@erpsquad/common 1.8.114 → 1.8.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index/index.esm10.js +3 -3
- package/dist/_virtual/index/index.esm11.js +2 -4
- package/dist/_virtual/index/index.esm11.js.map +1 -1
- package/dist/_virtual/index/index.esm2.js +4 -2
- package/dist/_virtual/index/index.esm2.js.map +1 -1
- package/dist/_virtual/index/index.esm3.js +3 -3
- package/dist/_virtual/index/index.esm4.js +3 -3
- package/dist/_virtual/index/index.esm5.js +3 -3
- package/dist/_virtual/index/index.esm6.js +3 -3
- package/dist/_virtual/index/index.esm7.js +3 -3
- package/dist/_virtual/index/index.esm8.js +3 -3
- package/dist/_virtual/index/index.esm9.js +3 -3
- package/dist/_virtual/index/index10.js +1 -1
- package/dist/_virtual/index/index11.js +1 -1
- package/dist/_virtual/index/index2.js +1 -1
- package/dist/_virtual/index/index3.js +1 -1
- package/dist/_virtual/index/index4.js +1 -1
- package/dist/_virtual/index/index5.js +1 -1
- package/dist/_virtual/index/index6.js +1 -1
- package/dist/_virtual/index/index7.js +1 -1
- package/dist/_virtual/index/index8.js +1 -1
- package/dist/_virtual/index/index9.js +1 -1
- package/dist/components/form-control/form-parser/form-parser/index.esm.js +1 -1
- package/dist/components/form-control/form-parser/form-parser/index.js +1 -1
- package/dist/components/form-control/form-parser/form-parser/index.js.map +1 -1
- package/dist/index.esm.js +64 -64
- package/dist/index.js +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.esm.js +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js.map +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +2 -2
- package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
- package/dist/node_modules/@mui/system/createStyled/index.esm.js +6 -6
- package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
- package/dist/src/utils/form-builder-deconversion.d.ts +0 -43
- package/dist/style.css +70 -70
- package/dist/utils/form-builder-deconversion/index.esm.js +5 -4
- package/dist/utils/form-builder-deconversion/index.esm.js.map +1 -1
- package/dist/utils/form-builder-deconversion/index.js +1 -1
- package/dist/utils/form-builder-deconversion/index.js.map +1 -1
- package/dist/utils/form-builder-deconversion.d.ts +0 -43
- package/dist/utils/index.esm.js +4 -4
- package/dist/utils/index.js +1 -1
- package/dist/views/form-builder/utils/common/index.esm.js +1 -1
- package/dist/views/form-builder/utils/common/index.js +1 -1
- package/dist/views/form-builder/utils/common/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -55,7 +55,8 @@ const formBuilderDeConversion = (formData) => {
|
|
|
55
55
|
};
|
|
56
56
|
const checkIfSectionExist = currentTab.data.find((section) => section.label === (currentSection == null ? void 0 : currentSection.label));
|
|
57
57
|
if (!checkIfSectionExist) {
|
|
58
|
-
|
|
58
|
+
currentSection = { ...otherSectionDetails, ...currentSection };
|
|
59
|
+
currentTab.data.push(currentSection);
|
|
59
60
|
} else {
|
|
60
61
|
currentSection = checkIfSectionExist;
|
|
61
62
|
}
|
|
@@ -186,7 +187,8 @@ const formBuilderDeConversion = (formData) => {
|
|
|
186
187
|
};
|
|
187
188
|
const checkIfSectionExist = (_b = outputData == null ? void 0 : outputData.section) == null ? void 0 : _b.find((section) => section.label === (currentSection == null ? void 0 : currentSection.label));
|
|
188
189
|
if (!checkIfSectionExist) {
|
|
189
|
-
|
|
190
|
+
currentSection = { ...otherSectionDetails, ...currentSection };
|
|
191
|
+
outputData.section.push(currentSection);
|
|
190
192
|
} else {
|
|
191
193
|
currentSection = checkIfSectionExist;
|
|
192
194
|
}
|
|
@@ -306,7 +308,6 @@ const convertTableColumns = (columns) => {
|
|
|
306
308
|
};
|
|
307
309
|
export {
|
|
308
310
|
convertTableColumns,
|
|
309
|
-
formBuilderDeConversion as default
|
|
310
|
-
formBuilderDeConversion
|
|
311
|
+
formBuilderDeConversion as default
|
|
311
312
|
};
|
|
312
313
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../src/utils/form-builder-deconversion.ts"],"sourcesContent":["export type ItemType = {\n section_name: any;\n is_system_field: boolean;\n field_type: string;\n label: string;\n name?: string;\n placeholder: string;\n default_value: any;\n validation: any[];\n is_multiline: any;\n section_order: any;\n option?: any;\n time_format?: string;\n currency?: string;\n field_properties: {\n is_accordion?: boolean;\n float_step?: any;\n options: any;\n is_multiselect: any;\n title: string;\n title_position: \"start\" | \"end\";\n is_multiline: boolean\n is_checked: boolean\n table: string,\n table_columns: string[]\n table_rows?: any\n is_multiple: boolean\n enable_footer?: boolean\n footer_action?: 'add'\n other_buttons?:React.ReactNode[]\n };\n is_section_field?: true;\n section_type?: \"default\" | \"Form switcher section\";\n form_switcher_label?: string;\n form_switcher_name?: string;\n switcher_forms?: {\n value?: string;\n name?: string;\n id?: number;\n }[];\n is_accordion?: boolean;\n}\n\nconst getFirstNonSectionField = (formData: any[]) => {\n const firstField = formData?.find((field) => !field.is_section_field)\n return firstField\n}\n\nconst formBuilderDeConversion = (formData: any) => {\n const outputData: any = {};\n if (formData.length === 0) {\n return outputData;\n }\n\n const firstItem = getFirstNonSectionField(formData);\n\n if (firstItem?.tab_name) {\n outputData.tab = <any>[];\n let currentTab: {\n title: string;\n data: any;\n remove_tab?: any;\n tab_order?: any;\n } | null = null;\n let currentSection: {\n label: string;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach((item: any) => {\n if (item?.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n currentSection = null\n sectionOrder = sectionOrder++\n } else {\n if (!currentTab || currentTab.title !== item.tab_name) {\n\n currentTab = {\n tab_order: item.tab_order || 1,\n title: item.tab_name,\n data: [],\n };\n const checkIfTabExist = outputData.tab.find(tab => tab.title === currentTab?.title)\n\n if (!checkIfTabExist) {\n outputData.tab.push(currentTab);\n } else {\n currentTab = checkIfTabExist\n }\n currentSection = null;\n }\n\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = currentTab.data.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n currentTab.data.push({ ...otherSectionDetails, ...currentSection });\n } else {\n currentSection = checkIfSectionExist\n }\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label || \"\",\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find((v: { type: string }) => v.type === \"min_val\")\n ?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find((v: { type: string }) => v.type === \"max_val\")\n ?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties.float_step && {\n float_step: item.field_properties.float_step.toString(),\n }),\n ...(item.field_properties.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\" || item.field_type === \"radioButton\") && {\n title: item.field_properties?.title ? item.field_properties?.title : '',\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n if (currentSection) {\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n currentTab.remove_tab = currentTab.data.some(\n (section: { members: any[] }) =>\n section.members.some(\n (member: { type: string }) => member.type === \"system\",\n ),\n );\n }\n }\n });\n } else {\n // Convert to sections format\n outputData.section = [];\n let currentSection: {\n label: any;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach(\n (item: ItemType) => {\n if (item.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n sectionOrder = sectionOrder++\n currentSection = null\n } else {\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = outputData?.section?.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n outputData.section.push({ ...otherSectionDetails, ...currentSection });\n } else {\n currentSection = checkIfSectionExist\n }\n\n // outputData.section.push({ ...otherSectionDetails, ...currentSection });\n\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label,\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_val\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_val\",\n )?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties?.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties?.float_step && {\n float_step: Number(item.field_properties.float_step),\n }),\n ...(item.field_properties?.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties?.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\") && {\n title: item.field_properties?.title ? item.field_properties?.title : item.label,\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n }\n }\n );\n }\n\n return outputData;\n};\n\n\n\nfunction formatText(key: string): string {\n return key ? key\n .split(/[:_-]/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \") : key;\n}\n\nexport const convertTableColumns = (columns: string[]) => {\n if (!Array.isArray(columns)) return [];\n\n return columns.map(column => {\n if (typeof column === 'object') {\n return { ...column }\n } else {\n const colArr = column.split(\".\").filter(str => str)\n const header = colArr.length ? (colArr.length > 1 ? formatText(colArr[colArr.length - 1]) : formatText(colArr[0])) : \"-\"\n\n return {\n header,\n accessorKey: column,\n visible: true,\n }\n }\n })\n}\n\nexport { formBuilderDeConversion };\nexport default formBuilderDeConversion;\n"],"names":["member"],"mappings":"AA2CA,MAAM,0BAA0B,CAAC,aAAoB;AACnD,QAAM,aAAa,qCAAU,KAAK,CAAC,UAAU,CAAC,MAAM;AACpD,SAAO;AACT;AAEA,MAAM,0BAA0B,CAAC,aAAkB;AACjD,QAAM,aAAkB,CAAA;AACxB,MAAI,SAAS,WAAW,GAAG;AACzB,WAAO;AAAA,EACT;AAEA,QAAM,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AAY;AAAA,cACnC,QAAO,UAAK,qBAAL,mBAAuB;AAAA,cAC9B,eAAe,qBAAoB,UAAK,qBAAL,mBAAuB,aAAa;AAAA,cACvE,aAAY,UAAK,qBAAL,mBAAuB;AAAA,cACnC,gBAAc,UAAK,qBAAL,mBAAuB,kBAAiB,CAAA;AAAA,YAAC;AAAA,UACzD;AAGF,yBAAe,QAAQ,KAAK,MAAM;AAClC,cACE,eAAe,QAAQ,KAAK,CAACA,YAAgBA,QAAO,SAAS,QAAQ,GACrE;AACA,2BAAe,iBAAiB;AAAA,UAClC,OAAO;AACL,2BAAe,iBAAiB;AAAA,UAClC;AAAA,QACF;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO;AACT;AAIA,SAAS,WAAW,KAAqB;AACvC,SAAO,MAAM,IACV,MAAM,OAAO,EACb,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,EAAE,YAAA,IAAgB,KAAK,MAAM,CAAC,CAAC,EAC1D,KAAK,GAAG,IAAI;AACjB;AAEO,MAAM,sBAAsB,CAAC,YAAsB;AACxD,MAAI,CAAC,MAAM,QAAQ,OAAO,UAAU,CAAA;AAEpC,SAAO,QAAQ,IAAI,CAAA,WAAU;AAC3B,QAAI,OAAO,WAAW,UAAU;AAC9B,aAAO,EAAE,GAAG,OAAA;AAAA,IACd,OAAO;AACL,YAAM,SAAS,OAAO,MAAM,GAAG,EAAE,OAAO,SAAO,GAAG;AAClD,YAAM,SAAS,OAAO,SAAU,OAAO,SAAS,IAAI,WAAW,OAAO,OAAO,SAAS,CAAC,CAAC,IAAI,WAAW,OAAO,CAAC,CAAC,IAAK;AAErH,aAAO;AAAA,QACL;AAAA,QACA,aAAa;AAAA,QACb,SAAS;AAAA,MAAA;AAAA,IAEb;AAAA,EACF,CAAC;AACH;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../src/utils/form-builder-deconversion.ts"],"sourcesContent":["type ItemType = {\n section_name: any;\n is_system_field: boolean;\n field_type: string;\n label: string;\n name?: string;\n placeholder: string;\n default_value: any;\n validation: any[];\n is_multiline: any;\n section_order: any;\n option?: any;\n time_format?: string;\n currency?: string;\n field_properties: {\n is_accordion?: boolean;\n float_step?: any;\n options: any;\n is_multiselect: any;\n title: string;\n title_position: \"start\" | \"end\";\n is_multiline: boolean\n is_checked: boolean\n table: string,\n table_columns: string[]\n table_rows?: any\n is_multiple: boolean\n enable_footer?: boolean\n footer_action?: 'add'\n other_buttons?: React.ReactNode[]\n };\n is_section_field?: true;\n section_type?: \"default\" | \"Form switcher section\";\n form_switcher_label?: string;\n form_switcher_name?: string;\n switcher_forms?: {\n value?: string;\n name?: string;\n id?: number;\n }[];\n is_accordion?: boolean;\n}\n\nconst getFirstNonSectionField = (formData: any[]) => {\n const firstField = formData?.find((field) => !field.is_section_field)\n return firstField\n}\n\nconst formBuilderDeConversion = (formData: any) => {\n const outputData: any = {};\n if (formData.length === 0) {\n return outputData;\n }\n\n const firstItem = getFirstNonSectionField(formData);\n\n if (firstItem?.tab_name) {\n outputData.tab = <any>[];\n let currentTab: {\n title: string;\n data: any;\n remove_tab?: any;\n tab_order?: any;\n } | null = null;\n let currentSection: {\n label: string;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach((item: any) => {\n if (item?.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n currentSection = null\n sectionOrder = sectionOrder++\n } else {\n if (!currentTab || currentTab.title !== item.tab_name) {\n\n currentTab = {\n tab_order: item.tab_order || 1,\n title: item.tab_name,\n data: [],\n };\n const checkIfTabExist = outputData.tab.find(tab => tab.title === currentTab?.title)\n\n if (!checkIfTabExist) {\n outputData.tab.push(currentTab);\n } else {\n currentTab = checkIfTabExist\n }\n currentSection = null;\n }\n\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = currentTab.data.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n // Merge section details and update currentSection reference to the actual pushed object\n currentSection = { ...otherSectionDetails, ...currentSection };\n currentTab.data.push(currentSection);\n } else {\n currentSection = checkIfSectionExist\n }\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label || \"\",\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find((v: { type: string }) => v.type === \"min_val\")\n ?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find((v: { type: string }) => v.type === \"max_val\")\n ?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties.float_step && {\n float_step: item.field_properties.float_step.toString(),\n }),\n ...(item.field_properties.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\" || item.field_type === \"radioButton\") && {\n title: item.field_properties?.title ? item.field_properties?.title : '',\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n if (currentSection) {\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n currentTab.remove_tab = currentTab.data.some(\n (section: { members: any[] }) =>\n section.members.some(\n (member: { type: string }) => member.type === \"system\",\n ),\n );\n }\n }\n });\n } else {\n // Convert to sections format\n outputData.section = [];\n let currentSection: {\n label: any;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach(\n (item: ItemType) => {\n if (item.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n sectionOrder = sectionOrder++\n currentSection = null\n } else {\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = outputData?.section?.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n // Merge section details and update currentSection reference to the actual pushed object\n currentSection = { ...otherSectionDetails, ...currentSection };\n outputData.section.push(currentSection);\n } else {\n currentSection = checkIfSectionExist\n }\n\n // outputData.section.push({ ...otherSectionDetails, ...currentSection });\n\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label,\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_val\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_val\",\n )?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties?.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties?.float_step && {\n float_step: Number(item.field_properties.float_step),\n }),\n ...(item.field_properties?.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties?.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\") && {\n title: item.field_properties?.title ? item.field_properties?.title : item.label,\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n }\n }\n );\n }\n\n return outputData;\n};\n\n\n\nfunction formatText(key: string): string {\n return key ? key\n .split(/[:_-]/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \") : key;\n}\n\nexport const convertTableColumns = (columns: string[]) => {\n if (!Array.isArray(columns)) return [];\n\n return columns.map(column => {\n if (typeof column === 'object') {\n return { ...column }\n } else {\n const colArr = column.split(\".\").filter(str => str)\n const header = colArr.length ? (colArr.length > 1 ? formatText(colArr[colArr.length - 1]) : formatText(colArr[0])) : \"-\"\n\n return {\n header,\n accessorKey: column,\n visible: true,\n }\n }\n })\n}\n\nexport default formBuilderDeConversion;\n"],"names":["member"],"mappings":"AA2CA,MAAM,0BAA0B,CAAC,aAAoB;AACnD,QAAM,aAAa,qCAAU,KAAK,CAAC,UAAU,CAAC,MAAM;AACpD,SAAO;AACT;AAEA,MAAM,0BAA0B,CAAC,aAAkB;AACjD,QAAM,aAAkB,CAAA;AACxB,MAAI,SAAS,WAAW,GAAG;AACzB,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,wBAAwB,QAAQ;AAElD,MAAI,uCAAW,UAAU;AACvB,eAAW,MAAW,CAAA;AACtB,QAAI,aAKO;AACX,QAAI,iBAMO;AACX,QAAI,sBAA2B,CAAA;AAC/B,QAAI,eAAoB;AAExB,aAAS,QAAQ,CAAC,SAAc;AA/BpC;AAgCM,UAAI,6BAAM,kBAAkB;AAC1B,8BAAsB;AAAA,UACpB,YAAY,6BAAM;AAAA,UAClB,OAAO,6BAAM;AAAA,UACb,cAAc,6BAAM;AAAA,UACpB,kBAAkB,6BAAM;AAAA,UACxB,cAAc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rE;AACA,2BAAe,iBAAiB;AAAA,UAClC,OAAO;AACL,2BAAe,iBAAiB;AAAA,UAClC;AAAA,QACF;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO;AACT;AAIA,SAAS,WAAW,KAAqB;AACvC,SAAO,MAAM,IACV,MAAM,OAAO,EACb,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,EAAE,YAAA,IAAgB,KAAK,MAAM,CAAC,CAAC,EAC1D,KAAK,GAAG,IAAI;AACjB;AAEO,MAAM,sBAAsB,CAAC,YAAsB;AACxD,MAAI,CAAC,MAAM,QAAQ,OAAO,UAAU,CAAA;AAEpC,SAAO,QAAQ,IAAI,CAAA,WAAU;AAC3B,QAAI,OAAO,WAAW,UAAU;AAC9B,aAAO,EAAE,GAAG,OAAA;AAAA,IACd,OAAO;AACL,YAAM,SAAS,OAAO,MAAM,GAAG,EAAE,OAAO,SAAO,GAAG;AAClD,YAAM,SAAS,OAAO,SAAU,OAAO,SAAS,IAAI,WAAW,OAAO,OAAO,SAAS,CAAC,CAAC,IAAI,WAAW,OAAO,CAAC,CAAC,IAAK;AAErH,aAAO;AAAA,QACL;AAAA,QACA,aAAa;AAAA,QACb,SAAS;AAAA,MAAA;AAAA,IAEb;AAAA,EACF,CAAC;AACH;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=e=>{const
|
|
1
|
+
"use strict";function e(e){return e?e.split(/[:_-]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):e}Object.defineProperty(exports,"__esModule",{value:!0});const l=l=>Array.isArray(l)?l.map(l=>{if("object"==typeof l)return{...l};{const i=l.split(".").filter(e=>e);return{header:i.length?i.length>1?e(i[i.length-1]):e(i[0]):"-",accessorKey:l,visible:!0}}}):[];exports.convertTableColumns=l,exports.default=e=>{const i={};if(0===e.length)return i;const t=(e=>null==e?void 0:e.find(e=>!e.is_section_field))(e);if(null==t?void 0:t.tab_name){i.tab=[];let t=null,o=null,d={},n=null;e.forEach(e=>{var _,s,r,a,u,p,f,v,m,c,y,b,h,w,g,x,q,B,k,z,$,j,A,M;if(null==e?void 0:e.is_section_field)d={field_type:null==e?void 0:e.field_type,label:null==e?void 0:e.label,is_accordion:null==e?void 0:e.is_accordion,is_section_field:null==e?void 0:e.is_section_field,section_type:null==e?void 0:e.section_type,form_switcher_label:null==e?void 0:e.form_switcher_label,form_switcher_name:null==e?void 0:e.form_switcher_name,switcher_forms:null==e?void 0:e.switcher_forms,disabled:Boolean(null==e?void 0:e.disabled)},o=null,n=n++;else{if(!t||t.title!==e.tab_name){t={tab_order:e.tab_order||1,title:e.tab_name,data:[]};const l=i.tab.find(e=>e.title===(null==t?void 0:t.title));l?t=l:i.tab.push(t),o=null}if(!o||o.label!==e.section_name||n!==e.section_order){o={field_type:"section",label:e.section_name||"",is_accordion:null==(_=e.field_properties)?void 0:_.is_accordion,members:[],remove_section:!0===e.is_system_field};const l=t.data.find(e=>e.label===(null==o?void 0:o.label));l?o=l:(o={...d,...o},t.data.push(o)),d=null}n=e.section_order;const C=(null==(r=null==(s=null==e?void 0:e.validation)?void 0:s.find(e=>"when"===e.type))?void 0:r.thenValidations)||[],D={...e,id:`${Date.now()}-${Math.random()}`,field_type:"media"===e.field_type?"file":e.field_type||"text",type:e.is_system_field?"system":"custom",label:e.label||"",placeholder:e.placeholder||"",default_value:e.default_value||"",...(null==e?void 0:e.time_format)&&"time"===(null==e?void 0:e.field_type)&&{option:null==e?void 0:e.time_format},...(null==e?void 0:e.currency)&&"currency"===(null==e?void 0:e.field_type)&&{option:null==e?void 0:e.currency},..."text"===e.field_type&&{min_length:(null==(a=e.validation.find(e=>"min_length"===e.type))?void 0:a.value)||null},..."text"===e.field_type&&{max_length:(null==(u=e.validation.find(e=>"max_length"===e.type))?void 0:u.value)||null},..."number"===e.field_type&&{min_length:(null==(p=e.validation.find(e=>"min_val"===e.type))?void 0:p.value)||null},..."number"===e.field_type&&{max_length:(null==(f=e.validation.find(e=>"max_val"===e.type))?void 0:f.value)||null},...(void 0!==e.is_multiline||void 0!==e.field_properties.is_multiline)&&{is_multiline:e.is_multiline||e.field_properties.is_multiline},is_required:(null==(v=e.validation.find(e=>"required"===e.type))?void 0:v.value)||(null==(m=null==C?void 0:C.find(e=>"required"===e.type))?void 0:m.value)||!1,is_unique:(null==(c=e.validation.find(e=>"unique"===e.type))?void 0:c.value)||!1,section_order:e.section_order||0,...e.field_properties.float_step&&{float_step:e.field_properties.float_step.toString()},...e.field_properties.options&&{options:e.field_properties.options},...void 0!==e.field_properties.is_multiselect&&{is_multiselect:e.field_properties.is_multiselect},...void 0!==(null==(y=e.field_properties)?void 0:y.enable_footer)&&{enable_footer:Boolean(e.field_properties.enable_footer)},...void 0!==(null==(b=e.field_properties)?void 0:b.footer_action)&&{footer_action:e.field_properties.footer_action||"add"},..."date"===e.field_type&&{is_future_dates_allowed:(null==(h=e.validation.find(e=>"is_future_dates_allowed"===e.type))?void 0:h.value)||null},..."date"===e.field_type&&{is_past_dates_allowed:(null==(w=e.validation.find(e=>"is_past_dates_allowed"===e.type))?void 0:w.value)||null},...("image"===e.field_type||"media"===e.field_type||"file"===e.field_type)&&{max_size:(null==(g=e.validation.find(e=>"max_file_size"===e.type))?void 0:g.value)||void 0,is_multiple:null==(x=e.field_properties)?void 0:x.is_multiple},...("toggleButton"===e.field_type||"checkbox"===e.field_type||"radioButton"===e.field_type)&&{title:(null==(q=e.field_properties)?void 0:q.title)?null==(B=e.field_properties)?void 0:B.title:"",title_position:(null==(k=e.field_properties)?void 0:k.title_position)??"end",is_checked:null==(z=e.field_properties)?void 0:z.is_checked},..."table"===e.field_type&&{table:null==($=e.field_properties)?void 0:$.table,table_columns:l(null==(j=e.field_properties)?void 0:j.table_columns),table_rows:null==(A=e.field_properties)?void 0:A.table_rows,otherButtons:(null==(M=e.field_properties)?void 0:M.other_buttons)||[]}};o&&(o.members.push(D),o.members.some(e=>"system"===e.type)?o.remove_section=!0:o.remove_section=!1,t.remove_tab=t.data.some(e=>e.members.some(e=>"system"===e.type)))}})}else{i.section=[];let t=null,o={},d=null;e.forEach(e=>{var n,_,s,r,a,u,p,f,v,m,c,y,b,h,w,g,x,q,B,k,z,$,j,A,M,C,D,E,V;if(e.is_section_field)o={field_type:null==e?void 0:e.field_type,label:null==e?void 0:e.label,is_accordion:null==e?void 0:e.is_accordion,is_section_field:null==e?void 0:e.is_section_field,section_type:null==e?void 0:e.section_type,form_switcher_label:null==e?void 0:e.form_switcher_label,form_switcher_name:null==e?void 0:e.form_switcher_name,switcher_forms:null==e?void 0:e.switcher_forms,disabled:Boolean(null==e?void 0:e.disabled)},d=d++,t=null;else{if(!t||t.label!==e.section_name||d!==e.section_order){t={field_type:"section",label:e.section_name||"",is_accordion:null==(n=e.field_properties)?void 0:n.is_accordion,members:[],remove_section:!0===e.is_system_field};const l=null==(_=null==i?void 0:i.section)?void 0:_.find(e=>e.label===(null==t?void 0:t.label));l?t=l:(t={...o,...t},i.section.push(t)),o=null}d=e.section_order;const K=(null==(r=null==(s=null==e?void 0:e.validation)?void 0:s.find(e=>"when"===e.type))?void 0:r.thenValidations)||[],N={...e,id:`${Date.now()}-${Math.random()}`,field_type:"media"===e.field_type?"file":e.field_type||"text",type:e.is_system_field?"system":"custom",label:e.label,placeholder:e.placeholder||"",default_value:e.default_value||"",...(null==e?void 0:e.time_format)&&"time"===(null==e?void 0:e.field_type)&&{option:null==e?void 0:e.time_format},...(null==e?void 0:e.currency)&&"currency"===(null==e?void 0:e.field_type)&&{option:null==e?void 0:e.currency},..."text"===e.field_type&&{min_length:(null==(a=e.validation.find(e=>"min_length"===e.type))?void 0:a.value)||null},..."text"===e.field_type&&{max_length:(null==(u=e.validation.find(e=>"max_length"===e.type))?void 0:u.value)||null},..."number"===e.field_type&&{min_length:(null==(p=e.validation.find(e=>"min_val"===e.type))?void 0:p.value)||null},..."number"===e.field_type&&{max_length:(null==(f=e.validation.find(e=>"max_val"===e.type))?void 0:f.value)||null},...(void 0!==e.is_multiline||void 0!==(null==(v=e.field_properties)?void 0:v.is_multiline))&&{is_multiline:e.is_multiline||e.field_properties.is_multiline},is_required:(null==(m=e.validation.find(e=>"required"===e.type))?void 0:m.value)||(null==(c=null==K?void 0:K.find(e=>"required"===e.type))?void 0:c.value)||!1,is_unique:(null==(y=e.validation.find(e=>"unique"===e.type))?void 0:y.value)||!1,section_order:e.section_order||0,...(null==(b=e.field_properties)?void 0:b.float_step)&&{float_step:Number(e.field_properties.float_step)},...(null==(h=e.field_properties)?void 0:h.options)&&{options:e.field_properties.options},...void 0!==(null==(w=e.field_properties)?void 0:w.is_multiselect)&&{is_multiselect:e.field_properties.is_multiselect},...void 0!==(null==(g=e.field_properties)?void 0:g.enable_footer)&&{enable_footer:Boolean(e.field_properties.enable_footer)},...void 0!==(null==(x=e.field_properties)?void 0:x.footer_action)&&{footer_action:e.field_properties.footer_action||"add"},..."date"===e.field_type&&{is_future_dates_allowed:(null==(q=e.validation.find(e=>"is_future_dates_allowed"===e.type))?void 0:q.value)||null},..."date"===e.field_type&&{is_past_dates_allowed:(null==(B=e.validation.find(e=>"is_past_dates_allowed"===e.type))?void 0:B.value)||null},...("image"===e.field_type||"media"===e.field_type||"file"===e.field_type)&&{max_size:(null==(k=e.validation.find(e=>"max_file_size"===e.type))?void 0:k.value)||void 0,is_multiple:null==(z=e.field_properties)?void 0:z.is_multiple},...("toggleButton"===e.field_type||"checkbox"===e.field_type)&&{title:(null==($=e.field_properties)?void 0:$.title)?null==(j=e.field_properties)?void 0:j.title:e.label,title_position:(null==(A=e.field_properties)?void 0:A.title_position)??"end",is_checked:null==(M=e.field_properties)?void 0:M.is_checked},..."table"===e.field_type&&{table:null==(C=e.field_properties)?void 0:C.table,table_columns:l(null==(D=e.field_properties)?void 0:D.table_columns),table_rows:null==(E=e.field_properties)?void 0:E.table_rows,otherButtons:(null==(V=e.field_properties)?void 0:V.other_buttons)||[]}};t.members.push(N),t.members.some(e=>"system"===e.type)?t.remove_section=!0:t.remove_section=!1}})}return i};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/utils/form-builder-deconversion.ts"],"sourcesContent":["export type ItemType = {\n section_name: any;\n is_system_field: boolean;\n field_type: string;\n label: string;\n name?: string;\n placeholder: string;\n default_value: any;\n validation: any[];\n is_multiline: any;\n section_order: any;\n option?: any;\n time_format?: string;\n currency?: string;\n field_properties: {\n is_accordion?: boolean;\n float_step?: any;\n options: any;\n is_multiselect: any;\n title: string;\n title_position: \"start\" | \"end\";\n is_multiline: boolean\n is_checked: boolean\n table: string,\n table_columns: string[]\n table_rows?: any\n is_multiple: boolean\n enable_footer?: boolean\n footer_action?: 'add'\n other_buttons?:React.ReactNode[]\n };\n is_section_field?: true;\n section_type?: \"default\" | \"Form switcher section\";\n form_switcher_label?: string;\n form_switcher_name?: string;\n switcher_forms?: {\n value?: string;\n name?: string;\n id?: number;\n }[];\n is_accordion?: boolean;\n}\n\nconst getFirstNonSectionField = (formData: any[]) => {\n const firstField = formData?.find((field) => !field.is_section_field)\n return firstField\n}\n\nconst formBuilderDeConversion = (formData: any) => {\n const outputData: any = {};\n if (formData.length === 0) {\n return outputData;\n }\n\n const firstItem = getFirstNonSectionField(formData);\n\n if (firstItem?.tab_name) {\n outputData.tab = <any>[];\n let currentTab: {\n title: string;\n data: any;\n remove_tab?: any;\n tab_order?: any;\n } | null = null;\n let currentSection: {\n label: string;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach((item: any) => {\n if (item?.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n currentSection = null\n sectionOrder = sectionOrder++\n } else {\n if (!currentTab || currentTab.title !== item.tab_name) {\n\n currentTab = {\n tab_order: item.tab_order || 1,\n title: item.tab_name,\n data: [],\n };\n const checkIfTabExist = outputData.tab.find(tab => tab.title === currentTab?.title)\n\n if (!checkIfTabExist) {\n outputData.tab.push(currentTab);\n } else {\n currentTab = checkIfTabExist\n }\n currentSection = null;\n }\n\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = currentTab.data.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n currentTab.data.push({ ...otherSectionDetails, ...currentSection });\n } else {\n currentSection = checkIfSectionExist\n }\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label || \"\",\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find((v: { type: string }) => v.type === \"min_val\")\n ?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find((v: { type: string }) => v.type === \"max_val\")\n ?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties.float_step && {\n float_step: item.field_properties.float_step.toString(),\n }),\n ...(item.field_properties.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\" || item.field_type === \"radioButton\") && {\n title: item.field_properties?.title ? item.field_properties?.title : '',\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n if (currentSection) {\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n currentTab.remove_tab = currentTab.data.some(\n (section: { members: any[] }) =>\n section.members.some(\n (member: { type: string }) => member.type === \"system\",\n ),\n );\n }\n }\n });\n } else {\n // Convert to sections format\n outputData.section = [];\n let currentSection: {\n label: any;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach(\n (item: ItemType) => {\n if (item.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n sectionOrder = sectionOrder++\n currentSection = null\n } else {\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = outputData?.section?.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n outputData.section.push({ ...otherSectionDetails, ...currentSection });\n } else {\n currentSection = checkIfSectionExist\n }\n\n // outputData.section.push({ ...otherSectionDetails, ...currentSection });\n\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label,\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_val\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_val\",\n )?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties?.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties?.float_step && {\n float_step: Number(item.field_properties.float_step),\n }),\n ...(item.field_properties?.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties?.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\") && {\n title: item.field_properties?.title ? item.field_properties?.title : item.label,\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n }\n }\n );\n }\n\n return outputData;\n};\n\n\n\nfunction formatText(key: string): string {\n return key ? key\n .split(/[:_-]/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \") : key;\n}\n\nexport const convertTableColumns = (columns: string[]) => {\n if (!Array.isArray(columns)) return [];\n\n return columns.map(column => {\n if (typeof column === 'object') {\n return { ...column }\n } else {\n const colArr = column.split(\".\").filter(str => str)\n const header = colArr.length ? (colArr.length > 1 ? formatText(colArr[colArr.length - 1]) : formatText(colArr[0])) : \"-\"\n\n return {\n header,\n accessorKey: column,\n visible: true,\n }\n }\n })\n}\n\nexport { formBuilderDeConversion };\nexport default formBuilderDeConversion;\n"],"names":["formBuilderDeConversion","formData","outputData","length","firstItem","find","field","is_section_field","getFirstNonSectionField","tab_name","tab","currentTab","currentSection","otherSectionDetails","sectionOrder","forEach","item","field_type","label","is_accordion","section_type","form_switcher_label","form_switcher_name","switcher_forms","disabled","Boolean","title","tab_order","data","checkIfTabExist","push","section_name","section_order","_a","field_properties","members","remove_section","is_system_field","checkIfSectionExist","section","thenValidations","_c","_b","validation","v","type","member","id","Date","now","Math","random","placeholder","default_value","time_format","option","currency","min_length","_d","value","max_length","_e","_f","_g","is_multiline","is_required","_h","_i","is_unique","_j","float_step","toString","options","is_multiselect","_k","enable_footer","_l","footer_action","is_future_dates_allowed","_m","is_past_dates_allowed","_n","max_size","_o","is_multiple","_p","_q","_r","title_position","_s","is_checked","_t","table","_u","table_columns","convertTableColumns","_v","table_rows","_w","otherButtons","_x","other_buttons","some","remove_tab","Number","_y","_z","_A","_B","_C","formatText","key","split","map","word","charAt","toUpperCase","slice","join","columns","Array","isArray","column","colArr","filter","str","header","accessorKey","visible"],"mappings":"oEA2CA,MAKMA,EAA2BC,IAC/B,MAAMC,EAAkB,CAAA,EACxB,GAAwB,IAApBD,EAASE,OACX,OAAOD,EAGT,MAAME,EAXwB,CAACH,GACZ,MAAAA,OAAA,EAAAA,EAAUI,KAAMC,IAAWA,EAAMC,kBAUlCC,CAAwBP,GAE1C,SAAIG,WAAWK,SAAU,CACvBP,EAAWQ,IAAW,GACtB,IAAIC,EAKO,KACPC,EAMO,KACPC,EAA2B,CAAA,EAC3BC,EAAoB,KAExBb,EAASc,QAASC,wDAChB,SAAIA,WAAMT,iBACRM,EAAsB,CACpBI,WAAY,MAAAD,OAAA,EAAAA,EAAMC,WAClBC,MAAO,MAAAF,OAAA,EAAAA,EAAME,MACbC,aAAc,MAAAH,OAAA,EAAAA,EAAMG,aACpBZ,iBAAkB,MAAAS,OAAA,EAAAA,EAAMT,iBACxBa,aAAc,MAAAJ,OAAA,EAAAA,EAAMI,aACpBC,oBAAqB,MAAAL,OAAA,EAAAA,EAAMK,oBAC3BC,mBAAoB,MAAAN,OAAA,EAAAA,EAAMM,mBAC1BC,eAAgB,MAAAP,OAAA,EAAAA,EAAMO,eACtBC,SAAUC,QAAQ,MAAAT,OAAA,EAAAA,EAAMQ,WAE1BZ,EAAiB,KACjBE,EAAeA,QACV,CACL,IAAKH,GAAcA,EAAWe,QAAUV,EAAKP,SAAU,CAErDE,EAAa,CACXgB,UAAWX,EAAKW,WAAa,EAC7BD,MAAOV,EAAKP,SACZmB,KAAM,IAER,MAAMC,EAAkB3B,EAAWQ,IAAIL,QAAYK,EAAIgB,SAAU,MAAAf,OAAA,EAAAA,EAAYe,QAExEG,EAGHlB,EAAakB,EAFb3B,EAAWQ,IAAIoB,KAAKnB,GAItBC,EAAiB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type ItemType = {\n section_name: any;\n is_system_field: boolean;\n field_type: string;\n label: string;\n name?: string;\n placeholder: string;\n default_value: any;\n validation: any[];\n is_multiline: any;\n section_order: any;\n option?: any;\n time_format?: string;\n currency?: string;\n field_properties: {\n is_accordion?: boolean;\n float_step?: any;\n options: any;\n is_multiselect: any;\n title: string;\n title_position: \"start\" | \"end\";\n is_multiline: boolean\n is_checked: boolean\n table: string,\n table_columns: string[]\n table_rows?: any\n is_multiple: boolean\n enable_footer?: boolean\n footer_action?: 'add'\n other_buttons?: React.ReactNode[]\n };\n is_section_field?: true;\n section_type?: \"default\" | \"Form switcher section\";\n form_switcher_label?: string;\n form_switcher_name?: string;\n switcher_forms?: {\n value?: string;\n name?: string;\n id?: number;\n }[];\n is_accordion?: boolean;\n}\n\nconst getFirstNonSectionField = (formData: any[]) => {\n const firstField = formData?.find((field) => !field.is_section_field)\n return firstField\n}\n\nconst formBuilderDeConversion = (formData: any) => {\n const outputData: any = {};\n if (formData.length === 0) {\n return outputData;\n }\n\n const firstItem = getFirstNonSectionField(formData);\n\n if (firstItem?.tab_name) {\n outputData.tab = <any>[];\n let currentTab: {\n title: string;\n data: any;\n remove_tab?: any;\n tab_order?: any;\n } | null = null;\n let currentSection: {\n label: string;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach((item: any) => {\n if (item?.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n currentSection = null\n sectionOrder = sectionOrder++\n } else {\n if (!currentTab || currentTab.title !== item.tab_name) {\n\n currentTab = {\n tab_order: item.tab_order || 1,\n title: item.tab_name,\n data: [],\n };\n const checkIfTabExist = outputData.tab.find(tab => tab.title === currentTab?.title)\n\n if (!checkIfTabExist) {\n outputData.tab.push(currentTab);\n } else {\n currentTab = checkIfTabExist\n }\n currentSection = null;\n }\n\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = currentTab.data.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n // Merge section details and update currentSection reference to the actual pushed object\n currentSection = { ...otherSectionDetails, ...currentSection };\n currentTab.data.push(currentSection);\n } else {\n currentSection = checkIfSectionExist\n }\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label || \"\",\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find((v: { type: string }) => v.type === \"min_val\")\n ?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find((v: { type: string }) => v.type === \"max_val\")\n ?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties.float_step && {\n float_step: item.field_properties.float_step.toString(),\n }),\n ...(item.field_properties.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\" || item.field_type === \"radioButton\") && {\n title: item.field_properties?.title ? item.field_properties?.title : '',\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n if (currentSection) {\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n currentTab.remove_tab = currentTab.data.some(\n (section: { members: any[] }) =>\n section.members.some(\n (member: { type: string }) => member.type === \"system\",\n ),\n );\n }\n }\n });\n } else {\n // Convert to sections format\n outputData.section = [];\n let currentSection: {\n label: any;\n members: any;\n remove_section: any;\n field_type?: string;\n is_accordion?: boolean;\n } | null = null;\n let otherSectionDetails: any = {}\n let sectionOrder: any = null\n\n formData.forEach(\n (item: ItemType) => {\n if (item.is_section_field) {\n otherSectionDetails = {\n field_type: item?.field_type,\n label: item?.label,\n is_accordion: item?.is_accordion,\n is_section_field: item?.is_section_field,\n section_type: item?.section_type,\n form_switcher_label: item?.form_switcher_label,\n form_switcher_name: item?.form_switcher_name,\n switcher_forms: item?.switcher_forms,\n disabled: Boolean(item?.disabled)\n }\n sectionOrder = sectionOrder++\n currentSection = null\n } else {\n if (!currentSection || currentSection.label !== item.section_name || sectionOrder !== item.section_order) {\n currentSection = {\n field_type: \"section\",\n label: item.section_name || \"\",\n is_accordion: item.field_properties?.is_accordion,\n members: [],\n remove_section: item.is_system_field === true ? true : false,\n };\n\n const checkIfSectionExist = outputData?.section?.find(section => section.label === currentSection?.label)\n if (!checkIfSectionExist) {\n // Merge section details and update currentSection reference to the actual pushed object\n currentSection = { ...otherSectionDetails, ...currentSection };\n outputData.section.push(currentSection);\n } else {\n currentSection = checkIfSectionExist\n }\n\n // outputData.section.push({ ...otherSectionDetails, ...currentSection });\n\n otherSectionDetails = null\n }\n sectionOrder = item.section_order\n\n const thenValidations = item?.validation?.find((v: { type: string }) => v.type === \"when\")?.thenValidations || []\n\n const member = {\n ...item,\n id: `${Date.now()}-${Math.random()}`,\n field_type:\n item.field_type === \"media\" ? \"file\" : item.field_type || \"text\",\n type: item.is_system_field ? \"system\" : \"custom\",\n label: item.label,\n placeholder: item.placeholder || \"\",\n default_value: item.default_value || \"\",\n ...(item?.time_format &&\n item?.field_type === \"time\" && { option: item?.time_format }),\n ...(item?.currency &&\n item?.field_type === \"currency\" && { option: item?.currency }),\n ...(item.field_type === \"text\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"text\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_length\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n min_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"min_val\",\n )?.value || null,\n }),\n ...(item.field_type === \"number\" && {\n max_length:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_val\",\n )?.value || null,\n }),\n ...((item.is_multiline !== undefined || item.field_properties?.is_multiline !== undefined) && {\n is_multiline: item.is_multiline || item.field_properties.is_multiline,\n }),\n is_required:\n item.validation.find((v: { type: string }) => v.type === \"required\")?.value ||\n thenValidations?.find((v: { type: string }) => v.type === \"required\")?.value ||\n false,\n is_unique:\n item.validation.find((v: { type: string }) => v.type === \"unique\")\n ?.value || false,\n section_order: item.section_order || 0,\n ...(item.field_properties?.float_step && {\n float_step: Number(item.field_properties.float_step),\n }),\n ...(item.field_properties?.options && {\n options: item.field_properties.options,\n }),\n ...(item.field_properties?.is_multiselect !== undefined && {\n is_multiselect: item.field_properties.is_multiselect,\n }),\n ...(item.field_properties?.enable_footer !== undefined && {\n enable_footer: Boolean(item.field_properties.enable_footer),\n }),\n ...(item.field_properties?.footer_action !== undefined && {\n footer_action: item.field_properties.footer_action || 'add',\n }),\n ...(item.field_type === \"date\" && {\n is_future_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_future_dates_allowed\",\n )?.value || null,\n }),\n ...(item.field_type === \"date\" && {\n is_past_dates_allowed:\n item.validation.find(\n (v: { type: string }) => v.type === \"is_past_dates_allowed\",\n )?.value || null,\n }),\n ...((item.field_type === \"image\" || item.field_type === \"media\" || item.field_type === \"file\") && {\n max_size:\n item.validation.find(\n (v: { type: string }) => v.type === \"max_file_size\",\n )?.value || undefined,\n is_multiple: item.field_properties?.is_multiple\n }),\n ...((item.field_type === \"toggleButton\" || item.field_type === \"checkbox\") && {\n title: item.field_properties?.title ? item.field_properties?.title : item.label,\n title_position: item.field_properties?.title_position ?? \"end\",\n is_checked: item.field_properties?.is_checked\n }),\n ...((item.field_type === \"table\") && {\n table: item.field_properties?.table,\n table_columns: convertTableColumns(item.field_properties?.table_columns),\n table_rows: item.field_properties?.table_rows,\n otherButtons: item.field_properties?.other_buttons || []\n }),\n };\n\n currentSection.members.push(member);\n if (\n currentSection.members.some((member: any) => member.type === \"system\")\n ) {\n currentSection.remove_section = true;\n } else {\n currentSection.remove_section = false;\n }\n }\n }\n );\n }\n\n return outputData;\n};\n\n\n\nfunction formatText(key: string): string {\n return key ? key\n .split(/[:_-]/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \") : key;\n}\n\nexport const convertTableColumns = (columns: string[]) => {\n if (!Array.isArray(columns)) return [];\n\n return columns.map(column => {\n if (typeof column === 'object') {\n return { ...column }\n } else {\n const colArr = column.split(\".\").filter(str => str)\n const header = colArr.length ? (colArr.length > 1 ? formatText(colArr[colArr.length - 1]) : formatText(colArr[0])) : \"-\"\n\n return {\n header,\n accessorKey: column,\n visible: true,\n }\n }\n })\n}\n\nexport default formBuilderDeConversion;\n"],"names":["formatText","key","split","map","word","charAt","toUpperCase","slice","join","convertTableColumns","columns","Array","isArray","column","colArr","filter","str","header","length","accessorKey","visible","formData","outputData","firstItem","find","field","is_section_field","getFirstNonSectionField","tab_name","tab","currentTab","currentSection","otherSectionDetails","sectionOrder","forEach","item","field_type","label","is_accordion","section_type","form_switcher_label","form_switcher_name","switcher_forms","disabled","Boolean","title","tab_order","data","checkIfTabExist","push","section_name","section_order","_a","field_properties","members","remove_section","is_system_field","checkIfSectionExist","section","thenValidations","_c","_b","validation","v","type","member","id","Date","now","Math","random","placeholder","default_value","time_format","option","currency","min_length","_d","value","max_length","_e","_f","_g","is_multiline","is_required","_h","_i","is_unique","_j","float_step","toString","options","is_multiselect","_k","enable_footer","_l","footer_action","is_future_dates_allowed","_m","is_past_dates_allowed","_n","max_size","_o","is_multiple","_p","_q","_r","title_position","_s","is_checked","_t","table","_u","table_columns","_v","table_rows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
|
7
|
-
placeholder: string;
|
|
8
|
-
default_value: any;
|
|
9
|
-
validation: any[];
|
|
10
|
-
is_multiline: any;
|
|
11
|
-
section_order: any;
|
|
12
|
-
option?: any;
|
|
13
|
-
time_format?: string;
|
|
14
|
-
currency?: string;
|
|
15
|
-
field_properties: {
|
|
16
|
-
is_accordion?: boolean;
|
|
17
|
-
float_step?: any;
|
|
18
|
-
options: any;
|
|
19
|
-
is_multiselect: any;
|
|
20
|
-
title: string;
|
|
21
|
-
title_position: "start" | "end";
|
|
22
|
-
is_multiline: boolean;
|
|
23
|
-
is_checked: boolean;
|
|
24
|
-
table: string;
|
|
25
|
-
table_columns: string[];
|
|
26
|
-
table_rows?: any;
|
|
27
|
-
is_multiple: boolean;
|
|
28
|
-
enable_footer?: boolean;
|
|
29
|
-
footer_action?: 'add';
|
|
30
|
-
other_buttons?: React.ReactNode[];
|
|
31
|
-
};
|
|
32
|
-
is_section_field?: true;
|
|
33
|
-
section_type?: "default" | "Form switcher section";
|
|
34
|
-
form_switcher_label?: string;
|
|
35
|
-
form_switcher_name?: string;
|
|
36
|
-
switcher_forms?: {
|
|
37
|
-
value?: string;
|
|
38
|
-
name?: string;
|
|
39
|
-
id?: number;
|
|
40
|
-
}[];
|
|
41
|
-
is_accordion?: boolean;
|
|
42
|
-
};
|
|
43
1
|
declare const formBuilderDeConversion: (formData: any) => any;
|
|
44
2
|
export declare const convertTableColumns: (columns: string[]) => any[];
|
|
45
|
-
export { formBuilderDeConversion };
|
|
46
3
|
export default formBuilderDeConversion;
|
package/dist/utils/index.esm.js
CHANGED
|
@@ -13,7 +13,7 @@ import { deFormatText } from "./deformat-text/index.esm.js";
|
|
|
13
13
|
import { specificFilters, subModuleMappings } from "./export-filters/index.esm.js";
|
|
14
14
|
import { fileSize } from "./fileSize/index.esm.js";
|
|
15
15
|
import { formBuilderConversion } from "./form-builder-conversion/index.esm.js";
|
|
16
|
-
import { convertTableColumns,
|
|
16
|
+
import { convertTableColumns, default as default2 } from "./form-builder-deconversion/index.esm.js";
|
|
17
17
|
import { convertToUnderscore, formatLabel, formatText } from "./format-text/index.esm.js";
|
|
18
18
|
import "./i18n/index.esm.js";
|
|
19
19
|
import { fetchLanguages } from "./language/index.esm.js";
|
|
@@ -23,7 +23,7 @@ import { createParameterizedNavigationHandler, migrateRoutesToUseParams, migrate
|
|
|
23
23
|
import { getEntityId, navigateWithId } from "./navigation-utils/index.esm.js";
|
|
24
24
|
import { convertRoutesToUseIdParams, generateRouteWithId, navigateToRouteWithId, updatePathnameWithIdParams } from "./route-utils/index.esm.js";
|
|
25
25
|
import { loadModuleTranslations } from "./translations/index.esm.js";
|
|
26
|
-
import { default as
|
|
26
|
+
import { default as default3 } from "i18next";
|
|
27
27
|
import { setBaseUrl } from "../api-client/api.rbac/api/index.esm.js";
|
|
28
28
|
import { setBaseUrl as setBaseUrl2 } from "../api-client/api.drive/api/index.esm.js";
|
|
29
29
|
import { setBaseUrl as setBaseUrl3 } from "../api-client/api.system-feature/api/index.esm.js";
|
|
@@ -92,7 +92,7 @@ export {
|
|
|
92
92
|
filterCoaByCompanyIdOrNull,
|
|
93
93
|
findById,
|
|
94
94
|
formBuilderConversion,
|
|
95
|
-
formBuilderDeConversion,
|
|
95
|
+
default2 as formBuilderDeConversion,
|
|
96
96
|
formatAmount,
|
|
97
97
|
formatAmountWithCurrency,
|
|
98
98
|
formatAmountWithCurrencyData,
|
|
@@ -149,7 +149,7 @@ export {
|
|
|
149
149
|
handleCompareDateRangeSync,
|
|
150
150
|
handleRegularUpload,
|
|
151
151
|
hasValue,
|
|
152
|
-
|
|
152
|
+
default3 as i18n,
|
|
153
153
|
initializeApiBaseUrls,
|
|
154
154
|
initializeApiConfig,
|
|
155
155
|
isApiConfigInitialized,
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./api/index.js"),t=require("./api-config/index.js"),r=require("./calculation/index.js"),a=require("./color/index.js"),o=require("./common-utility/index.js"),s=require("./common/index.js"),i=require("./constant/index.js"),n=require("./country/index.js"),p=require("./date-range/index.js"),l=require("./dateFormat/index.js"),d=require("./dateValidation/index.js"),x=require("./deformat-text/index.js"),m=require("./export-filters/index.js"),u=require("./fileSize/index.js"),c=require("./form-builder-conversion/index.js"),g=require("./form-builder-deconversion/index.js"),D=require("./format-text/index.js");require("./i18n/index.js");var f=require("./language/index.js"),T=require("./menu-filter/index.js"),I=require("./metaComponent/index.js"),y=require("./migration-utils/index.js"),A=require("./navigation-utils/index.js"),F=require("./route-utils/index.js"),E=require("./translations/index.js"),S=require("i18next"),C=require("../api-client/api.rbac/api/index.js"),h=require("../api-client/api.drive/api/index.js"),N=require("../api-client/api.system-feature/api/index.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var O=/* @__PURE__ */R(S);exports.apiConfigurations=e.apiConfigurations,exports.fetchApi=e.fetchApi,exports.getCurrency=e.getCurrency,exports.getItems=e.getItems,exports.getOptions=e.getOptions,exports.initializeApiBaseUrls=e.initializeApiBaseUrls,exports.getApiConfig=t.getApiConfig,exports.getApiConfigSafe=t.getApiConfigSafe,exports.initializeApiConfig=t.initializeApiConfig,exports.isApiConfigInitialized=t.isApiConfigInitialized,exports.onApiConfigReady=t.onApiConfigReady,exports.resetApiConfig=t.resetApiConfig,exports.calculateEntries=r.calculateEntries,exports.blue=a.blue,exports.error=a.error,exports.green=a.green,exports.lightGreen=a.lightGreen,exports.magenta=a.magenta,exports.neutral=a.neutral,exports.olive=a.olive,exports.primaryGreen=a.primaryGreen,exports.red=a.red,exports.getFileNamesFromUrls=o.getFileNamesFromUrls,exports.getFileNamesFromUrlsAsLink=o.getFileNamesFromUrlsAsLink,exports.renderEmptyRowsFallback=o.renderEmptyRowsFallback,exports.renderValueField=o.renderValueField,exports.transformTableColumns=o.transformTableColumns,exports.InvoiceStatus=s.InvoiceStatus,exports.addOrEditArray=s.addOrEditArray,exports.appendConditionSafely=s.appendConditionSafely,exports.calculateAmountData=s.calculateAmountData,exports.calculatePeriods=s.calculatePeriods,exports.checkDuplicateTracking=s.checkDuplicateTracking,exports.checkForDuplicate=s.checkForDuplicate,exports.checkSkuAndItemName=s.checkSkuAndItemName,exports.createdOnAndBy=s.createdOnAndBy,exports.defaultCompany=s.defaultCompany,exports.defaultCurrencyFormat=s.defaultCurrencyFormat,exports.defaultCurrencySymbol=s.defaultCurrencySymbol,exports.displayPhone=s.displayPhone,exports.downloadDoc=s.downloadDoc,exports.downloadFile=s.downloadFile,exports.fetchAssemblyItemData=s.fetchAssemblyItemData,exports.fetchCompanyLocations=s.fetchCompanyLocations,exports.fetchDataLocally=s.fetchDataLocally,exports.fetchExchageRate=s.fetchExchageRate,exports.fetchItems=s.fetchItems,exports.fetchOptions=s.fetchOptions,exports.fetchRentalResponseItems=s.fetchRentalResponseItems,exports.fetchRfqItemsByIdForResponse=s.fetchRfqItemsByIdForResponse,exports.filterAccessibleModules=s.filterAccessibleModules,exports.filterCoaByCompanyIdOrNull=s.filterCoaByCompanyIdOrNull,exports.findById=s.findById,exports.formatAmount=s.formatAmount,exports.formatAmountWithCurrency=s.formatAmountWithCurrency,exports.formatAmountWithCurrencyData=s.formatAmountWithCurrencyData,exports.formatDateForPayload=s.formatDateForPayload,exports.formatDateTimeForPayload=s.formatDateTimeForPayload,exports.formatEmptyDataToNull=s.formatEmptyDataToNull,exports.formatResponseDatesToDayJS=s.formatResponseDatesToDayJS,exports.formatResponseOnlyDatesToDayJS=s.formatResponseOnlyDatesToDayJS,exports.formatTimeForPayload=s.formatTimeForPayload,exports.generateAndFormatStringFromObj=s.generateAndFormatStringFromObj,exports.generateFields=s.generateFields,exports.generateQueryString=s.generateQueryString,exports.generateRandomId=s.generateRandomId,exports.getAccessibleModules=s.getAccessibleModules,exports.getCountryIdByName=s.getCountryIdByName,exports.getErrorMessage=s.getErrorMessage,exports.getExcelExportTemplate=s.getExcelExportTemplate,exports.getExcelTemplateGenerateTemplate=s.getExcelTemplateGenerateTemplate,exports.getFieldFilters=s.getFieldFilters,exports.getFileName=s.getFileName,exports.getLabelValuePairs=s.getLabelValuePairs,exports.getName=s.getName,exports.getNestedValue=s.getNestedValue,exports.getNextScheduleDate=s.getNextScheduleDate,exports.getOperatorLabel=s.getOperatorLabel,exports.getOptionsData=s.getOptionsData,exports.getPartyDependentData=s.getPartyDependentData,exports.getPartyName=s.getPartyName,exports.getSlicedValue=s.getSlicedValue,exports.getTaxAmountDataFromMultipleTaxCodes=s.getTaxAmountDataFromMultipleTaxCodes,exports.getTaxAmountFromMultipleTaxCodes=s.getTaxAmountFromMultipleTaxCodes,exports.getToken=s.getToken,exports.handleRegularUpload=s.handleRegularUpload,exports.hasValue=s.hasValue,exports.isBetweenTheDates=s.isBetweenTheDates,exports.isJSONString=s.isJSONString,exports.isJsonParse=s.isJsonParse,exports.manageItems=s.manageItems,exports.mapApiPayload=s.mapApiPayload,exports.mapAsyncApiPayload=s.mapAsyncApiPayload,exports.matchedMaterialCostingTypeLabel=s.matchedMaterialCostingTypeLabel,exports.omitDataKeys=s.omitDataKeys,exports.partyDuplicateCheck=s.partyDuplicateCheck,exports.partyEmailIds=s.partyEmailIds,exports.postImportSheet=s.postImportSheet,exports.remainingMaterialCostingTypes=s.remainingMaterialCostingTypes,exports.removeIdFromObject=s.removeIdFromObject,exports.removeIdStaticIdsFromMongoObject=s.removeIdStaticIdsFromMongoObject,exports.setRateBasedOnPriceRules=s.setRateBasedOnPriceRules,exports.showSnackBar=s.showSnackBar,exports.skuGenerator=s.skuGenerator,exports.toFixedWithNumbers=s.toFixedWithNumbers,exports.updateFieldsDisabledState=s.updateFieldsDisabledState,exports.uploadAttachments=s.uploadAttachments,exports.uploadFiles=s.uploadFiles,exports.validateDiscountValidity=s.validateDiscountValidity,exports.INVENTORY_ADD_MODE_DISABLED_FIELDS=i.INVENTORY_ADD_MODE_DISABLED_FIELDS,exports.INVENTORY_ALWAYS_DISABLED_FIELDS=i.INVENTORY_ALWAYS_DISABLED_FIELDS,exports.INVENTORY_EDIT_MODE_DISABLED_FIELDS=i.INVENTORY_EDIT_MODE_DISABLED_FIELDS,exports.INVENTORY_FIELDS_TO_BE_DISABLED=i.INVENTORY_FIELDS_TO_BE_DISABLED,exports.INVENTORY_MATERIAL_COSTING_TYPE_ARR=i.INVENTORY_MATERIAL_COSTING_TYPE_ARR,exports.INVENTORY_MATERIAL_COSTING_TYPE_OPTIONS=i.INVENTORY_MATERIAL_COSTING_TYPE_OPTIONS,exports.INVENTORY_VARIANT_DISABLED_FIELDS=i.INVENTORY_VARIANT_DISABLED_FIELDS,exports.SECTION_TYPES=i.SECTION_TYPES,exports.responseItemDetailsColumns=i.responseItemDetailsColumns,exports.getCountry=n.getCountry,exports.RANGE=p.RANGE,exports.handleCompareDateRange=p.handleCompareDateRange,exports.handleCompareDateRangeSync=p.handleCompareDateRangeSync,exports.UTCDateFormat=l.UTCDateFormat,exports.dateFormat=l.dateFormat,exports.formatDataTime=l.formatDataTime,exports.formatDate=l.formatDate,exports.formatOnlyTime=l.formatOnlyTime,exports.formatUtcDate=l.formatUtcDate,exports.getMinutesFromTime=l.getMinutesFromTime,exports.getTimeFromMinutes=l.getTimeFromMinutes,exports.COMMON_DATE_VALIDATIONS=d.COMMON_DATE_VALIDATIONS,exports.anyDateValidation=d.anyDateValidation,exports.businessDateValidation=d.businessDateValidation,exports.conditionalDateValidation=d.conditionalDateValidation,exports.createCustomMessages=d.createCustomMessages,exports.createDateValidation=d.createDateValidation,exports.dateRangeValidation=d.dateRangeValidation,exports.dateTimeValidation=d.dateTimeValidation,exports.dateValidation=d.dateValidation,exports.futureDateValidation=d.futureDateValidation,exports.pastDateValidation=d.pastDateValidation,exports.deFormatText=x.deFormatText,exports.specificFilters=m.specificFilters,exports.subModuleMappings=m.subModuleMappings,exports.fileSize=u.fileSize,exports.formBuilderConversion=c.formBuilderConversion,exports.convertTableColumns=g.convertTableColumns,exports.formBuilderDeConversion=g.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./api/index.js"),t=require("./api-config/index.js"),r=require("./calculation/index.js"),a=require("./color/index.js"),o=require("./common-utility/index.js"),s=require("./common/index.js"),i=require("./constant/index.js"),n=require("./country/index.js"),p=require("./date-range/index.js"),l=require("./dateFormat/index.js"),d=require("./dateValidation/index.js"),x=require("./deformat-text/index.js"),m=require("./export-filters/index.js"),u=require("./fileSize/index.js"),c=require("./form-builder-conversion/index.js"),g=require("./form-builder-deconversion/index.js"),D=require("./format-text/index.js");require("./i18n/index.js");var f=require("./language/index.js"),T=require("./menu-filter/index.js"),I=require("./metaComponent/index.js"),y=require("./migration-utils/index.js"),A=require("./navigation-utils/index.js"),F=require("./route-utils/index.js"),E=require("./translations/index.js"),S=require("i18next"),C=require("../api-client/api.rbac/api/index.js"),h=require("../api-client/api.drive/api/index.js"),N=require("../api-client/api.system-feature/api/index.js");function R(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var O=/* @__PURE__ */R(S);exports.apiConfigurations=e.apiConfigurations,exports.fetchApi=e.fetchApi,exports.getCurrency=e.getCurrency,exports.getItems=e.getItems,exports.getOptions=e.getOptions,exports.initializeApiBaseUrls=e.initializeApiBaseUrls,exports.getApiConfig=t.getApiConfig,exports.getApiConfigSafe=t.getApiConfigSafe,exports.initializeApiConfig=t.initializeApiConfig,exports.isApiConfigInitialized=t.isApiConfigInitialized,exports.onApiConfigReady=t.onApiConfigReady,exports.resetApiConfig=t.resetApiConfig,exports.calculateEntries=r.calculateEntries,exports.blue=a.blue,exports.error=a.error,exports.green=a.green,exports.lightGreen=a.lightGreen,exports.magenta=a.magenta,exports.neutral=a.neutral,exports.olive=a.olive,exports.primaryGreen=a.primaryGreen,exports.red=a.red,exports.getFileNamesFromUrls=o.getFileNamesFromUrls,exports.getFileNamesFromUrlsAsLink=o.getFileNamesFromUrlsAsLink,exports.renderEmptyRowsFallback=o.renderEmptyRowsFallback,exports.renderValueField=o.renderValueField,exports.transformTableColumns=o.transformTableColumns,exports.InvoiceStatus=s.InvoiceStatus,exports.addOrEditArray=s.addOrEditArray,exports.appendConditionSafely=s.appendConditionSafely,exports.calculateAmountData=s.calculateAmountData,exports.calculatePeriods=s.calculatePeriods,exports.checkDuplicateTracking=s.checkDuplicateTracking,exports.checkForDuplicate=s.checkForDuplicate,exports.checkSkuAndItemName=s.checkSkuAndItemName,exports.createdOnAndBy=s.createdOnAndBy,exports.defaultCompany=s.defaultCompany,exports.defaultCurrencyFormat=s.defaultCurrencyFormat,exports.defaultCurrencySymbol=s.defaultCurrencySymbol,exports.displayPhone=s.displayPhone,exports.downloadDoc=s.downloadDoc,exports.downloadFile=s.downloadFile,exports.fetchAssemblyItemData=s.fetchAssemblyItemData,exports.fetchCompanyLocations=s.fetchCompanyLocations,exports.fetchDataLocally=s.fetchDataLocally,exports.fetchExchageRate=s.fetchExchageRate,exports.fetchItems=s.fetchItems,exports.fetchOptions=s.fetchOptions,exports.fetchRentalResponseItems=s.fetchRentalResponseItems,exports.fetchRfqItemsByIdForResponse=s.fetchRfqItemsByIdForResponse,exports.filterAccessibleModules=s.filterAccessibleModules,exports.filterCoaByCompanyIdOrNull=s.filterCoaByCompanyIdOrNull,exports.findById=s.findById,exports.formatAmount=s.formatAmount,exports.formatAmountWithCurrency=s.formatAmountWithCurrency,exports.formatAmountWithCurrencyData=s.formatAmountWithCurrencyData,exports.formatDateForPayload=s.formatDateForPayload,exports.formatDateTimeForPayload=s.formatDateTimeForPayload,exports.formatEmptyDataToNull=s.formatEmptyDataToNull,exports.formatResponseDatesToDayJS=s.formatResponseDatesToDayJS,exports.formatResponseOnlyDatesToDayJS=s.formatResponseOnlyDatesToDayJS,exports.formatTimeForPayload=s.formatTimeForPayload,exports.generateAndFormatStringFromObj=s.generateAndFormatStringFromObj,exports.generateFields=s.generateFields,exports.generateQueryString=s.generateQueryString,exports.generateRandomId=s.generateRandomId,exports.getAccessibleModules=s.getAccessibleModules,exports.getCountryIdByName=s.getCountryIdByName,exports.getErrorMessage=s.getErrorMessage,exports.getExcelExportTemplate=s.getExcelExportTemplate,exports.getExcelTemplateGenerateTemplate=s.getExcelTemplateGenerateTemplate,exports.getFieldFilters=s.getFieldFilters,exports.getFileName=s.getFileName,exports.getLabelValuePairs=s.getLabelValuePairs,exports.getName=s.getName,exports.getNestedValue=s.getNestedValue,exports.getNextScheduleDate=s.getNextScheduleDate,exports.getOperatorLabel=s.getOperatorLabel,exports.getOptionsData=s.getOptionsData,exports.getPartyDependentData=s.getPartyDependentData,exports.getPartyName=s.getPartyName,exports.getSlicedValue=s.getSlicedValue,exports.getTaxAmountDataFromMultipleTaxCodes=s.getTaxAmountDataFromMultipleTaxCodes,exports.getTaxAmountFromMultipleTaxCodes=s.getTaxAmountFromMultipleTaxCodes,exports.getToken=s.getToken,exports.handleRegularUpload=s.handleRegularUpload,exports.hasValue=s.hasValue,exports.isBetweenTheDates=s.isBetweenTheDates,exports.isJSONString=s.isJSONString,exports.isJsonParse=s.isJsonParse,exports.manageItems=s.manageItems,exports.mapApiPayload=s.mapApiPayload,exports.mapAsyncApiPayload=s.mapAsyncApiPayload,exports.matchedMaterialCostingTypeLabel=s.matchedMaterialCostingTypeLabel,exports.omitDataKeys=s.omitDataKeys,exports.partyDuplicateCheck=s.partyDuplicateCheck,exports.partyEmailIds=s.partyEmailIds,exports.postImportSheet=s.postImportSheet,exports.remainingMaterialCostingTypes=s.remainingMaterialCostingTypes,exports.removeIdFromObject=s.removeIdFromObject,exports.removeIdStaticIdsFromMongoObject=s.removeIdStaticIdsFromMongoObject,exports.setRateBasedOnPriceRules=s.setRateBasedOnPriceRules,exports.showSnackBar=s.showSnackBar,exports.skuGenerator=s.skuGenerator,exports.toFixedWithNumbers=s.toFixedWithNumbers,exports.updateFieldsDisabledState=s.updateFieldsDisabledState,exports.uploadAttachments=s.uploadAttachments,exports.uploadFiles=s.uploadFiles,exports.validateDiscountValidity=s.validateDiscountValidity,exports.INVENTORY_ADD_MODE_DISABLED_FIELDS=i.INVENTORY_ADD_MODE_DISABLED_FIELDS,exports.INVENTORY_ALWAYS_DISABLED_FIELDS=i.INVENTORY_ALWAYS_DISABLED_FIELDS,exports.INVENTORY_EDIT_MODE_DISABLED_FIELDS=i.INVENTORY_EDIT_MODE_DISABLED_FIELDS,exports.INVENTORY_FIELDS_TO_BE_DISABLED=i.INVENTORY_FIELDS_TO_BE_DISABLED,exports.INVENTORY_MATERIAL_COSTING_TYPE_ARR=i.INVENTORY_MATERIAL_COSTING_TYPE_ARR,exports.INVENTORY_MATERIAL_COSTING_TYPE_OPTIONS=i.INVENTORY_MATERIAL_COSTING_TYPE_OPTIONS,exports.INVENTORY_VARIANT_DISABLED_FIELDS=i.INVENTORY_VARIANT_DISABLED_FIELDS,exports.SECTION_TYPES=i.SECTION_TYPES,exports.responseItemDetailsColumns=i.responseItemDetailsColumns,exports.getCountry=n.getCountry,exports.RANGE=p.RANGE,exports.handleCompareDateRange=p.handleCompareDateRange,exports.handleCompareDateRangeSync=p.handleCompareDateRangeSync,exports.UTCDateFormat=l.UTCDateFormat,exports.dateFormat=l.dateFormat,exports.formatDataTime=l.formatDataTime,exports.formatDate=l.formatDate,exports.formatOnlyTime=l.formatOnlyTime,exports.formatUtcDate=l.formatUtcDate,exports.getMinutesFromTime=l.getMinutesFromTime,exports.getTimeFromMinutes=l.getTimeFromMinutes,exports.COMMON_DATE_VALIDATIONS=d.COMMON_DATE_VALIDATIONS,exports.anyDateValidation=d.anyDateValidation,exports.businessDateValidation=d.businessDateValidation,exports.conditionalDateValidation=d.conditionalDateValidation,exports.createCustomMessages=d.createCustomMessages,exports.createDateValidation=d.createDateValidation,exports.dateRangeValidation=d.dateRangeValidation,exports.dateTimeValidation=d.dateTimeValidation,exports.dateValidation=d.dateValidation,exports.futureDateValidation=d.futureDateValidation,exports.pastDateValidation=d.pastDateValidation,exports.deFormatText=x.deFormatText,exports.specificFilters=m.specificFilters,exports.subModuleMappings=m.subModuleMappings,exports.fileSize=u.fileSize,exports.formBuilderConversion=c.formBuilderConversion,exports.convertTableColumns=g.convertTableColumns,exports.formBuilderDeConversion=g.default,exports.convertToUnderscore=D.convertToUnderscore,exports.formatLabel=D.formatLabel,exports.formatText=D.formatText,exports.fetchLanguages=f.fetchLanguages,exports.MenuFilter=T.MenuFilter,exports.MenuFilterService=T.MenuFilterService,exports.ModuleAccessService=T.ModuleAccessService,exports.StorageUtils=T.StorageUtils,exports.MetaComponent=I.MetaComponent,exports.createParameterizedNavigationHandler=y.createParameterizedNavigationHandler,exports.migrateRoutesToUseParams=y.migrateRoutesToUseParams,exports.migrateToPathWithId=y.migrateToPathWithId,exports.updateTableConfigForParameterizedNavigation=y.updateTableConfigForParameterizedNavigation,exports.getEntityId=A.getEntityId,exports.navigateWithId=A.navigateWithId,exports.convertRoutesToUseIdParams=F.convertRoutesToUseIdParams,exports.generateRouteWithId=F.generateRouteWithId,exports.navigateToRouteWithId=F.navigateToRouteWithId,exports.updatePathnameWithIdParams=F.updatePathnameWithIdParams,exports.loadModuleTranslations=E.loadModuleTranslations,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return O.default}}),exports.setRoleURL=C.setBaseUrl,exports.setDriveURL=h.setBaseUrl,exports.setSystemFeatureURL=N.setBaseUrl;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
|
-
import
|
|
2
|
+
import formBuilderDeConversion from "../../../../utils/form-builder-deconversion/index.esm.js";
|
|
3
3
|
import { PathnameAccounting } from "../../../../constants/pathnames/pathname.accounting/index.esm.js";
|
|
4
4
|
import { PathnameCrm } from "../../../../constants/pathnames/pathname.crm/index.esm.js";
|
|
5
5
|
import { PathnameInventory } from "../../../../constants/pathnames/pathname.inventory/index.esm.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../../../../utils/form-builder-deconversion/index.js"),a=require("../../../../constants/pathnames/pathname.accounting/index.js"),r=require("../../../../constants/pathnames/pathname.crm/index.js"),n=require("../../../../constants/pathnames/pathname.inventory/index.js"),o=require("../../../../constants/pathnames/pathname.manufacturing/index.js"),s=require("../../../../constants/pathnames/pathname.procurement/index.js"),i=require("../../../../constants/pathnames/pathname.rental/index.js"),c=require("../../../../constants/pathnames/pathname.user/index.js");const l={accounting:a.PathnameAccounting.FORMS,inventory:n.PathnameInventory.FORMS,manufacturing:o.PathnameManufacturing.FORMS,procurement:s.PathnamePurchase.FORMS,crm:r.PathnameCrm.FORMS,rental:i.PathnameRental.FORMS,user:c.PathnameUsers.FORMS},m=e=>e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),u=(e,t)=>{var a,r;if(null==(a=e.table_columns)?void 0:a.length)return e.table_columns;if(!e.table||!(null==(r=t.fields)?void 0:r[e.table]))return[{header:"Column 1",accessorKey:"column_1",visible:!0},{header:"Column 2",accessorKey:"column_2",visible:!0}];const n=t.fields[e.table];return Array.isArray(n)&&0!==n.length?n.map((e,t)=>({header:m(e.field),accessorKey:e.field,visible:t<=3})):[{header:"Column 1",accessorKey:"column_1",visible:!0},{header:"Column 2",accessorKey:"column_2",visible:!0}]},d=(e,t)=>e.flatMap(e=>e.members.map(e=>"table"===e.field_type?{...e,table_columns:u(e,t)}:{...e})),p=e=>e.map(({field_type:e,label:t,is_accordion:a,id:r,remove_section:n,form_switcher_label:o,form_switcher_name:s,is_section_field:i,section_type:c,switcher_forms:l})=>({field_type:e,label:t,is_accordion:a,id:r,remove_section:n,form_switcher_label:o,form_switcher_name:s,is_section_field:i,section_type:c,switcher_forms:l})),h=(e,t=0,a,r,n)=>{const{removeSection:o,remove:s}=n;try{if(o(),s(),e.tab)f(e.tab,t,a,n);else if(e.section)v(e.section,a,n);else{if(!e.tabsData||!r)throw new Error("Invalid data format: Missing required properties (tab, section, or tabsData)");b(r,t,n)}}catch(i){alert(i instanceof Error?i.message:"An error occurred while processing data")}},f=(e,t,a,r)=>{const{setTabsData:n,append:o,appendSection:s}=r;n(e);const i=e.find(e=>e.tab_order===t+1);if(!(null==i?void 0:i.data))return;const c=p(i.data);o(d(i.data,a)),s(c)},v=(e,t,a)=>{const{append:r,appendSection:n}=a,o=p(e);r(d(e,t)),n(o)},b=(e,t,a)=>{const{append:r,appendSection:n}=a,o=e.find(e=>e.tab_order===t+1);if(!(null==o?void 0:o.data))return;const s=p(o.data),i=o.data.flatMap(e=>e.members.map(e=>({...e})));i.length>0&&r(i),s.length>0&&n(s)};exports.createDefaultTableColumns=()=>[{header:"Column 1",accessorKey:"column_1",visible:!0},{header:"Column 2",accessorKey:"column_2",visible:!0}],exports.extractSections=p,exports.formatText=m,exports.generateModulePath=e=>{try{const t=(e=>{if(!(e in l))throw new Error(`Invalid module: ${e}`);return l[e]})(e);return`/dashboard/${e}${t}`}catch(t){throw t}},exports.processMembers=d,exports.processTableColumns=u,exports.useFormDataEffect=(a,r,n=0,o)=>{const{removeSection:s,remove:i,append:c}=o;e.useEffect(()=>{var e;let l=null;if(null==(e=null==a?void 0:a.formData)?void 0:e.length)try{l=t.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../../../../utils/form-builder-deconversion/index.js"),a=require("../../../../constants/pathnames/pathname.accounting/index.js"),r=require("../../../../constants/pathnames/pathname.crm/index.js"),n=require("../../../../constants/pathnames/pathname.inventory/index.js"),o=require("../../../../constants/pathnames/pathname.manufacturing/index.js"),s=require("../../../../constants/pathnames/pathname.procurement/index.js"),i=require("../../../../constants/pathnames/pathname.rental/index.js"),c=require("../../../../constants/pathnames/pathname.user/index.js");const l={accounting:a.PathnameAccounting.FORMS,inventory:n.PathnameInventory.FORMS,manufacturing:o.PathnameManufacturing.FORMS,procurement:s.PathnamePurchase.FORMS,crm:r.PathnameCrm.FORMS,rental:i.PathnameRental.FORMS,user:c.PathnameUsers.FORMS},m=e=>e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),u=(e,t)=>{var a,r;if(null==(a=e.table_columns)?void 0:a.length)return e.table_columns;if(!e.table||!(null==(r=t.fields)?void 0:r[e.table]))return[{header:"Column 1",accessorKey:"column_1",visible:!0},{header:"Column 2",accessorKey:"column_2",visible:!0}];const n=t.fields[e.table];return Array.isArray(n)&&0!==n.length?n.map((e,t)=>({header:m(e.field),accessorKey:e.field,visible:t<=3})):[{header:"Column 1",accessorKey:"column_1",visible:!0},{header:"Column 2",accessorKey:"column_2",visible:!0}]},d=(e,t)=>e.flatMap(e=>e.members.map(e=>"table"===e.field_type?{...e,table_columns:u(e,t)}:{...e})),p=e=>e.map(({field_type:e,label:t,is_accordion:a,id:r,remove_section:n,form_switcher_label:o,form_switcher_name:s,is_section_field:i,section_type:c,switcher_forms:l})=>({field_type:e,label:t,is_accordion:a,id:r,remove_section:n,form_switcher_label:o,form_switcher_name:s,is_section_field:i,section_type:c,switcher_forms:l})),h=(e,t=0,a,r,n)=>{const{removeSection:o,remove:s}=n;try{if(o(),s(),e.tab)f(e.tab,t,a,n);else if(e.section)v(e.section,a,n);else{if(!e.tabsData||!r)throw new Error("Invalid data format: Missing required properties (tab, section, or tabsData)");b(r,t,n)}}catch(i){alert(i instanceof Error?i.message:"An error occurred while processing data")}},f=(e,t,a,r)=>{const{setTabsData:n,append:o,appendSection:s}=r;n(e);const i=e.find(e=>e.tab_order===t+1);if(!(null==i?void 0:i.data))return;const c=p(i.data);o(d(i.data,a)),s(c)},v=(e,t,a)=>{const{append:r,appendSection:n}=a,o=p(e);r(d(e,t)),n(o)},b=(e,t,a)=>{const{append:r,appendSection:n}=a,o=e.find(e=>e.tab_order===t+1);if(!(null==o?void 0:o.data))return;const s=p(o.data),i=o.data.flatMap(e=>e.members.map(e=>({...e})));i.length>0&&r(i),s.length>0&&n(s)};exports.createDefaultTableColumns=()=>[{header:"Column 1",accessorKey:"column_1",visible:!0},{header:"Column 2",accessorKey:"column_2",visible:!0}],exports.extractSections=p,exports.formatText=m,exports.generateModulePath=e=>{try{const t=(e=>{if(!(e in l))throw new Error(`Invalid module: ${e}`);return l[e]})(e);return`/dashboard/${e}${t}`}catch(t){throw t}},exports.processMembers=d,exports.processTableColumns=u,exports.useFormDataEffect=(a,r,n=0,o)=>{const{removeSection:s,remove:i,append:c}=o;e.useEffect(()=>{var e;let l=null;if(null==(e=null==a?void 0:a.formData)?void 0:e.length)try{l=t.default(a.formData)}catch(m){}if(!l)return s(),i(),void c([]);try{r.length>0?h({tabsData:r},n,a,r,o):l.tab?h(l,n,a,r,o):l.section?h(l,0,a,r,o):(s(),i(),c([]))}catch(m){s(),i(),c([])}},[n,JSON.stringify(null==a?void 0:a.formData),r.length])},exports.useFormDataProcessor=(a,r,n,o)=>{const{removeSection:s,remove:i,append:c}=o,l=useMemo(()=>JSON.stringify(null==a?void 0:a.formData),[null==a?void 0:a.formData]),m=useMemo(()=>{var e;if(!(null==(e=null==a?void 0:a.formData)?void 0:e.length))return null;try{return t.default(a.formData)}catch(r){return null}},[l]);return e.useEffect(()=>{if(!m)return s(),i(),void c([]);try{r.length>0?h({tabsData:r},n,a,r,o):m.tab?h(m,n,a,r,o):m.section?h(m,0,a,r,o):(s(),i(),c([]))}catch(e){s(),i(),c([])}},[n,l,r.length,m,o,a]),{initialData:m}};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|