react-table-edit 1.5.21 → 1.5.23

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
@@ -19957,8 +19957,8 @@ const calculateTableStructure = (columns, settingColumns) => {
19957
19957
  }
19958
19958
  traverse(columns);
19959
19959
  // Danh sách các cột được hiển thị
19960
- const flatVisble = flat.filter((e) => e.visible !== false);
19961
- const flatVisbleContent = flatVisble.filter((x) => x.field !== 'command' && x.field !== '#' && x.field !== 'checkbox');
19960
+ // const flatVisble = flat.filter((e) => e.visible !== false)
19961
+ const flatVisbleContent = flat.filter((x) => x.visible !== false && x.field !== 'command' && x.field !== '#' && x.field !== 'checkbox');
19962
19962
  // Tính toán vị trí đầu tiên và cuối cùng của các cột cố định
19963
19963
  const lastObjWidthFixLeft = Math.max(...Object.keys(objWidthFixLeft).map(Number), 0);
19964
19964
  const fisrtObjWidthFixRight = Math.min(...Object.keys(objWidthFixRight).map(Number), flat.length);
@@ -19968,7 +19968,7 @@ const calculateTableStructure = (columns, settingColumns) => {
19968
19968
  return {
19969
19969
  levels,
19970
19970
  flat,
19971
- flatVisble,
19971
+ // flatVisble,
19972
19972
  flatVisbleContent,
19973
19973
  objWidthFixLeft,
19974
19974
  objWidthFixRight,
@@ -20556,12 +20556,6 @@ editDisable, addDisable, toolbarSetting, buttonSetting) => {
20556
20556
  }
20557
20557
  };
20558
20558
 
20559
- const RenderColGroup = ({ contentColumns }) => (jsx("colgroup", { children: contentColumns.map((col, index) => (jsx("col", { style: {
20560
- width: typeof col.width === 'number' ? `${col.width}px` : col.width || undefined,
20561
- minWidth: typeof col.minWidth === 'number' ? `${col.minWidth}px` : col.minWidth || undefined,
20562
- maxWidth: typeof col.maxWidth === 'number' ? `${col.maxWidth}px` : col.maxWidth || undefined
20563
- } }, index))) }));
20564
-
20565
20559
  const IconCustom = (props) => {
20566
20560
  const { iconName, size } = props;
20567
20561
  if (iconName === '') {
@@ -36783,6 +36777,15 @@ const FooterCol = ({ col, indexCol, dataSource, objWidthFix, formatSetting }) =>
36783
36777
  }, children: jsx("div", { className: "r-footer-div", children: col.haveSum === true && col.type === "numeric" && (jsx(Fragment$1, { children: Number(sumValue) >= 0 ? (jsx(Fragment$1, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true, false) })) : (jsx("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: `${formatSetting?.prefixNegative ?? "-"}${formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true, false)}${formatSetting?.suffixNegative ?? ""}` })) })) }) })) }, `summarycell-${indexCol}`));
36784
36778
  };
36785
36779
 
36780
+ const RenderColGroup = ({ contentColumns, groupColumns, visibleGroupColumn }) => (jsx("colgroup", { children: contentColumns.map((col, index) => {
36781
+ return (col.visible !== false &&
36782
+ (visibleGroupColumn || !groupColumns?.includes(col.field)) && (jsx("col", { style: {
36783
+ width: typeof col.width === 'number' ? `${col.width}px` : col.width || undefined,
36784
+ minWidth: typeof col.minWidth === 'number' ? `${col.minWidth}px` : col.minWidth || undefined,
36785
+ maxWidth: typeof col.maxWidth === 'number' ? `${col.maxWidth}px` : col.maxWidth || undefined
36786
+ } }, index)));
36787
+ }) }));
36788
+
36786
36789
  var reactResizable = {exports: {}};
36787
36790
 
36788
36791
  var Resizable$2 = {};
@@ -38955,7 +38958,7 @@ const DateRangeFilterComponent = ({ fieldFilter, filterBy, handleSave }) => {
38955
38958
  };
38956
38959
 
38957
38960
  const HeaderTableCol = (props) => {
38958
- const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objHeaderWidthFixLeft, objHeaderWidthFixRight, totalCount, selectedRows, columns, orderBy, changeFilter, filterBy, changeOrder, allowFiltering, allowSorting, container, fisrtObjWidthFixRight, lastObjWidthFixLeft, setContentColumns, formatSetting, optionsFilter, idTable, isMulti } = props;
38961
+ const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objHeaderWidthFixLeft, objHeaderWidthFixRight, totalCount, selectedRows, columns, orderBy, changeFilter, filterBy, changeOrder, allowFiltering, allowSorting, container, fisrtObjWidthFixRight, lastObjWidthFixLeft, setContentColumns, formatSetting, optionsFilter, idTable, isMulti, groupColumns, visibleGroupColumn } = props;
38959
38962
  const { t } = useTranslation();
38960
38963
  const headerRef = useRef(null);
38961
38964
  const order = orderBy.find((item) => item.key === col.field);
@@ -38974,7 +38977,7 @@ const HeaderTableCol = (props) => {
38974
38977
  const checkOverflow = () => {
38975
38978
  return headerRef.current && headerRef.current.scrollHeight > headerRef.current.clientHeight;
38976
38979
  };
38977
- return (jsx(Fragment, { children: col.visible !== false && (jsx(Resizable, { className: "r-resize", width: typeof col.width === 'number' ? col.width : Number((col.width ?? '').replaceAll(new RegExp(`[^0-9]`, 'g'), '')), height: 0, onResize: handleResize, draggableOpts: { enableUserSelectHack: true }, children: jsx("th", { rowSpan: col.rowspan !== 1 ? col.rowspan : 1, colSpan: col.columns?.filter((x) => x.visible !== false)?.length ?? 1, className: classNames$1(`r-headercell fix-${col.fixedType}`, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'cell-fixed': col.fixedType }), style: {
38980
+ return (jsx(Fragment, { children: col.visible !== false && (visibleGroupColumn || !groupColumns?.includes(col.field)) && (jsx(Resizable, { className: "r-resize", width: typeof col.width === 'number' ? col.width : Number((col.width ?? '').replaceAll(new RegExp(`[^0-9]`, 'g'), '')), height: 0, onResize: handleResize, draggableOpts: { enableUserSelectHack: true }, children: jsx("th", { rowSpan: col.rowspan !== 1 ? col.rowspan : 1, colSpan: col.columns?.filter((x) => x.visible !== false)?.length ?? 1, className: classNames$1(`r-headercell fix-${col.fixedType}`, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'cell-fixed': col.fixedType }), style: {
38978
38981
  top: `${indexParent * 42}px`,
38979
38982
  left: col.fixedType === 'left' ? objHeaderWidthFixLeft[`${indexParent}-${indexCol ?? 0}`] : undefined,
38980
38983
  right: col.fixedType === 'right' ? objHeaderWidthFixRight[`${indexParent}-${indexCol ?? 0}`] : undefined
@@ -39017,7 +39020,7 @@ const HeaderTableCol = (props) => {
39017
39020
  }, children: jsx(DropdownItem$1, { className: "p-1", style: { borderRadius: '6px' }, tag: "div", header: true, children: jsx(FilterComponent, { setOpenFilter: setOpenFilter, filterBy: filterBy, optionsFilter: optionsFilter, formatSetting: formatSetting, changeFilter: changeFilter, column: col }) }) })] }))] }))] }))] }) }) })) }, `header-${indexCol}`));
