react-table-edit 1.4.49 → 1.4.51

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.
@@ -44,6 +44,16 @@ type IFProps = {
44
44
  * @returns Promise<any>
45
45
  */
46
46
  validateExcelApi: (params: any) => Promise<any>;
47
+ /**
48
+ * API cập nhật cấu hình import
49
+ * @param params - Tham số cập nhật
50
+ */
51
+ updateGeneralSettingApi: (params: IFDataMapExcel[]) => void;
52
+ /**
53
+ * API lấy cấu hình in
54
+ * @returns Promise trả về kết quả in
55
+ */
56
+ getGeneralSettingApi: () => Promise<any>;
47
57
  };
48
58
  declare const ModalImportComponent: (props: IFProps) => import("react/jsx-runtime").JSX.Element;
49
59
  export { ModalImportComponent };
@@ -4,8 +4,6 @@ export interface IFPropsDetail {
4
4
  setColumn: any;
5
5
  openSidebar: boolean;
6
6
  handleSidebar: any;
7
- resetDefaultColumns?: () => void;
8
- formatSetting?: any;
9
7
  }
10
8
  declare const SidebarSetColumn: (props: IFPropsDetail) => import("react/jsx-runtime").JSX.Element;
11
9
  export default SidebarSetColumn;
package/dist/index.d.ts CHANGED
@@ -550,6 +550,16 @@ type IFProps$1 = {
550
550
  * @returns Promise<any>
551
551
  */
552
552
  validateExcelApi: (params: any) => Promise<any>;
553
+ /**
554
+ * API cập nhật cấu hình import
555
+ * @param params - Tham số cập nhật
556
+ */
557
+ updateGeneralSettingApi: (params: IFDataMapExcel[]) => void;
558
+ /**
559
+ * API lấy cấu hình in
560
+ * @returns Promise trả về kết quả in
561
+ */
562
+ getGeneralSettingApi: () => Promise<any>;
553
563
  };
554
564
  declare const ModalImportComponent: (props: IFProps$1) => react_jsx_runtime.JSX.Element;
555
565
 
package/dist/index.js CHANGED
@@ -52737,6 +52737,11 @@ const TabMergeImportExcel = (props) => {
52737
52737
  selectSettings: {
52738
52738
  options: optionField
52739
52739
  },
52740
+ callback(value, indexRow, item) {
52741
+ if (!item.headerDefault.includes(value.label)) {
52742
+ item.headerDefault.push(value.label ? value.label?.trim() : '');
52743
+ }
52744
+ },
52740
52745
  visible: watch('dataMap').length > 0,
52741
52746
  template: (row) => { return optionField.find((e) => e.value === row.column)?.label; },
52742
52747
  width: 300,
@@ -71808,7 +71813,7 @@ const mapDataImportExcel = async (dataSheet, headerRow, dataMap, handleValidate)
71808
71813
  }
71809
71814
  }
71810
71815
  else {
71811
- value = row[ele.column] ? row[ele.column].toString() : undefined;
71816
+ value = row[ele.column] ? row[ele.column].toString().trim() : undefined;
71812
71817
  }
71813
71818
  //validate cho mỗi loại
71814
71819
  }
