@ai-matrx/design-system 0.18.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/content-transfer.cjs +24 -6
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.d.cts +5 -1
- package/dist/content-transfer.d.ts +5 -1
- package/dist/content-transfer.js +24 -6
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/copy-types.cjs.map +1 -1
- package/dist/data-table/copy-types.d.cts +2 -0
- package/dist/data-table/copy-types.d.ts +2 -0
- package/dist/data-table/data-row-inspector.cjs +27 -8
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +27 -8
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +27 -8
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +27 -8
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/index.cjs +140 -86
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +134 -76
- package/dist/data-table/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -460,7 +460,7 @@ module.exports = __toCommonJS(data_table_exports);
|
|
|
460
460
|
|
|
461
461
|
// src/data-table/MatrxDataTable.tsx
|
|
462
462
|
var import_react13 = require("react");
|
|
463
|
-
var
|
|
463
|
+
var import_core3 = require("@dnd-kit/core");
|
|
464
464
|
|
|
465
465
|
// src/data-table/icons.tsx
|
|
466
466
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -2426,7 +2426,12 @@ async function buildArtifact(draft, format, label) {
|
|
|
2426
2426
|
const extension = format === "plain" ? "txt" : format === "compact-json" ? "json" : format;
|
|
2427
2427
|
return (0, import_content_transfer.serialize)(draft, format, { spreadsheetSafe: format === "csv" || format === "tsv", filename: `${filenameFor(label)}.${extension}` });
|
|
2428
2428
|
}
|
|
2429
|
-
function ContentTransferMenu(
|
|
2429
|
+
function ContentTransferMenu(props) {
|
|
2430
|
+
const inherited = React12.useContext(CapabilityContext);
|
|
2431
|
+
const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
|
|
2432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
|
|
2433
|
+
}
|
|
2434
|
+
function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
|
|
2430
2435
|
const triggerRef = React12.useRef(null);
|
|
2431
2436
|
const inherited = React12.useContext(CapabilityContext);
|
|
2432
2437
|
const nearestSurface = React12.useContext(SurfaceContext);
|
|
@@ -2719,6 +2724,9 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
2719
2724
|
const [instruction, setInstruction] = React12.useState("");
|
|
2720
2725
|
const [busy, setBusy] = React12.useState(null);
|
|
2721
2726
|
const [aiFailed, setAiFailed] = React12.useState(false);
|
|
2727
|
+
React12.useEffect(() => {
|
|
2728
|
+
setAiFailed(false);
|
|
2729
|
+
}, [state.snapshot.id, state.draft.revision]);
|
|
2722
2730
|
const activeAi = React12.useRef(null);
|
|
2723
2731
|
const activeCapture = React12.useRef(null);
|
|
2724
2732
|
React12.useEffect(() => {
|
|
@@ -3029,7 +3037,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
3029
3037
|
activeCapture.current = null;
|
|
3030
3038
|
setBusy(null);
|
|
3031
3039
|
}, children: "Stop loading rows" }) : null,
|
|
3032
|
-
ai && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "outline", onClick: () => void runAi(true), children: aiFailed ? "Retry or rejoin AI run" : "Rejoin AI run" }) : null,
|
|
3040
|
+
ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { type: "button", variant: "outline", onClick: () => void runAi(true), children: aiFailed ? "Retry or rejoin AI run" : "Rejoin AI run" }) : null,
|
|
3033
3041
|
ai ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "matrx-alchemy-meta", children: "AI creates a preview. It never copies automatically. Closing detaches this view without cancelling server work." }) : null,
|
|
3034
3042
|
state.error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
|
|
3035
3043
|
] }) : null
|
|
@@ -3156,7 +3164,17 @@ var sourceFor = (id, label, build) => ({
|
|
|
3156
3164
|
}
|
|
3157
3165
|
});
|
|
3158
3166
|
function MatrxCopyMenu(props) {
|
|
3159
|
-
|
|
3167
|
+
const inherited = useContentTransferCapabilities();
|
|
3168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3169
|
+
MatrxCopyMenuSession,
|
|
3170
|
+
{
|
|
3171
|
+
...props
|
|
3172
|
+
},
|
|
3173
|
+
JSON.stringify([
|
|
3174
|
+
inherited.identityKey ?? null,
|
|
3175
|
+
props.sourceId ?? props.label
|
|
3176
|
+
])
|
|
3177
|
+
);
|
|
3160
3178
|
}
|
|
3161
3179
|
function MatrxCopyMenuSession(props) {
|
|
3162
3180
|
const instance = React13.useId();
|
|
@@ -3184,7 +3202,7 @@ function MatrxCopyMenuSession(props) {
|
|
|
3184
3202
|
})) : void 0;
|
|
3185
3203
|
const agent = aiVisible && props.agent !== void 0 ? make("agent", () => asPayload(resolve(props.agent))) : void 0;
|
|
3186
3204
|
const structuredAgent = aiVisible && props.agent !== void 0 ? make("structured-agent", () => structuredPayload(resolve(props.agent))) : void 0;
|
|
3187
|
-
const table = exportVisible && props.export?.sheetRows ? make("rows", () => {
|
|
3205
|
+
const table = (exportVisible || props.primarySource === "table") && props.export?.sheetRows ? make("rows", () => {
|
|
3188
3206
|
const value = (0, import_content_transfer2.normalizeTransferJson)(props.export.sheetRows());
|
|
3189
3207
|
if (!Array.isArray(value) || value.some(
|
|
3190
3208
|
(row) => row === null || typeof row !== "object" || Array.isArray(row)
|
|
@@ -3331,7 +3349,7 @@ function MatrxCopyMenuSession(props) {
|
|
|
3331
3349
|
return props.sendToSheet(draft.payload.rows, props.label);
|
|
3332
3350
|
}
|
|
3333
3351
|
});
|
|
3334
|
-
const source = json ?? table ?? structuredAgent ?? human ?? builderVariants[0]?.source;
|
|
3352
|
+
const source = (props.primarySource === "table" ? table : void 0) ?? json ?? table ?? structuredAgent ?? human ?? builderVariants[0]?.source;
|
|
3335
3353
|
if (!source && !actions.length) return null;
|
|
3336
3354
|
const target = source ?? make("actions", () => ({ kind: "text", text: props.label }));
|
|
3337
3355
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
@@ -3351,7 +3369,7 @@ function MatrxCopyMenuSession(props) {
|
|
|
3351
3369
|
formatSources: {
|
|
3352
3370
|
...human ? { plain: human, markdown: humanMarkdown, html: humanMarkdown } : {},
|
|
3353
3371
|
...json ? { json, "compact-json": json } : {},
|
|
3354
|
-
...table ? { csv: table, tsv: table } : {}
|
|
3372
|
+
...table && exportVisible ? { csv: table, tsv: table } : {}
|
|
3355
3373
|
},
|
|
3356
3374
|
...props.disabled !== void 0 ? { disabled: props.disabled } : {},
|
|
3357
3375
|
className: cn(
|
|
@@ -3651,8 +3669,9 @@ ${JSON.stringify(value.data, null, 2)}
|
|
|
3651
3669
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3652
3670
|
function CopyButtons(props) {
|
|
3653
3671
|
const { CopyControls } = useMatrxDataTableHost();
|
|
3654
|
-
|
|
3655
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3672
|
+
const copyProps = props.export?.sheetRows ? { ...props, primarySource: "table" } : props;
|
|
3673
|
+
if (CopyControls) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CopyControls, { ...copyProps });
|
|
3674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MatrxCopyMenu, { ...copyProps });
|
|
3656
3675
|
}
|
|
3657
3676
|
function jsonExportItem(build, label) {
|
|
3658
3677
|
return { id: "json", label, build: () => ({ content: JSON.stringify(build(), null, 2), extension: "json", mime: "application/json" }) };
|
|
@@ -4019,6 +4038,7 @@ var import_url_state3 = require("@ai-matrx/kit/url-state");
|
|
|
4019
4038
|
|
|
4020
4039
|
// src/data-table/ColumnHeaderCell.tsx
|
|
4021
4040
|
var import_react7 = require("react");
|
|
4041
|
+
var import_core = require("@dnd-kit/core");
|
|
4022
4042
|
|
|
4023
4043
|
// src/popover.tsx
|
|
4024
4044
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
@@ -4228,8 +4248,29 @@ function ColumnHeaderCell({
|
|
|
4228
4248
|
filterShowCancel = false,
|
|
4229
4249
|
filterFooterHint,
|
|
4230
4250
|
allowNegation = false,
|
|
4231
|
-
allowNullModes = false
|
|
4251
|
+
allowNullModes = false,
|
|
4252
|
+
reorderColumn
|
|
4232
4253
|
}) {
|
|
4254
|
+
const reorderEnabled = reorderColumn !== void 0;
|
|
4255
|
+
const { attributes: reorderAttributes, listeners: reorderListeners, setNodeRef } = (0, import_core.useDraggable)(
|
|
4256
|
+
reorderColumn ? {
|
|
4257
|
+
id: `matrx-column-header:${reorderColumn.id}`,
|
|
4258
|
+
data: { matrxDragKind: "column-header", columnId: reorderColumn.id },
|
|
4259
|
+
disabled: false
|
|
4260
|
+
} : {
|
|
4261
|
+
id: `matrx-column-header:inactive:${labelText ?? "column"}`,
|
|
4262
|
+
disabled: true
|
|
4263
|
+
}
|
|
4264
|
+
);
|
|
4265
|
+
const reorderLabel = reorderColumn?.label ?? labelText ?? "column";
|
|
4266
|
+
const reorderActivator = reorderEnabled ? {
|
|
4267
|
+
...reorderAttributes,
|
|
4268
|
+
...reorderListeners,
|
|
4269
|
+
ref: setNodeRef,
|
|
4270
|
+
title: `Drag to reorder ${reorderLabel}.`,
|
|
4271
|
+
"aria-description": "Drag this column label to reorder it."
|
|
4272
|
+
} : void 0;
|
|
4273
|
+
const reorderClass = reorderEnabled ? "touch-none cursor-grab active:cursor-grabbing" : void 0;
|
|
4233
4274
|
const filterActive = isColumnFilterActive(filterValue);
|
|
4234
4275
|
const deferredFilter = filterApplyLabel !== void 0 || filterShowCancel || filterFooterHint !== void 0;
|
|
4235
4276
|
const [filterOpen, setFilterOpen] = (0, import_react7.useState)(false);
|
|
@@ -4373,7 +4414,21 @@ function ColumnHeaderCell({
|
|
|
4373
4414
|
);
|
|
4374
4415
|
if (compact) {
|
|
4375
4416
|
if (!sortable && !filterKind) {
|
|
4376
|
-
|
|
4417
|
+
if (!reorderEnabled) {
|
|
4418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: cn("flex items-center justify-center", className), children: label });
|
|
4419
|
+
}
|
|
4420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: cn("flex items-center justify-center", className), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4421
|
+
"button",
|
|
4422
|
+
{
|
|
4423
|
+
type: "button",
|
|
4424
|
+
...reorderActivator,
|
|
4425
|
+
className: cn(
|
|
4426
|
+
"inline-flex items-center justify-center rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",
|
|
4427
|
+
reorderClass
|
|
4428
|
+
),
|
|
4429
|
+
children: label
|
|
4430
|
+
}
|
|
4431
|
+
) });
|
|
4377
4432
|
}
|
|
4378
4433
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4379
4434
|
"div",
|
|
@@ -4390,9 +4445,13 @@ function ColumnHeaderCell({
|
|
|
4390
4445
|
type: "button",
|
|
4391
4446
|
"aria-label": menuLabel,
|
|
4392
4447
|
title: menuLabel,
|
|
4393
|
-
onClick: (
|
|
4448
|
+
onClick: (event) => {
|
|
4449
|
+
event.stopPropagation();
|
|
4450
|
+
},
|
|
4451
|
+
...reorderActivator,
|
|
4394
4452
|
className: cn(
|
|
4395
4453
|
"relative inline-flex items-center justify-center rounded p-0.5 transition-colors",
|
|
4454
|
+
reorderClass,
|
|
4396
4455
|
isSorted || filterActive ? "text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
4397
4456
|
),
|
|
4398
4457
|
children: [
|
|
@@ -4428,8 +4487,10 @@ function ColumnHeaderCell({
|
|
|
4428
4487
|
{
|
|
4429
4488
|
type: "button",
|
|
4430
4489
|
onClick: onHeaderSortClick,
|
|
4490
|
+
...reorderActivator,
|
|
4431
4491
|
className: cn(
|
|
4432
4492
|
"inline-flex min-w-0 items-center gap-1 rounded px-0.5 py-0.5 text-left text-xs font-semibold uppercase tracking-wide transition-colors",
|
|
4493
|
+
reorderClass,
|
|
4433
4494
|
isSorted ? "text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
4434
4495
|
),
|
|
4435
4496
|
children: [
|
|
@@ -4437,6 +4498,17 @@ function ColumnHeaderCell({
|
|
|
4437
4498
|
isSorted ? sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArrowUp, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArrowDown, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArrowUpDown, { className: "h-3 w-3 shrink-0 opacity-40" })
|
|
4438
4499
|
]
|
|
4439
4500
|
}
|
|
4501
|
+
) : reorderEnabled ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4502
|
+
"button",
|
|
4503
|
+
{
|
|
4504
|
+
type: "button",
|
|
4505
|
+
...reorderActivator,
|
|
4506
|
+
className: cn(
|
|
4507
|
+
"min-w-0 truncate rounded px-0.5 py-0.5 text-left text-xs font-semibold uppercase tracking-wide text-muted-foreground hover:text-foreground",
|
|
4508
|
+
reorderClass
|
|
4509
|
+
),
|
|
4510
|
+
children: label
|
|
4511
|
+
}
|
|
4440
4512
|
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
|
|
4441
4513
|
filterKind ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "inline-flex items-center", children: [
|
|
4442
4514
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Popover, { open: filterOpen, onOpenChange: setFilterOpen, children: [
|
|
@@ -4759,7 +4831,7 @@ function parseOptionalNumber(raw) {
|
|
|
4759
4831
|
|
|
4760
4832
|
// src/data-table/ColumnManager.tsx
|
|
4761
4833
|
var import_react8 = require("react");
|
|
4762
|
-
var
|
|
4834
|
+
var import_core2 = require("@dnd-kit/core");
|
|
4763
4835
|
init_filter_engine();
|
|
4764
4836
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4765
4837
|
function ColumnManager({
|
|
@@ -4809,7 +4881,7 @@ function ColumnManager({
|
|
|
4809
4881
|
return next;
|
|
4810
4882
|
});
|
|
4811
4883
|
};
|
|
4812
|
-
(0,
|
|
4884
|
+
(0, import_core2.useDndMonitor)({
|
|
4813
4885
|
onDragStart(event) {
|
|
4814
4886
|
if (event.active.data.current?.matrxDragKind !== "column-manager") return;
|
|
4815
4887
|
setDraggedColumnId(String(event.active.data.current.columnId));
|
|
@@ -4927,14 +4999,14 @@ function ColumnManagerDropTarget({
|
|
|
4927
4999
|
className,
|
|
4928
5000
|
children
|
|
4929
5001
|
}) {
|
|
4930
|
-
const { setNodeRef } = (0,
|
|
5002
|
+
const { setNodeRef } = (0, import_core2.useDroppable)({
|
|
4931
5003
|
id: `matrx-column-manager:${id}`,
|
|
4932
5004
|
data: { matrxDragKind: "column-manager", columnId: id }
|
|
4933
5005
|
});
|
|
4934
5006
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref: setNodeRef, "data-matrx-column-manager-drop-target": id, className, children });
|
|
4935
5007
|
}
|
|
4936
5008
|
function ColumnManagerDragHandle({ id, label }) {
|
|
4937
|
-
const { attributes, listeners, setNodeRef } = (0,
|
|
5009
|
+
const { attributes, listeners, setNodeRef } = (0, import_core2.useDraggable)({
|
|
4938
5010
|
id: `matrx-column-manager:${id}`,
|
|
4939
5011
|
data: { matrxDragKind: "column-manager", columnId: id }
|
|
4940
5012
|
});
|
|
@@ -6558,6 +6630,7 @@ function MatrxDataTableWithUrlState({
|
|
|
6558
6630
|
}
|
|
6559
6631
|
);
|
|
6560
6632
|
}
|
|
6633
|
+
var COLUMN_REORDER_ACTIVATION_DISTANCE = 6;
|
|
6561
6634
|
function MatrxDataTableCore({
|
|
6562
6635
|
data: suppliedData,
|
|
6563
6636
|
columns,
|
|
@@ -6629,8 +6702,10 @@ function MatrxDataTableCore({
|
|
|
6629
6702
|
);
|
|
6630
6703
|
const [internalSearch, setInternalSearch] = (0, import_react13.useState)("");
|
|
6631
6704
|
const [draggedRowId, setDraggedRowId] = (0, import_react13.useState)(null);
|
|
6632
|
-
const hierarchySensors = (0,
|
|
6633
|
-
(0,
|
|
6705
|
+
const hierarchySensors = (0, import_core3.useSensors)(
|
|
6706
|
+
(0, import_core3.useSensor)(import_core3.PointerSensor, {
|
|
6707
|
+
activationConstraint: { distance: COLUMN_REORDER_ACTIVATION_DISTANCE }
|
|
6708
|
+
})
|
|
6634
6709
|
);
|
|
6635
6710
|
const toolbarSearchControlled = toolbar?.searchValue !== void 0;
|
|
6636
6711
|
const searchValue = controlledQuery ? controlledQuery.state.search : toolbarSearchControlled ? toolbar?.searchValue ?? "" : internalSearch;
|
|
@@ -7471,11 +7546,11 @@ function MatrxDataTableCore({
|
|
|
7471
7546
|
} : facet
|
|
7472
7547
|
) : toolbar?.facets;
|
|
7473
7548
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
7474
|
-
|
|
7549
|
+
import_core3.DndContext,
|
|
7475
7550
|
{
|
|
7476
7551
|
sensors: hierarchySensors,
|
|
7477
|
-
collisionDetection:
|
|
7478
|
-
measuring: { droppable: { strategy:
|
|
7552
|
+
collisionDetection: import_core3.pointerWithin,
|
|
7553
|
+
measuring: { droppable: { strategy: import_core3.MeasuringStrategy.Always } },
|
|
7479
7554
|
onDragStart: (event) => {
|
|
7480
7555
|
const kind = event.active.data.current?.matrxDragKind;
|
|
7481
7556
|
if (kind === "column-header") {
|
|
@@ -7688,6 +7763,7 @@ function MatrxDataTableCore({
|
|
|
7688
7763
|
size: "sm",
|
|
7689
7764
|
className: "h-7 gap-1 px-2 text-xs text-muted-foreground",
|
|
7690
7765
|
onClick: clearAllFilters,
|
|
7766
|
+
"aria-label": "Clear all filters",
|
|
7691
7767
|
title: "Clear all filters",
|
|
7692
7768
|
children: [
|
|
7693
7769
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Eraser, { className: "h-3.5 w-3.5" }),
|
|
@@ -8046,45 +8122,43 @@ function MatrxDataTableCore({
|
|
|
8046
8122
|
col.align === "right" && "text-right"
|
|
8047
8123
|
),
|
|
8048
8124
|
style: columnWidthVar(col.width),
|
|
8049
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime35.
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
}
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
)
|
|
8087
|
-
] })
|
|
8125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ColumnHeaderDropZone, { id, enabled: reorderableColumns, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8126
|
+
ColumnHeaderCell,
|
|
8127
|
+
{
|
|
8128
|
+
label: col.header,
|
|
8129
|
+
labelText: headerLabel,
|
|
8130
|
+
sortable: col.sortable !== false,
|
|
8131
|
+
isSorted: Boolean(isSorted),
|
|
8132
|
+
sortDirection: sort?.direction ?? defaultSortDirection,
|
|
8133
|
+
onSortAsc: () => setSort({ id, direction: "asc" }),
|
|
8134
|
+
onSortDesc: () => setSort({ id, direction: "desc" }),
|
|
8135
|
+
onClearSort: () => setSort(null),
|
|
8136
|
+
onHeaderSortClick: () => {
|
|
8137
|
+
if (!isSorted) {
|
|
8138
|
+
setSort({ id, direction: defaultSortDirection });
|
|
8139
|
+
return;
|
|
8140
|
+
}
|
|
8141
|
+
if (sort?.direction === "asc") {
|
|
8142
|
+
setSort({ id, direction: "desc" });
|
|
8143
|
+
return;
|
|
8144
|
+
}
|
|
8145
|
+
setSort(null);
|
|
8146
|
+
},
|
|
8147
|
+
filterKind: meta?.kind ?? null,
|
|
8148
|
+
filterValue: columnFilters[id],
|
|
8149
|
+
onFilterChange: (next) => setColumnFilter(id, next),
|
|
8150
|
+
selectOptions: meta?.options,
|
|
8151
|
+
selectSingle: col.filterSingle,
|
|
8152
|
+
filterApplyLabel: filterUi?.applyLabel,
|
|
8153
|
+
filterShowCancel: filterUi?.showCancel,
|
|
8154
|
+
filterFooterHint: filterUi?.footerHint,
|
|
8155
|
+
allowNegation: filterUi?.allowNegation,
|
|
8156
|
+
allowNullModes: filterUi?.allowNullModes,
|
|
8157
|
+
align: col.align,
|
|
8158
|
+
compact: col.compact,
|
|
8159
|
+
reorderColumn: reorderableColumns ? { id, label: headerLabel } : void 0
|
|
8160
|
+
}
|
|
8161
|
+
) })
|
|
8088
8162
|
},
|
|
8089
8163
|
id
|
|
8090
8164
|
);
|
|
@@ -8660,7 +8734,7 @@ function MatrxDataTableCore({
|
|
|
8660
8734
|
]
|
|
8661
8735
|
}
|
|
8662
8736
|
),
|
|
8663
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8737
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_core3.DragOverlay, { children: draggedRow ? (
|
|
8664
8738
|
// w-max: the overlay inherits the ACTIVE node's size, and the active
|
|
8665
8739
|
// node is the 16px grip handle — without it the label wraps to one
|
|
8666
8740
|
// character per line.
|
|
@@ -8675,7 +8749,7 @@ function HierarchyDragHandle({
|
|
|
8675
8749
|
label,
|
|
8676
8750
|
disabled
|
|
8677
8751
|
}) {
|
|
8678
|
-
const { attributes, listeners, setNodeRef } = (0,
|
|
8752
|
+
const { attributes, listeners, setNodeRef } = (0, import_core3.useDraggable)({
|
|
8679
8753
|
id,
|
|
8680
8754
|
disabled
|
|
8681
8755
|
});
|
|
@@ -8699,7 +8773,7 @@ function HierarchyRootDropTarget({
|
|
|
8699
8773
|
label,
|
|
8700
8774
|
draggedLabel
|
|
8701
8775
|
}) {
|
|
8702
|
-
const { isOver, setNodeRef } = (0,
|
|
8776
|
+
const { isOver, setNodeRef } = (0, import_core3.useDroppable)({ id: "__root__" });
|
|
8703
8777
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
8704
8778
|
"div",
|
|
8705
8779
|
{
|
|
@@ -8723,7 +8797,7 @@ function HierarchyDragIndicatorLayer({
|
|
|
8723
8797
|
const [indicator, setIndicator] = (0, import_react13.useState)(
|
|
8724
8798
|
null
|
|
8725
8799
|
);
|
|
8726
|
-
(0,
|
|
8800
|
+
(0, import_core3.useDndMonitor)({
|
|
8727
8801
|
onDragMove(event) {
|
|
8728
8802
|
const container = scrollRef.current;
|
|
8729
8803
|
const overId = event.over ? String(event.over.id) : null;
|
|
@@ -8823,7 +8897,7 @@ function HierarchyDroppableRow({
|
|
|
8823
8897
|
disabled,
|
|
8824
8898
|
children
|
|
8825
8899
|
}) {
|
|
8826
|
-
const { setNodeRef } = (0,
|
|
8900
|
+
const { setNodeRef } = (0, import_core3.useDroppable)({ id, disabled });
|
|
8827
8901
|
if (!(0, import_react13.isValidElement)(children) || children.type !== "tr") return children;
|
|
8828
8902
|
const row = children;
|
|
8829
8903
|
return (0, import_react13.cloneElement)(row, {
|
|
@@ -8836,33 +8910,13 @@ function ColumnHeaderDropZone({
|
|
|
8836
8910
|
enabled,
|
|
8837
8911
|
children
|
|
8838
8912
|
}) {
|
|
8839
|
-
const { setNodeRef } = (0,
|
|
8913
|
+
const { setNodeRef } = (0, import_core3.useDroppable)({
|
|
8840
8914
|
id: `matrx-column-header:${id}`,
|
|
8841
8915
|
disabled: !enabled,
|
|
8842
8916
|
data: { matrxDragKind: "column-header", columnId: id }
|
|
8843
8917
|
});
|
|
8844
8918
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { ref: setNodeRef, className: "flex min-w-0 items-center", children });
|
|
8845
8919
|
}
|
|
8846
|
-
function ColumnReorderHandle({ id, label }) {
|
|
8847
|
-
const { attributes, listeners, setNodeRef } = (0, import_core2.useDraggable)({
|
|
8848
|
-
id: `matrx-column-header:${id}`,
|
|
8849
|
-
data: { matrxDragKind: "column-header", columnId: id }
|
|
8850
|
-
});
|
|
8851
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
8852
|
-
"button",
|
|
8853
|
-
{
|
|
8854
|
-
ref: setNodeRef,
|
|
8855
|
-
type: "button",
|
|
8856
|
-
className: "mr-1 flex h-7 w-5 shrink-0 touch-none cursor-grab items-center justify-center text-muted-foreground hover:text-foreground active:cursor-grabbing",
|
|
8857
|
-
"aria-label": `Reorder ${label}`,
|
|
8858
|
-
title: `Drag to reorder ${label}`,
|
|
8859
|
-
onClick: (event) => event.stopPropagation(),
|
|
8860
|
-
...attributes,
|
|
8861
|
-
...listeners,
|
|
8862
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(GripVertical, { className: "h-3.5 w-3.5" })
|
|
8863
|
-
}
|
|
8864
|
-
);
|
|
8865
|
-
}
|
|
8866
8920
|
function columnWidthVar(width) {
|
|
8867
8921
|
if (width === void 0) return void 0;
|
|
8868
8922
|
return {
|