@rowsncolumns/utils 9.6.2 → 9.6.3

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 (37) hide show
  1. package/dist/cjs/autocorrect.d.ts +28 -0
  2. package/dist/cjs/autocorrect.d.ts.map +1 -0
  3. package/dist/cjs/autocorrect.js +91 -0
  4. package/dist/cjs/index.d.ts +2 -0
  5. package/dist/cjs/index.d.ts.map +1 -1
  6. package/dist/cjs/index.js +2 -0
  7. package/dist/cjs/insert-date-time.d.ts +17 -0
  8. package/dist/cjs/insert-date-time.d.ts.map +1 -0
  9. package/dist/cjs/insert-date-time.js +26 -0
  10. package/dist/cjs/sparkline-groups.d.ts.map +1 -1
  11. package/dist/cjs/sparkline-groups.js +2 -0
  12. package/dist/cjs/table-style-presets.d.ts +9 -0
  13. package/dist/cjs/table-style-presets.d.ts.map +1 -0
  14. package/dist/cjs/table-style-presets.js +559 -0
  15. package/dist/cjs/table-styles.d.ts +52 -1
  16. package/dist/cjs/table-styles.d.ts.map +1 -1
  17. package/dist/cjs/table-styles.js +191 -386
  18. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  19. package/dist/esm/autocorrect.d.ts +28 -0
  20. package/dist/esm/autocorrect.d.ts.map +1 -0
  21. package/dist/esm/autocorrect.js +76 -0
  22. package/dist/esm/index.d.ts +2 -0
  23. package/dist/esm/index.d.ts.map +1 -1
  24. package/dist/esm/index.js +2 -0
  25. package/dist/esm/insert-date-time.d.ts +17 -0
  26. package/dist/esm/insert-date-time.d.ts.map +1 -0
  27. package/dist/esm/insert-date-time.js +21 -0
  28. package/dist/esm/sparkline-groups.d.ts.map +1 -1
  29. package/dist/esm/sparkline-groups.js +2 -0
  30. package/dist/esm/table-style-presets.d.ts +9 -0
  31. package/dist/esm/table-style-presets.d.ts.map +1 -0
  32. package/dist/esm/table-style-presets.js +556 -0
  33. package/dist/esm/table-styles.d.ts +52 -1
  34. package/dist/esm/table-styles.d.ts.map +1 -1
  35. package/dist/esm/table-styles.js +149 -383
  36. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  37. package/package.json +2 -2
@@ -4,390 +4,139 @@
4
4
  * Shared between toolkit (import) and app (rendering)
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.findMatchingBandProperty = exports.getTableBorderStyles = void 0;
7
+ exports.resolveTableStyleCell = exports.findMatchingBandProperty = exports.getTableBorderStyles = void 0;
8
8
  var tslib_1 = require("tslib");
