react-table-edit 1.5.33 → 1.5.35

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.
@@ -45,12 +45,12 @@ type IFProps = {
45
45
  * API cập nhật cấu hình import
46
46
  * @param params - Tham số cập nhật
47
47
  */
48
- updateGeneralSettingApi: (params: IFDataMapExcel[]) => void;
48
+ updateGeneralSettingApi?: (params: IFDataMapExcel[]) => void;
49
49
  /**
50
50
  * API lấy cấu hình in
51
51
  * @returns Promise trả về kết quả in
52
52
  */
53
- getGeneralSettingApi: () => Promise<any>;
53
+ getGeneralSettingApi?: () => Promise<any>;
54
54
  };
55
55
  declare const ModalImportComponent: (props: IFProps) => import("react/jsx-runtime").JSX.Element;
56
56
  export { ModalImportComponent };
@@ -3,7 +3,7 @@ import 'react-resizable/css/styles.css';
3
3
  import { IFFilterTable, IFOrderTable, IFTableEditFormat, IHeaderColumnTable } from '../type';
4
4
  type IFDataProps = {
5
5
  idTable: string;
6
- selectEnable: boolean;
6
+ selectEnable?: boolean;
7
7
  dataSource: any[];
8
8
  setSelectedRows: Dispatch<SetStateAction<any[]>>;
9
9
  col: IHeaderColumnTable;
@@ -12,11 +12,12 @@ type IContentColProps = {
12
12
  objWidthFixRight: any;
13
13
  lastObjWidthFixLeft: number;
14
14
  fisrtObjWidthFixRight: number;
15
- selectEnable?: boolean;
16
15
  isMulti?: boolean;
17
16
  fieldKey: string;
18
17
  zeroVisiable?: boolean;
19
18
  setSelectedRows: (value: any[]) => void;
19
+ handleCloseContext: () => void;
20
+ handleDoubleClick?: (row: any, col: IColumnTable) => void;
20
21
  };
21
22
  export declare const RenderContentCol: (props: IContentColProps) => import("react/jsx-runtime").JSX.Element;
22
23
  export {};
@@ -5,8 +5,6 @@ type TableViewProps = {
5
5
  dataSource: any[];
6
6
  height?: number;
7
7
  columns: IColumnTable[];
8
- selectEnable?: boolean;
9
- isMutil?: boolean;
10
8
  isLoading?: boolean;
11
9
  formatSetting?: IFTableEditFormat;
12
10
  pagingSetting?: IFTableEditPaging;
@@ -39,7 +37,7 @@ type TableViewProps = {
39
37
  resetDefaultColumns?: () => void;
40
38
  saveSettingColumn?: (data: IFSettingColumns[]) => void;
41
39
  setSelectedItem?: Dispatch<SetStateAction<any>>;
42
- handleDoubleClick?: (args: any) => void;
40
+ handleDoubleClick?: (row: any, col: IColumnTable) => void;
43
41
  contextMenuItems?: IContextItem[];
44
42
  handleContextMenuClick?: (context: IContextItem, data: any) => void;
45
43
  isMulti?: boolean;
@@ -224,6 +224,8 @@ export type IColumnTable = {
224
224
  onPaste?: (dataRow: any, dataPaste: any) => void;
225
225
  /** Xác thực dữ liệu được paste */
226
226
  onPasteValidate?: (dataPaste: string, dataRow: any, rowIndex: number) => Promise<any>;
227
+ /** Chỉ dùng cho bảng view */
228
+ onClick?: (dataRow: any, rowIndex: number) => void;
227
229
  /**Không có tác dụng */
228
230
  rowspan?: number;
229
231
  };
@@ -267,6 +269,8 @@ export type IFTableEditToolbar = {
267
269
  toolbarBottomOptions?: IFToolbarOptions[];
268
270
  /** Hiển thị thanh công cụ dưới */
269
271
  showBottomToolbar?: boolean;
272
+ /** Hiển thị nút cài đặt cột */
273
+ hiddenSetting?: boolean;
270
274
  };
271
275
  /** Cấu hình tìm kiếm trong bảng */
272
276
  export type IFTableEditSearchSetting = {
package/dist/index.d.ts CHANGED
@@ -228,6 +228,8 @@ type IColumnTable = {
228
228
  onPaste?: (dataRow: any, dataPaste: any) => void;
229
229
  /** Xác thực dữ liệu được paste */
230
230
  onPasteValidate?: (dataPaste: string, dataRow: any, rowIndex: number) => Promise<any>;
231
+ /** Chỉ dùng cho bảng view */
232
+ onClick?: (dataRow: any, rowIndex: number) => void;
231
233
  /**Không có tác dụng */
232
234
  rowspan?: number;
233
235
  };
@@ -271,6 +273,8 @@ type IFTableEditToolbar = {
271
273
  toolbarBottomOptions?: IFToolbarOptions[];
272
274
  /** Hiển thị thanh công cụ dưới */
273
275
  showBottomToolbar?: boolean;
276
+ /** Hiển thị nút cài đặt cột */
277
+ hiddenSetting?: boolean;
274
278
  };
275
279
  /** Cấu hình tìm kiếm trong bảng */
276
280
  type IFTableEditSearchSetting = {
@@ -579,12 +583,12 @@ type IFProps$1 = {
579
583
  * API cập nhật cấu hình import
580
584
  * @param params - Tham số cập nhật
581
585
  */
582
- updateGeneralSettingApi: (params: IFDataMapExcel[]) => void;
586
+ updateGeneralSettingApi?: (params: IFDataMapExcel[]) => void;
583
587
  /**
584
588
  * API lấy cấu hình in
585
589
  * @returns Promise trả về kết quả in
586
590
  */
587
- getGeneralSettingApi: () => Promise<any>;
591
+ getGeneralSettingApi?: () => Promise<any>;
588
592
  };
589
593
  declare const ModalImportComponent: (props: IFProps$1) => react_jsx_runtime.JSX.Element;
590
594
 
@@ -703,8 +707,6 @@ type TableViewProps = {
703
707
  dataSource: any[];
704
708
  height?: number;
705
709
  columns: IColumnTable[];
706
- selectEnable?: boolean;
707
- isMutil?: boolean;
708
710
  isLoading?: boolean;
709
711
  formatSetting?: IFTableEditFormat;
710
712
  pagingSetting?: IFTableEditPaging;
@@ -737,7 +739,7 @@ type TableViewProps = {
737
739
  resetDefaultColumns?: () => void;
738
740
  saveSettingColumn?: (data: IFSettingColumns[]) => void;
739
741
  setSelectedItem?: Dispatch<SetStateAction<any>>;
740
- handleDoubleClick?: (args: any) => void;
742
+ handleDoubleClick?: (row: any, col: IColumnTable) => void;
741
743
  contextMenuItems?: IContextItem[];
742
744
  handleContextMenuClick?: (context: IContextItem, data: any) => void;
743
745
  isMulti?: boolean;
package/dist/index.js CHANGED
@@ -19838,7 +19838,7 @@ const generateUUID = () => {
19838
19838
  * @param isDone đã nhập xong
19839
19839
  * @returns
19840
19840
  */
19841
- const formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 10, isDone, haveNegative = true) => {
19841
+ const formartNumberic = (str, decimalSeparator, thousandSeparator, fraction = 2, isDone, haveNegative = true) => {
19842
19842
  if (isDone) {
19843
19843
  str = roundNumber(Number(str), fraction);
19844
19844
  }
@@ -20128,7 +20128,7 @@ const getMaxExpandedLevel = (items, fieldChildren = 'children', level = 0) => {
20128
20128
  });
20129
20129
  return max;
20130
20130
  };
20131
- const findItemInTree = (items, filter, keyFilter = "value", keyChildren = "children") => {
20131
+ const findItemInTree = (items, filter, keyFilter = 'value', keyChildren = 'children') => {
20132
20132
  for (let index = 0; index < items.length; index++) {
20133
20133
  const item = items[index];
20134
20134
  if (item[keyFilter] === filter) {
@@ -39042,7 +39042,7 @@ const HeaderTableCol = (props) => {
39042
39042
  left: col.fixedType === 'left' ? objHeaderWidthFixLeft[`${indexParent}-${indexCol ?? 0}`] : undefined,
39043
39043
  right: col.fixedType === 'right' ? objHeaderWidthFixRight[`${indexParent}-${indexCol ?? 0}`] : undefined
39044
39044
  }, children: jsxRuntime.jsxs("div", { style: { justifyContent: col.textAlign === 'center' ? 'center' : 'space-between' }, onClick: () => {
39045
- if (!allowSorting || col.columns?.length) {
39045
+ if (!allowSorting || col.columns?.length || col.field === 'checkbox') {
39046
39046
  return;
39047
39047
  }
39048
39048
  if (order) {
@@ -39840,12 +39840,12 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
39840
39840
  return (jsxRuntime.jsx("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: jsxRuntime.jsxs("div", { className: "r-toolbar-items", children: [jsxRuntime.jsxs("div", { className: "r-toolbar-left", children: [jsxRuntime.jsxs("div", { className: classNames$1('r-toolbar-item d-flex', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: [jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: () => handleAdd(1), className: "d-flex", children: t('Add item') }), !!buttonSetting?.disableAddMulti && (jsxRuntime.jsxs(UncontrolledDropdown, { className: "nav-item", children: [jsxRuntime.jsx(DropdownToggle$1, { tag: "div", className: "me-0 d-flex", children: jsxRuntime.jsx(Button$1$1, { type: "button", color: "success", outline: true, style: { marginLeft: -1 }, className: "px-25", children: jsxRuntime.jsx("svg", { fill: "#28c76f", height: "15", width: "20", viewBox: "0 0 20 20", children: jsxRuntime.jsx("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) }) }), jsxRuntime.jsxs(DropdownMenu$1, { className: "formula-dropdown icon-dropdown p-0", children: [jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(10), children: "10 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(20), children: "20 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(30), children: "30 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(40), children: "40 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(50), children: "50 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(100), children: "100 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(1000), children: "1000 h\u00E0ng" })] })] }))] }), (focusRow ?? -1) > -1 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: () => {
39841
39841
  handleDuplicate();
39842
39842
  }, className: "d-flex", children: t('Duplicate') }) }), jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t('Insert item before') }) }), jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t('Insert item after') }) })] })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: " " })), jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item', { 'd-none': editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: jsxRuntime.jsx(Button$1$1, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t('Delete all item') }) }), toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