@@ -71916,7 +71921,7 @@ const TabValidateImportExcel = (props) => {
71916
71921
 
71917
71922
  const ModalImportComponent = (props) => {
71918
71923
  const { t } = reactI18next.useTranslation();
71919
- const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, pageOptions, pageSizeDefault, formatNumber, mapColumn, headerValidateExcelColumns } = props;
71924
+ const { windowSize, openModal, handleModal, handleValidate, importExcelApi, validateExcelApi, getGeneralSettingApi, updateGeneralSettingApi, headerErrorExcelColumns, templateUrl, defaultHeaderRow, pageOptions, pageSizeDefault, formatNumber, mapColumn, headerValidateExcelColumns } = props;
71920
71925
  const [optionField, setOptionField] = React$5.useState([]);
71921
71926
  const [dataMerge, setDataMerge] = React$5.useState([]);
71922
71927
  const [dataValidate, setDataValidate] = React$5.useState([]);
@@ -71926,6 +71931,7 @@ const ModalImportComponent = (props) => {
71926
71931
  const [checkInitValidate, setCheckInitValidate] = React$5.useState(false);
71927
71932
  const [validateExcelColumns, setValidateExcelColumns] = React$5.useState([]);
71928
71933
  const [dataError, setDataError] = React$5.useState([]);
71934
+ const [isSaveSetting, setIsSaveSetting] = React$5.useState(true);
71929
71935
  const formSchema = create().shape({
71930
71936
  step: create$1(),
71931
71937
  sheetId: create$2()
@@ -71972,9 +71978,17 @@ const ModalImportComponent = (props) => {
71972
71978
  getColumnsSheetExcel(data.file, data.headerRow ?? 0, data.sheetId ?? "", handleSetColumns);
71973
71979
  }
71974
71980
  else if (getValues('step') === 2) {
71981
+ const check = data.dataMap.find(x => x.isRequired && !x.column);
71982
+ if (check) {
71983
+ messageBoxError(t, `Vui lòng chọn trường ghép cho cột <<${check.header}>>`);
71984
+ return;
71985
+ }
71975
71986
  mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate)
71976
71987
  .then((arr) => {
71977
71988
  setCheckInitValidate(true);
71989
+ if (isSaveSetting) {
71990
+ updateGeneralSettingApi(data.dataMap.map(x => ({ ...x, column: undefined })));
71991
+ }
71978
71992
  validateExcelApi(arr)
71979
71993
  .then((rs) => {
71980
71994
  setCheckInitValidate(false);
@@ -72049,7 +72063,11 @@ const ModalImportComponent = (props) => {
72049
72063
  }
72050
72064
  ];
72051
72065
  const handleFormOpened = () => {
72052
- setValue('dataMap', mapColumn);
72066
+ getGeneralSettingApi().then((rs) => {
72067
+ setValue('dataMap', rs.value ? JSON.parse(rs.value) : mapColumn);
72068
+ }).catch(() => {
72069
+ setValue('dataMap', mapColumn);
72070
+ });
72053
72071
  if (headerValidateExcelColumns && headerValidateExcelColumns.length > 0) {
72054
72072
  setValidateExcelColumns(headerValidateExcelColumns);
72055
72073
  }
@@ -72077,9 +72095,6 @@ const ModalImportComponent = (props) => {
72077
72095
  setValue('step', 2);
72078
72096
  }
72079
72097
  };
72080
- const renderFooterButtons = () => {
72081
- return (jsxRuntime.jsxs(React$5.Fragment, { children: [jsxRuntime.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') }), jsxRuntime.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') }), jsxRuntime.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') }), jsxRuntime.jsx(Button$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] }));
72082
- };
72083
72098
  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: [
72084
72099
  {
72085
72100
  id: 'upload-file',
@@ -72102,7 +72117,9 @@ const ModalImportComponent = (props) => {
72102
72117
  visiable: !!headerErrorExcelColumns,
72103
72118
  content: jsxRuntime.jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, pageOptions: pageOptions, pageSizeDefault: pageSizeDefault, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
72104
72119
  }
72105
- ] }) }) }) }), jsxRuntime.jsx("div", { className: "d-flex justify-content-end p-1", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: renderFooterButtons() })] }) }));
72120
+ ] }) }) }) }), 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) => {
72121
+ setIsSaveSetting(val.target.checked);
72122
+ } }), 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, { 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, { 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, { 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, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
72106
72123
  };
72107
72124
 
72108
72125
  const TabsMenuComponent = ({ buttonWidth, tabParent, tabChild, resourceCodeParent, resources, resourceCode, windowSize, renderModal }) => {