es-grid-template 1.8.36 → 1.8.37
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/table-component/TableContainer.js +2 -1
- package/es/table-component/body/TableBodyCell.js +22 -10
- package/es/table-component/hook/utils.d.ts +1 -1
- package/es/table-component/hook/utils.js +49 -18
- package/lib/table-component/TableContainer.js +2 -1
- package/lib/table-component/body/TableBodyCell.js +22 -10
- package/lib/table-component/hook/utils.d.ts +1 -1
- package/lib/table-component/hook/utils.js +49 -18
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ const renderCellIndex = props => {
|
|
|
23
23
|
}
|
|
24
24
|
return /*#__PURE__*/React.createElement("span", {
|
|
25
25
|
className: "ui-rc_cell-content"
|
|
26
|
-
}, cell.row.index + (pagination ? (pagination.currentPage ?? 1 - 1) * (pagination?.pageSize ?? 0) : 0) + 1);
|
|
26
|
+
}, cell.row.index + (pagination ? ((pagination.currentPage ?? 1) - 1) * (pagination?.pageSize ?? 0) : 0) + 1);
|
|
27
27
|
};
|
|
28
28
|
const renderCommand = args => {
|
|
29
29
|
const {
|
|
@@ -81,7 +81,7 @@ const renderSelection = args => {
|
|
|
81
81
|
isSelectionChange
|
|
82
82
|
} = args;
|
|
83
83
|
const checked = selectionSettings?.checkStrictly ? row.getIsSelected() : row.getIsSelected() || row.getIsAllSubRowsSelected();
|
|
84
|
-
const indeterminate = selectionSettings?.type
|
|
84
|
+
const indeterminate = selectionSettings?.type === 'single' || selectionSettings?.checkStrictly ? false : row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === 'checkbox' || row.getIsSomeSelected();
|
|
85
85
|
return /*#__PURE__*/React.createElement("div", {
|
|
86
86
|
style: {}
|
|
87
87
|
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/React.createElement("div", {
|
|
@@ -209,7 +209,17 @@ const TableBodyCell = props => {
|
|
|
209
209
|
// maxWidth: cell.column.getSize(),
|
|
210
210
|
...getCommonPinningStyles(cell.column)
|
|
211
211
|
},
|
|
212
|
-
|
|
212
|
+
onClick: e => {
|
|
213
|
+
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
214
|
+
toggleRowSelection({
|
|
215
|
+
e,
|
|
216
|
+
cell,
|
|
217
|
+
setIsSelectionChange,
|
|
218
|
+
isSelectionChange,
|
|
219
|
+
selectionSettings
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
213
223
|
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/React.createElement("div", {
|
|
214
224
|
className: "ui-rc-table-row-expand-trigger",
|
|
215
225
|
style: {
|
|
@@ -457,13 +467,15 @@ const TableBodyCell = props => {
|
|
|
457
467
|
,
|
|
458
468
|
|
|
459
469
|
onClick: e => {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
470
|
+
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
471
|
+
toggleRowSelection({
|
|
472
|
+
e,
|
|
473
|
+
cell,
|
|
474
|
+
setIsSelectionChange,
|
|
475
|
+
isSelectionChange,
|
|
476
|
+
selectionSettings
|
|
477
|
+
});
|
|
478
|
+
}
|
|
467
479
|
}
|
|
468
480
|
}, /*#__PURE__*/React.createElement("div", {
|
|
469
481
|
className: classNames('ui-rc_cell-content', {})
|
|
@@ -137,7 +137,7 @@ export declare const convertToObjTrue: (arr: any) => {
|
|
|
137
137
|
};
|
|
138
138
|
export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
|
|
139
139
|
export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
|
|
140
|
-
export declare function isTreeArray(arr: any[]
|
|
140
|
+
export declare function isTreeArray(arr: any[]): boolean;
|
|
141
141
|
export declare function updateColumnWidthsRecursive(columns: any[], sizing: Record<string, number>): any[];
|
|
142
142
|
export declare function updateWidthsByOther(source: any[], target: any[]): any[];
|
|
143
143
|
export declare function findAllChildrenKeys2<RecordType>(data: readonly RecordType[], rowKey: any, childrenColumnName: string): Key[];
|
|
@@ -1942,32 +1942,63 @@ export function findFirst(items) {
|
|
|
1942
1942
|
if (leftItem) return leftItem;
|
|
1943
1943
|
return null;
|
|
1944
1944
|
}
|
|
1945
|
-
|
|
1945
|
+
|
|
1946
|
+
// export function isTreeArray(arr: any[]): boolean {
|
|
1947
|
+
// if (!Array.isArray(arr) || arr.length === 0) {
|
|
1948
|
+
|
|
1949
|
+
// return false
|
|
1950
|
+
// }
|
|
1951
|
+
|
|
1952
|
+
// // const requireNonEmpty = options?.requireNonEmptyChildren ?? false
|
|
1953
|
+
// let hasParent = false
|
|
1954
|
+
|
|
1955
|
+
// for (const item of arr) {
|
|
1956
|
+
// if (typeof item !== 'object' || item === null) {
|
|
1957
|
+
|
|
1958
|
+
// return false
|
|
1959
|
+
// }
|
|
1960
|
+
|
|
1961
|
+
// if ('children' in item) {
|
|
1962
|
+
// const children = (item as any).children
|
|
1963
|
+
// if (!Array.isArray(children)) {
|
|
1964
|
+
// // return false;
|
|
1965
|
+
// hasParent = false
|
|
1966
|
+
// }
|
|
1967
|
+
|
|
1968
|
+
// if (children && children.length > 0) {
|
|
1969
|
+
// hasParent = true
|
|
1970
|
+
// }
|
|
1971
|
+
|
|
1972
|
+
// // if (requireNonEmpty) {
|
|
1973
|
+
|
|
1974
|
+
// // console.log('requireNonEmpty', requireNonEmpty)
|
|
1975
|
+
// // if (children.length > 0) {
|
|
1976
|
+
// // hasParent = true
|
|
1977
|
+
// // }
|
|
1978
|
+
// // } else {
|
|
1979
|
+
|
|
1980
|
+
// // hasParent = true
|
|
1981
|
+
|
|
1982
|
+
// // }
|
|
1983
|
+
// }
|
|
1984
|
+
// }
|
|
1985
|
+
|
|
1986
|
+
// return hasParent
|
|
1987
|
+
// }
|
|
1988
|
+
|
|
1989
|
+
export function isTreeArray(arr) {
|
|
1946
1990
|
if (!Array.isArray(arr) || arr.length === 0) {
|
|
1947
1991
|
return false;
|
|
1948
1992
|
}
|
|
1949
|
-
const requireNonEmpty = options?.requireNonEmptyChildren ?? false;
|
|
1950
|
-
let hasParent = false;
|
|
1951
1993
|
for (const item of arr) {
|
|
1952
|
-
if (
|
|
1994
|
+
if (!item) {
|
|
1953
1995
|
return false;
|
|
1954
1996
|
}
|
|
1955
|
-
if (
|
|
1956
|
-
|
|
1957
|
-
if (!Array.isArray(children)) {
|
|
1958
|
-
// return false;
|
|
1959
|
-
hasParent = false;
|
|
1960
|
-
}
|
|
1961
|
-
if (requireNonEmpty) {
|
|
1962
|
-
if (children.length > 0) {
|
|
1963
|
-
hasParent = true;
|
|
1964
|
-
}
|
|
1965
|
-
} else {
|
|
1966
|
-
hasParent = true;
|
|
1967
|
-
}
|
|
1997
|
+
if (item.children?.length > 0) {
|
|
1998
|
+
return true;
|
|
1968
1999
|
}
|
|
1969
2000
|
}
|
|
1970
|
-
return
|
|
2001
|
+
return false;
|
|
1971
2002
|
}
|
|
1972
2003
|
export function updateColumnWidthsRecursive(columns, sizing) {
|
|
1973
2004
|
return columns.map(col => {
|
|
@@ -30,7 +30,7 @@ const renderCellIndex = props => {
|
|
|
30
30
|
}
|
|
31
31
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
32
32
|
className: "ui-rc_cell-content"
|
|
33
|
-
}, cell.row.index + (pagination ? (pagination.currentPage ?? 1 - 1) * (pagination?.pageSize ?? 0) : 0) + 1);
|
|
33
|
+
}, cell.row.index + (pagination ? ((pagination.currentPage ?? 1) - 1) * (pagination?.pageSize ?? 0) : 0) + 1);
|
|
34
34
|
};
|
|
35
35
|
const renderCommand = args => {
|
|
36
36
|
const {
|
|
@@ -88,7 +88,7 @@ const renderSelection = args => {
|
|
|
88
88
|
isSelectionChange
|
|
89
89
|
} = args;
|
|
90
90
|
const checked = selectionSettings?.checkStrictly ? row.getIsSelected() : row.getIsSelected() || row.getIsAllSubRowsSelected();
|
|
91
|
-
const indeterminate = selectionSettings?.type
|
|
91
|
+
const indeterminate = selectionSettings?.type === 'single' || selectionSettings?.checkStrictly ? false : row.getIsSomeSelected() && selectionSettings && selectionSettings.mode === 'checkbox' || row.getIsSomeSelected();
|
|
92
92
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
93
93
|
style: {}
|
|
94
94
|
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -216,7 +216,17 @@ const TableBodyCell = props => {
|
|
|
216
216
|
// maxWidth: cell.column.getSize(),
|
|
217
217
|
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
218
218
|
},
|
|
219
|
-
|
|
219
|
+
onClick: e => {
|
|
220
|
+
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
221
|
+
(0, _useColumns.toggleRowSelection)({
|
|
222
|
+
e,
|
|
223
|
+
cell,
|
|
224
|
+
setIsSelectionChange,
|
|
225
|
+
isSelectionChange,
|
|
226
|
+
selectionSettings
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
220
230
|
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/_react.default.createElement("div", {
|
|
221
231
|
className: "ui-rc-table-row-expand-trigger",
|
|
222
232
|
style: {
|
|
@@ -464,13 +474,15 @@ const TableBodyCell = props => {
|
|
|
464
474
|
,
|
|
465
475
|
|
|
466
476
|
onClick: e => {
|
|
467
|
-
(
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
477
|
+
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
478
|
+
(0, _useColumns.toggleRowSelection)({
|
|
479
|
+
e,
|
|
480
|
+
cell,
|
|
481
|
+
setIsSelectionChange,
|
|
482
|
+
isSelectionChange,
|
|
483
|
+
selectionSettings
|
|
484
|
+
});
|
|
485
|
+
}
|
|
474
486
|
}
|
|
475
487
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
476
488
|
className: (0, _classnames.default)('ui-rc_cell-content', {})
|
|
@@ -137,7 +137,7 @@ export declare const convertToObjTrue: (arr: any) => {
|
|
|
137
137
|
};
|
|
138
138
|
export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
|
|
139
139
|
export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
|
|
140
|
-
export declare function isTreeArray(arr: any[]
|
|
140
|
+
export declare function isTreeArray(arr: any[]): boolean;
|
|
141
141
|
export declare function updateColumnWidthsRecursive(columns: any[], sizing: Record<string, number>): any[];
|
|
142
142
|
export declare function updateWidthsByOther(source: any[], target: any[]): any[];
|
|
143
143
|
export declare function findAllChildrenKeys2<RecordType>(data: readonly RecordType[], rowKey: any, childrenColumnName: string): Key[];
|
|
@@ -2064,32 +2064,63 @@ function findFirst(items) {
|
|
|
2064
2064
|
if (leftItem) return leftItem;
|
|
2065
2065
|
return null;
|
|
2066
2066
|
}
|
|
2067
|
-
|
|
2067
|
+
|
|
2068
|
+
// export function isTreeArray(arr: any[]): boolean {
|
|
2069
|
+
// if (!Array.isArray(arr) || arr.length === 0) {
|
|
2070
|
+
|
|
2071
|
+
// return false
|
|
2072
|
+
// }
|
|
2073
|
+
|
|
2074
|
+
// // const requireNonEmpty = options?.requireNonEmptyChildren ?? false
|
|
2075
|
+
// let hasParent = false
|
|
2076
|
+
|
|
2077
|
+
// for (const item of arr) {
|
|
2078
|
+
// if (typeof item !== 'object' || item === null) {
|
|
2079
|
+
|
|
2080
|
+
// return false
|
|
2081
|
+
// }
|
|
2082
|
+
|
|
2083
|
+
// if ('children' in item) {
|
|
2084
|
+
// const children = (item as any).children
|
|
2085
|
+
// if (!Array.isArray(children)) {
|
|
2086
|
+
// // return false;
|
|
2087
|
+
// hasParent = false
|
|
2088
|
+
// }
|
|
2089
|
+
|
|
2090
|
+
// if (children && children.length > 0) {
|
|
2091
|
+
// hasParent = true
|
|
2092
|
+
// }
|
|
2093
|
+
|
|
2094
|
+
// // if (requireNonEmpty) {
|
|
2095
|
+
|
|
2096
|
+
// // console.log('requireNonEmpty', requireNonEmpty)
|
|
2097
|
+
// // if (children.length > 0) {
|
|
2098
|
+
// // hasParent = true
|
|
2099
|
+
// // }
|
|
2100
|
+
// // } else {
|
|
2101
|
+
|
|
2102
|
+
// // hasParent = true
|
|
2103
|
+
|
|
2104
|
+
// // }
|
|
2105
|
+
// }
|
|
2106
|
+
// }
|
|
2107
|
+
|
|
2108
|
+
// return hasParent
|
|
2109
|
+
// }
|
|
2110
|
+
|
|
2111
|
+
function isTreeArray(arr) {
|
|
2068
2112
|
if (!Array.isArray(arr) || arr.length === 0) {
|
|
2069
2113
|
return false;
|
|
2070
2114
|
}
|
|
2071
|
-
const requireNonEmpty = options?.requireNonEmptyChildren ?? false;
|
|
2072
|
-
let hasParent = false;
|
|
2073
2115
|
for (const item of arr) {
|
|
2074
|
-
if (
|
|
2116
|
+
if (!item) {
|
|
2075
2117
|
return false;
|
|
2076
2118
|
}
|
|
2077
|
-
if (
|
|
2078
|
-
|
|
2079
|
-
if (!Array.isArray(children)) {
|
|
2080
|
-
// return false;
|
|
2081
|
-
hasParent = false;
|
|
2082
|
-
}
|
|
2083
|
-
if (requireNonEmpty) {
|
|
2084
|
-
if (children.length > 0) {
|
|
2085
|
-
hasParent = true;
|
|
2086
|
-
}
|
|
2087
|
-
} else {
|
|
2088
|
-
hasParent = true;
|
|
2089
|
-
}
|
|
2119
|
+
if (item.children?.length > 0) {
|
|
2120
|
+
return true;
|
|
2090
2121
|
}
|
|
2091
2122
|
}
|
|
2092
|
-
return
|
|
2123
|
+
return false;
|
|
2093
2124
|
}
|
|
2094
2125
|
function updateColumnWidthsRecursive(columns, sizing) {
|
|
2095
2126
|
return columns.map(col => {
|