Browse Source

fix(nc-gui): revise isCheckboxType logic

pull/6725/head
աɨռɢӄաօռɢ 1 year ago
parent
commit
76403ad667
  1. 7
      packages/nc-gui/helpers/parsers/parserHelpers.ts

7
packages/nc-gui/helpers/parsers/parserHelpers.ts

@ -29,17 +29,15 @@ 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)
if (val === null || val === undefined || val.toString().trim() === '') { if (val === null || val === undefined || val.toString().trim() === '') {
continue continue
} }
options = options.filter((v) => val in v) options = options.filter((v) => val in v)
if (!options.length) { if (!options.length) {
return false return false
} }
} }
return options return true
} }
export const getCheckboxValue = (value: any) => { export const getCheckboxValue = (value: any) => {
@ -161,8 +159,7 @@ export const getColumnUIDTAndMetas = (colData: [], defaultType: string) => {
if (isUrlType(colData)) { if (isUrlType(colData)) {
colProps.uidt = UITypes.URL colProps.uidt = UITypes.URL
} else { } else {
const checkboxType = isCheckboxType(colData) if (isCheckboxType(colData)) {
if (checkboxType.length === 1) {
colProps.uidt = UITypes.Checkbox colProps.uidt = UITypes.Checkbox
} else { } else {
Object.assign(colProps, extractMultiOrSingleSelectProps(colData)) Object.assign(colProps, extractMultiOrSingleSelectProps(colData))

Loading…
Cancel
Save