react-table-edit 1.5.34 → 1.5.35
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/component/modal-import-excel/index.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -45,12 +45,12 @@ type IFProps = {
|
|
|
45
45
|
* API cập nhật cấu hình import
|
|
46
46
|
* @param params - Tham số cập nhật
|
|
47
47
|
*/
|
|
48
|
-
updateGeneralSettingApi
|
|
48
|
+
updateGeneralSettingApi?: (params: IFDataMapExcel[]) => void;
|
|
49
49
|
/**
|
|
50
50
|
* API lấy cấu hình in
|
|
51
51
|
* @returns Promise trả về kết quả in
|
|
52
52
|
*/
|
|
53
|
-
getGeneralSettingApi
|
|
53
|
+
getGeneralSettingApi?: () => Promise<any>;
|
|
54
54
|
};
|
|
55
55
|
declare const ModalImportComponent: (props: IFProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
56
|
export { ModalImportComponent };
|
package/dist/index.d.ts
CHANGED
|
@@ -583,12 +583,12 @@ type IFProps$1 = {
|
|
|
583
583
|
* API cập nhật cấu hình import
|
|
584
584
|
* @param params - Tham số cập nhật
|
|
585
585
|
*/
|
|
586
|
-
updateGeneralSettingApi
|
|
586
|
+
updateGeneralSettingApi?: (params: IFDataMapExcel[]) => void;
|
|
587
587
|
/**
|
|
588
588
|
* API lấy cấu hình in
|
|
589
589
|
* @returns Promise trả về kết quả in
|
|
590
590
|
*/
|
|
591
|
-
getGeneralSettingApi
|
|
591
|
+
getGeneralSettingApi?: () => Promise<any>;
|
|
592
592
|
};
|
|
593
593
|
declare const ModalImportComponent: (props: IFProps$1) => react_jsx_runtime.JSX.Element;
|
|
594
594
|
|
package/dist/index.js
CHANGED
|
@@ -49176,13 +49176,13 @@ const TabHandleErrorImportExcel = (props) => {
|
|
|
49176
49176
|
const TabMergeImportExcel = (props) => {
|
|
49177
49177
|
const { setValue, watch, windowSize, optionField, formatNumber } = props;
|
|
49178
49178
|
const { t } = reactI18next.useTranslation();
|
|
49179
|
-
return (jsxRuntime.jsxs("div", { className:
|
|
49179
|
+
return (jsxRuntime.jsxs("div", { className: "box form-box__border", children: [jsxRuntime.jsx("h5", { className: "m-0 form-box__border--title", children: t('Merge data fields') }), jsxRuntime.jsx(TableEdit, { formatSetting: {
|
|
49180
49180
|
decimalSeparator: formatNumber?.decimalSeparator,
|
|
49181
49181
|
thousandSeparator: formatNumber?.thousandSeparator,
|
|
49182
49182
|
colorNegative: formatNumber?.colorNegative,
|
|
49183
49183
|
prefixNegative: formatNumber?.prefixNegative,
|
|
49184
49184
|
suffixNegative: formatNumber?.suffixNegative
|
|
49185
|
-
}, idTable:
|
|
49185
|
+
}, idTable: "MapColumnImportExcel", columns: [
|
|
49186
49186
|
{
|
|
49187
49187
|
headerText: 'Required Information',
|
|
49188
49188
|
field: 'isRequired',
|
|
@@ -49190,7 +49190,7 @@ const TabMergeImportExcel = (props) => {
|
|
|
49190
49190
|
editEnable: true,
|
|
49191
49191
|
textAlign: 'center',
|
|
49192
49192
|
template: (data) => {
|
|
49193
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: data.isRequired ? jsxRuntime.jsx(SvgCheckSquare, { color:
|
|
49193
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: data.isRequired ? jsxRuntime.jsx(SvgCheckSquare, { color: "green", fontSize: 18 }) : jsxRuntime.jsx(SvgXSquare, { color: "red", fontSize: 18 }) });
|
|
49194
49194
|
},
|
|
49195
49195
|
disabledCondition: (row) => {
|
|
49196
49196
|
return row.disableEdit ?? false;
|
|
@@ -49212,15 +49212,18 @@ const TabMergeImportExcel = (props) => {
|
|
|
49212
49212
|
type: 'select',
|
|
49213
49213
|
editEnable: true,
|
|
49214
49214
|
selectSettings: {
|
|
49215
|
-
options: optionField
|
|
49215
|
+
options: optionField,
|
|
49216
|
+
isClearable: true
|
|
49216
49217
|
},
|
|
49217
49218
|
callback(value, indexRow, item) {
|
|
49218
|
-
if (!item.headerDefault.includes(value
|
|
49219
|
-
item.headerDefault.push(value
|
|
49219
|
+
if (!item.headerDefault.includes(value?.label)) {
|
|
49220
|
+
item.headerDefault.push(value?.label ? value?.label?.trim() : '');
|
|
49220
49221
|
}
|
|
49221
49222
|
},
|
|
49222
49223
|
visible: watch('dataMap').length > 0,
|
|
49223
|
-
template: (row) => {
|
|
49224
|
+
template: (row) => {
|
|
49225
|
+
return optionField.find((e) => e.value === row.column)?.label;
|
|
49226
|
+
},
|
|
49224
49227
|
width: 300,
|
|
49225
49228
|
minWidth: 250,
|
|
49226
49229
|
maxWidth: 350
|
|
@@ -68398,7 +68401,7 @@ const ModalImportComponent = (props) => {
|
|
|
68398
68401
|
const [checkInitValidate, setCheckInitValidate] = React$5.useState(false);
|
|
68399
68402
|
const [validateExcelColumns, setValidateExcelColumns] = React$5.useState(mapColumn);
|
|
68400
68403
|
const [dataError, setDataError] = React$5.useState([]);
|
|
68401
|
-
const [isSaveSetting, setIsSaveSetting] = React$5.useState(
|
|
68404
|
+
const [isSaveSetting, setIsSaveSetting] = React$5.useState(!!getGeneralSettingApi && !!updateGeneralSettingApi);
|
|
68402
68405
|
const formSchema = create().shape({
|
|
68403
68406
|
step: create$1(),
|
|
68404
68407
|
sheetId: create$2().when('step', {
|
|
@@ -68451,7 +68454,7 @@ const ModalImportComponent = (props) => {
|
|
|
68451
68454
|
mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate).then((arr) => {
|
|
68452
68455
|
setCheckInitValidate(true);
|
|
68453
68456
|
if (isSaveSetting) {
|
|
68454
|
-
updateGeneralSettingApi(data.dataMap.map((x) => ({ ...x, column: undefined })));
|
|
68457
|
+
updateGeneralSettingApi?.(data.dataMap.map((x) => ({ ...x, column: undefined })));
|
|
68455
68458
|
}
|
|
68456
68459
|
validateExcelApi(arr)
|
|
68457
68460
|
.then((rs) => {
|
|
@@ -68462,7 +68465,8 @@ const ModalImportComponent = (props) => {
|
|
|
68462
68465
|
setDataValid(list.filter((x) => x.error || x.errors?.length === 0));
|
|
68463
68466
|
setValue('step', 3);
|
|
68464
68467
|
})
|
|
68465
|
-
.catch(() => {
|
|
68468
|
+
.catch((ex) => {
|
|
68469
|
+
console.log(ex);
|
|
68466
68470
|
notificationError(t('GetFail'));
|
|
68467
68471
|
setCheckInitValidate(false);
|
|
68468
68472
|
});
|
|
@@ -68528,24 +68532,26 @@ const ModalImportComponent = (props) => {
|
|
|
68528
68532
|
}
|
|
68529
68533
|
}
|
|
68530
68534
|
];
|
|
68531
|
-
React$5.useEffect(() => {
|
|
68532
|
-
console.log(watch('dataMap'));
|
|
68533
|
-
}, [watch('dataMap')]);
|
|
68534
68535
|
const handleFormOpened = () => {
|
|
68535
|
-
getGeneralSettingApi
|
|
68536
|
-
|
|
68537
|
-
|
|
68538
|
-
|
|
68539
|
-
|
|
68540
|
-
|
|
68541
|
-
|
|
68542
|
-
|
|
68543
|
-
|
|
68544
|
-
|
|
68545
|
-
|
|
68546
|
-
|
|
68536
|
+
if (getGeneralSettingApi) {
|
|
68537
|
+
getGeneralSettingApi()
|
|
68538
|
+
.then((rs) => {
|
|
68539
|
+
const arr = rs?.value ? JSON.parse(rs.value) : [];
|
|
68540
|
+
setValue('dataMap', [...mapColumn].map((x) => {
|
|
68541
|
+
const ele = arr.find((y) => x.field === y.field);
|
|
68542
|
+
if (ele) {
|
|
68543
|
+
x.headerDefault = ele.headerDefault;
|
|
68544
|
+
}
|
|
68545
|
+
return x;
|
|
68546
|
+
}));
|
|
68547
|
+
})
|
|
68548
|
+
.catch(() => {
|
|
68549
|
+
setValue('dataMap', [...mapColumn]);
|
|
68550
|
+
});
|
|
68551
|
+
}
|
|
68552
|
+
else {
|
|
68547
68553
|
setValue('dataMap', [...mapColumn]);
|
|
68548
|
-
}
|
|
68554
|
+
}
|
|
68549
68555
|
if (headerValidateExcelColumns && headerValidateExcelColumns.length > 0) {
|
|
68550
68556
|
setValidateExcelColumns(headerValidateExcelColumns);
|
|
68551
68557
|
}
|
|
@@ -68596,7 +68602,7 @@ const ModalImportComponent = (props) => {
|
|
|
68596
68602
|
visible: !!headerErrorExcelColumns,
|
|
68597
68603
|
content: jsxRuntime.jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
|
|
68598
68604
|
}
|
|
68599
|
-
] }) }) }) }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-between align-items-center p-1", style: { boxShadow: '0 4px 24px 0 rgb(34 41 47 / 10%)' }, children: [jsxRuntime.jsx("div", { className: "d-flex align-items-center", children: watch('step') === 2 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
|
|
68605
|
+
] }) }) }) }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-between align-items-center p-1", style: { boxShadow: '0 4px 24px 0 rgb(34 41 47 / 10%)' }, children: [jsxRuntime.jsx("div", { className: "d-flex align-items-center", children: watch('step') === 2 && getGeneralSettingApi && updateGeneralSettingApi && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
|
|
68600
68606
|
setIsSaveSetting(val.target.checked);
|
|
68601
68607
|
} }), jsxRuntime.jsx("span", { children: "L\u01B0u th\u00F4ng tin gh\u00E9p tr\u01B0\u1EDDng d\u1EEF li\u1EC7u" })] })) }), jsxRuntime.jsxs("div", { className: "d-flex align-items-center", children: [jsxRuntime.jsx(Button$1$1, { disabled: !getValues('file'), color: "primary", outline: true, className: `update-btn update-todo-item me-1 ${watch('step') !== 1 ? '' : 'd-none'}`, onClick: handleBackStep, children: t('Back') }), jsxRuntime.jsx(Button$1$1, { className: `update-btn update-todo-item me-1 ${watch('step') !== 3 ? '' : 'd-none'}`, disabled: !watch('file') || checkInitValidate, color: "primary", onClick: handleSubmit(onSubmit), children: t('Next') }), jsxRuntime.jsx(Button$1$1, { className: `update-btn update-todo-item me-1 ${watch('step') === 3 ? '' : 'd-none'}`, disabled: dataValid.length === 0 || !getValues('file') || checkInit, color: "primary", onClick: handleSubmit(onSubmit), children: t('Import') }), jsxRuntime.jsx(Button$1$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
|
|
68602
68608
|
};
|