react-table-edit 1.4.16 → 1.4.18

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
@@ -19269,6 +19269,77 @@ const FindNodeByPath = (tree, path) => {
19269
19269
  }
19270
19270
  return { parent: current, lastIndex: levels.at(-1), firstIndex: levels.length === 1 ? levels[0] : -1, node };
19271
19271
  };
19272
+ /**
19273
+ * Tính toán cấu trúc bảng từ dữ liệu column dạng cây:
19274
+ * - Tạo header dạng nhiều cấp (header theo chiều dọc)
19275
+ * - Chuyển cột thành dạng phẳng để render nội dung
19276
+ * - Tính toán vị trí cố định trái/phải (fixed column) để hiển thị sticky
19277
+ *
19278
+ * @param columns Mảng cấu trúc cây đại diện cho các cột của bảng
19279
+ * @returns {
19280
+ * levels: IHeaderColumnTable[][] // Các hàng header theo cấp
19281
+ * flat: IColumnVirtualizedTable[] // Danh sách cột phẳng
19282
+ * objWidthFixLeft: Record<number, number> // Offset trái cho cột fixed left
19283
+ * objWidthFixRight: Record<number, number> // Offset phải cho cột fixed right
19284
+ * lastObjWidthFixLeft: number // Chỉ số cột cuối cùng fixed left
19285
+ * fisrtObjWidthFixRight: number // Chỉ số cột đầu tiên fixed right
19286
+ * }
19287
+ */
19288
+ const calculateTableStructure = (columns) => {
19289
+ const levels = [];
19290
+ const flat = [];
19291
+ const objWidthFixLeft = {};
19292
+ const objWidthFixRight = {};
19293
+ let maxDepth = 0;
19294
+ // Tính depth tối đa
19295
+ const calculateDepth = (cols, depth = 1) => (Math.max(...cols.map(col => (col.columns?.length ? calculateDepth(col.columns, depth + 1) : depth))));
19296
+ maxDepth = calculateDepth(columns);
19297
+ let leftTotal = 0;
19298
+ let rightTotal = 0;
19299
+ const traverse = (cols, level = 0) => {
19300
+ levels[level] = levels[level] || [];
19301
+ return cols.reduce((colspanSum, col) => {
19302
+ const hasChildren = (col.columns?.length ?? 0) > 0;
19303
+ const colspan = hasChildren ? traverse(col.columns, level + 1) : 1;
19304
+ const cell = {
19305
+ ...col,
19306
+ columns: col.columns ?? [],
19307
+ colspan,
19308
+ rowspan: hasChildren ? 1 : maxDepth - level
19309
+ };
19310
+ levels[level].push(cell);
19311
+ if (!hasChildren) {
19312
+ const visible = col.visible !== false;
19313
+ const index = flat.length;
19314
+ const width = col.width ?? 40;
19315
+ cell.index = index;
19316
+ flat.push(cell);
19317
+ if (col.fixedType === 'left' && visible) {
19318
+ objWidthFixLeft[index] = leftTotal;
19319
+ leftTotal += width;
19320
+ }
19321
+ if (col.fixedType === 'right' && visible) {
19322
+ objWidthFixRight[index] = rightTotal;
19323
+ rightTotal += width;
19324
+ }
19325
+ }
19326
+ return colspanSum + colspan;
19327
+ }, 0);
19328
+ };
19329
+ traverse(columns);
19330
+ const flatVisble = flat.filter((e) => e.visible !== false);
19331
+ const lastObjWidthFixLeft = Math.max(...Object.keys(objWidthFixLeft).map(Number), 0);
19332
+ const fisrtObjWidthFixRight = Math.min(...Object.keys(objWidthFixRight).map(Number), flat.length);
19333
+ return {
19334
+ levels,
19335
+ flat,
19336
+ flatVisble,
19337
+ objWidthFixLeft,
19338
+ objWidthFixRight,
19339
+ lastObjWidthFixLeft,
19340
+ fisrtObjWidthFixRight
19341
+ };
19342
+ };
19272
19343
 
19273
19344
  var isCheckBoxInput = (element) => element.type === 'checkbox';
19274
19345
 
