@xleddyl/443-components-vue 0.16.14 → 0.16.16
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/CATALOG.md +155 -144
- package/README.md +4 -0
- package/dist/components/core/index.d.ts +1 -0
- package/dist/components/core/index.mjs +1 -0
- package/dist/components/core/palette.d.ts +4 -0
- package/dist/components/core/palette.mjs +22 -0
- package/dist/components/core/types.d.ts +1 -0
- package/dist/components/data/Badge.vue +8 -1
- package/dist/components/data/Badge.vue.d.ts +2 -2
- package/dist/components/data/FilterPill.vue +8 -0
- package/dist/components/data/FilterPill.vue.d.ts +2 -2
- package/dist/components/data/FilterPills.vue +1 -0
- package/dist/components/data/RecordList.vue +55 -0
- package/dist/components/data/RecordList.vue.d.ts +237 -0
- package/dist/components/data/Tag.vue +3 -1
- package/dist/components/data/Tag.vue.d.ts +2 -2
- package/dist/components/data/index.d.ts +1 -0
- package/dist/components/data/index.mjs +1 -0
- package/dist/components/data/types.d.ts +11 -1
- package/dist/components/forms/Combobox.vue +31 -3
- package/dist/components/forms/Combobox.vue.d.ts +2 -0
- package/dist/components/forms/types.d.ts +2 -0
- package/dist/components/overlays/CommandButton.vue +21 -0
- package/dist/components/overlays/CommandButton.vue.d.ts +249 -0
- package/dist/components/overlays/CommandPalette.vue +13 -2
- package/dist/components/overlays/index.d.ts +2 -0
- package/dist/components/overlays/index.mjs +2 -0
- package/dist/components/overlays/types.d.ts +4 -0
- package/dist/components/templates/DashboardLayout.vue +22 -6
- package/dist/components/templates/DashboardLayout.vue.d.ts +1 -0
- package/dist/components/templates/FormDrawer.vue +59 -9
- package/dist/components/templates/FormDrawer.vue.d.ts +3 -1
- package/dist/components/templates/types.d.ts +4 -0
- package/dist/composables/layout.d.ts +1 -0
- package/dist/composables/layout.mjs +1 -0
- package/dist/composables/templates.d.ts +1 -0
- package/dist/composables/templates.mjs +1 -0
- package/dist/composables/useConfirm.d.ts +4 -1
- package/dist/composables/useConfirm.mjs +16 -2
- package/dist/composables/usePageCommands.d.ts +6 -0
- package/dist/composables/usePageCommands.mjs +9 -0
- package/dist/composables/useRouteRecord.d.ts +24 -0
- package/dist/composables/useRouteRecord.mjs +55 -0
- package/dist/grid/cells/BadgeCell.vue +27 -15
- package/dist/grid/data-grid.css +4 -0
- package/dist/grid/types.d.ts +5 -2
- package/dist/locale/de.mjs +1 -0
- package/dist/locale/en.mjs +1 -0
- package/dist/locale/it.mjs +1 -0
- package/dist/locale/types.d.ts +1 -0
- package/dist/styles/data/badge.css +5 -0
- package/dist/styles/data/filter-pills.css +8 -0
- package/dist/styles/data/record-list.css +57 -0
- package/dist/styles/data/tag.css +5 -0
- package/dist/styles/data.css +1 -0
- package/dist/styles/forms/combobox.css +27 -0
- package/dist/styles/tokens.css +12 -0
- package/dist/styles/utilities.css +55 -0
- package/package.json +1 -1
|
@@ -29,7 +29,13 @@
|
|
|
29
29
|
>
|
|
30
30
|
<span v-if="icon" class="k-combobox-lead" aria-hidden="true"><Icon :name="icon" /></span>
|
|
31
31
|
<template v-if="multiple && !hideTags">
|
|
32
|
-
<span
|
|
32
|
+
<span
|
|
33
|
+
v-for="value in selectedValues"
|
|
34
|
+
:key="keyOf(value)"
|
|
35
|
+
class="k-combobox-tag"
|
|
36
|
+
:class="tagClass(value)"
|
|
37
|
+
:title="optionFor(value)?.description"
|
|
38
|
+
>
|
|
33
39
|
<span class="k-combobox-tag-label">{{ labelFor(value) }}</span>
|
|
34
40
|
<button
|
|
35
41
|
v-if="interactive"
|
|
@@ -107,6 +113,9 @@
|
|
|
107
113
|
:data-side="layer.side.value"
|
|
108
114
|
@mousedown.prevent
|
|
109
115
|
>
|
|
116
|
+
<div v-if="$slots.header" class="k-combobox-header">
|
|
117
|
+
<slot name="header" />
|
|
118
|
+
</div>
|
|
110
119
|
<ul
|
|
111
120
|
:id="listId"
|
|
112
121
|
role="listbox"
|
|
@@ -136,6 +145,12 @@
|
|
|
136
145
|
<Icon v-if="item.selected" name="check" />
|
|
137
146
|
</span>
|
|
138
147
|
<Icon v-if="item.kind === 'create'" name="plus" class="k-combobox-option-icon" />
|
|
148
|
+
<span
|
|
149
|
+
v-else-if="item.option.color && !item.option.icon"
|
|
150
|
+
class="k-combobox-option-dot"
|
|
151
|
+
:class="paletteClass(item.option.color)"
|
|
152
|
+
aria-hidden="true"
|
|
153
|
+
/>
|
|
139
154
|
<Icon
|
|
140
155
|
v-else-if="item.option.icon"
|
|
141
156
|
:name="item.option.icon"
|
|
@@ -210,6 +225,7 @@ import { normalizeSearch } from "../../internal/core/text";
|
|
|
210
225
|
import { translateOr } from "../../locale";
|
|
211
226
|
import { joinIds } from "../../internal/forms/control";
|
|
212
227
|
import Icon from "../core/Icon.vue";
|
|
228
|
+
import { paletteClass } from "../core/palette";
|
|
213
229
|
import FieldMessage from "../core/FieldMessage.vue";
|
|
214
230
|
import Spinner from "../core/Spinner.vue";
|
|
215
231
|
defineOptions({ inheritAttrs: false });
|
|
@@ -277,6 +293,11 @@ const activeIndex = ref(-1);
|
|
|
277
293
|
const results = shallowRef([]);
|
|
278
294
|
const searchedOnce = ref(false);
|
|
279
295
|
const known = shallowReactive(/* @__PURE__ */ new Map());
|
|
296
|
+
watch(
|
|
297
|
+
() => props.options,
|
|
298
|
+
(options) => options.forEach(remember),
|
|
299
|
+
{ immediate: true }
|
|
300
|
+
);
|
|
280
301
|
const control = useFieldControl({
|
|
281
302
|
invalid: () => props.invalid,
|
|
282
303
|
disabled: () => props.disabled,
|
|
@@ -404,9 +425,16 @@ function optionId(index) {
|
|
|
404
425
|
function remember(option) {
|
|
405
426
|
known.set(keyOf(option.value), option);
|
|
406
427
|
}
|
|
407
|
-
function
|
|
428
|
+
function optionFor(value) {
|
|
408
429
|
const key = keyOf(value);
|
|
409
|
-
return
|
|
430
|
+
return props.options.find((option) => keyOf(option.value) === key) ?? results.value.find((option) => keyOf(option.value) === key) ?? known.get(key);
|
|
431
|
+
}
|
|
432
|
+
function labelFor(value) {
|
|
433
|
+
return optionFor(value)?.label ?? keyOf(value);
|
|
434
|
+
}
|
|
435
|
+
function tagClass(value) {
|
|
436
|
+
const color = optionFor(value)?.color;
|
|
437
|
+
return color ? ["is-colored", paletteClass(color)] : void 0;
|
|
410
438
|
}
|
|
411
439
|
function firstEnabled(from = 0, direction = 1) {
|
|
412
440
|
return nextEnabledIndex(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IconName } from '../../composables/useIcons';
|
|
2
|
+
import type { PaletteColor } from '../core/types';
|
|
2
3
|
export type ChoiceValue = string | number | boolean | null;
|
|
3
4
|
export type ChoiceOrientation = 'horizontal' | 'vertical';
|
|
4
5
|
export interface ChoiceOption<T = ChoiceValue> {
|
|
@@ -28,6 +29,7 @@ export interface ComboboxOption<T = string | number> {
|
|
|
28
29
|
description?: string;
|
|
29
30
|
disabled?: boolean;
|
|
30
31
|
icon?: IconName;
|
|
32
|
+
color?: PaletteColor;
|
|
31
33
|
keywords?: string[];
|
|
32
34
|
}
|
|
33
35
|
export type ComboboxSearch<T = string | number> = (query: string, signal: AbortSignal) => Promise<ComboboxOption<T>[]> | ComboboxOption<T>[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Button
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
:label="label ?? command.label"
|
|
5
|
+
:icon="icon ?? command.icon"
|
|
6
|
+
:to="command.to"
|
|
7
|
+
:href="command.href"
|
|
8
|
+
:disabled="command.disabled"
|
|
9
|
+
@click="command.onSelect?.(command)"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
14
|
+
import Button from "../core/Button.vue";
|
|
15
|
+
defineOptions({ inheritAttrs: false });
|
|
16
|
+
defineProps({
|
|
17
|
+
command: { type: Object, required: true },
|
|
18
|
+
label: { type: String, required: false },
|
|
19
|
+
icon: { type: null, required: false }
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import type { IconName } from '../../composables/useIcons';
|
|
2
|
+
import type { CommandItem } from './types';
|
|
3
|
+
declare const __VLS_export: <T = unknown>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<{
|
|
5
|
+
command: CommandItem<T>;
|
|
6
|
+
label?: string;
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
} & Partial<NonNullable<{
|
|
9
|
+
readonly label?: string | undefined;
|
|
10
|
+
readonly type?: "submit" | "button" | "reset" | undefined;
|
|
11
|
+
readonly size?: import("../core/types.ts").ButtonSize | undefined;
|
|
12
|
+
readonly tone?: import("../core/types.ts").Tone | undefined;
|
|
13
|
+
readonly variant?: import("../core/types.ts").ButtonVariant | undefined;
|
|
14
|
+
readonly icon?: IconName | undefined;
|
|
15
|
+
readonly trailingIcon?: IconName | undefined;
|
|
16
|
+
readonly to?: import("../core/types.ts").LinkTarget | undefined;
|
|
17
|
+
readonly href?: string | undefined | undefined;
|
|
18
|
+
readonly target?: string | undefined | undefined;
|
|
19
|
+
readonly external?: boolean | undefined;
|
|
20
|
+
readonly disabled?: (boolean | "true" | "false") | undefined;
|
|
21
|
+
readonly loading?: boolean | undefined;
|
|
22
|
+
readonly block?: boolean | undefined;
|
|
23
|
+
readonly square?: boolean | undefined;
|
|
24
|
+
readonly download?: any;
|
|
25
|
+
readonly hreflang?: string | undefined | undefined;
|
|
26
|
+
readonly media?: string | undefined | undefined;
|
|
27
|
+
readonly ping?: string | undefined | undefined;
|
|
28
|
+
readonly rel?: string | undefined | undefined;
|
|
29
|
+
readonly referrerpolicy?: ("" | "origin" | "no-referrer" | "no-referrer-when-downgrade" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url") | undefined;
|
|
30
|
+
readonly innerHTML?: string | undefined | undefined;
|
|
31
|
+
readonly class?: import("vue").ClassValue;
|
|
32
|
+
readonly style?: import("vue").StyleValue;
|
|
33
|
+
readonly accesskey?: string | undefined | undefined;
|
|
34
|
+
readonly contenteditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
35
|
+
readonly contextmenu?: string | undefined | undefined;
|
|
36
|
+
readonly dir?: string | undefined | undefined;
|
|
37
|
+
readonly draggable?: (boolean | "true" | "false") | undefined;
|
|
38
|
+
readonly enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
39
|
+
readonly enterKeyHint?: "search" | "done" | "previous" | "next" | "enter" | "go" | "send" | undefined;
|
|
40
|
+
readonly hidden?: "" | "hidden" | (boolean | "true" | "false") | "until-found" | undefined;
|
|
41
|
+
readonly id?: string | undefined | undefined;
|
|
42
|
+
readonly inert?: (boolean | "true" | "false") | undefined;
|
|
43
|
+
readonly lang?: string | undefined | undefined;
|
|
44
|
+
readonly placeholder?: string | undefined | undefined;
|
|
45
|
+
readonly spellcheck?: (boolean | "true" | "false") | undefined;
|
|
46
|
+
readonly tabindex?: (string | number) | undefined;
|
|
47
|
+
readonly title?: string | undefined | undefined;
|
|
48
|
+
readonly translate?: "yes" | "no" | undefined | undefined;
|
|
49
|
+
readonly radiogroup?: string | undefined | undefined;
|
|
50
|
+
readonly role?: string | undefined | undefined;
|
|
51
|
+
readonly about?: string | undefined | undefined;
|
|
52
|
+
readonly datatype?: string | undefined | undefined;
|
|
53
|
+
readonly inlist?: any;
|
|
54
|
+
readonly prefix?: string | undefined | undefined;
|
|
55
|
+
readonly property?: string | undefined | undefined;
|
|
56
|
+
readonly resource?: string | undefined | undefined;
|
|
57
|
+
readonly typeof?: string | undefined | undefined;
|
|
58
|
+
readonly vocab?: string | undefined | undefined;
|
|
59
|
+
readonly autocapitalize?: string | undefined | undefined;
|
|
60
|
+
readonly autocorrect?: string | undefined | undefined;
|
|
61
|
+
readonly autosave?: string | undefined | undefined;
|
|
62
|
+
readonly color?: string | undefined | undefined;
|
|
63
|
+
readonly itemprop?: string | undefined | undefined;
|
|
64
|
+
readonly itemscope?: (boolean | "true" | "false") | undefined;
|
|
65
|
+
readonly itemtype?: string | undefined | undefined;
|
|
66
|
+
readonly itemid?: string | undefined | undefined;
|
|
67
|
+
readonly itemref?: string | undefined | undefined;
|
|
68
|
+
readonly results?: (string | number) | undefined;
|
|
69
|
+
readonly security?: string | undefined | undefined;
|
|
70
|
+
readonly unselectable?: "on" | "off" | undefined | undefined;
|
|
71
|
+
readonly inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
72
|
+
readonly is?: string | undefined | undefined;
|
|
73
|
+
readonly exportparts?: string | undefined;
|
|
74
|
+
readonly part?: string | undefined;
|
|
75
|
+
readonly popover?: (import("../../index.ts").PopoverMode | "" | boolean) | undefined;
|
|
76
|
+
readonly 'aria-activedescendant'?: string | undefined | undefined;
|
|
77
|
+
readonly 'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
78
|
+
readonly 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
79
|
+
readonly 'aria-busy'?: (boolean | "true" | "false") | undefined;
|
|
80
|
+
readonly 'aria-checked'?: (boolean | "true" | "false") | "mixed" | undefined;
|
|
81
|
+
readonly 'aria-colcount'?: (string | number) | undefined;
|
|
82
|
+
readonly 'aria-colindex'?: (string | number) | undefined;
|
|
83
|
+
readonly 'aria-colspan'?: (string | number) | undefined;
|
|
84
|
+
readonly 'aria-controls'?: string | undefined | undefined;
|
|
85
|
+
readonly 'aria-current'?: "page" | "time" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
|
|
86
|
+
readonly 'aria-describedby'?: string | undefined | undefined;
|
|
87
|
+
readonly 'aria-details'?: string | undefined | undefined;
|
|
88
|
+
readonly 'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
89
|
+
readonly 'aria-dropeffect'?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
|
|
90
|
+
readonly 'aria-errormessage'?: string | undefined | undefined;
|
|
91
|
+
readonly 'aria-expanded'?: (boolean | "true" | "false") | undefined;
|
|
92
|
+
readonly 'aria-flowto'?: string | undefined | undefined;
|
|
93
|
+
readonly 'aria-grabbed'?: (boolean | "true" | "false") | undefined;
|
|
94
|
+
readonly 'aria-haspopup'?: "grid" | "tree" | "dialog" | "menu" | (boolean | "true" | "false") | "listbox" | undefined;
|
|
95
|
+
readonly 'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
96
|
+
readonly 'aria-invalid'?: (boolean | "true" | "false") | "grammar" | "spelling" | undefined;
|
|
97
|
+
readonly 'aria-keyshortcuts'?: string | undefined | undefined;
|
|
98
|
+
readonly 'aria-label'?: string | undefined | undefined;
|
|
99
|
+
readonly 'aria-labelledby'?: string | undefined | undefined;
|
|
100
|
+
readonly 'aria-level'?: (string | number) | undefined;
|
|
101
|
+
readonly 'aria-live'?: "off" | "assertive" | "polite" | undefined | undefined;
|
|
102
|
+
readonly 'aria-modal'?: (boolean | "true" | "false") | undefined;
|
|
103
|
+
readonly 'aria-multiline'?: (boolean | "true" | "false") | undefined;
|
|
104
|
+
readonly 'aria-multiselectable'?: (boolean | "true" | "false") | undefined;
|
|
105
|
+
readonly 'aria-orientation'?: "horizontal" | "vertical" | undefined | undefined;
|
|
106
|
+
readonly 'aria-owns'?: string | undefined | undefined;
|
|
107
|
+
readonly 'aria-placeholder'?: string | undefined | undefined;
|
|
108
|
+
readonly 'aria-posinset'?: (string | number) | undefined;
|
|
109
|
+
readonly 'aria-pressed'?: (boolean | "true" | "false") | "mixed" | undefined;
|
|
110
|
+
readonly 'aria-readonly'?: (boolean | "true" | "false") | undefined;
|
|
111
|
+
readonly 'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
|
|
112
|
+
readonly 'aria-required'?: (boolean | "true" | "false") | undefined;
|
|
113
|
+
readonly 'aria-roledescription'?: string | undefined | undefined;
|
|
114
|
+
readonly 'aria-rowcount'?: (string | number) | undefined;
|
|
115
|
+
readonly 'aria-rowindex'?: (string | number) | undefined;
|
|
116
|
+
readonly 'aria-rowspan'?: (string | number) | undefined;
|
|
117
|
+
readonly 'aria-selected'?: (boolean | "true" | "false") | undefined;
|
|
118
|
+
readonly 'aria-setsize'?: (string | number) | undefined;
|
|
119
|
+
readonly 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
|
|
120
|
+
readonly 'aria-valuemax'?: (string | number) | undefined;
|
|
121
|
+
readonly 'aria-valuemin'?: (string | number) | undefined;
|
|
122
|
+
readonly 'aria-valuenow'?: (string | number) | undefined;
|
|
123
|
+
readonly 'aria-valuetext'?: string | undefined | undefined;
|
|
124
|
+
readonly onCopy?: ((payload: ClipboardEvent) => void) | undefined;
|
|
125
|
+
readonly onCut?: ((payload: ClipboardEvent) => void) | undefined;
|
|
126
|
+
readonly onPaste?: ((payload: ClipboardEvent) => void) | undefined;
|
|
127
|
+
readonly onCompositionend?: ((payload: CompositionEvent) => void) | undefined;
|
|
128
|
+
readonly onCompositionstart?: ((payload: CompositionEvent) => void) | undefined;
|
|
129
|
+
readonly onCompositionupdate?: ((payload: CompositionEvent) => void) | undefined;
|
|
130
|
+
readonly onDrag?: ((payload: DragEvent) => void) | undefined;
|
|
131
|
+
readonly onDragend?: ((payload: DragEvent) => void) | undefined;
|
|
132
|
+
readonly onDragenter?: ((payload: DragEvent) => void) | undefined;
|
|
133
|
+
readonly onDragexit?: ((payload: DragEvent) => void) | undefined;
|
|
134
|
+
readonly onDragleave?: ((payload: DragEvent) => void) | undefined;
|
|
135
|
+
readonly onDragover?: ((payload: DragEvent) => void) | undefined;
|
|
136
|
+
readonly onDragstart?: ((payload: DragEvent) => void) | undefined;
|
|
137
|
+
readonly onDrop?: ((payload: DragEvent) => void) | undefined;
|
|
138
|
+
readonly onFocus?: ((payload: FocusEvent) => void) | undefined;
|
|
139
|
+
readonly onFocusin?: ((payload: FocusEvent) => void) | undefined;
|
|
140
|
+
readonly onFocusout?: ((payload: FocusEvent) => void) | undefined;
|
|
141
|
+
readonly onBlur?: ((payload: FocusEvent) => void) | undefined;
|
|
142
|
+
readonly onChange?: ((payload: Event) => void) | undefined;
|
|
143
|
+
readonly onBeforeinput?: ((payload: InputEvent) => void) | undefined;
|
|
144
|
+
readonly onFormdata?: ((payload: FormDataEvent) => void) | undefined;
|
|
145
|
+
readonly onInput?: ((payload: InputEvent) => void) | undefined;
|
|
146
|
+
readonly onReset?: ((payload: Event) => void) | undefined;
|
|
147
|
+
readonly onSubmit?: ((payload: SubmitEvent) => void) | undefined;
|
|
148
|
+
readonly onInvalid?: ((payload: Event) => void) | undefined;
|
|
149
|
+
readonly onFullscreenchange?: ((payload: Event) => void) | undefined;
|
|
150
|
+
readonly onFullscreenerror?: ((payload: Event) => void) | undefined;
|
|
151
|
+
readonly onLoad?: ((payload: Event) => void) | undefined;
|
|
152
|
+
readonly onError?: ((payload: Event) => void) | undefined;
|
|
153
|
+
readonly onKeydown?: ((payload: KeyboardEvent) => void) | undefined;
|
|
154
|
+
readonly onKeypress?: ((payload: KeyboardEvent) => void) | undefined;
|
|
155
|
+
readonly onKeyup?: ((payload: KeyboardEvent) => void) | undefined;
|
|
156
|
+
readonly onDblclick?: ((payload: MouseEvent) => void) | undefined;
|
|
157
|
+
readonly onMousedown?: ((payload: MouseEvent) => void) | undefined;
|
|
158
|
+
readonly onMouseenter?: ((payload: MouseEvent) => void) | undefined;
|
|
159
|
+
readonly onMouseleave?: ((payload: MouseEvent) => void) | undefined;
|
|
160
|
+
readonly onMousemove?: ((payload: MouseEvent) => void) | undefined;
|
|
161
|
+
readonly onMouseout?: ((payload: MouseEvent) => void) | undefined;
|
|
162
|
+
readonly onMouseover?: ((payload: MouseEvent) => void) | undefined;
|
|
163
|
+
readonly onMouseup?: ((payload: MouseEvent) => void) | undefined;
|
|
164
|
+
readonly onAbort?: ((payload: UIEvent) => void) | undefined;
|
|
165
|
+
readonly onCanplay?: ((payload: Event) => void) | undefined;
|
|
166
|
+
readonly onCanplaythrough?: ((payload: Event) => void) | undefined;
|
|
167
|
+
readonly onDurationchange?: ((payload: Event) => void) | undefined;
|
|
168
|
+
readonly onEmptied?: ((payload: Event) => void) | undefined;
|
|
169
|
+
readonly onEncrypted?: ((payload: MediaEncryptedEvent) => void) | undefined;
|
|
170
|
+
readonly onEnded?: ((payload: Event) => void) | undefined;
|
|
171
|
+
readonly onLoadeddata?: ((payload: Event) => void) | undefined;
|
|
172
|
+
readonly onLoadedmetadata?: ((payload: Event) => void) | undefined;
|
|
173
|
+
readonly onLoadstart?: ((payload: Event) => void) | undefined;
|
|
174
|
+
readonly onPause?: ((payload: Event) => void) | undefined;
|
|
175
|
+
readonly onPlay?: ((payload: Event) => void) | undefined;
|
|
176
|
+
readonly onPlaying?: ((payload: Event) => void) | undefined;
|
|
177
|
+
readonly onProgress?: ((payload: ProgressEvent<EventTarget>) => void) | undefined;
|
|
178
|
+
readonly onRatechange?: ((payload: Event) => void) | undefined;
|
|
179
|
+
readonly onSeeked?: ((payload: Event) => void) | undefined;
|
|
180
|
+
readonly onSeeking?: ((payload: Event) => void) | undefined;
|
|
181
|
+
readonly onStalled?: ((payload: Event) => void) | undefined;
|
|
182
|
+
readonly onSuspend?: ((payload: Event) => void) | undefined;
|
|
183
|
+
readonly onTimeupdate?: ((payload: Event) => void) | undefined;
|
|
184
|
+
readonly onVolumechange?: ((payload: Event) => void) | undefined;
|
|
185
|
+
readonly onWaiting?: ((payload: Event) => void) | undefined;
|
|
186
|
+
readonly onSelect?: ((payload: Event) => void) | undefined;
|
|
187
|
+
readonly onScroll?: ((payload: Event) => void) | undefined;
|
|
188
|
+
readonly onScrollend?: ((payload: Event) => void) | undefined;
|
|
189
|
+
readonly onTouchcancel?: ((payload: TouchEvent) => void) | undefined;
|
|
190
|
+
readonly onTouchend?: ((payload: TouchEvent) => void) | undefined;
|
|
191
|
+
readonly onTouchmove?: ((payload: TouchEvent) => void) | undefined;
|
|
192
|
+
readonly onTouchstart?: ((payload: TouchEvent) => void) | undefined;
|
|
193
|
+
readonly onAuxclick?: ((payload: PointerEvent) => void) | undefined;
|
|
194
|
+
readonly onClick?: ((payload: PointerEvent) => void) | undefined;
|
|
195
|
+
readonly onContextmenu?: ((payload: PointerEvent) => void) | undefined;
|
|
196
|
+
readonly onGotpointercapture?: ((payload: PointerEvent) => void) | undefined;
|
|
197
|
+
readonly onLostpointercapture?: ((payload: PointerEvent) => void) | undefined;
|
|
198
|
+
readonly onPointerdown?: ((payload: PointerEvent) => void) | undefined;
|
|
199
|
+
readonly onPointermove?: ((payload: PointerEvent) => void) | undefined;
|
|
200
|
+
readonly onPointerup?: ((payload: PointerEvent) => void) | undefined;
|
|
201
|
+
readonly onPointercancel?: ((payload: PointerEvent) => void) | undefined;
|
|
202
|
+
readonly onPointerenter?: ((payload: PointerEvent) => void) | undefined;
|
|
203
|
+
readonly onPointerleave?: ((payload: PointerEvent) => void) | undefined;
|
|
204
|
+
readonly onPointerover?: ((payload: PointerEvent) => void) | undefined;
|
|
205
|
+
readonly onPointerout?: ((payload: PointerEvent) => void) | undefined;
|
|
206
|
+
readonly onBeforetoggle?: ((payload: ToggleEvent) => void) | undefined;
|
|
207
|
+
readonly onToggle?: ((payload: ToggleEvent) => void) | undefined;
|
|
208
|
+
readonly onWheel?: ((payload: WheelEvent) => void) | undefined;
|
|
209
|
+
readonly onAnimationcancel?: ((payload: AnimationEvent) => void) | undefined;
|
|
210
|
+
readonly onAnimationstart?: ((payload: AnimationEvent) => void) | undefined;
|
|
211
|
+
readonly onAnimationend?: ((payload: AnimationEvent) => void) | undefined;
|
|
212
|
+
readonly onAnimationiteration?: ((payload: AnimationEvent) => void) | undefined;
|
|
213
|
+
readonly onSecuritypolicyviolation?: ((payload: SecurityPolicyViolationEvent) => void) | undefined;
|
|
214
|
+
readonly onTransitioncancel?: ((payload: TransitionEvent) => void) | undefined;
|
|
215
|
+
readonly onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
|
|
216
|
+
readonly onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
|
|
217
|
+
readonly onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
|
|
218
|
+
readonly key?: PropertyKey | undefined;
|
|
219
|
+
readonly ref?: import("vue").VNodeRef | undefined;
|
|
220
|
+
readonly ref_for?: boolean | undefined | undefined;
|
|
221
|
+
readonly ref_key?: string | undefined | undefined;
|
|
222
|
+
readonly autofocus?: (boolean | "true" | "false") | undefined;
|
|
223
|
+
readonly form?: string | undefined | undefined;
|
|
224
|
+
readonly formaction?: string | undefined | undefined;
|
|
225
|
+
readonly formenctype?: string | undefined | undefined;
|
|
226
|
+
readonly formmethod?: string | undefined | undefined;
|
|
227
|
+
readonly formnovalidate?: (boolean | "true" | "false") | undefined;
|
|
228
|
+
readonly formtarget?: string | undefined | undefined;
|
|
229
|
+
readonly name?: string | undefined | undefined;
|
|
230
|
+
readonly value?: string | number | readonly string[] | undefined;
|
|
231
|
+
readonly popovertarget?: string | undefined;
|
|
232
|
+
readonly popovertargetaction?: import("../../index.ts").PopoverTargetAction | undefined;
|
|
233
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps>>> & (typeof globalThis extends {
|
|
234
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
235
|
+
} ? P : {});
|
|
236
|
+
expose: (exposed: {}) => void;
|
|
237
|
+
attrs: any;
|
|
238
|
+
slots: {};
|
|
239
|
+
emit: {};
|
|
240
|
+
}>) => import("vue").VNode & {
|
|
241
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
242
|
+
};
|
|
243
|
+
declare const _default: typeof __VLS_export;
|
|
244
|
+
export default _default;
|
|
245
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
246
|
+
[K in keyof T]: T[K];
|
|
247
|
+
} : {
|
|
248
|
+
[K in keyof T as K]: T[K];
|
|
249
|
+
}) & {};
|
|
@@ -102,7 +102,9 @@
|
|
|
102
102
|
>
|
|
103
103
|
<slot name="item" :item="entry.item" :active="entry.index === active">
|
|
104
104
|
<Icon
|
|
105
|
-
:name="
|
|
105
|
+
:name="
|
|
106
|
+
entry.item.icon ?? group.icon ?? (group.recent ? 'arrow-path' : 'arrow-right')
|
|
107
|
+
"
|
|
106
108
|
class="k-command-option-icon"
|
|
107
109
|
/>
|
|
108
110
|
<span class="k-command-option-text">
|
|
@@ -251,13 +253,22 @@ const rendered = computed(() => {
|
|
|
251
253
|
});
|
|
252
254
|
}
|
|
253
255
|
for (const group of resultGroups.value) {
|
|
256
|
+
const items = group.more ? [
|
|
257
|
+
...group.items,
|
|
258
|
+
{
|
|
259
|
+
icon: "arrow-right",
|
|
260
|
+
...group.more,
|
|
261
|
+
id: group.more.id ?? `${group.id}:more`
|
|
262
|
+
}
|
|
263
|
+
] : group.items;
|
|
254
264
|
list.push({
|
|
255
265
|
key: `group-${group.id}`,
|
|
256
266
|
label: group.label,
|
|
257
267
|
description: group.description,
|
|
268
|
+
icon: group.icon,
|
|
258
269
|
source: group,
|
|
259
270
|
recent: false,
|
|
260
|
-
items:
|
|
271
|
+
items: items.map((item) => ({
|
|
261
272
|
key: `${group.id}-${item.id}`,
|
|
262
273
|
index: index++,
|
|
263
274
|
item
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { default as CommandButton } from './CommandButton.vue';
|
|
1
2
|
export { default as CommandPalette } from './CommandPalette.vue';
|
|
2
3
|
export { default as ConfirmDialog } from './ConfirmDialog.vue';
|
|
3
4
|
export { default as ConfirmHost } from './ConfirmHost.vue';
|
|
@@ -11,3 +12,4 @@ export { default as Popover } from './Popover.vue';
|
|
|
11
12
|
export { default as Toaster } from './Toaster.vue';
|
|
12
13
|
export { default as Tooltip } from './Tooltip.vue';
|
|
13
14
|
export type * from './types';
|
|
15
|
+
export { matchesSearch, normalizeSearch } from '../../internal/core/text';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { default as CommandButton } from "./CommandButton.vue";
|
|
1
2
|
export { default as CommandPalette } from "./CommandPalette.vue";
|
|
2
3
|
export { default as ConfirmDialog } from "./ConfirmDialog.vue";
|
|
3
4
|
export { default as ConfirmHost } from "./ConfirmHost.vue";
|
|
@@ -10,3 +11,4 @@ export { default as OverlayHost } from "./OverlayHost.vue";
|
|
|
10
11
|
export { default as Popover } from "./Popover.vue";
|
|
11
12
|
export { default as Toaster } from "./Toaster.vue";
|
|
12
13
|
export { default as Tooltip } from "./Tooltip.vue";
|
|
14
|
+
export { matchesSearch, normalizeSearch } from "../../internal/core/text.mjs";
|
|
@@ -78,7 +78,11 @@ export interface CommandGroup<T = unknown> {
|
|
|
78
78
|
id: string;
|
|
79
79
|
label?: string;
|
|
80
80
|
description?: string;
|
|
81
|
+
icon?: IconName;
|
|
81
82
|
items: CommandItem<T>[];
|
|
83
|
+
more?: Omit<CommandItem<T>, 'id'> & {
|
|
84
|
+
id?: string;
|
|
85
|
+
};
|
|
82
86
|
}
|
|
83
87
|
export interface CommandGroupLabelSlotProps<T = unknown> {
|
|
84
88
|
group?: CommandGroup<T>;
|
|
@@ -167,6 +167,7 @@ import { computed, ref, useTemplateRef } from "vue";
|
|
|
167
167
|
import { useLocale } from "../../composables/useLocale";
|
|
168
168
|
import { navCommands, toNavSections } from "../../internal/layout/navigation";
|
|
169
169
|
import { matchesSearch } from "../../internal/core/text";
|
|
170
|
+
import { usePageCommandItems } from "../../composables/usePageCommands";
|
|
170
171
|
import AppShell from "../layout/AppShell.vue";
|
|
171
172
|
import Breadcrumbs from "../layout/Breadcrumbs.vue";
|
|
172
173
|
import Sidebar from "../layout/Sidebar.vue";
|
|
@@ -206,6 +207,7 @@ const props = defineProps({
|
|
|
206
207
|
searchPlaceholder: { type: String, required: false },
|
|
207
208
|
searchShortcut: { type: [String, Boolean], required: false, default: "mod+k" },
|
|
208
209
|
searchNavigationLabel: { type: String, required: false },
|
|
210
|
+
searchPageLabel: { type: String, required: false },
|
|
209
211
|
themeSwitch: { type: [String, Boolean], required: false, default: false },
|
|
210
212
|
collapsible: { type: Boolean, required: false, default: true },
|
|
211
213
|
storageKey: { type: [String, Boolean], required: false, default: "k-sidebar-collapsed" },
|
|
@@ -238,6 +240,7 @@ const navigationGroupLabel = computed(
|
|
|
238
240
|
() => props.searchNavigationLabel ?? t("dashboardLayout.pages")
|
|
239
241
|
);
|
|
240
242
|
const shell = useTemplateRef("shell");
|
|
243
|
+
const pageGroupLabel = computed(() => props.searchPageLabel ?? t("dashboardLayout.pageCommands"));
|
|
241
244
|
const searchOpen = ref(false);
|
|
242
245
|
const hasDesktopTopbar = computed(
|
|
243
246
|
() => Boolean(
|
|
@@ -262,21 +265,34 @@ const settingsSlots = computed(
|
|
|
262
265
|
const navigationCommands = computed(
|
|
263
266
|
() => navCommands(toNavSections(props.navigation))
|
|
264
267
|
);
|
|
268
|
+
const pageCommands = usePageCommandItems();
|
|
269
|
+
function matchingCommands(items, query) {
|
|
270
|
+
return items.filter(
|
|
271
|
+
(item) => matchesSearch([item.label, item.description, ...item.keywords ?? []], query)
|
|
272
|
+
);
|
|
273
|
+
}
|
|
265
274
|
const searchFunction = computed(() => {
|
|
266
275
|
const search = props.search;
|
|
267
276
|
if (typeof search !== "function") return void 0;
|
|
268
|
-
if (!props.searchNavigation) return search;
|
|
269
277
|
return async (query, signal) => {
|
|
270
278
|
const groups = await search(query, signal);
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
279
|
+
const page = matchingCommands(pageCommands.value, query);
|
|
280
|
+
const navigation = props.searchNavigation ? matchingCommands(navigationCommands.value, query) : [];
|
|
281
|
+
return [
|
|
282
|
+
...page.length ? [{ id: "page", label: pageGroupLabel.value, items: page }] : [],
|
|
283
|
+
...navigation.length ? [{ id: "navigation", label: navigationGroupLabel.value, items: navigation }] : [],
|
|
284
|
+
...groups
|
|
285
|
+
];
|
|
276
286
|
};
|
|
277
287
|
});
|
|
278
288
|
const commandGroups = computed(() => {
|
|
279
289
|
const groups = [];
|
|
290
|
+
if (pageCommands.value.length)
|
|
291
|
+
groups.push({
|
|
292
|
+
id: "page",
|
|
293
|
+
label: pageGroupLabel.value,
|
|
294
|
+
items: pageCommands.value
|
|
295
|
+
});
|
|
280
296
|
if (navigationCommands.value.length)
|
|
281
297
|
groups.push({
|
|
282
298
|
id: "navigation",
|
|
@@ -36,6 +36,7 @@ declare const __VLS_export: <T = unknown>(__VLS_props: NonNullable<Awaited<typeo
|
|
|
36
36
|
searchPlaceholder?: string;
|
|
37
37
|
searchShortcut?: string | false;
|
|
38
38
|
searchNavigationLabel?: string;
|
|
39
|
+
searchPageLabel?: string;
|
|
39
40
|
themeSwitch?: ThemeSwitchPlacement;
|
|
40
41
|
collapsible?: boolean;
|
|
41
42
|
storageKey?: string | false;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
<Drawer
|
|
3
3
|
ref="drawer"
|
|
4
4
|
v-model:open="open"
|
|
5
|
-
v-model:tab="
|
|
5
|
+
v-model:tab="activeTab"
|
|
6
6
|
class="k-form-drawer"
|
|
7
7
|
:title="title"
|
|
8
8
|
:description="description"
|
|
9
9
|
:label="label"
|
|
10
10
|
:side="side"
|
|
11
11
|
:size="size"
|
|
12
|
-
:tabs="
|
|
12
|
+
:tabs="tabItems"
|
|
13
13
|
:trail="trail"
|
|
14
14
|
:back-label="backLabel"
|
|
15
15
|
:before-close="beforeClose"
|
|
@@ -27,7 +27,14 @@
|
|
|
27
27
|
<slot v-if="loading" name="skeleton">
|
|
28
28
|
<SkeletonForm />
|
|
29
29
|
</slot>
|
|
30
|
-
<Form
|
|
30
|
+
<Form
|
|
31
|
+
v-else-if="form"
|
|
32
|
+
:id="formId"
|
|
33
|
+
:key="formKey"
|
|
34
|
+
class="k-form-drawer-form"
|
|
35
|
+
:form="form"
|
|
36
|
+
@invalid="openErrorTab"
|
|
37
|
+
>
|
|
31
38
|
<slot :tab="active" />
|
|
32
39
|
</Form>
|
|
33
40
|
<slot v-else :tab="active" />
|
|
@@ -80,6 +87,12 @@ import { useLocale } from "../../composables/useLocale";
|
|
|
80
87
|
import Button from "../core/Button.vue";
|
|
81
88
|
import Form from "../core/Form.vue";
|
|
82
89
|
import SkeletonForm from "../feedback/SkeletonForm.vue";
|
|
90
|
+
import {
|
|
91
|
+
useDefaultRouteLocation,
|
|
92
|
+
useRouteValue,
|
|
93
|
+
writeRouteValue
|
|
94
|
+
} from "../../internal/layout/query";
|
|
95
|
+
import { useRouterLike } from "../../internal/layout/route";
|
|
83
96
|
import Drawer from "../overlays/Drawer.vue";
|
|
84
97
|
const props = defineProps({
|
|
85
98
|
title: { type: String, required: false },
|
|
@@ -88,6 +101,7 @@ const props = defineProps({
|
|
|
88
101
|
side: { type: String, required: false },
|
|
89
102
|
size: { type: String, required: false, default: "md" },
|
|
90
103
|
tabs: { type: Array, required: false },
|
|
104
|
+
tabRoute: { type: String, required: false },
|
|
91
105
|
trail: { type: Array, required: false },
|
|
92
106
|
backLabel: { type: String, required: false },
|
|
93
107
|
form: { type: Object, required: false },
|
|
@@ -122,6 +136,45 @@ const formKey = computed(() => {
|
|
|
122
136
|
if (!formKeys.has(form)) formKeys.set(form, nextFormKey++);
|
|
123
137
|
return formKeys.get(form);
|
|
124
138
|
});
|
|
139
|
+
const router = useRouterLike();
|
|
140
|
+
const routeLocation = useDefaultRouteLocation();
|
|
141
|
+
const routeTab = useRouteValue(router, () => props.tabRoute, routeLocation);
|
|
142
|
+
function inField(name, field) {
|
|
143
|
+
return name === field || name.startsWith(`${field}.`) || name.startsWith(`${field}[`);
|
|
144
|
+
}
|
|
145
|
+
function hasError(item) {
|
|
146
|
+
const errors = props.form?.errors;
|
|
147
|
+
if (!errors || !item.fields?.length) return false;
|
|
148
|
+
return Object.entries(errors).some(
|
|
149
|
+
([name, message]) => !!message && item.fields.some((field) => inField(name, field))
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
const tabItems = computed(
|
|
153
|
+
() => props.tabs?.map(({ fields, ...item }) => ({
|
|
154
|
+
...item,
|
|
155
|
+
dot: item.dot || hasError({ ...item, fields })
|
|
156
|
+
}))
|
|
157
|
+
);
|
|
158
|
+
function firstTab() {
|
|
159
|
+
return props.tabs?.find((item) => !item.disabled)?.value;
|
|
160
|
+
}
|
|
161
|
+
const activeTab = computed({
|
|
162
|
+
get: () => {
|
|
163
|
+
const wanted = props.tabRoute ? routeTab.value : tab.value;
|
|
164
|
+
const match = props.tabs?.find((item) => item.value === wanted && !item.disabled);
|
|
165
|
+
return match ? match.value : firstTab();
|
|
166
|
+
},
|
|
167
|
+
set: (value) => {
|
|
168
|
+
tab.value = value;
|
|
169
|
+
if (!props.tabRoute || !router) return;
|
|
170
|
+
const stored = value === firstTab() || value === void 0 ? void 0 : String(value);
|
|
171
|
+
void writeRouteValue(router, props.tabRoute, stored, "replace", routeLocation);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
function openErrorTab() {
|
|
175
|
+
const target = props.tabs?.find(hasError);
|
|
176
|
+
if (target && target.value !== activeTab.value) activeTab.value = target.value;
|
|
177
|
+
}
|
|
125
178
|
const isDirty = computed(() => Boolean(props.form?.dirty.value));
|
|
126
179
|
const isSaving = computed(() => Boolean(props.form?.submitting.value));
|
|
127
180
|
const needsDirty = computed(() => props.requireDirty ?? !props.creating);
|
|
@@ -135,12 +188,9 @@ const cancelText = computed(
|
|
|
135
188
|
const deleteText = computed(() => props.deleteLabel ?? t("common.delete"));
|
|
136
189
|
async function confirmDiscard() {
|
|
137
190
|
if (!props.guard || props.readonly || props.loading || !isDirty.value) return true;
|
|
138
|
-
return confirm({
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
description: props.guardMessage ?? t("formDrawer.discardDescription"),
|
|
142
|
-
confirmLabel: t("dirtyGuard.confirm"),
|
|
143
|
-
cancelLabel: t("dirtyGuard.cancel")
|
|
191
|
+
return confirm.discard({
|
|
192
|
+
...props.guardTitle ? { title: props.guardTitle } : {},
|
|
193
|
+
...props.guardMessage ? { description: props.guardMessage } : {}
|
|
144
194
|
});
|
|
145
195
|
}
|
|
146
196
|
async function beforeClose(reason) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FormSchema, UseFormReturn } from '../../composables/useForm';
|
|
2
2
|
import type { TabItem } from '../layout/types';
|
|
3
|
+
import type { FormDrawerTab } from './types';
|
|
3
4
|
import type { DialogBeforeClose, DrawerSide, DrawerSize } from '../overlays/types';
|
|
4
5
|
declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
6
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
@@ -8,7 +9,8 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
|
|
|
8
9
|
label?: string;
|
|
9
10
|
side?: DrawerSide;
|
|
10
11
|
size?: DrawerSize;
|
|
11
|
-
tabs?:
|
|
12
|
+
tabs?: FormDrawerTab[];
|
|
13
|
+
tabRoute?: string;
|
|
12
14
|
trail?: string[];
|
|
13
15
|
backLabel?: string;
|
|
14
16
|
form?: UseFormReturn<S, V>;
|