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