@ishibashi0112/spreadsheet-grid-core 0.60.0 → 0.62.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/README.md +2 -2
- package/dist/controllers/changeHighlightController.cjs +1 -1
- package/dist/controllers/changeHighlightController.js +54 -49
- package/dist/controllers/clipboardController.cjs +2 -2
- package/dist/controllers/clipboardController.js +71 -76
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +74 -70
- package/dist/controllers/columnMenuController.cjs +1 -1
- package/dist/controllers/columnMenuController.d.ts +2 -0
- package/dist/controllers/columnMenuController.js +72 -60
- package/dist/controllers/contextMenuController.cjs +1 -1
- package/dist/controllers/contextMenuController.js +40 -32
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +90 -84
- package/dist/controllers/findController.cjs +1 -1
- package/dist/controllers/findController.js +71 -71
- package/dist/controllers/imeInputController.cjs +1 -1
- package/dist/controllers/imeInputController.js +68 -65
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.d.ts +3 -0
- package/dist/controllers/keyboardController.js +184 -91
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.js +11 -2
- package/dist/controllers/popoverSupport.cjs +1 -1
- package/dist/controllers/popoverSupport.d.ts +1 -0
- package/dist/controllers/popoverSupport.js +14 -2
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +2 -0
- package/dist/controllers/rowDragController.js +222 -138
- package/dist/controllers/rowEnterController.cjs +1 -1
- package/dist/controllers/rowEnterController.js +49 -47
- package/dist/controllers/saveStatusController.cjs +1 -1
- package/dist/controllers/saveStatusController.js +101 -48
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.d.ts +1 -0
- package/dist/controllers/serverSideRowModel.js +199 -130
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +38 -21
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +2 -1
- package/dist/controllers/viewportSyncController.js +3 -2
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.d.ts +1 -0
- package/dist/engine/columnLayout.js +12 -11
- package/dist/engine/exportCommands.cjs +1 -1
- package/dist/engine/exportCommands.js +27 -25
- package/dist/engine/filterPopoverCommands.cjs +1 -1
- package/dist/engine/filterPopoverCommands.js +12 -7
- package/dist/engine/gridApi.cjs +1 -1
- package/dist/engine/gridApi.d.ts +4 -1
- package/dist/engine/gridApi.js +175 -129
- package/dist/engine/notifiers.cjs +1 -1
- package/dist/engine/notifiers.d.ts +1 -0
- package/dist/engine/notifiers.js +10 -5
- package/dist/logic/conditionalFormat.cjs +1 -1
- package/dist/logic/conditionalFormat.js +2 -2
- package/dist/logic/detailRow.cjs +1 -1
- package/dist/logic/detailRow.d.ts +1 -0
- package/dist/logic/detailRow.js +9 -4
- package/dist/logic/domGuards.cjs +1 -1
- package/dist/logic/domGuards.d.ts +4 -0
- package/dist/logic/domGuards.js +2 -2
- package/dist/logic/editorValues.cjs +1 -1
- package/dist/logic/editorValues.d.ts +2 -0
- package/dist/logic/editorValues.js +19 -9
- package/dist/logic/fillSeries.cjs +1 -1
- package/dist/logic/fillSeries.js +43 -36
- package/dist/logic/filterSummary.cjs +1 -1
- package/dist/logic/filterSummary.d.ts +9 -3
- package/dist/logic/filterSummary.js +39 -13
- package/dist/logic/find.cjs +1 -1
- package/dist/logic/find.d.ts +1 -0
- package/dist/logic/find.js +6 -6
- package/dist/logic/gridAsk.cjs +1 -1
- package/dist/logic/gridAsk.js +106 -106
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +14 -0
- package/dist/logic/gridState.js +114 -62
- package/dist/logic/numberFilterCondition.cjs +1 -1
- package/dist/logic/numberFilterCondition.d.ts +1 -1
- package/dist/logic/numberFilterCondition.js +12 -9
- package/dist/logic/selectionAggregates.cjs +1 -1
- package/dist/logic/selectionAggregates.js +5 -2
- package/dist/logic/serverSideEdits.cjs +1 -1
- package/dist/logic/serverSideEdits.d.ts +16 -2
- package/dist/logic/serverSideEdits.js +60 -14
- package/dist/logic/urgentFilters.cjs +1 -0
- package/dist/logic/urgentFilters.d.ts +3 -0
- package/dist/logic/urgentFilters.js +6 -0
- package/dist/logic/validation.cjs +1 -1
- package/dist/logic/validation.d.ts +1 -1
- package/dist/logic/validation.js +10 -10
- package/dist/logic/valueFormatters.d.ts +2 -1
- package/dist/model/gridStore.cjs +1 -1
- package/dist/model/gridStore.d.ts +1 -0
- package/dist/model/gridStore.js +2 -1
- package/dist/model/gridTypes.core.d.ts +92 -16
- package/dist/utils/clipboard.cjs +5 -5
- package/dist/utils/clipboard.d.ts +3 -0
- package/dist/utils/clipboard.js +58 -65
- package/dist/utils/permissions.cjs +1 -1
- package/dist/utils/permissions.js +5 -3
- package/package.json +1 -6
|
@@ -1,65 +1,73 @@
|
|
|
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, handleMenuKeyNavigation as r, isInsideGridRoot as i, restoreGridFocus as a } from "./popoverSupport.js";
|
|
3
3
|
//#region src/controllers/contextMenuController.ts
|
|
4
|
-
var
|
|
5
|
-
let
|
|
4
|
+
var o = 220, s = 8, c = 34, l = 16, u = () => {
|
|
5
|
+
let u = null, d = e({
|
|
6
6
|
state: null,
|
|
7
7
|
layout: null
|
|
8
|
-
}),
|
|
9
|
-
let t =
|
|
10
|
-
t.layout === e || t.layout !== null && e !== null && t.layout.top === e.top && t.layout.left === e.left && t.layout.width === e.width ||
|
|
8
|
+
}), f = { current: null }, p = null, m = 0, h = (e) => {
|
|
9
|
+
let t = d.getSnapshot();
|
|
10
|
+
t.layout === e || t.layout !== null && e !== null && t.layout.top === e.top && t.layout.left === e.left && t.layout.width === e.width || d.setSnapshot({
|
|
11
11
|
...t,
|
|
12
12
|
layout: e
|
|
13
13
|
});
|
|
14
|
-
},
|
|
15
|
-
if (!
|
|
16
|
-
|
|
14
|
+
}, g = () => {
|
|
15
|
+
if (!p) {
|
|
16
|
+
h(null);
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
let e =
|
|
20
|
-
t = Math.max(
|
|
19
|
+
let e = m * c + l, t = p.x, n = p.y, r = p.y - e;
|
|
20
|
+
t = Math.max(s, t), t = Math.min(t, window.innerWidth - o - s), n + e > window.innerHeight - s && (n = r), n = Math.max(s, n), h({
|
|
21
21
|
top: n,
|
|
22
22
|
left: t,
|
|
23
|
-
width:
|
|
23
|
+
width: o
|
|
24
24
|
});
|
|
25
|
-
},
|
|
26
|
-
|
|
25
|
+
}, _ = (e) => {
|
|
26
|
+
d.setSnapshot({
|
|
27
27
|
state: null,
|
|
28
28
|
layout: null
|
|
29
|
-
}),
|
|
30
|
-
},
|
|
31
|
-
onResize:
|
|
32
|
-
onScroll:
|
|
33
|
-
isInside: (e) =>
|
|
34
|
-
onOutsidePointerDown: (e) =>
|
|
29
|
+
}), p = null, m = 0, y.detach(), u !== null && e && a(u.gridRootRef);
|
|
30
|
+
}, v = () => _(!0), y = n({
|
|
31
|
+
onResize: g,
|
|
32
|
+
onScroll: v,
|
|
33
|
+
isInside: (e) => f.current?.contains(e) === !0,
|
|
34
|
+
onOutsidePointerDown: (e) => _(u !== null && i(u.gridRootRef, e)),
|
|
35
35
|
onKeyDown: (e) => {
|
|
36
|
-
e.key === "Escape"
|
|
36
|
+
if (e.key === "Escape") {
|
|
37
|
+
e.preventDefault(), v();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let t = f.current;
|
|
41
|
+
if (!(!t || r(t, e)) && e.key === "Tab") {
|
|
42
|
+
let n = document.activeElement;
|
|
43
|
+
(!(n instanceof HTMLElement && t.contains(n)) || n.getAttribute("role") === "menuitem") && (e.preventDefault(), v());
|
|
44
|
+
}
|
|
37
45
|
}
|
|
38
46
|
});
|
|
39
47
|
return {
|
|
40
48
|
update: (e) => {
|
|
41
|
-
|
|
49
|
+
u = e;
|
|
42
50
|
},
|
|
43
|
-
subscribe:
|
|
44
|
-
getSnapshot:
|
|
45
|
-
panelRef:
|
|
51
|
+
subscribe: d.subscribe,
|
|
52
|
+
getSnapshot: d.getSnapshot,
|
|
53
|
+
panelRef: f,
|
|
46
54
|
open: (e, n) => {
|
|
47
|
-
t(
|
|
55
|
+
t(u?.gridRootRef.current ?? null), p = {
|
|
48
56
|
x: e.clientX,
|
|
49
57
|
y: e.clientY
|
|
50
|
-
},
|
|
51
|
-
...
|
|
58
|
+
}, m = n.length, d.setSnapshot({
|
|
59
|
+
...d.getSnapshot(),
|
|
52
60
|
state: {
|
|
53
61
|
params: e,
|
|
54
62
|
items: n
|
|
55
63
|
}
|
|
56
|
-
}),
|
|
64
|
+
}), g(), y.attach();
|
|
57
65
|
},
|
|
58
|
-
close:
|
|
66
|
+
close: v,
|
|
59
67
|
dispose: () => {
|
|
60
|
-
|
|
68
|
+
y.detach();
|
|
61
69
|
}
|
|
62
70
|
};
|
|
63
71
|
};
|
|
64
72
|
//#endregion
|
|
65
|
-
export {
|
|
73
|
+
export { u 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=()=>{let t=null,c=null,l=(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}},u=(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},d=e=>{t=e;let r=e.uiState.editingCell;if(!r){c=null;return}let i=l(e,r);if(c!==null&&i!==null&&Object.is(i.rowKey,c.rowKey)&&i.columnKey===c.columnKey){c={...c,cell:r};return}let a=c!==null&&c.cell.row===r.row&&c.cell.col===r.col;if(c===null||!a){c=i?{...i,cell:r}:null;return}let o=u(e,c);o?(c={...c,cell:o},e.dispatch(n.gridActions.startEdit(o))):(c=null,e.dispatch(n.gridActions.stopEdit()))},f=e=>{t!==null&&(t.dispatch(n.gridActions.startSelection(e)),t.dispatch(n.gridActions.endSelection()),t.dispatch(n.gridActions.activateCell(e)))},p=(e,r)=>{t!==null&&(t.setEditorInitialValue(r),t.dispatch(n.gridActions.startEdit(e)))},m=(e,n=null)=>{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=()=>{let t=null,c=null,l=(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}},u=(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},d=e=>{t=e;let r=e.uiState.editingCell;if(!r){c=null;return}let i=l(e,r);if(c!==null&&i!==null&&Object.is(i.rowKey,c.rowKey)&&i.columnKey===c.columnKey){c={...c,cell:r};return}let a=c!==null&&c.cell.row===r.row&&c.cell.col===r.col;if(c===null||!a){c=i?{...i,cell:r}:null;return}let o=u(e,c);o?(c={...c,cell:o},e.dispatch(n.gridActions.startEdit(o))):(c=null,e.dispatch(n.gridActions.stopEdit()))},f=e=>{t!==null&&(t.dispatch(n.gridActions.startSelection(e)),t.dispatch(n.gridActions.endSelection()),t.dispatch(n.gridActions.activateCell(e)))},p=(e,r)=>{t!==null&&(t.setEditorInitialValue(r),t.dispatch(n.gridActions.startEdit(e)))},m=(e,n=null,i)=>{let a=t;a!==null&&requestAnimationFrame(()=>{let c=a.gridRootRef.current;if(c!==null&&s(c)&&c.focus(),e!==null&&t!==null&&!(n!==null&&o(n,t.uiState))){let n=t.rowModel.getRowCount(),a=t.visibleColumns.length,o=r.clamp(e.row,0,Math.max(n-1,0)),{getLabelRow:s}=t.rowModel;if(s&&i!==void 0&&o!==i){let e=o>i?1:-1;for(;o>=0&&o<n&&s(o);)o+=e;(o<0||o>=n)&&(o=r.clamp(i,0,Math.max(n-1,0)))}f({row:o,col:r.clamp(e.col,0,Math.max(a-1,0))})}a.editorActionGuardRef.current=!1})};return{update:d,activateSingleCell:f,startEditWithValue:p,commitEdit:(r,o)=>{if(t===null)return{status:`noop`};let{uiState:s,visibleColumns:c,rowModel:l,rows:u,applyServerSideCellEdits:d,onRowsChange:f,dispatch:p,editorActionGuardRef:h}=t;if(h.current||!s.editingCell)return{status:`noop`};let g=s.editingCell,_=o===`down`?{row:g.row+1,col:g.col}:o===`up`?{row:g.row-1,col:g.col}:o===`right`?{row:g.row,col:g.col+1}:o===`left`?{row:g.row,col:g.col-1}:g,v=c[g.col],y=l.getSourceIndex(g.row),b=d?l.getRow(g.row):u[y];if(!v||!b)return p(n.gridActions.stopEdit()),{status:`noop`};if(!e.isViewCellEditable({readOnly:t.readOnly,canEditCell:t.canEditCell},l,g.row,g.col,b,v))return h.current=!0,p(n.gridActions.stopEdit()),m(null),{status:`noop`};let x=i.isUnchangedEditorCommit(v,e.getCellValue(b,v),r);if(!x&&d){let e=i.parseCommittedValue(v,r,b),t=a.decideCellWrite(v,b,e);if(t.action===`reject`)return{status:`rejected`,message:t.message};d([{viewIndex:g.row,column:v,value:e}])}else if(!x&&f){let e=i.parseCommittedValue(v,r,b),t=a.decideCellWrite(v,b,e);if(t.action===`reject`)return{status:`rejected`,message:t.message};f(i.writeRowsCell(u,y,v,e))}return h.current=!0,m(_,o===void 0?{activeCell:s.activeCell,selection:s.selection}:null,g.row),p(n.gridActions.stopEdit()),{status:`committed`}},cancelEdit:()=>{t===null||t.editorActionGuardRef.current||(t.editorActionGuardRef.current=!0,t.dispatch(n.gridActions.stopEdit()),m(null))}}};exports.createEditController=c;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isFocusInsideDetailCard as
|
|
3
|
-
import { gridActions as
|
|
4
|
-
import { clamp as
|
|
5
|
-
import { parseCommittedValue as
|
|
6
|
-
import { decideCellWrite as
|
|
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 r } from "../model/gridActions.js";
|
|
4
|
+
import { clamp as i } from "../logic/geometry.js";
|
|
5
|
+
import { isUnchangedEditorCommit as a, parseCommittedValue as o, writeRowsCell as s } from "../logic/editorValues.js";
|
|
6
|
+
import { decideCellWrite as c } from "../logic/validation.js";
|
|
7
7
|
//#region src/controllers/editController.ts
|
|
8
|
-
var
|
|
9
|
-
if (
|
|
10
|
-
let
|
|
11
|
-
return r === null || r ===
|
|
12
|
-
},
|
|
13
|
-
let
|
|
8
|
+
var l = (e, t) => t.activeCell !== e.activeCell || t.selection !== e.selection, u = (e) => {
|
|
9
|
+
if (n()) return !1;
|
|
10
|
+
let t = e.ownerDocument, r = t.activeElement;
|
|
11
|
+
return r === null || r === t.body || r === t.documentElement || e.contains(r);
|
|
12
|
+
}, d = () => {
|
|
13
|
+
let n = null, d = null, f = (e, t) => {
|
|
14
14
|
let n = e.visibleColumns[t.col];
|
|
15
15
|
return !n || t.row < 0 || t.row >= e.rowModel.getRowCount() || e.rowModel.getRow(t.row) === void 0 ? null : {
|
|
16
16
|
rowKey: e.rowModel.getRowKey(t.row),
|
|
17
17
|
columnKey: n.key
|
|
18
18
|
};
|
|
19
|
-
},
|
|
19
|
+
}, p = (e, t) => {
|
|
20
20
|
let n = e.visibleColumns.findIndex((e) => e.key === t.columnKey);
|
|
21
21
|
if (n < 0) return null;
|
|
22
22
|
let r = e.rowModel.getRowCount();
|
|
@@ -25,106 +25,112 @@ var s = (e, t) => t.activeCell !== e.activeCell || t.selection !== e.selection,
|
|
|
25
25
|
col: n
|
|
26
26
|
};
|
|
27
27
|
return null;
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
let
|
|
31
|
-
if (!
|
|
32
|
-
|
|
28
|
+
}, m = (e) => {
|
|
29
|
+
n = e;
|
|
30
|
+
let t = e.uiState.editingCell;
|
|
31
|
+
if (!t) {
|
|
32
|
+
d = null;
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
let i =
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
...
|
|
39
|
-
cell:
|
|
35
|
+
let i = f(e, t);
|
|
36
|
+
if (d !== null && i !== null && Object.is(i.rowKey, d.rowKey) && i.columnKey === d.columnKey) {
|
|
37
|
+
d = {
|
|
38
|
+
...d,
|
|
39
|
+
cell: t
|
|
40
40
|
};
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
let a =
|
|
44
|
-
if (
|
|
45
|
-
|
|
43
|
+
let a = d !== null && d.cell.row === t.row && d.cell.col === t.col;
|
|
44
|
+
if (d === null || !a) {
|
|
45
|
+
d = i ? {
|
|
46
46
|
...i,
|
|
47
|
-
cell:
|
|
47
|
+
cell: t
|
|
48
48
|
} : null;
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
let o =
|
|
52
|
-
o ? (
|
|
53
|
-
...
|
|
51
|
+
let o = p(e, d);
|
|
52
|
+
o ? (d = {
|
|
53
|
+
...d,
|
|
54
54
|
cell: o
|
|
55
|
-
}, e.dispatch(
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
let
|
|
64
|
-
if (
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
}, e.dispatch(r.startEdit(o))) : (d = null, e.dispatch(r.stopEdit()));
|
|
56
|
+
}, h = (e) => {
|
|
57
|
+
n !== null && (n.dispatch(r.startSelection(e)), n.dispatch(r.endSelection()), n.dispatch(r.activateCell(e)));
|
|
58
|
+
}, g = (e, t) => {
|
|
59
|
+
n !== null && (n.setEditorInitialValue(t), n.dispatch(r.startEdit(e)));
|
|
60
|
+
}, _ = (e, t = null, r) => {
|
|
61
|
+
let a = n;
|
|
62
|
+
a !== null && requestAnimationFrame(() => {
|
|
63
|
+
let o = a.gridRootRef.current;
|
|
64
|
+
if (o !== null && u(o) && o.focus(), e !== null && n !== null && !(t !== null && l(t, n.uiState))) {
|
|
65
|
+
let t = n.rowModel.getRowCount(), a = n.visibleColumns.length, o = i(e.row, 0, Math.max(t - 1, 0)), { getLabelRow: s } = n.rowModel;
|
|
66
|
+
if (s && r !== void 0 && o !== r) {
|
|
67
|
+
let e = o > r ? 1 : -1;
|
|
68
|
+
for (; o >= 0 && o < t && s(o);) o += e;
|
|
69
|
+
(o < 0 || o >= t) && (o = i(r, 0, Math.max(t - 1, 0)));
|
|
70
|
+
}
|
|
71
|
+
h({
|
|
72
|
+
row: o,
|
|
73
|
+
col: i(e.col, 0, Math.max(a - 1, 0))
|
|
69
74
|
});
|
|
70
75
|
}
|
|
71
|
-
|
|
76
|
+
a.editorActionGuardRef.current = !1;
|
|
72
77
|
});
|
|
73
78
|
};
|
|
74
79
|
return {
|
|
75
|
-
update:
|
|
76
|
-
activateSingleCell:
|
|
77
|
-
startEditWithValue:
|
|
78
|
-
commitEdit: (
|
|
79
|
-
if (
|
|
80
|
-
let { uiState:
|
|
81
|
-
if (
|
|
82
|
-
let
|
|
83
|
-
row:
|
|
84
|
-
col:
|
|
85
|
-
} :
|
|
86
|
-
row:
|
|
87
|
-
col:
|
|
88
|
-
} :
|
|
89
|
-
row:
|
|
90
|
-
col:
|
|
91
|
-
} :
|
|
92
|
-
row:
|
|
93
|
-
col:
|
|
94
|
-
} :
|
|
95
|
-
if (!
|
|
96
|
-
if (!
|
|
97
|
-
readOnly:
|
|
98
|
-
canEditCell:
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
80
|
+
update: m,
|
|
81
|
+
activateSingleCell: h,
|
|
82
|
+
startEditWithValue: g,
|
|
83
|
+
commitEdit: (i, l) => {
|
|
84
|
+
if (n === null) return { status: "noop" };
|
|
85
|
+
let { uiState: u, visibleColumns: d, rowModel: f, rows: p, applyServerSideCellEdits: m, onRowsChange: h, dispatch: g, editorActionGuardRef: v } = n;
|
|
86
|
+
if (v.current || !u.editingCell) return { status: "noop" };
|
|
87
|
+
let y = u.editingCell, b = l === "down" ? {
|
|
88
|
+
row: y.row + 1,
|
|
89
|
+
col: y.col
|
|
90
|
+
} : l === "up" ? {
|
|
91
|
+
row: y.row - 1,
|
|
92
|
+
col: y.col
|
|
93
|
+
} : l === "right" ? {
|
|
94
|
+
row: y.row,
|
|
95
|
+
col: y.col + 1
|
|
96
|
+
} : l === "left" ? {
|
|
97
|
+
row: y.row,
|
|
98
|
+
col: y.col - 1
|
|
99
|
+
} : y, x = d[y.col], S = f.getSourceIndex(y.row), C = m ? f.getRow(y.row) : p[S];
|
|
100
|
+
if (!x || !C) return g(r.stopEdit()), { status: "noop" };
|
|
101
|
+
if (!t({
|
|
102
|
+
readOnly: n.readOnly,
|
|
103
|
+
canEditCell: n.canEditCell
|
|
104
|
+
}, f, y.row, y.col, C, x)) return v.current = !0, g(r.stopEdit()), _(null), { status: "noop" };
|
|
105
|
+
let w = a(x, e(C, x), i);
|
|
106
|
+
if (!w && m) {
|
|
107
|
+
let e = o(x, i, C), t = c(x, C, e);
|
|
102
108
|
if (t.action === "reject") return {
|
|
103
109
|
status: "rejected",
|
|
104
110
|
message: t.message
|
|
105
111
|
};
|
|
106
|
-
|
|
107
|
-
viewIndex:
|
|
108
|
-
column:
|
|
112
|
+
m([{
|
|
113
|
+
viewIndex: y.row,
|
|
114
|
+
column: x,
|
|
109
115
|
value: e
|
|
110
116
|
}]);
|
|
111
|
-
} else if (
|
|
112
|
-
let e =
|
|
117
|
+
} else if (!w && h) {
|
|
118
|
+
let e = o(x, i, C), t = c(x, C, e);
|
|
113
119
|
if (t.action === "reject") return {
|
|
114
120
|
status: "rejected",
|
|
115
121
|
message: t.message
|
|
116
122
|
};
|
|
117
|
-
|
|
123
|
+
h(s(p, S, x, e));
|
|
118
124
|
}
|
|
119
|
-
return
|
|
120
|
-
activeCell:
|
|
121
|
-
selection:
|
|
122
|
-
} : null),
|
|
125
|
+
return v.current = !0, _(b, l === void 0 ? {
|
|
126
|
+
activeCell: u.activeCell,
|
|
127
|
+
selection: u.selection
|
|
128
|
+
} : null, y.row), g(r.stopEdit()), { status: "committed" };
|
|
123
129
|
},
|
|
124
130
|
cancelEdit: () => {
|
|
125
|
-
|
|
131
|
+
n === null || n.editorActionGuardRef.current || (n.editorActionGuardRef.current = !0, n.dispatch(r.stopEdit()), _(null));
|
|
126
132
|
}
|
|
127
133
|
};
|
|
128
134
|
};
|
|
129
135
|
//#endregion
|
|
130
|
-
export {
|
|
136
|
+
export { d as createEditController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=new Map,o=()=>{let i=null,o=0,s=null,c=e.createValueStore({open:!1,query:``,matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1}),l=e=>{c.setSnapshot({...c.getSnapshot(),...e})},u=null,d=()=>{let e=c.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open};u!==null&&u.query===t.query&&u.matchCount===t.matchCount&&u.currentIndex===t.currentIndex&&u.open===t.open||(u=t,i?.onChange?.(t))},f=()=>{let e=c.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},p=()=>{o+=1,s=null,l({matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1})},m=e=>{let a=i,u=c.getSnapshot();if(!a||!u.open||u.query.length===0){p(),d();return}o+=1;let m=o,{rowModel:h,columns:g,caseSensitive:_}=a,v=u.query;s={rowModel:h,columns:g,query:v,caseSensitive:_};let y=u.currentIndex===null?null:u.matches[u.currentIndex]??null,b=[],x=!1,S=h.getRowCount();l({scanning:!0}),t.runChunked(S,e=>{if(x)return;let t=h.getRow(e);t!==void 0&&g.forEach((i,a)=>{if(x||n.isSyntheticColumnKey(i.key))return;let o=r.resolveFindCellText(i,t);for(let t of r.findRangesInText(o,v,_)){if(b.length>=1e4){x=!0;return}b.push({rowIndex:e,colIndex:a,columnKey:String(i.key),start:t.start,length:t.length})}})},{isCancelled:()=>o!==m}).then(t=>{if(!t||o!==m)return;let n=r.resolveCurrentAfterRescan(b,y);l({matches:b,index:r.buildFindIndex(b),currentIndex:n,scanning:!1,truncated:x}),d(),e&&f()})},h=()=>{let e=c.getSnapshot();return!i||!e.open||e.query.length===0?!1:s===null||s.rowModel!==i.rowModel||s.columns!==i.columns||s.query!==e.query||s.caseSensitive!==i.caseSensitive};return{update:e=>{let t=i;if(i=e,!e.enabled){c.getSnapshot().open&&(l({open:!1,query:``}),p(),d());return}t!==e&&h()&&m(!1)},open:e=>{if(!i?.enabled)return;let t=c.getSnapshot(),n=e??t.query;l({open:!0,query:n}),n!==t.query||!t.open?m(!0):d()},close:()=>{c.getSnapshot().open&&(l({open:!1,query:``}),p(),d())},setQuery:e=>{let t=c.getSnapshot();!t.open||e===t.query||(l({query:e}),m(!0))},next:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);l({currentIndex:t}),d(),f()},prev:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);l({currentIndex:t}),d(),f()},subscribe:c.subscribe,getSnapshot:c.getSnapshot,dispose:()=>{o+=1,i=null}}};exports.MAX_FIND_MATCHES=i,exports.createFindController=o;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=new Map,o=()=>{let i=null,o=0,s=null,c=e.createValueStore({open:!1,query:``,matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1}),l=e=>{c.setSnapshot({...c.getSnapshot(),...e})},u=null,d=()=>{let e=c.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open};u!==null&&u.query===t.query&&u.matchCount===t.matchCount&&u.currentIndex===t.currentIndex&&u.open===t.open||(u=t,i?.onChange?.(t))},f=()=>{let e=c.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},p=()=>{o+=1,s=null,l({matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1})},m=e=>{let a=i,u=c.getSnapshot();if(!a||!u.open||u.query.length===0){p(),d();return}o+=1;let m=o,{rowModel:h,columns:g,caseSensitive:_}=a,v=u.query;s={rowModel:h,columns:g,query:v,caseSensitive:_};let y=u.currentIndex===null?null:u.matches[u.currentIndex]??null,b=[],x=!1,S=h.getRowCount();l({scanning:!0}),t.runChunked(S,e=>{if(x)return;let t=h.getRow(e);t!==void 0&&g.forEach((i,a)=>{if(x||n.isSyntheticColumnKey(i.key)||!r.isFindableColumn(i))return;let o=r.resolveFindCellText(i,t);for(let t of r.findRangesInText(o,v,_)){if(b.length>=1e4){x=!0;return}b.push({rowIndex:e,colIndex:a,columnKey:String(i.key),start:t.start,length:t.length})}})},{isCancelled:()=>o!==m}).then(t=>{if(!t||o!==m)return;let n=r.resolveCurrentAfterRescan(b,y);l({matches:b,index:r.buildFindIndex(b),currentIndex:n,scanning:!1,truncated:x}),d(),e&&f()})},h=()=>{let e=c.getSnapshot();return!i||!e.open||e.query.length===0?!1:s===null||s.rowModel!==i.rowModel||s.columns!==i.columns||s.query!==e.query||s.caseSensitive!==i.caseSensitive};return{update:e=>{let t=i;if(i=e,!e.enabled){c.getSnapshot().open&&(l({open:!1,query:``}),p(),d());return}t!==e&&h()&&m(!1)},open:e=>{if(!i?.enabled)return;let t=c.getSnapshot(),n=e??t.query;l({open:!0,query:n}),n!==t.query||!t.open?m(!0):d()},close:()=>{c.getSnapshot().open&&(l({open:!1,query:``}),p(),d())},setQuery:e=>{let t=c.getSnapshot();!t.open||e===t.query||(l({query:e}),m(!0))},next:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);l({currentIndex:t}),d(),f()},prev:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);l({currentIndex:t}),d(),f()},subscribe:c.subscribe,getSnapshot:c.getSnapshot,dispose:()=>{o+=1,i=null}}};exports.MAX_FIND_MATCHES=i,exports.createFindController=o;
|
|
@@ -1,137 +1,137 @@
|
|
|
1
1
|
import { createValueStore as e } from "../logic/valueStore.js";
|
|
2
2
|
import { runChunked as t } from "../logic/chunkedLoop.js";
|
|
3
3
|
import { isSyntheticColumnKey as n } from "../logic/detailRow.js";
|
|
4
|
-
import { buildFindIndex as r, findRangesInText as i,
|
|
4
|
+
import { buildFindIndex as r, findRangesInText as i, isFindableColumn as a, resolveCurrentAfterRescan as o, resolveFindCellText as s, stepFindIndex as c } from "../logic/find.js";
|
|
5
5
|
//#region src/controllers/findController.ts
|
|
6
|
-
var
|
|
7
|
-
let
|
|
6
|
+
var l = 1e4, u = /* @__PURE__ */ new Map(), d = () => {
|
|
7
|
+
let l = null, d = 0, f = null, p = e({
|
|
8
8
|
open: !1,
|
|
9
9
|
query: "",
|
|
10
10
|
matches: [],
|
|
11
|
-
index:
|
|
11
|
+
index: u,
|
|
12
12
|
currentIndex: null,
|
|
13
13
|
scanning: !1,
|
|
14
14
|
truncated: !1
|
|
15
|
-
}),
|
|
16
|
-
|
|
17
|
-
...
|
|
15
|
+
}), m = (e) => {
|
|
16
|
+
p.setSnapshot({
|
|
17
|
+
...p.getSnapshot(),
|
|
18
18
|
...e
|
|
19
19
|
});
|
|
20
|
-
},
|
|
21
|
-
let e =
|
|
20
|
+
}, h = null, g = () => {
|
|
21
|
+
let e = p.getSnapshot(), t = {
|
|
22
22
|
query: e.query,
|
|
23
23
|
matchCount: e.matches.length,
|
|
24
24
|
currentIndex: e.currentIndex,
|
|
25
25
|
open: e.open
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
let e =
|
|
27
|
+
h !== null && h.query === t.query && h.matchCount === t.matchCount && h.currentIndex === t.currentIndex && h.open === t.open || (h = t, l?.onChange?.(t));
|
|
28
|
+
}, _ = () => {
|
|
29
|
+
let e = p.getSnapshot();
|
|
30
30
|
if (e.currentIndex === null) return;
|
|
31
31
|
let t = e.matches[e.currentIndex];
|
|
32
|
-
t &&
|
|
33
|
-
},
|
|
34
|
-
|
|
32
|
+
t && l?.onNavigate(t.rowIndex, t.colIndex);
|
|
33
|
+
}, v = () => {
|
|
34
|
+
d += 1, f = null, m({
|
|
35
35
|
matches: [],
|
|
36
|
-
index:
|
|
36
|
+
index: u,
|
|
37
37
|
currentIndex: null,
|
|
38
38
|
scanning: !1,
|
|
39
39
|
truncated: !1
|
|
40
40
|
});
|
|
41
|
-
},
|
|
42
|
-
let
|
|
43
|
-
if (!
|
|
44
|
-
|
|
41
|
+
}, y = (e) => {
|
|
42
|
+
let c = l, u = p.getSnapshot();
|
|
43
|
+
if (!c || !u.open || u.query.length === 0) {
|
|
44
|
+
v(), g();
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
rowModel:
|
|
51
|
-
columns:
|
|
52
|
-
query:
|
|
53
|
-
caseSensitive:
|
|
47
|
+
d += 1;
|
|
48
|
+
let h = d, { rowModel: y, columns: b, caseSensitive: x } = c, S = u.query;
|
|
49
|
+
f = {
|
|
50
|
+
rowModel: y,
|
|
51
|
+
columns: b,
|
|
52
|
+
query: S,
|
|
53
|
+
caseSensitive: x
|
|
54
54
|
};
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
let t =
|
|
59
|
-
t !== void 0 &&
|
|
60
|
-
if (
|
|
61
|
-
let
|
|
62
|
-
for (let t of i(
|
|
63
|
-
if (
|
|
64
|
-
|
|
55
|
+
let C = u.currentIndex === null ? null : u.matches[u.currentIndex] ?? null, w = [], T = !1, E = y.getRowCount();
|
|
56
|
+
m({ scanning: !0 }), t(E, (e) => {
|
|
57
|
+
if (T) return;
|
|
58
|
+
let t = y.getRow(e);
|
|
59
|
+
t !== void 0 && b.forEach((r, o) => {
|
|
60
|
+
if (T || n(r.key) || !a(r)) return;
|
|
61
|
+
let c = s(r, t);
|
|
62
|
+
for (let t of i(c, S, x)) {
|
|
63
|
+
if (w.length >= 1e4) {
|
|
64
|
+
T = !0;
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
w.push({
|
|
68
68
|
rowIndex: e,
|
|
69
|
-
colIndex:
|
|
69
|
+
colIndex: o,
|
|
70
70
|
columnKey: String(r.key),
|
|
71
71
|
start: t.start,
|
|
72
72
|
length: t.length
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
-
}, { isCancelled: () =>
|
|
77
|
-
if (!t ||
|
|
78
|
-
let n =
|
|
79
|
-
|
|
80
|
-
matches:
|
|
81
|
-
index: r(
|
|
76
|
+
}, { isCancelled: () => d !== h }).then((t) => {
|
|
77
|
+
if (!t || d !== h) return;
|
|
78
|
+
let n = o(w, C);
|
|
79
|
+
m({
|
|
80
|
+
matches: w,
|
|
81
|
+
index: r(w),
|
|
82
82
|
currentIndex: n,
|
|
83
83
|
scanning: !1,
|
|
84
|
-
truncated:
|
|
85
|
-
}),
|
|
84
|
+
truncated: T
|
|
85
|
+
}), g(), e && _();
|
|
86
86
|
});
|
|
87
|
-
},
|
|
88
|
-
let e =
|
|
89
|
-
return !
|
|
87
|
+
}, b = () => {
|
|
88
|
+
let e = p.getSnapshot();
|
|
89
|
+
return !l || !e.open || e.query.length === 0 ? !1 : f === null || f.rowModel !== l.rowModel || f.columns !== l.columns || f.query !== e.query || f.caseSensitive !== l.caseSensitive;
|
|
90
90
|
};
|
|
91
91
|
return {
|
|
92
92
|
update: (e) => {
|
|
93
|
-
let t =
|
|
94
|
-
if (
|
|
95
|
-
|
|
93
|
+
let t = l;
|
|
94
|
+
if (l = e, !e.enabled) {
|
|
95
|
+
p.getSnapshot().open && (m({
|
|
96
96
|
open: !1,
|
|
97
97
|
query: ""
|
|
98
|
-
}),
|
|
98
|
+
}), v(), g());
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
t !== e &&
|
|
101
|
+
t !== e && b() && y(!1);
|
|
102
102
|
},
|
|
103
103
|
open: (e) => {
|
|
104
|
-
if (!
|
|
105
|
-
let t =
|
|
106
|
-
|
|
104
|
+
if (!l?.enabled) return;
|
|
105
|
+
let t = p.getSnapshot(), n = e ?? t.query;
|
|
106
|
+
m({
|
|
107
107
|
open: !0,
|
|
108
108
|
query: n
|
|
109
|
-
}), n !== t.query || !t.open ?
|
|
109
|
+
}), n !== t.query || !t.open ? y(!0) : g();
|
|
110
110
|
},
|
|
111
111
|
close: () => {
|
|
112
|
-
|
|
112
|
+
p.getSnapshot().open && (m({
|
|
113
113
|
open: !1,
|
|
114
114
|
query: ""
|
|
115
|
-
}),
|
|
115
|
+
}), v(), g());
|
|
116
116
|
},
|
|
117
117
|
setQuery: (e) => {
|
|
118
|
-
let t =
|
|
119
|
-
!t.open || e === t.query || (
|
|
118
|
+
let t = p.getSnapshot();
|
|
119
|
+
!t.open || e === t.query || (m({ query: e }), y(!0));
|
|
120
120
|
},
|
|
121
121
|
next: () => {
|
|
122
|
-
let e =
|
|
123
|
-
|
|
122
|
+
let e = p.getSnapshot(), t = c(e.currentIndex, e.matches.length, 1);
|
|
123
|
+
m({ currentIndex: t }), g(), _();
|
|
124
124
|
},
|
|
125
125
|
prev: () => {
|
|
126
|
-
let e =
|
|
127
|
-
|
|
126
|
+
let e = p.getSnapshot(), t = c(e.currentIndex, e.matches.length, -1);
|
|
127
|
+
m({ currentIndex: t }), g(), _();
|
|
128
128
|
},
|
|
129
|
-
subscribe:
|
|
130
|
-
getSnapshot:
|
|
129
|
+
subscribe: p.subscribe,
|
|
130
|
+
getSnapshot: p.getSnapshot,
|
|
131
131
|
dispose: () => {
|
|
132
|
-
|
|
132
|
+
d += 1, l = null;
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
136
|
//#endregion
|
|
137
|
-
export {
|
|
137
|
+
export { l as MAX_FIND_MATCHES, d as createFindController };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/domGuards.cjs");var n=`ssg-ime-input--composing`,r=(t,n,r)=>{let i=t.querySelectorAll(`.ssg-body-row[data-row-index="${n.row}"]`);for(let n of Array.from(i)){if(e.isInsideDetailCardOf(t,n))continue;let i=n.querySelectorAll(`.ssg-body-cell`);for(let e of Array.from(i))if(e.getAttribute(`data-ssg-col-key`)===r)return e}return null},i=(e,t)=>e===t||e!==null&&t!==null&&e.row===t.row&&e.col===t.col,a=()=>{let e=null,a=null,o=null,s=null,c=!1,l=null,u=!1,d=!1,f=!1,p=null,m=()=>e?.gridRootRef.current??null,h=()=>{a&&a.ownerDocument.activeElement!==a&&a.focus({preventScroll:!0})},g=(t,n)=>{let i=m(),o=e?.resolveCell(t)??null;if(!a||!i||!o)return!1;let s=r(i,t,o.colKey);if(!s)return!1;let c=i.getBoundingClientRect(),l=s.getBoundingClientRect();return a.style.left=`${l.left-c.left-i.clientLeft}px`,a.style.top=`${l.top-c.top-i.clientTop}px`,a.style.width=`${l.width}px`,a.style.height=`${l.height}px`,a.style.textAlign=n&&o.align?o.align:``,!0},_=()=>{a&&(a.classList.remove(n),a.value=``,a.style.textAlign=``)},v=t=>{e===null||!e.enabled||e.editing||d||t.target===o&&h()},y=()=>{if(e===null||!e.enabled||e.editing||e.activeCell===null){l=null;return}let t=e.activeCell,r=e.canStartEdit(t);l={cell:t,allowed:r},f=!1,r&&(g(t,!0),p=t,a?.classList.add(n))},b=t=>{let n=l;l=null;let r=f;if(f=!1,!a||n===null||!n.allowed||r){_();return}let i=a.value||t.data||``;queueMicrotask(()=>{let t=a;if(e===null||!e.enabled||!t||i===``||t.ownerDocument.activeElement!==t||!e.canStartEdit(n.cell)){_();return}let r=e.resolveEditText?e.resolveEditText(n.cell,i):i;if(r===null||r===``){_();return}u=!0,e.startEdit(n.cell,r),requestAnimationFrame(()=>{u&&e!==null&&!e.editing&&(u=!1,_())})})},x=()=>{l===null&&!u&&a&&(a.value=``)},S=e=>{if(e.target!==a||e.key!==`Tab`||e.defaultPrevented||t.isImeComposingKeyEvent(e))return;let n=m();if(n){d=!0;try{n.focus({preventScroll:!0})}finally{d=!1}}},C=()=>{l!==null&&(f=!0)},w=e=>{o!==e&&(o?.removeEventListener(`focus`,v),o=e,o?.addEventListener(`focus`,v))},T=e=>{typeof document>`u`||c===e||(c=e,e?(document.addEventListener(`keydown`,S),document.addEventListener(`pointerdown`,C,!0)):(document.removeEventListener(`keydown`,S),document.removeEventListener(`pointerdown`,C,!0)))},E=e=>{s!==e&&(s&&(s.removeEventListener(`compositionstart`,y),s.removeEventListener(`compositionend`,b),s.removeEventListener(`input`,x)),s=e,s&&(s.addEventListener(`compositionstart`,y),s.addEventListener(`compositionend`,b),s.addEventListener(`input`,x)))};return{update:t=>{e=t;let n=t.gridRootRef.current;if(w(t.enabled?n:null),E(t.enabled?a:null),T(t.enabled),!t.enabled){l=null,u=!1,_(),a&&n&&a.ownerDocument.activeElement===a&&n.focus({preventScroll:!0});return}u&&t.editing&&(u=!1,_()),!(l!==null||u)&&(t.activeCell!==null&&!i(p,t.activeCell)&&g(t.activeCell,!1)&&(p=t.activeCell),!t.editing&&n&&n.ownerDocument.activeElement===n&&h())},attach:t=>{a!==t&&(a=t,E(e?.enabled?a:null),a&&(typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches&&(a.inputMode=`none`),p=null))},dispose:()=>{E(null),w(null),T(!1),l=null,u=!1,e=null}}};exports.IME_INPUT_COMPOSING_CLASS=n,exports.createImeInputController=a;
|