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.js CHANGED
@@ -20516,13 +20516,25 @@ const ReactInput = (props) => {
20516
20516
 
20517
20517
  const RenderToolbarTop = ({ toolbarTopOption }) => {
20518
20518
  return (jsxRuntime.jsx("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: jsxRuntime.jsxs("div", { className: "r-toolbar-items", children: [jsxRuntime.jsx("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
20519
- return ((item.align === 'left') ? jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-left-${index}`) }) : '');
20519
+ return ((item.align === 'left') ? jsxRuntime.jsx(ToolBarElement, { item: item, index: index }) : '');
20520
20520
  }) }), jsxRuntime.jsx("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
20521
- return ((item.align === 'center') ? jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-center-${index}`) }) : '');
20521
+ return ((item.align === 'center') ? jsxRuntime.jsx(ToolBarElement, { item: item, index: index }) : '');
20522
20522
  }) }), jsxRuntime.jsx("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
20523
- return ((item.align === 'right') ? jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-top-right-${index}`) }) : '');
20523
+ return ((item.align === 'right') ? jsxRuntime.jsx(ToolBarElement, { item: item, index: index }) : '');
20524
20524
  }) })] }) }));
20525
20525
  };
20526
+ const ToolBarElement = ({ item, index }) => {
20527
+ if (item.id === 'GROUP') {
20528
+ return (jsxRuntime.jsx("div", { className: "r-toolbar-item cursor-pointer", "aria-disabled": "false", children: jsxRuntime.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: [jsxRuntime.jsxs("g", { "clip-path": "url(#group_svg__a)", fill: "#7F7F7F", children: [jsxRuntime.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" }), jsxRuntime.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" })] }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "group_svg__a", children: jsxRuntime.jsx("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })] }) }, `toolbar-top-${index}`));
20529
+ }
20530
+ if (item.id === 'EXPAND') {
20531
+ return (jsxRuntime.jsx("div", { className: "r-toolbar-item cursor-pointer", "aria-disabled": "false" }, `toolbar-top-${index}`));
20532
+ }
20533
+ if (item.id === 'COLUMN_CHOOSE') {
20534
+ return (jsxRuntime.jsx("div", { className: "r-toolbar-item cursor-pointer", "aria-disabled": "false", children: jsxRuntime.jsx(SvgSettings, { className: "me-1", fontSize: 20, color: "#7F7F7F" }) }, `toolbar-top-${index}`));
20535
+ }
20536
+ return (jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template?.() }, `toolbar-top-${index}`));
20537
+ };
20526
20538
 
20527
20539
  const handleAdd = (dataSource, containerRef, indexFirstEdit,
20528
20540
  /*eslint-disable*/
@@ -23982,7 +23994,9 @@ const EditForm = React$5.forwardRef((props, ref) => {
23982
23994
  const [itemsField, setItemsField] = React$5.useState([]);
23983
23995
  const { t } = reactI18next.useTranslation();
23984
23996
  useOnClickOutside(editFormRef, () => {
23985
- closeMenu();
23997
+ if (dropdownOpen !== false) {
23998
+ closeMenu();
23999
+ }
23986
24000
  });
23987
24001
  const closeMenu = () => {
23988
24002
  setTimeout(() => {
@@ -24146,43 +24160,43 @@ const EditForm = React$5.forwardRef((props, ref) => {
24146
24160
  });
24147
24161
  }
24148
24162
  }, [inputRef]);
24149
- return (jsxRuntime.jsx("div", { className: "form-edit", ref: ref, id: id, children: jsxRuntime.jsx("div", { ref: editFormRef, children: jsxRuntime.jsxs(Dropdown$1, { isOpen: dropdownOpen, toggle: () => { }, children: [jsxRuntime.jsx(DropdownToggle$1, { tag: 'div', children: jsxRuntime.jsxs("div", { className: classNames$1('display-value', { 'r-is-focus': isFocus || dropdownOpen }, { 'is-invalid': invalid }), onClick: handleOnClick, children: [template?.(rowData, indexRow) ?? displayValue, jsxRuntime.jsx(Input$1, { style: {
24150
- outline: 'none',
24151
- border: 'none',
24152
- width: template ? 0 : '100%',
24153
- height: template ? 0 : 28,
24154
- lineHeight: template ? 0 : 19,
24155
- padding: template ? 0 : 'auto',
24156
- backgroundColor: '$white',
24157
- textAlign: textAlign ?? 'left'
24158
- }, placeholder: placeholder, innerRef: inputRef, onKeyDown: (e) => handleOnKeyDown(e), onPaste: (e) => onPaste && onPaste(e), readOnly: true })] }) }), jsxRuntime.jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown p-0', container: component, style: {
24159
- position: 'fixed',
24160
- minWidth: minWidth ? minWidth : defaultWidth,
24161
- width: menuWidth ? menuWidth : 'min-content',
24162
- maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
24163
- borderRadius: 8,
24164
- zIndex: 9999
24165
- }, children: jsxRuntime.jsxs(DropdownItem$1, { className: 'p-0', style: { borderRadius: '6px' }, tag: 'div', header: true, children: [jsxRuntime.jsx("div", { onKeyDown: (e) => formKeyDown(e, handleSubmit(handleOnSubmit)), className: 'p-1', style: {
24166
- maxHeight: menuHeight ? menuHeight : 300,
24167
- overflow: "auto"
24168
- }, children: itemsField ? renderForm(itemsField) : '' }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [jsxRuntime.jsx("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : '' }), !onChangeField ? jsxRuntime.jsxs("div", { className: "d-flex justify-content-end", children: [isClearable && jsxRuntime.jsx(Button$1, { className: 'btn me-50 py-25 px-50', outline: true, onClick: () => {
24169
- itemsField.forEach((e) => {
24170
- if (e.type === 'numeric') {
24171
- setValue(e.name, 0);
24172
- }
24173
- else {
24174
- setValue(e.name, '');
24175
- }
24176
- });
24177
- }, onKeyDown: (e) => {
24178
- if (e.code === 'Tab') {
24179
- closeMenu();
24163
+ return (jsxRuntime.jsx("div", { className: "form-edit", ref: ref, id: id, children: jsxRuntime.jsxs(Dropdown$1, { isOpen: dropdownOpen, toggle: () => { }, children: [jsxRuntime.jsx(DropdownToggle$1, { tag: 'div', children: jsxRuntime.jsxs("div", { className: classNames$1('display-value', { 'r-is-focus': isFocus || dropdownOpen }, { 'is-invalid': invalid }), onClick: handleOnClick, children: [template?.(rowData, indexRow) ?? displayValue, jsxRuntime.jsx(Input$1, { style: {
24164
+ outline: 'none',
24165
+ border: 'none',
24166
+ width: template ? 0 : '100%',
24167
+ height: template ? 0 : 28,
24168
+ lineHeight: template ? 0 : 19,
24169
+ padding: template ? 0 : 'auto',
24170
+ backgroundColor: '$white',
24171
+ textAlign: textAlign ?? 'left'
24172
+ }, placeholder: placeholder, innerRef: inputRef, onKeyDown: (e) => handleOnKeyDown(e), onPaste: (e) => onPaste && onPaste(e), readOnly: true })] }) }), jsxRuntime.jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown p-0', container: component, style: {
24173
+ position: 'fixed',
24174
+ minWidth: minWidth ? minWidth : defaultWidth,
24175
+ width: menuWidth ? menuWidth : 'min-content',
24176
+ maxWidth: innerWidth > 1280 ? 1280 : innerWidth,
24177
+ borderRadius: 8,
24178
+ zIndex: 9999
24179
+ }, children: jsxRuntime.jsxs(DropdownItem$1, { className: 'p-0', style: { borderRadius: '6px' }, tag: 'div', header: true, children: [jsxRuntime.jsx("div", { onKeyDown: (e) => formKeyDown(e, handleSubmit(handleOnSubmit)), className: 'p-1', ref: editFormRef, style: {
24180
+ maxHeight: menuHeight ? menuHeight : 300,
24181
+ overflow: "auto"
24182
+ }, children: itemsField ? renderForm(itemsField) : '' }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-between p-50", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: [jsxRuntime.jsx("div", { className: "text-primary py-25", style: { fontSize: 12 }, children: footerTemplate ? footerTemplate(rowData) : '' }), !onChangeField ? jsxRuntime.jsxs("div", { className: "d-flex justify-content-end", children: [isClearable && jsxRuntime.jsx(Button$1, { className: 'btn me-50 py-25 px-50', outline: true, onClick: () => {
24183
+ itemsField.forEach((e) => {
24184
+ if (e.type === 'numeric') {
24185
+ setValue(e.name, 0);
24180
24186
  }
24181
- }, children: t('Clear') }), jsxRuntime.jsx(Button$1, { color: 'primary', className: 'btn btn-primary py-25 px-50', onClick: handleSubmit(handleOnSubmit), onKeyDown: (e) => {
24182
- if (e.code === 'Tab') {
24183
- closeMenu();
24187
+ else {
24188
+ setValue(e.name, '');
24184
24189
  }
24185
- }, children: t('Save') })] }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] })] }) })] }) }) }));
24190
+ });
24191
+ }, onKeyDown: (e) => {
24192
+ if (e.code === 'Tab') {
24193
+ closeMenu();
24194
+ }
24195
+ }, children: t('Clear') }), jsxRuntime.jsx(Button$1, { color: 'primary', className: 'btn btn-primary py-25 px-50', onClick: handleSubmit(handleOnSubmit), onKeyDown: (e) => {
24196
+ if (e.code === 'Tab') {
24197
+ closeMenu();
24198
+ }
24199
+ }, children: t('Save') })] }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] })] }) })] }) }));
24186
24200
  });
24187
24201
 
24188
24202
  const SelectTableBox = (props) => {
@@ -43650,7 +43664,7 @@ var css_248z$1 = ".react-resizable {\n position: relative;\n}\n.react-resizable
43650
43664
  styleInject(css_248z$1);
43651
43665
 
43652
43666
  const HeaderTableCol$1 = (props) => {
43653
- 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;
43667
+ 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;
43654
43668
  const { t } = reactI18next.useTranslation();
43655
43669
  const headerRef = React$5.useRef(null);
43656
43670
  const order = orderBy.find((item) => item.key === col.field);
@@ -43687,7 +43701,7 @@ const HeaderTableCol$1 = (props) => {
43687
43701
  orderBy.push({ direction: 'asc', key: col.field });
43688
43702
  changeOrder(orderBy);
43689
43703
  }
43690
- }, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowOrder }), children: [col.field === 'checkbox' && (jsxRuntime.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) => {
43704
+ }, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowSorting }), children: [col.field === 'checkbox' && (jsxRuntime.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) => {
43691
43705
  if (selectEnable) {
43692
43706
  if (e.target.checked) {
43693
43707
  setSelectedRows(dataSource.map((item) => { return item; }));
@@ -43696,7 +43710,7 @@ const HeaderTableCol$1 = (props) => {
43696
43710
  setSelectedRows([]);
43697
43711
  }
43698
43712
  }
43699
- } })), col.field !== 'checkbox' && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsxRuntime.jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(herderContent) }), checkOverflow() && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(herderContent) })] }), col.field !== '#' && col.field !== 'command' && jsxRuntime.jsxs("div", { className: 'd-flex', children: [allowOrder && order?.direction === 'asc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsxRuntime.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" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_6", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowOrder && order?.direction === 'desc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsxRuntime.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" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_2", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFilter && (col.columns?.length ?? 0) === 0 && col.allowFilter !== false && jsxRuntime.jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
43713
+ } })), col.field !== 'checkbox' && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsxRuntime.jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(herderContent) }), checkOverflow() && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(herderContent) })] }), col.field !== '#' && col.field !== 'command' && jsxRuntime.jsxs("div", { className: 'd-flex', children: [allowSorting && order?.direction === 'asc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsxRuntime.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" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_6", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowSorting && order?.direction === 'desc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsxRuntime.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" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_2", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFiltering && (col.columns?.length ?? 0) === 0 && col.allowFilter !== false && jsxRuntime.jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
43700
43714
  setOpenFilter(!openFilter);
43701
43715
  e.stopPropagation();
43702
43716
  }, onClick: (e) => {
@@ -43782,7 +43796,7 @@ const RenderFilterElement$1 = ({ filter, optionsFilter, formatSetting, filterBy,
43782
43796
  }, children: t('Clear') })] })] }));
43783
43797
  };
43784
43798
 
43785
- 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 }) => {
43799
+ 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 }) => {
43786
43800
  let filteredData = dataSource.map((row, index) => ({ data: row, indexRow: index }));
43787
43801
  if (((filterBy && filterBy.length > 0) || (searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) && !searchClient) {
43788
43802
  filteredData = filteredData.filter(({ data }) => CheckRowMatch(data, filterBy, searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, searchSetting?.keyField ?? []));
@@ -43817,7 +43831,7 @@ const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, vi
43817
43831
  }, []);
43818
43832
  return (jsxRuntime.jsx("div", { ref: containerRef, className: "r-gridtable", style: { maxHeight: `${height ? `${height}px` : "auto"}` }, children: jsxRuntime.jsxs("table", { style: { width: "100%" }, role: "presentation", children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: visibleColumns }), jsxRuntime.jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((element, indexParent) => {
43819
43833
  return (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
43820
- return (jsxRuntime.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) => {
43834
+ return (jsxRuntime.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) => {
43821
43835
  setFilterBy([...val]);
43822
43836
  }, changeOrder: (val) => {
43823
43837
  setOrderBy([...val]);
@@ -44544,7 +44558,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
44544
44558
 
44545
44559
  const TableEdit = React$5.forwardRef((props, ref) => {
44546
44560
  const { t } = reactI18next.useTranslation();
44547
- 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;
44561
+ 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;
44548
44562
  React$5.useImperativeHandle(ref, () => {
44549
44563
  return {
44550
44564
  refeshFocusRow: handleRefeshRow
@@ -44949,7 +44963,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
44949
44963
  }
44950
44964
  }
44951
44965
  };
44952
- return (jsxRuntime.jsx(React$5.Fragment, { children: jsxRuntime.jsxs("div", { className: "r-table-edit", children: [jsxRuntime.jsxs("div", { className: "r-grid", ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxRuntime.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: () => {
44966
+ return (jsxRuntime.jsx(React$5.Fragment, { children: jsxRuntime.jsxs("div", { className: "r-table-edit", children: [jsxRuntime.jsxs("div", { className: "r-grid", ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxRuntime.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: () => {
44953
44967
  handleDuplicate(dataSource, startCell.row, fieldKey, defaultValue, fieldUniKey, changeDataSource, containerRef, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate);
44954
44968
  }, setContentColumns: (newColumns) => {
44955
44969
  setContentColumns(newColumns);
@@ -73378,15 +73392,9 @@ const TabsMenuComponent = ({ buttonWidth, tabParent, tabChild, resourceCodeParen
73378
73392
  };
73379
73393
 
73380
73394
  const RenderContentCol = (props) => {
73381
- const { col, indexCol, indexRow, isSelected, row, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, handleCommandClick, fieldKey, isMulti } = props;
73395
+ const { col, indexCol, indexRow, isSelected, row, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
73382
73396
  const RenderElement = () => {
73383
- if (col.type === 'command' && !col.field) {
73384
- return jsxRuntime.jsx("div", { className: "r-rowcell-div command", children: jsxRuntime.jsx(CommandElement, { commandItems: col.commandItems ?? [], handleCommandClick: handleCommandClick, indexRow: indexRow, rowData: row }) });
73385
- }
73386
- else if (col.type === '#' && !col.field) {
73387
- jsxRuntime.jsx("div", { className: "r-rowcell-div", children: indexRow + 1 });
73388
- }
73389
- else if (col.type === 'checkbox' && !col.field) {
73397
+ if (col.type === 'checkbox' && !col.field) {
73390
73398
  return (jsxRuntime.jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
73391
73399
  if (selectEnable) {
73392
73400
  const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
@@ -73461,7 +73469,7 @@ const RenderContentCol = (props) => {
73461
73469
  };
73462
73470
 
73463
73471
  const HeaderTableCol = (props) => {
73464
- 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;
73472
+ 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;
73465
73473
  const { t } = reactI18next.useTranslation();
73466
73474
  const headerRef = React$5.useRef(null);
73467
73475
  const order = orderBy.find((item) => item.key === col.field);
@@ -73492,20 +73500,22 @@ const HeaderTableCol = (props) => {
73492
73500
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol ?? 0] : undefined,
73493
73501
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol ?? 0] : undefined
73494
73502
  }, children: jsxRuntime.jsxs("div", { style: { justifyContent: 'space-between' }, onClick: () => {
73495
- if (order) {
73496
- if (order.direction === 'asc') {
73497
- order.direction = 'desc';
73498
- changeOrder(orderBy);
73503
+ if (!!allowSorting && (col.columns?.length ?? 0) === 0) {
73504
+ if (order) {
73505
+ if (order.direction === 'asc') {
73506
+ order.direction = 'desc';
73507
+ changeOrder(orderBy);
73508
+ }
73509
+ else {
73510
+ changeOrder(orderBy.filter((x) => x.key !== col.field));
73511
+ }
73499
73512
  }
73500
73513
  else {
73501
- changeOrder(orderBy.filter((x) => x.key !== col.field));
73514
+ orderBy.push({ direction: 'asc', key: col.field });
73515
+ changeOrder(orderBy);
73502
73516
  }
73503
73517
  }
73504
- else {
73505
- orderBy.push({ direction: 'asc', key: col.field });
73506
- changeOrder(orderBy);
73507
- }
73508
- }, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowOrder }), children: [(col.type === 'checkbox' && !col.field) && (jsxRuntime.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) => {
73518
+ }, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowSorting }), children: [(col.type === 'checkbox' && !col.field) && (jsxRuntime.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) => {
73509
73519
  if (selectEnable) {
73510
73520
  if (e.target.checked) {
73511
73521
  setSelectedRows(dataSource.map((item) => { return item; }));
@@ -73514,7 +73524,7 @@ const HeaderTableCol = (props) => {
73514
73524
  setSelectedRows([]);
73515
73525
  }
73516
73526
  }
73517
- } })), col.type !== 'checkbox' && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsxRuntime.jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(col.headerText ?? '') }), checkOverflow() && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(col.headerText ?? '') })] }), col.type !== '#' && col.type !== 'command' && jsxRuntime.jsxs("div", { className: 'd-flex', children: [allowOrder && order?.direction === 'asc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsxRuntime.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" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_6", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowOrder && order?.direction === 'desc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsxRuntime.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" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_2", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFilter && jsxRuntime.jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
73527
+ } })), col.type !== 'checkbox' && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsxRuntime.jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(col.headerText ?? '') }), checkOverflow() && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(col.headerText ?? '') })] }), jsxRuntime.jsxs("div", { className: 'd-flex align-items-center', children: [allowSorting && order?.direction === 'asc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsxRuntime.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" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_6", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowSorting && order?.direction === 'desc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsxRuntime.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" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_2", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFiltering && (col.columns?.length ?? 0) === 0 && col.allowFilter !== false && jsxRuntime.jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
73518
73528
  setOpenFilter(!openFilter);
73519
73529
  e.stopPropagation();
73520
73530
  }, onClick: (e) => {
@@ -73602,18 +73612,15 @@ const RenderFilterElement = ({ filter, optionsFilter, formatSetting, filterBy, s
73602
73612
  }, children: t('Clear') })] })] }));
73603
73613
  };
73604
73614
 
73605
- 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 }) => {
73615
+ 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 }) => {
73606
73616
  const { t } = reactI18next.useTranslation();
73607
73617
  const gridRef = React$5.useRef(null);
73618
+ const [openPopupSetupColumn, setOpenPopupSetupColumn] = React$5.useState(false);
73608
73619
  const [selectedRows, setSelectedRows] = React$5.useState([]);
73609
73620
  const [orderBy, setOrderBy] = React$5.useState([]);
73610
73621
  const [filterBy, setFilterBy] = React$5.useState([]);
73611
73622
  const [searchTerm, setSearchTerm] = React$5.useState('');
73612
73623
  const fieldKey = (columns.find((item) => item.isPrimarykey === true)?.field) ?? 'id';
73613
- const [startIndex, setStartIndex] = React$5.useState(0);
73614
- //trường liên quan đến virtul loading
73615
- const buffer = 10; // số dòng dự phòng phía trên và dưới
73616
- const visibleRowCount = Math.ceil(height / rowHeight) + 5;
73617
73624
  // 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
73618
73625
  const viewData = React$5.useMemo(() => {
73619
73626
  if (!dataSource || dataSource.length === 0) {
@@ -73627,7 +73634,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73627
73634
  });
73628
73635
  });
73629
73636
  }
73630
- if (filterBy && filterBy.length > 0) {
73637
+ if (querySetting?.client === true && filterBy && filterBy.length > 0) {
73631
73638
  datas = datas.filter((row) => {
73632
73639
  return filterBy.every((filter) => {
73633
73640
  const { key, value, ope } = filter;
@@ -73664,7 +73671,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73664
73671
  });
73665
73672
  });
73666
73673
  }
73667
- if (orderBy && orderBy.length > 0) {
73674
+ if (querySetting?.client === true && orderBy && orderBy.length > 0) {
73668
73675
  datas = datas.sort((a, b) => {
73669
73676
  for (const order of orderBy) {
73670
73677
  const { key, direction } = order;
@@ -73682,50 +73689,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73682
73689
  }
73683
73690
  return datas;
73684
73691
  }, [searchTerm, filterBy, orderBy, dataSource]);
73685
- // Tính toán chỉ số bắt đầu và kết thúc của dữ liệu hiển thị
73686
- const { adjustedStartIndex, adjustedEndIndex } = React$5.useMemo(() => {
73687
- if (!viewData || viewData.length === 0 || !isVirtualList) {
73688
- return { adjustedStartIndex: 0, adjustedEndIndex: 0 };
73689
- }
73690
- return {
73691
- adjustedStartIndex: Math.max(startIndex - buffer, 0),
73692
- adjustedEndIndex: Math.min(startIndex + visibleRowCount + buffer, dataSource.length)
73693
- };
73694
- }, [startIndex, viewData]);
73695
- const visibleData = React$5.useMemo(() => {
73696
- if (!viewData || viewData.length === 0) {
73697
- return [];
73698
- }
73699
- return isVirtualList ? viewData.slice(adjustedStartIndex, adjustedEndIndex) : viewData;
73700
- }, [viewData]);
73701
73692
  const { levels: headerColumns, flat: contentColumns, flatVisble, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = React$5.useMemo(() => calculateTableStructure(columns), [columns]);
73702
- const scrollTimeoutRef = React$5.useRef(null);
73703
- const lastScrollTop = React$5.useRef(0);
73704
- const handleScroll = (e) => {
73705
- if (!gridRef.current || !isVirtualList) {
73706
- return;
73707
- }
73708
- // Nếu không có sự thay đổi về scrollTop => người dùng chỉ scroll ngang => không xử lý
73709
- if (e.target.scrollTop === lastScrollTop.current) {
73710
- return;
73711
- }
73712
- lastScrollTop.current = e.target.scrollTop;
73713
- if (scrollTimeoutRef.current !== null) {
73714
- cancelAnimationFrame(scrollTimeoutRef.current);
73715
- }
73716
- scrollTimeoutRef.current = requestAnimationFrame(() => {
73717
- const scrollTop = gridRef.current.scrollTop;
73718
- const newStartIndex = Math.floor(scrollTop / rowHeight);
73719
- if (newStartIndex !== startIndex) {
73720
- setStartIndex(newStartIndex);
73721
- }
73722
- });
73723
- };
73724
- const handleCommandClick = (id, rowData, index) => {
73725
- if (commandClick) {
73726
- commandClick({ id, rowData, index });
73727
- }
73728
- };
73729
73693
  const handleKeyPress = (e) => {
73730
73694
  if ((e.code === 'Enter' || e.code === 'NumpadEnter')) {
73731
73695
  if (searchSetting?.setSearchTerm) {
@@ -73814,21 +73778,20 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73814
73778
  }
73815
73779
  }
73816
73780
  }, [selectedItem]);
73817
- return (jsxRuntime.jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxRuntime.jsxs("div", { className: 'r-grid', children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable", onScroll: handleScroll, style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxRuntime.jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: flatVisble }), jsxRuntime.jsx("thead", { className: 'r-gridheader', role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((column, indexColumn) => (jsxRuntime.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) => {
73781
+ return (jsxRuntime.jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxRuntime.jsxs("div", { className: 'r-grid', children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxRuntime.jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: flatVisble }), jsxRuntime.jsx("thead", { className: 'r-gridheader', role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((column, indexColumn) => (jsxRuntime.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) => {
73818
73782
  setFilterBy([...val]);
73819
- if (changeFilter) {
73820
- changeFilter(val);
73783
+ if (querySetting?.changeFilter) {
73784
+ querySetting.changeFilter(val);
73821
73785
  }
73822
73786
  }, changeOrder: (val) => {
73823
73787
  setOrderBy([...val]);
73824
- if (changeOrder) {
73825
- changeOrder(val);
73788
+ if (querySetting?.changeOrder) {
73789
+ querySetting.changeOrder(val);
73826
73790
  }
73827
- }, container: gridRef, totalCount: dataSource.length }, `header-${indexParent}-${indexColumn}`))) }, `header-${-indexParent}`))) }), jsxRuntime.jsxs("tbody", { className: 'r-gridcontent', role: "rowgroup", children: [adjustedStartIndex > 0 && (jsxRuntime.jsx("tr", { style: { height: adjustedStartIndex * rowHeight }, children: jsxRuntime.jsx("td", { style: { padding: 0 }, colSpan: flatVisble.length }) })), visibleData.map((row, index) => {
73828
- const indexRow = index + startIndex;
73829
- const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
73830
- return (jsxRuntime.jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: 'r-row', children: contentColumns.map((column, indexCol) => (jsxRuntime.jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: fieldKey, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, handleCommandClick: handleCommandClick, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row }, indexCol))) }, `row-content-${indexRow}`));
73831
- }), adjustedEndIndex > 0 && viewData.length > adjustedEndIndex && (jsxRuntime.jsx("tr", { style: { height: (viewData.length - adjustedEndIndex) * rowHeight }, children: jsxRuntime.jsx("td", { style: { padding: 0 }, colSpan: flatVisble.length }) }))] }), viewData.length > 0 && jsxRuntime.jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 ? jsxRuntime.jsx("tr", { className: 'r-row', children: contentColumns.map((col, indexCol) => {
73791
+ }, container: gridRef, totalCount: dataSource.length }, `header-${indexParent}-${indexColumn}`))) }, `header-${-indexParent}`))) }), jsxRuntime.jsx("tbody", { className: 'r-gridcontent', role: "rowgroup", children: viewData.map((row, indexRow) => {
73792
+ const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
73793
+ return (jsxRuntime.jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: 'r-row', children: contentColumns.map((column, indexCol) => (jsxRuntime.jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: fieldKey, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row }, indexCol))) }, `row-content-${indexRow}`));
73794
+ }) }), viewData.length > 0 && jsxRuntime.jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 ? jsxRuntime.jsx("tr", { className: 'r-row', children: contentColumns.map((col, indexCol) => {
73832
73795
  const item = columnsAggregate?.find((x) => x.field === col.field);
73833
73796
  let sumValue = item?.value;
73834
73797
  if (!item && col.haveSum === true && col.type === "numeric") {
@@ -73839,7 +73802,13 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
73839
73802
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
73840
73803
  textAlign: col.textAlign ? col.textAlign : 'left'
73841
73804
  }, children: jsxRuntime.jsxs("div", { className: "r-footer-div", children: [(item || (col.haveSum === true && col.type === "numeric")) && col.type === "numeric" && (Number(sumValue) >= 0) && jsxRuntime.jsx(jsxRuntime.Fragment, { 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) && jsxRuntime.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}`);
73842
- }) }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}) })] }), (((viewData.length ?? 0) === 0) && !isLoading) && jsxRuntime.jsxs("div", { className: "r-no-data", children: [jsxRuntime.jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [jsxRuntime.jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), jsxRuntime.jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [jsxRuntime.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" }), jsxRuntime.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 && jsxRuntime.jsx("div", { className: "r-loading-overlay", children: jsxRuntime.jsxs("div", { className: "r-loading", children: [jsxRuntime.jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) })] })] }), pagingSetting?.allowPaging ? jsxRuntime.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 }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] }));
73805
+ }) }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}) })] }), (((viewData.length ?? 0) === 0) && !isLoading) && jsxRuntime.jsxs("div", { className: "r-no-data", children: [jsxRuntime.jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [jsxRuntime.jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), jsxRuntime.jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [jsxRuntime.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" }), jsxRuntime.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 && jsxRuntime.jsx("div", { className: "r-loading-overlay", children: jsxRuntime.jsxs("div", { className: "r-loading", children: [jsxRuntime.jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) })] })] }), pagingSetting?.allowPaging && jsxRuntime.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 }), jsxRuntime.jsx(SettingColumn, { gridRef: gridRef, handleSidebar: () => {
73806
+ setOpenPopupSetupColumn(!openPopupSetupColumn);
73807
+ }, settingColumns: settingColumns, openSidebar: openPopupSetupColumn, column: [...contentColumns], resetDefaultColumns: resetDefaultColumns, setColumn: (newColumns) => {
73808
+ if (saveSettingColumn) {
73809
+ saveSettingColumn(newColumns.map((x, index) => ({ field: x.field, headerText: x.headerDisplay, visible: x.visible, fixedType: x.fixedType, width: x.width, sortOrder: index + 1 })));
73810
+ }
73811
+ } })] }));
73843
73812
  };
73844
73813
 
73845
73814
  exports.CheckRowMatch = CheckRowMatch;