javascript-excel 2.0.0-alpha.3 → 2.0.0-alpha.4

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/import.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_pipeline = require("./pipeline-Bnf7EU3X.cjs");
2
+ const require_pipeline = require("./pipeline-BV2q-khO.cjs");
3
3
  exports.applyMapping = require_pipeline.applyMapping;
4
4
  exports.coerceColumns = require_pipeline.coerceColumns;
5
5
  exports.detectHeader = require_pipeline.detectHeader;
package/dist/import.js CHANGED
@@ -1 +1 @@
1
- export { i as applyMapping, n as coerceColumns, o as detectHeader, t as importDataset, r as inferColumnTypes, a as mapColumns, s as parseDate, c as parseNumber } from "./pipeline-BAJtzBdW.js";
1
+ export { i as applyMapping, n as coerceColumns, o as detectHeader, t as importDataset, r as inferColumnTypes, a as mapColumns, s as parseDate, c as parseNumber } from "./pipeline-Snu8wBXd.js";
package/dist/index.cjs CHANGED
@@ -10,7 +10,7 @@ const require_numfmt = require("./numfmt-BmEbm78Y.cjs");
10
10
  const require_address = require("./address-DZBHchLv.cjs");
11
11
  // src/index.ts
12
12
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
13
- const VERSION = "2.0.0-alpha.3";
13
+ const VERSION = "2.0.0-alpha.4";
14
14
  exports.BUILTIN_NUM_FMTS = require_numfmt.BUILTIN_NUM_FMTS;
15
15
  exports.CsvError = require_errors.CsvError;
16
16
  exports.EnvironmentError = require_errors.EnvironmentError;
