react-table-edit 1.5.38 → 1.5.39
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 +3 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +34 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -68362,7 +68362,7 @@ const TabValidateImportExcel = (props) => {
|
|
|
68362
68362
|
|
|
68363
68363
|
const ModalImportComponent = (props) => {
|
|
68364
68364
|
const { t } = useTranslation();
|
|
68365
|
-
const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, formatNumber, mapColumn, headerValidateExcelColumns } = props;
|
|
68365
|
+
const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, formatNumber, mapColumn, headerValidateExcelColumns, style, } = props;
|
|
68366
68366
|
const [optionField, setOptionField] = useState([]);
|
|
68367
68367
|
const [dataMerge, setDataMerge] = useState([]);
|
|
68368
68368
|
const [dataValidate, setDataValidate] = useState([]);
|
|
@@ -68377,22 +68377,22 @@ const ModalImportComponent = (props) => {
|
|
|
68377
68377
|
step: create$1(),
|
|
68378
68378
|
sheetId: create$2().when('step', {
|
|
68379
68379
|
is: 1,
|
|
68380
|
-
then: create$2().required(`${t('Sheet name')} ${t('is required')}`)
|
|
68380
|
+
then: create$2().required(`${t('Sheet name')} ${t('is required')}`),
|
|
68381
68381
|
}),
|
|
68382
68382
|
headerRow: create$1().when('step', {
|
|
68383
68383
|
is: 1,
|
|
68384
|
-
then: create$1().required(`${t('Header row')} ${t('is required')}`)
|
|
68385
|
-
})
|
|
68384
|
+
then: create$1().required(`${t('Header row')} ${t('is required')}`),
|
|
68385
|
+
}),
|
|
68386
68386
|
});
|
|
68387
68387
|
const defaultValues = {
|
|
68388
68388
|
step: 1,
|
|
68389
68389
|
headerRow: defaultHeaderRow ?? 1,
|
|
68390
|
-
dataMap: []
|
|
68390
|
+
dataMap: [],
|
|
68391
68391
|
};
|
|
68392
|
-
const { control, clearErrors, reset, handleSubmit, getValues, setValue, watch, setError, formState: { errors } } = useForm({
|
|
68392
|
+
const { control, clearErrors, reset, handleSubmit, getValues, setValue, watch, setError, formState: { errors }, } = useForm({
|
|
68393
68393
|
defaultValues,
|
|
68394
68394
|
mode: 'onChange',
|
|
68395
|
-
resolver: o(formSchema)
|
|
68395
|
+
resolver: o(formSchema),
|
|
68396
68396
|
});
|
|
68397
68397
|
const handleSetColumns = (headerColumns, dataS) => {
|
|
68398
68398
|
if (headerColumns.length === 0) {
|
|
@@ -68430,7 +68430,10 @@ const ModalImportComponent = (props) => {
|
|
|
68430
68430
|
validateExcelApi(arr)
|
|
68431
68431
|
.then((rs) => {
|
|
68432
68432
|
setCheckInitValidate(false);
|
|
68433
|
-
const list = rs.map((item) => ({
|
|
68433
|
+
const list = rs.map((item) => ({
|
|
68434
|
+
...item,
|
|
68435
|
+
errors: item.errors.map((x) => connectString(t, x)),
|
|
68436
|
+
}));
|
|
68434
68437
|
setDataValidate(list);
|
|
68435
68438
|
setDataInvalid(list.filter((x) => x.errors?.length > 0));
|
|
68436
68439
|
setDataValid(list.filter((x) => x.error || x.errors?.length === 0));
|
|
@@ -68472,7 +68475,13 @@ const ModalImportComponent = (props) => {
|
|
|
68472
68475
|
});
|
|
68473
68476
|
};
|
|
68474
68477
|
const getDataType = (e) => {
|
|
68475
|
-
return e.dataType === 'numeric' ||
|
|
68478
|
+
return e.dataType === 'numeric' ||
|
|
68479
|
+
e.dataType === 'datetime' ||
|
|
68480
|
+
e.dataType === 'date'
|
|
68481
|
+
? e.dataType
|
|
68482
|
+
: e.dataType === 'boolean'
|
|
68483
|
+
? 'checkbox'
|
|
68484
|
+
: 'text';
|
|
68476
68485
|
};
|
|
68477
68486
|
const defaultValidateExcelColumns = [
|
|
68478
68487
|
{
|
|
@@ -68480,7 +68489,7 @@ const ModalImportComponent = (props) => {
|
|
|
68480
68489
|
headerText: 'Row',
|
|
68481
68490
|
fixedType: 'left',
|
|
68482
68491
|
textAlign: 'center',
|
|
68483
|
-
width: 80
|
|
68492
|
+
width: 80,
|
|
68484
68493
|
},
|
|
68485
68494
|
{
|
|
68486
68495
|
field: 'result',
|
|
@@ -68488,8 +68497,8 @@ const ModalImportComponent = (props) => {
|
|
|
68488
68497
|
fixedType: 'left',
|
|
68489
68498
|
width: 140,
|
|
68490
68499
|
template: (props) => {
|
|
68491
|
-
return props.errors?.length === 0 ? jsx("span", { className: "text-success", children: t('Valid') }) : jsx("span", { className: "text-danger", children: t('Invalid') });
|
|
68492
|
-
}
|
|
68500
|
+
return props.errors?.length === 0 ? (jsx("span", { className: "text-success", children: t('Valid') })) : (jsx("span", { className: "text-danger", children: t('Invalid') }));
|
|
68501
|
+
},
|
|
68493
68502
|
},
|
|
68494
68503
|
{
|
|
68495
68504
|
field: 'errorDetail',
|
|
@@ -68500,8 +68509,8 @@ const ModalImportComponent = (props) => {
|
|
|
68500
68509
|
return (jsx("div", { children: props.errors?.map((item, index) => {
|
|
68501
68510
|
return (jsxs("div", { className: "d-flex text-danger align-items-center", children: [jsx(SvgCircle, { fontSize: 6, className: "me-50 " }), jsx("div", { style: { fontSize: '12px' }, children: t(item) })] }, index));
|
|
68502
68511
|
}) }));
|
|
68503
|
-
}
|
|
68504
|
-
}
|
|
68512
|
+
},
|
|
68513
|
+
},
|
|
68505
68514
|
];
|
|
68506
68515
|
const handleFormOpened = () => {
|
|
68507
68516
|
if (getGeneralSettingApi) {
|
|
@@ -68534,8 +68543,8 @@ const ModalImportComponent = (props) => {
|
|
|
68534
68543
|
headerText: e.header,
|
|
68535
68544
|
width: e.width ?? 150,
|
|
68536
68545
|
type: getDataType(e),
|
|
68537
|
-
template: e.template
|
|
68538
|
-
}))
|
|
68546
|
+
template: e.template,
|
|
68547
|
+
})),
|
|
68539
68548
|
]);
|
|
68540
68549
|
}
|
|
68541
68550
|
};
|
|
@@ -68551,29 +68560,31 @@ const ModalImportComponent = (props) => {
|
|
|
68551
68560
|
setValue('step', 2);
|
|
68552
68561
|
}
|
|
68553
68562
|
};
|
|
68554
|
-
return (jsx(Modal$1, { isOpen: openModal, toggle: handleModal, backdrop: "static", className: "modal-dialog-centered modal-xl", contentClassName: "p-0", onOpened: handleFormOpened, onClosed: handleModalClosed, children: jsxs(Form$1, { id: "form-modal-globalzone", className: "todo-modal modal-form-content", children: [jsx(ModalHeader, { typeModal: 'Import', handleModal: handleModal, title: "Import Excel" }), jsx(Scrollbars, { autoHide: true, autoHeight: true, autoHeightMax: windowSize.innerHeight - 120, children: jsx(ModalBody$1, { children: jsx("div", { style: { marginTop: '-25px' }, className: "modern-horizontal-wizard", children: jsx(Wizard, { activeStep: watch('step'), type: "modern-horizontal", steps: [
|
|
68563
|
+
return (jsx(Modal$1, { isOpen: openModal, style: style, toggle: handleModal, backdrop: "static", className: "modal-dialog-centered modal-xl", contentClassName: "p-0", onOpened: handleFormOpened, onClosed: handleModalClosed, children: jsxs(Form$1, { id: "form-modal-globalzone", className: "todo-modal modal-form-content", children: [jsx(ModalHeader, { typeModal: 'Import', handleModal: handleModal, title: "Import Excel" }), jsx(Scrollbars, { autoHide: true, autoHeight: true, autoHeightMax: windowSize.innerHeight - 120, children: jsx(ModalBody$1, { children: jsx("div", { style: { marginTop: '-25px' }, className: "modern-horizontal-wizard", children: jsx(Wizard, { activeStep: watch('step'), type: "modern-horizontal", steps: [
|
|
68555
68564
|
{
|
|
68556
68565
|
id: 'upload-file',
|
|
68557
68566
|
title: t('Upload file'),
|
|
68558
|
-
content: jsx(TabSelectFileImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, watch: watch, templateUrl: templateUrl })
|
|
68567
|
+
content: (jsx(TabSelectFileImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, watch: watch, templateUrl: templateUrl })),
|
|
68559
68568
|
},
|
|
68560
68569
|
{
|
|
68561
68570
|
id: 'merge-data',
|
|
68562
68571
|
title: t('Merge data fields'),
|
|
68563
|
-
content: jsx(TabMergeImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, formatNumber: formatNumber, watch: watch, optionField: optionField, windowSize: windowSize })
|
|
68572
|
+
content: (jsx(TabMergeImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, formatNumber: formatNumber, watch: watch, optionField: optionField, windowSize: windowSize })),
|
|
68564
68573
|
},
|
|
68565
68574
|
{
|
|
68566
68575
|
id: 'validate-data',
|
|
68567
68576
|
title: t('Validate data'),
|
|
68568
|
-
content: jsx(TabValidateImportExcel, { formatNumber: formatNumber, dataInvalid: dataInvalid, dataValid: dataValid, dataValidate: dataValidate, headerValidateExcelColumns: validateExcelColumns, windowSize: windowSize })
|
|
68577
|
+
content: (jsx(TabValidateImportExcel, { formatNumber: formatNumber, dataInvalid: dataInvalid, dataValid: dataValid, dataValidate: dataValidate, headerValidateExcelColumns: validateExcelColumns, windowSize: windowSize })),
|
|
68569
68578
|
},
|
|
68570
68579
|
{
|
|
68571
68580
|
id: 'handle-error',
|
|
68572
68581
|
title: t('Error result'),
|
|
68573
68582
|
visible: !!headerErrorExcelColumns,
|
|
68574
|
-
content: jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
|
|
68575
|
-
}
|
|
68576
|
-
] }) }) }) }), 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: [jsx("div", { className: "d-flex align-items-center", children: watch('step') === 2 &&
|
|
68583
|
+
content: (jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })),
|
|
68584
|
+
},
|
|
68585
|
+
] }) }) }) }), 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: [jsx("div", { className: "d-flex align-items-center", children: watch('step') === 2 &&
|
|
68586
|
+
getGeneralSettingApi &&
|
|
68587
|
+
updateGeneralSettingApi && (jsxs(Fragment$1, { children: [jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
|
|
68577
68588
|
setIsSaveSetting(val.target.checked);
|
|
68578
68589
|
} }), jsx("span", { children: "L\u01B0u th\u00F4ng tin gh\u00E9p tr\u01B0\u1EDDng d\u1EEF li\u1EC7u" })] })) }), jsxs("div", { className: "d-flex align-items-center", children: [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') }), 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') }), 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') }), jsx(Button$1$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
|
|
68579
68590
|
};
|