es-grid-template 1.4.1 → 1.4.3
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/es/grid-component/EditableCell.js +46 -15
- package/es/grid-component/InternalTable.d.ts +1 -0
- package/es/grid-component/InternalTable.js +467 -111
- package/es/grid-component/TableGrid.js +2 -7
- package/es/grid-component/hooks/columns/index.d.ts +1 -1
- package/es/grid-component/hooks/columns/index.js +3 -13
- package/es/grid-component/hooks/useColumns.js +2 -0
- package/es/grid-component/hooks/utils.d.ts +1 -1
- package/es/grid-component/hooks/utils.js +3 -3
- package/es/grid-component/styles.scss +1186 -1170
- package/es/grid-component/table/Grid.d.ts +1 -0
- package/es/grid-component/table/GridEdit.d.ts +1 -0
- package/es/grid-component/table/GridEdit.js +156 -121
- package/es/grid-component/table/Group.d.ts +1 -0
- package/es/grid-component/type.d.ts +7 -2
- package/es/grid-component/useContext.d.ts +1 -0
- package/lib/grid-component/EditableCell.js +46 -15
- package/lib/grid-component/InternalTable.d.ts +1 -0
- package/lib/grid-component/InternalTable.js +467 -100
- package/lib/grid-component/TableGrid.js +2 -7
- package/lib/grid-component/hooks/columns/index.d.ts +1 -1
- package/lib/grid-component/hooks/columns/index.js +5 -15
- package/lib/grid-component/hooks/useColumns.js +2 -0
- package/lib/grid-component/hooks/utils.d.ts +1 -1
- package/lib/grid-component/hooks/utils.js +3 -3
- package/lib/grid-component/styles.scss +1186 -1170
- package/lib/grid-component/table/Grid.d.ts +1 -0
- package/lib/grid-component/table/GridEdit.d.ts +1 -0
- package/lib/grid-component/table/GridEdit.js +156 -121
- package/lib/grid-component/table/Group.d.ts +1 -0
- package/lib/grid-component/type.d.ts +7 -2
- package/lib/grid-component/useContext.d.ts +1 -0
- package/package.json +110 -109
|
@@ -355,9 +355,7 @@ const TableGrid = props => {
|
|
|
355
355
|
}), /*#__PURE__*/React.createElement(Table, _extends({
|
|
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.createElement(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 ? filterDataByColumns4(dataSource, filterStates) : []
|
|
375
|
-
// dataSource={columns && columns.length > 0 && loading !== true ? dataSource : []}
|
|
376
|
-
// className={styles.customTable}
|
|
377
|
-
,
|
|
372
|
+
dataSource: columns && columns.length > 0 ? filterDataByColumns4(dataSource, filterStates) : [],
|
|
378
373
|
className: classNames(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
|
|
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;
|
|
@@ -38,16 +38,8 @@ export function flatColumns(columns, parentKey = 'key') {
|
|
|
38
38
|
}];
|
|
39
39
|
}, []);
|
|
40
40
|
}
|
|
41
|
-
export
|
|
42
|
-
// parentKey = 'key'
|
|
43
|
-
) {
|
|
44
|
-
// @ts-ignore
|
|
41
|
+
export const flatColumns2 = columns => {
|
|
45
42
|
return columns.reduce((list, column) => {
|
|
46
|
-
// const { fixed } = column
|
|
47
|
-
// Convert `fixed='true'` to `fixed='left'` instead
|
|
48
|
-
// const parsedFixed = fixed === true ? 'left' : fixed
|
|
49
|
-
// const mergedKey = `${parentKey}-${index}`
|
|
50
|
-
|
|
51
43
|
const subColumns = column.children;
|
|
52
44
|
if (column === SELECTION_COLUMN) {
|
|
53
45
|
return [...list, {
|
|
@@ -55,18 +47,16 @@ export function flatColumns2(columns
|
|
|
55
47
|
}];
|
|
56
48
|
}
|
|
57
49
|
if (subColumns && subColumns.length > 0) {
|
|
58
|
-
return [...list, ...
|
|
50
|
+
return [...list, ...flatColumns2(subColumns).map(subColum => ({
|
|
59
51
|
// fixed: parsedFixed,
|
|
60
52
|
...subColum
|
|
61
53
|
}))];
|
|
62
54
|
}
|
|
63
55
|
return [...list, {
|
|
64
|
-
// key: mergedKey,
|
|
65
56
|
...column
|
|
66
|
-
// fixed: parsedFixed
|
|
67
57
|
}];
|
|
68
58
|
}, []);
|
|
69
|
-
}
|
|
59
|
+
};
|
|
70
60
|
export const getValueCell = (column, value, format) => {
|
|
71
61
|
switch (column?.type) {
|
|
72
62
|
case 'number':
|
|
@@ -262,12 +262,14 @@ const useColumns = config => {
|
|
|
262
262
|
})));
|
|
263
263
|
},
|
|
264
264
|
onHeaderCell: () => ({
|
|
265
|
+
id: `${col.field}`,
|
|
265
266
|
width: col.width,
|
|
266
267
|
onResize: handleResize?.(col),
|
|
267
268
|
className: col.headerTextAlign === 'center' ? 'head-align-center' : col.headerTextAlign === 'right' ? 'head-align-right' : ''
|
|
268
269
|
}),
|
|
269
270
|
onCell: (data, index) => {
|
|
270
271
|
return {
|
|
272
|
+
id: `${col.field}`,
|
|
271
273
|
colSpan: groupColumns && data.children && col.field === firstNonGroupColumn?.field ? 2 : groupColumns && data.children && nonGroupColumns[1].field === col.field ? 0 : 1,
|
|
272
274
|
zIndex: data.children && col.field === firstNonGroupColumn?.field ? 11 : undefined,
|
|
273
275
|
...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[];
|
|
@@ -949,11 +949,11 @@ export const isArraysEqual = (arr1, arr2) => {
|
|
|
949
949
|
export const editAbleColumns = columns => {
|
|
950
950
|
return columns.filter(col => col.field !== '#' && col.field !== 'index' && col.field !== 'command' && col.visible !== false);
|
|
951
951
|
};
|
|
952
|
-
export const findItemPath = (tree, targetItem, rowKey) => {
|
|
952
|
+
export const findItemPath = (tree, targetItem, rowKey, currentPage, pageSize) => {
|
|
953
953
|
let result = null;
|
|
954
954
|
function dfs(nodes, path = []) {
|
|
955
955
|
for (let i = 0; i < nodes.length; i++) {
|
|
956
|
-
const currentPath = [...path, i + 1];
|
|
956
|
+
const currentPath = currentPage && pageSize ? [...path, i + 1 + (currentPage - 1) * pageSize] : [...path, i + 1];
|
|
957
957
|
const node = nodes[i];
|
|
958
958
|
if (node?.[rowKey] === targetItem?.[rowKey]) {
|
|
959
959
|
result = currentPath.join('.');
|
|
@@ -1614,7 +1614,7 @@ export const onAddBorderSelectedCell = (selectedCells, id) => {
|
|
|
1614
1614
|
if (cell) {
|
|
1615
1615
|
cell.style.zIndex = 1;
|
|
1616
1616
|
}
|
|
1617
|
-
if (cell && cell.classList.contains('ui-rc-table-cell-fix-left')) {
|
|
1617
|
+
if (cell && (cell.classList.contains('ui-rc-table-cell-fix-left') || cell.classList.contains('ui-rc-table-cell-fix-right'))) {
|
|
1618
1618
|
cell.style.zIndex = 3;
|
|
1619
1619
|
}
|
|
1620
1620
|
|