39018
39021
  };
39019
39022
 
39020
- const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, visibleColumns, selectedRows, setSelectedRows, selectedCell, startCell, editCell, gridRef, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, totalCount, isMulti, selectEnable, editDisable, addDisable, defaultValue, fieldKey, fieldUniKey, formatSetting, toolbarSetting, buttonSetting, containerRef, handleDataChange, changeDataSource, handleCommandClick, handleDuplicate, handleKeyDown, onDuplicate, setSelectedCell, setStartCell, focusEditElementCell, setContentColumns, handeCopyCell, isCopying, typeDragging, rowChange, visibleContentColumns, filterBy, setFilterBy, orderBy, setOrderBy, optionsFilter, allowFiltering, allowSorting, searchSetting, searchTerm, searchClient, height, rowHeight, haveSum }) => {
39023
+ const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, selectedRows, setSelectedRows, selectedCell, startCell, editCell, gridRef, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, totalCount, isMulti, selectEnable, editDisable, addDisable, defaultValue, fieldKey, fieldUniKey, formatSetting, toolbarSetting, buttonSetting, containerRef, handleDataChange, changeDataSource, handleCommandClick, handleDuplicate, handleKeyDown, onDuplicate, setSelectedCell, setStartCell, focusEditElementCell, setContentColumns, handeCopyCell, isCopying, typeDragging, rowChange, visibleContentColumns, filterBy, setFilterBy, orderBy, setOrderBy, optionsFilter, allowFiltering, allowSorting, searchSetting, searchTerm, searchClient, height, rowHeight, haveSum }) => {
39021
39024
  const filteredData = useMemo(() => {
39022
39025
  const arr = dataSource.map((row, index) => ({ data: row, indexRow: index }));
39023
39026
  if (((filterBy && filterBy.length > 0) || (searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) && searchClient) {
@@ -39053,7 +39056,7 @@ const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, vi
39053
39056
  }
39054
39057
  };
39055
39058
  }, []);
39056
- return (jsx("div", { ref: containerRef, className: "r-gridtable", style: { maxHeight: `${height ? `${height}px` : 'auto'}` }, children: jsxs("table", { style: { width: '100%' }, role: "presentation", children: [jsx(RenderColGroup, { contentColumns: visibleColumns }), jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((element, indexParent) => {
39059
+ return (jsx("div", { ref: containerRef, className: "r-gridtable", style: { maxHeight: `${height ? `${height}px` : 'auto'}` }, children: jsxs("table", { style: { width: '100%' }, role: "presentation", children: [jsx(RenderColGroup, { contentColumns: contentColumns }), jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((element, indexParent) => {
39057
39060
  return (jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
39058
39061
  return (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: containerRef, filterBy: filterBy, orderBy: orderBy, optionsFilter: optionsFilter, allowFiltering: allowFiltering, allowSorting: allowSorting, formatSetting: formatSetting, changeFilter: (val) => {
39059
39062
  setFilterBy([...val]);
@@ -39682,7 +39685,7 @@ const SettingColumn = (props) => {
39682
39685
  // const [indexFocus, setIndexFocus] = useState<number>()
39683
39686
  useEffect(() => {
39684
39687
  if (openSidebar) {
39685
- setDataSource([...column.map(x => ({ ...x }))]);
39688
+ setDataSource([...column.map((x) => ({ ...x }))]);
39686
39689
  }
39687
39690
  }, [openSidebar]);
39688
39691
  const handleCancel = () => {
@@ -39702,9 +39705,9 @@ const SettingColumn = (props) => {
39702
39705
  const handleWindowResize = () => {
39703
39706
  setWindowSize(getWindowSize());
39704
39707
  };
39705
- window.addEventListener("resize", handleWindowResize);
39708
+ window.addEventListener('resize', handleWindowResize);
39706
39709
  return () => {
39707
- window.removeEventListener("resize", handleWindowResize);
39710
+ window.removeEventListener('resize', handleWindowResize);
39708
39711
  };
39709
39712
  }, []);
39710
39713
  const handleResetColumns = () => {
@@ -39714,7 +39717,7 @@ const SettingColumn = (props) => {
39714
39717
  handleSidebar();
39715
39718
  setDataSource([]);
39716
39719
  };
39717
- const visibleTemplate = (item, index) => {
39720
+ const VisibleTemplate = ({ index, item }) => {
39718
39721
  return (jsx(Input$1, { defaultChecked: item.visible ?? true, disabled: item.field === 'command' || item.field === '#' || item.field === 'checkbox' || item.visibleLocked, type: "checkbox", style: { height: 18 }, className: " cursor-pointer", onChange: (e) => {
39719
39722
  if (dataSource) {
39720
39723
  dataSource[index].visible = e.target.checked;
@@ -39722,9 +39725,9 @@ const SettingColumn = (props) => {
39722
39725
  }
39723
39726
  } }));
39724
39727
  };
39725
- const headerDisplayTemplate = (item, index) => {
39726
- let textValue = t(item.headerDisplay ?? (item.headerText ?? ''));
39727
- return (jsx(Input$1, { defaultValue: textValue, className: classNames$1(""), onChange: (e) => {
39728
+ const HeaderDisplayTemplate = ({ index, item }) => {
39729
+ let textValue = t(item.headerDisplay ?? item.headerText ?? '');
39730
+ return (jsx(Input$1, { defaultValue: textValue, className: classNames$1(''), onChange: (e) => {
39728
39731
  textValue = e.target?.value;
39729
39732
  }, onBlur: () => {
39730
39733
  if (dataSource) {
@@ -39733,25 +39736,28 @@ const SettingColumn = (props) => {
39733
39736
  }
39734
39737
  } }));
39735
39738
  };
39736
- const fixColumnTemplate = (item, index) => {
39737
- const optionsFix = [{ label: 'Trái', value: 'left' }, { label: 'Phải', value: 'right' }];
39738
- return (jsx(SelectTable, { component: gridRef, options: optionsFix, textAlign: "left", isClearable: true, onChange: (val) => {
39739
+ const FixColumnTemplate = ({ index, item }) => {
39740
+ const optionsFix = [
39741
+ { label: 'Trái', value: 'left' },
39742
+ { label: 'Phải', value: 'right' }
39743
+ ];
39744
+ return (jsx(SelectTable, { component: gridRef, options: optionsFix, textAlign: 'left', isClearable: true, onChange: (val) => {
39739
39745
  if (dataSource) {
39740
39746
  dataSource[index].fixedType = val?.value;
39741
39747
  setDataSource([...dataSource]);
39742
39748
  }
39743
- }, value: item.fixedType ? optionsFix.find(x => x.value === item.fixedType) : undefined }));
39749
+ }, value: item.fixedType ? optionsFix.find((x) => x.value === item.fixedType) : undefined }));
39744
39750
  };
39745
- const widthColumnTemplate = (item, index) => {
39751
+ const WidthColumnTemplate = ({ index, item }) => {
39746
39752
  const numericFormatProps = {
39747
- value: !isNullOrUndefined$1(item.width) ? item.width?.toString() : "",
39753
+ value: !isNullOrUndefined$1(item.width) ? item.width?.toString() : '',
39748
39754
  thousandSeparator: checkThousandSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
39749
39755
  decimalSeparator: checkDecimalSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
39750
39756
  allowNegative: false,
39751
39757
  decimalScale: 0
39752
39758
  };
39753
- let floatValue = parseFloat(item.width?.toString() ?? "0");
39754
- return (jsx(NumericFormat, { style: { textAlign: 'right', height: 29, width: '100%' }, ...numericFormatProps, defaultValue: formartNumberic(item.width?.toString() ?? '0', formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", 0), className: classNames$1("form-control"), onValueChange: (values) => {
39759
+ let floatValue = parseFloat(item.width?.toString() ?? '0');
39760
+ return (jsx(NumericFormat, { style: { textAlign: 'right', height: 29, width: '100%' }, ...numericFormatProps, defaultValue: formartNumberic(item.width?.toString() ?? '0', formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', 0), className: classNames$1('form-control'), onValueChange: (values) => {
39755
39761
  floatValue = values?.floatValue;
39756
39762
  }, onFocus: (e) => {
39757
39763
  e.target.setSelectionRange(0, e.target.innerText.length - 1);
@@ -39764,9 +39770,9 @@ const SettingColumn = (props) => {
39764
39770
  }
39765
39771
  } }));
39766
39772
  };
39767
- return (jsxs(Sidebar, { open: openSidebar, toggleSidebar: handleCancel, width: 900, children: [jsx(ModalHeader, { typeModal: "Edit", handleModal: handleCancel, title: "Column setup" }), jsxs("div", { className: "r-setting-container", children: [jsxs("div", { style: { fontWeight: 700, color: "#000" }, className: 'r-setting-row r-setting-header me-75', children: [jsx("span", { className: "r-setting-cell", style: { width: 30 } }), jsx("span", { className: "r-setting-cell", style: { width: 200 }, children: t('Column name') }), jsx("span", { className: "r-setting-cell", style: { flex: 1 }, children: t('Column name display') }), jsx("span", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: t('Display') }), jsx("span", { className: "r-setting-cell", style: { width: 100 }, children: t('Fix the column') }), jsx("span", { className: "r-setting-cell", style: { width: 110 }, children: t('Column width(px)') })] }), jsx("div", { className: 'r-setting-content', style: { height: windowSize.innerHeight - 140 }, children: jsx(dist.exports.ReactSortable, { tag: 'div', list: dataSource, handle: '.drag-icon', setList: newState => setDataSource(newState), children: dataSource.map((item, index) => {
39768
- return jsx(Fragment$1, { children: jsxs("div", { className: 'r-setting-row', children: [jsx("div", { className: "r-setting-cell", style: { width: 30 }, children: jsx(SvgDragDrop, { fontSize: 12, className: 'drag-icon cursor-move' }) }), jsx("div", { className: "r-setting-cell", style: { width: 200 }, children: t(item.headerText ?? '') }), jsx("div", { className: "r-setting-cell", style: { flex: 1 }, children: headerDisplayTemplate(item, index) }), jsx("div", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: visibleTemplate(item, index) }), jsx("div", { className: "r-setting-cell", style: { width: 100 }, children: fixColumnTemplate(item, index) }), jsx("div", { className: "r-setting-cell", style: { width: 110 }, children: widthColumnTemplate(item, index) })] }) });
39769
- }) }) })] }), jsxs("div", { style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, className: "d-flex justify-content-between align-items-center w-100 py-75 px-1", children: [jsx("div", { children: settingColumns?.updatedDate && jsxs("p", { children: [jsxs("strong", { children: [t("Update date"), ": "] }), " ", jsx("span", { children: settingColumns.updatedDate ? formatDateTime(settingColumns.updatedDate, "DD/MM/yyyy HH:mm") : "" }), jsxs("strong", { className: "ms-2", children: [t("Editor"), ": "] }), " ", jsx("span", { children: settingColumns.updatedByName })] }) }), jsxs("div", { children: [resetDefaultColumns && jsx(Button$1$1, { color: "primary", onClick: () => messageBoxConfirm(t, handleResetColumns, {}, 'Do you want to reset the default settings?'), className: "me-1", children: t("Reset") }), jsx(Button$1$1, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }), jsx(Button$1$1, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })] })] })] }));
39773
+ return (jsxs(Sidebar, { open: openSidebar, toggleSidebar: handleCancel, width: 900, children: [jsx(ModalHeader, { typeModal: 'Edit', handleModal: handleCancel, title: 'Column setup' }), jsxs("div", { className: "r-setting-container", children: [jsxs("div", { style: { fontWeight: 700, color: '#000' }, className: "r-setting-row r-setting-header me-75", children: [jsx("span", { className: "r-setting-cell", style: { width: 30 } }), jsx("span", { className: "r-setting-cell", style: { width: 200 }, children: t('Column name') }), jsx("span", { className: "r-setting-cell", style: { flex: 1 }, children: t('Column name display') }), jsx("span", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: t('Display') }), jsx("span", { className: "r-setting-cell", style: { width: 100 }, children: t('Fix the column') }), jsx("span", { className: "r-setting-cell", style: { width: 110 }, children: t('Column width(px)') })] }), jsx("div", { className: "r-setting-content", style: { height: windowSize.innerHeight - 140 }, children: jsx(dist.exports.ReactSortable, { tag: "div", list: dataSource, handle: ".drag-icon", setList: (newState) => setDataSource(newState), children: dataSource.map((item, index) => {
39774
+ return (jsx(Fragment$1, { children: jsxs("div", { className: "r-setting-row", children: [jsx("div", { className: "r-setting-cell", style: { width: 30 }, children: jsx(SvgDragDrop, { fontSize: 12, className: "drag-icon cursor-move" }) }), jsx("div", { className: "r-setting-cell", style: { width: 200 }, children: t(item.headerText ?? '') }), jsx("div", { className: "r-setting-cell", style: { flex: 1 }, children: jsx(HeaderDisplayTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: jsx(VisibleTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 100 }, children: jsx(FixColumnTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 110 }, children: jsx(WidthColumnTemplate, { item: item, index: index }) })] }) }));
39775
+ }) }) })] }), jsxs("div", { style: { boxShadow: '0 4px 24px 0 rgb(34 41 47 / 10%)' }, className: "d-flex justify-content-between align-items-center w-100 py-75 px-1", children: [jsx("div", { children: settingColumns?.updatedDate && (jsxs("p", { children: [jsxs("strong", { children: [t('Update date'), ": "] }), " ", jsx("span", { children: settingColumns.updatedDate ? formatDateTime(settingColumns.updatedDate, 'DD/MM/yyyy HH:mm') : '' }), jsxs("strong", { className: "ms-2", children: [t('Editor'), ": "] }), " ", jsx("span", { children: settingColumns.updatedByName })] })) }), jsxs("div", { children: [resetDefaultColumns && (jsx(Button$1$1, { color: "primary", onClick: () => messageBoxConfirm(t, handleResetColumns, {}, 'Do you want to reset the default settings?'), className: "me-1", children: t('Reset') })), jsx(Button$1$1, { color: "primary", onClick: handleSubmit, className: "me-1", children: t('Confirm') }), jsx(Button$1$1, { color: "secondary", onClick: handleCancel, outline: true, children: t('Close') })] })] })] }));
39770
39776
  };
39771
39777
 
39772
39778
  const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, focusRow, editDisable, addDisable, buttonSetting, toolbarSetting, headerColumns }) => {
@@ -39810,7 +39816,7 @@ const TableEdit = forwardRef((props, ref) => {
39810
39816
  const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
39811
39817
  const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? 'id';
39812
39818
  const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
39813
- const { levels: headerColumns, flatVisble: visibleColumns, flatVisbleContent: visibleContentColumns, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, objHeaderWidthFixLeft, objHeaderWidthFixRight, indexFirstEdit, indexLastEdit } = useMemo(() => {
39819
+ const { levels: headerColumns, flatVisbleContent: visibleContentColumns, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, objHeaderWidthFixLeft, objHeaderWidthFixRight, indexFirstEdit, indexLastEdit } = useMemo(() => {
39814
39820
  const rs = calculateTableStructure(columns, settingColumns?.value);
39815
39821
  setContentColumns(rs.flat);
39816
39822
  return rs;
@@ -40184,7 +40190,7 @@ const TableEdit = forwardRef((props, ref) => {
40184
40190
  }
40185
40191
  }
40186
40192
  };
40187
- return (jsx(Fragment, { children: jsxs("div", { className: "r-table-edit", children: [jsxs("div", { className: "r-grid", ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsx(TableComponent, { idTable: idTable, height: height, dataSource: dataSource, contentColumns: contentColumns, headerColumns: headerColumns, visibleColumns: visibleColumns, selectedRows: selectedRows, setSelectedRows: setSelectedRows, selectedCell: selectedCell, startCell: startCell, editCell: editCell, gridRef: gridRef, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, fisrtObjWidthFixRight: fisrtObjWidthFixRight, totalCount: totalCount, isMulti: isMulti, selectEnable: selectEnable, editDisable: editDisable, addDisable: addDisable, defaultValue: defaultValue, fieldKey: fieldKey, fieldUniKey: fieldUniKey, formatSetting: formatSetting, toolbarSetting: toolbarSetting, buttonSetting: buttonSetting, containerRef: containerRef, optionsFilter: optionsFilter, allowFiltering: allowFiltering, allowSorting: allowSorting, searchSetting: searchSetting, searchTerm: searchTerm, haveSum: haveSum, isCopying: isCopying, typeDragging: typeDragging, visibleContentColumns: visibleContentColumns, rowHeight: rowHeight, changeDataSource: changeDataSource, handleCommandClick: handleCommandClick, handleKeyDown: handleKeyDown, handeCopyCell: handeCopyCell, onDuplicate: onDuplicate, setSelectedCell: setSelectedCell, setStartCell: setStartCell, focusEditElementCell: focusEditElementCell, rowChange: rowChange, filterBy: filterBy, setFilterBy: setFilterBy, orderBy: orderBy, setOrderBy: setOrderBy, searchClient: searchClient, handleDataChange: handleDataChange, handleDuplicate: () => {
40193
+ return (jsx(Fragment, { children: jsxs("div", { className: "r-table-edit", children: [jsxs("div", { className: "r-grid", ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsx(TableComponent, { idTable: idTable, height: height, dataSource: dataSource, contentColumns: contentColumns, headerColumns: headerColumns, selectedRows: selectedRows, setSelectedRows: setSelectedRows, selectedCell: selectedCell, startCell: startCell, editCell: editCell, gridRef: gridRef, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, fisrtObjWidthFixRight: fisrtObjWidthFixRight, totalCount: totalCount, isMulti: isMulti, selectEnable: selectEnable, editDisable: editDisable, addDisable: addDisable, defaultValue: defaultValue, fieldKey: fieldKey, fieldUniKey: fieldUniKey, formatSetting: formatSetting, toolbarSetting: toolbarSetting, buttonSetting: buttonSetting, containerRef: containerRef, optionsFilter: optionsFilter, allowFiltering: allowFiltering, allowSorting: allowSorting, searchSetting: searchSetting, searchTerm: searchTerm, haveSum: haveSum, isCopying: isCopying, typeDragging: typeDragging, visibleContentColumns: visibleContentColumns, rowHeight: rowHeight, changeDataSource: changeDataSource, handleCommandClick: handleCommandClick, handleKeyDown: handleKeyDown, handeCopyCell: handeCopyCell, onDuplicate: onDuplicate, setSelectedCell: setSelectedCell, setStartCell: setStartCell, focusEditElementCell: focusEditElementCell, rowChange: rowChange, filterBy: filterBy, setFilterBy: setFilterBy, orderBy: orderBy, setOrderBy: setOrderBy, searchClient: searchClient, handleDataChange: handleDataChange, handleDuplicate: () => {
40188
40194
  handleDuplicate(dataSource, startCell.row, fieldKey, defaultValue, fieldUniKey, changeDataSource, containerRef, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate);
40189
40195
  }, setContentColumns: (newColumns) => {
40190
40196
  setContentColumns(newColumns);
@@ -49030,12 +49036,14 @@ const Wizard = forwardRef((props, ref) => {
49030
49036
  const { steps, activeStep, setActiveStep, className = '', headerClassName = '', contentClassName = '', contentWrapperClassName = '', type = 'horizontal', heightContent = 'auto', widthContent = '100%', separator = jsx(SvgChevronRight, { fontSize: 17 }) } = props;
49031
49037
  // ** Renders Wizard Header
49032
49038
  const renderHeader = () => {
49033
- return steps.filter(x => x.visiable !== false).map((step, index) => {
49034
- return (jsxs(Fragment, { children: [index !== 0 && index !== steps.length ? jsx("div", { className: 'line', children: separator }) : null, jsx("div", { className: classNames$1('step', {
49035
- crossed: (step.done !== undefined ? step.done : activeStep > (index + 1)),
49039
+ return steps
49040
+ .filter((x) => x.visible !== false)
49041
+ .map((step, index) => {
49042
+ return (jsxs(Fragment, { children: [index !== 0 && index !== steps.length ? jsx("div", { className: "line", children: separator }) : null, jsx("div", { className: classNames$1('step', {
49043
+ crossed: step.done !== undefined ? step.done : activeStep > index + 1,
49036
49044
  disable: step.disable,
49037
- active: (index + 1) === activeStep
49038
- }), "data-target": `#${step.id}`, children: jsxs("button", { type: 'button', disabled: step.disable, className: 'step-trigger', onClick: () => setActiveStep?.(index + 1), children: [jsx("span", { className: 'bs-stepper-box', children: step.icon ? step.icon : index + 1 }), jsxs("span", { className: 'bs-stepper-label', children: [jsxs("span", { className: 'bs-stepper-title', children: [step.title, " "] }), step.loading && jsx(Spinner$1, { className: 'text-info', style: { borderWidth: 2, height: 15, width: 15, marginRight: 3 } }), " ", step.subtitle ? jsx("span", { className: 'bs-stepper-subtitle', children: step.subtitle }) : null] })] }) })] }, step.id));
49045
+ active: index + 1 === activeStep
49046
+ }), "data-target": `#${step.id}`, children: jsxs("button", { type: "button", disabled: step.disable, className: "step-trigger", onClick: () => setActiveStep?.(index + 1), children: [jsx("span", { className: "bs-stepper-box", children: step.icon ? step.icon : index + 1 }), jsxs("span", { className: "bs-stepper-label", children: [jsxs("span", { className: "bs-stepper-title", children: [step.title, " "] }), step.loading && jsx(Spinner$1, { className: "text-info", style: { borderWidth: 2, height: 15, width: 15, marginRight: 3 } }), " ", step.subtitle ? jsx("span", { className: "bs-stepper-subtitle", children: step.subtitle }) : null] })] }) })] }, step.id));
49039
49047
  });
49040
49048
  };
49041
49049
  // ** Renders Wizard Content
@@ -49043,7 +49051,7 @@ const Wizard = forwardRef((props, ref) => {
49043
49051
  return steps.map((step, index) => {
49044
49052
  return (jsx("div", { className: classNames$1('content', {
49045
49053
  [contentClassName]: contentClassName,
49046
- 'active dstepper-block': activeStep === (index + 1)
49054
+ 'active dstepper-block': activeStep === index + 1
49047
49055
  }), id: step.id, children: step.content }, step.id));
49048
49056
  });
49049
49057
  };
@@ -68305,13 +68313,11 @@ const ModalImportComponent = (props) => {
68305
68313
  const [isSaveSetting, setIsSaveSetting] = useState(true);
68306
68314
  const formSchema = create().shape({
68307
68315
  step: create$1(),
68308
- sheetId: create$2()
68309
- .when('step', {
68316
+ sheetId: create$2().when('step', {
68310
68317
  is: 1,
68311
68318
  then: create$2().required(`${t('Sheet name')} ${t('is required')}`)
68312
68319
  }),
68313
- headerRow: create$1()
68314
- .when('step', {
68320
+ headerRow: create$1().when('step', {
68315
68321
  is: 1,
68316
68322
  then: create$1().required(`${t('Header row')} ${t('is required')}`)
68317
68323
  })
@@ -68346,29 +68352,29 @@ const ModalImportComponent = (props) => {
68346
68352
  };
68347
68353
  const onSubmit = (data) => {
68348
68354
  if (getValues('step') === 1) {
68349
- getColumnsSheetExcel(data.file, data.headerRow ?? 0, data.sheetId ?? "", handleSetColumns);
68355
+ getColumnsSheetExcel(data.file, data.headerRow ?? 0, data.sheetId ?? '', handleSetColumns);
68350
68356
  }
68351
68357
  else if (getValues('step') === 2) {
68352
- const check = data.dataMap.find(x => x.isRequired && !x.column);
68358
+ const check = data.dataMap.find((x) => x.isRequired && !x.column);
68353
68359
  if (check) {
68354
68360
  messageBoxError(t, `Vui lòng chọn trường ghép cho cột <<${check.header}>>`);
68355
68361
  return;
68356
68362
  }
68357
- mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate)
68358
- .then((arr) => {
68363
+ mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate).then((arr) => {
68359
68364
  setCheckInitValidate(true);
68360
68365
  if (isSaveSetting) {
68361
- updateGeneralSettingApi(data.dataMap.map(x => ({ ...x, column: undefined })));
68366
+ updateGeneralSettingApi(data.dataMap.map((x) => ({ ...x, column: undefined })));
68362
68367
  }
68363
68368
  validateExcelApi(arr)
68364
68369
  .then((rs) => {
68365
68370
  setCheckInitValidate(false);
68366
- const list = rs.map((item) => ({ ...item, errors: item.errors.map((x) => (connectString(t, x))) }));
68371
+ const list = rs.map((item) => ({ ...item, errors: item.errors.map((x) => connectString(t, x)) }));
68367
68372
  setDataValidate(list);
68368
68373
  setDataInvalid(list.filter((x) => x.errors?.length > 0));
68369
68374
  setDataValid(list.filter((x) => x.error || x.errors?.length === 0));
68370
68375
  setValue('step', 3);
68371
- }).catch(() => {
68376
+ })
68377
+ .catch(() => {
68372
68378
  notificationError(t('GetFail'));
68373
68379
  setCheckInitValidate(false);
68374
68380
  });
@@ -68376,7 +68382,7 @@ const ModalImportComponent = (props) => {
68376
68382
  }
68377
68383
  else if (getValues('step') === 3) {
68378
68384
  if (dataInvalid.length > 0) {
68379
- messageBoxConfirm(t, handleAdd, dataValid, "The data from your excel file still has invalid rows. Please double check or import only valid lines now.");
68385
+ messageBoxConfirm(t, handleAdd, dataValid, 'The data from your excel file still has invalid rows. Please double check or import only valid lines now.');
68380
68386
  }
68381
68387
  else {
68382
68388
  handleAdd(dataValid);
@@ -68396,34 +68402,35 @@ const ModalImportComponent = (props) => {
68396
68402
  else {
68397
68403
  setDataError([]);
68398
68404
  }
68399
- }).catch(() => {
68405
+ })
68406
+ .catch(() => {
68400
68407
  setCheckInit(false);
68401
68408
  notificationError(t('AddFail'));
68402
68409
  });
68403
68410
  };
68404
68411
  const getDataType = (e) => {
68405
- return (e.dataType === 'numeric' || e.dataType === 'datetime' || e.dataType === 'date') ? e.dataType : (e.dataType === 'boolean' ? 'checkbox' : 'text');
68412
+ return e.dataType === 'numeric' || e.dataType === 'datetime' || e.dataType === 'date' ? e.dataType : e.dataType === 'boolean' ? 'checkbox' : 'text';
68406
68413
  };
68407
68414
  const defaultValidateExcelColumns = [
68408
68415
  {
68409
68416
  field: 'row',
68410
- headerText: "Row",
68417
+ headerText: 'Row',
68411
68418
  fixedType: 'left',
68412
68419
  textAlign: 'center',
68413
68420
  width: 80
68414
68421
  },
68415
68422
  {
68416
68423
  field: 'result',
68417
- headerText: "Result",
68424
+ headerText: 'Result',
68418
68425
  fixedType: 'left',
68419
68426
  width: 140,
68420
68427
  template: (props) => {
68421
- return (props.errors?.length === 0 ? jsx("span", { className: 'text-success', children: t('Valid') }) : jsx("span", { className: 'text-danger', children: t('Invalid') }));
68428
+ return props.errors?.length === 0 ? jsx("span", { className: "text-success", children: t('Valid') }) : jsx("span", { className: "text-danger", children: t('Invalid') });
68422
68429
  }
68423
68430
  },
68424
68431
  {
68425
68432
  field: 'errorDetail',
68426
- headerText: "Error detail",
68433
+ headerText: 'Error detail',
68427
68434
  fixedType: 'left',
68428
68435
  width: 550,
68429
68436
  template: (props) => {
@@ -68437,16 +68444,18 @@ const ModalImportComponent = (props) => {
68437
68444
  console.log(watch('dataMap'));
68438
68445
  }, [watch('dataMap')]);
68439
68446
  const handleFormOpened = () => {
68440
- getGeneralSettingApi().then((rs) => {
68447
+ getGeneralSettingApi()
68448
+ .then((rs) => {
68441
68449
  const arr = rs?.value ? JSON.parse(rs.value) : [];
68442
68450
  setValue('dataMap', [...mapColumn].map((x) => {
68443
- const ele = arr.find(y => x.field === y.field);
68451
+ const ele = arr.find((y) => x.field === y.field);
68444
68452
  if (ele) {
68445
68453
  x.headerDefault = ele.headerDefault;
68446
68454
  }
68447
68455
  return x;
68448
68456
  }));
68449
- }).catch(() => {
68457
+ })
68458
+ .catch(() => {
68450
68459
  setValue('dataMap', [...mapColumn]);
68451
68460
  });
68452
68461
  if (headerValidateExcelColumns && headerValidateExcelColumns.length > 0) {
@@ -68455,7 +68464,7 @@ const ModalImportComponent = (props) => {
68455
68464
  else {
68456
68465
  setValidateExcelColumns([
68457
68466
  ...defaultValidateExcelColumns,
68458
- ...mapColumn.map(e => ({
68467
+ ...mapColumn.map((e) => ({
68459
68468
  field: e.field,
68460
68469
  headerText: e.header,
68461
68470
  width: e.width ?? 150,
@@ -68477,7 +68486,7 @@ const ModalImportComponent = (props) => {
68477
68486
  setValue('step', 2);
68478
68487
  }
68479
68488
  };
68480
- 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: [
68489
+ 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: [
68481
68490
  {
68482
68491
  id: 'upload-file',
68483
68492
  title: t('Upload file'),
@@ -68496,12 +68505,12 @@ const ModalImportComponent = (props) => {
68496
68505
  {
68497
68506
  id: 'handle-error',
68498
68507
  title: t('Error result'),
68499
- visiable: !!headerErrorExcelColumns,
68508
+ visible: !!headerErrorExcelColumns,
68500
68509
  content: jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
68501
68510
  }
68502
- ] }) }) }) }), 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) => {
68511
+ ] }) }) }) }), 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) => {
68503
68512
  setIsSaveSetting(val.target.checked);
68504
- } }), 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$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$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$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$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
68513
+ } }), 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$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$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$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$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
68505
68514
  };
68506
68515
 
68507
68516
  const TabsMenuComponent = ({ buttonWidth, tabParent, tabChild, resourceCodeParent, resources, resourceCode, windowSize, renderModal }) => {
@@ -68634,7 +68643,7 @@ const UnExpandAllIcon = ({ className, color = '#7F7F7F', size = 24, onClick, sty
68634
68643
  };
68635
68644
 
68636
68645
  const RenderContentCol = (props) => {
68637
- const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
68646
+ const { col, indexCol, indexRow, isSelected, row, zeroVisiable, groupColumns, visibleGroupColumn, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
68638
68647
  const cellId = `content-${idTable}-row${indexRow}col-${indexCol}`;
68639
68648
  const checkOverflow = () => {
68640
68649
  const element = document.getElementById(cellId);
@@ -68704,7 +68713,7 @@ const RenderContentCol = (props) => {
68704
68713
  }, children: displayText }) }), checkOverflow() && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsx("div", { style: { color: textColor }, children: displayText }) }))] }));
68705
68714
  }
68706
68715
  };
68707
- return (jsx(Fragment$1, { children: col.visible !== false && (jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': isSelected }), style: {
68716
+ return (jsx(Fragment$1, { children: col.visible !== false && (visibleGroupColumn || !groupColumns?.includes(col.field)) && (jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': isSelected }), style: {
68708
68717
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
68709
68718
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined
68710
68719
  }, onClick: (e) => {
@@ -68752,12 +68761,27 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
68752
68761
  }
68753
68762
  setExpandsAll(true);
68754
68763
  }, [groupSetting?.groupColumns]);
68755
- const { levels: headerColumns, flatVisble, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = useMemo(() => {
68764
+ const { levels: headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = useMemo(() => {
68756
68765
  const rs = calculateTableStructure(columns, settingColumns?.value);
68757
68766
  setContentColumns(rs.flat);
68758
68767
  return rs;
68759
68768
  }, [columns, settingColumns]);
68760
- const optionGroupColumns = useMemo(() => contentColumns.filter((x) => !groupColumns.includes(x.field)).map((x) => ({ ...x, headerDisplay: t(x.headerDisplay ?? x.headerText) })), [groupColumns, contentColumns]);
68769
+ const optionGroupColumns = useMemo(() => contentColumns.filter((x) => !groupColumns.includes(x.field)).map((x) => ({ ...x, headerDisplay: t(x.columnGroupText ?? x.headerDisplay ?? x.headerText) })), [groupColumns, contentColumns]);
68770
+ const firstColSpan = useMemo(() => {
68771
+ let count = 0;
68772
+ let index = 3;
68773
+ for (let i = 0; i < contentColumns.length; i++) {
68774
+ const col = contentColumns[i];
68775
+ if (col.visible !== false && (groupSetting?.visibleGroupColumn || !groupColumns?.includes(col.field))) {
68776
+ count++;
68777
+ }
68778
+ if (count === 3) {
68779
+ index = i;
68780
+ break;
68781
+ }
68782
+ }
68783
+ return index;
68784
+ }, [contentColumns, groupColumns]);
68761
68785
  // Tính toán dữ liệu hiển thị dựa trên các điều kiện lọc, tìm kiếm và sắp xếp
68762
68786
  const viewData = useMemo(() => {
68763
68787
  if (!dataSource || dataSource.length === 0) {
@@ -68966,7 +68990,6 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
68966
68990
  }
68967
68991
  }
68968
68992
  }, [selectedItem]);
68969
- const firstColSpan = flatVisble.length > 6 ? 3 : Math.floor(flatVisble.length / 2);
68970
68993
  const RenderContent = ({ datas, level = 0 }) => {
68971
68994
  return (jsx(Fragment$1, { children: datas.map((row, indexRow) => {
68972
68995
  const [expand, setExpand] = useState(row.expand ?? true);
@@ -68991,12 +69014,12 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
68991
69014
  if (col.template) {
68992
69015
  value = col.template(row, indexRow) ?? '';
68993
69016
  }
68994
- return (jsxs(Fragment$1, { children: [jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsx("td", { className: "r-rowcell r-cell-group", colSpan: firstColSpan, children: jsxs("div", { className: "r-rowcell-div", children: [jsx(SvgChevronRight, { style: { marginLeft: level * 20, transform: expand ? 'rotate(90deg)' : 'rotate(0deg)' }, fontSize: 15, onClick: () => {
69017
+ return (jsxs(Fragment$1, { children: [jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsx("td", { className: "r-rowcell r-cell-group", colSpan: 3, children: jsxs("div", { className: "r-rowcell-div", children: [jsx(SvgChevronRight, { style: { marginLeft: level * 20, transform: expand ? 'rotate(90deg)' : 'rotate(0deg)' }, fontSize: 15, onClick: () => {
68995
69018
  setExpand(!expand);
68996
69019
  setExpandsAll(undefined);
68997
69020
  row.expand = !expand;
68998
69021
  } }), t(col.headerDisplay ?? col.headerText), ": ", value, " (", row.children.length, ")"] }) }), contentColumns.map((colSum, indexCol) => {
68999
- if (indexCol < firstColSpan || colSum.visible === false) {
69022
+ if (indexCol <= firstColSpan || colSum.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns?.includes(colSum.field))) {
69000
69023
  return;
69001
69024
  }
69002
69025
  let sumValue = row[colSum.field];
@@ -69017,11 +69040,11 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
69017
69040
  }
69018
69041
  else {
69019
69042
  const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
69020
- return (jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: contentColumns.map((column, indexCol) => (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}`));
69043
+ return (jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: contentColumns.map((column, indexCol) => (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, groupColumns: groupColumns, visibleGroupColumn: groupSetting?.visibleGroupColumn }, indexCol))) }, `row-content-${indexRow}`));
69021
69044
  }
69022
69045
  }) }));
69023
69046
  };
69024
- return (jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxs("div", { ref: gridRef, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsx(RenderColGroup, { contentColumns: flatVisble }), jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => {
69047
+ return (jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxs("div", { ref: gridRef, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsx(RenderColGroup, { contentColumns: contentColumns, groupColumns: groupColumns, visibleGroupColumn: groupSetting?.visibleGroupColumn }), jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => {
69025
69048
  return (jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((col, index) => (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) => {
69026
69049
  setFilterBy([...val]);
69027
69050
  if (querySetting?.changeFilter) {
@@ -69032,9 +69055,9 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
69032
69055
  if (querySetting?.changeOrder) {
69033
69056
  querySetting.changeOrder(val);
69034
69057
  }
69035
- }, columns: contentColumns, setContentColumns: setContentColumns, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, totalCount: dataSource?.length ?? 0 }, `header-${indexParent}-${index}`))) }, `header-${-indexParent}`));
69058
+ }, columns: contentColumns, groupColumns: groupColumns, visibleGroupColumn: groupSetting?.visibleGroupColumn, setContentColumns: setContentColumns, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, totalCount: dataSource?.length ?? 0 }, `header-${indexParent}-${index}`))) }, `header-${-indexParent}`));
69036
69059
  }) }), jsx("tbody", { className: "r-gridcontent", role: "rowgroup", children: jsx(RenderContent, { datas: viewData }) }), jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 && (jsx("tr", { className: "r-row", children: contentColumns.map((col, indexCol) => {
69037
- if (col.visible === false) {
69060
+ if (col.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns.includes(col.field))) {
69038
69061
  return;
69039
69062
  }
69040
69063
  const item = columnsAggregate?.find((x) => x.field === col.field);