package/dist/index.d.cts CHANGED
@@ -277,5 +277,5 @@ export declare function encodeRange(r: RangeAddress): string;
277
277
  /** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
278
278
  export declare function decodeRange(ref: string): RangeAddress;
279
279
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
280
- export declare const VERSION = "2.0.0-alpha.3";
280
+ export declare const VERSION = "2.0.0-alpha.4";
281
281
  export { type AbortSignalLike, type Alignment, type AutoWidthOptions, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellAddress, type CellErrorValue, type CellInput, type CellTextOptions, type CellType, type CellValue, type Color, type ColorContext, type ColumnDef, type ColumnProps, type ColumnTotal, type ColumnWidth, type Dataset, type DatasetBlock, type DatasetOptions, type DatasetResult, type DateOptions, type DefinedName, type DocProperties, type ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type GroupColumn, type Hyperlink, type LeafColumn, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RangeAddress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetNameProblem, type SheetView, type Style, type Theme, type ToDatasetOptions, type Workbook, type WriteOptions, XLSX_MIME, toBlob, toUint8Array };
package/dist/index.d.ts CHANGED
@@ -277,5 +277,5 @@ export declare function encodeRange(r: RangeAddress): string;
277
277
  /** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
278
278
  export declare function decodeRange(ref: string): RangeAddress;
279
279
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
280
- export declare const VERSION = "2.0.0-alpha.3";
280
+ export declare const VERSION = "2.0.0-alpha.4";
281
281
  export { type AbortSignalLike, type Alignment, type AutoWidthOptions, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellAddress, type CellErrorValue, type CellInput, type CellTextOptions, type CellType, type CellValue, type Color, type ColorContext, type ColumnDef, type ColumnProps, type ColumnTotal, type ColumnWidth, type Dataset, type DatasetBlock, type DatasetOptions, type DatasetResult, type DateOptions, type DefinedName, type DocProperties, type ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type GroupColumn, type Hyperlink, type LeafColumn, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RangeAddress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetNameProblem, type SheetView, type Style, type Theme, type ToDatasetOptions, type Workbook, type WriteOptions, XLSX_MIME, toBlob, toUint8Array };
package/dist/index.js CHANGED
@@ -9,5 +9,5 @@ import { n as isDateFormat, t as BUILTIN_NUM_FMTS } from "./numfmt-DCDrX9P1.js";
9
9
  import { a as decodeRange, c as encodeRange, i as decodeCol, n as MAX_ROWS, o as encodeCell, r as decodeCell, s as encodeCol, t as MAX_COLS } from "./address-DUn7-5OS.js";
10
10
  // src/index.ts
11
11
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
12
- const VERSION = "2.0.0-alpha.3";
12
+ const VERSION = "2.0.0-alpha.4";
13
13
  export { BUILTIN_NUM_FMTS, CsvError, EnvironmentError, ExcelError, FormatError, LimitError, MAX_COLS, MAX_ROWS, VERSION, ValidationError, XLSX_MIME, cellText, dateToSerial, decodeCell, decodeCol, decodeRange, encodeCell, encodeCol, encodeRange, fromDataset, fromDatasets, isDateFormat, isExcelError, mergeStyles, resolveColor, sanitizeSheetName, serialToDate, toBlob, toDataset, toUint8Array, validateSheetName };
@@ -410,6 +410,17 @@ function applyMapping(dataset, mapping, schema) {
410
410
  message: `No column for the required field "${name}".`,
411
411
  severity: "error"
412
412
  });
413
+ columns.push({
414
+ key: name,
415
+ title: "",
416
+ letter: "",
417
+ type: "empty",
418
+ field: name
419
+ });
420
+ plan.push({
421
+ out: name,
422
+ from: null
423
+ });
413
424
  continue;
414
425
  }
415
426
  const c = byKey.get(from);
@@ -426,7 +437,7 @@ function applyMapping(dataset, mapping, schema) {
426
437
  });
427
438
  }
428
439
  if (schema.unmapped === "keep") {
429
- const mapped = new Set(plan.map((p) => p.from));
440
+ const mapped = new Set(plan.map((p) => p.from).filter((f) => f !== null));
430
441
  for (const c of dataset.columns) {
431
442
  if (mapped.has(c.key)) continue;
432
443
  let key = c.key;
@@ -444,12 +455,12 @@ function applyMapping(dataset, mapping, schema) {
444
455
  });
445
456
  }
446
457
  }
447
- const required = fields.filter(([name, spec]) => spec.required && plan.some((p) => p.out === name)).map(([name]) => name);
458
+ const required = fields.filter(([name, spec]) => spec.required && plan.some((p) => p.out === name && p.from !== null)).map(([name]) => name);
448
459
  return {
449
460
  columns,
450
461
  data: dataset.data.map((row, i) => {
451
462
  const out = Object.create(null);
452
- for (const { out: k, from } of plan) out[k] = row[from] ?? null;
463
+ for (const { out: k, from } of plan) out[k] = from === null ? null : row[from] ?? null;
453
464
  for (const name of required) {
454
465
  const v = out[name];
455
466
  if (v === null || v === void 0 || typeof v === "string" && v.trim() === "") {
@@ -410,6 +410,17 @@ function applyMapping(dataset, mapping, schema) {
410
410
  message: `No column for the required field "${name}".`,
411
411
  severity: "error"
412
412
  });
413
+ columns.push({
414
+ key: name,
415
+ title: "",
416
+ letter: "",
417
+ type: "empty",
418
+ field: name
419
+ });
420
+ plan.push({
421
+ out: name,
422
+ from: null
423
+ });
413
424
  continue;
414
425
  }
415
426
  const c = byKey.get(from);
@@ -426,7 +437,7 @@ function applyMapping(dataset, mapping, schema) {
426
437
  });
427
438
  }
428
439
  if (schema.unmapped === "keep") {
429
- const mapped = new Set(plan.map((p) => p.from));
440
+ const mapped = new Set(plan.map((p) => p.from).filter((f) => f !== null));
430
441
  for (const c of dataset.columns) {
431
442
  if (mapped.has(c.key)) continue;
432
443
  let key = c.key;
@@ -444,12 +455,12 @@ function applyMapping(dataset, mapping, schema) {
444
455
  });
445
456
  }
446
457
  }
447
- const required = fields.filter(([name, spec]) => spec.required && plan.some((p) => p.out === name)).map(([name]) => name);
458
+ const required = fields.filter(([name, spec]) => spec.required && plan.some((p) => p.out === name && p.from !== null)).map(([name]) => name);
448
459
  return {
449
460
  columns,
450
461
  data: dataset.data.map((row, i) => {
451
462
  const out = Object.create(null);
452
- for (const { out: k, from } of plan) out[k] = row[from] ?? null;
463
+ for (const { out: k, from } of plan) out[k] = from === null ? null : row[from] ?? null;
453
464
  for (const name of required) {
454
465
  const v = out[name];
455
466
  if (v === null || v === void 0 || typeof v === "string" && v.trim() === "") {
package/dist/worker.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_csv = require("./csv-DyVH9y7S.cjs");
3
3
  const require_errors = require("./errors-DOPrrGS4.cjs");
4
4
  const require_read = require("./read-CZEWV4rK.cjs");
5
- const require_pipeline = require("./pipeline-Bnf7EU3X.cjs");
5
+ const require_pipeline = require("./pipeline-BV2q-khO.cjs");
6
6
  const require_write = require("./write-f9kcYf5K.cjs");
7
7
  // src/worker.ts
8
8
  /** Marks the library's messages, so an app can use the same worker for its own messages too. */
package/dist/worker.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { i as toCsv, r as readCsv } from "./csv-pXfaputs.js";
2
2
  import { a as LimitError, i as FormatError, n as EnvironmentError, o as ValidationError, r as ExcelError, s as isExcelError, t as CsvError } from "./errors-CvGlfw0E.js";
3
3
  import { r as read } from "./read-LWti17lz.js";
4
- import { t as importDataset } from "./pipeline-BAJtzBdW.js";
4
+ import { t as importDataset } from "./pipeline-Snu8wBXd.js";
5
5
  import { r as toUint8Array } from "./write-DjgWy1PK.js";
6
6
  // src/worker.ts
7
7
  /** Marks the library's messages, so an app can use the same worker for its own messages too. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-excel",
3
- "version": "2.0.0-alpha.3",
3
+ "version": "2.0.0-alpha.4",
4
4
  "private": false,
5
5
  "description": "Read and write .xlsx and .csv files in browsers, Web Workers and Node. 2.0 is a from-scratch rewrite in progress.",
6
6
  "keywords": [