@sewadah/selaras 0.7.1 → 0.8.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/agent/catalog.json +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/components/AvatarGroup.vue +3 -2
- package/dist/runtime/components/CodeGroup.vue +3 -15
- package/dist/runtime/components/ColorModeSwitch.vue +5 -4
- package/dist/runtime/components/ColorModeToggle.vue +5 -4
- package/dist/runtime/components/Listbox.d.vue.ts +28 -0
- package/dist/runtime/components/Listbox.vue +53 -0
- package/dist/runtime/components/Listbox.vue.d.ts +28 -0
- package/dist/runtime/components/TransferList.d.vue.ts +47 -0
- package/dist/runtime/components/TransferList.vue +67 -0
- package/dist/runtime/components/TransferList.vue.d.ts +47 -0
- package/dist/runtime/internal/ListSelectionForm.d.vue.ts +15 -0
- package/dist/runtime/internal/ListSelectionForm.vue +33 -0
- package/dist/runtime/internal/ListSelectionForm.vue.d.ts +15 -0
- package/dist/runtime/internal/ListboxBase.d.vue.ts +49 -0
- package/dist/runtime/internal/ListboxBase.vue +177 -0
- package/dist/runtime/internal/ListboxBase.vue.d.ts +49 -0
- package/dist/runtime/internal/ListboxOption.d.vue.ts +31 -0
- package/dist/runtime/internal/ListboxOption.vue +37 -0
- package/dist/runtime/internal/ListboxOption.vue.d.ts +31 -0
- package/dist/runtime/internal/TransferListBase.d.vue.ts +63 -0
- package/dist/runtime/internal/TransferListBase.vue +206 -0
- package/dist/runtime/internal/TransferListBase.vue.d.ts +63 -0
- package/dist/runtime/internal/color-mode-control.d.ts +7 -0
- package/dist/runtime/internal/color-mode-control.js +12 -0
- package/dist/runtime/internal/list-selection.d.ts +15 -0
- package/dist/runtime/internal/list-selection.js +43 -0
- package/dist/runtime/theme/listbox.d.ts +131 -0
- package/dist/runtime/theme/listbox.js +27 -0
- package/dist/runtime/theme/select.js +1 -1
- package/dist/runtime/theme/transfer-list.d.ts +74 -0
- package/dist/runtime/theme/transfer-list.js +21 -0
- package/dist/runtime/theme-config.d.ts +10 -0
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/utils/listbox-contracts.d.ts +31 -0
- package/dist/runtime/utils/listbox-contracts.js +0 -0
- package/dist/runtime/utils/messages.d.ts +7 -0
- package/dist/runtime/utils/messages.js +7 -0
- package/dist/runtime/utils/slot-children.d.ts +2 -0
- package/dist/runtime/utils/slot-children.js +15 -0
- package/dist/runtime/utils/transfer-list-contracts.d.ts +48 -0
- package/dist/runtime/utils/transfer-list-contracts.js +0 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -3,6 +3,7 @@ import { computed, provide, useSlots } from "vue";
|
|
|
3
3
|
import { useMessages } from "../composables/use-messages";
|
|
4
4
|
import { avatarGroupTheme } from "../theme/avatar-group";
|
|
5
5
|
import { AVATAR_SIZE_INJECTION_KEY } from "../utils/injection-keys";
|
|
6
|
+
import { flattenSlotChildren } from "../utils/slot-children";
|
|
6
7
|
import { resolveSlot, useComponentTheme, useRootProps } from "../utils/ui";
|
|
7
8
|
defineOptions({ inheritAttrs: false });
|
|
8
9
|
const props = defineProps({
|
|
@@ -18,7 +19,7 @@ const ui = computed(() => theme.value({
|
|
|
18
19
|
}));
|
|
19
20
|
const rootProps = useRootProps(() => ui.value.root, () => props.ui?.root);
|
|
20
21
|
provide(AVATAR_SIZE_INJECTION_KEY, computed(() => props.size));
|
|
21
|
-
const slotChildren = computed(() => slots.default?.() ?? []);
|
|
22
|
+
const slotChildren = computed(() => flattenSlotChildren(slots.default?.() ?? []));
|
|
22
23
|
const visibleChildren = computed(() => {
|
|
23
24
|
if (!props.max || slotChildren.value.length <= props.max)
|
|
24
25
|
return slotChildren.value;
|
|
@@ -34,7 +35,7 @@ const overflowCount = computed(() => {
|
|
|
34
35
|
<template>
|
|
35
36
|
<div v-bind="rootProps">
|
|
36
37
|
<span v-if="overflowCount" v-bind="resolveSlot(ui.count, props.ui?.count)">{{ messages.avatarGroupOverflow(overflowCount) }}</span>
|
|
37
|
-
<span v-for="(child, i) in visibleChildren" :key="i" v-bind="resolveSlot(ui.item, props.ui?.item)">
|
|
38
|
+
<span v-for="(child, i) in visibleChildren" :key="child.key ?? i" v-bind="resolveSlot(ui.item, props.ui?.item)">
|
|
38
39
|
<component :is="child" />
|
|
39
40
|
</span>
|
|
40
41
|
</div>
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { cloneVNode,
|
|
2
|
+
import { cloneVNode, computed, ref, useSlots } from "vue";
|
|
3
3
|
import { useMessages } from "../composables/use-messages";
|
|
4
4
|
import { resolveFileIcon } from "../utils/file-icons";
|
|
5
|
+
import { flattenSlotChildren } from "../utils/slot-children";
|
|
5
6
|
import ProsePre from "./ProsePre.vue";
|
|
6
7
|
import Tabs from "./Tabs.vue";
|
|
7
8
|
const slots = useSlots();
|
|
8
9
|
const messages = useMessages();
|
|
9
|
-
|
|
10
|
-
const result = [];
|
|
11
|
-
for (const vnode of vnodes) {
|
|
12
|
-
if (vnode.type === Comment || vnode.type === Text)
|
|
13
|
-
continue;
|
|
14
|
-
if (vnode.type === Fragment && Array.isArray(vnode.children)) {
|
|
15
|
-
result.push(...flatten(vnode.children));
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
result.push(vnode);
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
const children = computed(() => flatten(slots.default?.() ?? []));
|
|
10
|
+
const children = computed(() => flattenSlotChildren(slots.default?.() ?? []));
|
|
23
11
|
function labelFor(child, index) {
|
|
24
12
|
const props = child.props ?? {};
|
|
25
13
|
return props.filename || props.language || messages.value.codeTabFallback(index + 1);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, useAttrs, useSlots } from "vue";
|
|
3
|
-
import { useColorMode } from "#imports";
|
|
4
3
|
import { useIcons } from "../composables/use-icons";
|
|
5
4
|
import { useMessages } from "../composables/use-messages";
|
|
5
|
+
import { useColorModeControl } from "../internal/color-mode-control";
|
|
6
6
|
import Switch from "./Switch.vue";
|
|
7
7
|
defineOptions({ inheritAttrs: false });
|
|
8
8
|
const props = defineProps({
|
|
@@ -18,10 +18,9 @@ const props = defineProps({
|
|
|
18
18
|
});
|
|
19
19
|
const attrs = useAttrs();
|
|
20
20
|
const slots = useSlots();
|
|
21
|
-
const colorMode =
|
|
21
|
+
const { colorMode, isDark, isDisabled } = useColorModeControl();
|
|
22
22
|
const icons = useIcons();
|
|
23
23
|
const messages = useMessages();
|
|
24
|
-
const isDark = computed(() => colorMode.value === "dark");
|
|
25
24
|
const switchUi = computed(() => {
|
|
26
25
|
const track = typeof props.ui?.track === "string" ? { class: props.ui.track } : props.ui?.track;
|
|
27
26
|
return {
|
|
@@ -35,6 +34,8 @@ const switchUi = computed(() => {
|
|
|
35
34
|
};
|
|
36
35
|
});
|
|
37
36
|
function updateMode(dark) {
|
|
37
|
+
if (isDisabled.value || props.disabled)
|
|
38
|
+
return;
|
|
38
39
|
colorMode.preference = dark ? "dark" : "light";
|
|
39
40
|
}
|
|
40
41
|
</script>
|
|
@@ -43,7 +44,7 @@ function updateMode(dark) {
|
|
|
43
44
|
<Switch
|
|
44
45
|
v-bind="{ ...attrs, ...props }"
|
|
45
46
|
:model-value="isDark"
|
|
46
|
-
:disabled="disabled ||
|
|
47
|
+
:disabled="disabled || isDisabled"
|
|
47
48
|
:checked-icon="checkedIcon ?? icons.darkMode"
|
|
48
49
|
:unchecked-icon="uncheckedIcon ?? icons.lightMode"
|
|
49
50
|
:ui="switchUi"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
3
|
-
import { useColorMode } from "#imports";
|
|
4
2
|
import { useIcons } from "../composables/use-icons";
|
|
5
3
|
import { useMessages } from "../composables/use-messages";
|
|
4
|
+
import { useColorModeControl } from "../internal/color-mode-control";
|
|
6
5
|
import Button from "./Button.vue";
|
|
7
|
-
const colorMode =
|
|
6
|
+
const { colorMode, isDark, isDisabled } = useColorModeControl();
|
|
8
7
|
const icons = useIcons();
|
|
9
8
|
const messages = useMessages();
|
|
10
|
-
const isDark = computed(() => colorMode.value === "dark");
|
|
11
9
|
function toggle() {
|
|
10
|
+
if (isDisabled.value)
|
|
11
|
+
return;
|
|
12
12
|
colorMode.preference = isDark.value ? "light" : "dark";
|
|
13
13
|
}
|
|
14
14
|
</script>
|
|
@@ -19,6 +19,7 @@ function toggle() {
|
|
|
19
19
|
variant="ghost"
|
|
20
20
|
color="neutral"
|
|
21
21
|
:aria-label="messages.colorModeToggle"
|
|
22
|
+
:disabled="isDisabled"
|
|
22
23
|
@click="toggle"
|
|
23
24
|
/>
|
|
24
25
|
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ListboxProps, ListboxSlots } from '../utils/listbox-contracts.js';
|
|
2
|
+
import type { SelectEntry, SelectModel } from '../utils/select-contracts.js';
|
|
3
|
+
export type { ListboxEmits, ListboxProps, ListboxSlots } from '../utils/listbox-contracts.js';
|
|
4
|
+
declare const __VLS_export: <Entry extends SelectEntry, Key extends string = "value", Multiple extends boolean = false>(__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
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<ListboxProps<Entry, Key, Multiple> & {
|
|
6
|
+
"onUpdate:modelValue"?: ((value: SelectModel<import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
7
|
+
value: infer Value;
|
|
8
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never, Multiple>) => any) | undefined;
|
|
9
|
+
"onUpdate:searchTerm"?: ((value: string) => any) | undefined;
|
|
10
|
+
}> & (typeof globalThis extends {
|
|
11
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
12
|
+
} ? P : {});
|
|
13
|
+
expose: (exposed: {}) => void;
|
|
14
|
+
attrs: any;
|
|
15
|
+
slots: ListboxSlots<Entry>;
|
|
16
|
+
emit: ((evt: "update:modelValue", value: SelectModel<import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
17
|
+
value: infer Value;
|
|
18
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never, Multiple>) => void) & ((evt: "update:searchTerm", value: string) => void);
|
|
19
|
+
}>) => import("vue").VNode & {
|
|
20
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
21
|
+
};
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
25
|
+
[K in keyof T]: T[K];
|
|
26
|
+
} : {
|
|
27
|
+
[K in keyof T as K]: T[K];
|
|
28
|
+
}) & {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getCurrentInstance } from "vue";
|
|
3
|
+
import ListboxBase from "../internal/ListboxBase.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
label: { type: String, required: false },
|
|
6
|
+
descriptionKey: { type: String, required: false },
|
|
7
|
+
selectionBehavior: { type: String, required: false },
|
|
8
|
+
checkbox: { type: Boolean, required: false },
|
|
9
|
+
selectAll: { type: Boolean, required: false },
|
|
10
|
+
ui: { type: Object, required: false },
|
|
11
|
+
items: { type: Array, required: true },
|
|
12
|
+
modelValue: { type: null, required: false },
|
|
13
|
+
defaultValue: { type: null, required: false },
|
|
14
|
+
valueKey: { type: void 0, required: false },
|
|
15
|
+
labelKey: { type: String, required: false },
|
|
16
|
+
multiple: { type: null, required: false },
|
|
17
|
+
searchable: { type: Boolean, required: false },
|
|
18
|
+
searchTerm: { type: String, required: false },
|
|
19
|
+
virtualize: { type: [Boolean, Object], required: false },
|
|
20
|
+
disabled: { type: Boolean, required: false },
|
|
21
|
+
loading: { type: Boolean, required: false },
|
|
22
|
+
invalid: { type: Boolean, required: false },
|
|
23
|
+
size: { type: null, required: false },
|
|
24
|
+
color: { type: null, required: false },
|
|
25
|
+
id: { type: String, required: false },
|
|
26
|
+
name: { type: String, required: false },
|
|
27
|
+
form: { type: String, required: false },
|
|
28
|
+
required: { type: Boolean, required: false }
|
|
29
|
+
});
|
|
30
|
+
const emit = defineEmits(["update:modelValue", "update:searchTerm"]);
|
|
31
|
+
const slots = defineSlots();
|
|
32
|
+
const instance = getCurrentInstance();
|
|
33
|
+
function baseProps() {
|
|
34
|
+
const controlled = Object.hasOwn(instance.vnode.props ?? {}, "modelValue") || Object.hasOwn(instance.vnode.props ?? {}, "model-value");
|
|
35
|
+
const { modelValue, ...rest } = props;
|
|
36
|
+
return { ...rest, ...controlled ? { modelValue } : {} };
|
|
37
|
+
}
|
|
38
|
+
const plainSlots = ["header", "footer", "empty", "empty-filter"];
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<ListboxBase v-bind="baseProps()" @update:model-value="emit('update:modelValue', $event)" @update:search-term="emit('update:searchTerm', $event)">
|
|
43
|
+
<template v-if="slots.item" #item="data">
|
|
44
|
+
<slot name="item" v-bind="data" />
|
|
45
|
+
</template>
|
|
46
|
+
<template v-if="slots.group" #group="{ group }">
|
|
47
|
+
<slot name="group" :group="group" />
|
|
48
|
+
</template>
|
|
49
|
+
<template v-for="name in plainSlots.filter((name) => slots[name])" :key="name" #[name]>
|
|
50
|
+
<slot :name="name" />
|
|
51
|
+
</template>
|
|
52
|
+
</ListboxBase>
|
|
53
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ListboxProps, ListboxSlots } from '../utils/listbox-contracts.js';
|
|
2
|
+
import type { SelectEntry, SelectModel } from '../utils/select-contracts.js';
|
|
3
|
+
export type { ListboxEmits, ListboxProps, ListboxSlots } from '../utils/listbox-contracts.js';
|
|
4
|
+
declare const __VLS_export: <Entry extends SelectEntry, Key extends string = "value", Multiple extends boolean = false>(__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
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<ListboxProps<Entry, Key, Multiple> & {
|
|
6
|
+
"onUpdate:modelValue"?: ((value: SelectModel<import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
7
|
+
value: infer Value;
|
|
8
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never, Multiple>) => any) | undefined;
|
|
9
|
+
"onUpdate:searchTerm"?: ((value: string) => any) | undefined;
|
|
10
|
+
}> & (typeof globalThis extends {
|
|
11
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
12
|
+
} ? P : {});
|
|
13
|
+
expose: (exposed: {}) => void;
|
|
14
|
+
attrs: any;
|
|
15
|
+
slots: ListboxSlots<Entry>;
|
|
16
|
+
emit: ((evt: "update:modelValue", value: SelectModel<import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
17
|
+
value: infer Value;
|
|
18
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never, Multiple>) => void) & ((evt: "update:searchTerm", value: string) => void);
|
|
19
|
+
}>) => import("vue").VNode & {
|
|
20
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
21
|
+
};
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
25
|
+
[K in keyof T]: T[K];
|
|
26
|
+
} : {
|
|
27
|
+
[K in keyof T as K]: T[K];
|
|
28
|
+
}) & {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SelectEntry } from '../utils/select-contracts.js';
|
|
2
|
+
import type { TransferListProps, TransferListSlots } from '../utils/transfer-list-contracts.js';
|
|
3
|
+
export type { TransferDirection, TransferListEmits, TransferListProps, TransferListSlots, TransferSide } from '../utils/transfer-list-contracts.js';
|
|
4
|
+
declare const __VLS_export: <Entry extends SelectEntry, Key extends string = "value">(__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
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<TransferListProps<Entry, Key> & {
|
|
6
|
+
"onUpdate:modelValue"?: ((value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
7
|
+
value: infer Value;
|
|
8
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => any) | undefined;
|
|
9
|
+
"onUpdate:checked"?: ((value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
10
|
+
value: infer Value;
|
|
11
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => any) | undefined;
|
|
12
|
+
"onUpdate:sourceSearchTerm"?: ((value: string) => any) | undefined;
|
|
13
|
+
"onUpdate:targetSearchTerm"?: ((value: string) => any) | undefined;
|
|
14
|
+
onTransfer?: ((payload: {
|
|
15
|
+
direction: import("./TransferList.vue.js").TransferDirection;
|
|
16
|
+
items: import("../utils/select-contracts.js").SelectEntryItem<Entry>[];
|
|
17
|
+
values: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
18
|
+
value: infer Value;
|
|
19
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[];
|
|
20
|
+
}) => any) | undefined;
|
|
21
|
+
}> & (typeof globalThis extends {
|
|
22
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
23
|
+
} ? P : {});
|
|
24
|
+
expose: (exposed: {}) => void;
|
|
25
|
+
attrs: any;
|
|
26
|
+
slots: TransferListSlots<Entry>;
|
|
27
|
+
emit: ((evt: "update:modelValue", value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
28
|
+
value: infer Value;
|
|
29
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => void) & ((evt: "update:checked", value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
30
|
+
value: infer Value;
|
|
31
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => void) & ((evt: "update:sourceSearchTerm", value: string) => void) & ((evt: "update:targetSearchTerm", value: string) => void) & ((evt: "transfer", payload: {
|
|
32
|
+
direction: import("./TransferList.vue.js").TransferDirection;
|
|
33
|
+
items: import("../utils/select-contracts.js").SelectEntryItem<Entry>[];
|
|
34
|
+
values: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
35
|
+
value: infer Value;
|
|
36
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[];
|
|
37
|
+
}) => void);
|
|
38
|
+
}>) => import("vue").VNode & {
|
|
39
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
40
|
+
};
|
|
41
|
+
declare const _default: typeof __VLS_export;
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
44
|
+
[K in keyof T]: T[K];
|
|
45
|
+
} : {
|
|
46
|
+
[K in keyof T as K]: T[K];
|
|
47
|
+
}) & {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getCurrentInstance } from "vue";
|
|
3
|
+
import TransferListBase from "../internal/TransferListBase.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
checked: { type: null, required: false },
|
|
6
|
+
sourceLabel: { type: String, required: false },
|
|
7
|
+
targetLabel: { type: String, required: false },
|
|
8
|
+
sourceSearchTerm: { type: String, required: false },
|
|
9
|
+
targetSearchTerm: { type: String, required: false },
|
|
10
|
+
showSelectAll: { type: Boolean, required: false, default: true },
|
|
11
|
+
layout: { type: String, required: false },
|
|
12
|
+
ui: { type: Object, required: false },
|
|
13
|
+
descriptionKey: { type: String, required: false },
|
|
14
|
+
items: { type: Array, required: true },
|
|
15
|
+
modelValue: { type: null, required: false },
|
|
16
|
+
defaultValue: { type: null, required: false },
|
|
17
|
+
valueKey: { type: void 0, required: false },
|
|
18
|
+
labelKey: { type: String, required: false },
|
|
19
|
+
searchable: { type: Boolean, required: false },
|
|
20
|
+
virtualize: { type: [Boolean, Object], required: false },
|
|
21
|
+
disabled: { type: Boolean, required: false },
|
|
22
|
+
loading: { type: Boolean, required: false },
|
|
23
|
+
invalid: { type: Boolean, required: false },
|
|
24
|
+
size: { type: null, required: false },
|
|
25
|
+
color: { type: null, required: false },
|
|
26
|
+
id: { type: String, required: false },
|
|
27
|
+
name: { type: String, required: false },
|
|
28
|
+
form: { type: String, required: false },
|
|
29
|
+
required: { type: Boolean, required: false }
|
|
30
|
+
});
|
|
31
|
+
const emit = defineEmits(["update:modelValue", "update:checked", "update:sourceSearchTerm", "update:targetSearchTerm", "transfer"]);
|
|
32
|
+
const slots = defineSlots();
|
|
33
|
+
const instance = getCurrentInstance();
|
|
34
|
+
function baseProps() {
|
|
35
|
+
const raw = instance.vnode.props ?? {};
|
|
36
|
+
const { modelValue, checked, ...rest } = props;
|
|
37
|
+
return {
|
|
38
|
+
...rest,
|
|
39
|
+
...Object.hasOwn(raw, "modelValue") || Object.hasOwn(raw, "model-value") ? { modelValue } : {},
|
|
40
|
+
...Object.hasOwn(raw, "checked") ? { checked } : {}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<TransferListBase
|
|
47
|
+
v-bind="baseProps()"
|
|
48
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
49
|
+
@update:checked="emit('update:checked', $event)"
|
|
50
|
+
@update:source-search-term="emit('update:sourceSearchTerm', $event)"
|
|
51
|
+
@update:target-search-term="emit('update:targetSearchTerm', $event)"
|
|
52
|
+
@transfer="emit('transfer', $event)"
|
|
53
|
+
>
|
|
54
|
+
<template v-if="slots.item" #item="data">
|
|
55
|
+
<slot name="item" v-bind="data" />
|
|
56
|
+
</template>
|
|
57
|
+
<template v-for="name in ['source-header', 'target-header'].filter((name) => slots[name])" :key="name" #[name]="data">
|
|
58
|
+
<slot :name="name" v-bind="data" />
|
|
59
|
+
</template>
|
|
60
|
+
<template v-for="name in ['source-footer', 'target-footer'].filter((name) => slots[name])" :key="name" #[name]>
|
|
61
|
+
<slot :name="name" />
|
|
62
|
+
</template>
|
|
63
|
+
<template v-for="name in ['empty', 'empty-filter'].filter((name) => slots[name])" :key="name" #[name]="data">
|
|
64
|
+
<slot :name="name" v-bind="data" />
|
|
65
|
+
</template>
|
|
66
|
+
</TransferListBase>
|
|
67
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SelectEntry } from '../utils/select-contracts.js';
|
|
2
|
+
import type { TransferListProps, TransferListSlots } from '../utils/transfer-list-contracts.js';
|
|
3
|
+
export type { TransferDirection, TransferListEmits, TransferListProps, TransferListSlots, TransferSide } from '../utils/transfer-list-contracts.js';
|
|
4
|
+
declare const __VLS_export: <Entry extends SelectEntry, Key extends string = "value">(__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
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<TransferListProps<Entry, Key> & {
|
|
6
|
+
"onUpdate:modelValue"?: ((value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
7
|
+
value: infer Value;
|
|
8
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => any) | undefined;
|
|
9
|
+
"onUpdate:checked"?: ((value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
10
|
+
value: infer Value;
|
|
11
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => any) | undefined;
|
|
12
|
+
"onUpdate:sourceSearchTerm"?: ((value: string) => any) | undefined;
|
|
13
|
+
"onUpdate:targetSearchTerm"?: ((value: string) => any) | undefined;
|
|
14
|
+
onTransfer?: ((payload: {
|
|
15
|
+
direction: import("./TransferList.vue.js").TransferDirection;
|
|
16
|
+
items: import("../utils/select-contracts.js").SelectEntryItem<Entry>[];
|
|
17
|
+
values: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
18
|
+
value: infer Value;
|
|
19
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[];
|
|
20
|
+
}) => any) | undefined;
|
|
21
|
+
}> & (typeof globalThis extends {
|
|
22
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
23
|
+
} ? P : {});
|
|
24
|
+
expose: (exposed: {}) => void;
|
|
25
|
+
attrs: any;
|
|
26
|
+
slots: TransferListSlots<Entry>;
|
|
27
|
+
emit: ((evt: "update:modelValue", value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
28
|
+
value: infer Value;
|
|
29
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => void) & ((evt: "update:checked", value: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
30
|
+
value: infer Value;
|
|
31
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[]) => void) & ((evt: "update:sourceSearchTerm", value: string) => void) & ((evt: "update:targetSearchTerm", value: string) => void) & ((evt: "transfer", payload: {
|
|
32
|
+
direction: import("./TransferList.vue.js").TransferDirection;
|
|
33
|
+
items: import("../utils/select-contracts.js").SelectEntryItem<Entry>[];
|
|
34
|
+
values: (import("../utils/select-contracts.js").SelectEntryItem<Entry> extends infer T ? T extends import("../utils/select-contracts.js").SelectEntryItem<Entry> ? T extends import("../utils/select-contracts.js").SelectValue ? T : Key extends "value" ? T extends object ? "value" extends keyof T ? T extends infer T_1 ? T_1 extends T ? T_1 extends {
|
|
35
|
+
value: infer Value;
|
|
36
|
+
} ? Value : T_1 | NonNullable<T_1[keyof T_1 & "value"]> : never : never : T : never : Key extends keyof T ? T[Key] : never : never : never)[];
|
|
37
|
+
}) => void);
|
|
38
|
+
}>) => import("vue").VNode & {
|
|
39
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
40
|
+
};
|
|
41
|
+
declare const _default: typeof __VLS_export;
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
44
|
+
[K in keyof T]: T[K];
|
|
45
|
+
} : {
|
|
46
|
+
[K in keyof T as K]: T[K];
|
|
47
|
+
}) & {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SelectModelValue } from '../utils/select-contracts.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
values: SelectModelValue[];
|
|
4
|
+
name?: string;
|
|
5
|
+
form?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
reset: () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onReset?: (() => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { onMounted, onUnmounted, ref } from "vue";
|
|
3
|
+
import { applyClassPrefix } from "../utils/ui";
|
|
4
|
+
defineProps({
|
|
5
|
+
values: { type: Array, required: true },
|
|
6
|
+
name: { type: String, required: false },
|
|
7
|
+
form: { type: String, required: false },
|
|
8
|
+
required: { type: Boolean, required: false },
|
|
9
|
+
disabled: { type: Boolean, required: false }
|
|
10
|
+
});
|
|
11
|
+
const emit = defineEmits(["reset"]);
|
|
12
|
+
const anchor = ref();
|
|
13
|
+
let owner = null;
|
|
14
|
+
function reset(event) {
|
|
15
|
+
queueMicrotask(() => {
|
|
16
|
+
if (!event.defaultPrevented)
|
|
17
|
+
emit("reset");
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
onMounted(() => {
|
|
21
|
+
owner = anchor.value?.form ?? null;
|
|
22
|
+
owner?.addEventListener("reset", reset);
|
|
23
|
+
});
|
|
24
|
+
onUnmounted(() => owner?.removeEventListener("reset", reset));
|
|
25
|
+
function serialize(value) {
|
|
26
|
+
return typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<input ref="anchor" :type="required ? 'text' : 'hidden'" :class="required ? applyClassPrefix('sr-only') : void 0" :form="form" :required="required && !disabled && !values.length" :disabled="disabled || !!values.length" aria-hidden="true" tabindex="-1" autocomplete="off">
|
|
32
|
+
<input v-for="(value, index) in values" :key="index" type="hidden" :name="name" :form="form" :value="serialize(value)" :disabled="disabled">
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SelectModelValue } from '../utils/select-contracts.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
values: SelectModelValue[];
|
|
4
|
+
name?: string;
|
|
5
|
+
form?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
reset: () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onReset?: (() => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ListboxProps } from '../utils/listbox-contracts.js';
|
|
2
|
+
import type { SelectModelValue } from '../utils/select-contracts.js';
|
|
3
|
+
import type { SelectItems } from './combobox-select.js';
|
|
4
|
+
export interface ListboxBaseProps extends Omit<ListboxProps, 'items' | 'valueKey' | 'labelKey' | 'descriptionKey' | 'multiple' | 'modelValue' | 'defaultValue'> {
|
|
5
|
+
items: SelectItems;
|
|
6
|
+
valueKey?: string;
|
|
7
|
+
labelKey?: string;
|
|
8
|
+
descriptionKey?: string;
|
|
9
|
+
multiple?: boolean;
|
|
10
|
+
modelValue?: SelectModelValue | SelectModelValue[];
|
|
11
|
+
defaultValue?: SelectModelValue | SelectModelValue[];
|
|
12
|
+
/** Composite panels must not inherit or submit their parent's form value. */
|
|
13
|
+
formField?: boolean;
|
|
14
|
+
}
|
|
15
|
+
type __VLS_Slots = {
|
|
16
|
+
'item'?: (props: {
|
|
17
|
+
item: SelectModelValue;
|
|
18
|
+
index: number;
|
|
19
|
+
selected: boolean;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
}) => any;
|
|
22
|
+
'group'?: (props: {
|
|
23
|
+
group: {
|
|
24
|
+
label: string;
|
|
25
|
+
items: readonly SelectModelValue[];
|
|
26
|
+
};
|
|
27
|
+
}) => any;
|
|
28
|
+
'header'?: () => any;
|
|
29
|
+
'footer'?: () => any;
|
|
30
|
+
'empty'?: () => any;
|
|
31
|
+
'empty-filter'?: () => any;
|
|
32
|
+
};
|
|
33
|
+
declare const __VLS_base: import("vue").DefineComponent<ListboxBaseProps, {
|
|
34
|
+
focus: () => void | undefined;
|
|
35
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
"update:modelValue": (value: SelectModelValue | SelectModelValue[] | undefined) => any;
|
|
37
|
+
"update:searchTerm": (value: string) => any;
|
|
38
|
+
}, string, import("vue").PublicProps, Readonly<ListboxBaseProps> & Readonly<{
|
|
39
|
+
"onUpdate:modelValue"?: ((value: SelectModelValue | SelectModelValue[] | undefined) => any) | undefined;
|
|
40
|
+
"onUpdate:searchTerm"?: ((value: string) => any) | undefined;
|
|
41
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
42
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|