v-nuxt-ui 0.1.35 → 0.1.36
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.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/form/field/DatePicker.vue +1 -1
- package/dist/runtime/components/sys/table/CreateModal.vue +31 -33
- package/dist/runtime/components/sys/table/Table.vue +6 -4
- 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/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/useRoleApi.js +3 -1
- package/dist/runtime/composables/api/sys/useUserApi.js +3 -1
- package/dist/runtime/composables/useDate.js +8 -8
- 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/types/components/table/column.d.ts +4 -3
- package/dist/runtime/types/components/table/query/where.d.ts +1 -5
- package/package.json +1 -1
- 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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, useTemplateRef } from "vue";
|
|
3
|
-
import ButtonDropdown from "#v/components/button/Dropdown.vue";
|
|
2
|
+
import { computed, ref, useTemplateRef } from "vue";
|
|
4
3
|
const props = defineProps({
|
|
5
4
|
disabled: { type: Boolean, required: false },
|
|
6
|
-
items: { type: Array, required: true }
|
|
5
|
+
items: { type: Array, required: true },
|
|
6
|
+
placeholder: { type: String, required: false }
|
|
7
7
|
});
|
|
8
8
|
const whereQueryItem = defineModel("whereQueryItem", { type: Object, ...{ required: true } });
|
|
9
|
-
const
|
|
9
|
+
const inputMenuValue = computed({
|
|
10
10
|
get() {
|
|
11
11
|
return whereQueryItem.value.value;
|
|
12
12
|
},
|
|
@@ -14,49 +14,49 @@ const queryValue = computed({
|
|
|
14
14
|
whereQueryItem.value = { ...whereQueryItem.value, value: newValue };
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ignoreFilter: true
|
|
17
|
+
const searchTerm = ref("");
|
|
18
|
+
const filteredItems = computed(() => {
|
|
19
|
+
if (!searchTerm.value) {
|
|
20
|
+
return props.items;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
return props.items.filter((item) => item?.label.toLowerCase().includes(searchTerm.value.toLowerCase()));
|
|
23
|
+
});
|
|
24
|
+
const inputMenuRef = useTemplateRef("inputMenu");
|
|
25
25
|
defineExpose({
|
|
26
26
|
focus: () => {
|
|
27
|
-
|
|
27
|
+
inputMenuRef.value?.inputRef.focus();
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
<template>
|
|
33
|
-
<
|
|
34
|
-
ref="
|
|
35
|
-
v-model="
|
|
36
|
-
|
|
33
|
+
<UInputMenu
|
|
34
|
+
ref="inputMenu"
|
|
35
|
+
v-model:search-term="searchTerm"
|
|
36
|
+
v-model="inputMenuValue"
|
|
37
|
+
:items="filteredItems"
|
|
38
|
+
:placeholder="placeholder"
|
|
37
39
|
multiple
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</UButton>
|
|
61
|
-
</ButtonDropdown>
|
|
40
|
+
color="neutral"
|
|
41
|
+
delete-icon="i-lucide-trash"
|
|
42
|
+
value-key="value"
|
|
43
|
+
clear
|
|
44
|
+
clear-icon="i-lucide-circle-x"
|
|
45
|
+
icon=""
|
|
46
|
+
:disabled="disabled"
|
|
47
|
+
open-on-focus
|
|
48
|
+
trailing
|
|
49
|
+
:ui="{
|
|
50
|
+
root: 'rounded-none min-w-32',
|
|
51
|
+
// TODO: 不然有rounded,这个应该是个bug
|
|
52
|
+
content: 'min-w-fit',
|
|
53
|
+
tagsInput: 'min-w-4 w-0'
|
|
54
|
+
}"
|
|
55
|
+
:content="{
|
|
56
|
+
align: 'start'
|
|
57
|
+
}"
|
|
58
|
+
@update:model-value="() => {
|
|
59
|
+
inputMenuRef?.inputRef.focus();
|
|
60
|
+
}"
|
|
61
|
+
/>
|
|
62
62
|
</template>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WhereQueryItem } from '#v/types';
|
|
2
|
+
import type { InputMenuItem, InputMenuProps } from '@nuxt/ui';
|
|
2
3
|
declare const __VLS_export: <T>(__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<{
|
|
3
4
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
4
5
|
disabled?: boolean;
|
|
5
|
-
items:
|
|
6
|
+
items: InputMenuItem[];
|
|
7
|
+
placeholder?: InputMenuProps["placeholder"];
|
|
6
8
|
} & {
|
|
7
9
|
whereQueryItem: WhereQueryItem<T>;
|
|
8
10
|
}) & {
|
|
@@ -48,6 +48,7 @@ defineExpose({
|
|
|
48
48
|
v-model:where-query-item="whereQueryItem"
|
|
49
49
|
:disabled="fetching"
|
|
50
50
|
:items="option.items || []"
|
|
51
|
+
:placeholder="option.placeholder"
|
|
51
52
|
/>
|
|
52
53
|
<TableQueryWhereSimpleItemOprDatePicker
|
|
53
54
|
v-else-if="option.type === 'date-picker'"
|
|
@@ -68,5 +69,6 @@ defineExpose({
|
|
|
68
69
|
:label-field="option.labelField"
|
|
69
70
|
:value-field="option.valueField"
|
|
70
71
|
:multiple="option.multiple"
|
|
72
|
+
:placeholder="option.placeholder"
|
|
71
73
|
/>
|
|
72
74
|
</template>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
1
2
|
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
3
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
import { useTableColumnPermission } from "#v/composables/table/useTableColumnPermission";
|
|
3
3
|
import UserTableColumnModal from "./UserTableColumnModal.vue";
|
|
4
4
|
import { ref, h, onMounted } from "vue";
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
5
|
const { tables, fetchTables, fetchMergedColumns, saveUserColumns } = useTableColumnPermission();
|
|
9
6
|
const selectedTable = ref(null);
|
|
10
7
|
const mergedColumns = ref([]);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
1
2
|
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
3
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -7,6 +7,7 @@ export const useRoleApi = createSharedComposable(() => ({
|
|
|
7
7
|
prune: (model) => {
|
|
8
8
|
const cloned = cloneJson(model);
|
|
9
9
|
cloned.menus = useBizModel().extractIds(cloned.menus);
|
|
10
|
+
cloned.tablePermissions = useBizModel().extractIds(cloned.tablePermissions);
|
|
10
11
|
return cloned;
|
|
11
12
|
},
|
|
12
13
|
copy: (model) => ({
|
|
@@ -15,6 +16,7 @@ export const useRoleApi = createSharedComposable(() => ({
|
|
|
15
16
|
permission: model.permission,
|
|
16
17
|
disabled: model.disabled,
|
|
17
18
|
remark: model.remark,
|
|
18
|
-
menus: model.menus
|
|
19
|
+
menus: model.menus,
|
|
20
|
+
tablePermissions: model.tablePermissions
|
|
19
21
|
})
|
|
20
22
|
}));
|
|
@@ -13,6 +13,7 @@ export const useUserApi = createSharedComposable(() => ({
|
|
|
13
13
|
const bizModel = useBizModel();
|
|
14
14
|
cloned.roles = bizModel.extractIds(cloned.roles);
|
|
15
15
|
cloned.menus = bizModel.extractIds(cloned.menus);
|
|
16
|
+
cloned.tablePermissions = bizModel.extractIds(cloned.tablePermissions);
|
|
16
17
|
return cloned;
|
|
17
18
|
},
|
|
18
19
|
copy: (model) => ({
|
|
@@ -28,7 +29,8 @@ export const useUserApi = createSharedComposable(() => ({
|
|
|
28
29
|
entryDate: model.entryDate,
|
|
29
30
|
resignDate: model.resignDate,
|
|
30
31
|
gender: model.gender,
|
|
31
|
-
loginType: model.loginType
|
|
32
|
+
loginType: model.loginType,
|
|
33
|
+
tablePermissions: model.tablePermissions
|
|
32
34
|
}),
|
|
33
35
|
changePwd: (payload, customOptions = {}) => {
|
|
34
36
|
return usePutFetch(`/users/pwd/change`, payload, customOptions);
|
|
@@ -39,7 +39,7 @@ const _useDate = () => {
|
|
|
39
39
|
return `${date.year()}-W${weekNumber}`;
|
|
40
40
|
}
|
|
41
41
|
case "day":
|
|
42
|
-
return date.format("YYYY
|
|
42
|
+
return date.format("YYYY-MM-DD");
|
|
43
43
|
default:
|
|
44
44
|
throw new Error(`Unsupported time unit: ${unit}`);
|
|
45
45
|
}
|
|
@@ -53,8 +53,8 @@ const _useDate = () => {
|
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
const getlastWeekDateRange = () => {
|
|
56
|
-
const end = dayjs().
|
|
57
|
-
const start = end.
|
|
56
|
+
const end = dayjs().endOf("week").subtract(1, "week");
|
|
57
|
+
const start = end.startOf("week");
|
|
58
58
|
return {
|
|
59
59
|
start: dayjsToDateValue(start),
|
|
60
60
|
end: dayjsToDateValue(end)
|
|
@@ -66,7 +66,7 @@ const _useDate = () => {
|
|
|
66
66
|
};
|
|
67
67
|
const getCurrentWeekDateRange = () => {
|
|
68
68
|
const end = dayjs().endOf("week");
|
|
69
|
-
const start = end.
|
|
69
|
+
const start = end.startOf("week");
|
|
70
70
|
return {
|
|
71
71
|
start: dayjsToDateValue(start),
|
|
72
72
|
end: dayjsToDateValue(end)
|
|
@@ -78,7 +78,7 @@ const _useDate = () => {
|
|
|
78
78
|
};
|
|
79
79
|
const getLastMonthDateRange = () => {
|
|
80
80
|
const end = dayjs().subtract(1, "month").endOf("month");
|
|
81
|
-
const start = end.
|
|
81
|
+
const start = end.startOf("month");
|
|
82
82
|
return {
|
|
83
83
|
start: dayjsToDateValue(start),
|
|
84
84
|
end: dayjsToDateValue(end)
|
|
@@ -90,7 +90,7 @@ const _useDate = () => {
|
|
|
90
90
|
};
|
|
91
91
|
const getCurrentMonthDateRange = () => {
|
|
92
92
|
const end = dayjs().endOf("month");
|
|
93
|
-
const start = end.
|
|
93
|
+
const start = end.startOf("month");
|
|
94
94
|
return {
|
|
95
95
|
start: dayjsToDateValue(start),
|
|
96
96
|
end: dayjsToDateValue(end)
|
|
@@ -102,7 +102,7 @@ const _useDate = () => {
|
|
|
102
102
|
};
|
|
103
103
|
const getlastYearDateRange = () => {
|
|
104
104
|
const end = dayjs().subtract(1, "year").endOf("year");
|
|
105
|
-
const start = end.
|
|
105
|
+
const start = end.startOf("year");
|
|
106
106
|
return {
|
|
107
107
|
start: dayjsToDateValue(start),
|
|
108
108
|
end: dayjsToDateValue(end)
|
|
@@ -114,7 +114,7 @@ const _useDate = () => {
|
|
|
114
114
|
};
|
|
115
115
|
const getCurrentYearDateRange = () => {
|
|
116
116
|
const end = dayjs().endOf("year");
|
|
117
|
-
const start = end.
|
|
117
|
+
const start = end.startOf("year");
|
|
118
118
|
return {
|
|
119
119
|
start: dayjsToDateValue(start),
|
|
120
120
|
end: dayjsToDateValue(end)
|
|
@@ -9,7 +9,6 @@ export var Gender = /* @__PURE__ */ ((Gender2) => {
|
|
|
9
9
|
return Gender2;
|
|
10
10
|
})(Gender || {});
|
|
11
11
|
export const genderOptions = [
|
|
12
|
-
{ label: "
|
|
13
|
-
{ label: "
|
|
14
|
-
{ label: "Unknown", value: 0 /* UNKNOWN */ }
|
|
12
|
+
{ label: "\u7537", value: 1 /* MALE */ },
|
|
13
|
+
{ label: "\u5973", value: 2 /* FEMALE */ }
|
|
15
14
|
];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const tableWhereQueryItemIconMap = /* @__PURE__ */ new Map([
|
|
2
|
+
["async-select", "i-lucide-list-check"],
|
|
3
|
+
["date-picker", "i-lucide-calendar-cog"],
|
|
4
|
+
["input", "i-lucide-text-cursor-input"],
|
|
5
|
+
["input-number", "i-lucide-text-cursor-input"],
|
|
6
|
+
["select", "i-lucide-list-check"],
|
|
7
|
+
["unknown", "i-lucide-circle-question-mark"]
|
|
8
|
+
]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OrderQueryOpr, WhereQueryOpr, QueryTemplate, WhereQueryItem } from '../../query.js';
|
|
2
2
|
import type { PageResult, RequestResult } from '../../request.js';
|
|
3
|
-
import type { TableColumn, BadgeProps,
|
|
3
|
+
import type { TableColumn, BadgeProps, InputMenuProps } from '@nuxt/ui';
|
|
4
4
|
import type { SelectOption } from '../../index.js';
|
|
5
5
|
import type { Ref } from 'vue';
|
|
6
6
|
export type WhereQueryType = 'input' | 'input-number' | 'date-picker' | 'select' | 'async-select' | 'unknown';
|
|
@@ -23,8 +23,8 @@ export type WhereQueryColumnAsyncSelectProps<T> = {
|
|
|
23
23
|
enableEmptyOption?: boolean;
|
|
24
24
|
disableOprSelector?: boolean;
|
|
25
25
|
multiple?: boolean;
|
|
26
|
-
placeholder?:
|
|
27
|
-
size?:
|
|
26
|
+
placeholder?: InputMenuProps['placeholder'];
|
|
27
|
+
size?: InputMenuProps['size'];
|
|
28
28
|
};
|
|
29
29
|
export type WhereQueryColumnOption<T> = {
|
|
30
30
|
defaultOpr?: WhereQueryOpr;
|
|
@@ -43,6 +43,7 @@ export type WhereQueryColumnOption<T> = {
|
|
|
43
43
|
variant?: BadgeProps['variant'];
|
|
44
44
|
items: SelectOption[];
|
|
45
45
|
empty?: BadgeProps;
|
|
46
|
+
placeholder?: InputMenuProps['placeholder'];
|
|
46
47
|
} | {
|
|
47
48
|
type: 'async-select';
|
|
48
49
|
} & WhereQueryColumnAsyncSelectProps<T> | {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VColumn, WhereQuery, WhereQueryColumnOption,
|
|
1
|
+
import type { VColumn, WhereQuery, WhereQueryColumnOption, WhereQueryItemGroup } from '../../../index.js';
|
|
2
2
|
export type WhereQueryOption<T> = {
|
|
3
3
|
field: string & keyof T | string;
|
|
4
4
|
label: string;
|
|
@@ -16,10 +16,6 @@ export type WhereQueryProps<T> = {
|
|
|
16
16
|
bizColumns?: VColumn<T>[];
|
|
17
17
|
hideQueryButton?: boolean;
|
|
18
18
|
};
|
|
19
|
-
export type WhereSimpleQueryProps<T> = {
|
|
20
|
-
items?: WhereQueryItem<T>[];
|
|
21
|
-
onUpdateItems: (items: WhereQueryItem<T>[] | undefined) => void;
|
|
22
|
-
} & Pick<WhereQueryProps<T>, 'whereOptions' | 'fetching' | 'triggerFetching' | 'bizColumns'>;
|
|
23
19
|
export type WhereAdvancedQueryProps<T> = {
|
|
24
20
|
group?: WhereQueryItemGroup<T>;
|
|
25
21
|
onUpdateGroup?: (items: WhereQueryItemGroup<T>) => void;
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { WhereSimpleQueryProps } from '#v/types';
|
|
2
|
-
declare const __VLS_export: <T>(__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<{
|
|
3
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<WhereSimpleQueryProps<T>> & (typeof globalThis extends {
|
|
4
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
5
|
-
} ? P : {});
|
|
6
|
-
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
7
|
-
focusItem: (field: string) => boolean;
|
|
8
|
-
}>) => void;
|
|
9
|
-
attrs: any;
|
|
10
|
-
slots: {};
|
|
11
|
-
emit: {};
|
|
12
|
-
}>) => import("vue").VNode & {
|
|
13
|
-
__ctx?: Awaited<typeof __VLS_setup>;
|
|
14
|
-
};
|
|
15
|
-
declare const _default: typeof __VLS_export;
|
|
16
|
-
export default _default;
|
|
17
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
18
|
-
[K in keyof T]: T[K];
|
|
19
|
-
} : {
|
|
20
|
-
[K in keyof T as K]: T[K];
|
|
21
|
-
}) & {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref } from "vue";
|
|
3
|
-
import TableQueryWhereSimpleItem from "#v/components/table/query/where/simple/item/index.vue";
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
items: { type: Array, required: false },
|
|
6
|
-
onUpdateItems: { type: Function, required: true },
|
|
7
|
-
whereOptions: { type: Array, required: true },
|
|
8
|
-
fetching: { type: Boolean, required: false },
|
|
9
|
-
triggerFetching: { type: Function, required: true },
|
|
10
|
-
bizColumns: { type: Array, required: false }
|
|
11
|
-
});
|
|
12
|
-
const onRemoveFilter = (field) => {
|
|
13
|
-
props.onUpdateItems(props.items?.filter((query) => query.field !== field) ?? []);
|
|
14
|
-
};
|
|
15
|
-
const itemRefMap = ref(/* @__PURE__ */ new Map());
|
|
16
|
-
function setItemRef(field, el) {
|
|
17
|
-
if (el && "focus" in el && typeof el.focus === "function") {
|
|
18
|
-
itemRefMap.value.set(field, el);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
defineExpose({
|
|
22
|
-
focusItem: (field) => {
|
|
23
|
-
const item = itemRefMap.value.get(field);
|
|
24
|
-
if (item) {
|
|
25
|
-
item.focus();
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<template>
|
|
34
|
-
<div class="flex flex-wrap gap-2.5">
|
|
35
|
-
<!-- key如果是field,那么field修改后,不能聚焦后面的组件,所以这里的key用idx代替 -->
|
|
36
|
-
<TableQueryWhereSimpleItem
|
|
37
|
-
v-for="(item, idx) in items"
|
|
38
|
-
:ref="(el) => setItemRef(item.field, el)"
|
|
39
|
-
:key="idx"
|
|
40
|
-
:where-query-item="item"
|
|
41
|
-
:options="whereOptions"
|
|
42
|
-
:fetching="fetching"
|
|
43
|
-
:trigger-fetching="() => triggerFetching(true)"
|
|
44
|
-
@remove="onRemoveFilter"
|
|
45
|
-
@update:where-query-item="(newWhereQueryItem) => {
|
|
46
|
-
const updatedItems = [...props.items ?? []];
|
|
47
|
-
updatedItems[idx] = newWhereQueryItem;
|
|
48
|
-
props.onUpdateItems(updatedItems);
|
|
49
|
-
}"
|
|
50
|
-
/>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { WhereSimpleQueryProps } from '#v/types';
|
|
2
|
-
declare const __VLS_export: <T>(__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<{
|
|
3
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<WhereSimpleQueryProps<T>> & (typeof globalThis extends {
|
|
4
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
5
|
-
} ? P : {});
|
|
6
|
-
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
7
|
-
focusItem: (field: string) => boolean;
|
|
8
|
-
}>) => void;
|
|
9
|
-
attrs: any;
|
|
10
|
-
slots: {};
|
|
11
|
-
emit: {};
|
|
12
|
-
}>) => import("vue").VNode & {
|
|
13
|
-
__ctx?: Awaited<typeof __VLS_setup>;
|
|
14
|
-
};
|
|
15
|
-
declare const _default: typeof __VLS_export;
|
|
16
|
-
export default _default;
|
|
17
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
18
|
-
[K in keyof T]: T[K];
|
|
19
|
-
} : {
|
|
20
|
-
[K in keyof T as K]: T[K];
|
|
21
|
-
}) & {};
|