es-grid-template 1.4.1 → 1.4.2

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.
Files changed (33) hide show
  1. package/es/grid-component/EditableCell.js +46 -15
  2. package/es/grid-component/InternalTable.d.ts +1 -0
  3. package/es/grid-component/InternalTable.js +467 -111
  4. package/es/grid-component/TableGrid.js +2 -7
  5. package/es/grid-component/hooks/columns/index.d.ts +1 -1
  6. package/es/grid-component/hooks/columns/index.js +3 -13
  7. package/es/grid-component/hooks/useColumns.js +2 -0
  8. package/es/grid-component/hooks/utils.d.ts +1 -1
  9. package/es/grid-component/hooks/utils.js +3 -3
  10. package/es/grid-component/styles.scss +1186 -1170
  11. package/es/grid-component/table/Grid.d.ts +1 -0
  12. package/es/grid-component/table/GridEdit.d.ts +1 -0
  13. package/es/grid-component/table/GridEdit.js +156 -121
  14. package/es/grid-component/table/Group.d.ts +1 -0
  15. package/es/grid-component/type.d.ts +7 -2
  16. package/es/grid-component/useContext.d.ts +1 -0
  17. package/lib/grid-component/EditableCell.js +46 -15
  18. package/lib/grid-component/InternalTable.d.ts +1 -0
  19. package/lib/grid-component/InternalTable.js +467 -100
  20. package/lib/grid-component/TableGrid.js +2 -7
  21. package/lib/grid-component/hooks/columns/index.d.ts +1 -1
  22. package/lib/grid-component/hooks/columns/index.js +5 -15
  23. package/lib/grid-component/hooks/useColumns.js +2 -0
  24. package/lib/grid-component/hooks/utils.d.ts +1 -1
  25. package/lib/grid-component/hooks/utils.js +3 -3
  26. package/lib/grid-component/styles.scss +1186 -1170
  27. package/lib/grid-component/table/Grid.d.ts +1 -0
  28. package/lib/grid-component/table/GridEdit.d.ts +1 -0
  29. package/lib/grid-component/table/GridEdit.js +156 -121
  30. package/lib/grid-component/table/Group.d.ts +1 -0
  31. package/lib/grid-component/type.d.ts +7 -2
  32. package/lib/grid-component/useContext.d.ts +1 -0
  33. package/package.json +109 -109
