es-grid-template 1.8.99 → 1.9.0
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/group-component/hook/utils.d.ts +8 -8
- package/es/group-component/hook/utils.js +1 -1
- package/es/group-component/table/Grid.js +4 -0
- package/es/table-component/table/Grid.js +2 -1
- package/es/table-virtuoso/InternalTable.js +4 -0
- package/es/table-virtuoso/body/TableBodyRow.js +7 -3
- package/lib/group-component/hook/utils.js +1 -1
- package/lib/group-component/table/Grid.js +4 -0
- package/lib/table-component/table/Grid.js +2 -1
- package/lib/table-virtuoso/InternalTable.js +4 -0
- package/lib/table-virtuoso/body/TableBodyRow.js +7 -3
- package/package.json +1 -1
|
@@ -162,7 +162,7 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
162
162
|
type?: IColumnType;
|
|
163
163
|
haveSum?: boolean;
|
|
164
164
|
isSummary?: boolean;
|
|
165
|
-
summaryTemplate?: (data: number, key: string) => import("react").
|
|
165
|
+
summaryTemplate?: (data: number, key: string) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode;
|
|
166
166
|
format?: IFormat | ((rowData: any) => IFormat);
|
|
167
167
|
allowFiltering?: boolean;
|
|
168
168
|
sorter?: boolean;
|
|
@@ -177,18 +177,18 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
177
177
|
headerText?: string;
|
|
178
178
|
hidden?: boolean;
|
|
179
179
|
visible?: boolean;
|
|
180
|
-
headerTooltip?: string | boolean | (() => import("react").
|
|
180
|
+
headerTooltip?: string | boolean | (() => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
181
181
|
columnGroupText?: string;
|
|
182
182
|
align?: import("./../../grid-component/type").ITextAlign;
|
|
183
183
|
textAlign?: import("./../../grid-component/type").ITextAlign;
|
|
184
184
|
headerTextAlign?: import("./../../grid-component/type").ITextAlign;
|
|
185
|
-
template?: import("react").
|
|
185
|
+
template?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode | ((args: import("./../../grid-component/type").ColumnTemplate<RecordType>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
186
186
|
showTooltip?: boolean;
|
|
187
187
|
tooltipDescription?: string | ((args: {
|
|
188
188
|
value: any;
|
|
189
189
|
rowData: RecordType;
|
|
190
|
-
}) => import("react").
|
|
191
|
-
headerTemplate?: import("react").
|
|
190
|
+
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
191
|
+
headerTemplate?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode | ((column: ColumnTable<RecordType>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
192
192
|
commandItems?: import("./../../grid-component/type").CommandItem[];
|
|
193
193
|
children?: ColumnTable<RecordType>[];
|
|
194
194
|
editType?: EditType | ((rowData?: RecordType) => EditType);
|
|
@@ -208,9 +208,9 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
208
208
|
ellipsis?: boolean;
|
|
209
209
|
allowResizing?: boolean;
|
|
210
210
|
allowSelection?: boolean | ((rowData: RecordType) => boolean);
|
|
211
|
-
onCellStyles?: Omit<CSSProperties, "
|
|
212
|
-
onCellHeaderStyles?: Omit<CSSProperties, "
|
|
213
|
-
onCellFooterStyles?: Omit<CSSProperties, "
|
|
211
|
+
onCellStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
|
|
212
|
+
onCellHeaderStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
|
|
213
|
+
onCellFooterStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
|
|
214
214
|
sumGroup?: boolean;
|
|
215
215
|
getValue?: (row: any, rowIndex: number) => any;
|
|
216
216
|
getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
|
|
@@ -126,6 +126,10 @@ const Grid = props => {
|
|
|
126
126
|
}
|
|
127
127
|
return true;
|
|
128
128
|
},
|
|
129
|
+
getRowCanExpand: row => {
|
|
130
|
+
// return Array.isArray(row.original.children) && row.original.children.length > 0
|
|
131
|
+
return Array.isArray(row.original.children);
|
|
132
|
+
},
|
|
129
133
|
initialState: {
|
|
130
134
|
rowSelection: {}
|
|
131
135
|
},
|
|
@@ -157,7 +157,8 @@ const Grid = props => {
|
|
|
157
157
|
getGroupedRowModel: getGroupedRowModel(),
|
|
158
158
|
// onExpandedChange: setExpanded,
|
|
159
159
|
getRowCanExpand: row => {
|
|
160
|
-
return Array.isArray(row.original.children) && row.original.children.length > 0
|
|
160
|
+
// return Array.isArray(row.original.children) && row.original.children.length > 0
|
|
161
|
+
return Array.isArray(row.original.children);
|
|
161
162
|
},
|
|
162
163
|
getExpandedRowModel: getExpandedRowModel(),
|
|
163
164
|
getPaginationRowModel: pagination && !infiniteScroll ? getPaginationRowModel() : undefined,
|
|
@@ -237,6 +237,10 @@ const InternalTable = props => {
|
|
|
237
237
|
enableColumnResizing: allowResizing !== false,
|
|
238
238
|
columnResizeMode,
|
|
239
239
|
columnResizeDirection,
|
|
240
|
+
getRowCanExpand: row => {
|
|
241
|
+
// return Array.isArray(row.original.children) && row.original.children.length > 0
|
|
242
|
+
return Array.isArray(row.original.children);
|
|
243
|
+
},
|
|
240
244
|
onColumnSizingChange: setColumnSizing,
|
|
241
245
|
onColumnSizingInfoChange: setColumnSizingInfo,
|
|
242
246
|
// ColumnSizing
|
|
@@ -45,7 +45,7 @@ const TableBodyRow = ({
|
|
|
45
45
|
className: classNames(`${prefix}-grid-row ${rowClass ?? ''}`, {
|
|
46
46
|
[`${prefix}-grid-row-selected`]: row.getIsSelected(),
|
|
47
47
|
[`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId,
|
|
48
|
-
[`${prefix}-grid-row-parent`]: row.
|
|
48
|
+
[`${prefix}-grid-row-parent`]: row.getCanExpand()
|
|
49
49
|
}),
|
|
50
50
|
style: {
|
|
51
51
|
...rowStyles,
|
|
@@ -85,7 +85,9 @@ const TableBodyRow = ({
|
|
|
85
85
|
|
|
86
86
|
// const colSpan = row.subRows && cell.column.id === firstNonGroupColumn?.id ? (groupSetting?.groupColumnSpan ?? 2)
|
|
87
87
|
const colSpanGroup = row.subRows && row.subRows.length > 0 && cell.column.id === firstNonGroupColumn?.column.id ? 2 : row.subRows && nonGroupColumns[1].column.id === cell.column.id ? 0 : 1;
|
|
88
|
-
|
|
88
|
+
|
|
89
|
+
// if (row.subRows && row.subRows.length > 0 && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
|
|
90
|
+
if (row.subRows && row.getCanExpand() && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
|
|
89
91
|
return null;
|
|
90
92
|
}
|
|
91
93
|
|
|
@@ -128,7 +130,9 @@ const TableBodyRow = ({
|
|
|
128
130
|
groupValue: groupValue
|
|
129
131
|
}));
|
|
130
132
|
}
|
|
131
|
-
|
|
133
|
+
|
|
134
|
+
// if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
|
|
135
|
+
if (row.getCanExpand() && originCol.sumGroup === true && originCol.type === 'number') {
|
|
132
136
|
const colFormat = typeof originCol.format === 'function' ? originCol.format({}) : originCol.format;
|
|
133
137
|
const cellFormat = getFormat(colFormat, format);
|
|
134
138
|
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
@@ -132,6 +132,10 @@ const Grid = props => {
|
|
|
132
132
|
}
|
|
133
133
|
return true;
|
|
134
134
|
},
|
|
135
|
+
getRowCanExpand: row => {
|
|
136
|
+
// return Array.isArray(row.original.children) && row.original.children.length > 0
|
|
137
|
+
return Array.isArray(row.original.children);
|
|
138
|
+
},
|
|
135
139
|
initialState: {
|
|
136
140
|
rowSelection: {}
|
|
137
141
|
},
|
|
@@ -162,7 +162,8 @@ const Grid = props => {
|
|
|
162
162
|
getGroupedRowModel: (0, _reactTable.getGroupedRowModel)(),
|
|
163
163
|
// onExpandedChange: setExpanded,
|
|
164
164
|
getRowCanExpand: row => {
|
|
165
|
-
return Array.isArray(row.original.children) && row.original.children.length > 0
|
|
165
|
+
// return Array.isArray(row.original.children) && row.original.children.length > 0
|
|
166
|
+
return Array.isArray(row.original.children);
|
|
166
167
|
},
|
|
167
168
|
getExpandedRowModel: (0, _reactTable.getExpandedRowModel)(),
|
|
168
169
|
getPaginationRowModel: pagination && !infiniteScroll ? (0, _reactTable.getPaginationRowModel)() : undefined,
|
|
@@ -247,6 +247,10 @@ const InternalTable = props => {
|
|
|
247
247
|
enableColumnResizing: allowResizing !== false,
|
|
248
248
|
columnResizeMode,
|
|
249
249
|
columnResizeDirection,
|
|
250
|
+
getRowCanExpand: row => {
|
|
251
|
+
// return Array.isArray(row.original.children) && row.original.children.length > 0
|
|
252
|
+
return Array.isArray(row.original.children);
|
|
253
|
+
},
|
|
250
254
|
onColumnSizingChange: setColumnSizing,
|
|
251
255
|
onColumnSizingInfoChange: setColumnSizingInfo,
|
|
252
256
|
// ColumnSizing
|
|
@@ -52,7 +52,7 @@ const TableBodyRow = ({
|
|
|
52
52
|
className: (0, _classnames.default)(`${prefix}-grid-row ${rowClass ?? ''}`, {
|
|
53
53
|
[`${prefix}-grid-row-selected`]: row.getIsSelected(),
|
|
54
54
|
[`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId,
|
|
55
|
-
[`${prefix}-grid-row-parent`]: row.
|
|
55
|
+
[`${prefix}-grid-row-parent`]: row.getCanExpand()
|
|
56
56
|
}),
|
|
57
57
|
style: {
|
|
58
58
|
...rowStyles,
|
|
@@ -92,7 +92,9 @@ const TableBodyRow = ({
|
|
|
92
92
|
|
|
93
93
|
// const colSpan = row.subRows && cell.column.id === firstNonGroupColumn?.id ? (groupSetting?.groupColumnSpan ?? 2)
|
|
94
94
|
const colSpanGroup = row.subRows && row.subRows.length > 0 && cell.column.id === firstNonGroupColumn?.column.id ? 2 : row.subRows && nonGroupColumns[1].column.id === cell.column.id ? 0 : 1;
|
|
95
|
-
|
|
95
|
+
|
|
96
|
+
// if (row.subRows && row.subRows.length > 0 && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
|
|
97
|
+
if (row.subRows && row.getCanExpand() && colSpanGroup === 0 || onCellRowSpan === 0 || onCellColSpan === 0) {
|
|
96
98
|
return null;
|
|
97
99
|
}
|
|
98
100
|
|
|
@@ -135,7 +137,9 @@ const TableBodyRow = ({
|
|
|
135
137
|
groupValue: groupValue
|
|
136
138
|
}));
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
|
|
141
|
+
// if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
|
|
142
|
+
if (row.getCanExpand() && originCol.sumGroup === true && originCol.type === 'number') {
|
|
139
143
|
const colFormat = typeof originCol.format === 'function' ? originCol.format({}) : originCol.format;
|
|
140
144
|
const cellFormat = (0, _utils.getFormat)(colFormat, format);
|
|
141
145
|
const thousandSeparator = cellFormat?.thousandSeparator;
|