@semcore/data-table 16.0.7 → 16.1.0-prerelease.2
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/CHANGELOG.md +28 -0
- package/lib/cjs/components/Body/Body.js +143 -103
- package/lib/cjs/components/Body/Body.js.map +1 -1
- package/lib/cjs/components/Body/Body.types.js.map +1 -1
- package/lib/cjs/components/Body/Cell.js +69 -46
- package/lib/cjs/components/Body/Cell.js.map +1 -1
- package/lib/cjs/components/Body/Cell.types.js.map +1 -1
- package/lib/cjs/components/Body/Row.js +46 -43
- package/lib/cjs/components/Body/Row.js.map +1 -1
- package/lib/cjs/components/Body/Row.types.js.map +1 -1
- package/lib/cjs/components/Body/style.shadow.css +68 -13
- package/lib/cjs/components/DataTable/DataTable.js +188 -109
- package/lib/cjs/components/DataTable/DataTable.js.map +1 -1
- package/lib/cjs/components/DataTable/DataTable.types.js.map +1 -1
- package/lib/cjs/components/Head/Column.js +39 -25
- package/lib/cjs/components/Head/Column.js.map +1 -1
- package/lib/cjs/components/Head/Column.types.js.map +1 -1
- package/lib/cjs/components/Head/Group.js +43 -31
- package/lib/cjs/components/Head/Group.js.map +1 -1
- package/lib/cjs/components/Head/Group.type.js.map +1 -1
- package/lib/cjs/components/Head/Head.js +41 -30
- package/lib/cjs/components/Head/Head.js.map +1 -1
- package/lib/cjs/components/Head/Head.types.js.map +1 -1
- package/lib/cjs/components/Head/style.shadow.css +64 -3
- package/lib/cjs/style/scroll-shadows.shadow.css +7 -12
- package/lib/es6/components/Body/Body.js +144 -104
- package/lib/es6/components/Body/Body.js.map +1 -1
- package/lib/es6/components/Body/Body.types.js.map +1 -1
- package/lib/es6/components/Body/Cell.js +69 -46
- package/lib/es6/components/Body/Cell.js.map +1 -1
- package/lib/es6/components/Body/Cell.types.js.map +1 -1
- package/lib/es6/components/Body/Row.js +47 -44
- package/lib/es6/components/Body/Row.js.map +1 -1
- package/lib/es6/components/Body/Row.types.js.map +1 -1
- package/lib/es6/components/Body/style.shadow.css +68 -13
- package/lib/es6/components/DataTable/DataTable.js +187 -108
- package/lib/es6/components/DataTable/DataTable.js.map +1 -1
- package/lib/es6/components/DataTable/DataTable.types.js.map +1 -1
- package/lib/es6/components/Head/Column.js +39 -25
- package/lib/es6/components/Head/Column.js.map +1 -1
- package/lib/es6/components/Head/Column.types.js.map +1 -1
- package/lib/es6/components/Head/Group.js +43 -31
- package/lib/es6/components/Head/Group.js.map +1 -1
- package/lib/es6/components/Head/Group.type.js.map +1 -1
- package/lib/es6/components/Head/Head.js +41 -30
- package/lib/es6/components/Head/Head.js.map +1 -1
- package/lib/es6/components/Head/Head.types.js.map +1 -1
- package/lib/es6/components/Head/style.shadow.css +64 -3
- package/lib/es6/style/scroll-shadows.shadow.css +7 -12
- package/lib/esm/components/Body/Body.mjs +97 -64
- package/lib/esm/components/Body/Cell.mjs +67 -47
- package/lib/esm/components/Body/Row.mjs +48 -45
- package/lib/esm/components/Body/style.shadow.css +68 -13
- package/lib/esm/components/DataTable/DataTable.mjs +133 -66
- package/lib/esm/components/Head/Column.mjs +40 -26
- package/lib/esm/components/Head/Group.mjs +43 -32
- package/lib/esm/components/Head/Head.mjs +39 -31
- package/lib/esm/components/Head/style.shadow.css +64 -3
- package/lib/esm/style/scroll-shadows.shadow.css +7 -12
- package/lib/types/components/Body/Body.d.ts +6 -7
- package/lib/types/components/Body/Body.types.d.ts +27 -19
- package/lib/types/components/Body/Cell.types.d.ts +12 -5
- package/lib/types/components/Body/Row.types.d.ts +20 -18
- package/lib/types/components/DataTable/DataTable.d.ts +1 -0
- package/lib/types/components/DataTable/DataTable.types.d.ts +29 -14
- package/lib/types/components/Head/Column.d.ts +3 -3
- package/lib/types/components/Head/Column.types.d.ts +11 -4
- package/lib/types/components/Head/Group.type.d.ts +2 -0
- package/lib/types/components/Head/Head.types.d.ts +12 -8
- package/package.json +22 -22
|
@@ -24,35 +24,37 @@ import { isFocusInside, hasFocusableIn } from '@semcore/core/lib/utils/use/useFo
|
|
|
24
24
|
import { NoData } from '@semcore/widget-empty';
|
|
25
25
|
import * as React from 'react';
|
|
26
26
|
/*!__reshadow-styles__:"./dataTable.shadow.css"*/
|
|
27
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
27
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SDataTable_sw87i_gg_{display:grid;align-items:start;min-width:-moz-fit-content;min-width:fit-content}.___SDataTable_sw87i_gg_.__gridTemplateColumns_sw87i_gg_{grid-template-columns:var(--gridTemplateColumns_sw87i)}.___SDataTable_sw87i_gg_.__gridTemplateAreas_sw87i_gg_{grid-template-areas:var(--gridTemplateAreas_sw87i)}.___SDataTable_sw87i_gg_.__gridTemplateRows_sw87i_gg_{grid-template-rows:var(--gridTemplateRows_sw87i)}", /*__inner_css_end__*/"sw87i_gg_"),
|
|
28
28
|
/*__reshadow_css_end__*/
|
|
29
29
|
{
|
|
30
|
-
"__SDataTable": "
|
|
31
|
-
"_gridTemplateColumns": "
|
|
32
|
-
"--gridTemplateColumns": "--
|
|
33
|
-
"_gridTemplateAreas": "
|
|
34
|
-
"--gridTemplateAreas": "--
|
|
35
|
-
"_gridTemplateRows": "
|
|
36
|
-
"--gridTemplateRows": "--
|
|
30
|
+
"__SDataTable": "___SDataTable_sw87i_gg_",
|
|
31
|
+
"_gridTemplateColumns": "__gridTemplateColumns_sw87i_gg_",
|
|
32
|
+
"--gridTemplateColumns": "--gridTemplateColumns_sw87i",
|
|
33
|
+
"_gridTemplateAreas": "__gridTemplateAreas_sw87i_gg_",
|
|
34
|
+
"--gridTemplateAreas": "--gridTemplateAreas_sw87i",
|
|
35
|
+
"_gridTemplateRows": "__gridTemplateRows_sw87i_gg_",
|
|
36
|
+
"--gridTemplateRows": "--gridTemplateRows_sw87i"
|
|
37
37
|
});
|
|
38
38
|
/*!__reshadow-styles__:"../../style/scroll-shadows.shadow.css"*/
|
|
39
|
-
var scrollStyles = (/*__reshadow_css_start__*/_sstyled2.insert(/*__inner_css_start__*/".
|
|
39
|
+
var scrollStyles = (/*__reshadow_css_start__*/_sstyled2.insert(/*__inner_css_start__*/".___SScrollArea_lhh9n_gg_{width:-moz-fit-content;width:fit-content}.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_{overflow:visible;overflow:initial}.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_._scrollDirection_both_lhh9n_gg_{overflow:auto}.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_._scrollDirection_both_lhh9n_gg_.__loading_lhh9n_gg_,.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_._scrollDirection_horizontal_lhh9n_gg_.__loading_lhh9n_gg_,.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_._scrollDirection_vertical_lhh9n_gg_.__loading_lhh9n_gg_{overflow:hidden}.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_._scrollDirection_horizontal_lhh9n_gg_{overflow-x:auto;overflow-y:initial}.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_._scrollDirection_vertical_lhh9n_gg_{overflow-x:initial;overflow-y:auto}.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_.__headerHeight_lhh9n_gg_{scroll-padding-top:var(--headerHeight_lhh9n)}.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_.__leftScrollPadding_lhh9n_gg_{scroll-padding-left:var(--leftScrollPadding_lhh9n)}.___SScrollArea_lhh9n_gg_ .___SContainer_lhh9n_gg_.__rightScrollPadding_lhh9n_gg_{scroll-padding-right:var(--rightScrollPadding_lhh9n)}.___SScrollArea_lhh9n_gg_ .___SShadowHorizontal_lhh9n_gg_::before,.___SScrollArea_lhh9n_gg_ .___SShadowHorizontal_lhh9n_gg_:after,.___SScrollArea_lhh9n_gg_ .___SShadowVertical_lhh9n_gg_::after{z-index:20}.___SScrollArea_lhh9n_gg_ .___SShadowHorizontal_lhh9n_gg_.__leftOffset_lhh9n_gg_::before,.___SScrollArea_lhh9n_gg_ .___SShadowHorizontal_lhh9n_gg_.__rightOffset_lhh9n_gg_::after,.___SScrollArea_lhh9n_gg_ .___SShadowVertical_lhh9n_gg_::before{display:none}", /*__inner_css_end__*/"lhh9n_gg_"),
|
|
40
40
|
/*__reshadow_css_end__*/
|
|
41
41
|
{
|
|
42
|
-
"__SScrollArea": "
|
|
43
|
-
"__SContainer": "
|
|
44
|
-
"_scrollDirection_both": "
|
|
45
|
-
"_loading": "
|
|
46
|
-
"_scrollDirection_horizontal": "
|
|
47
|
-
"_scrollDirection_vertical": "
|
|
48
|
-
"_headerHeight": "
|
|
49
|
-
"--headerHeight": "--
|
|
50
|
-
"_leftScrollPadding": "
|
|
51
|
-
"--leftScrollPadding": "--
|
|
52
|
-
"_rightScrollPadding": "
|
|
53
|
-
"--rightScrollPadding": "--
|
|
54
|
-
"__SShadowVertical": "
|
|
55
|
-
"__SShadowHorizontal": "
|
|
42
|
+
"__SScrollArea": "___SScrollArea_lhh9n_gg_",
|
|
43
|
+
"__SContainer": "___SContainer_lhh9n_gg_",
|
|
44
|
+
"_scrollDirection_both": "_scrollDirection_both_lhh9n_gg_",
|
|
45
|
+
"_loading": "__loading_lhh9n_gg_",
|
|
46
|
+
"_scrollDirection_horizontal": "_scrollDirection_horizontal_lhh9n_gg_",
|
|
47
|
+
"_scrollDirection_vertical": "_scrollDirection_vertical_lhh9n_gg_",
|
|
48
|
+
"_headerHeight": "__headerHeight_lhh9n_gg_",
|
|
49
|
+
"--headerHeight": "--headerHeight_lhh9n",
|
|
50
|
+
"_leftScrollPadding": "__leftScrollPadding_lhh9n_gg_",
|
|
51
|
+
"--leftScrollPadding": "--leftScrollPadding_lhh9n",
|
|
52
|
+
"_rightScrollPadding": "__rightScrollPadding_lhh9n_gg_",
|
|
53
|
+
"--rightScrollPadding": "--rightScrollPadding_lhh9n",
|
|
54
|
+
"__SShadowVertical": "___SShadowVertical_lhh9n_gg_",
|
|
55
|
+
"__SShadowHorizontal": "___SShadowHorizontal_lhh9n_gg_",
|
|
56
|
+
"_leftOffset": "__leftOffset_lhh9n_gg_",
|
|
57
|
+
"_rightOffset": "__rightOffset_lhh9n_gg_"
|
|
56
58
|
});
|
|
57
59
|
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
58
60
|
import { Body } from '../Body/Body';
|
|
@@ -61,6 +63,7 @@ import { Head } from '../Head/Head';
|
|
|
61
63
|
export var ACCORDION = Symbol('accordion');
|
|
62
64
|
export var ROW_GROUP = Symbol('ROW_GROUP');
|
|
63
65
|
export var UNIQ_ROW_KEY = Symbol('UNIQ_ROW_KEY');
|
|
66
|
+
export var IS_EMPTY_DATA_ROW = Symbol('IS_EMPTY_DATA_ROW');
|
|
64
67
|
export var SELECT_ALL = Symbol('SELECT_ALL');
|
|
65
68
|
export var ROW_INDEX = Symbol('ROW_INDEX');
|
|
66
69
|
var SCROLL_BAR_HEIGHT = 12;
|
|
@@ -72,6 +75,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
72
75
|
_defineProperty(_this, "columns", []);
|
|
73
76
|
_defineProperty(_this, "treeColumns", []);
|
|
74
77
|
_defineProperty(_this, "hasGroups", false);
|
|
78
|
+
_defineProperty(_this, "hasFixedColumn", false);
|
|
75
79
|
_defineProperty(_this, "focusedCell", [-1, -1]);
|
|
76
80
|
_defineProperty(_this, "scrollAreaRef", /*#__PURE__*/React.createRef());
|
|
77
81
|
_defineProperty(_this, "tableContainerRef", /*#__PURE__*/React.createRef());
|
|
@@ -87,11 +91,11 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
87
91
|
_defineProperty(_this, "state", {
|
|
88
92
|
scrollTop: 0,
|
|
89
93
|
scrollDirection: 'down',
|
|
90
|
-
selectAllMessage: ''
|
|
94
|
+
selectAllMessage: '',
|
|
95
|
+
shadowVertical: ''
|
|
91
96
|
});
|
|
92
97
|
_defineProperty(_this, "handleCellClick", function (e, opt) {
|
|
93
98
|
if (lastInteraction.isMouse()) {
|
|
94
|
-
console.log('click on cell in data table handler', opt);
|
|
95
99
|
_this.initFocusableCell([_this.hasFocusableInHeader() ? opt.rowIndex + 1 : opt.rowIndex, opt.colIndex]);
|
|
96
100
|
}
|
|
97
101
|
});
|
|
@@ -137,15 +141,23 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
137
141
|
});
|
|
138
142
|
});
|
|
139
143
|
_defineProperty(_this, "onExpandRow", function (expandedRow) {
|
|
140
|
-
var
|
|
144
|
+
var _this$asProps2 = _this.asProps,
|
|
145
|
+
expandedRows = _this$asProps2.expandedRows,
|
|
146
|
+
onAccordionToggle = _this$asProps2.onAccordionToggle,
|
|
147
|
+
accordionMode = _this$asProps2.accordionMode;
|
|
141
148
|
if (expandedRows.has(expandedRow[UNIQ_ROW_KEY])) {
|
|
142
149
|
expandedRows["delete"](expandedRow[UNIQ_ROW_KEY]);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}, 300);
|
|
150
|
+
_this.handlers.expandedRows(new Set(_toConsumableArray(expandedRows)));
|
|
151
|
+
onAccordionToggle === null || onAccordionToggle === void 0 || onAccordionToggle('close', expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
|
|
146
152
|
} else {
|
|
147
153
|
expandedRows.add(expandedRow[UNIQ_ROW_KEY]);
|
|
148
154
|
_this.handlers.expandedRows(new Set(_toConsumableArray(expandedRows)));
|
|
155
|
+
onAccordionToggle === null || onAccordionToggle === void 0 || onAccordionToggle('open', expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
|
|
156
|
+
if (accordionMode === 'toggle') {
|
|
157
|
+
var rowIndex = expandedRow[ROW_INDEX];
|
|
158
|
+
var colIndex = _this.focusedCell[1];
|
|
159
|
+
_this.initFocusableCell([_this.hasFocusableInHeader() ? rowIndex + 1 : rowIndex, colIndex]);
|
|
160
|
+
}
|
|
149
161
|
}
|
|
150
162
|
});
|
|
151
163
|
_defineProperty(_this, "changeFocusCell", function (rowIndex, colIndex, direction) {
|
|
@@ -253,13 +265,44 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
253
265
|
}
|
|
254
266
|
});
|
|
255
267
|
_defineProperty(_this, "handleScroll", trottle(function (e) {
|
|
256
|
-
|
|
257
|
-
|
|
268
|
+
if (_this.asProps.virtualScroll) {
|
|
269
|
+
var scrollTop = e.target.scrollTop;
|
|
270
|
+
var scrollDirection = scrollTop > _this.state.scrollTop ? 'down' : 'up';
|
|
271
|
+
_this.setState({
|
|
272
|
+
scrollTop: scrollTop,
|
|
273
|
+
scrollDirection: scrollDirection
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
if (_this.hasFixedColumn) {
|
|
277
|
+
_this.calculateVerticalShadow();
|
|
278
|
+
}
|
|
279
|
+
}));
|
|
280
|
+
_defineProperty(_this, "calculateVerticalShadow", function () {
|
|
281
|
+
if (!_this.tableContainerRef.current) return;
|
|
282
|
+
var _this$tableContainerR = _this.tableContainerRef.current,
|
|
283
|
+
scrollWidth = _this$tableContainerR.scrollWidth,
|
|
284
|
+
clientWidth = _this$tableContainerR.clientWidth,
|
|
285
|
+
scrollLeft = _this$tableContainerR.scrollLeft;
|
|
286
|
+
var maxScrollRight = scrollWidth - clientWidth;
|
|
287
|
+
var roundedScroll = Math.round(scrollLeft);
|
|
288
|
+
var roundedMaxScroll = Math.round(maxScrollRight);
|
|
289
|
+
var shadow = '';
|
|
290
|
+
// not scroll
|
|
291
|
+
if (roundedMaxScroll <= 0) {
|
|
292
|
+
// start scroll
|
|
293
|
+
} else if (roundedScroll <= 0) {
|
|
294
|
+
shadow = 'end';
|
|
295
|
+
// end scroll
|
|
296
|
+
} else if (roundedScroll >= roundedMaxScroll) {
|
|
297
|
+
shadow = 'start';
|
|
298
|
+
// median scroll
|
|
299
|
+
} else if (roundedScroll > 0) {
|
|
300
|
+
shadow = 'median';
|
|
301
|
+
}
|
|
258
302
|
_this.setState({
|
|
259
|
-
|
|
260
|
-
scrollDirection: scrollDirection
|
|
303
|
+
shadowVertical: shadow
|
|
261
304
|
});
|
|
262
|
-
})
|
|
305
|
+
});
|
|
263
306
|
_defineProperty(_this, "handleFocus", function (e) {
|
|
264
307
|
if (_this.asProps.loading) {
|
|
265
308
|
var _this$spinnerRef$curr;
|
|
@@ -404,25 +447,23 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
404
447
|
key: "componentDidMount",
|
|
405
448
|
value: function componentDidMount() {
|
|
406
449
|
var _this2 = this;
|
|
407
|
-
var _this$
|
|
408
|
-
headerProps = _this$
|
|
409
|
-
loading = _this$
|
|
410
|
-
|
|
411
|
-
if (headerProps !== null && headerProps !== void 0 && headerProps.sticky && !headerProps.h || loading || this.columns.some(function (c) {
|
|
412
|
-
return c.fixed;
|
|
413
|
-
})) {
|
|
450
|
+
var _this$asProps3 = this.asProps,
|
|
451
|
+
headerProps = _this$asProps3.headerProps,
|
|
452
|
+
loading = _this$asProps3.loading;
|
|
453
|
+
if (headerProps !== null && headerProps !== void 0 && headerProps.sticky && !headerProps.h || loading || this.hasFixedColumn) {
|
|
414
454
|
requestAnimationFrame(function () {
|
|
415
455
|
_this2.forceUpdate();
|
|
456
|
+
_this2.calculateVerticalShadow();
|
|
416
457
|
});
|
|
417
458
|
}
|
|
418
459
|
}
|
|
419
460
|
}, {
|
|
420
461
|
key: "componentDidUpdate",
|
|
421
462
|
value: function componentDidUpdate(prevProps) {
|
|
422
|
-
var _this$
|
|
423
|
-
data = _this$
|
|
424
|
-
selectedRows = _this$
|
|
425
|
-
columns = _this$
|
|
463
|
+
var _this$asProps4 = this.asProps,
|
|
464
|
+
data = _this$asProps4.data,
|
|
465
|
+
selectedRows = _this$asProps4.selectedRows,
|
|
466
|
+
columns = _this$asProps4.columns;
|
|
426
467
|
if (prevProps.columns !== columns) {
|
|
427
468
|
var cols = this.calculateColumnsFromConfig();
|
|
428
469
|
this.columns = cols[0];
|
|
@@ -432,6 +473,9 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
432
473
|
this.rows = this.calculateRows();
|
|
433
474
|
this.flatRows = this.rows.flat();
|
|
434
475
|
this.forceUpdate();
|
|
476
|
+
if (this.hasFixedColumn) {
|
|
477
|
+
this.calculateVerticalShadow();
|
|
478
|
+
}
|
|
435
479
|
}
|
|
436
480
|
if (prevProps.selectedRows !== selectedRows && selectedRows !== undefined) {
|
|
437
481
|
if (prevProps.selectedRows.length < data.length && selectedRows.length === data.length) {
|
|
@@ -444,9 +488,9 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
444
488
|
}, {
|
|
445
489
|
key: "totalRows",
|
|
446
490
|
get: function get() {
|
|
447
|
-
var _this$
|
|
448
|
-
totalRows = _this$
|
|
449
|
-
expandedRows = _this$
|
|
491
|
+
var _this$asProps5 = this.asProps,
|
|
492
|
+
totalRows = _this$asProps5.totalRows,
|
|
493
|
+
expandedRows = _this$asProps5.expandedRows;
|
|
450
494
|
var flatRows = this.rows.flat();
|
|
451
495
|
var expandedRowsCount = Array.from(expandedRows !== null && expandedRows !== void 0 ? expandedRows : []).reduce(function (acc, rowKey) {
|
|
452
496
|
var dtRow = flatRows.find(function (el) {
|
|
@@ -493,21 +537,22 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
493
537
|
key: "getHeadProps",
|
|
494
538
|
value: function getHeadProps() {
|
|
495
539
|
var _this3 = this;
|
|
496
|
-
var _this$
|
|
497
|
-
use = _this$
|
|
498
|
-
compact = _this$
|
|
499
|
-
sort = _this$
|
|
500
|
-
onSortChange = _this$
|
|
501
|
-
getI18nText = _this$
|
|
502
|
-
uid = _this$
|
|
503
|
-
headerProps = _this$
|
|
504
|
-
onSelectedRowsChange = _this$
|
|
505
|
-
selectedRows = _this$
|
|
506
|
-
sideIndents = _this$
|
|
540
|
+
var _this$asProps6 = this.asProps,
|
|
541
|
+
use = _this$asProps6.use,
|
|
542
|
+
compact = _this$asProps6.compact,
|
|
543
|
+
sort = _this$asProps6.sort,
|
|
544
|
+
onSortChange = _this$asProps6.onSortChange,
|
|
545
|
+
getI18nText = _this$asProps6.getI18nText,
|
|
546
|
+
uid = _this$asProps6.uid,
|
|
547
|
+
headerProps = _this$asProps6.headerProps,
|
|
548
|
+
onSelectedRowsChange = _this$asProps6.onSelectedRowsChange,
|
|
549
|
+
selectedRows = _this$asProps6.selectedRows,
|
|
550
|
+
sideIndents = _this$asProps6.sideIndents;
|
|
507
551
|
var _this$gridSettings = this.gridSettings,
|
|
508
552
|
gridTemplateColumns = _this$gridSettings.gridTemplateColumns,
|
|
509
553
|
gridTemplateAreas = _this$gridSettings.gridTemplateAreas;
|
|
510
|
-
|
|
554
|
+
var shadowVertical = this.state.shadowVertical;
|
|
555
|
+
return _objectSpread(_objectSpread({}, headerProps), {}, {
|
|
511
556
|
columns: this.columns,
|
|
512
557
|
treeColumns: this.treeColumns,
|
|
513
558
|
use: use,
|
|
@@ -517,7 +562,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
517
562
|
onSortChange: onSortChange,
|
|
518
563
|
getI18nText: getI18nText,
|
|
519
564
|
uid: uid,
|
|
520
|
-
ref: this.headerRef,
|
|
565
|
+
ref: headerProps !== null && headerProps !== void 0 && headerProps.ref ? forkRef(this.headerRef, headerProps.ref) : this.headerRef,
|
|
521
566
|
gridAreaGroupMap: this.gridAreaGroupMap,
|
|
522
567
|
gridTemplateColumns: gridTemplateColumns,
|
|
523
568
|
gridTemplateAreas: gridTemplateAreas,
|
|
@@ -538,32 +583,38 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
538
583
|
onSelectedRowsChange === null || onSelectedRowsChange === void 0 || onSelectedRowsChange(Array.from(selectedRowsSet), e);
|
|
539
584
|
},
|
|
540
585
|
getFixedStyle: this.getFixedStyle,
|
|
541
|
-
onCellClick: this.handleCellClick
|
|
542
|
-
|
|
586
|
+
onCellClick: this.handleCellClick,
|
|
587
|
+
shadowVertical: shadowVertical
|
|
588
|
+
});
|
|
543
589
|
}
|
|
544
590
|
}, {
|
|
545
591
|
key: "getBodyProps",
|
|
546
592
|
value: function getBodyProps() {
|
|
547
|
-
var _this$
|
|
548
|
-
use = _this$
|
|
549
|
-
compact = _this$
|
|
550
|
-
loading = _this$
|
|
551
|
-
getI18nText = _this$
|
|
552
|
-
expandedRows = _this$
|
|
553
|
-
virtualScroll = _this$
|
|
554
|
-
uid = _this$
|
|
555
|
-
rowProps = _this$
|
|
556
|
-
renderCell = _this$
|
|
557
|
-
headerProps = _this$
|
|
558
|
-
renderEmptyData = _this$
|
|
559
|
-
sideIndents = _this$
|
|
560
|
-
selectedRows = _this$
|
|
561
|
-
accordionDuration = _this$
|
|
593
|
+
var _this$asProps7 = this.asProps,
|
|
594
|
+
use = _this$asProps7.use,
|
|
595
|
+
compact = _this$asProps7.compact,
|
|
596
|
+
loading = _this$asProps7.loading,
|
|
597
|
+
getI18nText = _this$asProps7.getI18nText,
|
|
598
|
+
expandedRows = _this$asProps7.expandedRows,
|
|
599
|
+
virtualScroll = _this$asProps7.virtualScroll,
|
|
600
|
+
uid = _this$asProps7.uid,
|
|
601
|
+
rowProps = _this$asProps7.rowProps,
|
|
602
|
+
renderCell = _this$asProps7.renderCell,
|
|
603
|
+
headerProps = _this$asProps7.headerProps,
|
|
604
|
+
renderEmptyData = _this$asProps7.renderEmptyData,
|
|
605
|
+
sideIndents = _this$asProps7.sideIndents,
|
|
606
|
+
selectedRows = _this$asProps7.selectedRows,
|
|
607
|
+
accordionDuration = _this$asProps7.accordionDuration,
|
|
608
|
+
accordionMode = _this$asProps7.accordionMode,
|
|
609
|
+
rawData = _this$asProps7.data,
|
|
610
|
+
renderCellOverlay = _this$asProps7.renderCellOverlay;
|
|
562
611
|
var _this$gridSettings2 = this.gridSettings,
|
|
563
612
|
gridTemplateColumns = _this$gridSettings2.gridTemplateColumns,
|
|
564
613
|
gridTemplateAreas = _this$gridSettings2.gridTemplateAreas;
|
|
614
|
+
var shadowVertical = this.state.shadowVertical;
|
|
565
615
|
return {
|
|
566
616
|
accordionDuration: accordionDuration,
|
|
617
|
+
accordionMode: accordionMode,
|
|
567
618
|
columns: this.columns,
|
|
568
619
|
rows: this.rows,
|
|
569
620
|
flatRows: this.flatRows,
|
|
@@ -587,14 +638,17 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
587
638
|
virtualScroll: virtualScroll,
|
|
588
639
|
hasGroups: this.hasGroups,
|
|
589
640
|
uid: uid,
|
|
590
|
-
rowProps: rowProps,
|
|
591
|
-
renderCell: renderCell,
|
|
641
|
+
rowProps: this.rows.length > 0 ? rowProps : undefined,
|
|
642
|
+
renderCell: this.rows.length > 0 ? renderCell : undefined,
|
|
592
643
|
renderEmptyData: renderEmptyData,
|
|
593
644
|
sideIndents: sideIndents,
|
|
594
645
|
selectedRows: selectedRows,
|
|
595
646
|
onSelectRow: this.handleSelectRow,
|
|
596
647
|
getFixedStyle: this.getFixedStyle,
|
|
597
|
-
onCellClick: this.handleCellClick
|
|
648
|
+
onCellClick: this.handleCellClick,
|
|
649
|
+
rawData: rawData,
|
|
650
|
+
shadowVertical: shadowVertical,
|
|
651
|
+
renderCellOverlay: renderCellOverlay
|
|
598
652
|
};
|
|
599
653
|
}
|
|
600
654
|
}, {
|
|
@@ -629,20 +683,20 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
629
683
|
var _ref = this.asProps,
|
|
630
684
|
_ref2;
|
|
631
685
|
var SDataTable = Box;
|
|
632
|
-
var _this$
|
|
633
|
-
Children = _this$
|
|
634
|
-
styles = _this$
|
|
635
|
-
w = _this$
|
|
636
|
-
wMax = _this$
|
|
637
|
-
wMin = _this$
|
|
638
|
-
h = _this$
|
|
639
|
-
hMax = _this$
|
|
640
|
-
hMin = _this$
|
|
641
|
-
virtualScroll = _this$
|
|
642
|
-
children = _this$
|
|
643
|
-
headerProps = _this$
|
|
644
|
-
loading = _this$
|
|
645
|
-
selectedRows = _this$
|
|
686
|
+
var _this$asProps8 = this.asProps,
|
|
687
|
+
Children = _this$asProps8.Children,
|
|
688
|
+
styles = _this$asProps8.styles,
|
|
689
|
+
w = _this$asProps8.w,
|
|
690
|
+
wMax = _this$asProps8.wMax,
|
|
691
|
+
wMin = _this$asProps8.wMin,
|
|
692
|
+
h = _this$asProps8.h,
|
|
693
|
+
hMax = _this$asProps8.hMax,
|
|
694
|
+
hMin = _this$asProps8.hMin,
|
|
695
|
+
virtualScroll = _this$asProps8.virtualScroll,
|
|
696
|
+
children = _this$asProps8.children,
|
|
697
|
+
headerProps = _this$asProps8.headerProps,
|
|
698
|
+
loading = _this$asProps8.loading,
|
|
699
|
+
selectedRows = _this$asProps8.selectedRows;
|
|
646
700
|
var _this$getScrollOffset = this.getScrollOffsetValue(),
|
|
647
701
|
_this$getScrollOffset2 = _slicedToArray(_this$getScrollOffset, 2),
|
|
648
702
|
offsetLeftSum = _this$getScrollOffset2[0],
|
|
@@ -685,7 +739,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
685
739
|
"ref": this.scrollAreaRef,
|
|
686
740
|
"container": this.tableContainerRef,
|
|
687
741
|
"styles": scrollStyles,
|
|
688
|
-
"onScroll":
|
|
742
|
+
"onScroll": this.handleScroll,
|
|
689
743
|
"disableAutofocusToContent": true
|
|
690
744
|
}), /*#__PURE__*/React.createElement(ScrollArea.Container, {
|
|
691
745
|
tabIndex: -1
|
|
@@ -722,13 +776,13 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
722
776
|
}, _ref))), children ? /*#__PURE__*/React.createElement(Children, _ref2.cn("Children", {})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DataTableInternal.Head, null), /*#__PURE__*/React.createElement(DataTableInternal.Body, null)))), (headerPropsToCheck === null || headerPropsToCheck === void 0 ? void 0 : headerPropsToCheck.withScrollBar) && topOffset && !loading && /*#__PURE__*/React.createElement(ScrollArea.Bar, {
|
|
723
777
|
orientation: "horizontal",
|
|
724
778
|
top: topOffset - SCROLL_BAR_HEIGHT,
|
|
725
|
-
zIndex:
|
|
779
|
+
zIndex: 20
|
|
726
780
|
}), !loading && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ScrollArea.Bar, {
|
|
727
781
|
orientation: "horizontal",
|
|
728
|
-
zIndex:
|
|
782
|
+
zIndex: 20
|
|
729
783
|
}), /*#__PURE__*/React.createElement(ScrollArea.Bar, {
|
|
730
784
|
orientation: "vertical",
|
|
731
|
-
zIndex:
|
|
785
|
+
zIndex: 20
|
|
732
786
|
})), selectedRows !== undefined && /*#__PURE__*/React.createElement(ScreenReaderOnly, _ref2.cn("ScreenReaderOnly", {
|
|
733
787
|
"aria-live": 'polite',
|
|
734
788
|
"role": 'status'
|
|
@@ -751,7 +805,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
751
805
|
if (selectedRows) {
|
|
752
806
|
var column = {
|
|
753
807
|
name: SELECT_ALL.toString(),
|
|
754
|
-
gtcWidth: '
|
|
808
|
+
gtcWidth: 'min-content',
|
|
755
809
|
alignItems: 'flex-start',
|
|
756
810
|
children: ''
|
|
757
811
|
};
|
|
@@ -771,6 +825,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
771
825
|
alignItems: columnElement.props.alignItems,
|
|
772
826
|
alignContent: columnElement.props.alignContent,
|
|
773
827
|
justifyContent: columnElement.props.justifyContent,
|
|
828
|
+
textAlign: columnElement.props.textAlign,
|
|
774
829
|
children: ''
|
|
775
830
|
};
|
|
776
831
|
return column;
|
|
@@ -825,7 +880,9 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
825
880
|
data = _this$props2.data,
|
|
826
881
|
selectedRows = _this$props2.selectedRows;
|
|
827
882
|
this.hasGroups = columns.some(function (column) {
|
|
828
|
-
return 'columns' in column
|
|
883
|
+
return 'columns' in column && column.columns.some(function (col) {
|
|
884
|
+
return col.children !== null;
|
|
885
|
+
});
|
|
829
886
|
});
|
|
830
887
|
var groupIndex = 0;
|
|
831
888
|
var gridColumnIndex = selectedRows ? 2 : 1;
|
|
@@ -835,23 +892,26 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
835
892
|
if (selectedRows) {
|
|
836
893
|
var column = {
|
|
837
894
|
name: SELECT_ALL.toString(),
|
|
838
|
-
gtcWidth: '
|
|
895
|
+
gtcWidth: 'min-content',
|
|
839
896
|
alignItems: 'flex-start',
|
|
840
897
|
children: ''
|
|
841
898
|
};
|
|
842
899
|
calculatedColumns.push(column);
|
|
843
900
|
}
|
|
844
|
-
var makeColumn = function makeColumn(columnElement, parent, isFirst, isLast) {
|
|
901
|
+
var makeColumn = function makeColumn(columnElement, parent, isFirst, isLast, hasGroups) {
|
|
845
902
|
var _columnElement$fixed, _ref4, _columnElement$border;
|
|
846
903
|
var leftBordersFromParent = isFirst && ((parent === null || parent === void 0 ? void 0 : parent.borders) === 'both' || (parent === null || parent === void 0 ? void 0 : parent.borders) === 'left') ? 'left' : undefined;
|
|
847
904
|
var rightBordersFromParent = isLast && ((parent === null || parent === void 0 ? void 0 : parent.borders) === 'both' || (parent === null || parent === void 0 ? void 0 : parent.borders) === 'right') ? 'right' : undefined;
|
|
848
905
|
var column = _objectSpread(_objectSpread({}, columnElement), {}, {
|
|
849
906
|
name: childIsColumn(columnElement) ? columnElement.name : '',
|
|
850
907
|
gtcWidth: childIsColumn(columnElement) ? calculateGridTemplateColumn(columnElement) : '',
|
|
851
|
-
fixed: (_columnElement$fixed = columnElement.fixed) !== null && _columnElement$fixed !== void 0 ? _columnElement$fixed : parent === null || parent === void 0 ? void 0 : parent.fixed,
|
|
908
|
+
fixed: (_columnElement$fixed = columnElement.fixed) !== null && _columnElement$fixed !== void 0 ? _columnElement$fixed : hasGroups ? parent === null || parent === void 0 ? void 0 : parent.fixed : undefined,
|
|
852
909
|
borders: (_ref4 = (_columnElement$border = columnElement.borders) !== null && _columnElement$border !== void 0 ? _columnElement$border : leftBordersFromParent) !== null && _ref4 !== void 0 ? _ref4 : rightBordersFromParent,
|
|
853
910
|
parent: parent
|
|
854
911
|
});
|
|
912
|
+
if (column.fixed) {
|
|
913
|
+
_this5.hasFixedColumn = true;
|
|
914
|
+
}
|
|
855
915
|
return column;
|
|
856
916
|
};
|
|
857
917
|
var childIsColumn = function childIsColumn(child) {
|
|
@@ -860,6 +920,17 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
860
920
|
var childIsGroup = function childIsGroup(child) {
|
|
861
921
|
return 'columns' in child;
|
|
862
922
|
};
|
|
923
|
+
var setShowShadows = function setShowShadows(col, i) {
|
|
924
|
+
var prevCol = treeColumns[i - 1];
|
|
925
|
+
if ('columns' in prevCol && prevCol.columns) {
|
|
926
|
+
prevCol = prevCol.columns[prevCol.columns.length - 1];
|
|
927
|
+
}
|
|
928
|
+
if (prevCol.fixed && !col.fixed) {
|
|
929
|
+
prevCol.showShadowVertical = true;
|
|
930
|
+
} else if (!prevCol.fixed && col.fixed) {
|
|
931
|
+
col.showShadowVertical = true;
|
|
932
|
+
}
|
|
933
|
+
};
|
|
863
934
|
columns.forEach(function (child, i) {
|
|
864
935
|
if (childIsColumn(child)) {
|
|
865
936
|
var col = makeColumn(child);
|
|
@@ -867,28 +938,35 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
867
938
|
gridColumnIndex++;
|
|
868
939
|
calculatedColumns.push(col);
|
|
869
940
|
treeColumns.push(col);
|
|
941
|
+
if (i > 0) {
|
|
942
|
+
setShowShadows(col, i);
|
|
943
|
+
}
|
|
870
944
|
} else if (childIsGroup(child)) {
|
|
871
945
|
var Group = makeColumn(child);
|
|
872
946
|
var childCount = child.columns.length;
|
|
873
947
|
var initGridColumn = gridColumnIndex;
|
|
948
|
+
var groupedRow = _this5.hasGroups ? 2 : 1;
|
|
874
949
|
Group.columns = [];
|
|
875
950
|
Group.children = child.children;
|
|
876
951
|
child.columns.forEach(function (child, j) {
|
|
877
952
|
var _Group$columns;
|
|
878
953
|
var isFirst = j === 0;
|
|
879
954
|
var isLast = j === childCount - 1;
|
|
880
|
-
var col = makeColumn(child, Group, isFirst, isLast);
|
|
955
|
+
var col = makeColumn(child, Group, isFirst, isLast, _this5.hasGroups);
|
|
881
956
|
if (i === 0 && j === 0 && data.some(function (d) {
|
|
882
957
|
return d[ACCORDION];
|
|
883
958
|
})) {
|
|
884
959
|
gridColumnIndex++;
|
|
885
|
-
col.gridArea = "
|
|
960
|
+
col.gridArea = "".concat(groupedRow, " / ").concat(gridColumnIndex - 1, " / ").concat(groupedRow + 1, " / ").concat(gridColumnIndex + 1);
|
|
886
961
|
} else {
|
|
887
|
-
col.gridArea = "
|
|
962
|
+
col.gridArea = "".concat(groupedRow, " / ").concat(gridColumnIndex, " / ").concat(groupedRow + 1, " / ").concat(gridColumnIndex + 1);
|
|
888
963
|
}
|
|
889
|
-
col.gridArea = "
|
|
964
|
+
col.gridArea = "".concat(groupedRow, " / ").concat(gridColumnIndex, " / ").concat(groupedRow + 1, " / ").concat(gridColumnIndex + 1);
|
|
890
965
|
gridColumnIndex++;
|
|
891
966
|
calculatedColumns.push(col);
|
|
967
|
+
if (isFirst && i > 0) {
|
|
968
|
+
setShowShadows(col, i);
|
|
969
|
+
}
|
|
892
970
|
(_Group$columns = Group.columns) === null || _Group$columns === void 0 || _Group$columns.push(col);
|
|
893
971
|
});
|
|
894
972
|
treeColumns.push(Group);
|
|
@@ -896,6 +974,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
896
974
|
groupIndex++;
|
|
897
975
|
}
|
|
898
976
|
});
|
|
977
|
+
console.log(calculatedColumns, treeColumns);
|
|
899
978
|
return [calculatedColumns, treeColumns];
|
|
900
979
|
}
|
|
901
980
|
}, {
|