@ishibashi0112/spreadsheet-grid-core 1.10.0 → 1.12.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 (157) hide show
  1. package/dist/controllers/changeHighlightController.cjs +1 -1
  2. package/dist/controllers/changeHighlightController.js +69 -71
  3. package/dist/controllers/changeTracker.cjs +1 -1
  4. package/dist/controllers/changeTracker.js +229 -228
  5. package/dist/controllers/clipboardController.cjs +4 -2
  6. package/dist/controllers/clipboardController.d.ts +8 -0
  7. package/dist/controllers/clipboardController.js +286 -160
  8. package/dist/controllers/dateTimeEditorController.cjs +1 -0
  9. package/dist/controllers/dateTimeEditorController.d.ts +62 -0
  10. package/dist/controllers/dateTimeEditorController.js +201 -0
  11. package/dist/controllers/editController.cjs +1 -1
  12. package/dist/controllers/editController.js +206 -191
  13. package/dist/controllers/fillHandleController.cjs +1 -1
  14. package/dist/controllers/fillHandleController.js +151 -150
  15. package/dist/controllers/findController.cjs +1 -1
  16. package/dist/controllers/findController.d.ts +18 -0
  17. package/dist/controllers/findController.js +150 -92
  18. package/dist/controllers/findReplaceController.cjs +1 -0
  19. package/dist/controllers/findReplaceController.d.ts +61 -0
  20. package/dist/controllers/findReplaceController.js +324 -0
  21. package/dist/controllers/keyboardController.cjs +1 -1
  22. package/dist/controllers/keyboardController.d.ts +1 -0
  23. package/dist/controllers/keyboardController.js +150 -145
  24. package/dist/controllers/multiSelectEditorController.cjs +1 -0
  25. package/dist/controllers/multiSelectEditorController.d.ts +54 -0
  26. package/dist/controllers/multiSelectEditorController.js +200 -0
  27. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  28. package/dist/controllers/pointerInteractionsController.js +155 -154
  29. package/dist/controllers/selectOptionsCollector.cjs +1 -1
  30. package/dist/controllers/selectOptionsCollector.d.ts +2 -1
  31. package/dist/controllers/selectOptionsCollector.js +53 -52
  32. package/dist/controllers/tooltipController.cjs +1 -1
  33. package/dist/controllers/tooltipController.js +6 -1
  34. package/dist/engine/cellCommands.cjs +1 -1
  35. package/dist/engine/cellCommands.js +65 -64
  36. package/dist/engine/createGridEngine.cjs +1 -1
  37. package/dist/engine/createGridEngine.d.ts +2 -0
  38. package/dist/engine/createGridEngine.js +52 -51
  39. package/dist/engine/excelShortcutCommands.cjs +1 -1
  40. package/dist/engine/excelShortcutCommands.js +148 -123
  41. package/dist/engine/exportCommands.cjs +2 -2
  42. package/dist/engine/exportCommands.js +13 -11
  43. package/dist/engine/features.cjs +1 -1
  44. package/dist/engine/features.d.ts +5 -0
  45. package/dist/engine/features.js +39 -15
  46. package/dist/engine/fullFeatures.cjs +1 -1
  47. package/dist/engine/fullFeatures.js +29 -27
  48. package/dist/engine/gridApi.cjs +2 -2
  49. package/dist/engine/gridApi.d.ts +6 -1
  50. package/dist/engine/gridApi.js +29 -3
  51. package/dist/engine/newRowController.cjs +1 -1
  52. package/dist/engine/newRowController.js +69 -68
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.d.ts +1 -1
  55. package/dist/index.js +4 -4
  56. package/dist/locales/en.cjs +1 -1
  57. package/dist/locales/en.js +31 -0
  58. package/dist/logic/cellText.cjs +1 -0
  59. package/dist/logic/cellText.d.ts +3 -0
  60. package/dist/logic/cellText.js +11 -0
  61. package/dist/logic/cellValueTransfer.cjs +1 -0
  62. package/dist/logic/cellValueTransfer.d.ts +8 -0
  63. package/dist/logic/cellValueTransfer.js +11 -0
  64. package/dist/logic/changeTracking.cjs +1 -1
  65. package/dist/logic/changeTracking.js +88 -85
  66. package/dist/logic/clearCells.cjs +1 -1
  67. package/dist/logic/clearCells.js +1 -1
  68. package/dist/logic/clipboardHtml.cjs +1 -0
  69. package/dist/logic/clipboardHtml.d.ts +40 -0
  70. package/dist/logic/clipboardHtml.js +168 -0
  71. package/dist/logic/columnAutosize.cjs +1 -1
  72. package/dist/logic/columnAutosize.js +133 -115
  73. package/dist/logic/columnEditor.cjs +1 -0
  74. package/dist/logic/columnEditor.d.ts +26 -0
  75. package/dist/logic/columnEditor.js +15 -0
  76. package/dist/logic/dateTimeEditor.cjs +1 -0
  77. package/dist/logic/dateTimeEditor.d.ts +54 -0
  78. package/dist/logic/dateTimeEditor.js +100 -0
  79. package/dist/logic/dateTimeValues.cjs +1 -0
  80. package/dist/logic/dateTimeValues.d.ts +19 -0
  81. package/dist/logic/dateTimeValues.js +42 -0
  82. package/dist/logic/editorValues.cjs +1 -1
  83. package/dist/logic/editorValues.d.ts +4 -4
  84. package/dist/logic/editorValues.js +60 -49
  85. package/dist/logic/exportCsv.cjs +2 -2
  86. package/dist/logic/exportCsv.d.ts +2 -1
  87. package/dist/logic/exportCsv.js +17 -17
  88. package/dist/logic/exportData.cjs +1 -1
  89. package/dist/logic/exportData.d.ts +2 -1
  90. package/dist/logic/exportData.js +26 -26
  91. package/dist/logic/featureWarnings.cjs +1 -1
  92. package/dist/logic/featureWarnings.js +19 -10
  93. package/dist/logic/fillHandle.cjs +1 -1
  94. package/dist/logic/fillHandle.js +147 -100
  95. package/dist/logic/fillSeries.cjs +1 -1
  96. package/dist/logic/fillSeries.d.ts +2 -0
  97. package/dist/logic/fillSeries.js +104 -64
  98. package/dist/logic/filterSummary.cjs +1 -1
  99. package/dist/logic/filterSummary.js +38 -37
  100. package/dist/logic/filtering.cjs +1 -1
  101. package/dist/logic/filtering.js +160 -118
  102. package/dist/logic/find.cjs +1 -1
  103. package/dist/logic/find.d.ts +6 -2
  104. package/dist/logic/find.js +66 -26
  105. package/dist/logic/findReplace.cjs +1 -0
  106. package/dist/logic/findReplace.d.ts +35 -0
  107. package/dist/logic/findReplace.js +84 -0
  108. package/dist/logic/gridAsk.cjs +3 -3
  109. package/dist/logic/gridAsk.js +216 -211
  110. package/dist/logic/grouping.cjs +1 -1
  111. package/dist/logic/grouping.js +34 -38
  112. package/dist/logic/imeInput.cjs +1 -1
  113. package/dist/logic/imeInput.d.ts +1 -1
  114. package/dist/logic/imeInput.js +21 -20
  115. package/dist/logic/inferFilterType.cjs +1 -1
  116. package/dist/logic/inferFilterType.js +1 -1
  117. package/dist/logic/localeText.cjs +1 -1
  118. package/dist/logic/localeText.d.ts +3 -0
  119. package/dist/logic/localeText.js +3 -0
  120. package/dist/logic/localeTextFeatures.cjs +1 -1
  121. package/dist/logic/localeTextFeatures.d.ts +34 -0
  122. package/dist/logic/localeTextFeatures.js +38 -7
  123. package/dist/logic/multiSelect.cjs +1 -0
  124. package/dist/logic/multiSelect.d.ts +55 -0
  125. package/dist/logic/multiSelect.js +150 -0
  126. package/dist/logic/newRow.cjs +1 -1
  127. package/dist/logic/newRow.js +12 -11
  128. package/dist/logic/rowDragTarget.cjs +1 -1
  129. package/dist/logic/rowDragTarget.js +21 -23
  130. package/dist/logic/selectEditorState.cjs +1 -1
  131. package/dist/logic/selectEditorState.d.ts +1 -0
  132. package/dist/logic/selectEditorState.js +1 -1
  133. package/dist/logic/selectFillRow.cjs +1 -1
  134. package/dist/logic/selectFillRow.js +19 -18
  135. package/dist/logic/selectLabels.cjs +1 -1
  136. package/dist/logic/selectLabels.d.ts +4 -2
  137. package/dist/logic/selectLabels.js +36 -32
  138. package/dist/logic/selectOptions.cjs +1 -1
  139. package/dist/logic/selectOptions.d.ts +3 -2
  140. package/dist/logic/selectOptions.js +37 -16
  141. package/dist/logic/selectionAggregates.cjs +1 -1
  142. package/dist/logic/selectionAggregates.js +1 -1
  143. package/dist/logic/selectionOverlayGeometry.cjs +1 -1
  144. package/dist/logic/selectionOverlayGeometry.d.ts +14 -0
  145. package/dist/logic/selectionOverlayGeometry.js +36 -4
  146. package/dist/logic/sorting.cjs +1 -1
  147. package/dist/logic/sorting.js +108 -102
  148. package/dist/logic/validation.cjs +1 -1
  149. package/dist/logic/validation.d.ts +1 -1
  150. package/dist/logic/validation.js +28 -21
  151. package/dist/model/gridTypes.core.d.ts +211 -11
  152. package/dist/utils/clipboard.cjs +5 -4
  153. package/dist/utils/clipboard.d.ts +12 -3
  154. package/dist/utils/clipboard.js +51 -36
  155. package/dist/utils/editorVisibleBounds.cjs +1 -1
  156. package/dist/utils/editorVisibleBounds.js +1 -1
  157. package/package.json +1 -1
