@dcs-tech/ui 0.4.0 → 0.7.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/README.md +27 -0
- package/dist/ChartImageMenu-C6MwKKjc.js +1494 -0
- package/dist/{ChartView-Cehrcr05.js → ChartView-nS4f4EU_.js} +514 -514
- package/dist/{SummaryChart-y27q_BBN.js → SummaryChart-CVg6i2mx.js} +2 -2
- package/dist/{SummaryImage-DDNEEu_K.js → SummaryImage-OHJHjCqe.js} +2 -2
- package/dist/{SummarySeeAll-0dX-_LFe.js → SummarySeeAll-BYrvXSJ6.js} +5 -5
- package/dist/assets/fileTask.worker-BHT1olUk.js +1 -0
- package/dist/columnValue-K98ElfJc.js +610 -0
- package/dist/exportContext-CJaIv8R-.js +166 -0
- package/dist/{exportEngine-DL-jEXFU.js → exportEngine-S8JHzYbS.js} +355 -356
- package/dist/file-worker.js +1 -0
- package/dist/fileActions-COf5Q4Eg.js +144 -0
- package/dist/{geometry-CG2nOEnw.js → geometry-ChwYB45B.js} +433 -497
- package/dist/index.js +8817 -8596
- package/dist/{defaults-DL745PK1.js → labels-CnqqTrne.js} +3 -79
- package/dist/runFileTask--4YjQH7Y.js +210 -0
- package/dist/scrollArea-DAlVT5U7.js +214 -0
- package/dist/style.css +1 -1
- package/dist/{summaryChartData-Djo73zb8.js → summaryChartData-pNvzaEHp.js} +1 -1
- package/dist/types/components/Charts/parts.d.ts +1 -1
- package/dist/types/components/Collapsible/index.d.ts +1 -1
- package/dist/types/components/DataTable/DataTable.d.ts +1 -1
- package/dist/types/components/DataTable/cards/cardFields.d.ts +2 -4
- package/dist/types/components/DataTable/columnValue.d.ts +19 -0
- package/dist/types/components/DataTable/export/exportCells.d.ts +13 -0
- package/dist/types/components/DataTable/export/exportEngine.d.ts +13 -4
- package/dist/types/components/DataTable/export/useTableExport.d.ts +2 -0
- package/dist/types/components/DataTable/host.d.ts +2 -0
- package/dist/types/components/DataTable/index.d.ts +1 -1
- package/dist/types/components/DataTable/labels.d.ts +2 -0
- package/dist/types/components/DataTable/types.d.ts +11 -0
- package/dist/types/components/DataTable/useTable.d.ts +4 -1
- package/dist/types/components/DataTable/vendor/index.d.ts +1 -1
- package/dist/types/components/Dialog/DialogHost.d.ts +1 -0
- package/dist/types/components/EditableTable/EditableTableCell.d.ts +1 -1
- package/dist/types/components/FileEngine/FileEngineContext.d.ts +17 -0
- package/dist/types/components/FileEngine/FileEngineProvider.d.ts +31 -0
- package/dist/types/components/FileEngine/FileJobsTray.d.ts +10 -0
- package/dist/types/components/FileEngine/index.d.ts +8 -0
- package/dist/types/components/FileEngine/labels.d.ts +29 -0
- package/dist/types/components/Toast/ToastHost.d.ts +1 -0
- package/dist/types/components/UIProvider/UIFormatContext.d.ts +7 -0
- package/dist/types/components/UIProvider/UIHostContext.d.ts +20 -0
- package/dist/types/components/UIProvider/UILabelsContext.d.ts +116 -0
- package/dist/types/components/UIProvider/UIProvider.d.ts +8 -1
- package/dist/types/components/UIProvider/index.d.ts +6 -0
- package/dist/types/core/logic/collapsible.logic.d.ts +6 -1
- package/dist/types/core/logic/datePicker.logic.d.ts +5 -0
- package/dist/types/core/logic/exportSafety.logic.d.ts +1 -0
- package/dist/types/core/logic/fileQueue.logic.d.ts +28 -0
- package/dist/types/core/logic/format.logic.d.ts +4 -0
- package/dist/types/core/logic/index.d.ts +4 -0
- package/dist/types/core/logic/tableDate.logic.d.ts +7 -0
- package/dist/types/core/logic/tableSummary.logic.d.ts +2 -2
- package/dist/types/core/types/collapsible.types.d.ts +4 -16
- package/dist/types/core/types/fileEngine.types.d.ts +116 -0
- package/dist/types/core/types/form.types.d.ts +4 -0
- package/dist/types/core/types/format.types.d.ts +15 -0
- package/dist/types/core/types/index.d.ts +2 -0
- package/dist/types/core/types/table.types.d.ts +1 -0
- package/dist/types/{components/DataTable/vendor → file}/fileActions.d.ts +17 -7
- package/dist/types/file/fileEngine.d.ts +49 -0
- package/dist/types/file/tasks/fileTask.worker.d.ts +1 -0
- package/dist/types/file/tasks/runFileTask.d.ts +9 -0
- package/dist/types/file/workerPool.d.ts +18 -0
- package/dist/types/index.d.ts +11 -2
- package/package.json +3 -2
- package/dist/ChartImageMenu-HILSfn5A.js +0 -1115
- package/dist/exportContext-CdpsOzE8.js +0 -235
- package/dist/scrollArea-CkPGDYH2.js +0 -210
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FileEngineOptions, FileJob, FileJobAction } from '../types';
|
|
2
|
+
export declare const FILE_ENGINE_DEFAULTS: Required<FileEngineOptions>;
|
|
3
|
+
export declare function resolveFileEngineOptions(options?: FileEngineOptions): Required<FileEngineOptions>;
|
|
4
|
+
export declare const isFinishedJob: (job: Pick<FileJob, "status">) => boolean;
|
|
5
|
+
export declare const isActiveJob: (job: Pick<FileJob, "status">) => boolean;
|
|
6
|
+
export declare function pickJobsToStart(jobs: readonly FileJob[], concurrency: number): string[];
|
|
7
|
+
export type SubmitDecision = {
|
|
8
|
+
kind: 'reuse';
|
|
9
|
+
id: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'add';
|
|
12
|
+
cancel: string[];
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'reject';
|
|
15
|
+
reason: 'queue-full';
|
|
16
|
+
};
|
|
17
|
+
export declare function decideSubmit(jobs: readonly FileJob[], request: {
|
|
18
|
+
dedupeKey?: string;
|
|
19
|
+
replace?: boolean;
|
|
20
|
+
}, maxQueued: number): SubmitDecision;
|
|
21
|
+
export declare const shouldRetryJob: (job: Pick<FileJob, "attempts" | "retry">) => boolean;
|
|
22
|
+
export declare function nextJobProgress(current: number, reported: number): number | null;
|
|
23
|
+
export declare const USER_ACTIVATION_WINDOW_MS = 4000;
|
|
24
|
+
export declare function deliveryTiming(action: FileJobAction, context: {
|
|
25
|
+
activationActive?: boolean;
|
|
26
|
+
sinceSubmitMs: number;
|
|
27
|
+
}): 'now' | 'wait';
|
|
28
|
+
export declare function jobsToPrune(jobs: readonly FileJob[], keepFinished: number): string[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UIFormat, UIFormatSettings } from '../types';
|
|
2
|
+
export declare const DEFAULT_DATE_FORMAT: "dd-mm-yyyy";
|
|
3
|
+
export declare function createUIFormat(settings?: UIFormatSettings): UIFormat;
|
|
4
|
+
export declare function mergeFormatSettings(parent: UIFormatSettings, own: UIFormatSettings): UIFormatSettings;
|
|
@@ -26,6 +26,10 @@ export * from './select.logic';
|
|
|
26
26
|
export * from './suggest.logic';
|
|
27
27
|
export * from './switch.logic';
|
|
28
28
|
export * from './tableLayout.logic';
|
|
29
|
+
export * from './fileQueue.logic';
|
|
30
|
+
export * from './exportSafety.logic';
|
|
31
|
+
export * from './format.logic';
|
|
32
|
+
export * from './tableDate.logic';
|
|
29
33
|
export * from './tableSummary.logic';
|
|
30
34
|
export * from './tooltip.logic';
|
|
31
35
|
export * from './typography.logic';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DateDisplayFormat } from '../types';
|
|
2
|
+
export type TableDate = string;
|
|
3
|
+
export declare function toTableDate(raw: unknown, parse?: DateDisplayFormat): TableDate | null;
|
|
4
|
+
export declare const tableDay: (value: TableDate | null) => string | null;
|
|
5
|
+
export declare const compareTableDates: (a: TableDate, b: TableDate) => number;
|
|
6
|
+
export declare function formatTableDate(value: TableDate | null, format?: DateDisplayFormat): string;
|
|
7
|
+
export declare function compareBlanksLast<T>(a: T | null | undefined, b: T | null | undefined, desc: boolean, compare: (a: T, b: T) => number): number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ColumnSummaryConfig, EditableTableColumnDefinition, ResolvedColumnTotal, ResolvedSummaryEntry, ResolvedSummaryGroup, SummaryAggregation, SummaryContext, SummaryFormat, TableSummaryConfig } from '../types';
|
|
2
|
-
export declare function formatSummaryValue(value: number, format?: SummaryFormat, decimals?: number, prefix?: string, suffix?: string, formatter?: (value: any) => string): string;
|
|
2
|
+
export declare function formatSummaryValue(value: number, format?: SummaryFormat, decimals?: number, prefix?: string, suffix?: string, formatter?: (value: any) => string, locale?: string): string;
|
|
3
3
|
export declare function aggregateValues(values: number[], type: SummaryAggregation): number;
|
|
4
4
|
export declare function columnSummaryConfig(column: EditableTableColumnDefinition<any>): ColumnSummaryConfig | undefined;
|
|
5
|
-
export declare function computeColumnTotals<T>(columns: EditableTableColumnDefinition<T>[], rows: T[]): ResolvedColumnTotal[];
|
|
5
|
+
export declare function computeColumnTotals<T>(columns: EditableTableColumnDefinition<T>[], rows: T[], locale?: string): ResolvedColumnTotal[];
|
|
6
6
|
export interface ResolvedTableSummary {
|
|
7
7
|
columnTotals: ResolvedColumnTotal[];
|
|
8
8
|
totalsByColumn: Record<string, number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import type { TooltipProp } from './tooltip.types';
|
|
3
3
|
import type { ControlSize, SemanticColor } from './control.types';
|
|
4
4
|
export type CollapsibleVariant = 'default' | 'bordered' | 'separated' | 'filled' | 'minimal';
|
|
@@ -9,16 +9,7 @@ export type CollapsibleExpansionMode = 'single' | 'multiple';
|
|
|
9
9
|
export type CollapsibleDisclosure = 'chevron' | 'plusminus';
|
|
10
10
|
export type CollapsibleTone = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
11
11
|
export type CollapsibleHeadingLevel = 2 | 3 | 4 | 5 | 6;
|
|
12
|
-
export
|
|
13
|
-
type: 'r' | 's' | 'b';
|
|
14
|
-
tab: string;
|
|
15
|
-
subtab?: string;
|
|
16
|
-
featurename?: string;
|
|
17
|
-
featurevalue?: string;
|
|
18
|
-
report?: string;
|
|
19
|
-
rightsname?: string;
|
|
20
|
-
reportname?: string;
|
|
21
|
-
}
|
|
12
|
+
export type CollapsibleAuthorize = unknown;
|
|
22
13
|
export interface CollapsibleItemProps {
|
|
23
14
|
id?: string;
|
|
24
15
|
title: string | ReactNode;
|
|
@@ -27,9 +18,6 @@ export interface CollapsibleItemProps {
|
|
|
27
18
|
meta?: string | ReactNode;
|
|
28
19
|
tooltip?: TooltipProp;
|
|
29
20
|
children?: ReactNode;
|
|
30
|
-
Component?: ComponentType<any>;
|
|
31
|
-
JSX?: ReactNode;
|
|
32
|
-
props?: Record<string, any>;
|
|
33
21
|
expanded?: boolean;
|
|
34
22
|
defaultExpanded?: boolean;
|
|
35
23
|
disabled?: boolean;
|
|
@@ -72,7 +60,7 @@ export interface CollapsibleProps {
|
|
|
72
60
|
keyboardNavigation?: boolean;
|
|
73
61
|
'aria-label'?: string;
|
|
74
62
|
'aria-labelledby'?: string;
|
|
75
|
-
renderAuthorize?: (authorize:
|
|
63
|
+
renderAuthorize?: (authorize: any, children: ReactNode) => ReactNode;
|
|
76
64
|
}
|
|
77
65
|
export interface CollapsibleContextValue {
|
|
78
66
|
expandedItems: Set<string>;
|
|
@@ -91,5 +79,5 @@ export interface CollapsibleContextValue {
|
|
|
91
79
|
animationDuration: number;
|
|
92
80
|
collapsedIcon?: ReactNode;
|
|
93
81
|
expandedIcon?: ReactNode;
|
|
94
|
-
renderAuthorize?: (authorize:
|
|
82
|
+
renderAuthorize?: (authorize: any, children: ReactNode) => ReactNode;
|
|
95
83
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export type FileFormat = 'pdf' | 'xlsx' | 'csv' | 'html' | 'json' | 'xml' | 'png';
|
|
2
|
+
export type FileDeliveryAction = 'download' | 'share' | 'preview' | 'print' | 'open';
|
|
3
|
+
export type FileJobAction = FileDeliveryAction | 'none';
|
|
4
|
+
export type FileJobPriority = 'high' | 'normal' | 'low';
|
|
5
|
+
export type FileJobStatus = 'queued' | 'running' | 'ready' | 'delivered' | 'failed' | 'cancelled';
|
|
6
|
+
export interface FileJob {
|
|
7
|
+
id: string;
|
|
8
|
+
format: FileFormat;
|
|
9
|
+
filename: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
action: FileJobAction;
|
|
12
|
+
priority: FileJobPriority;
|
|
13
|
+
dedupeKey?: string;
|
|
14
|
+
status: FileJobStatus;
|
|
15
|
+
progress: number;
|
|
16
|
+
attempts: number;
|
|
17
|
+
retry: number;
|
|
18
|
+
seq: number;
|
|
19
|
+
createdAt: number;
|
|
20
|
+
startedAt?: number;
|
|
21
|
+
finishedAt?: number;
|
|
22
|
+
error?: string;
|
|
23
|
+
awaitingClick?: boolean;
|
|
24
|
+
notify: 'all' | 'awaiting-click';
|
|
25
|
+
}
|
|
26
|
+
export interface FileEngineOptions {
|
|
27
|
+
concurrency?: number;
|
|
28
|
+
maxQueued?: number;
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
keepFinished?: number;
|
|
31
|
+
workers?: 'auto' | 'off';
|
|
32
|
+
}
|
|
33
|
+
export type XlsxCellValue = string | number | boolean | Date | null;
|
|
34
|
+
export interface XlsxCellStyle {
|
|
35
|
+
bold?: boolean;
|
|
36
|
+
italic?: boolean;
|
|
37
|
+
size?: number;
|
|
38
|
+
color?: string;
|
|
39
|
+
fill?: string;
|
|
40
|
+
align?: 'left' | 'center' | 'right';
|
|
41
|
+
numFmt?: string;
|
|
42
|
+
borderTop?: XlsxBorder;
|
|
43
|
+
borderBottom?: XlsxBorder;
|
|
44
|
+
}
|
|
45
|
+
export interface XlsxBorder {
|
|
46
|
+
style: 'thin' | 'medium' | 'thick' | 'dotted' | 'dashed' | 'double';
|
|
47
|
+
color?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface XlsxRowSpec {
|
|
50
|
+
values: XlsxCellValue[];
|
|
51
|
+
style?: XlsxCellStyle;
|
|
52
|
+
cells?: Record<number, XlsxCellStyle>;
|
|
53
|
+
merge?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface XlsxColumnSpec {
|
|
56
|
+
header: string;
|
|
57
|
+
width?: number;
|
|
58
|
+
numFmt?: string;
|
|
59
|
+
align?: 'left' | 'center' | 'right';
|
|
60
|
+
style?: XlsxCellStyle;
|
|
61
|
+
}
|
|
62
|
+
export interface XlsxSheetSpec {
|
|
63
|
+
name: string;
|
|
64
|
+
columns: XlsxColumnSpec[];
|
|
65
|
+
rows: XlsxCellValue[][];
|
|
66
|
+
freezeHeader?: boolean;
|
|
67
|
+
before?: XlsxRowSpec[];
|
|
68
|
+
after?: XlsxRowSpec[];
|
|
69
|
+
headerStyle?: XlsxCellStyle;
|
|
70
|
+
stripe?: string;
|
|
71
|
+
cellStyles?: Array<Record<number, XlsxCellStyle> | null | undefined>;
|
|
72
|
+
autoFilter?: boolean;
|
|
73
|
+
freeze?: {
|
|
74
|
+
rows?: number;
|
|
75
|
+
cols?: number;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface XlsxWorkbookSpec {
|
|
79
|
+
sheets: XlsxSheetSpec[];
|
|
80
|
+
}
|
|
81
|
+
export interface PdfTaskFonts {
|
|
82
|
+
fonts?: Record<string, {
|
|
83
|
+
normal: string;
|
|
84
|
+
bold: string;
|
|
85
|
+
italics: string;
|
|
86
|
+
bolditalics: string;
|
|
87
|
+
}>;
|
|
88
|
+
vfs?: Record<string, string>;
|
|
89
|
+
}
|
|
90
|
+
export interface PdfTableLayoutSpec {
|
|
91
|
+
hLineWidth?: number;
|
|
92
|
+
edgeLineWidth?: number;
|
|
93
|
+
vLineWidth?: number;
|
|
94
|
+
hLineColor?: string;
|
|
95
|
+
vLineColor?: string;
|
|
96
|
+
paddingX?: number;
|
|
97
|
+
paddingY?: number;
|
|
98
|
+
}
|
|
99
|
+
export interface PdfPageFooterSpec {
|
|
100
|
+
text: string;
|
|
101
|
+
alignment?: 'left' | 'center' | 'right';
|
|
102
|
+
fontSize?: number;
|
|
103
|
+
color?: string;
|
|
104
|
+
font?: string;
|
|
105
|
+
margin?: [number, number, number, number];
|
|
106
|
+
}
|
|
107
|
+
export type FileTask = {
|
|
108
|
+
kind: 'pdf';
|
|
109
|
+
document: Record<string, unknown>;
|
|
110
|
+
fonts?: PdfTaskFonts;
|
|
111
|
+
tableLayouts?: Record<string, PdfTableLayoutSpec>;
|
|
112
|
+
footer?: PdfPageFooterSpec;
|
|
113
|
+
} | {
|
|
114
|
+
kind: 'xlsx';
|
|
115
|
+
workbook: XlsxWorkbookSpec;
|
|
116
|
+
};
|
|
@@ -100,6 +100,10 @@ export interface FormCallbacks<T = any> {
|
|
|
100
100
|
onUnhandledError?: (error: Error, methods: FormMethods<T>) => void;
|
|
101
101
|
onToast?: (type: 'success' | 'error' | 'info' | 'warning', message: string) => void;
|
|
102
102
|
onNavigate?: (path: string) => void;
|
|
103
|
+
onConfirm?: (request: {
|
|
104
|
+
title: string;
|
|
105
|
+
message: string;
|
|
106
|
+
}) => boolean | Promise<boolean>;
|
|
103
107
|
}
|
|
104
108
|
export interface FormProps<T = any> extends FormCallbacks<T> {
|
|
105
109
|
id?: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DateDisplayFormat } from './datePicker.types';
|
|
2
|
+
export interface UIFormatSettings {
|
|
3
|
+
locale?: string;
|
|
4
|
+
currency?: string;
|
|
5
|
+
dateFormat?: DateDisplayFormat;
|
|
6
|
+
}
|
|
7
|
+
export interface UIFormat {
|
|
8
|
+
locale: string | undefined;
|
|
9
|
+
currency: string | undefined;
|
|
10
|
+
dateFormat: DateDisplayFormat;
|
|
11
|
+
number: (value: number, decimals?: number) => string;
|
|
12
|
+
money: (value: number, decimals?: number) => string;
|
|
13
|
+
percent: (value: number, decimals?: number) => string;
|
|
14
|
+
day: (value: unknown) => string;
|
|
15
|
+
}
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface PdfFontConfig {
|
|
2
|
+
fonts?: Record<string, {
|
|
3
|
+
normal: string;
|
|
4
|
+
bold: string;
|
|
5
|
+
italics: string;
|
|
6
|
+
bolditalics: string;
|
|
7
|
+
}>;
|
|
8
|
+
vfs?: Record<string, string>;
|
|
9
|
+
fontFor?: (text: string) => string | undefined;
|
|
10
|
+
}
|
|
11
|
+
import type { FileFormat, FileDeliveryAction } from '../core/types';
|
|
12
|
+
export type { FileFormat };
|
|
13
|
+
export type FileAction = FileDeliveryAction;
|
|
4
14
|
export declare const EXTENSION_MAP: Record<FileFormat, string>;
|
|
5
15
|
export declare const MIME_MAP: Record<FileFormat, string>;
|
|
6
|
-
export declare function createPdfBlob(docDef: unknown, fontConfig?:
|
|
7
|
-
export declare function rawDataToBlob(format: FileFormat, data: any, fontConfig?:
|
|
16
|
+
export declare function createPdfBlob(docDef: unknown, fontConfig?: PdfFontConfig): Promise<Blob>;
|
|
17
|
+
export declare function rawDataToBlob(format: FileFormat, data: any, fontConfig?: PdfFontConfig): Promise<Blob>;
|
|
8
18
|
export declare function safeFileBaseName(name: string): string;
|
|
9
19
|
export declare function safeFileName(filename: string): string;
|
|
10
20
|
export declare function downloadBlob(blob: Blob, filename: string): void;
|
|
11
|
-
export declare function shareFile(blob: Blob, filename: string): Promise<boolean>;
|
|
21
|
+
export declare function shareFile(blob: Blob, filename: string, title?: string): Promise<boolean>;
|
|
12
22
|
export declare function openPreview(blob: Blob, format: FileFormat, title?: string): {
|
|
13
23
|
type: "new_tab";
|
|
14
24
|
} | {
|
|
15
25
|
type: "modal";
|
|
16
26
|
};
|
|
17
|
-
export declare function executeFileAction(data: any, filename: string, format: FileFormat, action: string, title?: string, fontConfig?:
|
|
27
|
+
export declare function executeFileAction(data: any, filename: string, format: FileFormat, action: string, title?: string, fontConfig?: PdfFontConfig): Promise<void>;
|
|
18
28
|
export declare function getExtension(format: FileFormat): string;
|
|
19
29
|
export declare function getFormatLabel(format: FileFormat): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { FileDeliveryAction, FileEngineOptions, FileFormat, FileJob, FileJobAction, FileJobPriority, FileTask, PdfTaskFonts } from '../core/types';
|
|
2
|
+
export interface FileBuildContext {
|
|
3
|
+
signal: AbortSignal;
|
|
4
|
+
progress: (fraction: number) => void;
|
|
5
|
+
}
|
|
6
|
+
interface FileJobRequestBase {
|
|
7
|
+
filename: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
action?: FileJobAction;
|
|
10
|
+
priority?: FileJobPriority;
|
|
11
|
+
dedupeKey?: string;
|
|
12
|
+
replace?: boolean;
|
|
13
|
+
retry?: number;
|
|
14
|
+
onReady?: (blob: Blob, job: FileJob) => void;
|
|
15
|
+
notify?: FileJob['notify'];
|
|
16
|
+
}
|
|
17
|
+
export type FileJobRequest = FileJobRequestBase & ({
|
|
18
|
+
format: FileFormat;
|
|
19
|
+
build: (context: FileBuildContext) => unknown | Promise<unknown>;
|
|
20
|
+
task?: never;
|
|
21
|
+
} | {
|
|
22
|
+
task: FileTask;
|
|
23
|
+
format?: FileFormat;
|
|
24
|
+
build?: never;
|
|
25
|
+
});
|
|
26
|
+
export type FileDeliverer = (blob: Blob, job: FileJob, action: FileDeliveryAction) => void | Promise<void>;
|
|
27
|
+
export interface CreateFileEngineOptions extends FileEngineOptions {
|
|
28
|
+
deliver?: FileDeliverer;
|
|
29
|
+
createWorker?: () => Worker;
|
|
30
|
+
pdfFonts?: PdfTaskFonts;
|
|
31
|
+
}
|
|
32
|
+
export type FileEngineErrorCode = 'queue-full' | 'timeout' | 'disposed';
|
|
33
|
+
export declare class FileEngineError extends Error {
|
|
34
|
+
readonly code: FileEngineErrorCode;
|
|
35
|
+
constructor(code: FileEngineErrorCode, message: string);
|
|
36
|
+
}
|
|
37
|
+
export interface FileEngine {
|
|
38
|
+
submit(request: FileJobRequest): string;
|
|
39
|
+
cancel(id: string): void;
|
|
40
|
+
retry(id: string): void;
|
|
41
|
+
deliver(id: string, action?: FileDeliveryAction): Promise<void>;
|
|
42
|
+
wait(id: string): Promise<FileJob | undefined>;
|
|
43
|
+
clear(filter?: (job: FileJob) => boolean): void;
|
|
44
|
+
getJobs(): readonly FileJob[];
|
|
45
|
+
subscribe(listener: () => void): () => void;
|
|
46
|
+
dispose(): void;
|
|
47
|
+
}
|
|
48
|
+
export declare function createFileEngine(options?: CreateFileEngineOptions): FileEngine;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FileTask, PdfTaskFonts, PdfPageFooterSpec, PdfTableLayoutSpec } from '../../core/types';
|
|
2
|
+
export interface TaskContext {
|
|
3
|
+
progress: (fraction: number) => void;
|
|
4
|
+
signal?: AbortSignal;
|
|
5
|
+
pdfFonts?: PdfTaskFonts;
|
|
6
|
+
}
|
|
7
|
+
export declare function runFileTask(task: FileTask, ctx: TaskContext): Promise<ArrayBuffer>;
|
|
8
|
+
export declare function pdfTableLayout(spec: PdfTableLayoutSpec): Record<string, unknown>;
|
|
9
|
+
export declare function pdfFooter(spec: PdfPageFooterSpec): (page: number, pages: number) => Record<string, unknown>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FileTask } from '../core/types';
|
|
2
|
+
export declare class WorkerFallback extends Error {
|
|
3
|
+
readonly reason: 'unavailable' | 'uncloneable';
|
|
4
|
+
constructor(reason: 'unavailable' | 'uncloneable', detail: string);
|
|
5
|
+
}
|
|
6
|
+
export interface WorkerPool {
|
|
7
|
+
run(task: FileTask, ctx: {
|
|
8
|
+
signal: AbortSignal;
|
|
9
|
+
progress: (fraction: number) => void;
|
|
10
|
+
}): Promise<ArrayBuffer>;
|
|
11
|
+
readonly broken: boolean;
|
|
12
|
+
dispose(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare function createWorkerPool(options: {
|
|
15
|
+
size: number;
|
|
16
|
+
create: () => Worker;
|
|
17
|
+
init?: unknown;
|
|
18
|
+
}): WorkerPool;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { Suggest, SuggestionList, useSuggest } from './components/Suggest';
|
|
|
28
28
|
export { FORMATTER_UTILITY_CLASSES, SUGGEST_SEARCH_ENGINE_OPTIONS, SUGGEST_SEARCH_MODE_OPTIONS, } from './components/Suggest';
|
|
29
29
|
export type { SuggestProps, SuggestSize, SuggestLayout, SuggestSearchEngine, SuggestSearchMode, RenderKey, SuggestionConfig, SuggestionItemProps, SuggestionListProps, SuggestionGroup, UseSuggestOptions, UseSuggestReturn, SuggestSearchOptions, } from './components/Suggest';
|
|
30
30
|
export { Collapsible, CollapsibleItem, CollapsibleContext, useCollapsibleContext } from './components/Collapsible';
|
|
31
|
-
export type { CollapsibleProps, CollapsibleItemProps, CollapsibleContextValue, CollapsibleVariant, CollapsibleSize, CollapsibleColor, CollapsibleIconPosition, CollapsibleExpansionMode, CollapsibleAuthorize, } from './components/Collapsible';
|
|
31
|
+
export type { CollapsibleProps, CollapsibleItemProps, CollapsibleContextValue, CollapsibleVariant, CollapsibleSize, CollapsibleColor, CollapsibleIconPosition, CollapsibleExpansionMode, CollapsibleAuthorize, CollapsibleDisclosure, CollapsibleTone, CollapsibleHeadingLevel, } from './components/Collapsible';
|
|
32
32
|
export { Fields, Field } from './components/Fields';
|
|
33
33
|
export { useFieldCondition, useFieldRender, useFieldDisabled, useFieldValue, useFieldChange, useFieldBlur, useFieldValidation, useFieldSelect, } from './components/Fields';
|
|
34
34
|
export type { FieldsProps, FieldProps, FieldsBaseProps, FieldsWithSetState, FieldsWithOnChange, FieldDefinition, FieldsDefinition, FieldAuthorize, FieldTooltipProps, FieldComponentRegistry, FieldEditableTableProps, BaseFieldDefinition, InputFieldDefinition, SwitchFieldDefinition, SelectFieldDefinition, SuggestFieldDefinition, RadioFieldDefinition, CheckboxFieldDefinition, ButtonFieldDefinition, ChildFieldDefinition, EditableTableFieldDefinition, ChipInputFieldDefinition, ConditionOperator, ConditionCompareType, ConditionObject, ConditionRegexObject, ConditionFunction, ConditionSimpleKey, Condition, ConditionContext, NestedKeys, NestedValue, ResetKeyConfig, SelectCopyKeyConfig, ChangeContext, ChangeAdditionalDataContext, SelectAdditionalDataContext, EditableTableCustomPropContext, ErrorObject, TouchedObject, } from './components/Fields';
|
|
@@ -44,7 +44,9 @@ export * from './components/Charts';
|
|
|
44
44
|
export * from './components/Scroll';
|
|
45
45
|
export { ColorSchemeSelect } from './components/ColorSchemeSelect';
|
|
46
46
|
export type { ColorSchemeSelectProps } from './components/ColorSchemeSelect';
|
|
47
|
-
export { UIProvider, useUIPortalContainer, useUITheme } from './components/UIProvider';
|
|
47
|
+
export { UIProvider, useUIPortalContainer, useUITheme, FormatProvider, useFormat, LabelsProvider, useUILabels, DEFAULT_UI_LABELS, HostProvider, useUIHost } from './components/UIProvider';
|
|
48
|
+
export type { FormatProviderProps, UILabels, UILabelsInput, UIHostDefaults, UIConfirmRequest } from './components/UIProvider';
|
|
49
|
+
export type { UIFormat, UIFormatSettings } from './core/types';
|
|
48
50
|
export type { UIProviderProps, UITheme, ResolvedUITheme, UIThemeValue } from './components/UIProvider';
|
|
49
51
|
export { Skeleton } from './components/Skeleton';
|
|
50
52
|
export type { SkeletonProps, SkeletonVariant, SkeletonAnimation } from './components/Skeleton';
|
|
@@ -66,6 +68,13 @@ export { useDialog } from './components/Dialog/DialogHost';
|
|
|
66
68
|
export type { DialogApi, DialogChoice, DialogActionProps, ConfirmOptions, ChooseOptions, AlertOptions, } from './components/Dialog/DialogHost';
|
|
67
69
|
export { ToastHost, useToast } from './components/Toast';
|
|
68
70
|
export type { ToastApi, ToastDefaults, ToastOptions, ToastPosition, ToastRecord, ToastType, ToastHostProps, } from './components/Toast';
|
|
71
|
+
export { createFileEngine, FileEngineError } from './file/fileEngine';
|
|
72
|
+
export { createPdfBlob, rawDataToBlob, downloadBlob, shareFile, openPreview, executeFileAction, getExtension, getFormatLabel, safeFileName, safeFileBaseName, EXTENSION_MAP, MIME_MAP, } from './file/fileActions';
|
|
73
|
+
export type { PdfFontConfig, FileAction } from './file/fileActions';
|
|
74
|
+
export type { FileEngine, CreateFileEngineOptions, FileJobRequest, FileBuildContext, FileDeliverer, FileEngineErrorCode, } from './file/fileEngine';
|
|
75
|
+
export type { FileFormat, FileDeliveryAction, FileJobAction, FileJobPriority, FileJobStatus, FileJob, FileEngineOptions, FileTask, XlsxWorkbookSpec, XlsxSheetSpec, XlsxColumnSpec, XlsxCellValue, PdfTaskFonts, XlsxCellStyle, XlsxBorder, XlsxRowSpec, PdfTableLayoutSpec, PdfPageFooterSpec, } from './core/types';
|
|
76
|
+
export { FileEngineProvider, FileJobsTray, useFileEngine, useFileJob, DEFAULT_FILE_ENGINE_LABELS, } from './components/FileEngine';
|
|
77
|
+
export type { FileEngineProviderProps, FileJobNotice, FileJobsTrayProps, UseFileEngineResult, FileEngineLabels, FileEngineLabelsInput, } from './components/FileEngine';
|
|
69
78
|
export { Stepper } from './components/Stepper';
|
|
70
79
|
export type { StepperProps, StepperStep } from './components/Stepper';
|
|
71
80
|
export { Tabs, TabPanel } from './components/Tabs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcs-tech/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "React UI component library — fields, buttons, tooltips, tables and design tokens.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
"import": "./dist/index.js"
|
|
19
19
|
},
|
|
20
20
|
"./style.css": "./dist/style.css",
|
|
21
|
+
"./file-worker": "./dist/file-worker.js",
|
|
21
22
|
"./package.json": "./package.json"
|
|
22
23
|
},
|
|
23
24
|
"publishConfig": {
|
|
24
25
|
"access": "public"
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
|
-
"build": "vite build && npm run build:types && npm run verify:types && npm run verify:no-leak && npm run verify:tokens",
|
|
28
|
+
"build": "vite build && node scripts/copy-worker.mjs && npm run build:types && npm run verify:types && npm run verify:no-leak && npm run verify:tokens",
|
|
28
29
|
"build:types": "tsc -p tsconfig.build.json",
|
|
29
30
|
"verify:types": "tsc -p tsconfig.verify.json",
|
|
30
31
|
"verify:no-leak": "node scripts/verify-no-leak.mjs",
|