@webx-ui/core 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/README.md +21 -3
- package/dist/components/Affix/Affix.d.ts +37 -0
- package/dist/components/Affix/index.d.ts +2 -0
- package/dist/components/Affix/types.d.ts +14 -0
- package/dist/components/Avatar/Avatar.d.ts +31 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/types.d.ts +30 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +8 -0
- package/dist/components/AvatarGroup/index.d.ts +2 -0
- package/dist/components/AvatarGroup/types.d.ts +12 -0
- package/dist/components/Backtop/Backtop.d.ts +31 -0
- package/dist/components/Backtop/index.d.ts +2 -0
- package/dist/components/Backtop/types.d.ts +19 -0
- package/dist/components/Cascader/Cascader.d.ts +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/Descriptions/Descriptions.d.ts +33 -0
- package/dist/components/Descriptions/context.d.ts +5 -0
- package/dist/components/Descriptions/index.d.ts +2 -0
- package/dist/components/Descriptions/types.d.ts +30 -0
- package/dist/components/DescriptionsItem/DescriptionsItem.d.ts +25 -0
- package/dist/components/DescriptionsItem/index.d.ts +1 -0
- package/dist/components/Empty/Empty.d.ts +38 -0
- package/dist/components/Empty/index.d.ts +2 -0
- package/dist/components/Empty/types.d.ts +20 -0
- package/dist/components/EntityCard/EntityCard.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +1 -1
- package/dist/components/Image/Image.d.ts +43 -0
- package/dist/components/Image/index.d.ts +2 -0
- package/dist/components/Image/types.d.ts +26 -0
- package/dist/components/Indicator/Indicator.d.ts +1 -1
- package/dist/components/InputNumber/InputNumber.d.ts +2 -2
- package/dist/components/Loading/Loading.d.ts +34 -0
- package/dist/components/Loading/index.d.ts +2 -0
- package/dist/components/Loading/types.d.ts +25 -0
- package/dist/components/Popconfirm/Popconfirm.d.ts +69 -0
- package/dist/components/Popconfirm/index.d.ts +2 -0
- package/dist/components/Popconfirm/types.d.ts +33 -0
- package/dist/components/Progress/Progress.d.ts +41 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/types.d.ts +26 -0
- package/dist/components/Rate/Rate.d.ts +1 -1
- package/dist/components/Result/Result.d.ts +38 -0
- package/dist/components/Result/index.d.ts +2 -0
- package/dist/components/Result/types.d.ts +15 -0
- package/dist/components/Segmented/Segmented.d.ts +44 -0
- package/dist/components/Segmented/index.d.ts +2 -0
- package/dist/components/Segmented/types.d.ts +23 -0
- package/dist/components/SelectionArea/SelectionArea.d.ts +48 -0
- package/dist/components/SelectionArea/directive.d.ts +19 -0
- package/dist/components/SelectionArea/index.d.ts +3 -0
- package/dist/components/SelectionArea/types.d.ts +26 -0
- package/dist/components/Skeleton/Skeleton.d.ts +33 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/types.d.ts +31 -0
- package/dist/components/SkeletonItem/SkeletonItem.d.ts +8 -0
- package/dist/components/SkeletonItem/index.d.ts +1 -0
- package/dist/components/Slider/Slider.d.ts +1 -1
- package/dist/components/SortableList/SortableList.d.ts +53 -0
- package/dist/components/SortableList/index.d.ts +2 -0
- package/dist/components/SortableList/types.d.ts +38 -0
- package/dist/components/Step/Step.d.ts +38 -0
- package/dist/components/Step/index.d.ts +1 -0
- package/dist/components/Steps/Steps.d.ts +31 -0
- package/dist/components/Steps/context.d.ts +5 -0
- package/dist/components/Steps/index.d.ts +2 -0
- package/dist/components/Steps/types.d.ts +44 -0
- package/dist/components/Table/Table.d.ts +3 -2
- package/dist/components/Table/types.d.ts +61 -3
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/Toaster/Toaster.d.ts +9 -0
- package/dist/components/Toaster/index.d.ts +2 -0
- package/dist/components/Toaster/types.d.ts +16 -0
- package/dist/components/Tooltip/Tooltip.d.ts +44 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/types.d.ts +25 -0
- package/dist/components/Transfer/Transfer.d.ts +57 -0
- package/dist/components/Transfer/index.d.ts +2 -0
- package/dist/components/Transfer/types.d.ts +40 -0
- package/dist/components/Tree/Tree.d.ts +79 -0
- package/dist/components/Tree/index.d.ts +2 -0
- package/dist/components/Tree/types.d.ts +99 -0
- package/dist/components/TreeSelect/TreeSelect.d.ts +47 -0
- package/dist/components/TreeSelect/index.d.ts +2 -0
- package/dist/components/TreeSelect/types.d.ts +76 -0
- package/dist/components/Upload/Upload.d.ts +74 -0
- package/dist/components/Upload/index.d.ts +2 -0
- package/dist/components/Upload/types.d.ts +54 -0
- package/dist/components/index.d.ts +25 -0
- package/dist/composables/confirm.d.ts +23 -0
- package/dist/composables/useModal.d.ts +68 -0
- package/dist/composables/useToast.d.ts +66 -0
- package/dist/composables/useTreeNodes.d.ts +96 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7297 -4056
- package/dist/index.js.map +1 -1
- package/dist/internal/ConfirmDialog.d.ts +18 -0
- package/dist/{components/Menu → internal}/nodes.d.ts +6 -6
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as WxStep } from './Step';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { StepsProps } from './types';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
attrs: Partial<{}>;
|
|
4
|
+
slots: Readonly<{
|
|
5
|
+
default?: () => unknown;
|
|
6
|
+
}> & {
|
|
7
|
+
default?: () => unknown;
|
|
8
|
+
};
|
|
9
|
+
refs: {};
|
|
10
|
+
rootEl: HTMLOListElement;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
13
|
+
declare const __VLS_component: import('vue').DefineComponent<StepsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
change: (index: number) => any;
|
|
15
|
+
}, string, import('vue').PublicProps, Readonly<StepsProps> & Readonly<{
|
|
16
|
+
onChange?: ((index: number) => any) | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
size: import('./types').StepsSize;
|
|
19
|
+
ariaLabel: string;
|
|
20
|
+
error: boolean;
|
|
21
|
+
current: number;
|
|
22
|
+
direction: import('./types').StepsDirection;
|
|
23
|
+
clickable: boolean;
|
|
24
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLOListElement>;
|
|
25
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IconName } from '../Icon/types';
|
|
2
|
+
export type StepsDirection = 'horizontal' | 'vertical';
|
|
3
|
+
export type StepsSize = 'sm' | 'md';
|
|
4
|
+
/** Where a step stands relative to the one the reader is on. */
|
|
5
|
+
export type StepState = 'done' | 'current' | 'todo' | 'error';
|
|
6
|
+
export interface StepsProps {
|
|
7
|
+
/** Which step the reader is on, counting from zero. */
|
|
8
|
+
current?: number;
|
|
9
|
+
direction?: StepsDirection;
|
|
10
|
+
size?: StepsSize;
|
|
11
|
+
/** Marks the current step as gone wrong, without moving off it. */
|
|
12
|
+
error?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Lets a finished step be clicked to go back to it. Going forward is never
|
|
15
|
+
* offered: the steps ahead are the ones that have not been filled in.
|
|
16
|
+
*/
|
|
17
|
+
clickable?: boolean;
|
|
18
|
+
/** Accessible name of the sequence. */
|
|
19
|
+
ariaLabel?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface StepsEmits {
|
|
22
|
+
/** A step was chosen. Only fires for steps that are behind the current one. */
|
|
23
|
+
change: [index: number];
|
|
24
|
+
}
|
|
25
|
+
export interface StepProps {
|
|
26
|
+
/** What this step is. */
|
|
27
|
+
title?: string;
|
|
28
|
+
/** What it involves, in a few words. */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Icon instead of the number. */
|
|
31
|
+
icon?: IconName;
|
|
32
|
+
}
|
|
33
|
+
/** What `WxSteps` hands down to each step. */
|
|
34
|
+
export interface StepsContext {
|
|
35
|
+
register: (id: symbol) => void;
|
|
36
|
+
unregister: (id: symbol) => void;
|
|
37
|
+
indexOf: (id: symbol) => number;
|
|
38
|
+
stateOf: (index: number) => StepState;
|
|
39
|
+
choose: (index: number) => void;
|
|
40
|
+
direction: StepsDirection;
|
|
41
|
+
size: StepsSize;
|
|
42
|
+
clickable: boolean;
|
|
43
|
+
total: number;
|
|
44
|
+
}
|
|
@@ -12,8 +12,9 @@ declare const _default: <T extends TableRow = TableRow>(__VLS_props: NonNullable
|
|
|
12
12
|
readonly "onSort-change"?: ((sort: TableSort | null) => any) | undefined;
|
|
13
13
|
readonly "onSelection-change"?: ((keys: RowKey[], rows: T[]) => any) | undefined;
|
|
14
14
|
readonly "onExpand-change"?: ((keys: RowKey[], rows: T[]) => any) | undefined;
|
|
15
|
+
readonly "onNode-drop"?: ((event: import('./types').TableNodeDropEvent<T>) => any) | undefined;
|
|
15
16
|
readonly "onState-change"?: ((state: TableState) => any) | undefined;
|
|
16
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSearch" | "onUpdate:page" | "onUpdate:perPage" | "onUpdate:selected" | "onUpdate:expanded" | "onUpdate:sort" | "onUpdate:search" | "onRow-click" | "onSort-change" | "onSelection-change" | "onExpand-change" | "onState-change"> & ({
|
|
17
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSearch" | "onUpdate:page" | "onUpdate:perPage" | "onUpdate:selected" | "onUpdate:expanded" | "onUpdate:sort" | "onUpdate:search" | "onRow-click" | "onSort-change" | "onSelection-change" | "onExpand-change" | "onNode-drop" | "onState-change"> & ({
|
|
17
18
|
selected?: RowKey[];
|
|
18
19
|
expanded?: RowKey[];
|
|
19
20
|
sort?: TableSort | null;
|
|
@@ -70,7 +71,7 @@ declare const _default: <T extends TableRow = TableRow>(__VLS_props: NonNullable
|
|
|
70
71
|
index: number;
|
|
71
72
|
}) => unknown;
|
|
72
73
|
};
|
|
73
|
-
emit: (((evt: "search", term: string) => void) & ((evt: "row-click", row: T, index: number, event: MouseEvent) => void) & ((evt: "sort-change", sort: TableSort | null) => void) & ((evt: "selection-change", keys: RowKey[], rows: T[]) => void) & ((evt: "expand-change", keys: RowKey[], rows: T[]) => void) & ((evt: "state-change", state: TableState) => void)) & (((evt: "update:page", value: number) => void) & ((evt: "update:perPage", value: number) => void) & ((evt: "update:selected", value: RowKey[]) => void) & ((evt: "update:expanded", value: RowKey[]) => void) & ((evt: "update:sort", value: TableSort | null) => void) & ((evt: "update:search", value: string) => void));
|
|
74
|
+
emit: (((evt: "search", term: string) => void) & ((evt: "row-click", row: T, index: number, event: MouseEvent) => void) & ((evt: "sort-change", sort: TableSort | null) => void) & ((evt: "selection-change", keys: RowKey[], rows: T[]) => void) & ((evt: "expand-change", keys: RowKey[], rows: T[]) => void) & ((evt: "node-drop", event: import('./types').TableNodeDropEvent<T>) => void) & ((evt: "state-change", state: TableState) => void)) & (((evt: "update:page", value: number) => void) & ((evt: "update:perPage", value: number) => void) & ((evt: "update:selected", value: RowKey[]) => void) & ((evt: "update:expanded", value: RowKey[]) => void) & ((evt: "update:sort", value: TableSort | null) => void) & ((evt: "update:search", value: string) => void));
|
|
74
75
|
}>) => import('vue').VNode & {
|
|
75
76
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
76
77
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ControlSize } from '../../composables/useFormField';
|
|
2
|
+
import { TreeDropZone } from '../../composables/useTreeNodes';
|
|
3
|
+
export type { TreeDropZone };
|
|
2
4
|
/**
|
|
3
5
|
* A page as Laravel's `->paginate()` serialises it. Taken as it arrives, with the
|
|
4
6
|
* snake_case keys intact — renaming them in every controller is work the table can
|
|
@@ -36,9 +38,10 @@ export interface TableColumn<T = TableRow> {
|
|
|
36
38
|
/** Adds a sort control to the heading. The table reports, it does not reorder. */
|
|
37
39
|
sortable?: boolean;
|
|
38
40
|
/**
|
|
39
|
-
* Pins the column to an edge while the rest scrolls sideways.
|
|
40
|
-
*
|
|
41
|
-
*
|
|
41
|
+
* Pins the column to an edge while the rest scrolls sideways. Give it a `width` as
|
|
42
|
+
* well: the table measures where each pinned column comes to rest, but the declared
|
|
43
|
+
* width is what the offsets fall back on before the first measurement — and what
|
|
44
|
+
* decides how wide the column is in the first place.
|
|
42
45
|
*/
|
|
43
46
|
fixed?: 'left' | 'right';
|
|
44
47
|
/** Turns the raw value into the text of the cell. */
|
|
@@ -62,6 +65,57 @@ export interface TableSummaryRow {
|
|
|
62
65
|
strong?: boolean;
|
|
63
66
|
class?: string;
|
|
64
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Turns the rows into a tree: the first column keeps the disclosure and the
|
|
70
|
+
* indentation, every other column is still a column.
|
|
71
|
+
*
|
|
72
|
+
* A tree is a structure, and the two things a table does to a flat list destroy it —
|
|
73
|
+
* so in this mode `sortable` columns are drawn without their control and `pagination`
|
|
74
|
+
* is off. Ordering a tree is what dragging is for, and a page of it would cut branches
|
|
75
|
+
* in half.
|
|
76
|
+
*/
|
|
77
|
+
export interface TableTreeOptions<T = TableRow> {
|
|
78
|
+
/** Field holding the children of a row. */
|
|
79
|
+
childrenKey?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Field that says a row has children before any have been fetched — Laravel's
|
|
82
|
+
* `withCount('children')` under its own name, or a boolean of your own. Without it a
|
|
83
|
+
* lazy table cannot tell a leaf from a branch nobody has opened yet.
|
|
84
|
+
*/
|
|
85
|
+
hasChildrenKey?: string;
|
|
86
|
+
/** Children arrive when a row is opened. Requires `load`. */
|
|
87
|
+
lazy?: boolean;
|
|
88
|
+
/** Fetches the children of one row. */
|
|
89
|
+
load?: (row: T) => T[] | Promise<T[]>;
|
|
90
|
+
/** Open every branch that is already loaded, once, on the first render. */
|
|
91
|
+
defaultExpandAll?: boolean;
|
|
92
|
+
/** How far one level sits from the next, in pixels. */
|
|
93
|
+
indent?: number;
|
|
94
|
+
/** Rows can be picked up and dropped before, after or inside another. */
|
|
95
|
+
draggable?: boolean;
|
|
96
|
+
/** Rows this returns `false` for cannot be picked up. */
|
|
97
|
+
allowDrag?: (row: T) => boolean;
|
|
98
|
+
/** Vetoes a landing spot before anything moves. */
|
|
99
|
+
allowDrop?: (drag: T, drop: T, zone: TreeDropZone) => boolean;
|
|
100
|
+
/**
|
|
101
|
+
* How long a row dragged over a closed branch waits before that branch opens.
|
|
102
|
+
* Dropping into a branch you cannot see the inside of is a guess; this turns the
|
|
103
|
+
* guess into a look. Zero switches it off.
|
|
104
|
+
*/
|
|
105
|
+
springDelay?: number;
|
|
106
|
+
}
|
|
107
|
+
/** What a finished move says: the row, where it went, and how it got there. */
|
|
108
|
+
export interface TableNodeDropEvent<T = TableRow> {
|
|
109
|
+
row: T;
|
|
110
|
+
/** The row it was dropped on. */
|
|
111
|
+
target: T;
|
|
112
|
+
zone: TreeDropZone;
|
|
113
|
+
/** The row it now hangs from — `null` at the top level. */
|
|
114
|
+
parent: T | null;
|
|
115
|
+
/** Its position among its new siblings. */
|
|
116
|
+
index: number;
|
|
117
|
+
via: 'pointer' | 'keyboard';
|
|
118
|
+
}
|
|
65
119
|
/** Everything the table asks the backend for, in one object. */
|
|
66
120
|
export interface TableState {
|
|
67
121
|
page: number;
|
|
@@ -123,6 +177,8 @@ export interface TableProps<T = TableRow> {
|
|
|
123
177
|
maxHeight?: string | number;
|
|
124
178
|
/** Extra class per row, for status colouring and the like. */
|
|
125
179
|
rowClass?: (row: T, index: number) => string | undefined;
|
|
180
|
+
/** Draws the rows as a tree. See {@link TableTreeOptions}. */
|
|
181
|
+
tree?: TableTreeOptions<T>;
|
|
126
182
|
/** Fixes the column widths instead of letting the content decide. */
|
|
127
183
|
layout?: 'auto' | 'fixed';
|
|
128
184
|
ariaLabel?: string;
|
|
@@ -132,6 +188,8 @@ export interface TableEmits<T = TableRow> {
|
|
|
132
188
|
'sort-change': [sort: TableSort | null];
|
|
133
189
|
'selection-change': [keys: RowKey[], rows: T[]];
|
|
134
190
|
'expand-change': [keys: RowKey[], rows: T[]];
|
|
191
|
+
/** A row was moved in tree mode. The rows have already been rearranged. */
|
|
192
|
+
'node-drop': [event: TableNodeDropEvent<T>];
|
|
135
193
|
search: [term: string];
|
|
136
194
|
/**
|
|
137
195
|
* Everything the backend needs, together. Fires once on mount — with whatever
|
|
@@ -27,8 +27,8 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
27
27
|
ariaLabel: string;
|
|
28
28
|
status: import('../..').ControlStatus;
|
|
29
29
|
id: string;
|
|
30
|
-
readonly: boolean;
|
|
31
30
|
resize: "none" | "vertical" | "both";
|
|
31
|
+
readonly: boolean;
|
|
32
32
|
maxlength: number;
|
|
33
33
|
showCount: boolean;
|
|
34
34
|
rows: number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ToasterProps } from './types';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<ToasterProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ToasterProps> & Readonly<{}>, {
|
|
3
|
+
label: string;
|
|
4
|
+
width: number | string;
|
|
5
|
+
max: number;
|
|
6
|
+
placement: import('./types').ToasterPlacement;
|
|
7
|
+
hotkey: string[];
|
|
8
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Which corner — or edge — the toasts stack in. */
|
|
2
|
+
export type ToasterPlacement = 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
3
|
+
export interface ToasterProps {
|
|
4
|
+
placement?: ToasterPlacement;
|
|
5
|
+
/** Width of a toast: a number in pixels, or any CSS length. */
|
|
6
|
+
width?: number | string;
|
|
7
|
+
/** Accessible name of the region the toasts land in. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* How many are shown at once. The rest wait their turn rather than covering the
|
|
11
|
+
* screen — a hundred failed requests is one problem, not a hundred notifications.
|
|
12
|
+
*/
|
|
13
|
+
max?: number;
|
|
14
|
+
/** Key that dismisses everything on screen, e.g. `F8`. */
|
|
15
|
+
hotkey?: string[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TooltipProps } from './types';
|
|
2
|
+
type __VLS_Props = TooltipProps;
|
|
3
|
+
type __VLS_PublicProps = {
|
|
4
|
+
'open'?: boolean | undefined;
|
|
5
|
+
} & __VLS_Props;
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: Readonly<{
|
|
9
|
+
/** The control the tip belongs to. Exactly one element. */
|
|
10
|
+
default?: () => unknown;
|
|
11
|
+
/** The tip itself, when the text is not enough. */
|
|
12
|
+
content?: () => unknown;
|
|
13
|
+
}> & {
|
|
14
|
+
/** The control the tip belongs to. Exactly one element. */
|
|
15
|
+
default?: () => unknown;
|
|
16
|
+
/** The tip itself, when the text is not enough. */
|
|
17
|
+
content?: () => unknown;
|
|
18
|
+
};
|
|
19
|
+
refs: {};
|
|
20
|
+
rootEl: any;
|
|
21
|
+
};
|
|
22
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
23
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
24
|
+
"update:open": (value: boolean | undefined) => any;
|
|
25
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
26
|
+
"onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
content: string;
|
|
30
|
+
side: import('./types').TooltipSide;
|
|
31
|
+
align: import('./types').TooltipAlign;
|
|
32
|
+
offset: number;
|
|
33
|
+
teleport: boolean;
|
|
34
|
+
delay: number;
|
|
35
|
+
maxWidth: number | string;
|
|
36
|
+
arrow: boolean;
|
|
37
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
41
|
+
new (): {
|
|
42
|
+
$slots: S;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type TooltipSide = 'top' | 'right' | 'bottom' | 'left';
|
|
2
|
+
export type TooltipAlign = 'start' | 'center' | 'end';
|
|
3
|
+
export interface TooltipProps {
|
|
4
|
+
/** The text. Use the `content` slot for anything richer. */
|
|
5
|
+
content?: string;
|
|
6
|
+
/** Which side of the trigger it prefers; it flips when there is no room. */
|
|
7
|
+
side?: TooltipSide;
|
|
8
|
+
align?: TooltipAlign;
|
|
9
|
+
/** Distance from the trigger, in pixels. */
|
|
10
|
+
offset?: number;
|
|
11
|
+
/**
|
|
12
|
+
* How long the pointer has to rest before the tip appears, in milliseconds. The
|
|
13
|
+
* first tip in a group waits; the ones after it come at once, because by then the
|
|
14
|
+
* reader has said what they are doing.
|
|
15
|
+
*/
|
|
16
|
+
delay?: number;
|
|
17
|
+
/** Draws the little pointer at the trigger. */
|
|
18
|
+
arrow?: boolean;
|
|
19
|
+
/** Largest width the tip takes before it wraps. */
|
|
20
|
+
maxWidth?: number | string;
|
|
21
|
+
/** Nothing opens. For a tip whose trigger is temporarily meaningless. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Render the tip in a portal so it escapes `overflow: hidden`. */
|
|
24
|
+
teleport?: boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { TransferItem, TransferProps, TransferSide, TransferValue } from './types';
|
|
2
|
+
type __VLS_Props = TransferProps;
|
|
3
|
+
type __VLS_PublicProps = {
|
|
4
|
+
modelValue?: TransferValue[];
|
|
5
|
+
} & __VLS_Props;
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: Readonly<{
|
|
9
|
+
/** One row, on either side. */
|
|
10
|
+
item?: (props: {
|
|
11
|
+
item: TransferItem;
|
|
12
|
+
side: TransferSide;
|
|
13
|
+
}) => unknown;
|
|
14
|
+
/** Shown in a panel with nothing in it. */
|
|
15
|
+
empty?: (props: {
|
|
16
|
+
side: TransferSide;
|
|
17
|
+
}) => unknown;
|
|
18
|
+
}> & {
|
|
19
|
+
/** One row, on either side. */
|
|
20
|
+
item?: (props: {
|
|
21
|
+
item: TransferItem;
|
|
22
|
+
side: TransferSide;
|
|
23
|
+
}) => unknown;
|
|
24
|
+
/** Shown in a panel with nothing in it. */
|
|
25
|
+
empty?: (props: {
|
|
26
|
+
side: TransferSide;
|
|
27
|
+
}) => unknown;
|
|
28
|
+
};
|
|
29
|
+
refs: {};
|
|
30
|
+
rootEl: HTMLDivElement;
|
|
31
|
+
};
|
|
32
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
33
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
34
|
+
change: (change: import('./types').TransferChange) => any;
|
|
35
|
+
"update:modelValue": (value: TransferValue[]) => any;
|
|
36
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
37
|
+
onChange?: ((change: import('./types').TransferChange) => any) | undefined;
|
|
38
|
+
"onUpdate:modelValue"?: ((value: TransferValue[]) => any) | undefined;
|
|
39
|
+
}>, {
|
|
40
|
+
size: import('../..').ControlSize;
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
emptyText: string;
|
|
43
|
+
height: number | string;
|
|
44
|
+
items: TransferItem[];
|
|
45
|
+
searchable: boolean;
|
|
46
|
+
searchPlaceholder: string;
|
|
47
|
+
titles: [string, string];
|
|
48
|
+
toRightLabel: string;
|
|
49
|
+
toLeftLabel: string;
|
|
50
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
51
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
52
|
+
export default _default;
|
|
53
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
54
|
+
new (): {
|
|
55
|
+
$slots: S;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ControlSize } from '../../composables/useFormField';
|
|
2
|
+
export type TransferValue = string | number;
|
|
3
|
+
export type TransferSide = 'left' | 'right';
|
|
4
|
+
export interface TransferItem {
|
|
5
|
+
value: TransferValue;
|
|
6
|
+
/** What is read on the row. Falls back to the value. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** A second line under the label. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Cannot be moved, from either side. */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface TransferProps {
|
|
14
|
+
/** Everything there is to choose from, both panels together. */
|
|
15
|
+
items?: TransferItem[];
|
|
16
|
+
/** Headings of the two panels. */
|
|
17
|
+
titles?: [string, string];
|
|
18
|
+
/** A search field over each panel. */
|
|
19
|
+
searchable?: boolean;
|
|
20
|
+
searchPlaceholder?: string;
|
|
21
|
+
/** Height of a list: a number in pixels, or any CSS length. */
|
|
22
|
+
height?: number | string;
|
|
23
|
+
/** Shown in a panel with nothing in it. */
|
|
24
|
+
emptyText?: string;
|
|
25
|
+
size?: ControlSize;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** Accessible names for the two buttons. */
|
|
28
|
+
toRightLabel?: string;
|
|
29
|
+
toLeftLabel?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface TransferChange {
|
|
32
|
+
/** What moved, in the order it was shown. */
|
|
33
|
+
values: TransferValue[];
|
|
34
|
+
/** Which panel it moved to. */
|
|
35
|
+
to: TransferSide;
|
|
36
|
+
}
|
|
37
|
+
export interface TransferEmits {
|
|
38
|
+
/** Something moved. The model has already been rewritten. */
|
|
39
|
+
change: [change: TransferChange];
|
|
40
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { TreeKey } from '../../composables/useTreeNodes';
|
|
2
|
+
import { TreeNode, TreeProps } from './types';
|
|
3
|
+
declare const _default: <T extends TreeNode>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
5
|
+
readonly "onUpdate:modelValue"?: ((value: T[]) => any) | undefined;
|
|
6
|
+
readonly onCheck?: ((keys: TreeKey[], detail: {
|
|
7
|
+
node: T;
|
|
8
|
+
checked: boolean;
|
|
9
|
+
}) => any) | undefined;
|
|
10
|
+
readonly onSelect?: ((node: T | null, key: TreeKey | null) => any) | undefined;
|
|
11
|
+
readonly onCollapse?: ((node: T) => any) | undefined;
|
|
12
|
+
readonly onDrop?: ((event: import('./types').TreeDropEvent<T>) => any) | undefined;
|
|
13
|
+
readonly onExpand?: ((node: T) => any) | undefined;
|
|
14
|
+
readonly "onUpdate:selected"?: ((value: TreeKey | null) => any) | undefined;
|
|
15
|
+
readonly "onUpdate:expanded"?: ((value: TreeKey[]) => any) | undefined;
|
|
16
|
+
readonly "onUpdate:checked"?: ((value: TreeKey[]) => any) | undefined;
|
|
17
|
+
readonly "onNode-click"?: ((node: T, event: MouseEvent) => any) | undefined;
|
|
18
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:modelValue" | "onDrop" | "onSelect" | "onCollapse" | "onExpand" | "onUpdate:selected" | "onUpdate:expanded" | "onCheck" | "onUpdate:checked" | "onNode-click"> & ({
|
|
19
|
+
modelValue?: T[];
|
|
20
|
+
expanded?: TreeKey[];
|
|
21
|
+
selected?: TreeKey | null;
|
|
22
|
+
checked?: TreeKey[];
|
|
23
|
+
} & TreeProps<T>) & Partial<{}>> & import('vue').PublicProps;
|
|
24
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
25
|
+
/** Opens every branch on the way to a node. */
|
|
26
|
+
reveal: (key: TreeKey) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Opens a named path one level at a time, waiting for each lazy level before asking
|
|
29
|
+
* for the next — the way to reach a node the tree has not fetched yet.
|
|
30
|
+
*/
|
|
31
|
+
openPath: (keys: TreeKey[]) => Promise<boolean>;
|
|
32
|
+
expandAll: () => void;
|
|
33
|
+
collapseAll: () => void;
|
|
34
|
+
/** The node itself and everything above it — a breadcrumb of the tree. */
|
|
35
|
+
path: (key: TreeKey) => T[];
|
|
36
|
+
}>): void;
|
|
37
|
+
attrs: any;
|
|
38
|
+
slots: Readonly<{
|
|
39
|
+
/** One node's label. Without it the tree reads `labelKey` and highlights the filter. */
|
|
40
|
+
default?: (props: {
|
|
41
|
+
node: T;
|
|
42
|
+
depth: number;
|
|
43
|
+
expanded: boolean;
|
|
44
|
+
selected: boolean;
|
|
45
|
+
}) => unknown;
|
|
46
|
+
/** The end of a row, where the buttons that act on it go. */
|
|
47
|
+
actions?: (props: {
|
|
48
|
+
node: T;
|
|
49
|
+
depth: number;
|
|
50
|
+
}) => unknown;
|
|
51
|
+
/** Shown in place of an empty tree. */
|
|
52
|
+
empty?: () => unknown;
|
|
53
|
+
}> & {
|
|
54
|
+
/** One node's label. Without it the tree reads `labelKey` and highlights the filter. */
|
|
55
|
+
default?: (props: {
|
|
56
|
+
node: T;
|
|
57
|
+
depth: number;
|
|
58
|
+
expanded: boolean;
|
|
59
|
+
selected: boolean;
|
|
60
|
+
}) => unknown;
|
|
61
|
+
/** The end of a row, where the buttons that act on it go. */
|
|
62
|
+
actions?: (props: {
|
|
63
|
+
node: T;
|
|
64
|
+
depth: number;
|
|
65
|
+
}) => unknown;
|
|
66
|
+
/** Shown in place of an empty tree. */
|
|
67
|
+
empty?: () => unknown;
|
|
68
|
+
};
|
|
69
|
+
emit: (((evt: "check", keys: TreeKey[], detail: {
|
|
70
|
+
node: T;
|
|
71
|
+
checked: boolean;
|
|
72
|
+
}) => void) & ((evt: "select", node: T | null, key: TreeKey | null) => void) & ((evt: "collapse", node: T) => void) & ((evt: "drop", event: import('./types').TreeDropEvent<T>) => void) & ((evt: "expand", node: T) => void) & ((evt: "node-click", node: T, event: MouseEvent) => void)) & (((evt: "update:modelValue", value: T[]) => void) & ((evt: "update:selected", value: TreeKey | null) => void) & ((evt: "update:expanded", value: TreeKey[]) => void) & ((evt: "update:checked", value: TreeKey[]) => void));
|
|
73
|
+
}>) => import('vue').VNode & {
|
|
74
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
75
|
+
};
|
|
76
|
+
export default _default;
|
|
77
|
+
type __VLS_PrettifyLocal<T> = {
|
|
78
|
+
[K in keyof T]: T[K];
|
|
79
|
+
} & {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { TreeDropZone, TreeKey } from '../../composables/useTreeNodes';
|
|
2
|
+
export type { TreeDropZone, TreeKey };
|
|
3
|
+
export type TreeSize = 'sm' | 'md';
|
|
4
|
+
/**
|
|
5
|
+
* A node as the tree hopes to find it. Every field is optional and every name is a prop
|
|
6
|
+
* away from being something else, so a record straight out of a Laravel controller —
|
|
7
|
+
* `{ id, title, children }` — is a tree without a `map` over it first.
|
|
8
|
+
*/
|
|
9
|
+
export interface TreeNode {
|
|
10
|
+
id?: TreeKey;
|
|
11
|
+
key?: TreeKey;
|
|
12
|
+
label?: string;
|
|
13
|
+
children?: TreeNode[];
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Says this node has nothing under it. Only needed with `lazy`, where an empty
|
|
17
|
+
* `children` cannot tell "not loaded yet" from "nothing there".
|
|
18
|
+
*/
|
|
19
|
+
leaf?: boolean;
|
|
20
|
+
[field: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
/** What a finished move says: the node, where it went, and how it got there. */
|
|
23
|
+
export interface TreeDropEvent<T = TreeNode> {
|
|
24
|
+
node: T;
|
|
25
|
+
/** The node it was dropped on. */
|
|
26
|
+
target: T;
|
|
27
|
+
zone: TreeDropZone;
|
|
28
|
+
/** The node it now hangs from — `null` at the top level. */
|
|
29
|
+
parent: T | null;
|
|
30
|
+
/** Its position among its new siblings. */
|
|
31
|
+
index: number;
|
|
32
|
+
via: 'pointer' | 'keyboard';
|
|
33
|
+
}
|
|
34
|
+
export interface TreeProps<T = TreeNode> {
|
|
35
|
+
/** Field holding the identity of a node. */
|
|
36
|
+
nodeKey?: string;
|
|
37
|
+
/** Field holding the text of a node. */
|
|
38
|
+
labelKey?: string;
|
|
39
|
+
/** Field holding the array of children. */
|
|
40
|
+
childrenKey?: string;
|
|
41
|
+
/** Field that, when true, makes a node unselectable and unmovable. */
|
|
42
|
+
disabledKey?: string;
|
|
43
|
+
/** Field that says a node has no children to fetch. Only read when `lazy`. */
|
|
44
|
+
leafKey?: string;
|
|
45
|
+
/** Expand every branch once, on the first render. */
|
|
46
|
+
defaultExpandAll?: boolean;
|
|
47
|
+
/** Opening a branch closes the others at its level. */
|
|
48
|
+
accordion?: boolean;
|
|
49
|
+
/** Clicking a label opens the branch as well as selecting it. */
|
|
50
|
+
expandOnClick?: boolean;
|
|
51
|
+
/** Adds a checkbox to every node. */
|
|
52
|
+
checkable?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Checking a branch leaves its children alone. Off — the default — a branch follows
|
|
55
|
+
* its children and its children follow it, which is what a permission tree wants.
|
|
56
|
+
*/
|
|
57
|
+
checkStrictly?: boolean;
|
|
58
|
+
/** Rows can be picked up and dropped before, after or inside another. */
|
|
59
|
+
draggable?: boolean;
|
|
60
|
+
/** Nodes this returns `false` for cannot be picked up. */
|
|
61
|
+
allowDrag?: (node: T) => boolean;
|
|
62
|
+
/** Vetoes a landing spot — say, to keep a page out of the root. */
|
|
63
|
+
allowDrop?: (drag: T, drop: T, zone: TreeDropZone) => boolean;
|
|
64
|
+
/** Children are fetched when a branch first opens. Requires `load`. */
|
|
65
|
+
lazy?: boolean;
|
|
66
|
+
/** Fetches the children of one node. */
|
|
67
|
+
load?: (node: T) => T[] | Promise<T[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Shows only the nodes whose label contains this, together with the branches that
|
|
70
|
+
* lead to them — which are opened for as long as the term stands.
|
|
71
|
+
*/
|
|
72
|
+
filter?: string;
|
|
73
|
+
/** Draws the guide lines that connect a child to its parent. */
|
|
74
|
+
showLines?: boolean;
|
|
75
|
+
/** How far one level sits from the next, in pixels. */
|
|
76
|
+
indent?: number;
|
|
77
|
+
size?: TreeSize;
|
|
78
|
+
/** Shown when there is nothing to draw. */
|
|
79
|
+
emptyText?: string;
|
|
80
|
+
/** What the drag handle is called, before the name of the node it holds. */
|
|
81
|
+
dragLabel?: string;
|
|
82
|
+
/** Accessible name for the tree. */
|
|
83
|
+
ariaLabel?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface TreeEmits<T = TreeNode> {
|
|
86
|
+
/** A node was clicked — before anything was decided about selection. */
|
|
87
|
+
'node-click': [node: T, event: MouseEvent];
|
|
88
|
+
/** The selected node changed. */
|
|
89
|
+
select: [node: T | null, key: TreeKey | null];
|
|
90
|
+
/** A checkbox changed. The keys are every checked node, branches included. */
|
|
91
|
+
check: [keys: TreeKey[], detail: {
|
|
92
|
+
node: T;
|
|
93
|
+
checked: boolean;
|
|
94
|
+
}];
|
|
95
|
+
expand: [node: T];
|
|
96
|
+
collapse: [node: T];
|
|
97
|
+
/** A node was moved. The tree has already been rearranged. */
|
|
98
|
+
drop: [event: TreeDropEvent<T>];
|
|
99
|
+
}
|