react-table-edit 1.5.19 → 1.5.21

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.
@@ -14,10 +14,9 @@ interface ToolbarBottomProps {
14
14
  focusRow: number | null;
15
15
  editDisable?: boolean;
16
16
  addDisable?: boolean;
17
- disableAddMulti?: boolean;
18
17
  buttonSetting?: IFTableEditButton;
19
18
  toolbarSetting?: IFTableEditToolbar;
20
19
  headerColumns: any[][];
21
20
  }
22
- declare const ToolbarBottom: ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, focusRow, editDisable, addDisable, disableAddMulti, buttonSetting, toolbarSetting, headerColumns }: ToolbarBottomProps) => import("react/jsx-runtime").JSX.Element;
21
+ declare const ToolbarBottom: ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, focusRow, editDisable, addDisable, buttonSetting, toolbarSetting, headerColumns }: ToolbarBottomProps) => import("react/jsx-runtime").JSX.Element;
23
22
  export default ToolbarBottom;
@@ -233,6 +233,8 @@ export type IFTableEditPaging = {
233
233
  };
234
234
  /** Cấu hình các nút thao tác trên bảng */
235
235
  export type IFTableEditButton = {
236
+ /** Vô hiệu hóa nút thêm nhiều dòng */
237
+ disableAddMulti?: boolean;
236
238
  /** Vô hiệu hóa nút xóa tất cả */
237
239
  deleteAllDisable?: boolean;
238
240
  /** Vô hiệu hóa nút chèn sau */
package/dist/index.d.ts CHANGED
@@ -237,6 +237,8 @@ type IFTableEditPaging = {
237
237
  };
238
238
  /** Cấu hình các nút thao tác trên bảng */
239
239
  type IFTableEditButton = {
240
+ /** Vô hiệu hóa nút thêm nhiều dòng */
241
+ disableAddMulti?: boolean;
240
242
  /** Vô hiệu hóa nút xóa tất cả */
241
243
  deleteAllDisable?: boolean;
242
244
  /** Vô hiệu hóa nút chèn sau */
package/dist/index.js CHANGED
@@ -38833,9 +38833,6 @@ const FilterComponent = ({ optionsFilter, formatSetting, filterBy, setOpenFilter
38833
38833
  else if (column.type === 'date' || column.type === 'datetime') {
38834
38834
  typeFilter = 'date';
38835
38835
  }
38836
- else if (column.type === 'select') {
38837
- typeFilter = 'select';
38838
- }
38839
38836
  else {
38840
38837
  typeFilter = 'text';
38841
38838
  }
@@ -39050,10 +39047,13 @@ const HeaderTableCol = (props) => {
39050
39047
  };
39051
39048
 
39052
39049
  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 }) => {
39053
- let filteredData = dataSource.map((row, index) => ({ data: row, indexRow: index }));
39054
- if (((filterBy && filterBy.length > 0) || (searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) && !searchClient) {
39055
- filteredData = filteredData.filter(({ data }) => CheckRowMatch(data, filterBy, searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, searchSetting?.keyField ?? []));
39056
- }
39050
+ const filteredData = React$5.useMemo(() => {
39051
+ const arr = dataSource.map((row, index) => ({ data: row, indexRow: index }));
39052
+ if (((filterBy && filterBy.length > 0) || (searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) && searchClient) {
39053
+ return arr.filter(({ data }) => CheckRowMatch(data, filterBy, searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, searchSetting?.keyField ?? []));
39054
+ }
39055
+ return arr;
39056
+ }, [filterBy, searchTerm, dataSource]);
39057
39057
  const [scrollTop, setScrollTop] = React$5.useState(0);
39058
39058
  const totalHeight = filteredData.length * rowHeight;
39059
39059
  const visibleCount = Math.ceil(height / rowHeight) + 5; // buffer
@@ -39798,9 +39798,9 @@ const SettingColumn = (props) => {
39798
39798
  }) }) })] }), jsxRuntime.jsxs("div", { style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, className: "d-flex justify-content-between align-items-center w-100 py-75 px-1", children: [jsxRuntime.jsx("div", { children: settingColumns?.updatedDate && jsxRuntime.jsxs("p", { children: [jsxRuntime.jsxs("strong", { children: [t("Update date"), ": "] }), " ", jsxRuntime.jsx("span", { children: settingColumns.updatedDate ? formatDateTime(settingColumns.updatedDate, "DD/MM/yyyy HH:mm") : "" }), jsxRuntime.jsxs("strong", { className: "ms-2", children: [t("Editor"), ": "] }), " ", jsxRuntime.jsx("span", { children: settingColumns.updatedByName })] }) }), jsxRuntime.jsxs("div", { children: [resetDefaultColumns && jsxRuntime.jsx(Button$1$1, { color: "primary", onClick: () => messageBoxConfirm(t, handleResetColumns, {}, 'Do you want to reset the default settings?'), className: "me-1", children: t("Reset") }), jsxRuntime.jsx(Button$1$1, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }), jsxRuntime.jsx(Button$1$1, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })] })] })] }));
