@docmentis/udoc-editor 0.8.18 → 0.8.19

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 (78) hide show
  1. package/dist/cell-format.d.ts +30 -0
  2. package/dist/cell-format.d.ts.map +1 -0
  3. package/dist/cell-format.js +325 -0
  4. package/dist/cell-format.js.map +1 -0
  5. package/dist/context-menu.d.ts +11 -1
  6. package/dist/context-menu.d.ts.map +1 -1
  7. package/dist/context-menu.js +78 -8
  8. package/dist/context-menu.js.map +1 -1
  9. package/dist/edit-mode.d.ts.map +1 -1
  10. package/dist/edit-mode.js +12 -4
  11. package/dist/edit-mode.js.map +1 -1
  12. package/dist/i18n/ar.d.ts.map +1 -1
  13. package/dist/i18n/ar.js +24 -0
  14. package/dist/i18n/ar.js.map +1 -1
  15. package/dist/i18n/de.d.ts.map +1 -1
  16. package/dist/i18n/de.js +24 -0
  17. package/dist/i18n/de.js.map +1 -1
  18. package/dist/i18n/en.d.ts.map +1 -1
  19. package/dist/i18n/en.js +24 -0
  20. package/dist/i18n/en.js.map +1 -1
  21. package/dist/i18n/es.d.ts.map +1 -1
  22. package/dist/i18n/es.js +24 -0
  23. package/dist/i18n/es.js.map +1 -1
  24. package/dist/i18n/fr.d.ts.map +1 -1
  25. package/dist/i18n/fr.js +24 -0
  26. package/dist/i18n/fr.js.map +1 -1
  27. package/dist/i18n/ja.d.ts.map +1 -1
  28. package/dist/i18n/ja.js +24 -0
  29. package/dist/i18n/ja.js.map +1 -1
  30. package/dist/i18n/ko.d.ts.map +1 -1
  31. package/dist/i18n/ko.js +24 -0
  32. package/dist/i18n/ko.js.map +1 -1
  33. package/dist/i18n/messages.d.ts +46 -0
  34. package/dist/i18n/messages.d.ts.map +1 -1
  35. package/dist/i18n/pt-BR.d.ts.map +1 -1
  36. package/dist/i18n/pt-BR.js +24 -0
  37. package/dist/i18n/pt-BR.js.map +1 -1
  38. package/dist/i18n/ru.d.ts.map +1 -1
  39. package/dist/i18n/ru.js +24 -0
  40. package/dist/i18n/ru.js.map +1 -1
  41. package/dist/i18n/zh-CN.d.ts.map +1 -1
  42. package/dist/i18n/zh-CN.js +24 -0
  43. package/dist/i18n/zh-CN.js.map +1 -1
  44. package/dist/i18n/zh-TW.d.ts.map +1 -1
  45. package/dist/i18n/zh-TW.js +24 -0
  46. package/dist/i18n/zh-TW.js.map +1 -1
  47. package/dist/icons.d.ts +12 -0
  48. package/dist/icons.d.ts.map +1 -1
  49. package/dist/icons.js +12 -0
  50. package/dist/icons.js.map +1 -1
  51. package/dist/menu-action.d.ts +3 -0
  52. package/dist/menu-action.d.ts.map +1 -1
  53. package/dist/menu-action.js +8 -0
  54. package/dist/menu-action.js.map +1 -1
  55. package/dist/paint.d.ts +5 -1
  56. package/dist/paint.d.ts.map +1 -1
  57. package/dist/paint.js +9 -0
  58. package/dist/paint.js.map +1 -1
  59. package/dist/table-format.d.ts +19 -9
  60. package/dist/table-format.d.ts.map +1 -1
  61. package/dist/table-format.js +24 -22
  62. package/dist/table-format.js.map +1 -1
  63. package/dist/table.d.ts +2 -0
  64. package/dist/table.d.ts.map +1 -1
  65. package/dist/table.js +8 -4
  66. package/dist/table.js.map +1 -1
  67. package/dist/tabs.d.ts +1 -1
  68. package/dist/tabs.d.ts.map +1 -1
  69. package/dist/tabs.js +42 -3
  70. package/dist/tabs.js.map +1 -1
  71. package/dist/text-format.d.ts +7 -3
  72. package/dist/text-format.d.ts.map +1 -1
  73. package/dist/text-format.js +46 -8
  74. package/dist/text-format.js.map +1 -1
  75. package/dist/version.d.ts +1 -1
  76. package/dist/version.js +1 -1
  77. package/dist/worker/worker-source.js +1 -1
  78. package/package.json +3 -3
