react-table-edit 1.5.38 → 1.5.40
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 -0
- package/dist/index.d.ts +2 -0
- 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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IColumnTable } from '../type';
|
|
2
2
|
import { IFDataMapExcel, IFNumberFormat } from './type';
|
|
3
3
|
type IFProps = {
|
|
4
|
+
/** custom style */
|
|
5
|
+
zIndex?: number;
|
|
4
6
|
/** Kích thước cửa sổ hiện tại (width, height) */
|
|
5
7
|
windowSize: any;
|
|
6
8
|
/** Trạng thái mở/đóng modal import */
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -68391,7 +68391,7 @@ const TabValidateImportExcel = (props) => {
|
|
|
68391
68391
|
|
|
68392
68392
|
const ModalImportComponent = (props) => {
|
|
68393
68393
|
const { t } = reactI18next.useTranslation();
|
|
68394
|
-
const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, formatNumber, mapColumn, headerValidateExcelColumns } = props;
|
|
68394
|
+
const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, formatNumber, mapColumn, headerValidateExcelColumns, zIndex, } = props;
|
|
68395
68395
|
const [optionField, setOptionField] = React$5.useState([]);
|
|
68396
68396
|
const [dataMerge, setDataMerge] = React$5.useState([]);
|
|
68397
68397
|
const [dataValidate, setDataValidate] = React$5.useState([]);
|
|
@@ -68406,22 +68406,22 @@ const ModalImportComponent = (props) => {
|
|
|
68406
68406
|
step: create$1(),
|
|
68407
68407
|
sheetId: create$2().when('step', {
|
|
68408
68408
|
is: 1,
|
|
68409
|
-
then: create$2().required(`${t('Sheet name')} ${t('is required')}`)
|
|
68409
|
+
then: create$2().required(`${t('Sheet name')} ${t('is required')}`),
|
|
68410
68410
|
}),
|
|
68411
68411
|
headerRow: create$1().when('step', {
|
|
68412
68412
|
is: 1,
|
|
68413
|
-
then: create$1().required(`${t('Header row')} ${t('is required')}`)
|
|
68414
|
-
})
|
|
68413
|
+
then: create$1().required(`${t('Header row')} ${t('is required')}`),
|
|
68414
|
+
}),
|
|
68415
68415
|
});
|
|
68416
68416
|
const defaultValues = {
|
|
68417
68417
|
step: 1,
|
|
68418
68418
|
headerRow: defaultHeaderRow ?? 1,
|
|
68419
|
-
dataMap: []
|
|
68419
|
+
dataMap: [],
|
|
68420
68420
|
};
|
|
68421
|
-
const { control, clearErrors, reset, handleSubmit, getValues, setValue, watch, setError, formState: { errors } } = useForm({
|
|
68421
|
+
const { control, clearErrors, reset, handleSubmit, getValues, setValue, watch, setError, formState: { errors }, } = useForm({
|
|
68422
68422
|
defaultValues,
|
|
68423
68423
|
mode: 'onChange',
|
|
68424
|
-
resolver: o(formSchema)
|
|
68424
|
+
resolver: o(formSchema),
|
|
68425
68425
|
});
|
|
68426
68426
|
const handleSetColumns = (headerColumns, dataS) => {
|
|
68427
68427
|
if (headerColumns.length === 0) {
|
|
@@ -68459,7 +68459,10 @@ const ModalImportComponent = (props) => {
|
|
|
68459
68459
|
validateExcelApi(arr)
|
|
68460
68460
|
.then((rs) => {
|
|
68461
68461
|
setCheckInitValidate(false);
|
|
68462
|
-
const list = rs.map((item) => ({
|
|
68462
|
+
const list = rs.map((item) => ({
|
|
68463
|
+
...item,
|
|
68464
|
+
errors: item.errors.map((x) => connectString(t, x)),
|
|
68465
|
+
}));
|
|
68463
68466
|
setDataValidate(list);
|
|
68464
68467
|
setDataInvalid(list.filter((x) => x.errors?.length > 0));
|
|
68465
68468
|
setDataValid(list.filter((x) => x.error || x.errors?.length === 0));
|
|
@@ -68501,7 +68504,13 @@ const ModalImportComponent = (props) => {
|
|
|
68501
68504
|
});
|
|
68502
68505
|
};
|
|
68503
68506
|
const getDataType = (e) => {
|
|
68504
|
-
return e.dataType === 'numeric' ||
|
|
68507
|
+
return e.dataType === 'numeric' ||
|
|
68508
|
+
e.dataType === 'datetime' ||
|
|
68509
|
+
e.dataType === 'date'
|
|
68510
|
+
? e.dataType
|
|
68511
|
+
: e.dataType === 'boolean'
|
|
68512
|
+
? 'checkbox'
|
|
68513
|
+
: 'text';
|
|
68505
68514
|
};
|
|
68506
68515
|
const defaultValidateExcelColumns = [
|
|
68507
68516
|
{
|
|
@@ -68509,7 +68518,7 @@ const ModalImportComponent = (props) => {
|
|
|
68509
68518
|
headerText: 'Row',
|
|
68510
68519
|
fixedType: 'left',
|
|
68511
68520
|
textAlign: 'center',
|
|
68512
|
-
width: 80
|
|
68521
|
+
width: 80,
|
|
68513
68522
|
},
|
|
68514
68523
|
{
|
|
68515
68524
|
field: 'result',
|
|
@@ -68517,8 +68526,8 @@ const ModalImportComponent = (props) => {
|
|
|
68517
68526
|
fixedType: 'left',
|
|
68518
68527
|
width: 140,
|
|
68519
68528
|
template: (props) => {
|
|
68520
|
-
return props.errors?.length === 0 ? jsxRuntime.jsx("span", { className: "text-success", children: t('Valid') }) : jsxRuntime.jsx("span", { className: "text-danger", children: t('Invalid') });
|
|
68521
|
-
}
|
|
68529
|
+
return props.errors?.length === 0 ? (jsxRuntime.jsx("span", { className: "text-success", children: t('Valid') })) : (jsxRuntime.jsx("span", { className: "text-danger", children: t('Invalid') }));
|
|
68530
|
+
},
|
|
68522
68531
|
},
|
|
68523
68532
|
{
|
|
68524
68533
|
field: 'errorDetail',
|
|
@@ -68529,8 +68538,8 @@ const ModalImportComponent = (props) => {
|
|
|
68529
68538
|
return (jsxRuntime.jsx("div", { children: props.errors?.map((item, index) => {
|
|
68530
68539
|
return (jsxRuntime.jsxs("div", { className: "d-flex text-danger align-items-center", children: [jsxRuntime.jsx(SvgCircle, { fontSize: 6, className: "me-50 " }), jsxRuntime.jsx("div", { style: { fontSize: '12px' }, children: t(item) })] }, index));
|
|
68531
68540
|
}) }));
|
|
68532
|
-
}
|
|
68533
|
-
}
|
|
68541
|
+
},
|
|
68542
|
+
},
|
|
68534
68543
|
];
|
|
68535
68544
|
const handleFormOpened = () => {
|
|
68536
68545
|
if (getGeneralSettingApi) {
|
|
@@ -68563,8 +68572,8 @@ const ModalImportComponent = (props) => {
|
|
|
68563
68572
|
headerText: e.header,
|
|
68564
68573
|
width: e.width ?? 150,
|
|
68565
68574
|
type: getDataType(e),
|
|
68566
|
-
template: e.template
|
|
68567
|
-
}))
|
|
68575
|
+
template: e.template,
|
|
68576
|
+
})),
|
|
68568
68577
|
]);
|
|
68569
68578
|
}
|
|
68570
68579
|
};
|
|
@@ -68580,29 +68589,31 @@ const ModalImportComponent = (props) => {
|
|
|
68580
68589
|
setValue('step', 2);
|
|
68581
68590
|
}
|
|
68582
68591
|
};
|
|
68583
|
-
return (jsxRuntime.jsx(Modal$1, { isOpen: openModal, toggle: handleModal, backdrop: "static", className: "modal-dialog-centered modal-xl", contentClassName: "p-0", onOpened: handleFormOpened, onClosed: handleModalClosed, children: jsxRuntime.jsxs(Form$1, { id: "form-modal-globalzone", className: "todo-modal modal-form-content", children: [jsxRuntime.jsx(ModalHeader, { typeModal: 'Import', handleModal: handleModal, title: "Import Excel" }), jsxRuntime.jsx(Scrollbars, { autoHide: true, autoHeight: true, autoHeightMax: windowSize.innerHeight - 120, children: jsxRuntime.jsx(ModalBody$1, { children: jsxRuntime.jsx("div", { style: { marginTop: '-25px' }, className: "modern-horizontal-wizard", children: jsxRuntime.jsx(Wizard, { activeStep: watch('step'), type: "modern-horizontal", steps: [
|
|
68592
|
+
return (jsxRuntime.jsx(Modal$1, { isOpen: openModal, zIndex: zIndex, toggle: handleModal, backdrop: "static", className: "modal-dialog-centered modal-xl", contentClassName: "p-0", onOpened: handleFormOpened, onClosed: handleModalClosed, children: jsxRuntime.jsxs(Form$1, { id: "form-modal-globalzone", className: "todo-modal modal-form-content", children: [jsxRuntime.jsx(ModalHeader, { typeModal: 'Import', handleModal: handleModal, title: "Import Excel" }), jsxRuntime.jsx(Scrollbars, { autoHide: true, autoHeight: true, autoHeightMax: windowSize.innerHeight - 120, children: jsxRuntime.jsx(ModalBody$1, { children: jsxRuntime.jsx("div", { style: { marginTop: '-25px' }, className: "modern-horizontal-wizard", children: jsxRuntime.jsx(Wizard, { activeStep: watch('step'), type: "modern-horizontal", steps: [
|
|
68584
68593
|
{
|
|
68585
68594
|
id: 'upload-file',
|
|
68586
68595
|
title: t('Upload file'),
|
|
68587
|
-
content: jsxRuntime.jsx(TabSelectFileImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, watch: watch, templateUrl: templateUrl })
|
|
68596
|
+
content: (jsxRuntime.jsx(TabSelectFileImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, watch: watch, templateUrl: templateUrl })),
|
|
68588
68597
|
},
|
|
68589
68598
|
{
|
|
68590
68599
|
id: 'merge-data',
|
|
68591
68600
|
title: t('Merge data fields'),
|
|
68592
|
-
content: jsxRuntime.jsx(TabMergeImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, formatNumber: formatNumber, watch: watch, optionField: optionField, windowSize: windowSize })
|
|
68601
|
+
content: (jsxRuntime.jsx(TabMergeImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, formatNumber: formatNumber, watch: watch, optionField: optionField, windowSize: windowSize })),
|
|
68593
68602
|
},
|
|
68594
68603
|
{
|
|
68595
68604
|
id: 'validate-data',
|
|
68596
68605
|
title: t('Validate data'),
|
|
68597
|
-
content: jsxRuntime.jsx(TabValidateImportExcel, { formatNumber: formatNumber, dataInvalid: dataInvalid, dataValid: dataValid, dataValidate: dataValidate, headerValidateExcelColumns: validateExcelColumns, windowSize: windowSize })
|
|
68606
|
+
content: (jsxRuntime.jsx(TabValidateImportExcel, { formatNumber: formatNumber, dataInvalid: dataInvalid, dataValid: dataValid, dataValidate: dataValidate, headerValidateExcelColumns: validateExcelColumns, windowSize: windowSize })),
|
|
68598
68607
|
},
|
|
68599
68608
|
{
|
|
68600
68609
|
id: 'handle-error',
|
|
68601
68610
|
title: t('Error result'),
|
|
68602
68611
|
visible: !!headerErrorExcelColumns,
|
|
68603
|
-
content: jsxRuntime.jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
|
|
68604
|
-
}
|
|
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 &&
|
|
68612
|
+
content: (jsxRuntime.jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })),
|
|
68613
|
+
},
|
|
68614
|
+
] }) }) }) }), 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 &&
|
|
68615
|
+
getGeneralSettingApi &&
|
|
68616
|
+
updateGeneralSettingApi && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
|
|
68606
68617
|
setIsSaveSetting(val.target.checked);
|
|
68607
68618
|
} }), 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') })] })] })] }) }));
|
|
68608
68619
|
};
|