@ai-matrx/design-system 0.42.1 → 0.44.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 +32 -0
- package/dist/content-transfer.cjs +39 -0
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.js +39 -0
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/copy-helpers.d.cts +1 -1
- package/dist/data-table/copy-helpers.d.ts +1 -1
- package/dist/data-table/data-row-inspector.cjs +39 -0
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +41 -2
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +39 -0
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +43 -4
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/filter-engine.d.cts +1 -1
- package/dist/data-table/filter-engine.d.ts +1 -1
- package/dist/data-table/host.d.cts +1 -1
- package/dist/data-table/host.d.ts +1 -1
- package/dist/data-table/index.cjs +114 -3
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +2 -2
- package/dist/data-table/index.d.ts +2 -2
- package/dist/data-table/index.js +151 -40
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.d.cts +1 -1
- package/dist/data-table/infer-filter.d.ts +1 -1
- package/dist/data-table/layered-filters.d.cts +1 -1
- package/dist/data-table/layered-filters.d.ts +1 -1
- package/dist/data-table/query-control.d.cts +1 -1
- package/dist/data-table/query-control.d.ts +1 -1
- package/dist/data-table/spreadsheet.cjs +68 -1
- package/dist/data-table/spreadsheet.cjs.map +1 -1
- package/dist/data-table/spreadsheet.d.cts +55 -1
- package/dist/data-table/spreadsheet.d.ts +55 -1
- package/dist/data-table/spreadsheet.js +68 -1
- package/dist/data-table/spreadsheet.js.map +1 -1
- package/dist/data-table/types.cjs.map +1 -1
- package/dist/data-table/types.d.cts +1 -1
- package/dist/data-table/types.d.ts +1 -1
- package/dist/data-table/url-state.d.cts +1 -1
- package/dist/data-table/url-state.d.ts +1 -1
- package/dist/data-table/xlsx.d.cts +1 -1
- package/dist/data-table/xlsx.d.ts +1 -1
- package/dist/index.cjs +43 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +48 -5
- package/dist/index.js.map +1 -1
- package/dist/{types-afUz93xo.d.ts → types-CUR8Hbt5.d.ts} +12 -0
- package/dist/{types-q5ficDSo.d.cts → types-CqU57qk8.d.cts} +12 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MatrxColumnDef, C as ColumnFiltersState, S as SortState, L as LayeredFilterRule, T as TableSearchMatchMode, a as ColumnFilterValue } from '../types-
|
|
1
|
+
import { M as MatrxColumnDef, C as ColumnFiltersState, S as SortState, L as LayeredFilterRule, T as TableSearchMatchMode, a as ColumnFilterValue } from '../types-CqU57qk8.cjs';
|
|
2
2
|
import '../content-transfer.cjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '@ai-matrx/kit/content-transfer';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MatrxColumnDef, C as ColumnFiltersState, S as SortState, L as LayeredFilterRule, T as TableSearchMatchMode, a as ColumnFilterValue } from '../types-
|
|
1
|
+
import { M as MatrxColumnDef, C as ColumnFiltersState, S as SortState, L as LayeredFilterRule, T as TableSearchMatchMode, a as ColumnFilterValue } from '../types-CUR8Hbt5.js';
|
|
2
2
|
import '../content-transfer.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '@ai-matrx/kit/content-transfer';
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ComponentType, ReactNode, MouseEventHandler } from 'react';
|
|
3
3
|
import { CopyControlProps } from './copy-types.cjs';
|
|
4
4
|
export { AgentPayloadInput, AiCustomSource, AiVariant, CopyExportConfig } from './copy-types.cjs';
|
|
5
|
-
import { b as TableSavedViewsProps, c as MatrxDataTableDensity, d as MatrxDataTableRecordControls } from '../types-
|
|
5
|
+
import { b as TableSavedViewsProps, c as MatrxDataTableDensity, d as MatrxDataTableRecordControls } from '../types-CqU57qk8.cjs';
|
|
6
6
|
import { MatrxTableMenuTarget, MatrxTableMenuPayload, MatrxTableMenuSectionsResolver, MatrxTableMenuIconName } from './menu-targets.cjs';
|
|
7
7
|
export { MatrxTableMenuItem, MatrxTableMenuSection } from './menu-targets.cjs';
|
|
8
8
|
import '../content-transfer.cjs';
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ComponentType, ReactNode, MouseEventHandler } from 'react';
|
|
3
3
|
import { CopyControlProps } from './copy-types.js';
|
|
4
4
|
export { AgentPayloadInput, AiCustomSource, AiVariant, CopyExportConfig } from './copy-types.js';
|
|
5
|
-
import { b as TableSavedViewsProps, c as MatrxDataTableDensity, d as MatrxDataTableRecordControls } from '../types-
|
|
5
|
+
import { b as TableSavedViewsProps, c as MatrxDataTableDensity, d as MatrxDataTableRecordControls } from '../types-CUR8Hbt5.js';
|
|
6
6
|
import { MatrxTableMenuTarget, MatrxTableMenuPayload, MatrxTableMenuSectionsResolver, MatrxTableMenuIconName } from './menu-targets.js';
|
|
7
7
|
export { MatrxTableMenuItem, MatrxTableMenuSection } from './menu-targets.js';
|
|
8
8
|
import '../content-transfer.js';
|
|
@@ -1658,6 +1658,15 @@ function useIsMobile() {
|
|
|
1658
1658
|
return isMobile;
|
|
1659
1659
|
}
|
|
1660
1660
|
|
|
1661
|
+
// src/layer-front.ts
|
|
1662
|
+
var LAYER_FRONT_EVENT = "matrx:layer-front";
|
|
1663
|
+
function announceLayerFront(element) {
|
|
1664
|
+
if (typeof document === "undefined") return;
|
|
1665
|
+
document.dispatchEvent(
|
|
1666
|
+
new CustomEvent(LAYER_FRONT_EVENT, { detail: { element } })
|
|
1667
|
+
);
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1661
1670
|
// src/dialog.tsx
|
|
1662
1671
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1663
1672
|
var DialogWindowedByDefaultContext = React11.createContext(false);
|
|
@@ -1728,6 +1737,8 @@ var DialogContent = React11.forwardRef(
|
|
|
1728
1737
|
dismissOnOutsideClick = false,
|
|
1729
1738
|
onInteractOutside,
|
|
1730
1739
|
onEscapeKeyDown,
|
|
1740
|
+
onPointerDownCapture,
|
|
1741
|
+
onFocusCapture,
|
|
1731
1742
|
style,
|
|
1732
1743
|
...props
|
|
1733
1744
|
}, ref) => {
|
|
@@ -1740,6 +1751,24 @@ var DialogContent = React11.forwardRef(
|
|
|
1740
1751
|
const [containerEl, setContainerEl] = React11.useState(
|
|
1741
1752
|
null
|
|
1742
1753
|
);
|
|
1754
|
+
const stacks = windowed && windowedByDefault;
|
|
1755
|
+
const [behind, setBehind] = React11.useState(false);
|
|
1756
|
+
React11.useEffect(() => {
|
|
1757
|
+
if (!stacks || !containerEl) return;
|
|
1758
|
+
const onFront = (event) => {
|
|
1759
|
+
const element = event.detail?.element ?? null;
|
|
1760
|
+
if (element && (element === containerEl || containerEl.contains(element))) return;
|
|
1761
|
+
setBehind(true);
|
|
1762
|
+
};
|
|
1763
|
+
document.addEventListener(LAYER_FRONT_EVENT, onFront);
|
|
1764
|
+
announceLayerFront(containerEl);
|
|
1765
|
+
return () => document.removeEventListener(LAYER_FRONT_EVENT, onFront);
|
|
1766
|
+
}, [stacks, containerEl]);
|
|
1767
|
+
const bringToFront = () => {
|
|
1768
|
+
if (!stacks || !containerEl) return;
|
|
1769
|
+
setBehind(false);
|
|
1770
|
+
announceLayerFront(containerEl);
|
|
1771
|
+
};
|
|
1743
1772
|
const [offset, setOffset] = React11.useState({ x: 0, y: 0 });
|
|
1744
1773
|
const dragRef = React11.useRef(null);
|
|
1745
1774
|
const handle = React11.useMemo(() => {
|
|
@@ -1798,10 +1827,20 @@ var DialogContent = React11.forwardRef(
|
|
|
1798
1827
|
// z=1000); staying below that boundary makes a newly focused window
|
|
1799
1828
|
// usable without coupling the two systems.
|
|
1800
1829
|
!isModal && !windowedByDefault && "z-[900]",
|
|
1830
|
+
// Another layer came to the front after this window (layer-front.ts).
|
|
1831
|
+
stacks && behind && "z-[999]",
|
|
1801
1832
|
// Without an overlay the card needs its own separation from the page.
|
|
1802
1833
|
windowed && "shadow-2xl ring-1 ring-border/60"
|
|
1803
1834
|
),
|
|
1804
1835
|
style: windowed && (offset.x !== 0 || offset.y !== 0) ? { ...style, translate: `${offset.x}px ${offset.y}px` } : style,
|
|
1836
|
+
onPointerDownCapture: (event) => {
|
|
1837
|
+
onPointerDownCapture?.(event);
|
|
1838
|
+
if (behind) bringToFront();
|
|
1839
|
+
},
|
|
1840
|
+
onFocusCapture: (event) => {
|
|
1841
|
+
onFocusCapture?.(event);
|
|
1842
|
+
if (behind) bringToFront();
|
|
1843
|
+
},
|
|
1805
1844
|
onInteractOutside: (event) => {
|
|
1806
1845
|
onInteractOutside?.(event);
|
|
1807
1846
|
if (windowed && !dismissOnOutsideClick) event.preventDefault();
|
|
@@ -8608,8 +8647,23 @@ function canRedo(stack) {
|
|
|
8608
8647
|
function targetsAnEditor(target) {
|
|
8609
8648
|
const element = target instanceof Element ? target : null;
|
|
8610
8649
|
if (!element) return false;
|
|
8650
|
+
if (element.closest(`[${TYPE_CATCHER_ATTR}]`)) return false;
|
|
8611
8651
|
return element.closest("input, textarea, select, [contenteditable='true']") !== null;
|
|
8612
8652
|
}
|
|
8653
|
+
var TYPE_CATCHER_ATTR = "data-matrx-type-catcher";
|
|
8654
|
+
var TYPE_CATCHER_STYLE = {
|
|
8655
|
+
position: "fixed",
|
|
8656
|
+
top: 0,
|
|
8657
|
+
left: 0,
|
|
8658
|
+
width: 1,
|
|
8659
|
+
height: 1,
|
|
8660
|
+
padding: 0,
|
|
8661
|
+
border: 0,
|
|
8662
|
+
opacity: 0,
|
|
8663
|
+
overflow: "hidden",
|
|
8664
|
+
resize: "none",
|
|
8665
|
+
pointerEvents: "none"
|
|
8666
|
+
};
|
|
8613
8667
|
function camePastAPortal(target, host) {
|
|
8614
8668
|
if (typeof Element === "undefined") return false;
|
|
8615
8669
|
const element = target instanceof Element ? target : null;
|
|
@@ -8629,6 +8683,8 @@ function useSpreadsheetGrid(options) {
|
|
|
8629
8683
|
const [fillTarget, setFillTarget] = (0, import_react15.useState)(null);
|
|
8630
8684
|
const [stack, setStack] = (0, import_react15.useState)(() => createUndoStack(options?.undoDepth ?? 100));
|
|
8631
8685
|
const draggingRef = (0, import_react15.useRef)(null);
|
|
8686
|
+
const catcherRef = (0, import_react15.useRef)(null);
|
|
8687
|
+
const composingRef = (0, import_react15.useRef)(false);
|
|
8632
8688
|
const optionsRef = (0, import_react15.useRef)(options);
|
|
8633
8689
|
optionsRef.current = options;
|
|
8634
8690
|
const rowIds = options?.rowIds ?? [];
|
|
@@ -9007,7 +9063,9 @@ function useSpreadsheetGrid(options) {
|
|
|
9007
9063
|
event.preventDefault();
|
|
9008
9064
|
const origin = event.currentTarget;
|
|
9009
9065
|
if (typeof HTMLElement !== "undefined" && origin instanceof HTMLElement) {
|
|
9010
|
-
origin.closest('[data-matrx-table-spreadsheet="true"]')
|
|
9066
|
+
const container = origin.closest('[data-matrx-table-spreadsheet="true"]');
|
|
9067
|
+
const catcher = container?.querySelector(`[${TYPE_CATCHER_ATTR}]`);
|
|
9068
|
+
(catcher ?? container)?.focus({ preventScroll: true });
|
|
9011
9069
|
}
|
|
9012
9070
|
setRange(
|
|
9013
9071
|
(previous) => event.shiftKey && previous ? { anchor: previous.anchor, focus: address } : { anchor: address, focus: address }
|
|
@@ -9078,11 +9136,58 @@ function useSpreadsheetGrid(options) {
|
|
|
9078
9136
|
window.addEventListener("mouseup", commit);
|
|
9079
9137
|
return () => window.removeEventListener("mouseup", commit);
|
|
9080
9138
|
}, [options, fillRequestBase, applyPatches, announceSkips, screenPatches, refuseWrite]);
|
|
9139
|
+
const takeTypedText = (0, import_react15.useCallback)(
|
|
9140
|
+
(text) => {
|
|
9141
|
+
if (catcherRef.current) catcherRef.current.value = "";
|
|
9142
|
+
const current = optionsRef.current;
|
|
9143
|
+
const focused = range?.focus;
|
|
9144
|
+
if (!current || !focused || current.readOnly || !current.onEditRequest) return;
|
|
9145
|
+
if (text.trim() === "") return;
|
|
9146
|
+
current.onEditRequest(focused, text);
|
|
9147
|
+
},
|
|
9148
|
+
[range]
|
|
9149
|
+
);
|
|
9150
|
+
const typeCatcherProps = {
|
|
9151
|
+
ref: (element) => {
|
|
9152
|
+
catcherRef.current = element;
|
|
9153
|
+
},
|
|
9154
|
+
tabIndex: -1,
|
|
9155
|
+
"aria-label": "Type to edit the selected cell",
|
|
9156
|
+
inputMode: "none",
|
|
9157
|
+
autoComplete: "off",
|
|
9158
|
+
autoCorrect: "off",
|
|
9159
|
+
autoCapitalize: "off",
|
|
9160
|
+
spellCheck: false,
|
|
9161
|
+
rows: 1,
|
|
9162
|
+
[TYPE_CATCHER_ATTR]: "",
|
|
9163
|
+
style: TYPE_CATCHER_STYLE,
|
|
9164
|
+
onInput: (event) => {
|
|
9165
|
+
const kind = event.nativeEvent?.inputType;
|
|
9166
|
+
if (typeof kind === "string" && (kind.startsWith("insertFromPaste") || kind.startsWith("insertFromDrop"))) {
|
|
9167
|
+
event.currentTarget.value = "";
|
|
9168
|
+
return;
|
|
9169
|
+
}
|
|
9170
|
+
if (composingRef.current) return;
|
|
9171
|
+
takeTypedText(event.currentTarget.value);
|
|
9172
|
+
},
|
|
9173
|
+
onCompositionStart: () => {
|
|
9174
|
+
composingRef.current = true;
|
|
9175
|
+
},
|
|
9176
|
+
onCompositionEnd: (event) => {
|
|
9177
|
+
composingRef.current = false;
|
|
9178
|
+
takeTypedText(event.data || event.currentTarget.value);
|
|
9179
|
+
}
|
|
9180
|
+
};
|
|
9081
9181
|
return {
|
|
9082
9182
|
range,
|
|
9083
9183
|
bounds,
|
|
9084
9184
|
enabled: options !== null,
|
|
9185
|
+
typeCatcherProps,
|
|
9085
9186
|
containerProps: {
|
|
9187
|
+
onFocus: (event) => {
|
|
9188
|
+
if (event.target !== event.currentTarget) return;
|
|
9189
|
+
catcherRef.current?.focus({ preventScroll: true });
|
|
9190
|
+
},
|
|
9086
9191
|
tabIndex: options ? 0 : -1,
|
|
9087
9192
|
onKeyDown,
|
|
9088
9193
|
onCopy,
|
|
@@ -14069,13 +14174,17 @@ function MatrxDataTableCore({
|
|
|
14069
14174
|
}));
|
|
14070
14175
|
};
|
|
14071
14176
|
const requestCellEdit = (address, seed) => {
|
|
14072
|
-
if (!editEnabled) return false;
|
|
14177
|
+
if (!editEnabled && !spreadsheet?.onEditRequest) return false;
|
|
14073
14178
|
const row = data.find((candidate) => getRowId(candidate) === address.rowId);
|
|
14074
14179
|
if (!row) return false;
|
|
14075
14180
|
const column = visibleColumns.find(
|
|
14076
14181
|
(candidate) => columnId(candidate) === address.fieldName
|
|
14077
14182
|
);
|
|
14078
|
-
if (!column?.editable
|
|
14183
|
+
if (!column?.editable) {
|
|
14184
|
+
const own = spreadsheet?.onEditRequest;
|
|
14185
|
+
return own ? own({ rowId: address.rowId, columnId: address.fieldName }, seed) : false;
|
|
14186
|
+
}
|
|
14187
|
+
if (!(column.editableIf?.(row) ?? true)) return false;
|
|
14079
14188
|
const field = column.accessorKey ? String(column.accessorKey) : columnId(column);
|
|
14080
14189
|
setEditRequest((current) => ({
|
|
14081
14190
|
rowId: address.rowId,
|
|
@@ -15204,6 +15313,7 @@ function MatrxDataTableCore({
|
|
|
15204
15313
|
onCopy: sheet.containerProps.onCopy,
|
|
15205
15314
|
onCut: sheet.containerProps.onCut,
|
|
15206
15315
|
onPaste: sheet.containerProps.onPaste,
|
|
15316
|
+
onFocus: sheet.containerProps.onFocus,
|
|
15207
15317
|
"data-matrx-table-spreadsheet": "true"
|
|
15208
15318
|
} : {},
|
|
15209
15319
|
"aria-busy": isLoading || isFetching,
|
|
@@ -15214,6 +15324,7 @@ function MatrxDataTableCore({
|
|
|
15214
15324
|
tableClassName
|
|
15215
15325
|
),
|
|
15216
15326
|
children: [
|
|
15327
|
+
spreadsheetEnabled ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("textarea", { ...sheet.typeCatcherProps }) : null,
|
|
15217
15328
|
hierarchy && draggedRow ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
15218
15329
|
HierarchyRootDropTarget,
|
|
15219
15330
|
{
|