Browse Source

feat(nc-gui): support single quote in select options during import

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

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

@ -78,7 +78,7 @@ export const extractMultiOrSingleSelectProps = (colData: []) => {
} }
// set dtxp here so that users can have the options even they switch the type from other types to MultiSelect // set dtxp here so that users can have the options even they switch the type from other types to MultiSelect
// once it's set, dtxp needs to be reset if the final column type is not MultiSelect // once it's set, dtxp needs to be reset if the final column type is not MultiSelect
colProps.dtxp = `'${uniqueVals.join("','")}'` colProps.dtxp = `${uniqueVals.map((v) => `'${v.replace(/'/gi, "''")}'`).join(',')}`
} }
} else { } else {
const uniqueVals = [...new Set(colData.map((v: any) => v.toString().trim().toLowerCase()))] const uniqueVals = [...new Set(colData.map((v: any) => v.toString().trim().toLowerCase()))]
@ -96,7 +96,7 @@ export const extractMultiOrSingleSelectProps = (colData: []) => {
} }
// set dtxp here so that users can have the options even they switch the type from other types to SingleSelect // set dtxp here so that users can have the options even they switch the type from other types to SingleSelect
// once it's set, dtxp needs to be reset if the final column type is not SingleSelect // once it's set, dtxp needs to be reset if the final column type is not SingleSelect
colProps.dtxp = `'${uniqueVals.join("','")}'` colProps.dtxp = `${uniqueVals.map((v) => `'${v.replace(/'/gi, "''")}'`).join(',')}`
} }
return colProps return colProps
} }

Loading…
Cancel
Save