es-grid-template 1.9.47 → 1.9.49
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 +3 -3
- package/es/table-component/InternalTable.js +19 -3
- package/es/table-component/TableContainer.d.ts +1 -0
- package/es/table-component/TableContainer.js +6 -4
- package/es/table-component/TableContainerEdit.js +2 -2
- package/es/table-component/body/EditableCell.js +2 -1
- package/es/table-component/body/TableBodyCell.js +1 -1
- package/es/table-component/hook/useColumns.d.ts +5 -2
- package/es/table-component/hook/useColumns.js +8 -5
- package/es/table-component/hook/utils.d.ts +1 -0
- package/es/table-component/hook/utils.js +5 -1
- package/es/table-component/style.js +1 -1
- package/es/table-component/style.scss +2 -87
- package/es/table-component/useContext.d.ts +1 -0
- package/lib/group-component/hook/utils.d.ts +3 -3
- package/lib/table-component/InternalTable.js +18 -2
- package/lib/table-component/TableContainer.d.ts +1 -0
- package/lib/table-component/TableContainer.js +6 -4
- package/lib/table-component/TableContainerEdit.js +2 -2
- package/lib/table-component/body/EditableCell.js +2 -1
- package/lib/table-component/body/TableBodyCell.js +1 -1
- package/lib/table-component/hook/useColumns.d.ts +5 -2
- package/lib/table-component/hook/useColumns.js +8 -5
- package/lib/table-component/hook/utils.d.ts +1 -0
- package/lib/table-component/hook/utils.js +7 -2
- package/lib/table-component/style.js +1 -1
- package/lib/table-component/style.scss +2 -87
- package/lib/table-component/useContext.d.ts +1 -0
- package/package.json +2 -2
|
@@ -194,10 +194,10 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
194
194
|
value: any;
|
|
195
195
|
rowData: RecordType;
|
|
196
196
|
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
197
|
-
onCellStyles?: Omit<CSSProperties, "position" | "
|
|
198
|
-
onCellHeaderStyles?: Omit<CSSProperties, "position" | "
|
|
197
|
+
onCellStyles?: Omit<CSSProperties, "position" | "display" | "left" | "minWidth" | "right" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "position" | "display" | "left" | "minWidth" | "right" | "width">);
|
|
198
|
+
onCellHeaderStyles?: Omit<CSSProperties, "position" | "display" | "left" | "minWidth" | "right" | "width"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "display" | "left" | "minWidth" | "right" | "width">);
|
|
199
199
|
onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
|
|
200
|
-
onCellFooterStyles?: Omit<CSSProperties, "position" | "
|
|
200
|
+
onCellFooterStyles?: Omit<CSSProperties, "position" | "display" | "left" | "minWidth" | "right" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "display" | "left" | "minWidth" | "right" | "width">);
|
|
201
201
|
getValue?: (row: any, rowIndex: number) => any;
|
|
202
202
|
getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
|
|
203
203
|
headerCellProps?: import("./../../grid-component/type").CellProps;
|
|
@@ -9,7 +9,7 @@ import "./style.scss";
|
|
|
9
9
|
import { faker } from '@faker-js/faker';
|
|
10
10
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
11
11
|
import Grid from "./table/Grid";
|
|
12
|
-
import { addRowIdArray, convertFlatColumn1, convertToObj, convertToObjTrue, filterDataByColumns, findAllChildrenKeys2, flatColumns2, getAllRowKey, getDiffent2Array, getFixedFields, getInvisibleColumns, groupArrayByColumns, isTreeArray, updateWidthsByOther } from "./hook/utils";
|
|
12
|
+
import { addRowIdArray, convertFlatColumn1, convertToObj, convertToObjTrue, filterDataByColumns, findAllChildrenKeys2, flatColumns2, getAllRowKey, getDiffent2Array, getFixedFields, getInvisibleColumns, getTreeDepth, groupArrayByColumns, isTreeArray, updateWidthsByOther } from "./hook/utils";
|
|
13
13
|
import { convertToTanStackColumns } from "./hook/useColumns";
|
|
14
14
|
import { convertColumns } from "./hook/convert";
|
|
15
15
|
import { removeInvisibleColumns } from "../grid-component/hooks";
|
|
@@ -95,16 +95,32 @@ const InternalTable = props => {
|
|
|
95
95
|
}
|
|
96
96
|
return addRowIdArray(dataSource);
|
|
97
97
|
}, [dataSource, groupAble, groupColumns, groupSetting]);
|
|
98
|
+
const depthData = React.useMemo(() => {
|
|
99
|
+
return getTreeDepth(convertData);
|
|
100
|
+
}, [convertData]);
|
|
101
|
+
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
102
|
+
const flatColumns = React.useMemo(() => {
|
|
103
|
+
return flatColumns2(propsColumns);
|
|
104
|
+
}, [propsColumns]);
|
|
105
|
+
const visibleColumns = React.useMemo(() => {
|
|
106
|
+
return flatColumns.filter(it => it.visible !== false);
|
|
107
|
+
}, [flatColumns]);
|
|
108
|
+
const expandColumn = React.useMemo(() => {
|
|
109
|
+
return visibleColumns[expandIconColumnIndex];
|
|
110
|
+
}, [expandIconColumnIndex, visibleColumns]);
|
|
98
111
|
const mergedColumns = React.useMemo(() => {
|
|
99
112
|
return convertToTanStackColumns({
|
|
100
113
|
t,
|
|
101
114
|
columns,
|
|
102
115
|
format,
|
|
103
|
-
editAble
|
|
116
|
+
editAble,
|
|
117
|
+
depthData,
|
|
118
|
+
expandable,
|
|
119
|
+
expandColumn
|
|
104
120
|
});
|
|
105
121
|
|
|
106
122
|
// return convertToTanStackColumns<RecordType>(columns)
|
|
107
|
-
}, [t, columns, format, editAble]);
|
|
123
|
+
}, [t, columns, format, editAble, expandable, depthData, expandColumn]);
|
|
108
124
|
const isDataTree = React.useMemo(() => {
|
|
109
125
|
return isTreeArray(dataSource);
|
|
110
126
|
}, [dataSource]);
|
|
@@ -43,6 +43,7 @@ type TableContainerProps<T> = Omit<TableProps<T>, 'columns'> & {
|
|
|
43
43
|
setIsExpandClick: Dispatch<SetStateAction<boolean>>;
|
|
44
44
|
columnSizingInfo: ColumnSizingInfoState;
|
|
45
45
|
columnSizing: ColumnSizingState;
|
|
46
|
+
maxDepth?: number;
|
|
46
47
|
};
|
|
47
48
|
declare const TableContainer: <RecordType extends object>(props: TableContainerProps<RecordType>) => JSX.Element;
|
|
48
49
|
export default TableContainer;
|
|
@@ -78,6 +78,7 @@ const TableContainer = props => {
|
|
|
78
78
|
setIsExpandClick,
|
|
79
79
|
recordClick,
|
|
80
80
|
striped = true,
|
|
81
|
+
maxDepth,
|
|
81
82
|
...rest
|
|
82
83
|
} = props;
|
|
83
84
|
const [paginationLocal] = useLocale('Pagination');
|
|
@@ -239,12 +240,12 @@ const TableContainer = props => {
|
|
|
239
240
|
alignItems: 'center',
|
|
240
241
|
gap: '1rem'
|
|
241
242
|
}
|
|
242
|
-
},
|
|
243
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
243
244
|
style: {
|
|
244
245
|
flex: 1,
|
|
245
246
|
overflow: 'hidden'
|
|
246
247
|
}
|
|
247
|
-
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
248
|
+
}, toolbarItemTop && toolbarItemTop?.length > 0 && /*#__PURE__*/React.createElement(Toolbar, {
|
|
248
249
|
items: toolbarItemTop ?? []
|
|
249
250
|
// mode={'scroll'}
|
|
250
251
|
,
|
|
@@ -339,7 +340,8 @@ const TableContainer = props => {
|
|
|
339
340
|
pagination,
|
|
340
341
|
dataSourceFilter,
|
|
341
342
|
onExpandClick,
|
|
342
|
-
setIsExpandClick
|
|
343
|
+
setIsExpandClick,
|
|
344
|
+
maxDepth
|
|
343
345
|
}
|
|
344
346
|
}, /*#__PURE__*/React.createElement(TableWrapper, _extends({}, rest, {
|
|
345
347
|
contextMenuItems: contextMenuItems,
|
|
@@ -367,7 +369,7 @@ const TableContainer = props => {
|
|
|
367
369
|
fixedRightColumns: fixedRightColumns
|
|
368
370
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
369
371
|
ref: bottomToolbarRef
|
|
370
|
-
}, toolbarItemBottom && toolbarItemBottom.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
372
|
+
}, toolbarItemBottom && toolbarItemBottom.length > 0 && false && /*#__PURE__*/React.createElement("div", {
|
|
371
373
|
style: {
|
|
372
374
|
flex: 1,
|
|
373
375
|
overflow: 'hidden'
|
|
@@ -2041,12 +2041,12 @@ const TableContainerEdit = props => {
|
|
|
2041
2041
|
alignItems: 'center',
|
|
2042
2042
|
gap: '1rem'
|
|
2043
2043
|
}
|
|
2044
|
-
},
|
|
2044
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
2045
2045
|
style: {
|
|
2046
2046
|
flex: 1,
|
|
2047
2047
|
overflow: 'hidden'
|
|
2048
2048
|
}
|
|
2049
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
2049
|
+
}, toolbarItemsTop && toolbarItemsTop.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
2050
2050
|
className: classNames('ui-rc-toolbar-bottom border-0', {
|
|
2051
2051
|
'ui-rc-toolbar-bottom_border-bottom': !pagination || infiniteScroll
|
|
2052
2052
|
})
|
|
@@ -356,13 +356,13 @@ const EditableCell = props => {
|
|
|
356
356
|
// const newVal = datetime.isValid() ? moment(datetime.toDate()).format() : ''
|
|
357
357
|
onChange(newVal);
|
|
358
358
|
}
|
|
359
|
-
onChange(dateString);
|
|
360
359
|
setTimeout(() => {
|
|
361
360
|
// @ts-ignore
|
|
362
361
|
dateTimePickerRef.current?.focus();
|
|
363
362
|
}, 0);
|
|
364
363
|
},
|
|
365
364
|
onBlur: () => {
|
|
365
|
+
console.log('22222222222');
|
|
366
366
|
const formState = getValues();
|
|
367
367
|
const itemState = getValues(dataIndex);
|
|
368
368
|
// @ts-ignore
|
|
@@ -377,6 +377,7 @@ const EditableCell = props => {
|
|
|
377
377
|
onChange(newVal);
|
|
378
378
|
newValue = newVal;
|
|
379
379
|
}
|
|
380
|
+
console.log('newValue', newValue);
|
|
380
381
|
if (prevState !== newState) {
|
|
381
382
|
handleCellChange?.({
|
|
382
383
|
key: key,
|
|
@@ -232,7 +232,7 @@ const TableBodyCell = props => {
|
|
|
232
232
|
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
233
233
|
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
234
234
|
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
235
|
-
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
235
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center' && cell.column.getIndex() !== expandIconColumnIndex,
|
|
236
236
|
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right'
|
|
237
237
|
}),
|
|
238
238
|
style: {
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { Dispatch, SetStateAction } from "react";
|
|
2
|
-
import type { ColumnsTable, ColumnTable, IFormat, SelectionSettings } from '../../grid-component/type';
|
|
2
|
+
import type { ColumnsTable, ColumnTable, ExpandableConfig, IFormat, SelectionSettings } from '../../grid-component/type';
|
|
3
3
|
import type { Cell, ColumnDef } from '@tanstack/react-table';
|
|
4
4
|
export declare const renderValueCell: <T>(column: ColumnTable<T>, value: any, record: T, rowIndex: number, colIndex: number, format?: IFormat, editAble?: boolean) => any;
|
|
5
5
|
export declare const getValueCellString: <T>(column: ColumnTable<T>, value: any, record: T, rowIndex: number, colIndex: number, format?: IFormat) => any;
|
|
6
|
-
export declare function convertToTanStackColumns<T>({ t, columns, format, editAble }: {
|
|
6
|
+
export declare function convertToTanStackColumns<T>({ t, columns, format, editAble, depthData, expandColumn }: {
|
|
7
7
|
t?: any;
|
|
8
8
|
columns: ColumnsTable<T>;
|
|
9
|
+
expandable?: ExpandableConfig<T>;
|
|
9
10
|
format?: IFormat;
|
|
10
11
|
editAble?: boolean;
|
|
12
|
+
depthData?: number;
|
|
13
|
+
expandColumn?: ColumnTable;
|
|
11
14
|
}): ColumnDef<T, any>[];
|
|
12
15
|
export type ToggleRow<T> = {
|
|
13
16
|
e: any;
|
|
@@ -141,10 +141,11 @@ export function convertToTanStackColumns({
|
|
|
141
141
|
// setExpanded,
|
|
142
142
|
// expandable,
|
|
143
143
|
format,
|
|
144
|
-
editAble
|
|
144
|
+
editAble,
|
|
145
|
+
depthData,
|
|
146
|
+
// expandable,
|
|
147
|
+
expandColumn
|
|
145
148
|
}) {
|
|
146
|
-
// const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0
|
|
147
|
-
|
|
148
149
|
return sortByType(columns).map(col => {
|
|
149
150
|
const {
|
|
150
151
|
headerText,
|
|
@@ -202,7 +203,7 @@ export function convertToTanStackColumns({
|
|
|
202
203
|
// enableHiding: false,
|
|
203
204
|
// enableResizing: true,
|
|
204
205
|
id: field,
|
|
205
|
-
size: width,
|
|
206
|
+
size: expandColumn?.field === col.field ? (width ?? 0) + (depthData ?? 0) * 25 : width,
|
|
206
207
|
accessorKey: field,
|
|
207
208
|
sortDescFirst: false,
|
|
208
209
|
minSize: minWidth,
|
|
@@ -219,7 +220,9 @@ export function convertToTanStackColumns({
|
|
|
219
220
|
columns: children,
|
|
220
221
|
editAble,
|
|
221
222
|
format,
|
|
222
|
-
t
|
|
223
|
+
t,
|
|
224
|
+
depthData,
|
|
225
|
+
expandColumn
|
|
223
226
|
});
|
|
224
227
|
}
|
|
225
228
|
const meta = {
|
|
@@ -166,3 +166,4 @@ export declare const updateColumnsByGroup: (columns: any[], columnsGroup: string
|
|
|
166
166
|
export declare const removeColumns: <RecordType>(columns: ColumnTable<RecordType>[], groupColumns: string[]) => ColumnsTable<RecordType>;
|
|
167
167
|
export declare function sumFields(columns: ColumnTable[], data: any[], childrenKey?: string): any;
|
|
168
168
|
export declare function sumNumberFields(columns: ColumnTable[], data: any[], childrenKey?: string): any;
|
|
169
|
+
export declare const getTreeDepth: (rows: any[]) => number;
|
|
@@ -2714,4 +2714,8 @@ export function sumNumberFields(columns, data, childrenKey = 'children') {
|
|
|
2714
2714
|
}
|
|
2715
2715
|
}
|
|
2716
2716
|
return result;
|
|
2717
|
-
}
|
|
2717
|
+
}
|
|
2718
|
+
export const getTreeDepth = rows => {
|
|
2719
|
+
if (!rows?.length) return 0;
|
|
2720
|
+
return 1 + Math.max(0, ...rows.map(r => getTreeDepth(r.children)));
|
|
2721
|
+
};
|
|
@@ -48,4 +48,4 @@ const colorDark = '#e6e4f3e6 ';
|
|
|
48
48
|
export const GridStyle = styled.div.withConfig({
|
|
49
49
|
displayName: "GridStyle",
|
|
50
50
|
componentId: "es-grid-template__sc-hdqm5k-0"
|
|
51
|
-
})(["&.", "-grid{color:", ";font-size:", ";background-color:", ";font-family:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:'';pointer-events:none;}.", "-grid-cell{padding:5px 8px;&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{justify-content:flex-end;text-align:right;}&.", "-grid-cell-ellipsis{.ui-rc_cell-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;&.select-cell{padding-right:18px;position:relative;}.caret-down{float:right;position:absolute;right:0;&::before{content:'';display:inline-block;margin-left:4px;vertical-align:middle;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #6f7777;}}}}&.", "-grid-cell-wrap{white-space:normal;text-overflow:ellipsis;word-break:break-word;}.", "-grid-header-text-wrap{white-space:normal;overflow:hidden;text-overflow:ellipsis;word-break:break-word;}}.", "-grid-thead{background-color:", ";font-weight:", ";.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{font-weight:", ";background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#f9f8fd;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, fontSize, BgColor, fontFamily, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, fwHeader, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, fwBody, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
51
|
+
})(["&.", "-grid{color:", ";font-size:", ";background-color:", ";font-family:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:'';pointer-events:none;}.", "-grid-cell{padding:5px 8px;&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{justify-content:flex-end;text-align:right;}&.", "-grid-cell-ellipsis{.ui-rc_cell-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;&.select-cell{padding-right:18px;position:relative;}.caret-down{float:right;position:absolute;right:0;&::before{content:'';display:inline-block;margin-left:4px;vertical-align:middle;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #6f7777;}}}}&.", "-grid-cell-wrap{white-space:normal;text-overflow:ellipsis;word-break:break-word;}.", "-grid-header-text-wrap{white-space:normal;overflow:hidden;text-overflow:ellipsis;word-break:break-word;}}.", "-grid-thead{background-color:", ";font-weight:", ";.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{font-weight:", ";background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#f9f8fd;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}.ui-rc-toolbar-bottom{border-right:1px solid #e0e0e0;border-left:1px solid #e0e0e0;.be-toolbar-item{.ui-rc-btn{font-size:12px;}.toolbar-dropdown-button{font-size:12px;.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item{border-color:#28c76f;}.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item{border-color:#28c76f;.ui-rc-btn-icon{color:#28c76f;}}}}}.ui-rc-toolbar-bottom_border-bottom{border-bottom:1px solid #e0e0e0;}.ui-rc-toolbar-bottom{position:relative;padding:.15rem 0.5rem;background-color:#ffffff;.toolbar-button{border-radius:3px;}.ui-rc-btn{border-radius:3px;height:28px;&.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item{border-start-start-radius:0;border-end-start-radius:0;}&.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item{border-start-end-radius:0;border-end-end-radius:0;}}}}"], props => props.$prefix, color, fontSize, BgColor, fontFamily, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, fwHeader, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, fwBody, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -627,91 +627,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
627
627
|
}
|
|
628
628
|
|
|
629
629
|
|
|
630
|
-
|
|
631
|
-
// bottom toolbar
|
|
632
|
-
.ui-rc-toolbar-bottom {
|
|
633
|
-
// border-bottom: 1px solid #e0e0e0;
|
|
634
|
-
border-right: 1px solid #e0e0e0;
|
|
635
|
-
border-left: 1px solid #e0e0e0;
|
|
636
|
-
|
|
637
|
-
.be-toolbar-item {
|
|
638
|
-
.ui-rc-btn {
|
|
639
|
-
font-size: 12px;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
.toolbar-dropdown-button {
|
|
643
|
-
font-size: 12px;
|
|
644
|
-
|
|
645
|
-
.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item {
|
|
646
|
-
border-color: #28c76f;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item {
|
|
650
|
-
border-color: #28c76f;
|
|
651
|
-
|
|
652
|
-
.ui-rc-btn-icon {
|
|
653
|
-
color: #28c76f;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
.ui-rc-toolbar-bottom_border-bottom {
|
|
662
|
-
border-bottom: 1px solid #e0e0e0;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
.ui-rc-toolbar-bottom {
|
|
666
|
-
position: relative;
|
|
667
|
-
padding: .15rem 0.5rem;
|
|
668
|
-
background-color: #ffffff;
|
|
669
|
-
|
|
670
|
-
// &::before {
|
|
671
|
-
// content: "";
|
|
672
|
-
// position: absolute;
|
|
673
|
-
// border-left: 1px solid #e0e0e0;
|
|
674
|
-
// height: 100%;
|
|
675
|
-
// bottom: 0;
|
|
676
|
-
// left: 0;
|
|
677
|
-
// //z-index: -1;
|
|
678
|
-
// }
|
|
679
|
-
|
|
680
|
-
// &::after {
|
|
681
|
-
// content: "";
|
|
682
|
-
// position: absolute;
|
|
683
|
-
// border-left: 1px solid #e0e0e0;
|
|
684
|
-
// height: 100%;
|
|
685
|
-
// bottom: 0;
|
|
686
|
-
// visibility: visible;
|
|
687
|
-
// right: 0;
|
|
688
|
-
// //z-index: -1;
|
|
689
|
-
// }
|
|
690
|
-
|
|
691
|
-
.toolbar-button {
|
|
692
|
-
border-radius: 3px;
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
.ui-rc-btn {
|
|
699
|
-
border-radius: 3px;
|
|
700
|
-
height: 28px;
|
|
701
|
-
|
|
702
|
-
&.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item {
|
|
703
|
-
border-start-start-radius: 0;
|
|
704
|
-
border-end-start-radius: 0;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
&.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item {
|
|
708
|
-
border-start-end-radius: 0;
|
|
709
|
-
border-end-end-radius: 0;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
630
|
.spinner-loading {
|
|
716
631
|
position: absolute;
|
|
717
632
|
top: 0;
|
|
@@ -800,7 +715,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
800
715
|
// margin: 1rem auto;
|
|
801
716
|
// }
|
|
802
717
|
|
|
803
|
-
|
|
718
|
+
// ------------ expand icon -------------------- //
|
|
804
719
|
.ui-rc-table-row-expand {
|
|
805
720
|
color: inherit;
|
|
806
721
|
text-decoration: none;
|
|
@@ -887,7 +802,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
887
802
|
.ui-rc-table-row-expand-icon-collapsed::before {
|
|
888
803
|
transform: rotate(-180deg);
|
|
889
804
|
}
|
|
890
|
-
|
|
805
|
+
// ------------ expand icon end -------------------- //
|
|
891
806
|
|
|
892
807
|
.#{$prefix}-grid-filter-dropdown {
|
|
893
808
|
box-sizing: border-box;
|
|
@@ -194,10 +194,10 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
194
194
|
value: any;
|
|
195
195
|
rowData: RecordType;
|
|
196
196
|
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
197
|
-
onCellStyles?: Omit<CSSProperties, "width" | "minWidth" | "
|
|
198
|
-
onCellHeaderStyles?: Omit<CSSProperties, "width" | "minWidth" | "
|
|
197
|
+
onCellStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
|
|
198
|
+
onCellHeaderStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
|
|
199
199
|
onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
|
|
200
|
-
onCellFooterStyles?: Omit<CSSProperties, "width" | "minWidth" | "
|
|
200
|
+
onCellFooterStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
|
|
201
201
|
getValue?: (row: any, rowIndex: number) => any;
|
|
202
202
|
getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
|
|
203
203
|
headerCellProps?: import("./../../grid-component/type").CellProps;
|
|
@@ -104,16 +104,32 @@ const InternalTable = props => {
|
|
|
104
104
|
}
|
|
105
105
|
return (0, _utils.addRowIdArray)(dataSource);
|
|
106
106
|
}, [dataSource, groupAble, groupColumns, groupSetting]);
|
|
107
|
+
const depthData = _react.default.useMemo(() => {
|
|
108
|
+
return (0, _utils.getTreeDepth)(convertData);
|
|
109
|
+
}, [convertData]);
|
|
110
|
+
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
111
|
+
const flatColumns = _react.default.useMemo(() => {
|
|
112
|
+
return (0, _utils.flatColumns2)(propsColumns);
|
|
113
|
+
}, [propsColumns]);
|
|
114
|
+
const visibleColumns = _react.default.useMemo(() => {
|
|
115
|
+
return flatColumns.filter(it => it.visible !== false);
|
|
116
|
+
}, [flatColumns]);
|
|
117
|
+
const expandColumn = _react.default.useMemo(() => {
|
|
118
|
+
return visibleColumns[expandIconColumnIndex];
|
|
119
|
+
}, [expandIconColumnIndex, visibleColumns]);
|
|
107
120
|
const mergedColumns = _react.default.useMemo(() => {
|
|
108
121
|
return (0, _useColumns.convertToTanStackColumns)({
|
|
109
122
|
t,
|
|
110
123
|
columns,
|
|
111
124
|
format,
|
|
112
|
-
editAble
|
|
125
|
+
editAble,
|
|
126
|
+
depthData,
|
|
127
|
+
expandable,
|
|
128
|
+
expandColumn
|
|
113
129
|
});
|
|
114
130
|
|
|
115
131
|
// return convertToTanStackColumns<RecordType>(columns)
|
|
116
|
-
}, [t, columns, format, editAble]);
|
|
132
|
+
}, [t, columns, format, editAble, expandable, depthData, expandColumn]);
|
|
117
133
|
const isDataTree = _react.default.useMemo(() => {
|
|
118
134
|
return (0, _utils.isTreeArray)(dataSource);
|
|
119
135
|
}, [dataSource]);
|
|
@@ -43,6 +43,7 @@ type TableContainerProps<T> = Omit<TableProps<T>, 'columns'> & {
|
|
|
43
43
|
setIsExpandClick: Dispatch<SetStateAction<boolean>>;
|
|
44
44
|
columnSizingInfo: ColumnSizingInfoState;
|
|
45
45
|
columnSizing: ColumnSizingState;
|
|
46
|
+
maxDepth?: number;
|
|
46
47
|
};
|
|
47
48
|
declare const TableContainer: <RecordType extends object>(props: TableContainerProps<RecordType>) => JSX.Element;
|
|
48
49
|
export default TableContainer;
|
|
@@ -85,6 +85,7 @@ const TableContainer = props => {
|
|
|
85
85
|
setIsExpandClick,
|
|
86
86
|
recordClick,
|
|
87
87
|
striped = true,
|
|
88
|
+
maxDepth,
|
|
88
89
|
...rest
|
|
89
90
|
} = props;
|
|
90
91
|
const [paginationLocal] = (0, _locale.useLocale)('Pagination');
|
|
@@ -246,12 +247,12 @@ const TableContainer = props => {
|
|
|
246
247
|
alignItems: 'center',
|
|
247
248
|
gap: '1rem'
|
|
248
249
|
}
|
|
249
|
-
},
|
|
250
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
250
251
|
style: {
|
|
251
252
|
flex: 1,
|
|
252
253
|
overflow: 'hidden'
|
|
253
254
|
}
|
|
254
|
-
}, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Toolbar, {
|
|
255
|
+
}, toolbarItemTop && toolbarItemTop?.length > 0 && /*#__PURE__*/_react.default.createElement(_rcMasterUi.Toolbar, {
|
|
255
256
|
items: toolbarItemTop ?? []
|
|
256
257
|
// mode={'scroll'}
|
|
257
258
|
,
|
|
@@ -346,7 +347,8 @@ const TableContainer = props => {
|
|
|
346
347
|
pagination,
|
|
347
348
|
dataSourceFilter,
|
|
348
349
|
onExpandClick,
|
|
349
|
-
setIsExpandClick
|
|
350
|
+
setIsExpandClick,
|
|
351
|
+
maxDepth
|
|
350
352
|
}
|
|
351
353
|
}, /*#__PURE__*/_react.default.createElement(_TableWrapper.default, (0, _extends2.default)({}, rest, {
|
|
352
354
|
contextMenuItems: contextMenuItems,
|
|
@@ -374,7 +376,7 @@ const TableContainer = props => {
|
|
|
374
376
|
fixedRightColumns: fixedRightColumns
|
|
375
377
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
376
378
|
ref: bottomToolbarRef
|
|
377
|
-
}, toolbarItemBottom && toolbarItemBottom.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
379
|
+
}, toolbarItemBottom && toolbarItemBottom.length > 0 && false && /*#__PURE__*/_react.default.createElement("div", {
|
|
378
380
|
style: {
|
|
379
381
|
flex: 1,
|
|
380
382
|
overflow: 'hidden'
|
|
@@ -2042,12 +2042,12 @@ const TableContainerEdit = props => {
|
|
|
2042
2042
|
alignItems: 'center',
|
|
2043
2043
|
gap: '1rem'
|
|
2044
2044
|
}
|
|
2045
|
-
},
|
|
2045
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
2046
2046
|
style: {
|
|
2047
2047
|
flex: 1,
|
|
2048
2048
|
overflow: 'hidden'
|
|
2049
2049
|
}
|
|
2050
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
2050
|
+
}, toolbarItemsTop && toolbarItemsTop.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
2051
2051
|
className: (0, _classnames.default)('ui-rc-toolbar-bottom border-0', {
|
|
2052
2052
|
'ui-rc-toolbar-bottom_border-bottom': !pagination || infiniteScroll
|
|
2053
2053
|
})
|
|
@@ -364,13 +364,13 @@ const EditableCell = props => {
|
|
|
364
364
|
// const newVal = datetime.isValid() ? moment(datetime.toDate()).format() : ''
|
|
365
365
|
onChange(newVal);
|
|
366
366
|
}
|
|
367
|
-
onChange(dateString);
|
|
368
367
|
setTimeout(() => {
|
|
369
368
|
// @ts-ignore
|
|
370
369
|
dateTimePickerRef.current?.focus();
|
|
371
370
|
}, 0);
|
|
372
371
|
},
|
|
373
372
|
onBlur: () => {
|
|
373
|
+
console.log('22222222222');
|
|
374
374
|
const formState = getValues();
|
|
375
375
|
const itemState = getValues(dataIndex);
|
|
376
376
|
// @ts-ignore
|
|
@@ -385,6 +385,7 @@ const EditableCell = props => {
|
|
|
385
385
|
onChange(newVal);
|
|
386
386
|
newValue = newVal;
|
|
387
387
|
}
|
|
388
|
+
console.log('newValue', newValue);
|
|
388
389
|
if (prevState !== newState) {
|
|
389
390
|
handleCellChange?.({
|
|
390
391
|
key: key,
|
|
@@ -239,7 +239,7 @@ const TableBodyCell = props => {
|
|
|
239
239
|
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
240
240
|
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
241
241
|
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
242
|
-
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
242
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center' && cell.column.getIndex() !== expandIconColumnIndex,
|
|
243
243
|
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right'
|
|
244
244
|
}),
|
|
245
245
|
style: {
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { Dispatch, SetStateAction } from "react";
|
|
2
|
-
import type { ColumnsTable, ColumnTable, IFormat, SelectionSettings } from '../../grid-component/type';
|
|
2
|
+
import type { ColumnsTable, ColumnTable, ExpandableConfig, IFormat, SelectionSettings } from '../../grid-component/type';
|
|
3
3
|
import type { Cell, ColumnDef } from '@tanstack/react-table';
|
|
4
4
|
export declare const renderValueCell: <T>(column: ColumnTable<T>, value: any, record: T, rowIndex: number, colIndex: number, format?: IFormat, editAble?: boolean) => any;
|
|
5
5
|
export declare const getValueCellString: <T>(column: ColumnTable<T>, value: any, record: T, rowIndex: number, colIndex: number, format?: IFormat) => any;
|
|
6
|
-
export declare function convertToTanStackColumns<T>({ t, columns, format, editAble }: {
|
|
6
|
+
export declare function convertToTanStackColumns<T>({ t, columns, format, editAble, depthData, expandColumn }: {
|
|
7
7
|
t?: any;
|
|
8
8
|
columns: ColumnsTable<T>;
|
|
9
|
+
expandable?: ExpandableConfig<T>;
|
|
9
10
|
format?: IFormat;
|
|
10
11
|
editAble?: boolean;
|
|
12
|
+
depthData?: number;
|
|
13
|
+
expandColumn?: ColumnTable;
|
|
11
14
|
}): ColumnDef<T, any>[];
|
|
12
15
|
export type ToggleRow<T> = {
|
|
13
16
|
e: any;
|
|
@@ -153,10 +153,11 @@ function convertToTanStackColumns({
|
|
|
153
153
|
// setExpanded,
|
|
154
154
|
// expandable,
|
|
155
155
|
format,
|
|
156
|
-
editAble
|
|
156
|
+
editAble,
|
|
157
|
+
depthData,
|
|
158
|
+
// expandable,
|
|
159
|
+
expandColumn
|
|
157
160
|
}) {
|
|
158
|
-
// const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0
|
|
159
|
-
|
|
160
161
|
return (0, _utils.sortByType)(columns).map(col => {
|
|
161
162
|
const {
|
|
162
163
|
headerText,
|
|
@@ -214,7 +215,7 @@ function convertToTanStackColumns({
|
|
|
214
215
|
// enableHiding: false,
|
|
215
216
|
// enableResizing: true,
|
|
216
217
|
id: field,
|
|
217
|
-
size: width,
|
|
218
|
+
size: expandColumn?.field === col.field ? (width ?? 0) + (depthData ?? 0) * 25 : width,
|
|
218
219
|
accessorKey: field,
|
|
219
220
|
sortDescFirst: false,
|
|
220
221
|
minSize: minWidth,
|
|
@@ -231,7 +232,9 @@ function convertToTanStackColumns({
|
|
|
231
232
|
columns: children,
|
|
232
233
|
editAble,
|
|
233
234
|
format,
|
|
234
|
-
t
|
|
235
|
+
t,
|
|
236
|
+
depthData,
|
|
237
|
+
expandColumn
|
|
235
238
|
});
|
|
236
239
|
}
|
|
237
240
|
const meta = {
|
|
@@ -166,3 +166,4 @@ export declare const updateColumnsByGroup: (columns: any[], columnsGroup: string
|
|
|
166
166
|
export declare const removeColumns: <RecordType>(columns: ColumnTable<RecordType>[], groupColumns: string[]) => ColumnsTable<RecordType>;
|
|
167
167
|
export declare function sumFields(columns: ColumnTable[], data: any[], childrenKey?: string): any;
|
|
168
168
|
export declare function sumNumberFields(columns: ColumnTable[], data: any[], childrenKey?: string): any;
|
|
169
|
+
export declare const getTreeDepth: (rows: any[]) => number;
|
|
@@ -41,7 +41,7 @@ exports.getHiddenParentKeys1 = getHiddenParentKeys1;
|
|
|
41
41
|
exports.getInvisibleColumns = getInvisibleColumns;
|
|
42
42
|
exports.getNewItemsOnly = exports.getLastSelectCell = void 0;
|
|
43
43
|
exports.getRowIdsBetween = getRowIdsBetween;
|
|
44
|
-
exports.getVisibleColumnKeys1 = exports.getVisibleColumnKeys = exports.getTypeFilter = exports.getTableHeight = exports.getSelectedCellMatrix = void 0;
|
|
44
|
+
exports.getVisibleColumnKeys1 = exports.getVisibleColumnKeys = exports.getTypeFilter = exports.getTreeDepth = exports.getTableHeight = exports.getSelectedCellMatrix = void 0;
|
|
45
45
|
exports.getVisibleFields = getVisibleFields;
|
|
46
46
|
exports.groupArrayByColumns = groupArrayByColumns;
|
|
47
47
|
exports.isColor = void 0;
|
|
@@ -2848,4 +2848,9 @@ function sumNumberFields(columns, data, childrenKey = 'children') {
|
|
|
2848
2848
|
}
|
|
2849
2849
|
}
|
|
2850
2850
|
return result;
|
|
2851
|
-
}
|
|
2851
|
+
}
|
|
2852
|
+
const getTreeDepth = rows => {
|
|
2853
|
+
if (!rows?.length) return 0;
|
|
2854
|
+
return 1 + Math.max(0, ...rows.map(r => getTreeDepth(r.children)));
|
|
2855
|
+
};
|
|
2856
|
+
exports.getTreeDepth = getTreeDepth;
|
|
@@ -55,4 +55,4 @@ const colorDark = '#e6e4f3e6 ';
|
|
|
55
55
|
const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
|
|
56
56
|
displayName: "GridStyle",
|
|
57
57
|
componentId: "es-grid-template__sc-hdqm5k-0"
|
|
58
|
-
})(["&.", "-grid{color:", ";font-size:", ";background-color:", ";font-family:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:'';pointer-events:none;}.", "-grid-cell{padding:5px 8px;&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{justify-content:flex-end;text-align:right;}&.", "-grid-cell-ellipsis{.ui-rc_cell-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;&.select-cell{padding-right:18px;position:relative;}.caret-down{float:right;position:absolute;right:0;&::before{content:'';display:inline-block;margin-left:4px;vertical-align:middle;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #6f7777;}}}}&.", "-grid-cell-wrap{white-space:normal;text-overflow:ellipsis;word-break:break-word;}.", "-grid-header-text-wrap{white-space:normal;overflow:hidden;text-overflow:ellipsis;word-break:break-word;}}.", "-grid-thead{background-color:", ";font-weight:", ";.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{font-weight:", ";background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#f9f8fd;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, fontSize, BgColor, fontFamily, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, fwHeader, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, fwBody, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
58
|
+
})(["&.", "-grid{color:", ";font-size:", ";background-color:", ";font-family:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:'';pointer-events:none;}.", "-grid-cell{padding:5px 8px;&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{justify-content:flex-end;text-align:right;}&.", "-grid-cell-ellipsis{.ui-rc_cell-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;&.select-cell{padding-right:18px;position:relative;}.caret-down{float:right;position:absolute;right:0;&::before{content:'';display:inline-block;margin-left:4px;vertical-align:middle;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #6f7777;}}}}&.", "-grid-cell-wrap{white-space:normal;text-overflow:ellipsis;word-break:break-word;}.", "-grid-header-text-wrap{white-space:normal;overflow:hidden;text-overflow:ellipsis;word-break:break-word;}}.", "-grid-thead{background-color:", ";font-weight:", ";.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{font-weight:", ";background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#f9f8fd;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}.ui-rc-toolbar-bottom{border-right:1px solid #e0e0e0;border-left:1px solid #e0e0e0;.be-toolbar-item{.ui-rc-btn{font-size:12px;}.toolbar-dropdown-button{font-size:12px;.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item{border-color:#28c76f;}.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item{border-color:#28c76f;.ui-rc-btn-icon{color:#28c76f;}}}}}.ui-rc-toolbar-bottom_border-bottom{border-bottom:1px solid #e0e0e0;}.ui-rc-toolbar-bottom{position:relative;padding:.15rem 0.5rem;background-color:#ffffff;.toolbar-button{border-radius:3px;}.ui-rc-btn{border-radius:3px;height:28px;&.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item{border-start-start-radius:0;border-end-start-radius:0;}&.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item{border-start-end-radius:0;border-end-end-radius:0;}}}}"], props => props.$prefix, color, fontSize, BgColor, fontFamily, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, fwHeader, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, fwBody, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -627,91 +627,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
627
627
|
}
|
|
628
628
|
|
|
629
629
|
|
|
630
|
-
|
|
631
|
-
// bottom toolbar
|
|
632
|
-
.ui-rc-toolbar-bottom {
|
|
633
|
-
// border-bottom: 1px solid #e0e0e0;
|
|
634
|
-
border-right: 1px solid #e0e0e0;
|
|
635
|
-
border-left: 1px solid #e0e0e0;
|
|
636
|
-
|
|
637
|
-
.be-toolbar-item {
|
|
638
|
-
.ui-rc-btn {
|
|
639
|
-
font-size: 12px;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
.toolbar-dropdown-button {
|
|
643
|
-
font-size: 12px;
|
|
644
|
-
|
|
645
|
-
.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item {
|
|
646
|
-
border-color: #28c76f;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
.ui-rc-btn.ui-rc-btn-default.ui-rc-btn-variant-outlined.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item {
|
|
650
|
-
border-color: #28c76f;
|
|
651
|
-
|
|
652
|
-
.ui-rc-btn-icon {
|
|
653
|
-
color: #28c76f;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
.ui-rc-toolbar-bottom_border-bottom {
|
|
662
|
-
border-bottom: 1px solid #e0e0e0;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
.ui-rc-toolbar-bottom {
|
|
666
|
-
position: relative;
|
|
667
|
-
padding: .15rem 0.5rem;
|
|
668
|
-
background-color: #ffffff;
|
|
669
|
-
|
|
670
|
-
// &::before {
|
|
671
|
-
// content: "";
|
|
672
|
-
// position: absolute;
|
|
673
|
-
// border-left: 1px solid #e0e0e0;
|
|
674
|
-
// height: 100%;
|
|
675
|
-
// bottom: 0;
|
|
676
|
-
// left: 0;
|
|
677
|
-
// //z-index: -1;
|
|
678
|
-
// }
|
|
679
|
-
|
|
680
|
-
// &::after {
|
|
681
|
-
// content: "";
|
|
682
|
-
// position: absolute;
|
|
683
|
-
// border-left: 1px solid #e0e0e0;
|
|
684
|
-
// height: 100%;
|
|
685
|
-
// bottom: 0;
|
|
686
|
-
// visibility: visible;
|
|
687
|
-
// right: 0;
|
|
688
|
-
// //z-index: -1;
|
|
689
|
-
// }
|
|
690
|
-
|
|
691
|
-
.toolbar-button {
|
|
692
|
-
border-radius: 3px;
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
.ui-rc-btn {
|
|
699
|
-
border-radius: 3px;
|
|
700
|
-
height: 28px;
|
|
701
|
-
|
|
702
|
-
&.ui-rc-btn-compact-item.ui-rc-btn-compact-last-item {
|
|
703
|
-
border-start-start-radius: 0;
|
|
704
|
-
border-end-start-radius: 0;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
&.ui-rc-btn-compact-item.ui-rc-btn-compact-first-item {
|
|
708
|
-
border-start-end-radius: 0;
|
|
709
|
-
border-end-end-radius: 0;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
630
|
.spinner-loading {
|
|
716
631
|
position: absolute;
|
|
717
632
|
top: 0;
|
|
@@ -800,7 +715,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
800
715
|
// margin: 1rem auto;
|
|
801
716
|
// }
|
|
802
717
|
|
|
803
|
-
|
|
718
|
+
// ------------ expand icon -------------------- //
|
|
804
719
|
.ui-rc-table-row-expand {
|
|
805
720
|
color: inherit;
|
|
806
721
|
text-decoration: none;
|
|
@@ -887,7 +802,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
887
802
|
.ui-rc-table-row-expand-icon-collapsed::before {
|
|
888
803
|
transform: rotate(-180deg);
|
|
889
804
|
}
|
|
890
|
-
|
|
805
|
+
// ------------ expand icon end -------------------- //
|
|
891
806
|
|
|
892
807
|
.#{$prefix}-grid-filter-dropdown {
|
|
893
808
|
box-sizing: border-box;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-grid-template",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.49",
|
|
4
4
|
"description": "es-grid-template",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@vitest/coverage-v8": "2.0.5",
|
|
58
58
|
"antd": "5.24.1",
|
|
59
59
|
"antd-style": "3.7.1",
|
|
60
|
-
"becoxy-icons": "2.
|
|
60
|
+
"becoxy-icons": "^2.1.1",
|
|
61
61
|
"classnames": "2.3.1",
|
|
62
62
|
"dayjs": "^1.11.13",
|
|
63
63
|
"lodash": "4.17.21",
|