react-table-edit 1.5.6 → 1.5.8

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
@@ -20487,13 +20487,25 @@ const ReactInput = (props) => {
20487
20487
 
20488
20488
  const RenderToolbarTop = ({ toolbarTopOption }) => {
20489
20489
  return (jsx("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: jsxs("div", { className: "r-toolbar-items", children: [jsx("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
20490
- return ((item.align === 'left') ? jsx(Fragment$1, { children: jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) }) : '');
20490
+ return ((item.align === 'left') ? jsx(ToolBarElement, { item: item, index: index }) : '');
20491
20491
  }) }), jsx("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
20492
- return ((item.align === 'center') ? jsx(Fragment$1, { children: jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) }) : '');
20492
+ return ((item.align === 'center') ? jsx(ToolBarElement, { item: item, index: index }) : '');
20493
20493
  }) }), jsx("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
20494
- return ((item.align === 'right') ? jsx(Fragment$1, { children: jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) }) : '');
20494
+ return ((item.align === 'right') ? jsx(ToolBarElement, { item: item, index: index }) : '');
20495
20495
  }) })] }) }));
20496
20496
  };
20497
+ const ToolBarElement = ({ item, index }) => {
20498
+ if (item.id === 'GROUP') {
20499
+ return (jsx("div", { className: "r-toolbar-item cursor-pointer", "aria-disabled": "false", children: jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "stroke-width": "1.5", id: "toolbar-columns-group", "font-size": "20", color: "#7F7F7F", className: "cursor-pointer", children: [jsxs("g", { "clip-path": "url(#group_svg__a)", fill: "#7F7F7F", children: [jsx("path", { d: "M22.167 0h-7.334c-.486 0-.952.181-1.295.503A1.662 1.662 0 0 0 13 1.714v20.572c0 .454.194.89.538 1.211.343.322.81.503 1.295.503h7.334c.486 0 .952-.181 1.295-.503.344-.321.537-.757.538-1.211V1.714c0-.454-.194-.89-.538-1.211A1.902 1.902 0 0 0 22.167 0Zm0 1.714v6h-7.334v-6h7.334Zm0 7.715v5.142h-7.334V9.43h7.334Zm-7.334 12.857v-6h7.334v6h-7.334ZM7.502 11.25h-1.5v-1.5h-1.5v1.5h-1.5v1.5h1.5v1.5h1.5v-1.5h1.5v-1.5Z" }), jsx("path", { d: "M10.502 4.5V3h-4.5a1.502 1.502 0 0 0-1.5 1.5v2.31a5.242 5.242 0 0 0 0 10.38v2.31a1.502 1.502 0 0 0 1.5 1.5h4.5v-1.5h-4.5v-2.31a5.243 5.243 0 0 0 0-10.38V4.5h4.5Zm-1.5 7.5a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z" })] }), jsx("defs", { children: jsx("clipPath", { id: "group_svg__a", children: jsx("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })] }) }, `toolbar-top-${index}`));
20500
+ }
20501
+ if (item.id === 'EXPAND') {
20502
+ return (jsx("div", { className: "r-toolbar-item cursor-pointer", "aria-disabled": "false" }, `toolbar-top-${index}`));
20503
+ }
20504
+ if (item.id === 'COLUMN_CHOOSE') {
20505
+ return (jsx("div", { className: "r-toolbar-item cursor-pointer", "aria-disabled": "false", children: jsx(SvgSettings, { className: "me-1", fontSize: 20, color: "#7F7F7F" }) }, `toolbar-top-${index}`));
20506
+ }
20507
+ return (jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template?.() }, `toolbar-top-${index}`));
20508
+ };
20497
20509
 
20498
20510
  const handleAdd = (dataSource, containerRef, indexFirstEdit,
20499
20511
  /*eslint-disable*/
@@ -23953,7 +23965,9 @@ const EditForm = forwardRef((props, ref) => {
23953
23965
  const [itemsField, setItemsField] = useState([]);
23954
23966
  const { t } = useTranslation();
23955
23967
  useOnClickOutside(editFormRef, () => {
23956
- closeMenu();
23968
+ if (dropdownOpen !== false) {
23969
+ closeMenu();
23970
+ }
23957
23971
  });
23958
23972
  const closeMenu = () => {
23959
23973
  setTimeout(() => {
@@ -24117,43 +24131,43 @@ const EditForm = forwardRef((props, ref) => {
24117
24131
  });
24118
24132
  }
24119
24133
  }, [inputRef]);
24120
- return (jsx("div", { className: "form-edit", ref: ref, id: id, children: jsx("div", { ref: editFormRef, children: jsxs(Dropdown$1, { isOpen: dropdownOpen, toggle: () => { }, children: [jsx(DropdownToggle$1, { tag: 'div', children: jsxs("div", { className: classNames$1('display-value', { 'r-is-focus': isFocus || dropdownOpen }, { 'is-invalid': invalid }), onClick: handleOnClick, children: [template?.(rowData, indexRow) ?? displayValue, jsx(Input$1, { style: {
24121
- outline: 'none',
24122
- border: 'none',
24123
- width: template ? 0 : '100%',
24124
- height: template ? 0 : 28,
24125
- lineHeight: template ? 0 : 19,
24126
- padding: template ? 0 : 'auto',
24127
- backgroundColor: '$white',
24128
- textAlign: textAlign ?? 'left'
24129
- }, placeholder: placeholder, innerRef: inputRef, onKeyDown: (e) => handleOnKeyDown(e), onPaste: (e) => onPaste && onPaste(e), readOnly: true })] }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown p-0', container: component, style: {
24130
- position: 'fixed',
24131
- minWidth: minWidth ? minWidth : defaultWidth,
24132
- width: menuWidth ? menuWidth : 'min-content',
24133
- maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
24134
- borderRadius: 8,
24135
- zIndex: 9999
24136
- }, children: jsxs(DropdownItem$1, { className: 'p-0', style: { borderRadius: '6px' }, tag: 'div', header: true, children: [jsx("div", { onKeyDown: (e) => formKeyDown(e, handleSubmit(handleOnSubmit)), className: 'p-1', style: {
24137
- maxHeight: menuHeight ? menuHeight : 300,
24138
- overflow: "auto"
24139
- }, children: itemsField ? renderForm(itemsField) : '' }), jsxs("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [jsx("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : '' }), !onChangeField ? jsxs("div", { className: "d-flex justify-content-end", children: [isClearable && jsx(Button$1, { className: 'btn me-50 py-25 px-50', outline: true, onClick: () => {
24140
- itemsField.forEach((e) => {
24141
- if (e.type === 'numeric') {
24142
- setValue(e.name, 0);
24143
- }
24144
- else {
24145
- setValue(e.name, '');
24146
- }
24147
- });
24148
- }, onKeyDown: (e) => {
24149
- if (e.code === 'Tab') {
24150
- closeMenu();
24134
+ return (jsx("div", { className: "form-edit", ref: ref, id: id, children: jsxs(Dropdown$1, { isOpen: dropdownOpen, toggle: () => { }, children: [jsx(DropdownToggle$1, { tag: 'div', children: jsxs("div", { className: classNames$1('display-value', { 'r-is-focus': isFocus || dropdownOpen }, { 'is-invalid': invalid }), onClick: handleOnClick, children: [template?.(rowData, indexRow) ?? displayValue, jsx(Input$1, { style: {
24135
+ outline: 'none',
24136
+ border: 'none',
24137
+ width: template ? 0 : '100%',
24138
+ height: template ? 0 : 28,
24139
+ lineHeight: template ? 0 : 19,
24140
+ padding: template ? 0 : 'auto',
24141
+ backgroundColor: '$white',
24142
+ textAlign: textAlign ?? 'left'
24143
+ }, placeholder: placeholder, innerRef: inputRef, onKeyDown: (e) => handleOnKeyDown(e), onPaste: (e) => onPaste && onPaste(e), readOnly: true })] }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown p-0', container: component, style: {
24144
+ position: 'fixed',
24145
+ minWidth: minWidth ? minWidth : defaultWidth,
24146
+ width: menuWidth ? menuWidth : 'min-content',
24147
+ maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
24148
+ borderRadius: 8,
24149
+ zIndex: 9999
24150
+ }, children: jsxs(DropdownItem$1, { className: 'p-0', style: { borderRadius: '6px' }, tag: 'div', header: true, children: [jsx("div", { onKeyDown: (e) => formKeyDown(e, handleSubmit(handleOnSubmit)), className: 'p-1', ref: editFormRef, style: {
24151
+ maxHeight: menuHeight ? menuHeight : 300,
24152
+ overflow: "auto"
24153
+ }, children: itemsField ? renderForm(itemsField) : '' }), jsxs("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [jsx("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : '' }), !onChangeField ? jsxs("div", { className: "d-flex justify-content-end", children: [isClearable && jsx(Button$1, { className: 'btn me-50 py-25 px-50', outline: true, onClick: () => {
24154
+ itemsField.forEach((e) => {
24155
+ if (e.type === 'numeric') {
24156
+ setValue(e.name, 0);
24151
24157
  }
24152
- }, children: t('Clear') }), jsx(Button$1, { color: 'primary', className: 'btn btn-primary py-25 px-50', onClick: handleSubmit(handleOnSubmit), onKeyDown: (e) => {
24153
- if (e.code === 'Tab') {
24154
- closeMenu();
24158
+ else {
24159
+ setValue(e.name, '');
24155
24160
  }
24156
- }, children: t('Save') })] }) : jsx(Fragment$1, {})] })] }) })] }) }) }));
24161
+ });
24162
+ }, onKeyDown: (e) => {
24163
+ if (e.code === 'Tab') {
24164
+ closeMenu();
24165
+ }
24166
+ }, children: t('Clear') }), jsx(Button$1, { color: 'primary', className: 'btn btn-primary py-25 px-50', onClick: handleSubmit(handleOnSubmit), onKeyDown: (e) => {
24167
+ if (e.code === 'Tab') {
24168
+ closeMenu();
24169
+ }
24170
+ }, children: t('Save') })] }) : jsx(Fragment$1, {})] })] }) })] }) }));
24157
24171
  });
24158
24172
 
24159
24173
  const SelectTableBox = (props) => {
@@ -43621,7 +43635,7 @@ var css_248z$1 = ".react-resizable {\n position: relative;\n}\n.react-resizable
43621
43635
  styleInject(css_248z$1);
43622
43636
 
43623
43637
  const HeaderTableCol$1 = (props) => {
43624
- const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objHeaderWidthFixLeft, objHeaderWidthFixRight, totalCount, selectedRows, columns, orderBy, changeFilter, filterBy, changeOrder, allowFilter, allowOrder, container, fisrtObjWidthFixRight, lastObjWidthFixLeft, setContentColumns, formatSetting, optionsFilter, idTable, isMulti } = props;
43638
+ 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;
43625
43639
  const { t } = useTranslation();
43626
43640
  const headerRef = useRef(null);
43627
43641
  const order = orderBy.find((item) => item.key === col.field);
@@ -43658,7 +43672,7 @@ const HeaderTableCol$1 = (props) => {
43658
43672
  orderBy.push({ direction: 'asc', key: col.field });
43659
43673
  changeOrder(orderBy);
43660
43674
  }
43661
- }, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowOrder }), children: [col.field === 'checkbox' && (jsx(Input$1, { checked: !!(totalCount > 0 && selectedRows?.length >= totalCount), type: "checkbox", className: classNames$1('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
43675
+ }, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowSorting }), children: [col.field === 'checkbox' && (jsx(Input$1, { checked: !!(totalCount > 0 && selectedRows?.length >= totalCount), type: "checkbox", className: classNames$1('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
43662
43676
  if (selectEnable) {
43663
43677
  if (e.target.checked) {
43664
43678
  setSelectedRows(dataSource.map((item) => { return item; }));
@@ -43667,7 +43681,7 @@ const HeaderTableCol$1 = (props) => {
43667
43681
  setSelectedRows([]);
43668
43682
  }
43669
43683
  }
43670
- } })), col.field !== 'checkbox' && jsxs(Fragment$1, { children: [jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(herderContent) }), checkOverflow() && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(herderContent) })] }), col.field !== '#' && col.field !== 'command' && jsxs("div", { className: 'd-flex', children: [allowOrder && order?.direction === 'asc' && jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsx("path", { d: "M8.70711 0.292893C8.31658 -0.0976311 7.68342 -0.0976311 7.29289 0.292893L0.928932 6.65685C0.538408 7.04738 0.538408 7.68054 0.928932 8.07107C1.31946 8.46159 1.95262 8.46159 2.34315 8.07107L8 2.41421L13.6569 8.07107C14.0474 8.46159 14.6805 8.46159 15.0711 8.07107C15.4616 7.68054 15.4616 7.04738 15.0711 6.65685L8.70711 0.292893ZM8 18H9L9 1H8H7L7 18H8Z", fill: "black" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_520_6", children: jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowOrder && order?.direction === 'desc' && jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsx("path", { d: "M7.29289 17.7071C7.68342 18.0976 8.31658 18.0976 8.70711 17.7071L15.0711 11.3431C15.4616 10.9526 15.4616 10.3195 15.0711 9.92893C14.6805 9.53841 14.0474 9.53841 13.6569 9.92893L8 15.5858L2.34315 9.92893C1.95262 9.53841 1.31946 9.53841 0.928932 9.92893C0.538408 10.3195 0.538408 10.9526 0.928932 11.3431L7.29289 17.7071ZM8 0L7 0L7 17H8H9L9 0L8 0Z", fill: "black" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_520_2", children: jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFilter && (col.columns?.length ?? 0) === 0 && col.allowFilter !== false && jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
43684
+ } })), col.field !== 'checkbox' && jsxs(Fragment$1, { children: [jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(herderContent) }), checkOverflow() && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(herderContent) })] }), col.field !== '#' && col.field !== 'command' && jsxs("div", { className: 'd-flex', children: [allowSorting && order?.direction === 'asc' && jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsx("path", { d: "M8.70711 0.292893C8.31658 -0.0976311 7.68342 -0.0976311 7.29289 0.292893L0.928932 6.65685C0.538408 7.04738 0.538408 7.68054 0.928932 8.07107C1.31946 8.46159 1.95262 8.46159 2.34315 8.07107L8 2.41421L13.6569 8.07107C14.0474 8.46159 14.6805 8.46159 15.0711 8.07107C15.4616 7.68054 15.4616 7.04738 15.0711 6.65685L8.70711 0.292893ZM8 18H9L9 1H8H7L7 18H8Z", fill: "black" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_520_6", children: jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowSorting && order?.direction === 'desc' && jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsx("path", { d: "M7.29289 17.7071C7.68342 18.0976 8.31658 18.0976 8.70711 17.7071L15.0711 11.3431C15.4616 10.9526 15.4616 10.3195 15.0711 9.92893C14.6805 9.53841 14.0474 9.53841 13.6569 9.92893L8 15.5858L2.34315 9.92893C1.95262 9.53841 1.31946 9.53841 0.928932 9.92893C0.538408 10.3195 0.538408 10.9526 0.928932 11.3431L7.29289 17.7071ZM8 0L7 0L7 17H8H9L9 0L8 0Z", fill: "black" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_520_2", children: jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFiltering && (col.columns?.length ?? 0) === 0 && col.allowFilter !== false && jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
43671
43685
  setOpenFilter(!openFilter);
43672
43686
  e.stopPropagation();
43673
43687
  }, onClick: (e) => {
@@ -43753,7 +43767,7 @@ const RenderFilterElement$1 = ({ filter, optionsFilter, formatSetting, filterBy,
43753
43767
  }, children: t('Clear') })] })] }));
