@ishibashi0112/spreadsheet-grid-core 1.0.1 → 1.1.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/dist/controllers/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.js +4 -2
- package/dist/controllers/clipboardController.cjs +1 -2
- package/dist/controllers/clipboardController.d.ts +3 -0
- package/dist/controllers/clipboardController.js +78 -59
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +3 -1
- package/dist/controllers/columnAutosizeRunner.js +12 -10
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +146 -140
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.js +71 -69
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.d.ts +4 -1
- package/dist/controllers/contextMenuController.js +55 -38
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +78 -78
- package/dist/controllers/escapeClaimController.cjs +1 -1
- package/dist/controllers/escapeClaimController.d.ts +1 -0
- package/dist/controllers/escapeClaimController.js +11 -5
- package/dist/controllers/fillHandleController.cjs +1 -1
- package/dist/controllers/fillHandleController.d.ts +1 -0
- package/dist/controllers/fillHandleController.js +148 -147
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +81 -77
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.d.ts +1 -0
- package/dist/controllers/findController.js +36 -29
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.d.ts +6 -0
- package/dist/controllers/historyController.js +79 -37
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +1 -0
- package/dist/controllers/keyboardController.js +116 -116
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +1 -0
- package/dist/controllers/pointerInteractionsController.js +142 -142
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +1 -0
- package/dist/controllers/popoverSupport.js +17 -7
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +151 -149
- package/dist/controllers/rowEnterController.cjs +1 -1
- package/dist/controllers/rowEnterController.d.ts +1 -0
- package/dist/controllers/rowEnterController.js +47 -42
- package/dist/controllers/toolPanelController.cjs +1 -1
- package/dist/controllers/toolPanelController.js +26 -14
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +85 -66
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +4 -1
- package/dist/controllers/viewportSyncController.js +89 -30
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +16 -9
- package/dist/engine/filterPopoverCommands.cjs +1 -1
- package/dist/engine/filterPopoverCommands.d.ts +2 -0
- package/dist/engine/filterPopoverCommands.js +15 -15
- package/dist/engine/fullFeatures.cjs +1 -1
- package/dist/engine/fullFeatures.js +17 -17
- package/dist/engine/gridApi.cjs +3 -3
- package/dist/engine/gridApi.d.ts +7 -2
- package/dist/engine/gridApi.js +16 -16
- package/dist/engine/rowSelectionCommands.cjs +1 -1
- package/dist/engine/rowSelectionCommands.d.ts +1 -0
- package/dist/engine/rowSelectionCommands.js +21 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -6
- package/dist/locales/en.cjs +1 -1
- package/dist/locales/en.js +10 -4
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +2 -0
- package/dist/logic/autoScrollGeometry.js +3 -3
- package/dist/logic/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.d.ts +8 -2
- package/dist/logic/columnAutosize.js +102 -87
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +4 -0
- package/dist/logic/detailRow.js +18 -15
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +1 -0
- package/dist/logic/editorValues.js +37 -34
- package/dist/logic/exportCsv.cjs +3 -3
- package/dist/logic/exportCsv.d.ts +3 -1
- package/dist/logic/exportCsv.js +22 -20
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +3 -1
- package/dist/logic/exportData.js +40 -36
- package/dist/logic/filterSummary.cjs +1 -1
- package/dist/logic/filterSummary.js +9 -2
- package/dist/logic/filtering.cjs +1 -1
- package/dist/logic/filtering.d.ts +2 -1
- package/dist/logic/filtering.js +16 -3
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.d.ts +4 -3
- package/dist/logic/find.js +27 -13
- package/dist/logic/gridAsk.cjs +2 -2
- package/dist/logic/gridAsk.d.ts +7 -7
- package/dist/logic/gridAsk.js +140 -122
- package/dist/logic/gridAskLocaleText.cjs +1 -1
- package/dist/logic/gridAskLocaleText.d.ts +2 -0
- package/dist/logic/gridAskLocaleText.js +1 -0
- package/dist/logic/gridState.d.ts +2 -2
- package/dist/logic/groupExport.cjs +1 -1
- package/dist/logic/groupExport.js +28 -27
- package/dist/logic/grouping.cjs +1 -1
- package/dist/logic/grouping.d.ts +1 -0
- package/dist/logic/grouping.js +52 -41
- package/dist/logic/historyRebase.cjs +1 -0
- package/dist/logic/historyRebase.d.ts +5 -0
- package/dist/logic/historyRebase.js +36 -0
- package/dist/logic/localeText.cjs +1 -1
- package/dist/logic/localeText.d.ts +2 -0
- package/dist/logic/localeText.js +1 -0
- package/dist/logic/localeTextFeatures.cjs +1 -1
- package/dist/logic/localeTextFeatures.d.ts +4 -0
- package/dist/logic/localeTextFeatures.js +10 -7
- package/dist/logic/localeTextFilters.cjs +1 -1
- package/dist/logic/localeTextFilters.d.ts +1 -0
- package/dist/logic/localeTextFilters.js +1 -0
- package/dist/logic/localeTextPopups.cjs +1 -1
- package/dist/logic/localeTextPopups.d.ts +1 -0
- package/dist/logic/localeTextPopups.js +3 -2
- package/dist/logic/numberFilterCondition.cjs +1 -1
- package/dist/logic/numberFilterCondition.d.ts +1 -1
- package/dist/logic/numberFilterCondition.js +5 -5
- package/dist/logic/scrollTargets.cjs +1 -1
- package/dist/logic/scrollTargets.js +2 -2
- package/dist/logic/selectEditorState.cjs +1 -1
- package/dist/logic/selectEditorState.d.ts +1 -0
- package/dist/logic/selectEditorState.js +8 -1
- package/dist/logic/selectLabels.cjs +1 -0
- package/dist/logic/selectLabels.d.ts +3 -0
- package/dist/logic/selectLabels.js +41 -0
- package/dist/logic/valueFormatters.d.ts +5 -5
- package/dist/logic/valueParsers.cjs +1 -0
- package/dist/logic/valueParsers.d.ts +14 -0
- package/dist/logic/valueParsers.js +23 -0
- package/dist/logic/verticalGeometry.cjs +1 -1
- package/dist/logic/verticalGeometry.d.ts +1 -0
- package/dist/logic/verticalGeometry.js +12 -8
- package/dist/model/gridActions.cjs +1 -1
- package/dist/model/gridActions.d.ts +2 -1
- package/dist/model/gridActions.js +3 -2
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +145 -62
- package/dist/model/gridTypes.core.d.ts +492 -315
- package/dist/utils/clipboard.cjs +4 -6
- package/dist/utils/clipboard.d.ts +15 -2
- package/dist/utils/clipboard.js +103 -48
- package/dist/utils/popupContainer.cjs +1 -0
- package/dist/utils/popupContainer.d.ts +8 -0
- package/dist/utils/popupContainer.js +60 -0
- package/package.json +1 -1
|
@@ -1,124 +1,126 @@
|
|
|
1
1
|
import { createValueStore as e } from "../logic/valueStore.js";
|
|
2
|
-
import { blurForPopover as t, createPopoverWindowBindings as n,
|
|
2
|
+
import { blurForPopover as t, createPopoverWindowBindings as n, focusPanelIfIdle as r, handleMenuKeyNavigation as i, isInsideGridRoot as a, restoreGridFocus as o } from "./popoverSupport.js";
|
|
3
3
|
//#region src/controllers/columnMenuController.ts
|
|
4
|
-
var
|
|
5
|
-
let
|
|
4
|
+
var s = 220, c = ".ssg-menu-item", l = 8, u = 6, d = 289, f = () => {
|
|
5
|
+
let f = null, p = e({
|
|
6
6
|
columnKey: null,
|
|
7
7
|
layout: null
|
|
8
|
-
}),
|
|
9
|
-
let t =
|
|
10
|
-
n === e || n !== null && e !== null && n.top === e.top && n.left === e.left && n.width === e.width && n.maxHeight === e.maxHeight ||
|
|
8
|
+
}), m = { current: null }, h = null, g = !1, _ = null, v = null, y = null, b = (e) => {
|
|
9
|
+
let t = p.getSnapshot(), n = t.layout;
|
|
10
|
+
n === e || n !== null && e !== null && n.top === e.top && n.left === e.left && n.width === e.width && n.maxHeight === e.maxHeight || p.setSnapshot({
|
|
11
11
|
...t,
|
|
12
12
|
layout: e
|
|
13
13
|
});
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, x = () => {
|
|
15
|
+
y !== null && (cancelAnimationFrame(y), y = null), T.detach(), p.setSnapshot({
|
|
16
16
|
columnKey: null,
|
|
17
17
|
layout: null
|
|
18
18
|
});
|
|
19
|
-
},
|
|
20
|
-
if (
|
|
21
|
-
|
|
19
|
+
}, S = () => {
|
|
20
|
+
if (p.getSnapshot().columnKey === null) {
|
|
21
|
+
b(null);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
let e, t, n, r =
|
|
25
|
-
if (
|
|
26
|
-
if (!
|
|
27
|
-
|
|
24
|
+
let e, t, n, r = m.current, i = r ? r.scrollHeight + (r.offsetHeight - r.clientHeight) : d;
|
|
25
|
+
if (h) {
|
|
26
|
+
if (!h.isConnected) {
|
|
27
|
+
h = null, x();
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
let r =
|
|
31
|
-
t = r.right -
|
|
32
|
-
} else if (
|
|
30
|
+
let r = h.getBoundingClientRect();
|
|
31
|
+
t = r.right - s, e = r.bottom + u, n = r.top - i - u;
|
|
32
|
+
} else if (_) t = _.x, e = _.y, n = _.y - i;
|
|
33
33
|
else {
|
|
34
|
-
|
|
34
|
+
b(null);
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
t = Math.max(
|
|
38
|
-
let a = window.innerHeight -
|
|
39
|
-
e + i > a && n >=
|
|
40
|
-
let
|
|
41
|
-
|
|
37
|
+
t = Math.max(l, t), t = Math.min(t, window.innerWidth - s - l);
|
|
38
|
+
let a = window.innerHeight - l;
|
|
39
|
+
e + i > a && n >= l && (e = n), e = Math.max(l, e);
|
|
40
|
+
let o = a - e;
|
|
41
|
+
b({
|
|
42
42
|
top: e,
|
|
43
43
|
left: t,
|
|
44
|
-
width:
|
|
45
|
-
maxHeight: i >
|
|
44
|
+
width: s,
|
|
45
|
+
maxHeight: i > o ? Math.max(o, 0) : void 0
|
|
46
46
|
});
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
onResize:
|
|
51
|
-
onScroll: () => {
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
}, C = (e) => {
|
|
48
|
+
x(), h = null, _ = null, f !== null && e && o(f.gridRootRef);
|
|
49
|
+
}, w = () => C(!0), T = n({
|
|
50
|
+
onResize: S,
|
|
51
|
+
onScroll: (e) => {
|
|
52
|
+
if (!(e.target instanceof Node && m.current?.contains(e.target))) {
|
|
53
|
+
if (_) {
|
|
54
|
+
w();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
S();
|
|
55
58
|
}
|
|
56
|
-
x();
|
|
57
59
|
},
|
|
58
|
-
isInside: (e) =>
|
|
59
|
-
onOutsidePointerDown: (e) =>
|
|
60
|
-
getGridRoot: () =>
|
|
61
|
-
onGridHidden: () =>
|
|
60
|
+
isInside: (e) => m.current?.contains(e) === !0 || h?.contains(e) === !0,
|
|
61
|
+
onOutsidePointerDown: (e) => C(f !== null && a(f.gridRootRef, e)),
|
|
62
|
+
getGridRoot: () => f?.gridRootRef.current ?? null,
|
|
63
|
+
onGridHidden: () => C(!1),
|
|
62
64
|
onKeyDown: (e) => {
|
|
63
65
|
if (e.key === "Escape") {
|
|
64
|
-
e.preventDefault(),
|
|
66
|
+
e.preventDefault(), w();
|
|
65
67
|
return;
|
|
66
68
|
}
|
|
67
|
-
let t =
|
|
68
|
-
if (!t ||
|
|
69
|
+
let t = m.current;
|
|
70
|
+
if (!t || i(t, e, c)) return;
|
|
69
71
|
let n = document.activeElement;
|
|
70
|
-
e.key === "Tab" && n instanceof HTMLElement && n.matches(
|
|
72
|
+
e.key === "Tab" && n instanceof HTMLElement && (n === t || n.matches(c) && t.contains(n)) && (e.preventDefault(), w());
|
|
71
73
|
}
|
|
72
|
-
}),
|
|
73
|
-
|
|
74
|
-
...
|
|
74
|
+
}), E = (e) => {
|
|
75
|
+
p.setSnapshot({
|
|
76
|
+
...p.getSnapshot(),
|
|
75
77
|
columnKey: e
|
|
76
|
-
}),
|
|
77
|
-
|
|
78
|
-
}),
|
|
79
|
-
},
|
|
80
|
-
t(
|
|
78
|
+
}), S(), y !== null && cancelAnimationFrame(y), y = requestAnimationFrame(() => {
|
|
79
|
+
y = null, S(), g ? (g = !1, m.current?.querySelector(c)?.focus()) : r(m.current, f?.gridRootRef.current ?? null);
|
|
80
|
+
}), T.attach();
|
|
81
|
+
}, D = (e, n, r = !1) => {
|
|
82
|
+
t(f?.gridRootRef.current ?? null), h = n, _ = null, g = r, E(e.key);
|
|
81
83
|
};
|
|
82
84
|
return {
|
|
83
85
|
update: (e) => {
|
|
84
|
-
|
|
86
|
+
f = e;
|
|
85
87
|
},
|
|
86
|
-
subscribe:
|
|
87
|
-
getSnapshot:
|
|
88
|
-
panelRef:
|
|
88
|
+
subscribe: p.subscribe,
|
|
89
|
+
getSnapshot: p.getSnapshot,
|
|
90
|
+
panelRef: m,
|
|
89
91
|
openFromButton: (e, t) => {
|
|
90
|
-
if (t.preventDefault(), t.stopPropagation(), !
|
|
92
|
+
if (t.preventDefault(), t.stopPropagation(), !f?.enableColumnMenu || t.button !== 0) return;
|
|
91
93
|
let n = t.currentTarget;
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
+
if (p.getSnapshot().columnKey === e.key && h === n) {
|
|
95
|
+
w();
|
|
94
96
|
return;
|
|
95
97
|
}
|
|
96
98
|
if (t.pointerType === "touch") {
|
|
97
|
-
|
|
99
|
+
v = n;
|
|
98
100
|
return;
|
|
99
101
|
}
|
|
100
|
-
|
|
102
|
+
D(e, n);
|
|
101
103
|
},
|
|
102
104
|
openFromButtonClick: (e, t) => {
|
|
103
|
-
let n =
|
|
104
|
-
|
|
105
|
+
let n = v;
|
|
106
|
+
v = null;
|
|
105
107
|
let r = n === null && t.detail === 0;
|
|
106
|
-
!
|
|
108
|
+
!f?.enableColumnMenu || n !== t.currentTarget && !r || (t.preventDefault(), t.stopPropagation(), D(e, t.currentTarget, r));
|
|
107
109
|
},
|
|
108
110
|
openFromContextMenu: (e, n) => {
|
|
109
|
-
|
|
111
|
+
f?.enableColumnMenu && (n.preventDefault(), n.stopPropagation(), t(f.gridRootRef.current), h = null, _ = {
|
|
110
112
|
x: n.clientX,
|
|
111
113
|
y: n.clientY
|
|
112
|
-
},
|
|
114
|
+
}, g = !1, E(e.key));
|
|
113
115
|
},
|
|
114
116
|
openFromKeyboard: (e, t) => {
|
|
115
|
-
|
|
117
|
+
f?.enableColumnMenu && D(e, t, !0);
|
|
116
118
|
},
|
|
117
|
-
close:
|
|
119
|
+
close: w,
|
|
118
120
|
dispose: () => {
|
|
119
|
-
|
|
121
|
+
y !== null && (cancelAnimationFrame(y), y = null), T.detach();
|
|
120
122
|
}
|
|
121
123
|
};
|
|
122
124
|
};
|
|
123
125
|
//#endregion
|
|
124
|
-
export {
|
|
126
|
+
export { f as createColumnMenuController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("./popoverSupport.cjs");var n=220,r=8,i=34,a=16,o=()=>{let o=null,s=e.createValueStore({state:null,layout:null}),c={current:null},l=null,u=0,d=e=>{let t=s.getSnapshot();t.layout===e||t.layout!==null&&e!==null&&t.layout.top===e.top&&t.layout.left===e.left&&t.layout.width===e.width||s.setSnapshot({...t,layout:e})},
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("./popoverSupport.cjs");var n=220,r=8,i=34,a=16,o=()=>{let o=null,s=e.createValueStore({state:null,layout:null}),c={current:null},l=null,u=0,d=null,f=()=>{d!==null&&(cancelAnimationFrame(d),d=null)},p=e=>{let t=s.getSnapshot();t.layout===e||t.layout!==null&&e!==null&&t.layout.top===e.top&&t.layout.left===e.left&&t.layout.width===e.width||s.setSnapshot({...t,layout:e})},m=()=>{if(!l){p(null);return}let e=u*i+a,t=l.x,o=l.y,s=l.y-e;t=Math.max(r,t),t=Math.min(t,window.innerWidth-n-r),o+e>window.innerHeight-r&&(o=s),o=Math.max(r,o),p({top:o,left:t,width:n})},h=e=>{f(),s.setSnapshot({state:null,layout:null}),l=null,u=0,_.detach(),o!==null&&e&&t.restoreGridFocus(o.gridRootRef)},g=()=>h(!0),_=t.createPopoverWindowBindings({onResize:m,onScroll:g,isInside:e=>c.current?.contains(e)===!0,onOutsidePointerDown:e=>h(o!==null&&t.isInsideGridRoot(o.gridRootRef,e)),getGridRoot:()=>o?.gridRootRef.current??null,onGridHidden:()=>h(!1),onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),g();return}let n=c.current;if(!(!n||t.handleMenuKeyNavigation(n,e))&&e.key===`Tab`){let t=document.activeElement;(!(t instanceof HTMLElement&&n.contains(t))||t===n||t.getAttribute(`role`)===`menuitem`)&&(e.preventDefault(),g())}}});return{update:e=>{o=e},subscribe:s.subscribe,getSnapshot:s.getSnapshot,panelRef:c,open:(e,n,r)=>{t.blurForPopover(o?.gridRootRef.current??null),l={x:e.clientX,y:e.clientY},u=n.length,s.setSnapshot({...s.getSnapshot(),state:{params:e,items:n}}),m(),_.attach(),f();let i=r?.focus??`panel`;d=requestAnimationFrame(()=>{d=null;let e=c.current;if(!(e===null||e.contains(e.ownerDocument.activeElement))){if(i===`firstItem`){let t=e.querySelector(`[role="menuitem"]:not(:disabled):not([aria-disabled="true"])`);if(t!==null){t.focus({preventScroll:!0});return}}t.focusPanelIfIdle(e,o?.gridRootRef.current??null)}})},close:g,dispose:()=>{f(),_.detach()}}};exports.createContextMenuController=o;
|
|
@@ -13,6 +13,9 @@ export type ContextMenuSnapshot<T> = {
|
|
|
13
13
|
state: CellContextMenuState<T> | null;
|
|
14
14
|
layout: CellContextMenuLayout | null;
|
|
15
15
|
};
|
|
16
|
+
export type ContextMenuOpenOptions = {
|
|
17
|
+
focus?: 'panel' | 'firstItem';
|
|
18
|
+
};
|
|
16
19
|
export type ContextMenuControllerArgs = {
|
|
17
20
|
gridRootRef: ReadonlyElementRef;
|
|
18
21
|
};
|
|
@@ -23,7 +26,7 @@ export type ContextMenuController<T> = {
|
|
|
23
26
|
panelRef: {
|
|
24
27
|
current: HTMLDivElement | null;
|
|
25
28
|
};
|
|
26
|
-
open: (params: GridContextMenuParams<T>, items: GridContextMenuItem[]) => void;
|
|
29
|
+
open: (params: GridContextMenuParams<T>, items: GridContextMenuItem[], options?: ContextMenuOpenOptions) => void;
|
|
27
30
|
close: () => void;
|
|
28
31
|
dispose: () => void;
|
|
29
32
|
};
|
|
@@ -1,75 +1,92 @@
|
|
|
1
1
|
import { createValueStore as e } from "../logic/valueStore.js";
|
|
2
|
-
import { blurForPopover as t, createPopoverWindowBindings as n,
|
|
2
|
+
import { blurForPopover as t, createPopoverWindowBindings as n, focusPanelIfIdle as r, handleMenuKeyNavigation as i, isInsideGridRoot as a, restoreGridFocus as o } from "./popoverSupport.js";
|
|
3
3
|
//#region src/controllers/contextMenuController.ts
|
|
4
|
-
var
|
|
5
|
-
let
|
|
4
|
+
var s = 220, c = 8, l = 34, u = 16, d = () => {
|
|
5
|
+
let d = null, f = e({
|
|
6
6
|
state: null,
|
|
7
7
|
layout: null
|
|
8
|
-
}),
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
}), p = { current: null }, m = null, h = 0, g = null, _ = () => {
|
|
9
|
+
g !== null && (cancelAnimationFrame(g), g = null);
|
|
10
|
+
}, v = (e) => {
|
|
11
|
+
let t = f.getSnapshot();
|
|
12
|
+
t.layout === e || t.layout !== null && e !== null && t.layout.top === e.top && t.layout.left === e.left && t.layout.width === e.width || f.setSnapshot({
|
|
11
13
|
...t,
|
|
12
14
|
layout: e
|
|
13
15
|
});
|
|
14
|
-
},
|
|
15
|
-
if (!
|
|
16
|
-
|
|
16
|
+
}, y = () => {
|
|
17
|
+
if (!m) {
|
|
18
|
+
v(null);
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
|
-
let e =
|
|
20
|
-
t = Math.max(
|
|
21
|
+
let e = h * l + u, t = m.x, n = m.y, r = m.y - e;
|
|
22
|
+
t = Math.max(c, t), t = Math.min(t, window.innerWidth - s - c), n + e > window.innerHeight - c && (n = r), n = Math.max(c, n), v({
|
|
21
23
|
top: n,
|
|
22
24
|
left: t,
|
|
23
|
-
width:
|
|
25
|
+
width: s
|
|
24
26
|
});
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
+
}, b = (e) => {
|
|
28
|
+
_(), f.setSnapshot({
|
|
27
29
|
state: null,
|
|
28
30
|
layout: null
|
|
29
|
-
}),
|
|
30
|
-
},
|
|
31
|
-
onResize:
|
|
32
|
-
onScroll:
|
|
33
|
-
isInside: (e) =>
|
|
34
|
-
onOutsidePointerDown: (e) =>
|
|
35
|
-
getGridRoot: () =>
|
|
36
|
-
onGridHidden: () =>
|
|
31
|
+
}), m = null, h = 0, S.detach(), d !== null && e && o(d.gridRootRef);
|
|
32
|
+
}, x = () => b(!0), S = n({
|
|
33
|
+
onResize: y,
|
|
34
|
+
onScroll: x,
|
|
35
|
+
isInside: (e) => p.current?.contains(e) === !0,
|
|
36
|
+
onOutsidePointerDown: (e) => b(d !== null && a(d.gridRootRef, e)),
|
|
37
|
+
getGridRoot: () => d?.gridRootRef.current ?? null,
|
|
38
|
+
onGridHidden: () => b(!1),
|
|
37
39
|
onKeyDown: (e) => {
|
|
38
40
|
if (e.key === "Escape") {
|
|
39
|
-
e.preventDefault(),
|
|
41
|
+
e.preventDefault(), x();
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
42
|
-
let t =
|
|
43
|
-
if (!(!t ||
|
|
44
|
+
let t = p.current;
|
|
45
|
+
if (!(!t || i(t, e)) && e.key === "Tab") {
|
|
44
46
|
let n = document.activeElement;
|
|
45
|
-
(!(n instanceof HTMLElement && t.contains(n)) || n.getAttribute("role") === "menuitem") && (e.preventDefault(),
|
|
47
|
+
(!(n instanceof HTMLElement && t.contains(n)) || n === t || n.getAttribute("role") === "menuitem") && (e.preventDefault(), x());
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
});
|
|
49
51
|
return {
|
|
50
52
|
update: (e) => {
|
|
51
|
-
|
|
53
|
+
d = e;
|
|
52
54
|
},
|
|
53
|
-
subscribe:
|
|
54
|
-
getSnapshot:
|
|
55
|
-
panelRef:
|
|
56
|
-
open: (e, n) => {
|
|
57
|
-
t(
|
|
55
|
+
subscribe: f.subscribe,
|
|
56
|
+
getSnapshot: f.getSnapshot,
|
|
57
|
+
panelRef: p,
|
|
58
|
+
open: (e, n, i) => {
|
|
59
|
+
t(d?.gridRootRef.current ?? null), m = {
|
|
58
60
|
x: e.clientX,
|
|
59
61
|
y: e.clientY
|
|
60
|
-
},
|
|
61
|
-
...
|
|
62
|
+
}, h = n.length, f.setSnapshot({
|
|
63
|
+
...f.getSnapshot(),
|
|
62
64
|
state: {
|
|
63
65
|
params: e,
|
|
64
66
|
items: n
|
|
65
67
|
}
|
|
66
|
-
}),
|
|
68
|
+
}), y(), S.attach(), _();
|
|
69
|
+
let a = i?.focus ?? "panel";
|
|
70
|
+
g = requestAnimationFrame(() => {
|
|
71
|
+
g = null;
|
|
72
|
+
let e = p.current;
|
|
73
|
+
if (!(e === null || e.contains(e.ownerDocument.activeElement))) {
|
|
74
|
+
if (a === "firstItem") {
|
|
75
|
+
let t = e.querySelector("[role=\"menuitem\"]:not(:disabled):not([aria-disabled=\"true\"])");
|
|
76
|
+
if (t !== null) {
|
|
77
|
+
t.focus({ preventScroll: !0 });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
r(e, d?.gridRootRef.current ?? null);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
67
84
|
},
|
|
68
|
-
close:
|
|
85
|
+
close: x,
|
|
69
86
|
dispose: () => {
|
|
70
|
-
|
|
87
|
+
_(), S.detach();
|
|
71
88
|
}
|
|
72
89
|
};
|
|
73
90
|
};
|
|
74
91
|
//#endregion
|
|
75
|
-
export {
|
|
92
|
+
export { d as createContextMenuController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/editorValues.cjs"),a=require("../logic/validation.cjs");var o=(e,t)=>t.activeCell!==e.activeCell||t.selection!==e.selection,s=e=>{if(t.isFocusInsideDetailCard())return!1;let n=e.ownerDocument,r=n.activeElement;return r===null||r===n.body||r===n.documentElement||e.contains(r)},c=e=>{if(e===null)return!1;let n=e.ownerDocument.activeElement;return n!==null&&n!==e&&e.contains(n)&&typeof n.closest==`function`&&n.closest(`.ssg-cell-editor`)!==null&&!t.isFocusInsideDetailCard()},l=()=>{let
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../logic/detailRow.cjs"),n=require("../model/gridActions.cjs"),r=require("../logic/geometry.cjs"),i=require("../logic/editorValues.cjs"),a=require("../logic/validation.cjs");var o=(e,t)=>t.activeCell!==e.activeCell||t.selection!==e.selection,s=e=>{if(t.isFocusInsideDetailCard())return!1;let n=e.ownerDocument,r=n.activeElement;return r===null||r===n.body||r===n.documentElement||e.contains(r)},c=e=>{if(e===null)return!1;let n=e.ownerDocument.activeElement;return n!==null&&n!==e&&e.contains(n)&&typeof n.closest==`function`&&n.closest(`.ssg-cell-editor`)!==null&&!t.isFocusInsideDetailCard()},l=()=>{let l=null,u=null,d=(e,t)=>{let n=e.visibleColumns[t.col];return!n||t.row<0||t.row>=e.rowModel.getRowCount()||e.rowModel.getRow(t.row)===void 0?null:{rowKey:e.rowModel.getRowKey(t.row),columnKey:n.key}},f=(e,t)=>{let n=e.visibleColumns.findIndex(e=>e.key===t.columnKey);if(n<0)return null;let r=e.rowModel.getRowCount();for(let i=0;i<r;i+=1)if(e.rowModel.getRow(i)!==void 0&&Object.is(e.rowModel.getRowKey(i),t.rowKey))return{row:i,col:n};return null},p=e=>{l=e;let t=e.uiState.editingCell;if(!t){u=null;return}let r=d(e,t);if(u!==null&&r!==null&&Object.is(r.rowKey,u.rowKey)&&r.columnKey===u.columnKey){u={...u,cell:t};return}let i=u!==null&&u.cell.row===t.row&&u.cell.col===t.col;if(u===null||!i){u=r?{...r,cell:t}:null;return}let a=f(e,u);a?(u={...u,cell:a},e.dispatch(n.gridActions.startEdit(a))):(u=null,e.dispatch(n.gridActions.stopEdit()))},m=e=>{l!==null&&(l.dispatch(n.gridActions.startSelection(e)),l.dispatch(n.gridActions.endSelection()),l.dispatch(n.gridActions.activateCell(e)))},h=(e,t)=>{l!==null&&(l.setEditorInitialValue(t),l.dispatch(n.gridActions.startEdit(e)))},g=(e,t=null,n,i=!1)=>{let a=l;if(a===null)return;let c=!1,u=i=>{if(c||!i&&(l===null||l.uiState.editingCell!==null))return;c=!0;let u=a.gridRootRef.current;if(u!==null&&s(u)&&u.focus(),e!==null&&l!==null&&!(t!==null&&o(t,l.uiState))){let t=l.rowModel.getRowCount(),i=l.visibleColumns.length,a=r.clamp(e.row,0,Math.max(t-1,0)),{getLabelRow:o}=l.rowModel;if(o&&n!==void 0&&a!==n){let e=a>n?1:-1;for(;a>=0&&a<t&&o(a);)a+=e;(a<0||a>=t)&&(a=r.clamp(n,0,Math.max(t-1,0)))}m({row:a,col:r.clamp(e.col,0,Math.max(i-1,0))})}a.editorActionGuardRef.current=!1};i&&queueMicrotask(()=>u(!1)),requestAnimationFrame(()=>u(!0))},_=()=>{let e=l?.gridRootRef.current??null;return c(e)?(e.focus({preventScroll:!0}),!0):!1};return{update:p,activateSingleCell:m,startEditWithValue:h,commitEdit:(r,o)=>{if(l===null)return{status:`noop`};let{uiState:s,visibleColumns:c,rowModel:u,rows:d,applyServerSideCellEdits:f,onRowsChange:p,dispatch:m,editorActionGuardRef:h}=l;if(h.current||!s.editingCell)return{status:`noop`};let v=s.editingCell,y=o===`down`?{row:v.row+1,col:v.col}:o===`up`?{row:v.row-1,col:v.col}:o===`right`?{row:v.row,col:v.col+1}:o===`left`?{row:v.row,col:Math.max(v.col-1,t.resolveFirstDataColIndex(c))}:v,b=c[v.col],x=u.getSourceIndex(v.row),S=f?u.getRow(v.row):d[x];if(!b||!S)return m(n.gridActions.stopEdit()),{status:`noop`};if(!e.isViewCellEditable({readOnly:l.readOnly,canEditCell:l.canEditCell},u,v.row,v.col,S,b))return h.current=!0,m(n.gridActions.stopEdit()),g(null),{status:`noop`};let C=i.isUnchangedEditorCommit(b,e.getCellValue(S,b),r);if(!C&&f){let e=i.parseCommittedValue(b,r,S),t=a.decideCellWrite(b,S,e,l.localeTexts);if(t.action===`reject`)return{status:`rejected`,message:t.message};f([{viewIndex:v.row,column:b,value:e}])}else if(!C&&p){let e=i.parseCommittedValue(b,r,S),t=a.decideCellWrite(b,S,e,l.localeTexts);if(t.action===`reject`)return{status:`rejected`,message:t.message};p(i.writeRowsCell(d,x,b,e))}h.current=!0;let w=_();return g(y,o===void 0?{activeCell:s.activeCell,selection:s.selection}:null,v.row,w),m(n.gridActions.stopEdit()),{status:`committed`}},cancelEdit:()=>{if(l===null||l.editorActionGuardRef.current)return;l.editorActionGuardRef.current=!0;let e=_();l.dispatch(n.gridActions.stopEdit()),g(null,null,void 0,e)}}};exports.createEditController=l;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { getCellValue as e, isViewCellEditable as t } from "../utils/permissions.js";
|
|
2
|
-
import { isFocusInsideDetailCard as n } from "../logic/detailRow.js";
|
|
3
|
-
import { gridActions as
|
|
4
|
-
import { clamp as
|
|
5
|
-
import { isUnchangedEditorCommit as
|
|
6
|
-
import { decideCellWrite as
|
|
2
|
+
import { isFocusInsideDetailCard as n, resolveFirstDataColIndex as r } from "../logic/detailRow.js";
|
|
3
|
+
import { gridActions as i } from "../model/gridActions.js";
|
|
4
|
+
import { clamp as a } from "../logic/geometry.js";
|
|
5
|
+
import { isUnchangedEditorCommit as o, parseCommittedValue as s, writeRowsCell as c } from "../logic/editorValues.js";
|
|
6
|
+
import { decideCellWrite as l } from "../logic/validation.js";
|
|
7
7
|
//#region src/controllers/editController.ts
|
|
8
|
-
var
|
|
8
|
+
var u = (e, t) => t.activeCell !== e.activeCell || t.selection !== e.selection, d = (e) => {
|
|
9
9
|
if (n()) return !1;
|
|
10
10
|
let t = e.ownerDocument, r = t.activeElement;
|
|
11
11
|
return r === null || r === t.body || r === t.documentElement || e.contains(r);
|
|
12
|
-
},
|
|
12
|
+
}, f = (e) => {
|
|
13
13
|
if (e === null) return !1;
|
|
14
14
|
let t = e.ownerDocument.activeElement;
|
|
15
15
|
return t !== null && t !== e && e.contains(t) && typeof t.closest == "function" && t.closest(".ssg-cell-editor") !== null && !n();
|
|
16
|
-
},
|
|
17
|
-
let n = null,
|
|
16
|
+
}, p = () => {
|
|
17
|
+
let n = null, p = null, m = (e, t) => {
|
|
18
18
|
let n = e.visibleColumns[t.col];
|
|
19
19
|
return !n || t.row < 0 || t.row >= e.rowModel.getRowCount() || e.rowModel.getRow(t.row) === void 0 ? null : {
|
|
20
20
|
rowKey: e.rowModel.getRowKey(t.row),
|
|
21
21
|
columnKey: n.key
|
|
22
22
|
};
|
|
23
|
-
},
|
|
23
|
+
}, h = (e, t) => {
|
|
24
24
|
let n = e.visibleColumns.findIndex((e) => e.key === t.columnKey);
|
|
25
25
|
if (n < 0) return null;
|
|
26
26
|
let r = e.rowModel.getRowCount();
|
|
@@ -29,124 +29,124 @@ var l = (e, t) => t.activeCell !== e.activeCell || t.selection !== e.selection,
|
|
|
29
29
|
col: n
|
|
30
30
|
};
|
|
31
31
|
return null;
|
|
32
|
-
},
|
|
32
|
+
}, g = (e) => {
|
|
33
33
|
n = e;
|
|
34
34
|
let t = e.uiState.editingCell;
|
|
35
35
|
if (!t) {
|
|
36
|
-
|
|
36
|
+
p = null;
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
let
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
...
|
|
39
|
+
let r = m(e, t);
|
|
40
|
+
if (p !== null && r !== null && Object.is(r.rowKey, p.rowKey) && r.columnKey === p.columnKey) {
|
|
41
|
+
p = {
|
|
42
|
+
...p,
|
|
43
43
|
cell: t
|
|
44
44
|
};
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
let a =
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
...
|
|
47
|
+
let a = p !== null && p.cell.row === t.row && p.cell.col === t.col;
|
|
48
|
+
if (p === null || !a) {
|
|
49
|
+
p = r ? {
|
|
50
|
+
...r,
|
|
51
51
|
cell: t
|
|
52
52
|
} : null;
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
let o =
|
|
56
|
-
o ? (
|
|
57
|
-
...
|
|
55
|
+
let o = h(e, p);
|
|
56
|
+
o ? (p = {
|
|
57
|
+
...p,
|
|
58
58
|
cell: o
|
|
59
|
-
}, e.dispatch(
|
|
60
|
-
},
|
|
61
|
-
n !== null && (n.dispatch(
|
|
62
|
-
},
|
|
63
|
-
n !== null && (n.setEditorInitialValue(t), n.dispatch(
|
|
64
|
-
},
|
|
59
|
+
}, e.dispatch(i.startEdit(o))) : (p = null, e.dispatch(i.stopEdit()));
|
|
60
|
+
}, _ = (e) => {
|
|
61
|
+
n !== null && (n.dispatch(i.startSelection(e)), n.dispatch(i.endSelection()), n.dispatch(i.activateCell(e)));
|
|
62
|
+
}, v = (e, t) => {
|
|
63
|
+
n !== null && (n.setEditorInitialValue(t), n.dispatch(i.startEdit(e)));
|
|
64
|
+
}, y = (e, t = null, r, i = !1) => {
|
|
65
65
|
let o = n;
|
|
66
66
|
if (o === null) return;
|
|
67
|
-
let s = !1, c = (
|
|
68
|
-
if (s || !
|
|
67
|
+
let s = !1, c = (i) => {
|
|
68
|
+
if (s || !i && (n === null || n.uiState.editingCell !== null)) return;
|
|
69
69
|
s = !0;
|
|
70
70
|
let c = o.gridRootRef.current;
|
|
71
|
-
if (c !== null &&
|
|
72
|
-
let t = n.rowModel.getRowCount(),
|
|
71
|
+
if (c !== null && d(c) && c.focus(), e !== null && n !== null && !(t !== null && u(t, n.uiState))) {
|
|
72
|
+
let t = n.rowModel.getRowCount(), i = n.visibleColumns.length, o = a(e.row, 0, Math.max(t - 1, 0)), { getLabelRow: s } = n.rowModel;
|
|
73
73
|
if (s && r !== void 0 && o !== r) {
|
|
74
74
|
let e = o > r ? 1 : -1;
|
|
75
75
|
for (; o >= 0 && o < t && s(o);) o += e;
|
|
76
|
-
(o < 0 || o >= t) && (o =
|
|
76
|
+
(o < 0 || o >= t) && (o = a(r, 0, Math.max(t - 1, 0)));
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
_({
|
|
79
79
|
row: o,
|
|
80
|
-
col:
|
|
80
|
+
col: a(e.col, 0, Math.max(i - 1, 0))
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
o.editorActionGuardRef.current = !1;
|
|
84
84
|
};
|
|
85
|
-
|
|
86
|
-
},
|
|
85
|
+
i && queueMicrotask(() => c(!1)), requestAnimationFrame(() => c(!0));
|
|
86
|
+
}, b = () => {
|
|
87
87
|
let e = n?.gridRootRef.current ?? null;
|
|
88
|
-
return
|
|
88
|
+
return f(e) ? (e.focus({ preventScroll: !0 }), !0) : !1;
|
|
89
89
|
};
|
|
90
90
|
return {
|
|
91
|
-
update:
|
|
92
|
-
activateSingleCell:
|
|
93
|
-
startEditWithValue:
|
|
94
|
-
commitEdit: (
|
|
91
|
+
update: g,
|
|
92
|
+
activateSingleCell: _,
|
|
93
|
+
startEditWithValue: v,
|
|
94
|
+
commitEdit: (a, u) => {
|
|
95
95
|
if (n === null) return { status: "noop" };
|
|
96
|
-
let { uiState:
|
|
97
|
-
if (
|
|
98
|
-
let
|
|
99
|
-
row:
|
|
100
|
-
col:
|
|
101
|
-
} :
|
|
102
|
-
row:
|
|
103
|
-
col:
|
|
104
|
-
} :
|
|
105
|
-
row:
|
|
106
|
-
col:
|
|
107
|
-
} :
|
|
108
|
-
row:
|
|
109
|
-
col:
|
|
110
|
-
} :
|
|
111
|
-
if (!
|
|
96
|
+
let { uiState: d, visibleColumns: f, rowModel: p, rows: m, applyServerSideCellEdits: h, onRowsChange: g, dispatch: _, editorActionGuardRef: v } = n;
|
|
97
|
+
if (v.current || !d.editingCell) return { status: "noop" };
|
|
98
|
+
let x = d.editingCell, S = u === "down" ? {
|
|
99
|
+
row: x.row + 1,
|
|
100
|
+
col: x.col
|
|
101
|
+
} : u === "up" ? {
|
|
102
|
+
row: x.row - 1,
|
|
103
|
+
col: x.col
|
|
104
|
+
} : u === "right" ? {
|
|
105
|
+
row: x.row,
|
|
106
|
+
col: x.col + 1
|
|
107
|
+
} : u === "left" ? {
|
|
108
|
+
row: x.row,
|
|
109
|
+
col: Math.max(x.col - 1, r(f))
|
|
110
|
+
} : x, C = f[x.col], w = p.getSourceIndex(x.row), T = h ? p.getRow(x.row) : m[w];
|
|
111
|
+
if (!C || !T) return _(i.stopEdit()), { status: "noop" };
|
|
112
112
|
if (!t({
|
|
113
113
|
readOnly: n.readOnly,
|
|
114
114
|
canEditCell: n.canEditCell
|
|
115
|
-
},
|
|
116
|
-
let
|
|
117
|
-
if (!
|
|
118
|
-
let e =
|
|
115
|
+
}, p, x.row, x.col, T, C)) return v.current = !0, _(i.stopEdit()), y(null), { status: "noop" };
|
|
116
|
+
let E = o(C, e(T, C), a);
|
|
117
|
+
if (!E && h) {
|
|
118
|
+
let e = s(C, a, T), t = l(C, T, e, n.localeTexts);
|
|
119
119
|
if (t.action === "reject") return {
|
|
120
120
|
status: "rejected",
|
|
121
121
|
message: t.message
|
|
122
122
|
};
|
|
123
|
-
|
|
124
|
-
viewIndex:
|
|
125
|
-
column:
|
|
123
|
+
h([{
|
|
124
|
+
viewIndex: x.row,
|
|
125
|
+
column: C,
|
|
126
126
|
value: e
|
|
127
127
|
}]);
|
|
128
|
-
} else if (!
|
|
129
|
-
let e =
|
|
128
|
+
} else if (!E && g) {
|
|
129
|
+
let e = s(C, a, T), t = l(C, T, e, n.localeTexts);
|
|
130
130
|
if (t.action === "reject") return {
|
|
131
131
|
status: "rejected",
|
|
132
132
|
message: t.message
|
|
133
133
|
};
|
|
134
|
-
|
|
134
|
+
g(c(m, w, C, e));
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
let
|
|
138
|
-
return
|
|
139
|
-
activeCell:
|
|
140
|
-
selection:
|
|
141
|
-
} : null,
|
|
136
|
+
v.current = !0;
|
|
137
|
+
let D = b();
|
|
138
|
+
return y(S, u === void 0 ? {
|
|
139
|
+
activeCell: d.activeCell,
|
|
140
|
+
selection: d.selection
|
|
141
|
+
} : null, x.row, D), _(i.stopEdit()), { status: "committed" };
|
|
142
142
|
},
|
|
143
143
|
cancelEdit: () => {
|
|
144
144
|
if (n === null || n.editorActionGuardRef.current) return;
|
|
145
145
|
n.editorActionGuardRef.current = !0;
|
|
146
|
-
let e =
|
|
147
|
-
n.dispatch(
|
|
146
|
+
let e = b();
|
|
147
|
+
n.dispatch(i.stopEdit()), y(null, null, void 0, e);
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
151
|
//#endregion
|
|
152
|
-
export {
|
|
152
|
+
export { p as createEditController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`.ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover`,t=e=>{if(e===null)return!1;if(e.type!==`cell`)return!0;let{start:t,end:n}=e.range;return t.row!==n.row||t.col!==n.col},n=new WeakSet,r=new WeakSet,i=e=>n.has(e),a=e=>n.has(e)?r.has(e):e.defaultPrevented,o=`data-mantine-stop-propagation`,s=()=>{let e=null,t=!1,i=t=>{if(t.key!==`Escape`||t.isComposing||t.keyCode===229||e===null||n.has(t))return;let i=e.gridRootRef.current,a=t.target;if(i===null||!(a instanceof Element)
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`.ssg-menu-panel, .ssg-filter-popover, .ssg-toolpanel, .ssg-select-editor-popover`,t=e=>{if(e===null)return!1;if(e.type!==`cell`)return!0;let{start:t,end:n}=e.range;return t.row!==n.row||t.col!==n.col},n=new WeakSet,r=new WeakSet,i=e=>n.has(e),a=e=>n.has(e)?r.has(e):e.defaultPrevented,o=`data-mantine-stop-propagation`,s=0,c=()=>{s+=1;let e=!1;return()=>{e||(e=!0,--s)}},l=()=>{let e=null,t=!1,i=t=>{if(t.key!==`Escape`||t.isComposing||t.keyCode===229||e===null||n.has(t))return;let i=e.gridRootRef.current,a=t.target;if(i===null||!(a instanceof Element)||s===0&&!e.isClaimedTarget(a,i))return;n.add(t),t.preventDefault();let c=t.preventDefault.bind(t);t.preventDefault=()=>{r.add(t),c()},a.hasAttribute(o)||(a.setAttribute(o,`true`),setTimeout(()=>{a.removeAttribute(o)},0))};return{update:n=>{e=n,!t&&typeof window<`u`&&(window.addEventListener(`keydown`,i,!0),t=!0)},dispose:()=>{t&&=(window.removeEventListener(`keydown`,i,!0),!1)}}};exports.GRID_POPUP_SELECTOR=e,exports.beginEscapeCancelableDrag=c,exports.createEscapeClaimController=l,exports.isClearableSelection=t,exports.isEscapeClaimedByGrid=i,exports.isEscapePreventedInside=a;
|
|
@@ -14,5 +14,6 @@ export type EscapeClaimController = {
|
|
|
14
14
|
};
|
|
15
15
|
export declare const isEscapeClaimedByGrid: (event: Event) => boolean;
|
|
16
16
|
export declare const isEscapePreventedInside: (event: Event) => boolean;
|
|
17
|
+
export declare const beginEscapeCancelableDrag: () => (() => void);
|
|
17
18
|
export declare const createEscapeClaimController: () => EscapeClaimController;
|
|
18
19
|
export {};
|