@@ -23037,7 +23108,6 @@ const EditForm = forwardRef((props, ref) => {
23037
23108
  const { innerWidth } = window;
23038
23109
  const inputRef = useRef(null);
23039
23110
  const editFormRef = useRef(null);
23040
- const buttonRef = useRef(null);
23041
23111
  const [dropdownOpen, setDropdownOpen] = useState(false);
23042
23112
  const [isFocus, setIsFocus] = useState(false);
23043
23113
  const [itemsField, setItemsField] = useState([]);
@@ -23223,7 +23293,7 @@ const EditForm = forwardRef((props, ref) => {
23223
23293
  }, 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: {
23224
23294
  maxHeight: menuHeight ? menuHeight : 300,
23225
23295
  overflow: "auto"
23226
- }, 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, { ref: buttonRef, className: 'btn me-50 py-25 px-50', outline: true, onClick: () => {
23296
+ }, 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: () => {
23227
23297
  itemsField.forEach((e) => {
23228
23298
  if (e.type === 'numeric') {
23229
23299
  setValue(e.name, 0);
@@ -23236,7 +23306,7 @@ const EditForm = forwardRef((props, ref) => {
23236
23306
  if (e.code === 'Tab') {
23237
23307
  closeMenu();
23238
23308
  }
23239
- }, children: t('Clear') }), jsx(Button$1, { ref: buttonRef, color: 'primary', className: 'btn btn-primary py-25 px-50', onClick: handleSubmit(handleOnSubmit), onKeyDown: (e) => {
23309
+ }, children: t('Clear') }), jsx(Button$1, { color: 'primary', className: 'btn btn-primary py-25 px-50', onClick: handleSubmit(handleOnSubmit), onKeyDown: (e) => {
23240
23310
  if (e.code === 'Tab') {
23241
23311
  closeMenu();
23242
23312
  }
@@ -23490,7 +23560,9 @@ const CommandElement = (props) => {
23490
23560
  }), color: item.color ? item.color : '#000', onClick: (e) => {
23491
23561
  handleCommandClick(item.id, rowData, indexRow);
23492
23562
  if (indexRow === indexFocus) {
23493
- setIndexFocus(-1);
23563
+ if (setIndexFocus) {
23564
+ setIndexFocus(-1);
23565
+ }
23494
23566
  }
23495
23567
  e.preventDefault();
23496
23568
  }, children: [item.icon && jsx(IconCustom, { iconName: item.icon, size: 16 }), jsx(UncontrolledTooltip, { className: "r-tooltip", target: `command-item-${indexRow}-${index}`, place: "top", children: t(item.tooltip ?? '') })] }, `command-${index}`));
@@ -41732,7 +41804,7 @@ const HeaderTableCol = (props) => {
41732
41804
  width: col.width ? typeof col.width === 'number' ? col.width : col.width?.includes('px') || col.width?.includes('%') ? col.width : `${col.width}px` : 'auto',
41733
41805
  minWidth: col.fixedType ? col.width : col.minWidth ? typeof col.minWidth === 'number' ? col.minWidth : col.minWidth?.includes('px') || col.minWidth?.includes('%') ? col.minWidth : `${col.minWidth}px` : 'auto',
41734
41806
  maxWidth: col.fixedType ? col.width : col.maxWidth ? typeof col.maxWidth === 'number' ? col.maxWidth : col.maxWidth?.includes('px') || col.maxWidth?.includes('%') ? col.maxWidth : `${col.maxWidth}px` : 'auto'
41735
- }, children: jsxs("div", { style: { justifyContent: col.textAlign ?? 'left' }, className: classnames('r-headercell-div'), children: [col.field === 'checkbox' && (jsx(Input$1, { checked: totalCount > 0 && selectedRows?.length >= totalCount, type: "checkbox", className: classnames('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
41807
+ }, children: jsxs("div", { style: { justifyContent: col.textAlign ?? 'left' }, className: classnames('r-headercell-div'), children: [col.field === 'checkbox' && (jsx(Input$1, { checked: !!(totalCount > 0 && selectedRows?.length >= totalCount), type: "checkbox", className: classnames('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
41736
41808
  if (selectEnable) {
41737
41809
  if (e.target.checked) {
41738
41810
  setSelectedRows(dataSource.map((item) => { return item; }));
@@ -42230,13 +42302,13 @@ editDisable, addDisable, toolbarSetting, buttonSetting) => {
42230
42302
  };
42231
42303
 
42232
42304
  const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, indexFocus, editDisable, addDisable, buttonSetting, toolbarSetting, headerColumns, t }) => {
42233
- return (jsx("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: jsxs("div", { className: "r-toolbar-items", children: [jsxs("div", { className: "r-toolbar-left", children: [jsxs("div", { className: classnames('r-toolbar-item d-flex', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: [jsx(Button$1, { color: 'success', outline: true, onClick: () => handleAdd(1), className: 'd-flex', children: t('Add item') }), jsxs(UncontrolledDropdown, { className: 'nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', className: 'me-0 d-flex', children: jsx(Button$1, { type: 'button', color: 'success', outline: true, style: { marginLeft: -1 }, className: 'px-25', children: jsx("svg", { fill: '#28c76f', height: "15", width: "20", viewBox: "0 0 20 20", children: jsx("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) }) }), jsxs(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown p-0', style: { width: 60 }, children: [jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(10), children: " 10 " }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(20), children: " 20 " }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(30), children: " 30 " }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(40), children: " 40 " }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(50), children: " 50 " })] })] })] }), (indexFocus ?? -1) > -1 ? jsxs(Fragment$1, { children: [jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: () => { handleDuplicate(); }, className: 'd-flex', children: t('Duplicate') }) }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: handleInsertBefore, className: 'd-flex', children: t('Insert item before') }) }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: handleInsertAfter, className: 'd-flex', children: t('Insert item after') }) })] }) : jsx(Fragment$1, { children: " " }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'primary', outline: true, onClick: handleDeleteAll, className: 'd-flex', children: t('Delete all item') }) }), toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
42305
+ return (jsx("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: jsxs("div", { className: "r-toolbar-items", children: [jsxs("div", { className: "r-toolbar-left", children: [jsxs("div", { className: classnames('r-toolbar-item d-flex', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: [jsx(Button$1, { color: 'success', outline: true, onClick: () => handleAdd(1), className: 'd-flex', children: t('Add item') }), jsxs(UncontrolledDropdown, { className: 'nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', className: 'me-0 d-flex', children: jsx(Button$1, { type: 'button', color: 'success', outline: true, style: { marginLeft: -1 }, className: 'px-25', children: jsx("svg", { fill: '#28c76f', height: "15", width: "20", viewBox: "0 0 20 20", children: jsx("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) }) }), jsxs(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown p-0', style: { width: 60 }, children: [jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(10), children: "Th\u00EAm 10 h\u00E0ng" }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(20), children: "Th\u00EAm 20 h\u00E0ng" }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(30), children: "Th\u00EAm 30 h\u00E0ng" }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(40), children: "Th\u00EAm 40 h\u00E0ng" }), jsx(DropdownItem$1, { className: 'py-25', tag: 'div', onClick: () => handleAdd(50), children: "Th\u00EAm 50 h\u00E0ng" })] })] })] }), (indexFocus ?? -1) > -1 ? jsxs(Fragment$1, { children: [jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: () => { handleDuplicate(); }, className: 'd-flex', children: t('Duplicate') }) }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: handleInsertBefore, className: 'd-flex', children: t('Insert item before') }) }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: handleInsertAfter, className: 'd-flex', children: t('Insert item after') }) })] }) : jsx(Fragment$1, { children: " " }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'primary', outline: true, onClick: handleDeleteAll, className: 'd-flex', children: t('Delete all item') }) }), toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
42234
42306
  return ((item.align === 'left') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : '');
42235
42307
  })] }), jsx("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
42236
42308
  return ((item.align === 'center') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : '');
42237
42309
  }) }), jsxs("div", { className: "r-toolbar-right", children: [toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
42238
42310
  return ((item.align === 'right') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : '');
42239
- }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxs("ul", { className: "mb-0 pe-50", children: [jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl + Shift + \u2193 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng d\u01B0\u1EDBi" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl + Shift + \u2191 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng tr\u00EAn" })] }) })] }) })] })] }) }));
42311
+ }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxs("ul", { className: "mb-0 pe-50", children: [jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl ho\u1EB7c Alt + Shift + \u2193 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng d\u01B0\u1EDBi" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl ho\u1EB7c Alt + Shift + \u2191 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng tr\u00EAn" })] }) })] }) })] })] }) }));
42240
42312
  };