@@ -0,0 +1,30 @@
1
+ import type { GridBorderProperties, GridBorderStyle } from "@docmentis/udoc-wasm";
2
+ import type { CommandDef, MenuItem } from "@docmentis/udoc-ui/internal";
3
+ import type { MessageKey } from "./i18n/index.js";
4
+ import type { BorderPen } from "./table-format.js";
5
+ import type { EditTools } from "./tools.js";
6
+ type Def = CommandDef<MessageKey>;
7
+ /** The line style of Excel's nearest `pen`: thin, medium or thick by its
8
+ * weight — Excel's 1, 2 and 3 pixels — and dashed, dotted or dash-dotted as
9
+ * it is, in the weights Excel has them in. */
10
+ export declare function cellBorderStyle(pen: BorderPen): GridBorderStyle;
11
+ /** The cell border line `pen` draws. */
12
+ export declare function cellBorderLine(pen: BorderPen): GridBorderProperties;
13
+ /** The Alignment dropdown: where the cells' text sits, top to bottom, then
14
+ * across — Excel's six alignment buttons. */
15
+ export declare const CELL_ALIGN_MENU: readonly MenuItem<MessageKey>[];
16
+ /** The Merge & Center menu, Excel's. A merge keeps only its top-left cell's
17
+ * contents, emptying the rest. */
18
+ export declare const CELL_MERGE_MENU: readonly MenuItem<MessageKey>[];
19
+ /** The Number Format dropdown: the formats as one exclusive set, the active
20
+ * cell's marked. */
21
+ export declare const CELL_NUMBER_FORMAT_MENU: readonly MenuItem<MessageKey>[];
22
+ /**
23
+ * The Cell tab's commands, over the {@link EditTools} once edit mode is
24
+ * mounted: Fill Color, then Border Color and Border, which share a pen of
25
+ * their own; the Alignment dropdown, Wrap Text and Merge & Center; the Number Format
26
+ * dropdown and the decimal steps; and Clear Formats.
27
+ */
28
+ export declare function cellCommands(tools: () => EditTools): Readonly<Record<string, Def>>;
29
+ export {};
30
+ //# sourceMappingURL=cell-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell-format.d.ts","sourceRoot":"","sources":["../src/cell-format.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,oBAAoB,EACpB,eAAe,EAIlB,MAAM,sBAAsB,CAAC;AAe9B,OAAO,KAAK,EAER,UAAU,EAGV,QAAQ,EAQX,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAkBlD,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,KAAK,GAAG,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAuElC;;+CAE+C;AAC/C,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,GAAG,eAAe,CAY/D;AAED,wCAAwC;AACxC,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,oBAAoB,CAGnE;AA8BD;8CAC8C;AAC9C,eAAO,MAAM,eAAe,EAAE,SAAS,QAAQ,CAAC,UAAU,CAAC,EAO1D,CAAC;AAQF;mCACmC;AACnC,eAAO,MAAM,eAAe,EAAE,SAAS,QAAQ,CAAC,UAAU,CAAC,EAuB1D,CAAC;AA0DF;qBACqB;AACrB,eAAO,MAAM,uBAAuB,EAAE,SAAS,QAAQ,CAAC,UAAU,CAAC,EAKhE,CAAC;AASJ;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CA2GlF"}
@@ -0,0 +1,325 @@
1
+ import { allowsEdit, applyPaintBar, buildMenuInto, buildPaintPanel, commandContext, createDropdownButton, createSplitButton, displayToActivePaint, ICON_FILL, paintSwatch, sheetCellFormat, sheetCellMerged, } from "@docmentis/udoc-ui/internal";
2
+ import { ICON_BORDER_ALL, ICON_BORDER_COLOR, ICON_CLEAR_FORMAT, ICON_DECIMAL_DECREASE, ICON_DECIMAL_INCREASE, ICON_MERGE_CELLS, ICON_NUMBER_FORMAT, ICON_PARAGRAPH_CENTER, ICON_PARAGRAPH_LEFT, ICON_PARAGRAPH_RIGHT, ICON_WRAP_TEXT, } from "./icons.js";
3
+ import { paintToGridColor } from "./paint.js";
4
+ import { editState, editStateOf } from "./state.js";
5
+ import { ICON_CELL_ALIGN_BOTTOM, ICON_CELL_ALIGN_CENTER, ICON_CELL_ALIGN_TOP, ICON_UNMERGE_CELLS } from "./table.js";
6
+ import { borderColorControl, borderControl, createBorderState, themeOf } from "./table-format.js";
7
+ /** The format of the workbook's active cell in `state`, or `null` outside a
8
+ * worksheet's grid. */
9
+ function cellFormatIn(state) {
10
+ return sheetCellFormat(editState(state).selectionProperties);
11
+ }
12
+ /** {@link cellFormatIn} for a command's context. */
13
+ function cellFormatOf(c) {
14
+ return sheetCellFormat(editStateOf(c).selectionProperties);
15
+ }
16
+ /** Live where the selection takes a cell edit of `kind`. */
17
+ const whenCellEdit = (kind) => (c) => allowsEdit(c.selection, kind);
18
+ /** Run `edit` on the selected cells — one committing edit. */
19
+ function runCellEdit(host, edit) {
20
+ return host.commit(() => host.client.executeOnSelection(edit));
21
+ }
22
+ /** A menu row's intent: `edit` on the selection, which the shell runs — a
23
+ * merge Excel refuses showing its reason under the formula bar. */
24
+ function cellEditAction(edit) {
25
+ return { kind: "selectionEdit", edit };
26
+ }
27
+ /**
28
+ * The Fill Color dropdown: the selected cells' fill. The swatch is the active
29
+ * cell's fill, and the caret opens the color panel, whose No Fill row takes the
30
+ * fill away.
31
+ */
32
+ function cellFillControl(env, tools) {
33
+ const { i18n } = tools;
34
+ const fill = () => editState(env.store.getState()).selectionPaint.fill;
35
+ const dd = createDropdownButton({ icon: paintSwatch(ICON_FILL, fill()), label: env.label }, {
36
+ menuLabel: i18n.t("ribbon.paintOptions", { label: env.label }),
37
+ onOpen: () => buildPaintPanel(dd.menu, {
38
+ i18n,
39
+ variant: "fill",
40
+ theme: themeOf(env),
41
+ recent: env.recentPaint.fill,
42
+ active: displayToActivePaint(fill()),
43
+ stroke: null,
44
+ onPick: (paint) => {
45
+ if (paint.kind !== "none")
46
+ env.pushRecent("fill", paint.hex);
47
+ dd.controller.close();
48
+ const color = paintToGridColor(paint);
49
+ void runCellEdit(tools.host, {
50
+ kind: "setCellFill",
51
+ fill: color ? { pattern: { pattern: "solid", foreground: color } } : null,
52
+ });
53
+ },
54
+ }),
55
+ });
56
+ dd.trigger.dataset.command = "cellFill";
57
+ return {
58
+ el: dd.el,
59
+ sync: (state) => applyPaintBar(dd.trigger, editState(state).selectionPaint.fill),
60
+ close: () => dd.controller.close(),
61
+ destroy: () => dd.destroy(),
62
+ };
63
+ }
64
+ /** The line style of Excel's nearest `pen`: thin, medium or thick by its
65
+ * weight — Excel's 1, 2 and 3 pixels — and dashed, dotted or dash-dotted as
66
+ * it is, in the weights Excel has them in. */
67
+ export function cellBorderStyle(pen) {
68
+ const medium = pen.weight >= 1.125;
69
+ switch (pen.dash) {
70
+ case "solid":
71
+ return pen.weight >= 1.875 ? "thick" : medium ? "medium" : "thin";
72
+ case "dash":
73
+ return medium ? "mediumDashed" : "dashed";
74
+ case "dot":
75
+ return "dotted";
76
+ case "dashDot":
77
+ return medium ? "mediumDashDot" : "dashDot";
78
+ }
79
+ }
80
+ /** The cell border line `pen` draws. */
81
+ export function cellBorderLine(pen) {
82
+ const color = paintToGridColor(pen.paint);
83
+ return color ? { style: cellBorderStyle(pen), color } : { style: cellBorderStyle(pen) };
84
+ }
85
+ /** A workbook's {@link LayBorder}: the selected cells' borders. */
86
+ function layCellBorder(host) {
87
+ return (edges, pen) => void runCellEdit(host, { kind: "patchSheetCellBorders", edges, line: pen ? cellBorderLine(pen) : null });
88
+ }
89
+ /** A vertical alignment row, marked where the active cell's text sits so. */
90
+ function verticalRow(vertical, label, icon) {
91
+ return {
92
+ action: cellEditAction({ kind: "patchCellAlignment", alignment: { vertical } }),
93
+ label,
94
+ icon,
95
+ enabledWhen: whenCellEdit("patchCellAlignment"),
96
+ activeWhen: (c) => cellFormatOf(c)?.vertical === vertical,
97
+ };
98
+ }
99
+ /** A horizontal alignment row, marked where the active cell's text sits so. */
100
+ function horizontalRow(horizontal, label, icon) {
101
+ return {
102
+ action: cellEditAction({ kind: "patchCellAlignment", alignment: { horizontal } }),
103
+ label,
104
+ icon,
105
+ enabledWhen: whenCellEdit("patchCellAlignment"),
106
+ activeWhen: (c) => cellFormatOf(c)?.horizontal === horizontal,
107
+ };
108
+ }
109
+ /** The Alignment dropdown: where the cells' text sits, top to bottom, then
110
+ * across — Excel's six alignment buttons. */
111
+ export const CELL_ALIGN_MENU = [
112
+ verticalRow("top", "cell.alignTop", ICON_CELL_ALIGN_TOP),
113
+ verticalRow("center", "cell.alignMiddle", ICON_CELL_ALIGN_CENTER),
114
+ verticalRow("bottom", "cell.alignBottom", ICON_CELL_ALIGN_BOTTOM),
115
+ { ...horizontalRow("left", "paragraph.alignLeft", ICON_PARAGRAPH_LEFT), separatorBefore: true },
116
+ horizontalRow("center", "paragraph.center", ICON_PARAGRAPH_CENTER),
117
+ horizontalRow("right", "paragraph.alignRight", ICON_PARAGRAPH_RIGHT),
118
+ ];
119
+ /** Live where the selection takes a merge: a block of cells. */
120
+ const whenMerge = (c) => allowsEdit(c.selection, "mergeSheetCells");
121
+ /** Merge & Center: the selected block made one cell, its contents centered. */
122
+ const MERGE_AND_CENTER = { kind: "mergeSheetCells", across: false, center: true };
123
+ /** The Merge & Center menu, Excel's. A merge keeps only its top-left cell's
124
+ * contents, emptying the rest. */
125
+ export const CELL_MERGE_MENU = [
126
+ {
127
+ action: cellEditAction(MERGE_AND_CENTER),
128
+ label: "cell.mergeAndCenter",
129
+ enabledWhen: whenMerge,
130
+ },
131
+ {
132
+ action: cellEditAction({ kind: "mergeSheetCells", across: true, center: false }),
133
+ label: "cell.mergeAcross",
134
+ enabledWhen: whenMerge,
135
+ },
136
+ {
137
+ action: cellEditAction({ kind: "mergeSheetCells", across: false, center: false }),
138
+ label: "table.mergeCells",
139
+ icon: ICON_MERGE_CELLS,
140
+ enabledWhen: whenMerge,
141
+ },
142
+ {
143
+ action: cellEditAction({ kind: "unmergeSheetCells" }),
144
+ label: "table.unmergeCells",
145
+ icon: ICON_UNMERGE_CELLS,
146
+ enabledWhen: whenCellEdit("unmergeSheetCells"),
147
+ },
148
+ ];
149
+ /**
150
+ * The Merge & Center split button, Excel's: the main part reads pressed while
151
+ * the active cell is in a merge, and takes it away there, else merges the
152
+ * selected block and centers it; the caret opens {@link CELL_MERGE_MENU}.
153
+ */
154
+ function cellMergeControl(env, tools) {
155
+ const { i18n, host } = tools;
156
+ const merged = (state) => sheetCellMerged(editState(state).selectionProperties);
157
+ const split = createSplitButton({
158
+ mainLabel: env.label,
159
+ mainIcon: ICON_MERGE_CELLS,
160
+ caretLabel: i18n.t("ribbon.listOptions", { label: env.label }),
161
+ menuLabel: i18n.t("ribbon.listOptions", { label: env.label }),
162
+ onOpen: () => buildMenuInto(split.menu, CELL_MERGE_MENU, {
163
+ i18n,
164
+ context: () => commandContext(env.store.getState()),
165
+ action: (action) => host.runMenuAction(action),
166
+ close: () => split.controller.close(),
167
+ }),
168
+ });
169
+ split.main.dataset.command = "cellMerge";
170
+ split.caret.dataset.command = "cellMerge";
171
+ split.main.addEventListener("click", () => {
172
+ const edit = merged(env.store.getState()) ? { kind: "unmergeSheetCells" } : MERGE_AND_CENTER;
173
+ host.runMenuAction(cellEditAction(edit));
174
+ });
175
+ return {
176
+ el: split.el,
177
+ sync: (state) => {
178
+ const on = merged(state);
179
+ split.setActive(on);
180
+ split.main.setAttribute("aria-pressed", String(on));
181
+ // Off a merge the main part merges, which only a block of cells
182
+ // takes — not whole rows, columns or the sheet.
183
+ if (!on && !allowsEdit(state.selectionCaps, "mergeSheetCells"))
184
+ split.main.disabled = true;
185
+ },
186
+ close: () => split.controller.close(),
187
+ destroy: () => split.destroy(),
188
+ };
189
+ }
190
+ /** The number formats the Number Format dropdown offers — Excel's, but for
191
+ * its currency, accounting and long date, which differ by locale — each by
192
+ * its en-US code. */
193
+ const NUMBER_FORMATS = [
194
+ ["General", "cell.formatGeneral"],
195
+ ["0.00", "cell.formatNumber"],
196
+ ["m/d/yyyy", "cell.formatShortDate"],
197
+ ["h:mm:ss AM/PM", "cell.formatTime"],
198
+ ["0.00%", "cell.formatPercentage"],
199
+ ["# ?/?", "cell.formatFraction"],
200
+ ["0.00E+00", "cell.formatScientific"],
201
+ ["@", "cell.formatText"],
202
+ ];
203
+ /** The Number Format dropdown: the formats as one exclusive set, the active
204
+ * cell's marked. */
205
+ export const CELL_NUMBER_FORMAT_MENU = NUMBER_FORMATS.map(([code, label]) => ({
206
+ action: cellEditAction({ kind: "setCellNumberFormat", format: { code } }),
207
+ label,
208
+ enabledWhen: whenCellEdit("setCellNumberFormat"),
209
+ activeWhen: (c) => cellFormatOf(c)?.numberFormat === code,
210
+ }));
211
+ /** The name the Number Format dropdown shows for the active cell's format:
212
+ * one of its own, else Custom. */
213
+ function numberFormatName(state) {
214
+ const code = cellFormatIn(state)?.numberFormat ?? "General";
215
+ return NUMBER_FORMATS.find(([offered]) => offered === code)?.[1] ?? "cell.formatCustom";
216
+ }
217
+ /**
218
+ * The Cell tab's commands, over the {@link EditTools} once edit mode is
219
+ * mounted: Fill Color, then Border Color and Border, which share a pen of
220
+ * their own; the Alignment dropdown, Wrap Text and Merge & Center; the Number Format
221
+ * dropdown and the decimal steps; and Clear Formats.
222
+ */
223
+ export function cellCommands(tools) {
224
+ const border = createBorderState();
225
+ const action = (id, label, icon, group, edit) => ({
226
+ id,
227
+ label,
228
+ icon,
229
+ group,
230
+ run: { kind: "action", press: () => void runCellEdit(tools().host, edit) },
231
+ enabledWhen: whenCellEdit(edit.kind),
232
+ });
233
+ return {
234
+ cellFill: {
235
+ id: "cellFill",
236
+ label: "cell.fillColor",
237
+ icon: ICON_FILL,
238
+ group: "font",
239
+ run: { kind: "control", cluster: "paint", create: (env) => cellFillControl(env, tools()) },
240
+ enabledWhen: whenCellEdit("setCellFill"),
241
+ },
242
+ cellBorderColor: {
243
+ id: "cellBorderColor",
244
+ label: "table.borderColor",
245
+ icon: ICON_BORDER_COLOR,
246
+ group: "font",
247
+ run: {
248
+ kind: "control",
249
+ cluster: "paint",
250
+ create: (env) => borderColorControl(env, tools(), border, "cellBorderColor"),
251
+ },
252
+ enabledWhen: whenCellEdit("patchSheetCellBorders"),
253
+ },
254
+ cellBorder: {
255
+ id: "cellBorder",
256
+ label: "table.border",
257
+ icon: ICON_BORDER_ALL,
258
+ group: "font",
259
+ run: {
260
+ kind: "control",
261
+ cluster: "paint",
262
+ create: (env) => borderControl(env, tools(), border, "cellBorder", layCellBorder(tools().host)),
263
+ },
264
+ enabledWhen: whenCellEdit("patchSheetCellBorders"),
265
+ },
266
+ cellAlign: {
267
+ id: "cellAlign",
268
+ label: "cell.alignment",
269
+ icon: ICON_PARAGRAPH_LEFT,
270
+ group: "cellAlignment",
271
+ run: { kind: "menu", menu: CELL_ALIGN_MENU },
272
+ enabledWhen: whenCellEdit("patchCellAlignment"),
273
+ },
274
+ cellWrap: {
275
+ id: "cellWrap",
276
+ label: "cell.wrapText",
277
+ icon: ICON_WRAP_TEXT,
278
+ group: "cellAlignment",
279
+ run: {
280
+ kind: "toggle",
281
+ pressed: (state) => cellFormatIn(state)?.wrapText === true,
282
+ press: (store) => {
283
+ const wrapText = cellFormatIn(store.getState())?.wrapText !== true;
284
+ void runCellEdit(tools().host, { kind: "patchCellAlignment", alignment: { wrapText } });
285
+ },
286
+ },
287
+ enabledWhen: whenCellEdit("patchCellAlignment"),
288
+ },
289
+ cellMerge: {
290
+ id: "cellMerge",
291
+ label: "cell.mergeAndCenter",
292
+ icon: ICON_MERGE_CELLS,
293
+ group: "cellAlignment",
294
+ run: { kind: "control", create: (env) => cellMergeControl(env, tools()) },
295
+ enabledWhen: (c) => allowsEdit(c.selection, "mergeSheetCells", "unmergeSheetCells"),
296
+ },
297
+ cellNumberFormat: {
298
+ id: "cellNumberFormat",
299
+ label: "cell.numberFormat",
300
+ icon: ICON_NUMBER_FORMAT,
301
+ group: "cellNumber",
302
+ // Named, as Excel's box is: the format a cell shows its value
303
+ // through isn't seen in the value.
304
+ labeled: true,
305
+ run: {
306
+ kind: "menu",
307
+ menu: CELL_NUMBER_FORMAT_MENU,
308
+ current: (state) => ({ icon: ICON_NUMBER_FORMAT, label: numberFormatName(state) }),
309
+ },
310
+ enabledWhen: whenCellEdit("setCellNumberFormat"),
311
+ },
312
+ cellDecimalsUp: action("cellDecimalsUp", "cell.increaseDecimal", ICON_DECIMAL_INCREASE, "cellNumber", {
313
+ kind: "stepCellDecimals",
314
+ increase: true,
315
+ }),
316
+ cellDecimalsDown: action("cellDecimalsDown", "cell.decreaseDecimal", ICON_DECIMAL_DECREASE, "cellNumber", {
317
+ kind: "stepCellDecimals",
318
+ increase: false,
319
+ }),
320
+ cellClearFormats: action("cellClearFormats", "cell.clearFormats", ICON_CLEAR_FORMAT, "cellClear", {
321
+ kind: "clearCellFormats",
322
+ }),
323
+ };
324
+ }
325
+ //# sourceMappingURL=cell-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cell-format.js","sourceRoot":"","sources":["../src/cell-format.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,eAAe,EACf,eAAe,GAClB,MAAM,6BAA6B,CAAC;AAgBrC,OAAO,EACH,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrH,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAMlG;wBACwB;AACxB,SAAS,YAAY,CAAC,KAAc;IAChC,OAAO,eAAe,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,mBAAmB,CAAC,CAAC;AACjE,CAAC;AAED,oDA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E,WAAW,EAAE;YAC9F,IAAI,EAAE,kBAAkB;SAC3B,CAAC;KACL,CAAC;AACN,CAAC"}
@@ -13,7 +13,8 @@ export type ClipboardOp = "cut" | "paste";
13
13
  *
