@privyid/persona 0.21.0 → 0.23.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/accordion/Accordion.vue +5 -2
- package/dist/components/accordion/AccordionItem.vue +9 -7
- package/dist/components/avatar/Avatar.vue.d.ts +2 -2
- package/dist/components/badge/Badge.vue +21 -3
- package/dist/components/badge/Badge.vue.d.ts +1 -1
- package/dist/components/banner/Banner.vue +5 -0
- package/dist/components/banner/Banner.vue.d.ts +9 -0
- package/dist/components/button/Button.vue +18 -18
- package/dist/components/calendar/Calendar.vue.d.ts +2 -2
- package/dist/components/calendar/adapter/adapter.d.ts +1 -8
- package/dist/components/calendar/adapter/adapter.mjs +0 -10
- package/dist/components/calendar/adapter/date.mjs +2 -2
- package/dist/components/calendar/adapter/month.mjs +2 -2
- package/dist/components/camera/Camera.vue.d.ts +3 -3
- package/dist/components/card/Card.vue.d.ts +1 -1
- package/dist/components/card/CardSection.vue +1 -0
- package/dist/components/card/CardSection.vue.d.ts +1 -1
- package/dist/components/carousel/Carousel.vue.d.ts +8 -8
- package/dist/components/chart/ChartSet.vue.d.ts +2 -2
- package/dist/components/chart/ChartVal.vue.d.ts +4 -4
- package/dist/components/checkbox/Checkbox.vue +98 -112
- package/dist/components/checkbox/icon/IconCheckbox.vue +13 -0
- package/dist/components/checkbox/icon/IconInderteminate.vue +12 -0
- package/dist/components/contextual-bar/ContextualBar.vue +67 -19
- package/dist/components/contextual-bar/ContextualBar.vue.d.ts +4 -4
- package/dist/components/contextual-bar/index.d.ts +1 -1
- package/dist/components/cropper/Cropper.vue.d.ts +10 -10
- package/dist/components/datepicker/Datepicker.vue +2 -0
- package/dist/components/datepicker/Datepicker.vue.d.ts +3 -3
- package/dist/components/dialog/Dialog.vue +2 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/divider/Divider.vue +1 -1
- package/dist/components/dot/Dot.vue.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.vue +303 -222
- package/dist/components/dropdown/DropdownItem.vue +8 -8
- package/dist/components/dropdown-subitem/DropdownSubitem.vue.d.ts +1 -1
- package/dist/components/dropzone/Dropzone.vue.d.ts +5 -5
- package/dist/components/filterbar/pinned/PinnedDate.vue +2 -0
- package/dist/components/filterbar/pinned/PinnedDate.vue.d.ts +3 -3
- package/dist/components/filterbar/pinned/PinnedMultiselect.vue +10 -6
- package/dist/components/filterbar/pinned/PinnedMultiselect.vue.d.ts +1 -1
- package/dist/components/filterbar/pinned/PinnedSelect.vue +11 -7
- package/dist/components/filterbar/pinned/PinnedSelect.vue.d.ts +4 -4
- package/dist/components/filterbar/pinned/PinnedToggle.vue.d.ts +7 -7
- package/dist/components/global/store.d.ts +2 -1
- package/dist/components/input/Input.vue +16 -5
- package/dist/components/input/Input.vue.d.ts +6 -5
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input-file/InputFile.vue.d.ts +5 -5
- package/dist/components/input-pin/InputPin.vue.d.ts +3 -3
- package/dist/components/input-range/InputRange.vue.d.ts +8 -8
- package/dist/components/label/Label.vue +31 -12
- package/dist/components/label/Label.vue.d.ts +2 -2
- package/dist/components/list-group/ListGroup.vue.d.ts +1 -1
- package/dist/components/list-group/ListGroupItem.vue +2 -2
- package/dist/components/main/Main.vue +4 -2
- package/dist/components/markdown/index.d.ts +6 -1
- package/dist/components/markdown/index.mjs +8 -2
- package/dist/components/meta.json +135 -0
- package/dist/components/modal/Modal.vue +215 -12
- package/dist/components/modal/Modal.vue.d.ts +56 -2
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/nav/Nav.vue +5 -1
- package/dist/components/nav/Nav.vue.d.ts +1 -1
- package/dist/components/nav/NavItem.vue.d.ts +2 -2
- package/dist/components/nav/NavItemDropdown.vue.d.ts +3 -3
- package/dist/components/nav/NavSubItem.vue +6 -6
- package/dist/components/navbar/Navbar.vue.d.ts +1 -1
- package/dist/components/navbar/NavbarBrand.vue +1 -1
- package/dist/components/pagination/Pagination.vue +9 -0
- package/dist/components/pagination/Pagination.vue.d.ts +10 -0
- package/dist/components/pdf-helipad/PdfHelipad.vue +101 -85
- package/dist/components/pdf-helipad/utils/use-drag.d.ts +2 -7
- package/dist/components/pdf-helipad/utils/use-drag.mjs +1 -1
- package/dist/components/pdf-object/PdfObject.vue.d.ts +3 -3
- package/dist/components/pdf-object/index.d.ts +7 -0
- package/dist/components/pdf-object/utils/use-drag.d.ts +1 -0
- package/dist/components/pdf-object/utils/use-drag.mjs +1 -1
- package/dist/components/pdf-text/PdfText.vue.d.ts +4 -4
- package/dist/components/pdf-viewer/PdfViewer.vue.d.ts +6 -6
- package/dist/components/progress-indicator/ProgressIndicator.vue.d.ts +2 -2
- package/dist/components/progressbar/Progressbar.vue.d.ts +7 -7
- package/dist/components/radio/Radio.vue.d.ts +5 -5
- package/dist/components/ringbar/Ringbar.vue.d.ts +6 -6
- package/dist/components/select/Select.vue +402 -214
- package/dist/components/select/SelectInput.vue +102 -0
- package/dist/components/select/SelectTags.vue +57 -0
- package/dist/components/select/adapter/adapter.d.ts +1 -0
- package/dist/components/select/adapter/async-adapter.d.ts +13 -1
- package/dist/components/select/adapter/async-adapter.mjs +8 -15
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.mjs +4 -1
- package/dist/components/sheet/Sheet.vue +2 -3
- package/dist/components/sidebar/Sidebar.vue +101 -116
- package/dist/components/sidebar/SidebarBrand.vue +1 -1
- package/dist/components/sidebar/SidebarContent.vue +27 -0
- package/dist/components/sidebar/SidebarNav.vue +78 -87
- package/dist/components/sidebar-menu/SidebarMenu.vue +57 -204
- package/dist/components/sidebar-menu/SidebarMenuItem.vue +70 -0
- package/dist/components/signature-text/SignatureText.vue.d.ts +5 -5
- package/dist/components/steps/StepSlider.vue +2 -2
- package/dist/components/steps/Steps.vue.d.ts +2 -2
- package/dist/components/strengthbar/Strengthbar.vue.d.ts +9 -9
- package/dist/components/table/index.d.ts +5 -8
- package/dist/components/table-flex/TableFlex.vue +14 -11
- package/dist/components/table-static/TableStatic.vue +131 -119
- package/dist/components/table-static/TableStaticRoot.vue +42 -0
- package/dist/components/tabs/Tab.vue +13 -15
- package/dist/components/tabs/TabContent.vue +64 -23
- package/dist/components/tabs/Tabs.vue +93 -75
- package/dist/components/text/Text.vue +15 -7
- package/dist/components/text/Text.vue.d.ts +11 -2
- package/dist/components/text/index.d.ts +1 -0
- package/dist/components/textarea/Textarea.vue.d.ts +5 -5
- package/dist/components/toggle/Toggle.vue +12 -1
- package/dist/components/toggle/Toggle.vue.d.ts +16 -7
- package/dist/components/tooltip/index.mjs +1 -1
- package/dist/components/tooltip/utils/create-handler.mjs +1 -1
- package/dist/components/tour/TourDialog.vue +6 -0
- package/dist/components/truncate/Truncate.vue +1 -1
- package/dist/components/truncate/Truncate.vue.d.ts +2 -2
- package/dist/components/utils/date.d.ts +21 -0
- package/dist/components/utils/date.mjs +15 -0
- package/dist/components/utils/vnode.mjs +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.mjs +4 -0
- package/dist/module.json +1 -1
- package/package.json +17 -17
- package/dist/components/checkbox/Checkbox.vue.d.ts +0 -84
- package/dist/components/dropdown/Dropdown.vue.d.ts +0 -147
- package/dist/components/pdf-helipad/PdfHelipad.vue.d.ts +0 -45
- package/dist/components/select/Select.vue.d.ts +0 -157
- package/dist/components/sidebar/Sidebar.vue.d.ts +0 -80
- package/dist/components/sidebar/SidebarNav.vue.d.ts +0 -66
- package/dist/components/sidebar-menu/SidebarMenu.vue.d.ts +0 -91
- package/dist/components/tabs/Tab.vue.d.ts +0 -23
- package/dist/components/tabs/TabContent.vue.d.ts +0 -14
- package/dist/components/tabs/Tabs.vue.d.ts +0 -80
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
declare const _default: import("vue-demi").DefineComponent<{
|
|
2
2
|
length: {
|
|
3
|
-
type: (
|
|
3
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
4
4
|
default: number;
|
|
5
5
|
};
|
|
6
6
|
value: {
|
|
7
|
-
type: (
|
|
7
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
8
8
|
default: number;
|
|
9
9
|
};
|
|
10
10
|
min: {
|
|
11
|
-
type: (
|
|
11
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
12
12
|
default: number;
|
|
13
13
|
};
|
|
14
14
|
max: {
|
|
15
|
-
type: (
|
|
15
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
16
16
|
default: number;
|
|
17
17
|
};
|
|
18
18
|
}, {
|
|
@@ -21,24 +21,24 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
21
21
|
status: import("vue-demi").ComputedRef<"high" | "mid" | "low">;
|
|
22
22
|
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
23
23
|
length: {
|
|
24
|
-
type: (
|
|
24
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
25
25
|
default: number;
|
|
26
26
|
};
|
|
27
27
|
value: {
|
|
28
|
-
type: (
|
|
28
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
29
29
|
default: number;
|
|
30
30
|
};
|
|
31
31
|
min: {
|
|
32
|
-
type: (
|
|
32
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
33
33
|
default: number;
|
|
34
34
|
};
|
|
35
35
|
max: {
|
|
36
|
-
type: (
|
|
36
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
37
37
|
default: number;
|
|
38
38
|
};
|
|
39
39
|
}>>, {
|
|
40
|
-
value: string | number;
|
|
41
40
|
length: string | number;
|
|
41
|
+
value: string | number;
|
|
42
42
|
min: string | number;
|
|
43
43
|
max: string | number;
|
|
44
44
|
}, {}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'vue-demi';
|
|
2
2
|
import { LiteralUnion } from 'type-fest';
|
|
3
|
-
type KeyType<T> = LiteralUnion<keyof T & string, string>;
|
|
4
|
-
type LabelType<T> = LiteralUnion<Capitalize<keyof T & string>, string>;
|
|
3
|
+
export type KeyType<T> = LiteralUnion<keyof T & string, string>;
|
|
4
|
+
export type LabelType<T> = LiteralUnion<Capitalize<keyof T & string>, string>;
|
|
5
5
|
export type ApperanceVariant = 'card' | 'table';
|
|
6
6
|
export interface TableField<T = Record<string, unknown>> {
|
|
7
7
|
/**
|
|
@@ -24,12 +24,10 @@ export interface TableField<T = Record<string, unknown>> {
|
|
|
24
24
|
thClass?: HTMLAttributes['class'];
|
|
25
25
|
}
|
|
26
26
|
export declare function baseFormatter(value: unknown): string;
|
|
27
|
-
export declare function defineTable<T>(fields: Array<TableField<T>> | string[]): Array<TableField<T>>;
|
|
28
|
-
export declare function withKey(item:
|
|
27
|
+
export declare function defineTable<T = unknown>(fields: Array<TableField<T>> | string[]): Array<TableField<T>>;
|
|
28
|
+
export declare function withKey(item: object): Omit<object, never> & Omit<{
|
|
29
29
|
_key: symbol;
|
|
30
|
-
},
|
|
31
|
-
_key: unknown;
|
|
32
|
-
};
|
|
30
|
+
}, never> & {};
|
|
33
31
|
export declare function withoutKey(item: Record<string, unknown>): Pick<Record<string, unknown>, string>;
|
|
34
32
|
/**
|
|
35
33
|
* Add unit to unitless value
|
|
@@ -37,4 +35,3 @@ export declare function withoutKey(item: Record<string, unknown>): Pick<Record<s
|
|
|
37
35
|
* @param unit default unit
|
|
38
36
|
*/
|
|
39
37
|
export declare function withUnit(value?: number | string | undefined, unit?: string): string | number | undefined;
|
|
40
|
-
export {};
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
</div>
|
|
108
108
|
</template>
|
|
109
109
|
|
|
110
|
-
<script lang="ts" setup generic="T
|
|
110
|
+
<script lang="ts" setup generic="T">
|
|
111
111
|
import {
|
|
112
112
|
computed,
|
|
113
113
|
HTMLAttributes,
|
|
@@ -120,6 +120,7 @@ import {
|
|
|
120
120
|
withKey,
|
|
121
121
|
withoutKey,
|
|
122
122
|
withUnit,
|
|
123
|
+
KeyType,
|
|
123
124
|
} from '../table'
|
|
124
125
|
import Checkbox from '../checkbox/Checkbox.vue'
|
|
125
126
|
import { useVModel } from '../input'
|
|
@@ -178,17 +179,15 @@ const props = defineProps({
|
|
|
178
179
|
})
|
|
179
180
|
|
|
180
181
|
const model = useVModel(props)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
(event: 'update:modelValue', items: T[]): void,
|
|
185
|
-
(event: 'update:items', items: T[]): void,
|
|
182
|
+
const emit = defineEmits<{
|
|
183
|
+
'update:modelValue': [T[]],
|
|
184
|
+
'update:items': [T[]],
|
|
186
185
|
}>()
|
|
187
186
|
|
|
188
187
|
const rows = computed<T[]>({
|
|
189
188
|
get () {
|
|
190
189
|
return props.items.map((item) => {
|
|
191
|
-
return withKey(item) as T
|
|
190
|
+
return withKey(item as Record<string, unknown>) as T
|
|
192
191
|
})
|
|
193
192
|
},
|
|
194
193
|
set (items) {
|
|
@@ -215,10 +214,14 @@ const classNames = computed(() => {
|
|
|
215
214
|
})
|
|
216
215
|
|
|
217
216
|
defineSlots<{
|
|
218
|
-
empty:() => VNode,
|
|
219
|
-
row:(props: { index: number, item: T
|
|
220
|
-
[
|
|
221
|
-
[
|
|
217
|
+
empty:() => VNode[],
|
|
218
|
+
row:(props: { index: number, item: T }) => VNode[],
|
|
219
|
+
[K: `cell(${string})`]:(props: { index: number }) => VNode[],
|
|
220
|
+
[K: `head(${string})`]:(props: { field: TableField<T>, label: string }) => VNode[],
|
|
221
|
+
} & {
|
|
222
|
+
[K in KeyType<T> as `cell(${K})`]:(props: { item: T, index: number }) => VNode[]
|
|
223
|
+
} & {
|
|
224
|
+
[K in KeyType<T> as `head(${K})`]:(props: { field: TableField<T>, label: string }) => VNode[]
|
|
222
225
|
}>()
|
|
223
226
|
</script>
|
|
224
227
|
|
|
@@ -1,115 +1,112 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<TableStaticRoot
|
|
3
3
|
data-testid="table-static"
|
|
4
|
-
|
|
5
|
-
:class="classNames"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
:disabled="!draggable">
|
|
49
|
-
<template #item="{ element, index }">
|
|
50
|
-
<tr
|
|
51
|
-
class="table-static__row"
|
|
52
|
-
:class="trClass"
|
|
53
|
-
data-role="row">
|
|
54
|
-
<slot
|
|
55
|
-
name="row"
|
|
56
|
-
:item="element"
|
|
57
|
-
:index="index">
|
|
58
|
-
<td
|
|
59
|
-
v-if="draggable"
|
|
60
|
-
class="table-static__cell table-static__drag"
|
|
61
|
-
data-testid="table-static-drag-handle">
|
|
62
|
-
<IconDrag />
|
|
63
|
-
</td>
|
|
64
|
-
<td
|
|
65
|
-
v-if="selectable"
|
|
66
|
-
class="table-static__cell table-static__checkbox">
|
|
67
|
-
<Checkbox
|
|
68
|
-
v-model="model"
|
|
69
|
-
data-testid="table-static-select"
|
|
70
|
-
:value="withoutKey(element)"
|
|
71
|
-
:disabled="element._selectable === false" />
|
|
72
|
-
</td>
|
|
73
|
-
<td
|
|
74
|
-
v-for="field in fields"
|
|
75
|
-
:key="field.key"
|
|
76
|
-
class="table-static__cell"
|
|
77
|
-
data-testid="table-static-cell"
|
|
78
|
-
:class="field.tdClass"
|
|
79
|
-
:data-cell="field.key">
|
|
80
|
-
<slot
|
|
81
|
-
:name="`cell(${field.key})`"
|
|
82
|
-
:index="index"
|
|
83
|
-
:item="element">
|
|
84
|
-
{{ field.formatter(element[field.key], element) }}
|
|
85
|
-
</slot>
|
|
86
|
-
</td>
|
|
87
|
-
</slot>
|
|
88
|
-
</tr>
|
|
89
|
-
</template>
|
|
90
|
-
</Draggable>
|
|
91
|
-
<tbody
|
|
92
|
-
v-else
|
|
93
|
-
class="table-static__body">
|
|
4
|
+
:scrollable="scrollable"
|
|
5
|
+
:class="classNames"
|
|
6
|
+
:table-class="tableClass">
|
|
7
|
+
<thead
|
|
8
|
+
v-if="!noLabel"
|
|
9
|
+
class="table-static__headers">
|
|
10
|
+
<tr :class="trClass">
|
|
11
|
+
<th
|
|
12
|
+
v-if="draggable"
|
|
13
|
+
class="table-static__header table-static__drag" />
|
|
14
|
+
<th
|
|
15
|
+
v-if="selectable"
|
|
16
|
+
class="table-static__header table-static__checkbox">
|
|
17
|
+
<Checkbox
|
|
18
|
+
v-model="selectAll"
|
|
19
|
+
data-testid="table-static-select-all"
|
|
20
|
+
:indeterminate="indeterminate" />
|
|
21
|
+
</th>
|
|
22
|
+
<th
|
|
23
|
+
v-for="field in fields"
|
|
24
|
+
:key="field.key"
|
|
25
|
+
class="table-static__header"
|
|
26
|
+
data-testid="table-static-header"
|
|
27
|
+
:style="field.width ? { width: withUnit(field.width) } : {}"
|
|
28
|
+
:class="field.thClass"
|
|
29
|
+
:data-header="field.key">
|
|
30
|
+
<slot
|
|
31
|
+
:name="`head(${field.key})`"
|
|
32
|
+
:label="field.label"
|
|
33
|
+
:field="field">
|
|
34
|
+
{{ field.label }}
|
|
35
|
+
</slot>
|
|
36
|
+
</th>
|
|
37
|
+
</tr>
|
|
38
|
+
</thead>
|
|
39
|
+
<Draggable
|
|
40
|
+
v-if="items.length > 0"
|
|
41
|
+
v-model="rows"
|
|
42
|
+
class="table-static__body"
|
|
43
|
+
handle=".table-static__drag"
|
|
44
|
+
item-key="_key"
|
|
45
|
+
tag="tbody"
|
|
46
|
+
:disabled="!draggable">
|
|
47
|
+
<template #item="{ element, index }">
|
|
94
48
|
<tr
|
|
95
|
-
class="table-static__row"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
49
|
+
class="table-static__row"
|
|
50
|
+
:class="trClass"
|
|
51
|
+
data-role="row">
|
|
52
|
+
<slot
|
|
53
|
+
name="row"
|
|
54
|
+
:item="element"
|
|
55
|
+
:index="index">
|
|
56
|
+
<td
|
|
57
|
+
v-if="draggable"
|
|
58
|
+
class="table-static__cell table-static__drag"
|
|
59
|
+
data-testid="table-static-drag-handle">
|
|
60
|
+
<IconDrag />
|
|
61
|
+
</td>
|
|
62
|
+
<td
|
|
63
|
+
v-if="selectable"
|
|
64
|
+
class="table-static__cell table-static__checkbox">
|
|
65
|
+
<Checkbox
|
|
66
|
+
v-model="model"
|
|
67
|
+
data-testid="table-static-select"
|
|
68
|
+
:value="withoutKey(element)"
|
|
69
|
+
:disabled="element._selectable === false" />
|
|
70
|
+
</td>
|
|
71
|
+
<td
|
|
72
|
+
v-for="field in fields"
|
|
73
|
+
:key="field.key"
|
|
74
|
+
class="table-static__cell"
|
|
75
|
+
data-testid="table-static-cell"
|
|
76
|
+
:class="field.tdClass"
|
|
77
|
+
:data-cell="field.key">
|
|
78
|
+
<slot
|
|
79
|
+
:name="`cell(${field.key})`"
|
|
80
|
+
:index="index"
|
|
81
|
+
:item="element">
|
|
82
|
+
{{ field.formatter(element[field.key], element) }}
|
|
83
|
+
</slot>
|
|
84
|
+
</td>
|
|
85
|
+
</slot>
|
|
106
86
|
</tr>
|
|
107
|
-
</
|
|
108
|
-
</
|
|
109
|
-
|
|
87
|
+
</template>
|
|
88
|
+
</Draggable>
|
|
89
|
+
<tbody
|
|
90
|
+
v-else
|
|
91
|
+
class="table-static__body">
|
|
92
|
+
<tr
|
|
93
|
+
class="table-static__row">
|
|
94
|
+
<td
|
|
95
|
+
:colspan="fields.length"
|
|
96
|
+
data-testid="table-static-empty"
|
|
97
|
+
class="table-static__cell table-static__cell--empty datatable__state-empty">
|
|
98
|
+
<slot name="empty">
|
|
99
|
+
<span class="flex items-center justify-center text-subtle dark:text-dark-subtle">
|
|
100
|
+
{{ emptyLabel }}
|
|
101
|
+
</span>
|
|
102
|
+
</slot>
|
|
103
|
+
</td>
|
|
104
|
+
</tr>
|
|
105
|
+
</tbody>
|
|
106
|
+
</TableStaticRoot>
|
|
110
107
|
</template>
|
|
111
108
|
|
|
112
|
-
<script lang="ts" setup generic="T
|
|
109
|
+
<script lang="ts" setup generic="T">
|
|
113
110
|
import {
|
|
114
111
|
computed,
|
|
115
112
|
HTMLAttributes,
|
|
@@ -122,8 +119,10 @@ import {
|
|
|
122
119
|
withKey,
|
|
123
120
|
withoutKey,
|
|
124
121
|
withUnit,
|
|
122
|
+
KeyType,
|
|
125
123
|
} from '../table'
|
|
126
124
|
import Checkbox from '../checkbox/Checkbox.vue'
|
|
125
|
+
import TableStaticRoot from './TableStaticRoot.vue'
|
|
127
126
|
import { useVModel } from '../input'
|
|
128
127
|
import IconDrag from '@privyid/persona-icon/vue/draggable/20.vue'
|
|
129
128
|
import Draggable from 'vuedraggable'
|
|
@@ -177,20 +176,22 @@ const props = defineProps({
|
|
|
177
176
|
] as PropType<HTMLAttributes['class']>,
|
|
178
177
|
default: undefined,
|
|
179
178
|
},
|
|
179
|
+
scrollable: {
|
|
180
|
+
type : Boolean,
|
|
181
|
+
default: true,
|
|
182
|
+
},
|
|
180
183
|
})
|
|
181
184
|
|
|
182
185
|
const model = useVModel(props)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
(event: 'update:modelValue', items: T[]): void,
|
|
187
|
-
(event: 'update:items', items: T[]): void,
|
|
186
|
+
const emit = defineEmits<{
|
|
187
|
+
'update:modelValue': [T[]],
|
|
188
|
+
'update:items': [T[]],
|
|
188
189
|
}>()
|
|
189
190
|
|
|
190
191
|
const rows = computed<T[]>({
|
|
191
192
|
get () {
|
|
192
193
|
return props.items.map((item) => {
|
|
193
|
-
return withKey(item) as T
|
|
194
|
+
return withKey(item as Record<string, unknown>) as T
|
|
194
195
|
})
|
|
195
196
|
},
|
|
196
197
|
set (items) {
|
|
@@ -213,11 +214,14 @@ const classNames = computed(() => {
|
|
|
213
214
|
if (props.noLabel)
|
|
214
215
|
result.push('table-static--no-label')
|
|
215
216
|
|
|
217
|
+
if (props.scrollable)
|
|
218
|
+
result.push('table-static--scrollable')
|
|
219
|
+
|
|
216
220
|
return result
|
|
217
221
|
})
|
|
218
222
|
|
|
219
223
|
const selectableRows = computed(() => {
|
|
220
|
-
return props.items.filter((item) => item._selectable !== false)
|
|
224
|
+
return props.items.filter((item) => (item as Record<string, unknown>)._selectable !== false)
|
|
221
225
|
})
|
|
222
226
|
|
|
223
227
|
const selectAll = computed({
|
|
@@ -227,7 +231,7 @@ const selectAll = computed({
|
|
|
227
231
|
set (value) {
|
|
228
232
|
if (selectAll.value !== value) {
|
|
229
233
|
model.value = value
|
|
230
|
-
? selectableRows.value.map((item) => withoutKey(item)) as T[]
|
|
234
|
+
? selectableRows.value.map((item) => withoutKey(item as Record<string, unknown>)) as T[]
|
|
231
235
|
: []
|
|
232
236
|
}
|
|
233
237
|
},
|
|
@@ -239,10 +243,14 @@ const indeterminate = computed(() => {
|
|
|
239
243
|
})
|
|
240
244
|
|
|
241
245
|
defineSlots<{
|
|
242
|
-
empty:() => VNode,
|
|
243
|
-
row:(props: { index: number, item: T
|
|
244
|
-
[
|
|
245
|
-
[
|
|
246
|
+
empty:() => VNode[],
|
|
247
|
+
row:(props: { index: number, item: T }) => VNode[],
|
|
248
|
+
[K: `cell(${string})`]:(props: { index: number }) => VNode[],
|
|
249
|
+
[K: `head(${string})`]:(props: { field: TableField<T>, label: string }) => VNode[],
|
|
250
|
+
} & {
|
|
251
|
+
[K in KeyType<T> as `cell(${K})`]:(props: { item: T, index: number }) => VNode[]
|
|
252
|
+
} & {
|
|
253
|
+
[K in KeyType<T> as `head(${K})`]:(props: { field: TableField<T>, label: string }) => VNode[]
|
|
246
254
|
}>()
|
|
247
255
|
</script>
|
|
248
256
|
|
|
@@ -255,7 +263,7 @@ defineSlots<{
|
|
|
255
263
|
--p-table-border: theme(borderColor.default.DEFAULT);
|
|
256
264
|
--p-table-border-dark: theme(borderColor.dark.default.DEFAULT);
|
|
257
265
|
|
|
258
|
-
@apply w-full
|
|
266
|
+
@apply w-full;
|
|
259
267
|
|
|
260
268
|
&__table {
|
|
261
269
|
@apply min-w-full table;
|
|
@@ -329,5 +337,9 @@ defineSlots<{
|
|
|
329
337
|
}
|
|
330
338
|
}
|
|
331
339
|
}
|
|
340
|
+
|
|
341
|
+
&--scrollable {
|
|
342
|
+
@apply overflow-auto overscroll-contain;
|
|
343
|
+
}
|
|
332
344
|
}
|
|
333
345
|
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-if="scrollable">
|
|
3
|
+
<div
|
|
4
|
+
class="table-static"
|
|
5
|
+
v-bind="$attrs">
|
|
6
|
+
<table
|
|
7
|
+
class="table-static__table"
|
|
8
|
+
:class="tableClass">
|
|
9
|
+
<slot />
|
|
10
|
+
</table>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else>
|
|
14
|
+
<table
|
|
15
|
+
class="table-static__table"
|
|
16
|
+
:class="tableClass"
|
|
17
|
+
v-bind="$attrs">
|
|
18
|
+
<slot />
|
|
19
|
+
</table>
|
|
20
|
+
</template>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts" setup>
|
|
24
|
+
import { HTMLAttributes, PropType } from 'vue-demi'
|
|
25
|
+
|
|
26
|
+
defineOptions({ inheritAttrs: false })
|
|
27
|
+
|
|
28
|
+
defineProps({
|
|
29
|
+
scrollable: {
|
|
30
|
+
type : Boolean,
|
|
31
|
+
default: true,
|
|
32
|
+
},
|
|
33
|
+
tableClass: {
|
|
34
|
+
type: [
|
|
35
|
+
String,
|
|
36
|
+
Array,
|
|
37
|
+
Object,
|
|
38
|
+
] as PropType<HTMLAttributes['class']>,
|
|
39
|
+
default: undefined,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
</script>
|
|
@@ -10,19 +10,17 @@
|
|
|
10
10
|
</section>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
|
-
<script>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
});
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
defineProps({
|
|
15
|
+
title: {
|
|
16
|
+
type : String,
|
|
17
|
+
default: '',
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
type : Boolean,
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
defineOptions({ name: 'Tab' })
|
|
28
26
|
</script>
|
|
@@ -1,27 +1,68 @@
|
|
|
1
|
-
<
|
|
1
|
+
<template>
|
|
2
|
+
<render />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" setup>
|
|
2
6
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
VNode,
|
|
8
|
+
Transition,
|
|
9
|
+
h,
|
|
10
|
+
ref,
|
|
11
|
+
watch,
|
|
12
|
+
resolveComponent,
|
|
13
|
+
} from 'vue-demi'
|
|
14
|
+
import { findAllChildren, toBoolean } from '../utils/vnode'
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
active: {
|
|
18
|
+
type : Number,
|
|
19
|
+
required: true,
|
|
13
20
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
keepAlive: {
|
|
22
|
+
type : Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
vertical: {
|
|
26
|
+
type : Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const transition = ref(props.vertical ? 'slide-top' : 'slide-left')
|
|
32
|
+
|
|
33
|
+
watch(() => props.active, (value, last) => {
|
|
34
|
+
transition.value = value < last
|
|
35
|
+
? (props.vertical ? 'slide-bottom' : 'slide-right')
|
|
36
|
+
: (props.vertical ? 'slide-top' : 'slide-left')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const slots = defineSlots<{
|
|
40
|
+
default:() => VNode[],
|
|
41
|
+
}>()
|
|
42
|
+
|
|
43
|
+
const render = () => {
|
|
44
|
+
const tab = findAllChildren(slots.default(), 'Tab')
|
|
45
|
+
.map((vnode, index) => {
|
|
46
|
+
const isDisabled = toBoolean(vnode.props?.disabled)
|
|
47
|
+
const isActive = index === props.active && !isDisabled
|
|
48
|
+
|
|
49
|
+
return h(vnode, {
|
|
50
|
+
key : index,
|
|
51
|
+
dataTabid: index,
|
|
52
|
+
style : { display: isActive ? 'block' : 'none' },
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
.at(props.active)
|
|
56
|
+
|
|
57
|
+
const body = () => {
|
|
58
|
+
return props.keepAlive
|
|
59
|
+
? h(resolveComponent('keep-alive'), () => tab)
|
|
60
|
+
: tab
|
|
25
61
|
}
|
|
26
|
-
|
|
62
|
+
|
|
63
|
+
return h(Transition, {
|
|
64
|
+
name: transition.value,
|
|
65
|
+
mode: 'out-in',
|
|
66
|
+
}, body)
|
|
67
|
+
}
|
|
27
68
|
</script>
|