@ai-matrx/design-system 0.56.2 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/README.md +5 -1
- package/dist/data-table/index.cjs +61 -17
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +61 -17
- package/dist/data-table/index.js.map +1 -1
- package/package.json +1 -1
package/dist/data-table/index.js
CHANGED
|
@@ -52873,7 +52873,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
52873
52873
|
if (!el) return;
|
|
52874
52874
|
hintScrollLeft.current = el.scrollLeft;
|
|
52875
52875
|
const hasRows = Boolean(el.querySelector("tbody tr[data-row-id]"));
|
|
52876
|
-
const actions = el.querySelector("th[data-matrx-table-actions-column]");
|
|
52876
|
+
const actions = el.querySelector("th[data-matrx-table-actions-column], th[data-matrx-table-pinned-actions]");
|
|
52877
52877
|
setScrollHintRight(hasRows && el.scrollLeft + el.clientWidth < el.scrollWidth - 2);
|
|
52878
52878
|
setScrollHintLeft(hasRows && el.scrollLeft > 2);
|
|
52879
52879
|
setScrollHintRightInset(actions ? Math.ceil(actions.getBoundingClientRect().width) + 6 : 6);
|
|
@@ -53193,13 +53193,24 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53193
53193
|
...strips.map((strip) => Math.ceil(strip.scrollWidth) + 16),
|
|
53194
53194
|
actionsHeader ? Math.ceil(actionsHeader.scrollWidth) : 0
|
|
53195
53195
|
);
|
|
53196
|
+
const custom = {};
|
|
53197
|
+
for (const strip of Array.from(el.querySelectorAll("[data-matrx-table-custom-actions]"))) {
|
|
53198
|
+
const id = strip.closest("td")?.getAttribute("data-matrx-table-column-id");
|
|
53199
|
+
if (id) custom[id] = Math.max(custom[id] ?? 0, Math.ceil(strip.scrollWidth) + 16);
|
|
53200
|
+
}
|
|
53201
|
+
for (const id of Object.keys(custom)) {
|
|
53202
|
+
const header = Array.from(el.querySelectorAll("thead th[data-matrx-table-column-id]")).find((th) => th.getAttribute("data-matrx-table-column-id") === id);
|
|
53203
|
+
const inner = header?.firstElementChild;
|
|
53204
|
+
if (inner) custom[id] = Math.max(custom[id], Math.ceil(inner.scrollWidth) + 16);
|
|
53205
|
+
}
|
|
53196
53206
|
const table2 = el.querySelector(":scope > table");
|
|
53197
53207
|
const spill = table2 && table2.hasAttribute("data-matrx-table-fit") ? Math.max(0, el.scrollWidth - el.clientWidth) : 0;
|
|
53198
53208
|
setFitSpace((now) => {
|
|
53199
53209
|
const sameWidth = now !== null && now.width === el.clientWidth;
|
|
53200
53210
|
const slack = sameWidth ? now.slack + spill : spill;
|
|
53201
|
-
const next = { width: el.clientWidth, actions, slack };
|
|
53202
|
-
|
|
53211
|
+
const next = { width: el.clientWidth, actions, slack, custom };
|
|
53212
|
+
const sameCustom = now !== null && Object.keys(now.custom).length === Object.keys(custom).length && Object.entries(custom).every(([id, w]) => now.custom[id] === w);
|
|
53213
|
+
return now && sameCustom && now.width === next.width && now.actions === next.actions && now.slack === next.slack ? now : next;
|
|
53203
53214
|
});
|
|
53204
53215
|
};
|
|
53205
53216
|
read2();
|
|
@@ -53212,11 +53223,12 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53212
53223
|
}, [fitToWidth, data.length]);
|
|
53213
53224
|
const fittedWidths = useMemo12(() => {
|
|
53214
53225
|
if (!fitToWidth || !fitSpace) return null;
|
|
53215
|
-
const
|
|
53226
|
+
const contentWidth = (col) => col.customActions ? fitSpace.custom[columnId(col)] : void 0;
|
|
53227
|
+
const keepsItsWidth = (col) => resolveColumnMarker(col) !== void 0 || col.resizable === false && pixelWidth(col.width) !== void 0 || contentWidth(col) !== void 0;
|
|
53216
53228
|
const scaling = visibleColumns.filter((col) => !keepsItsWidth(col));
|
|
53217
|
-
const fixed = visibleColumns.filter(keepsItsWidth).reduce((sum, col) => sum + (pixelWidth(col.width) ?? 40), 0);
|
|
53229
|
+
const fixed = visibleColumns.filter(keepsItsWidth).reduce((sum, col) => sum + (contentWidth(col) ?? pixelWidth(col.width) ?? 40), 0);
|
|
53218
53230
|
const utilities = (selection ? selectionColumnWidth ?? SELECTION_COLUMN_PX : 0) + fitSpace.actions;
|
|
53219
|
-
|
|
53231
|
+
const shares = fitColumnWidths(
|
|
53220
53232
|
scaling.map(columnId),
|
|
53221
53233
|
(id) => {
|
|
53222
53234
|
const col = scaling.find((c) => columnId(c) === id);
|
|
@@ -53224,6 +53236,13 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53224
53236
|
},
|
|
53225
53237
|
fitSpace.width - utilities - fixed - fitSpace.slack
|
|
53226
53238
|
);
|
|
53239
|
+
if (!shares) return null;
|
|
53240
|
+
const out = { ...shares };
|
|
53241
|
+
for (const col of visibleColumns) {
|
|
53242
|
+
const w = contentWidth(col);
|
|
53243
|
+
if (w !== void 0) out[columnId(col)] = w;
|
|
53244
|
+
}
|
|
53245
|
+
return out;
|
|
53227
53246
|
}, [fitToWidth, fitSpace, visibleColumns, selection, selectionColumnWidth, effectiveColumnWidths]);
|
|
53228
53247
|
const fitActive = fittedWidths !== null;
|
|
53229
53248
|
const actionsColumnWidth = fitActive && fitSpace ? fitSpace.actions : fixedTableGeometry?.actionsWidth;
|
|
@@ -53906,7 +53925,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
53906
53925
|
const showRowCopy = effectiveCopy !== void 0 && effectiveCopy.showRow !== false;
|
|
53907
53926
|
const menuActionsColumn = visibleColumns.find((column) => column.customActions);
|
|
53908
53927
|
const rowCopyInMenu = rowCopyPlacement === "menu" && menuActionsColumn !== void 0;
|
|
53909
|
-
const
|
|
53928
|
+
const rowCopyInCustomColumn = showRowCopy && !rowCopyInMenu && menuActionsColumn !== void 0;
|
|
53929
|
+
const showInlineRowCopy = showRowCopy && !rowCopyInMenu && !rowCopyInCustomColumn;
|
|
53910
53930
|
const showToolbarCopy = effectiveCopy !== void 0 && effectiveCopy.showToolbar !== false;
|
|
53911
53931
|
const placeToolbar = (node) => {
|
|
53912
53932
|
if (toolbar && "portalInto" in toolbar) {
|
|
@@ -54594,6 +54614,8 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54594
54614
|
);
|
|
54595
54615
|
}, [host.rowContextRegistry, tableContextMenuInstanceId]);
|
|
54596
54616
|
const showActionsCol = windowEnabled || Boolean(rowActions) || showInlineRowCopy;
|
|
54617
|
+
const lastVisibleColumn = visibleColumns[visibleColumns.length - 1];
|
|
54618
|
+
const pinnedActionsColumnId = !showActionsCol && lastVisibleColumn?.customActions ? columnId(lastVisibleColumn) : void 0;
|
|
54597
54619
|
const getSelectionId = selection?.getSelectionId ?? getRowId;
|
|
54598
54620
|
const selectedIdSet = useMemo12(
|
|
54599
54621
|
() => new Set(selection?.selectedIds ?? []),
|
|
@@ -54666,15 +54688,28 @@ function MatrxDataTableCore(coreProps) {
|
|
|
54666
54688
|
if (col.customActions) {
|
|
54667
54689
|
const controls = suppliedControls ?? liveRecordControls(displayRow);
|
|
54668
54690
|
const content = /* @__PURE__ */ jsx59(MatrxTableRowControlsScope, { value: controls, children: col.customActions(displayRow, controls) });
|
|
54669
|
-
|
|
54670
|
-
|
|
54671
|
-
|
|
54672
|
-
|
|
54673
|
-
|
|
54674
|
-
|
|
54675
|
-
|
|
54676
|
-
|
|
54677
|
-
|
|
54691
|
+
const copyHere = rowCopyInCustomColumn && effectiveCopy && menuActionsColumn !== void 0 && columnId(col) === columnId(menuActionsColumn);
|
|
54692
|
+
return /* @__PURE__ */ jsxs48("div", { "data-matrx-table-custom-actions": true, "data-matrx-cell-control": true, className: cn("inline-flex items-center justify-end gap-0", compactRows && "[&_button]:h-6 [&_button]:min-h-6"), onClick: (event) => event.stopPropagation(), children: [
|
|
54693
|
+
copyHere && effectiveCopy ? /* @__PURE__ */ jsx59(
|
|
54694
|
+
TableRowCopyControl,
|
|
54695
|
+
{
|
|
54696
|
+
size: "toolbar",
|
|
54697
|
+
copy: effectiveCopy,
|
|
54698
|
+
row: displayRow,
|
|
54699
|
+
sourceId: `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`,
|
|
54700
|
+
...copy === void 0 ? { defaultColumns: declaredVisibleCopyColumns } : {}
|
|
54701
|
+
}
|
|
54702
|
+
) : null,
|
|
54703
|
+
effectiveCopy && showRowCopy ? /* @__PURE__ */ jsx59(
|
|
54704
|
+
MatrxTableRowAlchemyProvider,
|
|
54705
|
+
{
|
|
54706
|
+
copy: tableRowCopyProps(effectiveCopy, displayRow, `${tableCopySourceNamespace}:row:${getRowId(displayRow)}`, copy === void 0 ? declaredVisibleCopyColumns : void 0),
|
|
54707
|
+
placement: rowCopyInMenu && columnId(col) === (menuActionsColumn ? columnId(menuActionsColumn) : void 0) ? "menu" : "inline",
|
|
54708
|
+
controls,
|
|
54709
|
+
children: content
|
|
54710
|
+
}
|
|
54711
|
+
) : content
|
|
54712
|
+
] });
|
|
54678
54713
|
}
|
|
54679
54714
|
const display = renderCell(displayRow, col, index);
|
|
54680
54715
|
const href = col.href?.(row) ?? void 0;
|
|
@@ -55178,6 +55213,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55178
55213
|
"td",
|
|
55179
55214
|
{
|
|
55180
55215
|
"data-matrx-table-column-id": columnId(col),
|
|
55216
|
+
"data-matrx-table-pinned-actions": pinnedActionsColumnId === columnId(col) ? "" : void 0,
|
|
55181
55217
|
"data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
|
|
55182
55218
|
...sheetCell ? {
|
|
55183
55219
|
"data-matrx-cell-row": sheetCell["data-matrx-cell-row"],
|
|
@@ -55216,6 +55252,11 @@ function MatrxDataTableCore(coreProps) {
|
|
|
55216
55252
|
frozen && sheetCell?.["data-matrx-cell-selected"] && "sm:bg-[color-mix(in_oklab,var(--color-primary)_10%,var(--color-card))]",
|
|
55217
55253
|
frozen && canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]",
|
|
55218
55254
|
frozenEdgeId === columnId(col) && FROZEN_EDGE_CLASS,
|
|
55255
|
+
pinnedActionsColumnId === columnId(col) && [
|
|
55256
|
+
"text-right sm:sticky sm:right-0 sm:z-20 sm:shadow-[inset_1px_0_0_var(--color-border)]",
|
|
55257
|
+
frozenRowBackgroundClass,
|
|
55258
|
+
canHoverFrozenCell && "sm:group-hover/matrx-row:bg-[color-mix(in_oklab,var(--color-muted)_50%,var(--color-card))]"
|
|
55259
|
+
],
|
|
55219
55260
|
// A cell tint paints OVER the row tint beneath
|
|
55220
55261
|
// it, and the consumer's own hook comes last so
|
|
55221
55262
|
// it can always win.
|
|
@@ -56198,6 +56239,7 @@ function MatrxDataTableCore(coreProps) {
|
|
|
56198
56239
|
{
|
|
56199
56240
|
"data-matrx-table-column-id": id,
|
|
56200
56241
|
"data-matrx-header-column-id": id,
|
|
56242
|
+
"data-matrx-table-pinned-actions": pinnedActionsColumnId === id ? "" : void 0,
|
|
56201
56243
|
"data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
|
|
56202
56244
|
"aria-sort": isSorted ? sort?.direction === "asc" ? "ascending" : "descending" : void 0,
|
|
56203
56245
|
className: cn(
|
|
@@ -56225,7 +56267,9 @@ function MatrxDataTableCore(coreProps) {
|
|
|
56225
56267
|
frozenColumns.offsets[id] !== void 0 && FROZEN_HEADER_CLASS,
|
|
56226
56268
|
phoneFrozenId === id && FROZEN_PHONE_HEADER_CLASS,
|
|
56227
56269
|
embedded && (frozenColumns.offsets[id] !== void 0 || phoneFrozenId === id) && "sm:bg-card max-sm:bg-card",
|
|
56228
|
-
frozenEdgeId === id && FROZEN_EDGE_CLASS
|
|
56270
|
+
frozenEdgeId === id && FROZEN_EDGE_CLASS,
|
|
56271
|
+
pinnedActionsColumnId === id && "sm:sticky sm:right-0 sm:z-30 sm:bg-muted sm:shadow-[inset_1px_0_0_var(--color-border)]",
|
|
56272
|
+
pinnedActionsColumnId === id && embedded && "sm:bg-card"
|
|
56229
56273
|
),
|
|
56230
56274
|
style: {
|
|
56231
56275
|
...columnWidthVar(width, windowedWidthFor(id, width), id, columnResizable),
|