v-nuxt-ui 0.1.35 → 0.2.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/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/components/Watermark.d.vue.ts +3 -3
- package/dist/runtime/components/Watermark.vue.d.ts +3 -3
- package/dist/runtime/components/button/CircleColor.d.vue.ts +17 -0
- package/dist/runtime/components/button/CircleColor.vue +37 -0
- package/dist/runtime/components/button/CircleColor.vue.d.ts +17 -0
- package/dist/runtime/components/button/Dropdown.vue +5 -1
- package/dist/runtime/components/date-picker/Input.d.vue.ts +9 -1
- package/dist/runtime/components/date-picker/Input.vue +55 -11
- package/dist/runtime/components/date-picker/Input.vue.d.ts +9 -1
- package/dist/runtime/components/date-picker/index.vue +3 -3
- package/dist/runtime/components/flow/FlowEdge.client.vue +170 -41
- package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +51 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue +287 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +51 -0
- package/dist/runtime/components/flow/FlowNode.client.d.vue.ts +13 -2
- package/dist/runtime/components/flow/FlowNode.client.vue +44 -48
- package/dist/runtime/components/flow/FlowNode.client.vue.d.ts +13 -2
- package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +41 -5
- package/dist/runtime/components/flow/FlowToolbar.vue +554 -88
- package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +41 -5
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.d.vue.ts +17 -0
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue +16 -0
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue.d.ts +17 -0
- package/dist/runtime/components/form/field/DatePicker.vue +1 -1
- package/dist/runtime/components/sys/flow/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/flow/CreateModal.vue +32 -0
- package/dist/runtime/components/sys/flow/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.vue +30 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/flow/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/flow/Table.vue +103 -0
- package/dist/runtime/components/sys/flow/Table.vue.d.ts +3 -0
- package/dist/runtime/components/sys/table/CreateModal.vue +9 -193
- package/dist/runtime/components/sys/table/Table.vue +6 -15
- package/dist/runtime/components/sys/table/TableColumnList.d.vue.ts +54 -0
- package/dist/runtime/components/sys/table/TableColumnList.vue +196 -0
- package/dist/runtime/components/sys/table/TableColumnList.vue.d.ts +54 -0
- package/dist/runtime/components/sys/table/TableColumnModal.d.vue.ts +3 -13
- package/dist/runtime/components/sys/table/TableColumnModal.vue +32 -100
- package/dist/runtime/components/sys/table/TableColumnModal.vue.d.ts +3 -13
- package/dist/runtime/components/sys/user/Table.vue +44 -27
- package/dist/runtime/components/table/permission/TablePermissionConfig.d.vue.ts +2 -2
- package/dist/runtime/components/table/permission/TablePermissionConfig.vue +3 -3
- package/dist/runtime/components/table/permission/TablePermissionConfig.vue.d.ts +2 -2
- package/dist/runtime/components/table/permission/TablePermissionTab.vue +7 -4
- package/dist/runtime/components/table/query/order/Item.d.vue.ts +2 -2
- package/dist/runtime/components/table/query/order/Item.vue.d.ts +2 -2
- package/dist/runtime/components/table/query/where/Newer.vue +2 -0
- package/dist/runtime/components/table/query/where/index.vue +46 -15
- package/dist/runtime/components/table/query/where/simple/item/ColumnPicker.vue +9 -4
- package/dist/runtime/components/table/query/where/simple/item/OprPicker.vue +3 -3
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue +45 -48
- package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.vue +137 -131
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.d.vue.ts +4 -2
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue +40 -40
- package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue.d.ts +4 -2
- package/dist/runtime/components/table/query/where/simple/item/opr/index.vue +2 -0
- package/dist/runtime/components/table/settings/TableSettings.d.vue.ts +1 -1
- package/dist/runtime/components/table/settings/TableSettings.vue +0 -3
- package/dist/runtime/components/table/settings/TableSettings.vue.d.ts +1 -1
- package/dist/runtime/composables/api/sys/index.d.ts +3 -0
- package/dist/runtime/composables/api/sys/index.js +3 -0
- package/dist/runtime/composables/api/sys/useFlowApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowApi.js +5 -0
- package/dist/runtime/composables/api/sys/useFlowEdgeApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowEdgeApi.js +3 -0
- package/dist/runtime/composables/api/sys/useFlowNodeApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowNodeApi.js +3 -0
- package/dist/runtime/composables/api/sys/useRoleApi.js +3 -1
- package/dist/runtime/composables/api/sys/useUserApi.js +3 -1
- package/dist/runtime/composables/flow/index.d.ts +3 -0
- package/dist/runtime/composables/flow/index.js +3 -0
- package/dist/runtime/composables/flow/useFlow.d.ts +33 -0
- package/dist/runtime/composables/flow/useFlow.js +401 -0
- package/dist/runtime/composables/flow/useFlowNode.d.ts +17 -0
- package/dist/runtime/composables/flow/useFlowNode.js +106 -0
- package/dist/runtime/composables/flow/useFlowResize.d.ts +21 -0
- package/dist/runtime/composables/flow/useFlowResize.js +84 -0
- package/dist/runtime/composables/flow/useFlowStyles.d.ts +62 -9
- package/dist/runtime/composables/flow/useFlowStyles.js +127 -23
- package/dist/runtime/composables/table/useTableColumnPermission.d.ts +36 -0
- package/dist/runtime/composables/useDate.js +8 -8
- package/dist/runtime/composables/useSidebarMenu.js +0 -2
- package/dist/runtime/composables/useTheme.d.ts +1 -1
- package/dist/runtime/composables/useTheme.js +0 -1
- package/dist/runtime/constants/flow.d.ts +166 -0
- package/dist/runtime/constants/flow.js +171 -0
- package/dist/runtime/constants/index.d.ts +1 -0
- package/dist/runtime/constants/index.js +1 -0
- package/dist/runtime/constants/options.js +2 -3
- package/dist/runtime/constants/table.d.ts +2 -0
- package/dist/runtime/constants/table.js +8 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/types/components/table/column.d.ts +4 -3
- package/dist/runtime/types/components/table/query/where.d.ts +1 -5
- package/dist/runtime/types/models/flow.d.ts +61 -0
- package/dist/runtime/types/models/flow.js +0 -0
- package/dist/runtime/types/models/index.d.ts +1 -0
- package/dist/runtime/types/models/index.js +1 -0
- package/dist/runtime/types/models/table.d.ts +1 -0
- package/dist/runtime/types/storage.d.ts +3 -4
- package/dist/runtime/types/storage.js +3 -4
- package/package.json +3 -2
- package/dist/runtime/components/table/query/where/simple/index.d.vue.ts +0 -21
- package/dist/runtime/components/table/query/where/simple/index.vue +0 -52
- package/dist/runtime/components/table/query/where/simple/index.vue.d.ts +0 -21
|
@@ -4,10 +4,10 @@ type __VLS_Props = {
|
|
|
4
4
|
tableId?: number;
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
-
close: (
|
|
7
|
+
close: (result: false | TablePermission) => any;
|
|
8
8
|
save: (args_0: TablePermission) => any;
|
|
9
9
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
-
onClose?: ((
|
|
10
|
+
onClose?: ((result: false | TablePermission) => any) | undefined;
|
|
11
11
|
onSave?: ((args_0: TablePermission) => any) | undefined;
|
|
12
12
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const _default: typeof __VLS_export;
|
|
@@ -10,23 +10,26 @@ const toast = useToast();
|
|
|
10
10
|
const tablePermissionConfigModal = overlay.create(TablePermissionConfig);
|
|
11
11
|
function openAddModal() {
|
|
12
12
|
tablePermissionConfigModal.open({}).result.then((result) => {
|
|
13
|
-
if (result
|
|
14
|
-
const
|
|
13
|
+
if (result && typeof result === "object") {
|
|
14
|
+
const saved = result;
|
|
15
|
+
const newPermissions = [...props.modelValue, saved];
|
|
15
16
|
emit("update:modelValue", newPermissions);
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
function openEditModal(permission) {
|
|
20
21
|
tablePermissionConfigModal.open({ permission }).result.then((result) => {
|
|
21
|
-
if (result
|
|
22
|
+
if (result && typeof result === "object") {
|
|
23
|
+
const saved = result;
|
|
22
24
|
const newPermissions = props.modelValue.map(
|
|
23
|
-
(p) => p.tableId ===
|
|
25
|
+
(p) => p.tableId === saved.tableId ? saved : p
|
|
24
26
|
);
|
|
25
27
|
emit("update:modelValue", newPermissions);
|
|
26
28
|
}
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
function removePermission(tableId) {
|
|
32
|
+
if (tableId === void 0) return;
|
|
30
33
|
toast.add({
|
|
31
34
|
title: "\u786E\u8BA4\u5220\u9664",
|
|
32
35
|
description: "\u786E\u5B9A\u8981\u5220\u9664\u8BE5 Table \u6743\u9650\u5417\uFF1F",
|
|
@@ -7,15 +7,15 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
7
7
|
orderOptions: OrderQueryOption<T>[];
|
|
8
8
|
unselectedFields: string[];
|
|
9
9
|
} & {
|
|
10
|
-
onRemove?: (() => any) | undefined;
|
|
11
10
|
onChange?: ((args_0: string, args_1: OrderQueryOpr) => any) | undefined;
|
|
11
|
+
onRemove?: (() => any) | undefined;
|
|
12
12
|
}> & (typeof globalThis extends {
|
|
13
13
|
__VLS_PROPS_FALLBACK: infer P;
|
|
14
14
|
} ? P : {});
|
|
15
15
|
expose: (exposed: {}) => void;
|
|
16
16
|
attrs: any;
|
|
17
17
|
slots: {};
|
|
18
|
-
emit: ((evt: "
|
|
18
|
+
emit: ((evt: "change", args_0: string, args_1: OrderQueryOpr) => void) & ((evt: "remove") => void);
|
|
19
19
|
}>) => import("vue").VNode & {
|
|
20
20
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
21
21
|
};
|
|
@@ -7,15 +7,15 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
7
7
|
orderOptions: OrderQueryOption<T>[];
|
|
8
8
|
unselectedFields: string[];
|
|
9
9
|
} & {
|
|
10
|
-
onRemove?: (() => any) | undefined;
|
|
11
10
|
onChange?: ((args_0: string, args_1: OrderQueryOpr) => any) | undefined;
|
|
11
|
+
onRemove?: (() => any) | undefined;
|
|
12
12
|
}> & (typeof globalThis extends {
|
|
13
13
|
__VLS_PROPS_FALLBACK: infer P;
|
|
14
14
|
} ? P : {});
|
|
15
15
|
expose: (exposed: {}) => void;
|
|
16
16
|
attrs: any;
|
|
17
17
|
slots: {};
|
|
18
|
-
emit: ((evt: "
|
|
18
|
+
emit: ((evt: "change", args_0: string, args_1: OrderQueryOpr) => void) & ((evt: "remove") => void);
|
|
19
19
|
}>) => import("vue").VNode & {
|
|
20
20
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
21
21
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, computed } from "vue";
|
|
3
3
|
import ButtonDropdown from "#v/components/button/Dropdown.vue";
|
|
4
|
+
import { tableWhereQueryItemIconMap } from "#v/constants";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
options: { type: Array, required: true },
|
|
6
7
|
unselectedFields: { type: Array, required: true },
|
|
@@ -19,6 +20,7 @@ const unselectedOptions = computed(() => {
|
|
|
19
20
|
const column = props.bizColumns.find((column2) => column2["accessorKey"] === field);
|
|
20
21
|
return {
|
|
21
22
|
label: column?.header || option?.label || field,
|
|
23
|
+
icon: tableWhereQueryItemIconMap.get(option?.type ?? "unknown") || "field",
|
|
22
24
|
onSelect: () => {
|
|
23
25
|
emit("new", field);
|
|
24
26
|
popoverOpen.value = false;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, ref, nextTick } from "vue";
|
|
3
3
|
import { useTableOpr } from "#v/composables/table/useTableOpr";
|
|
4
4
|
import { useToast } from "@nuxt/ui/composables";
|
|
5
|
-
import
|
|
5
|
+
import TableQueryWhereSimpleItem from "#v/components/table/query/where/simple/item/index.vue";
|
|
6
6
|
import TableQueryWhereNewer from "#v/components/table/query/where/Newer.vue";
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
whereOptions: { type: Array, required: true },
|
|
@@ -23,7 +23,19 @@ const selectedWhereFields = computed(() => {
|
|
|
23
23
|
const unselectedWhereFields = computed(() => {
|
|
24
24
|
return props.whereOptions.map((option) => option.field).filter((field) => !selectedWhereFields.value.includes(field));
|
|
25
25
|
});
|
|
26
|
-
const
|
|
26
|
+
const itemRefMap = ref(/* @__PURE__ */ new Map());
|
|
27
|
+
function setItemRef(field, el) {
|
|
28
|
+
if (el && "focus" in el && typeof el.focus === "function") {
|
|
29
|
+
itemRefMap.value.set(field, el);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const onRemoveFilter = (field) => {
|
|
33
|
+
const updatedItems = props.whereQuery?.items?.filter((query) => query.field !== field) ?? [];
|
|
34
|
+
props.onUpdateWhereQuery({
|
|
35
|
+
...props.whereQuery,
|
|
36
|
+
items: updatedItems
|
|
37
|
+
});
|
|
38
|
+
};
|
|
27
39
|
const onNewField = (field) => {
|
|
28
40
|
const option = props.whereOptions.find((option2) => option2.field === field);
|
|
29
41
|
if (!option || !option.type) {
|
|
@@ -44,7 +56,10 @@ const onNewField = (field) => {
|
|
|
44
56
|
}]
|
|
45
57
|
});
|
|
46
58
|
nextTick(() => {
|
|
47
|
-
|
|
59
|
+
const item = itemRefMap.value.get(field);
|
|
60
|
+
if (item) {
|
|
61
|
+
item.focus();
|
|
62
|
+
}
|
|
48
63
|
});
|
|
49
64
|
};
|
|
50
65
|
const isWhereQueryEmpty = computed(() => {
|
|
@@ -52,7 +67,12 @@ const isWhereQueryEmpty = computed(() => {
|
|
|
52
67
|
(props.whereQuery?.items?.filter((query) => props.whereOptions.find((option) => option.field === query.field)).length ?? 0) === 0 && (props.whereQuery?.groups?.length ?? 0) === 0;
|
|
53
68
|
});
|
|
54
69
|
const focusField = (field) => {
|
|
55
|
-
|
|
70
|
+
const item = itemRefMap.value.get(field);
|
|
71
|
+
if (item) {
|
|
72
|
+
item.focus();
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
56
76
|
};
|
|
57
77
|
defineExpose({ focusField });
|
|
58
78
|
</script>
|
|
@@ -61,16 +81,27 @@ defineExpose({ focusField });
|
|
|
61
81
|
<div class="flex items-start gap-2 pl-4 pr-2.5 py-2.5">
|
|
62
82
|
<!-- conditions -->
|
|
63
83
|
<div class="flex flex-wrap items-center gap-2.5">
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
<!-- key如果是field,那么field修改后,不能聚焦后面的组件,所以这里的key用idx代替 -->
|
|
85
|
+
<template v-if="!isWhereQueryEmpty">
|
|
86
|
+
<TableQueryWhereSimpleItem
|
|
87
|
+
v-for="(item, idx) in whereQuery?.items"
|
|
88
|
+
:ref="(el) => setItemRef(item.field, el)"
|
|
89
|
+
:key="idx"
|
|
90
|
+
:where-query-item="item"
|
|
91
|
+
:options="whereOptions"
|
|
92
|
+
:fetching="fetching"
|
|
93
|
+
:trigger-fetching="() => triggerFetching(true)"
|
|
94
|
+
@remove="onRemoveFilter"
|
|
95
|
+
@update:where-query-item="(newWhereQueryItem) => {
|
|
96
|
+
const updatedItems = [...props.whereQuery?.items ?? []];
|
|
97
|
+
updatedItems[idx] = newWhereQueryItem;
|
|
98
|
+
onUpdateWhereQuery({
|
|
99
|
+
...whereQuery,
|
|
100
|
+
items: updatedItems
|
|
101
|
+
});
|
|
102
|
+
}"
|
|
103
|
+
/>
|
|
104
|
+
</template>
|
|
74
105
|
<TableQueryWhereNewer
|
|
75
106
|
:options="whereOptions"
|
|
76
107
|
:unselected-fields="unselectedWhereFields"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, nextTick } from "vue";
|
|
3
3
|
import { useTableOpr } from "#v/composables/table/useTableOpr";
|
|
4
4
|
import ButtonDropdown from "#v/components/button/Dropdown.vue";
|
|
5
|
+
import { tableWhereQueryItemIconMap } from "#v/constants";
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
options: { type: Array, required: true },
|
|
7
8
|
disabled: { type: Boolean, required: false },
|
|
@@ -16,6 +17,7 @@ const items = computed(() => {
|
|
|
16
17
|
items: props.options.map((option) => ({
|
|
17
18
|
label: option.label,
|
|
18
19
|
value: option.field,
|
|
20
|
+
icon: tableWhereQueryItemIconMap.get(option.type) || "field",
|
|
19
21
|
onSelect: () => {
|
|
20
22
|
modelValue.value = option.field;
|
|
21
23
|
nextTick(() => {
|
|
@@ -43,9 +45,8 @@ const modelValue = computed({
|
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
});
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
return option?.label || "";
|
|
48
|
+
const currentOption = computed(() => {
|
|
49
|
+
return props.options.find((opt) => opt.field === modelValue.value);
|
|
49
50
|
});
|
|
50
51
|
</script>
|
|
51
52
|
|
|
@@ -58,8 +59,12 @@ const currentLabel = computed(() => {
|
|
|
58
59
|
:size="'sm'"
|
|
59
60
|
:color="'neutral'"
|
|
60
61
|
:variant="'outline'"
|
|
61
|
-
:label="
|
|
62
|
+
:label="currentOption?.label || '\u9009\u62E9\u5B57\u6BB5'"
|
|
62
63
|
:disabled="disabled"
|
|
64
|
+
:icon="tableWhereQueryItemIconMap.get(currentOption?.type ?? 'unknown') || 'field'"
|
|
65
|
+
:ui="{
|
|
66
|
+
label: 'font-bold'
|
|
67
|
+
}"
|
|
63
68
|
/>
|
|
64
69
|
</ButtonDropdown>
|
|
65
70
|
</template>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, computed, useTemplateRef } from "vue";
|
|
2
|
+
import { ref, computed, useTemplateRef, watch } from "vue";
|
|
3
3
|
import { useDebounceFn } from "@vueuse/core";
|
|
4
4
|
import { defu } from "defu";
|
|
5
5
|
import { useFetching } from "#v/composables/useBoolean";
|
|
6
6
|
import { isEmptyString } from "#v/utils";
|
|
7
|
-
import ButtonDropdown from "#v/components/button/Dropdown.vue";
|
|
8
7
|
const props = defineProps({
|
|
9
8
|
label: { type: String, required: true },
|
|
10
9
|
disabled: { type: Boolean, required: false },
|
|
@@ -57,7 +56,7 @@ const items = computed(() => {
|
|
|
57
56
|
value: p[props.valueField]
|
|
58
57
|
})).filter((p) => p.label && !isEmptyString(String(p.value)));
|
|
59
58
|
});
|
|
60
|
-
const
|
|
59
|
+
const inputMenuValue = computed({
|
|
61
60
|
get() {
|
|
62
61
|
return whereQueryItem.value.value;
|
|
63
62
|
},
|
|
@@ -80,26 +79,16 @@ const commandPaletteValue = computed({
|
|
|
80
79
|
};
|
|
81
80
|
}
|
|
82
81
|
});
|
|
83
|
-
const
|
|
84
|
-
const options = [
|
|
85
|
-
{
|
|
86
|
-
id: "fields",
|
|
87
|
-
items: items.value,
|
|
88
|
-
ignoreFilter: true
|
|
89
|
-
}
|
|
90
|
-
];
|
|
91
|
-
return options;
|
|
92
|
-
});
|
|
93
|
-
const onFetchItems = async (searchTerm) => {
|
|
82
|
+
const onFetchItems = async (searchTerm2) => {
|
|
94
83
|
try {
|
|
95
84
|
startFetching();
|
|
96
85
|
const query = {
|
|
97
86
|
pagination: { pageNum: 1, pageSize: 10 },
|
|
98
87
|
whereQuery: { items: [] }
|
|
99
88
|
};
|
|
100
|
-
if (!isEmptyString(
|
|
89
|
+
if (!isEmptyString(searchTerm2)) {
|
|
101
90
|
props.searchFields.forEach((field) => {
|
|
102
|
-
query.whereQuery?.items?.push({ field, opr: "like", value:
|
|
91
|
+
query.whereQuery?.items?.push({ field, opr: "like", value: searchTerm2, andOr: "or" });
|
|
103
92
|
});
|
|
104
93
|
}
|
|
105
94
|
const result = await props.listApi(defu(query, props.extraQuery));
|
|
@@ -110,45 +99,53 @@ const onFetchItems = async (searchTerm) => {
|
|
|
110
99
|
endFetching();
|
|
111
100
|
}
|
|
112
101
|
};
|
|
102
|
+
const searchTerm = ref("");
|
|
113
103
|
const onDebounceFetchItems = useDebounceFn(onFetchItems, 512);
|
|
114
|
-
|
|
104
|
+
watch(searchTerm, (newVal) => {
|
|
105
|
+
onDebounceFetchItems(newVal);
|
|
106
|
+
}, { immediate: false });
|
|
107
|
+
const inputMenuRef = useTemplateRef("inputMenu");
|
|
115
108
|
defineExpose({
|
|
116
109
|
focus: () => {
|
|
117
|
-
|
|
110
|
+
inputMenuRef.value?.inputRef.focus();
|
|
118
111
|
}
|
|
119
112
|
});
|
|
120
113
|
</script>
|
|
121
114
|
|
|
122
115
|
<template>
|
|
123
|
-
<
|
|
124
|
-
ref="
|
|
125
|
-
v-model="
|
|
126
|
-
|
|
116
|
+
<UInputMenu
|
|
117
|
+
ref="inputMenu"
|
|
118
|
+
v-model:search-term="searchTerm"
|
|
119
|
+
v-model="inputMenuValue"
|
|
120
|
+
:items="items"
|
|
121
|
+
:placeholder="placeholder"
|
|
127
122
|
multiple
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
123
|
+
color="neutral"
|
|
124
|
+
delete-icon="i-lucide-trash"
|
|
125
|
+
value-key="value"
|
|
126
|
+
clear
|
|
127
|
+
clear-icon="i-lucide-circle-x"
|
|
128
|
+
icon=""
|
|
129
|
+
:loading="fetching"
|
|
130
|
+
:disabled="disabled"
|
|
131
|
+
open-on-focus
|
|
132
|
+
trailing
|
|
133
|
+
:ui="{
|
|
134
|
+
root: 'rounded-none min-w-32',
|
|
135
|
+
// TODO: 不然有rounded,这个应该是个bug
|
|
136
|
+
content: 'min-w-fit',
|
|
137
|
+
tagsInput: 'min-w-4 w-0'
|
|
138
|
+
}"
|
|
139
|
+
:content="{
|
|
140
|
+
align: 'start'
|
|
141
|
+
}"
|
|
142
|
+
@update:open="(opened) => {
|
|
143
|
+
if (opened) {
|
|
144
|
+
onFetchItems(searchTerm);
|
|
145
|
+
}
|
|
146
|
+
}"
|
|
147
|
+
@update:model-value="() => {
|
|
148
|
+
inputMenuRef?.inputRef.focus();
|
|
149
|
+
}"
|
|
150
|
+
/>
|
|
154
151
|
</template>
|