@semcore/data-table 16.5.3 → 16.6.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 +14 -0
- package/lib/cjs/components/AccordionRows/AccordionRows.js +51 -51
- package/lib/cjs/components/Body/Body.js +71 -88
- 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 +51 -51
- package/lib/cjs/components/Body/LimitOverlay.js +51 -51
- package/lib/cjs/components/Body/LimitOverlay.js.map +1 -1
- package/lib/cjs/components/Body/Row.js +130 -157
- 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/RowGroup.js +147 -0
- package/lib/cjs/components/Body/RowGroup.js.map +1 -0
- package/lib/cjs/components/Body/style.shadow.css +13 -4
- package/lib/cjs/components/DataTable/DataTable.js +122 -102
- 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 +50 -47
- package/lib/cjs/components/Head/Column.js.map +1 -1
- package/lib/cjs/components/Head/Group.js +36 -36
- package/lib/cjs/components/Head/Head.js +90 -57
- 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/RowSelector/RowsSelector.js +124 -0
- package/lib/cjs/components/RowSelector/RowsSelector.js.map +1 -0
- package/lib/cjs/index.js +7 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/store/SelectableRows.js +210 -0
- package/lib/cjs/store/SelectableRows.js.map +1 -0
- package/lib/es6/components/AccordionRows/AccordionRows.js +51 -51
- package/lib/es6/components/Body/Body.js +73 -90
- 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 +51 -51
- package/lib/es6/components/Body/LimitOverlay.js +51 -51
- package/lib/es6/components/Body/LimitOverlay.js.map +1 -1
- package/lib/es6/components/Body/Row.js +131 -158
- 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/RowGroup.js +140 -0
- package/lib/es6/components/Body/RowGroup.js.map +1 -0
- package/lib/es6/components/Body/style.shadow.css +13 -4
- package/lib/es6/components/DataTable/DataTable.js +122 -102
- 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 +50 -47
- package/lib/es6/components/Head/Column.js.map +1 -1
- package/lib/es6/components/Head/Group.js +36 -36
- package/lib/es6/components/Head/Head.js +90 -57
- 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/RowSelector/RowsSelector.js +117 -0
- package/lib/es6/components/RowSelector/RowsSelector.js.map +1 -0
- package/lib/es6/index.js +2 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/store/SelectableRows.js +203 -0
- package/lib/es6/store/SelectableRows.js.map +1 -0
- package/lib/esm/components/AccordionRows/AccordionRows.mjs +52 -52
- package/lib/esm/components/Body/Body.mjs +74 -90
- package/lib/esm/components/Body/Cell.mjs +52 -52
- package/lib/esm/components/Body/LimitOverlay.mjs +52 -52
- package/lib/esm/components/Body/Row.mjs +71 -91
- package/lib/esm/components/Body/RowGroup.mjs +133 -0
- package/lib/esm/components/Body/style.shadow.css +13 -4
- package/lib/esm/components/DataTable/DataTable.mjs +68 -47
- package/lib/esm/components/Head/Column.mjs +51 -48
- package/lib/esm/components/Head/Group.mjs +37 -37
- package/lib/esm/components/Head/Head.mjs +91 -56
- package/lib/esm/components/RowSelector/RowsSelector.mjs +98 -0
- package/lib/esm/index.mjs +2 -0
- package/lib/esm/store/SelectableRows.mjs +200 -0
- package/lib/types/components/Body/Body.types.d.ts +2 -1
- package/lib/types/components/Body/Row.d.ts +0 -2
- package/lib/types/components/Body/Row.types.d.ts +2 -1
- package/lib/types/components/Body/RowGroup.d.ts +19 -0
- package/lib/types/components/DataTable/DataTable.types.d.ts +21 -12
- package/lib/types/components/Head/Column.d.ts +1 -0
- package/lib/types/components/Head/Head.types.d.ts +2 -1
- package/lib/types/components/RowSelector/RowsSelector.d.ts +31 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/store/SelectableRows.d.ts +51 -0
- package/package.json +9 -9
|
@@ -23,38 +23,39 @@ import { isFocusInside, hasFocusableIn } from '@semcore/core/lib/utils/use/useFo
|
|
|
23
23
|
import { NoData } from '@semcore/widget-empty';
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
/*!__reshadow-styles__:"./dataTable.shadow.css"*/
|
|
26
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
26
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SDataTable_hxi9n_gg_{display:grid;align-items:start;min-width:-moz-fit-content;min-width:fit-content;grid-auto-rows:min-content}.___SDataTable_hxi9n_gg_.__isDataEmpty_hxi9n_gg_{display:block;align-items:initial;min-width:initial}.___SDataTable_hxi9n_gg_.__gridTemplateColumns_hxi9n_gg_{grid-template-columns:var(--gridTemplateColumns_hxi9n)}.___SDataTable_hxi9n_gg_.__gridTemplateAreas_hxi9n_gg_{grid-template-areas:var(--gridTemplateAreas_hxi9n)}.___SDataTable_hxi9n_gg_.__gridTemplateRows_hxi9n_gg_{grid-template-rows:var(--gridTemplateRows_hxi9n)}", /*__inner_css_end__*/"hxi9n_gg_"),
|
|
27
27
|
/*__reshadow_css_end__*/
|
|
28
28
|
{
|
|
29
|
-
"__SDataTable": "
|
|
30
|
-
"_isDataEmpty": "
|
|
31
|
-
"_gridTemplateColumns": "
|
|
32
|
-
"--gridTemplateColumns": "--
|
|
33
|
-
"_gridTemplateAreas": "
|
|
34
|
-
"--gridTemplateAreas": "--
|
|
35
|
-
"_gridTemplateRows": "
|
|
36
|
-
"--gridTemplateRows": "--
|
|
29
|
+
"__SDataTable": "___SDataTable_hxi9n_gg_",
|
|
30
|
+
"_isDataEmpty": "__isDataEmpty_hxi9n_gg_",
|
|
31
|
+
"_gridTemplateColumns": "__gridTemplateColumns_hxi9n_gg_",
|
|
32
|
+
"--gridTemplateColumns": "--gridTemplateColumns_hxi9n",
|
|
33
|
+
"_gridTemplateAreas": "__gridTemplateAreas_hxi9n_gg_",
|
|
34
|
+
"--gridTemplateAreas": "--gridTemplateAreas_hxi9n",
|
|
35
|
+
"_gridTemplateRows": "__gridTemplateRows_hxi9n_gg_",
|
|
36
|
+
"--gridTemplateRows": "--gridTemplateRows_hxi9n"
|
|
37
37
|
});
|
|
38
|
+
import { SelectableRows } from '../../store/SelectableRows';
|
|
38
39
|
/*!__reshadow-styles__:"../../style/scroll-shadows.shadow.css"*/
|
|
39
|
-
var scrollStyles = (/*__reshadow_css_start__*/_sstyled2.insert(/*__inner_css_start__*/".
|
|
40
|
+
var scrollStyles = (/*__reshadow_css_start__*/_sstyled2.insert(/*__inner_css_start__*/".___SScrollArea_70deb_gg_{width:-moz-fit-content;width:fit-content}.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_{overflow:visible;overflow:initial}.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_._scrollDirection_both_70deb_gg_{overflow:auto}.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_._scrollDirection_both_70deb_gg_.__loading_70deb_gg_,.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_._scrollDirection_horizontal_70deb_gg_.__loading_70deb_gg_,.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_._scrollDirection_vertical_70deb_gg_.__loading_70deb_gg_{overflow:hidden}.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_._scrollDirection_horizontal_70deb_gg_{overflow-x:auto;overflow-y:initial}.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_._scrollDirection_vertical_70deb_gg_{overflow-x:initial;overflow-y:auto}.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_.__headerHeight_70deb_gg_{scroll-padding-top:var(--headerHeight_70deb)}.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_.__leftScrollPadding_70deb_gg_{scroll-padding-left:var(--leftScrollPadding_70deb)}.___SScrollArea_70deb_gg_ .___SContainer_70deb_gg_.__rightScrollPadding_70deb_gg_{scroll-padding-right:var(--rightScrollPadding_70deb)}.___SScrollArea_70deb_gg_ .___SShadowHorizontal_70deb_gg_::before,.___SScrollArea_70deb_gg_ .___SShadowHorizontal_70deb_gg_:after,.___SScrollArea_70deb_gg_ .___SShadowVertical_70deb_gg_::after{z-index:20}.___SScrollArea_70deb_gg_ .___SShadowHorizontal_70deb_gg_.__leftOffset_70deb_gg_::before,.___SScrollArea_70deb_gg_ .___SShadowHorizontal_70deb_gg_.__rightOffset_70deb_gg_::after,.___SScrollArea_70deb_gg_ .___SShadowVertical_70deb_gg_::before{display:none}", /*__inner_css_end__*/"70deb_gg_"),
|
|
40
41
|
/*__reshadow_css_end__*/
|
|
41
42
|
{
|
|
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": "
|
|
56
|
-
"_leftOffset": "
|
|
57
|
-
"_rightOffset": "
|
|
43
|
+
"__SScrollArea": "___SScrollArea_70deb_gg_",
|
|
44
|
+
"__SContainer": "___SContainer_70deb_gg_",
|
|
45
|
+
"_scrollDirection_both": "_scrollDirection_both_70deb_gg_",
|
|
46
|
+
"_loading": "__loading_70deb_gg_",
|
|
47
|
+
"_scrollDirection_horizontal": "_scrollDirection_horizontal_70deb_gg_",
|
|
48
|
+
"_scrollDirection_vertical": "_scrollDirection_vertical_70deb_gg_",
|
|
49
|
+
"_headerHeight": "__headerHeight_70deb_gg_",
|
|
50
|
+
"--headerHeight": "--headerHeight_70deb",
|
|
51
|
+
"_leftScrollPadding": "__leftScrollPadding_70deb_gg_",
|
|
52
|
+
"--leftScrollPadding": "--leftScrollPadding_70deb",
|
|
53
|
+
"_rightScrollPadding": "__rightScrollPadding_70deb_gg_",
|
|
54
|
+
"--rightScrollPadding": "--rightScrollPadding_70deb",
|
|
55
|
+
"__SShadowVertical": "___SShadowVertical_70deb_gg_",
|
|
56
|
+
"__SShadowHorizontal": "___SShadowHorizontal_70deb_gg_",
|
|
57
|
+
"_leftOffset": "__leftOffset_70deb_gg_",
|
|
58
|
+
"_rightOffset": "__rightOffset_70deb_gg_"
|
|
58
59
|
});
|
|
59
60
|
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
60
61
|
import { Body } from '../Body/Body';
|
|
@@ -95,7 +96,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
95
96
|
});
|
|
96
97
|
_defineProperty(_this, "selectAllMessageTimer", 0);
|
|
97
98
|
_defineProperty(_this, "headerNodesMap", new Map());
|
|
98
|
-
_defineProperty(_this, "
|
|
99
|
+
_defineProperty(_this, "selectedRowsContainer", void 0);
|
|
99
100
|
_defineProperty(_this, "lastSelectedRowKey", void 0);
|
|
100
101
|
_defineProperty(_this, "state", {
|
|
101
102
|
scrollTop: 0,
|
|
@@ -140,13 +141,16 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
140
141
|
_this.initFocusableCell([_this.hasFocusableInHeader() ? opt.rowIndex + 1 : opt.rowIndex, opt.colIndex]);
|
|
141
142
|
}
|
|
142
143
|
});
|
|
144
|
+
_defineProperty(_this, "handleSelectAllRows", function (selectedRows, event) {
|
|
145
|
+
if (!('onSelectedRowsChange' in _this.asProps) || !_this.asProps.onSelectedRowsChange || !Array.isArray(selectedRows)) return;
|
|
146
|
+
_this.asProps.onSelectedRowsChange(selectedRows, event);
|
|
147
|
+
});
|
|
143
148
|
_defineProperty(_this, "handleSelectRow", function (isSelected, selectedRowIndex, row, event) {
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (!selectedRows || !onSelectedRowsChange) return;
|
|
149
|
+
var selectedRows = _this.asProps.selectedRows;
|
|
150
|
+
if (!selectedRows || !('onSelectedRowsChange' in _this.asProps) || !_this.asProps.onSelectedRowsChange || !Array.isArray(selectedRows)) return;
|
|
151
|
+
var onSelectedRowsChange = _this.asProps.onSelectedRowsChange;
|
|
148
152
|
var selectedRowsSet = new Set(selectedRows);
|
|
149
|
-
if (_this.isPressedShift && selectedRowsSet.size > 0 && _this.lastSelectedRowKey && (isSelected ? selectedRowsSet.has(_this.lastSelectedRowKey) : true)) {
|
|
153
|
+
if (_this.selectedRowsContainer.isPressedShift && selectedRowsSet.size > 0 && _this.lastSelectedRowKey && (isSelected ? selectedRowsSet.has(_this.lastSelectedRowKey) : true)) {
|
|
150
154
|
var select = false;
|
|
151
155
|
var firstColumnKey = _this.columns[0].name;
|
|
152
156
|
var isMerged = _this.flatRows.some(function (item) {
|
|
@@ -222,9 +226,9 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
222
226
|
});
|
|
223
227
|
});
|
|
224
228
|
_defineProperty(_this, "onExpandRow", function (expandedRow) {
|
|
225
|
-
var _this$
|
|
226
|
-
onAccordionToggle = _this$
|
|
227
|
-
accordionMode = _this$
|
|
229
|
+
var _this$asProps = _this.asProps,
|
|
230
|
+
onAccordionToggle = _this$asProps.onAccordionToggle,
|
|
231
|
+
accordionMode = _this$asProps.accordionMode;
|
|
228
232
|
var expandedRows = _this.state.expandedRows;
|
|
229
233
|
if (expandedRows.has(expandedRow[UNIQ_ROW_KEY])) {
|
|
230
234
|
expandedRows["delete"](expandedRow[UNIQ_ROW_KEY]);
|
|
@@ -369,13 +373,13 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
369
373
|
}
|
|
370
374
|
case 'Shift':
|
|
371
375
|
{
|
|
372
|
-
_this.isPressedShift = true;
|
|
376
|
+
_this.selectedRowsContainer.isPressedShift = true;
|
|
373
377
|
}
|
|
374
378
|
}
|
|
375
379
|
});
|
|
376
380
|
_defineProperty(_this, "handleKeyUp", function (e) {
|
|
377
381
|
if (e.key === 'Shift') {
|
|
378
|
-
_this.isPressedShift = false;
|
|
382
|
+
_this.selectedRowsContainer.isPressedShift = false;
|
|
379
383
|
}
|
|
380
384
|
});
|
|
381
385
|
_defineProperty(_this, "handleScroll", trottle(function (e) {
|
|
@@ -493,12 +497,12 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
493
497
|
_this.changeFocusCell(-1, cellIndex === -1 ? 0 : cellIndex, 'up');
|
|
494
498
|
});
|
|
495
499
|
_defineProperty(_this, "handleContainerResizeEnd", function (entries, observer) {
|
|
496
|
-
var _this$asProps$onResiz, _this$
|
|
500
|
+
var _this$asProps$onResiz, _this$asProps2;
|
|
497
501
|
if (_this.containerResizeEndTimeoutId) {
|
|
498
502
|
clearTimeout(_this.containerResizeEndTimeoutId);
|
|
499
503
|
}
|
|
500
504
|
_this.containerResizeEndTimeoutId = setTimeout(_this.calculateVerticalShadow, 0);
|
|
501
|
-
(_this$asProps$onResiz = (_this$
|
|
505
|
+
(_this$asProps$onResiz = (_this$asProps2 = _this.asProps).onResize) === null || _this$asProps$onResiz === void 0 || _this$asProps$onResiz.call(_this$asProps2, entries, observer);
|
|
502
506
|
});
|
|
503
507
|
_defineProperty(_this, "getScrollOffsetValue", function () {
|
|
504
508
|
if (!_this.headerRef.current) {
|
|
@@ -572,6 +576,11 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
572
576
|
_this.calculatedRows = _this.getRows();
|
|
573
577
|
_this.flatRows = _this.calculatedRows.flat();
|
|
574
578
|
_this.tmpData = props.data;
|
|
579
|
+
if (Array.isArray(props.selectedRows) || !props.selectedRows) {
|
|
580
|
+
_this.selectedRowsContainer = new SelectableRows();
|
|
581
|
+
} else {
|
|
582
|
+
_this.selectedRowsContainer = props.selectedRows;
|
|
583
|
+
}
|
|
575
584
|
return _this;
|
|
576
585
|
}
|
|
577
586
|
_inherits(DataTableRoot, _Component);
|
|
@@ -579,9 +588,9 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
579
588
|
key: "componentDidMount",
|
|
580
589
|
value: function componentDidMount() {
|
|
581
590
|
var _this2 = this;
|
|
582
|
-
var _this$
|
|
583
|
-
headerProps = _this$
|
|
584
|
-
loading = _this$
|
|
591
|
+
var _this$asProps3 = this.asProps,
|
|
592
|
+
headerProps = _this$asProps3.headerProps,
|
|
593
|
+
loading = _this$asProps3.loading;
|
|
585
594
|
if (headerProps !== null && headerProps !== void 0 && headerProps.sticky && !headerProps.h || loading || this.hasFixedColumn) {
|
|
586
595
|
requestAnimationFrame(function () {
|
|
587
596
|
_this2.forceUpdate();
|
|
@@ -595,10 +604,10 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
595
604
|
}, {
|
|
596
605
|
key: "componentDidUpdate",
|
|
597
606
|
value: function componentDidUpdate(prevProps) {
|
|
598
|
-
var _this$
|
|
599
|
-
data = _this$
|
|
600
|
-
selectedRows = _this$
|
|
601
|
-
columns = _this$
|
|
607
|
+
var _this$asProps4 = this.asProps,
|
|
608
|
+
data = _this$asProps4.data,
|
|
609
|
+
selectedRows = _this$asProps4.selectedRows,
|
|
610
|
+
columns = _this$asProps4.columns;
|
|
602
611
|
if (prevProps.columns !== columns) {
|
|
603
612
|
var cols = this.calculateColumnsFromConfig();
|
|
604
613
|
this.columns = cols[0];
|
|
@@ -610,7 +619,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
610
619
|
this.calculateVerticalShadow();
|
|
611
620
|
}
|
|
612
621
|
}
|
|
613
|
-
if (prevProps.selectedRows !== selectedRows && selectedRows !== undefined) {
|
|
622
|
+
if (prevProps.selectedRows !== selectedRows && selectedRows !== undefined && Array.isArray(selectedRows)) {
|
|
614
623
|
var selectedRowsSet = new Set(selectedRows);
|
|
615
624
|
var allChecked = [];
|
|
616
625
|
var allUnchecked = [];
|
|
@@ -627,6 +636,9 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
627
636
|
this.setSelectAllMessage(false);
|
|
628
637
|
}
|
|
629
638
|
}
|
|
639
|
+
if (prevProps.selectedRows !== selectedRows && selectedRows !== undefined && !Array.isArray(selectedRows)) {
|
|
640
|
+
this.selectedRowsContainer = selectedRows;
|
|
641
|
+
}
|
|
630
642
|
}
|
|
631
643
|
}, {
|
|
632
644
|
key: "componentWillUnmount",
|
|
@@ -673,11 +685,11 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
673
685
|
}, {
|
|
674
686
|
key: "scrollDirection",
|
|
675
687
|
get: function get() {
|
|
676
|
-
var _this$
|
|
677
|
-
w = _this$
|
|
678
|
-
wMax = _this$
|
|
679
|
-
h = _this$
|
|
680
|
-
hMax = _this$
|
|
688
|
+
var _this$asProps5 = this.asProps,
|
|
689
|
+
w = _this$asProps5.w,
|
|
690
|
+
wMax = _this$asProps5.wMax,
|
|
691
|
+
h = _this$asProps5.h,
|
|
692
|
+
hMax = _this$asProps5.hMax;
|
|
681
693
|
var scrollDirection = undefined;
|
|
682
694
|
var hasWidthSettings = Boolean(w) || Boolean(wMax);
|
|
683
695
|
var hasHeightSettings = Boolean(h) && h !== 'fit-content' || Boolean(hMax);
|
|
@@ -698,18 +710,17 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
698
710
|
}, {
|
|
699
711
|
key: "getHeadProps",
|
|
700
712
|
value: function getHeadProps() {
|
|
701
|
-
var _this$
|
|
702
|
-
use = _this$
|
|
703
|
-
compact = _this$
|
|
704
|
-
sort = _this$
|
|
705
|
-
onSortChange = _this$
|
|
706
|
-
getI18nText = _this$
|
|
707
|
-
uid = _this$
|
|
708
|
-
headerProps = _this$
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
variant = _this$asProps7.variant;
|
|
713
|
+
var _this$asProps6 = this.asProps,
|
|
714
|
+
use = _this$asProps6.use,
|
|
715
|
+
compact = _this$asProps6.compact,
|
|
716
|
+
sort = _this$asProps6.sort,
|
|
717
|
+
onSortChange = _this$asProps6.onSortChange,
|
|
718
|
+
getI18nText = _this$asProps6.getI18nText,
|
|
719
|
+
uid = _this$asProps6.uid,
|
|
720
|
+
headerProps = _this$asProps6.headerProps,
|
|
721
|
+
selectedRows = _this$asProps6.selectedRows,
|
|
722
|
+
sideIndents = _this$asProps6.sideIndents,
|
|
723
|
+
variant = _this$asProps6.variant;
|
|
713
724
|
var _this$gridSettings = this.gridSettings,
|
|
714
725
|
gridTemplateColumns = _this$gridSettings.gridTemplateColumns,
|
|
715
726
|
gridTemplateAreas = _this$gridSettings.gridTemplateAreas;
|
|
@@ -733,7 +744,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
733
744
|
totalRows: this.totalRows,
|
|
734
745
|
selectedRows: selectedRows,
|
|
735
746
|
flatRows: this.getFlatRows(),
|
|
736
|
-
onChangeSelectAll:
|
|
747
|
+
onChangeSelectAll: Array.isArray(selectedRows) ? this.handleSelectAllRows : undefined,
|
|
737
748
|
getFixedStyle: this.getFixedStyle,
|
|
738
749
|
onCellClick: this.handleCellClick,
|
|
739
750
|
shadowVertical: shadowVertical,
|
|
@@ -744,27 +755,27 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
744
755
|
}, {
|
|
745
756
|
key: "getBodyProps",
|
|
746
757
|
value: function getBodyProps() {
|
|
747
|
-
var _this$
|
|
748
|
-
use = _this$
|
|
749
|
-
compact = _this$
|
|
750
|
-
loading = _this$
|
|
751
|
-
getI18nText = _this$
|
|
752
|
-
virtualScroll = _this$
|
|
753
|
-
uid = _this$
|
|
754
|
-
rowProps = _this$
|
|
755
|
-
renderCell = _this$
|
|
756
|
-
headerProps = _this$
|
|
757
|
-
renderEmptyData = _this$
|
|
758
|
-
sideIndents = _this$
|
|
759
|
-
selectedRows = _this$
|
|
760
|
-
accordionDuration = _this$
|
|
761
|
-
accordionMode = _this$
|
|
762
|
-
rawData = _this$
|
|
763
|
-
renderCellOverlay = _this$
|
|
764
|
-
limit = _this$
|
|
765
|
-
variant = _this$
|
|
766
|
-
totalRows = _this$
|
|
767
|
-
accordionAnimationRows = _this$
|
|
758
|
+
var _this$asProps7 = this.asProps,
|
|
759
|
+
use = _this$asProps7.use,
|
|
760
|
+
compact = _this$asProps7.compact,
|
|
761
|
+
loading = _this$asProps7.loading,
|
|
762
|
+
getI18nText = _this$asProps7.getI18nText,
|
|
763
|
+
virtualScroll = _this$asProps7.virtualScroll,
|
|
764
|
+
uid = _this$asProps7.uid,
|
|
765
|
+
rowProps = _this$asProps7.rowProps,
|
|
766
|
+
renderCell = _this$asProps7.renderCell,
|
|
767
|
+
headerProps = _this$asProps7.headerProps,
|
|
768
|
+
renderEmptyData = _this$asProps7.renderEmptyData,
|
|
769
|
+
sideIndents = _this$asProps7.sideIndents,
|
|
770
|
+
selectedRows = _this$asProps7.selectedRows,
|
|
771
|
+
accordionDuration = _this$asProps7.accordionDuration,
|
|
772
|
+
accordionMode = _this$asProps7.accordionMode,
|
|
773
|
+
rawData = _this$asProps7.data,
|
|
774
|
+
renderCellOverlay = _this$asProps7.renderCellOverlay,
|
|
775
|
+
limit = _this$asProps7.limit,
|
|
776
|
+
variant = _this$asProps7.variant,
|
|
777
|
+
totalRows = _this$asProps7.totalRows,
|
|
778
|
+
accordionAnimationRows = _this$asProps7.accordionAnimationRows;
|
|
768
779
|
var _this$gridSettings2 = this.gridSettings,
|
|
769
780
|
gridTemplateColumns = _this$gridSettings2.gridTemplateColumns,
|
|
770
781
|
gridTemplateAreas = _this$gridSettings2.gridTemplateAreas;
|
|
@@ -801,7 +812,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
801
812
|
renderEmptyData: renderEmptyData,
|
|
802
813
|
sideIndents: sideIndents,
|
|
803
814
|
selectedRows: selectedRows,
|
|
804
|
-
onSelectRow: this.handleSelectRow,
|
|
815
|
+
onSelectRow: Array.isArray(selectedRows) ? this.handleSelectRow : undefined,
|
|
805
816
|
getFixedStyle: this.getFixedStyle,
|
|
806
817
|
onCellClick: this.handleCellClick,
|
|
807
818
|
rawData: rawData,
|
|
@@ -844,20 +855,20 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
844
855
|
var _ref = this.asProps,
|
|
845
856
|
_ref2;
|
|
846
857
|
var SDataTable = Box;
|
|
847
|
-
var _this$
|
|
848
|
-
Children = _this$
|
|
849
|
-
styles = _this$
|
|
850
|
-
w = _this$
|
|
851
|
-
wMax = _this$
|
|
852
|
-
wMin = _this$
|
|
853
|
-
h = _this$
|
|
854
|
-
hMax = _this$
|
|
855
|
-
hMin = _this$
|
|
856
|
-
virtualScroll = _this$
|
|
857
|
-
children = _this$
|
|
858
|
-
headerProps = _this$
|
|
859
|
-
loading = _this$
|
|
860
|
-
selectedRows = _this$
|
|
858
|
+
var _this$asProps8 = this.asProps,
|
|
859
|
+
Children = _this$asProps8.Children,
|
|
860
|
+
styles = _this$asProps8.styles,
|
|
861
|
+
w = _this$asProps8.w,
|
|
862
|
+
wMax = _this$asProps8.wMax,
|
|
863
|
+
wMin = _this$asProps8.wMin,
|
|
864
|
+
h = _this$asProps8.h,
|
|
865
|
+
hMax = _this$asProps8.hMax,
|
|
866
|
+
hMin = _this$asProps8.hMin,
|
|
867
|
+
virtualScroll = _this$asProps8.virtualScroll,
|
|
868
|
+
children = _this$asProps8.children,
|
|
869
|
+
headerProps = _this$asProps8.headerProps,
|
|
870
|
+
loading = _this$asProps8.loading,
|
|
871
|
+
selectedRows = _this$asProps8.selectedRows;
|
|
861
872
|
var _this$getScrollOffset = this.getScrollOffsetValue(),
|
|
862
873
|
_this$getScrollOffset2 = _slicedToArray(_this$getScrollOffset, 2),
|
|
863
874
|
offsetLeftSum = _this$getScrollOffset2[0],
|
|
@@ -1076,11 +1087,13 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
1076
1087
|
var _this$props2 = this.props,
|
|
1077
1088
|
data = _this$props2.data,
|
|
1078
1089
|
uid = _this$props2.uid,
|
|
1079
|
-
uniqueRowKey = _this$props2.uniqueRowKey
|
|
1090
|
+
uniqueRowKey = _this$props2.uniqueRowKey,
|
|
1091
|
+
selectedRows = _this$props2.selectedRows;
|
|
1080
1092
|
if (this.tmpData === data) {
|
|
1081
1093
|
return this.calculatedRows;
|
|
1082
1094
|
}
|
|
1083
1095
|
this.tmpData = data;
|
|
1096
|
+
var availableRowKeys = [];
|
|
1084
1097
|
var rows = [];
|
|
1085
1098
|
var columnNames = columns.map(function (column) {
|
|
1086
1099
|
return column.name;
|
|
@@ -1150,6 +1163,10 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
1150
1163
|
dtRow[value] = '';
|
|
1151
1164
|
});
|
|
1152
1165
|
}
|
|
1166
|
+
if (!excludeColumns) {
|
|
1167
|
+
// we should add only the main row in mergedRows or default rows
|
|
1168
|
+
availableRowKeys.push(dtRow[UNIQ_ROW_KEY]);
|
|
1169
|
+
}
|
|
1153
1170
|
return dtRow;
|
|
1154
1171
|
};
|
|
1155
1172
|
data.forEach(function (row) {
|
|
@@ -1202,6 +1219,9 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
1202
1219
|
}
|
|
1203
1220
|
});
|
|
1204
1221
|
this.calculatedRows = rows;
|
|
1222
|
+
if (selectedRows && !Array.isArray(selectedRows)) {
|
|
1223
|
+
selectedRows.setAvailableKeys(availableRowKeys);
|
|
1224
|
+
}
|
|
1205
1225
|
return rows;
|
|
1206
1226
|
}
|
|
1207
1227
|
}, {
|