|
|
@ -20,11 +20,11 @@ const booleanOptions = [ |
|
|
|
] |
|
|
|
] |
|
|
|
const aggBooleanOptions: any = booleanOptions.reduce((obj, o) => ({ ...obj, ...o }), {}) |
|
|
|
const aggBooleanOptions: any = booleanOptions.reduce((obj, o) => ({ ...obj, ...o }), {}) |
|
|
|
|
|
|
|
|
|
|
|
const getColVal = (row: any, col = null) => { |
|
|
|
const getColVal = (row: any, col?: number) => { |
|
|
|
return row && col ? row[col] : row |
|
|
|
return row && col ? row[col] : row |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const isCheckboxType: any = (values: [], col = null) => { |
|
|
|
export const isCheckboxType: any = (values: [], col?: number) => { |
|
|
|
let options = booleanOptions |
|
|
|
let options = booleanOptions |
|
|
|
for (let i = 0; i < values.length; i++) { |
|
|
|
for (let i = 0; i < values.length; i++) { |
|
|
|
const val = getColVal(values[i], col) |
|
|
|
const val = getColVal(values[i], col) |
|
|
@ -45,7 +45,7 @@ export const getCheckboxValue = (value: any) => { |
|
|
|
return value && aggBooleanOptions[value] |
|
|
|
return value && aggBooleanOptions[value] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const isMultiLineTextType = (values: [], col = null) => { |
|
|
|
export const isMultiLineTextType = (values: [], col?: number) => { |
|
|
|
return values.some( |
|
|
|
return values.some( |
|
|
|
(r) => (getColVal(r, col) || '').toString().match(/[\r\n]/) || (getColVal(r, col) || '').toString().length > 255, |
|
|
|
(r) => (getColVal(r, col) || '').toString().match(/[\r\n]/) || (getColVal(r, col) || '').toString().length > 255, |
|
|
|
) |
|
|
|
) |
|
|
@ -107,13 +107,15 @@ export const isDecimalType = (colData: []) => |
|
|
|
return v && parseInt(v) !== +v |
|
|
|
return v && parseInt(v) !== +v |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
export const isEmailType = (colData: []) => |
|
|
|
export const isEmailType = (colData: [], col?: number) => |
|
|
|
colData.some((v: any) => { |
|
|
|
colData.some((r: any) => { |
|
|
|
|
|
|
|
const v = getColVal(r, col) |
|
|
|
return v && validateEmail(v) |
|
|
|
return v && validateEmail(v) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
export const isUrlType = (colData: []) => |
|
|
|
export const isUrlType = (colData: [], col?: number) => |
|
|
|
colData.some((v: any) => { |
|
|
|
colData.some((r: any) => { |
|
|
|
|
|
|
|
const v = getColVal(r, col) |
|
|
|
return v && isValidURL(v) |
|
|
|
return v && isValidURL(v) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|