9
- var stripeTint = 0.8;
10
- var colorIndexes = [1, 4, 5, 6, 7, 8, 9];
9
+ var table_style_presets_1 = require("./table-style-presets");
10
+ var ROW_STRIPES = ["firstRowStripe", "secondRowStripe"];
11
+ var COLUMN_STRIPES = [
12
+ "firstColumnStripe",
13
+ "secondColumnStripe",
14
+ ];
15
+ var outerEdges = function (borders) {
16
+ var _a = borders !== null && borders !== void 0 ? borders : {}, top = _a.top, bottom = _a.bottom, left = _a.left, right = _a.right;
17
+ var edges = {};
18
+ if (top)
19
+ edges.top = top;
20
+ if (bottom)
21
+ edges.bottom = bottom;
22
+ if (left)
23
+ edges.left = left;
24
+ if (right)
25
+ edges.right = right;
26
+ return Object.keys(edges).length ? edges : undefined;
27
+ };
28
+ var compact = function (value) {
29
+ var e_1, _a;
30
+ try {
31
+ for (var _b = tslib_1.__values(Object.keys(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
32
+ var key = _c.value;
33
+ if (value[key] == null)
34
+ delete value[key];
35
+ }
36
+ }
37
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
38
+ finally {
39
+ try {
40
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
41
+ }
42
+ finally { if (e_1) throw e_1.error; }
43
+ }
44
+ return Object.keys(value).length ? value : undefined;
45
+ };
11
46
  /**
12
- * Get table border styles map with all table themes and their banded definitions
47
+ * A built-in style's banded definition for the table's stripe toggles: its elements (stripe
48
+ * elements dropped when the stripes are off) plus the coarse row / column summary.
49
+ */
50
+ var presetBandedDefinition = function (preset, showRowStripes, showColumnStripes) {
51
+ var e_2, _a, e_3, _b;
52
+ var _c, _d, _e, _f;
53
+ // A fresh copy per call: callers store and may mutate the result; the presets stay shared.
54
+ var elements = JSON.parse(JSON.stringify(preset));
55
+ if (!showRowStripes)
56
+ try {
57
+ for (var ROW_STRIPES_1 = tslib_1.__values(ROW_STRIPES), ROW_STRIPES_1_1 = ROW_STRIPES_1.next(); !ROW_STRIPES_1_1.done; ROW_STRIPES_1_1 = ROW_STRIPES_1.next()) {
58
+ var type = ROW_STRIPES_1_1.value;
59
+ delete elements[type];
60
+ }
61
+ }
62
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
63
+ finally {
64
+ try {
65
+ if (ROW_STRIPES_1_1 && !ROW_STRIPES_1_1.done && (_a = ROW_STRIPES_1.return)) _a.call(ROW_STRIPES_1);
66
+ }
67
+ finally { if (e_2) throw e_2.error; }
68
+ }
69
+ if (!showColumnStripes)
70
+ try {
71
+ for (var COLUMN_STRIPES_1 = tslib_1.__values(COLUMN_STRIPES), COLUMN_STRIPES_1_1 = COLUMN_STRIPES_1.next(); !COLUMN_STRIPES_1_1.done; COLUMN_STRIPES_1_1 = COLUMN_STRIPES_1.next()) {
72
+ var type = COLUMN_STRIPES_1_1.value;
73
+ delete elements[type];
74
+ }
75
+ }
76
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
77
+ finally {
78
+ try {
79
+ if (COLUMN_STRIPES_1_1 && !COLUMN_STRIPES_1_1.done && (_b = COLUMN_STRIPES_1.return)) _b.call(COLUMN_STRIPES_1);
80
+ }
81
+ finally { if (e_3) throw e_3.error; }
82
+ }
83
+ var headerRow = elements.headerRow, totalRow = elements.totalRow, firstColumn = elements.firstColumn, lastColumn = elements.lastColumn;
84
+ var rowProperties = compact({
85
+ headerColor: headerRow === null || headerRow === void 0 ? void 0 : headerRow.fill,
86
+ headerBorder: outerEdges(headerRow === null || headerRow === void 0 ? void 0 : headerRow.borders),
87
+ firstBandColor: (_c = elements.firstRowStripe) === null || _c === void 0 ? void 0 : _c.fill,
88
+ secondBandColor: (_d = elements.secondRowStripe) === null || _d === void 0 ? void 0 : _d.fill,
89
+ totalRowColor: totalRow === null || totalRow === void 0 ? void 0 : totalRow.fill,
90
+ totalRowBorder: outerEdges(totalRow === null || totalRow === void 0 ? void 0 : totalRow.borders),
91
+ totalRowBold: totalRow === null || totalRow === void 0 ? void 0 : totalRow.bold,
92
+ firstColumnColor: firstColumn === null || firstColumn === void 0 ? void 0 : firstColumn.fill,
93
+ lastColumnColor: lastColumn === null || lastColumn === void 0 ? void 0 : lastColumn.fill,
94
+ });
95
+ var columnProperties = compact({
96
+ firstBandColor: (_e = elements.firstColumnStripe) === null || _e === void 0 ? void 0 : _e.fill,
97
+ secondBandColor: (_f = elements.secondColumnStripe) === null || _f === void 0 ? void 0 : _f.fill,
98
+ });
99
+ return compact({
100
+ rowProperties: rowProperties,
101
+ columnProperties: columnProperties,
102
+ tableStyleElements: elements,
103
+ });
104
+ };
105
+ var FAMILIES = [
106
+ ["Light", 21],
107
+ ["Medium", 28],
108
+ ["Dark", 11],
109
+ ];
110
+ /**
111
+ * Excel's 60 built-in table styles by gallery group (Light 1–21, Medium 1–28, Dark 1–11; "None"
112
+ * leads the Light group), each with its banded definition for the given stripe toggles.
113
+ * Element formats come from ECMA-376 `presetTableStyles.xml` (`./table-style-presets`).
13
114
  */
14
115
  var getTableBorderStyles = function (showRowStripes, showColumnStripes) {
15
- var e_1, _a, e_2, _b;
16
- var _c, _d, _e, _f, _g, _h, _j, _k, _l;
17
- var runningLightIndex = 1;
18
- var runningMediumIndex = 1;
19
- var runningDarkIndex = 1;
20
- var styles = new Map([
21
- [
22
- "Light",
23
- tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([
24
- ["None", 0, 0, undefined]
25
- ], tslib_1.__read(colorIndexes.map(function (value) {
26
- return [
27
- ("TableStyleLight" + runningLightIndex++),
28
- stripeTint,
29
- 1,
30
- {
31
- rowProperties: {
32
- firstBandColor: {
33
- theme: value,
34
- tint: showRowStripes ? stripeTint : 1,
35
- },
36
- secondBandColor: showRowStripes
37
- ? {
38
- theme: 0,
39
- }
40
- : undefined,
41
- headerBorder: {
42
- top: {
43
- width: 1,
44
- style: "solid",
45
- color: { theme: value },
46
- },
47
- bottom: {
48
- width: 1,
49
- style: "solid",
50
- color: { theme: value },
51
- },
52
- },
53
- footerBorder: {
54
- bottom: {
55
- width: 1,
56
- style: "solid",
57
- color: { theme: value },
58
- },
59
- },
60
- },
61
- columnProperties: showColumnStripes
62
- ? {
63
- firstBandColor: {
64
- theme: value,
65
- tint: showColumnStripes ? stripeTint : 1,
66
- },
67
- }
68
- : undefined,
69
- },
70
- ];
71
- })), false), tslib_1.__read(colorIndexes.map(function (value) {
72
- return [
73
- ("TableStyleLight" + runningLightIndex++),
116
+ var e_4, _a;
117
+ var styles = new Map();
118
+ try {
119
+ for (var FAMILIES_1 = tslib_1.__values(FAMILIES), FAMILIES_1_1 = FAMILIES_1.next(); !FAMILIES_1_1.done; FAMILIES_1_1 = FAMILIES_1.next()) {
120
+ var _b = tslib_1.__read(FAMILIES_1_1.value, 2), family = _b[0], count = _b[1];
121
+ var entries = family === "Light" ? [["None", 0, 0, undefined]] : [];
122
+ for (var n = 1; n <= count; n++) {
123
+ var name_1 = "TableStyle".concat(family).concat(n);
124
+ entries.push([
125
+ name_1,
74
126
  undefined,
75
127
  undefined,
76
- {
77
- rowProperties: {
78
- headerColor: { theme: value },
79
- },
80
- },
81
- ];
82
- })), false), tslib_1.__read(colorIndexes.map(function (value) {
83
- var border = {
84
- width: 1,
85
- style: "solid",
86
- color: { theme: value },
87
- };
88
- return [
89
- ("TableStyleLight" + runningLightIndex++),
90
- stripeTint,
91
- 1,
92
- {
93
- rowProperties: {
94
- firstBandColor: {
95
- theme: value,
96
- tint: showRowStripes ? stripeTint : 1,
97
- },
98
- secondBandColor: showRowStripes
99
- ? {
100
- theme: 0,
101
- }
102
- : undefined,
103
- firstBandBorder: {
104
- top: border,
105
- left: border,
106
- right: border,
107
- bottom: border,
108
- },
109
- headerBorder: {
110
- top: border,
111
- left: border,
112
- right: border,
113
- bottom: border,
114
- },
115
- },
116
- columnProperties: showColumnStripes
117
- ? {
118
- firstBandColor: {
119
- theme: value,
120
- tint: showColumnStripes ? stripeTint : 1,
121
- },
122
- }
123
- : undefined,
124
- },
125
- ];
126
- })), false),
127
- ],
128
- [
129
- "Medium",
130
- tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(colorIndexes.map(function (value) {
131
- return [
132
- ("TableStyleMedium" + runningMediumIndex++),
133
- stripeTint,
134
- 1,
135
- {
136
- rowProperties: {
137
- headerColor: { theme: value },
138
- firstBandColor: {
139
- theme: value,
140
- tint: showRowStripes ? stripeTint : 1,
141
- },
142
- secondBandColor: showRowStripes
143
- ? {
144
- theme: 0,
145
- }
146
- : undefined,
147
- firstBandBorder: {
148
- bottom: {
149
- width: 1,
150
- style: "solid",
151
- color: { theme: value },
152
- },
153
- },
154
- },
155
- columnProperties: showColumnStripes
156
- ? {
157
- firstBandColor: {
158
- theme: value,
159
- tint: showColumnStripes ? stripeTint : 1,
160
- },
161
- }
162
- : undefined,
163
- },
164
- ];
165
- })), false), tslib_1.__read(colorIndexes.map(function (value) {
166
- return [
167
- ("TableStyleMedium" + runningMediumIndex++),
168
- 0.6,
169
- 0.8,
170
- {
171
- rowProperties: {
172
- headerColor: { theme: value },
173
- firstBandColor: {
174
- theme: value,
175
- tint: showRowStripes ? 0.6 : 0.8,
176
- },
177
- secondBandColor: {
178
- theme: value,
179
- tint: 0.8,
180
- },
181
- },
182
- columnProperties: showColumnStripes
183
- ? {
184
- firstBandColor: {
185
- theme: value,
186
- tint: showColumnStripes ? 0.6 : 0.8,
187
- },
188
- }
189
- : undefined,
190
- },
191
- ];
192
- })), false), tslib_1.__read(colorIndexes.map(function (value) {
193
- var border = {
194
- width: 2,
195
- style: "solid",
196
- color: { theme: 1 },
197
- };
198
- return [
199
- ("TableStyleMedium" + runningMediumIndex++),
200
- -0.15,
201
- 1,
202
- {
203
- rowProperties: {
204
- headerColor: { theme: value },
205
- firstBandColor: {
206
- theme: 0,
207
- tint: showRowStripes ? -0.15 : 1,
208
- },
209
- secondBandColor: showRowStripes
210
- ? {
211
- theme: 0,
212
- }
213
- : undefined,
214
- headerBorder: {
215
- top: border,
216
- },
217
- footerBorder: {
218
- bottom: border,
219
- },
220
- },
221
- columnProperties: showColumnStripes
222
- ? {
223
- firstBandColor: {
224
- theme: 0,
225
- tint: showColumnStripes ? -0.15 : 1,
226
- },
227
- }
228
- : undefined,
229
- },
230
- ];
231
- })), false), tslib_1.__read(colorIndexes.map(function (value) {
232
- var border = {
233
- width: 1,
234
- style: "solid",
235
- color: { theme: value },
236
- };
237
- return [
238
- ("TableStyleMedium" + runningMediumIndex++),
239
- stripeTint,
240
- 0.9,
241
- {
242
- rowProperties: {
243
- headerColor: {
244
- theme: value,
245
- tint: 0.9,
246
- },
247
- firstBandColor: {
248
- theme: value,
249
- tint: showRowStripes ? stripeTint : 0.9,
250
- },
251
- secondBandColor: {
252
- theme: value,
253
- tint: 0.9,
254
- },
255
- firstBandBorder: {
256
- top: border,
257
- left: border,
258
- right: border,
259
- bottom: border,
260
- },
261
- headerBorder: {
262
- top: border,
263
- left: border,
264
- right: border,
265
- bottom: border,
266
- },
267
- },
268
- columnProperties: showColumnStripes
269
- ? {
270
- firstBandColor: {
271
- theme: value,
272
- tint: showColumnStripes ? stripeTint : 0.9,
273
- },
274
- }
275
- : undefined,
276
- },
277
- ];
278
- })), false),
279
- ],
280
- [
281
- "Dark",
282
- tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(colorIndexes.map(function (value) {
283
- var firstTint = value - 1 === 0 ? 0.25 : -0.25;
284
- var secondTint = value - 1 === 0 ? 0.5 : 0;
285
- var edgeColumnColor = {
286
- theme: value,
287
- tint: value - 1 === 0 ? 0.15 : -0.5,
288
- };
289
- return [
290
- ("TableStyleDark" + runningDarkIndex++),
291
- firstTint,
292
- secondTint,
293
- {
294
- rowProperties: {
295
- headerColor: { theme: 1 },
296
- firstBandColor: {
297
- theme: value,
298
- tint: showRowStripes ? firstTint : secondTint,
299
- },
300
- secondBandColor: {
301
- theme: value,
302
- tint: secondTint,
303
- },
304
- firstColumnColor: edgeColumnColor,
305
- lastColumnColor: edgeColumnColor,
306
- },
307
- columnProperties: showColumnStripes
308
- ? {
309
- firstBandColor: {
310
- theme: value,
311
- tint: showColumnStripes ? firstTint : secondTint,
312
- },
313
- }
314
- : undefined,
315
- },
316
- ];
317
- })), false), tslib_1.__read([1, 5, 7, 9].map(function (value) {
318
- var firstTint = value - 1 === 0 ? -0.35 : 0.6;
319
- var secondTint = value - 1 === 0 ? -0.15 : 0.8;
320
- var edgeColumnColor = {
321
- theme: value - 1,
322
- tint: value - 1 === 0 ? -0.5 : 0.4,
323
- };
324
- return [
325
- ("TableStyleDark" + runningDarkIndex++),
326
- firstTint,
327
- secondTint,
328
- {
329
- rowProperties: {
330
- headerColor: { theme: value },
331
- firstBandColor: {
332
- theme: value - 1,
333
- tint: showRowStripes ? firstTint : secondTint,
334
- },
335
- secondBandColor: {
336
- theme: value - 1,
337
- tint: secondTint,
338
- },
339
- firstColumnColor: edgeColumnColor,
340
- lastColumnColor: edgeColumnColor,
341
- },
342
- columnProperties: showColumnStripes
343
- ? {
344
- firstBandColor: {
345
- theme: value - 1,
346
- tint: showColumnStripes ? firstTint : secondTint,
347
- },
348
- }
349
- : undefined,
350
- },
351
- ];
352
- })), false),
353
- ],
354
- ]);
355
- try {
356
- // Excel's built-in table styles bold the totals row and rule it with a double top border in
357
- // the style's accent colour — the header border's colour, else the header fill's, else the
358
- // stripe border's.
359
- for (var _m = tslib_1.__values(styles.values()), _o = _m.next(); !_o.done; _o = _m.next()) {
360
- var entries = _o.value;
361
- try {
362
- for (var entries_1 = (e_2 = void 0, tslib_1.__values(entries)), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
363
- var _p = tslib_1.__read(entries_1_1.value, 4), bandDefinition = _p[3];
364
- var rows = bandDefinition === null || bandDefinition === void 0 ? void 0 : bandDefinition.rowProperties;
365
- if (!rows)
366
- continue;
367
- rows.totalRowBold = true;
368
- var accent = (_j = (_h = (_e = (_d = (_c = rows.headerBorder) === null || _c === void 0 ? void 0 : _c.top) === null || _d === void 0 ? void 0 : _d.color) !== null && _e !== void 0 ? _e : (_g = (_f = rows.headerBorder) === null || _f === void 0 ? void 0 : _f.bottom) === null || _g === void 0 ? void 0 : _g.color) !== null && _h !== void 0 ? _h : rows.headerColor) !== null && _j !== void 0 ? _j : (_l = (_k = rows.firstBandBorder) === null || _k === void 0 ? void 0 : _k.bottom) === null || _l === void 0 ? void 0 : _l.color;
369
- if (accent && !rows.totalRowBorder) {
370
- rows.totalRowBorder = {
371
- top: { width: 1, style: "double", color: accent },
372
- };
373
- }
374
- }
375
- }
376
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
377
- finally {
378
- try {
379
- if (entries_1_1 && !entries_1_1.done && (_b = entries_1.return)) _b.call(entries_1);
380
- }
381
- finally { if (e_2) throw e_2.error; }
128
+ presetBandedDefinition(table_style_presets_1.TABLE_STYLE_PRESETS[name_1], showRowStripes, showColumnStripes),
129
+ ]);
382
130
  }