14
14
  * Cut and Copy gate on the engine's `copyable` verdict (Cut additionally on a
15
15
  * delete kind — cut is copy-then-delete, so a copyable-but-locked object is only
16
- * copied). Paste needs a document, not a selection: it reads the system
16
+ * copied). Delete is left out where it can't run, as over a workbook's cells,
17
+ * rather than shown greyed. Paste needs a document, not a selection: it reads the system
17
18
  * clipboard, which may hold something to paste even when nothing is selected.
18
19
  *
19
20
  * Paste pastes the object, not merely its text: the copy path carries the
@@ -23,6 +24,15 @@ export type ClipboardOp = "cut" | "paste";
23
24
  * with its own paste-confirmation UI.
24
25
  */
25
26
  export declare const CONTEXT_MENU: readonly MenuItem<MessageKey>[];
27
+ /**
28
+ * The context menu as it reads over a **workbook's grid** or its headers — the
29
+ * rows above plus Select, Insert and Delete fly-outs, as a table's read: the
30
+ * selection widened to whole rows or columns or the whole sheet, rows above or
31
+ * below it and columns left or right of it, as many as it spans, and its rows
32
+ * or columns deleted. Whole columns offer the column rows, whole rows the row
33
+ * rows.
34
+ */
35
+ export declare const GRID_CONTEXT_MENU: readonly MenuItem<MessageKey>[];
26
36
  /**
27
37
  * The context menu as it reads over a **table** — the rows above plus the
28
38
  * Select fly-out that widens the pick to whole rows, whole columns, or the
@@ -1 +1 @@
1
- {"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../src/context-menu.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAYlD;8CAC8C;AAC9C,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,CAAC;AAM1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,QAAQ,CAAC,UAAU,CAAC,EAqBvD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,QAAQ,CAAC,UAAU,CAAC,EAoC7D,CAAC"}
1
+ {"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../src/context-menu.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAsBlD;8CAC8C;AAC9C,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,CAAC;AAa1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,QAAQ,CAAC,UAAU,CAAC,EAsBvD,CAAC;AAoBF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,QAAQ,CAAC,UAAU,CAAC,EAgD5D,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,QAAQ,CAAC,UAAU,CAAC,EAoC7D,CAAC"}
@@ -1,14 +1,19 @@
1
1
  // Edit mode's canvas context menu rows: the clipboard and Delete over any
2
- // selection, and over a table the Select, Insert, Delete, Merge and Table
3
- // Properties rows. The
4
- // shell opens the menu (`UIExtension.contextMenuItems`).
2
+ // selection, over a table the Select, Insert, Delete, Merge and Table
3
+ // Properties rows, and over a workbook's grid the Insert and Delete of its rows
4
+ // and columns. The shell opens the menu (`UIExtension.contextMenuItems`).
5
5
  import { allowsEdit, COPY_MENU_ITEM, ICON_DELETE, ICON_TOOL_POINTER } from "@docmentis/udoc-ui/internal";
6
- import { ICON_CUT, ICON_INSERT_ROW_BELOW, ICON_MERGE_CELLS, ICON_PASTE, ICON_TABLE_PROPERTIES } from "./icons.js";
6
+ import { ICON_CUT, ICON_INSERT_COLUMN_LEFT, ICON_INSERT_COLUMN_RIGHT, ICON_INSERT_ROW_ABOVE, ICON_INSERT_ROW_BELOW, ICON_MERGE_CELLS, ICON_PASTE, ICON_TABLE_PROPERTIES, } from "./icons.js";
7
7
  import { editAction } from "./menu-action.js";
8
- import { ICON_DELETE_ROWS, ICON_UNMERGE_CELLS, TABLE_DELETE_MENU, TABLE_INSERT_MENU, TABLE_SELECT_MENU, whenTableEdit, } from "./table.js";
8
+ import { ICON_DELETE_COLUMNS, ICON_DELETE_ROWS, ICON_UNMERGE_CELLS, TABLE_DELETE_MENU, TABLE_INSERT_MENU, TABLE_SELECT_MENU, whenTableEdit, } from "./table.js";
9
9
  /** Enabled whenever a document is open — the rows that act on the document at
10
10
  * large rather than on the selection. */
