@dcs-tech/ui 0.8.0 → 0.10.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/CHANGELOG.md +496 -0
- package/README.md +56 -5
- package/dist/{ChartImageMenu-AsfvmdTH.js → ChartImageMenu-3OfqNFyt.js} +557 -546
- package/dist/{ChartView-CW3m4Z_1.js → ChartView-n4G5_2ro.js} +35 -31
- package/dist/{SummaryChart-CxRjK_HU.js → SummaryChart-i6fOdrDM.js} +2 -2
- package/dist/{SummaryImage-DeYs2Jgj.js → SummaryImage-CCt5ozD9.js} +2 -2
- package/dist/{SummarySeeAll-CrmROhBv.js → SummarySeeAll-BY8knsRe.js} +5 -5
- package/dist/assets/fileTask.worker--Q3rI3Bn.js +1 -0
- package/dist/{columnValue-DwUqueZ6.js → columnValue-74XDBcVF.js} +219 -192
- package/dist/{exportContext-BKFnNQ0q.js → exportContext-C52ZuHd8.js} +2 -2
- package/dist/{exportEngine-CZ22cX7a.js → exportEngine-BmDly7iw.js} +3 -3
- package/dist/file-worker.js +1 -1
- package/dist/{fileActions-COf5Q4Eg.js → fileActions-CFNO14Aj.js} +1 -1
- package/dist/{geometry-yZmKN662.js → geometry-DG134nYI.js} +379 -273
- package/dist/index.js +12808 -9621
- package/dist/{labels-CnqqTrne.js → labels-BPItSeRU.js} +2 -0
- package/dist/{runFileTask--4YjQH7Y.js → runFileTask-BIZTFnZP.js} +55 -39
- package/dist/scrollArea-D84Cwm4o.js +310 -0
- package/dist/style.css +1 -1
- package/dist/{summaryChartData-CARqGRUl.js → summaryChartData-BiQYJbYZ.js} +8 -2
- package/dist/types/components/Alert/Alert.d.ts +16 -0
- package/dist/types/components/Alert/index.d.ts +2 -0
- package/dist/types/components/Card/Card.d.ts +4 -3
- package/dist/types/components/Card/index.d.ts +1 -1
- package/dist/types/components/Charts/Funnel.d.ts +2 -1
- package/dist/types/components/Charts/chartImage.d.ts +1 -0
- package/dist/types/components/ChipInput/ChipTags.d.ts +3 -0
- package/dist/types/components/CommandPalette/CommandPaletteTrigger.d.ts +9 -0
- package/dist/types/components/CommandPalette/index.d.ts +2 -0
- package/dist/types/components/DataTable/TablePagination.d.ts +1 -1
- package/dist/types/components/DataTable/TableToolbar.d.ts +2 -1
- package/dist/types/components/DataTable/TableView.d.ts +1 -0
- package/dist/types/components/DataTable/cards/cardFields.d.ts +1 -0
- package/dist/types/components/DataTable/defaults.d.ts +4 -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 +19 -2
- package/dist/types/components/DataTable/ui-local/TableReorderList.d.ts +13 -0
- package/dist/types/components/DataTable/ui.d.ts +2 -1
- package/dist/types/components/DataTable/useTable.d.ts +1 -0
- package/dist/types/components/DatePicker/PeriodGrid.d.ts +13 -0
- package/dist/types/components/DatePicker/PeriodPicker.d.ts +19 -0
- package/dist/types/components/DatePicker/index.d.ts +1 -1
- package/dist/types/components/Dialog/dialogSlots.d.ts +9 -0
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +8 -0
- package/dist/types/components/FieldWrapper/index.d.ts +1 -1
- package/dist/types/components/Fields/index.d.ts +1 -1
- package/dist/types/components/Image/ImageEditor.d.ts +21 -0
- package/dist/types/components/Image/ImagePicker.d.ts +10 -1
- package/dist/types/components/Image/imageRender.d.ts +33 -0
- package/dist/types/components/Image/index.d.ts +3 -1
- package/dist/types/components/Image/prepareImage.d.ts +4 -3
- package/dist/types/components/Link/Link.d.ts +22 -0
- package/dist/types/components/Link/index.d.ts +2 -0
- package/dist/types/components/NavList/NavList.d.ts +13 -0
- package/dist/types/components/NavList/index.d.ts +2 -0
- package/dist/types/components/PageProgress/PageProgress.d.ts +10 -0
- package/dist/types/components/PageProgress/index.d.ts +2 -0
- package/dist/types/components/Pagination/Pagination.d.ts +19 -0
- package/dist/types/components/Pagination/index.d.ts +2 -0
- package/dist/types/components/Popover/Popover.d.ts +1 -1
- package/dist/types/components/Popover/floatingPosition.d.ts +4 -0
- package/dist/types/components/ReorderList/ReorderGroup.d.ts +16 -0
- package/dist/types/components/ReorderList/ReorderList.d.ts +55 -0
- package/dist/types/components/ReorderList/crossListDrag.d.ts +61 -0
- package/dist/types/components/ReorderList/index.d.ts +5 -0
- package/dist/types/components/ReorderList/useReorderDrag.d.ts +28 -0
- package/dist/types/components/Tooltip/useTooltip.d.ts +4 -0
- package/dist/types/components/UIProvider/UILabelsContext.d.ts +86 -0
- package/dist/types/core/hooks/index.d.ts +1 -0
- package/dist/types/core/hooks/useMeasuredState.d.ts +1 -0
- package/dist/types/core/logic/alert.logic.d.ts +3 -0
- package/dist/types/core/logic/commandPalette.logic.d.ts +2 -0
- package/dist/types/core/logic/datePicker.logic.d.ts +12 -0
- package/dist/types/core/logic/fieldWrapper.logic.d.ts +6 -1
- package/dist/types/core/logic/imageEditor.logic.d.ts +132 -0
- package/dist/types/core/logic/imageTransform.logic.d.ts +57 -0
- package/dist/types/core/logic/index.d.ts +9 -0
- package/dist/types/core/logic/inertProps.d.ts +3 -0
- package/dist/types/core/logic/pageProgress.logic.d.ts +3 -0
- package/dist/types/core/logic/pagination.logic.d.ts +7 -0
- package/dist/types/core/logic/periodPicker.logic.d.ts +86 -0
- package/dist/types/core/logic/reorder.logic.d.ts +49 -0
- package/dist/types/core/types/chipinput.types.d.ts +3 -1
- package/dist/types/core/types/collapsible.types.d.ts +3 -0
- package/dist/types/core/types/datePicker.types.d.ts +7 -0
- package/dist/types/core/types/field.types.d.ts +6 -3
- package/dist/types/core/types/fieldWrapper.types.d.ts +2 -0
- package/dist/types/core/types/fields.types.d.ts +6 -1
- package/dist/types/core/types/form.types.d.ts +1 -0
- package/dist/types/core/types/format.types.d.ts +2 -0
- package/dist/types/core/types/input.types.d.ts +2 -0
- package/dist/types/core/types/navigation.types.d.ts +1 -0
- package/dist/types/core/types/select.types.d.ts +2 -6
- package/dist/types/core/types/suggest.types.d.ts +2 -0
- package/dist/types/index.d.ts +25 -7
- package/package.json +3 -2
- package/dist/assets/fileTask.worker-BHT1olUk.js +0 -1
- package/dist/scrollArea-Dd2dNMV4.js +0 -236
- package/dist/types/components/DataTable/ui-local/DragAndDropList/DragAndDropList.d.ts +0 -4
- package/dist/types/components/DataTable/ui-local/DragAndDropList/index.d.ts +0 -3
- package/dist/types/components/DataTable/ui-local/DragAndDropList/types.d.ts +0 -70
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { DateDisplayFormat, DateTextOrder } from '../types';
|
|
2
|
+
import { type DateHighlightAction, type IsoDay } from './datePicker.logic';
|
|
3
|
+
export type IsoPeriod = string;
|
|
4
|
+
export type PeriodMode = 'month' | 'year';
|
|
5
|
+
export interface PeriodBounds {
|
|
6
|
+
min: IsoPeriod;
|
|
7
|
+
max: IsoPeriod;
|
|
8
|
+
}
|
|
9
|
+
export declare const PERIOD_COLUMNS = 3;
|
|
10
|
+
export declare const PERIOD_PAGE_SIZE = 12;
|
|
11
|
+
export declare function toPeriod(value: unknown, mode: PeriodMode, bound?: 'start' | 'end'): IsoPeriod;
|
|
12
|
+
export declare function shiftPeriod(period: IsoPeriod, mode: PeriodMode, n: number): IsoPeriod;
|
|
13
|
+
export declare function resolvePeriodBounds(opts: {
|
|
14
|
+
mode: PeriodMode;
|
|
15
|
+
min?: string;
|
|
16
|
+
max?: string;
|
|
17
|
+
yearRange?: {
|
|
18
|
+
back?: number;
|
|
19
|
+
ahead?: number;
|
|
20
|
+
};
|
|
21
|
+
today?: IsoDay;
|
|
22
|
+
}): PeriodBounds;
|
|
23
|
+
export declare const isPeriodInBounds: (period: IsoPeriod, bounds: PeriodBounds) => boolean;
|
|
24
|
+
export declare function clampPeriod(period: IsoPeriod, bounds: PeriodBounds): IsoPeriod;
|
|
25
|
+
export declare function openingPeriod(value: unknown, opts: {
|
|
26
|
+
mode: PeriodMode;
|
|
27
|
+
bounds: PeriodBounds;
|
|
28
|
+
today?: IsoDay;
|
|
29
|
+
}): IsoPeriod;
|
|
30
|
+
export interface PeriodCell {
|
|
31
|
+
period: IsoPeriod;
|
|
32
|
+
year: number;
|
|
33
|
+
month: number;
|
|
34
|
+
isCurrent: boolean;
|
|
35
|
+
isSelected: boolean;
|
|
36
|
+
isHighlighted: boolean;
|
|
37
|
+
inRange: boolean;
|
|
38
|
+
isRangeStart: boolean;
|
|
39
|
+
isRangeEnd: boolean;
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface PeriodGridView {
|
|
43
|
+
firstYear: number;
|
|
44
|
+
lastYear: number;
|
|
45
|
+
rows: PeriodCell[][];
|
|
46
|
+
canPagePrev: boolean;
|
|
47
|
+
canPageNext: boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare function buildPeriodGrid(opts: {
|
|
50
|
+
mode: PeriodMode;
|
|
51
|
+
cursor: IsoPeriod;
|
|
52
|
+
bounds: PeriodBounds;
|
|
53
|
+
today?: IsoDay;
|
|
54
|
+
selected?: IsoPeriod;
|
|
55
|
+
rangeFrom?: IsoPeriod;
|
|
56
|
+
rangeTo?: IsoPeriod;
|
|
57
|
+
}): PeriodGridView;
|
|
58
|
+
export declare function movePeriodCursor(from: IsoPeriod, action: DateHighlightAction, opts: {
|
|
59
|
+
mode: PeriodMode;
|
|
60
|
+
bounds: PeriodBounds;
|
|
61
|
+
}): IsoPeriod;
|
|
62
|
+
export declare function extendPeriodRange(range: {
|
|
63
|
+
from?: IsoPeriod;
|
|
64
|
+
to?: IsoPeriod;
|
|
65
|
+
}, picked: IsoPeriod, mode: PeriodMode): {
|
|
66
|
+
from: IsoPeriod;
|
|
67
|
+
to: IsoPeriod;
|
|
68
|
+
};
|
|
69
|
+
export interface PeriodTextOptions {
|
|
70
|
+
mode: PeriodMode;
|
|
71
|
+
within?: IsoPeriod;
|
|
72
|
+
today?: IsoDay;
|
|
73
|
+
order?: DateTextOrder;
|
|
74
|
+
monthNames?: string[];
|
|
75
|
+
monthNamesShort?: string[];
|
|
76
|
+
}
|
|
77
|
+
export declare function parsePeriodText(text: unknown, opts: PeriodTextOptions): IsoPeriod | null;
|
|
78
|
+
export declare function parsePeriodRangeText(text: unknown, opts: PeriodTextOptions): {
|
|
79
|
+
from: IsoPeriod;
|
|
80
|
+
to: IsoPeriod;
|
|
81
|
+
} | null;
|
|
82
|
+
export declare function formatPeriodText(value: unknown, mode: PeriodMode, opts?: {
|
|
83
|
+
locale?: string;
|
|
84
|
+
monthNames?: string[];
|
|
85
|
+
}): string;
|
|
86
|
+
export declare function periodPlaceholder(mode: PeriodMode, format?: DateDisplayFormat): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface ReorderSlot {
|
|
2
|
+
start: number;
|
|
3
|
+
size: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ReorderRange {
|
|
6
|
+
min: number;
|
|
7
|
+
max: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function moveItem<T>(items: readonly T[], from: number, to: number): T[];
|
|
10
|
+
export declare function reorderRange(fixed: readonly boolean[], from: number): ReorderRange;
|
|
11
|
+
export declare function reorderTarget(slots: readonly ReorderSlot[], from: number, offset: number, range: ReorderRange): number;
|
|
12
|
+
export declare function reorderShift(slots: readonly ReorderSlot[], from: number, to: number, index: number): number;
|
|
13
|
+
export declare function reorderDropOffset(slots: readonly ReorderSlot[], from: number, to: number): number;
|
|
14
|
+
export declare function reorderDragLimits(slots: readonly ReorderSlot[], from: number, range: ReorderRange): ReorderRange;
|
|
15
|
+
export declare function stepReorderIndex(current: number, step: -1 | 1, range: ReorderRange): number;
|
|
16
|
+
export declare function autoScrollStep(pointer: number, edgeStart: number, edgeEnd: number, zone: number, maxStep: number): number;
|
|
17
|
+
export interface ReorderPoint {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ReorderSize {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ReorderFlow {
|
|
26
|
+
axis: 'vertical' | 'horizontal' | 'wrap';
|
|
27
|
+
width: number;
|
|
28
|
+
gapX: number;
|
|
29
|
+
gapY: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function flowPositions(sizes: readonly ReorderSize[], flow: ReorderFlow): ReorderPoint[];
|
|
32
|
+
export declare function flowExtent(sizes: readonly ReorderSize[], flow: ReorderFlow): ReorderSize;
|
|
33
|
+
export declare function insertItem<T>(items: readonly T[], index: number, item: T): T[];
|
|
34
|
+
export declare function insertionPoints(sizes: readonly ReorderSize[], dragged: ReorderSize, flow: ReorderFlow, range: ReorderRange): ReorderPoint[];
|
|
35
|
+
export declare function nearestPoint(points: readonly ReorderPoint[], at: ReorderPoint): number;
|
|
36
|
+
export interface ReorderAcceptRules {
|
|
37
|
+
from?: number;
|
|
38
|
+
sortable?: boolean;
|
|
39
|
+
maxItems?: number;
|
|
40
|
+
replaceWhenFull?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare function acceptedRange(fixed: readonly boolean[], rules: ReorderAcceptRules): ReorderRange | null;
|
|
43
|
+
export interface ReorderStop {
|
|
44
|
+
list: number;
|
|
45
|
+
index: number;
|
|
46
|
+
}
|
|
47
|
+
export declare function stepAcrossLists(ranges: ReadonlyArray<ReorderRange | null>, current: ReorderStop, step: -1 | 1): ReorderStop;
|
|
48
|
+
export declare function reorderSelectedValues<V>(value: readonly V[], shown: readonly V[]): V[];
|
|
49
|
+
export declare function fixedSelectValues<V>(value: readonly V[], fixedItems: number, defaultSelected: readonly V[]): Set<V>;
|
|
@@ -48,7 +48,9 @@ export type ChipInputSize = FieldSize;
|
|
|
48
48
|
export type ChipInputVariant = FieldVariant;
|
|
49
49
|
export type ChipInputLayout = FieldLayout;
|
|
50
50
|
export interface ChipInputProps extends TextFieldProps<string, HTMLDivElement> {
|
|
51
|
-
sources
|
|
51
|
+
sources?: ChipSources;
|
|
52
|
+
tags?: string[];
|
|
53
|
+
onTagsChange?: (tags: string[]) => void;
|
|
52
54
|
syntax?: ChipTokenSyntax;
|
|
53
55
|
inputClassName?: string;
|
|
54
56
|
previewData?: Record<string, Record<string, any>>;
|
|
@@ -23,6 +23,7 @@ export interface CollapsibleItemProps {
|
|
|
23
23
|
disabled?: boolean;
|
|
24
24
|
collapsedIcon?: ReactNode;
|
|
25
25
|
expandedIcon?: ReactNode;
|
|
26
|
+
keepMounted?: boolean;
|
|
26
27
|
onChange?: (expanded: boolean) => void;
|
|
27
28
|
authorize?: CollapsibleAuthorize;
|
|
28
29
|
className?: string;
|
|
@@ -48,6 +49,7 @@ export interface CollapsibleProps {
|
|
|
48
49
|
disclosure?: CollapsibleDisclosure;
|
|
49
50
|
iconTile?: boolean;
|
|
50
51
|
headingLevel?: CollapsibleHeadingLevel;
|
|
52
|
+
keepMounted?: boolean;
|
|
51
53
|
disabled?: boolean;
|
|
52
54
|
className?: string;
|
|
53
55
|
style?: CSSProperties;
|
|
@@ -73,6 +75,7 @@ export interface CollapsibleContextValue {
|
|
|
73
75
|
disclosure: CollapsibleDisclosure;
|
|
74
76
|
iconTile: boolean;
|
|
75
77
|
headingLevel: CollapsibleHeadingLevel;
|
|
78
|
+
keepMounted: boolean;
|
|
76
79
|
keyboardNavigation: boolean;
|
|
77
80
|
disabled: boolean;
|
|
78
81
|
animated: boolean;
|
|
@@ -3,14 +3,20 @@ import type { FieldChangeEvent } from './control.types';
|
|
|
3
3
|
import type { FieldPopupProps, TextFieldProps } from './field.types';
|
|
4
4
|
export type DateDisplayFormat = 'dd-mm-yyyy' | 'dd/mm/yyyy' | 'yyyy-mm-dd';
|
|
5
5
|
export type DateTextOrder = 'dmy' | 'mdy' | 'ymd';
|
|
6
|
+
export type DatePickerMode = 'date' | 'month' | 'year';
|
|
6
7
|
export interface DateRangeValue {
|
|
7
8
|
from: string;
|
|
8
9
|
to: string;
|
|
9
10
|
}
|
|
10
11
|
export interface DatePickerBaseProps extends Omit<TextFieldProps<string, HTMLInputElement, FieldChangeEvent<string>>, 'value' | 'onChange'>, FieldPopupProps {
|
|
12
|
+
picker?: DatePickerMode;
|
|
11
13
|
withTime?: boolean;
|
|
12
14
|
min?: string;
|
|
13
15
|
max?: string;
|
|
16
|
+
yearRange?: {
|
|
17
|
+
back?: number;
|
|
18
|
+
ahead?: number;
|
|
19
|
+
};
|
|
14
20
|
displayFormat?: DateDisplayFormat;
|
|
15
21
|
textOrder?: DateTextOrder;
|
|
16
22
|
weekStart?: number;
|
|
@@ -27,6 +33,7 @@ export interface DatePickerBaseProps extends Omit<TextFieldProps<string, HTMLInp
|
|
|
27
33
|
placement?: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
28
34
|
showCalendarIcon?: boolean;
|
|
29
35
|
clearable?: boolean;
|
|
36
|
+
autoComplete?: string;
|
|
30
37
|
placeholder?: string;
|
|
31
38
|
hint?: ReactNode;
|
|
32
39
|
error?: ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, FocusEvent, KeyboardEvent, ReactNode } from 'react';
|
|
2
2
|
import type { DataAttributes } from './common.types';
|
|
3
|
-
import type { FieldTooltipSupport } from './fieldWrapper.types';
|
|
3
|
+
import type { FieldTooltipSupport, FieldWidth } from './fieldWrapper.types';
|
|
4
4
|
import type { ControlLabelPosition, ControlLayout, ControlSize, ControlVariant, FieldCellContext, FieldChangeEvent, FieldColor, ToggleVariant } from './control.types';
|
|
5
5
|
import type { FieldKeyboardConfig } from './keyboard.types';
|
|
6
6
|
export interface FieldIdentityProps<V = any, C = FieldChangeEvent<V>> {
|
|
@@ -32,7 +32,6 @@ export interface FieldChromeProps {
|
|
|
32
32
|
className?: string;
|
|
33
33
|
labelClassName?: string;
|
|
34
34
|
style?: CSSProperties;
|
|
35
|
-
fullWidth?: boolean;
|
|
36
35
|
}
|
|
37
36
|
export interface FieldA11yProps {
|
|
38
37
|
'aria-label'?: string;
|
|
@@ -73,8 +72,12 @@ export interface FieldHandle {
|
|
|
73
72
|
}
|
|
74
73
|
export type BaseFieldProps<V = any, E extends HTMLElement = HTMLElement, C = FieldChangeEvent<V>> = FieldIdentityProps<V, C> & FieldChromeProps & FieldA11yProps & FieldInteractionProps<E> & FieldCellContext & FieldTooltipSupport & DataAttributes;
|
|
75
74
|
export type TextFieldProps<V = any, E extends HTMLElement = HTMLElement, C = FieldChangeEvent<V>> = BaseFieldProps<V, E, C> & ControlSurfaceProps & {
|
|
75
|
+
width?: FieldWidth;
|
|
76
|
+
fullWidth?: boolean;
|
|
76
77
|
placeholder?: string;
|
|
77
78
|
inputMode?: 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url' | 'none';
|
|
78
79
|
spellCheck?: boolean;
|
|
79
80
|
};
|
|
80
|
-
export type ToggleFieldProps<V = any, E extends HTMLElement = HTMLInputElement, C = FieldChangeEvent<V>> = BaseFieldProps<V, E, C> & ToggleSurfaceProps
|
|
81
|
+
export type ToggleFieldProps<V = any, E extends HTMLElement = HTMLInputElement, C = FieldChangeEvent<V>> = BaseFieldProps<V, E, C> & ToggleSurfaceProps & {
|
|
82
|
+
fullWidth?: boolean;
|
|
83
|
+
};
|
|
@@ -5,6 +5,7 @@ export type FieldLayout = ControlLayout;
|
|
|
5
5
|
export type FieldSize = ControlSize;
|
|
6
6
|
export type FieldVariant = ControlVariant;
|
|
7
7
|
export type { ToggleVariant } from './control.types';
|
|
8
|
+
export type FieldWidth = 'full' | 'auto' | number | string;
|
|
8
9
|
export interface FieldTooltipSupport {
|
|
9
10
|
tooltip?: TooltipProp;
|
|
10
11
|
tooltipTrigger?: TooltipTrigger;
|
|
@@ -19,6 +20,7 @@ export interface FieldWrapperProps extends FieldTooltipSupport {
|
|
|
19
20
|
className?: string;
|
|
20
21
|
labelClassName?: string;
|
|
21
22
|
style?: CSSProperties;
|
|
23
|
+
width?: FieldWidth;
|
|
22
24
|
disabled?: boolean;
|
|
23
25
|
children: ReactNode;
|
|
24
26
|
extraMessages?: ReactNode;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DatePickerProps } from './datePicker.types';
|
|
1
2
|
import { ReactNode, ComponentType, Dispatch, SetStateAction } from 'react';
|
|
2
3
|
import type { InputProps } from './input.types';
|
|
3
4
|
import type { SwitchProps } from './switch.types';
|
|
@@ -195,6 +196,10 @@ export interface ChildFieldDefinition<T> extends BaseFieldDefinition<T> {
|
|
|
195
196
|
props?: Record<string, any>;
|
|
196
197
|
};
|
|
197
198
|
}
|
|
199
|
+
export interface DateFieldDefinition<T> extends BaseFieldDefinition<T> {
|
|
200
|
+
field: 'date';
|
|
201
|
+
fprop?: Partial<DatePickerProps>;
|
|
202
|
+
}
|
|
198
203
|
export interface EditableTableFieldDefinition<T> extends BaseFieldDefinition<T> {
|
|
199
204
|
field: 'editableTable';
|
|
200
205
|
fprop?: Record<string, any>;
|
|
@@ -203,7 +208,7 @@ export interface ChipInputFieldDefinition<T> extends BaseFieldDefinition<T> {
|
|
|
203
208
|
field: 'chipinput';
|
|
204
209
|
fprop?: Record<string, any>;
|
|
205
210
|
}
|
|
206
|
-
export type FieldDefinition<T> = InputFieldDefinition<T> | SwitchFieldDefinition<T> | SelectFieldDefinition<T> | SuggestFieldDefinition<T> | RadioFieldDefinition<T> | CheckboxFieldDefinition<T> | ButtonFieldDefinition<T> | ChildFieldDefinition<T> | EditableTableFieldDefinition<T> | ChipInputFieldDefinition<T>;
|
|
211
|
+
export type FieldDefinition<T> = InputFieldDefinition<T> | SwitchFieldDefinition<T> | SelectFieldDefinition<T> | SuggestFieldDefinition<T> | RadioFieldDefinition<T> | CheckboxFieldDefinition<T> | ButtonFieldDefinition<T> | ChildFieldDefinition<T> | DateFieldDefinition<T> | EditableTableFieldDefinition<T> | ChipInputFieldDefinition<T>;
|
|
207
212
|
export type FieldsDefinition<T> = Array<FieldDefinition<T>>;
|
|
208
213
|
export type ErrorObject = Record<string, string>;
|
|
209
214
|
export type TouchedObject = Record<string, boolean>;
|
|
@@ -119,6 +119,7 @@ export interface FormProps<T = any> extends FormCallbacks<T> {
|
|
|
119
119
|
columns?: number;
|
|
120
120
|
header?: FormHeader;
|
|
121
121
|
footer?: FormFooter;
|
|
122
|
+
dialogSlots?: boolean;
|
|
122
123
|
actions?: Array<FormAction<T>>;
|
|
123
124
|
showSubmit?: boolean;
|
|
124
125
|
submitButton?: Partial<FormAction<T>>;
|
|
@@ -25,6 +25,8 @@ export type InputEditableTableCellProps = FieldCellContext;
|
|
|
25
25
|
export interface InputProps extends TextFieldProps<string | number, HTMLInputElement | HTMLTextAreaElement, ChangeEvent<HTMLInputElement | HTMLTextAreaElement>> {
|
|
26
26
|
type?: InputType;
|
|
27
27
|
autoComplete?: string;
|
|
28
|
+
accept?: string;
|
|
29
|
+
multiple?: boolean;
|
|
28
30
|
validation?: ValidationConfig;
|
|
29
31
|
min?: number | string;
|
|
30
32
|
max?: number | string;
|
|
@@ -109,6 +109,7 @@ export interface SelectProps extends TextFieldProps<any, HTMLDivElement, SelectE
|
|
|
109
109
|
virtualScroll?: boolean | VirtualScrollConfig;
|
|
110
110
|
keyboard?: FieldKeyboardConfig & KeyboardConfig;
|
|
111
111
|
position?: DropdownPosition | PositionConfig;
|
|
112
|
+
listWidth?: 'fit' | 'field';
|
|
112
113
|
emptyState?: EmptyStateConfig;
|
|
113
114
|
loading?: LoadingConfig;
|
|
114
115
|
triggerClassName?: string;
|
|
@@ -140,8 +141,6 @@ export interface SelectState {
|
|
|
140
141
|
searchTerm: string;
|
|
141
142
|
filteredOptions: SelectOption[];
|
|
142
143
|
highlightedIndex: number;
|
|
143
|
-
draggedItem: SelectOption | null;
|
|
144
|
-
draggedOver: SelectOption | null;
|
|
145
144
|
collapsedGroups: Set<string>;
|
|
146
145
|
isInModal: boolean;
|
|
147
146
|
}
|
|
@@ -167,10 +166,7 @@ export interface UseSelectReturn {
|
|
|
167
166
|
pickHighlighted: () => boolean;
|
|
168
167
|
handleSearchChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
169
168
|
handleClickOutside: (event: MouseEvent) => void;
|
|
170
|
-
|
|
171
|
-
handleDragOver: (event: DragEvent, option: SelectOption) => void;
|
|
172
|
-
handleDragEnd: () => void;
|
|
173
|
-
handleDrop: (event: DragEvent, targetOption: SelectOption) => void;
|
|
169
|
+
handleReorder: (rows: SelectOption[]) => void;
|
|
174
170
|
handleSelectAll: () => void;
|
|
175
171
|
handleClear: () => void;
|
|
176
172
|
handleBlur: (event: FocusEvent<HTMLDivElement>) => void;
|
|
@@ -63,6 +63,7 @@ export interface SuggestionListProps<T = any> {
|
|
|
63
63
|
inputRef: RefObject<HTMLInputElement | null>;
|
|
64
64
|
containerRef: RefObject<HTMLDivElement | null>;
|
|
65
65
|
portal?: boolean;
|
|
66
|
+
listWidth?: 'fit' | 'field';
|
|
66
67
|
zIndex?: number;
|
|
67
68
|
exiting?: boolean;
|
|
68
69
|
renderItem?: (item: T, isHighlighted: boolean, searchValue: string) => ReactNode;
|
|
@@ -94,6 +95,7 @@ export interface SuggestProps extends TextFieldProps<string, HTMLInputElement, C
|
|
|
94
95
|
portal?: boolean;
|
|
95
96
|
portalContainer?: Element;
|
|
96
97
|
position?: 'auto' | 'top' | 'bottom';
|
|
98
|
+
listWidth?: 'fit' | 'field';
|
|
97
99
|
}
|
|
98
100
|
export interface SuggestionGroup {
|
|
99
101
|
name: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type { TypographyProps, TypographyVariant, TypographyColor, TypographyAli
|
|
|
6
6
|
export { Button, ButtonGroup } from './components/Button';
|
|
7
7
|
export type { ButtonProps, ButtonGroupProps, ButtonVariant, ButtonSize, ButtonColor, ButtonShape, LoadingPosition, GroupOrientation, ButtonGroupContextValue, } from './components/Button';
|
|
8
8
|
export { FieldWrapper } from './components/FieldWrapper';
|
|
9
|
-
export type { FieldWrapperProps, FieldLayout, FieldSize, } from './components/FieldWrapper';
|
|
9
|
+
export type { FieldWrapperProps, FieldWidth, FieldLayout, FieldSize, } from './components/FieldWrapper';
|
|
10
10
|
export { FieldContext, FieldProvider, useFieldContext, useFieldSurface, useToggleSurface, useField, useFormKeyboard, } from './components/FieldContext';
|
|
11
11
|
export type { FieldContextValue, FieldProviderProps, FieldSurfaceInput, FieldSurfaceDefaults, ResolvedFieldSurface, ResolvedToggleSurface, UseFieldOptions, UseFieldResult, UseFormKeyboardOptions, } from './components/FieldContext';
|
|
12
12
|
export type { BaseFieldProps, TextFieldProps, ToggleFieldProps, FieldIdentityProps, FieldChromeProps, FieldA11yProps, FieldInteractionProps, FieldSurfaceProps, ControlSurfaceProps, ToggleSurfaceProps, FieldPopupProps, FieldHandle, FieldFocusEvent, OpenReason, FieldKeyboardConfig, FieldWidget, FieldKeyState, FieldKeyAction, KeyResolution, KeyEventLike, NavAction, GridMode, } from './core/types';
|
|
@@ -23,7 +23,7 @@ export type { InputProps, InputType, InputVariant, InputSize, InputLayout, Valid
|
|
|
23
23
|
export { Select, useSelect } from './components/Select';
|
|
24
24
|
export type { SelectProps, SelectOption, SelectSize, SelectLayout, SelectState, SelectEvent, SelectAccessibilityConfig, UseSelectReturn, UseSelectConfig, MultiSelectConfig, SearchConfig, SortConfig, ReorderConfig, GroupConfig, VirtualScrollConfig, KeyboardConfig, DropdownPosition, PositionConfig, EmptyStateConfig, LoadingConfig, ChipProps, GroupDisplayProps, OptionItemProps, AutoScrollState, DropdownDimensions, OptionValue, } from './components/Select';
|
|
25
25
|
export { DatePicker, Calendar } from './components/DatePicker';
|
|
26
|
-
export type { DatePickerProps, DatePickerBaseProps, DatePickerSingleProps, DatePickerRangeProps, DateRangeValue, DateDisplayFormat, DateTextOrder, CalendarProps, } from './components/DatePicker';
|
|
26
|
+
export type { DatePickerProps, DatePickerBaseProps, DatePickerSingleProps, DatePickerRangeProps, DatePickerMode, DateRangeValue, DateDisplayFormat, DateTextOrder, CalendarProps, } from './components/DatePicker';
|
|
27
27
|
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';
|
|
@@ -31,7 +31,7 @@ export { Collapsible, CollapsibleItem, CollapsibleContext, useCollapsibleContext
|
|
|
31
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
|
-
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';
|
|
34
|
+
export type { FieldsProps, FieldProps, FieldsBaseProps, FieldsWithSetState, FieldsWithOnChange, FieldDefinition, FieldsDefinition, FieldAuthorize, FieldTooltipProps, FieldComponentRegistry, FieldEditableTableProps, BaseFieldDefinition, InputFieldDefinition, SwitchFieldDefinition, SelectFieldDefinition, SuggestFieldDefinition, RadioFieldDefinition, CheckboxFieldDefinition, ButtonFieldDefinition, ChildFieldDefinition, DateFieldDefinition, EditableTableFieldDefinition, ChipInputFieldDefinition, ConditionOperator, ConditionCompareType, ConditionObject, ConditionRegexObject, ConditionFunction, ConditionSimpleKey, Condition, ConditionContext, NestedKeys, NestedValue, ResetKeyConfig, SelectCopyKeyConfig, ChangeContext, ChangeAdditionalDataContext, SelectAdditionalDataContext, EditableTableCustomPropContext, ErrorObject, TouchedObject, } from './components/Fields';
|
|
35
35
|
export { Form } from './components/Form';
|
|
36
36
|
export type { FormProps, FormMethods, FormSection, FormAction, FormValidation, FormHeader, FormFooter, FormCallbacks, FormState, FormLayout, FormSize, FormVariant, } from './components/Form';
|
|
37
37
|
export { validateStandardSchema, isStandardSchema } from './core/logic/standardSchema.logic';
|
|
@@ -57,16 +57,21 @@ export type { BadgeProps, BadgeColor, BadgeVariant, BadgeSize } from './componen
|
|
|
57
57
|
export { Avatar, AvatarGroup } from './components/Avatar';
|
|
58
58
|
export type { AvatarProps, AvatarGroupProps, AvatarSize, AvatarShape } from './components/Avatar';
|
|
59
59
|
export { Card } from './components/Card';
|
|
60
|
-
export type { CardProps, CardVariant, CardPadding } from './components/Card';
|
|
60
|
+
export type { CardProps, CardVariant, CardPadding, CardHeadingLevel } from './components/Card';
|
|
61
|
+
export { ReorderList, ReorderGroup } from './components/ReorderList';
|
|
62
|
+
export type { ReorderListProps, ReorderItemState, ReorderHandleProps, ReorderDragFrom, ReorderAxis, ReorderMove, ReorderLabels, ReorderListHandle, ReorderWhenFull, ReorderGroupProps, ReorderGroupMove, } from './components/ReorderList';
|
|
61
63
|
export { Popover } from './components/Popover';
|
|
62
64
|
export type { PopoverProps } from './components/Popover';
|
|
63
65
|
export { DropdownMenu } from './components/DropdownMenu';
|
|
64
66
|
export type { DropdownMenuProps, DropdownMenuItem } from './components/DropdownMenu';
|
|
65
|
-
export { ImagePicker, ImageStrip, ImageViewer, prepareImage, ImagePrepareError } from './components/Image';
|
|
66
|
-
export type { ImagePickerProps, ImagePickerItem, ImageStripProps, StripImage, ImageViewerProps, ViewerImage, PrepareImageOptions, PreparedImage, } from './components/Image';
|
|
67
|
+
export { ImagePicker, ImageStrip, ImageViewer, ImageEditor, prepareImage, ImagePrepareError } from './components/Image';
|
|
68
|
+
export type { ImagePickerProps, ImagePickerItem, ImageStripProps, StripImage, ImageViewerProps, ViewerImage, PrepareImageOptions, PreparedImage, ImagePickerEditorOptions, ImageEditorProps, ImageEditorResult, ImageEditorPanelContext, } from './components/Image';
|
|
69
|
+
export { resolveImageTransform, imageOutputSize } from './core/logic/imageTransform.logic';
|
|
70
|
+
export type { ImageTransform, ImageTransformInput, ImageCropRect, ImageQuarterTurn, ImageSize, ImageOutputLimits, } from './core/logic/imageTransform.logic';
|
|
71
|
+
export type { ImageEditorOptions, ImageEditorCropOptions, ImageEditorOutputOptions, ImageEditorRatio, } from './core/logic/imageEditor.logic';
|
|
67
72
|
export { Dialog } from './components/Dialog';
|
|
68
73
|
export type { DialogProps, DialogPlacement, DialogSize } from './components/Dialog';
|
|
69
|
-
export { useDialog } from './components/Dialog/DialogHost';
|
|
74
|
+
export { useDialog, DialogHost } from './components/Dialog/DialogHost';
|
|
70
75
|
export { useDialogOpen } from './components/Dialog/dialogOpen';
|
|
71
76
|
export type { DialogApi, DialogChoice, DialogActionProps, ConfirmOptions, ChooseOptions, AlertOptions, } from './components/Dialog/DialogHost';
|
|
72
77
|
export { ToastHost, useToast } from './components/Toast';
|
|
@@ -91,6 +96,19 @@ export type { AppBarProps, AppBarSize, AppBarVariant } from './components/AppBar
|
|
|
91
96
|
export { Breadcrumbs } from './components/Breadcrumbs';
|
|
92
97
|
export type { BreadcrumbsProps } from './components/Breadcrumbs';
|
|
93
98
|
export type { NavItem } from './core/types';
|
|
99
|
+
export { Link } from './components/Link';
|
|
100
|
+
export type { LinkProps, LinkOwnProps, LinkColor, LinkUnderline } from './components/Link';
|
|
101
|
+
export { Alert } from './components/Alert';
|
|
102
|
+
export type { AlertProps } from './components/Alert';
|
|
103
|
+
export type { AlertTone } from './core/logic';
|
|
104
|
+
export { Pagination } from './components/Pagination';
|
|
105
|
+
export type { PaginationProps, PaginationVariant } from './components/Pagination';
|
|
106
|
+
export { CommandPaletteTrigger } from './components/CommandPalette';
|
|
107
|
+
export type { CommandPaletteTriggerProps } from './components/CommandPalette';
|
|
108
|
+
export { PageProgress } from './components/PageProgress';
|
|
109
|
+
export type { PageProgressProps } from './components/PageProgress';
|
|
110
|
+
export { NavList } from './components/NavList';
|
|
111
|
+
export type { NavListProps } from './components/NavList';
|
|
94
112
|
export { useArrowKeyFocus } from './components/ArrowKeyFocus/useArrowKeyFocus';
|
|
95
113
|
export type { ArrowKeyFocusOptions, ArrowKeyFocusHandlers } from './components/ArrowKeyFocus/useArrowKeyFocus';
|
|
96
114
|
export { buildFieldControlClassKeys, buildPopupListClassKeys, buildPopupRowClassKeys, computeTooltipPosition, normalizeTooltip, resolveTooltipPlacementOrder, shouldAnchorToPointer, useMergeRefs, } from './core/logic';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcs-tech/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "React UI component library — fields, buttons, tooltips, tables and design tokens.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"*.css"
|
|
9
9
|
],
|
|
10
10
|
"files": [
|
|
11
|
-
"dist"
|
|
11
|
+
"dist",
|
|
12
|
+
"CHANGELOG.md"
|
|
12
13
|
],
|
|
13
14
|
"main": "./dist/index.js",
|
|
14
15
|
"types": "./dist/types/index.d.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=()=>new DOMException(`Aborted`,`AbortError`);async function t(t,n){if(n.signal?.aborted)throw e();switch(t.kind){case`xlsx`:return l(t.workbook,n);case`pdf`:return p(t,n);default:throw Error(`Unknown file task: ${t.kind}`)}}const n=globalThis;async function r(){let e=await import(`exceljs`),t=[e.default?.default,e.default,e,n.ExcelJS].find(e=>e&&typeof e.Workbook==`function`);if(!t)throw Error(`ExcelJS did not load`);return t}async function i(){let e=await import(`pdfmake/build/pdfmake.js`),t=[e.default?.default,e.default,e,n.pdfMake].find(e=>e&&typeof e.createPdf==`function`);if(!t)throw Error(`pdfmake did not load`);let r=await import(`pdfmake/build/vfs_fonts.js`);return{pdfMake:t,vfs:[r?.default,r,r?.pdfMake?.vfs,r?.default?.pdfMake?.vfs,t.vfs,n.pdfMake?.vfs].find(e=>e&&e[`Roboto-Regular.ttf`])}}const a=e=>ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e,o=e=>`FF`+e.replace(`#`,``).toUpperCase();function s(e,t){if(t&&((t.bold!==void 0||t.italic!==void 0||t.size||t.color)&&(e.font={...e.font??{},...t.bold===void 0?{}:{bold:t.bold},...t.italic===void 0?{}:{italic:t.italic},...t.size?{size:t.size}:{},...t.color?{color:{argb:o(t.color)}}:{}}),t.fill&&(e.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:o(t.fill)}}),t.align&&(e.alignment={horizontal:t.align,vertical:`middle`}),t.numFmt&&(typeof e.value==`number`||e.value instanceof Date)&&(e.numFmt=t.numFmt),t.borderTop||t.borderBottom)){let n=e=>({style:e.style,...e.color?{color:{argb:o(e.color)}}:{}});e.border={...t.borderTop?{top:n(t.borderTop)}:{},...t.borderBottom?{bottom:n(t.borderBottom)}:{}}}}function c(e,t,n){let r=e.addRow(t.values);t.style?.bold&&(r.font={bold:!0}),t.merge&&n>1&&e.mergeCells(r.number,1,r.number,n);let i=t.merge?1:Math.max(t.values.length,0);for(let e=0;e<i;e++){let n=r.getCell(e+1);s(n,t.style),s(n,t.cells?.[e])}}async function l(t,n){let i=new(await(r())).Workbook,l=Math.max(1,t.sheets.reduce((e,t)=>e+t.rows.length,0)),u=Math.max(1,Math.floor(l/50)),d=0;for(let r of t.sheets){let t=i.addWorksheet(r.name),a=r.columns.length;t.columns=r.columns.map((e,t)=>({key:String(t),width:e.width}));for(let e of r.before??[])c(t,e,a);let f=t.addRow(r.columns.map(e=>e.header));f.font={bold:r.headerStyle?.bold??!0},f.eachCell((e,t)=>{let n=r.columns[t-1]?.align;n&&(e.alignment={horizontal:n,vertical:`middle`}),s(e,r.headerStyle)});let p=f.number;r.freeze?t.views=[{state:`frozen`,ySplit:r.freeze.rows??0,xSplit:r.freeze.cols??0}]:r.freezeHeader!==!1&&(t.views=[{state:`frozen`,ySplit:p}]),r.rows.forEach((i,a)=>{let c=t.addRow(i),f=r.cellStyles?.[a],p=r.stripe&&a%2==1;if(r.columns.forEach((e,t)=>{let n=c.getCell(t+1);e.numFmt&&(typeof n.value==`number`||n.value instanceof Date)&&(n.numFmt=e.numFmt),e.align&&(n.alignment={horizontal:e.align,vertical:`middle`}),p&&(n.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:o(r.stripe)}}),s(n,e.style),s(n,f?.[t])}),++d%u===0){if(n.signal?.aborted)throw e();n.progress(d/l*.9)}}),r.autoFilter&&r.rows.length>0&&(t.autoFilter={from:{row:p,column:1},to:{row:p,column:a}});for(let e of r.after??[])c(t,e,a)}let f=await i.xlsx.writeBuffer();return n.progress(1),a(f)}const u={Roboto:{normal:`Roboto-Regular.ttf`,bold:`Roboto-Medium.ttf`,italics:`Roboto-Italic.ttf`,bolditalics:`Roboto-MediumItalic.ttf`}};function d(e){let t=e.hLineWidth??1,n=e.edgeLineWidth??t;return{hLineWidth:(e,r)=>e===0||e===(r.table.headerRows??0)||e===r.table.body.length?n:t,vLineWidth:()=>e.vLineWidth??1,...e.hLineColor?{hLineColor:()=>e.hLineColor}:{},...e.vLineColor?{vLineColor:()=>e.vLineColor}:{},...e.paddingX===void 0?{}:{paddingLeft:()=>e.paddingX,paddingRight:()=>e.paddingX},...e.paddingY===void 0?{}:{paddingTop:()=>e.paddingY,paddingBottom:()=>e.paddingY}}}function f(e){return(t,n)=>({text:e.text.replace(/\{page\}/g,String(t)).replace(/\{pages\}/g,String(n)),...e.font?{font:e.font}:{},alignment:e.alignment??`center`,fontSize:e.fontSize??8,...e.color?{color:e.color}:{},...e.margin?{margin:e.margin}:{}})}async function p(t,n){let r=n.pdfFonts?{fonts:{...n.pdfFonts.fonts,...t.fonts?.fonts},vfs:n.pdfFonts.vfs||t.fonts?.vfs?{...n.pdfFonts.vfs,...t.fonts?.vfs}:void 0}:t.fonts,a=t.footer?{...t.document,footer:f(t.footer)}:t.document,o=t.tableLayouts?Object.fromEntries(Object.entries(t.tableLayouts).map(([e,t])=>[e,d(t)])):void 0,{pdfMake:s,vfs:c}=await i();if(n.progress(.1),n.signal?.aborted)throw e();let l={...u,...r?.fonts??{}},p=r?.vfs?{...c??{},...r.vfs}:c,m=await new Promise((e,t)=>{try{let n=s.createPdf(a,o,l,p).getStream(),r=[];n.on(`data`,e=>r.push(e)),n.on(`error`,t),n.on(`end`,()=>{let t=new Uint8Array(r.reduce((e,t)=>e+t.byteLength,0)),n=0;for(let e of r)t.set(e,n),n+=e.byteLength;e(t.buffer)}),n.end()}catch(e){t(e)}});return n.progress(1),m}let m;const h=self;h.onmessage=async e=>{if(e.data.type===`init`){m=e.data.pdfFonts;return}let{id:n,task:r}=e.data;try{let e=await t(r,{progress:e=>h.postMessage({type:`progress`,id:n,fraction:e}),pdfFonts:m});h.postMessage({type:`done`,id:n,buffer:e},[e])}catch(e){h.postMessage({type:`error`,id:n,message:e instanceof Error?e.message:String(e)})}};
|