@ai-matrx/design-system 0.42.1 → 0.43.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 +14 -0
- package/dist/data-table/copy-helpers.d.cts +1 -1
- package/dist/data-table/copy-helpers.d.ts +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 +75 -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 +75 -3
- 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/{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
|
-
export { _ as LAYERED_FILTER_OPERATORS, $ as LAYERED_FILTER_OPERATOR_LABELS, a0 as LayeredFilterField, a1 as LayeredFilterOperator, L as LayeredFilterRule, a2 as columnFiltersToLayeredRules, a3 as completeLayeredFilterRules, a4 as decodeLayeredFilterRules, a5 as encodeLayeredFilterRules, a6 as isCompleteLayeredFilterRule, a7 as isLayeredFilterOperator, a8 as layeredFilterMatchesValue, a9 as layeredFilterNeedsValue, aa as layeredFilterRuleSummary, ab as operatorsForLayeredField } from '../types-
|
|
1
|
+
export { _ as LAYERED_FILTER_OPERATORS, $ as LAYERED_FILTER_OPERATOR_LABELS, a0 as LayeredFilterField, a1 as LayeredFilterOperator, L as LayeredFilterRule, a2 as columnFiltersToLayeredRules, a3 as completeLayeredFilterRules, a4 as decodeLayeredFilterRules, a5 as encodeLayeredFilterRules, a6 as isCompleteLayeredFilterRule, a7 as isLayeredFilterOperator, a8 as layeredFilterMatchesValue, a9 as layeredFilterNeedsValue, aa as layeredFilterRuleSummary, ab as operatorsForLayeredField } 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
|
-
export { _ as LAYERED_FILTER_OPERATORS, $ as LAYERED_FILTER_OPERATOR_LABELS, a0 as LayeredFilterField, a1 as LayeredFilterOperator, L as LayeredFilterRule, a2 as columnFiltersToLayeredRules, a3 as completeLayeredFilterRules, a4 as decodeLayeredFilterRules, a5 as encodeLayeredFilterRules, a6 as isCompleteLayeredFilterRule, a7 as isLayeredFilterOperator, a8 as layeredFilterMatchesValue, a9 as layeredFilterNeedsValue, aa as layeredFilterRuleSummary, ab as operatorsForLayeredField } from '../types-
|
|
1
|
+
export { _ as LAYERED_FILTER_OPERATORS, $ as LAYERED_FILTER_OPERATOR_LABELS, a0 as LayeredFilterField, a1 as LayeredFilterOperator, L as LayeredFilterRule, a2 as columnFiltersToLayeredRules, a3 as completeLayeredFilterRules, a4 as decodeLayeredFilterRules, a5 as encodeLayeredFilterRules, a6 as isCompleteLayeredFilterRule, a7 as isLayeredFilterOperator, a8 as layeredFilterMatchesValue, a9 as layeredFilterNeedsValue, aa as layeredFilterRuleSummary, ab as operatorsForLayeredField } from '../types-CUR8Hbt5.js';
|
|
2
2
|
import '../content-transfer.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import '@ai-matrx/kit/content-transfer';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedFilterKind } from './infer-filter.cjs';
|
|
2
|
-
import { e as MatrxDataTableQueryState, M as MatrxColumnDef } from '../types-
|
|
2
|
+
import { e as MatrxDataTableQueryState, M as MatrxColumnDef } from '../types-CqU57qk8.cjs';
|
|
3
3
|
import '../content-transfer.cjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@ai-matrx/kit/content-transfer';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedFilterKind } from './infer-filter.js';
|
|
2
|
-
import { e as MatrxDataTableQueryState, M as MatrxColumnDef } from '../types-
|
|
2
|
+
import { e as MatrxDataTableQueryState, M as MatrxColumnDef } from '../types-CUR8Hbt5.js';
|
|
3
3
|
import '../content-transfer.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@ai-matrx/kit/content-transfer';
|
|
@@ -23,6 +23,7 @@ var useSpreadsheetGrid_exports = {};
|
|
|
23
23
|
__export(useSpreadsheetGrid_exports, {
|
|
24
24
|
NO_PATCHES: () => NOTHING,
|
|
25
25
|
READ_ONLY_REASON: () => READ_ONLY_REASON,
|
|
26
|
+
TYPE_CATCHER_ATTR: () => TYPE_CATCHER_ATTR,
|
|
26
27
|
useSpreadsheetGrid: () => useSpreadsheetGrid
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(useSpreadsheetGrid_exports);
|
|
@@ -633,8 +634,23 @@ function undoEntryFor(before, after, label) {
|
|
|
633
634
|
function targetsAnEditor(target) {
|
|
634
635
|
const element = target instanceof Element ? target : null;
|
|
635
636
|
if (!element) return false;
|
|
637
|
+
if (element.closest(`[${TYPE_CATCHER_ATTR}]`)) return false;
|
|
636
638
|
return element.closest("input, textarea, select, [contenteditable='true']") !== null;
|
|
637
639
|
}
|
|
640
|
+
var TYPE_CATCHER_ATTR = "data-matrx-type-catcher";
|
|
641
|
+
var TYPE_CATCHER_STYLE = {
|
|
642
|
+
position: "fixed",
|
|
643
|
+
top: 0,
|
|
644
|
+
left: 0,
|
|
645
|
+
width: 1,
|
|
646
|
+
height: 1,
|
|
647
|
+
padding: 0,
|
|
648
|
+
border: 0,
|
|
649
|
+
opacity: 0,
|
|
650
|
+
overflow: "hidden",
|
|
651
|
+
resize: "none",
|
|
652
|
+
pointerEvents: "none"
|
|
653
|
+
};
|
|
638
654
|
function camePastAPortal(target, host) {
|
|
639
655
|
if (typeof Element === "undefined") return false;
|
|
640
656
|
const element = target instanceof Element ? target : null;
|
|
@@ -655,6 +671,8 @@ function useSpreadsheetGrid(options) {
|
|
|
655
671
|
const [fillTarget, setFillTarget] = (0, import_react.useState)(null);
|
|
656
672
|
const [stack, setStack] = (0, import_react.useState)(() => createUndoStack(options?.undoDepth ?? 100));
|
|
657
673
|
const draggingRef = (0, import_react.useRef)(null);
|
|
674
|
+
const catcherRef = (0, import_react.useRef)(null);
|
|
675
|
+
const composingRef = (0, import_react.useRef)(false);
|
|
658
676
|
const optionsRef = (0, import_react.useRef)(options);
|
|
659
677
|
optionsRef.current = options;
|
|
660
678
|
const rowIds = options?.rowIds ?? [];
|
|
@@ -1033,7 +1051,9 @@ function useSpreadsheetGrid(options) {
|
|
|
1033
1051
|
event.preventDefault();
|
|
1034
1052
|
const origin = event.currentTarget;
|
|
1035
1053
|
if (typeof HTMLElement !== "undefined" && origin instanceof HTMLElement) {
|
|
1036
|
-
origin.closest('[data-matrx-table-spreadsheet="true"]')
|
|
1054
|
+
const container = origin.closest('[data-matrx-table-spreadsheet="true"]');
|
|
1055
|
+
const catcher = container?.querySelector(`[${TYPE_CATCHER_ATTR}]`);
|
|
1056
|
+
(catcher ?? container)?.focus({ preventScroll: true });
|
|
1037
1057
|
}
|
|
1038
1058
|
setRange(
|
|
1039
1059
|
(previous) => event.shiftKey && previous ? { anchor: previous.anchor, focus: address } : { anchor: address, focus: address }
|
|
@@ -1104,11 +1124,58 @@ function useSpreadsheetGrid(options) {
|
|
|
1104
1124
|
window.addEventListener("mouseup", commit);
|
|
1105
1125
|
return () => window.removeEventListener("mouseup", commit);
|
|
1106
1126
|
}, [options, fillRequestBase, applyPatches, announceSkips, screenPatches, refuseWrite]);
|
|
1127
|
+
const takeTypedText = (0, import_react.useCallback)(
|
|
1128
|
+
(text) => {
|
|
1129
|
+
if (catcherRef.current) catcherRef.current.value = "";
|
|
1130
|
+
const current = optionsRef.current;
|
|
1131
|
+
const focused = range?.focus;
|
|
1132
|
+
if (!current || !focused || current.readOnly || !current.onEditRequest) return;
|
|
1133
|
+
if (text.trim() === "") return;
|
|
1134
|
+
current.onEditRequest(focused, text);
|
|
1135
|
+
},
|
|
1136
|
+
[range]
|
|
1137
|
+
);
|
|
1138
|
+
const typeCatcherProps = {
|
|
1139
|
+
ref: (element) => {
|
|
1140
|
+
catcherRef.current = element;
|
|
1141
|
+
},
|
|
1142
|
+
tabIndex: -1,
|
|
1143
|
+
"aria-label": "Type to edit the selected cell",
|
|
1144
|
+
inputMode: "none",
|
|
1145
|
+
autoComplete: "off",
|
|
1146
|
+
autoCorrect: "off",
|
|
1147
|
+
autoCapitalize: "off",
|
|
1148
|
+
spellCheck: false,
|
|
1149
|
+
rows: 1,
|
|
1150
|
+
[TYPE_CATCHER_ATTR]: "",
|
|
1151
|
+
style: TYPE_CATCHER_STYLE,
|
|
1152
|
+
onInput: (event) => {
|
|
1153
|
+
const kind = event.nativeEvent?.inputType;
|
|
1154
|
+
if (typeof kind === "string" && (kind.startsWith("insertFromPaste") || kind.startsWith("insertFromDrop"))) {
|
|
1155
|
+
event.currentTarget.value = "";
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
if (composingRef.current) return;
|
|
1159
|
+
takeTypedText(event.currentTarget.value);
|
|
1160
|
+
},
|
|
1161
|
+
onCompositionStart: () => {
|
|
1162
|
+
composingRef.current = true;
|
|
1163
|
+
},
|
|
1164
|
+
onCompositionEnd: (event) => {
|
|
1165
|
+
composingRef.current = false;
|
|
1166
|
+
takeTypedText(event.data || event.currentTarget.value);
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1107
1169
|
return {
|
|
1108
1170
|
range,
|
|
1109
1171
|
bounds,
|
|
1110
1172
|
enabled: options !== null,
|
|
1173
|
+
typeCatcherProps,
|
|
1111
1174
|
containerProps: {
|
|
1175
|
+
onFocus: (event) => {
|
|
1176
|
+
if (event.target !== event.currentTarget) return;
|
|
1177
|
+
catcherRef.current?.focus({ preventScroll: true });
|
|
1178
|
+
},
|
|
1112
1179
|
tabIndex: options ? 0 : -1,
|
|
1113
1180
|
onKeyDown,
|
|
1114
1181
|
onCopy,
|