@toolbox-web/grid 1.13.0 → 1.14.0
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/all.js +1483 -1403
- package/all.js.map +1 -1
- package/index.js +11 -4
- package/index.js.map +1 -1
- package/lib/core/internal/row-animation.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +1 -1
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +44 -1
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +69 -8
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.d.ts +1 -1
- package/lib/plugins/clipboard/index.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +257 -192
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +31 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +8 -0
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +75 -60
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/context-menu/types.d.ts +7 -0
- package/lib/plugins/context-menu/types.d.ts.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/editors.d.ts +2 -2
- package/lib/plugins/editing/editors.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +420 -381
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +6 -23
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
- package/lib/plugins/export/index.js +75 -66
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.d.ts +1 -1
- package/lib/plugins/filtering/index.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +1 -0
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +118 -87
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pinned-rows/pinned-rows.d.ts +2 -1
- package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/types.d.ts +23 -2
- package/lib/plugins/pinned-rows/types.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +147 -139
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/shared/data-collection.d.ts +33 -0
- package/lib/plugins/shared/data-collection.d.ts.map +1 -0
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +23 -23
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +2 -2
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -5
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/export.umd.js +7 -7
- package/umd/plugins/export.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColumnEditorContext } from '../../core/types';
|
|
2
2
|
/**
|
|
3
3
|
* Event detail for cell value commit.
|
|
4
4
|
*
|
|
@@ -317,29 +317,12 @@ export interface EditingConfig {
|
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
319
|
* Context passed to editor factory functions.
|
|
320
|
+
*
|
|
321
|
+
* Extends the public {@link ColumnEditorContext} with no additional properties.
|
|
322
|
+
* Kept as a separate type for backward compatibility with existing plugin code
|
|
323
|
+
* that imports `EditorContext` from the editing plugin.
|
|
320
324
|
*/
|
|
321
|
-
export
|
|
322
|
-
/** The row data object */
|
|
323
|
-
row: T;
|
|
324
|
-
/** Stable row identifier (from getRowId) */
|
|
325
|
-
rowId: string;
|
|
326
|
-
/** Current cell value */
|
|
327
|
-
value: V;
|
|
328
|
-
/** Field name being edited */
|
|
329
|
-
field: string;
|
|
330
|
-
/** Column configuration */
|
|
331
|
-
column: ColumnConfig<T>;
|
|
332
|
-
/** Call to commit the new value */
|
|
333
|
-
commit: (newValue: V) => void;
|
|
334
|
-
/** Call to cancel editing */
|
|
335
|
-
cancel: () => void;
|
|
336
|
-
/**
|
|
337
|
-
* Update other fields in this row.
|
|
338
|
-
* Useful for editors that affect multiple fields (e.g., address lookup).
|
|
339
|
-
* Changes will be committed with source: 'cascade'.
|
|
340
|
-
*/
|
|
341
|
-
updateRow: (changes: Partial<T>) => void;
|
|
342
|
-
}
|
|
325
|
+
export type EditorContext<T = any, V = unknown> = ColumnEditorContext<T, V>;
|
|
343
326
|
/**
|
|
344
327
|
* Configuration parameters for the built-in number editor.
|
|
345
328
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/editing/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/editing/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAM5D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,OAAO;IAC9C,+DAA+D;IAC/D,GAAG,EAAE,IAAI,CAAC;IACV,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,WAAW,EAAE,IAAI,EAAE,CAAC;IACpB,2BAA2B;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,qDAAqD;IACrD,eAAe,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC5C;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,eAAe,CAAC,IAAI,GAAG,OAAO;IAC7C,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,GAAG,EAAE,IA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4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/export/ExportPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"ExportPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/export/ExportPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG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 1-.5-.5z"/></svg>',
|
|
1
|
+
const m = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', x = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -11,7 +11,7 @@ const m = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
|
|
|
11
11
|
filterActive: m,
|
|
12
12
|
print: "🖨️"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class E {
|
|
15
15
|
/**
|
|
16
16
|
* Plugin dependencies - declare other plugins this one requires.
|
|
17
17
|
*
|
|
@@ -301,7 +301,7 @@ class x {
|
|
|
301
301
|
*/
|
|
302
302
|
get gridIcons() {
|
|
303
303
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
304
|
-
return { ...
|
|
304
|
+
return { ...x, ...e };
|
|
305
305
|
}
|
|
306
306
|
// #region Animation Helpers
|
|
307
307
|
/**
|
|
@@ -377,45 +377,56 @@ class x {
|
|
|
377
377
|
}
|
|
378
378
|
// #endregion
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
|
|
382
|
-
if (
|
|
383
|
-
|
|
384
|
-
|
|
380
|
+
function v(s, e, t = !0) {
|
|
381
|
+
let n = s;
|
|
382
|
+
if (t && (n = n.filter((o) => !o.hidden && !o.field.startsWith("__") && o.meta?.utility !== !0)), e?.length) {
|
|
383
|
+
const o = new Set(e);
|
|
384
|
+
n = n.filter((c) => o.has(c.field));
|
|
385
|
+
}
|
|
386
|
+
return n;
|
|
387
|
+
}
|
|
388
|
+
function b(s, e) {
|
|
389
|
+
return e?.length ? [...e].sort((t, n) => t - n).map((t) => s[t]).filter((t) => t != null) : s;
|
|
390
|
+
}
|
|
391
|
+
function C(s, e = !0) {
|
|
392
|
+
if (s == null) return "";
|
|
393
|
+
if (s instanceof Date) return s.toISOString();
|
|
394
|
+
if (typeof s == "object") return JSON.stringify(s);
|
|
395
|
+
const t = String(s);
|
|
385
396
|
return e && (t.includes(",") || t.includes('"') || t.includes(`
|
|
386
397
|
`) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
|
|
387
398
|
}
|
|
388
|
-
function
|
|
389
|
-
const
|
|
399
|
+
function S(s, e, t, n = {}) {
|
|
400
|
+
const o = n.delimiter ?? ",", c = n.newline ?? `
|
|
390
401
|
`, r = [], i = n.bom ? "\uFEFF" : "";
|
|
391
402
|
if (t.includeHeaders !== !1) {
|
|
392
|
-
const
|
|
393
|
-
const
|
|
394
|
-
return
|
|
403
|
+
const l = e.map((u) => {
|
|
404
|
+
const a = u.header || u.field, d = t.processHeader ? t.processHeader(a, u.field) : a;
|
|
405
|
+
return C(d);
|
|
395
406
|
});
|
|
396
|
-
r.push(
|
|
407
|
+
r.push(l.join(o));
|
|
397
408
|
}
|
|
398
|
-
for (const
|
|
399
|
-
const
|
|
400
|
-
let
|
|
401
|
-
return t.processCell && (
|
|
409
|
+
for (const l of s) {
|
|
410
|
+
const u = e.map((a) => {
|
|
411
|
+
let d = l[a.field];
|
|
412
|
+
return t.processCell && (d = t.processCell(d, a.field, l)), C(d);
|
|
402
413
|
});
|
|
403
|
-
r.push(
|
|
414
|
+
r.push(u.join(o));
|
|
404
415
|
}
|
|
405
|
-
return i + r.join(
|
|
416
|
+
return i + r.join(c);
|
|
406
417
|
}
|
|
407
|
-
function h(
|
|
408
|
-
const t = URL.createObjectURL(
|
|
418
|
+
function h(s, e) {
|
|
419
|
+
const t = URL.createObjectURL(s), n = document.createElement("a");
|
|
409
420
|
n.href = t, n.download = e, n.style.display = "none", document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(t);
|
|
410
421
|
}
|
|
411
|
-
function
|
|
412
|
-
const t = new Blob([
|
|
422
|
+
function y(s, e) {
|
|
423
|
+
const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
|
|
413
424
|
h(t, e);
|
|
414
425
|
}
|
|
415
|
-
function
|
|
416
|
-
return
|
|
426
|
+
function w(s) {
|
|
427
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
417
428
|
}
|
|
418
|
-
function
|
|
429
|
+
function R(s, e, t) {
|
|
419
430
|
let n = `<?xml version="1.0" encoding="UTF-8"?>
|
|
420
431
|
<?mso-application progid="Excel.Sheet"?>
|
|
421
432
|
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
|
@@ -425,20 +436,20 @@ function v(o, e, t) {
|
|
|
425
436
|
if (t.includeHeaders !== !1) {
|
|
426
437
|
n += `
|
|
427
438
|
<Row>`;
|
|
428
|
-
for (const
|
|
429
|
-
const
|
|
430
|
-
n += `<Cell><Data ss:Type="String">${
|
|
439
|
+
for (const o of e) {
|
|
440
|
+
const c = o.header || o.field, r = t.processHeader ? t.processHeader(c, o.field) : c;
|
|
441
|
+
n += `<Cell><Data ss:Type="String">${w(r)}</Data></Cell>`;
|
|
431
442
|
}
|
|
432
443
|
n += "</Row>";
|
|
433
444
|
}
|
|
434
|
-
for (const
|
|
445
|
+
for (const o of s) {
|
|
435
446
|
n += `
|
|
436
447
|
<Row>`;
|
|
437
|
-
for (const
|
|
438
|
-
let r = c
|
|
439
|
-
t.processCell && (r = t.processCell(r,
|
|
440
|
-
let i = "String",
|
|
441
|
-
r == null ?
|
|
448
|
+
for (const c of e) {
|
|
449
|
+
let r = o[c.field];
|
|
450
|
+
t.processCell && (r = t.processCell(r, c.field, o));
|
|
451
|
+
let i = "String", l = "";
|
|
452
|
+
r == null ? l = "" : typeof r == "number" && !isNaN(r) ? (i = "Number", l = String(r)) : r instanceof Date ? (i = "DateTime", l = r.toISOString()) : l = w(String(r)), n += `<Cell><Data ss:Type="${i}">${l}</Data></Cell>`;
|
|
442
453
|
}
|
|
443
454
|
n += "</Row>";
|
|
444
455
|
}
|
|
@@ -447,13 +458,13 @@ function v(o, e, t) {
|
|
|
447
458
|
</Worksheet>
|
|
448
459
|
</Workbook>`, n;
|
|
449
460
|
}
|
|
450
|
-
function
|
|
451
|
-
const t = e.endsWith(".xls") ? e : `${e}.xls`, n = new Blob([
|
|
461
|
+
function I(s, e) {
|
|
462
|
+
const t = e.endsWith(".xls") ? e : `${e}.xls`, n = new Blob([s], {
|
|
452
463
|
type: "application/vnd.ms-excel;charset=utf-8;"
|
|
453
464
|
});
|
|
454
465
|
h(n, t);
|
|
455
466
|
}
|
|
456
|
-
class
|
|
467
|
+
class _ extends E {
|
|
457
468
|
/** @internal */
|
|
458
469
|
name = "export";
|
|
459
470
|
/** @internal */
|
|
@@ -471,7 +482,7 @@ class R extends x {
|
|
|
471
482
|
// #endregion
|
|
472
483
|
// #region Private Methods
|
|
473
484
|
performExport(e, t) {
|
|
474
|
-
const n = this.config,
|
|
485
|
+
const n = this.config, o = {
|
|
475
486
|
format: e,
|
|
476
487
|
fileName: t?.fileName ?? n.fileName ?? "export",
|
|
477
488
|
includeHeaders: t?.includeHeaders ?? n.includeHeaders,
|
|
@@ -479,43 +490,41 @@ class R extends x {
|
|
|
479
490
|
processHeader: t?.processHeader,
|
|
480
491
|
columns: t?.columns,
|
|
481
492
|
rowIndices: t?.rowIndices
|
|
482
|
-
};
|
|
483
|
-
let
|
|
484
|
-
if (
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
t?.rowIndices && (r = t.rowIndices.map((s) => this.rows[s]).filter(Boolean)), this.isExportingFlag = !0;
|
|
494
|
-
let i = c.fileName;
|
|
493
|
+
}, c = v(this.columns, t?.columns, n.onlyVisible);
|
|
494
|
+
let r;
|
|
495
|
+
if (t?.rowIndices)
|
|
496
|
+
r = b(this.rows, t.rowIndices);
|
|
497
|
+
else if (n.onlySelected) {
|
|
498
|
+
const l = this.getSelectionState();
|
|
499
|
+
l?.selected?.size ? r = b(this.rows, [...l.selected]) : r = [...this.rows];
|
|
500
|
+
} else
|
|
501
|
+
r = [...this.rows];
|
|
502
|
+
this.isExportingFlag = !0;
|
|
503
|
+
let i = o.fileName;
|
|
495
504
|
try {
|
|
496
505
|
switch (e) {
|
|
497
506
|
case "csv": {
|
|
498
|
-
const
|
|
499
|
-
i = i.endsWith(".csv") ? i : `${i}.csv`,
|
|
507
|
+
const l = S(r, c, o, { bom: !0 });
|
|
508
|
+
i = i.endsWith(".csv") ? i : `${i}.csv`, y(l, i);
|
|
500
509
|
break;
|
|
501
510
|
}
|
|
502
511
|
case "excel": {
|
|
503
|
-
const
|
|
504
|
-
i = i.endsWith(".xls") ? i : `${i}.xls`,
|
|
512
|
+
const l = R(r, c, o);
|
|
513
|
+
i = i.endsWith(".xls") ? i : `${i}.xls`, I(l, i);
|
|
505
514
|
break;
|
|
506
515
|
}
|
|
507
516
|
case "json": {
|
|
508
|
-
const
|
|
517
|
+
const l = r.map((d) => {
|
|
509
518
|
const p = {};
|
|
510
|
-
for (const f of
|
|
511
|
-
let g =
|
|
512
|
-
|
|
519
|
+
for (const f of c) {
|
|
520
|
+
let g = d[f.field];
|
|
521
|
+
o.processCell && (g = o.processCell(g, f.field, d)), p[f.field] = g;
|
|
513
522
|
}
|
|
514
523
|
return p;
|
|
515
|
-
}),
|
|
524
|
+
}), u = JSON.stringify(l, null, 2);
|
|
516
525
|
i = i.endsWith(".json") ? i : `${i}.json`;
|
|
517
|
-
const
|
|
518
|
-
h(
|
|
526
|
+
const a = new Blob([u], { type: "application/json" });
|
|
527
|
+
h(a, i);
|
|
519
528
|
break;
|
|
520
529
|
}
|
|
521
530
|
}
|
|
@@ -523,7 +532,7 @@ class R extends x {
|
|
|
523
532
|
format: e,
|
|
524
533
|
fileName: i,
|
|
525
534
|
rowCount: r.length,
|
|
526
|
-
columnCount:
|
|
535
|
+
columnCount: c.length
|
|
527
536
|
});
|
|
528
537
|
} finally {
|
|
529
538
|
this.isExportingFlag = !1;
|
|
@@ -576,6 +585,6 @@ class R extends x {
|
|
|
576
585
|
// #endregion
|
|
577
586
|
}
|
|
578
587
|
export {
|
|
579
|
-
|
|
588
|
+
_ as ExportPlugin
|
|
580
589
|
};
|
|
581
590
|
//# sourceMappingURL=index.js.map
|