131
+ styles.set(family, entries);
383
132
  }
384
133
  }
385
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
134
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
386
135
  finally {
387
136
  try {
388
- if (_o && !_o.done && (_a = _m.return)) _a.call(_m);
137
+ if (FAMILIES_1_1 && !FAMILIES_1_1.done && (_a = FAMILIES_1.return)) _a.call(FAMILIES_1);
389
138
  }
390
- finally { if (e_1) throw e_1.error; }
139
+ finally { if (e_4) throw e_4.error; }
391
140
  }
392
141
  return styles;
393
142
  };
@@ -396,19 +145,75 @@ exports.getTableBorderStyles = getTableBorderStyles;
396
145
  * Find the banded definition for a given table theme
397
146
  */
398
147
  var findMatchingBandProperty = function (tableTheme, showRowStripes, showColumnStripes) {
399
- var bandProperties = (0, exports.getTableBorderStyles)(showRowStripes, showColumnStripes);
400
- var result;
401
- bandProperties.forEach(function (tableStyles) {
402
- if (result)
403
- return;
404
- for (var i = 0; i < tableStyles.length; i++) {
405
- var _a = tslib_1.__read(tableStyles[i], 4), themeName = _a[0], bandDefinition = _a[3];
406
- if (themeName === tableTheme) {
407
- result = bandDefinition ? tslib_1.__assign({}, bandDefinition) : undefined;
408
- return;
409
- }
410
- }
411
- });
412
- return result;
148
+ var preset = Object.prototype.hasOwnProperty.call(table_style_presets_1.TABLE_STYLE_PRESETS, tableTheme)
149
+ ? table_style_presets_1.TABLE_STYLE_PRESETS[tableTheme]
150
+ : undefined;
151
+ return preset
152
+ ? presetBandedDefinition(preset, showRowStripes, showColumnStripes)
153
+ : undefined;
413
154
  };
