ooxml-core 0.21.2 → 0.22.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/README.md +3 -4
- package/dist/automation/index.cjs +86 -22
- package/dist/automation/index.mjs +86 -22
- package/dist/chart/index.cjs +242 -0
- package/dist/chart/index.d.ts +5 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +227 -1
- package/dist/chart/pie-best-fit.d.ts +51 -0
- package/dist/chart/pie-best-fit.d.ts.map +1 -0
- package/dist/chart/pie-label-collision.d.ts +48 -0
- package/dist/chart/pie-label-collision.d.ts.map +1 -0
- package/dist/chart/radar-geometry.d.ts +19 -0
- package/dist/chart/radar-geometry.d.ts.map +1 -0
- package/dist/chart/treemap-squarify.d.ts +31 -0
- package/dist/chart/treemap-squarify.d.ts.map +1 -0
- package/dist/chart/trendline-equation.d.ts +39 -0
- package/dist/chart/trendline-equation.d.ts.map +1 -0
- package/dist/collab/index.cjs +6 -1
- package/dist/collab/index.mjs +6 -1
- package/dist/color/contrast.d.ts +18 -0
- package/dist/color/contrast.d.ts.map +1 -0
- package/dist/color/index.cjs +33 -0
- package/dist/color/index.d.ts +2 -0
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.mjs +31 -1
- package/dist/color/unit-rgb.d.ts +21 -0
- package/dist/color/unit-rgb.d.ts.map +1 -0
- package/dist/docx/embedded.cjs +1 -1
- package/dist/docx/embedded.mjs +1 -1
- package/dist/docx/index.cjs +1 -1
- package/dist/docx/index.mjs +1 -1
- package/dist/docx/load/index.cjs +1 -1
- package/dist/docx/load/index.mjs +1 -1
- package/dist/geometry/align-distribute.d.ts +145 -0
- package/dist/geometry/align-distribute.d.ts.map +1 -0
- package/dist/geometry/index.cjs +318 -0
- package/dist/geometry/index.d.ts +2 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.mjs +307 -1
- package/dist/geometry/snap-guides.d.ts +125 -0
- package/dist/geometry/snap-guides.d.ts.map +1 -0
- package/dist/index.cjs +665 -0
- package/dist/index.mjs +665 -0
- package/dist/pptx/automation/index.cjs +24 -1
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +24 -1
- package/dist/pptx/chunks/{index-JaNVJ6Tf.d.ts → index-D2y7ehZ5.d.ts} +3 -3
- package/dist/pptx/chunks/{index-JaNVJ6Tf.d.ts.map → index-D2y7ehZ5.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-DHdHU9Qr.d.ts → index-ucqKcqvI.d.ts} +10 -2
- package/dist/pptx/chunks/{index-DHdHU9Qr.d.ts.map → index-ucqKcqvI.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-DUEhSW5Z.d.ts → text-operations-CR3pUJi-.d.ts} +14 -2
- package/dist/pptx/chunks/text-operations-CR3pUJi-.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +23 -0
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +23 -0
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/index.cjs +33 -3
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +33 -3
- package/dist/teams/index.cjs +7 -2
- package/dist/teams/index.mjs +7 -2
- package/dist/text/decimal-tab.d.ts +24 -0
- package/dist/text/decimal-tab.d.ts.map +1 -0
- package/dist/text/index.cjs +72 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +68 -1
- package/dist/text/tab-leader.d.ts +36 -0
- package/dist/text/tab-leader.d.ts.map +1 -0
- package/dist/xlsx/edit/charts.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard-html-parse.d.ts.map +1 -1
- package/dist/xlsx/edit/fill-series.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +85 -21
- package/dist/xlsx/index.mjs +85 -21
- package/dist/xlsx/load/csv.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +17 -8
- package/dist/xlsx/load/index.mjs +17 -8
- package/dist/xlsx/numfmt/input-date.d.ts.map +1 -1
- package/dist/xlsx/ui/grid/cell-paint.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +86 -25
- package/dist/xlsx/ui/index.mjs +86 -25
- package/dist/xlsx/ui/selection.d.ts.map +1 -1
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/pptx/chunks/text-operations-DUEhSW5Z.d.ts.map +0 -1
package/dist/text/index.mjs
CHANGED
|
@@ -114,4 +114,71 @@ function hasDistinctScriptFonts(fonts) {
|
|
|
114
114
|
return Boolean(fonts.eastAsia) && fonts.eastAsia !== base || Boolean(fonts.complexScript) && fonts.complexScript !== base || Boolean(fonts.symbol) && fonts.symbol !== base;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
// text/tab-leader.ts
|
|
118
|
+
function getLeaderCharacter(leader) {
|
|
119
|
+
switch (leader) {
|
|
120
|
+
case "dot":
|
|
121
|
+
return ".";
|
|
122
|
+
case "hyphen":
|
|
123
|
+
return "-";
|
|
124
|
+
case "underscore":
|
|
125
|
+
return "_";
|
|
126
|
+
case "heavy":
|
|
127
|
+
return "\u2501";
|
|
128
|
+
// box-drawing heavy horizontal
|
|
129
|
+
case "middleDot":
|
|
130
|
+
return "\xB7";
|
|
131
|
+
// middle dot
|
|
132
|
+
default:
|
|
133
|
+
return void 0;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function getLeaderStyles(widthPx, color) {
|
|
137
|
+
if (widthPx <= 0) {
|
|
138
|
+
return void 0;
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
display: "inline-block",
|
|
142
|
+
width: `${widthPx}px`,
|
|
143
|
+
overflow: "hidden",
|
|
144
|
+
whiteSpace: "pre",
|
|
145
|
+
verticalAlign: "baseline",
|
|
146
|
+
...color ? { color } : {}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function buildLeaderString(leader, widthPx, fontSizePx = 16) {
|
|
150
|
+
const char = getLeaderCharacter(leader);
|
|
151
|
+
if (!char || widthPx <= 0) {
|
|
152
|
+
return " ";
|
|
153
|
+
}
|
|
154
|
+
const charWidth = Math.max(1, fontSizePx * 0.6);
|
|
155
|
+
const count = Math.max(1, Math.ceil(widthPx / charWidth));
|
|
156
|
+
return char.repeat(count);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// text/decimal-tab.ts
|
|
160
|
+
function decimalSeparatorForLanguage(language) {
|
|
161
|
+
if (!language) {
|
|
162
|
+
return ".";
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
const part = new Intl.NumberFormat(language).formatToParts(1.5).find((p) => p.type === "decimal");
|
|
166
|
+
return part?.value ?? ".";
|
|
167
|
+
} catch {
|
|
168
|
+
return ".";
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function decimalAnchorIndex(text, separator) {
|
|
172
|
+
const first = text.search(/[0-9]/u);
|
|
173
|
+
if (first < 0) {
|
|
174
|
+
return text.length;
|
|
175
|
+
}
|
|
176
|
+
let end = first;
|
|
177
|
+
while (end < text.length && /[0-9.,]/u.test(text.charAt(end))) {
|
|
178
|
+
end++;
|
|
179
|
+
}
|
|
180
|
+
const sep = text.slice(first, end).indexOf(separator);
|
|
181
|
+
return sep >= 0 ? first + sep : end;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export { buildLeaderString, decimalAnchorIndex, decimalSeparatorForLanguage, detectFontScript, getLeaderCharacter, getLeaderStyles, hasDistinctScriptFonts, resolveFontForScript, segmentByScript };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tab stop leader character rendering utilities.
|
|
3
|
+
*
|
|
4
|
+
* OOXML tab stops can specify a leader character that fills the gap between the
|
|
5
|
+
* preceding text and the tab stop position. This module provides the mapping
|
|
6
|
+
* from OOXML leader types to repeated characters and CSS styles for rendering
|
|
7
|
+
* them. Framework-agnostic; each binding maps the returned style map onto its
|
|
8
|
+
* own style binding.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Map an OOXML tab leader type to the character used to fill the tab gap.
|
|
12
|
+
* Returns `undefined` for 'none' or unknown types.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getLeaderCharacter(leader: string | undefined): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Build inline CSS for a tab leader span.
|
|
17
|
+
*
|
|
18
|
+
* The leader span is rendered as an inline-block element that fills the tab gap
|
|
19
|
+
* width with repeated leader characters.
|
|
20
|
+
*
|
|
21
|
+
* @param widthPx - Width of the tab gap in pixels.
|
|
22
|
+
* @param color - Text colour to inherit.
|
|
23
|
+
* @returns CSS properties for the leader span, or undefined if width is non-positive.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getLeaderStyles(widthPx: number, color?: string): Record<string, string | number> | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Generate a string of repeated leader characters sufficient to fill the given
|
|
28
|
+
* pixel width. Assumes ~0.6em per character at the given font size.
|
|
29
|
+
*
|
|
30
|
+
* @param leader - The OOXML leader type.
|
|
31
|
+
* @param widthPx - Width of the tab gap in pixels.
|
|
32
|
+
* @param fontSizePx - Font size in pixels (default 16).
|
|
33
|
+
* @returns The repeated leader string, or a plain tab character if no leader.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildLeaderString(leader: string | undefined, widthPx: number, fontSizePx?: number): string;
|
|
36
|
+
//# sourceMappingURL=tab-leader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab-leader.d.ts","sourceRoot":"","sources":["../../text/tab-leader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAejF;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACZ,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,CAY7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,MAAW,GACrB,MAAM,CAUR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/charts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,cAAc,CAAC;AAEzD,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAU7D,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;AAEzE,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,MAAM,CAc9F;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/charts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,cAAc,CAAC;AAEzD,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAU7D,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;AAEzE,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,MAAM,CAc9F;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAmB/F;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAS5E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACvB,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,aAAa,EACrB,IAAI,CAAC,EAAE,MAAM,GACX,WAAW,CAwBb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard-html-parse.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/clipboard-html-parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,SAAS,EAET,KAAK,EAGL,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAuBhE,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAkB7D;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;
|
|
1
|
+
{"version":3,"file":"clipboard-html-parse.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/clipboard-html-parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,SAAS,EAET,KAAK,EAGL,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAuBhE,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAkB7D;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AA2ID;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,cAAc,GAAG,SAAS,CAoDxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill-series.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/fill-series.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI7D,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;AAIxD,eAAO,MAAM,GAAG,MAAO,MAAM,KAAK,MAAM,KAAG,MAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"fill-series.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/fill-series.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI7D,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;AAIxD,eAAO,MAAM,GAAG,MAAO,MAAM,KAAK,MAAM,KAAG,MAA2B,CAAC;AA0JvE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,eAAe,CAa5F"}
|
package/dist/xlsx/index.cjs
CHANGED
|
@@ -1804,7 +1804,8 @@ function parseDay(text2) {
|
|
|
1804
1804
|
function parseDateTimeInput(text2, date1904) {
|
|
1805
1805
|
const time = parseTime(text2);
|
|
1806
1806
|
if (time) return { value: time.fraction, numFmt: time.format };
|
|
1807
|
-
const
|
|
1807
|
+
const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text2);
|
|
1808
|
+
const split = tail && tail.index > 0 ? [tail[0], text2.slice(0, tail.index), tail[1]] : null;
|
|
1808
1809
|
const dayText = split ? split[1] ?? "" : text2;
|
|
1809
1810
|
const day = parseDay(dayText);
|
|
1810
1811
|
if (!day) return void 0;
|
|
@@ -1849,10 +1850,10 @@ function parseNumberInput(text2) {
|
|
|
1849
1850
|
s = s.slice(lead[0].length);
|
|
1850
1851
|
if (!sign()) return void 0;
|
|
1851
1852
|
} else {
|
|
1852
|
-
const
|
|
1853
|
-
if (
|
|
1854
|
-
currency =
|
|
1855
|
-
s = s.slice(0, -
|
|
1853
|
+
const last = s.slice(-1);
|
|
1854
|
+
if (last === "\u20AC" || last === "\xA3") {
|
|
1855
|
+
currency = last;
|
|
1856
|
+
s = s.slice(0, -1).trimEnd();
|
|
1856
1857
|
}
|
|
1857
1858
|
}
|
|
1858
1859
|
let percent = false;
|
|
@@ -17173,7 +17174,10 @@ function writeDrawing(writer, partName, objects, sourceDrawing) {
|
|
|
17173
17174
|
let nextId = Math.max(
|
|
17174
17175
|
1,
|
|
17175
17176
|
...kept.flatMap(
|
|
17176
|
-
(xml) => [...xml.matchAll(/cNvPr[^>]
|
|
17177
|
+
(xml) => [...xml.matchAll(/cNvPr([^>]*)/g)].flatMap((m) => {
|
|
17178
|
+
const id = /\sid="(\d+)"/.exec(m[1] ?? "");
|
|
17179
|
+
return id ? [Number(id[1])] : [];
|
|
17180
|
+
})
|
|
17177
17181
|
)
|
|
17178
17182
|
) + 1;
|
|
17179
17183
|
let body = "";
|
|
@@ -19366,7 +19370,7 @@ async function saveXlsx(workbook) {
|
|
|
19366
19370
|
|
|
19367
19371
|
// xlsx/edit/context.ts
|
|
19368
19372
|
function sheetAt(workbook, index2) {
|
|
19369
|
-
const sheet = workbook.sheets[index2];
|
|
19373
|
+
const sheet = Number.isInteger(index2) ? workbook.sheets[index2] : void 0;
|
|
19370
19374
|
if (!sheet) throw new RangeError(`No sheet at index ${index2}`);
|
|
19371
19375
|
return sheet;
|
|
19372
19376
|
}
|
|
@@ -20511,7 +20515,9 @@ function decodeEntities(text2) {
|
|
|
20511
20515
|
}
|
|
20512
20516
|
function parseAttributes(text2) {
|
|
20513
20517
|
const attrs2 = /* @__PURE__ */ new Map();
|
|
20514
|
-
for (const m of text2.matchAll(
|
|
20518
|
+
for (const m of text2.matchAll(
|
|
20519
|
+
/([\w:-]{1,64})\s{0,16}=\s{0,16}(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g
|
|
20520
|
+
))
|
|
20515
20521
|
attrs2.set((m[1] ?? "").toLowerCase(), decodeEntities(m[2] ?? m[3] ?? m[4] ?? ""));
|
|
20516
20522
|
return attrs2;
|
|
20517
20523
|
}
|
|
@@ -20566,9 +20572,56 @@ function stylePatchFromCss(css, inner2) {
|
|
|
20566
20572
|
if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
|
|
20567
20573
|
return patch;
|
|
20568
20574
|
}
|
|
20575
|
+
function removeComments(text2) {
|
|
20576
|
+
let out = "";
|
|
20577
|
+
let from = 0;
|
|
20578
|
+
for (; ; ) {
|
|
20579
|
+
const open = text2.indexOf("<!--", from);
|
|
20580
|
+
const close = open < 0 ? -1 : text2.indexOf("-->", open + 4);
|
|
20581
|
+
if (close < 0) return out + text2.slice(from);
|
|
20582
|
+
out += text2.slice(from, open);
|
|
20583
|
+
from = close + 3;
|
|
20584
|
+
}
|
|
20585
|
+
}
|
|
20586
|
+
function removeTags(text2) {
|
|
20587
|
+
let out = "";
|
|
20588
|
+
let i = 0;
|
|
20589
|
+
while (i < text2.length) {
|
|
20590
|
+
const ch = text2[i];
|
|
20591
|
+
if (ch === "<") {
|
|
20592
|
+
let j = i + 1;
|
|
20593
|
+
while (j < text2.length && text2[j] !== "<" && text2[j] !== ">") j++;
|
|
20594
|
+
if (text2[j] === ">") {
|
|
20595
|
+
i = j + 1;
|
|
20596
|
+
continue;
|
|
20597
|
+
}
|
|
20598
|
+
}
|
|
20599
|
+
out += ch;
|
|
20600
|
+
i++;
|
|
20601
|
+
}
|
|
20602
|
+
return out;
|
|
20603
|
+
}
|
|
20604
|
+
function stripTags(markup) {
|
|
20605
|
+
let previous;
|
|
20606
|
+
let text2 = markup;
|
|
20607
|
+
do {
|
|
20608
|
+
previous = text2;
|
|
20609
|
+
text2 = removeTags(removeComments(text2));
|
|
20610
|
+
} while (text2 !== previous);
|
|
20611
|
+
return removeAll(text2, ["<!--", "-->"]);
|
|
20612
|
+
}
|
|
20613
|
+
function removeAll(text2, tokens2) {
|
|
20614
|
+
let current = text2;
|
|
20615
|
+
let previous;
|
|
20616
|
+
do {
|
|
20617
|
+
previous = current;
|
|
20618
|
+
for (const token of tokens2) current = current.split(token).join("");
|
|
20619
|
+
} while (current !== previous);
|
|
20620
|
+
return current;
|
|
20621
|
+
}
|
|
20569
20622
|
function cellText(inner2) {
|
|
20570
20623
|
return decodeEntities(
|
|
20571
|
-
inner2.replace(
|
|
20624
|
+
stripTags(inner2.replace(/<br\s*\/?>/gi, "\0")).replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
|
|
20572
20625
|
).replace(/ /g, " ").trim();
|
|
20573
20626
|
}
|
|
20574
20627
|
function parseHtmlTable(html, base) {
|
|
@@ -20576,7 +20629,9 @@ function parseHtmlTable(html, base) {
|
|
|
20576
20629
|
if (table2 === void 0) return void 0;
|
|
20577
20630
|
const classes = /* @__PURE__ */ new Map();
|
|
20578
20631
|
for (const block of html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))
|
|
20579
|
-
for (const rule of (block[1] ?? ""
|
|
20632
|
+
for (const rule of removeAll(block[1] ?? "", ["<!--", "-->"]).matchAll(
|
|
20633
|
+
/\.([\w-]+)\s*\{([^}]*)\}/g
|
|
20634
|
+
))
|
|
20580
20635
|
classes.set(rule[1] ?? "", rule[2] ?? "");
|
|
20581
20636
|
const grid = [];
|
|
20582
20637
|
const taken = /* @__PURE__ */ new Set();
|
|
@@ -20746,7 +20801,15 @@ function linearTrend(values2) {
|
|
|
20746
20801
|
const slope = den ? num3 / den : 0;
|
|
20747
20802
|
return (k) => Number((meanY + slope * (k - meanX)).toPrecision(15));
|
|
20748
20803
|
}
|
|
20749
|
-
var
|
|
20804
|
+
var isDigit3 = (ch) => ch !== void 0 && ch >= "0" && ch <= "9";
|
|
20805
|
+
function matchTextNumber(text2) {
|
|
20806
|
+
let end = text2.length;
|
|
20807
|
+
while (end > 0 && !isDigit3(text2[end - 1])) end--;
|
|
20808
|
+
if (end === 0) return null;
|
|
20809
|
+
let start = end;
|
|
20810
|
+
while (start > 0 && isDigit3(text2[start - 1])) start--;
|
|
20811
|
+
return [text2, text2.slice(0, start), text2.slice(start, end), text2.slice(end)];
|
|
20812
|
+
}
|
|
20750
20813
|
var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
|
|
20751
20814
|
function textSeries(texts) {
|
|
20752
20815
|
const lists = texts.map(listMatch);
|
|
@@ -20768,7 +20831,7 @@ function textSeries(texts) {
|
|
|
20768
20831
|
const step2 = q1 ? mod(Number(q1[3]) - 1 - start, 4) || 1 : 1;
|
|
20769
20832
|
return (k) => ({ kind: "value", value: `${q0[1]}${q0[2]}${mod(start + step2 * k, 4) + 1}` });
|
|
20770
20833
|
}
|
|
20771
|
-
const parts = texts.map(
|
|
20834
|
+
const parts = texts.map(matchTextNumber);
|
|
20772
20835
|
const p0 = parts[0];
|
|
20773
20836
|
if (!p0 || !parts.every((p) => p && p[1] === p0[1] && p[3] === p0[3])) return void 0;
|
|
20774
20837
|
const numbers3 = parts.map((p) => Number(p?.[2]));
|
|
@@ -21365,7 +21428,7 @@ function setAutoFilter(ctx, s, range) {
|
|
|
21365
21428
|
const old = sheet.autoFilter;
|
|
21366
21429
|
if (old) applyFilter(ctx, sheet, { range: old.range });
|
|
21367
21430
|
if (r) sheet.autoFilter = { range: r };
|
|
21368
|
-
else
|
|
21431
|
+
else Reflect.deleteProperty(sheet, "autoFilter");
|
|
21369
21432
|
},
|
|
21370
21433
|
{ sheet: s, structural: true }
|
|
21371
21434
|
);
|
|
@@ -22209,9 +22272,10 @@ function updateChart(ctx, s, index2, patch) {
|
|
|
22209
22272
|
() => {
|
|
22210
22273
|
const live = sheet.drawings[index2];
|
|
22211
22274
|
for (const [key, value] of Object.entries(structuredClone(patch))) {
|
|
22212
|
-
if (key === "kind" || key === "partName") continue;
|
|
22213
|
-
if (
|
|
22214
|
-
|
|
22275
|
+
if (key === "kind" || key === "partName" || key === "__proto__") continue;
|
|
22276
|
+
if (key === "constructor" || key === "prototype") continue;
|
|
22277
|
+
if (value === void 0) Reflect.deleteProperty(live, key);
|
|
22278
|
+
else Reflect.set(live, key, value);
|
|
22215
22279
|
}
|
|
22216
22280
|
},
|
|
22217
22281
|
{ sheet: s }
|
|
@@ -22720,7 +22784,7 @@ function setDefaultColumnWidth(ctx, s, width) {
|
|
|
22720
22784
|
"format",
|
|
22721
22785
|
[{ kind: "sheet", sheet: s }],
|
|
22722
22786
|
() => {
|
|
22723
|
-
if (width === void 0)
|
|
22787
|
+
if (width === void 0) Reflect.deleteProperty(sheet, "defaultColWidth");
|
|
22724
22788
|
else sheet.defaultColWidth = width;
|
|
22725
22789
|
},
|
|
22726
22790
|
{ sheet: s, structural: true }
|
|
@@ -22742,7 +22806,7 @@ function setPageSetup(ctx, s, patch) {
|
|
|
22742
22806
|
() => {
|
|
22743
22807
|
const next = compact2({ ...sheet.pageSetup, ...structuredClone(patch) });
|
|
22744
22808
|
if (Object.keys(next).length) sheet.pageSetup = next;
|
|
22745
|
-
else
|
|
22809
|
+
else Reflect.deleteProperty(sheet, "pageSetup");
|
|
22746
22810
|
},
|
|
22747
22811
|
{ sheet: s }
|
|
22748
22812
|
);
|
|
@@ -22758,7 +22822,7 @@ function setPrintOptions(ctx, s, patch) {
|
|
|
22758
22822
|
for (const key of Object.keys(next))
|
|
22759
22823
|
if (!next[key]) delete next[key];
|
|
22760
22824
|
if (Object.keys(next).length) sheet.printOptions = next;
|
|
22761
|
-
else
|
|
22825
|
+
else Reflect.deleteProperty(sheet, "printOptions");
|
|
22762
22826
|
sheet.preserved.delete("printOptions");
|
|
22763
22827
|
},
|
|
22764
22828
|
{ sheet: s }
|
|
@@ -23389,7 +23453,7 @@ function setSheetProtection(ctx, s, protection, password) {
|
|
|
23389
23453
|
[{ kind: "sheet", sheet: s }],
|
|
23390
23454
|
() => {
|
|
23391
23455
|
if (!protection) {
|
|
23392
|
-
|
|
23456
|
+
Reflect.deleteProperty(sheet, "protection");
|
|
23393
23457
|
return;
|
|
23394
23458
|
}
|
|
23395
23459
|
const next = structuredClone(protection);
|
|
@@ -24405,7 +24469,7 @@ function setTabColor(ctx, index2, color) {
|
|
|
24405
24469
|
[{ kind: "sheet", sheet: index2 }],
|
|
24406
24470
|
() => {
|
|
24407
24471
|
if (color) sheet.tabColor = { ...color };
|
|
24408
|
-
else
|
|
24472
|
+
else Reflect.deleteProperty(sheet, "tabColor");
|
|
24409
24473
|
},
|
|
24410
24474
|
{ sheet: index2 }
|
|
24411
24475
|
);
|
package/dist/xlsx/index.mjs
CHANGED
|
@@ -1798,7 +1798,8 @@ function parseDay(text2) {
|
|
|
1798
1798
|
function parseDateTimeInput(text2, date1904) {
|
|
1799
1799
|
const time = parseTime(text2);
|
|
1800
1800
|
if (time) return { value: time.fraction, numFmt: time.format };
|
|
1801
|
-
const
|
|
1801
|
+
const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text2);
|
|
1802
|
+
const split = tail && tail.index > 0 ? [tail[0], text2.slice(0, tail.index), tail[1]] : null;
|
|
1802
1803
|
const dayText = split ? split[1] ?? "" : text2;
|
|
1803
1804
|
const day = parseDay(dayText);
|
|
1804
1805
|
if (!day) return void 0;
|
|
@@ -1843,10 +1844,10 @@ function parseNumberInput(text2) {
|
|
|
1843
1844
|
s = s.slice(lead[0].length);
|
|
1844
1845
|
if (!sign()) return void 0;
|
|
1845
1846
|
} else {
|
|
1846
|
-
const
|
|
1847
|
-
if (
|
|
1848
|
-
currency =
|
|
1849
|
-
s = s.slice(0, -
|
|
1847
|
+
const last = s.slice(-1);
|
|
1848
|
+
if (last === "\u20AC" || last === "\xA3") {
|
|
1849
|
+
currency = last;
|
|
1850
|
+
s = s.slice(0, -1).trimEnd();
|
|
1850
1851
|
}
|
|
1851
1852
|
}
|
|
1852
1853
|
let percent = false;
|
|
@@ -17167,7 +17168,10 @@ function writeDrawing(writer, partName, objects, sourceDrawing) {
|
|
|
17167
17168
|
let nextId = Math.max(
|
|
17168
17169
|
1,
|
|
17169
17170
|
...kept.flatMap(
|
|
17170
|
-
(xml) => [...xml.matchAll(/cNvPr[^>]
|
|
17171
|
+
(xml) => [...xml.matchAll(/cNvPr([^>]*)/g)].flatMap((m) => {
|
|
17172
|
+
const id = /\sid="(\d+)"/.exec(m[1] ?? "");
|
|
17173
|
+
return id ? [Number(id[1])] : [];
|
|
17174
|
+
})
|
|
17171
17175
|
)
|
|
17172
17176
|
) + 1;
|
|
17173
17177
|
let body = "";
|
|
@@ -19360,7 +19364,7 @@ async function saveXlsx(workbook) {
|
|
|
19360
19364
|
|
|
19361
19365
|
// xlsx/edit/context.ts
|
|
19362
19366
|
function sheetAt(workbook, index2) {
|
|
19363
|
-
const sheet = workbook.sheets[index2];
|
|
19367
|
+
const sheet = Number.isInteger(index2) ? workbook.sheets[index2] : void 0;
|
|
19364
19368
|
if (!sheet) throw new RangeError(`No sheet at index ${index2}`);
|
|
19365
19369
|
return sheet;
|
|
19366
19370
|
}
|
|
@@ -20505,7 +20509,9 @@ function decodeEntities(text2) {
|
|
|
20505
20509
|
}
|
|
20506
20510
|
function parseAttributes(text2) {
|
|
20507
20511
|
const attrs2 = /* @__PURE__ */ new Map();
|
|
20508
|
-
for (const m of text2.matchAll(
|
|
20512
|
+
for (const m of text2.matchAll(
|
|
20513
|
+
/([\w:-]{1,64})\s{0,16}=\s{0,16}(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g
|
|
20514
|
+
))
|
|
20509
20515
|
attrs2.set((m[1] ?? "").toLowerCase(), decodeEntities(m[2] ?? m[3] ?? m[4] ?? ""));
|
|
20510
20516
|
return attrs2;
|
|
20511
20517
|
}
|
|
@@ -20560,9 +20566,56 @@ function stylePatchFromCss(css, inner2) {
|
|
|
20560
20566
|
if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
|
|
20561
20567
|
return patch;
|
|
20562
20568
|
}
|
|
20569
|
+
function removeComments(text2) {
|
|
20570
|
+
let out = "";
|
|
20571
|
+
let from = 0;
|
|
20572
|
+
for (; ; ) {
|
|
20573
|
+
const open = text2.indexOf("<!--", from);
|
|
20574
|
+
const close = open < 0 ? -1 : text2.indexOf("-->", open + 4);
|
|
20575
|
+
if (close < 0) return out + text2.slice(from);
|
|
20576
|
+
out += text2.slice(from, open);
|
|
20577
|
+
from = close + 3;
|
|
20578
|
+
}
|
|
20579
|
+
}
|
|
20580
|
+
function removeTags(text2) {
|
|
20581
|
+
let out = "";
|
|
20582
|
+
let i = 0;
|
|
20583
|
+
while (i < text2.length) {
|
|
20584
|
+
const ch = text2[i];
|
|
20585
|
+
if (ch === "<") {
|
|
20586
|
+
let j = i + 1;
|
|
20587
|
+
while (j < text2.length && text2[j] !== "<" && text2[j] !== ">") j++;
|
|
20588
|
+
if (text2[j] === ">") {
|
|
20589
|
+
i = j + 1;
|
|
20590
|
+
continue;
|
|
20591
|
+
}
|
|
20592
|
+
}
|
|
20593
|
+
out += ch;
|
|
20594
|
+
i++;
|
|
20595
|
+
}
|
|
20596
|
+
return out;
|
|
20597
|
+
}
|
|
20598
|
+
function stripTags(markup) {
|
|
20599
|
+
let previous;
|
|
20600
|
+
let text2 = markup;
|
|
20601
|
+
do {
|
|
20602
|
+
previous = text2;
|
|
20603
|
+
text2 = removeTags(removeComments(text2));
|
|
20604
|
+
} while (text2 !== previous);
|
|
20605
|
+
return removeAll(text2, ["<!--", "-->"]);
|
|
20606
|
+
}
|
|
20607
|
+
function removeAll(text2, tokens2) {
|
|
20608
|
+
let current = text2;
|
|
20609
|
+
let previous;
|
|
20610
|
+
do {
|
|
20611
|
+
previous = current;
|
|
20612
|
+
for (const token of tokens2) current = current.split(token).join("");
|
|
20613
|
+
} while (current !== previous);
|
|
20614
|
+
return current;
|
|
20615
|
+
}
|
|
20563
20616
|
function cellText(inner2) {
|
|
20564
20617
|
return decodeEntities(
|
|
20565
|
-
inner2.replace(
|
|
20618
|
+
stripTags(inner2.replace(/<br\s*\/?>/gi, "\0")).replace(/\s+/g, " ").replace(/ ?\u0000 ?/g, "\n")
|
|
20566
20619
|
).replace(/ /g, " ").trim();
|
|
20567
20620
|
}
|
|
20568
20621
|
function parseHtmlTable(html, base) {
|
|
@@ -20570,7 +20623,9 @@ function parseHtmlTable(html, base) {
|
|
|
20570
20623
|
if (table2 === void 0) return void 0;
|
|
20571
20624
|
const classes = /* @__PURE__ */ new Map();
|
|
20572
20625
|
for (const block of html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))
|
|
20573
|
-
for (const rule of (block[1] ?? ""
|
|
20626
|
+
for (const rule of removeAll(block[1] ?? "", ["<!--", "-->"]).matchAll(
|
|
20627
|
+
/\.([\w-]+)\s*\{([^}]*)\}/g
|
|
20628
|
+
))
|
|
20574
20629
|
classes.set(rule[1] ?? "", rule[2] ?? "");
|
|
20575
20630
|
const grid = [];
|
|
20576
20631
|
const taken = /* @__PURE__ */ new Set();
|
|
@@ -20740,7 +20795,15 @@ function linearTrend(values2) {
|
|
|
20740
20795
|
const slope = den ? num3 / den : 0;
|
|
20741
20796
|
return (k) => Number((meanY + slope * (k - meanX)).toPrecision(15));
|
|
20742
20797
|
}
|
|
20743
|
-
var
|
|
20798
|
+
var isDigit3 = (ch) => ch !== void 0 && ch >= "0" && ch <= "9";
|
|
20799
|
+
function matchTextNumber(text2) {
|
|
20800
|
+
let end = text2.length;
|
|
20801
|
+
while (end > 0 && !isDigit3(text2[end - 1])) end--;
|
|
20802
|
+
if (end === 0) return null;
|
|
20803
|
+
let start = end;
|
|
20804
|
+
while (start > 0 && isDigit3(text2[start - 1])) start--;
|
|
20805
|
+
return [text2, text2.slice(0, start), text2.slice(start, end), text2.slice(end)];
|
|
20806
|
+
}
|
|
20744
20807
|
var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
|
|
20745
20808
|
function textSeries(texts) {
|
|
20746
20809
|
const lists = texts.map(listMatch);
|
|
@@ -20762,7 +20825,7 @@ function textSeries(texts) {
|
|
|
20762
20825
|
const step2 = q1 ? mod(Number(q1[3]) - 1 - start, 4) || 1 : 1;
|
|
20763
20826
|
return (k) => ({ kind: "value", value: `${q0[1]}${q0[2]}${mod(start + step2 * k, 4) + 1}` });
|
|
20764
20827
|
}
|
|
20765
|
-
const parts = texts.map(
|
|
20828
|
+
const parts = texts.map(matchTextNumber);
|
|
20766
20829
|
const p0 = parts[0];
|
|
20767
20830
|
if (!p0 || !parts.every((p) => p && p[1] === p0[1] && p[3] === p0[3])) return void 0;
|
|
20768
20831
|
const numbers3 = parts.map((p) => Number(p?.[2]));
|
|
@@ -21359,7 +21422,7 @@ function setAutoFilter(ctx, s, range) {
|
|
|
21359
21422
|
const old = sheet.autoFilter;
|
|
21360
21423
|
if (old) applyFilter(ctx, sheet, { range: old.range });
|
|
21361
21424
|
if (r) sheet.autoFilter = { range: r };
|
|
21362
|
-
else
|
|
21425
|
+
else Reflect.deleteProperty(sheet, "autoFilter");
|
|
21363
21426
|
},
|
|
21364
21427
|
{ sheet: s, structural: true }
|
|
21365
21428
|
);
|
|
@@ -22203,9 +22266,10 @@ function updateChart(ctx, s, index2, patch) {
|
|
|
22203
22266
|
() => {
|
|
22204
22267
|
const live = sheet.drawings[index2];
|
|
22205
22268
|
for (const [key, value] of Object.entries(structuredClone(patch))) {
|
|
22206
|
-
if (key === "kind" || key === "partName") continue;
|
|
22207
|
-
if (
|
|
22208
|
-
|
|
22269
|
+
if (key === "kind" || key === "partName" || key === "__proto__") continue;
|
|
22270
|
+
if (key === "constructor" || key === "prototype") continue;
|
|
22271
|
+
if (value === void 0) Reflect.deleteProperty(live, key);
|
|
22272
|
+
else Reflect.set(live, key, value);
|
|
22209
22273
|
}
|
|
22210
22274
|
},
|
|
22211
22275
|
{ sheet: s }
|
|
@@ -22714,7 +22778,7 @@ function setDefaultColumnWidth(ctx, s, width) {
|
|
|
22714
22778
|
"format",
|
|
22715
22779
|
[{ kind: "sheet", sheet: s }],
|
|
22716
22780
|
() => {
|
|
22717
|
-
if (width === void 0)
|
|
22781
|
+
if (width === void 0) Reflect.deleteProperty(sheet, "defaultColWidth");
|
|
22718
22782
|
else sheet.defaultColWidth = width;
|
|
22719
22783
|
},
|
|
22720
22784
|
{ sheet: s, structural: true }
|
|
@@ -22736,7 +22800,7 @@ function setPageSetup(ctx, s, patch) {
|
|
|
22736
22800
|
() => {
|
|
22737
22801
|
const next = compact2({ ...sheet.pageSetup, ...structuredClone(patch) });
|
|
22738
22802
|
if (Object.keys(next).length) sheet.pageSetup = next;
|
|
22739
|
-
else
|
|
22803
|
+
else Reflect.deleteProperty(sheet, "pageSetup");
|
|
22740
22804
|
},
|
|
22741
22805
|
{ sheet: s }
|
|
22742
22806
|
);
|
|
@@ -22752,7 +22816,7 @@ function setPrintOptions(ctx, s, patch) {
|
|
|
22752
22816
|
for (const key of Object.keys(next))
|
|
22753
22817
|
if (!next[key]) delete next[key];
|
|
22754
22818
|
if (Object.keys(next).length) sheet.printOptions = next;
|
|
22755
|
-
else
|
|
22819
|
+
else Reflect.deleteProperty(sheet, "printOptions");
|
|
22756
22820
|
sheet.preserved.delete("printOptions");
|
|
22757
22821
|
},
|
|
22758
22822
|
{ sheet: s }
|
|
@@ -23383,7 +23447,7 @@ function setSheetProtection(ctx, s, protection, password) {
|
|
|
23383
23447
|
[{ kind: "sheet", sheet: s }],
|
|
23384
23448
|
() => {
|
|
23385
23449
|
if (!protection) {
|
|
23386
|
-
|
|
23450
|
+
Reflect.deleteProperty(sheet, "protection");
|
|
23387
23451
|
return;
|
|
23388
23452
|
}
|
|
23389
23453
|
const next = structuredClone(protection);
|
|
@@ -24399,7 +24463,7 @@ function setTabColor(ctx, index2, color) {
|
|
|
24399
24463
|
[{ kind: "sheet", sheet: index2 }],
|
|
24400
24464
|
() => {
|
|
24401
24465
|
if (color) sheet.tabColor = { ...color };
|
|
24402
|
-
else
|
|
24466
|
+
else Reflect.deleteProperty(sheet, "tabColor");
|
|
24403
24467
|
},
|
|
24404
24468
|
{ sheet: index2 }
|
|
24405
24469
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../xlsx/load/csv.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKlD,MAAM,WAAW,UAAU;IAC1B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAyBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAepD;AAKD,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,MAAM,EAAE,EAAE,CA4C5E;AAKD,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../xlsx/load/csv.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKlD,MAAM,WAAW,UAAU;IAC1B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAyBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAepD;AAKD,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,MAAM,EAAE,EAAE,CA4C5E;AAKD,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAU1E;AAED,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,QAAQ,CAmCtF;AAKD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IAClD;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAMD;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,eAAoB,GAC3B,MAAM,CAwBR"}
|
package/dist/xlsx/load/index.cjs
CHANGED
|
@@ -6823,7 +6823,10 @@ function writeDrawing(writer, partName, objects, sourceDrawing) {
|
|
|
6823
6823
|
let nextId = Math.max(
|
|
6824
6824
|
1,
|
|
6825
6825
|
...kept.flatMap(
|
|
6826
|
-
(xml) => [...xml.matchAll(/cNvPr[^>]
|
|
6826
|
+
(xml) => [...xml.matchAll(/cNvPr([^>]*)/g)].flatMap((m) => {
|
|
6827
|
+
const id = /\sid="(\d+)"/.exec(m[1] ?? "");
|
|
6828
|
+
return id ? [Number(id[1])] : [];
|
|
6829
|
+
})
|
|
6827
6830
|
)
|
|
6828
6831
|
) + 1;
|
|
6829
6832
|
let body = "";
|
|
@@ -7806,7 +7809,8 @@ function parseDay(text) {
|
|
|
7806
7809
|
function parseDateTimeInput(text, date1904) {
|
|
7807
7810
|
const time = parseTime(text);
|
|
7808
7811
|
if (time) return { value: time.fraction, numFmt: time.format };
|
|
7809
|
-
const
|
|
7812
|
+
const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text);
|
|
7813
|
+
const split = tail && tail.index > 0 ? [tail[0], text.slice(0, tail.index), tail[1]] : null;
|
|
7810
7814
|
const dayText = split ? split[1] ?? "" : text;
|
|
7811
7815
|
const day = parseDay(dayText);
|
|
7812
7816
|
if (!day) return void 0;
|
|
@@ -7851,10 +7855,10 @@ function parseNumberInput(text) {
|
|
|
7851
7855
|
s = s.slice(lead[0].length);
|
|
7852
7856
|
if (!sign()) return void 0;
|
|
7853
7857
|
} else {
|
|
7854
|
-
const
|
|
7855
|
-
if (
|
|
7856
|
-
currency =
|
|
7857
|
-
s = s.slice(0, -
|
|
7858
|
+
const last = s.slice(-1);
|
|
7859
|
+
if (last === "\u20AC" || last === "\xA3") {
|
|
7860
|
+
currency = last;
|
|
7861
|
+
s = s.slice(0, -1).trimEnd();
|
|
7858
7862
|
}
|
|
7859
7863
|
}
|
|
7860
7864
|
let percent = false;
|
|
@@ -18674,8 +18678,13 @@ function parseCsv(input, options = {}) {
|
|
|
18674
18678
|
var INVALID_SHEET_CHARS = /[\\/?*[\]:]/g;
|
|
18675
18679
|
function sheetNameFromFileName(fileName) {
|
|
18676
18680
|
const base = (fileName ?? "").split(/[\\/]/).pop() ?? "";
|
|
18677
|
-
const
|
|
18678
|
-
const
|
|
18681
|
+
const dot = base.lastIndexOf(".");
|
|
18682
|
+
const stem = (dot < 0 ? base : base.slice(0, dot)).replace(INVALID_SHEET_CHARS, "_");
|
|
18683
|
+
let start = 0;
|
|
18684
|
+
let end = stem.length;
|
|
18685
|
+
while (start < end && stem[start] === "'") start++;
|
|
18686
|
+
while (end > start && stem[end - 1] === "'") end--;
|
|
18687
|
+
const trimmed = stem.slice(start, end).slice(0, 31).trim();
|
|
18679
18688
|
return trimmed && trimmed.toLowerCase() !== "history" ? trimmed : "Sheet1";
|
|
18680
18689
|
}
|
|
18681
18690
|
function csvToWorkbook(text, options = {}) {
|