@inf-monkeys-tech/monkeys-design 0.4.32 → 0.4.33
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/components/base/index.d.mts +2 -2
- package/dist/components/base/index.d.ts +2 -2
- package/dist/components/base/index.js +545 -26
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/base/index.mjs +543 -28
- package/dist/components/base/index.mjs.map +1 -1
- package/dist/components/workbench/index.d.mts +193 -2
- package/dist/components/workbench/index.d.ts +193 -2
- package/dist/components/workbench/index.js +1157 -20
- package/dist/components/workbench/index.js.map +1 -1
- package/dist/components/workbench/index.mjs +1134 -22
- package/dist/components/workbench/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1382 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1375 -39
- package/dist/index.mjs.map +1 -1
- package/dist/{theme-CvbotXXr.d.ts → theme-CoG9vCPT.d.mts} +8 -3
- package/dist/{theme-6RDum855.d.mts → theme-Cuy60thu.d.ts} +8 -3
- package/dist/theme-system/index.d.mts +1 -1
- package/dist/theme-system/index.d.ts +1 -1
- package/dist/theme-system/index.js +398 -16
- package/dist/theme-system/index.js.map +1 -1
- package/dist/theme-system/index.mjs +399 -17
- package/dist/theme-system/index.mjs.map +1 -1
- package/dist/{types-BgEEUqSm.d.mts → types-CZALgtez.d.mts} +121 -1
- package/dist/{types-BgEEUqSm.d.ts → types-CZALgtez.d.ts} +121 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var React = require('react');
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var ContextMenu = require('@radix-ui/react-context-menu');
|
|
6
6
|
var DropdownMenu3 = require('@radix-ui/react-dropdown-menu');
|
|
7
|
+
var core = require('@dnd-kit/core');
|
|
7
8
|
var Tooltip = require('@radix-ui/react-tooltip');
|
|
8
9
|
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -4548,7 +4549,7 @@ var require_lodash = __commonJS({
|
|
|
4548
4549
|
function valuesIn(object) {
|
|
4549
4550
|
return object == null ? [] : baseValues(object, keysIn(object));
|
|
4550
4551
|
}
|
|
4551
|
-
function
|
|
4552
|
+
function clamp5(number, lower, upper) {
|
|
4552
4553
|
if (upper === undefined2) {
|
|
4553
4554
|
upper = lower;
|
|
4554
4555
|
lower = undefined2;
|
|
@@ -5225,7 +5226,7 @@ var require_lodash = __commonJS({
|
|
|
5225
5226
|
lodash.camelCase = camelCase;
|
|
5226
5227
|
lodash.capitalize = capitalize;
|
|
5227
5228
|
lodash.ceil = ceil;
|
|
5228
|
-
lodash.clamp =
|
|
5229
|
+
lodash.clamp = clamp5;
|
|
5229
5230
|
lodash.clone = clone;
|
|
5230
5231
|
lodash.cloneDeep = cloneDeep;
|
|
5231
5232
|
lodash.cloneDeepWith = cloneDeepWith;
|
|
@@ -8580,7 +8581,41 @@ var baseSlots = {
|
|
|
8580
8581
|
tableEmptyActions: "mt-4 flex flex-wrap items-center justify-center gap-2",
|
|
8581
8582
|
tableLoadingRow: "border-b border-border/60",
|
|
8582
8583
|
tableLoadingCell: "px-3 py-2",
|
|
8583
|
-
tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70"
|
|
8584
|
+
tableLoadingSkeleton: "h-4 w-full rounded-md bg-muted/70",
|
|
8585
|
+
layoutRoot: cn(
|
|
8586
|
+
"grid min-w-0 overflow-hidden grid-rows-[auto_minmax(0,1fr)_auto] gap-3 rounded-lg border border-border/70 bg-background p-3 text-foreground",
|
|
8587
|
+
motionBase
|
|
8588
|
+
),
|
|
8589
|
+
layoutRootFull: "h-full min-h-0",
|
|
8590
|
+
layoutHeader: "min-w-0",
|
|
8591
|
+
layoutBody: "grid min-h-0 min-w-0 overflow-hidden gap-3",
|
|
8592
|
+
layoutSidebar: "min-h-0 min-w-0 overflow-hidden",
|
|
8593
|
+
layoutMain: "min-h-0 min-w-0 overflow-hidden",
|
|
8594
|
+
layoutAside: "min-h-0 min-w-0 overflow-hidden",
|
|
8595
|
+
layoutFooter: "min-w-0",
|
|
8596
|
+
layoutPane: cn(
|
|
8597
|
+
"h-full max-h-full min-h-0 min-w-0 overflow-hidden rounded-lg bg-background text-foreground",
|
|
8598
|
+
motionBase
|
|
8599
|
+
),
|
|
8600
|
+
layoutPaneScrollable: "overflow-auto",
|
|
8601
|
+
layoutPaneBordered: "border border-border/70",
|
|
8602
|
+
layoutPaneMuted: "bg-muted/25",
|
|
8603
|
+
layoutPaneSoft: "bg-background/95 shadow-sm",
|
|
8604
|
+
layoutPaneTransparent: "bg-transparent shadow-none",
|
|
8605
|
+
layoutSplitRoot: "grid min-h-0 min-w-0 overflow-hidden",
|
|
8606
|
+
layoutSplitHorizontal: "grid-flow-col",
|
|
8607
|
+
layoutSplitVertical: "grid-flow-row",
|
|
8608
|
+
layoutSplitPane: "min-h-0 min-w-0 overflow-hidden",
|
|
8609
|
+
layoutSplitPrimary: "",
|
|
8610
|
+
layoutSplitSecondary: "",
|
|
8611
|
+
layoutResizeHandle: cn(
|
|
8612
|
+
"group/resize relative z-10 flex shrink-0 items-center justify-center bg-transparent text-muted-foreground hover:bg-border/60 active:bg-border/70 focus-visible:bg-border/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
|
|
8613
|
+
motionInteractive
|
|
8614
|
+
),
|
|
8615
|
+
layoutResizeHandleHorizontal: "w-2 cursor-col-resize",
|
|
8616
|
+
layoutResizeHandleVertical: "h-2 cursor-row-resize",
|
|
8617
|
+
layoutResizeHandleDisabled: "cursor-default opacity-60",
|
|
8618
|
+
layoutResizeHandleIndicator: "rounded-full bg-muted-foreground/45 group-hover/resize:bg-primary/70"
|
|
8584
8619
|
};
|
|
8585
8620
|
var densitySlots = {
|
|
8586
8621
|
compact: {
|
|
@@ -8654,7 +8689,12 @@ var densitySlots = {
|
|
|
8654
8689
|
tableCell: "px-2 py-1.5 text-xs",
|
|
8655
8690
|
tableHeadLabel: "text-[11px]",
|
|
8656
8691
|
tableHeadDescription: "text-[10px] leading-3",
|
|
8657
|
-
tableLoadingCell: "px-2 py-1.5"
|
|
8692
|
+
tableLoadingCell: "px-2 py-1.5",
|
|
8693
|
+
layoutRoot: "gap-2 p-2",
|
|
8694
|
+
layoutBody: "gap-2",
|
|
8695
|
+
layoutPane: "rounded-md text-xs",
|
|
8696
|
+
layoutResizeHandleHorizontal: "w-1.5",
|
|
8697
|
+
layoutResizeHandleVertical: "h-1.5"
|
|
8658
8698
|
},
|
|
8659
8699
|
default: {
|
|
8660
8700
|
buttonBase: "h-9"
|
|
@@ -8705,7 +8745,12 @@ var densitySlots = {
|
|
|
8705
8745
|
menuSubTrigger: "min-h-9 px-3 py-2",
|
|
8706
8746
|
tableHead: "h-12 px-4 py-3",
|
|
8707
8747
|
tableCell: "px-4 py-3",
|
|
8708
|
-
tableLoadingCell: "px-4 py-3"
|
|
8748
|
+
tableLoadingCell: "px-4 py-3",
|
|
8749
|
+
layoutRoot: "gap-4 p-4",
|
|
8750
|
+
layoutBody: "gap-4",
|
|
8751
|
+
layoutPane: "rounded-xl",
|
|
8752
|
+
layoutResizeHandleHorizontal: "w-2.5",
|
|
8753
|
+
layoutResizeHandleVertical: "h-2.5"
|
|
8709
8754
|
}
|
|
8710
8755
|
};
|
|
8711
8756
|
var radiusSlots = {
|
|
@@ -8749,7 +8794,9 @@ var radiusSlots = {
|
|
|
8749
8794
|
menuSubContent: "rounded-none",
|
|
8750
8795
|
tableContainer: "rounded-none",
|
|
8751
8796
|
tableEmptyIcon: "rounded-none",
|
|
8752
|
-
tableLoadingSkeleton: "rounded-none"
|
|
8797
|
+
tableLoadingSkeleton: "rounded-none",
|
|
8798
|
+
layoutRoot: "rounded-none",
|
|
8799
|
+
layoutPane: "rounded-none"
|
|
8753
8800
|
},
|
|
8754
8801
|
sm: {
|
|
8755
8802
|
buttonBase: "rounded-sm",
|
|
@@ -8791,7 +8838,9 @@ var radiusSlots = {
|
|
|
8791
8838
|
menuSubContent: "rounded-sm",
|
|
8792
8839
|
tableContainer: "rounded-sm",
|
|
8793
8840
|
tableEmptyIcon: "rounded-sm",
|
|
8794
|
-
tableLoadingSkeleton: "rounded-sm"
|
|
8841
|
+
tableLoadingSkeleton: "rounded-sm",
|
|
8842
|
+
layoutRoot: "rounded-sm",
|
|
8843
|
+
layoutPane: "rounded-sm"
|
|
8795
8844
|
},
|
|
8796
8845
|
md: {},
|
|
8797
8846
|
lg: {
|
|
@@ -8828,7 +8877,9 @@ var radiusSlots = {
|
|
|
8828
8877
|
menuSubContent: "rounded-lg",
|
|
8829
8878
|
tableContainer: "rounded-xl",
|
|
8830
8879
|
tableEmptyIcon: "rounded-xl",
|
|
8831
|
-
tableLoadingSkeleton: "rounded-lg"
|
|
8880
|
+
tableLoadingSkeleton: "rounded-lg",
|
|
8881
|
+
layoutRoot: "rounded-xl",
|
|
8882
|
+
layoutPane: "rounded-xl"
|
|
8832
8883
|
},
|
|
8833
8884
|
xl: {
|
|
8834
8885
|
buttonBase: "rounded-xl",
|
|
@@ -8866,7 +8917,9 @@ var radiusSlots = {
|
|
|
8866
8917
|
menuSubContent: "rounded-xl",
|
|
8867
8918
|
tableContainer: "rounded-2xl",
|
|
8868
8919
|
tableEmptyIcon: "rounded-2xl",
|
|
8869
|
-
tableLoadingSkeleton: "rounded-xl"
|
|
8920
|
+
tableLoadingSkeleton: "rounded-xl",
|
|
8921
|
+
layoutRoot: "rounded-2xl",
|
|
8922
|
+
layoutPane: "rounded-2xl"
|
|
8870
8923
|
},
|
|
8871
8924
|
full: {
|
|
8872
8925
|
buttonBase: "rounded-full",
|
|
@@ -8908,7 +8961,9 @@ var radiusSlots = {
|
|
|
8908
8961
|
menuSubContent: "rounded-2xl",
|
|
8909
8962
|
tableContainer: "rounded-2xl",
|
|
8910
8963
|
tableEmptyIcon: "rounded-full",
|
|
8911
|
-
tableLoadingSkeleton: "rounded-full"
|
|
8964
|
+
tableLoadingSkeleton: "rounded-full",
|
|
8965
|
+
layoutRoot: "rounded-2xl",
|
|
8966
|
+
layoutPane: "rounded-2xl"
|
|
8912
8967
|
}
|
|
8913
8968
|
};
|
|
8914
8969
|
var borderSlots = {
|
|
@@ -8950,7 +9005,10 @@ var borderSlots = {
|
|
|
8950
9005
|
tableFooterBarAttached: "border-t border-transparent",
|
|
8951
9006
|
tableRow: "border-transparent",
|
|
8952
9007
|
tableEmptyRow: "border-transparent",
|
|
8953
|
-
tableLoadingRow: "border-transparent"
|
|
9008
|
+
tableLoadingRow: "border-transparent",
|
|
9009
|
+
layoutRoot: "border-transparent",
|
|
9010
|
+
layoutPaneBordered: "border-transparent",
|
|
9011
|
+
layoutResizeHandle: "bg-transparent hover:bg-transparent active:bg-transparent focus-visible:bg-transparent"
|
|
8954
9012
|
},
|
|
8955
9013
|
subtle: {
|
|
8956
9014
|
buttonDefault: "border-border/60",
|
|
@@ -8990,7 +9048,9 @@ var borderSlots = {
|
|
|
8990
9048
|
tableFooterBarAttached: "border-t border-border/60",
|
|
8991
9049
|
tableRow: "border-border/50",
|
|
8992
9050
|
tableEmptyRow: "border-border/50",
|
|
8993
|
-
tableLoadingRow: "border-border/50"
|
|
9051
|
+
tableLoadingRow: "border-border/50",
|
|
9052
|
+
layoutRoot: "border-border/60",
|
|
9053
|
+
layoutPaneBordered: "border-border/60"
|
|
8994
9054
|
},
|
|
8995
9055
|
solid: {},
|
|
8996
9056
|
strong: {
|
|
@@ -9031,7 +9091,10 @@ var borderSlots = {
|
|
|
9031
9091
|
tableFooterBarAttached: "border-t border-foreground/20",
|
|
9032
9092
|
tableRow: "border-foreground/15",
|
|
9033
9093
|
tableEmptyRow: "border-foreground/15",
|
|
9034
|
-
tableLoadingRow: "border-foreground/15"
|
|
9094
|
+
tableLoadingRow: "border-foreground/15",
|
|
9095
|
+
layoutRoot: "border-foreground/20",
|
|
9096
|
+
layoutPaneBordered: "border-foreground/20",
|
|
9097
|
+
layoutResizeHandle: "hover:bg-foreground/15 active:bg-foreground/20 focus-visible:bg-foreground/15"
|
|
9035
9098
|
}
|
|
9036
9099
|
};
|
|
9037
9100
|
var backgroundSlots = {
|
|
@@ -9073,7 +9136,11 @@ var backgroundSlots = {
|
|
|
9073
9136
|
tableFooter: "bg-muted/35",
|
|
9074
9137
|
tableFooterBar: "bg-muted/30 shadow-none",
|
|
9075
9138
|
tableRowInteractive: "cursor-pointer hover:bg-muted/45",
|
|
9076
|
-
tableLoadingSkeleton: "bg-muted"
|
|
9139
|
+
tableLoadingSkeleton: "bg-muted",
|
|
9140
|
+
layoutRoot: "bg-card",
|
|
9141
|
+
layoutPane: "bg-card",
|
|
9142
|
+
layoutPaneMuted: "bg-muted/35",
|
|
9143
|
+
layoutResizeHandle: "hover:bg-border/70 active:bg-border/80 focus-visible:bg-border/70"
|
|
9077
9144
|
},
|
|
9078
9145
|
soft: {
|
|
9079
9146
|
buttonDefault: "bg-muted/30 hover:bg-muted/55",
|
|
@@ -9109,7 +9176,10 @@ var backgroundSlots = {
|
|
|
9109
9176
|
tableFooter: "bg-muted/25",
|
|
9110
9177
|
tableFooterBar: "bg-muted/25 shadow-none",
|
|
9111
9178
|
tableRowInteractive: "cursor-pointer hover:bg-muted/35",
|
|
9112
|
-
tableLoadingSkeleton: "bg-muted/65"
|
|
9179
|
+
tableLoadingSkeleton: "bg-muted/65",
|
|
9180
|
+
layoutRoot: "bg-background/95 shadow-sm",
|
|
9181
|
+
layoutPane: "bg-background/95 shadow-sm",
|
|
9182
|
+
layoutPaneSoft: "bg-background/95 shadow-md"
|
|
9113
9183
|
},
|
|
9114
9184
|
glass: {
|
|
9115
9185
|
buttonBase: "backdrop-blur-md",
|
|
@@ -9170,7 +9240,13 @@ var backgroundSlots = {
|
|
|
9170
9240
|
tableRow: "border-white/10",
|
|
9171
9241
|
tableRowInteractive: "cursor-pointer hover:bg-white/[0.08]",
|
|
9172
9242
|
tableHeadLabel: "text-foreground",
|
|
9173
|
-
tableLoadingSkeleton: "bg-white/[0.16]"
|
|
9243
|
+
tableLoadingSkeleton: "bg-white/[0.16]",
|
|
9244
|
+
layoutRoot: "border-white/10 bg-white/[0.05] shadow-none backdrop-blur-md",
|
|
9245
|
+
layoutPane: "border-white/10 bg-white/[0.06] shadow-none backdrop-blur-md",
|
|
9246
|
+
layoutPaneMuted: "bg-white/[0.08]",
|
|
9247
|
+
layoutPaneSoft: "bg-white/[0.10] shadow-none backdrop-blur-md",
|
|
9248
|
+
layoutResizeHandle: "text-foreground/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
|
|
9249
|
+
layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
|
|
9174
9250
|
},
|
|
9175
9251
|
dark: {
|
|
9176
9252
|
buttonBase: "border-white/15 text-white shadow-lg backdrop-blur",
|
|
@@ -9299,7 +9375,13 @@ var backgroundSlots = {
|
|
|
9299
9375
|
menuSubTrigger: "text-white focus:bg-white/[0.10] focus:text-white data-[highlighted]:bg-white/[0.10] data-[highlighted]:text-white data-[state=open]:bg-white/[0.12]",
|
|
9300
9376
|
menuSubTriggerIcon: "text-white/55",
|
|
9301
9377
|
menuSubContent: "border-white/10 bg-slate-950 text-white shadow-2xl",
|
|
9302
|
-
tableLoadingSkeleton: "bg-white/[0.14]"
|
|
9378
|
+
tableLoadingSkeleton: "bg-white/[0.14]",
|
|
9379
|
+
layoutRoot: "border-white/10 bg-slate-950 text-white shadow-none",
|
|
9380
|
+
layoutPane: "border-white/10 bg-slate-950 text-white shadow-none",
|
|
9381
|
+
layoutPaneMuted: "bg-white/[0.06]",
|
|
9382
|
+
layoutPaneSoft: "bg-white/[0.08] shadow-none",
|
|
9383
|
+
layoutResizeHandle: "text-white/65 hover:bg-white/10 active:bg-white/15 focus-visible:bg-white/10",
|
|
9384
|
+
layoutResizeHandleIndicator: "bg-white/45 group-hover/resize:bg-white/75"
|
|
9303
9385
|
}
|
|
9304
9386
|
};
|
|
9305
9387
|
var presetDefaults = {
|
|
@@ -11157,6 +11239,432 @@ var BaseInput = React.forwardRef(
|
|
|
11157
11239
|
);
|
|
11158
11240
|
}
|
|
11159
11241
|
);
|
|
11242
|
+
var DEFAULT_SPLIT_SIZE = 50;
|
|
11243
|
+
var DEFAULT_MIN_SIZE = 20;
|
|
11244
|
+
var DEFAULT_MAX_SIZE = 80;
|
|
11245
|
+
var DEFAULT_KEYBOARD_STEP = 2.5;
|
|
11246
|
+
function toCssSize(value, fallback) {
|
|
11247
|
+
if (typeof value === "number") {
|
|
11248
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
11249
|
+
throw new Error("BaseLayout size and gap props must be finite, non-negative numbers.");
|
|
11250
|
+
}
|
|
11251
|
+
return `${value}px`;
|
|
11252
|
+
}
|
|
11253
|
+
return value ?? fallback;
|
|
11254
|
+
}
|
|
11255
|
+
function assertPercent(name, value) {
|
|
11256
|
+
if (!Number.isFinite(value)) {
|
|
11257
|
+
throw new Error(`BaseLayoutSplit ${name} must be a finite number.`);
|
|
11258
|
+
}
|
|
11259
|
+
if (value < 0 || value > 100) {
|
|
11260
|
+
throw new Error(`BaseLayoutSplit ${name} must be between 0 and 100.`);
|
|
11261
|
+
}
|
|
11262
|
+
return value;
|
|
11263
|
+
}
|
|
11264
|
+
function clamp(value, min5, max5) {
|
|
11265
|
+
return Math.min(Math.max(value, min5), max5);
|
|
11266
|
+
}
|
|
11267
|
+
function resolveSplitBounds({
|
|
11268
|
+
minSize = DEFAULT_MIN_SIZE,
|
|
11269
|
+
maxSize = DEFAULT_MAX_SIZE,
|
|
11270
|
+
keyboardStep = DEFAULT_KEYBOARD_STEP
|
|
11271
|
+
}) {
|
|
11272
|
+
const min5 = assertPercent("minSize", minSize);
|
|
11273
|
+
const max5 = assertPercent("maxSize", maxSize);
|
|
11274
|
+
if (min5 > max5) {
|
|
11275
|
+
throw new Error("BaseLayoutSplit minSize cannot be greater than maxSize.");
|
|
11276
|
+
}
|
|
11277
|
+
if (!Number.isFinite(keyboardStep) || keyboardStep <= 0) {
|
|
11278
|
+
throw new Error("BaseLayoutSplit keyboardStep must be a finite positive number.");
|
|
11279
|
+
}
|
|
11280
|
+
return { min: min5, max: max5, keyboardStep };
|
|
11281
|
+
}
|
|
11282
|
+
function resolveSplitSize(name, value, fallback, min5, max5) {
|
|
11283
|
+
return clamp(assertPercent(name, value ?? fallback), min5, max5);
|
|
11284
|
+
}
|
|
11285
|
+
function getSeparatorOrientation(orientation) {
|
|
11286
|
+
return orientation === "horizontal" ? "vertical" : "horizontal";
|
|
11287
|
+
}
|
|
11288
|
+
function BaseLayout({
|
|
11289
|
+
header,
|
|
11290
|
+
sidebar,
|
|
11291
|
+
aside,
|
|
11292
|
+
footer,
|
|
11293
|
+
children,
|
|
11294
|
+
sidebarSize,
|
|
11295
|
+
asideSize,
|
|
11296
|
+
gap,
|
|
11297
|
+
fullHeight,
|
|
11298
|
+
appearance,
|
|
11299
|
+
className,
|
|
11300
|
+
classNames,
|
|
11301
|
+
style,
|
|
11302
|
+
...layoutProps
|
|
11303
|
+
}) {
|
|
11304
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11305
|
+
const hasHeader = hasRenderableNode(header);
|
|
11306
|
+
const hasSidebar = hasRenderableNode(sidebar);
|
|
11307
|
+
const hasAside = hasRenderableNode(aside);
|
|
11308
|
+
const hasFooter = hasRenderableNode(footer);
|
|
11309
|
+
const bodyColumns = [
|
|
11310
|
+
hasSidebar ? "var(--base-layout-sidebar-size)" : void 0,
|
|
11311
|
+
"minmax(0, 1fr)",
|
|
11312
|
+
hasAside ? "var(--base-layout-aside-size)" : void 0
|
|
11313
|
+
].filter(Boolean).join(" ");
|
|
11314
|
+
const layoutRows = [
|
|
11315
|
+
hasHeader ? "auto" : void 0,
|
|
11316
|
+
"minmax(0, 1fr)",
|
|
11317
|
+
hasFooter ? "auto" : void 0
|
|
11318
|
+
].filter(Boolean).join(" ");
|
|
11319
|
+
const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
|
|
11320
|
+
const layoutStyle = {
|
|
11321
|
+
...theme.styles.layout,
|
|
11322
|
+
"--base-layout-sidebar-size": toCssSize(sidebarSize, "16rem"),
|
|
11323
|
+
"--base-layout-aside-size": toCssSize(asideSize, "20rem"),
|
|
11324
|
+
gridTemplateRows: layoutRows,
|
|
11325
|
+
...resolvedGap !== void 0 ? { gap: resolvedGap } : {},
|
|
11326
|
+
...style
|
|
11327
|
+
};
|
|
11328
|
+
const bodyStyle = {
|
|
11329
|
+
...theme.styles.layoutBody,
|
|
11330
|
+
gridTemplateColumns: bodyColumns,
|
|
11331
|
+
...resolvedGap !== void 0 ? { gap: resolvedGap } : {}
|
|
11332
|
+
};
|
|
11333
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11334
|
+
"div",
|
|
11335
|
+
{
|
|
11336
|
+
...layoutProps,
|
|
11337
|
+
className: cn(
|
|
11338
|
+
theme.slots.layoutRoot,
|
|
11339
|
+
fullHeight && theme.slots.layoutRootFull,
|
|
11340
|
+
classNames?.root,
|
|
11341
|
+
className
|
|
11342
|
+
),
|
|
11343
|
+
style: layoutStyle,
|
|
11344
|
+
children: [
|
|
11345
|
+
hasHeader ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11346
|
+
"div",
|
|
11347
|
+
{
|
|
11348
|
+
className: cn(theme.slots.layoutHeader, classNames?.header),
|
|
11349
|
+
style: theme.styles.layoutHeader,
|
|
11350
|
+
children: header
|
|
11351
|
+
}
|
|
11352
|
+
) : null,
|
|
11353
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11354
|
+
"div",
|
|
11355
|
+
{
|
|
11356
|
+
className: cn(theme.slots.layoutBody, classNames?.body),
|
|
11357
|
+
style: bodyStyle,
|
|
11358
|
+
children: [
|
|
11359
|
+
hasSidebar ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11360
|
+
"aside",
|
|
11361
|
+
{
|
|
11362
|
+
className: cn(theme.slots.layoutSidebar, classNames?.sidebar),
|
|
11363
|
+
style: theme.styles.layoutSidebar,
|
|
11364
|
+
children: sidebar
|
|
11365
|
+
}
|
|
11366
|
+
) : null,
|
|
11367
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11368
|
+
"main",
|
|
11369
|
+
{
|
|
11370
|
+
className: cn(theme.slots.layoutMain, classNames?.main),
|
|
11371
|
+
style: theme.styles.layoutMain,
|
|
11372
|
+
children
|
|
11373
|
+
}
|
|
11374
|
+
),
|
|
11375
|
+
hasAside ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11376
|
+
"aside",
|
|
11377
|
+
{
|
|
11378
|
+
className: cn(theme.slots.layoutAside, classNames?.aside),
|
|
11379
|
+
style: theme.styles.layoutAside,
|
|
11380
|
+
children: aside
|
|
11381
|
+
}
|
|
11382
|
+
) : null
|
|
11383
|
+
]
|
|
11384
|
+
}
|
|
11385
|
+
),
|
|
11386
|
+
hasFooter ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11387
|
+
"div",
|
|
11388
|
+
{
|
|
11389
|
+
className: cn(theme.slots.layoutFooter, classNames?.footer),
|
|
11390
|
+
style: theme.styles.layoutFooter,
|
|
11391
|
+
children: footer
|
|
11392
|
+
}
|
|
11393
|
+
) : null
|
|
11394
|
+
]
|
|
11395
|
+
}
|
|
11396
|
+
);
|
|
11397
|
+
}
|
|
11398
|
+
function BaseLayoutPane({
|
|
11399
|
+
as = "div",
|
|
11400
|
+
scrollable = false,
|
|
11401
|
+
bordered = true,
|
|
11402
|
+
surface = "default",
|
|
11403
|
+
children,
|
|
11404
|
+
appearance,
|
|
11405
|
+
className,
|
|
11406
|
+
classNames,
|
|
11407
|
+
style,
|
|
11408
|
+
...paneProps
|
|
11409
|
+
}) {
|
|
11410
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11411
|
+
const Component = as;
|
|
11412
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11413
|
+
Component,
|
|
11414
|
+
{
|
|
11415
|
+
...paneProps,
|
|
11416
|
+
className: cn(
|
|
11417
|
+
theme.slots.layoutPane,
|
|
11418
|
+
scrollable && theme.slots.layoutPaneScrollable,
|
|
11419
|
+
bordered && theme.slots.layoutPaneBordered,
|
|
11420
|
+
surface === "muted" && theme.slots.layoutPaneMuted,
|
|
11421
|
+
surface === "soft" && theme.slots.layoutPaneSoft,
|
|
11422
|
+
surface === "transparent" && theme.slots.layoutPaneTransparent,
|
|
11423
|
+
classNames?.root,
|
|
11424
|
+
className
|
|
11425
|
+
),
|
|
11426
|
+
style: {
|
|
11427
|
+
...theme.styles.layoutPane,
|
|
11428
|
+
...style
|
|
11429
|
+
},
|
|
11430
|
+
children
|
|
11431
|
+
}
|
|
11432
|
+
);
|
|
11433
|
+
}
|
|
11434
|
+
function BaseLayoutResizeHandle({
|
|
11435
|
+
orientation = "horizontal",
|
|
11436
|
+
resizable = false,
|
|
11437
|
+
disabled = false,
|
|
11438
|
+
size,
|
|
11439
|
+
minSize,
|
|
11440
|
+
maxSize,
|
|
11441
|
+
label = "Resize panels",
|
|
11442
|
+
appearance,
|
|
11443
|
+
className,
|
|
11444
|
+
classNames,
|
|
11445
|
+
style,
|
|
11446
|
+
tabIndex,
|
|
11447
|
+
...handleProps
|
|
11448
|
+
}) {
|
|
11449
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11450
|
+
const interactive = resizable && !disabled;
|
|
11451
|
+
const separatorOrientation = getSeparatorOrientation(orientation);
|
|
11452
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11453
|
+
"div",
|
|
11454
|
+
{
|
|
11455
|
+
...handleProps,
|
|
11456
|
+
role: interactive ? "separator" : void 0,
|
|
11457
|
+
"aria-label": interactive ? label : void 0,
|
|
11458
|
+
"aria-orientation": interactive ? separatorOrientation : void 0,
|
|
11459
|
+
"aria-valuemin": interactive ? minSize : void 0,
|
|
11460
|
+
"aria-valuemax": interactive ? maxSize : void 0,
|
|
11461
|
+
"aria-valuenow": interactive ? size : void 0,
|
|
11462
|
+
"aria-disabled": interactive ? void 0 : true,
|
|
11463
|
+
tabIndex: interactive ? tabIndex ?? 0 : void 0,
|
|
11464
|
+
className: cn(
|
|
11465
|
+
theme.slots.layoutResizeHandle,
|
|
11466
|
+
orientation === "horizontal" ? theme.slots.layoutResizeHandleHorizontal : theme.slots.layoutResizeHandleVertical,
|
|
11467
|
+
!interactive && theme.slots.layoutResizeHandleDisabled,
|
|
11468
|
+
classNames?.root,
|
|
11469
|
+
className
|
|
11470
|
+
),
|
|
11471
|
+
style: {
|
|
11472
|
+
...theme.styles.layoutResizeHandle,
|
|
11473
|
+
...style
|
|
11474
|
+
},
|
|
11475
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11476
|
+
"span",
|
|
11477
|
+
{
|
|
11478
|
+
"aria-hidden": "true",
|
|
11479
|
+
className: cn(
|
|
11480
|
+
theme.slots.layoutResizeHandleIndicator,
|
|
11481
|
+
orientation === "horizontal" ? "h-8 w-px" : "h-px w-8",
|
|
11482
|
+
classNames?.indicator
|
|
11483
|
+
)
|
|
11484
|
+
}
|
|
11485
|
+
)
|
|
11486
|
+
}
|
|
11487
|
+
);
|
|
11488
|
+
}
|
|
11489
|
+
function BaseLayoutSplit({
|
|
11490
|
+
orientation = "horizontal",
|
|
11491
|
+
primary,
|
|
11492
|
+
secondary,
|
|
11493
|
+
children,
|
|
11494
|
+
resizable = false,
|
|
11495
|
+
size,
|
|
11496
|
+
defaultSize,
|
|
11497
|
+
minSize,
|
|
11498
|
+
maxSize,
|
|
11499
|
+
gap,
|
|
11500
|
+
keyboardStep,
|
|
11501
|
+
resizeLabel,
|
|
11502
|
+
appearance,
|
|
11503
|
+
className,
|
|
11504
|
+
classNames,
|
|
11505
|
+
style,
|
|
11506
|
+
onSizeChange,
|
|
11507
|
+
...splitProps
|
|
11508
|
+
}) {
|
|
11509
|
+
const theme = resolveBaseAppearance(appearance);
|
|
11510
|
+
const bounds = resolveSplitBounds({ minSize, maxSize, keyboardStep });
|
|
11511
|
+
const initialSize = resolveSplitSize(
|
|
11512
|
+
"defaultSize",
|
|
11513
|
+
defaultSize,
|
|
11514
|
+
DEFAULT_SPLIT_SIZE,
|
|
11515
|
+
bounds.min,
|
|
11516
|
+
bounds.max
|
|
11517
|
+
);
|
|
11518
|
+
const [uncontrolledSize, setUncontrolledSize] = React.useState(initialSize);
|
|
11519
|
+
const rootRef = React.useRef(null);
|
|
11520
|
+
const cleanupRef = React.useRef(null);
|
|
11521
|
+
const controlled = size !== void 0;
|
|
11522
|
+
const renderedSize = resolveSplitSize(
|
|
11523
|
+
"size",
|
|
11524
|
+
controlled ? size : uncontrolledSize,
|
|
11525
|
+
initialSize,
|
|
11526
|
+
bounds.min,
|
|
11527
|
+
bounds.max
|
|
11528
|
+
);
|
|
11529
|
+
const commitSize = React.useCallback(
|
|
11530
|
+
(nextSize) => {
|
|
11531
|
+
const clampedSize = clamp(nextSize, bounds.min, bounds.max);
|
|
11532
|
+
if (!controlled) {
|
|
11533
|
+
setUncontrolledSize(clampedSize);
|
|
11534
|
+
}
|
|
11535
|
+
onSizeChange?.(clampedSize);
|
|
11536
|
+
},
|
|
11537
|
+
[bounds.max, bounds.min, controlled, onSizeChange]
|
|
11538
|
+
);
|
|
11539
|
+
const updateFromPointer = React.useCallback(
|
|
11540
|
+
(event) => {
|
|
11541
|
+
const root = rootRef.current;
|
|
11542
|
+
if (!root) return;
|
|
11543
|
+
const rect = root.getBoundingClientRect();
|
|
11544
|
+
const total = orientation === "horizontal" ? rect.width : rect.height;
|
|
11545
|
+
if (total <= 0) return;
|
|
11546
|
+
const offset = orientation === "horizontal" ? event.clientX - rect.left : event.clientY - rect.top;
|
|
11547
|
+
commitSize(offset / total * 100);
|
|
11548
|
+
},
|
|
11549
|
+
[commitSize, orientation]
|
|
11550
|
+
);
|
|
11551
|
+
const stopResize = React.useCallback(() => {
|
|
11552
|
+
cleanupRef.current?.();
|
|
11553
|
+
cleanupRef.current = null;
|
|
11554
|
+
}, []);
|
|
11555
|
+
React.useEffect(() => stopResize, [stopResize]);
|
|
11556
|
+
const handlePointerDown = (event) => {
|
|
11557
|
+
if (!resizable) return;
|
|
11558
|
+
event.preventDefault();
|
|
11559
|
+
stopResize();
|
|
11560
|
+
updateFromPointer(event);
|
|
11561
|
+
const handleMove = (nextEvent) => {
|
|
11562
|
+
updateFromPointer(nextEvent);
|
|
11563
|
+
};
|
|
11564
|
+
const handleStop = () => {
|
|
11565
|
+
stopResize();
|
|
11566
|
+
};
|
|
11567
|
+
window.addEventListener("pointermove", handleMove);
|
|
11568
|
+
window.addEventListener("pointerup", handleStop, { once: true });
|
|
11569
|
+
window.addEventListener("pointercancel", handleStop, { once: true });
|
|
11570
|
+
cleanupRef.current = () => {
|
|
11571
|
+
window.removeEventListener("pointermove", handleMove);
|
|
11572
|
+
window.removeEventListener("pointerup", handleStop);
|
|
11573
|
+
window.removeEventListener("pointercancel", handleStop);
|
|
11574
|
+
};
|
|
11575
|
+
};
|
|
11576
|
+
const handleKeyDown = (event) => {
|
|
11577
|
+
if (!resizable) return;
|
|
11578
|
+
const step = event.shiftKey ? bounds.keyboardStep * 4 : bounds.keyboardStep;
|
|
11579
|
+
let nextSize;
|
|
11580
|
+
if (event.key === "Home") nextSize = bounds.min;
|
|
11581
|
+
if (event.key === "End") nextSize = bounds.max;
|
|
11582
|
+
if (orientation === "horizontal" && event.key === "ArrowLeft") {
|
|
11583
|
+
nextSize = renderedSize - step;
|
|
11584
|
+
}
|
|
11585
|
+
if (orientation === "horizontal" && event.key === "ArrowRight") {
|
|
11586
|
+
nextSize = renderedSize + step;
|
|
11587
|
+
}
|
|
11588
|
+
if (orientation === "vertical" && event.key === "ArrowUp") {
|
|
11589
|
+
nextSize = renderedSize - step;
|
|
11590
|
+
}
|
|
11591
|
+
if (orientation === "vertical" && event.key === "ArrowDown") {
|
|
11592
|
+
nextSize = renderedSize + step;
|
|
11593
|
+
}
|
|
11594
|
+
if (nextSize === void 0) return;
|
|
11595
|
+
event.preventDefault();
|
|
11596
|
+
commitSize(nextSize);
|
|
11597
|
+
};
|
|
11598
|
+
const resolvedGap = gap !== void 0 ? toCssSize(gap, "0px") : void 0;
|
|
11599
|
+
const resizeTrack = resolvedGap !== void 0 ? "var(--base-layout-split-gap)" : "auto";
|
|
11600
|
+
const resizeHandleStyle = resolvedGap !== void 0 ? orientation === "horizontal" ? { width: "var(--base-layout-split-gap)" } : { height: "var(--base-layout-split-gap)" } : void 0;
|
|
11601
|
+
const splitStyle = {
|
|
11602
|
+
...theme.styles.layoutSplit,
|
|
11603
|
+
[orientation === "horizontal" ? "gridTemplateColumns" : "gridTemplateRows"]: resizable ? `${renderedSize}% ${resizeTrack} minmax(0, 1fr)` : `${renderedSize}% minmax(0, 1fr)`,
|
|
11604
|
+
...resizable ? { gap: 0 } : {},
|
|
11605
|
+
...resolvedGap !== void 0 ? {
|
|
11606
|
+
"--base-layout-split-gap": resolvedGap,
|
|
11607
|
+
...resizable ? {} : { gap: resolvedGap }
|
|
11608
|
+
} : {},
|
|
11609
|
+
...style
|
|
11610
|
+
};
|
|
11611
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11612
|
+
"div",
|
|
11613
|
+
{
|
|
11614
|
+
...splitProps,
|
|
11615
|
+
ref: rootRef,
|
|
11616
|
+
className: cn(
|
|
11617
|
+
theme.slots.layoutSplitRoot,
|
|
11618
|
+
orientation === "horizontal" ? theme.slots.layoutSplitHorizontal : theme.slots.layoutSplitVertical,
|
|
11619
|
+
classNames?.root,
|
|
11620
|
+
className
|
|
11621
|
+
),
|
|
11622
|
+
style: splitStyle,
|
|
11623
|
+
children: [
|
|
11624
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11625
|
+
"div",
|
|
11626
|
+
{
|
|
11627
|
+
className: cn(
|
|
11628
|
+
theme.slots.layoutSplitPane,
|
|
11629
|
+
theme.slots.layoutSplitPrimary,
|
|
11630
|
+
classNames?.primary
|
|
11631
|
+
),
|
|
11632
|
+
style: theme.styles.layoutSplitPane,
|
|
11633
|
+
children: hasRenderableNode(primary) ? primary : children
|
|
11634
|
+
}
|
|
11635
|
+
),
|
|
11636
|
+
resizable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11637
|
+
BaseLayoutResizeHandle,
|
|
11638
|
+
{
|
|
11639
|
+
orientation,
|
|
11640
|
+
resizable: true,
|
|
11641
|
+
size: renderedSize,
|
|
11642
|
+
minSize: bounds.min,
|
|
11643
|
+
maxSize: bounds.max,
|
|
11644
|
+
label: resizeLabel,
|
|
11645
|
+
appearance,
|
|
11646
|
+
className: classNames?.handle,
|
|
11647
|
+
style: resizeHandleStyle,
|
|
11648
|
+
onPointerDown: handlePointerDown,
|
|
11649
|
+
onKeyDown: handleKeyDown
|
|
11650
|
+
}
|
|
11651
|
+
) : null,
|
|
11652
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11653
|
+
"div",
|
|
11654
|
+
{
|
|
11655
|
+
className: cn(
|
|
11656
|
+
theme.slots.layoutSplitPane,
|
|
11657
|
+
theme.slots.layoutSplitSecondary,
|
|
11658
|
+
classNames?.secondary
|
|
11659
|
+
),
|
|
11660
|
+
style: theme.styles.layoutSplitPane,
|
|
11661
|
+
children: secondary
|
|
11662
|
+
}
|
|
11663
|
+
)
|
|
11664
|
+
]
|
|
11665
|
+
}
|
|
11666
|
+
);
|
|
11667
|
+
}
|
|
11160
11668
|
function DefaultLoadingIcon({ className }) {
|
|
11161
11669
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11162
11670
|
"svg",
|
|
@@ -11446,7 +11954,7 @@ function BasePagination({
|
|
|
11446
11954
|
function toFiniteNumber(value, fallback) {
|
|
11447
11955
|
return Number.isFinite(value) ? Number(value) : fallback;
|
|
11448
11956
|
}
|
|
11449
|
-
function
|
|
11957
|
+
function clamp2(value, min5, max5) {
|
|
11450
11958
|
return Math.min(Math.max(value, min5), max5);
|
|
11451
11959
|
}
|
|
11452
11960
|
function BaseProgress({
|
|
@@ -11464,7 +11972,7 @@ function BaseProgress({
|
|
|
11464
11972
|
}) {
|
|
11465
11973
|
const theme = resolveBaseAppearance(appearance);
|
|
11466
11974
|
const safeMax = Math.max(toFiniteNumber(max5, 100), 1);
|
|
11467
|
-
const safeValue =
|
|
11975
|
+
const safeValue = clamp2(toFiniteNumber(value, 0), 0, safeMax);
|
|
11468
11976
|
const percent = safeValue / safeMax * 100;
|
|
11469
11977
|
const renderedValue = valueFormatter?.(safeValue, safeMax) ?? `${Math.round(percent)}%`;
|
|
11470
11978
|
const hasLabelRow = hasRenderableNode(label) || showValue;
|
|
@@ -12230,7 +12738,7 @@ function useBaseTableContext(appearance) {
|
|
|
12230
12738
|
}
|
|
12231
12739
|
};
|
|
12232
12740
|
}
|
|
12233
|
-
function
|
|
12741
|
+
function toCssSize2(value) {
|
|
12234
12742
|
if (value === void 0) return void 0;
|
|
12235
12743
|
return typeof value === "number" ? `${value}px` : value;
|
|
12236
12744
|
}
|
|
@@ -12443,7 +12951,7 @@ function BaseTableRow({
|
|
|
12443
12951
|
}
|
|
12444
12952
|
);
|
|
12445
12953
|
}
|
|
12446
|
-
|
|
12954
|
+
var BaseTableHead = React.forwardRef(function BaseTableHead2({
|
|
12447
12955
|
columnId,
|
|
12448
12956
|
align = "left",
|
|
12449
12957
|
icon,
|
|
@@ -12471,10 +12979,18 @@ function BaseTableHead({
|
|
|
12471
12979
|
onDragOver,
|
|
12472
12980
|
onDrop,
|
|
12473
12981
|
...headProps
|
|
12474
|
-
}) {
|
|
12982
|
+
}, forwardedRef) {
|
|
12475
12983
|
const tableContext = useBaseTableContext(appearance);
|
|
12476
12984
|
const { theme } = tableContext;
|
|
12477
12985
|
const headRef = React.useRef(null);
|
|
12986
|
+
const setHeadRef = (node) => {
|
|
12987
|
+
headRef.current = node;
|
|
12988
|
+
if (typeof forwardedRef === "function") {
|
|
12989
|
+
forwardedRef(node);
|
|
12990
|
+
} else if (forwardedRef) {
|
|
12991
|
+
forwardedRef.current = node;
|
|
12992
|
+
}
|
|
12993
|
+
};
|
|
12478
12994
|
const controlledWidth = columnId && tableContext.columnSizes?.[columnId] !== void 0 ? tableContext.columnSizes[columnId] : width;
|
|
12479
12995
|
const canDrag = Boolean(
|
|
12480
12996
|
columnId && draggable !== false && (draggable || tableContext.columnDragEnabled) && tableContext.columnOrder && tableContext.onColumnOrderChange
|
|
@@ -12629,7 +13145,7 @@ function BaseTableHead({
|
|
|
12629
13145
|
"th",
|
|
12630
13146
|
{
|
|
12631
13147
|
...headProps,
|
|
12632
|
-
ref:
|
|
13148
|
+
ref: setHeadRef,
|
|
12633
13149
|
scope: headProps.scope ?? "col",
|
|
12634
13150
|
"aria-sort": ariaSort,
|
|
12635
13151
|
className: cn(
|
|
@@ -12641,9 +13157,9 @@ function BaseTableHead({
|
|
|
12641
13157
|
),
|
|
12642
13158
|
style: {
|
|
12643
13159
|
...theme.styles.tableHead,
|
|
12644
|
-
width:
|
|
12645
|
-
minWidth:
|
|
12646
|
-
maxWidth:
|
|
13160
|
+
width: toCssSize2(controlledWidth),
|
|
13161
|
+
minWidth: toCssSize2(minWidth),
|
|
13162
|
+
maxWidth: toCssSize2(maxWidth),
|
|
12647
13163
|
...style
|
|
12648
13164
|
},
|
|
12649
13165
|
onDragOver: handleDragOver,
|
|
@@ -12664,7 +13180,7 @@ function BaseTableHead({
|
|
|
12664
13180
|
]
|
|
12665
13181
|
}
|
|
12666
13182
|
);
|
|
12667
|
-
}
|
|
13183
|
+
});
|
|
12668
13184
|
function BaseTableCell({
|
|
12669
13185
|
align = "left",
|
|
12670
13186
|
appearance,
|
|
@@ -12792,7 +13308,7 @@ function BaseTableLoading({
|
|
|
12792
13308
|
classNames?.skeleton
|
|
12793
13309
|
),
|
|
12794
13310
|
style: {
|
|
12795
|
-
width:
|
|
13311
|
+
width: toCssSize2(columnWidths[columnIndex])
|
|
12796
13312
|
}
|
|
12797
13313
|
}
|
|
12798
13314
|
)
|
|
@@ -15807,7 +16323,7 @@ var DEFAULT_ZOOM_STEP = 1.18;
|
|
|
15807
16323
|
var DEFAULT_STAGE_PADDING = 16;
|
|
15808
16324
|
var MAX_SAFE_SCALE = 1e6;
|
|
15809
16325
|
var MIN_SAFE_SCALE = 1e-6;
|
|
15810
|
-
var
|
|
16326
|
+
var clamp3 = (value, min5, max5) => Math.min(max5, Math.max(min5, value));
|
|
15811
16327
|
var isNoDragTarget = (target) => target instanceof Element && Boolean(target.closest('[data-no-drag="true"]'));
|
|
15812
16328
|
function ResetIcon() {
|
|
15813
16329
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -15931,7 +16447,7 @@ function DataExplorerImagePreview({
|
|
|
15931
16447
|
availableWidth / size.width,
|
|
15932
16448
|
availableHeight / size.height
|
|
15933
16449
|
);
|
|
15934
|
-
const nextScale =
|
|
16450
|
+
const nextScale = clamp3(
|
|
15935
16451
|
fitScale,
|
|
15936
16452
|
normalizedMinScale,
|
|
15937
16453
|
normalizedMaxScale
|
|
@@ -15985,7 +16501,7 @@ function DataExplorerImagePreview({
|
|
|
15985
16501
|
if (!Number.isFinite(factor) || factor === 1) return;
|
|
15986
16502
|
if (!Number.isFinite(stageX) || !Number.isFinite(stageY)) return;
|
|
15987
16503
|
setView((current) => {
|
|
15988
|
-
const nextScale =
|
|
16504
|
+
const nextScale = clamp3(
|
|
15989
16505
|
current.scale * factor,
|
|
15990
16506
|
normalizedMinScale,
|
|
15991
16507
|
normalizedMaxScale
|
|
@@ -21326,7 +21842,7 @@ function getWorkbenchIconComponent(icon) {
|
|
|
21326
21842
|
if (!icon || !isWorkbenchIconComponent(icon)) return null;
|
|
21327
21843
|
return icon;
|
|
21328
21844
|
}
|
|
21329
|
-
function
|
|
21845
|
+
function toCssSize3(value) {
|
|
21330
21846
|
if (value === void 0) return void 0;
|
|
21331
21847
|
return typeof value === "number" ? `${value}px` : value;
|
|
21332
21848
|
}
|
|
@@ -21475,7 +21991,7 @@ function WorkbenchTableView({
|
|
|
21475
21991
|
"div",
|
|
21476
21992
|
{
|
|
21477
21993
|
className: cn("w-full overflow-auto", classNames?.scrollArea),
|
|
21478
|
-
style: { maxHeight:
|
|
21994
|
+
style: { maxHeight: toCssSize3(bodyMaxHeight) },
|
|
21479
21995
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21480
21996
|
BaseTable,
|
|
21481
21997
|
{
|
|
@@ -21621,6 +22137,659 @@ function WorkbenchTableView({
|
|
|
21621
22137
|
}
|
|
21622
22138
|
);
|
|
21623
22139
|
}
|
|
22140
|
+
function toCssSize4(value) {
|
|
22141
|
+
if (value === void 0) return void 0;
|
|
22142
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
22143
|
+
}
|
|
22144
|
+
function isBrowser() {
|
|
22145
|
+
return typeof window !== "undefined";
|
|
22146
|
+
}
|
|
22147
|
+
function defaultGetRowKey2(row, rowIndex) {
|
|
22148
|
+
return row?.id ?? row?.key ?? rowIndex;
|
|
22149
|
+
}
|
|
22150
|
+
function getColumnDefaultSize(column) {
|
|
22151
|
+
if (typeof column.width === "number") return column.width;
|
|
22152
|
+
if (typeof column.minWidth === "number") return column.minWidth;
|
|
22153
|
+
return 160;
|
|
22154
|
+
}
|
|
22155
|
+
function buildDefaultColumnSizes(columns, explicit) {
|
|
22156
|
+
return columns.reduce((acc, column) => {
|
|
22157
|
+
acc[column.key] = explicit?.[column.key] ?? getColumnDefaultSize(column);
|
|
22158
|
+
return acc;
|
|
22159
|
+
}, {});
|
|
22160
|
+
}
|
|
22161
|
+
function loadStoredColumnSizes(storageKey, defaults) {
|
|
22162
|
+
if (!storageKey || !isBrowser()) return defaults;
|
|
22163
|
+
try {
|
|
22164
|
+
const parsed = JSON.parse(window.localStorage.getItem(storageKey) || "{}");
|
|
22165
|
+
return Object.keys(defaults).reduce((acc, key) => {
|
|
22166
|
+
const value = Number(parsed?.[key]);
|
|
22167
|
+
acc[key] = Number.isFinite(value) ? value : defaults[key];
|
|
22168
|
+
return acc;
|
|
22169
|
+
}, {});
|
|
22170
|
+
} catch {
|
|
22171
|
+
return defaults;
|
|
22172
|
+
}
|
|
22173
|
+
}
|
|
22174
|
+
function persistColumnSizes(storageKey, sizes) {
|
|
22175
|
+
if (!storageKey || !isBrowser()) return;
|
|
22176
|
+
window.localStorage.setItem(storageKey, JSON.stringify(sizes));
|
|
22177
|
+
}
|
|
22178
|
+
function getFrozenColumnStorageKey(storageKey) {
|
|
22179
|
+
return storageKey ? `${storageKey}.frozenColumnCount` : void 0;
|
|
22180
|
+
}
|
|
22181
|
+
function getFrozenEndColumnStorageKey(storageKey) {
|
|
22182
|
+
return storageKey ? `${storageKey}.frozenEndColumnCount` : void 0;
|
|
22183
|
+
}
|
|
22184
|
+
function clampFrozenColumnCount(count, columnCount) {
|
|
22185
|
+
if (!Number.isFinite(count)) return 0;
|
|
22186
|
+
return Math.max(0, Math.min(Math.round(count), columnCount));
|
|
22187
|
+
}
|
|
22188
|
+
function normalizeFrozenColumnCounts(startCount, endCount, columnCount) {
|
|
22189
|
+
const normalizedStartCount = clampFrozenColumnCount(startCount, columnCount);
|
|
22190
|
+
const normalizedEndCount = clampFrozenColumnCount(endCount, Math.max(0, columnCount - normalizedStartCount));
|
|
22191
|
+
return {
|
|
22192
|
+
startCount: normalizedStartCount,
|
|
22193
|
+
endCount: normalizedEndCount
|
|
22194
|
+
};
|
|
22195
|
+
}
|
|
22196
|
+
function loadStoredFrozenColumnCount(storageKey, defaultCount, columnCount) {
|
|
22197
|
+
const fallback = clampFrozenColumnCount(defaultCount, columnCount);
|
|
22198
|
+
const frozenStorageKey = getFrozenColumnStorageKey(storageKey);
|
|
22199
|
+
if (!frozenStorageKey || !isBrowser()) return fallback;
|
|
22200
|
+
try {
|
|
22201
|
+
const storedValue = window.localStorage.getItem(frozenStorageKey);
|
|
22202
|
+
if (storedValue === null) return fallback;
|
|
22203
|
+
const value = Number(storedValue);
|
|
22204
|
+
return Number.isFinite(value) ? clampFrozenColumnCount(value, columnCount) : fallback;
|
|
22205
|
+
} catch {
|
|
22206
|
+
return fallback;
|
|
22207
|
+
}
|
|
22208
|
+
}
|
|
22209
|
+
function persistFrozenColumnCount(storageKey, count) {
|
|
22210
|
+
const frozenStorageKey = getFrozenColumnStorageKey(storageKey);
|
|
22211
|
+
if (!frozenStorageKey || !isBrowser()) return;
|
|
22212
|
+
window.localStorage.setItem(frozenStorageKey, String(count));
|
|
22213
|
+
}
|
|
22214
|
+
function loadStoredFrozenEndColumnCount(storageKey, defaultCount, columnCount) {
|
|
22215
|
+
const fallback = clampFrozenColumnCount(defaultCount, columnCount);
|
|
22216
|
+
const frozenStorageKey = getFrozenEndColumnStorageKey(storageKey);
|
|
22217
|
+
if (!frozenStorageKey || !isBrowser()) return fallback;
|
|
22218
|
+
try {
|
|
22219
|
+
const storedValue = window.localStorage.getItem(frozenStorageKey);
|
|
22220
|
+
if (storedValue === null) return fallback;
|
|
22221
|
+
const value = Number(storedValue);
|
|
22222
|
+
return Number.isFinite(value) ? clampFrozenColumnCount(value, columnCount) : fallback;
|
|
22223
|
+
} catch {
|
|
22224
|
+
return fallback;
|
|
22225
|
+
}
|
|
22226
|
+
}
|
|
22227
|
+
function persistFrozenEndColumnCount(storageKey, count) {
|
|
22228
|
+
const frozenStorageKey = getFrozenEndColumnStorageKey(storageKey);
|
|
22229
|
+
if (!frozenStorageKey || !isBrowser()) return;
|
|
22230
|
+
window.localStorage.setItem(frozenStorageKey, String(count));
|
|
22231
|
+
}
|
|
22232
|
+
function normalizeColumnOrder2(columnKeys, columnOrder) {
|
|
22233
|
+
const validColumnKeys = new Set(columnKeys);
|
|
22234
|
+
const orderedKeys = (columnOrder || []).filter((columnKey) => validColumnKeys.has(columnKey));
|
|
22235
|
+
const orderedKeySet = new Set(orderedKeys);
|
|
22236
|
+
const remainingKeys = columnKeys.filter((columnKey) => !orderedKeySet.has(columnKey));
|
|
22237
|
+
return [...orderedKeys, ...remainingKeys];
|
|
22238
|
+
}
|
|
22239
|
+
function getOrderedColumns2(columns, columnOrder) {
|
|
22240
|
+
const normalizedOrder = normalizeColumnOrder2(columns.map((column) => column.key), columnOrder);
|
|
22241
|
+
const columnMap = new Map(columns.map((column) => [column.key, column]));
|
|
22242
|
+
return normalizedOrder.map((columnKey) => columnMap.get(columnKey)).filter(Boolean);
|
|
22243
|
+
}
|
|
22244
|
+
function getColumnNumericWidth(column, columnSizes) {
|
|
22245
|
+
const controlledWidth = columnSizes[column.key];
|
|
22246
|
+
if (typeof controlledWidth === "number") return controlledWidth;
|
|
22247
|
+
return getColumnDefaultSize(column);
|
|
22248
|
+
}
|
|
22249
|
+
function buildFrozenOffsets(columns, columnSizes, frozenColumnCount) {
|
|
22250
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
22251
|
+
let left = 0;
|
|
22252
|
+
columns.slice(0, Math.max(0, frozenColumnCount)).forEach((column) => {
|
|
22253
|
+
offsets.set(column.key, left);
|
|
22254
|
+
left += getColumnNumericWidth(column, columnSizes);
|
|
22255
|
+
});
|
|
22256
|
+
return offsets;
|
|
22257
|
+
}
|
|
22258
|
+
function buildFrozenEndOffsets(columns, columnSizes, frozenEndColumnCount) {
|
|
22259
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
22260
|
+
let right = 0;
|
|
22261
|
+
columns.slice(Math.max(0, columns.length - frozenEndColumnCount)).reverse().forEach((column) => {
|
|
22262
|
+
offsets.set(column.key, right);
|
|
22263
|
+
right += getColumnNumericWidth(column, columnSizes);
|
|
22264
|
+
});
|
|
22265
|
+
return offsets;
|
|
22266
|
+
}
|
|
22267
|
+
function resolveRowClassName(rowClassName, row, rowIndex) {
|
|
22268
|
+
return typeof rowClassName === "function" ? rowClassName(row, rowIndex) : rowClassName;
|
|
22269
|
+
}
|
|
22270
|
+
function renderDefaultCell(column, row) {
|
|
22271
|
+
const value = row?.[column.key];
|
|
22272
|
+
if (value === void 0 || value === null || value === "") return "\u2014";
|
|
22273
|
+
return String(value);
|
|
22274
|
+
}
|
|
22275
|
+
function InteractiveTableCellContent({
|
|
22276
|
+
children,
|
|
22277
|
+
wrap
|
|
22278
|
+
}) {
|
|
22279
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22280
|
+
"div",
|
|
22281
|
+
{
|
|
22282
|
+
className: cn(
|
|
22283
|
+
"min-w-0 max-w-full overflow-auto overscroll-contain [scrollbar-width:thin]",
|
|
22284
|
+
wrap ? "max-h-20 whitespace-pre-wrap break-words leading-5" : "whitespace-nowrap"
|
|
22285
|
+
),
|
|
22286
|
+
children
|
|
22287
|
+
}
|
|
22288
|
+
);
|
|
22289
|
+
}
|
|
22290
|
+
function PinIcon({ className }) {
|
|
22291
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
22292
|
+
"svg",
|
|
22293
|
+
{
|
|
22294
|
+
"aria-hidden": "true",
|
|
22295
|
+
viewBox: "0 0 16 16",
|
|
22296
|
+
className,
|
|
22297
|
+
fill: "none",
|
|
22298
|
+
stroke: "currentColor",
|
|
22299
|
+
strokeLinecap: "round",
|
|
22300
|
+
strokeLinejoin: "round",
|
|
22301
|
+
strokeWidth: "1.75",
|
|
22302
|
+
children: [
|
|
22303
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5.25 2.75h5.5" }),
|
|
22304
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.25 2.75v4L4.5 9.25h7L9.75 6.75v-4" }),
|
|
22305
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 9.25v4" })
|
|
22306
|
+
]
|
|
22307
|
+
}
|
|
22308
|
+
);
|
|
22309
|
+
}
|
|
22310
|
+
function InteractiveTable({
|
|
22311
|
+
rows = [],
|
|
22312
|
+
columns = [],
|
|
22313
|
+
pinnedTopRows = [],
|
|
22314
|
+
getRowKey = defaultGetRowKey2,
|
|
22315
|
+
getPinnedTopRowKey = defaultGetRowKey2,
|
|
22316
|
+
renderCell,
|
|
22317
|
+
renderPinnedTopCell,
|
|
22318
|
+
renderColumnHeader,
|
|
22319
|
+
onRowClick,
|
|
22320
|
+
getRowState,
|
|
22321
|
+
rowClassName,
|
|
22322
|
+
pinnedTopRowClassName,
|
|
22323
|
+
emptyState = "\u2014",
|
|
22324
|
+
columnMenuLabels,
|
|
22325
|
+
columnStorageKey,
|
|
22326
|
+
columnOrder,
|
|
22327
|
+
columnSizes,
|
|
22328
|
+
defaultColumnSizes,
|
|
22329
|
+
columnDragEnabled = false,
|
|
22330
|
+
columnResizeEnabled = true,
|
|
22331
|
+
frozenColumnCount = 0,
|
|
22332
|
+
frozenEndColumnCount = 0,
|
|
22333
|
+
tableMinWidth,
|
|
22334
|
+
bodyMaxHeight = "min(60vh, 42rem)",
|
|
22335
|
+
appearance,
|
|
22336
|
+
className,
|
|
22337
|
+
tableClassName,
|
|
22338
|
+
classNames,
|
|
22339
|
+
style,
|
|
22340
|
+
onColumnOrderChange,
|
|
22341
|
+
onColumnSizeChange,
|
|
22342
|
+
onResetColumnSizes,
|
|
22343
|
+
onFrozenColumnCountChange,
|
|
22344
|
+
onFrozenEndColumnCountChange,
|
|
22345
|
+
onSort
|
|
22346
|
+
}) {
|
|
22347
|
+
const columnKeySignature = columns.map((column) => column.key).join("");
|
|
22348
|
+
const defaultOrder = React.useMemo(
|
|
22349
|
+
() => columnKeySignature ? columnKeySignature.split("") : [],
|
|
22350
|
+
[columnKeySignature]
|
|
22351
|
+
);
|
|
22352
|
+
const defaultSizes = React.useMemo(
|
|
22353
|
+
() => buildDefaultColumnSizes(columns, defaultColumnSizes),
|
|
22354
|
+
[columns, defaultColumnSizes]
|
|
22355
|
+
);
|
|
22356
|
+
const [internalColumnOrder, setInternalColumnOrder] = React.useState(defaultOrder);
|
|
22357
|
+
const [internalColumnSizes, setInternalColumnSizes] = React.useState(() => loadStoredColumnSizes(columnStorageKey, defaultSizes));
|
|
22358
|
+
const [internalFrozenColumnCount, setInternalFrozenColumnCount] = React.useState(() => loadStoredFrozenColumnCount(columnStorageKey, frozenColumnCount, columns.length));
|
|
22359
|
+
const [internalFrozenEndColumnCount, setInternalFrozenEndColumnCount] = React.useState(() => loadStoredFrozenEndColumnCount(columnStorageKey, frozenEndColumnCount, columns.length));
|
|
22360
|
+
React.useEffect(() => {
|
|
22361
|
+
setInternalColumnOrder((current) => normalizeColumnOrder2(defaultOrder, current));
|
|
22362
|
+
}, [defaultOrder]);
|
|
22363
|
+
React.useEffect(() => {
|
|
22364
|
+
if (columnSizes) return;
|
|
22365
|
+
setInternalColumnSizes(loadStoredColumnSizes(columnStorageKey, defaultSizes));
|
|
22366
|
+
}, [columnSizes, columnStorageKey, defaultSizes]);
|
|
22367
|
+
React.useEffect(() => {
|
|
22368
|
+
setInternalFrozenColumnCount(loadStoredFrozenColumnCount(columnStorageKey, frozenColumnCount, columns.length));
|
|
22369
|
+
}, [columnStorageKey, columns.length, frozenColumnCount]);
|
|
22370
|
+
React.useEffect(() => {
|
|
22371
|
+
setInternalFrozenEndColumnCount(loadStoredFrozenEndColumnCount(columnStorageKey, frozenEndColumnCount, columns.length));
|
|
22372
|
+
}, [columnStorageKey, columns.length, frozenEndColumnCount]);
|
|
22373
|
+
const resolvedColumnOrder = columnOrder ? normalizeColumnOrder2(defaultOrder, columnOrder) : internalColumnOrder;
|
|
22374
|
+
const resolvedColumnSizes = columnSizes ?? internalColumnSizes;
|
|
22375
|
+
const orderedColumns = getOrderedColumns2(columns, resolvedColumnOrder);
|
|
22376
|
+
const {
|
|
22377
|
+
startCount: resolvedFrozenColumnCount,
|
|
22378
|
+
endCount: resolvedFrozenEndColumnCount
|
|
22379
|
+
} = normalizeFrozenColumnCounts(internalFrozenColumnCount, internalFrozenEndColumnCount, orderedColumns.length);
|
|
22380
|
+
const frozenOffsets = buildFrozenOffsets(orderedColumns, resolvedColumnSizes, resolvedFrozenColumnCount);
|
|
22381
|
+
const frozenEndOffsets = buildFrozenEndOffsets(orderedColumns, resolvedColumnSizes, resolvedFrozenEndColumnCount);
|
|
22382
|
+
const resolvedMinWidth = tableMinWidth ?? Math.max(760, orderedColumns.reduce((total, column) => total + getColumnNumericWidth(column, resolvedColumnSizes), 0));
|
|
22383
|
+
const labels = {
|
|
22384
|
+
columnActions: columnMenuLabels?.columnActions ?? "Column actions",
|
|
22385
|
+
freezeColumn: columnMenuLabels?.freezeColumn ?? "Freeze to left",
|
|
22386
|
+
freezeEndColumn: columnMenuLabels?.freezeEndColumn ?? "Freeze to right",
|
|
22387
|
+
unfreezeColumn: columnMenuLabels?.unfreezeColumn ?? "Unfreeze from left",
|
|
22388
|
+
unfreezeEndColumn: columnMenuLabels?.unfreezeEndColumn ?? "Unfreeze from right",
|
|
22389
|
+
unfreezeAllColumns: columnMenuLabels?.unfreezeAllColumns ?? "Unfreeze all columns",
|
|
22390
|
+
resetColumnWidth: columnMenuLabels?.resetColumnWidth ?? "Reset column width",
|
|
22391
|
+
frozenColumnTitle: columnMenuLabels?.frozenColumnTitle ?? "Frozen column"
|
|
22392
|
+
};
|
|
22393
|
+
const handleColumnOrderChange = React.useCallback((nextOrder, detail) => {
|
|
22394
|
+
const normalizedOrder = normalizeColumnOrder2(defaultOrder, nextOrder);
|
|
22395
|
+
if (!columnOrder) {
|
|
22396
|
+
setInternalColumnOrder(normalizedOrder);
|
|
22397
|
+
}
|
|
22398
|
+
onColumnOrderChange?.(normalizedOrder, detail);
|
|
22399
|
+
}, [columnOrder, defaultOrder, onColumnOrderChange]);
|
|
22400
|
+
const handleColumnSizeChange = React.useCallback((columnId, width, detail) => {
|
|
22401
|
+
const column = columns.find((item) => item.key === columnId);
|
|
22402
|
+
const minWidth = column?.minWidth;
|
|
22403
|
+
const maxWidth = column?.maxWidth;
|
|
22404
|
+
const nextWidth = Math.max(
|
|
22405
|
+
typeof minWidth === "number" ? minWidth : 0,
|
|
22406
|
+
Math.min(width, typeof maxWidth === "number" ? maxWidth : Number.POSITIVE_INFINITY)
|
|
22407
|
+
);
|
|
22408
|
+
const nextSizes = {
|
|
22409
|
+
...resolvedColumnSizes,
|
|
22410
|
+
[columnId]: nextWidth
|
|
22411
|
+
};
|
|
22412
|
+
if (!columnSizes) {
|
|
22413
|
+
setInternalColumnSizes(nextSizes);
|
|
22414
|
+
}
|
|
22415
|
+
persistColumnSizes(columnStorageKey, nextSizes);
|
|
22416
|
+
onColumnSizeChange?.(columnId, nextWidth, detail);
|
|
22417
|
+
}, [columnSizes, columnStorageKey, columns, onColumnSizeChange, resolvedColumnSizes]);
|
|
22418
|
+
const handleResetColumnSize = React.useCallback((column) => {
|
|
22419
|
+
const nextWidth = defaultSizes[column.key] ?? getColumnDefaultSize(column);
|
|
22420
|
+
const previousWidth = getColumnNumericWidth(column, resolvedColumnSizes);
|
|
22421
|
+
const nextSizes = {
|
|
22422
|
+
...resolvedColumnSizes,
|
|
22423
|
+
[column.key]: nextWidth
|
|
22424
|
+
};
|
|
22425
|
+
if (!columnSizes) {
|
|
22426
|
+
setInternalColumnSizes(nextSizes);
|
|
22427
|
+
}
|
|
22428
|
+
persistColumnSizes(columnStorageKey, nextSizes);
|
|
22429
|
+
onColumnSizeChange?.(column.key, nextWidth, {
|
|
22430
|
+
columnId: column.key,
|
|
22431
|
+
previousWidth,
|
|
22432
|
+
minWidth: column.minWidth,
|
|
22433
|
+
maxWidth: column.maxWidth
|
|
22434
|
+
});
|
|
22435
|
+
onResetColumnSizes?.(nextSizes);
|
|
22436
|
+
}, [columnSizes, columnStorageKey, defaultSizes, onColumnSizeChange, onResetColumnSizes, resolvedColumnSizes]);
|
|
22437
|
+
const setFrozenColumnCount = React.useCallback((nextCount) => {
|
|
22438
|
+
const normalizedCount = clampFrozenColumnCount(nextCount, Math.max(0, orderedColumns.length - resolvedFrozenEndColumnCount));
|
|
22439
|
+
setInternalFrozenColumnCount(normalizedCount);
|
|
22440
|
+
persistFrozenColumnCount(columnStorageKey, normalizedCount);
|
|
22441
|
+
onFrozenColumnCountChange?.(normalizedCount);
|
|
22442
|
+
}, [columnStorageKey, onFrozenColumnCountChange, orderedColumns.length, resolvedFrozenEndColumnCount]);
|
|
22443
|
+
const setFrozenEndColumnCount = React.useCallback((nextCount) => {
|
|
22444
|
+
const normalizedCount = clampFrozenColumnCount(nextCount, Math.max(0, orderedColumns.length - resolvedFrozenColumnCount));
|
|
22445
|
+
setInternalFrozenEndColumnCount(normalizedCount);
|
|
22446
|
+
persistFrozenEndColumnCount(columnStorageKey, normalizedCount);
|
|
22447
|
+
onFrozenEndColumnCountChange?.(normalizedCount);
|
|
22448
|
+
}, [columnStorageKey, onFrozenEndColumnCountChange, orderedColumns.length, resolvedFrozenColumnCount]);
|
|
22449
|
+
const getFrozenPosition = (columnIndex) => {
|
|
22450
|
+
if (columnIndex < resolvedFrozenColumnCount) return "start";
|
|
22451
|
+
if (columnIndex >= orderedColumns.length - resolvedFrozenEndColumnCount) return "end";
|
|
22452
|
+
return void 0;
|
|
22453
|
+
};
|
|
22454
|
+
const getFrozenClassName = (column, columnIndex, isHeader = false) => {
|
|
22455
|
+
const position = getFrozenPosition(columnIndex);
|
|
22456
|
+
if (!position) return void 0;
|
|
22457
|
+
return cn(
|
|
22458
|
+
"sticky",
|
|
22459
|
+
position === "start" ? "shadow-[1px_0_0_0_hsl(var(--border)/0.45)]" : "shadow-[-1px_0_0_0_hsl(var(--border)/0.45)]",
|
|
22460
|
+
isHeader ? "bg-muted/60" : "bg-inherit",
|
|
22461
|
+
isHeader ? "z-40" : "z-20",
|
|
22462
|
+
(columnIndex === 0 || columnIndex === orderedColumns.length - 1) && (isHeader ? "z-50" : "z-30")
|
|
22463
|
+
);
|
|
22464
|
+
};
|
|
22465
|
+
const getFrozenStyle = (column, columnIndex) => {
|
|
22466
|
+
const position = getFrozenPosition(columnIndex);
|
|
22467
|
+
if (position === "start") return { left: frozenOffsets.get(column.key) ?? 0 };
|
|
22468
|
+
if (position === "end") return { right: frozenEndOffsets.get(column.key) ?? 0 };
|
|
22469
|
+
return void 0;
|
|
22470
|
+
};
|
|
22471
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22472
|
+
BaseTableContainer,
|
|
22473
|
+
{
|
|
22474
|
+
appearance,
|
|
22475
|
+
className: cn("flex h-full min-h-0 flex-col overflow-hidden rounded-lg border border-border/60 bg-card", classNames?.root, className),
|
|
22476
|
+
style,
|
|
22477
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22478
|
+
"div",
|
|
22479
|
+
{
|
|
22480
|
+
className: cn("min-h-0 flex-1 overflow-auto", classNames?.scrollArea),
|
|
22481
|
+
style: { maxHeight: toCssSize4(bodyMaxHeight) },
|
|
22482
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
22483
|
+
BaseTable,
|
|
22484
|
+
{
|
|
22485
|
+
appearance,
|
|
22486
|
+
columnOrder: resolvedColumnOrder,
|
|
22487
|
+
columnSizes: resolvedColumnSizes,
|
|
22488
|
+
columnDragEnabled,
|
|
22489
|
+
columnResizeEnabled,
|
|
22490
|
+
onColumnOrderChange: handleColumnOrderChange,
|
|
22491
|
+
onColumnSizeChange: handleColumnSizeChange,
|
|
22492
|
+
className: cn("w-full table-fixed text-left text-xs", classNames?.table, tableClassName),
|
|
22493
|
+
style: { minWidth: resolvedMinWidth },
|
|
22494
|
+
children: [
|
|
22495
|
+
/* @__PURE__ */ jsxRuntime.jsx("colgroup", { children: orderedColumns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
22496
|
+
"col",
|
|
22497
|
+
{
|
|
22498
|
+
style: {
|
|
22499
|
+
width: toCssSize4(resolvedColumnSizes[column.key] ?? column.width),
|
|
22500
|
+
minWidth: toCssSize4(column.minWidth)
|
|
22501
|
+
}
|
|
22502
|
+
},
|
|
22503
|
+
column.key
|
|
22504
|
+
)) }),
|
|
22505
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseTableHeader, { appearance, className: cn("border-b border-border/60 bg-muted/60 text-[11px] font-medium text-muted-foreground", classNames?.tableHeader), children: /* @__PURE__ */ jsxRuntime.jsx(BaseTableRow, { appearance, className: cn("hover:bg-transparent", classNames?.headerRow), children: orderedColumns.map((column, columnIndex) => {
|
|
22506
|
+
const headerContent = renderColumnHeader ? renderColumnHeader(column, { column, columnIndex, columns: orderedColumns, rows }) : column.label;
|
|
22507
|
+
const sortable = Boolean(column.sortable);
|
|
22508
|
+
const handleSort = sortable && onSort ? () => onSort(column.key, column) : void 0;
|
|
22509
|
+
const isFrozenStart = columnIndex < resolvedFrozenColumnCount;
|
|
22510
|
+
const isFrozenEnd = columnIndex >= orderedColumns.length - resolvedFrozenEndColumnCount;
|
|
22511
|
+
const isFrozen = isFrozenStart || isFrozenEnd;
|
|
22512
|
+
const isColumnAtDefaultWidth = getColumnNumericWidth(column, resolvedColumnSizes) === (defaultSizes[column.key] ?? getColumnDefaultSize(column));
|
|
22513
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(BaseContextMenu, { modal: false, children: [
|
|
22514
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseContextMenuTrigger, { asChild: true, appearance, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
22515
|
+
BaseTableHead,
|
|
22516
|
+
{
|
|
22517
|
+
appearance,
|
|
22518
|
+
columnId: column.key,
|
|
22519
|
+
align: column.align,
|
|
22520
|
+
label: headerContent,
|
|
22521
|
+
description: column.description,
|
|
22522
|
+
trailing: isFrozen ? /* @__PURE__ */ jsxRuntime.jsx("span", { title: labels.frozenColumnTitle, className: "inline-flex h-5 w-5 items-center justify-center rounded text-primary", children: /* @__PURE__ */ jsxRuntime.jsx(PinIcon, { className: "h-3.5 w-3.5" }) }) : null,
|
|
22523
|
+
sortable,
|
|
22524
|
+
sortDirection: column.sortDirection,
|
|
22525
|
+
sortLabel: column.sortLabel,
|
|
22526
|
+
onSort: handleSort,
|
|
22527
|
+
draggable: column.draggable,
|
|
22528
|
+
resizable: column.resizable,
|
|
22529
|
+
width: column.width,
|
|
22530
|
+
minWidth: column.minWidth,
|
|
22531
|
+
maxWidth: column.maxWidth,
|
|
22532
|
+
className: cn(
|
|
22533
|
+
"sticky top-0 h-9 whitespace-nowrap border-r border-border/50 bg-muted/60 px-2.5 py-2 backdrop-blur",
|
|
22534
|
+
getFrozenClassName(column, columnIndex, true),
|
|
22535
|
+
column.headerClassName,
|
|
22536
|
+
column.className,
|
|
22537
|
+
classNames?.headerCell
|
|
22538
|
+
),
|
|
22539
|
+
style: getFrozenStyle(column, columnIndex)
|
|
22540
|
+
}
|
|
22541
|
+
) }),
|
|
22542
|
+
/* @__PURE__ */ jsxRuntime.jsxs(BaseContextMenuContent, { appearance, alignOffset: -4, className: "min-w-44", children: [
|
|
22543
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseContextMenuLabel, { appearance, children: labels.columnActions }),
|
|
22544
|
+
isFrozen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
22545
|
+
BaseContextMenuItem,
|
|
22546
|
+
{
|
|
22547
|
+
appearance,
|
|
22548
|
+
onSelect: () => {
|
|
22549
|
+
if (isFrozenEnd) setFrozenEndColumnCount(orderedColumns.length - columnIndex - 1);
|
|
22550
|
+
else setFrozenColumnCount(columnIndex);
|
|
22551
|
+
},
|
|
22552
|
+
children: isFrozenEnd ? labels.unfreezeEndColumn : labels.unfreezeColumn
|
|
22553
|
+
}
|
|
22554
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
22555
|
+
BaseContextMenuItem,
|
|
22556
|
+
{
|
|
22557
|
+
appearance,
|
|
22558
|
+
onSelect: () => setFrozenColumnCount(columnIndex + 1),
|
|
22559
|
+
children: labels.freezeColumn
|
|
22560
|
+
}
|
|
22561
|
+
),
|
|
22562
|
+
!isFrozen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
22563
|
+
BaseContextMenuItem,
|
|
22564
|
+
{
|
|
22565
|
+
appearance,
|
|
22566
|
+
onSelect: () => setFrozenEndColumnCount(orderedColumns.length - columnIndex),
|
|
22567
|
+
children: labels.freezeEndColumn
|
|
22568
|
+
}
|
|
22569
|
+
) : null,
|
|
22570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22571
|
+
BaseContextMenuItem,
|
|
22572
|
+
{
|
|
22573
|
+
appearance,
|
|
22574
|
+
disabled: resolvedFrozenColumnCount === 0 && resolvedFrozenEndColumnCount === 0,
|
|
22575
|
+
onSelect: () => {
|
|
22576
|
+
setFrozenColumnCount(0);
|
|
22577
|
+
setFrozenEndColumnCount(0);
|
|
22578
|
+
},
|
|
22579
|
+
children: labels.unfreezeAllColumns
|
|
22580
|
+
}
|
|
22581
|
+
),
|
|
22582
|
+
/* @__PURE__ */ jsxRuntime.jsx(BaseContextMenuSeparator, { appearance }),
|
|
22583
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22584
|
+
BaseContextMenuItem,
|
|
22585
|
+
{
|
|
22586
|
+
appearance,
|
|
22587
|
+
disabled: isColumnAtDefaultWidth,
|
|
22588
|
+
onSelect: () => handleResetColumnSize(column),
|
|
22589
|
+
children: labels.resetColumnWidth
|
|
22590
|
+
}
|
|
22591
|
+
)
|
|
22592
|
+
] })
|
|
22593
|
+
] }, column.key);
|
|
22594
|
+
}) }) }),
|
|
22595
|
+
/* @__PURE__ */ jsxRuntime.jsxs(BaseTableBody, { appearance, className: cn("divide-y divide-border/50", classNames?.body), children: [
|
|
22596
|
+
pinnedTopRows.map((row, rowIndex) => {
|
|
22597
|
+
const key = getPinnedTopRowKey(row, rowIndex);
|
|
22598
|
+
const resolvedRowClassName = resolveRowClassName(pinnedTopRowClassName, row, rowIndex);
|
|
22599
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22600
|
+
BaseTableRow,
|
|
22601
|
+
{
|
|
22602
|
+
appearance,
|
|
22603
|
+
className: cn("bg-card/95", classNames?.pinnedTopRow, resolvedRowClassName),
|
|
22604
|
+
children: orderedColumns.map((column, columnIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
22605
|
+
BaseTableCell,
|
|
22606
|
+
{
|
|
22607
|
+
appearance,
|
|
22608
|
+
align: column.align,
|
|
22609
|
+
className: cn(
|
|
22610
|
+
"h-[52px] border-r border-border/50 px-2.5 py-1.5 align-middle",
|
|
22611
|
+
column.wrap ? "whitespace-normal" : "whitespace-nowrap",
|
|
22612
|
+
getFrozenClassName(column, columnIndex),
|
|
22613
|
+
column.cellClassName,
|
|
22614
|
+
classNames?.cell
|
|
22615
|
+
),
|
|
22616
|
+
style: getFrozenStyle(column, columnIndex),
|
|
22617
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(InteractiveTableCellContent, { wrap: column.wrap, children: renderPinnedTopCell ? renderPinnedTopCell(column, row, { row, rowIndex, column, columnIndex, isPinnedTopRow: true }) : renderDefaultCell(column, row) })
|
|
22618
|
+
},
|
|
22619
|
+
`pinned-${key}-${column.key}`
|
|
22620
|
+
))
|
|
22621
|
+
},
|
|
22622
|
+
`pinned-${key}`
|
|
22623
|
+
);
|
|
22624
|
+
}),
|
|
22625
|
+
rows.length ? rows.map((row, rowIndex) => {
|
|
22626
|
+
const key = getRowKey(row, rowIndex);
|
|
22627
|
+
const state = getRowState?.(row, rowIndex) || {};
|
|
22628
|
+
const resolvedRowClassName = resolveRowClassName(rowClassName, row, rowIndex);
|
|
22629
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22630
|
+
BaseTableRow,
|
|
22631
|
+
{
|
|
22632
|
+
appearance,
|
|
22633
|
+
interactive: Boolean(onRowClick) && !state.disabled,
|
|
22634
|
+
selected: state.selected,
|
|
22635
|
+
disabled: state.disabled,
|
|
22636
|
+
onClick: () => {
|
|
22637
|
+
if (!state.disabled) onRowClick?.(row, rowIndex);
|
|
22638
|
+
},
|
|
22639
|
+
className: cn(
|
|
22640
|
+
"min-h-[52px] bg-card transition-colors",
|
|
22641
|
+
state.saving && "bg-primary/5",
|
|
22642
|
+
state.pending && "opacity-80",
|
|
22643
|
+
onRowClick && !state.disabled ? "cursor-pointer hover:bg-muted/30" : "hover:bg-muted/30",
|
|
22644
|
+
classNames?.row,
|
|
22645
|
+
resolvedRowClassName
|
|
22646
|
+
),
|
|
22647
|
+
children: orderedColumns.map((column, columnIndex) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
22648
|
+
BaseTableCell,
|
|
22649
|
+
{
|
|
22650
|
+
appearance,
|
|
22651
|
+
align: column.align,
|
|
22652
|
+
className: cn(
|
|
22653
|
+
"h-[52px] border-r border-border/50 px-2.5 py-1.5 align-middle",
|
|
22654
|
+
column.wrap ? "whitespace-normal" : "whitespace-nowrap",
|
|
22655
|
+
getFrozenClassName(column, columnIndex),
|
|
22656
|
+
column.cellClassName,
|
|
22657
|
+
classNames?.cell
|
|
22658
|
+
),
|
|
22659
|
+
style: getFrozenStyle(column, columnIndex),
|
|
22660
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(InteractiveTableCellContent, { wrap: column.wrap, children: renderCell ? renderCell(column, row, { row, rowIndex, column, columnIndex, isPinnedTopRow: false }) : renderDefaultCell(column, row) })
|
|
22661
|
+
},
|
|
22662
|
+
`${key}-${column.key}`
|
|
22663
|
+
))
|
|
22664
|
+
},
|
|
22665
|
+
key
|
|
22666
|
+
);
|
|
22667
|
+
}) : pinnedTopRows.length ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
22668
|
+
BaseTableEmpty,
|
|
22669
|
+
{
|
|
22670
|
+
appearance,
|
|
22671
|
+
colSpan: Math.max(orderedColumns.length, 1),
|
|
22672
|
+
className: classNames?.empty,
|
|
22673
|
+
children: emptyState
|
|
22674
|
+
}
|
|
22675
|
+
)
|
|
22676
|
+
] })
|
|
22677
|
+
]
|
|
22678
|
+
}
|
|
22679
|
+
)
|
|
22680
|
+
}
|
|
22681
|
+
)
|
|
22682
|
+
}
|
|
22683
|
+
);
|
|
22684
|
+
}
|
|
22685
|
+
function InteractiveTableEditableTextCell({
|
|
22686
|
+
value,
|
|
22687
|
+
placeholder,
|
|
22688
|
+
disabled,
|
|
22689
|
+
multiline = false,
|
|
22690
|
+
commitOnBlur = true,
|
|
22691
|
+
className,
|
|
22692
|
+
inputClassName,
|
|
22693
|
+
onCommit
|
|
22694
|
+
}) {
|
|
22695
|
+
const initialValue = String(value || "");
|
|
22696
|
+
const [draft, setDraft] = React.useState(initialValue);
|
|
22697
|
+
React.useEffect(() => {
|
|
22698
|
+
setDraft(initialValue);
|
|
22699
|
+
}, [initialValue]);
|
|
22700
|
+
const commit = React.useCallback(async () => {
|
|
22701
|
+
const nextValue = String(draft || "").trim();
|
|
22702
|
+
const previousValue = String(initialValue || "").trim();
|
|
22703
|
+
if (nextValue === previousValue) return;
|
|
22704
|
+
try {
|
|
22705
|
+
await onCommit?.(nextValue);
|
|
22706
|
+
} catch {
|
|
22707
|
+
setDraft(initialValue);
|
|
22708
|
+
}
|
|
22709
|
+
}, [draft, initialValue, onCommit]);
|
|
22710
|
+
const controlClassName = cn(
|
|
22711
|
+
"w-full resize-none rounded-sm border border-transparent bg-transparent px-1.5 py-1 text-xs text-foreground outline-none transition-colors",
|
|
22712
|
+
"placeholder:text-muted-foreground/70 hover:border-border/60 hover:bg-background focus:border-primary/45 focus:bg-background",
|
|
22713
|
+
multiline ? "min-h-[42px] leading-5" : "h-8",
|
|
22714
|
+
disabled && "cursor-not-allowed text-muted-foreground hover:border-transparent hover:bg-transparent",
|
|
22715
|
+
inputClassName
|
|
22716
|
+
);
|
|
22717
|
+
if (multiline) {
|
|
22718
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22719
|
+
"textarea",
|
|
22720
|
+
{
|
|
22721
|
+
className: cn(controlClassName, className),
|
|
22722
|
+
disabled,
|
|
22723
|
+
value: draft,
|
|
22724
|
+
placeholder,
|
|
22725
|
+
onChange: (event) => setDraft(event.target.value),
|
|
22726
|
+
onBlur: () => {
|
|
22727
|
+
if (commitOnBlur) void commit();
|
|
22728
|
+
},
|
|
22729
|
+
onKeyDown: (event) => {
|
|
22730
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
|
|
22731
|
+
event.currentTarget.blur();
|
|
22732
|
+
}
|
|
22733
|
+
if (event.key === "Escape") {
|
|
22734
|
+
setDraft(initialValue);
|
|
22735
|
+
event.currentTarget.blur();
|
|
22736
|
+
}
|
|
22737
|
+
}
|
|
22738
|
+
}
|
|
22739
|
+
);
|
|
22740
|
+
}
|
|
22741
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22742
|
+
"input",
|
|
22743
|
+
{
|
|
22744
|
+
className: cn(controlClassName, className),
|
|
22745
|
+
disabled,
|
|
22746
|
+
value: draft,
|
|
22747
|
+
placeholder,
|
|
22748
|
+
onChange: (event) => setDraft(event.target.value),
|
|
22749
|
+
onBlur: () => {
|
|
22750
|
+
if (commitOnBlur) void commit();
|
|
22751
|
+
},
|
|
22752
|
+
onKeyDown: (event) => {
|
|
22753
|
+
if (event.key === "Enter") event.currentTarget.blur();
|
|
22754
|
+
if (event.key === "Escape") {
|
|
22755
|
+
setDraft(initialValue);
|
|
22756
|
+
event.currentTarget.blur();
|
|
22757
|
+
}
|
|
22758
|
+
}
|
|
22759
|
+
}
|
|
22760
|
+
);
|
|
22761
|
+
}
|
|
22762
|
+
function InteractiveTableReadonlyCell({
|
|
22763
|
+
children,
|
|
22764
|
+
mono = false,
|
|
22765
|
+
className
|
|
22766
|
+
}) {
|
|
22767
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("min-w-0 text-xs text-muted-foreground", mono && "font-mono", className), children: hasRenderableNode(children) ? children : "\u2014" });
|
|
22768
|
+
}
|
|
22769
|
+
function InteractiveTableSelectCell({
|
|
22770
|
+
value,
|
|
22771
|
+
options,
|
|
22772
|
+
disabled,
|
|
22773
|
+
ariaLabel,
|
|
22774
|
+
children,
|
|
22775
|
+
className,
|
|
22776
|
+
onChange
|
|
22777
|
+
}) {
|
|
22778
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative flex w-full items-center", className), children: [
|
|
22779
|
+
children,
|
|
22780
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22781
|
+
"select",
|
|
22782
|
+
{
|
|
22783
|
+
"aria-label": ariaLabel,
|
|
22784
|
+
disabled,
|
|
22785
|
+
value,
|
|
22786
|
+
onChange: (event) => onChange?.(event.target.value),
|
|
22787
|
+
className: "absolute inset-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
|
|
22788
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value))
|
|
22789
|
+
}
|
|
22790
|
+
)
|
|
22791
|
+
] });
|
|
22792
|
+
}
|
|
21624
22793
|
var imageExtPattern = /\.(png|jpe?g|webp|gif|svg|bmp|avif)$/i;
|
|
21625
22794
|
var audioExtPattern = /\.(wav|mp3|ogg|m4a|flac|aac)$/i;
|
|
21626
22795
|
var isLikelyUrl = (value) => /^https?:\/\//i.test(String(value || ""));
|
|
@@ -21947,7 +23116,7 @@ var DEFAULT_MASONRY_GAP_PX = 12;
|
|
|
21947
23116
|
var DEFAULT_MASONRY_ROW_HEIGHT_PX = 8;
|
|
21948
23117
|
var DEFAULT_MASONRY_COLUMN_WIDTH_PX = 280;
|
|
21949
23118
|
var DEFAULT_MASONRY_ITEM_HEIGHT_PX = 240;
|
|
21950
|
-
function
|
|
23119
|
+
function clamp4(value, min5, max5) {
|
|
21951
23120
|
return Math.min(Math.max(value, min5), max5);
|
|
21952
23121
|
}
|
|
21953
23122
|
function getRootFontSize(node) {
|
|
@@ -22022,10 +23191,10 @@ function getItemColumnSpan({
|
|
|
22022
23191
|
gap
|
|
22023
23192
|
}) {
|
|
22024
23193
|
if (Number.isFinite(size?.columnSpan) && Number(size?.columnSpan) > 0) {
|
|
22025
|
-
return
|
|
23194
|
+
return clamp4(Math.round(Number(size?.columnSpan)), 1, columnCount);
|
|
22026
23195
|
}
|
|
22027
23196
|
const itemWidth = resolveLengthToPixels(size?.width, columnWidth, null);
|
|
22028
|
-
return
|
|
23197
|
+
return clamp4(Math.ceil((itemWidth + gap) / (columnWidth + gap)), 1, columnCount);
|
|
22029
23198
|
}
|
|
22030
23199
|
function getItemRowSpan({
|
|
22031
23200
|
size,
|
|
@@ -22202,7 +23371,7 @@ function WorkbenchMasonryLayout({
|
|
|
22202
23371
|
let nextColumnIndex = 0;
|
|
22203
23372
|
let maxBottom = 0;
|
|
22204
23373
|
const positionedItems = layoutItems.map(({ key, item, columnSpan, rowSpan, size }) => {
|
|
22205
|
-
const resolvedSpan =
|
|
23374
|
+
const resolvedSpan = clamp4(columnSpan, 1, columnCount);
|
|
22206
23375
|
let startColumn = nextColumnIndex;
|
|
22207
23376
|
if (startColumn + resolvedSpan > columnCount) {
|
|
22208
23377
|
startColumn = 0;
|
|
@@ -22807,6 +23976,173 @@ function WorkbenchGalleryView({
|
|
|
22807
23976
|
}
|
|
22808
23977
|
);
|
|
22809
23978
|
}
|
|
23979
|
+
function toCssSize5(value) {
|
|
23980
|
+
if (value === void 0) return void 0;
|
|
23981
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
23982
|
+
}
|
|
23983
|
+
function defaultGetRowId(row, rowIndex) {
|
|
23984
|
+
return String(row?.id ?? row?.key ?? rowIndex);
|
|
23985
|
+
}
|
|
23986
|
+
function defaultGetColumnId(row) {
|
|
23987
|
+
return String(row?.columnId ?? row?.status ?? "");
|
|
23988
|
+
}
|
|
23989
|
+
function defaultRenderCard(row) {
|
|
23990
|
+
const value = row?.title ?? row?.name ?? row?.id ?? "Untitled";
|
|
23991
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-border/70 bg-card px-3 py-2 text-sm text-foreground shadow-sm", children: String(value) });
|
|
23992
|
+
}
|
|
23993
|
+
function WorkbenchLaneDraggableCard({
|
|
23994
|
+
row,
|
|
23995
|
+
rowId,
|
|
23996
|
+
rowIndex,
|
|
23997
|
+
column,
|
|
23998
|
+
classNames,
|
|
23999
|
+
renderCard
|
|
24000
|
+
}) {
|
|
24001
|
+
const { attributes, listeners, setNodeRef, isDragging } = core.useDraggable({ id: rowId });
|
|
24002
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24003
|
+
"div",
|
|
24004
|
+
{
|
|
24005
|
+
ref: setNodeRef,
|
|
24006
|
+
...listeners,
|
|
24007
|
+
...attributes,
|
|
24008
|
+
className: cn("touch-none", classNames?.cardWrapper),
|
|
24009
|
+
children: renderCard(row, { row, rowIndex, column, isDragging, isOverlay: false })
|
|
24010
|
+
}
|
|
24011
|
+
);
|
|
24012
|
+
}
|
|
24013
|
+
function WorkbenchLaneColumnView({
|
|
24014
|
+
column,
|
|
24015
|
+
columnRows,
|
|
24016
|
+
columnWidth,
|
|
24017
|
+
columnMinHeight,
|
|
24018
|
+
emptyColumn,
|
|
24019
|
+
classNames,
|
|
24020
|
+
renderCard
|
|
24021
|
+
}) {
|
|
24022
|
+
const { setNodeRef, isOver } = core.useDroppable({ id: column.id });
|
|
24023
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24024
|
+
"section",
|
|
24025
|
+
{
|
|
24026
|
+
className: cn(
|
|
24027
|
+
"flex shrink-0 flex-col rounded-xl border border-border/60 bg-card p-2 shadow-sm",
|
|
24028
|
+
classNames?.column,
|
|
24029
|
+
column.className
|
|
24030
|
+
),
|
|
24031
|
+
style: { width: toCssSize5(columnWidth) ?? "280px" },
|
|
24032
|
+
children: [
|
|
24033
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex h-10 items-center gap-2 px-1", classNames?.columnHeader, column.headerClassName), children: [
|
|
24034
|
+
column.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("inline-flex h-4 w-4 items-center justify-center text-muted-foreground", classNames?.columnIcon, column.iconClassName), children: column.icon }) : null,
|
|
24035
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("inline-flex items-center rounded px-2 py-0.5 text-xs font-semibold bg-muted text-muted-foreground", classNames?.columnBadge, column.badgeClassName), children: column.label ?? column.id }),
|
|
24036
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-xs text-muted-foreground", classNames?.columnCount), children: columnRows.length })
|
|
24037
|
+
] }),
|
|
24038
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24039
|
+
"div",
|
|
24040
|
+
{
|
|
24041
|
+
ref: setNodeRef,
|
|
24042
|
+
className: cn(
|
|
24043
|
+
"mt-1 flex min-h-[200px] flex-1 flex-col gap-2 overflow-y-auto rounded-lg p-1 transition-colors [scrollbar-width:thin]",
|
|
24044
|
+
isOver && "bg-accent/60",
|
|
24045
|
+
classNames?.columnBody,
|
|
24046
|
+
column.bodyClassName
|
|
24047
|
+
),
|
|
24048
|
+
style: { minHeight: toCssSize5(columnMinHeight) },
|
|
24049
|
+
children: columnRows.length ? columnRows.map(({ row, rowIndex, rowId }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24050
|
+
WorkbenchLaneDraggableCard,
|
|
24051
|
+
{
|
|
24052
|
+
row,
|
|
24053
|
+
rowId,
|
|
24054
|
+
rowIndex,
|
|
24055
|
+
column,
|
|
24056
|
+
classNames,
|
|
24057
|
+
renderCard
|
|
24058
|
+
},
|
|
24059
|
+
rowId
|
|
24060
|
+
)) : emptyColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex min-h-24 items-center justify-center rounded-lg border border-dashed border-border/60 px-3 py-4 text-xs text-muted-foreground", classNames?.emptyColumn), children: emptyColumn }) : null
|
|
24061
|
+
}
|
|
24062
|
+
)
|
|
24063
|
+
]
|
|
24064
|
+
}
|
|
24065
|
+
);
|
|
24066
|
+
}
|
|
24067
|
+
function WorkbenchLaneView({
|
|
24068
|
+
rows = [],
|
|
24069
|
+
columns = [],
|
|
24070
|
+
getRowId = defaultGetRowId,
|
|
24071
|
+
getColumnId = defaultGetColumnId,
|
|
24072
|
+
renderCard = defaultRenderCard,
|
|
24073
|
+
renderOverlayCard,
|
|
24074
|
+
onMoveRow,
|
|
24075
|
+
emptyColumn,
|
|
24076
|
+
activationDistance = 5,
|
|
24077
|
+
columnWidth = 280,
|
|
24078
|
+
columnMinHeight,
|
|
24079
|
+
className,
|
|
24080
|
+
classNames,
|
|
24081
|
+
style
|
|
24082
|
+
}) {
|
|
24083
|
+
const [activeRowId, setActiveRowId] = React.useState(null);
|
|
24084
|
+
const sensors = core.useSensors(core.useSensor(core.PointerSensor, { activationConstraint: { distance: activationDistance } }));
|
|
24085
|
+
const columnMap = React.useMemo(() => new Map(columns.map((column) => [column.id, column])), [columns]);
|
|
24086
|
+
const rowEntries = React.useMemo(() => rows.map((row, rowIndex) => ({
|
|
24087
|
+
row,
|
|
24088
|
+
rowIndex,
|
|
24089
|
+
rowId: getRowId(row, rowIndex),
|
|
24090
|
+
columnId: getColumnId(row, rowIndex)
|
|
24091
|
+
})), [getColumnId, getRowId, rows]);
|
|
24092
|
+
const activeEntry = activeRowId ? rowEntries.find((entry) => entry.rowId === activeRowId) : void 0;
|
|
24093
|
+
const rowsByColumn = React.useMemo(() => {
|
|
24094
|
+
const next = /* @__PURE__ */ new Map();
|
|
24095
|
+
columns.forEach((column) => next.set(column.id, []));
|
|
24096
|
+
rowEntries.forEach(({ row, rowIndex, rowId, columnId }) => {
|
|
24097
|
+
next.get(columnId)?.push({ row, rowIndex, rowId });
|
|
24098
|
+
});
|
|
24099
|
+
return next;
|
|
24100
|
+
}, [columns, rowEntries]);
|
|
24101
|
+
const activeColumn = activeEntry ? columnMap.get(activeEntry.columnId) : void 0;
|
|
24102
|
+
const handleDragStart = React.useCallback((event) => {
|
|
24103
|
+
setActiveRowId(String(event.active.id));
|
|
24104
|
+
}, []);
|
|
24105
|
+
const handleDragEnd = React.useCallback((event) => {
|
|
24106
|
+
setActiveRowId(null);
|
|
24107
|
+
const rowId = String(event.active.id);
|
|
24108
|
+
const nextColumnId = String(event.over?.id ?? "");
|
|
24109
|
+
const activeRow = rowEntries.find((entry) => entry.rowId === rowId);
|
|
24110
|
+
if (!activeRow || !columnMap.has(nextColumnId) || activeRow.columnId === nextColumnId) return;
|
|
24111
|
+
onMoveRow?.(rowId, nextColumnId, activeRow.row);
|
|
24112
|
+
}, [columnMap, onMoveRow, rowEntries]);
|
|
24113
|
+
const handleDragCancel = React.useCallback(() => {
|
|
24114
|
+
setActiveRowId(null);
|
|
24115
|
+
}, []);
|
|
24116
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.DndContext, { sensors, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDragCancel: handleDragCancel, children: [
|
|
24117
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24118
|
+
"div",
|
|
24119
|
+
{
|
|
24120
|
+
className: cn("flex min-h-0 flex-1 gap-4 overflow-x-auto p-4 [scrollbar-width:thin]", classNames?.root, className),
|
|
24121
|
+
style,
|
|
24122
|
+
children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24123
|
+
WorkbenchLaneColumnView,
|
|
24124
|
+
{
|
|
24125
|
+
column,
|
|
24126
|
+
columnRows: rowsByColumn.get(column.id) || [],
|
|
24127
|
+
columnWidth,
|
|
24128
|
+
columnMinHeight,
|
|
24129
|
+
emptyColumn,
|
|
24130
|
+
classNames,
|
|
24131
|
+
renderCard
|
|
24132
|
+
},
|
|
24133
|
+
column.id
|
|
24134
|
+
))
|
|
24135
|
+
}
|
|
24136
|
+
),
|
|
24137
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.DragOverlay, { children: activeEntry && activeColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(classNames?.overlayWrapper), children: (renderOverlayCard || renderCard)(activeEntry.row, {
|
|
24138
|
+
row: activeEntry.row,
|
|
24139
|
+
rowIndex: activeEntry.rowIndex,
|
|
24140
|
+
column: activeColumn,
|
|
24141
|
+
isDragging: false,
|
|
24142
|
+
isOverlay: true
|
|
24143
|
+
}) }) : null })
|
|
24144
|
+
] });
|
|
24145
|
+
}
|
|
22810
24146
|
function cn4(...inputs) {
|
|
22811
24147
|
return inputs.filter(Boolean).join(" ");
|
|
22812
24148
|
}
|
|
@@ -23134,6 +24470,10 @@ exports.BaseDropdownMenu = BaseDropdownMenu;
|
|
|
23134
24470
|
exports.BaseEmptyState = BaseEmptyState;
|
|
23135
24471
|
exports.BaseField = BaseField;
|
|
23136
24472
|
exports.BaseInput = BaseInput;
|
|
24473
|
+
exports.BaseLayout = BaseLayout;
|
|
24474
|
+
exports.BaseLayoutPane = BaseLayoutPane;
|
|
24475
|
+
exports.BaseLayoutResizeHandle = BaseLayoutResizeHandle;
|
|
24476
|
+
exports.BaseLayoutSplit = BaseLayoutSplit;
|
|
23137
24477
|
exports.BaseLoadingState = BaseLoadingState;
|
|
23138
24478
|
exports.BaseNotice = BaseNotice;
|
|
23139
24479
|
exports.BasePagination = BasePagination;
|
|
@@ -23198,6 +24538,10 @@ exports.DefaultLandingPage = DefaultLandingPage;
|
|
|
23198
24538
|
exports.DynamicComponent = DynamicComponent;
|
|
23199
24539
|
exports.EmailAuth = EmailAuth;
|
|
23200
24540
|
exports.I18nSelector = I18nSelector;
|
|
24541
|
+
exports.InteractiveTable = InteractiveTable;
|
|
24542
|
+
exports.InteractiveTableEditableTextCell = InteractiveTableEditableTextCell;
|
|
24543
|
+
exports.InteractiveTableReadonlyCell = InteractiveTableReadonlyCell;
|
|
24544
|
+
exports.InteractiveTableSelectCell = InteractiveTableSelectCell;
|
|
23201
24545
|
exports.LoginLayout = LoginLayout;
|
|
23202
24546
|
exports.NavButton = NavButton;
|
|
23203
24547
|
exports.OAuthButton = OAuthButton;
|
|
@@ -23210,6 +24554,7 @@ exports.WorkbenchGalleryCard = WorkbenchGalleryCard;
|
|
|
23210
24554
|
exports.WorkbenchGallerySettingsButton = WorkbenchGallerySettingsButton;
|
|
23211
24555
|
exports.WorkbenchGallerySettingsPanel = WorkbenchGallerySettingsPanel;
|
|
23212
24556
|
exports.WorkbenchGalleryView = WorkbenchGalleryView;
|
|
24557
|
+
exports.WorkbenchLaneView = WorkbenchLaneView;
|
|
23213
24558
|
exports.WorkbenchMasonryLayout = WorkbenchMasonryLayout;
|
|
23214
24559
|
exports.WorkbenchResizableSidebar = WorkbenchResizableSidebar;
|
|
23215
24560
|
exports.WorkbenchTableView = WorkbenchTableView;
|