414
155
  exports.findMatchingBandProperty = findMatchingBandProperty;
156
+ /**
157
+ * A table cell's format from its style elements, the way Excel layers them: whole table, then
158
+ * column stripes, row stripes, last column, first column, header row and total row — a later
159
+ * element overrides the earlier ones on each property it sets. Stripes cover the body rows
160
+ * only; the header / total rows and first / last columns apply per the table's show-flags.
161
+ * An element's outer borders rule its region's edges and `horizontal` / `vertical` its inner
162
+ * edges.
163
+ */
164
+ var resolveTableStyleCell = function (elements, position) {
165
+ var r = position.rowIndex, c = position.columnIndex, rowCount = position.rowCount, columnCount = position.columnCount;
166
+ var lastRow = rowCount - 1;
167
+ var lastColumn = columnCount - 1;
168
+ var bodyStart = position.headerRow ? 1 : 0;
169
+ var bodyEnd = position.totalRow ? lastRow - 1 : lastRow;
170
+ var isBody = r >= bodyStart && r <= bodyEnd;
171
+ var out = {};
172
+ var borders = {};
173
+ var apply = function (format, r0, r1, c0, c1) {
174
+ if (!format)
175
+ return;
176
+ if (format.fill)
177
+ out.fill = format.fill;
178
+ if (format.color)
179
+ out.color = format.color;
180
+ if (format.bold)
181
+ out.bold = true;
182
+ var b = format.borders;
183
+ if (!b)
184
+ return;
185
+ var top = r === r0 ? b.top : b.horizontal;
186
+ var bottom = r === r1 ? b.bottom : b.horizontal;
187
+ var left = c === c0 ? b.left : b.vertical;
188
+ var right = c === c1 ? b.right : b.vertical;
189
+ if (top)
190
+ borders.top = top;
191
+ if (bottom)
192
+ borders.bottom = bottom;
193
+ if (left)
194
+ borders.left = left;
195
+ if (right)
196
+ borders.right = right;
197
+ };
198
+ apply(elements.wholeTable, 0, lastRow, 0, lastColumn);
199
+ if (isBody) {
200
+ apply(elements[c % 2 === 0 ? "firstColumnStripe" : "secondColumnStripe"], bodyStart, bodyEnd, c, c);
201
+ apply(elements[(r - bodyStart) % 2 === 0 ? "firstRowStripe" : "secondRowStripe"], r, r, 0, lastColumn);
202
+ }
203
+ if (position.showLastColumn && c === lastColumn) {
204
+ apply(elements.lastColumn, 0, lastRow, c, c);
205
+ }
206
+ if (position.showFirstColumn && c === 0) {
207
+ apply(elements.firstColumn, 0, lastRow, c, c);
208
+ }
209
+ if (position.headerRow && r === 0) {
210
+ apply(elements.headerRow, r, r, 0, lastColumn);
211
+ }
212
+ if (position.totalRow && r === lastRow) {
213
+ apply(elements.totalRow, r, r, 0, lastColumn);
214
+ }
215
+ if (Object.keys(borders).length)
216
+ out.borders = borders;
217
+ return out;
218
+ };
219
+ exports.resolveTableStyleCell = resolveTableStyleCell;
@@ -1 +1 @@
1
- {"root":["../../array.ts","../../cell-data-helpers.ts","../../cjk-number-format.ts","../../clipboard-html-sanitize.ts","../../color.ts","../../colors.ts","../../condition-operand.ts","../../conditional-format.ts","../../content-hash.ts","../../data-validation.ts","../../date.ts","../../dom.ts","../../excel-number-format.ts","../../formatter.ts","../../formula-locale.ts","../../formula-refs.ts","../../formula.ts","../../index.ts","../../keyboard.ts","../../locale.ts","../../log.ts","../../memoize.ts","../../numbers.ts","../../rich-text-html.ts","../../rich-text-links.ts","../../selection.ts","../../shared-string-canonical.ts","../../sheet-names.ts","../../sheet-protection.ts","../../sheet-span.ts","../../sort.ts","../../sparkline-groups.ts","../../string.ts","../../table-names.ts","../../table-styles.ts","../../table-totals.ts","../../typeguards.ts","../../uuid.ts","../../vitest.config.ts","../../formula-locale/formula-locale-data.generated.ts"],"version":"5.8.3"}
1
+ {"root":["../../array.ts","../../autocorrect.ts","../../cell-data-helpers.ts","../../cjk-number-format.ts","../../clipboard-html-sanitize.ts","../../color.ts","../../colors.ts","../../condition-operand.ts","../../conditional-format.ts","../../content-hash.ts","../../data-validation.ts","../../date.ts","../../dom.ts","../../excel-number-format.ts","../../formatter.ts","../../formula-locale.ts","../../formula-refs.ts","../../formula.ts","../../index.ts","../../insert-date-time.ts","../../keyboard.ts","../../locale.ts","../../log.ts","../../memoize.ts","../../numbers.ts","../../rich-text-html.ts","../../rich-text-links.ts","../../selection.ts","../../shared-string-canonical.ts","../../sheet-names.ts","../../sheet-protection.ts","../../sheet-span.ts","../../sort.ts","../../sparkline-groups.ts","../../string.ts","../../table-names.ts","../../table-style-presets.ts","../../table-styles.ts","../../table-totals.ts","../../typeguards.ts","../../uuid.ts","../../vitest.config.ts","../../formula-locale/formula-locale-data.generated.ts"],"version":"5.8.3"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Excel's AutoCorrect for a typed entry (File › Options › Proofing › AutoCorrect Options,
3
+ * "Choose AutoCorrect options for capitalization, spelling, and symbols", support.microsoft.com):
4
+ * the first letter of a sentence capitalised, the symbol replacements of the built-in list, and,
5
+ * under "AutoFormat As You Type", Internet and network paths turned into hyperlinks. Each part has
6
+ * its own switch, as Excel's dialog has; a host turns the whole of it off with `false`. Hyperlinks
7
+ * are the engines' own: both link a bare URL or email address on commit (`SheetCell.setValue`,
8
+ * rnc-store `set_user_value`), so AutoCorrect only leaves such an entry alone.
9
+ */
10
+ export type AutoCorrectOptions = {
11
+ /** "Capitalize first letter of sentences". */
12
+ capitalizeSentences: boolean;
13
+ /** "Replace text as you type": `(c)` → ©, `(tm)` → ™, `...` → …, `-->` → →. */
14
+ replaceText: boolean;
15
+ };
16
+ export declare const DEFAULT_AUTOCORRECT_OPTIONS: AutoCorrectOptions;
17
+ /** The symbol entries of Office's built-in AutoCorrect list, longest first where they overlap. */
18
+ export declare const AUTOCORRECT_REPLACEMENTS: ReadonlyArray<readonly [pattern: RegExp, replacement: string]>;
19
+ /**
20
+ * The entry after AutoCorrect. `lengthPreserving` keeps the text the same length (only
21
+ * capitalisation), for an entry whose rich-text runs index into it.
22
+ */
23
+ export declare const applyAutoCorrect: ({ text, options, lengthPreserving, }: {
24
+ text: string;
25
+ options?: AutoCorrectOptions;
26
+ lengthPreserving?: boolean;
27
+ }) => string;
28
+ //# sourceMappingURL=autocorrect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocorrect.d.ts","sourceRoot":"","sources":["../../autocorrect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,8CAA8C;IAC9C,mBAAmB,EAAE,OAAO,CAAC;IAC7B,+EAA+E;IAC/E,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,kBAGzC,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,wBAAwB,EAAE,aAAa,CAClD,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,CAYhD,CAAC;AA2DF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,sCAI9B;IACD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,KAAG,MAQH,CAAC"}