39799
39799
  };
39800
39800
 
39801
- const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, focusRow, editDisable, addDisable, disableAddMulti, buttonSetting, toolbarSetting, headerColumns }) => {
39801
+ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, focusRow, editDisable, addDisable, buttonSetting, toolbarSetting, headerColumns }) => {
39802
39802
  const { t } = reactI18next.useTranslation();
39803
- return (jsxRuntime.jsx("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: jsxRuntime.jsxs("div", { className: "r-toolbar-items", children: [jsxRuntime.jsxs("div", { className: "r-toolbar-left", children: [jsxRuntime.jsxs("div", { className: classNames$1('r-toolbar-item d-flex', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: [jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: () => handleAdd(1), className: "d-flex", children: t('Add item') }), !!disableAddMulti && (jsxRuntime.jsxs(UncontrolledDropdown, { className: "nav-item", children: [jsxRuntime.jsx(DropdownToggle$1, { tag: "div", className: "me-0 d-flex", children: jsxRuntime.jsx(Button$1$1, { type: "button", color: "success", outline: true, style: { marginLeft: -1 }, className: "px-25", children: jsxRuntime.jsx("svg", { fill: "#28c76f", height: "15", width: "20", viewBox: "0 0 20 20", children: jsxRuntime.jsx("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) }) }), jsxRuntime.jsxs(DropdownMenu$1, { className: "formula-dropdown icon-dropdown p-0", children: [jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(10), children: "10 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(20), children: "20 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(30), children: "30 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(40), children: "40 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(50), children: "50 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(100), children: "100 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(1000), children: "1000 h\u00E0ng" })] })] }))] }), (focusRow ?? -1) > -1 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: () => {
39803
+ return (jsxRuntime.jsx("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: jsxRuntime.jsxs("div", { className: "r-toolbar-items", children: [jsxRuntime.jsxs("div", { className: "r-toolbar-left", children: [jsxRuntime.jsxs("div", { className: classNames$1('r-toolbar-item d-flex', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: [jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: () => handleAdd(1), className: "d-flex", children: t('Add item') }), !!buttonSetting?.disableAddMulti && (jsxRuntime.jsxs(UncontrolledDropdown, { className: "nav-item", children: [jsxRuntime.jsx(DropdownToggle$1, { tag: "div", className: "me-0 d-flex", children: jsxRuntime.jsx(Button$1$1, { type: "button", color: "success", outline: true, style: { marginLeft: -1 }, className: "px-25", children: jsxRuntime.jsx("svg", { fill: "#28c76f", height: "15", width: "20", viewBox: "0 0 20 20", children: jsxRuntime.jsx("path", { d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z" }) }) }) }), jsxRuntime.jsxs(DropdownMenu$1, { className: "formula-dropdown icon-dropdown p-0", children: [jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(10), children: "10 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(20), children: "20 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(30), children: "30 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(40), children: "40 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(50), children: "50 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(100), children: "100 h\u00E0ng" }), jsxRuntime.jsx(DropdownItem$1, { className: "py-25", tag: "div", onClick: () => handleAdd(1000), children: "1000 h\u00E0ng" })] })] }))] }), (focusRow ?? -1) > -1 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: () => {
39804
39804
  handleDuplicate();
39805
39805
  }, className: "d-flex", children: t('Duplicate') }) }), jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: handleInsertBefore, className: "d-flex", children: t('Insert item before') }) }), jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: jsxRuntime.jsx(Button$1$1, { color: "success", outline: true, onClick: handleInsertAfter, className: "d-flex", children: t('Insert item after') }) })] })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: " " })), jsxRuntime.jsx("div", { className: classNames$1('r-toolbar-item', { 'd-none': editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: jsxRuntime.jsx(Button$1$1, { color: "primary", outline: true, onClick: handleDeleteAll, className: "d-flex", children: t('Delete all item') }) }), toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
39806
39806
  return item.align === 'left' ? (jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`)) : ('');
@@ -68700,7 +68700,7 @@ const RenderContentCol = (props) => {
68700
68700
  // ✅ Format dữ liệu theo loại cột
68701
68701
  if (col.type === 'numeric') {
68702
68702
  value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
68703
- if (!zeroVisiable && (value === '0' || value === 0)) {
68703
+ if (!zeroVisiable && !(row?.sortOrder < 0 || row?.sortOrder > 100000) && (value === '0' || value === 0)) {
68704
68704
  value = '';
68705
68705
  }
68706
68706
  }