39843
- return item.align === 'left' ? (jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`)) : ('');
39843
+ return (item.align === 'left' && (jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`)));
39844
39844
  })] }), jsxRuntime.jsx("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
39845
- return item.align === 'center' ? (jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`)) : ('');
39845
+ return (item.align === 'center' && (jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`)));
39846
39846
  }) }), jsxRuntime.jsxs("div", { className: "r-toolbar-right", children: [toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
39847
- return item.align === 'right' ? (jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`)) : ('');
39848
- }), jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item me-25'), "aria-disabled": "false", children: jsxRuntime.jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxRuntime.jsxs(UncontrolledDropdown, { className: "dropdown-user nav-item", children: [jsxRuntime.jsx(DropdownToggle$1, { tag: "div", color: "primary", onClick: (e) => e.preventDefault(), children: jsxRuntime.jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsxRuntime.jsx(DropdownMenu$1, { className: "formula-dropdown icon-dropdown", children: jsxRuntime.jsxs("ul", { className: "mb-0 pe-50", children: [jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl ho\u1EB7c Alt + Shift + \u2193 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng d\u01B0\u1EDBi" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl ho\u1EB7c Alt + Shift + \u2191 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng tr\u00EAn" })] }) })] }) })] })] }) }));
39847
+ return (item.align === 'right' && (jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`)));
39848
+ }), !toolbarSetting?.hiddenSetting && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item me-25'), "aria-disabled": "false", children: jsxRuntime.jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxRuntime.jsxs(UncontrolledDropdown, { className: "dropdown-user nav-item", children: [jsxRuntime.jsx(DropdownToggle$1, { tag: "div", color: "primary", onClick: (e) => e.preventDefault(), children: jsxRuntime.jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsxRuntime.jsx(DropdownMenu$1, { className: "formula-dropdown icon-dropdown", children: jsxRuntime.jsxs("ul", { className: "mb-0 pe-50", children: [jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl ho\u1EB7c Alt + Shift + \u2193 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng d\u01B0\u1EDBi" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl ho\u1EB7c Alt + Shift + \u2191 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng tr\u00EAn" })] }) })] }) })] }))] })] }) }));
39849
39849
  };
