@ostack.tech/ui 0.11.3 → 0.12.1
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/ostack-ui.css +40 -32
- package/dist/ostack-ui.js +552 -304
- package/dist/ostack-ui.js.map +1 -1
- package/dist/types/components/DataTable/DataTableColumn.d.ts +12 -1
- package/dist/types/components/DataTable/DataTableContext.d.ts +2 -0
- package/dist/types/components/DataTable/DataTableFoot.d.ts +2 -1
- package/dist/types/components/DataTable/columnUtils.d.ts +5 -0
- package/dist/types/components/DataTable/sanitizeProps.d.ts +8 -0
- package/dist/types/components/Layer/Layer.d.ts +32 -0
- package/dist/types/components/Layer/LayerContext.d.ts +6 -0
- package/dist/types/components/Layer/index.d.ts +2 -0
- package/dist/types/components/Overlay/Overlay.d.ts +1 -1
- package/dist/types/components/Root/Root.d.ts +9 -4
- package/dist/types/components/Table/Table.d.ts +4 -4
- package/dist/types/components/Table/TableCell.d.ts +15 -0
- package/dist/types/components/Table/TableColumn.d.ts +1 -1
- package/dist/types/components/Table/TableContext.d.ts +9 -9
- package/dist/types/components/Table/TableHead.d.ts +2 -2
- package/dist/types/components/Table/columnUtils.d.ts +35 -0
- package/dist/types/components/Toast/ToastProvider.d.ts +2 -1
- package/dist/types/components/Toast/ToastViewport.d.ts +8 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -5
- package/scss/components/CommandMenu/_CommandMenu-variables.scss +0 -1
- package/scss/components/CommandMenu/_CommandMenu.scss +0 -2
- package/scss/components/DataTable/_DataTable.scss +4 -3
- package/scss/components/Dialog/_Dialog-variables.scss +0 -1
- package/scss/components/Dialog/_Dialog.scss +0 -1
- package/scss/components/DropdownMenu/_DropdownMenu-variables.scss +0 -2
- package/scss/components/DropdownMenu/_DropdownMenu.scss +0 -1
- package/scss/components/Overlay/_Overlay-variables.scss +0 -1
- package/scss/components/Overlay/_Overlay.scss +0 -1
- package/scss/components/Table/_Table-variables.scss +2 -4
- package/scss/components/Table/_Table.scss +10 -8
- package/scss/components/Tabs/_Tabs-variables.scss +3 -3
- package/scss/components/Toast/_Toast.scss +26 -14
- package/scss/components/Tooltip/_Tooltip-variables.scss +0 -1
- package/scss/components/Tooltip/_Tooltip.scss +0 -2
- package/scss/scss/_base-variables.scss +0 -2
- package/scss/scss/placeholders/button/_button-variables.scss +1 -1
- package/scss/scss/placeholders/button/_button.scss +5 -2
- package/scss/scss/placeholders/control/_control-variables.scss +3 -5
- package/scss/scss/placeholders/popover/_popover-variables.scss +0 -1
- package/scss/scss/placeholders/popover/_popover.scss +0 -2
package/dist/ostack-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { forwardRef, createContext, useContext, useCallback, useRef, useEffect, useId, useMemo, useState, memo, Fragment as Fragment$1,
|
|
2
|
+
import { forwardRef, createContext, useContext, useCallback, useRef, useEffect, useId, useMemo, Children, isValidElement, useState, memo, Fragment as Fragment$1, cloneElement, useImperativeHandle, startTransition, useLayoutEffect as useLayoutEffect$2, useSyncExternalStore, useDeferredValue } from "react";
|
|
3
3
|
import { parseKeybinding, tinykeys } from "tinykeys";
|
|
4
4
|
import fromExponential from "from-exponential";
|
|
5
5
|
import { isValid, isDate, addMonths, isBefore, startOfMonth, isAfter, setMonth, setYear, startOfYear, format, max, min, endOfMonth, isWithinInterval, lastDayOfMonth, isSameDay, isEqual, parseISO, parse } from "date-fns";
|
|
@@ -453,6 +453,12 @@ function useCreateDataTableContext({
|
|
|
453
453
|
subscribeWithSelector((set, get) => ({
|
|
454
454
|
columns,
|
|
455
455
|
leafColumns: leafColumns2,
|
|
456
|
+
hasFooterCells: computed(
|
|
457
|
+
() => [get().leafColumns],
|
|
458
|
+
(leafColumns22) => Object.values(leafColumns22).some(
|
|
459
|
+
(column) => typeof column.footer !== "boolean" && column.footer != null
|
|
460
|
+
)
|
|
461
|
+
),
|
|
456
462
|
headCount,
|
|
457
463
|
_offset: offset ?? defaultOffset,
|
|
458
464
|
offset: computed(
|
|
@@ -536,6 +542,10 @@ function useCreateDataTableContext({
|
|
|
536
542
|
() => [get().totalCount(), get().loading, get().loadingCount],
|
|
537
543
|
(totalCount, loading2, loadingCount2) => loading2 ? loadingCount2 : totalCount ?? loadingCount2
|
|
538
544
|
),
|
|
545
|
+
footCount: computed(
|
|
546
|
+
() => [get().hasFooterCells()],
|
|
547
|
+
(hasFooterCells) => hasFooterCells ? 1 : 0
|
|
548
|
+
),
|
|
539
549
|
scrolledRangeStart: 1,
|
|
540
550
|
scrolledRangeEnd: 1,
|
|
541
551
|
tableHeadHeight: void 0,
|
|
@@ -969,7 +979,7 @@ function useOnFieldLabelChange(cb, { fireImmediately = true } = {}) {
|
|
|
969
979
|
}
|
|
970
980
|
let prevCleanup;
|
|
971
981
|
const unsubscribe = store.subscribe(
|
|
972
|
-
(
|
|
982
|
+
({ label }) => label,
|
|
973
983
|
(label) => {
|
|
974
984
|
prevCleanup = cb(label);
|
|
975
985
|
},
|
|
@@ -1020,37 +1030,153 @@ const LinkContext = createContext(LINK_CONTEXT_DEFAULT_VALUE);
|
|
|
1020
1030
|
function useLinkContext() {
|
|
1021
1031
|
return useContext(LinkContext);
|
|
1022
1032
|
}
|
|
1033
|
+
const TableColumn = forwardRef(function TableColumn2() {
|
|
1034
|
+
return null;
|
|
1035
|
+
});
|
|
1036
|
+
function columnsFromChildren(children) {
|
|
1037
|
+
return Children.toArray(children).filter(
|
|
1038
|
+
(child) => isValidElement(child) && child.type === TableColumn
|
|
1039
|
+
).map((child) => ({
|
|
1040
|
+
...child.props,
|
|
1041
|
+
subColumns: columnsFromChildren(child.props.children ?? null)
|
|
1042
|
+
}));
|
|
1043
|
+
}
|
|
1044
|
+
function numberOfRows$1(columns) {
|
|
1045
|
+
return columns.reduce(
|
|
1046
|
+
(n, column) => Math.max(n, numberOfRows$1(column.subColumns) + 1),
|
|
1047
|
+
0
|
|
1048
|
+
);
|
|
1049
|
+
}
|
|
1050
|
+
function numberOfColumns(columns) {
|
|
1051
|
+
return columns.reduce(
|
|
1052
|
+
(n, column) => n + (column.subColumns.length === 0 ? column.colSpan ?? 1 : numberOfColumns(column.subColumns)),
|
|
1053
|
+
0
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
function columnsOfRow(columns, index) {
|
|
1057
|
+
return index === 0 ? columns : columns.reduce((rowColumns, column) => {
|
|
1058
|
+
rowColumns.push(...columnsOfRow(column.subColumns, index - 1));
|
|
1059
|
+
return rowColumns;
|
|
1060
|
+
}, []);
|
|
1061
|
+
}
|
|
1062
|
+
function leafColumns$1(columns) {
|
|
1063
|
+
return columns.reduce((leaves, column) => {
|
|
1064
|
+
leaves.push(
|
|
1065
|
+
...column.subColumns.length === 0 ? [column] : leafColumns$1(column.subColumns)
|
|
1066
|
+
);
|
|
1067
|
+
return leaves;
|
|
1068
|
+
}, []);
|
|
1069
|
+
}
|
|
1070
|
+
function tableMinWidth(leaves, defaultColumnWidth) {
|
|
1071
|
+
return leaves.reduce(
|
|
1072
|
+
(sum, column) => sum + columnWidth(column, defaultColumnWidth),
|
|
1073
|
+
0
|
|
1074
|
+
) + "px";
|
|
1075
|
+
}
|
|
1076
|
+
function tableMaxWidth(leaves, defaultColumnWidth) {
|
|
1077
|
+
return leaves.every((column) => column.fixed) ? tableMinWidth(leaves, defaultColumnWidth) : void 0;
|
|
1078
|
+
}
|
|
1079
|
+
function columnWidths(leaves, defaultColumnWidth) {
|
|
1080
|
+
const dynamicWidthsSum = leaves.reduce(
|
|
1081
|
+
(sum, column) => sum + (column.fixed ? 0 : columnWidth(column, defaultColumnWidth)),
|
|
1082
|
+
0
|
|
1083
|
+
);
|
|
1084
|
+
return leaves.reduce((widths, column) => {
|
|
1085
|
+
const colSpan = column.colSpan ?? 1;
|
|
1086
|
+
const colWidths = Array.isArray(column.width) ? column.width : (
|
|
1087
|
+
// Distribute the width amongst the columns being spanned
|
|
1088
|
+
new Array(colSpan).fill(
|
|
1089
|
+
columnWidth(column, defaultColumnWidth) / colSpan
|
|
1090
|
+
)
|
|
1091
|
+
);
|
|
1092
|
+
for (let i = 0; i < colSpan; ++i) {
|
|
1093
|
+
const colWidth = colWidths[i] ?? 0;
|
|
1094
|
+
widths.push(
|
|
1095
|
+
column.fixed ? `${colWidth}px` : `${colWidth / dynamicWidthsSum * 100}%`
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
return widths;
|
|
1099
|
+
}, []);
|
|
1100
|
+
}
|
|
1101
|
+
function columnWidth(column, defaultColumnsMinWidth) {
|
|
1102
|
+
return Array.isArray(column.width) ? column.width.reduce((sum, width) => sum + width, 0) : column.width ?? defaultColumnsMinWidth * (column.colSpan ?? 1);
|
|
1103
|
+
}
|
|
1104
|
+
function leftMostColumns(columns) {
|
|
1105
|
+
if (columns.length === 0) {
|
|
1106
|
+
return [];
|
|
1107
|
+
}
|
|
1108
|
+
const firstColumn = columns[0];
|
|
1109
|
+
return [firstColumn, ...leftMostColumns(firstColumn.subColumns)];
|
|
1110
|
+
}
|
|
1111
|
+
function rightMostColumns(columns) {
|
|
1112
|
+
if (columns.length === 0) {
|
|
1113
|
+
return [];
|
|
1114
|
+
}
|
|
1115
|
+
const lastColumn = columns[columns.length - 1];
|
|
1116
|
+
return [lastColumn, ...rightMostColumns(lastColumn.subColumns)];
|
|
1117
|
+
}
|
|
1118
|
+
function leftMostLeafColumn(column) {
|
|
1119
|
+
if (column.subColumns.length === 0) {
|
|
1120
|
+
return column;
|
|
1121
|
+
}
|
|
1122
|
+
return leftMostLeafColumn(column.subColumns[0]);
|
|
1123
|
+
}
|
|
1124
|
+
function rightMostLeafColumn(column) {
|
|
1125
|
+
const subcolumnsLength = column.subColumns.length;
|
|
1126
|
+
if (subcolumnsLength === 0) {
|
|
1127
|
+
return column;
|
|
1128
|
+
}
|
|
1129
|
+
return rightMostLeafColumn(column.subColumns[subcolumnsLength - 1]);
|
|
1130
|
+
}
|
|
1131
|
+
function stickyColumnOffsets(leaves, defaultColumnWidth) {
|
|
1132
|
+
const offsets = new Array(leaves.length);
|
|
1133
|
+
let leftSum = 0;
|
|
1134
|
+
let rightSum = 0;
|
|
1135
|
+
for (let i = 0; i < leaves.length; ++i) {
|
|
1136
|
+
const colStart = leaves[i];
|
|
1137
|
+
const colEnd = leaves[leaves.length - 1 - i];
|
|
1138
|
+
if (colStart.sticky === "left") {
|
|
1139
|
+
offsets[i] = leftSum;
|
|
1140
|
+
leftSum += columnWidth(colStart, defaultColumnWidth);
|
|
1141
|
+
}
|
|
1142
|
+
if (colEnd.sticky === "right") {
|
|
1143
|
+
offsets[leaves.length - 1 - i] = rightSum;
|
|
1144
|
+
rightSum += columnWidth(colEnd, defaultColumnWidth);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
return offsets;
|
|
1148
|
+
}
|
|
1023
1149
|
const TableContext = createContext(null);
|
|
1024
|
-
function useCreateTableContext(
|
|
1150
|
+
function useCreateTableContext({
|
|
1151
|
+
editable,
|
|
1152
|
+
status,
|
|
1153
|
+
layout,
|
|
1154
|
+
defaultColumnWidth
|
|
1155
|
+
}) {
|
|
1025
1156
|
const store = useConstant(
|
|
1026
1157
|
() => createStore()(
|
|
1027
|
-
subscribeWithSelector((_set) => ({
|
|
1158
|
+
subscribeWithSelector((_set, get) => ({
|
|
1028
1159
|
scrollPosition: void 0,
|
|
1029
|
-
|
|
1030
|
-
|
|
1160
|
+
leafColumns: void 0,
|
|
1161
|
+
defaultColumnWidth,
|
|
1162
|
+
stickyColumnOffsets: computed(
|
|
1163
|
+
() => [get().leafColumns, get().defaultColumnWidth],
|
|
1164
|
+
(leaves, defaultColumnWidth2) => leaves && stickyColumnOffsets(leaves, defaultColumnWidth2)
|
|
1165
|
+
)
|
|
1031
1166
|
}))
|
|
1032
1167
|
)
|
|
1033
1168
|
);
|
|
1034
|
-
|
|
1035
|
-
(
|
|
1169
|
+
useEffect(() => {
|
|
1170
|
+
store.setState({ defaultColumnWidth });
|
|
1171
|
+
}, [defaultColumnWidth, store]);
|
|
1172
|
+
return useMemo(() => {
|
|
1173
|
+
return {
|
|
1036
1174
|
editable,
|
|
1037
1175
|
status,
|
|
1038
1176
|
layout,
|
|
1039
|
-
defaultColumnWidth,
|
|
1040
|
-
onTableMinWidthChange,
|
|
1041
|
-
onTableMaxWidthChange,
|
|
1042
1177
|
store
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
defaultColumnWidth,
|
|
1046
|
-
editable,
|
|
1047
|
-
layout,
|
|
1048
|
-
onTableMaxWidthChange,
|
|
1049
|
-
onTableMinWidthChange,
|
|
1050
|
-
status,
|
|
1051
|
-
store
|
|
1052
|
-
]
|
|
1053
|
-
);
|
|
1178
|
+
};
|
|
1179
|
+
}, [editable, layout, status, store]);
|
|
1054
1180
|
}
|
|
1055
1181
|
function useTableContext() {
|
|
1056
1182
|
const tableContext = useContext(TableContext);
|
|
@@ -1061,7 +1187,7 @@ function useTableContext() {
|
|
|
1061
1187
|
}
|
|
1062
1188
|
function useTableNumberOfColumns() {
|
|
1063
1189
|
const { store } = useTableContext();
|
|
1064
|
-
return useStore$1(store, (state) => state.
|
|
1190
|
+
return useStore$1(store, (state) => state.leafColumns?.length);
|
|
1065
1191
|
}
|
|
1066
1192
|
const TableHeadContext = createContext(false);
|
|
1067
1193
|
function useIsInTableHead() {
|
|
@@ -1094,6 +1220,87 @@ function ClearContexts({
|
|
|
1094
1220
|
}
|
|
1095
1221
|
return result;
|
|
1096
1222
|
}
|
|
1223
|
+
function useCssVars(options) {
|
|
1224
|
+
const contextPrefix = usePrefix();
|
|
1225
|
+
const prefix = options?.prefix ?? contextPrefix;
|
|
1226
|
+
const cssVarName = useCallback(
|
|
1227
|
+
(name) => `--${prefix(name)}`,
|
|
1228
|
+
[prefix]
|
|
1229
|
+
);
|
|
1230
|
+
const cssVar = useCallback(
|
|
1231
|
+
(name, fallback) => `var(${cssVarName(name)}${// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
1232
|
+
fallback != null ? `, ${String(fallback)}` : ""})`,
|
|
1233
|
+
[cssVarName]
|
|
1234
|
+
);
|
|
1235
|
+
const cssVarStyle = useCallback(
|
|
1236
|
+
(name, value) => value != null ? (
|
|
1237
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
1238
|
+
{ [cssVarName(name)]: String(value) }
|
|
1239
|
+
) : void 0,
|
|
1240
|
+
[cssVarName]
|
|
1241
|
+
);
|
|
1242
|
+
const cssToggler = useCallback(
|
|
1243
|
+
(value) => cssVar(`toggler-${value}`, null),
|
|
1244
|
+
[cssVar]
|
|
1245
|
+
);
|
|
1246
|
+
return useMemo(
|
|
1247
|
+
() => ({ cssVarName, cssVar, cssVarStyle, cssToggler }),
|
|
1248
|
+
[cssToggler, cssVar, cssVarName, cssVarStyle]
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1251
|
+
const LayerContext = createContext([]);
|
|
1252
|
+
function useLayerZIndex() {
|
|
1253
|
+
return computeLayerZIndex(useContext(LayerContext));
|
|
1254
|
+
}
|
|
1255
|
+
function computeLayerZIndex(zIndices) {
|
|
1256
|
+
let zIndexSum;
|
|
1257
|
+
let zIndexStrings;
|
|
1258
|
+
for (const zIndex of zIndices) {
|
|
1259
|
+
if (typeof zIndex === "number") {
|
|
1260
|
+
zIndexSum = (zIndexSum ?? 0) + zIndex;
|
|
1261
|
+
} else {
|
|
1262
|
+
(zIndexStrings ??= []).push(zIndex);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
if (zIndexStrings === void 0) {
|
|
1266
|
+
return zIndexSum === void 0 ? "auto" : zIndexSum.toString();
|
|
1267
|
+
}
|
|
1268
|
+
if (zIndexSum === void 0) {
|
|
1269
|
+
return zIndexStrings.length === 1 ? zIndexStrings[0] : `calc(${zIndexStrings.join(" + ")})`;
|
|
1270
|
+
}
|
|
1271
|
+
return `calc(${zIndexStrings.join(" + ")}${zIndexSum === 0 ? "" : zIndexSum > 0 ? ` + ${zIndexSum}` : ` - ${-zIndexSum}`})`;
|
|
1272
|
+
}
|
|
1273
|
+
function Layer({ zIndex, reset, style, ...otherProps }) {
|
|
1274
|
+
const { cssVar, cssVarStyle } = useCssVars();
|
|
1275
|
+
const parentZIndices = useContext(LayerContext);
|
|
1276
|
+
const normalizeZIndex = useCallback(
|
|
1277
|
+
(zIndex2) => typeof zIndex2 === "string" ? cssVar(`z-index-${zIndex2}`) : zIndex2,
|
|
1278
|
+
[cssVar]
|
|
1279
|
+
);
|
|
1280
|
+
const normalizedZIndex = useMemo(
|
|
1281
|
+
() => (Array.isArray(zIndex) ? zIndex.map(normalizeZIndex) : [normalizeZIndex(zIndex)]).filter((v) => v != null),
|
|
1282
|
+
[normalizeZIndex, zIndex]
|
|
1283
|
+
);
|
|
1284
|
+
const zIndices = useMemo(
|
|
1285
|
+
() => normalizedZIndex == null ? reset ? [] : parentZIndices : reset ? normalizedZIndex : [...parentZIndices, ...normalizedZIndex],
|
|
1286
|
+
[normalizedZIndex, parentZIndices, reset]
|
|
1287
|
+
);
|
|
1288
|
+
const layerZIndex = useMemo(
|
|
1289
|
+
() => zIndices.length === 0 && !reset ? void 0 : computeLayerZIndex(zIndices),
|
|
1290
|
+
[reset, zIndices]
|
|
1291
|
+
);
|
|
1292
|
+
return zIndices.length === 0 && !reset ? /* @__PURE__ */ jsx(Slot, { style, ...otherProps }) : /* @__PURE__ */ jsx(LayerContext.Provider, { value: zIndices, children: /* @__PURE__ */ jsx(
|
|
1293
|
+
Slot,
|
|
1294
|
+
{
|
|
1295
|
+
style: {
|
|
1296
|
+
...cssVarStyle("layer-z-index", layerZIndex),
|
|
1297
|
+
zIndex: cssVar("layer-z-index"),
|
|
1298
|
+
...style
|
|
1299
|
+
},
|
|
1300
|
+
...otherProps
|
|
1301
|
+
}
|
|
1302
|
+
) });
|
|
1303
|
+
}
|
|
1097
1304
|
const Overlay = forwardRef(
|
|
1098
1305
|
function Overlay2({ className, ...otherProps }, forwardedRef) {
|
|
1099
1306
|
const prefix = usePrefix();
|
|
@@ -1151,11 +1358,14 @@ const DialogContent = forwardRef(function DialogContent2({
|
|
|
1151
1358
|
container: portalContext?.container,
|
|
1152
1359
|
...portalProps,
|
|
1153
1360
|
forceMount,
|
|
1154
|
-
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Dialog$1.Overlay, { forceMount, asChild: true, children: /* @__PURE__ */ jsx(
|
|
1361
|
+
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "dialog", reset: true, children: /* @__PURE__ */ jsx(Dialog$1.Overlay, { forceMount, asChild: true, children: /* @__PURE__ */ jsx(
|
|
1155
1362
|
Overlay,
|
|
1156
1363
|
{
|
|
1157
1364
|
...overlayProps,
|
|
1158
|
-
className: cx(
|
|
1365
|
+
className: cx(
|
|
1366
|
+
prefix("dialog__overlay"),
|
|
1367
|
+
overlayProps?.className
|
|
1368
|
+
),
|
|
1159
1369
|
children: /* @__PURE__ */ jsx(
|
|
1160
1370
|
Dialog$1.Content,
|
|
1161
1371
|
{
|
|
@@ -1185,7 +1395,7 @@ const DialogContent = forwardRef(function DialogContent2({
|
|
|
1185
1395
|
}
|
|
1186
1396
|
)
|
|
1187
1397
|
}
|
|
1188
|
-
) }) })
|
|
1398
|
+
) }) }) })
|
|
1189
1399
|
}
|
|
1190
1400
|
) });
|
|
1191
1401
|
});
|
|
@@ -1704,7 +1914,7 @@ const Tooltip = forwardRef(function Tooltip2({
|
|
|
1704
1914
|
container: portalContext?.container,
|
|
1705
1915
|
...portalProps,
|
|
1706
1916
|
forceMount,
|
|
1707
|
-
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1917
|
+
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "tooltip", children: /* @__PURE__ */ jsxs(
|
|
1708
1918
|
Tooltip$1.Content,
|
|
1709
1919
|
{
|
|
1710
1920
|
sideOffset,
|
|
@@ -1728,7 +1938,7 @@ const Tooltip = forwardRef(function Tooltip2({
|
|
|
1728
1938
|
)
|
|
1729
1939
|
]
|
|
1730
1940
|
}
|
|
1731
|
-
) })
|
|
1941
|
+
) }) })
|
|
1732
1942
|
}
|
|
1733
1943
|
) })
|
|
1734
1944
|
]
|
|
@@ -1961,11 +2171,14 @@ const AlertDialogContent = forwardRef(function AlertDialogContent2({
|
|
|
1961
2171
|
container: portalContext?.container,
|
|
1962
2172
|
...portalProps,
|
|
1963
2173
|
forceMount,
|
|
1964
|
-
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(AlertDialog$1.Overlay, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2174
|
+
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "dialog", reset: true, children: /* @__PURE__ */ jsx(AlertDialog$1.Overlay, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1965
2175
|
Overlay,
|
|
1966
2176
|
{
|
|
1967
2177
|
...overlayProps,
|
|
1968
|
-
className: cx(
|
|
2178
|
+
className: cx(
|
|
2179
|
+
prefix("dialog__overlay"),
|
|
2180
|
+
overlayProps?.className
|
|
2181
|
+
),
|
|
1969
2182
|
children: /* @__PURE__ */ jsx(
|
|
1970
2183
|
AlertDialog$1.Content,
|
|
1971
2184
|
{
|
|
@@ -1990,7 +2203,7 @@ const AlertDialogContent = forwardRef(function AlertDialogContent2({
|
|
|
1990
2203
|
}
|
|
1991
2204
|
)
|
|
1992
2205
|
}
|
|
1993
|
-
) }) })
|
|
2206
|
+
) }) }) })
|
|
1994
2207
|
}
|
|
1995
2208
|
) });
|
|
1996
2209
|
});
|
|
@@ -2163,7 +2376,7 @@ function AlertDialogProvider({ children }) {
|
|
|
2163
2376
|
const [content, setContent] = useState(null);
|
|
2164
2377
|
const resolveRef = useRef(null);
|
|
2165
2378
|
const prompt = useCallback(
|
|
2166
|
-
// eslint-disable-next-line
|
|
2379
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
2167
2380
|
(renderContent) => new Promise((res) => {
|
|
2168
2381
|
const resolve = resolveRef.current = (value) => {
|
|
2169
2382
|
res(value);
|
|
@@ -2676,19 +2889,20 @@ const ToastTitle = forwardRef(function ToastTitle2({ className, ...otherProps },
|
|
|
2676
2889
|
}
|
|
2677
2890
|
);
|
|
2678
2891
|
});
|
|
2679
|
-
const ToastViewport = forwardRef(function ToastViewport2({ label, className, ...otherProps }, forwardedRef) {
|
|
2892
|
+
const ToastViewport = forwardRef(function ToastViewport2({ position = "right", label, className, ...otherProps }, forwardedRef) {
|
|
2680
2893
|
const prefix = usePrefix();
|
|
2681
2894
|
const [locale7] = useLocale();
|
|
2682
2895
|
label ??= locale7.ToastViewport.label;
|
|
2683
|
-
return /* @__PURE__ */ jsx(
|
|
2896
|
+
return /* @__PURE__ */ jsx(Layer, { zIndex: "toast", reset: true, children: /* @__PURE__ */ jsx(
|
|
2684
2897
|
Toast$1.Viewport,
|
|
2685
2898
|
{
|
|
2686
2899
|
label,
|
|
2687
2900
|
className: cx(prefix("toast__viewport"), className),
|
|
2901
|
+
"data-position": position,
|
|
2688
2902
|
...otherProps,
|
|
2689
2903
|
ref: forwardedRef
|
|
2690
2904
|
}
|
|
2691
|
-
);
|
|
2905
|
+
) });
|
|
2692
2906
|
});
|
|
2693
2907
|
function ToastManagerProvider({ children }) {
|
|
2694
2908
|
const toastId = useRef(0);
|
|
@@ -3151,8 +3365,9 @@ const Root = forwardRef(function Root2({
|
|
|
3151
3365
|
disableTooltipsHoverableContent,
|
|
3152
3366
|
toastsLabel,
|
|
3153
3367
|
toastsDuration,
|
|
3154
|
-
toastsSwipeDirection,
|
|
3155
3368
|
toastsSwipeThreshold,
|
|
3369
|
+
toastViewportPosition,
|
|
3370
|
+
toastsSwipeDirection = toastViewportPosition === "left" ? "left" : void 0,
|
|
3156
3371
|
toastViewportHotkey,
|
|
3157
3372
|
toastViewportLabel,
|
|
3158
3373
|
toastViewportProps,
|
|
@@ -3179,6 +3394,7 @@ const Root = forwardRef(function Root2({
|
|
|
3179
3394
|
toastsDuration,
|
|
3180
3395
|
toastsSwipeDirection,
|
|
3181
3396
|
toastsSwipeThreshold,
|
|
3397
|
+
toastViewportPosition,
|
|
3182
3398
|
toastViewportHotkey,
|
|
3183
3399
|
toastViewportLabel,
|
|
3184
3400
|
toastViewportProps,
|
|
@@ -3245,6 +3461,7 @@ const Root = forwardRef(function Root2({
|
|
|
3245
3461
|
/* @__PURE__ */ jsx(Portal, { container: portalsContainer, asChild: true, children: /* @__PURE__ */ jsx(
|
|
3246
3462
|
ToastViewport,
|
|
3247
3463
|
{
|
|
3464
|
+
position: toastViewportPosition,
|
|
3248
3465
|
hotkey: toastViewportHotkey,
|
|
3249
3466
|
label: toastViewportLabel,
|
|
3250
3467
|
...toastViewportProps
|
|
@@ -3381,34 +3598,6 @@ function setNativeProperty(element, prop, value) {
|
|
|
3381
3598
|
function camelToKebabCase(str) {
|
|
3382
3599
|
return str.replace(/[A-Z]/g, (l) => `-${l.toLowerCase()}`);
|
|
3383
3600
|
}
|
|
3384
|
-
function useCssVars(options) {
|
|
3385
|
-
const contextPrefix = usePrefix();
|
|
3386
|
-
const prefix = options?.prefix ?? contextPrefix;
|
|
3387
|
-
const cssVarName = useCallback(
|
|
3388
|
-
(name) => `--${prefix(name)}`,
|
|
3389
|
-
[prefix]
|
|
3390
|
-
);
|
|
3391
|
-
const cssVar = useCallback(
|
|
3392
|
-
(name, fallback) => `var(${cssVarName(name)}${// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
3393
|
-
fallback != null ? `, ${String(fallback)}` : ""})`,
|
|
3394
|
-
[cssVarName]
|
|
3395
|
-
);
|
|
3396
|
-
const cssVarStyle = useCallback(
|
|
3397
|
-
(name, value) => value != null ? (
|
|
3398
|
-
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
3399
|
-
{ [cssVarName(name)]: String(value) }
|
|
3400
|
-
) : void 0,
|
|
3401
|
-
[cssVarName]
|
|
3402
|
-
);
|
|
3403
|
-
const cssToggler = useCallback(
|
|
3404
|
-
(value) => cssVar(`toggler-${value}`, null),
|
|
3405
|
-
[cssVar]
|
|
3406
|
-
);
|
|
3407
|
-
return useMemo(
|
|
3408
|
-
() => ({ cssVarName, cssVar, cssVarStyle, cssToggler }),
|
|
3409
|
-
[cssToggler, cssVar, cssVarName, cssVarStyle]
|
|
3410
|
-
);
|
|
3411
|
-
}
|
|
3412
3601
|
function useResponsiveValues(options) {
|
|
3413
3602
|
const { cssVarName } = useCssVars(options);
|
|
3414
3603
|
const responsiveValueToCssVarsAndDataAttrs = useCallback(
|
|
@@ -3536,7 +3725,9 @@ function Printer({
|
|
|
3536
3725
|
const triggerRef = useRef(null);
|
|
3537
3726
|
const contentRef = useRef(null);
|
|
3538
3727
|
const [printInProgress, setPrintInProgress] = useState(false);
|
|
3539
|
-
const [printOptions, setPrintOptions] = useState(
|
|
3728
|
+
const [printOptions, setPrintOptions] = useState(
|
|
3729
|
+
void 0
|
|
3730
|
+
);
|
|
3540
3731
|
const resolvePrintRef = useRef(null);
|
|
3541
3732
|
const rejectPrintRef = useRef(null);
|
|
3542
3733
|
const pendingPromiseRef = useRef(null);
|
|
@@ -3556,9 +3747,13 @@ function Printer({
|
|
|
3556
3747
|
setTimeout(() => triggerRef.current?.focus(), 100);
|
|
3557
3748
|
}
|
|
3558
3749
|
};
|
|
3750
|
+
const relevantDocumentTitle = printOptions?.documentTitle ?? documentTitle;
|
|
3559
3751
|
const reactToPrintFn = useReactToPrint({
|
|
3560
3752
|
bodyClass: preview || printInForeground ? prefix("root") : void 0,
|
|
3561
|
-
documentTitle:
|
|
3753
|
+
documentTitle: (
|
|
3754
|
+
// Allow the function to return `undefined`
|
|
3755
|
+
typeof relevantDocumentTitle === "function" ? () => relevantDocumentTitle() ?? document.title : relevantDocumentTitle ?? document.title
|
|
3756
|
+
),
|
|
3562
3757
|
pageStyle: printPageStyle({
|
|
3563
3758
|
pageSize: printOptions?.pageSize ?? pageSize,
|
|
3564
3759
|
pageMargin: printOptions?.pageMargin ?? pageMargin,
|
|
@@ -3587,7 +3782,6 @@ function Printer({
|
|
|
3587
3782
|
const latest = useLatestValues({
|
|
3588
3783
|
printInProgress,
|
|
3589
3784
|
reactToPrintFn,
|
|
3590
|
-
documentTitle,
|
|
3591
3785
|
onBeforePrint
|
|
3592
3786
|
});
|
|
3593
3787
|
const handlePrint = useCallback(
|
|
@@ -3597,11 +3791,7 @@ function Printer({
|
|
|
3597
3791
|
}
|
|
3598
3792
|
flushSync(() => {
|
|
3599
3793
|
setPrintInProgress(true);
|
|
3600
|
-
|
|
3601
|
-
setPrintOptions({
|
|
3602
|
-
...options,
|
|
3603
|
-
documentTitle: typeof documentTitleToUse === "function" ? documentTitleToUse() : documentTitleToUse
|
|
3604
|
-
});
|
|
3794
|
+
setPrintOptions(options);
|
|
3605
3795
|
});
|
|
3606
3796
|
await pendingPromiseRef.current;
|
|
3607
3797
|
if (latest.onBeforePrint) {
|
|
@@ -3768,7 +3958,7 @@ const Field = forwardRef(function Field2({ asChild, className, ...otherProps },
|
|
|
3768
3958
|
const fieldRef = useRef(null);
|
|
3769
3959
|
useEffect(
|
|
3770
3960
|
() => store.subscribe(
|
|
3771
|
-
(
|
|
3961
|
+
({ controlHasCode }) => controlHasCode,
|
|
3772
3962
|
(hasCode) => setBoolDataAttr(fieldRef.current, "hasCode", hasCode),
|
|
3773
3963
|
{ fireImmediately: true }
|
|
3774
3964
|
),
|
|
@@ -3832,30 +4022,42 @@ const Table = forwardRef(
|
|
|
3832
4022
|
const [scrollableEl, setScrollableEl] = useState(
|
|
3833
4023
|
null
|
|
3834
4024
|
);
|
|
3835
|
-
const
|
|
3836
|
-
if (tableRef.current) {
|
|
3837
|
-
tableRef.current.style.minWidth = minWidth ?? "";
|
|
3838
|
-
}
|
|
3839
|
-
}, []);
|
|
3840
|
-
const handleMaxWidthChange = useCallback(
|
|
3841
|
-
(maxWidth) => {
|
|
3842
|
-
if (tableRef.current) {
|
|
3843
|
-
tableRef.current.style.maxWidth = maxWidth ?? "";
|
|
3844
|
-
}
|
|
3845
|
-
if (scrollableEl) {
|
|
3846
|
-
scrollableEl.style.maxWidth = maxWidth ? `min(100%, ${maxWidth})` : "";
|
|
3847
|
-
}
|
|
3848
|
-
},
|
|
3849
|
-
[scrollableEl]
|
|
3850
|
-
);
|
|
3851
|
-
const tableContextValue = useCreateTableContext(
|
|
4025
|
+
const tableContextValue = useCreateTableContext({
|
|
3852
4026
|
editable,
|
|
3853
4027
|
status,
|
|
3854
4028
|
layout,
|
|
3855
|
-
defaultColumnWidth
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
)
|
|
4029
|
+
defaultColumnWidth
|
|
4030
|
+
});
|
|
4031
|
+
const { store } = tableContextValue;
|
|
4032
|
+
useEffect(() => {
|
|
4033
|
+
if (layout === "fixed") {
|
|
4034
|
+
return store.subscribe(
|
|
4035
|
+
({ leafColumns: leafColumns2 }) => leafColumns2 && tableMinWidth(leafColumns2, defaultColumnWidth),
|
|
4036
|
+
(minWidth) => {
|
|
4037
|
+
if (tableRef.current) {
|
|
4038
|
+
tableRef.current.style.minWidth = minWidth ?? "";
|
|
4039
|
+
}
|
|
4040
|
+
},
|
|
4041
|
+
{ fireImmediately: true }
|
|
4042
|
+
);
|
|
4043
|
+
}
|
|
4044
|
+
}, [defaultColumnWidth, layout, store]);
|
|
4045
|
+
useEffect(() => {
|
|
4046
|
+
if (layout === "fixed") {
|
|
4047
|
+
return store.subscribe(
|
|
4048
|
+
({ leafColumns: leafColumns2 }) => leafColumns2 && tableMaxWidth(leafColumns2, defaultColumnWidth),
|
|
4049
|
+
(maxWidth) => {
|
|
4050
|
+
if (tableRef.current) {
|
|
4051
|
+
tableRef.current.style.maxWidth = maxWidth ?? "";
|
|
4052
|
+
}
|
|
4053
|
+
if (scrollableEl) {
|
|
4054
|
+
scrollableEl.style.maxWidth = maxWidth ? `min(100%, ${maxWidth})` : "";
|
|
4055
|
+
}
|
|
4056
|
+
},
|
|
4057
|
+
{ fireImmediately: true }
|
|
4058
|
+
);
|
|
4059
|
+
}
|
|
4060
|
+
}, [defaultColumnWidth, layout, scrollableEl, store]);
|
|
3859
4061
|
useScrollPosition(
|
|
3860
4062
|
scrollableEl,
|
|
3861
4063
|
useCallback(
|
|
@@ -3940,7 +4142,7 @@ const Table = forwardRef(
|
|
|
3940
4142
|
children: visuallyHiddenCaption
|
|
3941
4143
|
}
|
|
3942
4144
|
) }),
|
|
3943
|
-
/* @__PURE__ */ jsx(ColumnWidths, {}),
|
|
4145
|
+
/* @__PURE__ */ jsx(ColumnWidths, { defaultColumnWidth }),
|
|
3944
4146
|
children
|
|
3945
4147
|
]
|
|
3946
4148
|
}
|
|
@@ -3953,10 +4155,15 @@ const Table = forwardRef(
|
|
|
3953
4155
|
) }) });
|
|
3954
4156
|
}
|
|
3955
4157
|
);
|
|
3956
|
-
function ColumnWidths() {
|
|
4158
|
+
function ColumnWidths({ defaultColumnWidth }) {
|
|
3957
4159
|
const { store } = useTableContext();
|
|
3958
|
-
const
|
|
3959
|
-
|
|
4160
|
+
const widths = useStore$1(
|
|
4161
|
+
store,
|
|
4162
|
+
useShallow(
|
|
4163
|
+
(state) => state.leafColumns && columnWidths(state.leafColumns, defaultColumnWidth)
|
|
4164
|
+
)
|
|
4165
|
+
);
|
|
4166
|
+
return widths && /* @__PURE__ */ jsx("colgroup", { children: widths.map((width, i) => /* @__PURE__ */ jsx("col", { style: width != null ? { width } : void 0 }, i)) });
|
|
3960
4167
|
}
|
|
3961
4168
|
const TableBody = forwardRef(
|
|
3962
4169
|
function TableBody2({ className, ...otherProps }, forwardedRef) {
|
|
@@ -3972,42 +4179,89 @@ const TableBody = forwardRef(
|
|
|
3972
4179
|
}
|
|
3973
4180
|
);
|
|
3974
4181
|
const TableCell = forwardRef(
|
|
3975
|
-
function TableCell2({
|
|
3976
|
-
header,
|
|
3977
|
-
align,
|
|
3978
|
-
variant,
|
|
3979
|
-
status,
|
|
3980
|
-
framed,
|
|
3981
|
-
paddingless,
|
|
3982
|
-
sticky,
|
|
3983
|
-
className,
|
|
3984
|
-
style,
|
|
3985
|
-
...otherProps
|
|
3986
|
-
}, forwardedRef) {
|
|
4182
|
+
function TableCell2({ columnIndex, _stickyColumnIndex, ...otherProps }, forwardedRef) {
|
|
3987
4183
|
const prefix = usePrefix();
|
|
3988
|
-
const { cssVarStyle } = useCssVars();
|
|
4184
|
+
const { cssVarName, cssVarStyle } = useCssVars();
|
|
3989
4185
|
const {
|
|
3990
4186
|
status: tableStatus,
|
|
3991
4187
|
editable: isTableEditable,
|
|
3992
4188
|
store
|
|
3993
4189
|
} = useTableContext();
|
|
3994
4190
|
const isInTableHead = useIsInTableHead();
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4191
|
+
const column = useStore$1(
|
|
4192
|
+
store,
|
|
4193
|
+
useShallow(
|
|
4194
|
+
(state) => columnIndex != null && state.leafColumns?.[columnIndex] || {}
|
|
4195
|
+
)
|
|
4196
|
+
);
|
|
4197
|
+
const {
|
|
4198
|
+
header = isInTableHead,
|
|
4199
|
+
align,
|
|
4200
|
+
variant = header ? "header" : "data",
|
|
4201
|
+
// Setting the status to `null` overrides the automatic inheritance of the
|
|
4202
|
+
// table status for header cells
|
|
4203
|
+
status = header ? tableStatus : void 0,
|
|
4204
|
+
framed = isTableEditable,
|
|
4205
|
+
paddingless = !header && isTableEditable,
|
|
4206
|
+
sticky,
|
|
4207
|
+
className,
|
|
4208
|
+
style,
|
|
4209
|
+
// `TableColumnObject` properties irrelevant to a `TableCell`
|
|
4210
|
+
subColumns: _subColumns,
|
|
4211
|
+
label: _label,
|
|
4212
|
+
labelText: _labelText,
|
|
4213
|
+
helperText: _helperText,
|
|
4214
|
+
helperButtonLabel: _helperButtonLabel,
|
|
4215
|
+
width: _width,
|
|
4216
|
+
fixed: _fixed,
|
|
4217
|
+
sortable: _sortable,
|
|
4218
|
+
defaultSortDirection: _defaultSortDirection,
|
|
4219
|
+
sorted: _sorted,
|
|
4220
|
+
onSort: _onSort,
|
|
4221
|
+
containerProps: _containerProps,
|
|
4222
|
+
labelProps: _labelProps,
|
|
4223
|
+
sortButtonProps: _sortButtonProps,
|
|
4224
|
+
sortIconContainerProps: _sortIconContainerProps,
|
|
4225
|
+
sortAscIconProps: _sortAscIconProps,
|
|
4226
|
+
sortDescIconProps: _sortDescIconProps,
|
|
4227
|
+
helperButtonProps: _helperButtonProps,
|
|
4228
|
+
helperPopoverProps: _helperPopoverProps,
|
|
4229
|
+
helperPopoverContentProps: _helperPopoverContentProps,
|
|
4230
|
+
...otherMergedProps
|
|
4231
|
+
} = { ...column, ...otherProps };
|
|
4232
|
+
const { colSpan = 1 } = otherProps;
|
|
4233
|
+
if (columnIndex != null && _stickyColumnIndex == null && sticky) {
|
|
4234
|
+
_stickyColumnIndex = columnIndex + (sticky === "left" ? 0 : colSpan - 1);
|
|
3999
4235
|
}
|
|
4000
|
-
framed ??= isTableEditable;
|
|
4001
|
-
paddingless ??= !header && isTableEditable;
|
|
4002
4236
|
const cellRef = useRef(null);
|
|
4003
|
-
useEffect(
|
|
4004
|
-
()
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4237
|
+
useEffect(() => {
|
|
4238
|
+
if (sticky) {
|
|
4239
|
+
return store.subscribe(
|
|
4240
|
+
({ scrollPosition, stickyColumnOffsets: stickyColumnOffsets2 }) => {
|
|
4241
|
+
const isBorderSticky = _stickyColumnIndex != null && stickyColumnOffsets2()?.[_stickyColumnIndex + (sticky === "left" ? colSpan : -colSpan)] === void 0;
|
|
4242
|
+
return isBorderSticky && scrollPosition != null && (sticky === "left" ? scrollPosition.left > 0 : scrollPosition.right > 0);
|
|
4243
|
+
},
|
|
4244
|
+
(isStuck) => setBoolDataAttr(cellRef.current, "stuck", isStuck),
|
|
4245
|
+
{ fireImmediately: true }
|
|
4246
|
+
);
|
|
4247
|
+
}
|
|
4248
|
+
}, [_stickyColumnIndex, colSpan, sticky, store]);
|
|
4249
|
+
useEffect(() => {
|
|
4250
|
+
if (_stickyColumnIndex != null && sticky) {
|
|
4251
|
+
return store.subscribe(
|
|
4252
|
+
({ stickyColumnOffsets: stickyColumnOffsets2 }) => stickyColumnOffsets2()?.[_stickyColumnIndex],
|
|
4253
|
+
(offset) => {
|
|
4254
|
+
if (offset && cellRef.current) {
|
|
4255
|
+
cellRef.current.style.setProperty(
|
|
4256
|
+
cssVarName("table-cell-sticky-offset"),
|
|
4257
|
+
`${offset}px`
|
|
4258
|
+
);
|
|
4259
|
+
}
|
|
4260
|
+
},
|
|
4261
|
+
{ fireImmediately: true }
|
|
4262
|
+
);
|
|
4263
|
+
}
|
|
4264
|
+
}, [_stickyColumnIndex, cssVarName, sticky, store]);
|
|
4011
4265
|
const As = header ? "th" : "td";
|
|
4012
4266
|
const combinedCellRef = useCombinedRef(cellRef, forwardedRef);
|
|
4013
4267
|
return /* @__PURE__ */ jsx(TableCellContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
|
|
@@ -4023,15 +4277,12 @@ const TableCell = forwardRef(
|
|
|
4023
4277
|
"data-paddingless": boolDataAttr(paddingless),
|
|
4024
4278
|
"data-variant": variant,
|
|
4025
4279
|
"data-sticky": sticky,
|
|
4026
|
-
...
|
|
4280
|
+
...otherMergedProps,
|
|
4027
4281
|
ref: combinedCellRef
|
|
4028
4282
|
}
|
|
4029
4283
|
) });
|
|
4030
4284
|
}
|
|
4031
4285
|
);
|
|
4032
|
-
const TableColumn = forwardRef(function TableColumn2() {
|
|
4033
|
-
return null;
|
|
4034
|
-
});
|
|
4035
4286
|
const TableFoot = forwardRef(
|
|
4036
4287
|
function TableFoot2({ sticky = true, className, ...otherProps }, forwardedRef) {
|
|
4037
4288
|
const prefix = usePrefix();
|
|
@@ -4087,7 +4338,7 @@ const PopoverContent = forwardRef(function PopoverContent2({
|
|
|
4087
4338
|
container: portalContext?.container,
|
|
4088
4339
|
...portalProps,
|
|
4089
4340
|
forceMount,
|
|
4090
|
-
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
4341
|
+
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "popover", children: /* @__PURE__ */ jsxs(
|
|
4091
4342
|
Popover$1.Content,
|
|
4092
4343
|
{
|
|
4093
4344
|
className: cx(prefix("popover"), className),
|
|
@@ -4104,12 +4355,15 @@ const PopoverContent = forwardRef(function PopoverContent2({
|
|
|
4104
4355
|
width: 12,
|
|
4105
4356
|
height: 6,
|
|
4106
4357
|
...arrowProps,
|
|
4107
|
-
className: cx(
|
|
4358
|
+
className: cx(
|
|
4359
|
+
prefix("popover__arrow"),
|
|
4360
|
+
arrowProps?.className
|
|
4361
|
+
)
|
|
4108
4362
|
}
|
|
4109
4363
|
)
|
|
4110
4364
|
]
|
|
4111
4365
|
}
|
|
4112
|
-
) })
|
|
4366
|
+
) }) })
|
|
4113
4367
|
}
|
|
4114
4368
|
) });
|
|
4115
4369
|
});
|
|
@@ -4187,8 +4441,28 @@ const Stack = forwardRef(function Stack2({
|
|
|
4187
4441
|
});
|
|
4188
4442
|
const DEFAULT_TABLE_ROW_HEIGHT = 41;
|
|
4189
4443
|
const TableRow = forwardRef(
|
|
4190
|
-
function TableRow2({ className, selected, ...otherProps }, forwardedRef) {
|
|
4444
|
+
function TableRow2({ className, selected, children, ...otherProps }, forwardedRef) {
|
|
4191
4445
|
const prefix = usePrefix();
|
|
4446
|
+
let nextIdx = 0;
|
|
4447
|
+
const indexedChildren = Children.toArray(children).map((child) => {
|
|
4448
|
+
if (!isValidElement(child) || child.type !== TableCell) {
|
|
4449
|
+
return child;
|
|
4450
|
+
}
|
|
4451
|
+
const tableCellProps = child.props;
|
|
4452
|
+
const { columnIndex, colSpan } = tableCellProps;
|
|
4453
|
+
if (columnIndex !== void 0) {
|
|
4454
|
+
if (columnIndex !== null) {
|
|
4455
|
+
nextIdx = columnIndex + (colSpan ?? 1);
|
|
4456
|
+
}
|
|
4457
|
+
return child;
|
|
4458
|
+
}
|
|
4459
|
+
const cellIdx = nextIdx;
|
|
4460
|
+
nextIdx += colSpan ?? 1;
|
|
4461
|
+
return cloneElement(
|
|
4462
|
+
child,
|
|
4463
|
+
{ ...tableCellProps, columnIndex: cellIdx }
|
|
4464
|
+
);
|
|
4465
|
+
});
|
|
4192
4466
|
return /* @__PURE__ */ jsx(
|
|
4193
4467
|
"tr",
|
|
4194
4468
|
{
|
|
@@ -4196,7 +4470,8 @@ const TableRow = forwardRef(
|
|
|
4196
4470
|
"data-selected": boolDataAttr(selected),
|
|
4197
4471
|
"aria-selected": selected || void 0,
|
|
4198
4472
|
...otherProps,
|
|
4199
|
-
ref: forwardedRef
|
|
4473
|
+
ref: forwardedRef,
|
|
4474
|
+
children: indexedChildren
|
|
4200
4475
|
}
|
|
4201
4476
|
);
|
|
4202
4477
|
}
|
|
@@ -4213,14 +4488,7 @@ const TableHead = forwardRef(
|
|
|
4213
4488
|
const prefix = usePrefix();
|
|
4214
4489
|
const [locale7] = useLocale();
|
|
4215
4490
|
sortByColumnDescription ??= locale7.TableHead.sortByColumnDescription;
|
|
4216
|
-
const {
|
|
4217
|
-
status: tableStatus,
|
|
4218
|
-
layout,
|
|
4219
|
-
defaultColumnWidth,
|
|
4220
|
-
onTableMinWidthChange,
|
|
4221
|
-
onTableMaxWidthChange,
|
|
4222
|
-
store
|
|
4223
|
-
} = useTableContext();
|
|
4491
|
+
const { status: tableStatus, layout, store } = useTableContext();
|
|
4224
4492
|
const columns = useMemo(() => columnsFromChildren(children), [children]);
|
|
4225
4493
|
const nRows = useMemo(() => numberOfRows$1(columns), [columns]);
|
|
4226
4494
|
const rows = useMemo(
|
|
@@ -4229,6 +4497,12 @@ const TableHead = forwardRef(
|
|
|
4229
4497
|
);
|
|
4230
4498
|
const { printHidden } = usePrintClassNames();
|
|
4231
4499
|
const generatedId = useId();
|
|
4500
|
+
const { leaves, leafIndices } = useMemo(() => {
|
|
4501
|
+
const leaves2 = leafColumns$1(columns);
|
|
4502
|
+
const leafIndices2 = new Map(leaves2.map((l, i) => [l, i]));
|
|
4503
|
+
return { leaves: leaves2, leafIndices: leafIndices2 };
|
|
4504
|
+
}, [columns]);
|
|
4505
|
+
useEffect(() => store.setState({ leafColumns: leaves }), [leaves, store]);
|
|
4232
4506
|
const tableHeadRef = useRef(null);
|
|
4233
4507
|
useEffect(
|
|
4234
4508
|
() => store.subscribe(
|
|
@@ -4238,25 +4512,6 @@ const TableHead = forwardRef(
|
|
|
4238
4512
|
),
|
|
4239
4513
|
[sticky, store]
|
|
4240
4514
|
);
|
|
4241
|
-
useEffect(() => {
|
|
4242
|
-
const leaves = leafColumns$1(columns);
|
|
4243
|
-
store.setState({ numberOfColumns: leaves.length });
|
|
4244
|
-
if (layout === "fixed") {
|
|
4245
|
-
store.setState({
|
|
4246
|
-
columnWidths: columnWidths(leaves, defaultColumnWidth)
|
|
4247
|
-
});
|
|
4248
|
-
onTableMinWidthChange(tableMinWidth(leaves, defaultColumnWidth));
|
|
4249
|
-
onTableMaxWidthChange(tableMaxWidth(leaves, defaultColumnWidth));
|
|
4250
|
-
return () => store.setState({ columnWidths: void 0 });
|
|
4251
|
-
}
|
|
4252
|
-
}, [
|
|
4253
|
-
columns,
|
|
4254
|
-
defaultColumnWidth,
|
|
4255
|
-
layout,
|
|
4256
|
-
onTableMaxWidthChange,
|
|
4257
|
-
onTableMinWidthChange,
|
|
4258
|
-
store
|
|
4259
|
-
]);
|
|
4260
4515
|
const leftMost = useMemo(() => leftMostColumns(columns), [columns]);
|
|
4261
4516
|
const rightMost = useMemo(() => rightMostColumns(columns), [columns]);
|
|
4262
4517
|
const combinedTableHeadRef = useCombinedRef(tableHeadRef, forwardedRef);
|
|
@@ -4274,14 +4529,16 @@ const TableHead = forwardRef(
|
|
|
4274
4529
|
...typeof rowProps === "function" ? rowProps(i) : rowProps,
|
|
4275
4530
|
children: row.map((column, j) => {
|
|
4276
4531
|
const {
|
|
4532
|
+
subColumns,
|
|
4277
4533
|
label,
|
|
4278
4534
|
labelText = typeof label === "string" ? label : "",
|
|
4279
4535
|
helperText,
|
|
4280
4536
|
helperButtonLabel = locale7.TableColumn.helperButtonLabel,
|
|
4281
4537
|
width,
|
|
4282
4538
|
fixed: _fixed,
|
|
4283
|
-
header
|
|
4539
|
+
header: _header,
|
|
4284
4540
|
align,
|
|
4541
|
+
sticky: sticky2,
|
|
4285
4542
|
sortable,
|
|
4286
4543
|
defaultSortDirection = "asc",
|
|
4287
4544
|
sorted,
|
|
@@ -4298,8 +4555,17 @@ const TableHead = forwardRef(
|
|
|
4298
4555
|
style,
|
|
4299
4556
|
...otherColumnProps
|
|
4300
4557
|
} = column;
|
|
4558
|
+
const rowSpan = numberOfRows$1([column]) > 1 ? 1 : nRows - i;
|
|
4559
|
+
const colSpan = numberOfColumns([column]);
|
|
4560
|
+
const isLeaf = subColumns.length === 0;
|
|
4561
|
+
const leafIndex = isLeaf ? leafIndices.get(column) : -1;
|
|
4562
|
+
const stickyColumnIndex = sticky2 ? isLeaf ? leafIndex : leafIndices.get(
|
|
4563
|
+
sticky2 === "left" ? leftMostLeafColumn(column) : rightMostLeafColumn(column)
|
|
4564
|
+
) : -1;
|
|
4301
4565
|
const newSortDirection = !sorted ? defaultSortDirection : sorted === defaultSortDirection ? sorted === "asc" ? "desc" : "asc" : null;
|
|
4302
|
-
const sortDescriptionId = sortable ? prefix(
|
|
4566
|
+
const sortDescriptionId = isLeaf && sortable ? prefix(
|
|
4567
|
+
`table-column-${leafIndex}-sort-description-${generatedId}`
|
|
4568
|
+
) : void 0;
|
|
4303
4569
|
const helperTextEl = helperText && /* @__PURE__ */ jsxs(Popover, { modal: false, ...helperPopoverProps, children: [
|
|
4304
4570
|
/* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(
|
|
4305
4571
|
IconButton,
|
|
@@ -4330,14 +4596,15 @@ const TableHead = forwardRef(
|
|
|
4330
4596
|
}
|
|
4331
4597
|
)
|
|
4332
4598
|
] });
|
|
4333
|
-
const rowSpan = numberOfRows$1([column]) > 1 ? 1 : nRows - i;
|
|
4334
|
-
const colSpan = numberOfColumns([column]);
|
|
4335
4599
|
return /* @__PURE__ */ jsx(
|
|
4336
4600
|
TableCell,
|
|
4337
4601
|
{
|
|
4338
|
-
|
|
4339
|
-
|
|
4602
|
+
columnIndex: null,
|
|
4603
|
+
_stickyColumnIndex: stickyColumnIndex === -1 ? null : stickyColumnIndex,
|
|
4604
|
+
header: true,
|
|
4605
|
+
scope: isLeaf ? "col" : "colgroup",
|
|
4340
4606
|
align,
|
|
4607
|
+
sticky: sticky2,
|
|
4341
4608
|
rowSpan: rowSpan === 1 ? void 0 : rowSpan,
|
|
4342
4609
|
colSpan: colSpan === 1 ? void 0 : colSpan,
|
|
4343
4610
|
style: {
|
|
@@ -4361,7 +4628,7 @@ const TableHead = forwardRef(
|
|
|
4361
4628
|
gap: 1.5,
|
|
4362
4629
|
...containerProps,
|
|
4363
4630
|
children: [
|
|
4364
|
-
!sortable && label && /* @__PURE__ */ jsx(
|
|
4631
|
+
(!isLeaf || !sortable) && label && /* @__PURE__ */ jsx(
|
|
4365
4632
|
"div",
|
|
4366
4633
|
{
|
|
4367
4634
|
"data-align": align,
|
|
@@ -4373,7 +4640,7 @@ const TableHead = forwardRef(
|
|
|
4373
4640
|
children: label
|
|
4374
4641
|
}
|
|
4375
4642
|
),
|
|
4376
|
-
sortable && /* @__PURE__ */ jsxs(
|
|
4643
|
+
isLeaf && sortable && /* @__PURE__ */ jsxs(
|
|
4377
4644
|
Button,
|
|
4378
4645
|
{
|
|
4379
4646
|
variant: "ghost",
|
|
@@ -4467,87 +4734,36 @@ const TableHead = forwardRef(
|
|
|
4467
4734
|
) });
|
|
4468
4735
|
}
|
|
4469
4736
|
);
|
|
4470
|
-
function
|
|
4471
|
-
return
|
|
4472
|
-
(
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
}
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
0
|
|
4482
|
-
);
|
|
4483
|
-
}
|
|
4484
|
-
function numberOfColumns(columns) {
|
|
4485
|
-
return columns.reduce(
|
|
4486
|
-
(n, column) => n + (column.children.length === 0 ? 1 : numberOfColumns(column.children)),
|
|
4487
|
-
0
|
|
4737
|
+
function leafColumns(columns) {
|
|
4738
|
+
return Object.entries(columns).reduce(
|
|
4739
|
+
(leaves, [columnName, column]) => {
|
|
4740
|
+
if (column.subColumns) {
|
|
4741
|
+
Object.assign(leaves, leafColumns(column.subColumns));
|
|
4742
|
+
} else {
|
|
4743
|
+
leaves[columnName] = column;
|
|
4744
|
+
}
|
|
4745
|
+
return leaves;
|
|
4746
|
+
},
|
|
4747
|
+
{}
|
|
4488
4748
|
);
|
|
4489
4749
|
}
|
|
4490
|
-
function
|
|
4491
|
-
return
|
|
4492
|
-
|
|
4493
|
-
return rowColumns;
|
|
4494
|
-
}, []);
|
|
4495
|
-
}
|
|
4496
|
-
function leafColumns$1(columns) {
|
|
4497
|
-
return columns.reduce((leaves, column) => {
|
|
4498
|
-
leaves.push(
|
|
4499
|
-
...column.children.length === 0 ? [column] : leafColumns$1(column.children)
|
|
4500
|
-
);
|
|
4501
|
-
return leaves;
|
|
4502
|
-
}, []);
|
|
4503
|
-
}
|
|
4504
|
-
function tableMinWidth(leaves, defaultColumnWidth) {
|
|
4505
|
-
return leaves.reduce(
|
|
4506
|
-
(sum, column) => sum + columnWidth(column, defaultColumnWidth),
|
|
4507
|
-
0
|
|
4508
|
-
) + "px";
|
|
4509
|
-
}
|
|
4510
|
-
function tableMaxWidth(leaves, defaultColumnWidth) {
|
|
4511
|
-
return leaves.every((column) => column.fixed) ? tableMinWidth(leaves, defaultColumnWidth) : void 0;
|
|
4512
|
-
}
|
|
4513
|
-
function columnWidths(leaves, defaultColumnWidth) {
|
|
4514
|
-
const dynamicWidthsSum = leaves.reduce(
|
|
4515
|
-
(sum, column) => sum + (column.fixed ? 0 : columnWidth(column, defaultColumnWidth)),
|
|
4750
|
+
function numberOfRows(columns) {
|
|
4751
|
+
return Object.values(columns).reduce(
|
|
4752
|
+
(n, column) => Math.max(n, numberOfRows(column.subColumns ?? {}) + 1),
|
|
4516
4753
|
0
|
|
4517
4754
|
);
|
|
4518
|
-
return leaves.reduce((widths, column) => {
|
|
4519
|
-
const colSpan = column.colSpan ?? 1;
|
|
4520
|
-
const colWidths = Array.isArray(column.width) ? column.width : (
|
|
4521
|
-
// Distribute the width amongst the columns being spanned
|
|
4522
|
-
[...Array(colSpan)].map(
|
|
4523
|
-
() => columnWidth(column, defaultColumnWidth) / colSpan
|
|
4524
|
-
)
|
|
4525
|
-
);
|
|
4526
|
-
for (let i = 0; i < colSpan; ++i) {
|
|
4527
|
-
const colWidth = colWidths[i] ?? 0;
|
|
4528
|
-
widths.push(
|
|
4529
|
-
column.fixed ? `${colWidth}px` : `${colWidth / dynamicWidthsSum * 100}%`
|
|
4530
|
-
);
|
|
4531
|
-
}
|
|
4532
|
-
return widths;
|
|
4533
|
-
}, []);
|
|
4534
4755
|
}
|
|
4535
|
-
function
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
function leftMostColumns(columns) {
|
|
4539
|
-
if (columns.length === 0) {
|
|
4540
|
-
return [];
|
|
4756
|
+
function sanitizeInt(value) {
|
|
4757
|
+
if (typeof value === "string") {
|
|
4758
|
+
value = +value;
|
|
4541
4759
|
}
|
|
4542
|
-
|
|
4543
|
-
return [firstColumn, ...leftMostColumns(firstColumn.children)];
|
|
4760
|
+
return value === void 0 || Number.isNaN(value) ? void 0 : Math.trunc(value);
|
|
4544
4761
|
}
|
|
4545
|
-
function
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
return [lastColumn, ...rightMostColumns(lastColumn.children)];
|
|
4762
|
+
function sanitizeSortBy(sortBy, leaves) {
|
|
4763
|
+
return sortBy == null || sortBy in leaves ? sortBy : null;
|
|
4764
|
+
}
|
|
4765
|
+
function sanitizeSortDirection(sortDirection) {
|
|
4766
|
+
return sortDirection === void 0 || sortDirection === "asc" || sortDirection === "desc" ? sortDirection : void 0;
|
|
4551
4767
|
}
|
|
4552
4768
|
const DEFAULT_OFFSET = 0;
|
|
4553
4769
|
const DEFAULT_LIMIT = 10;
|
|
@@ -4596,10 +4812,10 @@ const DataTable = forwardRef(
|
|
|
4596
4812
|
const printing = usePrinting();
|
|
4597
4813
|
const leaves = useMemo(() => leafColumns(columns), [columns]);
|
|
4598
4814
|
const headCount = useMemo(() => numberOfRows(columns), [columns]);
|
|
4599
|
-
defaultOffset =
|
|
4600
|
-
offset =
|
|
4601
|
-
defaultLimit =
|
|
4602
|
-
limit =
|
|
4815
|
+
defaultOffset = sanitizeInt(defaultOffset) ?? DEFAULT_OFFSET;
|
|
4816
|
+
offset = sanitizeInt(offset);
|
|
4817
|
+
defaultLimit = sanitizeInt(defaultLimit) ?? DEFAULT_LIMIT;
|
|
4818
|
+
limit = sanitizeInt(limit);
|
|
4603
4819
|
defaultSortBy = sanitizeSortBy(defaultSortBy, leaves) ?? null;
|
|
4604
4820
|
sortBy = sanitizeSortBy(sortBy, leaves);
|
|
4605
4821
|
defaultSortDirection = sanitizeSortDirection(defaultSortDirection);
|
|
@@ -4654,37 +4870,6 @@ const DataTable = forwardRef(
|
|
|
4654
4870
|
) });
|
|
4655
4871
|
}
|
|
4656
4872
|
);
|
|
4657
|
-
function leafColumns(columns) {
|
|
4658
|
-
return Object.entries(columns).reduce(
|
|
4659
|
-
(leaves, [columnName, column]) => {
|
|
4660
|
-
if (column.subColumns) {
|
|
4661
|
-
Object.assign(leaves, leafColumns(column.subColumns));
|
|
4662
|
-
} else {
|
|
4663
|
-
leaves[columnName] = column;
|
|
4664
|
-
}
|
|
4665
|
-
return leaves;
|
|
4666
|
-
},
|
|
4667
|
-
{}
|
|
4668
|
-
);
|
|
4669
|
-
}
|
|
4670
|
-
function numberOfRows(columns) {
|
|
4671
|
-
return Object.values(columns).reduce(
|
|
4672
|
-
(n, column) => Math.max(n, numberOfRows(column.subColumns ?? {}) + 1),
|
|
4673
|
-
0
|
|
4674
|
-
);
|
|
4675
|
-
}
|
|
4676
|
-
function sanitizeNumeric(value) {
|
|
4677
|
-
if (typeof value === "string") {
|
|
4678
|
-
value = +value;
|
|
4679
|
-
}
|
|
4680
|
-
return value === void 0 || Number.isNaN(value) ? void 0 : Math.trunc(value);
|
|
4681
|
-
}
|
|
4682
|
-
function sanitizeSortBy(sortBy, leaves) {
|
|
4683
|
-
return sortBy == null || sortBy in leaves ? sortBy : null;
|
|
4684
|
-
}
|
|
4685
|
-
function sanitizeSortDirection(sortDirection) {
|
|
4686
|
-
return sortDirection === void 0 || sortDirection === "asc" || sortDirection === "desc" ? sortDirection : void 0;
|
|
4687
|
-
}
|
|
4688
4873
|
function useDataTableApiRef() {
|
|
4689
4874
|
return useRef(null);
|
|
4690
4875
|
}
|
|
@@ -5408,6 +5593,7 @@ const DataTableRow = memo(
|
|
|
5408
5593
|
format: format2,
|
|
5409
5594
|
render,
|
|
5410
5595
|
compare: _compare,
|
|
5596
|
+
footer: _footer,
|
|
5411
5597
|
label,
|
|
5412
5598
|
labelText: _labelText,
|
|
5413
5599
|
helperText: _helperText,
|
|
@@ -5418,6 +5604,7 @@ const DataTableRow = memo(
|
|
|
5418
5604
|
defaultSortDirection: _defaultSortDirection,
|
|
5419
5605
|
containerProps: _containerProps,
|
|
5420
5606
|
labelProps,
|
|
5607
|
+
footerProps: _footerProps,
|
|
5421
5608
|
sortButtonProps: _sortButtonProps,
|
|
5422
5609
|
sortIconContainerProps: _sortIconContainerProps,
|
|
5423
5610
|
sortAscIconProps: _sortAscIconProps,
|
|
@@ -5427,7 +5614,7 @@ const DataTableRow = memo(
|
|
|
5427
5614
|
helperPopoverContentProps: _helperPopoverContentProps,
|
|
5428
5615
|
...otherProps2
|
|
5429
5616
|
}
|
|
5430
|
-
]) => {
|
|
5617
|
+
], i) => {
|
|
5431
5618
|
const loadingRow = row === void 0;
|
|
5432
5619
|
const value = !loadingRow && (getValue ? getValue({ row, index }) : row?.[columnName] ?? null);
|
|
5433
5620
|
const formattedValue = !loadingRow && (format2 ? format2({ value, row, index }) : value?.toString() ?? "");
|
|
@@ -5459,7 +5646,7 @@ const DataTableRow = memo(
|
|
|
5459
5646
|
index
|
|
5460
5647
|
}) : markedValue
|
|
5461
5648
|
};
|
|
5462
|
-
return renderCell ? /* @__PURE__ */ jsx(Fragment$1, { children: renderCell(props) }, columnName) : /* @__PURE__ */ jsx(DataTableCell, { ...props }, columnName);
|
|
5649
|
+
return renderCell ? /* @__PURE__ */ jsx(Fragment$1, { children: renderCell({ columnIndex: i, ...props }) }, columnName) : /* @__PURE__ */ jsx(DataTableCell, { columnIndex: i, ...props }, columnName);
|
|
5463
5650
|
}
|
|
5464
5651
|
)
|
|
5465
5652
|
}
|
|
@@ -5539,7 +5726,7 @@ function PagedDataTableRows() {
|
|
|
5539
5726
|
]);
|
|
5540
5727
|
useEffect(
|
|
5541
5728
|
() => store.subscribe(
|
|
5542
|
-
(
|
|
5729
|
+
({ updateCounter }) => updateCounter,
|
|
5543
5730
|
() => {
|
|
5544
5731
|
const { pageOffset: pageOffset2, pageLimit, limit, actions } = store.getState();
|
|
5545
5732
|
actions.updateWindow(pageOffset2(), pageLimit() ?? limit());
|
|
@@ -5622,7 +5809,7 @@ function ScrolledDataTableRows({
|
|
|
5622
5809
|
);
|
|
5623
5810
|
useEffect(
|
|
5624
5811
|
() => store.subscribe(
|
|
5625
|
-
(
|
|
5812
|
+
({ updateCounter }) => updateCounter,
|
|
5626
5813
|
() => update(virtualizer.getVirtualItems())
|
|
5627
5814
|
),
|
|
5628
5815
|
[store, update, virtualizer]
|
|
@@ -5679,7 +5866,7 @@ function ScrolledDataTableRows({
|
|
|
5679
5866
|
);
|
|
5680
5867
|
useEffect(
|
|
5681
5868
|
() => store.subscribe(
|
|
5682
|
-
(
|
|
5869
|
+
({ offset }) => offset(),
|
|
5683
5870
|
(offset) => !virtualizer.isScrolling && goTo(offset)
|
|
5684
5871
|
),
|
|
5685
5872
|
[goTo, store, virtualizer]
|
|
@@ -5767,7 +5954,7 @@ function useMeasure(element, setMeasurement) {
|
|
|
5767
5954
|
};
|
|
5768
5955
|
}, [element, setMeasurement]);
|
|
5769
5956
|
}
|
|
5770
|
-
const DataTableFoot = forwardRef(function DataTableFoot2({ showWhenEmpty, ...otherProps }, forwardedRef) {
|
|
5957
|
+
const DataTableFoot = forwardRef(function DataTableFoot2({ footContent, showWhenEmpty, ...otherProps }, forwardedRef) {
|
|
5771
5958
|
const { store } = useDataTableContext();
|
|
5772
5959
|
const shouldShow = useStore$1(
|
|
5773
5960
|
store,
|
|
@@ -5781,8 +5968,63 @@ const DataTableFoot = forwardRef(function DataTableFoot2({ showWhenEmpty, ...oth
|
|
|
5781
5968
|
[store]
|
|
5782
5969
|
)
|
|
5783
5970
|
);
|
|
5971
|
+
const selectionColumn = useDataTableSelectionColumn();
|
|
5972
|
+
const dataTableSelectionColumnId = useDataTableSelectionColumnId();
|
|
5973
|
+
const leafColumns2 = useStore$1(
|
|
5974
|
+
store,
|
|
5975
|
+
useShallow(
|
|
5976
|
+
({ leafColumns: leafColumns22 }) => selectionColumn ? { [dataTableSelectionColumnId]: selectionColumn, ...leafColumns22 } : leafColumns22
|
|
5977
|
+
)
|
|
5978
|
+
);
|
|
5979
|
+
const hasFooterCells = useStore$1(
|
|
5980
|
+
store,
|
|
5981
|
+
({ hasFooterCells: hasFooterCells2 }) => hasFooterCells2()
|
|
5982
|
+
);
|
|
5983
|
+
const footRowIndex = useStore$1(
|
|
5984
|
+
store,
|
|
5985
|
+
({ headCount, bodyCount }) => hasFooterCells ? headCount + bodyCount() + 1 : void 0
|
|
5986
|
+
);
|
|
5987
|
+
const rows = useStore$1(
|
|
5988
|
+
store,
|
|
5989
|
+
({ transformedRows }) => transformedRows()
|
|
5990
|
+
);
|
|
5784
5991
|
const combinedTableFootRef = useCombinedRef(setTableFootEl, forwardedRef);
|
|
5785
|
-
return shouldShow && /* @__PURE__ */
|
|
5992
|
+
return shouldShow && (hasFooterCells || footContent) && /* @__PURE__ */ jsxs(TableFoot, { ...otherProps, ref: combinedTableFootRef, children: [
|
|
5993
|
+
hasFooterCells && /* @__PURE__ */ jsx(TableRow, { "aria-rowindex": footRowIndex, children: Object.entries(leafColumns2).map(
|
|
5994
|
+
([
|
|
5995
|
+
columnName,
|
|
5996
|
+
{
|
|
5997
|
+
filterable: _filterable,
|
|
5998
|
+
locale: _locale,
|
|
5999
|
+
subColumns: _subColumns,
|
|
6000
|
+
getValue: _getValue,
|
|
6001
|
+
format: _format,
|
|
6002
|
+
render: _render,
|
|
6003
|
+
compare: _compare,
|
|
6004
|
+
footer,
|
|
6005
|
+
label: _label,
|
|
6006
|
+
labelText: _labelText,
|
|
6007
|
+
helperText: _helperText,
|
|
6008
|
+
helperButtonLabel: _helperButtonLabel,
|
|
6009
|
+
width: _width,
|
|
6010
|
+
fixed: _fixed,
|
|
6011
|
+
sortable: _sortable,
|
|
6012
|
+
defaultSortDirection: _defaultSortDirection,
|
|
6013
|
+
containerProps: _containerProps,
|
|
6014
|
+
labelProps: _labelProps,
|
|
6015
|
+
sortButtonProps: _sortButtonProps,
|
|
6016
|
+
sortIconContainerProps: _sortIconContainerProps,
|
|
6017
|
+
sortAscIconProps: _sortAscIconProps,
|
|
6018
|
+
sortDescIconProps: _sortDescIconProps,
|
|
6019
|
+
helperButtonProps: _helperButtonProps,
|
|
6020
|
+
helperPopoverProps: _helperPopoverProps,
|
|
6021
|
+
helperPopoverContentProps: _helperPopoverContentProps,
|
|
6022
|
+
...otherProps2
|
|
6023
|
+
}
|
|
6024
|
+
]) => /* @__PURE__ */ jsx(TableCell, { ...otherProps2, children: typeof footer === "function" ? footer({ rows }) : footer }, columnName)
|
|
6025
|
+
) }),
|
|
6026
|
+
footContent
|
|
6027
|
+
] });
|
|
5786
6028
|
});
|
|
5787
6029
|
const DataTableHead = forwardRef(function DataTableHead2({ rowProps, ...otherProps }, forwardedRef) {
|
|
5788
6030
|
const { generatedId, store } = useDataTableContext();
|
|
@@ -5846,6 +6088,8 @@ function renderDataTableColumns(columns, generatedId, sortingProps) {
|
|
|
5846
6088
|
format: _format,
|
|
5847
6089
|
render: _render,
|
|
5848
6090
|
compare: _compare,
|
|
6091
|
+
footer: _footer,
|
|
6092
|
+
footerProps: _footerProps,
|
|
5849
6093
|
labelProps,
|
|
5850
6094
|
...column
|
|
5851
6095
|
}
|
|
@@ -5874,8 +6118,8 @@ const DataTableContent = forwardRef(function DataTable2({
|
|
|
5874
6118
|
scrollableProps,
|
|
5875
6119
|
tableHeadProps,
|
|
5876
6120
|
tableBodyProps,
|
|
5877
|
-
emptyMessageProps,
|
|
5878
6121
|
tableFootProps,
|
|
6122
|
+
emptyMessageProps,
|
|
5879
6123
|
className,
|
|
5880
6124
|
...otherProps
|
|
5881
6125
|
}, forwardedRef) {
|
|
@@ -5895,7 +6139,7 @@ const DataTableContent = forwardRef(function DataTable2({
|
|
|
5895
6139
|
const stickyHeadFoot = maxHeight !== void 0;
|
|
5896
6140
|
useEffect(
|
|
5897
6141
|
() => store.subscribe(
|
|
5898
|
-
(state) => state.headCount + state.bodyCount(),
|
|
6142
|
+
(state) => state.headCount + state.bodyCount() + state.footCount(),
|
|
5899
6143
|
(totalCount) => {
|
|
5900
6144
|
tableRef.current.ariaRowCount = totalCount.toString();
|
|
5901
6145
|
},
|
|
@@ -5936,13 +6180,13 @@ const DataTableContent = forwardRef(function DataTable2({
|
|
|
5936
6180
|
...tableBodyProps
|
|
5937
6181
|
}
|
|
5938
6182
|
),
|
|
5939
|
-
|
|
6183
|
+
/* @__PURE__ */ jsx(
|
|
5940
6184
|
DataTableFoot,
|
|
5941
6185
|
{
|
|
5942
6186
|
sticky: stickyHeadFoot,
|
|
5943
6187
|
showWhenEmpty: showTableFootWhenEmpty,
|
|
5944
|
-
|
|
5945
|
-
|
|
6188
|
+
footContent: tableFootContent,
|
|
6189
|
+
...tableFootProps
|
|
5946
6190
|
}
|
|
5947
6191
|
)
|
|
5948
6192
|
]
|
|
@@ -7802,7 +8046,7 @@ const CommandMenuDialog = forwardRef(function CommandMenuDialog2({
|
|
|
7802
8046
|
container: portalContext?.container,
|
|
7803
8047
|
...portalProps,
|
|
7804
8048
|
forceMount,
|
|
7805
|
-
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Dialog$1.Overlay, { forceMount, asChild: true, children: /* @__PURE__ */ jsx(
|
|
8049
|
+
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "dialog", reset: true, children: /* @__PURE__ */ jsx(Dialog$1.Overlay, { forceMount, asChild: true, children: /* @__PURE__ */ jsx(
|
|
7806
8050
|
Overlay,
|
|
7807
8051
|
{
|
|
7808
8052
|
...overlayProps,
|
|
@@ -7830,7 +8074,7 @@ const CommandMenuDialog = forwardRef(function CommandMenuDialog2({
|
|
|
7830
8074
|
}
|
|
7831
8075
|
)
|
|
7832
8076
|
}
|
|
7833
|
-
) }) })
|
|
8077
|
+
) }) }) })
|
|
7834
8078
|
}
|
|
7835
8079
|
) })
|
|
7836
8080
|
}
|
|
@@ -11054,15 +11298,15 @@ const DropdownMenuContent = forwardRef(function DropdownMenuContent2({
|
|
|
11054
11298
|
container: portalContext?.container,
|
|
11055
11299
|
...portalProps,
|
|
11056
11300
|
forceMount,
|
|
11057
|
-
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
11301
|
+
children: /* @__PURE__ */ jsx(Root, { asChild: true, children: /* @__PURE__ */ jsx(Layer, { zIndex: "dropdown", children: /* @__PURE__ */ jsx(
|
|
11058
11302
|
DropdownMenu$1.Content,
|
|
11059
11303
|
{
|
|
11060
11304
|
className: cx(prefix("dropdown-menu"), className),
|
|
11061
11305
|
sideOffset,
|
|
11062
11306
|
collisionPadding,
|
|
11063
11307
|
forceMount,
|
|
11064
|
-
ref: forwardedRef,
|
|
11065
11308
|
...otherProps,
|
|
11309
|
+
ref: forwardedRef,
|
|
11066
11310
|
children: /* @__PURE__ */ jsx(
|
|
11067
11311
|
MenuList,
|
|
11068
11312
|
{
|
|
@@ -11088,7 +11332,7 @@ const DropdownMenuContent = forwardRef(function DropdownMenuContent2({
|
|
|
11088
11332
|
}
|
|
11089
11333
|
)
|
|
11090
11334
|
}
|
|
11091
|
-
) })
|
|
11335
|
+
) }) })
|
|
11092
11336
|
}
|
|
11093
11337
|
) });
|
|
11094
11338
|
});
|
|
@@ -12850,17 +13094,18 @@ const StepList = forwardRef(
|
|
|
12850
13094
|
const prefix = usePrefix();
|
|
12851
13095
|
const { showAllStepsWhilePrinting } = useStepperContext();
|
|
12852
13096
|
const { printHidden } = usePrintClassNames();
|
|
12853
|
-
let
|
|
13097
|
+
let nextIdx = 0;
|
|
12854
13098
|
const indexedChildren = Children.toArray(children).map((child) => {
|
|
12855
13099
|
if (!isValidElement(child) || child.type !== Step) {
|
|
12856
13100
|
return child;
|
|
12857
13101
|
}
|
|
12858
13102
|
const { index, ...otherStepProps } = child.props;
|
|
12859
|
-
if (index) {
|
|
12860
|
-
|
|
13103
|
+
if (index != null) {
|
|
13104
|
+
nextIdx = index + 1;
|
|
13105
|
+
return child;
|
|
12861
13106
|
}
|
|
12862
13107
|
return cloneElement(child, {
|
|
12863
|
-
index:
|
|
13108
|
+
index: nextIdx++,
|
|
12864
13109
|
...otherStepProps
|
|
12865
13110
|
});
|
|
12866
13111
|
});
|
|
@@ -12912,17 +13157,18 @@ const Stepper = forwardRef(
|
|
|
12912
13157
|
)
|
|
12913
13158
|
);
|
|
12914
13159
|
useImperativeHandle(apiRef, () => api, [api]);
|
|
12915
|
-
let
|
|
13160
|
+
let nextIdx = 0;
|
|
12916
13161
|
const indexedChildren = Children.toArray(children).map((child) => {
|
|
12917
13162
|
if (!isValidElement(child) || child.type !== StepContent) {
|
|
12918
13163
|
return child;
|
|
12919
13164
|
}
|
|
12920
13165
|
const { index, ...otherStepContentProps } = child.props;
|
|
12921
|
-
if (index) {
|
|
12922
|
-
|
|
13166
|
+
if (index != null) {
|
|
13167
|
+
nextIdx = index + 1;
|
|
13168
|
+
return child;
|
|
12923
13169
|
}
|
|
12924
13170
|
return cloneElement(child, {
|
|
12925
|
-
index:
|
|
13171
|
+
index: nextIdx++,
|
|
12926
13172
|
...otherStepContentProps
|
|
12927
13173
|
});
|
|
12928
13174
|
});
|
|
@@ -13316,7 +13562,7 @@ const TabList = forwardRef(function TabList2({
|
|
|
13316
13562
|
);
|
|
13317
13563
|
useEffect(
|
|
13318
13564
|
() => store.subscribe(
|
|
13319
|
-
(
|
|
13565
|
+
({ width }) => width,
|
|
13320
13566
|
(width) => {
|
|
13321
13567
|
store.setState({
|
|
13322
13568
|
showScrollButtons: (containerEl?.scrollWidth ?? 0) > Math.ceil(width)
|
|
@@ -13754,6 +14000,7 @@ export {
|
|
|
13754
14000
|
Keybinds,
|
|
13755
14001
|
Keyboard,
|
|
13756
14002
|
Label,
|
|
14003
|
+
Layer,
|
|
13757
14004
|
Link,
|
|
13758
14005
|
LocalizationContext,
|
|
13759
14006
|
LocalizationProvider,
|
|
@@ -13880,6 +14127,7 @@ export {
|
|
|
13880
14127
|
useIsInTableCell,
|
|
13881
14128
|
useKeyboardShortcut,
|
|
13882
14129
|
useLatestValues,
|
|
14130
|
+
useLayerZIndex,
|
|
13883
14131
|
useLayoutEffect$1 as useLayoutEffect,
|
|
13884
14132
|
useLocale,
|
|
13885
14133
|
useLocation,
|