@easyvision/easyvision-ui 1.8.0 → 1.9.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 +94 -12
- package/dist/EasyVisionTable.css +7 -0
- package/dist/index.cjs +389 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +142 -1
- package/dist/index.d.ts +142 -1
- package/dist/index.js +383 -68
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode, RefObject, Ref } from 'react';
|
|
4
4
|
import { RowData } from '@tanstack/react-table';
|
|
5
|
+
import ExcelJS from 'exceljs';
|
|
5
6
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
6
7
|
|
|
7
8
|
interface BaseStatefulProps<S = unknown> {
|
|
@@ -107,6 +108,13 @@ interface TextFieldDef extends MultifilterFieldBase {
|
|
|
107
108
|
* Multiple prominent fields are supported and wrap onto extra rows as needed.
|
|
108
109
|
*/
|
|
109
110
|
prominent?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Search every one of these paths (a case-insensitive substring match on
|
|
113
|
+
* any of them, as one `$or`) instead of `field`. The text is escaped, so it
|
|
114
|
+
* matches literally. Use this instead of a hand-written `toCondition` for
|
|
115
|
+
* multi-path search bars, e.g. `fields: ['name', 'documentId']`.
|
|
116
|
+
*/
|
|
117
|
+
fields?: string[];
|
|
110
118
|
}
|
|
111
119
|
interface SelectorFieldDef<V extends string | number = string | number> extends MultifilterFieldBase {
|
|
112
120
|
type: 'selector';
|
|
@@ -401,6 +409,68 @@ declare function createLoopbackTableFetcher<T = unknown>(opts: CreateLoopbackTab
|
|
|
401
409
|
*/
|
|
402
410
|
declare function matchLoopbackWhere(row: unknown, where: LoopbackFilter['where'] | undefined): boolean;
|
|
403
411
|
|
|
412
|
+
/** A value ExcelJS can write into a cell without further coercion. */
|
|
413
|
+
type ExportCellValue = string | number | boolean | Date | null;
|
|
414
|
+
interface ExportCellStyle {
|
|
415
|
+
/** Solid background fill, ARGB (e.g. 'FFDC2626'). */
|
|
416
|
+
fill?: string;
|
|
417
|
+
/** Font colour, ARGB. */
|
|
418
|
+
fontColor?: string;
|
|
419
|
+
bold?: boolean;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* A fully-resolved sheet column: no dependency on table column types, so
|
|
423
|
+
* `buildWorkbook` stays independent of how the columns were derived.
|
|
424
|
+
*/
|
|
425
|
+
interface ExportColumnSpec<T = unknown> {
|
|
426
|
+
header: string;
|
|
427
|
+
getValue: (item: T) => ExportCellValue;
|
|
428
|
+
getStyle?: (value: ExportCellValue, item: T) => ExportCellStyle | undefined;
|
|
429
|
+
}
|
|
430
|
+
interface SheetSpec<T = unknown> {
|
|
431
|
+
/** Pre-sanitizing name. `buildWorkbook` sanitizes and de-duplicates. */
|
|
432
|
+
name: string;
|
|
433
|
+
columns: ExportColumnSpec<T>[];
|
|
434
|
+
rows: T[];
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* What an EasyVisionTable registers so an export button can pull from it.
|
|
438
|
+
* Both resolvers run at export time, never at registration time, so a column
|
|
439
|
+
* toggle or a new multifilter query needs no re-registration.
|
|
440
|
+
*/
|
|
441
|
+
interface ExportSource<T = unknown> {
|
|
442
|
+
/** Default sheet name. The button's `sheetNames` map overrides it. */
|
|
443
|
+
sheetName: string;
|
|
444
|
+
getColumns: () => ExportColumnSpec<T>[];
|
|
445
|
+
getRows: () => Promise<T[]>;
|
|
446
|
+
}
|
|
447
|
+
interface ExportLabels {
|
|
448
|
+
export: string;
|
|
449
|
+
exporting: string;
|
|
450
|
+
}
|
|
451
|
+
interface EasyVisionExportButtonProps {
|
|
452
|
+
/**
|
|
453
|
+
* Table ids, in sheet order. Each id is resolved namespace-first — qualified
|
|
454
|
+
* through the surrounding namespace, the same way a nested id is resolved
|
|
455
|
+
* elsewhere in this library — and only falls back to the raw id verbatim if
|
|
456
|
+
* that namespaced lookup misses.
|
|
457
|
+
*/
|
|
458
|
+
tables: string[];
|
|
459
|
+
/** Timestamp and `.xlsx` are appended. */
|
|
460
|
+
filename: string;
|
|
461
|
+
/** Per-table sheet-name override, keyed by the same id passed in `tables`. */
|
|
462
|
+
sheetNames?: Record<string, string>;
|
|
463
|
+
labels?: Partial<ExportLabels>;
|
|
464
|
+
/** Fetch or workbook failure. The export is aborted whole; no partial file. */
|
|
465
|
+
onError?: (error: unknown) => void;
|
|
466
|
+
/** Nothing to export — no file was written. */
|
|
467
|
+
onEmpty?: () => void;
|
|
468
|
+
disabled?: boolean;
|
|
469
|
+
className?: string;
|
|
470
|
+
/** Replaces the default download icon. */
|
|
471
|
+
icon?: ReactNode;
|
|
472
|
+
}
|
|
473
|
+
|
|
404
474
|
type TableMode = 'local' | 'api';
|
|
405
475
|
/**
|
|
406
476
|
* Controls the fallback sorting behavior when a column does not specify
|
|
@@ -462,6 +532,29 @@ type EasyVisionColumn<T> = {
|
|
|
462
532
|
* survive unmount when the table is mounted with `persist`.
|
|
463
533
|
*/
|
|
464
534
|
resizable?: boolean;
|
|
535
|
+
/**
|
|
536
|
+
* Header text in an exported sheet. Defaults to `header` when it is a
|
|
537
|
+
* plain string, otherwise to `field`.
|
|
538
|
+
*/
|
|
539
|
+
exportHeader?: string;
|
|
540
|
+
/**
|
|
541
|
+
* Cell value in an exported sheet. Defaults to the value at `field`,
|
|
542
|
+
* with arrays joined by ", ". Use this to format dates, map codes to
|
|
543
|
+
* labels, or reach into fields the column doesn't render.
|
|
544
|
+
*/
|
|
545
|
+
exportValue?: (item: T) => ExportCellValue;
|
|
546
|
+
/**
|
|
547
|
+
* Per-cell styling in an exported sheet. Return ARGB colour strings
|
|
548
|
+
* (alpha first, e.g. 'FFDC2626'). Return undefined to leave the cell
|
|
549
|
+
* unstyled.
|
|
550
|
+
*/
|
|
551
|
+
exportStyle?: (value: ExportCellValue, item: T) => ExportCellStyle | undefined;
|
|
552
|
+
/**
|
|
553
|
+
* Include this column in exports. Defaults to true for `data` columns
|
|
554
|
+
* and false for `ui` columns — set it true on a `ui` column alongside an
|
|
555
|
+
* `exportValue` to export a computed column.
|
|
556
|
+
*/
|
|
557
|
+
exportable?: boolean;
|
|
465
558
|
} | {
|
|
466
559
|
type: 'ui';
|
|
467
560
|
/** Unique column ID. */
|
|
@@ -476,6 +569,29 @@ type EasyVisionColumn<T> = {
|
|
|
476
569
|
truncate?: boolean;
|
|
477
570
|
/** See data-column docs. */
|
|
478
571
|
resizable?: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* Header text in an exported sheet. Defaults to `header` when it is a
|
|
574
|
+
* plain string, otherwise to `field`.
|
|
575
|
+
*/
|
|
576
|
+
exportHeader?: string;
|
|
577
|
+
/**
|
|
578
|
+
* Cell value in an exported sheet. Defaults to the value at `field`,
|
|
579
|
+
* with arrays joined by ", ". Use this to format dates, map codes to
|
|
580
|
+
* labels, or reach into fields the column doesn't render.
|
|
581
|
+
*/
|
|
582
|
+
exportValue?: (item: T) => ExportCellValue;
|
|
583
|
+
/**
|
|
584
|
+
* Per-cell styling in an exported sheet. Return ARGB colour strings
|
|
585
|
+
* (alpha first, e.g. 'FFDC2626'). Return undefined to leave the cell
|
|
586
|
+
* unstyled.
|
|
587
|
+
*/
|
|
588
|
+
exportStyle?: (value: ExportCellValue, item: T) => ExportCellStyle | undefined;
|
|
589
|
+
/**
|
|
590
|
+
* Include this column in exports. Defaults to true for `data` columns
|
|
591
|
+
* and false for `ui` columns — set it true on a `ui` column alongside an
|
|
592
|
+
* `exportValue` to export a computed column.
|
|
593
|
+
*/
|
|
594
|
+
exportable?: boolean;
|
|
479
595
|
};
|
|
480
596
|
interface ApiFetchParams {
|
|
481
597
|
page: number;
|
|
@@ -685,6 +801,31 @@ interface EasyVisionTableProps<T> extends BaseStatefulProps {
|
|
|
685
801
|
|
|
686
802
|
declare function EasyVisionTable<T extends RowData>(props: EasyVisionTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
687
803
|
|
|
804
|
+
declare function EasyVisionExportButton({ tables, filename, sheetNames, labels: labelOverrides, onError, onEmpty, disabled, className, icon, }: EasyVisionExportButtonProps): react_jsx_runtime.JSX.Element;
|
|
805
|
+
|
|
806
|
+
declare const sanitizeSheetName: (name: string) => string;
|
|
807
|
+
interface ExportSheetsOptions {
|
|
808
|
+
/** Timestamp and `.xlsx` are appended. */
|
|
809
|
+
filename: string;
|
|
810
|
+
/** Injectable for tests. Defaults to an object-URL anchor click. */
|
|
811
|
+
download?: (blob: Blob, filename: string) => void;
|
|
812
|
+
}
|
|
813
|
+
/** Native download — no file-saver needed. */
|
|
814
|
+
declare const downloadBlob: (blob: Blob, filename: string) => void;
|
|
815
|
+
/**
|
|
816
|
+
* Assemble sheets into a workbook. Returns `null` when nothing was worth
|
|
817
|
+
* writing, so callers can distinguish "no file" from "empty file".
|
|
818
|
+
*/
|
|
819
|
+
declare function buildWorkbook<T>(sheets: SheetSpec<T>[]): Promise<ExcelJS.Workbook | null>;
|
|
820
|
+
/** Build and hand the file to the browser. Returns false when no file was written. */
|
|
821
|
+
declare function exportSheets<T>(sheets: SheetSpec<T>[], options: ExportSheetsOptions): Promise<boolean>;
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Flatten table columns into sheet columns, keeping the declared order.
|
|
825
|
+
* `isVisible` is supplied by the caller so this stays free of slice access.
|
|
826
|
+
*/
|
|
827
|
+
declare function toExportColumns<T>(columns: EasyVisionColumn<T>[], isVisible: (field: string) => boolean): ExportColumnSpec<T>[];
|
|
828
|
+
|
|
688
829
|
type SliceKind = 'input' | 'selector' | 'multifilter' | 'table';
|
|
689
830
|
interface InputSliceData {
|
|
690
831
|
kind: 'input';
|
|
@@ -748,4 +889,4 @@ declare const getSlice: <K extends SliceKind>(fullId: string) => SliceFor<K> | u
|
|
|
748
889
|
*/
|
|
749
890
|
declare const defaultCell: (content: ReactNode, title?: string) => ReactNode;
|
|
750
891
|
|
|
751
|
-
export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type TableLabels, type TableMode, type TextFieldDef, createLoopbackTableFetcher, defaultCell, easyVisionRegistry, getSlice, matchLoopbackWhere };
|
|
892
|
+
export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionExportButton, type EasyVisionExportButtonProps, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type ExportCellStyle, type ExportCellValue, type ExportColumnSpec, type ExportLabels, type ExportSource, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type SheetSpec, type TableLabels, type TableMode, type TextFieldDef, buildWorkbook, createLoopbackTableFetcher, defaultCell, downloadBlob, easyVisionRegistry, exportSheets, getSlice, matchLoopbackWhere, sanitizeSheetName, toExportColumns };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ComponentType, ReactNode, RefObject, Ref } from 'react';
|
|
4
4
|
import { RowData } from '@tanstack/react-table';
|
|
5
|
+
import ExcelJS from 'exceljs';
|
|
5
6
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
6
7
|
|
|
7
8
|
interface BaseStatefulProps<S = unknown> {
|
|
@@ -107,6 +108,13 @@ interface TextFieldDef extends MultifilterFieldBase {
|
|
|
107
108
|
* Multiple prominent fields are supported and wrap onto extra rows as needed.
|
|
108
109
|
*/
|
|
109
110
|
prominent?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Search every one of these paths (a case-insensitive substring match on
|
|
113
|
+
* any of them, as one `$or`) instead of `field`. The text is escaped, so it
|
|
114
|
+
* matches literally. Use this instead of a hand-written `toCondition` for
|
|
115
|
+
* multi-path search bars, e.g. `fields: ['name', 'documentId']`.
|
|
116
|
+
*/
|
|
117
|
+
fields?: string[];
|
|
110
118
|
}
|
|
111
119
|
interface SelectorFieldDef<V extends string | number = string | number> extends MultifilterFieldBase {
|
|
112
120
|
type: 'selector';
|
|
@@ -401,6 +409,68 @@ declare function createLoopbackTableFetcher<T = unknown>(opts: CreateLoopbackTab
|
|
|
401
409
|
*/
|
|
402
410
|
declare function matchLoopbackWhere(row: unknown, where: LoopbackFilter['where'] | undefined): boolean;
|
|
403
411
|
|
|
412
|
+
/** A value ExcelJS can write into a cell without further coercion. */
|
|
413
|
+
type ExportCellValue = string | number | boolean | Date | null;
|
|
414
|
+
interface ExportCellStyle {
|
|
415
|
+
/** Solid background fill, ARGB (e.g. 'FFDC2626'). */
|
|
416
|
+
fill?: string;
|
|
417
|
+
/** Font colour, ARGB. */
|
|
418
|
+
fontColor?: string;
|
|
419
|
+
bold?: boolean;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* A fully-resolved sheet column: no dependency on table column types, so
|
|
423
|
+
* `buildWorkbook` stays independent of how the columns were derived.
|
|
424
|
+
*/
|
|
425
|
+
interface ExportColumnSpec<T = unknown> {
|
|
426
|
+
header: string;
|
|
427
|
+
getValue: (item: T) => ExportCellValue;
|
|
428
|
+
getStyle?: (value: ExportCellValue, item: T) => ExportCellStyle | undefined;
|
|
429
|
+
}
|
|
430
|
+
interface SheetSpec<T = unknown> {
|
|
431
|
+
/** Pre-sanitizing name. `buildWorkbook` sanitizes and de-duplicates. */
|
|
432
|
+
name: string;
|
|
433
|
+
columns: ExportColumnSpec<T>[];
|
|
434
|
+
rows: T[];
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* What an EasyVisionTable registers so an export button can pull from it.
|
|
438
|
+
* Both resolvers run at export time, never at registration time, so a column
|
|
439
|
+
* toggle or a new multifilter query needs no re-registration.
|
|
440
|
+
*/
|
|
441
|
+
interface ExportSource<T = unknown> {
|
|
442
|
+
/** Default sheet name. The button's `sheetNames` map overrides it. */
|
|
443
|
+
sheetName: string;
|
|
444
|
+
getColumns: () => ExportColumnSpec<T>[];
|
|
445
|
+
getRows: () => Promise<T[]>;
|
|
446
|
+
}
|
|
447
|
+
interface ExportLabels {
|
|
448
|
+
export: string;
|
|
449
|
+
exporting: string;
|
|
450
|
+
}
|
|
451
|
+
interface EasyVisionExportButtonProps {
|
|
452
|
+
/**
|
|
453
|
+
* Table ids, in sheet order. Each id is resolved namespace-first — qualified
|
|
454
|
+
* through the surrounding namespace, the same way a nested id is resolved
|
|
455
|
+
* elsewhere in this library — and only falls back to the raw id verbatim if
|
|
456
|
+
* that namespaced lookup misses.
|
|
457
|
+
*/
|
|
458
|
+
tables: string[];
|
|
459
|
+
/** Timestamp and `.xlsx` are appended. */
|
|
460
|
+
filename: string;
|
|
461
|
+
/** Per-table sheet-name override, keyed by the same id passed in `tables`. */
|
|
462
|
+
sheetNames?: Record<string, string>;
|
|
463
|
+
labels?: Partial<ExportLabels>;
|
|
464
|
+
/** Fetch or workbook failure. The export is aborted whole; no partial file. */
|
|
465
|
+
onError?: (error: unknown) => void;
|
|
466
|
+
/** Nothing to export — no file was written. */
|
|
467
|
+
onEmpty?: () => void;
|
|
468
|
+
disabled?: boolean;
|
|
469
|
+
className?: string;
|
|
470
|
+
/** Replaces the default download icon. */
|
|
471
|
+
icon?: ReactNode;
|
|
472
|
+
}
|
|
473
|
+
|
|
404
474
|
type TableMode = 'local' | 'api';
|
|
405
475
|
/**
|
|
406
476
|
* Controls the fallback sorting behavior when a column does not specify
|
|
@@ -462,6 +532,29 @@ type EasyVisionColumn<T> = {
|
|
|
462
532
|
* survive unmount when the table is mounted with `persist`.
|
|
463
533
|
*/
|
|
464
534
|
resizable?: boolean;
|
|
535
|
+
/**
|
|
536
|
+
* Header text in an exported sheet. Defaults to `header` when it is a
|
|
537
|
+
* plain string, otherwise to `field`.
|
|
538
|
+
*/
|
|
539
|
+
exportHeader?: string;
|
|
540
|
+
/**
|
|
541
|
+
* Cell value in an exported sheet. Defaults to the value at `field`,
|
|
542
|
+
* with arrays joined by ", ". Use this to format dates, map codes to
|
|
543
|
+
* labels, or reach into fields the column doesn't render.
|
|
544
|
+
*/
|
|
545
|
+
exportValue?: (item: T) => ExportCellValue;
|
|
546
|
+
/**
|
|
547
|
+
* Per-cell styling in an exported sheet. Return ARGB colour strings
|
|
548
|
+
* (alpha first, e.g. 'FFDC2626'). Return undefined to leave the cell
|
|
549
|
+
* unstyled.
|
|
550
|
+
*/
|
|
551
|
+
exportStyle?: (value: ExportCellValue, item: T) => ExportCellStyle | undefined;
|
|
552
|
+
/**
|
|
553
|
+
* Include this column in exports. Defaults to true for `data` columns
|
|
554
|
+
* and false for `ui` columns — set it true on a `ui` column alongside an
|
|
555
|
+
* `exportValue` to export a computed column.
|
|
556
|
+
*/
|
|
557
|
+
exportable?: boolean;
|
|
465
558
|
} | {
|
|
466
559
|
type: 'ui';
|
|
467
560
|
/** Unique column ID. */
|
|
@@ -476,6 +569,29 @@ type EasyVisionColumn<T> = {
|
|
|
476
569
|
truncate?: boolean;
|
|
477
570
|
/** See data-column docs. */
|
|
478
571
|
resizable?: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* Header text in an exported sheet. Defaults to `header` when it is a
|
|
574
|
+
* plain string, otherwise to `field`.
|
|
575
|
+
*/
|
|
576
|
+
exportHeader?: string;
|
|
577
|
+
/**
|
|
578
|
+
* Cell value in an exported sheet. Defaults to the value at `field`,
|
|
579
|
+
* with arrays joined by ", ". Use this to format dates, map codes to
|
|
580
|
+
* labels, or reach into fields the column doesn't render.
|
|
581
|
+
*/
|
|
582
|
+
exportValue?: (item: T) => ExportCellValue;
|
|
583
|
+
/**
|
|
584
|
+
* Per-cell styling in an exported sheet. Return ARGB colour strings
|
|
585
|
+
* (alpha first, e.g. 'FFDC2626'). Return undefined to leave the cell
|
|
586
|
+
* unstyled.
|
|
587
|
+
*/
|
|
588
|
+
exportStyle?: (value: ExportCellValue, item: T) => ExportCellStyle | undefined;
|
|
589
|
+
/**
|
|
590
|
+
* Include this column in exports. Defaults to true for `data` columns
|
|
591
|
+
* and false for `ui` columns — set it true on a `ui` column alongside an
|
|
592
|
+
* `exportValue` to export a computed column.
|
|
593
|
+
*/
|
|
594
|
+
exportable?: boolean;
|
|
479
595
|
};
|
|
480
596
|
interface ApiFetchParams {
|
|
481
597
|
page: number;
|
|
@@ -685,6 +801,31 @@ interface EasyVisionTableProps<T> extends BaseStatefulProps {
|
|
|
685
801
|
|
|
686
802
|
declare function EasyVisionTable<T extends RowData>(props: EasyVisionTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
687
803
|
|
|
804
|
+
declare function EasyVisionExportButton({ tables, filename, sheetNames, labels: labelOverrides, onError, onEmpty, disabled, className, icon, }: EasyVisionExportButtonProps): react_jsx_runtime.JSX.Element;
|
|
805
|
+
|
|
806
|
+
declare const sanitizeSheetName: (name: string) => string;
|
|
807
|
+
interface ExportSheetsOptions {
|
|
808
|
+
/** Timestamp and `.xlsx` are appended. */
|
|
809
|
+
filename: string;
|
|
810
|
+
/** Injectable for tests. Defaults to an object-URL anchor click. */
|
|
811
|
+
download?: (blob: Blob, filename: string) => void;
|
|
812
|
+
}
|
|
813
|
+
/** Native download — no file-saver needed. */
|
|
814
|
+
declare const downloadBlob: (blob: Blob, filename: string) => void;
|
|
815
|
+
/**
|
|
816
|
+
* Assemble sheets into a workbook. Returns `null` when nothing was worth
|
|
817
|
+
* writing, so callers can distinguish "no file" from "empty file".
|
|
818
|
+
*/
|
|
819
|
+
declare function buildWorkbook<T>(sheets: SheetSpec<T>[]): Promise<ExcelJS.Workbook | null>;
|
|
820
|
+
/** Build and hand the file to the browser. Returns false when no file was written. */
|
|
821
|
+
declare function exportSheets<T>(sheets: SheetSpec<T>[], options: ExportSheetsOptions): Promise<boolean>;
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Flatten table columns into sheet columns, keeping the declared order.
|
|
825
|
+
* `isVisible` is supplied by the caller so this stays free of slice access.
|
|
826
|
+
*/
|
|
827
|
+
declare function toExportColumns<T>(columns: EasyVisionColumn<T>[], isVisible: (field: string) => boolean): ExportColumnSpec<T>[];
|
|
828
|
+
|
|
688
829
|
type SliceKind = 'input' | 'selector' | 'multifilter' | 'table';
|
|
689
830
|
interface InputSliceData {
|
|
690
831
|
kind: 'input';
|
|
@@ -748,4 +889,4 @@ declare const getSlice: <K extends SliceKind>(fullId: string) => SliceFor<K> | u
|
|
|
748
889
|
*/
|
|
749
890
|
declare const defaultCell: (content: ReactNode, title?: string) => ReactNode;
|
|
750
891
|
|
|
751
|
-
export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type TableLabels, type TableMode, type TextFieldDef, createLoopbackTableFetcher, defaultCell, easyVisionRegistry, getSlice, matchLoopbackWhere };
|
|
892
|
+
export { type AccordionItem, type AccordionMode, type ApiFetchParams, type ApiFetchResult, type BaseStatefulProps, type CreateLoopbackTableFetcherOptions, type CustomFieldDef, type DateRangeFieldDef, type DateRangeValue, EasyVisionAccordion, EasyVisionAccordionItem, type EasyVisionAccordionItemProps, type EasyVisionAccordionProps, EasyVisionCard, EasyVisionCardContent, EasyVisionCardDescription, EasyVisionCardFooter, EasyVisionCardHeader, EasyVisionCardTitle, type EasyVisionColumn, EasyVisionExportButton, type EasyVisionExportButtonProps, EasyVisionInput, type EasyVisionInputProps, EasyVisionMultifilter, type EasyVisionMultifilterProps, EasyVisionSelector, type EasyVisionSelectorProps, EasyVisionTable, type EasyVisionTableProps, type ExportCellStyle, type ExportCellValue, type ExportColumnSpec, type ExportLabels, type ExportSource, type FieldDef, type LoopbackCountResponse, type LoopbackFilter, type LoopbackWhereValue, type MultiSelectFieldDef, type MultifilterConfig, type MultifilterFieldDef, type MultifilterHandle, type MultifilterLabels, type MultifilterQuery, type MultifilterSnapshot, type NumberRangeFieldDef, type NumberRangeValue, type SelectionChange, type SelectorFieldDef, type SelectorOption, type SheetSpec, type TableLabels, type TableMode, type TextFieldDef, buildWorkbook, createLoopbackTableFetcher, defaultCell, downloadBlob, easyVisionRegistry, exportSheets, getSlice, matchLoopbackWhere, sanitizeSheetName, toExportColumns };
|