42241
42313
 
42242
42314
  const handleArrowRight = (e, params) => {
@@ -42602,24 +42674,6 @@ const TableEdit = forwardRef((props, ref) => {
42602
42674
  setHeaderColumns(arrHeaderColumns);
42603
42675
  setContentColumns(arrContentColumns);
42604
42676
  }, [columns]);
42605
- useEffect(() => {
42606
- const arrHeaderColumns = [];
42607
- const arrContentColumns = [];
42608
- let headerLevelRow = 0;
42609
- if (levelCol) {
42610
- headerLevelRow = levelCol;
42611
- }
42612
- else {
42613
- headerLevelRow = stretchColumn(columns, 0);
42614
- setLevelCol(headerLevelRow);
42615
- }
42616
- for (let i = 0; i < headerLevelRow; i++) {
42617
- arrHeaderColumns.push([]);
42618
- }
42619
- getNestedChildren(columns, arrHeaderColumns, arrContentColumns, 0, headerLevelRow);
42620
- setHeaderColumns(arrHeaderColumns);
42621
- setContentColumns(arrContentColumns);
42622
- }, [columns]);
42623
42677
  const getNestedChildren = (array, arrHeaderColumns, arrContentColumns, level, maxLevelRow) => {
42624
42678
  array.forEach((item) => {
42625
42679
  const ele = { ...item, visible: item.visible, rowspan: 1, index: 0 };
@@ -42828,7 +42882,7 @@ const TableEdit = forwardRef((props, ref) => {
42828
42882
  }
42829
42883
  } }));
42830
42884
  case 'checkbox':
42831
- return (jsx(Input$1, { checked: row[col.field], id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, type: "checkbox", className: "input-checkbox cursor-pointer", style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (val) => {
42885
+ return (jsx(Input$1, { checked: !!row[col.field], id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, type: "checkbox", className: "input-checkbox cursor-pointer", style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (val) => {
42832
42886
  row[col.field] = val.currentTarget.checked;
42833
42887
  if (col.callback) {
42834
42888
  col.callback(val.target.value, indexRow, row);
@@ -43255,14 +43309,14 @@ const TableEdit = forwardRef((props, ref) => {
43255
43309
  }, [selectedItem]);
43256
43310
  const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
43257
43311
  if (col.field === 'command') {
43258
- return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
43312
+ return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
43259
43313
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
43260
43314
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
43261
43315
  textAlign: col.textAlign ? col.textAlign : 'left',
43262
43316
  }, children: jsx("div", { className: "r-rowcell-div command", children: jsx(CommandElement, { commandItems: col.commandItems ?? [], handleCommandClick: handleCommandClick, indexRow: indexRow, rowData: row, setIndexFocus: setIndexFocus, indexFocus: indexFocus }) }) }, `col-${indexRow}-${indexCol}`));
43263
43317
  }
43264
43318
  else if (col.field === '#') {
43265
- return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), tabIndex: Number(`${indexRow}${indexCol}`), style: {
43319
+ return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), tabIndex: Number(`${indexRow}${indexCol}`), style: {
43266
43320
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
43267
43321
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
43268
43322
  textAlign: 'center',
@@ -43300,7 +43354,7 @@ const TableEdit = forwardRef((props, ref) => {
43300
43354
  }, children: jsx("div", { className: "r-rowcell-div", children: indexRow + 1 }) }, `col-${indexRow}-${indexCol}`));
43301
43355
  }
43302
43356
  else if (col.field === 'checkbox') {
43303
- return (jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
43357
+ return (jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
43304
43358
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
43305
43359
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
43306
43360
  }, children: jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
@@ -43340,7 +43394,7 @@ const TableEdit = forwardRef((props, ref) => {
43340
43394
  }
43341
43395
  const typeDis = !editDisable && (indexFocus === indexRow || col.editType === 'checkbox') && (!col.disabledCondition || !col.disabledCondition(row)) ? (col.editEnable ? 1 : (col.template ? 2 : 3)) : (col.template ? 2 : 3);
43342
43396
  const errorMessage = typeDis === 1 || col.field === '' || !col.validate ? '' : col.validate(row[col.field], row);
43343
- return (jsx(Fragment, { children: col.visible !== false && jsx("td", { className: classnames(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
43397
+ return (jsx(Fragment, { children: col.visible !== false && jsx("td", { className: classnames(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
43344
43398
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
43345
43399
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
43346
43400
  }, onClick: (e) => {
@@ -65324,5 +65378,5 @@ const ImportExcelComponent = (props) => {
65324
65378
  ] }) }));
65325
65379
  };
65326
65380
 
65327
- export { ExportExcelComponent, FindNodeByPath, ImportExcelComponent, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, Wizard, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined$1 as isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
65381
+ export { ExportExcelComponent, FindNodeByPath, ImportExcelComponent, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined$1 as isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
65328
65382
  //# sourceMappingURL=index.mjs.map