react-table-edit 1.5.39 → 1.5.41
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 +14 -3
- package/dist/component/modal-import-excel/tab-select-file.d.ts +9 -0
- package/dist/index.d.ts +15 -3
- package/dist/index.js +22 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -68302,38 +68302,48 @@ const connectString = (t, props) => {
|
|
|
68302
68302
|
};
|
|
68303
68303
|
|
|
68304
68304
|
const TabSelectFileImportExcel = (props) => {
|
|
68305
|
-
const { templateUrl, setValue, getValues, control, errors } = props;
|
|
68305
|
+
const { templateUrl, getExcelTemplate, templateCode, resourceName, setValue, getValues, control, errors, } = props;
|
|
68306
68306
|
const [isDragging, setIsDragging] = useState(false);
|
|
68307
68307
|
const [optionSheetName, setOptionSheetName] = useState([]);
|
|
68308
68308
|
const { t } = useTranslation();
|
|
68309
68309
|
const hanldDrag = (e) => {
|
|
68310
68310
|
e.preventDefault();
|
|
68311
68311
|
e.stopPropagation();
|
|
68312
|
-
if (e.type ===
|
|
68312
|
+
if (e.type === 'dragenter' || e.type === 'dragover') {
|
|
68313
68313
|
setIsDragging(true);
|
|
68314
68314
|
}
|
|
68315
|
-
else if (e.type ===
|
|
68315
|
+
else if (e.type === 'dragleave') {
|
|
68316
68316
|
setIsDragging(false);
|
|
68317
68317
|
}
|
|
68318
68318
|
};
|
|
68319
|
-
return (jsxs("div", { className:
|
|
68320
|
-
const link = document.createElement(
|
|
68319
|
+
return (jsxs("div", { className: "box form-box__border", children: [templateUrl && (!templateCode || !getExcelTemplate) && (jsxs(Button$1$1, { color: "link", onClick: () => {
|
|
68320
|
+
const link = document.createElement('a');
|
|
68321
68321
|
link.href = `${templateUrl}`; // URL file
|
|
68322
68322
|
document.body.appendChild(link);
|
|
68323
68323
|
link.click();
|
|
68324
68324
|
document.body.removeChild(link);
|
|
68325
|
-
}, children: [jsx(SvgDownload, { fontSize: 14, className:
|
|
68325
|
+
}, children: [jsx(SvgDownload, { fontSize: 14, className: "me-50" }), t('Download the sample file')] })), templateCode && getExcelTemplate && (jsxs(Button$1$1, { color: "link", onClick: () => {
|
|
68326
|
+
getExcelTemplate(templateCode).then((rs) => {
|
|
68327
|
+
const url = window.URL.createObjectURL(new Blob([rs]));
|
|
68328
|
+
const link = document.createElement('a');
|
|
68329
|
+
link.href = url;
|
|
68330
|
+
link.download = `${resourceName ? `${resourceName}_` : ''}${t('Sample File')}.xlsx`;
|
|
68331
|
+
document.body.appendChild(link);
|
|
68332
|
+
link.click();
|
|
68333
|
+
document.body.removeChild(link);
|
|
68334
|
+
});
|
|
68335
|
+
}, children: [jsx(SvgDownload, { fontSize: 14, className: "me-50" }), t('Download the sample file')] })), jsx("h5", { className: "m-0 form-box__border--title", children: t('Upload file') }), jsx("div", { className: `m-1 rounded d-flex flex-column align-items-center justify-content-center ${isDragging ? 'dragging-file' : 'no-dragging-file'}`, style: { minHeight: '220px' }, draggable: true, onDragEnter: hanldDrag, onDragLeave: hanldDrag, onDragOver: hanldDrag, onDrop: (e) => {
|
|
68326
68336
|
e.preventDefault();
|
|
68327
68337
|
e.stopPropagation();
|
|
68328
68338
|
setIsDragging(false);
|
|
68329
68339
|
if (e.dataTransfer.files && e.dataTransfer.files[0]) {
|
|
68330
68340
|
getSheetsExcel(e.dataTransfer.files[0], setValue, setOptionSheetName);
|
|
68331
68341
|
}
|
|
68332
|
-
}, children: getValues('file') ? jsxs(Fragment$1, { children: [jsx("div", { className:
|
|
68342
|
+
}, children: getValues('file') ? (jsxs(Fragment$1, { children: [jsx("div", { className: "mb-1 fs-5", children: getValues('file')?.name }), jsxs(Button$1$1, { tag: Label$1, outline: true, className: "me-75", size: "md", color: "primary", children: [jsx(SvgArrowLeftCircle, { fontSize: 18, className: "me-50" }), t('Select other file'), jsx(Input$1, { type: "file", onChange: (e) => {
|
|
68333
68343
|
getSheetsExcel(e.target.files[0], setValue, setOptionSheetName);
|
|
68334
|
-
}, hidden: true, accept:
|
|
68344
|
+
}, hidden: true, accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" })] })] })) : (jsxs(Fragment$1, { children: [jsx("div", { className: "fs-4 bolder", children: t('Drag and drop files here') }), jsx("div", { className: "my-50", children: t('or') }), jsxs(Button$1$1, { tag: Label$1, outline: true, className: "me-75", size: "md", color: "primary", children: [jsx(SvgArrowLeftCircle, { fontSize: 18, className: "me-50" }), t('Select file'), jsx(Input$1, { type: "file", onChange: (e) => {
|
|
68335
68345
|
getSheetsExcel(e.target.files[0], setValue, setOptionSheetName);
|
|
68336
|
-
}, hidden: true, accept:
|
|
68346
|
+
}, hidden: true, accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" })] }), jsx("div", { className: "mt-1", children: t('Accepts .xls, .xlsx, .csv files') })] })) }), jsxs(Row$1, { className: `${getValues('file') ? '' : 'd-none'} m-0 gy-1`, children: [jsx(Col$1, { lg: 6, md: 12, xs: 12, children: jsx(SelectTableBox$1, { labelSize: "d-flex form-row-inline label-medium", control: control, name: "sheetId", label: t('Sheet name'), required: true, errors: errors.sheetId, placeholder: t('Select'), options: optionSheetName }) }), jsx(Col$1, { lg: 6, md: 12, xs: 12, children: jsx(NumberInput, { control: control, name: "headerRow", labelSize: "d-flex form-row-inline label-medium", label: t('Header row'), errors: errors.headerRow }) })] })] }));
|
|
68337
68347
|
};
|
|
68338
68348
|
|
|
68339
68349
|
const TabValidateImportExcel = (props) => {
|
|
@@ -68362,7 +68372,7 @@ const TabValidateImportExcel = (props) => {
|
|
|
68362
68372
|
|
|
68363
68373
|
const ModalImportComponent = (props) => {
|
|
68364
68374
|
const { t } = useTranslation();
|
|
68365
|
-
const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, formatNumber, mapColumn, headerValidateExcelColumns,
|
|
68375
|
+
const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, formatNumber, mapColumn, headerValidateExcelColumns, getExcelTemplate, templateCode, resourceName, zIndex, } = props;
|
|
68366
68376
|
const [optionField, setOptionField] = useState([]);
|
|
68367
68377
|
const [dataMerge, setDataMerge] = useState([]);
|
|
68368
68378
|
const [dataValidate, setDataValidate] = useState([]);
|
|
@@ -68560,11 +68570,11 @@ const ModalImportComponent = (props) => {
|
|
|
68560
68570
|
setValue('step', 2);
|
|
68561
68571
|
}
|
|
68562
68572
|
};
|
|
68563
|
-
return (jsx(Modal$1, { isOpen: openModal,
|
|
68573
|
+
return (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: 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: [
|
|
68564
68574
|
{
|
|
68565
68575
|
id: 'upload-file',
|
|
68566
68576
|
title: t('Upload file'),
|
|
68567
|
-
content: (jsx(TabSelectFileImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, watch: watch, templateUrl: templateUrl })),
|
|
68577
|
+
content: (jsx(TabSelectFileImportExcel, { control: control, errors: errors, getValues: getValues, setValue: setValue, watch: watch, templateUrl: templateUrl, resourceName: resourceName, templateCode: templateCode, getExcelTemplate: getExcelTemplate })),
|
|
68568
68578
|
},
|
|
68569
68579
|
{
|
|
68570
68580
|
id: 'merge-data',
|