@@ -1,25 +1,34 @@
1
1
  import { gridActions as e } from "../model/gridActions.js";
2
2
  import { getCellValue as t, isCellEditable as n, isViewCellEditable as r } from "../utils/permissions.js";
3
- import { isSyntheticColumnKey as i } from "../logic/detailRow.js";
4
- import { normalizeCellRange as a } from "../model/gridSelectors.js";
5
- import { formatCellClipboardText as o } from "../logic/selectLabels.js";
6
- import { clamp as s } from "../logic/geometry.js";
7
- import { shouldIgnoreGridKeydown as c } from "../logic/domGuards.js";
8
- import { resolveCellParser as l } from "../logic/editorValues.js";
9
- import { applyClipboardMatrixToRows as u, buildClipboardCellEdits as d, filterClipboardColumns as f, formatClipboardCell as p, joinTsvLines as m, joinTsvRow as h, parseClipboardText as ee, resolvePasteColumnIndexes as te, serializeSelectionToTsv as g, writeTextToClipboard as ne } from "../utils/clipboard.js";
10
- import { findFirstPasteRow as re, resolvePasteTargetViewIndexes as ie } from "../logic/labelRows.js";
11
- import { getSelectableRowCount as _ } from "../logic/newRow.js";
12
- import { expandPasteMatrixToSelection as ae } from "../logic/pasteFill.js";
13
- import { buildClearCellEdits as oe, clearCellsInSelection as se, resolveClearTarget as v } from "../logic/clearCells.js";
14
- import { isEditingAtEvent as ce, readLiveUiState as le } from "./liveUiState.js";
3
+ import { isMultiSelectCell as i, isSameMultiSelectValue as a } from "../logic/multiSelect.js";
4
+ import { getActiveElement as o } from "../utils/shadowDom.js";
5
+ import { isSyntheticColumnKey as s } from "../logic/detailRow.js";
6
+ import { normalizeCellRange as c, normalizeColumnRange as l, normalizeRowRange as u } from "../model/gridSelectors.js";
7
+ import { formatCellClipboardText as d } from "../logic/selectLabels.js";
8
+ import { clamp as f } from "../logic/geometry.js";
9
+ import { shouldIgnoreGridKeydown as p } from "../logic/domGuards.js";
10
+ import { resolveCellParser as m } from "../logic/editorValues.js";
11
+ import { applyClipboardMatrixToRows as h, buildClipboardCellEdits as g, buildClipboardHeaderText as _, filterClipboardColumns as v, formatClipboardCell as y, joinTsvLines as b, joinTsvRow as x, parseClipboardText as ee, resolveClipboardHeaderLayout as S, resolvePasteColumnIndexes as te, serializeSelectionToTsv as C, writeTextToClipboard as w } from "../utils/clipboard.js";
12
+ import { findFirstPasteRow as ne, resolvePasteTargetViewIndexes as re } from "../logic/labelRows.js";
13
+ import { getSelectableRowCount as T } from "../logic/newRow.js";
14
+ import { expandPasteMatrixToSelection as ie } from "../logic/pasteFill.js";
15
+ import { buildClearCellEdits as ae, clearCellsInSelection as oe, resolveClearTarget as E } from "../logic/clearCells.js";
16
+ import { isEditingAtEvent as se, readLiveUiState as ce } from "./liveUiState.js";
15
17
  //#region src/controllers/clipboardController.ts
