@semcore/data-table 4.49.1 → 16.0.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 +6 -0
- package/lib/cjs/Body.js +10 -10
- package/lib/cjs/Body.js.map +1 -1
- package/lib/cjs/DataTable.js +47 -52
- package/lib/cjs/DataTable.js.map +1 -1
- package/lib/cjs/Head.js +6 -5
- package/lib/cjs/Head.js.map +1 -1
- package/lib/cjs/style/data-table.shadow.css +0 -19
- package/lib/es6/Body.js +11 -10
- package/lib/es6/Body.js.map +1 -1
- package/lib/es6/DataTable.js +48 -51
- package/lib/es6/DataTable.js.map +1 -1
- package/lib/es6/Head.js +6 -5
- package/lib/es6/Head.js.map +1 -1
- package/lib/es6/style/data-table.shadow.css +0 -19
- package/lib/esm/Body.mjs +70 -70
- package/lib/esm/DataTable.mjs +265 -268
- package/lib/esm/Head.mjs +10 -9
- package/lib/types/Body.d.ts +1 -1
- package/package.json +5 -8
package/lib/esm/Body.mjs
CHANGED
|
@@ -1,58 +1,57 @@
|
|
|
1
1
|
import oe from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import
|
|
2
|
+
import j from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import ue from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
4
|
import ie from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
5
5
|
import ae from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
|
-
import
|
|
6
|
+
import q from "@babel/runtime/helpers/esm/typeof";
|
|
7
7
|
import he from "@babel/runtime/helpers/esm/classCallCheck";
|
|
8
8
|
import ge from "@babel/runtime/helpers/esm/createClass";
|
|
9
9
|
import p from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
10
10
|
import me from "@babel/runtime/helpers/esm/inherits";
|
|
11
11
|
import pe from "@babel/runtime/helpers/esm/createSuper";
|
|
12
12
|
import R from "@babel/runtime/helpers/esm/defineProperty";
|
|
13
|
-
import { sstyled as Re } from "@semcore/
|
|
14
|
-
import { sstyled as M, assignProps as we, Component as ye } from "@semcore/core";
|
|
13
|
+
import { sstyled as V, assignProps as Re, Component as we } from "@semcore/core";
|
|
15
14
|
import s from "react";
|
|
16
|
-
import { Flex as Se, Box as
|
|
17
|
-
import
|
|
18
|
-
import { getFixedStyle as
|
|
19
|
-
import
|
|
20
|
-
import N from "@semcore/
|
|
21
|
-
import { forkRef as
|
|
22
|
-
import
|
|
23
|
-
import { SORT_ICON_WIDTH as
|
|
24
|
-
import { getFocusableIn as le } from "@semcore/
|
|
25
|
-
var
|
|
15
|
+
import { Flex as Se, Box as M } from "@semcore/flex-box";
|
|
16
|
+
import K, { hideScrollBarsFromScreenReadersContext as ye } from "@semcore/scroll-area";
|
|
17
|
+
import { getFixedStyle as _e, getScrollOffsetValue as He } from "./utils.mjs";
|
|
18
|
+
import W, { callAllEventHandlers as ne } from "@semcore/core/lib/utils/assignProps";
|
|
19
|
+
import N from "@semcore/core/lib/utils/rafTrottle";
|
|
20
|
+
import { forkRef as Oe } from "@semcore/core/lib/utils/ref";
|
|
21
|
+
import be from "@semcore/core/lib/utils/canUseDOM";
|
|
22
|
+
import { SORT_ICON_WIDTH as Pe } from "./Head.mjs";
|
|
23
|
+
import { getFocusableIn as le } from "@semcore/core/lib/utils/focus-lock/getFocusableIn";
|
|
24
|
+
var ze = ["childrenPropsGetter"], Ee = ["childrenPropsGetter"], xe = (
|
|
26
25
|
/*__reshadow_css_start__*/
|
|
27
|
-
(
|
|
26
|
+
(V.insert(
|
|
28
27
|
/*__inner_css_start__*/
|
|
29
|
-
".
|
|
30
|
-
"
|
|
28
|
+
".___SShadowHorizontal_11aq4_gg_:after,.___SShadowHorizontal_11aq4_gg_:before,.___SShadowVertical_11aq4_gg_:after,.___SShadowVertical_11aq4_gg_:before{z-index:1}",
|
|
29
|
+
"11aq4_gg_"
|
|
31
30
|
), {
|
|
32
|
-
__SShadowHorizontal: "
|
|
33
|
-
__SShadowVertical: "
|
|
31
|
+
__SShadowHorizontal: "___SShadowHorizontal_11aq4_gg_",
|
|
32
|
+
__SShadowVertical: "___SShadowVertical_11aq4_gg_"
|
|
34
33
|
})
|
|
35
|
-
), Ae = process.env.NODE_ENV === "test",
|
|
36
|
-
var x =
|
|
34
|
+
), Ae = process.env.NODE_ENV === "test", ke = function(F) {
|
|
35
|
+
var x = F.flat(20);
|
|
37
36
|
return Object.fromEntries(x.map(function(r) {
|
|
38
37
|
return [r.name, r.data];
|
|
39
38
|
}));
|
|
40
39
|
}, J = {
|
|
41
40
|
display: "contents"
|
|
42
|
-
},
|
|
41
|
+
}, rr = /* @__PURE__ */ function(Q) {
|
|
43
42
|
me(x, Q);
|
|
44
|
-
var
|
|
43
|
+
var F = pe(x);
|
|
45
44
|
function x() {
|
|
46
45
|
var r;
|
|
47
46
|
he(this, x);
|
|
48
47
|
for (var l = arguments.length, i = new Array(l), c = 0; c < l; c++)
|
|
49
48
|
i[c] = arguments[c];
|
|
50
|
-
return r =
|
|
49
|
+
return r = F.call.apply(F, [this].concat(i)), R(p(r), "state", {
|
|
51
50
|
rowHeight: void 0,
|
|
52
51
|
scrollAreaHeight: void 0,
|
|
53
52
|
scrollOffset: 0
|
|
54
53
|
}), R(p(r), "scrollContainerRef", /* @__PURE__ */ s.createRef()), R(p(r), "firstRowRef", /* @__PURE__ */ s.createRef()), R(p(r), "firstRowResizeObserver", null), R(p(r), "lockedCell", [null, !1]), R(p(r), "getRowHeight", function() {
|
|
55
|
-
var e = r.asProps.virtualScroll, o =
|
|
54
|
+
var e = r.asProps.virtualScroll, o = q(e) === "object" && (e == null ? void 0 : e.rowHeight);
|
|
56
55
|
return o || r.state.rowHeight;
|
|
57
56
|
}), R(p(r), "handleKeyDown", function(e) {
|
|
58
57
|
if (e.currentTarget === r.lockedCell[0]) {
|
|
@@ -111,7 +110,7 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
111
110
|
};
|
|
112
111
|
});
|
|
113
112
|
}), R(p(r), "setupRowSizeObserver", function() {
|
|
114
|
-
r.firstRowRef.current && r.asProps.virtualScroll &&
|
|
113
|
+
r.firstRowRef.current && r.asProps.virtualScroll && be() && (r.firstRowResizeObserver = new ResizeObserver(r.handleFirstRowResize), r.firstRowResizeObserver.observe(r.firstRowRef.current));
|
|
115
114
|
}), R(p(r), "handleBodyTransitionEnd", N(function() {
|
|
116
115
|
r.forceUpdate();
|
|
117
116
|
})), r;
|
|
@@ -120,25 +119,25 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
120
119
|
key: "renderCells",
|
|
121
120
|
value: function(l, i, c) {
|
|
122
121
|
var e = this, o = Se, t = this.asProps, n = t.styles, a = t.columns, f = t.use, g = t.uid;
|
|
123
|
-
return l.map(function(d,
|
|
122
|
+
return l.map(function(d, S) {
|
|
124
123
|
if (Array.isArray(d)) {
|
|
125
|
-
var
|
|
126
|
-
return
|
|
127
|
-
key: "".concat(
|
|
124
|
+
var y, A = "div";
|
|
125
|
+
return y = V(n), /* @__PURE__ */ s.createElement(A, y.cn("SGroupCell", {
|
|
126
|
+
key: "".concat(S),
|
|
128
127
|
"data-ui-name": "group-cell"
|
|
129
128
|
}), e.renderRows(d, !0));
|
|
130
129
|
} else {
|
|
131
|
-
var _, H, m, u, w, O, P, z, E = d.name.split("/"),
|
|
132
|
-
return h.name ===
|
|
130
|
+
var _, H, m, u, w, O, P, z, E = d.name.split("/"), k = E[0], I = E[E.length - 1], b = a.find(function(h) {
|
|
131
|
+
return h.name === k;
|
|
133
132
|
}), T = a.find(function(h) {
|
|
134
133
|
return h.name === I;
|
|
135
134
|
}), v = a.find(function(h) {
|
|
136
135
|
return h.name === d.name;
|
|
137
|
-
}),
|
|
136
|
+
}), G = _e(d, a), B = ae(G, 2), X = B[0], Y = B[1], se = (H = v == null ? void 0 : v.parentColumns.map(function(h) {
|
|
138
137
|
return h.name;
|
|
139
|
-
})) !== null && H !== void 0 ? H : [],
|
|
138
|
+
})) !== null && H !== void 0 ? H : [], L = (Array.isArray(d.cssVar) ? d.cssVar : [d.cssVar]).map(function(h) {
|
|
140
139
|
return "var(".concat(h, ")");
|
|
141
|
-
}), de = v == null || (m = v.props) === null || m === void 0 || (u = m.ref.current) === null || u === void 0 ? void 0 : u.style.getPropertyValue("min-width"),
|
|
140
|
+
}), de = v == null || (m = v.props) === null || m === void 0 || (u = m.ref.current) === null || u === void 0 ? void 0 : u.style.getPropertyValue("min-width"), U = v == null || (w = v.props) === null || w === void 0 || (O = w.ref.current) === null || O === void 0 ? void 0 : O.style.getPropertyValue("max-width"), C = {
|
|
142
141
|
name: d.name,
|
|
143
142
|
children: /* @__PURE__ */ s.createElement(s.Fragment, null, d.data),
|
|
144
143
|
justifyContent: v == null || (P = v.props) === null || P === void 0 ? void 0 : P.justifyContent,
|
|
@@ -146,29 +145,29 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
146
145
|
borderLeft: b == null ? void 0 : b.borderLeft,
|
|
147
146
|
borderRight: T == null ? void 0 : T.borderRight,
|
|
148
147
|
style: {
|
|
149
|
-
width:
|
|
148
|
+
width: L.length === 1 ? L[0] : "calc(".concat(L.join(" + "), ")"),
|
|
150
149
|
minWidth: de,
|
|
151
|
-
maxWidth:
|
|
150
|
+
maxWidth: U && v !== null && v !== void 0 && v.sortable ? "calc(".concat(Pe, "px + ").concat(U, ")") : U
|
|
152
151
|
}
|
|
153
152
|
};
|
|
154
153
|
X !== void 0 && Y !== void 0 && (C.style[X] = Y);
|
|
155
|
-
var
|
|
154
|
+
var D = ie(d.cellPropsLayers || []), Z;
|
|
156
155
|
try {
|
|
157
|
-
for (
|
|
156
|
+
for (D.s(); !(Z = D.n()).done; ) {
|
|
158
157
|
var $ = Z.value, ee = $.childrenPropsGetter, ve = ee === void 0 ? function(h) {
|
|
159
158
|
return h;
|
|
160
|
-
} : ee, fe = oe($,
|
|
161
|
-
C =
|
|
159
|
+
} : ee, fe = oe($, ze), re = W(fe, C);
|
|
160
|
+
C = W(ve(re, i, c), re);
|
|
162
161
|
}
|
|
163
162
|
} catch (h) {
|
|
164
|
-
|
|
163
|
+
D.e(h);
|
|
165
164
|
} finally {
|
|
166
|
-
|
|
165
|
+
D.f();
|
|
167
166
|
}
|
|
168
167
|
var ce = [d.name].concat(ue(se)).filter(Boolean).map(function(h) {
|
|
169
168
|
return "igc-table-".concat(g, "-").concat(h);
|
|
170
169
|
}), te = E.length;
|
|
171
|
-
return _ =
|
|
170
|
+
return _ = V(n), /* @__PURE__ */ s.createElement(o, _.cn("SCell", j(j({
|
|
172
171
|
key: d.name,
|
|
173
172
|
role: "gridcell",
|
|
174
173
|
headers: ce.join(" "),
|
|
@@ -182,8 +181,9 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
182
181
|
tabIndex: -1,
|
|
183
182
|
onKeyDown: e.handleKeyDown,
|
|
184
183
|
onFocus: e.onFocusCell,
|
|
185
|
-
"aria-colindex":
|
|
186
|
-
"aria-colspan": te === 1 ? void 0 : te
|
|
184
|
+
"aria-colindex": S + 1,
|
|
185
|
+
"aria-colspan": te === 1 ? void 0 : te,
|
|
186
|
+
innerOutline: !0
|
|
187
187
|
})));
|
|
188
188
|
}
|
|
189
189
|
}, []);
|
|
@@ -191,7 +191,7 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
191
191
|
}, {
|
|
192
192
|
key: "renderRow",
|
|
193
193
|
value: function(l, i) {
|
|
194
|
-
var c, e = i.dataIndex, o = i.topOffset, t = i.nested, n = t === void 0 ? !1 : t, a =
|
|
194
|
+
var c, e = i.dataIndex, o = i.topOffset, t = i.nested, n = t === void 0 ? !1 : t, a = M, f = this.asProps, g = f.styles, d = f.rowPropsLayers, S = f.uniqueKey, y = f.virtualScroll, A = q(y) === "object" && (y == null ? void 0 : y.rowHeight), _ = l.flatRowData || ke(l), H = _[S] ? String(_[S]) : "row_".concat(e), m = e === 0 && !A, u = {
|
|
195
195
|
children: this.renderCells(l, _, e),
|
|
196
196
|
theme: void 0,
|
|
197
197
|
active: void 0,
|
|
@@ -205,15 +205,15 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
205
205
|
for (w.s(); !(O = w.n()).done; ) {
|
|
206
206
|
var P = O.value, z = P.childrenPropsGetter, E = z === void 0 ? function(b) {
|
|
207
207
|
return b;
|
|
208
|
-
} : z,
|
|
209
|
-
u =
|
|
208
|
+
} : z, k = oe(P, Ee), I = W(k, u);
|
|
209
|
+
u = W(E(I, _, e), I);
|
|
210
210
|
}
|
|
211
211
|
} catch (b) {
|
|
212
212
|
w.e(b);
|
|
213
213
|
} finally {
|
|
214
214
|
w.f();
|
|
215
215
|
}
|
|
216
|
-
return c =
|
|
216
|
+
return c = V(g), /* @__PURE__ */ s.createElement(a, c.cn("SRow", j({
|
|
217
217
|
"data-nested": n.toString(),
|
|
218
218
|
role: n ? void 0 : "row",
|
|
219
219
|
__excludeProps: ["data"]
|
|
@@ -235,7 +235,7 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
235
235
|
value: function(l) {
|
|
236
236
|
var i, c = this;
|
|
237
237
|
if (l.length === 0) return [];
|
|
238
|
-
var e = this.asProps.virtualScroll, o = this.state, t = o.scrollOffset, n = o.scrollAreaHeight, a = this.getRowHeight(), f = (i =
|
|
238
|
+
var e = this.asProps.virtualScroll, o = this.state, t = o.scrollOffset, n = o.scrollAreaHeight, a = this.getRowHeight(), f = (i = q(e) === "object" ? e == null ? void 0 : e.tollerance : 2) !== null && i !== void 0 ? i : 2, g = Math.max(Math.floor(t / a) - f, 0), d = Math.min(Math.ceil((t + n) / a) + f, l.length), S = q(e) === "object" && (e == null ? void 0 : e.rowHeight), y = !S, A = {
|
|
239
239
|
cells: l[0],
|
|
240
240
|
dataIndex: 0,
|
|
241
241
|
topOffset: 0
|
|
@@ -246,7 +246,7 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
246
246
|
topOffset: a * (g + u)
|
|
247
247
|
};
|
|
248
248
|
});
|
|
249
|
-
return
|
|
249
|
+
return y && g !== 0 && H.unshift(A), H.map(function(m) {
|
|
250
250
|
var u = m.cells, w = m.dataIndex, O = m.topOffset;
|
|
251
251
|
return c.renderRow(u, {
|
|
252
252
|
dataIndex: w,
|
|
@@ -264,12 +264,12 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
264
264
|
}, {
|
|
265
265
|
key: "render",
|
|
266
266
|
value: function() {
|
|
267
|
-
var l = this.asProps, i, c =
|
|
268
|
-
var
|
|
269
|
-
return v +
|
|
270
|
-
}, 0) > 0 || Ae, O =
|
|
271
|
-
|
|
272
|
-
var b = (i =
|
|
267
|
+
var l = this.asProps, i, c = M, e = M, o = M, t = this.asProps, n = t.Children, a = t.styles, f = t.rows, g = t.columns, d = t.$scrollRef, S = t.virtualScroll, y = t.onResize, A = t.onScroll, _ = t.disabledScroll, H = t.renderRows, m = t.animationsDisabled, u = t.scrollContainerRef, w = g.reduce(function(v, G) {
|
|
268
|
+
var B = G.width;
|
|
269
|
+
return v + B;
|
|
270
|
+
}, 0) > 0 || Ae, O = He(g), P = ae(O, 2), z = P[0], E = P[1], k = this.getRowHeight(), I = k !== void 0 && S ? k * f.length : void 0;
|
|
271
|
+
S && w && !k && requestAnimationFrame(this.setupRowSizeObserver);
|
|
272
|
+
var b = (i = V(a), /* @__PURE__ */ s.createElement(c, i.cn("SBody", j({}, Re({
|
|
273
273
|
animationsDisabled: m,
|
|
274
274
|
onTransitionEnd: this.handleBodyTransitionEnd
|
|
275
275
|
}, l))), H ? H({
|
|
@@ -279,21 +279,21 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
279
279
|
}) || null : /* @__PURE__ */ s.createElement(s.Fragment, null, I ? /* @__PURE__ */ s.createElement(o, i.cn("SHeightHold", {
|
|
280
280
|
hMin: I,
|
|
281
281
|
"aria-hidden": !0
|
|
282
|
-
})) : null,
|
|
282
|
+
})) : null, S ? this.renderVirtualizedRows(f) : this.renderRows(f))));
|
|
283
283
|
if (_)
|
|
284
284
|
return /* @__PURE__ */ s.createElement(e, null, b);
|
|
285
285
|
var T = [d, this.scrollContainerRef];
|
|
286
|
-
return u && T.push(u), /* @__PURE__ */ s.createElement(
|
|
286
|
+
return u && T.push(u), /* @__PURE__ */ s.createElement(ye.Provider, {
|
|
287
287
|
value: !0
|
|
288
|
-
}, /* @__PURE__ */ s.createElement(e, i.cn("SBodyWrapper", {}), /* @__PURE__ */ s.createElement(
|
|
288
|
+
}, /* @__PURE__ */ s.createElement(e, i.cn("SBodyWrapper", {}), /* @__PURE__ */ s.createElement(K, i.cn("ScrollArea", {
|
|
289
289
|
shadow: !0,
|
|
290
290
|
leftOffset: z,
|
|
291
291
|
rightOffset: E,
|
|
292
|
-
onResize: ne(
|
|
293
|
-
onScroll: ne(
|
|
294
|
-
styles:
|
|
295
|
-
}), /* @__PURE__ */ s.createElement(
|
|
296
|
-
ref:
|
|
292
|
+
onResize: ne(y, this.handleScrollAreaResize),
|
|
293
|
+
onScroll: ne(A, this.handleScrollAreaScroll),
|
|
294
|
+
styles: xe
|
|
295
|
+
}), /* @__PURE__ */ s.createElement(K.Container, {
|
|
296
|
+
ref: Oe.apply(void 0, T),
|
|
297
297
|
role: "rowgroup",
|
|
298
298
|
focusRingTopOffset: "3px",
|
|
299
299
|
tabIndex: -1
|
|
@@ -303,18 +303,18 @@ var Ee = ["childrenPropsGetter"], xe = ["childrenPropsGetter"], ke = (
|
|
|
303
303
|
style: J
|
|
304
304
|
}), /* @__PURE__ */ s.createElement("div", i.cn("div", {
|
|
305
305
|
style: J
|
|
306
|
-
}), /* @__PURE__ */ s.createElement(
|
|
306
|
+
}), /* @__PURE__ */ s.createElement(K.Bar, {
|
|
307
307
|
orientation: "horizontal",
|
|
308
308
|
bottom: 0,
|
|
309
309
|
container: this.scrollContainerRef
|
|
310
|
-
}), /* @__PURE__ */ s.createElement(
|
|
310
|
+
}), /* @__PURE__ */ s.createElement(K.Bar, {
|
|
311
311
|
orientation: "vertical",
|
|
312
312
|
w: "12px",
|
|
313
313
|
zIndex: 2
|
|
314
314
|
}))))), n.origin));
|
|
315
315
|
}
|
|
316
316
|
}]), x;
|
|
317
|
-
}(
|
|
317
|
+
}(we);
|
|
318
318
|
export {
|
|
319
|
-
|
|
319
|
+
rr as default
|
|
320
320
|
};
|