@czi-sds/components 23.5.0 → 23.6.0
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/dist/index.cjs.d.ts +15 -3
- package/dist/index.cjs.js +327 -34
- package/dist/index.esm.d.ts +15 -3
- package/dist/index.esm.js +328 -35
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/variables.css +12 -12
- package/dist/variables.scss +12 -12
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -445,12 +445,12 @@ const createAppThemeBorders = (colors, isDarkMode) => {
|
|
|
445
445
|
default: createBorder("indigo", isDarkMode ? 600 : 500, "solid", "default"),
|
|
446
446
|
focused: createBorder("indigo", isDarkMode ? 600 : 500, "solid", "default"),
|
|
447
447
|
hover: createBorder("indigo", isDarkMode ? 700 : 600, "solid", "default"),
|
|
448
|
-
open: createBorder("indigo", isDarkMode ?
|
|
448
|
+
open: createBorder("indigo", isDarkMode ? 800 : 700, "solid", "default"),
|
|
449
449
|
pressed: createBorder("indigo", isDarkMode ? 800 : 700, "solid", "default"),
|
|
450
|
-
selected: createBorder("indigo", isDarkMode ?
|
|
450
|
+
selected: createBorder("indigo", isDarkMode ? 800 : 700, "solid", "default")
|
|
451
451
|
},
|
|
452
452
|
base: {
|
|
453
|
-
default: createBorder("gray",
|
|
453
|
+
default: createBorder("gray", 600, "solid", "default"),
|
|
454
454
|
disabled: createBorder("gray", 300, "solid", "default"),
|
|
455
455
|
divider: createBorder("gray", 200, "solid", "default"),
|
|
456
456
|
dividerOnDark: createBorder("gray", isDarkMode ? 200 : 700, "solid", "default"),
|
|
@@ -480,9 +480,9 @@ const createAppThemeBorders = (colors, isDarkMode) => {
|
|
|
480
480
|
thick: createBorder("red", 600, "solid", "thick")
|
|
481
481
|
},
|
|
482
482
|
neutral: {
|
|
483
|
-
default: createBorder("gray",
|
|
484
|
-
extraThick: createBorder("gray",
|
|
485
|
-
thick: createBorder("gray",
|
|
483
|
+
default: createBorder("gray", 700, "solid", "default"),
|
|
484
|
+
extraThick: createBorder("gray", 700, "solid", "extraThick"),
|
|
485
|
+
thick: createBorder("gray", 700, "solid", "thick")
|
|
486
486
|
},
|
|
487
487
|
none: "none",
|
|
488
488
|
notice: {
|
|
@@ -6474,7 +6474,7 @@ const useDetectUserTabbing = (ref) => {
|
|
|
6474
6474
|
* @see https://mui.com/material-ui/react-text-field/
|
|
6475
6475
|
*/
|
|
6476
6476
|
const InputSearch = React.forwardRef(function InputSearch(props, ref) {
|
|
6477
|
-
const { label, id, placeholder, sdsStyle = "square", intent = "default", handleSubmit, onChange, disabled, classes = EMPTY_OBJECT, className, ...rest } = props;
|
|
6477
|
+
const { label, id, placeholder, sdsStyle = "square", intent = "default", handleSubmit, onChange, disabled, classes = EMPTY_OBJECT, className, value: propValue, ...rest } = props;
|
|
6478
6478
|
const { root: rootClassName, label: labelClassName, input: inputClassName, endAdornment: endAdornmentClassName, startAdornment: startAdornmentClassName, clearButton: clearButtonClassName, searchButton: searchButtonClassName, } = classes;
|
|
6479
6479
|
/**
|
|
6480
6480
|
* (masoudmanson): In case that the ref is not provided, we will create a new one.
|
|
@@ -6489,14 +6489,20 @@ const InputSearch = React.forwardRef(function InputSearch(props, ref) {
|
|
|
6489
6489
|
* user is tabbing, we can apply different styles for :focus and :focus-visible states.
|
|
6490
6490
|
*/
|
|
6491
6491
|
useDetectUserTabbing((ref ? ref : inputRef));
|
|
6492
|
-
const [
|
|
6492
|
+
const [internalValue, setInternalValue] = React.useState("");
|
|
6493
|
+
const isControlled = propValue !== undefined;
|
|
6494
|
+
const value = isControlled ? String(propValue ?? "") : internalValue;
|
|
6493
6495
|
const handleChange = (event) => {
|
|
6494
|
-
|
|
6496
|
+
if (!isControlled) {
|
|
6497
|
+
setInternalValue(event.target.value);
|
|
6498
|
+
}
|
|
6495
6499
|
if (onChange)
|
|
6496
6500
|
onChange(event);
|
|
6497
6501
|
};
|
|
6498
6502
|
const clearInput = () => {
|
|
6499
|
-
|
|
6503
|
+
if (!isControlled) {
|
|
6504
|
+
setInternalValue("");
|
|
6505
|
+
}
|
|
6500
6506
|
if (handleSubmit)
|
|
6501
6507
|
handleSubmit("");
|
|
6502
6508
|
/**
|
|
@@ -9380,18 +9386,31 @@ const TableRow = React.forwardRef((props, ref) => {
|
|
|
9380
9386
|
|
|
9381
9387
|
const StyledTableHeader$1 = styled__default.default("thead") `
|
|
9382
9388
|
${(props) => {
|
|
9389
|
+
const { hasFilterRow } = props;
|
|
9383
9390
|
const semanticColors = getSemanticColors(props);
|
|
9384
9391
|
return `
|
|
9385
9392
|
border-bottom: solid 2px ${semanticColors?.base?.borderSecondary};
|
|
9386
9393
|
margin: 0;
|
|
9387
9394
|
padding: 0;
|
|
9395
|
+
|
|
9396
|
+
${hasFilterRow
|
|
9397
|
+
? `
|
|
9398
|
+
> tr:first-of-type {
|
|
9399
|
+
border-bottom: none;
|
|
9400
|
+
|
|
9401
|
+
:after {
|
|
9402
|
+
display: none !important;
|
|
9403
|
+
}
|
|
9404
|
+
}
|
|
9405
|
+
`
|
|
9406
|
+
: ""}
|
|
9388
9407
|
`;
|
|
9389
9408
|
}}
|
|
9390
9409
|
`;
|
|
9391
9410
|
|
|
9392
9411
|
const TableHeader = React.forwardRef((props, ref) => {
|
|
9393
|
-
const { children } = props;
|
|
9394
|
-
return (jsxRuntime.
|
|
9412
|
+
const { children, filterRow } = props;
|
|
9413
|
+
return (jsxRuntime.jsxs(StyledTableHeader$1, __assign({ ref: ref, hasFilterRow: !!filterRow }, props, { children: [jsxRuntime.jsx(TableRow, { hover: false, shouldShowTooltipOnHover: false, children: children }), filterRow] })));
|
|
9395
9414
|
});
|
|
9396
9415
|
|
|
9397
9416
|
const contentPositionMapping = {
|
|
@@ -9435,7 +9454,6 @@ const ShouldTruncate$1 = () => {
|
|
|
9435
9454
|
};
|
|
9436
9455
|
const StyledTableHeader = styled__default.default.div `
|
|
9437
9456
|
${fontHeaderS}
|
|
9438
|
-
${focusVisibleA11yStyle}
|
|
9439
9457
|
|
|
9440
9458
|
${(props) => {
|
|
9441
9459
|
const { active = false, horizontalAlign = "left", hover = true } = props;
|
|
@@ -9448,6 +9466,7 @@ const StyledTableHeader = styled__default.default.div `
|
|
|
9448
9466
|
? semanticColors?.accent?.foregroundInteraction
|
|
9449
9467
|
: semanticColors?.base?.textPrimary;
|
|
9450
9468
|
return `
|
|
9469
|
+
outline: none;
|
|
9451
9470
|
color: ${defaultColor};
|
|
9452
9471
|
padding: ${spaces?.m}px !important;
|
|
9453
9472
|
text-align: ${horizontalAlign};
|
|
@@ -10018,12 +10037,12 @@ const InputCheckbox = (props) => {
|
|
|
10018
10037
|
|
|
10019
10038
|
const StyledCellComponentData = styled__default.default.div `
|
|
10020
10039
|
${fontBodyS$1}
|
|
10021
|
-
${focusVisibleA11yStyle}
|
|
10022
10040
|
|
|
10023
10041
|
${(props) => {
|
|
10024
10042
|
const spaces = getSpaces(props);
|
|
10025
10043
|
const { horizontalAlign = "left", verticalAlign = "top" } = props;
|
|
10026
10044
|
return `
|
|
10045
|
+
outline: none;
|
|
10027
10046
|
align-items: center;
|
|
10028
10047
|
text-align: ${horizontalAlign};
|
|
10029
10048
|
vertical-align: ${verticalAlign};
|
|
@@ -10135,6 +10154,104 @@ const StyledTableWrapper = styled__default.default.div `
|
|
|
10135
10154
|
}
|
|
10136
10155
|
}
|
|
10137
10156
|
}
|
|
10157
|
+
|
|
10158
|
+
td,
|
|
10159
|
+
th {
|
|
10160
|
+
--pinned-gradient-base: transparent;
|
|
10161
|
+
--pinned-gradient-bg: ${semanticColors?.base?.backgroundPrimary};
|
|
10162
|
+
--pinned-gradient-overlay: transparent;
|
|
10163
|
+
}
|
|
10164
|
+
|
|
10165
|
+
tbody tr:hover td,
|
|
10166
|
+
tbody tr:hover th {
|
|
10167
|
+
--pinned-gradient-overlay: ${semanticColors?.base
|
|
10168
|
+
?.fillPrimaryInteraction};
|
|
10169
|
+
}
|
|
10170
|
+
|
|
10171
|
+
tbody tr[aria-selected="true"] td,
|
|
10172
|
+
tbody tr[aria-selected="true"] th {
|
|
10173
|
+
--pinned-gradient-bg: ${semanticColors?.accent?.surfaceSecondary};
|
|
10174
|
+
}
|
|
10175
|
+
|
|
10176
|
+
${sdsStyle === "striped" &&
|
|
10177
|
+
`
|
|
10178
|
+
tbody tr:nth-of-type(odd) td,
|
|
10179
|
+
tbody tr:nth-of-type(odd) th {
|
|
10180
|
+
--pinned-gradient-base: ${semanticColors?.base?.backgroundPrimary};
|
|
10181
|
+
--pinned-gradient-bg: ${semanticColors?.base?.backgroundSecondary};
|
|
10182
|
+
}
|
|
10183
|
+
|
|
10184
|
+
tbody tr:nth-of-type(odd):hover td,
|
|
10185
|
+
tbody tr:nth-of-type(odd):hover th {
|
|
10186
|
+
--pinned-gradient-base: transparent;
|
|
10187
|
+
--pinned-gradient-bg: ${semanticColors?.base?.backgroundPrimary};
|
|
10188
|
+
}
|
|
10189
|
+
|
|
10190
|
+
tbody tr[aria-selected="true"]:nth-of-type(odd) td,
|
|
10191
|
+
tbody tr[aria-selected="true"]:nth-of-type(odd) th {
|
|
10192
|
+
--pinned-gradient-base: transparent;
|
|
10193
|
+
--pinned-gradient-bg: ${semanticColors?.accent?.surfaceSecondary};
|
|
10194
|
+
}
|
|
10195
|
+
|
|
10196
|
+
tbody tr[aria-selected="true"]:nth-of-type(odd):hover td,
|
|
10197
|
+
tbody tr[aria-selected="true"]:nth-of-type(odd):hover th {
|
|
10198
|
+
--pinned-gradient-base: transparent;
|
|
10199
|
+
--pinned-gradient-bg: ${semanticColors?.accent?.surfaceSecondary};
|
|
10200
|
+
}
|
|
10201
|
+
`}
|
|
10202
|
+
|
|
10203
|
+
[data-pinned-edge]::after {
|
|
10204
|
+
content: "";
|
|
10205
|
+
position: absolute;
|
|
10206
|
+
top: 0;
|
|
10207
|
+
bottom: 0;
|
|
10208
|
+
width: 24px;
|
|
10209
|
+
pointer-events: none;
|
|
10210
|
+
opacity: 0;
|
|
10211
|
+
transition: opacity 0.3s ease;
|
|
10212
|
+
}
|
|
10213
|
+
|
|
10214
|
+
[data-pinned-edge="left"]::after {
|
|
10215
|
+
right: 0;
|
|
10216
|
+
transform: translateX(100%);
|
|
10217
|
+
background:
|
|
10218
|
+
linear-gradient(
|
|
10219
|
+
var(--pinned-gradient-overlay),
|
|
10220
|
+
var(--pinned-gradient-overlay)
|
|
10221
|
+
),
|
|
10222
|
+
linear-gradient(var(--pinned-gradient-bg), var(--pinned-gradient-bg)),
|
|
10223
|
+
linear-gradient(
|
|
10224
|
+
var(--pinned-gradient-base),
|
|
10225
|
+
var(--pinned-gradient-base)
|
|
10226
|
+
);
|
|
10227
|
+
-webkit-mask-image: linear-gradient(to right, black, transparent);
|
|
10228
|
+
mask-image: linear-gradient(to right, black, transparent);
|
|
10229
|
+
}
|
|
10230
|
+
|
|
10231
|
+
[data-pinned-edge="right"]::after {
|
|
10232
|
+
left: 0;
|
|
10233
|
+
transform: translateX(-100%);
|
|
10234
|
+
background:
|
|
10235
|
+
linear-gradient(
|
|
10236
|
+
var(--pinned-gradient-overlay),
|
|
10237
|
+
var(--pinned-gradient-overlay)
|
|
10238
|
+
),
|
|
10239
|
+
linear-gradient(var(--pinned-gradient-bg), var(--pinned-gradient-bg)),
|
|
10240
|
+
linear-gradient(
|
|
10241
|
+
var(--pinned-gradient-base),
|
|
10242
|
+
var(--pinned-gradient-base)
|
|
10243
|
+
);
|
|
10244
|
+
-webkit-mask-image: linear-gradient(to left, black, transparent);
|
|
10245
|
+
mask-image: linear-gradient(to left, black, transparent);
|
|
10246
|
+
}
|
|
10247
|
+
|
|
10248
|
+
&[data-scrolled-left="true"] [data-pinned-edge="left"]::after {
|
|
10249
|
+
opacity: 1;
|
|
10250
|
+
}
|
|
10251
|
+
|
|
10252
|
+
&[data-scrolled-right="true"] [data-pinned-edge="right"]::after {
|
|
10253
|
+
opacity: 1;
|
|
10254
|
+
}
|
|
10138
10255
|
`;
|
|
10139
10256
|
}}
|
|
10140
10257
|
`;
|
|
@@ -10186,6 +10303,38 @@ const StyledPaginationWrapper = styled__default.default.div `
|
|
|
10186
10303
|
const StyledSelectionCell = styled__default.default(CellComponent) `
|
|
10187
10304
|
line-height: 22px !important;
|
|
10188
10305
|
`;
|
|
10306
|
+
const StyledFilterRow = styled__default.default("tr") `
|
|
10307
|
+
${(props) => {
|
|
10308
|
+
const semanticColors = getSemanticColors(props);
|
|
10309
|
+
return `
|
|
10310
|
+
background-color: ${semanticColors?.base?.backgroundPrimary};
|
|
10311
|
+
border: none;
|
|
10312
|
+
box-shadow: none;
|
|
10313
|
+
|
|
10314
|
+
td, th {
|
|
10315
|
+
background-color: ${semanticColors?.base?.backgroundPrimary};
|
|
10316
|
+
}
|
|
10317
|
+
|
|
10318
|
+
&:after {
|
|
10319
|
+
display: none !important;
|
|
10320
|
+
}
|
|
10321
|
+
|
|
10322
|
+
&:hover {
|
|
10323
|
+
background-color: ${semanticColors?.base?.backgroundPrimary};
|
|
10324
|
+
}
|
|
10325
|
+
`;
|
|
10326
|
+
}}
|
|
10327
|
+
`;
|
|
10328
|
+
const StyledFilterCell = styled__default.default("th") `
|
|
10329
|
+
${(props) => {
|
|
10330
|
+
const spaces = getSpaces(props);
|
|
10331
|
+
return `
|
|
10332
|
+
padding: 0 ${spaces?.s}px ${spaces?.s}px;
|
|
10333
|
+
vertical-align: middle;
|
|
10334
|
+
width: 100%;
|
|
10335
|
+
`;
|
|
10336
|
+
}}
|
|
10337
|
+
`;
|
|
10189
10338
|
|
|
10190
10339
|
const SELECT_COLUMN_ID = "SdsTableSelectColumn";
|
|
10191
10340
|
function getSize(size = 100, max = Number.MAX_SAFE_INTEGER, min = 40) {
|
|
@@ -10281,11 +10430,78 @@ const getCommonPinningStyles = (column, table) => {
|
|
|
10281
10430
|
};
|
|
10282
10431
|
};
|
|
10283
10432
|
|
|
10433
|
+
/**
|
|
10434
|
+
* Manages gradient vignettes on the inner edges of pinned columns.
|
|
10435
|
+
*
|
|
10436
|
+
* Identifies which columns sit at the boundary of left/right pinned groups
|
|
10437
|
+
* and toggles scroll-aware data attributes on the wrapper so the CSS
|
|
10438
|
+
* gradients in StyledTableWrapper only appear while content scrolls
|
|
10439
|
+
* underneath the pinned columns.
|
|
10440
|
+
*/
|
|
10441
|
+
function usePinnedColumnGradient(table, columns) {
|
|
10442
|
+
const tableWrapperRef = React.useRef(null);
|
|
10443
|
+
const { lastLeftPinnedColumnId, firstRightPinnedColumnId } = React.useMemo(() => {
|
|
10444
|
+
const allCols = table.getAllColumns();
|
|
10445
|
+
const leftPinned = allCols.filter((col) => col.columnDef.meta?.pinning === "left");
|
|
10446
|
+
const rightPinned = allCols.filter((col) => col.columnDef.meta?.pinning === "right");
|
|
10447
|
+
return {
|
|
10448
|
+
firstRightPinnedColumnId: rightPinned.length > 0 ? rightPinned[0].id : null,
|
|
10449
|
+
lastLeftPinnedColumnId: leftPinned.length > 0 ? leftPinned[leftPinned.length - 1].id : null
|
|
10450
|
+
};
|
|
10451
|
+
// (masoudmanson): `columns` is included as a dependency even though only
|
|
10452
|
+
// `table.getAllColumns()`is called inside the callback. The TanStack
|
|
10453
|
+
// Table `table` object can be a stable reference that doesn't change
|
|
10454
|
+
// identity when column definitions change, so `columns` acts as a
|
|
10455
|
+
// reactivity signal to ensure this memo recomputes.
|
|
10456
|
+
//
|
|
10457
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10458
|
+
}, [table, columns]);
|
|
10459
|
+
const getPinnedEdge = React.useCallback((columnId) => {
|
|
10460
|
+
if (columnId === lastLeftPinnedColumnId)
|
|
10461
|
+
return "left";
|
|
10462
|
+
if (columnId === firstRightPinnedColumnId)
|
|
10463
|
+
return "right";
|
|
10464
|
+
return undefined;
|
|
10465
|
+
}, [lastLeftPinnedColumnId, firstRightPinnedColumnId]);
|
|
10466
|
+
React.useEffect(() => {
|
|
10467
|
+
const wrapper = tableWrapperRef.current;
|
|
10468
|
+
if (!wrapper)
|
|
10469
|
+
return;
|
|
10470
|
+
if (!lastLeftPinnedColumnId && !firstRightPinnedColumnId)
|
|
10471
|
+
return;
|
|
10472
|
+
const updateScrollState = () => {
|
|
10473
|
+
const { scrollLeft, scrollWidth, clientWidth } = wrapper;
|
|
10474
|
+
const hasHorizontalScroll = scrollWidth > clientWidth;
|
|
10475
|
+
if (scrollLeft > 0) {
|
|
10476
|
+
wrapper.setAttribute("data-scrolled-left", "true");
|
|
10477
|
+
}
|
|
10478
|
+
else {
|
|
10479
|
+
wrapper.removeAttribute("data-scrolled-left");
|
|
10480
|
+
}
|
|
10481
|
+
if (hasHorizontalScroll && scrollLeft < scrollWidth - clientWidth - 1) {
|
|
10482
|
+
wrapper.setAttribute("data-scrolled-right", "true");
|
|
10483
|
+
}
|
|
10484
|
+
else {
|
|
10485
|
+
wrapper.removeAttribute("data-scrolled-right");
|
|
10486
|
+
}
|
|
10487
|
+
};
|
|
10488
|
+
updateScrollState();
|
|
10489
|
+
wrapper.addEventListener("scroll", updateScrollState, { passive: true });
|
|
10490
|
+
const resizeObserver = new ResizeObserver(() => updateScrollState());
|
|
10491
|
+
resizeObserver.observe(wrapper);
|
|
10492
|
+
return () => {
|
|
10493
|
+
wrapper.removeEventListener("scroll", updateScrollState);
|
|
10494
|
+
resizeObserver.disconnect();
|
|
10495
|
+
};
|
|
10496
|
+
}, [lastLeftPinnedColumnId, firstRightPinnedColumnId]);
|
|
10497
|
+
return { getPinnedEdge, tableWrapperRef };
|
|
10498
|
+
}
|
|
10499
|
+
|
|
10284
10500
|
// Create context for row hover state
|
|
10285
10501
|
const RowHoverContext = React.createContext({
|
|
10286
10502
|
isRowHovered: false
|
|
10287
10503
|
});
|
|
10288
|
-
const
|
|
10504
|
+
const PreComposedTableInner = ({ data, columns, border = true, enableSorting = false, enableRowSelection = false, shouldPinSelectRowToLeft = true, enablePagination = false, enableColumnFiltering = false, enableGlobalFiltering = false, paginationConfig, className, style, tableWidth = "100%", onRowSelect, tableRowProps, sdsStyle = "lined", tableOptions, }, ref) => {
|
|
10289
10505
|
const [sorting, setSorting] = React.useState([]);
|
|
10290
10506
|
const [rowSelection, setRowSelection] = React.useState({});
|
|
10291
10507
|
const [columnVisibility, setColumnVisibility] = React.useState({});
|
|
@@ -10357,10 +10573,35 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10357
10573
|
...columnsWithoutSelection,
|
|
10358
10574
|
];
|
|
10359
10575
|
}, [columns, enableRowSelection, shouldPinSelectRowToLeft]);
|
|
10576
|
+
const { onSortingChange: externalOnSortingChange, onRowSelectionChange: externalOnRowSelectionChange, onColumnVisibilityChange: externalOnColumnVisibilityChange, onColumnPinningChange: externalOnColumnPinningChange, onGlobalFilterChange: externalOnGlobalFilterChange, onPaginationChange: externalOnPaginationChange, } = tableOptions ?? {};
|
|
10577
|
+
const handleSortingChange = React.useCallback((updater) => {
|
|
10578
|
+
setSorting(updater);
|
|
10579
|
+
externalOnSortingChange?.(updater);
|
|
10580
|
+
}, [externalOnSortingChange]);
|
|
10581
|
+
const handleRowSelectionChange = React.useCallback((updater) => {
|
|
10582
|
+
setRowSelection(updater);
|
|
10583
|
+
externalOnRowSelectionChange?.(updater);
|
|
10584
|
+
}, [externalOnRowSelectionChange]);
|
|
10585
|
+
const handleColumnVisibilityChange = React.useCallback((updater) => {
|
|
10586
|
+
setColumnVisibility(updater);
|
|
10587
|
+
externalOnColumnVisibilityChange?.(updater);
|
|
10588
|
+
}, [externalOnColumnVisibilityChange]);
|
|
10589
|
+
const handleColumnPinningChange = React.useCallback((updater) => {
|
|
10590
|
+
setColumnPinning(updater);
|
|
10591
|
+
externalOnColumnPinningChange?.(updater);
|
|
10592
|
+
}, [externalOnColumnPinningChange]);
|
|
10593
|
+
const handleGlobalFilterChange = React.useCallback((updater) => {
|
|
10594
|
+
setGlobalFilter(updater);
|
|
10595
|
+
externalOnGlobalFilterChange?.(updater);
|
|
10596
|
+
}, [externalOnGlobalFilterChange]);
|
|
10597
|
+
const handlePaginationChange = React.useCallback((updater) => {
|
|
10598
|
+
setPagination(updater);
|
|
10599
|
+
externalOnPaginationChange?.(updater);
|
|
10600
|
+
}, [externalOnPaginationChange]);
|
|
10360
10601
|
const table = reactTable.useReactTable({
|
|
10602
|
+
...tableOptions,
|
|
10361
10603
|
columns: tableColumns,
|
|
10362
10604
|
data,
|
|
10363
|
-
debugTable: true,
|
|
10364
10605
|
enableColumnFilters: enableColumnFiltering,
|
|
10365
10606
|
enableGlobalFilter: enableGlobalFiltering,
|
|
10366
10607
|
enableRowSelection: enableRowSelection,
|
|
@@ -10369,21 +10610,23 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10369
10610
|
getFilteredRowModel: reactTable.getFilteredRowModel(),
|
|
10370
10611
|
getPaginationRowModel: reactTable.getPaginationRowModel(),
|
|
10371
10612
|
getSortedRowModel: reactTable.getSortedRowModel(),
|
|
10372
|
-
onColumnPinningChange:
|
|
10373
|
-
onColumnVisibilityChange:
|
|
10374
|
-
onGlobalFilterChange:
|
|
10375
|
-
onPaginationChange:
|
|
10376
|
-
onRowSelectionChange:
|
|
10377
|
-
onSortingChange:
|
|
10613
|
+
onColumnPinningChange: handleColumnPinningChange,
|
|
10614
|
+
onColumnVisibilityChange: handleColumnVisibilityChange,
|
|
10615
|
+
onGlobalFilterChange: handleGlobalFilterChange,
|
|
10616
|
+
onPaginationChange: handlePaginationChange,
|
|
10617
|
+
onRowSelectionChange: handleRowSelectionChange,
|
|
10618
|
+
onSortingChange: handleSortingChange,
|
|
10378
10619
|
state: {
|
|
10379
10620
|
columnPinning,
|
|
10380
10621
|
columnVisibility,
|
|
10381
10622
|
globalFilter,
|
|
10382
10623
|
pagination,
|
|
10383
10624
|
rowSelection,
|
|
10384
|
-
sorting
|
|
10625
|
+
sorting,
|
|
10626
|
+
...tableOptions?.state
|
|
10385
10627
|
}
|
|
10386
10628
|
});
|
|
10629
|
+
React.useImperativeHandle(ref, () => ({ table }), [table]);
|
|
10387
10630
|
const createInitialPinning = React.useCallback(() => {
|
|
10388
10631
|
const initialPinning = {};
|
|
10389
10632
|
tableColumns.forEach((column) => {
|
|
@@ -10436,6 +10679,7 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10436
10679
|
resizeObserver.disconnect();
|
|
10437
10680
|
};
|
|
10438
10681
|
}, [headers, table]);
|
|
10682
|
+
const { tableWrapperRef, getPinnedEdge } = usePinnedColumnGradient(table, tableColumns);
|
|
10439
10683
|
const renderCell = (cell, row) => {
|
|
10440
10684
|
const isRowHovered = hoveredRowId === row.id;
|
|
10441
10685
|
const isPinned = cell.column.columnDef.meta?.pinning;
|
|
@@ -10466,7 +10710,7 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10466
10710
|
: cell.column.columnDef.meta?.verticalAlign }));
|
|
10467
10711
|
}
|
|
10468
10712
|
if (isPinned) {
|
|
10469
|
-
return (jsxRuntime.jsx(RowHoverContext.Provider, { value: { isRowHovered }, children: jsxRuntime.jsx("td", { style: {
|
|
10713
|
+
return (jsxRuntime.jsx(RowHoverContext.Provider, { value: { isRowHovered }, children: jsxRuntime.jsx("td", { "data-pinned-edge": getPinnedEdge(cell.column.id), style: {
|
|
10470
10714
|
...pinnedStyle,
|
|
10471
10715
|
width: `${cell.column.getSize()}px`,
|
|
10472
10716
|
verticalAlign: cell.column.columnDef.meta?.verticalAlign
|
|
@@ -10477,16 +10721,41 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10477
10721
|
width: `${cell.column.getSize()}px`
|
|
10478
10722
|
}, children: cellContent }) }, cell.id));
|
|
10479
10723
|
};
|
|
10724
|
+
const renderFilterCell = (header) => {
|
|
10725
|
+
const column = header.column;
|
|
10726
|
+
const isPinned = column.columnDef.meta?.pinning;
|
|
10727
|
+
const pinnedStyle = getCommonPinningStyles(column, table);
|
|
10728
|
+
const isSelectionColumn = column.id === SELECT_COLUMN_ID;
|
|
10729
|
+
const cellStyle = {
|
|
10730
|
+
...(isPinned ? pinnedStyle : {}),
|
|
10731
|
+
width: `${column.getSize()}px`
|
|
10732
|
+
};
|
|
10733
|
+
const pinnedEdge = isPinned ? getPinnedEdge(column.id) : undefined;
|
|
10734
|
+
const customFilter = column.columnDef.meta?.filterComponent;
|
|
10735
|
+
if (customFilter && !isSelectionColumn) {
|
|
10736
|
+
return (jsxRuntime.jsx(StyledFilterCell, { "data-pinned-edge": pinnedEdge, style: cellStyle, children: customFilter({ column, table }) }, `filter-${header.id}`));
|
|
10737
|
+
}
|
|
10738
|
+
const canFilter = column.getCanFilter() && !isSelectionColumn;
|
|
10739
|
+
if (!canFilter) {
|
|
10740
|
+
return (jsxRuntime.jsx(StyledFilterCell, { "data-pinned-edge": pinnedEdge, style: cellStyle }, `filter-${header.id}`));
|
|
10741
|
+
}
|
|
10742
|
+
return (jsxRuntime.jsx(StyledFilterCell, { "data-pinned-edge": pinnedEdge, style: cellStyle, children: jsxRuntime.jsx(InputSearch, { id: `filter-${column.id}`, label: `Filter ${typeof column.columnDef.header === "string" ? column.columnDef.header : column.id}`, placeholder: "Search", sdsStyle: "square", value: column.getFilterValue() ?? "", onChange: (e) => column.setFilterValue(e.target.value || undefined) }) }, `filter-${header.id}`));
|
|
10743
|
+
};
|
|
10744
|
+
const renderFilterRow = () => {
|
|
10745
|
+
const flatHeaders = table.getFlatHeaders();
|
|
10746
|
+
return (jsxRuntime.jsx(StyledFilterRow, { children: flatHeaders.map((header) => renderFilterCell(header)) }));
|
|
10747
|
+
};
|
|
10480
10748
|
const renderHeader = (header) => {
|
|
10481
10749
|
const isSortable = enableSorting && header.column.getCanSort();
|
|
10482
10750
|
const isSorted = header.column.getIsSorted();
|
|
10483
10751
|
const sortDirection = header.column.getIsSorted();
|
|
10484
10752
|
const isPinned = header.column.columnDef.meta?.pinning;
|
|
10485
10753
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10486
|
-
const { ref, ...headerCellProps } = header.column.columnDef.meta?.headerCellProps || {};
|
|
10754
|
+
const { ref: headerCellRef, ...headerCellProps } = header.column.columnDef.meta?.headerCellProps || {};
|
|
10487
10755
|
const pinnedStyle = getCommonPinningStyles(header.column, table);
|
|
10756
|
+
const pinnedEdge = isPinned ? getPinnedEdge(header.column.id) : undefined;
|
|
10488
10757
|
if (typeof header.column.columnDef.header === "string") {
|
|
10489
|
-
return (jsxRuntime.jsx(CellHeader, __assign({ colSpan: header.colSpan, style: {
|
|
10758
|
+
return (jsxRuntime.jsx(CellHeader, __assign({ colSpan: header.colSpan, "data-pinned-edge": pinnedEdge, style: {
|
|
10490
10759
|
...(isPinned ? pinnedStyle : {}),
|
|
10491
10760
|
width: `${header.getSize()}px`
|
|
10492
10761
|
}, active: !!isSorted, direction: sortDirection || undefined, hover: isSortable, onClick: header.column.getToggleSortingHandler() }, headerCellProps, { children: header.isPlaceholder ? null : header.column.columnDef.header }), header.id));
|
|
@@ -10494,6 +10763,7 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10494
10763
|
else if (header.column.columnDef.header) {
|
|
10495
10764
|
return reactTable.flexRender(header.column.columnDef.header, {
|
|
10496
10765
|
...header.getContext(),
|
|
10766
|
+
"data-pinned-edge": pinnedEdge,
|
|
10497
10767
|
key: header.id,
|
|
10498
10768
|
style: {
|
|
10499
10769
|
...(isPinned ? pinnedStyle : {}),
|
|
@@ -10503,20 +10773,21 @@ const PreComposedTable = ({ data, columns, border = true, enableSorting = false,
|
|
|
10503
10773
|
}
|
|
10504
10774
|
else {
|
|
10505
10775
|
// Fallback for undefined header content
|
|
10506
|
-
return (jsxRuntime.jsx(CellHeader, { colSpan: header.colSpan, style: {
|
|
10776
|
+
return (jsxRuntime.jsx(CellHeader, { colSpan: header.colSpan, "data-pinned-edge": pinnedEdge, style: {
|
|
10507
10777
|
...(isPinned ? pinnedStyle : {}),
|
|
10508
10778
|
width: `${header.getSize()}px`
|
|
10509
10779
|
}, active: !!isSorted, direction: sortDirection || undefined, hover: isSortable, onClick: header.column.getToggleSortingHandler(), children: header.column.id || "Header" }, header.id));
|
|
10510
10780
|
}
|
|
10511
10781
|
};
|
|
10512
|
-
return (jsxRuntime.jsxs(StyledTableContainer$1, { ref: tableContainerRef, className: className, style: { width: tableWidth, ...style }, children: [enableGlobalFiltering && (jsxRuntime.jsx("div", { style: { marginBottom: "16px" }, children: jsxRuntime.jsx(StyledInputSearch, { id: "global-search", label: "Search", placeholder: "Search all columns...", value: globalFilter, onChange: (e) => setGlobalFilter(e.target.value) }) })), jsxRuntime.jsx(StyledTableWrapper, { border: border, sdsStyle: sdsStyle, children: jsxRuntime.jsxs(Table, { children: [jsxRuntime.jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => {
|
|
10782
|
+
return (jsxRuntime.jsxs(StyledTableContainer$1, { ref: tableContainerRef, className: className, style: { width: tableWidth, ...style }, children: [enableGlobalFiltering && (jsxRuntime.jsx("div", { style: { marginBottom: "16px" }, children: jsxRuntime.jsx(StyledInputSearch, { id: "global-search", label: "Search", placeholder: "Search all columns...", value: globalFilter, onChange: (e) => setGlobalFilter(e.target.value) }) })), jsxRuntime.jsx(StyledTableWrapper, { ref: tableWrapperRef, border: border, sdsStyle: sdsStyle, children: jsxRuntime.jsxs(Table, { children: [jsxRuntime.jsx(TableHeader, { filterRow: enableColumnFiltering ? renderFilterRow() : undefined, children: table.getHeaderGroups().map((headerGroup) => {
|
|
10513
10783
|
return (jsxRuntime.jsx(React.Fragment, { children: headerGroup.headers.map((header) => {
|
|
10514
10784
|
return renderHeader(header);
|
|
10515
10785
|
}) }, headerGroup.id));
|
|
10516
|
-
}) }), jsxRuntime.jsx("tbody", { children: table.getRowModel().rows.map((row) => (jsxRuntime.jsx(TableRow, __assign({ onMouseEnter: () => setHoveredRowId(row.id), onMouseLeave: () => setHoveredRowId(null), selected: row.getIsSelected(), "aria-selected": row.getIsSelected() }, tableRowProps, { children: row.getVisibleCells().map((cell) => {
|
|
10786
|
+
}) }), jsxRuntime.jsx("tbody", { children: table.getRowModel().rows.map((row) => (jsxRuntime.jsx(TableRow, __assign({ onMouseEnter: () => setHoveredRowId(row.id), onMouseLeave: () => setHoveredRowId(null), selected: row.getIsSelected(), "aria-selected": row.getIsSelected(), className: "group" }, tableRowProps, { children: row.getVisibleCells().map((cell) => {
|
|
10517
10787
|
return renderCell(cell, row);
|
|
10518
10788
|
}) }), row.id))) })] }) }), enablePagination && (jsxRuntime.jsx(StyledPaginationWrapper, { placement: paginationConfig?.placement, children: jsxRuntime.jsx(Pagination, __assign({ currentPage: table.getState().pagination.pageIndex + 1, onPageChange: (page) => table.setPageIndex(page - 1), onNextPage: () => table.nextPage(), onPreviousPage: () => table.previousPage(), pageSize: table.getState().pagination.pageSize, totalCount: table.getFilteredRowModel().rows.length }, paginationConfig)) }))] }, `table-${columns.length}-${columns.map((col) => col.id || "col").join("-")}`));
|
|
10519
10789
|
};
|
|
10790
|
+
const PreComposedTable = React.forwardRef(PreComposedTableInner);
|
|
10520
10791
|
|
|
10521
10792
|
const doNotForwardProps$v = [
|
|
10522
10793
|
"icon",
|
|
@@ -10605,6 +10876,7 @@ const PrimaryText = styled__default.default("div", {
|
|
|
10605
10876
|
return `
|
|
10606
10877
|
display: block;
|
|
10607
10878
|
font-variant-numeric: ${tabularNums ? TABULAR_NUMS : "normal"};
|
|
10879
|
+
white-space: pre-wrap;
|
|
10608
10880
|
|
|
10609
10881
|
${props.shouldTextWrap
|
|
10610
10882
|
? ShouldWrap(primaryTextWrapLineCount)
|
|
@@ -10625,6 +10897,7 @@ const SecondaryText = styled__default.default("span", {
|
|
|
10625
10897
|
color: ${semanticColors?.base?.textSecondary};
|
|
10626
10898
|
padding-top: 0px;
|
|
10627
10899
|
font-variant-numeric: ${tabularNums ? TABULAR_NUMS : "normal"};
|
|
10900
|
+
white-space: pre-wrap;
|
|
10628
10901
|
|
|
10629
10902
|
${props.shouldTextWrap
|
|
10630
10903
|
? ShouldWrap(secondaryTextWrapLineCount)
|
|
@@ -10646,6 +10919,7 @@ const TertiaryText = styled__default.default("span", {
|
|
|
10646
10919
|
color: ${semanticColors?.base?.textSecondary};
|
|
10647
10920
|
padding-top: ${spaces?.xxxs}px;
|
|
10648
10921
|
font-variant-numeric: ${tabularNums ? TABULAR_NUMS : "normal"};
|
|
10922
|
+
white-space: pre-wrap;
|
|
10649
10923
|
|
|
10650
10924
|
${props.shouldTextWrap
|
|
10651
10925
|
? ShouldWrap(tertiaryTextWrapLineCount)
|
|
@@ -10671,7 +10945,6 @@ const PrimaryTextComponentSlotRightWrapper = styled__default.default("div") `
|
|
|
10671
10945
|
`;
|
|
10672
10946
|
const StyledTableData = styled__default.default.div `
|
|
10673
10947
|
${fontBodyS$1}
|
|
10674
|
-
${focusVisibleA11yStyle}
|
|
10675
10948
|
|
|
10676
10949
|
${(props) => {
|
|
10677
10950
|
const { horizontalAlign = "left", verticalAlign = "top", shouldShowUnderlineOnHover = false, isRowHovered = false, extraRightPadding = 0, } = props;
|
|
@@ -10680,6 +10953,7 @@ const StyledTableData = styled__default.default.div `
|
|
|
10680
10953
|
? (spaces?.m ?? 0) + extraRightPadding
|
|
10681
10954
|
: spaces?.m;
|
|
10682
10955
|
return `
|
|
10956
|
+
outline: none;
|
|
10683
10957
|
padding: ${spaces?.m}px ${paddingRight}px ${spaces?.m}px ${spaces?.m}px !important;
|
|
10684
10958
|
text-align: ${horizontalAlign};
|
|
10685
10959
|
vertical-align: ${verticalAlignCSSMap[verticalAlign]};
|
|
@@ -10687,12 +10961,12 @@ const StyledTableData = styled__default.default.div `
|
|
|
10687
10961
|
|
|
10688
10962
|
&:hover {
|
|
10689
10963
|
${PrimaryText} {
|
|
10690
|
-
${shouldShowUnderlineOnHover ? "text-decoration: underline;" : ""}
|
|
10964
|
+
${shouldShowUnderlineOnHover ? "text-decoration: underline !important;" : ""}
|
|
10691
10965
|
}
|
|
10692
10966
|
}
|
|
10693
10967
|
|
|
10694
10968
|
${PrimaryText} {
|
|
10695
|
-
${isRowHovered && shouldShowUnderlineOnHover ? "text-decoration: underline;" : ""}
|
|
10969
|
+
${isRowHovered && shouldShowUnderlineOnHover ? "text-decoration: underline !important;" : ""}
|
|
10696
10970
|
}
|
|
10697
10971
|
`;
|
|
10698
10972
|
}}
|
|
@@ -18544,11 +18818,28 @@ const StyledHeaderComponent = styled__default.default("div") `
|
|
|
18544
18818
|
top: 0;
|
|
18545
18819
|
z-index: 1000;
|
|
18546
18820
|
background-color: ${semanticColors?.base?.backgroundPrimary};
|
|
18547
|
-
padding-bottom: ${spaces?.
|
|
18821
|
+
padding-bottom: ${spaces?.m}px;
|
|
18822
|
+
margin-bottom: ${spaces?.m}px;
|
|
18548
18823
|
padding-top: ${spaces?.xl}px;
|
|
18549
18824
|
display: flex;
|
|
18550
18825
|
justify-content: space-between;
|
|
18551
|
-
align-items:
|
|
18826
|
+
align-items: center;
|
|
18827
|
+
|
|
18828
|
+
&::after {
|
|
18829
|
+
content: "";
|
|
18830
|
+
position: absolute;
|
|
18831
|
+
bottom: 0;
|
|
18832
|
+
left: 0;
|
|
18833
|
+
right: 0;
|
|
18834
|
+
height: ${spaces?.xl}px;
|
|
18835
|
+
transform: translateY(100%);
|
|
18836
|
+
background: linear-gradient(
|
|
18837
|
+
to bottom,
|
|
18838
|
+
${semanticColors?.base?.backgroundPrimary},
|
|
18839
|
+
transparent
|
|
18840
|
+
);
|
|
18841
|
+
pointer-events: none;
|
|
18842
|
+
}
|
|
18552
18843
|
`;
|
|
18553
18844
|
}}
|
|
18554
18845
|
`;
|
|
@@ -18578,6 +18869,8 @@ const StyledPanelHeaderClose = styled__default.default("div") `
|
|
|
18578
18869
|
align-items: center;
|
|
18579
18870
|
|
|
18580
18871
|
button {
|
|
18872
|
+
height: auto !important;
|
|
18873
|
+
|
|
18581
18874
|
svg {
|
|
18582
18875
|
width: ${iconSizes?.l?.width}px;
|
|
18583
18876
|
height: ${iconSizes?.l?.height}px;
|