react-table-edit 1.4.49 → 1.4.50

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/index.mjs CHANGED
@@ -52709,6 +52709,11 @@ const TabMergeImportExcel = (props) => {
52709
52709
  selectSettings: {
52710
52710
  options: optionField
52711
52711
  },
52712
+ callback(value, indexRow, item) {
52713
+ if (!item.headerDefault.includes(value.label)) {
52714
+ item.headerDefault.push(value.label ? value.label?.trim() : '');
52715
+ }
52716
+ },
52712
52717
  visible: watch('dataMap').length > 0,
52713
52718
  template: (row) => { return optionField.find((e) => e.value === row.column)?.label; },
52714
52719
  width: 300,
@@ -71888,7 +71893,7 @@ const TabValidateImportExcel = (props) => {
71888
71893
 
71889
71894
  const ModalImportComponent = (props) => {
71890
71895
  const { t } = useTranslation();
71891
- const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, pageOptions, pageSizeDefault, formatNumber, mapColumn, headerValidateExcelColumns } = props;
71896
+ const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, pageOptions, pageSizeDefault, formatNumber, mapColumn, headerValidateExcelColumns } = props;
71892
71897
  const [optionField, setOptionField] = useState([]);
71893
71898
  const [dataMerge, setDataMerge] = useState([]);
71894
71899
  const [dataValidate, setDataValidate] = useState([]);
@@ -71898,6 +71903,7 @@ const ModalImportComponent = (props) => {
71898
71903
  const [checkInitValidate, setCheckInitValidate] = useState(false);
71899
71904
  const [validateExcelColumns, setValidateExcelColumns] = useState([]);
71900
71905
  const [dataError, setDataError] = useState([]);
71906
+ const [isSaveSetting, setIsSaveSetting] = useState(true);
71901
71907
  const formSchema = create().shape({
71902
71908
  step: create$1(),
71903
71909
  sheetId: create$2()
@@ -71944,9 +71950,17 @@ const ModalImportComponent = (props) => {
71944
71950
  getColumnsSheetExcel(data.file, data.headerRow ?? 0, data.sheetId ?? "", handleSetColumns);
71945
71951
  }
71946
71952
  else if (getValues('step') === 2) {
71953
+ const check = data.dataMap.find(x => x.isRequired && !x.column);
71954
+ if (check) {
71955
+ messageBoxError(t, `Vui lòng chọn trường ghép cho cột <<${check.header}>>`);
71956
+ return;
71957
+ }
71947
71958
  mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate)
71948
71959
  .then((arr) => {
71949
71960
  setCheckInitValidate(true);
71961
+ if (isSaveSetting) {
71962
+ updateGeneralSettingApi(data.dataMap.map(x => ({ ...x, column: undefined })));
71963
+ }
71950
71964
  validateExcelApi(arr)
71951
71965
  .then((rs) => {
71952
71966
  setCheckInitValidate(false);
@@ -72021,7 +72035,11 @@ const ModalImportComponent = (props) => {
72021
72035
  }
72022
72036
  ];
72023
72037
  const handleFormOpened = () => {
72024
- setValue('dataMap', mapColumn);
72038
+ getGeneralSettingApi().then((rs) => {
72039
+ setValue('dataMap', rs.value ? JSON.parse(rs.value) : mapColumn);
72040
+ }).catch(() => {
72041
+ setValue('dataMap', mapColumn);
72042
+ });
72025
72043
  if (headerValidateExcelColumns && headerValidateExcelColumns.length > 0) {
72026
72044
  setValidateExcelColumns(headerValidateExcelColumns);
72027
72045
  }
@@ -72049,9 +72067,6 @@ const ModalImportComponent = (props) => {
72049
72067
  setValue('step', 2);
72050
72068
  }
72051
72069
  };
72052
- const renderFooterButtons = () => {
72053
- return (jsxs(Fragment, { children: [jsx(Button$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, { 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, { 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, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] }));
72054
- };
72055
72070
  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: [
72056
72071
  {
72057
72072
  id: 'upload-file',
@@ -72074,7 +72089,9 @@ const ModalImportComponent = (props) => {
72074
72089
  visiable: !!headerErrorExcelColumns,
72075
72090
  content: jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, pageOptions: pageOptions, pageSizeDefault: pageSizeDefault, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
72076
72091
  }
72077
- ] }) }) }) }), jsx("div", { className: "d-flex justify-content-end p-1", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: renderFooterButtons() })] }) }));
72092
+ ] }) }) }) }), 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 && jsxs(Fragment$1, { children: [jsx(Input$1, { checked: isSaveSetting, type: 'checkbox', className: 'me-50', onChange: (val) => {
72093
+ setIsSaveSetting(val.target.checked);
72094
+ } }), 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, { 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, { 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, { 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, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
72078
72095
  };
72079
72096
 
72080
72097
  const TabsMenuComponent = ({ buttonWidth, tabParent, tabChild, resourceCodeParent, resources, resourceCode, windowSize, renderModal }) => {