v-nuxt-ui 0.2.19 → 0.2.21
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/module.json +1 -1
- package/dist/runtime/components/button/Dropdown.d.vue.ts +6 -7
- package/dist/runtime/components/button/Dropdown.vue +15 -86
- package/dist/runtime/components/button/Dropdown.vue.d.ts +6 -7
- package/dist/runtime/components/sys/user/Table.vue +0 -5
- package/dist/runtime/components/table/query/where/Newer.vue +12 -21
- package/dist/runtime/components/table/query/where/simple/item/ColumnPicker.vue +12 -20
- package/dist/runtime/components/table/query/where/simple/item/OprPicker.vue +10 -16
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ListboxItem, ListboxProps } from '@nuxt/ui';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
-
multiple?:
|
|
5
|
-
enableFooterToolbar?: boolean;
|
|
3
|
+
items: ListboxItem[];
|
|
4
|
+
multiple?: ListboxProps['multiple'];
|
|
6
5
|
onOpen?: () => Promise<void>;
|
|
7
6
|
onSearch?: (searchTerm: string) => Promise<void>;
|
|
8
7
|
};
|
|
9
8
|
type __VLS_ModelProps = {
|
|
10
|
-
'modelValue'?: string | number | undefined |
|
|
9
|
+
'modelValue'?: string | number | undefined | (string | number)[];
|
|
11
10
|
};
|
|
12
11
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
13
12
|
declare var __VLS_8: {};
|
|
@@ -17,9 +16,9 @@ type __VLS_Slots = {} & {
|
|
|
17
16
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
18
17
|
focus: () => Promise<void>;
|
|
19
18
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
|
-
"update:modelValue": (value: string | number | (string | number)[] |
|
|
19
|
+
"update:modelValue": (value: string | number | (string | number)[] | undefined) => any;
|
|
21
20
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
22
|
-
"onUpdate:modelValue"?: ((value: string | number | (string | number)[] |
|
|
21
|
+
"onUpdate:modelValue"?: ((value: string | number | (string | number)[] | undefined) => any) | undefined;
|
|
23
22
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
23
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
24
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,59 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { ref, watch } from "vue";
|
|
3
3
|
const props = defineProps({
|
|
4
|
-
|
|
4
|
+
items: { type: Array, required: true },
|
|
5
5
|
multiple: { type: Boolean, required: false },
|
|
6
|
-
enableFooterToolbar: { type: Boolean, required: false },
|
|
7
6
|
onOpen: { type: Function, required: false },
|
|
8
7
|
onSearch: { type: Function, required: false }
|
|
9
8
|
});
|
|
10
9
|
const modelValue = defineModel("modelValue", { type: null, ...{ required: false } });
|
|
11
|
-
const commandPaletteModelValue = computed({
|
|
12
|
-
get() {
|
|
13
|
-
if (props.multiple) {
|
|
14
|
-
const values = [];
|
|
15
|
-
for (const group of props.groups) {
|
|
16
|
-
for (const item of group.items) {
|
|
17
|
-
if (Array.isArray(modelValue.value) && modelValue.value.includes(item.value)) {
|
|
18
|
-
values.push(item);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return values;
|
|
23
|
-
}
|
|
24
|
-
for (const group of props.groups) {
|
|
25
|
-
for (const item of group.items) {
|
|
26
|
-
if (item.value === modelValue.value) {
|
|
27
|
-
const newItem = { ...item };
|
|
28
|
-
delete newItem.onSelect;
|
|
29
|
-
return newItem;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return {};
|
|
34
|
-
},
|
|
35
|
-
set(newValue) {
|
|
36
|
-
if (props.multiple) {
|
|
37
|
-
modelValue.value = newValue.map((item) => item.value);
|
|
38
|
-
} else {
|
|
39
|
-
modelValue.value = newValue.value;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
const footerActions = [
|
|
44
|
-
{
|
|
45
|
-
label: "\u5168\u9009",
|
|
46
|
-
fn: () => modelValue.value = props.groups.flatMap((group) => group.items.map((item) => item.value))
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
label: "\u53CD\u9009",
|
|
50
|
-
fn: () => modelValue.value = props.groups.flatMap((group) => group.items.map((item) => item.value)).filter((value) => !(Array.isArray(modelValue.value) ? modelValue.value.includes(value) : modelValue.value === value))
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
label: "\u6E05\u7A7A",
|
|
54
|
-
fn: () => modelValue.value = []
|
|
55
|
-
}
|
|
56
|
-
];
|
|
57
10
|
const searchTerm = ref("");
|
|
58
11
|
const popoverOpen = ref(false);
|
|
59
12
|
watch(popoverOpen, async (newOpen) => {
|
|
@@ -82,46 +35,22 @@ defineExpose({
|
|
|
82
35
|
<slot />
|
|
83
36
|
|
|
84
37
|
<template #content>
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
:
|
|
88
|
-
|
|
38
|
+
<UListbox
|
|
39
|
+
v-model="modelValue"
|
|
40
|
+
v-model:search-term="searchTerm"
|
|
41
|
+
autofocus
|
|
89
42
|
size="sm"
|
|
90
|
-
|
|
91
|
-
:
|
|
92
|
-
|
|
93
|
-
|
|
43
|
+
value-key="value"
|
|
44
|
+
:filter="{
|
|
45
|
+
placeholder: '\u641C\u7D22...',
|
|
46
|
+
icon: 'i-lucide-search'
|
|
94
47
|
}"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
@update:model-value="(newValue) => {
|
|
98
|
-
commandPaletteModelValue = newValue;
|
|
99
|
-
if (!multiple) {
|
|
100
|
-
popoverOpen = false;
|
|
101
|
-
}
|
|
102
|
-
}"
|
|
103
|
-
@update:search-term="async (newSearchTerm) => {
|
|
104
|
-
searchTerm = newSearchTerm;
|
|
105
|
-
await onSearch?.(newSearchTerm);
|
|
48
|
+
:ui="{
|
|
49
|
+
root: 'ring-0'
|
|
106
50
|
}"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<UFieldGroup class="flex items-center ml-auto">
|
|
111
|
-
<UButton
|
|
112
|
-
v-for="action in footerActions"
|
|
113
|
-
:key="action.label"
|
|
114
|
-
:label="action.label"
|
|
115
|
-
size="xs"
|
|
116
|
-
color="neutral"
|
|
117
|
-
variant="ghost"
|
|
118
|
-
class="text-muted font-normal"
|
|
119
|
-
@click="action.fn"
|
|
120
|
-
/>
|
|
121
|
-
</UFieldGroup>
|
|
122
|
-
</div>
|
|
123
|
-
</template>
|
|
124
|
-
</UCommandPalette>
|
|
51
|
+
:items="props.items"
|
|
52
|
+
:multiple="props.multiple"
|
|
53
|
+
/>
|
|
125
54
|
</template>
|
|
126
55
|
</UPopover>
|
|
127
56
|
</template>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ListboxItem, ListboxProps } from '@nuxt/ui';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
-
multiple?:
|
|
5
|
-
enableFooterToolbar?: boolean;
|
|
3
|
+
items: ListboxItem[];
|
|
4
|
+
multiple?: ListboxProps['multiple'];
|
|
6
5
|
onOpen?: () => Promise<void>;
|
|
7
6
|
onSearch?: (searchTerm: string) => Promise<void>;
|
|
8
7
|
};
|
|
9
8
|
type __VLS_ModelProps = {
|
|
10
|
-
'modelValue'?: string | number | undefined |
|
|
9
|
+
'modelValue'?: string | number | undefined | (string | number)[];
|
|
11
10
|
};
|
|
12
11
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
13
12
|
declare var __VLS_8: {};
|
|
@@ -17,9 +16,9 @@ type __VLS_Slots = {} & {
|
|
|
17
16
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
18
17
|
focus: () => Promise<void>;
|
|
19
18
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
|
-
"update:modelValue": (value: string | number | (string | number)[] |
|
|
19
|
+
"update:modelValue": (value: string | number | (string | number)[] | undefined) => any;
|
|
21
20
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
22
|
-
"onUpdate:modelValue"?: ((value: string | number | (string | number)[] |
|
|
21
|
+
"onUpdate:modelValue"?: ((value: string | number | (string | number)[] | undefined) => any) | undefined;
|
|
23
22
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
23
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
24
|
declare const _default: typeof __VLS_export;
|
|
@@ -192,11 +192,6 @@ const columns = [
|
|
|
192
192
|
:extra-order-query-options="[
|
|
193
193
|
{ field: 'createdAt', label: '\u521B\u5EFA\u65F6\u95F4', defaultOpr: 'desc' }
|
|
194
194
|
]"
|
|
195
|
-
:extra-where-query-init-values="{
|
|
196
|
-
items: [
|
|
197
|
-
{ field: 'isAdmin', opr: 'eq', value: false }
|
|
198
|
-
]
|
|
199
|
-
}"
|
|
200
195
|
@edit-row-from-modal="async (row) => await createModal.open({ model: row }).result"
|
|
201
196
|
/>
|
|
202
197
|
</template>
|
|
@@ -10,32 +10,23 @@ const props = defineProps({
|
|
|
10
10
|
});
|
|
11
11
|
const emit = defineEmits(["new"]);
|
|
12
12
|
const popoverOpen = ref(false);
|
|
13
|
-
const unselectedOptions = computed(() => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
label: column?.header || option?.label || field,
|
|
23
|
-
icon: tableWhereQueryItemIconMap.get(option?.type ?? "unknown") || "field",
|
|
24
|
-
onSelect: () => {
|
|
25
|
-
emit("new", field);
|
|
26
|
-
popoverOpen.value = false;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
})
|
|
13
|
+
const unselectedOptions = computed(() => props.unselectedFields.map((field) => {
|
|
14
|
+
const option = props.options.find((option2) => option2.field === field);
|
|
15
|
+
const column = props.bizColumns.find((column2) => column2["accessorKey"] === field);
|
|
16
|
+
return {
|
|
17
|
+
label: column?.header || option?.label || field,
|
|
18
|
+
icon: tableWhereQueryItemIconMap.get(option?.type ?? "unknown") || "field",
|
|
19
|
+
onSelect: () => {
|
|
20
|
+
emit("new", field);
|
|
21
|
+
popoverOpen.value = false;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
23
|
+
};
|
|
24
|
+
}));
|
|
34
25
|
</script>
|
|
35
26
|
|
|
36
27
|
<template>
|
|
37
28
|
<!-- NOTE: 自己实现DropdownMenu, 原生DropdownMenu的Focus有问题,会让查询字段打开的Popover关闭 -->
|
|
38
|
-
<ButtonDropdown :
|
|
29
|
+
<ButtonDropdown :items="unselectedOptions">
|
|
39
30
|
<UButton
|
|
40
31
|
label="新增"
|
|
41
32
|
:size="size"
|
|
@@ -9,25 +9,17 @@ const props = defineProps({
|
|
|
9
9
|
focus: { type: Function, required: false }
|
|
10
10
|
});
|
|
11
11
|
const whereQueryItem = defineModel("whereQueryItem", { type: Object, ...{ required: true } });
|
|
12
|
-
const items = computed(() => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
nextTick(() => {
|
|
24
|
-
props.focus?.();
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}))
|
|
28
|
-
}
|
|
29
|
-
];
|
|
30
|
-
});
|
|
12
|
+
const items = computed(() => props.options.map((option) => ({
|
|
13
|
+
label: option.label,
|
|
14
|
+
value: option.field,
|
|
15
|
+
icon: tableWhereQueryItemIconMap.get(option.type) || "field",
|
|
16
|
+
onSelect: () => {
|
|
17
|
+
modelValue.value = option.field;
|
|
18
|
+
nextTick(() => {
|
|
19
|
+
props.focus?.();
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
})));
|
|
31
23
|
const modelValue = computed({
|
|
32
24
|
get() {
|
|
33
25
|
return whereQueryItem.value.field;
|
|
@@ -53,7 +45,7 @@ const currentOption = computed(() => {
|
|
|
53
45
|
<template>
|
|
54
46
|
<ButtonDropdown
|
|
55
47
|
v-model="modelValue"
|
|
56
|
-
:
|
|
48
|
+
:items="items"
|
|
57
49
|
>
|
|
58
50
|
<UButton
|
|
59
51
|
:size="'sm'"
|
|
@@ -16,22 +16,16 @@ const items = computed(() => {
|
|
|
16
16
|
console.error("Cannot find field option or missing type for field:", whereQueryItem.value.field);
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
modelValue.value = option2.value;
|
|
28
|
-
nextTick(() => {
|
|
29
|
-
props.focus?.();
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}))
|
|
19
|
+
return useTableOpr().getOprNameOptionsByType(option.value.type).map((option2) => ({
|
|
20
|
+
label: option2.label,
|
|
21
|
+
value: option2.value,
|
|
22
|
+
onSelect: () => {
|
|
23
|
+
modelValue.value = option2.value;
|
|
24
|
+
nextTick(() => {
|
|
25
|
+
props.focus?.();
|
|
26
|
+
});
|
|
33
27
|
}
|
|
34
|
-
|
|
28
|
+
}));
|
|
35
29
|
});
|
|
36
30
|
const modelValue = computed({
|
|
37
31
|
get() {
|
|
@@ -55,7 +49,7 @@ const currentLabel = computed(() => {
|
|
|
55
49
|
<!-- NOTE: 自己实现DropdownMenu, 原生DropdownMenu的Focus有问题,会让查询字段打开的Popover关闭 -->
|
|
56
50
|
<ButtonDropdown
|
|
57
51
|
v-model="modelValue"
|
|
58
|
-
:
|
|
52
|
+
:items="items"
|
|
59
53
|
>
|
|
60
54
|
<UButton
|
|
61
55
|
size="sm"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "v-nuxt-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.21",
|
|
4
4
|
"description": "Veken UI Component Library - Reusable Nuxt UI components, composables, and utilities for enterprise applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"style": "./dist/runtime/index.css",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@nuxt/eslint-config": "^1.15.2",
|
|
72
72
|
"@nuxt/fonts": "^0.12.1",
|
|
73
73
|
"@nuxt/module-builder": "^1.0.2",
|
|
74
|
-
"@nuxt/ui": "^4.
|
|
74
|
+
"@nuxt/ui": "^4.7.0",
|
|
75
75
|
"@nuxtjs/i18n": "^10.2.4",
|
|
76
76
|
"@nuxtjs/mdc": "^0.20.2",
|
|
77
77
|
"@tanstack/table-core": "^8.21.3",
|