@semcore/data-table 17.0.0-prerelease.36 → 17.0.0-prerelease.37
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 +1 -1
- package/lib/esm/components/AccordionRows/AccordionRows.mjs +0 -1
- package/lib/esm/components/Body/Body.mjs +19 -26
- package/lib/esm/components/Body/Cell.mjs +6 -9
- package/lib/esm/components/Body/LimitOverlay.mjs +2 -3
- package/lib/esm/components/Body/Row.mjs +18 -23
- package/lib/esm/components/Body/RowGroup.mjs +3 -3
- package/lib/esm/components/DataTable/DataTable.mjs +77 -94
- package/lib/esm/components/Head/Column.mjs +13 -19
- package/lib/esm/components/Head/Group.mjs +1 -2
- package/lib/esm/components/Head/Head.mjs +9 -14
- package/lib/esm/components/RowSelector/RowsSelector.mjs +5 -6
- package/lib/esm/enhancers/focusableCell.mjs +4 -5
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,6 @@ import { sstyled } from "@semcore/core";
|
|
|
3
3
|
import { Box } from "@semcore/base-components";
|
|
4
4
|
import React__default from "react";
|
|
5
5
|
import { Row } from "../Body/Row.mjs";
|
|
6
|
-
/*!__reshadow-styles__:"../Body/style.shadow.css"*/
|
|
7
6
|
const styles = (
|
|
8
7
|
/*__reshadow_css_start__*/
|
|
9
8
|
(sstyled.insert(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import {
|
|
2
|
+
import { sstyled, Component, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Box } from "@semcore/base-components";
|
|
4
4
|
import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
|
|
5
5
|
import { hasParent } from "@semcore/core/lib/utils/hasParent";
|
|
@@ -9,7 +9,6 @@ import { MergedColumnsCell } from "./MergedCells.mjs";
|
|
|
9
9
|
import { Row } from "./Row.mjs";
|
|
10
10
|
import { RowGroup } from "./RowGroup.mjs";
|
|
11
11
|
import { UNIQ_ROW_KEY, ROW_INDEX, GRID_ROW_INDEX, IS_EMPTY_DATA_ROW } from "../DataTable/DataTable.mjs";
|
|
12
|
-
/*!__reshadow-styles__:"./style.shadow.css"*/
|
|
13
12
|
const style = (
|
|
14
13
|
/*__reshadow_css_start__*/
|
|
15
14
|
(sstyled.insert(
|
|
@@ -85,22 +84,21 @@ class BodyRoot extends Component {
|
|
|
85
84
|
_defineProperty(this, "spinContainerIsFocused", false);
|
|
86
85
|
_defineProperty(this, "calculateAriaRowIndex", () => {
|
|
87
86
|
requestAnimationFrame(() => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
collapsedElements == null ? void 0 : collapsedElements.forEach((collapsedElement) => {
|
|
87
|
+
const collapsedElements = this.bodyRef.current?.querySelectorAll('[role=row][data-ui-name="Collapse"]:not([aria-hidden=true]):not(:scope [data-ui-name="DataTable"] [role=row]:not([aria-hidden=true]))');
|
|
88
|
+
collapsedElements?.forEach((collapsedElement) => {
|
|
91
89
|
const parent = collapsedElement.parentElement;
|
|
92
|
-
if (
|
|
93
|
-
parent
|
|
90
|
+
if (parent?.getAttribute("role") === "rowgroup") {
|
|
91
|
+
parent?.appendChild(collapsedElement);
|
|
94
92
|
}
|
|
95
93
|
});
|
|
96
|
-
const visibleRows =
|
|
97
|
-
visibleRows
|
|
94
|
+
const visibleRows = this.bodyRef.current?.querySelectorAll('[role=row]:not([aria-hidden=true]):not(:scope [data-ui-name="DataTable"] [role=row]:not([aria-hidden=true]))');
|
|
95
|
+
visibleRows?.forEach((row, index) => {
|
|
98
96
|
if (row instanceof HTMLElement) {
|
|
99
97
|
row.setAttribute("aria-rowindex", (index + 2 + this.startIndex).toString());
|
|
100
98
|
}
|
|
101
99
|
});
|
|
102
100
|
if (!this.asProps.totalRows) {
|
|
103
|
-
|
|
101
|
+
this.asProps.tableRef.current?.setAttribute("aria-rowcount", (visibleRows?.length ?? 0).toString());
|
|
104
102
|
}
|
|
105
103
|
});
|
|
106
104
|
});
|
|
@@ -158,15 +156,13 @@ class BodyRoot extends Component {
|
|
|
158
156
|
if (loading) {
|
|
159
157
|
const activeElement = document.activeElement;
|
|
160
158
|
setTimeout(() => {
|
|
161
|
-
var _a;
|
|
162
159
|
if (tableRef.current && hasParent(activeElement, tableRef.current)) {
|
|
163
|
-
|
|
160
|
+
tableRef.current?.focus();
|
|
164
161
|
}
|
|
165
162
|
});
|
|
166
163
|
} else if (!loading && this.spinContainerIsFocused) {
|
|
167
164
|
setTimeout(() => {
|
|
168
|
-
|
|
169
|
-
(_a = tableRef.current) == null ? void 0 : _a.focus();
|
|
165
|
+
tableRef.current?.focus();
|
|
170
166
|
});
|
|
171
167
|
this.spinContainerIsFocused = false;
|
|
172
168
|
}
|
|
@@ -209,7 +205,7 @@ class BodyRoot extends Component {
|
|
|
209
205
|
const index = row[ROW_INDEX];
|
|
210
206
|
const gridRowIndex = row[GRID_ROW_INDEX] + (hasGroups ? INDEX_OFFSET + 1 : INDEX_OFFSET);
|
|
211
207
|
const sideIndentsValue = variant === "card" ? "wide" : sideIndents;
|
|
212
|
-
const calculatedRowProps =
|
|
208
|
+
const calculatedRowProps = rowProps?.(row, index) ?? {};
|
|
213
209
|
return {
|
|
214
210
|
...calculatedRowProps,
|
|
215
211
|
use,
|
|
@@ -252,7 +248,6 @@ class BodyRoot extends Component {
|
|
|
252
248
|
};
|
|
253
249
|
}
|
|
254
250
|
render() {
|
|
255
|
-
var _a, _b, _c, _d;
|
|
256
251
|
var _ref = this.asProps, _ref2;
|
|
257
252
|
const SBody = Box;
|
|
258
253
|
const SSpinContainer = Box;
|
|
@@ -276,7 +271,7 @@ class BodyRoot extends Component {
|
|
|
276
271
|
let lastIndex = -1;
|
|
277
272
|
if (virtualScroll) {
|
|
278
273
|
const rowsBuffer = typeof virtualScroll !== "boolean" && "rowsBuffer" in virtualScroll ? virtualScroll.rowsBuffer ?? ROWS_BUFFER : ROWS_BUFFER;
|
|
279
|
-
const offsetHeight =
|
|
274
|
+
const offsetHeight = tableContainerRef.current?.offsetHeight ?? 0;
|
|
280
275
|
const prevPrepared = scrollDirection === "up" ? rowsBuffer : 4;
|
|
281
276
|
const nextPrepared = scrollDirection === "up" ? 4 : rowsBuffer;
|
|
282
277
|
if (typeof virtualScroll === "boolean" || !("rowHeight" in virtualScroll)) {
|
|
@@ -298,7 +293,7 @@ class BodyRoot extends Component {
|
|
|
298
293
|
break;
|
|
299
294
|
}
|
|
300
295
|
}
|
|
301
|
-
if (scrollTop + offsetHeight < (
|
|
296
|
+
if (scrollTop + offsetHeight < (this.rowsHeightMap.get(lastIndex ?? 0)?.[1] ?? 0)) {
|
|
302
297
|
lastIndex = lastIndex + aproxRowsOnPage;
|
|
303
298
|
}
|
|
304
299
|
} else if (scrollDirection === "up") {
|
|
@@ -318,7 +313,7 @@ class BodyRoot extends Component {
|
|
|
318
313
|
break;
|
|
319
314
|
}
|
|
320
315
|
}
|
|
321
|
-
if (scrollTop < (
|
|
316
|
+
if (scrollTop < (this.rowsHeightMap.get(startIndex ?? 0)?.[0] ?? 0)) {
|
|
322
317
|
startIndex = Math.max(startIndex - aproxRowsOnPage, 0);
|
|
323
318
|
}
|
|
324
319
|
}
|
|
@@ -339,7 +334,7 @@ class BodyRoot extends Component {
|
|
|
339
334
|
}
|
|
340
335
|
}
|
|
341
336
|
this.startIndex = startIndex === -1 ? 0 : startIndex;
|
|
342
|
-
const rowMarginTop =
|
|
337
|
+
const rowMarginTop = this.rowsHeightMap.get(this.startIndex - 1)?.[1];
|
|
343
338
|
const needMarginTop = typeof virtualScroll === "boolean" || virtualScroll && !("rowHeight" in virtualScroll);
|
|
344
339
|
let emptyRow = null;
|
|
345
340
|
if (rowsToRender.length === 0) {
|
|
@@ -368,7 +363,6 @@ class BodyRoot extends Component {
|
|
|
368
363
|
}), needMarginTop && rowMarginTop && /* @__PURE__ */ React.createElement(Box, _ref2.cn("Box", {
|
|
369
364
|
"h": rowMarginTop
|
|
370
365
|
})), rowsToRender.map((row, index) => {
|
|
371
|
-
var _a2;
|
|
372
366
|
if (Array.isArray(row)) {
|
|
373
367
|
const groupUniqKey = row[0][UNIQ_ROW_KEY];
|
|
374
368
|
return /* @__PURE__ */ React.createElement(RowGroup, {
|
|
@@ -383,12 +377,12 @@ class BodyRoot extends Component {
|
|
|
383
377
|
});
|
|
384
378
|
}
|
|
385
379
|
return /* @__PURE__ */ React.createElement(Body.Row, {
|
|
386
|
-
key:
|
|
380
|
+
key: row[UNIQ_ROW_KEY]?.toString(),
|
|
387
381
|
row,
|
|
388
382
|
ref: virtualScroll ? this.handleRef(this.startIndex + index, row) : void 0,
|
|
389
383
|
componentRef: this.handleComponentRef(row)
|
|
390
384
|
});
|
|
391
|
-
}), renderCellOverlay
|
|
385
|
+
}), renderCellOverlay?.(), loading && /* @__PURE__ */ React.createElement(SSpinContainer, _ref2.cn("SSpinContainer", {
|
|
392
386
|
"innerOutline": true,
|
|
393
387
|
"headerHeight": `${this.getSpinnerTopOffset()}px`,
|
|
394
388
|
"tabIndex": -1,
|
|
@@ -402,12 +396,11 @@ class BodyRoot extends Component {
|
|
|
402
396
|
}))));
|
|
403
397
|
}
|
|
404
398
|
setRowHeight(index, row) {
|
|
405
|
-
var _a, _b;
|
|
406
399
|
const {
|
|
407
400
|
expandedRows
|
|
408
401
|
} = this.asProps;
|
|
409
|
-
const node =
|
|
410
|
-
const firstChild =
|
|
402
|
+
const node = this.rowsHeightMap.get(index)?.[2];
|
|
403
|
+
const firstChild = node?.role === "rowgroup" ? node?.children.item(0)?.children.item(0) : node?.children.item(0);
|
|
411
404
|
if (node && firstChild instanceof HTMLElement) {
|
|
412
405
|
const offset = firstChild.offsetTop - this.asProps.headerHeight;
|
|
413
406
|
let height = firstChild.getBoundingClientRect().height;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import {
|
|
2
|
+
import { sstyled, Component, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Box, Flex } from "@semcore/base-components";
|
|
4
4
|
import { getFocusableIn } from "@semcore/core/lib/utils/focus-lock/getFocusableIn";
|
|
5
5
|
import { isFocusInside } from "@semcore/core/lib/utils/focus-lock/isFocusInside";
|
|
@@ -7,7 +7,6 @@ import { isInteractiveElement } from "@semcore/core/lib/utils/isInteractiveEleme
|
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { MergedColumnsCell, MergedRowsCell } from "./MergedCells.mjs";
|
|
9
9
|
import { handleKeydownFocusCell, handleFocusCell } from "../../enhancers/focusableCell.mjs";
|
|
10
|
-
/*!__reshadow-styles__:"./style.shadow.css"*/
|
|
11
10
|
const styles = (
|
|
12
11
|
/*__reshadow_css_start__*/
|
|
13
12
|
(sstyled.insert(
|
|
@@ -80,7 +79,6 @@ class CellRoot extends Component {
|
|
|
80
79
|
handleFocusCell(this.lockedCell, e.target, e.currentTarget);
|
|
81
80
|
});
|
|
82
81
|
_defineProperty(this, "handleClickCell", (e) => {
|
|
83
|
-
var _a, _b;
|
|
84
82
|
const {
|
|
85
83
|
rowIndex,
|
|
86
84
|
columnIndex,
|
|
@@ -88,18 +86,18 @@ class CellRoot extends Component {
|
|
|
88
86
|
row,
|
|
89
87
|
accordionRowIndex
|
|
90
88
|
} = this.asProps;
|
|
91
|
-
const rowElement =
|
|
92
|
-
const ariaRowindex = Number(rowElement
|
|
89
|
+
const rowElement = e.currentTarget.parentElement?.parentElement;
|
|
90
|
+
const ariaRowindex = Number(rowElement?.getAttribute("aria-rowindex"));
|
|
93
91
|
let rowIndexValue = accordionRowIndex === void 0 ? rowIndex : rowIndex + 1 + accordionRowIndex;
|
|
94
92
|
if (!isNaN(ariaRowindex)) {
|
|
95
93
|
rowIndexValue = ariaRowindex - 2;
|
|
96
94
|
}
|
|
97
|
-
const focusableChildren = Array.from(
|
|
95
|
+
const focusableChildren = Array.from(this.cellRef.current?.children ?? []).flatMap((node) => getFocusableIn(node));
|
|
98
96
|
if (isInteractiveElement(e.target) && this.cellRef.current && focusableChildren.length > 1) {
|
|
99
97
|
this.lockedCell[0] = this.cellRef.current;
|
|
100
98
|
this.lockedCell[1] = true;
|
|
101
99
|
}
|
|
102
|
-
onClick
|
|
100
|
+
onClick?.(e, {
|
|
103
101
|
rowIndex: rowIndexValue,
|
|
104
102
|
colIndex: columnIndex,
|
|
105
103
|
row
|
|
@@ -107,13 +105,12 @@ class CellRoot extends Component {
|
|
|
107
105
|
});
|
|
108
106
|
}
|
|
109
107
|
componentWillUnmount() {
|
|
110
|
-
var _a;
|
|
111
108
|
const {
|
|
112
109
|
virtualScroll,
|
|
113
110
|
tableRef
|
|
114
111
|
} = this.asProps;
|
|
115
112
|
if (virtualScroll && this.cellRef.current && isFocusInside(this.cellRef.current)) {
|
|
116
|
-
|
|
113
|
+
tableRef.current?.setAttribute("tabIndex", "0");
|
|
117
114
|
}
|
|
118
115
|
}
|
|
119
116
|
render() {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import {
|
|
2
|
+
import { sstyled, Component, createComponent } from "@semcore/core";
|
|
3
3
|
import { Flex, Box } from "@semcore/base-components";
|
|
4
4
|
import { hasParent } from "@semcore/core/lib/utils/hasParent";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { handleKeydownFocusCell, handleFocusCell } from "../../enhancers/focusableCell.mjs";
|
|
7
7
|
import { GRID_ROW_INDEX, ACCORDION } from "../DataTable/DataTable.mjs";
|
|
8
|
-
/*!__reshadow-styles__:"./style.shadow.css"*/
|
|
9
8
|
const style = (
|
|
10
9
|
/*__reshadow_css_start__*/
|
|
11
10
|
(sstyled.insert(
|
|
@@ -165,7 +164,7 @@ class LimitOverlayRoot extends Component {
|
|
|
165
164
|
"tabIndex": -1,
|
|
166
165
|
"onFocus": this.handleFocusableCellFocus,
|
|
167
166
|
"onKeyDown": this.handleFocusableCellKeyDown
|
|
168
|
-
}), renderOverlay
|
|
167
|
+
}), renderOverlay?.()));
|
|
169
168
|
}
|
|
170
169
|
}
|
|
171
170
|
_defineProperty(LimitOverlayRoot, "displayName", "LimitOverlay");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import {
|
|
2
|
+
import { sstyled, Component, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Box, Collapse } from "@semcore/base-components";
|
|
4
4
|
import { ButtonLink } from "@semcore/button";
|
|
5
5
|
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
@@ -12,7 +12,6 @@ import { MergedRowsCell, MergedColumnsCell } from "./MergedCells.mjs";
|
|
|
12
12
|
import { AccordionRows } from "../AccordionRows/AccordionRows.mjs";
|
|
13
13
|
import { ACCORDION, UNIQ_ROW_KEY, ROW_INDEX, IS_EMPTY_DATA_ROW, ROW_GROUP } from "../DataTable/DataTable.mjs";
|
|
14
14
|
import { RowSelector } from "../RowSelector/RowsSelector.mjs";
|
|
15
|
-
/*!__reshadow-styles__:"./style.shadow.css"*/
|
|
16
15
|
const style = (
|
|
17
16
|
/*__reshadow_css_start__*/
|
|
18
17
|
(sstyled.insert(
|
|
@@ -133,8 +132,7 @@ class RowRoot extends Component {
|
|
|
133
132
|
[...previousRows.entries()].forEach(([uniqKey, previousRow]) => {
|
|
134
133
|
if (!this.state.expandedForAnimation) {
|
|
135
134
|
setTimeout(() => {
|
|
136
|
-
|
|
137
|
-
(_a = this.asProps.componentsMap.get(uniqKey)) == null ? void 0 : _a.closeAccordion(previousRow, closeDuration);
|
|
135
|
+
this.asProps.componentsMap.get(uniqKey)?.closeAccordion(previousRow, closeDuration);
|
|
138
136
|
}, openDuration / 3);
|
|
139
137
|
}
|
|
140
138
|
});
|
|
@@ -177,10 +175,9 @@ class RowRoot extends Component {
|
|
|
177
175
|
clearTimeout(this.openAccordionTimeout);
|
|
178
176
|
}
|
|
179
177
|
this.setState((prevState) => {
|
|
180
|
-
var _a;
|
|
181
178
|
return {
|
|
182
179
|
expandedForAnimation: true,
|
|
183
|
-
accordionRows:
|
|
180
|
+
accordionRows: prevState.accordionRows?.slice(0, accordionAnimationRows)
|
|
184
181
|
};
|
|
185
182
|
}, calculateAriaRowIndex);
|
|
186
183
|
this.closeAccordionTimeout = window.setTimeout(() => {
|
|
@@ -201,7 +198,7 @@ class RowRoot extends Component {
|
|
|
201
198
|
const {
|
|
202
199
|
componentRef
|
|
203
200
|
} = this.asProps;
|
|
204
|
-
componentRef
|
|
201
|
+
componentRef?.(this);
|
|
205
202
|
this.setAccordion();
|
|
206
203
|
}
|
|
207
204
|
componentDidUpdate(prevProps) {
|
|
@@ -213,8 +210,7 @@ class RowRoot extends Component {
|
|
|
213
210
|
}
|
|
214
211
|
}
|
|
215
212
|
componentWillUnmount() {
|
|
216
|
-
|
|
217
|
-
(_b = (_a = this.asProps).componentRef) == null ? void 0 : _b.call(_a, null);
|
|
213
|
+
this.asProps.componentRef?.(null);
|
|
218
214
|
}
|
|
219
215
|
setAccordion() {
|
|
220
216
|
const {
|
|
@@ -247,7 +243,7 @@ class RowRoot extends Component {
|
|
|
247
243
|
});
|
|
248
244
|
}
|
|
249
245
|
cellHasAccordion(cellValue) {
|
|
250
|
-
return !(cellValue instanceof MergedRowsCell || cellValue instanceof MergedColumnsCell) && Boolean(cellValue
|
|
246
|
+
return !(cellValue instanceof MergedRowsCell || cellValue instanceof MergedColumnsCell) && Boolean(cellValue?.[ACCORDION]);
|
|
251
247
|
}
|
|
252
248
|
handleClickRow(row) {
|
|
253
249
|
return (e) => {
|
|
@@ -291,7 +287,7 @@ class RowRoot extends Component {
|
|
|
291
287
|
value = cellValue;
|
|
292
288
|
}
|
|
293
289
|
const defaultRender = () => {
|
|
294
|
-
return /* @__PURE__ */ React.isValidElement(value) ? value : value
|
|
290
|
+
return /* @__PURE__ */ React.isValidElement(value) ? value : value?.toString();
|
|
295
291
|
};
|
|
296
292
|
let withoutBorder = props.row[IS_EMPTY_DATA_ROW];
|
|
297
293
|
if (variant === "card") {
|
|
@@ -303,7 +299,7 @@ class RowRoot extends Component {
|
|
|
303
299
|
use,
|
|
304
300
|
virtualScroll: Boolean(virtualScroll),
|
|
305
301
|
tableRef,
|
|
306
|
-
children:
|
|
302
|
+
children: props?.children ?? defaultRender(),
|
|
307
303
|
onClick: onCellClick,
|
|
308
304
|
flatRows: this.asProps.flatRows,
|
|
309
305
|
shadowVertical,
|
|
@@ -323,7 +319,7 @@ class RowRoot extends Component {
|
|
|
323
319
|
columnIndex: props.columnIndex,
|
|
324
320
|
dataKey,
|
|
325
321
|
defaultRender,
|
|
326
|
-
value: /* @__PURE__ */ React.isValidElement(value) ? value :
|
|
322
|
+
value: /* @__PURE__ */ React.isValidElement(value) ? value : value?.toString() ?? "",
|
|
327
323
|
isMergedRows,
|
|
328
324
|
isMergedColumns,
|
|
329
325
|
rawData: rowRawData,
|
|
@@ -343,9 +339,9 @@ class RowRoot extends Component {
|
|
|
343
339
|
}
|
|
344
340
|
}
|
|
345
341
|
const firstColumnIndex = selectedRows ? 1 : 0;
|
|
346
|
-
if (props.columnIndex === firstColumnIndex && props.row[ACCORDION] ||
|
|
342
|
+
if (props.columnIndex === firstColumnIndex && props.row[ACCORDION] || value?.[ACCORDION] || cellValue instanceof MergedRowsCell && cellValue.accordion) {
|
|
347
343
|
var _ref2;
|
|
348
|
-
const expanded =
|
|
344
|
+
const expanded = expandedRows?.has(props.row[UNIQ_ROW_KEY]) && !this.state.expandedForAnimation;
|
|
349
345
|
extraProps.expanded = expanded;
|
|
350
346
|
if (expanded) {
|
|
351
347
|
extraProps.withoutBorder = false;
|
|
@@ -355,7 +351,7 @@ class RowRoot extends Component {
|
|
|
355
351
|
const handleClick = (e) => {
|
|
356
352
|
this.handleExpandRow(row, rowIndex);
|
|
357
353
|
};
|
|
358
|
-
if (
|
|
354
|
+
if (value?.[ACCORDION] || cellValue instanceof MergedRowsCell && cellValue.accordion) {
|
|
359
355
|
extraProps.onClick = callAllEventHandlers(extraProps.onClick, this.handleClickCell);
|
|
360
356
|
}
|
|
361
357
|
extraProps.children = (_ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SAccordionToggle, _ref2.cn("SAccordionToggle", {
|
|
@@ -377,12 +373,11 @@ class RowRoot extends Component {
|
|
|
377
373
|
rowIndex,
|
|
378
374
|
limit
|
|
379
375
|
} = this.asProps;
|
|
380
|
-
const rowsLimit = limit
|
|
381
|
-
const columnsLimit = limit
|
|
376
|
+
const rowsLimit = limit?.fromRow;
|
|
377
|
+
const columnsLimit = limit?.fromColumn;
|
|
382
378
|
return rowsLimit !== void 0 && !columnsLimit && rowIndex > rowsLimit ? true : void 0;
|
|
383
379
|
}
|
|
384
380
|
render() {
|
|
385
|
-
var _a;
|
|
386
381
|
var _ref = this.asProps, _ref3;
|
|
387
382
|
const SRow = Box;
|
|
388
383
|
const SCollapseRow = Collapse;
|
|
@@ -424,17 +419,17 @@ class RowRoot extends Component {
|
|
|
424
419
|
accordionRows,
|
|
425
420
|
accordionComponent
|
|
426
421
|
} = this.state;
|
|
427
|
-
const expanded =
|
|
422
|
+
const expanded = expandedRows?.has(row[UNIQ_ROW_KEY]) && !expandedForAnimation;
|
|
428
423
|
const accordionType = row[ACCORDION] && !mergedRow ? "row" : void 0;
|
|
429
424
|
let accordionDataGridArea = "";
|
|
430
425
|
if (accordionRows || accordionComponent) {
|
|
431
|
-
const rowIncrement =
|
|
426
|
+
const rowIncrement = row[ROW_GROUP]?.size ? row[ROW_GROUP].size + 1 : 1;
|
|
432
427
|
accordionDataGridArea = accordionRows ? `${gridRowIndex + rowIncrement} / 1 / ${gridRowIndex + rowIncrement + accordionRows.length} / ${columns.length + 1}` : `${gridRowIndex + rowIncrement} / 1 / ${gridRowIndex + rowIncrement} / ${columns.length + 1}`;
|
|
433
428
|
}
|
|
434
429
|
const rowUniqKey = row[UNIQ_ROW_KEY];
|
|
435
430
|
const accordionId = `${uid}_${rowUniqKey}`;
|
|
436
|
-
const rowsLimit = limit
|
|
437
|
-
const columnsLimit = limit
|
|
431
|
+
const rowsLimit = limit?.fromRow;
|
|
432
|
+
const columnsLimit = limit?.fromColumn;
|
|
438
433
|
const filledColumns = columns.reduce((acc, column) => {
|
|
439
434
|
const cellValue = row[column.name];
|
|
440
435
|
if (cellValue instanceof MergedColumnsCell) {
|
|
@@ -5,7 +5,6 @@ import * as React from "react";
|
|
|
5
5
|
import { Body } from "./Body.mjs";
|
|
6
6
|
import { MergedRowsCell } from "./MergedCells.mjs";
|
|
7
7
|
import { UNIQ_ROW_KEY, SELECT_ALL } from "../DataTable/DataTable.mjs";
|
|
8
|
-
/*!__reshadow-styles__:"./style.shadow.css"*/
|
|
9
8
|
const style = (
|
|
10
9
|
/*__reshadow_css_start__*/
|
|
11
10
|
(sstyled.insert(
|
|
@@ -95,11 +94,13 @@ class RowGroup extends React.PureComponent {
|
|
|
95
94
|
rowIndex
|
|
96
95
|
} = this.props;
|
|
97
96
|
const groupUniqKey = rows[0][UNIQ_ROW_KEY];
|
|
97
|
+
let isFirstCellAreMergedRows = false;
|
|
98
98
|
if (selectedRows) {
|
|
99
99
|
const nextColumnName = columns[1].name;
|
|
100
100
|
const firstCell = rows[0][nextColumnName];
|
|
101
101
|
if (firstCell instanceof MergedRowsCell) {
|
|
102
102
|
rows[0][SELECT_ALL.toString()] = new MergedRowsCell("", firstCell.rowsCount);
|
|
103
|
+
isFirstCellAreMergedRows = true;
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
return _ref = sstyled(style), /* @__PURE__ */ React.createElement(SRowGroup, _ref.cn("SRowGroup", {
|
|
@@ -107,14 +108,13 @@ class RowGroup extends React.PureComponent {
|
|
|
107
108
|
"key": `gg_${groupUniqKey}`,
|
|
108
109
|
"ref": this.props.handleRef(startIndex + rowIndex, rows[0])
|
|
109
110
|
}), rows.map((item, i) => {
|
|
110
|
-
var _a;
|
|
111
111
|
const rowProps = {
|
|
112
112
|
row: item,
|
|
113
113
|
mergedRow: i > 0 ? true : false,
|
|
114
114
|
componentRef: this.props.handleComponentRef(item)
|
|
115
115
|
};
|
|
116
116
|
return /* @__PURE__ */ React.createElement(Body.Row, _extends({
|
|
117
|
-
key:
|
|
117
|
+
key: item[UNIQ_ROW_KEY]?.toString() ?? `gg_${groupUniqKey}_row_${i}`
|
|
118
118
|
}, rowProps));
|
|
119
119
|
}));
|
|
120
120
|
}
|