polaris-react-extended 13.10.4 → 13.10.5-rc1
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/build/cjs/components/IndexTable/IndexTable.js +107 -8
- package/build/cjs/components/IndexTable/components/Checkbox/Checkbox.js +10 -5
- package/build/cjs/components/IndexTable/components/Row/Row.js +31 -3
- package/build/esm/components/IndexTable/IndexTable.js +108 -9
- package/build/esm/components/IndexTable/components/Checkbox/Checkbox.js +10 -5
- package/build/esm/components/IndexTable/components/Row/Row.js +31 -3
- package/build/esm/styles.css +1 -1
- package/build/esnext/components/AppProvider/global.out.css +1 -1
- package/build/esnext/components/IndexTable/IndexTable.esnext +108 -9
- package/build/esnext/components/IndexTable/components/Checkbox/Checkbox.esnext +10 -5
- package/build/esnext/components/IndexTable/components/Row/Row.esnext +31 -3
- package/build/ts/src/components/IndexTable/IndexTable.d.ts +22 -0
- package/build/ts/src/components/IndexTable/IndexTable.d.ts.map +1 -1
- package/build/ts/src/components/IndexTable/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/build/ts/src/components/IndexTable/components/Row/Row.d.ts +8 -0
- package/build/ts/src/components/IndexTable/components/Row/Row.d.ts.map +1 -1
- package/build/ts/src/utilities/index-table/context.d.ts +12 -0
- package/build/ts/src/utilities/index-table/context.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -49,12 +49,24 @@ function IndexTableBase({
|
|
|
49
49
|
sortToggleLabels,
|
|
50
50
|
hasZebraStriping,
|
|
51
51
|
pagination,
|
|
52
|
+
expandable,
|
|
53
|
+
expandedRowIds,
|
|
54
|
+
defaultExpandedRowIds,
|
|
55
|
+
onExpandedChange,
|
|
56
|
+
getRowChildren,
|
|
57
|
+
isRowExpandable,
|
|
58
|
+
expandIconCollapsed,
|
|
59
|
+
expandIconExpanded,
|
|
60
|
+
expandButtonClassName,
|
|
61
|
+
expandButtonStyle,
|
|
52
62
|
rowClassName,
|
|
53
63
|
rowStyle,
|
|
54
64
|
cellClassName,
|
|
55
65
|
cellStyle,
|
|
56
66
|
checkboxClassName,
|
|
57
67
|
checkboxStyle,
|
|
68
|
+
checkboxWrapperClassName,
|
|
69
|
+
checkboxWrapperStyle,
|
|
58
70
|
...restProps
|
|
59
71
|
}) {
|
|
60
72
|
const {
|
|
@@ -88,6 +100,38 @@ function IndexTableBase({
|
|
|
88
100
|
const [tableInitialized, setTableInitialized] = React.useState(false);
|
|
89
101
|
const [stickyWrapper, setStickyWrapper] = React.useState(null);
|
|
90
102
|
const [hideScrollContainer, setHideScrollContainer] = React.useState(true);
|
|
103
|
+
|
|
104
|
+
// Expansion state
|
|
105
|
+
const [expandedRows, setExpandedRows] = React.useState(() => {
|
|
106
|
+
if (expandedRowIds) {
|
|
107
|
+
return new Set(expandedRowIds);
|
|
108
|
+
}
|
|
109
|
+
if (defaultExpandedRowIds) {
|
|
110
|
+
return new Set(defaultExpandedRowIds);
|
|
111
|
+
}
|
|
112
|
+
return new Set();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Update expanded state when prop changes
|
|
116
|
+
React.useEffect(() => {
|
|
117
|
+
if (expandedRowIds !== undefined) {
|
|
118
|
+
setExpandedRows(new Set(expandedRowIds));
|
|
119
|
+
}
|
|
120
|
+
}, [expandedRowIds]);
|
|
121
|
+
|
|
122
|
+
// Toggle expansion
|
|
123
|
+
const toggleRowExpansion = React.useCallback(rowId => {
|
|
124
|
+
setExpandedRows(prev => {
|
|
125
|
+
const newExpanded = new Set(prev);
|
|
126
|
+
if (newExpanded.has(rowId)) {
|
|
127
|
+
newExpanded.delete(rowId);
|
|
128
|
+
} else {
|
|
129
|
+
newExpanded.add(rowId);
|
|
130
|
+
}
|
|
131
|
+
onExpandedChange?.(Array.from(newExpanded));
|
|
132
|
+
return newExpanded;
|
|
133
|
+
});
|
|
134
|
+
}, [onExpandedChange]);
|
|
91
135
|
const tableHeadings = React.useRef([]);
|
|
92
136
|
const stickyTableHeadings = React.useRef([]);
|
|
93
137
|
const stickyHeaderWrapperElement = React.useRef(null);
|
|
@@ -343,12 +387,56 @@ function IndexTableBase({
|
|
|
343
387
|
event: "resize",
|
|
344
388
|
handler: handleResize
|
|
345
389
|
}), stickyHeaderMarkup);
|
|
390
|
+
|
|
391
|
+
// Process children to insert child rows for expanded rows
|
|
392
|
+
const processedChildren = React.useMemo(() => {
|
|
393
|
+
if (!expandable || !getRowChildren) {
|
|
394
|
+
return children;
|
|
395
|
+
}
|
|
396
|
+
const result = [];
|
|
397
|
+
let position = 0;
|
|
398
|
+
React.Children.forEach(children, child => {
|
|
399
|
+
if (/*#__PURE__*/React.isValidElement(child) && child.type === Row.Row) {
|
|
400
|
+
const rowId = child.props.id;
|
|
401
|
+
const isExpanded = expandedRows.has(rowId);
|
|
402
|
+
|
|
403
|
+
// Clone the row with updated position
|
|
404
|
+
const updatedRow = /*#__PURE__*/React.cloneElement(child, {
|
|
405
|
+
...child.props,
|
|
406
|
+
position
|
|
407
|
+
});
|
|
408
|
+
result.push(updatedRow);
|
|
409
|
+
position++;
|
|
410
|
+
|
|
411
|
+
// Add child rows if expanded
|
|
412
|
+
if (isExpanded) {
|
|
413
|
+
const childRows = getRowChildren(rowId);
|
|
414
|
+
if (childRows && childRows.length > 0) {
|
|
415
|
+
childRows.forEach((childRow, index) => {
|
|
416
|
+
if (/*#__PURE__*/React.isValidElement(childRow)) {
|
|
417
|
+
result.push(/*#__PURE__*/React.cloneElement(childRow, {
|
|
418
|
+
...childRow.props,
|
|
419
|
+
key: `${rowId}-child-${index}`,
|
|
420
|
+
position,
|
|
421
|
+
rowType: 'child'
|
|
422
|
+
}));
|
|
423
|
+
position++;
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
} else {
|
|
429
|
+
result.push(child);
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
return result;
|
|
433
|
+
}, [children, expandable, expandedRows, getRowChildren]);
|
|
346
434
|
const condensedClassNames = css.classNames(IndexTable_module.default.CondensedList, hasZebraStriping && IndexTable_module.default.ZebraStriping);
|
|
347
435
|
const bodyMarkup = condensed ? /*#__PURE__*/React.createElement(React.Fragment, null, sharedMarkup, /*#__PURE__*/React.createElement("ul", {
|
|
348
436
|
"data-selectmode": Boolean(selectMode),
|
|
349
437
|
className: condensedClassNames,
|
|
350
438
|
ref: condensedListElement
|
|
351
|
-
},
|
|
439
|
+
}, processedChildren)) : /*#__PURE__*/React.createElement(React.Fragment, null, sharedMarkup, /*#__PURE__*/React.createElement(ScrollContainer.ScrollContainer, {
|
|
352
440
|
scrollableContainerRef: scrollableContainerElement,
|
|
353
441
|
onScroll: handleScrollContainerScroll
|
|
354
442
|
}, /*#__PURE__*/React.createElement("table", {
|
|
@@ -358,23 +446,34 @@ function IndexTableBase({
|
|
|
358
446
|
className: IndexTable_module.default.HeadingRow
|
|
359
447
|
}, headingsMarkup)), /*#__PURE__*/React.createElement("tbody", {
|
|
360
448
|
ref: tableBodyRef
|
|
361
|
-
},
|
|
449
|
+
}, processedChildren))));
|
|
362
450
|
const tableContentMarkup = itemCount > 0 ? bodyMarkup : /*#__PURE__*/React.createElement("div", {
|
|
363
451
|
className: IndexTable_module.default.EmptySearchResultWrapper
|
|
364
452
|
}, emptyStateMarkup);
|
|
365
|
-
const paginationMarkup = pagination ? /*#__PURE__*/React.createElement("div", {
|
|
366
|
-
className: IndexTable_module.default.PaginationWrapper
|
|
367
|
-
}, /*#__PURE__*/React.createElement(Pagination.Pagination, Object.assign({
|
|
368
|
-
type: "table"
|
|
369
|
-
}, pagination))) : null;
|
|
370
453
|
const customizationContextValue = {
|
|
371
454
|
rowClassName,
|
|
372
455
|
rowStyle,
|
|
373
456
|
cellClassName,
|
|
374
457
|
cellStyle,
|
|
375
458
|
checkboxClassName,
|
|
376
|
-
checkboxStyle
|
|
459
|
+
checkboxStyle,
|
|
460
|
+
checkboxWrapperClassName,
|
|
461
|
+
checkboxWrapperStyle,
|
|
462
|
+
expandable,
|
|
463
|
+
expandedRowIds: expandedRows,
|
|
464
|
+
toggleRowExpansion,
|
|
465
|
+
isRowExpandable,
|
|
466
|
+
getRowChildren,
|
|
467
|
+
expandIconCollapsed,
|
|
468
|
+
expandIconExpanded,
|
|
469
|
+
expandButtonClassName,
|
|
470
|
+
expandButtonStyle
|
|
377
471
|
};
|
|
472
|
+
const paginationMarkup = pagination ? /*#__PURE__*/React.createElement("div", {
|
|
473
|
+
className: IndexTable_module.default.PaginationWrapper
|
|
474
|
+
}, /*#__PURE__*/React.createElement(Pagination.Pagination, Object.assign({
|
|
475
|
+
type: "table"
|
|
476
|
+
}, pagination))) : null;
|
|
378
477
|
return /*#__PURE__*/React.createElement(context.IndexTableCustomizationContext.Provider, {
|
|
379
478
|
value: customizationContextValue
|
|
380
479
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -27,8 +27,13 @@ const Checkbox = /*#__PURE__*/React.memo(function Checkbox({
|
|
|
27
27
|
const label = accessibilityLabel ? accessibilityLabel : i18n.translate('Polaris.IndexTable.selectItem', {
|
|
28
28
|
resourceName: resourceName.singular
|
|
29
29
|
});
|
|
30
|
+
const {
|
|
31
|
+
checkboxClassName: customCheckboxClassName,
|
|
32
|
+
checkboxStyle: customCheckboxStyle
|
|
33
|
+
} = React.useContext(context.IndexTableCustomizationContext);
|
|
30
34
|
return /*#__PURE__*/React.createElement(CheckboxWrapper, null, /*#__PURE__*/React.createElement("div", {
|
|
31
|
-
className: Checkbox_module.default.Wrapper,
|
|
35
|
+
className: css.classNames(Checkbox_module.default.Wrapper, customCheckboxClassName),
|
|
36
|
+
style: customCheckboxStyle,
|
|
32
37
|
onClick: onInteraction,
|
|
33
38
|
onKeyUp: noop
|
|
34
39
|
}, /*#__PURE__*/React.createElement(Checkbox$1.Checkbox, {
|
|
@@ -46,8 +51,8 @@ function CheckboxWrapper({
|
|
|
46
51
|
position
|
|
47
52
|
} = React.useContext(context.RowContext);
|
|
48
53
|
const {
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
checkboxWrapperClassName,
|
|
55
|
+
checkboxWrapperStyle
|
|
51
56
|
} = React.useContext(context.IndexTableCustomizationContext);
|
|
52
57
|
const checkboxNode = React.useRef(null);
|
|
53
58
|
|
|
@@ -69,10 +74,10 @@ function CheckboxWrapper({
|
|
|
69
74
|
window.removeEventListener('resize', handleResize);
|
|
70
75
|
};
|
|
71
76
|
}, [handleResize]);
|
|
72
|
-
const checkboxClassName = css.classNames(IndexTable_module.default.TableCell, IndexTable_module.default['TableCell-first'],
|
|
77
|
+
const checkboxClassName = css.classNames(IndexTable_module.default.TableCell, IndexTable_module.default['TableCell-first'], checkboxWrapperClassName);
|
|
73
78
|
return /*#__PURE__*/React.createElement("td", {
|
|
74
79
|
className: checkboxClassName,
|
|
75
|
-
style:
|
|
80
|
+
style: checkboxWrapperStyle,
|
|
76
81
|
ref: checkboxNode
|
|
77
82
|
}, children);
|
|
78
83
|
}
|
|
@@ -6,8 +6,8 @@ var css = require('../../../../utilities/css.js');
|
|
|
6
6
|
var IndexTable_module = require('../../IndexTable.css.js');
|
|
7
7
|
var hooks = require('../../../../utilities/index-provider/hooks.js');
|
|
8
8
|
var types = require('../../../../utilities/index-provider/types.js');
|
|
9
|
-
var context = require('../../../../utilities/index-table/context.js');
|
|
10
9
|
var Cell = require('../Cell/Cell.js');
|
|
10
|
+
var context = require('../../../../utilities/index-table/context.js');
|
|
11
11
|
var Checkbox = require('../Checkbox/Checkbox.js');
|
|
12
12
|
|
|
13
13
|
const Row = /*#__PURE__*/React.memo(function Row({
|
|
@@ -38,7 +38,15 @@ const Row = /*#__PURE__*/React.memo(function Row({
|
|
|
38
38
|
} = useToggle.useToggle(false);
|
|
39
39
|
const {
|
|
40
40
|
rowClassName: customRowClassName,
|
|
41
|
-
rowStyle: customRowStyle
|
|
41
|
+
rowStyle: customRowStyle,
|
|
42
|
+
expandable: tableExpandable,
|
|
43
|
+
expandedRowIds,
|
|
44
|
+
toggleRowExpansion,
|
|
45
|
+
isRowExpandable: tableIsRowExpandable,
|
|
46
|
+
expandIconCollapsed,
|
|
47
|
+
expandIconExpanded,
|
|
48
|
+
expandButtonClassName,
|
|
49
|
+
expandButtonStyle
|
|
42
50
|
} = React.useContext(context.IndexTableCustomizationContext);
|
|
43
51
|
const handleInteraction = React.useCallback(event => {
|
|
44
52
|
event.stopPropagation();
|
|
@@ -108,6 +116,26 @@ const Row = /*#__PURE__*/React.memo(function Row({
|
|
|
108
116
|
const checkboxMarkup = hideSelectable ? /*#__PURE__*/React.createElement(Cell.Cell, null) : /*#__PURE__*/React.createElement(Checkbox.Checkbox, {
|
|
109
117
|
accessibilityLabel: accessibilityLabel
|
|
110
118
|
});
|
|
119
|
+
const isRowExpandable = tableIsRowExpandable ? tableIsRowExpandable(id) : false;
|
|
120
|
+
const isExpanded = expandedRowIds ? expandedRowIds.has(id) : false;
|
|
121
|
+
const expandButton = tableExpandable && isRowExpandable ? /*#__PURE__*/React.createElement(Cell.Cell, null, /*#__PURE__*/React.createElement("button", {
|
|
122
|
+
onClick: e => {
|
|
123
|
+
e.stopPropagation();
|
|
124
|
+
toggleRowExpansion?.(id);
|
|
125
|
+
},
|
|
126
|
+
className: expandButtonClassName,
|
|
127
|
+
style: {
|
|
128
|
+
background: 'none',
|
|
129
|
+
border: 'none',
|
|
130
|
+
cursor: 'pointer',
|
|
131
|
+
padding: '4px',
|
|
132
|
+
display: 'flex',
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
justifyContent: 'center',
|
|
135
|
+
...expandButtonStyle
|
|
136
|
+
},
|
|
137
|
+
"aria-label": isExpanded ? 'Collapse row' : 'Expand row'
|
|
138
|
+
}, isExpanded ? expandIconExpanded || '▼' : expandIconCollapsed || '▶')) : null;
|
|
111
139
|
return /*#__PURE__*/React.createElement(context.RowContext.Provider, {
|
|
112
140
|
value: contextValue
|
|
113
141
|
}, /*#__PURE__*/React.createElement(context.RowHoveredContext.Provider, {
|
|
@@ -121,7 +149,7 @@ const Row = /*#__PURE__*/React.memo(function Row({
|
|
|
121
149
|
onMouseLeave: setHoverOut,
|
|
122
150
|
onClick: handleRowClick,
|
|
123
151
|
ref: tableRowCallbackRef
|
|
124
|
-
}, tableIsSelectable ? checkboxMarkup : null, children)));
|
|
152
|
+
}, expandButton, tableIsSelectable ? checkboxMarkup : null, children)));
|
|
125
153
|
});
|
|
126
154
|
|
|
127
155
|
exports.Row = Row;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useState, useCallback, useMemo
|
|
1
|
+
import React, { useRef, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { SortAscendingIcon, SortDescendingIcon } from '@shopify/polaris-icons';
|
|
3
3
|
import { debounce } from '../../utilities/debounce.js';
|
|
4
4
|
import { useToggle } from '../../utilities/use-toggle.js';
|
|
@@ -47,12 +47,24 @@ function IndexTableBase({
|
|
|
47
47
|
sortToggleLabels,
|
|
48
48
|
hasZebraStriping,
|
|
49
49
|
pagination,
|
|
50
|
+
expandable,
|
|
51
|
+
expandedRowIds,
|
|
52
|
+
defaultExpandedRowIds,
|
|
53
|
+
onExpandedChange,
|
|
54
|
+
getRowChildren,
|
|
55
|
+
isRowExpandable,
|
|
56
|
+
expandIconCollapsed,
|
|
57
|
+
expandIconExpanded,
|
|
58
|
+
expandButtonClassName,
|
|
59
|
+
expandButtonStyle,
|
|
50
60
|
rowClassName,
|
|
51
61
|
rowStyle,
|
|
52
62
|
cellClassName,
|
|
53
63
|
cellStyle,
|
|
54
64
|
checkboxClassName,
|
|
55
65
|
checkboxStyle,
|
|
66
|
+
checkboxWrapperClassName,
|
|
67
|
+
checkboxWrapperStyle,
|
|
56
68
|
...restProps
|
|
57
69
|
}) {
|
|
58
70
|
const {
|
|
@@ -86,6 +98,38 @@ function IndexTableBase({
|
|
|
86
98
|
const [tableInitialized, setTableInitialized] = useState(false);
|
|
87
99
|
const [stickyWrapper, setStickyWrapper] = useState(null);
|
|
88
100
|
const [hideScrollContainer, setHideScrollContainer] = useState(true);
|
|
101
|
+
|
|
102
|
+
// Expansion state
|
|
103
|
+
const [expandedRows, setExpandedRows] = useState(() => {
|
|
104
|
+
if (expandedRowIds) {
|
|
105
|
+
return new Set(expandedRowIds);
|
|
106
|
+
}
|
|
107
|
+
if (defaultExpandedRowIds) {
|
|
108
|
+
return new Set(defaultExpandedRowIds);
|
|
109
|
+
}
|
|
110
|
+
return new Set();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Update expanded state when prop changes
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (expandedRowIds !== undefined) {
|
|
116
|
+
setExpandedRows(new Set(expandedRowIds));
|
|
117
|
+
}
|
|
118
|
+
}, [expandedRowIds]);
|
|
119
|
+
|
|
120
|
+
// Toggle expansion
|
|
121
|
+
const toggleRowExpansion = useCallback(rowId => {
|
|
122
|
+
setExpandedRows(prev => {
|
|
123
|
+
const newExpanded = new Set(prev);
|
|
124
|
+
if (newExpanded.has(rowId)) {
|
|
125
|
+
newExpanded.delete(rowId);
|
|
126
|
+
} else {
|
|
127
|
+
newExpanded.add(rowId);
|
|
128
|
+
}
|
|
129
|
+
onExpandedChange?.(Array.from(newExpanded));
|
|
130
|
+
return newExpanded;
|
|
131
|
+
});
|
|
132
|
+
}, [onExpandedChange]);
|
|
89
133
|
const tableHeadings = useRef([]);
|
|
90
134
|
const stickyTableHeadings = useRef([]);
|
|
91
135
|
const stickyHeaderWrapperElement = useRef(null);
|
|
@@ -341,12 +385,56 @@ function IndexTableBase({
|
|
|
341
385
|
event: "resize",
|
|
342
386
|
handler: handleResize
|
|
343
387
|
}), stickyHeaderMarkup);
|
|
388
|
+
|
|
389
|
+
// Process children to insert child rows for expanded rows
|
|
390
|
+
const processedChildren = useMemo(() => {
|
|
391
|
+
if (!expandable || !getRowChildren) {
|
|
392
|
+
return children;
|
|
393
|
+
}
|
|
394
|
+
const result = [];
|
|
395
|
+
let position = 0;
|
|
396
|
+
React.Children.forEach(children, child => {
|
|
397
|
+
if (/*#__PURE__*/React.isValidElement(child) && child.type === Row) {
|
|
398
|
+
const rowId = child.props.id;
|
|
399
|
+
const isExpanded = expandedRows.has(rowId);
|
|
400
|
+
|
|
401
|
+
// Clone the row with updated position
|
|
402
|
+
const updatedRow = /*#__PURE__*/React.cloneElement(child, {
|
|
403
|
+
...child.props,
|
|
404
|
+
position
|
|
405
|
+
});
|
|
406
|
+
result.push(updatedRow);
|
|
407
|
+
position++;
|
|
408
|
+
|
|
409
|
+
// Add child rows if expanded
|
|
410
|
+
if (isExpanded) {
|
|
411
|
+
const childRows = getRowChildren(rowId);
|
|
412
|
+
if (childRows && childRows.length > 0) {
|
|
413
|
+
childRows.forEach((childRow, index) => {
|
|
414
|
+
if (/*#__PURE__*/React.isValidElement(childRow)) {
|
|
415
|
+
result.push(/*#__PURE__*/React.cloneElement(childRow, {
|
|
416
|
+
...childRow.props,
|
|
417
|
+
key: `${rowId}-child-${index}`,
|
|
418
|
+
position,
|
|
419
|
+
rowType: 'child'
|
|
420
|
+
}));
|
|
421
|
+
position++;
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
} else {
|
|
427
|
+
result.push(child);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
return result;
|
|
431
|
+
}, [children, expandable, expandedRows, getRowChildren]);
|
|
344
432
|
const condensedClassNames = classNames(styles.CondensedList, hasZebraStriping && styles.ZebraStriping);
|
|
345
433
|
const bodyMarkup = condensed ? /*#__PURE__*/React.createElement(React.Fragment, null, sharedMarkup, /*#__PURE__*/React.createElement("ul", {
|
|
346
434
|
"data-selectmode": Boolean(selectMode),
|
|
347
435
|
className: condensedClassNames,
|
|
348
436
|
ref: condensedListElement
|
|
349
|
-
},
|
|
437
|
+
}, processedChildren)) : /*#__PURE__*/React.createElement(React.Fragment, null, sharedMarkup, /*#__PURE__*/React.createElement(ScrollContainer, {
|
|
350
438
|
scrollableContainerRef: scrollableContainerElement,
|
|
351
439
|
onScroll: handleScrollContainerScroll
|
|
352
440
|
}, /*#__PURE__*/React.createElement("table", {
|
|
@@ -356,23 +444,34 @@ function IndexTableBase({
|
|
|
356
444
|
className: styles.HeadingRow
|
|
357
445
|
}, headingsMarkup)), /*#__PURE__*/React.createElement("tbody", {
|
|
358
446
|
ref: tableBodyRef
|
|
359
|
-
},
|
|
447
|
+
}, processedChildren))));
|
|
360
448
|
const tableContentMarkup = itemCount > 0 ? bodyMarkup : /*#__PURE__*/React.createElement("div", {
|
|
361
449
|
className: styles.EmptySearchResultWrapper
|
|
362
450
|
}, emptyStateMarkup);
|
|
363
|
-
const paginationMarkup = pagination ? /*#__PURE__*/React.createElement("div", {
|
|
364
|
-
className: styles.PaginationWrapper
|
|
365
|
-
}, /*#__PURE__*/React.createElement(Pagination, Object.assign({
|
|
366
|
-
type: "table"
|
|
367
|
-
}, pagination))) : null;
|
|
368
451
|
const customizationContextValue = {
|
|
369
452
|
rowClassName,
|
|
370
453
|
rowStyle,
|
|
371
454
|
cellClassName,
|
|
372
455
|
cellStyle,
|
|
373
456
|
checkboxClassName,
|
|
374
|
-
checkboxStyle
|
|
457
|
+
checkboxStyle,
|
|
458
|
+
checkboxWrapperClassName,
|
|
459
|
+
checkboxWrapperStyle,
|
|
460
|
+
expandable,
|
|
461
|
+
expandedRowIds: expandedRows,
|
|
462
|
+
toggleRowExpansion,
|
|
463
|
+
isRowExpandable,
|
|
464
|
+
getRowChildren,
|
|
465
|
+
expandIconCollapsed,
|
|
466
|
+
expandIconExpanded,
|
|
467
|
+
expandButtonClassName,
|
|
468
|
+
expandButtonStyle
|
|
375
469
|
};
|
|
470
|
+
const paginationMarkup = pagination ? /*#__PURE__*/React.createElement("div", {
|
|
471
|
+
className: styles.PaginationWrapper
|
|
472
|
+
}, /*#__PURE__*/React.createElement(Pagination, Object.assign({
|
|
473
|
+
type: "table"
|
|
474
|
+
}, pagination))) : null;
|
|
376
475
|
return /*#__PURE__*/React.createElement(IndexTableCustomizationContext.Provider, {
|
|
377
476
|
value: customizationContextValue
|
|
378
477
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -25,8 +25,13 @@ const Checkbox = /*#__PURE__*/memo(function Checkbox({
|
|
|
25
25
|
const label = accessibilityLabel ? accessibilityLabel : i18n.translate('Polaris.IndexTable.selectItem', {
|
|
26
26
|
resourceName: resourceName.singular
|
|
27
27
|
});
|
|
28
|
+
const {
|
|
29
|
+
checkboxClassName: customCheckboxClassName,
|
|
30
|
+
checkboxStyle: customCheckboxStyle
|
|
31
|
+
} = useContext(IndexTableCustomizationContext);
|
|
28
32
|
return /*#__PURE__*/React.createElement(CheckboxWrapper, null, /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className: styles.Wrapper,
|
|
33
|
+
className: classNames(styles.Wrapper, customCheckboxClassName),
|
|
34
|
+
style: customCheckboxStyle,
|
|
30
35
|
onClick: onInteraction,
|
|
31
36
|
onKeyUp: noop
|
|
32
37
|
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
@@ -44,8 +49,8 @@ function CheckboxWrapper({
|
|
|
44
49
|
position
|
|
45
50
|
} = useContext(RowContext);
|
|
46
51
|
const {
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
checkboxWrapperClassName,
|
|
53
|
+
checkboxWrapperStyle
|
|
49
54
|
} = useContext(IndexTableCustomizationContext);
|
|
50
55
|
const checkboxNode = useRef(null);
|
|
51
56
|
|
|
@@ -67,10 +72,10 @@ function CheckboxWrapper({
|
|
|
67
72
|
window.removeEventListener('resize', handleResize);
|
|
68
73
|
};
|
|
69
74
|
}, [handleResize]);
|
|
70
|
-
const checkboxClassName = classNames(styles$1.TableCell, styles$1['TableCell-first'],
|
|
75
|
+
const checkboxClassName = classNames(styles$1.TableCell, styles$1['TableCell-first'], checkboxWrapperClassName);
|
|
71
76
|
return /*#__PURE__*/React.createElement("td", {
|
|
72
77
|
className: checkboxClassName,
|
|
73
|
-
style:
|
|
78
|
+
style: checkboxWrapperStyle,
|
|
74
79
|
ref: checkboxNode
|
|
75
80
|
}, children);
|
|
76
81
|
}
|
|
@@ -4,8 +4,8 @@ import { classNames, variationName } from '../../../../utilities/css.js';
|
|
|
4
4
|
import styles from '../../IndexTable.css.js';
|
|
5
5
|
import { useIndexRow, useIndexSelectionChange } from '../../../../utilities/index-provider/hooks.js';
|
|
6
6
|
import { SelectionType } from '../../../../utilities/index-provider/types.js';
|
|
7
|
-
import { IndexTableCustomizationContext, RowContext, RowHoveredContext } from '../../../../utilities/index-table/context.js';
|
|
8
7
|
import { Cell } from '../Cell/Cell.js';
|
|
8
|
+
import { IndexTableCustomizationContext, RowContext, RowHoveredContext } from '../../../../utilities/index-table/context.js';
|
|
9
9
|
import { Checkbox } from '../Checkbox/Checkbox.js';
|
|
10
10
|
|
|
11
11
|
const Row = /*#__PURE__*/memo(function Row({
|
|
@@ -36,7 +36,15 @@ const Row = /*#__PURE__*/memo(function Row({
|
|
|
36
36
|
} = useToggle(false);
|
|
37
37
|
const {
|
|
38
38
|
rowClassName: customRowClassName,
|
|
39
|
-
rowStyle: customRowStyle
|
|
39
|
+
rowStyle: customRowStyle,
|
|
40
|
+
expandable: tableExpandable,
|
|
41
|
+
expandedRowIds,
|
|
42
|
+
toggleRowExpansion,
|
|
43
|
+
isRowExpandable: tableIsRowExpandable,
|
|
44
|
+
expandIconCollapsed,
|
|
45
|
+
expandIconExpanded,
|
|
46
|
+
expandButtonClassName,
|
|
47
|
+
expandButtonStyle
|
|
40
48
|
} = useContext(IndexTableCustomizationContext);
|
|
41
49
|
const handleInteraction = useCallback(event => {
|
|
42
50
|
event.stopPropagation();
|
|
@@ -106,6 +114,26 @@ const Row = /*#__PURE__*/memo(function Row({
|
|
|
106
114
|
const checkboxMarkup = hideSelectable ? /*#__PURE__*/React.createElement(Cell, null) : /*#__PURE__*/React.createElement(Checkbox, {
|
|
107
115
|
accessibilityLabel: accessibilityLabel
|
|
108
116
|
});
|
|
117
|
+
const isRowExpandable = tableIsRowExpandable ? tableIsRowExpandable(id) : false;
|
|
118
|
+
const isExpanded = expandedRowIds ? expandedRowIds.has(id) : false;
|
|
119
|
+
const expandButton = tableExpandable && isRowExpandable ? /*#__PURE__*/React.createElement(Cell, null, /*#__PURE__*/React.createElement("button", {
|
|
120
|
+
onClick: e => {
|
|
121
|
+
e.stopPropagation();
|
|
122
|
+
toggleRowExpansion?.(id);
|
|
123
|
+
},
|
|
124
|
+
className: expandButtonClassName,
|
|
125
|
+
style: {
|
|
126
|
+
background: 'none',
|
|
127
|
+
border: 'none',
|
|
128
|
+
cursor: 'pointer',
|
|
129
|
+
padding: '4px',
|
|
130
|
+
display: 'flex',
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
...expandButtonStyle
|
|
134
|
+
},
|
|
135
|
+
"aria-label": isExpanded ? 'Collapse row' : 'Expand row'
|
|
136
|
+
}, isExpanded ? expandIconExpanded || '▼' : expandIconCollapsed || '▶')) : null;
|
|
109
137
|
return /*#__PURE__*/React.createElement(RowContext.Provider, {
|
|
110
138
|
value: contextValue
|
|
111
139
|
}, /*#__PURE__*/React.createElement(RowHoveredContext.Provider, {
|
|
@@ -119,7 +147,7 @@ const Row = /*#__PURE__*/memo(function Row({
|
|
|
119
147
|
onMouseLeave: setHoverOut,
|
|
120
148
|
onClick: handleRowClick,
|
|
121
149
|
ref: tableRowCallbackRef
|
|
122
|
-
}, tableIsSelectable ? checkboxMarkup : null, children)));
|
|
150
|
+
}, expandButton, tableIsSelectable ? checkboxMarkup : null, children)));
|
|
123
151
|
});
|
|
124
152
|
|
|
125
153
|
export { Row };
|
package/build/esm/styles.css
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
@keyframes p-motion-keyframes-appear-below{ from{ transform:translateY(calc(var(--p-space-100)*-1)); opacity:0; } to{ transform:none; opacity:1; } }
|
|
22
22
|
|
|
23
23
|
:root{
|
|
24
|
-
--polaris-version-number:'13.10.
|
|
24
|
+
--polaris-version-number:'13.10.5-rc1';
|
|
25
25
|
|
|
26
26
|
--pg-navigation-width:15rem;
|
|
27
27
|
--pg-dangerous-magic-space-4:1rem;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
@keyframes p-motion-keyframes-appear-below{ from{ transform:translateY(calc(var(--p-space-100)*-1)); opacity:0; } to{ transform:none; opacity:1; } }
|
|
22
22
|
|
|
23
23
|
:root{
|
|
24
|
-
--polaris-version-number:'13.10.
|
|
24
|
+
--polaris-version-number:'13.10.5-rc1';
|
|
25
25
|
|
|
26
26
|
--pg-navigation-width:15rem;
|
|
27
27
|
--pg-dangerous-magic-space-4:1rem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useState, useCallback, useMemo
|
|
1
|
+
import React, { useRef, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { SortAscendingIcon, SortDescendingIcon } from '@shopify/polaris-icons';
|
|
3
3
|
import { debounce } from '../../utilities/debounce.esnext';
|
|
4
4
|
import { useToggle } from '../../utilities/use-toggle.esnext';
|
|
@@ -47,12 +47,24 @@ function IndexTableBase({
|
|
|
47
47
|
sortToggleLabels,
|
|
48
48
|
hasZebraStriping,
|
|
49
49
|
pagination,
|
|
50
|
+
expandable,
|
|
51
|
+
expandedRowIds,
|
|
52
|
+
defaultExpandedRowIds,
|
|
53
|
+
onExpandedChange,
|
|
54
|
+
getRowChildren,
|
|
55
|
+
isRowExpandable,
|
|
56
|
+
expandIconCollapsed,
|
|
57
|
+
expandIconExpanded,
|
|
58
|
+
expandButtonClassName,
|
|
59
|
+
expandButtonStyle,
|
|
50
60
|
rowClassName,
|
|
51
61
|
rowStyle,
|
|
52
62
|
cellClassName,
|
|
53
63
|
cellStyle,
|
|
54
64
|
checkboxClassName,
|
|
55
65
|
checkboxStyle,
|
|
66
|
+
checkboxWrapperClassName,
|
|
67
|
+
checkboxWrapperStyle,
|
|
56
68
|
...restProps
|
|
57
69
|
}) {
|
|
58
70
|
const {
|
|
@@ -86,6 +98,38 @@ function IndexTableBase({
|
|
|
86
98
|
const [tableInitialized, setTableInitialized] = useState(false);
|
|
87
99
|
const [stickyWrapper, setStickyWrapper] = useState(null);
|
|
88
100
|
const [hideScrollContainer, setHideScrollContainer] = useState(true);
|
|
101
|
+
|
|
102
|
+
// Expansion state
|
|
103
|
+
const [expandedRows, setExpandedRows] = useState(() => {
|
|
104
|
+
if (expandedRowIds) {
|
|
105
|
+
return new Set(expandedRowIds);
|
|
106
|
+
}
|
|
107
|
+
if (defaultExpandedRowIds) {
|
|
108
|
+
return new Set(defaultExpandedRowIds);
|
|
109
|
+
}
|
|
110
|
+
return new Set();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Update expanded state when prop changes
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (expandedRowIds !== undefined) {
|
|
116
|
+
setExpandedRows(new Set(expandedRowIds));
|
|
117
|
+
}
|
|
118
|
+
}, [expandedRowIds]);
|
|
119
|
+
|
|
120
|
+
// Toggle expansion
|
|
121
|
+
const toggleRowExpansion = useCallback(rowId => {
|
|
122
|
+
setExpandedRows(prev => {
|
|
123
|
+
const newExpanded = new Set(prev);
|
|
124
|
+
if (newExpanded.has(rowId)) {
|
|
125
|
+
newExpanded.delete(rowId);
|
|
126
|
+
} else {
|
|
127
|
+
newExpanded.add(rowId);
|
|
128
|
+
}
|
|
129
|
+
onExpandedChange?.(Array.from(newExpanded));
|
|
130
|
+
return newExpanded;
|
|
131
|
+
});
|
|
132
|
+
}, [onExpandedChange]);
|
|
89
133
|
const tableHeadings = useRef([]);
|
|
90
134
|
const stickyTableHeadings = useRef([]);
|
|
91
135
|
const stickyHeaderWrapperElement = useRef(null);
|
|
@@ -341,12 +385,56 @@ function IndexTableBase({
|
|
|
341
385
|
event: "resize",
|
|
342
386
|
handler: handleResize
|
|
343
387
|
}), stickyHeaderMarkup);
|
|
388
|
+
|
|
389
|
+
// Process children to insert child rows for expanded rows
|
|
390
|
+
const processedChildren = useMemo(() => {
|
|
391
|
+
if (!expandable || !getRowChildren) {
|
|
392
|
+
return children;
|
|
393
|
+
}
|
|
394
|
+
const result = [];
|
|
395
|
+
let position = 0;
|
|
396
|
+
React.Children.forEach(children, child => {
|
|
397
|
+
if (/*#__PURE__*/React.isValidElement(child) && child.type === Row) {
|
|
398
|
+
const rowId = child.props.id;
|
|
399
|
+
const isExpanded = expandedRows.has(rowId);
|
|
400
|
+
|
|
401
|
+
// Clone the row with updated position
|
|
402
|
+
const updatedRow = /*#__PURE__*/React.cloneElement(child, {
|
|
403
|
+
...child.props,
|
|
404
|
+
position
|
|
405
|
+
});
|
|
406
|
+
result.push(updatedRow);
|
|
407
|
+
position++;
|
|
408
|
+
|
|
409
|
+
// Add child rows if expanded
|
|
410
|
+
if (isExpanded) {
|
|
411
|
+
const childRows = getRowChildren(rowId);
|
|
412
|
+
if (childRows && childRows.length > 0) {
|
|
413
|
+
childRows.forEach((childRow, index) => {
|
|
414
|
+
if (/*#__PURE__*/React.isValidElement(childRow)) {
|
|
415
|
+
result.push(/*#__PURE__*/React.cloneElement(childRow, {
|
|
416
|
+
...childRow.props,
|
|
417
|
+
key: `${rowId}-child-${index}`,
|
|
418
|
+
position,
|
|
419
|
+
rowType: 'child'
|
|
420
|
+
}));
|
|
421
|
+
position++;
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
} else {
|
|
427
|
+
result.push(child);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
return result;
|
|
431
|
+
}, [children, expandable, expandedRows, getRowChildren]);
|
|
344
432
|
const condensedClassNames = classNames(styles.CondensedList, hasZebraStriping && styles.ZebraStriping);
|
|
345
433
|
const bodyMarkup = condensed ? /*#__PURE__*/React.createElement(React.Fragment, null, sharedMarkup, /*#__PURE__*/React.createElement("ul", {
|
|
346
434
|
"data-selectmode": Boolean(selectMode),
|
|
347
435
|
className: condensedClassNames,
|
|
348
436
|
ref: condensedListElement
|
|
349
|
-
},
|
|
437
|
+
}, processedChildren)) : /*#__PURE__*/React.createElement(React.Fragment, null, sharedMarkup, /*#__PURE__*/React.createElement(ScrollContainer, {
|
|
350
438
|
scrollableContainerRef: scrollableContainerElement,
|
|
351
439
|
onScroll: handleScrollContainerScroll
|
|
352
440
|
}, /*#__PURE__*/React.createElement("table", {
|
|
@@ -356,23 +444,34 @@ function IndexTableBase({
|
|
|
356
444
|
className: styles.HeadingRow
|
|
357
445
|
}, headingsMarkup)), /*#__PURE__*/React.createElement("tbody", {
|
|
358
446
|
ref: tableBodyRef
|
|
359
|
-
},
|
|
447
|
+
}, processedChildren))));
|
|
360
448
|
const tableContentMarkup = itemCount > 0 ? bodyMarkup : /*#__PURE__*/React.createElement("div", {
|
|
361
449
|
className: styles.EmptySearchResultWrapper
|
|
362
450
|
}, emptyStateMarkup);
|
|
363
|
-
const paginationMarkup = pagination ? /*#__PURE__*/React.createElement("div", {
|
|
364
|
-
className: styles.PaginationWrapper
|
|
365
|
-
}, /*#__PURE__*/React.createElement(Pagination, Object.assign({
|
|
366
|
-
type: "table"
|
|
367
|
-
}, pagination))) : null;
|
|
368
451
|
const customizationContextValue = {
|
|
369
452
|
rowClassName,
|
|
370
453
|
rowStyle,
|
|
371
454
|
cellClassName,
|
|
372
455
|
cellStyle,
|
|
373
456
|
checkboxClassName,
|
|
374
|
-
checkboxStyle
|
|
457
|
+
checkboxStyle,
|
|
458
|
+
checkboxWrapperClassName,
|
|
459
|
+
checkboxWrapperStyle,
|
|
460
|
+
expandable,
|
|
461
|
+
expandedRowIds: expandedRows,
|
|
462
|
+
toggleRowExpansion,
|
|
463
|
+
isRowExpandable,
|
|
464
|
+
getRowChildren,
|
|
465
|
+
expandIconCollapsed,
|
|
466
|
+
expandIconExpanded,
|
|
467
|
+
expandButtonClassName,
|
|
468
|
+
expandButtonStyle
|
|
375
469
|
};
|
|
470
|
+
const paginationMarkup = pagination ? /*#__PURE__*/React.createElement("div", {
|
|
471
|
+
className: styles.PaginationWrapper
|
|
472
|
+
}, /*#__PURE__*/React.createElement(Pagination, Object.assign({
|
|
473
|
+
type: "table"
|
|
474
|
+
}, pagination))) : null;
|
|
376
475
|
return /*#__PURE__*/React.createElement(IndexTableCustomizationContext.Provider, {
|
|
377
476
|
value: customizationContextValue
|
|
378
477
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -25,8 +25,13 @@ const Checkbox = /*#__PURE__*/memo(function Checkbox({
|
|
|
25
25
|
const label = accessibilityLabel ? accessibilityLabel : i18n.translate('Polaris.IndexTable.selectItem', {
|
|
26
26
|
resourceName: resourceName.singular
|
|
27
27
|
});
|
|
28
|
+
const {
|
|
29
|
+
checkboxClassName: customCheckboxClassName,
|
|
30
|
+
checkboxStyle: customCheckboxStyle
|
|
31
|
+
} = useContext(IndexTableCustomizationContext);
|
|
28
32
|
return /*#__PURE__*/React.createElement(CheckboxWrapper, null, /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className: styles.Wrapper,
|
|
33
|
+
className: classNames(styles.Wrapper, customCheckboxClassName),
|
|
34
|
+
style: customCheckboxStyle,
|
|
30
35
|
onClick: onInteraction,
|
|
31
36
|
onKeyUp: noop
|
|
32
37
|
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
@@ -44,8 +49,8 @@ function CheckboxWrapper({
|
|
|
44
49
|
position
|
|
45
50
|
} = useContext(RowContext);
|
|
46
51
|
const {
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
checkboxWrapperClassName,
|
|
53
|
+
checkboxWrapperStyle
|
|
49
54
|
} = useContext(IndexTableCustomizationContext);
|
|
50
55
|
const checkboxNode = useRef(null);
|
|
51
56
|
|
|
@@ -67,10 +72,10 @@ function CheckboxWrapper({
|
|
|
67
72
|
window.removeEventListener('resize', handleResize);
|
|
68
73
|
};
|
|
69
74
|
}, [handleResize]);
|
|
70
|
-
const checkboxClassName = classNames(styles$1.TableCell, styles$1['TableCell-first'],
|
|
75
|
+
const checkboxClassName = classNames(styles$1.TableCell, styles$1['TableCell-first'], checkboxWrapperClassName);
|
|
71
76
|
return /*#__PURE__*/React.createElement("td", {
|
|
72
77
|
className: checkboxClassName,
|
|
73
|
-
style:
|
|
78
|
+
style: checkboxWrapperStyle,
|
|
74
79
|
ref: checkboxNode
|
|
75
80
|
}, children);
|
|
76
81
|
}
|
|
@@ -4,8 +4,8 @@ import { classNames, variationName } from '../../../../utilities/css.esnext';
|
|
|
4
4
|
import styles from '../../IndexTable.css.esnext';
|
|
5
5
|
import { useIndexRow, useIndexSelectionChange } from '../../../../utilities/index-provider/hooks.esnext';
|
|
6
6
|
import { SelectionType } from '../../../../utilities/index-provider/types.esnext';
|
|
7
|
-
import { IndexTableCustomizationContext, RowContext, RowHoveredContext } from '../../../../utilities/index-table/context.esnext';
|
|
8
7
|
import { Cell } from '../Cell/Cell.esnext';
|
|
8
|
+
import { IndexTableCustomizationContext, RowContext, RowHoveredContext } from '../../../../utilities/index-table/context.esnext';
|
|
9
9
|
import { Checkbox } from '../Checkbox/Checkbox.esnext';
|
|
10
10
|
|
|
11
11
|
const Row = /*#__PURE__*/memo(function Row({
|
|
@@ -36,7 +36,15 @@ const Row = /*#__PURE__*/memo(function Row({
|
|
|
36
36
|
} = useToggle(false);
|
|
37
37
|
const {
|
|
38
38
|
rowClassName: customRowClassName,
|
|
39
|
-
rowStyle: customRowStyle
|
|
39
|
+
rowStyle: customRowStyle,
|
|
40
|
+
expandable: tableExpandable,
|
|
41
|
+
expandedRowIds,
|
|
42
|
+
toggleRowExpansion,
|
|
43
|
+
isRowExpandable: tableIsRowExpandable,
|
|
44
|
+
expandIconCollapsed,
|
|
45
|
+
expandIconExpanded,
|
|
46
|
+
expandButtonClassName,
|
|
47
|
+
expandButtonStyle
|
|
40
48
|
} = useContext(IndexTableCustomizationContext);
|
|
41
49
|
const handleInteraction = useCallback(event => {
|
|
42
50
|
event.stopPropagation();
|
|
@@ -106,6 +114,26 @@ const Row = /*#__PURE__*/memo(function Row({
|
|
|
106
114
|
const checkboxMarkup = hideSelectable ? /*#__PURE__*/React.createElement(Cell, null) : /*#__PURE__*/React.createElement(Checkbox, {
|
|
107
115
|
accessibilityLabel: accessibilityLabel
|
|
108
116
|
});
|
|
117
|
+
const isRowExpandable = tableIsRowExpandable ? tableIsRowExpandable(id) : false;
|
|
118
|
+
const isExpanded = expandedRowIds ? expandedRowIds.has(id) : false;
|
|
119
|
+
const expandButton = tableExpandable && isRowExpandable ? /*#__PURE__*/React.createElement(Cell, null, /*#__PURE__*/React.createElement("button", {
|
|
120
|
+
onClick: e => {
|
|
121
|
+
e.stopPropagation();
|
|
122
|
+
toggleRowExpansion?.(id);
|
|
123
|
+
},
|
|
124
|
+
className: expandButtonClassName,
|
|
125
|
+
style: {
|
|
126
|
+
background: 'none',
|
|
127
|
+
border: 'none',
|
|
128
|
+
cursor: 'pointer',
|
|
129
|
+
padding: '4px',
|
|
130
|
+
display: 'flex',
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
...expandButtonStyle
|
|
134
|
+
},
|
|
135
|
+
"aria-label": isExpanded ? 'Collapse row' : 'Expand row'
|
|
136
|
+
}, isExpanded ? expandIconExpanded || '▼' : expandIconCollapsed || '▶')) : null;
|
|
109
137
|
return /*#__PURE__*/React.createElement(RowContext.Provider, {
|
|
110
138
|
value: contextValue
|
|
111
139
|
}, /*#__PURE__*/React.createElement(RowHoveredContext.Provider, {
|
|
@@ -119,7 +147,7 @@ const Row = /*#__PURE__*/memo(function Row({
|
|
|
119
147
|
onMouseLeave: setHoverOut,
|
|
120
148
|
onClick: handleRowClick,
|
|
121
149
|
ref: tableRowCallbackRef
|
|
122
|
-
}, tableIsSelectable ? checkboxMarkup : null, children)));
|
|
150
|
+
}, expandButton, tableIsSelectable ? checkboxMarkup : null, children)));
|
|
123
151
|
});
|
|
124
152
|
|
|
125
153
|
export { Row };
|
|
@@ -76,6 +76,26 @@ export interface IndexTableBaseProps {
|
|
|
76
76
|
hasZebraStriping?: boolean;
|
|
77
77
|
/** Properties to enable pagination at the bottom of the table. */
|
|
78
78
|
pagination?: IndexTablePaginationProps;
|
|
79
|
+
/** Enable expandable rows */
|
|
80
|
+
expandable?: boolean;
|
|
81
|
+
/** IDs of expanded rows */
|
|
82
|
+
expandedRowIds?: string[];
|
|
83
|
+
/** Default expanded row IDs */
|
|
84
|
+
defaultExpandedRowIds?: string[];
|
|
85
|
+
/** Callback when expanded rows change */
|
|
86
|
+
onExpandedChange?: (expandedRowIds: string[]) => void;
|
|
87
|
+
/** Callback to get child rows for a row ID */
|
|
88
|
+
getRowChildren?: (rowId: string) => React.ReactNode[];
|
|
89
|
+
/** Callback to determine if a row is expandable */
|
|
90
|
+
isRowExpandable?: (rowId: string) => boolean;
|
|
91
|
+
/** Custom expand icon for collapsed state */
|
|
92
|
+
expandIconCollapsed?: React.ReactNode;
|
|
93
|
+
/** Custom expand icon for expanded state */
|
|
94
|
+
expandIconExpanded?: React.ReactNode;
|
|
95
|
+
/** Custom class name for expand button */
|
|
96
|
+
expandButtonClassName?: string;
|
|
97
|
+
/** Custom styles for expand button */
|
|
98
|
+
expandButtonStyle?: React.CSSProperties;
|
|
79
99
|
/** Custom class name for all rows */
|
|
80
100
|
rowClassName?: string;
|
|
81
101
|
/** Custom styles for all rows */
|
|
@@ -88,6 +108,8 @@ export interface IndexTableBaseProps {
|
|
|
88
108
|
checkboxClassName?: string;
|
|
89
109
|
/** Custom styles for all checkboxes */
|
|
90
110
|
checkboxStyle?: React.CSSProperties;
|
|
111
|
+
checkboxWrapperClassName?: string;
|
|
112
|
+
checkboxWrapperStyle?: React.CSSProperties;
|
|
91
113
|
}
|
|
92
114
|
export interface TableHeadingRect {
|
|
93
115
|
offsetWidth: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/IndexTable/IndexTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0D,MAAM,OAAO,CAAC;AAE/E,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,yBAAyB,C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AuC;IACvC,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC5C;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAojCD,MAAM,WAAW,eACf,SAAQ,mBAAmB,EACzB,kBAAkB;CAAG;AAEzB,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,UAAiB,EACjB,SAAS,EACT,kBAAsB,EACtB,YAAY,EAAE,kBAAkB,EAChC,OAAO,EACP,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,sBAAsB,EACtB,GAAG,mBAAmB,EACvB,EAAE,eAAe,qBAkBjB;yBA9Be,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/IndexTable/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAC9E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAarC,UAAU,aAAa;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/IndexTable/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAC9E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAarC,UAAU,aAAa;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,QAAQ,2CA4BnB,CAAC;AAEH,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,EAAC,QAAQ,EAAC,EAAE,oBAAoB,qBAwC/D"}
|
|
@@ -31,6 +31,14 @@ export interface RowProps {
|
|
|
31
31
|
onNavigation?(id: string): void;
|
|
32
32
|
/** Callback fired when the row is clicked. Overrides the default click behaviour. */
|
|
33
33
|
onClick?(): void;
|
|
34
|
+
/** @deprecated Use IndexTable expandable props instead */
|
|
35
|
+
expandable?: boolean;
|
|
36
|
+
/** @deprecated Use IndexTable expandable props instead */
|
|
37
|
+
expanded?: boolean;
|
|
38
|
+
/** @deprecated Use IndexTable expandable props instead */
|
|
39
|
+
onToggleExpansion?(): void;
|
|
40
|
+
/** @deprecated Use IndexTable expandable props instead */
|
|
41
|
+
expandIcon?: React.ReactNode;
|
|
34
42
|
}
|
|
35
43
|
export declare const Row: React.NamedExoticComponent<RowProps>;
|
|
36
44
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/IndexTable/components/Row/Row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAY5E,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,4CAA4C,CAAC;AAGtE,KAAK,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC;AAC9C,KAAK,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAGhE,MAAM,WAAW,QAAQ;IACvB,iCAAiC;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,oGAAoG;IACpG,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,yCAAyC;IACz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AE,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,qFAAqF;IACrF,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,iBAAiB,CAAC,IAAI,IAAI,CAAC;IAC3B,0DAA0D;IAC1D,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,GAAG,sCAqMd,CAAC"}
|
|
@@ -26,6 +26,18 @@ export interface IndexTableCustomizationContextType {
|
|
|
26
26
|
cellStyle?: React.CSSProperties;
|
|
27
27
|
checkboxClassName?: string;
|
|
28
28
|
checkboxStyle?: React.CSSProperties;
|
|
29
|
+
checkboxWrapperClassName?: string;
|
|
30
|
+
checkboxWrapperStyle?: React.CSSProperties;
|
|
31
|
+
expandable?: boolean;
|
|
32
|
+
expandedRowIds?: Set<string>;
|
|
33
|
+
toggleRowExpansion?: (rowId: string) => void;
|
|
34
|
+
isRowExpandable?: (rowId: string) => boolean;
|
|
35
|
+
getRowChildren?: (rowId: string) => React.ReactNode[];
|
|
36
|
+
expandIcon?: React.ReactNode;
|
|
37
|
+
expandIconCollapsed?: React.ReactNode;
|
|
38
|
+
expandIconExpanded?: React.ReactNode;
|
|
39
|
+
expandButtonClassName?: string;
|
|
40
|
+
expandButtonStyle?: React.CSSProperties;
|
|
29
41
|
}
|
|
30
42
|
export declare const IndexTableCustomizationContext: import("react").Context<IndexTableCustomizationContextType>;
|
|
31
43
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/utilities/index-table/context.ts"],"names":[],"mappings":";AAEA,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IACrC,QAAQ,CAAC,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