@@ -355,9 +355,7 @@ const TableGrid = props => {
355
355
  }), /*#__PURE__*/_react.default.createElement(_rcMasterUi.Table, (0, _extends2.default)({
356
356
  ref: tableRef
357
357
  }, rest, {
358
- tableLayout: 'fixed'
359
- // id={newGuid()}
360
- ,
358
+ tableLayout: 'fixed',
361
359
  locale: {
362
360
  ...locale,
363
361
  emptyText: showEmptyText !== false ? /*#__PURE__*/_react.default.createElement(_rcMasterUi.Empty, {
@@ -371,10 +369,7 @@ const TableGrid = props => {
371
369
  }
372
370
  // dataSource={columns && columns.length > 0 ? filterDataByColumns3(dataSource, filterStates) : []}
373
371
  ,
374
- dataSource: columns && columns.length > 0 ? (0, _hooks.filterDataByColumns4)(dataSource, filterStates) : []
375
- // dataSource={columns && columns.length > 0 && loading !== true ? dataSource : []}
376
- // className={styles.customTable}
377
- ,
372
+ dataSource: columns && columns.length > 0 ? (0, _hooks.filterDataByColumns4)(dataSource, filterStates) : [],
378
373
  className: (0, _classnames.default)(className, {
379
374
  'table-none-column-select': selectionSettings?.mode === undefined && selectionSettings?.type !== 'multiple'
380
375
  }, styles.customTable),
@@ -3,7 +3,7 @@ import React from "react";
3
3
  import type { TableLocale } from "rc-master-ui/lib/table/interface";
4
4
  import type { ColumnsTable } from "../../type";
5
5
  export declare function flatColumns<RecordType>(columns: ColumnsTable<RecordType>, parentKey?: string): ColumnsTable<RecordType>;
6
- export declare function flatColumns2<RecordType>(columns: ColumnsTable<RecordType>): ColumnsTable<RecordType>;
6
+ export declare const flatColumns2: <RecordType>(columns: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
7
7
  export declare const getValueCell: <T>(column: ColumnTable<T>, value: any, format?: IFormat) => any;
8
8
  export declare const renderContent: <T>(column: ColumnTable<T>, value: any, record: any, index: number, format?: IFormat) => React.JSX.Element;
9
9
  export declare const renderFilter: <RecordType>(column: ColumnTable<RecordType>, selectedKeys: string[], setSelectedKeys: any, confirm: any, visible: boolean, searchValue: string, setSearchValue: any, dataSourceFilter: any[], buddhistLocale: any, locale?: TableLocale, t?: any, format?: IFormat) => React.JSX.Element;
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.flatColumns = flatColumns;
8
- exports.flatColumns2 = flatColumns2;
9
- exports.renderFilter = exports.renderContent = exports.getValueCell = void 0;
8
+ exports.renderFilter = exports.renderContent = exports.getValueCell = exports.flatColumns2 = void 0;
10
9
  var _utils = require("../utils");
11
10
  var _reactNumericComponent = require("react-numeric-component");
12
11
  var _dayjs = _interopRequireDefault(require("dayjs"));
@@ -49,16 +48,8 @@ function flatColumns(columns, parentKey = 'key') {
49
48
  }];
50
49
  }, []);
51
50
  }
52
- function flatColumns2(columns
53
- // parentKey = 'key'
54
- ) {
55
- // @ts-ignore
51
+ const flatColumns2 = columns => {
56
52
  return columns.reduce((list, column) => {
57
- // const { fixed } = column
58
- // Convert `fixed='true'` to `fixed='left'` instead
59
- // const parsedFixed = fixed === true ? 'left' : fixed
60
- // const mergedKey = `${parentKey}-${index}`
61
-
62
53
  const subColumns = column.children;
63
54
  if (column === _useSelection.SELECTION_COLUMN) {
64
55
  return [...list, {
@@ -66,18 +57,17 @@ function flatColumns2(columns
66
57
  }];
67
58
  }
68
59
  if (subColumns && subColumns.length > 0) {
69
- return [...list, ...flatColumns(subColumns).map(subColum => ({
60
+ return [...list, ...flatColumns2(subColumns).map(subColum => ({
70
61
  // fixed: parsedFixed,
71
62
  ...subColum
72
63
  }))];
73
64
  }
74
65
  return [...list, {
75
- // key: mergedKey,
76
66
  ...column
77
- // fixed: parsedFixed
78
67
  }];
79
68
  }, []);
80
- }
69
+ };
70
+ exports.flatColumns2 = flatColumns2;
81
71
  const getValueCell = (column, value, format) => {
82
72
  switch (column?.type) {
83
73
  case 'number':
@@ -273,12 +273,14 @@ const useColumns = config => {
273
273
  })));
274
274
  },
275
275
  onHeaderCell: () => ({
276
+ id: `${col.field}`,
276
277
  width: col.width,
277
278
  onResize: handleResize?.(col),
278
279
  className: col.headerTextAlign === 'center' ? 'head-align-center' : col.headerTextAlign === 'right' ? 'head-align-right' : ''
279
280
  }),
280
281
  onCell: (data, index) => {
281
282
  return {
283
+ id: `${col.field}`,
282
284
  colSpan: groupColumns && data.children && col.field === firstNonGroupColumn?.field ? 2 : groupColumns && data.children && nonGroupColumns[1].field === col.field ? 0 : 1,
283
285
  zIndex: data.children && col.field === firstNonGroupColumn?.field ? 11 : undefined,
284
286
  ...transformedColumn?.onCell?.(data, index),
@@ -93,7 +93,7 @@ export declare const checkChild: (inputArray: any[]) => boolean;
93
93
  export declare const isEditable: <RecordType>(column: ColumnTable, rowData: RecordType) => boolean | ((rowData: any) => boolean);
94
94
  export declare const isArraysEqual: (arr1: any[], arr2: any[]) => boolean;
95
95
  export declare const editAbleColumns: <T>(columns: ColumnsTable<T>) => ColumnTable<T>[];
96
- export declare const findItemPath: (tree: any[], targetItem: any, rowKey: any) => any;
96
+ export declare const findItemPath: (tree: any[], targetItem: any, rowKey: any, currentPage?: number, pageSize?: number) => any;
97
97
  export declare const filterDataByColumns: (data: any[], queries: any) => any[];
98
98
  export declare const filterDataByColumns2: (data: any[], queries: any) => any[];
99
99
  export declare const removeFieldRecursive: (data: any[], field: string) => any[];
@@ -1031,11 +1031,11 @@ const editAbleColumns = columns => {
1031
1031
  return columns.filter(col => col.field !== '#' && col.field !== 'index' && col.field !== 'command' && col.visible !== false);
1032
1032
  };
1033
1033
  exports.editAbleColumns = editAbleColumns;
1034
- const findItemPath = (tree, targetItem, rowKey) => {
1034
+ const findItemPath = (tree, targetItem, rowKey, currentPage, pageSize) => {
1035
1035
  let result = null;
1036
1036
  function dfs(nodes, path = []) {
1037
1037
  for (let i = 0; i < nodes.length; i++) {
1038
- const currentPath = [...path, i + 1];
1038
+ const currentPath = currentPage && pageSize ? [...path, i + 1 + (currentPage - 1) * pageSize] : [...path, i + 1];
1039
1039
  const node = nodes[i];
1040
1040
  if (node?.[rowKey] === targetItem?.[rowKey]) {
1041
1041
  result = currentPath.join('.');
@@ -1714,7 +1714,7 @@ const onAddBorderSelectedCell = (selectedCells, id) => {
1714
1714
  if (cell) {
1715
1715
  cell.style.zIndex = 1;
1716
1716
  }
1717
- if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
1717
+ if (cell && (cell.classList.contains('ui-rc-table-cell-fix-left') || cell.classList.contains('ui-rc-table-cell-fix-right'))) {
1718
1718
  cell.style.zIndex = 3;
1719
1719
  }
1720
1720