@semcore/data-table 16.0.0-prerelease.15 → 16.0.0-prerelease.17
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 +6 -0
- package/lib/cjs/components/Body/Body.js +114 -100
- 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 +67 -30
- 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/MergedCells.js +9 -5
- package/lib/cjs/components/Body/MergedCells.js.map +1 -1
- package/lib/cjs/components/Body/Row.js +72 -113
- package/lib/cjs/components/Body/Row.js.map +1 -1
- package/lib/cjs/components/Body/Row.types.js +2 -0
- package/lib/cjs/components/Body/Row.types.js.map +1 -1
- package/lib/cjs/components/Body/style.shadow.css +75 -36
- package/lib/cjs/components/DataTable/DataTable.js +146 -97
- package/lib/cjs/components/DataTable/DataTable.js.map +1 -1
- package/lib/cjs/components/DataTable/DataTable.types.js +2 -0
- package/lib/cjs/components/DataTable/DataTable.types.js.map +1 -1
- package/lib/cjs/components/Head/Column.js +54 -33
- 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 +24 -33
- 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 +23 -28
- 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 +16 -14
- package/lib/cjs/index.js +7 -19
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/scroll-shadows.shadow.css +13 -6
- package/lib/es6/components/Body/Body.js +114 -100
- 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 +67 -30
- 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/MergedCells.js +9 -5
- package/lib/es6/components/Body/MergedCells.js.map +1 -1
- package/lib/es6/components/Body/Row.js +72 -113
- package/lib/es6/components/Body/Row.js.map +1 -1
- package/lib/es6/components/Body/Row.types.js +1 -1
- package/lib/es6/components/Body/Row.types.js.map +1 -1
- package/lib/es6/components/Body/style.shadow.css +75 -36
- package/lib/es6/components/DataTable/DataTable.js +143 -95
- package/lib/es6/components/DataTable/DataTable.js.map +1 -1
- package/lib/es6/components/DataTable/DataTable.types.js +6 -1
- package/lib/es6/components/DataTable/DataTable.types.js.map +1 -1
- package/lib/es6/components/Head/Column.js +52 -31
- 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 +24 -33
- 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 +24 -29
- 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 +16 -14
- package/lib/es6/index.js +5 -4
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/scroll-shadows.shadow.css +13 -6
- package/lib/esm/components/Body/Body.mjs +110 -98
- package/lib/esm/components/Body/Cell.mjs +64 -31
- package/lib/esm/components/Body/MergedCells.mjs +9 -5
- package/lib/esm/components/Body/Row.mjs +67 -109
- package/lib/esm/components/DataTable/DataTable.mjs +125 -46
- package/lib/esm/components/Head/Column.mjs +52 -32
- package/lib/esm/components/Head/Group.mjs +25 -34
- package/lib/esm/components/Head/Head.mjs +25 -30
- package/lib/esm/index.mjs +5 -6
- package/lib/esm/utils.mjs +0 -9
- package/lib/types/components/Body/Body.types.d.ts +13 -8
- package/lib/types/components/Body/Cell.types.d.ts +6 -6
- package/lib/types/components/Body/MergedCells.d.ts +8 -3
- package/lib/types/components/Body/Row.types.d.ts +19 -10
- package/lib/types/components/DataTable/DataTable.d.ts +3 -3
- package/lib/types/components/DataTable/DataTable.types.d.ts +23 -9
- package/lib/types/components/Head/Column.d.ts +6 -3
- package/lib/types/components/Head/Column.types.d.ts +5 -4
- package/lib/types/components/Head/Group.d.ts +0 -1
- package/lib/types/components/Head/Group.type.d.ts +4 -1
- package/lib/types/components/Head/Head.d.ts +6 -3
- package/lib/types/components/Head/Head.types.d.ts +8 -4
- package/lib/types/index.d.ts +10 -4
- package/package.json +7 -6
- package/lib/cjs/Body.js +0 -476
- package/lib/cjs/Body.js.map +0 -1
- package/lib/cjs/DataTable.js +0 -622
- package/lib/cjs/DataTable.js.map +0 -1
- package/lib/cjs/Head.js +0 -399
- package/lib/cjs/Head.js.map +0 -1
- package/lib/cjs/style/data-table.shadow.css +0 -394
- package/lib/cjs/types.js +0 -4
- package/lib/cjs/types.js.map +0 -1
- package/lib/es6/Body.js +0 -469
- package/lib/es6/Body.js.map +0 -1
- package/lib/es6/DataTable.js +0 -614
- package/lib/es6/DataTable.js.map +0 -1
- package/lib/es6/Head.js +0 -391
- package/lib/es6/Head.js.map +0 -1
- package/lib/es6/style/data-table.shadow.css +0 -394
- package/lib/es6/types.js +0 -2
- package/lib/es6/types.js.map +0 -1
- package/lib/esm/Body.mjs +0 -428
- package/lib/esm/DataTable.mjs +0 -582
- package/lib/esm/Head.mjs +0 -369
- package/lib/types/Body.d.ts +0 -61
- package/lib/types/DataTable.d.ts +0 -205
- package/lib/types/Head.d.ts +0 -45
- package/lib/types/types.d.ts +0 -73
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
SBody, SRow {
|
|
1
|
+
SBody, SRow, SRowGroup {
|
|
2
2
|
display: contents;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
SBody[compact]
|
|
6
|
-
|
|
5
|
+
SBody[compact] {
|
|
6
|
+
SCell {
|
|
7
|
+
padding: var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-2x, 8px);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
SCell[data-aria-level] {
|
|
11
|
+
padding-left: calc(var(--intergalactic-spacing-2x, 8px) + (var(--intergalactic-spacing-5x, 20px) * (var(--data-aria-level) - 1)));
|
|
12
|
+
}
|
|
7
13
|
}
|
|
8
14
|
|
|
9
15
|
SRow[gridArea], SCell[gridArea], SCollapseRow[gridArea] {
|
|
10
16
|
grid-area: var(--gridArea);
|
|
11
17
|
}
|
|
12
18
|
|
|
19
|
+
SCollapseRow SCell {
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
22
|
+
|
|
13
23
|
/* DEFAULT THEME */
|
|
14
24
|
SRow[active] > SCell:not([theme]) {
|
|
15
25
|
/* The color is hardcoded because need hex(in figma rgba) */
|
|
@@ -17,10 +27,65 @@ SRow[active] > SCell:not([theme]) {
|
|
|
17
27
|
background-color: var(--intergalactic-table-td-cell-active, #e6e7ed);
|
|
18
28
|
}
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
/* we need a media query here because of the postcssHoverMediaFeature plugin. it doesn't handle this type of selectors correctly */
|
|
31
|
+
@media (hover: hover) {
|
|
32
|
+
SRow:hover > SCell:not([theme]),
|
|
33
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow > SCell:not([theme]),
|
|
34
|
+
SRowGroup:has(SCell:hover) > SRow > SCell[data-grouped-by='rowgroup']:not([theme]) {
|
|
35
|
+
background-color: var(--intergalactic-table-td-cell-hover, #f0f0f4);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* MUTED THEME */
|
|
39
|
+
SRow:hover > SCell[theme='muted'],
|
|
40
|
+
SRow[theme='muted']:hover > SCell:not([theme]),
|
|
41
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow > SCell[theme='muted'],
|
|
42
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow[theme='muted'] > SCell:not([theme]),
|
|
43
|
+
SRowGroup:has(SCell:hover) > SRow > SCell[data-grouped-by='rowgroup'][theme='muted'],
|
|
44
|
+
SRowGroup:has(SCell:hover) > SRow[theme='muted'] > SCell[data-grouped-by='rowgroup']:not([theme]) {
|
|
45
|
+
/* The color is hardcoded because need hex(in figma rgba) */
|
|
46
|
+
/* disable-tokens-validator */
|
|
47
|
+
background-color: var(--intergalactic-table-td-cell-hover, #f0f0f4);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* INFO THEME */
|
|
51
|
+
SRow:hover > SCell[theme='info'],
|
|
52
|
+
SRow[theme='info']:hover > SCell:not([theme]),
|
|
53
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow > SCell[theme='info'],
|
|
54
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow[theme='info'] > SCell:not([theme]),
|
|
55
|
+
SRowGroup:has(SCell:hover) > SRow > SCell[data-grouped-by='rowgroup'][theme='info'],
|
|
56
|
+
SRowGroup:has(SCell:hover) > SRow[theme='info'] > SCell[data-grouped-by='rowgroup']:not([theme]) {
|
|
57
|
+
background-color: var(--intergalactic-table-td-cell-selected-hover, #c4e5fe);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* SUCCESS THEME */
|
|
61
|
+
SRow:hover > SCell[theme='success'],
|
|
62
|
+
SRow[theme='success']:hover > SCell:not([theme]),
|
|
63
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow > SCell[theme='success'],
|
|
64
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow[theme='success'] > SCell:not([theme]),
|
|
65
|
+
SRowGroup:has(SCell:hover) > SRow > SCell[data-grouped-by='rowgroup'][theme='success'],
|
|
66
|
+
SRowGroup:has(SCell:hover) > SRow[theme='success'] > SCell[data-grouped-by='rowgroup']:not([theme]) {
|
|
67
|
+
background-color: var(--intergalactic-table-td-cell-new-hover, #9ef2c9);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* WARNING THEME */
|
|
71
|
+
SRow:hover > SCell[theme='warning'],
|
|
72
|
+
SRow[theme='warning']:hover > SCell:not([theme]),
|
|
73
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow > SCell[theme='warning'],
|
|
74
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow[theme='warning'] > SCell:not([theme]),
|
|
75
|
+
SRowGroup:has(SCell:hover) > SRow > SCell[data-grouped-by='rowgroup'][theme='warning'],
|
|
76
|
+
SRowGroup:has(SCell:hover) > SRow[theme='warning'] > SCell[data-grouped-by='rowgroup']:not([theme]) {
|
|
77
|
+
background-color: var(--intergalactic-table-td-cell-warning-hover, #ffdca2);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* DANGER THEME */
|
|
81
|
+
SRow:hover > SCell[theme='danger'],
|
|
82
|
+
SRow[theme='danger']:hover > SCell:not([theme]),
|
|
83
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow > SCell[theme='danger'],
|
|
84
|
+
SRowGroup:has(SCell[data-grouped-by='rowgroup']:hover) > SRow[theme='danger'] > SCell:not([theme]),
|
|
85
|
+
SRowGroup:has(SCell:hover) > SRow > SCell[data-grouped-by='rowgroup'][theme='danger'],
|
|
86
|
+
SRowGroup:has(SCell:hover) > SRow[theme='danger'] > SCell[data-grouped-by='rowgroup']:not([theme]) {
|
|
87
|
+
background-color: var(--intergalactic-table-td-cell-critical-hover, #ffd7df);
|
|
88
|
+
}
|
|
24
89
|
}
|
|
25
90
|
|
|
26
91
|
/* MUTED THEME */
|
|
@@ -34,13 +99,6 @@ SRow[theme='muted'][active] > SCell:not([theme]) {
|
|
|
34
99
|
background-color: var(--intergalactic-table-td-cell-active, #e6e7ed);
|
|
35
100
|
}
|
|
36
101
|
|
|
37
|
-
SRow:hover > SCell[theme='muted'],
|
|
38
|
-
SRow[theme='muted']:hover > SCell:not([theme]) {
|
|
39
|
-
/* The color is hardcoded because need hex(in figma rgba) */
|
|
40
|
-
/* disable-tokens-validator */
|
|
41
|
-
background-color: var(--intergalactic-table-td-cell-hover, #f0f0f4);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
102
|
/* INFO THEME */
|
|
45
103
|
SRow[theme='info'] SCell:not([theme]) {
|
|
46
104
|
background-color: var(--intergalactic-table-td-cell-selected, #e9f7ff);
|
|
@@ -50,11 +108,6 @@ SRow[theme='info'][active] > SCell:not([theme]) {
|
|
|
50
108
|
background-color: var(--intergalactic-table-td-cell-selected-active, #c4e5fe);
|
|
51
109
|
}
|
|
52
110
|
|
|
53
|
-
SRow:hover > SCell[theme='info'],
|
|
54
|
-
SRow[theme='info']:hover > SCell:not([theme]) {
|
|
55
|
-
background-color: var(--intergalactic-table-td-cell-selected-hover, #c4e5fe);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
111
|
/* SUCCESS THEME */
|
|
59
112
|
SRow[theme='success'] SCell:not([theme]) {
|
|
60
113
|
background-color: var(--intergalactic-table-td-cell-new, #dbfee8);
|
|
@@ -64,11 +117,6 @@ SRow[theme='success'][active] > SCell:not([theme]) {
|
|
|
64
117
|
background-color: var(--intergalactic-table-td-cell-new-active, #9ef2c9);
|
|
65
118
|
}
|
|
66
119
|
|
|
67
|
-
SRow:hover > SCell[theme='success'],
|
|
68
|
-
SRow[theme='success']:hover > SCell:not([theme]) {
|
|
69
|
-
background-color: var(--intergalactic-table-td-cell-new-hover, #9ef2c9);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
120
|
/* WARNING THEME */
|
|
73
121
|
SRow[theme='warning'] SCell:not([theme]) {
|
|
74
122
|
background-color: var(--intergalactic-table-td-cell-warning, #fff3d9);
|
|
@@ -78,11 +126,6 @@ SRow[theme='warning'][active] > SCell:not([theme]) {
|
|
|
78
126
|
background-color: var(--intergalactic-table-td-cell-warning-active, #ffdca2);
|
|
79
127
|
}
|
|
80
128
|
|
|
81
|
-
SRow:hover > SCell[theme='warning'],
|
|
82
|
-
SRow[theme='warning']:hover > SCell:not([theme]) {
|
|
83
|
-
background-color: var(--intergalactic-table-td-cell-warning-hover, #ffdca2);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
129
|
/* DANGER THEME */
|
|
87
130
|
SRow[theme='danger'] SCell:not([theme]) {
|
|
88
131
|
background-color: var(--intergalactic-table-td-cell-critical, #fff0f7);
|
|
@@ -92,11 +135,6 @@ SRow[theme='danger'][active] > SCell:not([theme]) {
|
|
|
92
135
|
background-color: var(--intergalactic-table-td-cell-critical-active, #ffd7df);
|
|
93
136
|
}
|
|
94
137
|
|
|
95
|
-
SRow:hover > SCell[theme='danger'],
|
|
96
|
-
SRow[theme='danger']:hover > SCell:not([theme]) {
|
|
97
|
-
background-color: var(--intergalactic-table-td-cell-critical-hover, #ffd7df);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
138
|
SCell {
|
|
101
139
|
display: flex;
|
|
102
140
|
height: 100%;
|
|
@@ -113,6 +151,7 @@ SCell {
|
|
|
113
151
|
outline: none;
|
|
114
152
|
|
|
115
153
|
SAccordionToggle {
|
|
154
|
+
margin-right: var(--intergalactic-spacing-3x, 12px);
|
|
116
155
|
transition: transform calc(var(--intergalactic-duration-accordion, 200) * 1ms) ease-out;
|
|
117
156
|
|
|
118
157
|
&[expanded] {
|
|
@@ -127,7 +166,7 @@ SCell[use='primary'] {
|
|
|
127
166
|
background-color: var(--intergalactic-bg-primary-neutral, #ffffff);
|
|
128
167
|
|
|
129
168
|
&[data-aria-level] {
|
|
130
|
-
padding-left: calc(var(--intergalactic-spacing-3x, 12px) + (var(--intergalactic-spacing-5x, 20px) * (var(--data-aria-level) - 1)));
|
|
169
|
+
padding-left: calc(var(--intergalactic-spacing-3x, 12px) + ((var(--intergalactic-spacing-5x, 20px) + var(--intergalactic-spacing-2x, 8px)) * (var(--data-aria-level) - 1)));
|
|
131
170
|
}
|
|
132
171
|
}
|
|
133
172
|
|
|
@@ -137,7 +176,7 @@ SCell[use='secondary'] {
|
|
|
137
176
|
background-color: var(--intergalactic-bg-primary-neutral, #ffffff);
|
|
138
177
|
|
|
139
178
|
&[data-aria-level] {
|
|
140
|
-
padding-left: calc(var(--intergalactic-spacing-2x, 8px) + (var(--intergalactic-spacing-5x, 20px) * (var(--data-aria-level) - 1)));
|
|
179
|
+
padding-left: calc(var(--intergalactic-spacing-2x, 8px) + ((var(--intergalactic-spacing-5x, 20px) + var(--intergalactic-spacing-2x, 8px)) * (var(--data-aria-level) - 1)));
|
|
141
180
|
}
|
|
142
181
|
}
|
|
143
182
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
6
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -23,22 +24,23 @@ var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/
|
|
|
23
24
|
"--gridTemplateAreas": "--gridTemplateAreas_1yoby"
|
|
24
25
|
});
|
|
25
26
|
import { isFocusInside, hasFocusableIn } from '@semcore/core/lib/utils/use/useFocusLock';
|
|
26
|
-
import syncScroll from '@semcore/core/lib/utils/syncScroll';
|
|
27
27
|
import { getScrollOffsetValue } from '../../utils';
|
|
28
28
|
import findComponent from '@semcore/core/lib/utils/findComponent';
|
|
29
29
|
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
30
30
|
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
31
31
|
import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
32
|
-
import { ROW_GROUP } from '../../index';
|
|
33
32
|
import { MergedColumnsCell, MergedRowsCell } from '../Body/MergedCells';
|
|
34
33
|
import { forkRef } from '@semcore/core/lib/utils/ref';
|
|
35
34
|
/*__reshadow-styles__:"../../style/scroll-shadows.shadow.css"*/
|
|
36
|
-
var scrollStyles = ( /*__reshadow_css_start__*/_sstyled2.insert( /*__inner_css_start__*/".
|
|
37
|
-
"__SScrollArea": "
|
|
38
|
-
"
|
|
39
|
-
"
|
|
35
|
+
var scrollStyles = ( /*__reshadow_css_start__*/_sstyled2.insert( /*__inner_css_start__*/".___SScrollArea_14dz4_gg_{width:-moz-fit-content;width:fit-content}.___SScrollArea_14dz4_gg_ .___SShadowVertical_14dz4_gg_:before{display:none}.___SScrollArea_14dz4_gg_ .___SShadowHorizontal_14dz4_gg_:after,.___SScrollArea_14dz4_gg_ .___SShadowHorizontal_14dz4_gg_:before,.___SScrollArea_14dz4_gg_ .___SShadowVertical_14dz4_gg_:after{z-index:2}" /*__inner_css_end__*/, "14dz4_gg_") /*__reshadow_css_end__*/, {
|
|
36
|
+
"__SScrollArea": "___SScrollArea_14dz4_gg_",
|
|
37
|
+
"__SShadowVertical": "___SShadowVertical_14dz4_gg_",
|
|
38
|
+
"__SShadowHorizontal": "___SShadowHorizontal_14dz4_gg_"
|
|
40
39
|
});
|
|
40
|
+
import { hasParent } from '@semcore/core/lib/utils/hasParent';
|
|
41
41
|
export var ACCORDION = Symbol('accordion');
|
|
42
|
+
export var ROW_GROUP = Symbol('ROW_GROUP');
|
|
43
|
+
var SCROLL_BAR_HEIGHT = 12;
|
|
42
44
|
var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
43
45
|
_inherits(DataTableRoot, _Component);
|
|
44
46
|
var _super = _createSuper(DataTableRoot);
|
|
@@ -52,8 +54,7 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
52
54
|
_defineProperty(_assertThisInitialized(_this), "tableContainerRef", /*#__PURE__*/React.createRef());
|
|
53
55
|
_defineProperty(_assertThisInitialized(_this), "tableRef", /*#__PURE__*/React.createRef());
|
|
54
56
|
_defineProperty(_assertThisInitialized(_this), "headerRef", /*#__PURE__*/React.createRef());
|
|
55
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
56
|
-
_defineProperty(_assertThisInitialized(_this), "scrollHeadRef", void 0);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "spinnerRef", /*#__PURE__*/React.createRef());
|
|
57
58
|
_defineProperty(_assertThisInitialized(_this), "gridAreaGroupMap", new Map());
|
|
58
59
|
_defineProperty(_assertThisInitialized(_this), "getRow", function (index) {
|
|
59
60
|
var _this$tableRef$curren;
|
|
@@ -66,6 +67,16 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
66
67
|
});
|
|
67
68
|
return hasFocusable;
|
|
68
69
|
});
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "onExpandRow", function (expandedRowIndex) {
|
|
71
|
+
var expandedRows = _this.asProps.expandedRows;
|
|
72
|
+
if (expandedRows !== null && expandedRows !== void 0 && expandedRows.includes(expandedRowIndex)) {
|
|
73
|
+
_this.handlers.expandedRows(expandedRows.filter(function (row) {
|
|
74
|
+
return row !== expandedRowIndex;
|
|
75
|
+
}));
|
|
76
|
+
} else {
|
|
77
|
+
_this.handlers.expandedRows([].concat(_toConsumableArray(expandedRows), [expandedRowIndex]));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
69
80
|
_defineProperty(_assertThisInitialized(_this), "changeFocusCell", function (rowIndex, colIndex, direction) {
|
|
70
81
|
var _this$tableRef$curren2, _this$tableRef$curren3;
|
|
71
82
|
var hasFocusable = _this.hasFocusableInHeader();
|
|
@@ -168,7 +179,11 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
168
179
|
}
|
|
169
180
|
});
|
|
170
181
|
_defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
|
|
171
|
-
if (
|
|
182
|
+
if (_this.asProps.loading) {
|
|
183
|
+
var _this$spinnerRef$curr;
|
|
184
|
+
(_this$spinnerRef$curr = _this.spinnerRef.current) === null || _this$spinnerRef$curr === void 0 ? void 0 : _this$spinnerRef$curr.focus();
|
|
185
|
+
e.currentTarget.setAttribute('tabIndex', '-1');
|
|
186
|
+
} else if ((!e.relatedTarget || !isFocusInside(e.currentTarget, e.relatedTarget)) && lastInteraction.isKeyboard()) {
|
|
172
187
|
var _row;
|
|
173
188
|
if (_this.focusedCell[0] === -1 && _this.focusedCell[1] === -1) {
|
|
174
189
|
_this.initFocusableCell();
|
|
@@ -181,7 +196,13 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
181
196
|
}
|
|
182
197
|
var cell = (_row = row) === null || _row === void 0 ? void 0 : _row.querySelectorAll('[role=gridcell], [role=columnheader]').item(_this.focusedCell[1]);
|
|
183
198
|
cell === null || cell === void 0 ? void 0 : cell.removeAttribute('inert');
|
|
184
|
-
cell instanceof HTMLElement
|
|
199
|
+
if (cell instanceof HTMLElement) {
|
|
200
|
+
if (hasParent(e.target, cell)) {
|
|
201
|
+
e.target.focus();
|
|
202
|
+
} else {
|
|
203
|
+
cell.focus();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
185
206
|
e.currentTarget.setAttribute('tabIndex', '-1');
|
|
186
207
|
}
|
|
187
208
|
});
|
|
@@ -196,14 +217,17 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
196
217
|
_defineProperty(_assertThisInitialized(_this), "handleMouseMove", function () {
|
|
197
218
|
_this.setInert(false);
|
|
198
219
|
});
|
|
199
|
-
var createRef = syncScroll();
|
|
200
|
-
// first create body ref for master scroll
|
|
201
|
-
_this.scrollBodyRef = createRef('body');
|
|
202
|
-
_this.scrollHeadRef = createRef('head');
|
|
203
220
|
_this.columns = _this.calculateColumns();
|
|
204
221
|
return _this;
|
|
205
222
|
}
|
|
206
223
|
_createClass(DataTableRoot, [{
|
|
224
|
+
key: "uncontrolledProps",
|
|
225
|
+
value: function uncontrolledProps() {
|
|
226
|
+
return {
|
|
227
|
+
expandedRows: []
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
}, {
|
|
207
231
|
key: "componentDidMount",
|
|
208
232
|
value: function componentDidMount() {
|
|
209
233
|
this.forceUpdate();
|
|
@@ -211,8 +235,21 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
211
235
|
}, {
|
|
212
236
|
key: "totalRows",
|
|
213
237
|
get: function get() {
|
|
214
|
-
var
|
|
215
|
-
|
|
238
|
+
var _this2 = this;
|
|
239
|
+
var _this$asProps = this.asProps,
|
|
240
|
+
totalRows = _this$asProps.totalRows,
|
|
241
|
+
expandedRows = _this$asProps.expandedRows;
|
|
242
|
+
var expandedRowsCount = expandedRows === null || expandedRows === void 0 ? void 0 : expandedRows.reduce(function (acc, rowIndex) {
|
|
243
|
+
var dtRow = _this2.calculateRows().flat()[rowIndex];
|
|
244
|
+
var expandedRows = dtRow[ACCORDION];
|
|
245
|
+
if (Array.isArray(expandedRows)) {
|
|
246
|
+
acc = acc + expandedRows.length;
|
|
247
|
+
} else {
|
|
248
|
+
acc = acc + 1;
|
|
249
|
+
}
|
|
250
|
+
return acc;
|
|
251
|
+
}, 0);
|
|
252
|
+
return (totalRows !== null && totalRows !== void 0 ? totalRows : this.calculateRows().length) + expandedRowsCount;
|
|
216
253
|
}
|
|
217
254
|
}, {
|
|
218
255
|
key: "gridSettings",
|
|
@@ -231,13 +268,13 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
231
268
|
}, {
|
|
232
269
|
key: "getHeadProps",
|
|
233
270
|
value: function getHeadProps() {
|
|
234
|
-
var _this$
|
|
235
|
-
use = _this$
|
|
236
|
-
compact = _this$
|
|
237
|
-
sort = _this$
|
|
238
|
-
onSortChange = _this$
|
|
239
|
-
getI18nText = _this$
|
|
240
|
-
uid = _this$
|
|
271
|
+
var _this$asProps2 = this.asProps,
|
|
272
|
+
use = _this$asProps2.use,
|
|
273
|
+
compact = _this$asProps2.compact,
|
|
274
|
+
sort = _this$asProps2.sort,
|
|
275
|
+
onSortChange = _this$asProps2.onSortChange,
|
|
276
|
+
getI18nText = _this$asProps2.getI18nText,
|
|
277
|
+
uid = _this$asProps2.uid;
|
|
241
278
|
var _this$gridSettings = this.gridSettings,
|
|
242
279
|
gridTemplateColumns = _this$gridSettings.gridTemplateColumns,
|
|
243
280
|
gridTemplateAreas = _this$gridSettings.gridTemplateAreas;
|
|
@@ -260,11 +297,12 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
260
297
|
key: "getBodyProps",
|
|
261
298
|
value: function getBodyProps() {
|
|
262
299
|
var _header$children;
|
|
263
|
-
var _this$
|
|
264
|
-
use = _this$
|
|
265
|
-
compact = _this$
|
|
266
|
-
loading = _this$
|
|
267
|
-
getI18nText = _this$
|
|
300
|
+
var _this$asProps3 = this.asProps,
|
|
301
|
+
use = _this$asProps3.use,
|
|
302
|
+
compact = _this$asProps3.compact,
|
|
303
|
+
loading = _this$asProps3.loading,
|
|
304
|
+
getI18nText = _this$asProps3.getI18nText,
|
|
305
|
+
expandedRows = _this$asProps3.expandedRows;
|
|
268
306
|
var rows = this.calculateRows();
|
|
269
307
|
var _this$gridSettings2 = this.gridSettings,
|
|
270
308
|
gridTemplateColumns = _this$gridSettings2.gridTemplateColumns,
|
|
@@ -280,17 +318,17 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
280
318
|
return {
|
|
281
319
|
columns: this.columns,
|
|
282
320
|
rows: rows,
|
|
321
|
+
flatRows: rows.flat(),
|
|
283
322
|
use: use,
|
|
284
|
-
scrollRef: this.scrollBodyRef,
|
|
285
|
-
headerRows: this.columns.some(function (column) {
|
|
286
|
-
return Boolean(column.parent);
|
|
287
|
-
}) ? 2 : 1,
|
|
288
323
|
compact: Boolean(compact),
|
|
289
324
|
gridTemplateColumns: gridTemplateColumns,
|
|
290
325
|
gridTemplateAreas: gridTemplateAreas,
|
|
291
326
|
loading: loading,
|
|
292
327
|
headerHeight: headerHeight,
|
|
293
|
-
getI18nText: getI18nText
|
|
328
|
+
getI18nText: getI18nText,
|
|
329
|
+
expandedRows: expandedRows,
|
|
330
|
+
onExpandRow: this.onExpandRow,
|
|
331
|
+
spinnerRef: this.spinnerRef
|
|
294
332
|
};
|
|
295
333
|
}
|
|
296
334
|
}, {
|
|
@@ -312,16 +350,15 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
312
350
|
var _ref = this.asProps,
|
|
313
351
|
_ref2;
|
|
314
352
|
var SDataTable = Box;
|
|
315
|
-
var _this$
|
|
316
|
-
Children = _this$
|
|
317
|
-
styles = _this$
|
|
318
|
-
w = _this$
|
|
319
|
-
wMax = _this$
|
|
320
|
-
wMin = _this$
|
|
321
|
-
h = _this$
|
|
322
|
-
hMax = _this$
|
|
323
|
-
hMin = _this$
|
|
324
|
-
loading = _this$asProps3.loading;
|
|
353
|
+
var _this$asProps4 = this.asProps,
|
|
354
|
+
Children = _this$asProps4.Children,
|
|
355
|
+
styles = _this$asProps4.styles,
|
|
356
|
+
w = _this$asProps4.w,
|
|
357
|
+
wMax = _this$asProps4.wMax,
|
|
358
|
+
wMin = _this$asProps4.wMin,
|
|
359
|
+
h = _this$asProps4.h,
|
|
360
|
+
hMax = _this$asProps4.hMax,
|
|
361
|
+
hMin = _this$asProps4.hMin;
|
|
325
362
|
var _getScrollOffsetValue = getScrollOffsetValue(this.columns),
|
|
326
363
|
_getScrollOffsetValue2 = _slicedToArray(_getScrollOffsetValue, 2),
|
|
327
364
|
offsetLeftSum = _getScrollOffsetValue2[0],
|
|
@@ -330,13 +367,14 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
330
367
|
gridTemplateColumns = _this$gridSettings3.gridTemplateColumns,
|
|
331
368
|
gridTemplateAreas = _this$gridSettings3.gridTemplateAreas;
|
|
332
369
|
var Head = findComponent(Children, ['DataTable.Head']);
|
|
333
|
-
var
|
|
370
|
+
var topOffset = Head !== null && Head !== void 0 && Head.props.sticky || Head !== null && Head !== void 0 && Head.props.withScrollBar ? this.getTopScrollOffset() : undefined;
|
|
334
371
|
var width = w !== null && w !== void 0 ? w : this.columns.some(function (c) {
|
|
335
372
|
return c.gridColumnWidth === 'auto' || c.gridColumnWidth === '1fr';
|
|
336
373
|
}) ? '100%' : undefined;
|
|
337
374
|
return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(ScrollArea, _ref2.cn("ScrollArea", {
|
|
338
375
|
"leftOffset": offsetLeftSum,
|
|
339
376
|
"rightOffset": offsetRightSum,
|
|
377
|
+
"topOffset": topOffset,
|
|
340
378
|
"w": width,
|
|
341
379
|
"wMax": wMax,
|
|
342
380
|
"wMin": wMin,
|
|
@@ -368,16 +406,22 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
368
406
|
"use:h": undefined,
|
|
369
407
|
"use:hMax": undefined,
|
|
370
408
|
"use:hMin": undefined
|
|
371
|
-
}, _ref))),
|
|
372
|
-
orientation: "horizontal"
|
|
409
|
+
}, _ref))), /*#__PURE__*/React.createElement(Children, _ref2.cn("Children", {})))), (Head === null || Head === void 0 ? void 0 : Head.props.withScrollBar) && topOffset && /*#__PURE__*/React.createElement(ScrollArea.Bar, {
|
|
410
|
+
orientation: "horizontal",
|
|
411
|
+
top: topOffset - SCROLL_BAR_HEIGHT,
|
|
412
|
+
zIndex: 3
|
|
413
|
+
}), /*#__PURE__*/React.createElement(ScrollArea.Bar, {
|
|
414
|
+
orientation: "horizontal",
|
|
415
|
+
zIndex: 2
|
|
373
416
|
}), /*#__PURE__*/React.createElement(ScrollArea.Bar, {
|
|
374
|
-
orientation: "vertical"
|
|
417
|
+
orientation: "vertical",
|
|
418
|
+
zIndex: 2
|
|
375
419
|
}));
|
|
376
420
|
}
|
|
377
421
|
}, {
|
|
378
422
|
key: "calculateColumns",
|
|
379
423
|
value: function calculateColumns() {
|
|
380
|
-
var
|
|
424
|
+
var _this3 = this;
|
|
381
425
|
var _this$props = this.props,
|
|
382
426
|
children = _this$props.children,
|
|
383
427
|
data = _this$props.data;
|
|
@@ -415,27 +459,23 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
415
459
|
alignContent: columnElement.props.alignContent,
|
|
416
460
|
justifyContent: columnElement.props.justifyContent
|
|
417
461
|
};
|
|
418
|
-
|
|
419
|
-
// this.gridAreaColumnMap.set(
|
|
420
|
-
// columnIndex,
|
|
421
|
-
// `1 / ${gridColumnIndex} / ${hasGroup ? '3' : '2'} / ${gridColumnIndex + 1}`,
|
|
422
|
-
// );
|
|
423
|
-
// columnIndex++;
|
|
424
|
-
// gridColumnIndex++;
|
|
425
|
-
|
|
426
462
|
return column;
|
|
427
|
-
// columns.push(column);
|
|
428
463
|
};
|
|
429
|
-
|
|
464
|
+
var childIsColumn = function childIsColumn(child) {
|
|
465
|
+
return child.type === Head.Column;
|
|
466
|
+
};
|
|
467
|
+
var childIsGroup = function childIsGroup(child) {
|
|
468
|
+
return child.type === Head.Group;
|
|
469
|
+
};
|
|
430
470
|
React.Children.forEach(HeadComponent.props.children, function (child, i) {
|
|
431
471
|
if (! /*#__PURE__*/React.isValidElement(child)) return;
|
|
432
|
-
if (child
|
|
472
|
+
if (childIsColumn(child)) {
|
|
433
473
|
var col = makeColumn(child);
|
|
434
474
|
col.gridArea = "1 / ".concat(gridColumnIndex, " / ").concat(hasGroup ? '3' : '2', " / ").concat(gridColumnIndex + 1);
|
|
435
475
|
columnIndex++;
|
|
436
476
|
gridColumnIndex++;
|
|
437
477
|
columns.push(col);
|
|
438
|
-
} else if (child
|
|
478
|
+
} else if (childIsGroup(child)) {
|
|
439
479
|
var Group = child;
|
|
440
480
|
var childCount = React.Children.count(child.props.children);
|
|
441
481
|
var initGridColumn = gridColumnIndex;
|
|
@@ -458,78 +498,69 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
458
498
|
columns.push(_col);
|
|
459
499
|
}
|
|
460
500
|
});
|
|
461
|
-
|
|
501
|
+
_this3.gridAreaGroupMap.set(groupIndex, "1 / ".concat(initGridColumn, " / 2 / ").concat(gridColumnIndex));
|
|
462
502
|
groupIndex++;
|
|
463
503
|
}
|
|
464
504
|
});
|
|
465
505
|
return columns.filter(Boolean);
|
|
466
|
-
|
|
467
|
-
// return Columns.map((c) => {
|
|
468
|
-
// const column = {
|
|
469
|
-
// name: c.props.name,
|
|
470
|
-
// ref: (node: HTMLElement | null) => {
|
|
471
|
-
// if (node) {
|
|
472
|
-
// const calculatedWidth = node.getBoundingClientRect().width;
|
|
473
|
-
// column.calculatedWidth = calculatedWidth;
|
|
474
|
-
// }
|
|
475
|
-
//
|
|
476
|
-
// return { current: node };
|
|
477
|
-
// },
|
|
478
|
-
// gridColumnWidth: calculateGridTemplateColumn(c),
|
|
479
|
-
// fixed: c.props.fixed,
|
|
480
|
-
// calculatedWidth: 0,
|
|
481
|
-
// };
|
|
482
|
-
//
|
|
483
|
-
// return column;
|
|
484
|
-
// });
|
|
485
|
-
|
|
486
|
-
// return columns;
|
|
487
506
|
}
|
|
488
507
|
}, {
|
|
489
508
|
key: "calculateRows",
|
|
490
509
|
value: function calculateRows() {
|
|
491
|
-
var
|
|
510
|
+
var _this4 = this;
|
|
492
511
|
var data = this.asProps.data;
|
|
493
512
|
var rows = [];
|
|
494
513
|
var rowIndex = 0;
|
|
495
|
-
var
|
|
514
|
+
var makeDtRow = function makeDtRow(row) {
|
|
496
515
|
var dtRow = Object.entries(row).reduce(function (acc, _ref4) {
|
|
497
516
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
498
517
|
key = _ref5[0],
|
|
499
518
|
value = _ref5[1];
|
|
500
|
-
var columnsToRow = key.split(
|
|
519
|
+
var columnsToRow = key.split(_this4.columnsSplitter);
|
|
501
520
|
if (columnsToRow.length === 1) {
|
|
502
|
-
acc[key] = value;
|
|
521
|
+
acc[key] = value !== null && value !== void 0 ? value : '';
|
|
503
522
|
} else {
|
|
504
|
-
acc[columnsToRow[0]] = new MergedColumnsCell(value,
|
|
523
|
+
acc[columnsToRow[0]] = new MergedColumnsCell(value, {
|
|
524
|
+
dataKey: key,
|
|
525
|
+
size: columnsToRow.length
|
|
526
|
+
});
|
|
505
527
|
}
|
|
506
528
|
if (row[ACCORDION]) {
|
|
507
529
|
acc[ACCORDION] = row[ACCORDION];
|
|
508
530
|
}
|
|
509
531
|
return acc;
|
|
510
532
|
}, {});
|
|
511
|
-
|
|
512
|
-
rowIndex++;
|
|
533
|
+
return dtRow;
|
|
513
534
|
};
|
|
514
|
-
data.forEach(function (row
|
|
535
|
+
data.forEach(function (row) {
|
|
515
536
|
var groupedRows = row[ROW_GROUP];
|
|
537
|
+
var fromRow = rowIndex + 2; // 1 - for header, 1 - because start not from 0, but from 1
|
|
538
|
+
|
|
516
539
|
if (groupedRows) {
|
|
540
|
+
var toRow = fromRow + groupedRows.length;
|
|
541
|
+
var innerRows = [];
|
|
517
542
|
groupedRows.forEach(function (childRow, index) {
|
|
543
|
+
var dtRow;
|
|
518
544
|
if (index === 0) {
|
|
519
545
|
var rowData = _objectSpread(_objectSpread({}, childRow), Object.entries(row).reduce(function (acc, _ref6) {
|
|
520
546
|
var _ref7 = _slicedToArray(_ref6, 2),
|
|
521
547
|
key = _ref7[0],
|
|
522
548
|
value = _ref7[1];
|
|
523
|
-
acc[key] = new MergedRowsCell(value,
|
|
549
|
+
acc[key] = new MergedRowsCell(value, [fromRow, toRow]);
|
|
524
550
|
return acc;
|
|
525
551
|
}, {}));
|
|
526
|
-
|
|
552
|
+
dtRow = makeDtRow(rowData);
|
|
527
553
|
} else {
|
|
528
|
-
|
|
554
|
+
dtRow = makeDtRow(childRow);
|
|
529
555
|
}
|
|
556
|
+
innerRows.push(dtRow);
|
|
557
|
+
rowIndex++;
|
|
530
558
|
});
|
|
559
|
+
rows.push(innerRows);
|
|
531
560
|
} else {
|
|
532
|
-
|
|
561
|
+
var dtRow = makeDtRow(row);
|
|
562
|
+
rows.push(dtRow);
|
|
563
|
+
rowIndex++;
|
|
533
564
|
}
|
|
534
565
|
});
|
|
535
566
|
return rows;
|
|
@@ -540,6 +571,22 @@ var DataTableRoot = /*#__PURE__*/function (_Component) {
|
|
|
540
571
|
var _c$props$gtcWidth;
|
|
541
572
|
return (_c$props$gtcWidth = c.props.gtcWidth) !== null && _c$props$gtcWidth !== void 0 ? _c$props$gtcWidth : this.props.defaultGridTemplateColumnWidth;
|
|
542
573
|
}
|
|
574
|
+
}, {
|
|
575
|
+
key: "getTopScrollOffset",
|
|
576
|
+
value: function getTopScrollOffset() {
|
|
577
|
+
var _this$headerRef$curre;
|
|
578
|
+
var header = (_this$headerRef$curre = this.headerRef.current) === null || _this$headerRef$curre === void 0 ? void 0 : _this$headerRef$curre.children;
|
|
579
|
+
var height = 0;
|
|
580
|
+
for (var i = 0; i < ((_header$length = header === null || header === void 0 ? void 0 : header.length) !== null && _header$length !== void 0 ? _header$length : 0); i++) {
|
|
581
|
+
var _header$length, _header$item;
|
|
582
|
+
var columnHeight = header === null || header === void 0 ? void 0 : (_header$item = header.item(i)) === null || _header$item === void 0 ? void 0 : _header$item.getBoundingClientRect().height;
|
|
583
|
+
if (columnHeight) {
|
|
584
|
+
height = columnHeight;
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return height;
|
|
589
|
+
}
|
|
543
590
|
}]);
|
|
544
591
|
return DataTableRoot;
|
|
545
592
|
}(Component);
|
|
@@ -549,7 +596,8 @@ _defineProperty(DataTableRoot, "enhance", [uniqueIDEnhancement(), i18nEnhance(lo
|
|
|
549
596
|
_defineProperty(DataTableRoot, "defaultProps", {
|
|
550
597
|
use: 'primary',
|
|
551
598
|
defaultGridTemplateColumnWidth: 'auto',
|
|
552
|
-
h: 'auto'
|
|
599
|
+
h: 'auto',
|
|
600
|
+
defaultExpandedRows: []
|
|
553
601
|
});
|
|
554
602
|
export var DataTable = createComponent(DataTableRoot, {
|
|
555
603
|
Head: Head,
|