39850
39850
 
39851
39851
  const RenderToolbarTop = ({ toolbarTopOption }) => {
@@ -49176,13 +49176,13 @@ const TabHandleErrorImportExcel = (props) => {
49176
49176
  const TabMergeImportExcel = (props) => {
49177
49177
  const { setValue, watch, windowSize, optionField, formatNumber } = props;
49178
49178
  const { t } = reactI18next.useTranslation();
49179
- return (jsxRuntime.jsxs("div", { className: 'box form-box__border', children: [jsxRuntime.jsx("h5", { className: 'm-0 form-box__border--title', children: t('Merge data fields') }), jsxRuntime.jsx(TableEdit, { formatSetting: {
49179
+ return (jsxRuntime.jsxs("div", { className: "box form-box__border", children: [jsxRuntime.jsx("h5", { className: "m-0 form-box__border--title", children: t('Merge data fields') }), jsxRuntime.jsx(TableEdit, { formatSetting: {
49180
49180
  decimalSeparator: formatNumber?.decimalSeparator,
49181
49181
  thousandSeparator: formatNumber?.thousandSeparator,
49182
49182
  colorNegative: formatNumber?.colorNegative,
49183
49183
  prefixNegative: formatNumber?.prefixNegative,
49184
49184
  suffixNegative: formatNumber?.suffixNegative
49185
- }, idTable: 'MapColumnImportExcel', columns: [
49185
+ }, idTable: "MapColumnImportExcel", columns: [
49186
49186
  {
49187
49187
  headerText: 'Required Information',
49188
49188
  field: 'isRequired',
@@ -49190,7 +49190,7 @@ const TabMergeImportExcel = (props) => {
49190
49190
  editEnable: true,
49191
49191
  textAlign: 'center',
49192
49192
  template: (data) => {
49193
- return jsxRuntime.jsx(jsxRuntime.Fragment, { children: data.isRequired ? jsxRuntime.jsx(SvgCheckSquare, { color: 'green', fontSize: 18 }) : jsxRuntime.jsx(SvgXSquare, { color: 'red', fontSize: 18 }) });
49193
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: data.isRequired ? jsxRuntime.jsx(SvgCheckSquare, { color: "green", fontSize: 18 }) : jsxRuntime.jsx(SvgXSquare, { color: "red", fontSize: 18 }) });
49194
49194
  },
49195
49195
  disabledCondition: (row) => {
49196
49196
  return row.disableEdit ?? false;
@@ -49212,15 +49212,18 @@ const TabMergeImportExcel = (props) => {
49212
49212
  type: 'select',
49213
49213
  editEnable: true,
49214
49214
  selectSettings: {
49215
- options: optionField
49215
+ options: optionField,
49216
+ isClearable: true
49216
49217
  },
49217
49218
  callback(value, indexRow, item) {
49218
- if (!item.headerDefault.includes(value.label)) {
49219
- item.headerDefault.push(value.label ? value.label?.trim() : '');
49219
+ if (!item.headerDefault.includes(value?.label)) {
49220
+ item.headerDefault.push(value?.label ? value?.label?.trim() : '');
49220
49221
  }
49221
49222
  },
49222
49223
  visible: watch('dataMap').length > 0,
49223
- template: (row) => { return optionField.find((e) => e.value === row.column)?.label; },
49224
+ template: (row) => {
49225
+ return optionField.find((e) => e.value === row.column)?.label;
49226
+ },
49224
49227
  width: 300,
49225
49228
  minWidth: 250,
49226
49229
  maxWidth: 350
@@ -68398,7 +68401,7 @@ const ModalImportComponent = (props) => {
68398
68401
  const [checkInitValidate, setCheckInitValidate] = React$5.useState(false);
68399
68402
  const [validateExcelColumns, setValidateExcelColumns] = React$5.useState(mapColumn);
68400
68403
  const [dataError, setDataError] = React$5.useState([]);
68401
- const [isSaveSetting, setIsSaveSetting] = React$5.useState(true);
68404
+ const [isSaveSetting, setIsSaveSetting] = React$5.useState(!!getGeneralSettingApi && !!updateGeneralSettingApi);
68402
68405
  const formSchema = create().shape({
68403
68406
  step: create$1(),
68404
68407
  sheetId: create$2().when('step', {
@@ -68451,7 +68454,7 @@ const ModalImportComponent = (props) => {
68451
68454
  mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate).then((arr) => {
68452
68455
  setCheckInitValidate(true);
68453
68456
  if (isSaveSetting) {
68454
- updateGeneralSettingApi(data.dataMap.map((x) => ({ ...x, column: undefined })));
68457
+ updateGeneralSettingApi?.(data.dataMap.map((x) => ({ ...x, column: undefined })));
68455
68458
  }
68456
68459
  validateExcelApi(arr)
68457
68460
  .then((rs) => {
@@ -68462,7 +68465,8 @@ const ModalImportComponent = (props) => {
68462
68465
  setDataValid(list.filter((x) => x.error || x.errors?.length === 0));
68463
68466
  setValue('step', 3);
68464
68467
  })
68465
- .catch(() => {
68468
+ .catch((ex) => {
68469
+ console.log(ex);
68466
68470
  notificationError(t('GetFail'));
68467
68471
  setCheckInitValidate(false);
68468
68472
  });
@@ -68528,24 +68532,26 @@ const ModalImportComponent = (props) => {
68528
68532
  }
68529
68533
  }
68530
68534
  ];
68531
- React$5.useEffect(() => {
68532
- console.log(watch('dataMap'));
68533
- }, [watch('dataMap')]);
68534
68535
  const handleFormOpened = () => {
68535
- getGeneralSettingApi()
68536
- .then((rs) => {
68537
- const arr = rs?.value ? JSON.parse(rs.value) : [];
68538
- setValue('dataMap', [...mapColumn].map((x) => {
68539
- const ele = arr.find((y) => x.field === y.field);
68540
- if (ele) {
68541
- x.headerDefault = ele.headerDefault;
68542
- }
68543
- return x;
68544
- }));
68545
- })
68546
- .catch(() => {
68536
+ if (getGeneralSettingApi) {
68537
+ getGeneralSettingApi()
68538
+ .then((rs) => {
68539
+ const arr = rs?.value ? JSON.parse(rs.value) : [];
68540
+ setValue('dataMap', [...mapColumn].map((x) => {
68541
+ const ele = arr.find((y) => x.field === y.field);
68542
+ if (ele) {
68543
+ x.headerDefault = ele.headerDefault;
68544
+ }
68545
+ return x;
68546
+ }));
68547
+ })
68548
+ .catch(() => {
68549
+ setValue('dataMap', [...mapColumn]);
68550
+ });
68551
+ }
68552
+ else {
68547
68553
  setValue('dataMap', [...mapColumn]);
68548
- });
68554
+ }
68549
68555
  if (headerValidateExcelColumns && headerValidateExcelColumns.length > 0) {
68550
68556
  setValidateExcelColumns(headerValidateExcelColumns);
68551
68557
  }
@@ -68596,7 +68602,7 @@ const ModalImportComponent = (props) => {
68596
68602
  visible: !!headerErrorExcelColumns,
68597
68603
  content: jsxRuntime.jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
68598
68604
  }
68599
- ] }) }) }) }), 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) => {
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 && getGeneralSettingApi && updateGeneralSettingApi && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
68600
68606
  setIsSaveSetting(val.target.checked);
68601
68607
  } }), 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') })] })] })] }) }));
68602
68608
  };
@@ -68731,7 +68737,7 @@ const UnExpandAllIcon = ({ className, color = '#7F7F7F', size = 24, onClick, sty
68731
68737
  };
68732
68738
 
68733
68739
  const RenderContentCol = (props) => {
68734
- const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
68740
+ const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, fieldKey, isMulti } = props;
68735
68741
  const cellId = `content-${idTable}-row${indexRow}col-${indexCol}`;
68736
68742
  const checkOverflow = () => {
68737
68743
  const element = document.getElementById(cellId);
@@ -68739,31 +68745,27 @@ const RenderContentCol = (props) => {
68739
68745
  };
68740
68746
  const RenderElement = () => {
68741
68747
  if (col.type === 'checkbox' || col.field === 'checkbox') {
68742
- return (jsxRuntime.jsx("div", { className: "r-rowcell-div cursor-pointer", style: { display: 'flex', justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start', alignItems: 'center' }, onClick: (e) => {
68743
- console.log(isMulti);
68744
- console.log(selectEnable);
68745
- if (selectEnable) {
68746
- const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
68747
- if (index > -1) {
68748
- if (isMulti) {
68749
- selectedRows?.splice(index, 1);
68750
- setSelectedRows([...selectedRows]);
68751
- }
68752
- else {
68753
- setSelectedRows([]);
68754
- }
68748
+ return (jsxRuntime.jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer', { 'r-active-cell': isSelected }), style: { display: 'flex', justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start', alignItems: 'center' }, onClick: (e) => {
68749
+ const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
68750
+ if (index > -1) {
68751
+ if (isMulti) {
68752
+ selectedRows?.splice(index, 1);
68753
+ setSelectedRows([...selectedRows]);
68755
68754
  }
68756
68755
  else {
68757
- if (isMulti) {
68758
- setSelectedRows([...selectedRows, row]);
68759
- }
68760
- else {
68761
- setSelectedRows([row]);
68762
- }
68756
+ setSelectedRows([]);
68763
68757
  }
68764
- e.stopPropagation();
68765
68758
  }
68766
- }, children: jsxRuntime.jsx(Input$1, { checked: isSelected, type: "checkbox", className: "cursor-pointer", style: { textAlign: col.textAlign ?? 'center' } }) }));
68759
+ else {
68760
+ if (isMulti) {
68761
+ setSelectedRows([...selectedRows, row]);
68762
+ }
68763
+ else {
68764
+ setSelectedRows([row]);
68765
+ }
68766
+ }
68767
+ e.stopPropagation();
68768
+ }, children: jsxRuntime.jsx(Input$1, { defaultChecked: isSelected, type: "checkbox", className: "cursor-pointer", style: { textAlign: col.textAlign ?? 'center' } }) }));
68767
68769
  }
68768
68770
  else {
68769
68771
  let value = row[col.field];
@@ -68788,9 +68790,13 @@ const RenderContentCol = (props) => {
68788
68790
  const prefix = isNegative ? formatSetting?.prefixNegative ?? '-' : '';
68789
68791
  const suffix = isNegative ? formatSetting?.suffixNegative ?? '' : '';
68790
68792
  const displayText = isNegative ? `${prefix}${value}${suffix}` : value ?? '';
68791
- return (jsxRuntime.jsxs("div", { className: classNames$1('r-rowcell-div'), style: {
68793
+ return (jsxRuntime.jsxs("div", { className: classNames$1('r-rowcell-div cursor-pointer', { 'r-active-cell': isSelected }), style: {
68792
68794
  fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
68793
68795
  fontStyle: row.haveItalicType ? 'italic' : 'normal'
68796
+ }, onDoubleClick: (e) => {
68797
+ e.preventDefault();
68798
+ handleCloseContext();
68799
+ handleDoubleClick?.(row, col);
68794
68800
  }, children: [jsxRuntime.jsx("div", { className: "r-cell-text", style: {
68795
68801
  display: 'flex',
68796
68802
  justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start',
@@ -68809,24 +68815,22 @@ const RenderContentCol = (props) => {
68809
68815
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined
68810
68816
  }, onClick: (e) => {
68811
68817
  if (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD') {
68812
- if (selectEnable) {
68813
- const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
68814
- if (index > -1) {
68815
- if (isMulti) {
68816
- selectedRows?.splice(index, 1);
68817
- setSelectedRows([...selectedRows]);
68818
- }
68819
- else {
68820
- setSelectedRows([]);
68821
- }
68818
+ const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
68819
+ if (index > -1) {
68820
+ if (isMulti) {
68821
+ selectedRows?.splice(index, 1);
68822
+ setSelectedRows([...selectedRows]);
68822
68823
  }
68823
68824
  else {
68824
- if (isMulti) {
68825
- setSelectedRows([...selectedRows, row]);
68826
- }
68827
- else {
68828
- setSelectedRows([row]);
68829
- }
68825
+ setSelectedRows([]);
68826
+ }
68827
+ }
68828
+ else {
68829
+ if (isMulti) {
68830
+ setSelectedRows([...selectedRows, row]);
68831
+ }
68832
+ else {
68833
+ setSelectedRows([row]);
68830
68834
  }
68831
68835
  }
68832
68836
  e.stopPropagation();
@@ -68834,7 +68838,7 @@ const RenderContentCol = (props) => {
68834
68838
  }, children: RenderElement() }, `col-${indexRow}-${indexCol}`)) }));
68835
68839
  };
68836
68840
 
68837
- const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false, isLoading, selectEnable, formatSetting, querySetting, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent, groupSetting, zeroVisiable, isMulti, handleDoubleClick, contextMenuItems, handleContextMenuClick }) => {
68841
+ const TableView = ({ idTable, dataSource, height = 400, columns, isLoading, formatSetting, querySetting, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent, groupSetting, zeroVisiable, isMulti, handleDoubleClick, contextMenuItems, handleContextMenuClick }) => {
68838
68842
  const { t } = reactI18next.useTranslation();
68839
68843
  const gridRef = React$5.useRef(null);
68840
68844
  const [openPopupSetupColumn, setOpenPopupSetupColumn] = React$5.useState(false);
@@ -69045,8 +69049,10 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
69045
69049
  }
69046
69050
  };
69047
69051
  React$5.useEffect(() => {
69052
+ console.log(selectedRows);
69053
+ console.log(isMulti);
69048
69054
  if (setSelectedItem) {
69049
- if (isMutil) {
69055
+ if (isMulti) {
69050
69056
  if (dataSource && selectedRows && selectedRows?.length !== selectedItem?.length) {
69051
69057
  setSelectedItem([...selectedRows]);
69052
69058
  if (handleSelect) {
@@ -69073,7 +69079,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
69073
69079
  }
69074
69080
  }, [selectedRows]);
69075
69081
  React$5.useEffect(() => {
69076
- if (!isMutil) {
69082
+ if (!isMulti) {
69077
69083
  if (dataSource && selectedItem && selectedItem[fieldKey]) {
69078
69084
  if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
69079
69085
  setSelectedRows([selectedItem]);
@@ -69139,14 +69145,10 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
69139
69145
  }
69140
69146
  else {
69141
69147
  const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
69142
- return (jsxRuntime.jsx("tr", { id: `row-content-${indexRow}`, "aria-rowindex": indexRow + 1, role: "row", className: classNames$1('r-row', { 'r-last-row': level === 0 && indexRow === viewData.length - 1 }), onDoubleClick: (e) => {
69143
- e.preventDefault();
69144
- handleCloseContext();
69145
- handleDoubleClick?.(row);
69146
- }, onContextMenu: (e) => {
69148
+ return (jsxRuntime.jsx("tr", { id: `row-content-${indexRow}`, "aria-rowindex": indexRow + 1, role: "row", className: classNames$1('r-row', { 'r-last-row': level === 0 && indexRow === viewData.length - 1 }), onContextMenu: (e) => {
69147
69149
  e.preventDefault();
69148
69150
  handleContextMenu(e, row);
69149
- }, children: contentColumns.map((column, indexCol) => (jsxRuntime.jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: fieldKey, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row, zeroVisiable: zeroVisiable }, indexCol))) }, `row-content-${indexRow}`));
69151
+ }, children: contentColumns.map((column, indexCol) => (jsxRuntime.jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: fieldKey, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMulti, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row, zeroVisiable: zeroVisiable, handleCloseContext: handleCloseContext, handleDoubleClick: handleDoubleClick }, indexCol))) }, `row-content-${indexRow}`));
69150
69152
  }
69151
69153
  }) }));
69152
69154
  };
@@ -69174,7 +69176,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
69174
69176
  }
69175
69177
  }, [context]);
69176
69178
  return (jsxRuntime.jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxRuntime.jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}`, position: 'relative' }, children: [jsxRuntime.jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: contentColumns }), jsxRuntime.jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => {
69177
- return (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((col, index) => (jsxRuntime.jsx(HeaderTableCol, { col: col, idTable: idTable ?? '', dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, container: gridRef, filterBy: filterBy, orderBy: orderBy, optionsFilter: querySetting?.optionsFilter, allowFiltering: querySetting?.allowFiltering, allowSorting: querySetting?.allowSorting, formatSetting: formatSetting, changeFilter: (val) => {
69179
+ return (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((col, index) => (jsxRuntime.jsx(HeaderTableCol, { col: col, idTable: idTable ?? '', dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, selectEnable: true, selectedRows: selectedRows, setSelectedRows: setSelectedRows, container: gridRef, filterBy: filterBy, orderBy: orderBy, optionsFilter: querySetting?.optionsFilter, allowFiltering: querySetting?.allowFiltering, allowSorting: querySetting?.allowSorting, formatSetting: formatSetting, changeFilter: (val) => {
69178
69180
  setFilterBy([...val]);
69179
69181
  if (querySetting?.changeFilter) {
69180
69182
  querySetting.changeFilter(val);