11
11
  const whenReady = (c) => c.ready;
12
+ /** Whether the selection deletes — objects, annotations or shapes. */
13
+ const whenDeletes = (c) => allowsEdit(c.selection, "deleteObjects", "deleteAnnotations", "deleteShapes");
14
+ /** Whether the selection cuts: copies, and deletes objects or shapes — a
15
+ * copyable but locked object is only copied. */
16
+ const whenCuts = (c) => c.selection.copyable && allowsEdit(c.selection, "deleteObjects", "deleteShapes");
12
17
  /**
13
18
  * The canvas context menu in edit mode — what a right-click offers for the
14
19
  * current selection: the shell's Copy row among edit mode's own. These are
@@ -19,7 +24,8 @@ const whenReady = (c) => c.ready;
19
24
  *
20
25
  * Cut and Copy gate on the engine's `copyable` verdict (Cut additionally on a
21
26
  * delete kind — cut is copy-then-delete, so a copyable-but-locked object is only
22
- * copied). Paste needs a document, not a selection: it reads the system
27
+ * copied). Delete is left out where it can't run, as over a workbook's cells,
28
+ * rather than shown greyed. Paste needs a document, not a selection: it reads the system
23
29
  * clipboard, which may hold something to paste even when nothing is selected.
24
30
  *
25
31
  * Paste pastes the object, not merely its text: the copy path carries the
@@ -33,7 +39,7 @@ export const CONTEXT_MENU = [
33
39
  action: editAction({ kind: "clipboard", op: "cut" }),
34
40
  label: "contextMenu.cut",
35
41
  icon: ICON_CUT,
36
- enabledWhen: (c) => c.selection.copyable && allowsEdit(c.selection, "deleteObjects", "deleteShapes"),
42
+ enabledWhen: whenCuts,
37
43
  },
38
44
  COPY_MENU_ITEM,
39
45
  {
@@ -46,10 +52,74 @@ export const CONTEXT_MENU = [
46
52
  action: editAction({ kind: "delete" }),
47
53
  label: "contextMenu.delete",
48
54
  icon: ICON_DELETE,
49
- enabledWhen: (c) => allowsEdit(c.selection, "deleteObjects", "deleteAnnotations", "deleteShapes"),
55
+ enabledWhen: whenDeletes,
56
+ shownWhen: whenDeletes,
50
57
  separatorBefore: true,
51
58
  },
52
59
  ];
60
+ /** A workbook's grid edit of its rows or columns, as a menu row runs it,
61
+ * gated on its kind. */
62
+ function sheetTrackRow(edit, label, icon) {
63
+ return {
64
+ action: { kind: "selectionEdit", edit },
65
+ label,
66
+ icon,
67
+ enabledWhen: (c) => allowsEdit(c.selection, edit.kind),
68
+ };
69
+ }
70
+ /**
71
+ * The context menu as it reads over a **workbook's grid** or its headers — the
72
+ * rows above plus Select, Insert and Delete fly-outs, as a table's read: the
73
+ * selection widened to whole rows or columns or the whole sheet, rows above or
74
+ * below it and columns left or right of it, as many as it spans, and its rows
75
+ * or columns deleted. Whole columns offer the column rows, whole rows the row
76
+ * rows.
77
+ */
78
+ export const GRID_CONTEXT_MENU = [
79
+ ...CONTEXT_MENU,
80
+ {
81
+ submenu: [
82
+ { action: editAction({ kind: "selectSheet", scope: "rows" }), label: "table.row", enabledWhen: whenReady },
83
+ {
84
+ action: editAction({ kind: "selectSheet", scope: "columns" }),
85
+ label: "table.column",
86
+ enabledWhen: whenReady,
87
+ },
88
+ {
89
+ action: editAction({ kind: "selectSheet", scope: "sheet" }),
90
+ label: "grid.sheet",
91
+ enabledWhen: whenReady,
92
+ },
93
+ ],
94
+ label: "table.select",
95
+ icon: ICON_TOOL_POINTER,
96
+ enabledWhen: whenReady,
97
+ separatorBefore: true,
98
+ },
99
+ {
100
+ submenu: [
101
+ sheetTrackRow({ kind: "insertSheetRows", before: true }, "table.rowAbove", ICON_INSERT_ROW_ABOVE),
102
+ sheetTrackRow({ kind: "insertSheetRows", before: false }, "table.rowBelow", ICON_INSERT_ROW_BELOW),
103
+ {
104
+ ...sheetTrackRow({ kind: "insertSheetColumns", before: true }, "table.columnLeft", ICON_INSERT_COLUMN_LEFT),
105
+ separatorBefore: true,
106
+ },
107
+ sheetTrackRow({ kind: "insertSheetColumns", before: false }, "table.columnRight", ICON_INSERT_COLUMN_RIGHT),
108
+ ],
109
+ label: "table.insert",
110
+ icon: ICON_INSERT_ROW_BELOW,
111
+ enabledWhen: (c) => allowsEdit(c.selection, "insertSheetRows", "insertSheetColumns"),
112
+ },
113
+ {
114
+ submenu: [
115
+ sheetTrackRow({ kind: "deleteSheetRows" }, "table.rows", ICON_DELETE_ROWS),
116
+ sheetTrackRow({ kind: "deleteSheetColumns" }, "table.columns", ICON_DELETE_COLUMNS),
117
+ ],
118
+ label: "table.delete",
119
+ icon: ICON_DELETE_ROWS,
120
+ enabledWhen: (c) => allowsEdit(c.selection, "deleteSheetRows", "deleteSheetColumns"),
121
+ },
122
+ ];
53
123
  /**
54
124
  * The context menu as it reads over a **table** — the rows above plus the
55
125
  * Select fly-out that widens the pick to whole rows, whole columns, or the
@@ -1 +1 @@
1
- {"version":3,"file":"context-menu.js","sourceRoot":"","sources":["../src/context-menu.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,0EAA0E;AAC1E,uBAAuB;AACvB,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGzG,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAClH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACH,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GAChB,MAAM,YAAY,CAAC;AAMpB;0CAC0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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE;AA0JD,4CAA4C;AAC5C,wBAAgB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,QAAQ,CAmI7D"}
1
+ {"version":3,"file":"edit-mode.d.ts","sourceRoot":"","sources":["../src/edit-mode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAW,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAuBrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAc5C,6FAA6F;AAC7F,MAAM,WAAW,QAAS,SAAQ,WAAW;IACzC,kEAAkE;IAClE,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACrC,wDAAwD;IACxD,WAAW,IAAI,UAAU,CAAC;IAC1B,kDAAkD;IAClD,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IAChC,uEAAuE;IACvE,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE;AA0JD,4CAA4C;AAC5C,wBAAgB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,QAAQ,CAwI7D"}
package/dist/edit-mode.js CHANGED
@@ -1,8 +1,9 @@
1
1
  // Edit mode: the editor's extension of udoc-ui's shell.
2
2
  import { selectionPaint, selectionTextFormat, subscribeSelector } from "@docmentis/udoc-ui/internal";
3
3
  import { arrangeCommands } from "./arrange.js";
4
+ import { cellCommands } from "./cell-format.js";
4
5
  import { formatCommands } from "./commands.js";
5
- import { CONTEXT_MENU, TABLE_CONTEXT_MENU } from "./context-menu.js";
6
+ import { CONTEXT_MENU, GRID_CONTEXT_MENU, TABLE_CONTEXT_MENU } from "./context-menu.js";
6
7
  import { cropCommands } from "./crop.js";
7
8
  import { createGrips } from "./grips.js";
8
9
  import { createModeSwitch } from "./components/ModeSwitch.js";
@@ -190,6 +191,7 @@ export function editMode(options) {
190
191
  ...formatCommands(mountedTools),
191
192
  ...arrangeCommands(() => tools?.arrange ?? null),
192
193
  ...tableCommands(mountedTools, () => tableProperties?.open()),
194
+ ...cellCommands(mountedTools),
193
195
  ruler: RULER_COMMAND,
194
196
  createSlide: newSlideCommand(() => void slideLayouts?.newSlide()),
195
197
  deleteSlide: deleteSlideCommand(() => host),
@@ -217,9 +219,15 @@ export function editMode(options) {
217
219
  else if (tools)
218
220
  runEditMenuAction(tools, edit);
219
221
  },
220
- // Edit mode's acts on the selection, a table's rows added over one; view
221
- // mode keeps the shell's.
222
- contextMenuItems: (state, inTable) => (editing(state) ? (inTable ? TABLE_CONTEXT_MENU : CONTEXT_MENU) : null),
222
+ // Edit mode's acts on the selection, a table's rows added over one and a
223
+ // workbook grid's rows and columns over it; view mode keeps the shell's.
224
+ contextMenuItems: (state, inTable) => {
225
+ if (!editing(state))
226
+ return null;
227
+ if (inTable)
228
+ return TABLE_CONTEXT_MENU;
229
+ return state.docType === "spreadsheet" ? GRID_CONTEXT_MENU : CONTEXT_MENU;
230
+ },
223
231
  guideBand: (state) => (rulerShown(state) ? ruler : null),
224
232
  placedShape,
225
233
  placePreview: (tool, page, p0, p1) => host && tools ? placePreview(host, tools.paintMemory, tool, page, p0, p1) : null,