@webx-ui/core 0.18.0 → 0.19.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/dist/components/Repeater/Repeater.d.ts +58 -0
- package/dist/components/Repeater/index.d.ts +2 -0
- package/dist/components/Repeater/types.d.ts +48 -0
- package/dist/components/SortableList/types.d.ts +6 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.js +4654 -4435
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { SortableMove } from '../SortableList/types';
|
|
2
|
+
import { RepeaterProps } from './types';
|
|
3
|
+
declare const _default: <T extends object = Record<string, unknown>>(__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 onAdd?: ((item: T, index: number) => any) | undefined;
|
|
7
|
+
readonly onRemove?: ((item: T, index: number) => any) | undefined;
|
|
8
|
+
readonly onMove?: ((move: SortableMove<T>) => any) | undefined;
|
|
9
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:modelValue" | "onRemove" | "onMove" | "onAdd"> & ({
|
|
10
|
+
modelValue?: T[];
|
|
11
|
+
} & RepeaterProps<T>) & Partial<{}>> & import('vue').PublicProps;
|
|
12
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
13
|
+
attrs: any;
|
|
14
|
+
slots: Readonly<{
|
|
15
|
+
/** Replaces the title. */
|
|
16
|
+
header?: () => unknown;
|
|
17
|
+
/** The end of the heading — whatever else the repeater can do. */
|
|
18
|
+
extra?: () => unknown;
|
|
19
|
+
/** The fields of one row. */
|
|
20
|
+
default?: (props: {
|
|
21
|
+
item: T;
|
|
22
|
+
index: number;
|
|
23
|
+
update: (patch: Partial<T>) => void;
|
|
24
|
+
}) => unknown;
|
|
25
|
+
/** Row actions, before the one that removes it. */
|
|
26
|
+
actions?: (props: {
|
|
27
|
+
item: T;
|
|
28
|
+
index: number;
|
|
29
|
+
}) => unknown;
|
|
30
|
+
/** Shown in place of an empty repeater. */
|
|
31
|
+
empty?: () => unknown;
|
|
32
|
+
}> & {
|
|
33
|
+
/** Replaces the title. */
|
|
34
|
+
header?: () => unknown;
|
|
35
|
+
/** The end of the heading — whatever else the repeater can do. */
|
|
36
|
+
extra?: () => unknown;
|
|
37
|
+
/** The fields of one row. */
|
|
38
|
+
default?: (props: {
|
|
39
|
+
item: T;
|
|
40
|
+
index: number;
|
|
41
|
+
update: (patch: Partial<T>) => void;
|
|
42
|
+
}) => unknown;
|
|
43
|
+
/** Row actions, before the one that removes it. */
|
|
44
|
+
actions?: (props: {
|
|
45
|
+
item: T;
|
|
46
|
+
index: number;
|
|
47
|
+
}) => unknown;
|
|
48
|
+
/** Shown in place of an empty repeater. */
|
|
49
|
+
empty?: () => unknown;
|
|
50
|
+
};
|
|
51
|
+
emit: (((evt: "add", item: T, index: number) => void) & ((evt: "remove", item: T, index: number) => void) & ((evt: "move", move: SortableMove<T>) => void)) & ((evt: "update:modelValue", value: T[]) => void);
|
|
52
|
+
}>) => import('vue').VNode & {
|
|
53
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
54
|
+
};
|
|
55
|
+
export default _default;
|
|
56
|
+
type __VLS_PrettifyLocal<T> = {
|
|
57
|
+
[K in keyof T]: T[K];
|
|
58
|
+
} & {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SortableMove } from '../SortableList/types';
|
|
2
|
+
export type RepeaterSize = 'sm' | 'md';
|
|
3
|
+
/** One row of the model, plus the ways of writing it back. */
|
|
4
|
+
export interface RepeaterItemSlot<T extends object> {
|
|
5
|
+
item: T;
|
|
6
|
+
index: number;
|
|
7
|
+
/** Replaces the item with a copy carrying these keys — the model stays immutable. */
|
|
8
|
+
update: (patch: Partial<T>) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface RepeaterProps<T extends object = Record<string, unknown>> {
|
|
11
|
+
/** Heading above the rows. */
|
|
12
|
+
title?: string;
|
|
13
|
+
/**
|
|
14
|
+
* What a row is called in its header and to a screen reader: a key of the item, or a
|
|
15
|
+
* function. Falls back to the position.
|
|
16
|
+
*/
|
|
17
|
+
itemLabel?: string | ((item: T, index: number) => string);
|
|
18
|
+
/** Builds what `Add` appends. Defaults to an empty object. */
|
|
19
|
+
newItem?: () => T;
|
|
20
|
+
addLabel?: string;
|
|
21
|
+
removeLabel?: string;
|
|
22
|
+
/** Rows fold to their header, so a long form stays readable. */
|
|
23
|
+
collapsible?: boolean;
|
|
24
|
+
/** Rows that were already there start folded. Implies `collapsible`. */
|
|
25
|
+
collapsed?: boolean;
|
|
26
|
+
/** Fewer rows than this cannot be removed. */
|
|
27
|
+
min?: number;
|
|
28
|
+
/** More rows than this cannot be added. */
|
|
29
|
+
max?: number;
|
|
30
|
+
/** Rows can be reordered. */
|
|
31
|
+
sortable?: boolean;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/** Shown when there is nothing yet. */
|
|
34
|
+
emptyText?: string;
|
|
35
|
+
size?: RepeaterSize;
|
|
36
|
+
/** Drops the frame, for a repeater that already sits in a card. */
|
|
37
|
+
plain?: boolean;
|
|
38
|
+
/** Accessible name for the list of rows. */
|
|
39
|
+
ariaLabel?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface RepeaterEmits<T extends object = Record<string, unknown>> {
|
|
42
|
+
/** A row was appended. The model already holds it. */
|
|
43
|
+
add: [item: T, index: number];
|
|
44
|
+
/** A row was dropped. The model no longer holds it. */
|
|
45
|
+
remove: [item: T, index: number];
|
|
46
|
+
/** A row changed position. */
|
|
47
|
+
move: [move: SortableMove<T>];
|
|
48
|
+
}
|
|
@@ -18,6 +18,12 @@ export interface SortableListProps<T = unknown> {
|
|
|
18
18
|
handle?: 'grip' | 'row' | string;
|
|
19
19
|
/** Field to key a row by, or a function. Falls back to the position. */
|
|
20
20
|
itemKey?: string | ((item: T, index: number) => string | number);
|
|
21
|
+
/**
|
|
22
|
+
* What a row is called out loud — in the grip's name and in every move a keyboard
|
|
23
|
+
* announces: a field of the item, or a function. Falls back to its `title`, `name` or
|
|
24
|
+
* `label`, and to the position when it has none of those.
|
|
25
|
+
*/
|
|
26
|
+
itemLabel?: string | ((item: T, index: number) => string);
|
|
21
27
|
/** Lists that share a name pass rows between them. */
|
|
22
28
|
group?: string;
|
|
23
29
|
/** Nothing can be moved. */
|