16
- var y = (e) => e.replace(/\r\n?/g, "\n").replace(/\n+$/, ""), b = (e, t, n) => {
18
+ var D = (e) => e.replace(/\r\n?/g, "\n").replace(/\n+$/, ""), O = (e) => {
19
+ let t = 2166136261;
20
+ for (let n = 0; n < e.length; n += 1) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
21
+ return t >>> 0;
22
+ }, le = (e) => {
23
+ let t = o(e instanceof Node ? e : null);
24
+ return t instanceof HTMLElement && t !== t.ownerDocument.body ? t : e;
25
+ }, k = (e, t, n) => {
17
26
  if (t === 0 || n === 0 || e?.type !== "cell") return !1;
18
27
  let { start: r, end: i } = e.range, a = Math.min(r.row, i.row), o = Math.min(r.col, i.col), s = Math.max(r.row, i.row), c = Math.max(r.col, i.col);
19
28
  return a === 0 && o === 0 && s === t - 1 && c === n - 1;
20
29
  }, ue = (e, t) => {
21
30
  if (e?.type === "cell") {
22
- let n = a(e.range);
31
+ let n = c(e.range);
23
32
  return t.row >= n.start.row && t.row <= n.end.row && t.col >= n.start.col && t.col <= n.end.col ? n.start : t;
24
33
  }
25
34
  return e?.type === "col" ? {
@@ -37,7 +46,7 @@ var y = (e) => e.replace(/\r\n?/g, "\n").replace(/\n+$/, ""), b = (e, t, n) => {
37
46
  r = Math.min(r, t.getRowCount() - 1);
38
47
  for (let e = Math.max(n, 0); e <= r; e += 1) if (t.getRow(e) == null && t.getLabelRow?.(e) === void 0) return !0;
39
48
  return !1;
40
- }, x = (e, t, n) => {
49
+ }, fe = (e, t, n) => {
41
50
  let r = {
42
51
  row: e.row,
43
52
  rowKey: n,
@@ -48,33 +57,79 @@ var y = (e) => e.replace(/\r\n?/g, "\n").replace(/\n+$/, ""), b = (e, t, n) => {
48
57
  reason: e.reason
49
58
  };
50
59
  return e.reason === "invalid" && (r.value = e.value, r.message = e.message), r;
51
- }, S = () => {
52
- let a = null, S = (e) => {
53
- a = e;
54
- }, C = (e) => {
60
+ }, A = () => {
61
+ let o = null, A = (e) => {
62
+ o = e;
63
+ }, j = (e) => {
55
64
  let { isRowExportable: t, rowModel: n } = e;
56
65
  if (t) return (e, r) => t(e, {
57
66
  viewRowIndex: r,
58
67
  rowKey: n.getRowKey(r) ?? r
59
68
  });
60
- }, w = (e) => {
61
- let { rowModel: t } = e, n = f(e.visibleColumns), r = t.getRowCount();
69
+ }, M = (e) => {
70
+ let { rowModel: t } = e, n = v(e.visibleColumns), r = t.getRowCount();
62
71
  if (r === 0 || n.length === 0) return "";
63
- let i = C(e), a = [];
72
+ let i = j(e), a = e.localeTexts?.multiSelectSeparator, o = [];
64
73
  for (let e = 0; e < r; e += 1) {
65
74
  let r = t.getRow(e);
66
75
  if (!r || i && !i(r, e)) continue;
67
76
  let s = t.getTreeRow?.(e)?.aggregates;
68
- a.push(h(n.map((e) => s !== void 0 && e.key in s ? o(e, s[e.key], r) : p(r, e))));
77
+ o.push(x(n.map((e) => s !== void 0 && e.key in s ? d(e, s[e.key], r, a) : y(r, e, a))));
69
78
  }
70
- return m(a);
71
- }, T = (e, t) => {
79
+ return b(o);
80
+ }, N = (e, t) => {
81
+ if (!t) return null;
82
+ let { rowModel: n, visibleColumns: r } = e, i = n.getRowCount() - 1;
83
+ if (k(t, T(n), r.length)) return {
84
+ columns: v(r),
85
+ startRow: 0,
86
+ endRow: i
87
+ };
88
+ if (t.type === "cell") {
89
+ let e = c(t.range);
90
+ return {
91
+ columns: v(r.slice(e.start.col, e.end.col + 1)),
92
+ startRow: e.start.row,
93
+ endRow: Math.min(e.end.row, i)
94
+ };
95
+ }
96
+ if (t.type === "row") {
97
+ let e = u(t.startRow, t.endRow);
98
+ return {
99
+ columns: v(r),
100
+ startRow: e.startRow,
101
+ endRow: Math.min(e.endRow, i)
102
+ };
103
+ }
104
+ let a = l(t.startCol, t.endCol);
105
+ return {
106
+ columns: v(r.slice(a.startCol, a.endCol + 1)),
107
+ startRow: 0,
108
+ endRow: i
109
+ };
110
+ }, P = (e, t, n = !1) => {
111
+ let r = F(e, t);
112
+ if (!n || r === "") return {
113
+ text: r,
114
+ header: null
115
+ };
116
+ let i = N(e, t);
117
+ if (i === null || i.columns.length === 0) return {
118
+ text: r,
119
+ header: null
120
+ };
121
+ let a = _(S(e.columnGroupTree, i.columns), i.columns);
122
+ return {
123
+ text: `${a}\n${r}`,
124
+ header: a
125
+ };
126
+ }, F = (e, t) => {
72
127
  let { rowModel: n, visibleColumns: r } = e;
73
- return b(t, _(n), r.length) ? w(e) : g(n.getRow, n.getRowCount(), r, t, C(e), n.getTreeRow ? (e) => n.getTreeRow?.(e)?.aggregates : void 0);
74
- }, fe = (e, t, n) => {
128
+ return k(t, T(n), r.length) ? M(e) : C(n.getRow, n.getRowCount(), r, t, j(e), n.getTreeRow ? (e) => n.getTreeRow?.(e)?.aggregates : void 0, e.localeTexts?.multiSelectSeparator);
129
+ }, pe = (e, t, n) => {
75
130
  let { rowModel: r, visibleColumns: i, readOnly: a, onRowsChange: o, applyServerSideCellEdits: s } = e;
76
131
  if (a || !o && !s) return;
77
- let c = v(t, null, r.getRowCount(), i.length);
132
+ let c = E(t, null, r.getRowCount(), i.length);
78
133
  if (c === null) return;
79
134
  let l = [];
80
135
  for (let e = c.startRow; e <= c.endRow; e += 1) l.push(r.getRow(e) == null ? void 0 : r.getRowKey(e));
@@ -86,24 +141,83 @@ var y = (e) => e.replace(/\r\n?/g, "\n").replace(/\n+$/, ""), b = (e, t, n) => {
86
141
  rowKeys: l,
87
142
  columnKeys: u
88
143
  };
89
- }, E = async (e) => {
90
- if (a === null) return;
91
- let t = a, n = le(t), r = n.selection ?? (n.activeCell ? {
144
+ }, I = (e, t, n, r) => {
145
+ let i = N(e, n);
146
+ if (i === null || i.columns.length === 0 || i.endRow < i.startRow || (i.endRow - i.startRow + 1) * i.columns.length > 2e4) return null;
147
+ let { rowModel: a, visibleColumns: o } = e, s = j(e), c = [];
148
+ for (let e = i.startRow; e <= i.endRow; e += 1) {
149
+ let t = a.getRow(e);
150
+ !t || s && !s(t, e) || c.push({
151
+ row: t,
152
+ viewIndex: e,
153
+ aggregates: a.getTreeRow?.(e)?.aggregates
154
+ });
155
+ }
156
+ if (c.length === 0) return null;
157
+ let l = e.columnGroupTree ?? null, u = e.getConditionalFormatStats?.(), d = t.createClipboardColorResolver(e.getCopyColorHost?.() ?? null);
158
+ try {
159
+ return t.buildClipboardHtml({
160
+ columns: i.columns,
161
+ rows: c,
162
+ header: r ? S(l, i.columns) : null,
163
+ groupAlign: (e) => l?.groups.get(e)?.definition.headerAlign,
164
+ conditionalFormat: u ? {
165
+ stats: u,
166
+ chipContext: (t, n, r) => ({
167
+ row: t.row,
168
+ rowIndex: t.viewIndex,
169
+ sourceRowIndex: a.getSourceIndex(t.viewIndex) ?? t.viewIndex,
170
+ rowKey: a.getRowKey(t.viewIndex) ?? t.viewIndex,
171
+ colIndex: o.indexOf(n),
172
+ value: r,
173
+ column: n,
174
+ isActive: !1,
175
+ isSelected: !0,
176
+ isEditing: !1,
177
+ readOnly: e.readOnly
178
+ })
179
+ } : void 0,
180
+ separator: e.localeTexts?.multiSelectSeparator,
181
+ colors: d
182
+ });
183
+ } finally {
184
+ d.dispose();
185
+ }
186
+ }, L = null, R = async (e) => {
187
+ if (o === null) return;
188
+ let t = o, n = ce(t), r = n.selection ?? (n.activeCell ? {
92
189
  type: "cell",
93
190
  range: {
94
191
  start: n.activeCell,
95
192
  end: n.activeCell
96
193
  }
97
- } : null), i = T(t, r);
98
- if (i && await ne(i) && r) {
99
- let n = e ? fe(t, r, i) : void 0;
194
+ } : null), i = r !== null && r.type === "cell" && r.range.start.row === r.range.end.row && r.range.start.col === r.range.end.col, a = !e && t.copyHeaders === !0 && !i, { text: s, header: c } = P(t, r, a);
195
+ if (!s) return;
196
+ let l = null;
197
+ if (t.richCopy) try {
198
+ l = I(t, t.richCopy, r, a);
199
+ } catch (e) {
200
+ process.env.NODE_ENV !== "production" && console.error("[SpreadsheetGrid] 書式つきのコピー(copyFormat=\"rich\")の表を作れなかったため、文字だけをコピーしました。\n[SpreadsheetGrid] Could not build the rich copy (copyFormat=\"rich\"); copied the text only.", e);
201
+ }
202
+ if ((t.richCopy && l !== null ? await t.richCopy.writeRichToClipboard(s, l) : await w(s)) && r) {
203
+ if (c === null) L = null;
204
+ else {
205
+ let e = D(s);
206
+ L = {
207
+ selection: r,
208
+ header: c,
209
+ length: e.length,
210
+ fingerprint: O(e)
211
+ };
212
+ }
213
+ let n = e ? pe(t, r, s) : void 0;
100
214
  n === void 0 ? t.onCopied?.(r) : t.onCopied?.(r, n);
101
215
  }
102
- }, D = () => E(!1), O = () => E(!0), pe = (e, t) => {
216
+ }, z = () => R(!1), B = () => R(!0), me = (e, t) => {
103
217
  let n = e.getLiveCopiedRange?.() ?? null, r = n?.cut;
104
218
  if (n === null || r === void 0) return null;
105
- let i = y(t);
106
- if (i !== y(r.text)) return null;
219
+ let i = D(t);
220
+ if (i !== D(r.text)) return null;
107
221
  let { rowModel: a, visibleColumns: o } = e;
108
222
  if (r.endRow >= a.getRowCount() || r.endCol >= o.length) return null;
109
223
  for (let e = 0; e < r.rowKeys.length; e += 1) {
@@ -111,168 +225,180 @@ var y = (e) => e.replace(/\r\n?/g, "\n").replace(/\n+$/, ""), b = (e, t, n) => {
111
225
  if ((a.getRow(t) == null ? void 0 : a.getRowKey(t)) !== r.rowKeys[e]) return null;
112
226
  }
113
227
  for (let e = 0; e < r.columnKeys.length; e += 1) if (o[r.startCol + e]?.key !== r.columnKeys[e]) return null;
114
- return y(T(e, n.selection)) === i ? r : null;
115
- }, me = (e, n, i) => {
116
- let { rowModel: a, visibleColumns: s, readOnly: c, canEditCell: u } = e;
117
- for (let e = n.startRow; e <= n.endRow; e += 1) {
118
- let d = a.getRow(e);
119
- if (d != null) for (let f = n.startCol; f <= n.endCol; f += 1) {
120
- let n = s[f];
121
- if (n === void 0 || i(e, f) || !r({
122
- readOnly: c,
228
+ return D(P(e, n.selection).text) === i ? r : null;
229
+ }, he = (e) => {
230
+ let t = L;
231
+ if (t === null) return e;
232
+ let n = D(e);
233
+ if (n.length !== t.length || O(n) !== t.fingerprint) return e;
234
+ let r = e.replace(/\r\n?/g, "\n"), i = `${t.header}\n`;
235
+ return r.startsWith(i) ? r.slice(i.length) : e;
236
+ }, ge = (e, n, o) => {
237
+ let { rowModel: s, visibleColumns: c, readOnly: l, canEditCell: u } = e;
238
+ for (let f = n.startRow; f <= n.endRow; f += 1) {
239
+ let p = s.getRow(f);
240
+ if (p != null) for (let h = n.startCol; h <= n.endCol; h += 1) {
241
+ let n = c[h];
242
+ if (n === void 0 || o(f, h) || !r({
243
+ readOnly: l,
123
244
  canEditCell: u
124
- }, a, e, f, d, n)) continue;
125
- let p = t(d, n);
126
- if (p == null || p === "") continue;
127
- if (typeof p == "object") return !1;
128
- let m = l(n)(o(n, p, d), d);
129
- if (!Object.is(m, p) && (typeof m == "object" || String(m) !== String(p))) return !1;
245
+ }, s, f, h, p, n)) continue;
246
+ let g = t(p, n);
247
+ if (g == null || g === "") continue;
248
+ let _ = i(n, p);
249
+ if (typeof g == "object" && !_) return !1;
250
+ let v = e.localeTexts?.multiSelectSeparator, y = m(n, v)(d(n, g, p, v), p);
251
+ if (_) {
252
+ if (!a(y, g)) return !1;
253
+ continue;
254
+ }
255
+ if (!Object.is(y, g) && (typeof y == "object" || String(y) !== String(g))) return !1;
130
256
  }
131
257
  }
132
258
  return !0;
133
259
  };
134
260
  return {
135
- update: S,
136
- handleCopy: D,
137
- handleCut: O,
261
+ update: A,
262
+ handleCopy: z,
263
+ handleCut: B,
138
264
  handlePaste: (t) => {
139
- if (a === null) return;
140
- let o = a, { rows: l, rowModel: f, columns: p, visibleColumns: m, readOnly: h, canEditCell: g, rowKeyGetter: ne, createRow: _, createOverflowColumn: v, onRowsChange: y, onColumnsChange: b, applyServerSideCellEdits: S, onPasteSkipped: w, localeTexts: T, pasteFillsSelection: fe = !0, dispatch: E } = a, D = le(a);
141
- if (ce(a) || c(t.target ?? null) || h || !y && !S || !D.activeCell) return;
265
+ if (o === null) return;
266
+ let i = o, { rows: a, rowModel: c, columns: l, visibleColumns: u, readOnly: d, canEditCell: m, rowKeyGetter: _, createRow: v, createOverflowColumn: y, onRowsChange: b, onColumnsChange: x, applyServerSideCellEdits: S, onPasteSkipped: C, localeTexts: w, pasteFillsSelection: T = !0, dispatch: E } = o, D = ce(o);
267
+ if (se(o) || p(le(t.target ?? null)) || d || !b && !S || !D.activeCell) return;
142
268
  let O = t.clipboardData?.getData("text/plain") ?? "";
143
269
  if (!O) return;
144
270
  t.preventDefault();
145
- let k = ee(O);
146
- if (k.length === 0) return;
147
- let A = pe(o, O), he = fe && A === null ? ae(k, D.selection, D.activeCell, f, m) : null, j = he !== null && S && de(D.selection, f) ? k : he ?? k, M = w ? [] : null, ge = () => {
148
- let e = M?.filter((e) => !(e.reason === "readOnly" && e.text === ""));
149
- e !== void 0 && e.length > 0 && w?.({ cells: e });
150
- }, _e = j.reduce((e, t) => Math.max(e, t.length), 0);
151
- if (_e === 0) return;
152
- let N = ue(D.selection, D.activeCell), P = {
153
- row: re(f, N.row),
154
- col: te(m, N.col, 1)[0] ?? N.col
155
- }, F = P.row, I = P.col, L = te(m, I, _e), R = L[L.length - 1] ?? I, z = f.getLabelRow !== void 0 || f.getGroupRow !== void 0 ? ie(f, F, j.length) : null, B = (e) => z ? z[e - F] : e, V = z ? z[z.length - 1] : P.row + Math.max(j.length - 1, 0), H = A === null ? null : {
271
+ let k = he(O), A = ee(k);
272
+ if (A.length === 0) return;
273
+ let M = me(i, k), N = T && M === null ? ie(A, D.selection, D.activeCell, c, u) : null, P = N !== null && S && de(D.selection, c) ? A : N ?? A, F = C ? [] : null, pe = () => {
274
+ let e = F?.filter((e) => !(e.reason === "readOnly" && e.text === ""));
275
+ e !== void 0 && e.length > 0 && C?.({ cells: e });
276
+ }, I = P.reduce((e, t) => Math.max(e, t.length), 0);
277
+ if (I === 0) return;
278
+ let L = ue(D.selection, D.activeCell), R = {
279
+ row: ne(c, L.row),
280
+ col: te(u, L.col, 1)[0] ?? L.col
281
+ }, z = R.row, B = R.col, V = te(u, B, I), H = V[V.length - 1] ?? B, U = c.getLabelRow !== void 0 || c.getGroupRow !== void 0 ? re(c, z, P.length) : null, W = (e) => U ? U[e - z] : e, G = U ? U[U.length - 1] : R.row + Math.max(P.length - 1, 0), K = M === null ? null : {
156
282
  type: "cell",
157
283
  range: {
158
284
  start: {
159
- row: A.startRow,
160
- col: A.startCol
285
+ row: M.startRow,
286
+ col: M.startCol
161
287
  },
162
288
  end: {
163
- row: A.endRow,
164
- col: A.endCol
289
+ row: M.endRow,
290
+ col: M.endCol
165
291
  }
166
292
  }
167
- }, U;
168
- if (A !== null) {
293
+ }, q;
294
+ if (M !== null) {
169
295
  let e = /* @__PURE__ */ new Set();
170
- for (let t = 0; t < j.length; t += 1) e.add(B(F + t));
171
- let t = new Set(L), n = C(o);
172
- U = (r, a) => {
173
- if (e.has(r) && t.has(a)) return !0;
174
- let o = m[a];
175
- if (o === void 0 || i(o.key)) return !0;
176
- let s = f.getRow(r);
177
- if (s == null || f.getLabelRow?.(r) !== void 0 || f.getGroupRow?.(r) !== void 0) return !0;
178
- let c = f.getTreeRow?.(r)?.aggregates;
179
- return c !== void 0 && o.key in c ? !0 : n !== void 0 && !n(s, r);
296
+ for (let t = 0; t < P.length; t += 1) e.add(W(z + t));
297
+ let t = new Set(V), n = j(i);
298
+ q = (r, i) => {
299
+ if (e.has(r) && t.has(i)) return !0;
300
+ let a = u[i];
301
+ if (a === void 0 || s(a.key)) return !0;
302
+ let o = c.getRow(r);
303
+ if (o == null || c.getLabelRow?.(r) !== void 0 || c.getGroupRow?.(r) !== void 0) return !0;
304
+ let l = c.getTreeRow?.(r)?.aggregates;
305
+ return l !== void 0 && a.key in l ? !0 : n !== void 0 && !n(o, r);
180
306
  };
181
307
  }
182
- let W = A !== null && U !== void 0 && !me(o, A, U), ve = (e) => {
183
- A !== null && e !== "" && (W = !0);
184
- }, ye = (e, t) => j.some((n, r) => n.some((n, i) => n !== "" && (e(r) || (L[i] ?? t) >= t)));
308
+ let J = M !== null && q !== void 0 && !ge(i, M, q), _e = (e) => {
309
+ M !== null && e !== "" && (J = !0);
310
+ }, ve = (e, t) => P.some((n, r) => n.some((n, i) => n !== "" && (e(r) || (V[i] ?? t) >= t)));
185
311
  if (S) {
186
- let t = d((e) => f.getRow(B(e)), m, j, F, I, (e, t, n, i) => r({
187
- readOnly: h,
188
- canEditCell: g
189
- }, f, B(e), t, n, i), M !== null || A !== null ? (e) => {
190
- if (ve(e.text), M === null) return;
191
- let t = B(e.rowIndex);
192
- M.push(x(e, t, f.getRowKey(t) ?? t));
193
- } : void 0, T).map((e) => ({
312
+ let t = g((e) => c.getRow(W(e)), u, P, z, B, (e, t, n, i) => r({
313
+ readOnly: d,
314
+ canEditCell: m
315
+ }, c, W(e), t, n, i), F !== null || M !== null ? (e) => {
316
+ if (_e(e.text), F === null) return;
317
+ let t = W(e.rowIndex);
318
+ F.push(fe(e, t, c.getRowKey(t) ?? t));
319
+ } : void 0, w).map((e) => ({
194
320
  ...e,
195
- viewIndex: B(e.viewIndex)
321
+ viewIndex: W(e.viewIndex)
196
322
  }));
197
- A !== null && ye((e) => {
198
- let t = B(F + e);
199
- return t >= f.getRowCount() || f.getRow(t) == null;
200
- }, m.length) && (W = !0);
201
- let n = H === null || W ? [] : oe({
202
- getRow: (e) => f.getRow(e),
203
- columns: m,
204
- selection: H,
323
+ M !== null && ve((e) => {
324
+ let t = W(z + e);
325
+ return t >= c.getRowCount() || c.getRow(t) == null;
326
+ }, u.length) && (J = !0);
327
+ let n = K === null || J ? [] : ae({
328
+ getRow: (e) => c.getRow(e),
329
+ columns: u,
330
+ selection: K,
205
331
  activeCell: null,
206
- viewRowCount: f.getRowCount(),
332
+ viewRowCount: c.getRowCount(),
207
333
  canWriteCell: (e, t, n, i) => r({
208
- readOnly: h,
209
- canEditCell: g
210
- }, f, e, t, n, i),
211
- skipCell: U
334
+ readOnly: d,
335
+ canEditCell: m
336
+ }, c, e, t, n, i),
337
+ skipCell: q
212
338
  });
213
339
  (t.length > 0 || n.length > 0) && S([...n, ...t]);
214
- let i = s(V, 0, Math.max(f.getRowCount() - 1, 0)), a = s(R, 0, Math.max(m.length - 1, 0));
215
- E(e.startSelection(P)), E(e.updateSelection({
216
- row: i,
217
- col: a
218
- })), E(e.endSelection()), E(e.activateCell(P)), A !== null && o.onCutPasted?.(), ge();
340
+ let a = f(G, 0, Math.max(c.getRowCount() - 1, 0)), o = f(H, 0, Math.max(u.length - 1, 0));
341
+ E(e.startSelection(R)), E(e.updateSelection({
342
+ row: a,
343
+ col: o
344
+ })), E(e.endSelection()), E(e.activateCell(R)), M !== null && i.onCutPasted?.(), pe();
219
345
  return;
220
346
  }
221
- if (!y) return;
222
- let G = f.newRow, be = G !== void 0 && F >= G.index;
223
- if (f.getSourceIndex(F) === void 0 && !be) return;
224
- let xe = P.col, K = [...l], q = [...m], J = G === void 0 ? f.getRowCount() : G.index, Se = K.length, Y = (e) => {
225
- let t = B(e);
226
- return t < J ? f.getSourceIndex(t) : Se + (t - J);
227
- }, Ce = Math.max(V + 1 - J, 0), we = K.length + Ce, X = be && Ce > 0 ? G?.peekRow() : void 0;
228
- if (we > K.length && _) for (X !== void 0 && K.push(X); K.length < we;) K.push(_());
229
- let Te = R + 1, Z = [];
230
- if (Te > q.length && b && v) for (; q.length < Te;) {
231
- let e = v(q.length);
232
- q.push(e), Z.push(e);
347
+ if (!b) return;
348
+ let Y = c.newRow, ye = Y !== void 0 && z >= Y.index;
349
+ if (c.getSourceIndex(z) === void 0 && !ye) return;
350
+ let be = R.col, X = [...a], Z = [...u], Q = Y === void 0 ? c.getRowCount() : Y.index, xe = X.length, Se = (e) => {
351
+ let t = W(e);
352
+ return t < Q ? c.getSourceIndex(t) : xe + (t - Q);
353
+ }, Ce = Math.max(G + 1 - Q, 0), we = X.length + Ce, Te = ye && Ce > 0 ? Y?.peekRow() : void 0;
354
+ if (we > X.length && v) for (Te !== void 0 && X.push(Te); X.length < we;) X.push(v());
355
+ let Ee = H + 1, De = [];
356
+ if (Ee > Z.length && x && y) for (; Z.length < Ee;) {
357
+ let e = y(Z.length);
358
+ Z.push(e), De.push(e);
233
359
  }
234
- let Ee = (e, t, n) => (e < J ? f.getRowKey(e) : ne?.(t, n) ?? n) ?? n, De = u(K, Y, q, j, F, xe, (e, t, r, i, a) => {
235
- let o = B(a);
360
+ let Oe = (e, t, n) => (e < Q ? c.getRowKey(e) : _?.(t, n) ?? n) ?? n, ke = h(X, Se, Z, P, z, be, (e, t, r, i, a) => {
361
+ let o = W(a);
236
362
  return n({
237
- readOnly: h,
238
- canEditCell: g
363
+ readOnly: d,
364
+ canEditCell: m
239
365
  }, o, t, r, i, {
240
366
  sourceRowIndex: e,
241
- rowKey: Ee(o, r, e)
367
+ rowKey: Oe(o, r, e)
242
368
  });
243
- }, M !== null || A !== null ? (e) => {
244
- if (ve(e.text), M === null) return;
245
- let t = B(e.rowIndex), n = e.sourceRowIndex ?? t;
246
- M.push(x(e, t, Ee(t, e.row, n)));
247
- } : void 0, T), Q = De !== K;
248
- A !== null && ye((e) => {
249
- let t = Y(F + e);
250
- return t === void 0 || t >= K.length;
251
- }, q.length) && (W = !0);
252
- let Oe = Q ? De : l, $ = H === null || W ? Oe : se({
253
- rows: Oe,
254
- resolveSourceIndex: (e) => f.getSourceIndex(e),
255
- columns: m,
256
- selection: H,
369
+ }, F !== null || M !== null ? (e) => {
370
+ if (_e(e.text), F === null) return;
371
+ let t = W(e.rowIndex), n = e.sourceRowIndex ?? t;
372
+ F.push(fe(e, t, Oe(t, e.row, n)));
373
+ } : void 0, w), $ = ke !== X;
374
+ M !== null && ve((e) => {
375
+ let t = Se(z + e);
376
+ return t === void 0 || t >= X.length;
377
+ }, Z.length) && (J = !0);
378
+ let Ae = $ ? ke : a, je = K === null || J ? Ae : oe({
379
+ rows: Ae,
380
+ resolveSourceIndex: (e) => c.getSourceIndex(e),
381
+ columns: u,
382
+ selection: K,
257
383
  activeCell: null,
258
- viewRowCount: f.getRowCount(),
384
+ viewRowCount: c.getRowCount(),
259
385
  canWriteCell: (e, t, n, i, a) => r({
260
- readOnly: h,
261
- canEditCell: g
262
- }, f, a, t, n, i),
263
- skipCell: U
386
+ readOnly: d,
387
+ canEditCell: m
388
+ }, c, a, t, n, i),
389
+ skipCell: q
264
390
  }).nextRows;
265
- if (!Q && M !== null) {
266
- let e = M.filter((e) => e.rowIndex < J && e.colIndex < m.length);
267
- M.length = 0, M.push(...e);
391
+ if (!$ && F !== null) {
392
+ let e = F.filter((e) => e.rowIndex < Q && e.colIndex < u.length);
393
+ F.length = 0, F.push(...e);
268
394
  }
269
- let ke = s(V, 0, Math.max(Q && K.length > l.length ? V : J - 1, 0)), Ae = s(R, 0, Math.max((Q ? q : m).length - 1, 0));
270
- Q ? (G !== void 0 && K.length > l.length && (X !== void 0 && G.takeRow(), G.noteAppended(K.length - l.length)), Z.length > 0 && b?.(p ? [...p, ...Z] : q), y($)) : $ !== l && y($), E(e.startSelection(P)), E(e.updateSelection({
271
- row: ke,
272
- col: Ae
273
- })), E(e.endSelection()), E(e.activateCell(P)), A !== null && o.onCutPasted?.(), ge();
395
+ let Me = f(G, 0, Math.max($ && X.length > a.length ? G : Q - 1, 0)), Ne = f(H, 0, Math.max(($ ? Z : u).length - 1, 0));
396
+ $ ? (Y !== void 0 && X.length > a.length && (Te !== void 0 && Y.takeRow(), Y.noteAppended(X.length - a.length)), De.length > 0 && x?.(l ? [...l, ...De] : Z), b(je)) : je !== a && b(je), E(e.startSelection(R)), E(e.updateSelection({
397
+ row: Me,
398
+ col: Ne
399
+ })), E(e.endSelection()), E(e.activateCell(R)), M !== null && i.onCutPasted?.(), pe();
274
400
  }
275
401
  };
276
402
  };
277
403
  //#endregion
278
- export { b as computeIsWholeGridSelected, S as createClipboardController, ue as resolvePasteAnchor };
404
+ export { k as computeIsWholeGridSelected, A as createClipboardController, ue as resolvePasteAnchor };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/dateTimeValues.cjs"),t=require("../logic/valueStore.cjs"),n=require("../logic/filtering.cjs"),r=require("../logic/editorKeys.cjs"),i=require("../logic/dateTimeEditor.cjs");var a=a=>{let{kind:o}=a,s=a.now??(()=>new Date),c=i.resolveTimeStep(a.step),l=i.resolveDefaultTime(a.defaultTime),u=o===`time`?i.buildTimeList(c):[],d=o===`time`&&a.list===!0,f={onCommit:a.onCommit,onCancel:a.onCancel,onCommitToSelection:a.onCommitToSelection,invalidMessage:a.invalidMessage,invalidTimeMessage:a.invalidTimeMessage},p=a.initialText!==void 0,m=o===`datetime`?e.toDateTimeValue(a.value,l):``,h=m===``?null:m.slice(0,10),g=m===``?null:m.slice(11),_=e=>i.readTypedDateTimeValue(o,e,{defaultTime:l,today:s(),currentDate:h}),v=e=>e===null||e===``?{date:null,time:null}:o===`date`?{date:e,time:null}:o===`time`?{date:null,time:e}:{date:e.slice(0,10),time:e.slice(11)},y=e=>({listAnchor:o===`time`?i.resolveTimeListAnchor(e??i.floorTimeToStep(s(),c),c):-1,listHighlight:o===`time`?i.findTimeListIndex(e,c):-1}),b=a.initialText??i.formatDateTimeEditorStartText(o,a.value,l),x=v(_(b)),S=x.date??h??n.formatDateKey(s()),C=t.createValueStore({text:b,notice:null,calendarYear:Number(S.slice(0,4)),calendarMonth:Number(S.slice(5,7))-1,calendarView:`days`,selectedDate:x.date,selectedTime:x.time,timeText:x.time??g??``,...y(x.time),timeSelection:0}),w=e=>{C.setSnapshot({...C.getSnapshot(),...e})},T=(e,t={})=>{let n=v(_(e)),r={text:e,notice:null,selectedDate:n.date,selectedTime:n.time,...y(n.time)};n.date!==null&&t.followCalendar!==!1&&(r.calendarYear=Number(n.date.slice(0,4)),r.calendarMonth=Number(n.date.slice(5,7))-1,r.calendarView=`days`),o===`datetime`&&n.time!==null&&t.keepTimeText!==!0&&(r.timeText=n.time),w(r)},E=e=>{p=!0,T(i.formatDateTimeEditorText(o,e))},D=()=>{let{text:e,timeText:t}=C.getSnapshot();return o===`datetime`&&i.readTypedTime(t)===null?null:_(e)},O=e=>(e&&e.status===`rejected`&&w({notice:e.message}),e),k=(e,t=!1)=>{if(!p){O(t&&f.onCommitToSelection?f.onCommitToSelection(a.value):f.onCommit(a.value,e));return}let n=D();if(n===null){let e=o===`datetime`&&i.readTypedTime(C.getSnapshot().timeText)===null;w({notice:(e?f.invalidTimeMessage:void 0)??f.invalidMessage});return}O(t&&f.onCommitToSelection?f.onCommitToSelection(n):f.onCommit(n,e))},A=()=>n.formatDateKey(s()),j=(e,t)=>{let{selectedDate:n,selectedTime:r}=C.getSnapshot();if(o===`date`){E(n===null?A():i.shiftDateKey(n,e));return}if(o===`time`){E(r===null?i.floorTimeToStep(s(),c):i.shiftTimeValue(r,e,c));return}if(t===`date`){let t=n===null?A():i.shiftDateKey(n,e);E(`${t}T${r??g??l}`);return}let a=n??h??A();if(r===null){E(`${a}T${i.floorTimeToStep(s(),c)}`);return}let u=i.shiftTimeStep(r,e,c);E(`${u.dayShift===0?a:i.shiftDateKey(a,u.dayShift)}T${u.time}`)},M=(e,t,n)=>{let{key:i}=e;return f.onCommitToSelection!==void 0&&r.isCommitToSelectionKey(e)?(e.preventDefault(),k(void 0,!0),!0):i===`Enter`?(e.preventDefault(),k(r.resolveEnterDirection(t)),!0):i===`Tab`?(e.preventDefault(),k(e.shiftKey?`left`:`right`),!0):i===`Escape`?(e.preventDefault(),f.onCancel(),!0):(i===`ArrowUp`||i===`ArrowDown`)&&!e.altKey&&!e.ctrlKey&&!e.metaKey?(e.preventDefault(),j(i===(d?`ArrowDown`:`ArrowUp`)?1:-1,n),!0):r.isEditorScrollKey(i,!1)?(e.preventDefault(),!0):!1},N=e=>{if(o===`date`){p=!0,O(f.onCommit(e));return}let{selectedTime:t,timeText:n}=C.getSnapshot(),r=i.readTypedTime(n);E(`${e}T${t??(r||null)??g??l}`),w({timeSelection:C.getSnapshot().timeSelection+1})};return{getSnapshot:C.getSnapshot,subscribe:C.subscribe,timeList:u,step:c,input:(e,t)=>{if(p=!0,t){w({text:e,notice:null});return}T(e)},keyDown:(e,t)=>M(e,t,`date`),inputTime:(e,t)=>{if(p=!0,w({timeText:e,notice:null}),t)return;let n=i.readTypedTime(e);if(n){let{selectedDate:e}=C.getSnapshot();T(i.formatDateTimeEditorText(o,`${e??h??A()}T${n}`),{keepTimeText:!0})}},keyDownTime:(e,t)=>M(e,t,`time`),chooseDay:N,chooseToday:()=>N(A()),clear:()=>{p=!0,O(f.onCommit(``))},navigate:e=>{let{calendarYear:t,calendarMonth:n,calendarView:r}=C.getSnapshot();if(r===`days`){let r=new Date(t,n+e,1);w({calendarYear:r.getFullYear(),calendarMonth:r.getMonth()});return}w({calendarYear:t+e*(r===`months`?1:12)})},drillUp:()=>{let{calendarView:e}=C.getSnapshot();w({calendarView:e===`days`?`months`:`years`})},drillDown:()=>{let{calendarView:e}=C.getSnapshot();w({calendarView:e===`years`?`months`:`days`})},chooseMonth:e=>{w({calendarMonth:e,calendarView:`days`})},chooseYear:e=>{w({calendarYear:e,calendarView:`months`})},chooseTime:e=>{let t=u[e];t!==void 0&&(p=!0,O(f.onCommit(t)))},blur:()=>{if(!p){f.onCancel();return}let e=D();if(e===null){f.onCancel();return}let t=f.onCommit(e);t&&t.status===`rejected`&&f.onCancel()},flush:()=>{if(!p)return;let e=D();e!==null&&f.onCommit(e)},setHandlers:e=>{f=e}}};exports.createDateTimeEditorController=a;
@@ -0,0 +1,62 @@
1
+ import type { EditorCommitDirection, EditorCommitResult, EditorEnterMove } from '../model/gridTypes.unbound.js';
2
+ import { type DateTimeEditorKind } from '../logic/dateTimeEditor.js';
3
+ export type DateTimeCalendarView = 'days' | 'months' | 'years';
4
+ export type DateTimeEditorSnapshot = {
5
+ text: string;
6
+ notice: string | null;
7
+ calendarYear: number;
8
+ calendarMonth: number;
9
+ calendarView: DateTimeCalendarView;
10
+ selectedDate: string | null;
11
+ selectedTime: string | null;
12
+ timeText: string;
13
+ listAnchor: number;
14
+ listHighlight: number;
15
+ timeSelection: number;
16
+ };
17
+ export type DateTimeEditorInit = {
18
+ kind: DateTimeEditorKind;
19
+ value: unknown;
20
+ initialText?: string | undefined;
21
+ defaultTime?: string | undefined;
22
+ step?: number | undefined;
23
+ list?: boolean | undefined;
24
+ invalidMessage: string;
25
+ invalidTimeMessage?: string | undefined;
26
+ onCommit: (value: unknown, direction?: EditorCommitDirection) => EditorCommitResult | void;
27
+ onCancel: () => void;
28
+ onCommitToSelection?: ((value: unknown) => EditorCommitResult | void) | undefined;
29
+ now?: (() => Date) | undefined;
30
+ };
31
+ export type DateTimeEditorHandlers = Pick<DateTimeEditorInit, 'onCommit' | 'onCancel' | 'onCommitToSelection' | 'invalidMessage' | 'invalidTimeMessage'>;
32
+ export type DateTimeEditorKeyEventLike = {
33
+ key: string;
34
+ altKey: boolean;
35
+ ctrlKey: boolean;
36
+ metaKey: boolean;
37
+ shiftKey: boolean;
38
+ preventDefault: () => void;
39
+ };
40
+ export type DateTimeEditorController = {
41
+ getSnapshot: () => DateTimeEditorSnapshot;
42
+ subscribe: (listener: () => void) => () => void;
43
+ timeList: readonly string[];
44
+ step: number;
45
+ input: (text: string, composing: boolean) => void;
46
+ keyDown: (event: DateTimeEditorKeyEventLike, enterMove: EditorEnterMove | undefined) => boolean;
47
+ inputTime: (text: string, composing: boolean) => void;
48
+ keyDownTime: (event: DateTimeEditorKeyEventLike, enterMove: EditorEnterMove | undefined) => boolean;
49
+ chooseDay: (key: string) => void;
50
+ chooseToday: () => void;
51
+ clear: () => void;
52
+ navigate: (direction: 1 | -1) => void;
53
+ drillUp: () => void;
54
+ drillDown: () => void;
55
+ chooseMonth: (month: number) => void;
56
+ chooseYear: (year: number) => void;
57
+ chooseTime: (index: number) => void;
58
+ blur: () => void;
59
+ flush: () => void;
60
+ setHandlers: (handlers: DateTimeEditorHandlers) => void;
61
+ };
62
+ export declare const createDateTimeEditorController: (init: DateTimeEditorInit) => DateTimeEditorController;