43754
43768
  };
43755
43769
 
43756
- 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, allowFilter, allowOrder, searchSetting, searchTerm, searchClient, height, rowHeight, haveSum }) => {
43770
+ 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 }) => {
43757
43771
  let filteredData = dataSource.map((row, index) => ({ data: row, indexRow: index }));
43758
43772
  if (((filterBy && filterBy.length > 0) || (searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) && !searchClient) {
43759
43773
  filteredData = filteredData.filter(({ data }) => CheckRowMatch(data, filterBy, searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, searchSetting?.keyField ?? []));
@@ -43788,7 +43802,7 @@ const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, vi
43788
43802
  }, []);
43789
43803
  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) => {
43790
43804
  return (jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
43791
- return (jsx(HeaderTableCol$1, { 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, allowFilter: allowFilter, allowOrder: allowOrder, formatSetting: formatSetting, changeFilter: (val) => {
43805
+ return (jsx(HeaderTableCol$1, { 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) => {
43792
43806
  setFilterBy([...val]);
43793
43807
  }, changeOrder: (val) => {
43794
43808
  setOrderBy([...val]);
@@ -44515,7 +44529,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
44515
44529
 
44516
44530
  const TableEdit = forwardRef((props, ref) => {
44517
44531
  const { t } = useTranslation();
44518
- const { idTable, dataSource, columns, setDataSource, height = 400, rowHeight = 31.3, defaultValue, toolbarSetting, searchSetting, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, haveSum, isMulti, disableAutoKey, commandClick, dataSourceChange, rowChange, setSelectedItem, handleSelect, onDuplicate, saveSettingColumn, allowFilter = true, allowOrder, settingColumns, optionsFilter, pagingSetting, resetDefaultColumns } = props;
44532
+ const { idTable, dataSource, columns, setDataSource, height = 400, rowHeight = 31.3, defaultValue, toolbarSetting, searchSetting, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, haveSum, isMulti, disableAutoKey, commandClick, dataSourceChange, rowChange, setSelectedItem, handleSelect, onDuplicate, saveSettingColumn, allowFiltering = true, allowSorting, settingColumns, optionsFilter, pagingSetting, resetDefaultColumns } = props;
44519
44533
  useImperativeHandle(ref, () => {
44520
44534
  return {
44521
44535
  refeshFocusRow: handleRefeshRow
@@ -44920,7 +44934,7 @@ const TableEdit = forwardRef((props, ref) => {
44920
44934
  }
44921
44935
  }
44922
44936
  };
44923
- 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, allowFilter: allowFilter, allowOrder: allowOrder, 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: () => {
44937
+ 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: () => {
44924
44938
  handleDuplicate(dataSource, startCell.row, fieldKey, defaultValue, fieldUniKey, changeDataSource, containerRef, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate);
44925
44939
  }, setContentColumns: (newColumns) => {
44926
44940
  setContentColumns(newColumns);
@@ -73349,15 +73363,9 @@ const TabsMenuComponent = ({ buttonWidth, tabParent, tabChild, resourceCodeParen
73349
73363
  };
73350
73364
 
73351
73365
  const RenderContentCol = (props) => {
73352
- const { col, indexCol, indexRow, isSelected, row, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, handleCommandClick, fieldKey, isMulti } = props;
73366
+ const { col, indexCol, indexRow, isSelected, row, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
73353
73367
  const RenderElement = () => {
73354
- if (col.type === 'command' && !col.field) {
73355
- return jsx("div", { className: "r-rowcell-div command", children: jsx(CommandElement, { commandItems: col.commandItems ?? [], handleCommandClick: handleCommandClick, indexRow: indexRow, rowData: row }) });
73356
- }
73357
- else if (col.type === '#' && !col.field) {
73358
- jsx("div", { className: "r-rowcell-div", children: indexRow + 1 });
73359
- }
73360
- else if (col.type === 'checkbox' && !col.field) {
73368
+ if (col.type === 'checkbox' && !col.field) {
73361
73369
  return (jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
73362
73370
  if (selectEnable) {
73363
73371
  const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
@@ -73432,7 +73440,7 @@ const RenderContentCol = (props) => {
73432
73440
  };
73433
73441
 
73434
73442
  const HeaderTableCol = (props) => {
73435
- const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objWidthFixLeft, objWidthFixRight, totalCount, selectedRows, columns, setColumns, orderBy, changeFilter, filterBy, changeOrder, allowFilter, allowOrder, container, fisrtObjWidthFixRight, lastObjWidthFixLeft, formatSetting, optionsFilter, idTable, isMulti } = props;
73443
+ const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objWidthFixLeft, objWidthFixRight, totalCount, selectedRows, columns, setColumns, orderBy, changeFilter, filterBy, changeOrder, allowFiltering, allowSorting, container, fisrtObjWidthFixRight, lastObjWidthFixLeft, formatSetting, optionsFilter, idTable, isMulti } = props;
73436
73444
  const { t } = useTranslation();
73437
73445
  const headerRef = useRef(null);
73438
73446
  const order = orderBy.find((item) => item.key === col.field);
@@ -73463,20 +73471,22 @@ const HeaderTableCol = (props) => {
73463
73471
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol ?? 0] : undefined,
73464
73472
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol ?? 0] : undefined
73465
73473
  }, children: jsxs("div", { style: { justifyContent: 'space-between' }, onClick: () => {
73466
- if (order) {
73467
- if (order.direction === 'asc') {
73468
- order.direction = 'desc';
73469
- changeOrder(orderBy);
73474
+ if (!!allowSorting && (col.columns?.length ?? 0) === 0) {
73475
+ if (order) {
73476
+ if (order.direction === 'asc') {
73477
+ order.direction = 'desc';
73478
+ changeOrder(orderBy);
73479
+ }
73480
+ else {
73481
+ changeOrder(orderBy.filter((x) => x.key !== col.field));
73482
+ }
73470
73483
  }
73471
73484
  else {
73472
- changeOrder(orderBy.filter((x) => x.key !== col.field));
73485
+ orderBy.push({ direction: 'asc', key: col.field });
73486
+ changeOrder(orderBy);
73473
73487
  }
73474
73488
  }
73475
- else {
73476
- orderBy.push({ direction: 'asc', key: col.field });
73477
- changeOrder(orderBy);
73478
- }
73479
- }, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowOrder }), children: [(col.type === 'checkbox' && !col.field) && (jsx(Input$1, { checked: !!(totalCount > 0 && selectedRows?.length >= totalCount), type: "checkbox", className: classNames$1('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
73489
+ }, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowSorting }), children: [(col.type === 'checkbox' && !col.field) && (jsx(Input$1, { checked: !!(totalCount > 0 && selectedRows?.length >= totalCount), type: "checkbox", className: classNames$1('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
73480
73490
  if (selectEnable) {
73481
73491
  if (e.target.checked) {
73482
73492
  setSelectedRows(dataSource.map((item) => { return item; }));
@@ -73485,7 +73495,7 @@ const HeaderTableCol = (props) => {
73485
73495
  setSelectedRows([]);
73486
73496
  }
73487
73497
  }
73488
- } })), col.type !== 'checkbox' && jsxs(Fragment$1, { children: [jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(col.headerText ?? '') }), checkOverflow() && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(col.headerText ?? '') })] }), col.type !== '#' && col.type !== 'command' && jsxs("div", { className: 'd-flex', children: [allowOrder && order?.direction === 'asc' && jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsx("path", { d: "M8.70711 0.292893C8.31658 -0.0976311 7.68342 -0.0976311 7.29289 0.292893L0.928932 6.65685C0.538408 7.04738 0.538408 7.68054 0.928932 8.07107C1.31946 8.46159 1.95262 8.46159 2.34315 8.07107L8 2.41421L13.6569 8.07107C14.0474 8.46159 14.6805 8.46159 15.0711 8.07107C15.4616 7.68054 15.4616 7.04738 15.0711 6.65685L8.70711 0.292893ZM8 18H9L9 1H8H7L7 18H8Z", fill: "black" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_520_6", children: jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowOrder && order?.direction === 'desc' && jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsx("path", { d: "M7.29289 17.7071C7.68342 18.0976 8.31658 18.0976 8.70711 17.7071L15.0711 11.3431C15.4616 10.9526 15.4616 10.3195 15.0711 9.92893C14.6805 9.53841 14.0474 9.53841 13.6569 9.92893L8 15.5858L2.34315 9.92893C1.95262 9.53841 1.31946 9.53841 0.928932 9.92893C0.538408 10.3195 0.538408 10.9526 0.928932 11.3431L7.29289 17.7071ZM8 0L7 0L7 17H8H9L9 0L8 0Z", fill: "black" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_520_2", children: jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFilter && jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
73498
+ } })), col.type !== 'checkbox' && jsxs(Fragment$1, { children: [jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(col.headerText ?? '') }), checkOverflow() && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(col.headerText ?? '') })] }), jsxs("div", { className: 'd-flex align-items-center', children: [allowSorting && order?.direction === 'asc' && jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsx("path", { d: "M8.70711 0.292893C8.31658 -0.0976311 7.68342 -0.0976311 7.29289 0.292893L0.928932 6.65685C0.538408 7.04738 0.538408 7.68054 0.928932 8.07107C1.31946 8.46159 1.95262 8.46159 2.34315 8.07107L8 2.41421L13.6569 8.07107C14.0474 8.46159 14.6805 8.46159 15.0711 8.07107C15.4616 7.68054 15.4616 7.04738 15.0711 6.65685L8.70711 0.292893ZM8 18H9L9 1H8H7L7 18H8Z", fill: "black" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_520_6", children: jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowSorting && order?.direction === 'desc' && jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsx("path", { d: "M7.29289 17.7071C7.68342 18.0976 8.31658 18.0976 8.70711 17.7071L15.0711 11.3431C15.4616 10.9526 15.4616 10.3195 15.0711 9.92893C14.6805 9.53841 14.0474 9.53841 13.6569 9.92893L8 15.5858L2.34315 9.92893C1.95262 9.53841 1.31946 9.53841 0.928932 9.92893C0.538408 10.3195 0.538408 10.9526 0.928932 11.3431L7.29289 17.7071ZM8 0L7 0L7 17H8H9L9 0L8 0Z", fill: "black" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_520_2", children: jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFiltering && (col.columns?.length ?? 0) === 0 && col.allowFilter !== false && jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
73489
73499
  setOpenFilter(!openFilter);
73490
73500
  e.stopPropagation();
73491
73501
  }, onClick: (e) => {
@@ -73573,18 +73583,15 @@ const RenderFilterElement = ({ filter, optionsFilter, formatSetting, filterBy, s
73573
73583
  }, children: t('Clear') })] })] }));
73574
73584
  };
73575
73585
 
73576
- const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns, isMutil = false, isLoading, selectEnable, formatSetting, commandClick, allowFilter, allowOrder, setColumns, pagingSetting, changeFilter, changeOrder, searchSetting, columnsAggregate, toolbarSetting, optionsFilter, selectedItem, setSelectedItem, handleSelect, isVirtualList }) => {
73586
+ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false, isLoading, selectEnable, formatSetting, querySetting, setColumns, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent }) => {
73577
73587
  const { t } = useTranslation();
73578
73588
  const gridRef = useRef(null);
73589
+ const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState(false);
73579
73590
  const [selectedRows, setSelectedRows] = useState([]);
73580
73591
  const [orderBy, setOrderBy] = useState([]);
73581
73592
  const [filterBy, setFilterBy] = useState([]);
73582
73593
  const [searchTerm, setSearchTerm] = useState('');
73583
73594
  const fieldKey = (columns.find((item) => item.isPrimarykey === true)?.field) ?? 'id';
73584
- const [startIndex, setStartIndex] = useState(0);
73585
- //trường liên quan đến virtul loading
73586
- const buffer = 10; // số dòng dự phòng phía trên và dưới
73587
- const visibleRowCount = Math.ceil(height / rowHeight) + 5;
73588
73595
  // 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
73589
73596
  const viewData = useMemo(() => {
73590
73597
  if (!dataSource || dataSource.length === 0) {
@@ -73598,7 +73605,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73598
73605
  });
73599
73606
  });
73600
73607
  }
73601
- if (filterBy && filterBy.length > 0) {
73608
+ if (querySetting?.client === true && filterBy && filterBy.length > 0) {
73602
73609
  datas = datas.filter((row) => {
73603
73610
  return filterBy.every((filter) => {
73604
73611
  const { key, value, ope } = filter;
@@ -73635,7 +73642,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73635
73642
  });
73636
73643
  });
73637
73644
  }
73638
- if (orderBy && orderBy.length > 0) {
73645
+ if (querySetting?.client === true && orderBy && orderBy.length > 0) {
73639
73646
  datas = datas.sort((a, b) => {
73640
73647
  for (const order of orderBy) {
73641
73648
  const { key, direction } = order;
@@ -73653,50 +73660,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73653
73660
  }
73654
73661
  return datas;
73655
73662
  }, [searchTerm, filterBy, orderBy, dataSource]);
73656
- // Tính toán chỉ số bắt đầu và kết thúc của dữ liệu hiển thị
73657
- const { adjustedStartIndex, adjustedEndIndex } = useMemo(() => {
73658
- if (!viewData || viewData.length === 0 || !isVirtualList) {
73659
- return { adjustedStartIndex: 0, adjustedEndIndex: 0 };
73660
- }
73661
- return {
73662
- adjustedStartIndex: Math.max(startIndex - buffer, 0),
73663
- adjustedEndIndex: Math.min(startIndex + visibleRowCount + buffer, dataSource.length)
73664
- };
73665
- }, [startIndex, viewData]);
73666
- const visibleData = useMemo(() => {
73667
- if (!viewData || viewData.length === 0) {
73668
- return [];
73669
- }
73670
- return isVirtualList ? viewData.slice(adjustedStartIndex, adjustedEndIndex) : viewData;
73671
- }, [viewData]);
73672
73663
  const { levels: headerColumns, flat: contentColumns, flatVisble, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = useMemo(() => calculateTableStructure(columns), [columns]);
73673
- const scrollTimeoutRef = useRef(null);
73674
- const lastScrollTop = useRef(0);
73675
- const handleScroll = (e) => {
73676
- if (!gridRef.current || !isVirtualList) {
73677
- return;
73678
- }
73679
- // Nếu không có sự thay đổi về scrollTop => người dùng chỉ scroll ngang => không xử lý
73680
- if (e.target.scrollTop === lastScrollTop.current) {
73681
- return;
73682
- }
73683
- lastScrollTop.current = e.target.scrollTop;
73684
- if (scrollTimeoutRef.current !== null) {
73685
- cancelAnimationFrame(scrollTimeoutRef.current);
73686
- }
73687
- scrollTimeoutRef.current = requestAnimationFrame(() => {
73688
- const scrollTop = gridRef.current.scrollTop;
73689
- const newStartIndex = Math.floor(scrollTop / rowHeight);
73690
- if (newStartIndex !== startIndex) {
73691
- setStartIndex(newStartIndex);
73692
- }
73693
- });
73694
- };
73695
- const handleCommandClick = (id, rowData, index) => {
73696
- if (commandClick) {
73697
- commandClick({ id, rowData, index });
73698
- }
73699
- };
73700
73664
  const handleKeyPress = (e) => {
73701
73665
  if ((e.code === 'Enter' || e.code === 'NumpadEnter')) {
73702
73666
  if (searchSetting?.setSearchTerm) {
@@ -73785,21 +73749,20 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73785
73749
  }
73786
73750
  }
73787
73751
  }, [selectedItem]);
73788
- return (jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxs("div", { className: 'r-grid', children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxs("div", { ref: gridRef, className: "r-gridtable", onScroll: handleScroll, 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) => (jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((column, indexColumn) => (jsx(HeaderTableCol, { idTable: idTable, col: column, dataSource: dataSource, indexCol: indexColumn, indexParent: indexParent, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, columns: contentColumns, setColumns: setColumns, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, orderBy: orderBy, allowFilter: allowFilter, allowOrder: allowOrder, filterBy: filterBy, optionsFilter: optionsFilter, changeFilter: (val) => {
73752
+ 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) => (jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((column, indexColumn) => (jsx(HeaderTableCol, { idTable: idTable, col: column, dataSource: dataSource, indexCol: indexColumn, indexParent: indexParent, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, columns: contentColumns, setColumns: setColumns, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, orderBy: orderBy, allowFiltering: querySetting?.allowFiltering, allowSorting: querySetting?.allowSorting, filterBy: filterBy, optionsFilter: querySetting?.optionsFilter, changeFilter: (val) => {
73789
73753
  setFilterBy([...val]);
73790
- if (changeFilter) {
73791
- changeFilter(val);
73754
+ if (querySetting?.changeFilter) {
73755
+ querySetting.changeFilter(val);
73792
73756
  }
73793
73757
  }, changeOrder: (val) => {
73794
73758
  setOrderBy([...val]);
73795
- if (changeOrder) {
73796
- changeOrder(val);
73759
+ if (querySetting?.changeOrder) {
73760
+ querySetting.changeOrder(val);
73797
73761
  }
73798
- }, container: gridRef, totalCount: dataSource.length }, `header-${indexParent}-${indexColumn}`))) }, `header-${-indexParent}`))) }), jsxs("tbody", { className: 'r-gridcontent', role: "rowgroup", children: [adjustedStartIndex > 0 && (jsx("tr", { style: { height: adjustedStartIndex * rowHeight }, children: jsx("td", { style: { padding: 0 }, colSpan: flatVisble.length }) })), visibleData.map((row, index) => {
73799
- const indexRow = index + startIndex;
73800
- const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
73801
- 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, handleCommandClick: handleCommandClick, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row }, indexCol))) }, `row-content-${indexRow}`));
73802
- }), adjustedEndIndex > 0 && viewData.length > adjustedEndIndex && (jsx("tr", { style: { height: (viewData.length - adjustedEndIndex) * rowHeight }, children: jsx("td", { style: { padding: 0 }, colSpan: flatVisble.length }) }))] }), viewData.length > 0 && jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 ? jsx("tr", { className: 'r-row', children: contentColumns.map((col, indexCol) => {
73762
+ }, container: gridRef, totalCount: dataSource.length }, `header-${indexParent}-${indexColumn}`))) }, `header-${-indexParent}`))) }), jsx("tbody", { className: 'r-gridcontent', role: "rowgroup", children: viewData.map((row, indexRow) => {
73763
+ const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
73764
+ 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 }, indexCol))) }, `row-content-${indexRow}`));
73765
+ }) }), viewData.length > 0 && jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 ? jsx("tr", { className: 'r-row', children: contentColumns.map((col, indexCol) => {
73803
73766
  const item = columnsAggregate?.find((x) => x.field === col.field);
73804
73767
  let sumValue = item?.value;
73805
73768
  if (!item && col.haveSum === true && col.type === "numeric") {
@@ -73810,7 +73773,13 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73810
73773
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
73811
73774
  textAlign: col.textAlign ? col.textAlign : 'left'
73812
73775
  }, children: jsxs("div", { className: "r-footer-div", children: [(item || (col.haveSum === true && col.type === "numeric")) && col.type === "numeric" && (Number(sumValue) >= 0) && jsx(Fragment$1, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) }), (item || (col.haveSum === true && col.type === "numeric")) && col.type === "numeric" && (Number(sumValue) < 0) && jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false)}${formatSetting?.suffixNegative ?? ''}`] })] }) }, `summarycell-${indexCol}`);
73813
- }) }) : jsx(Fragment$1, {}) })] }), (((viewData.length ?? 0) === 0) && !isLoading) && jsxs("div", { className: "r-no-data", children: [jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [jsx("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), jsx("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })] })] }) }), t('No data available.')] }), isLoading && jsx("div", { className: "r-loading-overlay", children: jsxs("div", { className: "r-loading", children: [jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) })] })] }), pagingSetting?.allowPaging ? jsx(PagingComponent, { gridRef: gridRef, onChangePage: onChangePage, pageSize: pagingSetting?.pageSize ?? 0, currentPage: pagingSetting?.currentPage ?? 0, pageOptions: pagingSetting?.pageOptions ?? [20, 30, 50, 100], totalItem: pagingSetting?.totalItem ?? 0, onChangePageSize: onChangePageSize }) : jsx(Fragment$1, {})] }));
73776
+ }) }) : jsx(Fragment$1, {}) })] }), (((viewData.length ?? 0) === 0) && !isLoading) && jsxs("div", { className: "r-no-data", children: [jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [jsx("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), jsx("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })] })] }) }), t('No data available.')] }), isLoading && jsx("div", { className: "r-loading-overlay", children: jsxs("div", { className: "r-loading", children: [jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) })] })] }), pagingSetting?.allowPaging && jsx(PagingComponent, { gridRef: gridRef, onChangePage: onChangePage, pageSize: pagingSetting?.pageSize ?? 0, currentPage: pagingSetting?.currentPage ?? 0, pageOptions: pagingSetting?.pageOptions ?? [20, 30, 50, 100], totalItem: pagingSetting?.totalItem ?? 0, onChangePageSize: onChangePageSize }), jsx(SettingColumn, { gridRef: gridRef, handleSidebar: () => {
73777
+ setOpenPopupSetupColumn(!openPopupSetupColumn);
73778
+ }, settingColumns: settingColumns, openSidebar: openPopupSetupColumn, column: [...contentColumns], resetDefaultColumns: resetDefaultColumns, setColumn: (newColumns) => {
73779
+ if (saveSettingColumn) {
73780
+ saveSettingColumn(newColumns.map((x, index) => ({ field: x.field, headerText: x.headerDisplay, visible: x.visible, fixedType: x.fixedType, width: x.width, sortOrder: index + 1 })));
73781
+ }
73782
+ } })] }));
73814
73783
  };
73815
73784
 
73816
73785
  export { CheckRowMatch, ExportExcelComponent, FindNodeByPath, InputStyleComponent, ModalImportComponent, SelectTable, SelectTableTree, TableView, TabsMenuComponent, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined$1 as isNullOrUndefined, messageBoxConfirm, messageBoxConfirmAsync, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxConfirmAsync, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };