Browse Source

refactor(nc-gui): use set for calculating unique values

pull/4135/head
Wing-Kam Wong 2 years ago
parent
commit
7adf48d0b9
  1. 6
      packages/nc-gui/utils/parsers/parserHelpers.ts

6
packages/nc-gui/utils/parsers/parserHelpers.ts

@ -63,9 +63,9 @@ export const extractMultiOrSingleSelectProps = (colData: []) => {
.split(/\s*,\s*/) .split(/\s*,\s*/)
: [], : [],
) )
const uniqueVals = (flattenedVals = flattenedVals.filter(
(v, i, arr) => i === arr.findIndex((v1) => v.toLowerCase() === v1.toLowerCase()), const uniqueVals = [...new Set(flattenedVals.map((v: any) => v.toString().trim().toLowerCase()))]
))
if (uniqueVals.length > maxSelectOptionsAllowed) { if (uniqueVals.length > maxSelectOptionsAllowed) {
// too many options are detected, convert the column to SingleLineText instead // too many options are detected, convert the column to SingleLineText instead
colProps.uidt = UITypes.SingleLineText colProps.uidt = UITypes.SingleLineText

Loading…
Cancel
Save