@rowsncolumns/utils 9.5.6 → 9.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cell-data-helpers.d.ts +8 -2
- package/dist/cjs/cell-data-helpers.d.ts.map +1 -1
- package/dist/cjs/cell-data-helpers.js +11 -3
- package/dist/cjs/cjk-number-format.d.ts +11 -0
- package/dist/cjs/cjk-number-format.d.ts.map +1 -0
- package/dist/cjs/cjk-number-format.js +533 -0
- package/dist/cjs/color.d.ts +9 -0
- package/dist/cjs/color.d.ts.map +1 -1
- package/dist/cjs/color.js +55 -1
- package/dist/cjs/data-validation.d.ts +29 -1
- package/dist/cjs/data-validation.d.ts.map +1 -1
- package/dist/cjs/data-validation.js +83 -24
- package/dist/cjs/formatter.d.ts +42 -0
- package/dist/cjs/formatter.d.ts.map +1 -1
- package/dist/cjs/formatter.js +179 -6
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/cell-data-helpers.d.ts +8 -2
- package/dist/esm/cell-data-helpers.d.ts.map +1 -1
- package/dist/esm/cell-data-helpers.js +9 -2
- package/dist/esm/cjk-number-format.d.ts +11 -0
- package/dist/esm/cjk-number-format.d.ts.map +1 -0
- package/dist/esm/cjk-number-format.js +494 -0
- package/dist/esm/color.d.ts +9 -0
- package/dist/esm/color.d.ts.map +1 -1
- package/dist/esm/color.js +53 -0
- package/dist/esm/data-validation.d.ts +29 -1
- package/dist/esm/data-validation.d.ts.map +1 -1
- package/dist/esm/data-validation.js +75 -23
- package/dist/esm/formatter.d.ts +42 -0
- package/dist/esm/formatter.d.ts.map +1 -1
- package/dist/esm/formatter.js +162 -4
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/cjs/color.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getContrastColor = exports.expandChartPalette = exports.chartPaletteColorAt = exports.applyLumModOff = exports.CHART_PALETTE_VARIATIONS = exports.rgbToHex = exports.hexToRgb = exports.lightenColor = exports.colorStringToHex = exports.isSameColor = exports.rgbaToArgbHex = exports.getSelectionColorAtIndex = void 0;
|
|
3
|
+
exports.getContrastColor = exports.expandChartPalette = exports.chartPaletteColorAt = exports.applyLumModOff = exports.CHART_PALETTE_VARIATIONS = exports.rgbToHex = exports.hexToRgb = exports.applyTint = exports.lightenColor = exports.colorStringToHex = exports.isSameColor = exports.rgbaToArgbHex = exports.getSelectionColorAtIndex = void 0;
|
|
4
4
|
exports.normalizeColor = normalizeColor;
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
6
|
var typeguards_1 = require("./typeguards");
|
|
@@ -126,6 +126,60 @@ var lightenColor = function (unit, color) {
|
|
|
126
126
|
return rgbColor ? shade(unit, rgbColor) : undefined;
|
|
127
127
|
};
|
|
128
128
|
exports.lightenColor = lightenColor;
|
|
129
|
+
/**
|
|
130
|
+
* Excel's tint (ECMA-376 Part 1, §18.8.19 `CT_Color@tint`) — what a `{ theme, tint }` colour paints
|
|
131
|
+
* as. Unlike `lightenColor`, which blends each channel toward black or white, the colour moves to
|
|
132
|
+
* HLS and only its luminance changes: `L·(1+tint)` for a negative tint, `L·(1−tint) + tint` for a
|
|
133
|
+
* positive one. Hue and saturation stay, so accent1 `#4472C4` at −25 % is Excel's `#2F5597` (not
|
|
134
|
+
* `#335693`) and accent2 `#ED7D31` at −25 % is `#C55A11`. The engine's `rnc_model::apply_tint`
|
|
135
|
+
* is the same rule. Returns `#rrggbb` (as `rgbToHex`); `undefined` for a colour it cannot read.
|
|
136
|
+
*/
|
|
137
|
+
var applyTint = function (tint, color) {
|
|
138
|
+
var rgba = normalizeColor(color);
|
|
139
|
+
if (!rgba || rgba.a === 0)
|
|
140
|
+
return undefined;
|
|
141
|
+
if (!Number.isFinite(tint) || tint === 0) {
|
|
142
|
+
return (0, exports.rgbToHex)(Math.round(rgba.r), Math.round(rgba.g), Math.round(rgba.b));
|
|
143
|
+
}
|
|
144
|
+
var t = Math.max(-1, Math.min(1, tint));
|
|
145
|
+
var _a = tslib_1.__read(rgbToHls(rgba.r / 255, rgba.g / 255, rgba.b / 255), 3), h = _a[0], l = _a[1], s = _a[2];
|
|
146
|
+
var lum = Math.max(0, Math.min(1, t < 0 ? l * (1 + t) : l * (1 - t) + t));
|
|
147
|
+
var _b = tslib_1.__read(hlsToRgb(h, lum, s), 3), r = _b[0], g = _b[1], b = _b[2];
|
|
148
|
+
var byte = function (c) { return Math.max(0, Math.min(255, Math.round(c * 255))); };
|
|
149
|
+
return (0, exports.rgbToHex)(byte(r), byte(g), byte(b));
|
|
150
|
+
};
|
|
151
|
+
exports.applyTint = applyTint;
|
|
152
|
+
var rgbToHls = function (r, g, b) {
|
|
153
|
+
var max = Math.max(r, g, b);
|
|
154
|
+
var min = Math.min(r, g, b);
|
|
155
|
+
var l = (max + min) / 2;
|
|
156
|
+
if (max === min)
|
|
157
|
+
return [0, l, 0];
|
|
158
|
+
var range = max - min;
|
|
159
|
+
var s = l <= 0.5 ? range / (max + min) : range / (2 - max - min);
|
|
160
|
+
var rc = (max - r) / range;
|
|
161
|
+
var gc = (max - g) / range;
|
|
162
|
+
var bc = (max - b) / range;
|
|
163
|
+
var h = r === max ? bc - gc : g === max ? 2 + rc - bc : 4 + gc - rc;
|
|
164
|
+
return [(((h / 6) % 1) + 1) % 1, l, s];
|
|
165
|
+
};
|
|
166
|
+
var hlsToRgb = function (h, l, s) {
|
|
167
|
+
if (s === 0)
|
|
168
|
+
return [l, l, l];
|
|
169
|
+
var m2 = l <= 0.5 ? l * (1 + s) : l + s - l * s;
|
|
170
|
+
var m1 = 2 * l - m2;
|
|
171
|
+
var v = function (hue) {
|
|
172
|
+
var x = ((hue % 1) + 1) % 1;
|
|
173
|
+
if (x < 1 / 6)
|
|
174
|
+
return m1 + (m2 - m1) * x * 6;
|
|
175
|
+
if (x < 0.5)
|
|
176
|
+
return m2;
|
|
177
|
+
if (x < 2 / 3)
|
|
178
|
+
return m1 + (m2 - m1) * (2 / 3 - x) * 6;
|
|
179
|
+
return m1;
|
|
180
|
+
};
|
|
181
|
+
return [v(h + 1 / 3), v(h), v(h - 1 / 3)];
|
|
182
|
+
};
|
|
129
183
|
var hexToRgb = function (hex) {
|
|
130
184
|
var bigint = parseInt(hex.slice(1), 16);
|
|
131
185
|
var r = (bigint >> 16) & 255;
|
|
@@ -1,10 +1,38 @@
|
|
|
1
|
-
import type { DataValidationRule } from "@rowsncolumns/common-types";
|
|
1
|
+
import type { BooleanCondition, ConditionType, DataValidationRule } from "@rowsncolumns/common-types";
|
|
2
2
|
/**
|
|
3
3
|
* A leading apostrophe in a data-validation / conditional-format list entry is
|
|
4
4
|
* Excel's text prefix — `'000s` is the text "000s" and a bare `'` is empty
|
|
5
5
|
* text — never part of the value itself.
|
|
6
6
|
*/
|
|
7
7
|
export declare const stripDataValidationTextPrefix: (entry: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* A `ONE_OF_LIST` value that is a SOURCE FORMULA rather than literal items,
|
|
10
|
+
* returned trimmed with its leading `=` (`=RegionList`, `=$A$2:$A$9`,
|
|
11
|
+
* `=Sheet2!A1:A5`, `=INDIRECT("…")`). Excel's List type has one Source box
|
|
12
|
+
* that takes either literal items (`Yes,No`) or a formula starting with `=`;
|
|
13
|
+
* the "Dropdown" (`ONE_OF_LIST`) / "Dropdown (from a range)" (`ONE_OF_RANGE`)
|
|
14
|
+
* split means a `=…` typed into the literal dropdown is read the way Excel
|
|
15
|
+
* reads it — as a `ONE_OF_RANGE` over that source. A quoted literal
|
|
16
|
+
* (`"=a,b"`, Excel's quoted list), a `=` inside a later item (`a,=b`) and a
|
|
17
|
+
* bare `=` stay literal. Rust twin: `rnc_model::validation::one_of_list_formula_source`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getDataValidationListFormulaSource: (value: string | undefined | null) => string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The condition type a rule behaves as: a `ONE_OF_LIST` whose first value is
|
|
22
|
+
* a source formula (`getDataValidationListFormulaSource`) behaves as
|
|
23
|
+
* `ONE_OF_RANGE`; every other condition is its own type. Rust twin:
|
|
24
|
+
* `rnc_model::validation::effective_condition_kind`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getEffectiveDataValidationConditionType: (condition: BooleanCondition | undefined | null) => ConditionType | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The reference a list rule draws its options from, or `undefined` when the
|
|
29
|
+
* rule is a literal item list (or not a list rule at all). `ONE_OF_RANGE` is
|
|
30
|
+
* always a reference (its value, `""` when missing); a `ONE_OF_LIST` is one
|
|
31
|
+
* when its value is a source formula (`=RegionList`) or a bare A1 reference
|
|
32
|
+
* (`$A$1:$A$5`). Shared by the dropdown options, the commit gate and
|
|
33
|
+
* `checkBooleanRule`, so the three always agree.
|
|
34
|
+
*/
|
|
35
|
+
export declare const getDataValidationListReference: (condition: BooleanCondition | undefined | null) => string | undefined;
|
|
8
36
|
/**
|
|
9
37
|
* Whether a cell's current text matches a ONE_OF_LIST option, with Excel's
|
|
10
38
|
* text-prefix semantics on BOTH sides: the option strips its leading `'`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-validation.d.ts","sourceRoot":"","sources":["../../data-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"data-validation.d.ts","sourceRoot":"","sources":["../../data-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAUpC;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GAAI,OAAO,MAAM,KAAG,MACd,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kCAAkC,GAC7C,OAAO,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,MAAM,GAAG,SAKX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uCAAuC,GAClD,WAAW,gBAAgB,GAAG,SAAS,GAAG,IAAI,KAC7C,aAAa,GAAG,SAIe,CAAC;AAEnC;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,GACzC,WAAW,gBAAgB,GAAG,SAAS,GAAG,IAAI,KAC7C,MAAM,GAAG,SAYX,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC,GAC/C,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,EACjC,WAAW,MAAM,GAAG,SAAS,GAAG,IAAI,KACnC,OAKF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,2BAA2B,GACtC,MAAM,kBAAkB,GAAG,SAAS,YAKrC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,GACxC,MAAM,kBAAkB,GAAG,SAAS,EACpC,aAAa,MAAM,EACnB,SAAS,MAAM,uBAgBhB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildDataValidationExpression = exports.isDataValidationFormulaRule = exports.dataValidationOptionMatchesCellValue = exports.stripDataValidationTextPrefix = void 0;
|
|
3
|
+
exports.buildDataValidationExpression = exports.isDataValidationFormulaRule = exports.dataValidationOptionMatchesCellValue = exports.getDataValidationListReference = exports.getEffectiveDataValidationConditionType = exports.getDataValidationListFormulaSource = exports.stripDataValidationTextPrefix = void 0;
|
|
4
4
|
var condition_operand_1 = require("./condition-operand");
|
|
5
|
+
var selection_1 = require("./selection");
|
|
5
6
|
var FORMULA_PREDICATE_BASE_CELL_REF = "A1";
|
|
6
7
|
/**
|
|
7
8
|
* A leading apostrophe in a data-validation / conditional-format list entry is
|
|
@@ -12,6 +13,59 @@ var stripDataValidationTextPrefix = function (entry) {
|
|
|
12
13
|
return entry.startsWith("'") ? entry.slice(1) : entry;
|
|
13
14
|
};
|
|
14
15
|
exports.stripDataValidationTextPrefix = stripDataValidationTextPrefix;
|
|
16
|
+
/**
|
|
17
|
+
* A `ONE_OF_LIST` value that is a SOURCE FORMULA rather than literal items,
|
|
18
|
+
* returned trimmed with its leading `=` (`=RegionList`, `=$A$2:$A$9`,
|
|
19
|
+
* `=Sheet2!A1:A5`, `=INDIRECT("…")`). Excel's List type has one Source box
|
|
20
|
+
* that takes either literal items (`Yes,No`) or a formula starting with `=`;
|
|
21
|
+
* the "Dropdown" (`ONE_OF_LIST`) / "Dropdown (from a range)" (`ONE_OF_RANGE`)
|
|
22
|
+
* split means a `=…` typed into the literal dropdown is read the way Excel
|
|
23
|
+
* reads it — as a `ONE_OF_RANGE` over that source. A quoted literal
|
|
24
|
+
* (`"=a,b"`, Excel's quoted list), a `=` inside a later item (`a,=b`) and a
|
|
25
|
+
* bare `=` stay literal. Rust twin: `rnc_model::validation::one_of_list_formula_source`.
|
|
26
|
+
*/
|
|
27
|
+
var getDataValidationListFormulaSource = function (value) {
|
|
28
|
+
var trimmed = (value !== null && value !== void 0 ? value : "").trim();
|
|
29
|
+
return trimmed.startsWith("=") && trimmed.slice(1).trim()
|
|
30
|
+
? trimmed
|
|
31
|
+
: undefined;
|
|
32
|
+
};
|
|
33
|
+
exports.getDataValidationListFormulaSource = getDataValidationListFormulaSource;
|
|
34
|
+
/**
|
|
35
|
+
* The condition type a rule behaves as: a `ONE_OF_LIST` whose first value is
|
|
36
|
+
* a source formula (`getDataValidationListFormulaSource`) behaves as
|
|
37
|
+
* `ONE_OF_RANGE`; every other condition is its own type. Rust twin:
|
|
38
|
+
* `rnc_model::validation::effective_condition_kind`.
|
|
39
|
+
*/
|
|
40
|
+
var getEffectiveDataValidationConditionType = function (condition) {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
return (condition === null || condition === void 0 ? void 0 : condition.type) === "ONE_OF_LIST" &&
|
|
43
|
+
(0, exports.getDataValidationListFormulaSource)((_b = (_a = condition.values) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.userEnteredValue)
|
|
44
|
+
? "ONE_OF_RANGE"
|
|
45
|
+
: (_c = condition === null || condition === void 0 ? void 0 : condition.type) !== null && _c !== void 0 ? _c : undefined;
|
|
46
|
+
};
|
|
47
|
+
exports.getEffectiveDataValidationConditionType = getEffectiveDataValidationConditionType;
|
|
48
|
+
/**
|
|
49
|
+
* The reference a list rule draws its options from, or `undefined` when the
|
|
50
|
+
* rule is a literal item list (or not a list rule at all). `ONE_OF_RANGE` is
|
|
51
|
+
* always a reference (its value, `""` when missing); a `ONE_OF_LIST` is one
|
|
52
|
+
* when its value is a source formula (`=RegionList`) or a bare A1 reference
|
|
53
|
+
* (`$A$1:$A$5`). Shared by the dropdown options, the commit gate and
|
|
54
|
+
* `checkBooleanRule`, so the three always agree.
|
|
55
|
+
*/
|
|
56
|
+
var getDataValidationListReference = function (condition) {
|
|
57
|
+
var _a, _b, _c, _d;
|
|
58
|
+
var firstValue = (_b = (_a = condition === null || condition === void 0 ? void 0 : condition.values) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.userEnteredValue;
|
|
59
|
+
if ((0, exports.getEffectiveDataValidationConditionType)(condition) === "ONE_OF_RANGE") {
|
|
60
|
+
return (_d = (_c = (0, exports.getDataValidationListFormulaSource)(firstValue)) !== null && _c !== void 0 ? _c : firstValue) !== null && _d !== void 0 ? _d : "";
|
|
61
|
+
}
|
|
62
|
+
if ((condition === null || condition === void 0 ? void 0 : condition.type) === "ONE_OF_LIST" &&
|
|
63
|
+
(0, selection_1.checkIfStringIsReference)(firstValue)) {
|
|
64
|
+
return firstValue;
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
67
|
+
};
|
|
68
|
+
exports.getDataValidationListReference = getDataValidationListReference;
|
|
15
69
|
/**
|
|
16
70
|
* Whether a cell's current text matches a ONE_OF_LIST option, with Excel's
|
|
17
71
|
* text-prefix semantics on BOTH sides: the option strips its leading `'`
|
|
@@ -91,20 +145,23 @@ exports.buildDataValidationExpression = buildDataValidationExpression;
|
|
|
91
145
|
var buildDataValidationConditionExpression = function (rule, baseCellRef, locale) {
|
|
92
146
|
var _a, _b, _c;
|
|
93
147
|
var condition = rule === null || rule === void 0 ? void 0 : rule.condition;
|
|
94
|
-
|
|
148
|
+
// A ONE_OF_LIST whose value is a source formula (`=RegionList`) compiles as
|
|
149
|
+
// the ONE_OF_RANGE over that source, as Excel's List type reads it.
|
|
150
|
+
var type = (0, exports.getEffectiveDataValidationConditionType)(condition);
|
|
151
|
+
if (!condition || !type)
|
|
95
152
|
return undefined;
|
|
96
153
|
var values = (_a = condition.values) !== null && _a !== void 0 ? _a : [];
|
|
97
154
|
var fromRaw = (_b = values[0]) === null || _b === void 0 ? void 0 : _b.userEnteredValue;
|
|
98
155
|
var toRaw = (_c = values[1]) === null || _c === void 0 ? void 0 : _c.userEnteredValue;
|
|
99
|
-
if (
|
|
156
|
+
if (type === "CUSTOM_FORMULA") {
|
|
100
157
|
var raw = fromRaw !== null && fromRaw !== void 0 ? fromRaw : "";
|
|
101
158
|
var trimmed = raw.trim();
|
|
102
159
|
if (!trimmed)
|
|
103
160
|
return undefined;
|
|
104
161
|
return trimmed.startsWith("=") ? trimmed : "=".concat(trimmed);
|
|
105
162
|
}
|
|
106
|
-
var fromExpr = (0, condition_operand_1.normalizeConditionOperand)(fromRaw,
|
|
107
|
-
var toExpr = (0, condition_operand_1.normalizeConditionOperand)(toRaw,
|
|
163
|
+
var fromExpr = (0, condition_operand_1.normalizeConditionOperand)(fromRaw, type, locale);
|
|
164
|
+
var toExpr = (0, condition_operand_1.normalizeConditionOperand)(toRaw, type, locale);
|
|
108
165
|
if (!fromExpr && !toExpr)
|
|
109
166
|
return undefined;
|
|
110
167
|
var comparisonOperatorMap = {
|
|
@@ -123,51 +180,49 @@ var buildDataValidationConditionExpression = function (rule, baseCellRef, locale
|
|
|
123
180
|
TEXT_EQ: "=",
|
|
124
181
|
TEXT_NOT_EQ: "<>",
|
|
125
182
|
};
|
|
126
|
-
if (
|
|
127
|
-
condition.type === "DATE_BETWEEN") {
|
|
183
|
+
if (type === "NUMBER_BETWEEN" || type === "DATE_BETWEEN") {
|
|
128
184
|
if (!fromExpr || !toExpr)
|
|
129
185
|
return undefined;
|
|
130
186
|
return "=AND(".concat(baseCellRef, ">=").concat(fromExpr, ",").concat(baseCellRef, "<=").concat(toExpr, ")");
|
|
131
187
|
}
|
|
132
|
-
if (
|
|
133
|
-
condition.type === "DATE_NOT_BETWEEN") {
|
|
188
|
+
if (type === "NUMBER_NOT_BETWEEN" || type === "DATE_NOT_BETWEEN") {
|
|
134
189
|
if (!fromExpr || !toExpr)
|
|
135
190
|
return undefined;
|
|
136
191
|
return "=OR(".concat(baseCellRef, "<").concat(fromExpr, ",").concat(baseCellRef, ">").concat(toExpr, ")");
|
|
137
192
|
}
|
|
138
|
-
var comparisonOperator = comparisonOperatorMap[
|
|
193
|
+
var comparisonOperator = comparisonOperatorMap[type];
|
|
139
194
|
if (comparisonOperator) {
|
|
140
195
|
if (!fromExpr)
|
|
141
196
|
return undefined;
|
|
142
197
|
return "=".concat(baseCellRef).concat(comparisonOperator).concat(fromExpr);
|
|
143
198
|
}
|
|
144
|
-
if (
|
|
199
|
+
if (type === "TEXT_CONTAINS") {
|
|
145
200
|
if (!fromExpr)
|
|
146
201
|
return undefined;
|
|
147
202
|
return "=ISNUMBER(SEARCH(".concat(fromExpr, ",").concat(baseCellRef, "))");
|
|
148
203
|
}
|
|
149
|
-
if (
|
|
204
|
+
if (type === "TEXT_NOT_CONTAINS") {
|
|
150
205
|
if (!fromExpr)
|
|
151
206
|
return undefined;
|
|
152
207
|
return "=NOT(ISNUMBER(SEARCH(".concat(fromExpr, ",").concat(baseCellRef, ")))");
|
|
153
208
|
}
|
|
154
|
-
if (
|
|
209
|
+
if (type === "TEXT_STARTS_WITH") {
|
|
155
210
|
if (!fromExpr)
|
|
156
211
|
return undefined;
|
|
157
212
|
return "=LEFT(".concat(baseCellRef, ",LEN(").concat(fromExpr, "))=").concat(fromExpr);
|
|
158
213
|
}
|
|
159
|
-
if (
|
|
214
|
+
if (type === "TEXT_ENDS_WITH") {
|
|
160
215
|
if (!fromExpr)
|
|
161
216
|
return undefined;
|
|
162
217
|
return "=RIGHT(".concat(baseCellRef, ",LEN(").concat(fromExpr, "))=").concat(fromExpr);
|
|
163
218
|
}
|
|
164
|
-
if (
|
|
219
|
+
if (type === "TEXT_IS_EMAIL") {
|
|
165
220
|
return "=ISNUMBER(SEARCH(\"@\",".concat(baseCellRef, "))");
|
|
166
221
|
}
|
|
167
|
-
if (
|
|
222
|
+
if (type === "TEXT_IS_URL") {
|
|
168
223
|
return "=OR(LEFT(".concat(baseCellRef, ",7)=\"http://\",LEFT(").concat(baseCellRef, ",8)=\"https://\")");
|
|
169
224
|
}
|
|
170
|
-
if (
|
|
225
|
+
if (type === "ONE_OF_RANGE") {
|
|
171
226
|
if (!fromExpr)
|
|
172
227
|
return undefined;
|
|
173
228
|
if (rule === null || rule === void 0 ? void 0 : rule.allowBlank) {
|
|
@@ -175,7 +230,7 @@ var buildDataValidationConditionExpression = function (rule, baseCellRef, locale
|
|
|
175
230
|
}
|
|
176
231
|
return "=COUNTIF(".concat(fromExpr, ",").concat(baseCellRef, ")>0");
|
|
177
232
|
}
|
|
178
|
-
if (
|
|
233
|
+
if (type === "ONE_OF_LIST") {
|
|
179
234
|
var entries = fromRaw
|
|
180
235
|
? fromRaw.split(",").map(function (entry) { return entry.trim(); })
|
|
181
236
|
: [];
|
|
@@ -192,10 +247,14 @@ var buildDataValidationConditionExpression = function (rule, baseCellRef, locale
|
|
|
192
247
|
? [textCondition, "".concat(baseCellRef, "=\"'\"")]
|
|
193
248
|
: [textCondition];
|
|
194
249
|
}
|
|
250
|
+
// A list ITEM is never a formula (a source formula is the whole value,
|
|
251
|
+
// see `getEffectiveDataValidationConditionType`): `"=a,b"` and `a,=b`
|
|
252
|
+
// list the text `=a` / `=b`.
|
|
253
|
+
if (entry.startsWith("=")) {
|
|
254
|
+
return ["".concat(baseCellRef, "=\"").concat((0, condition_operand_1.escapeConditionFormulaText)(entry), "\"")];
|
|
255
|
+
}
|
|
195
256
|
return entry
|
|
196
|
-
? [
|
|
197
|
-
"".concat(baseCellRef, "=").concat((0, condition_operand_1.normalizeConditionOperand)(entry, condition.type, locale)),
|
|
198
|
-
]
|
|
257
|
+
? ["".concat(baseCellRef, "=").concat((0, condition_operand_1.normalizeConditionOperand)(entry, type, locale))]
|
|
199
258
|
: [];
|
|
200
259
|
})
|
|
201
260
|
.filter(function (entry) { return Boolean(entry); });
|
|
@@ -205,13 +264,13 @@ var buildDataValidationConditionExpression = function (rule, baseCellRef, locale
|
|
|
205
264
|
? "=".concat(conditions[0])
|
|
206
265
|
: "=OR(".concat(conditions.join(","), ")");
|
|
207
266
|
}
|
|
208
|
-
if (
|
|
267
|
+
if (type === "BLANK") {
|
|
209
268
|
return "=".concat(baseCellRef, "=\"\"");
|
|
210
269
|
}
|
|
211
|
-
if (
|
|
270
|
+
if (type === "NOT_BLANK") {
|
|
212
271
|
return "=".concat(baseCellRef, "<>\"\"");
|
|
213
272
|
}
|
|
214
|
-
if (
|
|
273
|
+
if (type === "BOOLEAN") {
|
|
215
274
|
return "=OR(".concat(baseCellRef, "=TRUE,").concat(baseCellRef, "=FALSE)");
|
|
216
275
|
}
|
|
217
276
|
return undefined;
|
package/dist/cjs/formatter.d.ts
CHANGED
|
@@ -44,5 +44,47 @@ export declare const withShortAmPmMarker: (pattern: string) => string | undefine
|
|
|
44
44
|
*/
|
|
45
45
|
export declare const withWorkbookSeparators: (pattern: string, locale?: string) => string | undefined;
|
|
46
46
|
export declare const ssfFormat: (pattern: string, value: any, locale?: string) => string;
|
|
47
|
+
/**
|
|
48
|
+
* One piece of a number format's width-aware output (see
|
|
49
|
+
* {@link ssfFormatLayout}):
|
|
50
|
+
* - `text` — literal characters, painted as they are;
|
|
51
|
+
* - `fill` — Excel's `*x`: `x` repeated to fill the cell's free width;
|
|
52
|
+
* - `skip` — Excel's `_x`: blank space as wide as the glyph `x`;
|
|
53
|
+
* - `digit` — a `?` placeholder with no digit: blank space as wide as a
|
|
54
|
+
* digit.
|
|
55
|
+
*/
|
|
56
|
+
export type NumberFormatLayoutPart = {
|
|
57
|
+
type: "text";
|
|
58
|
+
text: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: "fill";
|
|
61
|
+
char: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: "skip";
|
|
64
|
+
char: string;
|
|
65
|
+
} | {
|
|
66
|
+
type: "digit";
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Excel's width-aware number-format output: `*x` repeats `x` to the cell's
|
|
70
|
+
* width, `_x` reserves the width of `x` and `?` reserves a digit's width
|
|
71
|
+
* ("Number format codes", support.microsoft.com). A plain formatted string
|
|
72
|
+
* cannot carry that — `ssfFormat` drops the fill and renders the reserves as
|
|
73
|
+
* single spaces — so the painter asks for the parts and expands them with
|
|
74
|
+
* measured glyph widths.
|
|
75
|
+
*
|
|
76
|
+
* Returns `undefined` when the pattern has none of those tokens (the plain
|
|
77
|
+
* string is already exact), and for East Asian numeral codes. The parts'
|
|
78
|
+
* plain text ({@link numberFormatLayoutText}) equals `ssfFormat`'s output;
|
|
79
|
+
* callers compare it against the string they paint and ignore the layout
|
|
80
|
+
* when the two disagree.
|
|
81
|
+
*/
|
|
82
|
+
export declare const ssfFormatLayout: (pattern: string, value: any, locale?: string) => NumberFormatLayoutPart[] | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* The plain string a layout stands for — what `ssfFormat` returns for the
|
|
85
|
+
* same pattern and value: fills drop out, skips and digit pads are one
|
|
86
|
+
* space each.
|
|
87
|
+
*/
|
|
88
|
+
export declare const numberFormatLayoutText: (parts: readonly NumberFormatLayoutPart[]) => string;
|
|
47
89
|
export declare const ssfFormatColor: (pattern: string, value: any) => string | undefined;
|
|
48
90
|
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../formatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../formatter.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI,KAAG,OASlE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI,KACjC,OAWF,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI,KAAG,OAWlE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI,KAAG,OAOlE,CAAC;AAMF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,KAAG,OA4B1D,CAAC;AA+LF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,MAAM,GAAG,SA4C9D,CAAC;AAiIF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EACf,SAAS,MAAM,KACd,MAAM,GAAG,SAiBX,CAAC;AAiBF,eAAO,MAAM,SAAS,GACpB,SAAS,MAAM,EACf,OAAO,GAAG,EACV,SAAS,MAAM,KACd,MASF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAoDtB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,EACf,OAAO,GAAG,EACV,SAAS,MAAM,KACd,sBAAsB,EAAE,GAAG,SA8C7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,SAAS,sBAAsB,EAAE,KACvC,MAOF,CAAC;AAkQF,eAAO,MAAM,cAAc,GACzB,SAAS,MAAM,EACf,OAAO,GAAG,KACT,MAAM,GAAG,SAoBX,CAAC"}
|
package/dist/cjs/formatter.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ssfFormatColor = exports.ssfFormat = exports.withWorkbookSeparators = exports.withShortAmPmMarker = exports.isStandaloneMonthPattern = exports.isTextPattern = exports.isTimePattern = exports.isDateTimePattern = exports.isDatePattern = void 0;
|
|
3
|
+
exports.ssfFormatColor = exports.numberFormatLayoutText = exports.ssfFormatLayout = exports.ssfFormat = exports.withWorkbookSeparators = exports.withShortAmPmMarker = exports.isStandaloneMonthPattern = exports.isTextPattern = exports.isTimePattern = exports.isDateTimePattern = exports.isDatePattern = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var numfmt_1 = require("numfmt");
|
|
6
|
+
var cjk_number_format_1 = require("./cjk-number-format");
|
|
6
7
|
var colors_1 = require("./colors");
|
|
7
8
|
var excel_number_format_1 = require("./excel-number-format");
|
|
8
9
|
/**
|
|
@@ -529,6 +530,169 @@ var withWorkbookSeparatorsCached = function (code, locale) {
|
|
|
529
530
|
return rewritten;
|
|
530
531
|
};
|
|
531
532
|
var ssfFormat = function (pattern, value, locale) {
|
|
533
|
+
// East Asian tokens numfmt does not render (`[DBNumN]`, Japanese era `g`/`e`,
|
|
534
|
+
// `aaa` weekdays): rewrite the code to plain literals, then convert the
|
|
535
|
+
// rendered digits to the `[DBNumN]` numeral system (see cjk-number-format).
|
|
536
|
+
if (typeof value === "number") {
|
|
537
|
+
var cjk = (0, cjk_number_format_1.prepareCjkNumberFormat)(pattern, value, locale);
|
|
538
|
+
if (cjk)
|
|
539
|
+
return cjk.finish(ssfFormatBase(cjk.code, value, locale));
|
|
540
|
+
}
|
|
541
|
+
return ssfFormatBase(pattern, value, locale);
|
|
542
|
+
};
|
|
543
|
+
exports.ssfFormat = ssfFormat;
|
|
544
|
+
var LAYOUT_FILL_MARK = "\uE000";
|
|
545
|
+
var LAYOUT_SKIP_MARK = "\uE001";
|
|
546
|
+
var LAYOUT_LITERAL_SPACE = "\uE002";
|
|
547
|
+
var LAYOUT_DIGIT_PAD = "\u00a0";
|
|
548
|
+
/**
|
|
549
|
+
* Quote every literal space of `code` as a private-use sentinel so that,
|
|
550
|
+
* rendered with numfmt's `nbsp` option, the only non-breaking spaces left
|
|
551
|
+
* in the output are the `?` digit pads.
|
|
552
|
+
*/
|
|
553
|
+
var markLiteralSpaces = function (code) {
|
|
554
|
+
var _a;
|
|
555
|
+
var out = "";
|
|
556
|
+
var inQuotes = false;
|
|
557
|
+
var inBrackets = false;
|
|
558
|
+
for (var i = 0; i < code.length; i++) {
|
|
559
|
+
var char = code[i];
|
|
560
|
+
if (inQuotes) {
|
|
561
|
+
if (char === '"')
|
|
562
|
+
inQuotes = false;
|
|
563
|
+
out += char === " " ? LAYOUT_LITERAL_SPACE : char;
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
if (inBrackets) {
|
|
567
|
+
if (char === "]")
|
|
568
|
+
inBrackets = false;
|
|
569
|
+
out += char;
|
|
570
|
+
continue;
|
|
571
|
+
}
|
|
572
|
+
if (char === '"') {
|
|
573
|
+
inQuotes = true;
|
|
574
|
+
}
|
|
575
|
+
else if (char === "[") {
|
|
576
|
+
inBrackets = true;
|
|
577
|
+
}
|
|
578
|
+
else if (char === "\\" && code[i + 1] === " ") {
|
|
579
|
+
out += "\"".concat(LAYOUT_LITERAL_SPACE, "\"");
|
|
580
|
+
i++;
|
|
581
|
+
continue;
|
|
582
|
+
}
|
|
583
|
+
else if (char === "\\" || char === "_" || char === "*") {
|
|
584
|
+
out += char + ((_a = code[i + 1]) !== null && _a !== void 0 ? _a : "");
|
|
585
|
+
i++;
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
else if (char === " ") {
|
|
589
|
+
out += "\"".concat(LAYOUT_LITERAL_SPACE, "\"");
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
out += char;
|
|
593
|
+
}
|
|
594
|
+
return out;
|
|
595
|
+
};
|
|
596
|
+
/** Does the pattern carry a `*` fill, `_` skip or `?` placeholder at all? */
|
|
597
|
+
var LAYOUT_TOKEN_REGEX = /[*_?]/;
|
|
598
|
+
/**
|
|
599
|
+
* Excel's width-aware number-format output: `*x` repeats `x` to the cell's
|
|
600
|
+
* width, `_x` reserves the width of `x` and `?` reserves a digit's width
|
|
601
|
+
* ("Number format codes", support.microsoft.com). A plain formatted string
|
|
602
|
+
* cannot carry that — `ssfFormat` drops the fill and renders the reserves as
|
|
603
|
+
* single spaces — so the painter asks for the parts and expands them with
|
|
604
|
+
* measured glyph widths.
|
|
605
|
+
*
|
|
606
|
+
* Returns `undefined` when the pattern has none of those tokens (the plain
|
|
607
|
+
* string is already exact), and for East Asian numeral codes. The parts'
|
|
608
|
+
* plain text ({@link numberFormatLayoutText}) equals `ssfFormat`'s output;
|
|
609
|
+
* callers compare it against the string they paint and ignore the layout
|
|
610
|
+
* when the two disagree.
|
|
611
|
+
*/
|
|
612
|
+
var ssfFormatLayout = function (pattern, value, locale) {
|
|
613
|
+
var _a;
|
|
614
|
+
if (!pattern || !LAYOUT_TOKEN_REGEX.test(pattern))
|
|
615
|
+
return undefined;
|
|
616
|
+
if (typeof value === "number" && (0, cjk_number_format_1.prepareCjkNumberFormat)(pattern, value, locale)) {
|
|
617
|
+
return undefined;
|
|
618
|
+
}
|
|
619
|
+
var raw = ssfFormatBase(pattern, value, locale, {
|
|
620
|
+
nbsp: true,
|
|
621
|
+
fillChar: LAYOUT_FILL_MARK,
|
|
622
|
+
skipChar: LAYOUT_SKIP_MARK,
|
|
623
|
+
transform: markLiteralSpaces,
|
|
624
|
+
});
|
|
625
|
+
if (raw === undefined)
|
|
626
|
+
return undefined;
|
|
627
|
+
// A locale whose group separator is itself a non-breaking space makes the
|
|
628
|
+
// digit pads ambiguous: keep those as plain spaces.
|
|
629
|
+
var digitPads = separatorsFor(locale).group !== LAYOUT_DIGIT_PAD;
|
|
630
|
+
var parts = [];
|
|
631
|
+
var text = "";
|
|
632
|
+
var flush = function () {
|
|
633
|
+
if (text)
|
|
634
|
+
parts.push({ type: "text", text: text });
|
|
635
|
+
text = "";
|
|
636
|
+
};
|
|
637
|
+
for (var i = 0; i < raw.length; i++) {
|
|
638
|
+
var char = raw[i];
|
|
639
|
+
if (char === LAYOUT_FILL_MARK || char === LAYOUT_SKIP_MARK) {
|
|
640
|
+
var next = (_a = raw[i + 1]) !== null && _a !== void 0 ? _a : " ";
|
|
641
|
+
flush();
|
|
642
|
+
parts.push({
|
|
643
|
+
type: char === LAYOUT_FILL_MARK ? "fill" : "skip",
|
|
644
|
+
char: next,
|
|
645
|
+
});
|
|
646
|
+
i++;
|
|
647
|
+
}
|
|
648
|
+
else if (char === LAYOUT_DIGIT_PAD) {
|
|
649
|
+
if (digitPads) {
|
|
650
|
+
flush();
|
|
651
|
+
parts.push({ type: "digit" });
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
text += char;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
else if (char === LAYOUT_LITERAL_SPACE) {
|
|
658
|
+
text += " ";
|
|
659
|
+
}
|
|
660
|
+
else {
|
|
661
|
+
text += char;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
flush();
|
|
665
|
+
return parts.some(function (part) { return part.type !== "text"; }) ? parts : undefined;
|
|
666
|
+
};
|
|
667
|
+
exports.ssfFormatLayout = ssfFormatLayout;
|
|
668
|
+
/**
|
|
669
|
+
* The plain string a layout stands for — what `ssfFormat` returns for the
|
|
670
|
+
* same pattern and value: fills drop out, skips and digit pads are one
|
|
671
|
+
* space each.
|
|
672
|
+
*/
|
|
673
|
+
var numberFormatLayoutText = function (parts) {
|
|
674
|
+
var e_2, _a;
|
|
675
|
+
var out = "";
|
|
676
|
+
try {
|
|
677
|
+
for (var parts_1 = tslib_1.__values(parts), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) {
|
|
678
|
+
var part = parts_1_1.value;
|
|
679
|
+
if (part.type === "text")
|
|
680
|
+
out += part.text;
|
|
681
|
+
else if (part.type !== "fill")
|
|
682
|
+
out += " ";
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
686
|
+
finally {
|
|
687
|
+
try {
|
|
688
|
+
if (parts_1_1 && !parts_1_1.done && (_a = parts_1.return)) _a.call(parts_1);
|
|
689
|
+
}
|
|
690
|
+
finally { if (e_2) throw e_2.error; }
|
|
691
|
+
}
|
|
692
|
+
return out;
|
|
693
|
+
};
|
|
694
|
+
exports.numberFormatLayoutText = numberFormatLayoutText;
|
|
695
|
+
function ssfFormatBase(pattern, value, locale, layout) {
|
|
532
696
|
try {
|
|
533
697
|
if (locale)
|
|
534
698
|
ensureNumfmtLocale(locale);
|
|
@@ -537,12 +701,22 @@ var ssfFormat = function (pattern, value, locale) {
|
|
|
537
701
|
shortAmPm = (0, exports.withShortAmPmMarker)(pattern);
|
|
538
702
|
shortAmPmPatternCache.set(pattern, shortAmPm);
|
|
539
703
|
}
|
|
540
|
-
var
|
|
704
|
+
var baseCode = withWorkbookSeparatorsCached(shortAmPm !== null && shortAmPm !== void 0 ? shortAmPm : pattern, locale);
|
|
705
|
+
var code = layout ? layout.transform(baseCode) : baseCode;
|
|
541
706
|
var patternLocale = localeForPattern(pattern, locale);
|
|
542
707
|
if (shortAmPm !== undefined && patternLocale) {
|
|
543
708
|
patternLocale = getShortAmPmLocale(patternLocale);
|
|
544
709
|
}
|
|
545
|
-
|
|
710
|
+
// numfmt types `fillChar` / `skipChar` as booleans; at runtime they are
|
|
711
|
+
// the marker strings it emits ahead of the fill / skip character.
|
|
712
|
+
var options_1 = layout
|
|
713
|
+
? {
|
|
714
|
+
locale: patternLocale,
|
|
715
|
+
nbsp: layout.nbsp,
|
|
716
|
+
fillChar: layout.fillChar,
|
|
717
|
+
skipChar: layout.skipChar,
|
|
718
|
+
}
|
|
719
|
+
: { locale: patternLocale };
|
|
546
720
|
if (typeof value === "number") {
|
|
547
721
|
// Excel decides rounding, `General`, huge magnitudes and conditional
|
|
548
722
|
// sections from the 15-significant-digit decimal, not the binary
|
|
@@ -560,10 +734,9 @@ var ssfFormat = function (pattern, value, locale) {
|
|
|
560
734
|
return isNegativeElapsedTime ? "-".concat(formatted) : formatted;
|
|
561
735
|
}
|
|
562
736
|
catch (err) {
|
|
563
|
-
return String(value);
|
|
737
|
+
return layout ? undefined : String(value);
|
|
564
738
|
}
|
|
565
|
-
}
|
|
566
|
-
exports.ssfFormat = ssfFormat;
|
|
739
|
+
}
|
|
567
740
|
/**
|
|
568
741
|
* Excel's legacy fixed 56-color palette used by `[ColorN]` directives
|
|
569
742
|
* inside number format patterns (1-indexed). This palette is INDEPENDENT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../array.ts","../../cell-data-helpers.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","../../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"}
|
|
@@ -39,11 +39,17 @@ export declare const getExtendedValueError: (extValue?: Record<string, any> | nu
|
|
|
39
39
|
* state hooks' row auto-height so both agree on which cells wrap.
|
|
40
40
|
*/
|
|
41
41
|
export declare const alignmentImpliesWrap: (align: HorizontalAlign | string | null | undefined) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Excel's vertical `justify` and `distributed` wrap the text too: the lines
|
|
44
|
+
* are spread over the cell height, so there must be lines to spread.
|
|
45
|
+
*/
|
|
46
|
+
export declare const verticalAlignmentImpliesWrap: (align: string | null | undefined) => boolean;
|
|
42
47
|
/**
|
|
43
48
|
* Whether a cell format wraps its text — explicit `wrapStrategy: "wrap"` or
|
|
44
|
-
* an alignment that wraps implicitly ({@link alignmentImpliesWrap}
|
|
49
|
+
* an alignment that wraps implicitly ({@link alignmentImpliesWrap},
|
|
50
|
+
* {@link verticalAlignmentImpliesWrap}).
|
|
45
51
|
*/
|
|
46
|
-
export declare const cellFormatWrapsText: (format: Pick<CellFormat, "wrapStrategy" | "horizontalAlignment"> | null | undefined) => boolean;
|
|
52
|
+
export declare const cellFormatWrapsText: (format: Pick<CellFormat, "wrapStrategy" | "horizontalAlignment" | "verticalAlignment"> | null | undefined) => boolean;
|
|
47
53
|
export declare const resolveDefaultHorizontalAlignment: ({ errorValue, userEnteredValue, effectiveValue, dataValidation, }: {
|
|
48
54
|
errorValue: unknown;
|
|
49
55
|
userEnteredValue: Record<string, any> | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell-data-helpers.d.ts","sourceRoot":"","sources":["../../cell-data-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACf,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,QAAQ,EACxD,OAAO,CAAC,GAAG,IAAI,KACd,CAAC,CAAC,IAAI,CAER,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,QAAQ,EACtD,OAAO,CAAC,GAAG,IAAI,KACd,CAAC,CAAC,IAAI,CAER,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,QAAQ,EACzD,OAAO,CAAC,GAAG,IAAI,KACd,CAAC,CAAC,IAAI,CAER,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,QAAQ,EACvD,OAAO,CAAC,GAAG,IAAI,KACd,UAAU,GAAG,cAAc,GAAG,IAAI,GAAG,SAEvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,QAAQ,EACtD,OAAO,CAAC,GAAG,IAAI,KACd,MAAM,GAAG,SAAS,GAAG,IAEvB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,UAAU,MAAM,CAAC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