es-grid-template 1.9.48 → 1.9.50
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/ali-table/Grid.js +14 -8
- package/es/ali-table/InternalTable.js +29 -0
- package/es/ali-table/base-table/styles.d.ts +5 -1
- package/es/ali-table/base-table/styles.js +13 -4
- package/es/ali-table/base-table/table.js +1 -1
- package/es/ali-table/utils/selected.js +0 -1
- 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 +3 -1
- 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/useContext.d.ts +1 -0
- package/lib/ali-table/Grid.js +14 -8
- package/lib/ali-table/InternalTable.js +29 -0
- package/lib/ali-table/base-table/styles.d.ts +5 -1
- package/lib/ali-table/base-table/styles.js +13 -4
- package/lib/ali-table/base-table/table.js +1 -1
- package/lib/ali-table/utils/selected.js +0 -1
- package/lib/table-component/InternalTable.js +18 -2
- package/lib/table-component/TableContainer.d.ts +1 -0
- package/lib/table-component/TableContainer.js +3 -1
- 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/useContext.d.ts +1 -0
- package/package.json +2 -2
package/es/ali-table/Grid.js
CHANGED
|
@@ -15,7 +15,6 @@ import ContextMenu from "../table-component/ContextMenu";
|
|
|
15
15
|
import { TableContext } from "./useContext";
|
|
16
16
|
import { ColumnsChoose } from "./pipeline/features/ColumnsChoose";
|
|
17
17
|
import { StyleTableContainer } from "./base-table/styles";
|
|
18
|
-
// const Grid = (props: GridProps) => {
|
|
19
18
|
const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
20
19
|
const {
|
|
21
20
|
id,
|
|
@@ -56,7 +55,8 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
56
55
|
loading,
|
|
57
56
|
useVirtual,
|
|
58
57
|
useOuterBorder = true,
|
|
59
|
-
showHeader = true
|
|
58
|
+
showHeader = true,
|
|
59
|
+
gridLines
|
|
60
60
|
} = props;
|
|
61
61
|
const {
|
|
62
62
|
cssVariables
|
|
@@ -159,7 +159,11 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
159
159
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyleTableContainer, {
|
|
160
160
|
className: classNames(`${prefix}-grid`, {
|
|
161
161
|
[tableClassNames]: !!tableClassNames,
|
|
162
|
-
[`${prefix}-grid-theme-dark`]: theme?.theme === 'dark'
|
|
162
|
+
[`${prefix}-grid-theme-dark`]: theme?.theme === 'dark',
|
|
163
|
+
[`${prefix}-grid-line-horizontal`]: gridLines === 'Horizontal',
|
|
164
|
+
[`${prefix}-grid-line-vertical`]: gridLines === 'Vertical',
|
|
165
|
+
[`${prefix}-grid-line-none`]: gridLines === 'None',
|
|
166
|
+
[`use-outer-border`]: useOuterBorder
|
|
163
167
|
}),
|
|
164
168
|
style: {
|
|
165
169
|
maxHeight: height ?? 700,
|
|
@@ -168,8 +172,8 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
168
172
|
flexDirection: 'column',
|
|
169
173
|
...artTableWrapperProps.style
|
|
170
174
|
}
|
|
171
|
-
}, (showToolbar !== false || fullScreen !== false || title) && /*#__PURE__*/React.createElement("div", {
|
|
172
|
-
className: classNames(`${prefix}-grid-top
|
|
175
|
+
}, (showToolbar !== false || fullScreen !== false || title || topToolbaritems.length > 0) && /*#__PURE__*/React.createElement("div", {
|
|
176
|
+
className: classNames(`${prefix}-grid-top`, {})
|
|
173
177
|
}, /*#__PURE__*/React.createElement("div", {
|
|
174
178
|
style: {
|
|
175
179
|
display: 'flex',
|
|
@@ -244,7 +248,7 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
244
248
|
|
|
245
249
|
// estimatedRowHeight={50}
|
|
246
250
|
,
|
|
247
|
-
useOuterBorder:
|
|
251
|
+
useOuterBorder: false
|
|
248
252
|
// style={{ height: 700, overflow: 'auto' }}
|
|
249
253
|
,
|
|
250
254
|
style: minHeight ? {
|
|
@@ -293,7 +297,9 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
293
297
|
},
|
|
294
298
|
theme: theme,
|
|
295
299
|
footerDataSource: footerDataSource
|
|
296
|
-
})), bottom
|
|
300
|
+
})), (bottom || pagination && !infiniteScroll) && /*#__PURE__*/React.createElement("div", {
|
|
301
|
+
className: classNames(`${prefix}-grid-bottom`, {})
|
|
302
|
+
}, bottom, pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
297
303
|
pageSizeOptions: pageSizeOptions,
|
|
298
304
|
rootClassName: 'pagination-template',
|
|
299
305
|
showSizeChanger: true,
|
|
@@ -320,7 +326,7 @@ const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
320
326
|
}
|
|
321
327
|
},
|
|
322
328
|
responsive: true
|
|
323
|
-
}))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
329
|
+
})))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
324
330
|
id: `${id}-tooltip-content`,
|
|
325
331
|
style: {
|
|
326
332
|
zIndex: 1999,
|
|
@@ -236,6 +236,35 @@ const InternalTable = props => {
|
|
|
236
236
|
// colorLink: '#eb4619',
|
|
237
237
|
},
|
|
238
238
|
components: {
|
|
239
|
+
// Input: {
|
|
240
|
+
// activeBorderColor: '#1677ff',
|
|
241
|
+
// hoverBorderColor: '#1677ff',
|
|
242
|
+
// },
|
|
243
|
+
// Button: {
|
|
244
|
+
// colorLink: '#eb4619',
|
|
245
|
+
// colorLinkHover: '#eb4619'
|
|
246
|
+
// },
|
|
247
|
+
TableSelect: {
|
|
248
|
+
// activeBorderColor: '#1677ff',
|
|
249
|
+
// hoverBorderColor: '#1677ff',
|
|
250
|
+
zIndexPopup: 1158
|
|
251
|
+
},
|
|
252
|
+
Select: {
|
|
253
|
+
// activeBorderColor: '#1677ff',
|
|
254
|
+
// hoverBorderColor: '#1677ff',
|
|
255
|
+
zIndexPopup: 1158
|
|
256
|
+
// colorPrimary: '#eb4619',
|
|
257
|
+
// colorBgBase: 'red'
|
|
258
|
+
},
|
|
259
|
+
DatePicker: {
|
|
260
|
+
// colorPrimary: '#eb4619',
|
|
261
|
+
// activeBorderColor: '#1677ff',
|
|
262
|
+
// hoverBorderColor: '#1677ff',
|
|
263
|
+
zIndexPopup: 1158
|
|
264
|
+
},
|
|
265
|
+
// Pagination: {
|
|
266
|
+
// fontSize: 12
|
|
267
|
+
// },
|
|
239
268
|
Dropdown: {
|
|
240
269
|
zIndexPopup: 1158
|
|
241
270
|
},
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
export declare const LOCK_SHADOW_PADDING = 20;
|
|
3
3
|
export declare const Classes: {
|
|
4
4
|
/** Outer wrapper div for BaseTable component */
|
|
5
|
-
readonly
|
|
5
|
+
readonly tableWrapper: "ui-rc-grid-table-wrapper";
|
|
6
6
|
readonly tableThemeDark: "ui-rc-grid-theme-dark";
|
|
7
7
|
readonly artTable: "ui-rc-grid-table";
|
|
8
|
+
readonly tableTop: "ui-rc-grid-top";
|
|
9
|
+
readonly gridHorizontal: "ui-rc-grid-line-horizontal";
|
|
10
|
+
readonly gridVertical: "ui-rc-grid-line-vertical";
|
|
11
|
+
readonly gridNone: "ui-rc-grid-line-none";
|
|
8
12
|
readonly tableHeader: "ui-rc-grid-table-header";
|
|
9
13
|
readonly tableBody: "ui-rc-grid-table-body";
|
|
10
14
|
readonly tableFooter: "ui-rc-grid-table-footer";
|
|
@@ -3,9 +3,18 @@ export const LOCK_SHADOW_PADDING = 20;
|
|
|
3
3
|
const prefix = 'ui-rc-grid-';
|
|
4
4
|
export const Classes = {
|
|
5
5
|
/** Outer wrapper div for BaseTable component */
|
|
6
|
-
|
|
6
|
+
tableWrapper: `${prefix}table-wrapper`,
|
|
7
7
|
tableThemeDark: `${prefix}theme-dark`,
|
|
8
8
|
artTable: `${prefix}table`,
|
|
9
|
+
tableTop: `${prefix}top`,
|
|
10
|
+
// toolbar_top + title
|
|
11
|
+
gridHorizontal: `${prefix}line-horizontal`,
|
|
12
|
+
// line-horizontal
|
|
13
|
+
gridVertical: `${prefix}line-vertical`,
|
|
14
|
+
// line-vertical
|
|
15
|
+
gridNone: `${prefix}line-none`,
|
|
16
|
+
// line-vertical
|
|
17
|
+
|
|
9
18
|
tableHeader: `${prefix}table-header`,
|
|
10
19
|
tableBody: `${prefix}table-body`,
|
|
11
20
|
tableFooter: `${prefix}table-footer`,
|
|
@@ -45,11 +54,11 @@ const Z = {
|
|
|
45
54
|
scrollItem: 30,
|
|
46
55
|
loadingIndicator: 40
|
|
47
56
|
};
|
|
48
|
-
const outerBorderStyleMixin = css(["border-top:var(--cell-border-horizontal);border-right:var(--cell-border-vertical);border-bottom:var(--cell-border-horizontal);border-left:var(--cell-border-vertical);td.first,th.first{border-left:none;}td.last,th.last{border-right:none;}thead tr.first th,tbody tr.first td{border-top:none;}
|
|
57
|
+
const outerBorderStyleMixin = css(["border-top:var(--cell-border-horizontal);border-right:var(--cell-border-vertical);border-bottom:var(--cell-border-horizontal);border-left:var(--cell-border-vertical);.", "{border-left:0;border-right:0;border-top:0;}td.first,th.first{border-left:none;}td.last,th.last{border-right:none;}thead tr.first th,tbody tr.first td{border-top:none;}.has-footer tfoot tr.last td{}.has-footer tbody tr.last td{&.lock-left,&.lock-right{border-bottom-width:0;border-top-width:0;box-shadow:0 -1px 0 0 var(--border-color),0 0px 0 0 var(--border-color),-1px 0 0 0 var(--border-color);}}.has-footer tfoot tr td{background:var(--footer-bgcolor);&.", "{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}&.", "{width:100%;white-space:normal;word-break:break-word;}&.", "{text-align:center;}&.", "{text-align:right;}}:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{border-top:var(--cell-border-vertical);}&.", "{&:has(.", ") thead tr.first th{border-top:0;}}"], Classes.tableWrapper, Classes.cellEllipsis, Classes.cellWrap, Classes.cellTextCenter, Classes.cellTextRight, Classes.tableTop, Classes.gridNone, Classes.tableTop);
|
|
49
58
|
export const StyledArtTableWrapper = styled.div.withConfig({
|
|
50
59
|
displayName: "StyledArtTableWrapper",
|
|
51
60
|
componentId: "es-grid-template__sc-ipj1ht-0"
|
|
52
|
-
})(["
|
|
61
|
+
})(["box-sizing:border-box;*{box-sizing:border-box;}cursor:default;color:var(--color);font-size:var(--font-size);line-height:var(--line-height);position:relative;overflow-anchor:none;&::-webkit-scrollbar{width:8px;height:8px;}&::-webkit-scrollbar-track{background:var(--bgcolor);}&::-webkit-scrollbar-thumb{background:rgba(0,0,0,0.4);border-radius:8px;}&::-webkit-scrollbar-thumb:hover{background:#555;}&.dark{&::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.3);}&::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,0.5);}}&.", "{border:var(--cell-border-vertical);&.has-footer{.", "{td{}}}}&.use-outer-border{}.no-scrollbar{scrollbar-width:none;::-webkit-scrollbar{display:none;}}.", "{overflow-x:auto;overflow-y:hidden;background:var(--header-bgcolor);.ui-rc-table-column-title{flex:1;min-width:0;text-align:start;}.", "{font-weight:500;.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}.", "{width:100%;white-space:normal;word-break:break-word;}.", "{text-align:center;}.", "{text-align:right;}}}.", "{.", "{&.", "{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;.expansion-cell{.expansion-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}}&.", "{width:100%;white-space:normal;word-break:break-word;}&.", "{text-align:center;}&.", "{text-align:right;}}.", "{background:var(--footer-bgcolor);}}.", ",.", "{overflow-x:auto;overflow-y:hidden;}&.sticky-header .", "{position:sticky;top:0;z-index:", ";}&.sticky-footer .", "{position:sticky;bottom:0;z-index:", ";}.", "{tr{td{&.lock-left,&.lock-right{border-bottom-width:0;box-shadow:0 -1px 0 0 var(--border-color),0 0px 0 0 var(--border-color),-1px 0 0 0 var(--border-color);}}td.first{&.lock-left{border-bottom-width:1px;}}}}table{width:100%;table-layout:fixed;border-collapse:separate;border-spacing:0;display:table;margin:0;padding:0;}tr:not(.no-hover):hover > td{background:var(--hover-bgcolor);color:var(--hover-color);}tr:not(.no-highlight).highlight > td{}th{font-weight:normal;text-align:left;padding:var(--cell-padding);height:var(--header-row-height);color:var(--header-color);background:var(--header-bgcolor);border:none;border-right:var(--header-cell-border-vertical);border-bottom:var(--header-cell-border-horizontal);}tr.first th{}th.first{}td{padding:var(--cell-padding);background:var(--bgcolor);height:var(--row-height);border:none;border-right:var(--cell-border-vertical);border-bottom:var(--cell-border-horizontal);}td.first{}tr.first td{border-top:var(--cell-border-horizontal);}&.has-header tbody tr.first td{border-top:none;}&.has-footer tbody tr.last td{border-bottom:none;}&.has-footer tfoot tr > td{background:var(--footer-bgcolor);color:var(--footer-color);}&.has-footer tfoot tr:not(.no-hover):hover > td{background:var(--footer-bgcolor);}.lock-left,.lock-right{z-index:", ";}.resize-handle{width:6px;height:100%;position:absolute;top:0;right:0;cursor:col-resize;background-color:transparent;border-right:2px solid transparent;}.", "{position:absolute;top:0;bottom:0;z-index:", ";pointer-events:none;overflow:hidden;.", "{height:100%;}.", "{margin-right:", "px;box-shadow:none;&.show-shadow{box-shadow:var(--lock-shadow);border-right:var(--cell-border-vertical);}}.", "{margin-left:", "px;box-shadow:none;&.show-shadow{box-shadow:var(--lock-shadow);border-left:var(--cell-border-vertical);}}}.", "{pointer-events:none;color:#99a3b3;font-size:12px;text-align:center;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);.empty-image{width:50px;height:50px;}.empty-tips{margin-top:16px;line-height:1.5;}}.", "{overflow:auto;position:sticky;bottom:0;z-index:", ";margin-top:-17px;}.ui-rc-grid-loading-wrapper{}.ui-rc-grid-table{}.art-loading-content-wrapper{display:flex;height:100%;}.", "{height:1px;visibility:hidden;}.", "{position:relative;height:100%;.", "{position:absolute;inset:0;pointer-events:none;}.", "{position:sticky;z-index:", ";transform:translateY(-50%);}}"], Classes.tableWrapper, Classes.tableFooter, Classes.tableHeader, Classes.tableHeaderCell, Classes.cellEllipsis, Classes.cellWrap, Classes.cellTextCenter, Classes.cellTextRight, Classes.tableBody, Classes.tableCell, Classes.cellEllipsis, Classes.cellWrap, Classes.cellTextCenter, Classes.cellTextRight, Classes.tableFooter, Classes.tableBody, Classes.tableFooter, Classes.tableHeader, Z.header, Classes.tableFooter, Z.footer, Classes.tableBody, Z.lock, Classes.lockShadowMask, Z.lockShadow, Classes.lockShadow, Classes.leftLockShadow, LOCK_SHADOW_PADDING, Classes.rightLockShadow, LOCK_SHADOW_PADDING, Classes.emptyWrapper, Classes.stickyScroll, Z.scrollItem, Classes.stickyScrollItem, Classes.loadingWrapper, Classes.loadingIndicatorWrapper, Classes.loadingIndicator, Z.loadingIndicator);
|
|
53
62
|
|
|
54
63
|
// type StyleTableContainerProps = {
|
|
55
64
|
|
|
@@ -58,4 +67,4 @@ export const StyledArtTableWrapper = styled.div.withConfig({
|
|
|
58
67
|
export const StyleTableContainer = styled.div.withConfig({
|
|
59
68
|
displayName: "StyleTableContainer",
|
|
60
69
|
componentId: "es-grid-template__sc-ipj1ht-1"
|
|
61
|
-
})(["--color:#333;--bgcolor:white;--header-bgcolor:#ffffff;--header-hover-bgcolor:#ddd;--header-highlight-bgcolor:#e4e8ed;--cell-padding:7px 8px;--font-size:13px;--line-height:1.28571;--border-color:#dfe3e8;--cell-border:1px solid var(--border-color);--cell-border-horizontal:var(--cell-border);--cell-border-vertical:var(--cell-border);--header-cell-border:1px solid var(--border-color);--header-cell-border-horizontal:var(--header-cell-border);--header-cell-border-vertical:var(--header-cell-border);--footer-bgcolor:#fafafa;&.", "{--bgcolor:#343e59;--footer-bgcolor:#2e3342;--header-bgcolor:#343e59;--hover-bgcolor:#232b43;--header-hover-bgcolor:#606164;--highlight-bgcolor:#eff2f5;--header-highlight-bgcolor:#191a1b;--color:#dadde1;--header-color:#dadde1;--lock-shadow:rgb(37 37 37 / 0.5) 0 0 6px 2px;--border-color:#4f5266;background-color:var(--bgcolor);}&.
|
|
70
|
+
})(["--row-height:38px;--color:#333;--bgcolor:white;--body-hover-bgcolor:#f5f5f5;--body-hover-color:#333;--hover-bgcolor:var(--body-hover-bgcolor,#f5f5f5);--hover-color:var(--body-hover-color);--highlight-bgcolor:#eee;--header-row-height:36px;--header-color:#000000de;--header-bgcolor:#ffffff;--header-hover-bgcolor:#ddd;--header-highlight-bgcolor:#e4e8ed;--cell-padding:7px 8px;--font-size:13px;--line-height:1.28571;--lock-shadow:rgba(152,152,152,0.5) 0 0 6px 2px;--border-color:#dfe3e8;--cell-border:1px solid var(--border-color);--cell-border-horizontal:var(--cell-border);--cell-border-vertical:var(--cell-border);--header-cell-border:1px solid var(--border-color);--header-cell-border-horizontal:var(--header-cell-border);--header-cell-border-vertical:var(--header-cell-border);--footer-bgcolor:#fafafa;&.", "{--bgcolor:#343e59;--footer-bgcolor:#2e3342;--header-bgcolor:#343e59;--hover-bgcolor:#232b43;--header-hover-bgcolor:#606164;--highlight-bgcolor:#eff2f5;--header-highlight-bgcolor:#191a1b;--hover-color:#dadde1;--color:#dadde1;--header-color:#dadde1;--lock-shadow:rgb(37 37 37 / 0.5) 0 0 6px 2px;--border-color:#4f5266;background-color:var(--bgcolor);}&.use-outer-border{", ";}&.", "{.", "{border-left:0;border-right:0;td,th{border-right:0;}td.first,th.first{}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr.last td{}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{}}}&.", "{.", "{border-top:0;td,th{border-bottom:0;}td.lock-left{box-shadow:none;}td.first,th.first{}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr td{border-bottom:0;border-top:0;}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{}}}&.", "{.", "{border:0;td,th{border-right:0;border-bottom:0;}td.lock-left{box-shadow:none;}td.first,th.first{}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr td{border-bottom:0;border-top:0;}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{border-top:0;border:0;}}}.", "{padding:8px;}&.ui-rc-grid .ui-rc-pagination{background-color:var(--bgcolor);color:var(--color);padding:10px;background-color:var(--bgcolor);.ui-rc-pagination-prev{.anticon.anticon-left{color:var(--color);}}.ui-rc-pagination-disabled{.anticon.anticon-left{color:#7d7a7a;}}.ui-rc-pagination-next{.anticon.anticon-right{color:var(--color);}&.ui-rc-pagination-disabled{.anticon.anticon-right{color:#7d7a7a;}}}}&.", "{&.ui-rc-grid{.ui-rc-toolbar-bottom{background-color:var(--footer-bgcolor);color:#ffffff;}}.ui-rc-grid-top-toolbar{border-color:var(--border-color);color:#ffffff;}.ui-rc-toolbar{.ui-rc-toolbar-selection-item{background-color:var(--footer-bgcolor);color:#ffffff;}}}"], Classes.tableThemeDark, outerBorderStyleMixin, Classes.gridHorizontal, Classes.tableWrapper, Classes.tableTop, Classes.gridVertical, Classes.tableWrapper, Classes.tableTop, Classes.gridNone, Classes.tableWrapper, Classes.tableTop, Classes.tableTop, Classes.tableThemeDark);
|
|
@@ -350,7 +350,7 @@ export class BaseTable extends React.Component {
|
|
|
350
350
|
footerDataSource,
|
|
351
351
|
components
|
|
352
352
|
} = this.props;
|
|
353
|
-
const artTableWrapperClassName = cx(Classes.
|
|
353
|
+
const artTableWrapperClassName = cx(Classes.tableWrapper, {
|
|
354
354
|
'use-outer-border': useOuterBorder,
|
|
355
355
|
empty: dataSource.length === 0,
|
|
356
356
|
lock: info.hasLockColumn,
|
|
@@ -402,7 +402,6 @@ export function isRowChecked(key, selectedKeys, treeIndex, checkedStrategy, isDi
|
|
|
402
402
|
// =========================
|
|
403
403
|
if (checkedStrategy === 'parent') {
|
|
404
404
|
// node disable => chỉ true nếu explicit chọn
|
|
405
|
-
// console.log('isDisabled', isDisabled)
|
|
406
405
|
if (isDisabled) {
|
|
407
406
|
const abc = selectedKeys.has(key);
|
|
408
407
|
return abc;
|
|
@@ -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, "
|
|
198
|
-
onCellHeaderStyles?: Omit<CSSProperties, "
|
|
197
|
+
onCellStyles?: Omit<CSSProperties, "left" | "right" | "position" | "display" | "minWidth" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "position" | "display" | "minWidth" | "width">);
|
|
198
|
+
onCellHeaderStyles?: Omit<CSSProperties, "left" | "right" | "position" | "display" | "minWidth" | "width"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "position" | "display" | "minWidth" | "width">);
|
|
199
199
|
onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
|
|
200
|
-
onCellFooterStyles?: Omit<CSSProperties, "
|
|
200
|
+
onCellFooterStyles?: Omit<CSSProperties, "left" | "right" | "position" | "display" | "minWidth" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "position" | "display" | "minWidth" | "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');
|
|
@@ -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,
|
|
@@ -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
|
+
};
|
package/lib/ali-table/Grid.js
CHANGED
|
@@ -25,7 +25,6 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
25
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
26
|
// import type { TableProps } from "../table-component"
|
|
27
27
|
|
|
28
|
-
// const Grid = (props: GridProps) => {
|
|
29
28
|
const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
30
29
|
const {
|
|
31
30
|
id,
|
|
@@ -66,7 +65,8 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
66
65
|
loading,
|
|
67
66
|
useVirtual,
|
|
68
67
|
useOuterBorder = true,
|
|
69
|
-
showHeader = true
|
|
68
|
+
showHeader = true,
|
|
69
|
+
gridLines
|
|
70
70
|
} = props;
|
|
71
71
|
const {
|
|
72
72
|
cssVariables
|
|
@@ -169,7 +169,11 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
169
169
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles2.StyleTableContainer, {
|
|
170
170
|
className: (0, _classnames.default)(`${prefix}-grid`, {
|
|
171
171
|
[tableClassNames]: !!tableClassNames,
|
|
172
|
-
[`${prefix}-grid-theme-dark`]: theme?.theme === 'dark'
|
|
172
|
+
[`${prefix}-grid-theme-dark`]: theme?.theme === 'dark',
|
|
173
|
+
[`${prefix}-grid-line-horizontal`]: gridLines === 'Horizontal',
|
|
174
|
+
[`${prefix}-grid-line-vertical`]: gridLines === 'Vertical',
|
|
175
|
+
[`${prefix}-grid-line-none`]: gridLines === 'None',
|
|
176
|
+
[`use-outer-border`]: useOuterBorder
|
|
173
177
|
}),
|
|
174
178
|
style: {
|
|
175
179
|
maxHeight: height ?? 700,
|
|
@@ -178,8 +182,8 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
178
182
|
flexDirection: 'column',
|
|
179
183
|
...artTableWrapperProps.style
|
|
180
184
|
}
|
|
181
|
-
}, (showToolbar !== false || fullScreen !== false || title) && /*#__PURE__*/_react.default.createElement("div", {
|
|
182
|
-
className: (0, _classnames.default)(`${prefix}-grid-top
|
|
185
|
+
}, (showToolbar !== false || fullScreen !== false || title || topToolbaritems.length > 0) && /*#__PURE__*/_react.default.createElement("div", {
|
|
186
|
+
className: (0, _classnames.default)(`${prefix}-grid-top`, {})
|
|
183
187
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
184
188
|
style: {
|
|
185
189
|
display: 'flex',
|
|
@@ -254,7 +258,7 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
254
258
|
|
|
255
259
|
// estimatedRowHeight={50}
|
|
256
260
|
,
|
|
257
|
-
useOuterBorder:
|
|
261
|
+
useOuterBorder: false
|
|
258
262
|
// style={{ height: 700, overflow: 'auto' }}
|
|
259
263
|
,
|
|
260
264
|
style: minHeight ? {
|
|
@@ -303,7 +307,9 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
303
307
|
},
|
|
304
308
|
theme: theme,
|
|
305
309
|
footerDataSource: footerDataSource
|
|
306
|
-
})), bottom
|
|
310
|
+
})), (bottom || pagination && !infiniteScroll) && /*#__PURE__*/_react.default.createElement("div", {
|
|
311
|
+
className: (0, _classnames.default)(`${prefix}-grid-bottom`, {})
|
|
312
|
+
}, bottom, pagination && !infiniteScroll && /*#__PURE__*/_react.default.createElement(_pagination.default, (0, _extends2.default)({
|
|
307
313
|
pageSizeOptions: _hooks.pageSizeOptions,
|
|
308
314
|
rootClassName: 'pagination-template',
|
|
309
315
|
showSizeChanger: true,
|
|
@@ -330,7 +336,7 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
330
336
|
}
|
|
331
337
|
},
|
|
332
338
|
responsive: true
|
|
333
|
-
}))), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
339
|
+
})))), /*#__PURE__*/_react.default.createElement(_reactTooltip.Tooltip, {
|
|
334
340
|
id: `${id}-tooltip-content`,
|
|
335
341
|
style: {
|
|
336
342
|
zIndex: 1999,
|
|
@@ -243,6 +243,35 @@ const InternalTable = props => {
|
|
|
243
243
|
// colorLink: '#eb4619',
|
|
244
244
|
},
|
|
245
245
|
components: {
|
|
246
|
+
// Input: {
|
|
247
|
+
// activeBorderColor: '#1677ff',
|
|
248
|
+
// hoverBorderColor: '#1677ff',
|
|
249
|
+
// },
|
|
250
|
+
// Button: {
|
|
251
|
+
// colorLink: '#eb4619',
|
|
252
|
+
// colorLinkHover: '#eb4619'
|
|
253
|
+
// },
|
|
254
|
+
TableSelect: {
|
|
255
|
+
// activeBorderColor: '#1677ff',
|
|
256
|
+
// hoverBorderColor: '#1677ff',
|
|
257
|
+
zIndexPopup: 1158
|
|
258
|
+
},
|
|
259
|
+
Select: {
|
|
260
|
+
// activeBorderColor: '#1677ff',
|
|
261
|
+
// hoverBorderColor: '#1677ff',
|
|
262
|
+
zIndexPopup: 1158
|
|
263
|
+
// colorPrimary: '#eb4619',
|
|
264
|
+
// colorBgBase: 'red'
|
|
265
|
+
},
|
|
266
|
+
DatePicker: {
|
|
267
|
+
// colorPrimary: '#eb4619',
|
|
268
|
+
// activeBorderColor: '#1677ff',
|
|
269
|
+
// hoverBorderColor: '#1677ff',
|
|
270
|
+
zIndexPopup: 1158
|
|
271
|
+
},
|
|
272
|
+
// Pagination: {
|
|
273
|
+
// fontSize: 12
|
|
274
|
+
// },
|
|
246
275
|
Dropdown: {
|
|
247
276
|
zIndexPopup: 1158
|
|
248
277
|
},
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
export declare const LOCK_SHADOW_PADDING = 20;
|
|
3
3
|
export declare const Classes: {
|
|
4
4
|
/** Outer wrapper div for BaseTable component */
|
|
5
|
-
readonly
|
|
5
|
+
readonly tableWrapper: "ui-rc-grid-table-wrapper";
|
|
6
6
|
readonly tableThemeDark: "ui-rc-grid-theme-dark";
|
|
7
7
|
readonly artTable: "ui-rc-grid-table";
|
|
8
|
+
readonly tableTop: "ui-rc-grid-top";
|
|
9
|
+
readonly gridHorizontal: "ui-rc-grid-line-horizontal";
|
|
10
|
+
readonly gridVertical: "ui-rc-grid-line-vertical";
|
|
11
|
+
readonly gridNone: "ui-rc-grid-line-none";
|
|
8
12
|
readonly tableHeader: "ui-rc-grid-table-header";
|
|
9
13
|
readonly tableBody: "ui-rc-grid-table-body";
|
|
10
14
|
readonly tableFooter: "ui-rc-grid-table-footer";
|
|
@@ -11,9 +11,18 @@ const LOCK_SHADOW_PADDING = exports.LOCK_SHADOW_PADDING = 20;
|
|
|
11
11
|
const prefix = 'ui-rc-grid-';
|
|
12
12
|
const Classes = exports.Classes = {
|
|
13
13
|
/** Outer wrapper div for BaseTable component */
|
|
14
|
-
|
|
14
|
+
tableWrapper: `${prefix}table-wrapper`,
|
|
15
15
|
tableThemeDark: `${prefix}theme-dark`,
|
|
16
16
|
artTable: `${prefix}table`,
|
|
17
|
+
tableTop: `${prefix}top`,
|
|
18
|
+
// toolbar_top + title
|
|
19
|
+
gridHorizontal: `${prefix}line-horizontal`,
|
|
20
|
+
// line-horizontal
|
|
21
|
+
gridVertical: `${prefix}line-vertical`,
|
|
22
|
+
// line-vertical
|
|
23
|
+
gridNone: `${prefix}line-none`,
|
|
24
|
+
// line-vertical
|
|
25
|
+
|
|
17
26
|
tableHeader: `${prefix}table-header`,
|
|
18
27
|
tableBody: `${prefix}table-body`,
|
|
19
28
|
tableFooter: `${prefix}table-footer`,
|
|
@@ -53,11 +62,11 @@ const Z = {
|
|
|
53
62
|
scrollItem: 30,
|
|
54
63
|
loadingIndicator: 40
|
|
55
64
|
};
|
|
56
|
-
const outerBorderStyleMixin = (0, _styledComponents.css)(["border-top:var(--cell-border-horizontal);border-right:var(--cell-border-vertical);border-bottom:var(--cell-border-horizontal);border-left:var(--cell-border-vertical);td.first,th.first{border-left:none;}td.last,th.last{border-right:none;}thead tr.first th,tbody tr.first td{border-top:none;}
|
|
65
|
+
const outerBorderStyleMixin = (0, _styledComponents.css)(["border-top:var(--cell-border-horizontal);border-right:var(--cell-border-vertical);border-bottom:var(--cell-border-horizontal);border-left:var(--cell-border-vertical);.", "{border-left:0;border-right:0;border-top:0;}td.first,th.first{border-left:none;}td.last,th.last{border-right:none;}thead tr.first th,tbody tr.first td{border-top:none;}.has-footer tfoot tr.last td{}.has-footer tbody tr.last td{&.lock-left,&.lock-right{border-bottom-width:0;border-top-width:0;box-shadow:0 -1px 0 0 var(--border-color),0 0px 0 0 var(--border-color),-1px 0 0 0 var(--border-color);}}.has-footer tfoot tr td{background:var(--footer-bgcolor);&.", "{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}&.", "{width:100%;white-space:normal;word-break:break-word;}&.", "{text-align:center;}&.", "{text-align:right;}}:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{border-top:var(--cell-border-vertical);}&.", "{&:has(.", ") thead tr.first th{border-top:0;}}"], Classes.tableWrapper, Classes.cellEllipsis, Classes.cellWrap, Classes.cellTextCenter, Classes.cellTextRight, Classes.tableTop, Classes.gridNone, Classes.tableTop);
|
|
57
66
|
const StyledArtTableWrapper = exports.StyledArtTableWrapper = _styledComponents.default.div.withConfig({
|
|
58
67
|
displayName: "StyledArtTableWrapper",
|
|
59
68
|
componentId: "es-grid-template__sc-ipj1ht-0"
|
|
60
|
-
})(["
|
|
69
|
+
})(["box-sizing:border-box;*{box-sizing:border-box;}cursor:default;color:var(--color);font-size:var(--font-size);line-height:var(--line-height);position:relative;overflow-anchor:none;&::-webkit-scrollbar{width:8px;height:8px;}&::-webkit-scrollbar-track{background:var(--bgcolor);}&::-webkit-scrollbar-thumb{background:rgba(0,0,0,0.4);border-radius:8px;}&::-webkit-scrollbar-thumb:hover{background:#555;}&.dark{&::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.3);}&::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,0.5);}}&.", "{border:var(--cell-border-vertical);&.has-footer{.", "{td{}}}}&.use-outer-border{}.no-scrollbar{scrollbar-width:none;::-webkit-scrollbar{display:none;}}.", "{overflow-x:auto;overflow-y:hidden;background:var(--header-bgcolor);.ui-rc-table-column-title{flex:1;min-width:0;text-align:start;}.", "{font-weight:500;.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}.", "{width:100%;white-space:normal;word-break:break-word;}.", "{text-align:center;}.", "{text-align:right;}}}.", "{.", "{&.", "{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;.expansion-cell{.expansion-content{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}}&.", "{width:100%;white-space:normal;word-break:break-word;}&.", "{text-align:center;}&.", "{text-align:right;}}.", "{background:var(--footer-bgcolor);}}.", ",.", "{overflow-x:auto;overflow-y:hidden;}&.sticky-header .", "{position:sticky;top:0;z-index:", ";}&.sticky-footer .", "{position:sticky;bottom:0;z-index:", ";}.", "{tr{td{&.lock-left,&.lock-right{border-bottom-width:0;box-shadow:0 -1px 0 0 var(--border-color),0 0px 0 0 var(--border-color),-1px 0 0 0 var(--border-color);}}td.first{&.lock-left{border-bottom-width:1px;}}}}table{width:100%;table-layout:fixed;border-collapse:separate;border-spacing:0;display:table;margin:0;padding:0;}tr:not(.no-hover):hover > td{background:var(--hover-bgcolor);color:var(--hover-color);}tr:not(.no-highlight).highlight > td{}th{font-weight:normal;text-align:left;padding:var(--cell-padding);height:var(--header-row-height);color:var(--header-color);background:var(--header-bgcolor);border:none;border-right:var(--header-cell-border-vertical);border-bottom:var(--header-cell-border-horizontal);}tr.first th{}th.first{}td{padding:var(--cell-padding);background:var(--bgcolor);height:var(--row-height);border:none;border-right:var(--cell-border-vertical);border-bottom:var(--cell-border-horizontal);}td.first{}tr.first td{border-top:var(--cell-border-horizontal);}&.has-header tbody tr.first td{border-top:none;}&.has-footer tbody tr.last td{border-bottom:none;}&.has-footer tfoot tr > td{background:var(--footer-bgcolor);color:var(--footer-color);}&.has-footer tfoot tr:not(.no-hover):hover > td{background:var(--footer-bgcolor);}.lock-left,.lock-right{z-index:", ";}.resize-handle{width:6px;height:100%;position:absolute;top:0;right:0;cursor:col-resize;background-color:transparent;border-right:2px solid transparent;}.", "{position:absolute;top:0;bottom:0;z-index:", ";pointer-events:none;overflow:hidden;.", "{height:100%;}.", "{margin-right:", "px;box-shadow:none;&.show-shadow{box-shadow:var(--lock-shadow);border-right:var(--cell-border-vertical);}}.", "{margin-left:", "px;box-shadow:none;&.show-shadow{box-shadow:var(--lock-shadow);border-left:var(--cell-border-vertical);}}}.", "{pointer-events:none;color:#99a3b3;font-size:12px;text-align:center;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);.empty-image{width:50px;height:50px;}.empty-tips{margin-top:16px;line-height:1.5;}}.", "{overflow:auto;position:sticky;bottom:0;z-index:", ";margin-top:-17px;}.ui-rc-grid-loading-wrapper{}.ui-rc-grid-table{}.art-loading-content-wrapper{display:flex;height:100%;}.", "{height:1px;visibility:hidden;}.", "{position:relative;height:100%;.", "{position:absolute;inset:0;pointer-events:none;}.", "{position:sticky;z-index:", ";transform:translateY(-50%);}}"], Classes.tableWrapper, Classes.tableFooter, Classes.tableHeader, Classes.tableHeaderCell, Classes.cellEllipsis, Classes.cellWrap, Classes.cellTextCenter, Classes.cellTextRight, Classes.tableBody, Classes.tableCell, Classes.cellEllipsis, Classes.cellWrap, Classes.cellTextCenter, Classes.cellTextRight, Classes.tableFooter, Classes.tableBody, Classes.tableFooter, Classes.tableHeader, Z.header, Classes.tableFooter, Z.footer, Classes.tableBody, Z.lock, Classes.lockShadowMask, Z.lockShadow, Classes.lockShadow, Classes.leftLockShadow, LOCK_SHADOW_PADDING, Classes.rightLockShadow, LOCK_SHADOW_PADDING, Classes.emptyWrapper, Classes.stickyScroll, Z.scrollItem, Classes.stickyScrollItem, Classes.loadingWrapper, Classes.loadingIndicatorWrapper, Classes.loadingIndicator, Z.loadingIndicator);
|
|
61
70
|
|
|
62
71
|
// type StyleTableContainerProps = {
|
|
63
72
|
|
|
@@ -66,4 +75,4 @@ const StyledArtTableWrapper = exports.StyledArtTableWrapper = _styledComponents.
|
|
|
66
75
|
const StyleTableContainer = exports.StyleTableContainer = _styledComponents.default.div.withConfig({
|
|
67
76
|
displayName: "StyleTableContainer",
|
|
68
77
|
componentId: "es-grid-template__sc-ipj1ht-1"
|
|
69
|
-
})(["--color:#333;--bgcolor:white;--header-bgcolor:#ffffff;--header-hover-bgcolor:#ddd;--header-highlight-bgcolor:#e4e8ed;--cell-padding:7px 8px;--font-size:13px;--line-height:1.28571;--border-color:#dfe3e8;--cell-border:1px solid var(--border-color);--cell-border-horizontal:var(--cell-border);--cell-border-vertical:var(--cell-border);--header-cell-border:1px solid var(--border-color);--header-cell-border-horizontal:var(--header-cell-border);--header-cell-border-vertical:var(--header-cell-border);--footer-bgcolor:#fafafa;&.", "{--bgcolor:#343e59;--footer-bgcolor:#2e3342;--header-bgcolor:#343e59;--hover-bgcolor:#232b43;--header-hover-bgcolor:#606164;--highlight-bgcolor:#eff2f5;--header-highlight-bgcolor:#191a1b;--color:#dadde1;--header-color:#dadde1;--lock-shadow:rgb(37 37 37 / 0.5) 0 0 6px 2px;--border-color:#4f5266;background-color:var(--bgcolor);}&.
|
|
78
|
+
})(["--row-height:38px;--color:#333;--bgcolor:white;--body-hover-bgcolor:#f5f5f5;--body-hover-color:#333;--hover-bgcolor:var(--body-hover-bgcolor,#f5f5f5);--hover-color:var(--body-hover-color);--highlight-bgcolor:#eee;--header-row-height:36px;--header-color:#000000de;--header-bgcolor:#ffffff;--header-hover-bgcolor:#ddd;--header-highlight-bgcolor:#e4e8ed;--cell-padding:7px 8px;--font-size:13px;--line-height:1.28571;--lock-shadow:rgba(152,152,152,0.5) 0 0 6px 2px;--border-color:#dfe3e8;--cell-border:1px solid var(--border-color);--cell-border-horizontal:var(--cell-border);--cell-border-vertical:var(--cell-border);--header-cell-border:1px solid var(--border-color);--header-cell-border-horizontal:var(--header-cell-border);--header-cell-border-vertical:var(--header-cell-border);--footer-bgcolor:#fafafa;&.", "{--bgcolor:#343e59;--footer-bgcolor:#2e3342;--header-bgcolor:#343e59;--hover-bgcolor:#232b43;--header-hover-bgcolor:#606164;--highlight-bgcolor:#eff2f5;--header-highlight-bgcolor:#191a1b;--hover-color:#dadde1;--color:#dadde1;--header-color:#dadde1;--lock-shadow:rgb(37 37 37 / 0.5) 0 0 6px 2px;--border-color:#4f5266;background-color:var(--bgcolor);}&.use-outer-border{", ";}&.", "{.", "{border-left:0;border-right:0;td,th{border-right:0;}td.first,th.first{}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr.last td{}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{}}}&.", "{.", "{border-top:0;td,th{border-bottom:0;}td.lock-left{box-shadow:none;}td.first,th.first{}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr td{border-bottom:0;border-top:0;}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{}}}&.", "{.", "{border:0;td,th{border-right:0;border-bottom:0;}td.lock-left{box-shadow:none;}td.first,th.first{}td.last,th.last{}thead tr.first th,tbody tr.first td{}&.has-footer tfoot tr td{border-bottom:0;border-top:0;}&.has-footer tbody tr.last td{}&.has-footer tfoot tr td{}&:not(.has-footer) tbody tr.last td{}&:has(.", ") thead tr.first th{border-top:0;border:0;}}}.", "{padding:8px;}&.ui-rc-grid .ui-rc-pagination{background-color:var(--bgcolor);color:var(--color);padding:10px;background-color:var(--bgcolor);.ui-rc-pagination-prev{.anticon.anticon-left{color:var(--color);}}.ui-rc-pagination-disabled{.anticon.anticon-left{color:#7d7a7a;}}.ui-rc-pagination-next{.anticon.anticon-right{color:var(--color);}&.ui-rc-pagination-disabled{.anticon.anticon-right{color:#7d7a7a;}}}}&.", "{&.ui-rc-grid{.ui-rc-toolbar-bottom{background-color:var(--footer-bgcolor);color:#ffffff;}}.ui-rc-grid-top-toolbar{border-color:var(--border-color);color:#ffffff;}.ui-rc-toolbar{.ui-rc-toolbar-selection-item{background-color:var(--footer-bgcolor);color:#ffffff;}}}"], Classes.tableThemeDark, outerBorderStyleMixin, Classes.gridHorizontal, Classes.tableWrapper, Classes.tableTop, Classes.gridVertical, Classes.tableWrapper, Classes.tableTop, Classes.gridNone, Classes.tableWrapper, Classes.tableTop, Classes.tableTop, Classes.tableThemeDark);
|
|
@@ -357,7 +357,7 @@ class BaseTable extends _react.default.Component {
|
|
|
357
357
|
footerDataSource,
|
|
358
358
|
components
|
|
359
359
|
} = this.props;
|
|
360
|
-
const artTableWrapperClassName = (0, _classnames.default)(_styles.Classes.
|
|
360
|
+
const artTableWrapperClassName = (0, _classnames.default)(_styles.Classes.tableWrapper, {
|
|
361
361
|
'use-outer-border': useOuterBorder,
|
|
362
362
|
empty: dataSource.length === 0,
|
|
363
363
|
lock: info.hasLockColumn,
|
|
@@ -433,7 +433,6 @@ function isRowChecked(key, selectedKeys, treeIndex, checkedStrategy, isDisabledF
|
|
|
433
433
|
// =========================
|
|
434
434
|
if (checkedStrategy === 'parent') {
|
|
435
435
|
// node disable => chỉ true nếu explicit chọn
|
|
436
|
-
// console.log('isDisabled', isDisabled)
|
|
437
436
|
if (isDisabled) {
|
|
438
437
|
const abc = selectedKeys.has(key);
|
|
439
438
|
return abc;
|
|
@@ -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');
|
|
@@ -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,
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-grid-template",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.50",
|
|
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",
|