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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, useTemplateRef, nextTick, ref } from "vue";
|
|
3
|
-
import { now
|
|
3
|
+
import { now } from "@internationalized/date";
|
|
4
4
|
import dayjs from "dayjs";
|
|
5
5
|
import { useDate } from "#v/composables/useDate";
|
|
6
6
|
import { useApp } from "#v/composables/useApp";
|
|
7
|
-
import {
|
|
7
|
+
import { TIME_ZONE } from "#v/constants";
|
|
8
8
|
import DatePickerInput from "#v/components/date-picker/Input.vue";
|
|
9
9
|
defineProps({
|
|
10
10
|
disabled: { type: Boolean, required: false }
|
|
@@ -55,177 +55,183 @@ const calendarValue = computed({
|
|
|
55
55
|
whereQueryItem.value = { ...whereQueryItem.value, value: updatedValue };
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
const
|
|
59
|
-
|
|
58
|
+
const displayDateFormat = "YYYY-MM-DD";
|
|
59
|
+
const startDateStrValueInput = useTemplateRef("startDateStrValueInput");
|
|
60
|
+
const endDateStrValueInput = useTemplateRef("endDateStrValueInput");
|
|
61
|
+
const startDateStrValue = computed({
|
|
62
|
+
get() {
|
|
63
|
+
return useDate().dateValueToDayjs(calendarValue.value?.start)?.format(displayDateFormat) ?? void 0;
|
|
64
|
+
},
|
|
60
65
|
set(newValue) {
|
|
61
66
|
if (!newValue) {
|
|
62
|
-
|
|
67
|
+
calendarValue.value = { ...calendarValue.value, start: void 0 };
|
|
63
68
|
return;
|
|
64
69
|
}
|
|
65
|
-
const formattedDayjs = dayjs(newValue,
|
|
70
|
+
const formattedDayjs = dayjs(newValue, displayDateFormat, true);
|
|
66
71
|
if (formattedDayjs.isValid()) {
|
|
67
|
-
|
|
72
|
+
calendarValue.value = {
|
|
73
|
+
...calendarValue.value,
|
|
74
|
+
start: useDate().dayjsToDateValue(formattedDayjs)
|
|
75
|
+
};
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
78
|
});
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
const endDateStrValue = computed({
|
|
80
|
+
get() {
|
|
81
|
+
return useDate().dateValueToDayjs(calendarValue.value?.end)?.format(displayDateFormat) ?? void 0;
|
|
82
|
+
},
|
|
83
|
+
set(newValue) {
|
|
84
|
+
if (!newValue) {
|
|
85
|
+
calendarValue.value = { ...calendarValue.value, end: void 0 };
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const formattedDayjs = dayjs(newValue, displayDateFormat, true);
|
|
89
|
+
if (formattedDayjs.isValid()) {
|
|
90
|
+
calendarValue.value = {
|
|
91
|
+
...calendarValue.value,
|
|
92
|
+
end: useDate().dayjsToDateValue(formattedDayjs)
|
|
93
|
+
};
|
|
94
|
+
}
|
|
82
95
|
}
|
|
83
|
-
);
|
|
96
|
+
});
|
|
84
97
|
const singleDateStrValueInput = useTemplateRef("singleDateStrValueInput");
|
|
85
|
-
const singleDateStrValue =
|
|
86
|
-
()
|
|
87
|
-
|
|
88
|
-
|
|
98
|
+
const singleDateStrValue = computed({
|
|
99
|
+
get() {
|
|
100
|
+
return useDate().dateValueToDayjs(calendarValue.value)?.format(displayDateFormat) || void 0;
|
|
101
|
+
},
|
|
102
|
+
set(newValue) {
|
|
103
|
+
if (!newValue) {
|
|
104
|
+
calendarValue.value = null;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const formattedDayjs = dayjs(newValue, displayDateFormat, true);
|
|
108
|
+
if (formattedDayjs.isValid()) {
|
|
109
|
+
calendarValue.value = useDate().dayjsToDateValue(formattedDayjs);
|
|
110
|
+
}
|
|
89
111
|
}
|
|
90
|
-
);
|
|
91
|
-
const
|
|
112
|
+
});
|
|
113
|
+
const popoverOpen = ref(false);
|
|
114
|
+
const onOpenCalendar = () => {
|
|
115
|
+
popoverOpen.value = true;
|
|
116
|
+
};
|
|
117
|
+
const onCloseCalendar = () => {
|
|
118
|
+
popoverOpen.value = false;
|
|
119
|
+
};
|
|
120
|
+
const focusStartInput = () => {
|
|
92
121
|
nextTick(() => {
|
|
93
|
-
|
|
94
|
-
|
|
122
|
+
if (isRangeOpr.value) {
|
|
123
|
+
startDateStrValueInput.value?.focus();
|
|
124
|
+
} else {
|
|
125
|
+
singleDateStrValueInput.value?.focus();
|
|
126
|
+
}
|
|
95
127
|
});
|
|
96
128
|
};
|
|
97
|
-
const popoverOpen = ref(false);
|
|
98
129
|
defineExpose({
|
|
99
130
|
focus: () => {
|
|
100
|
-
|
|
101
|
-
dateStrInputFocus();
|
|
131
|
+
focusStartInput();
|
|
102
132
|
}
|
|
103
133
|
});
|
|
134
|
+
const date = useDate();
|
|
104
135
|
const dateRangeShortcuts = [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
start: startOfWeek(today, "zh-CN", "mon"),
|
|
111
|
-
end: endOfWeek(today, "zh-CN", "mon")
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
label: "\u672C\u6708",
|
|
117
|
-
dateFn: () => {
|
|
118
|
-
const today = now(TIME_ZONE);
|
|
119
|
-
return {
|
|
120
|
-
start: startOfMonth(today),
|
|
121
|
-
end: endOfMonth(today)
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
label: "\u4E0A\u5468",
|
|
127
|
-
dateFn: () => {
|
|
128
|
-
const today = now(TIME_ZONE);
|
|
129
|
-
const lastWeek = today.subtract({ weeks: 1 });
|
|
130
|
-
return {
|
|
131
|
-
start: startOfWeek(lastWeek, "zh-CN", "mon"),
|
|
132
|
-
end: endOfWeek(lastWeek, "zh-CN", "mon")
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
label: "\u4E0A\u6708",
|
|
138
|
-
dateFn: () => {
|
|
139
|
-
const today = now(TIME_ZONE);
|
|
140
|
-
const lastMonth = today.subtract({ months: 1 });
|
|
141
|
-
return {
|
|
142
|
-
start: startOfMonth(lastMonth),
|
|
143
|
-
end: endOfMonth(lastMonth)
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
136
|
+
date.lastWeekDateShortcut,
|
|
137
|
+
date.lastMonthDateShortcut,
|
|
138
|
+
date.currentWeekDateShortcut,
|
|
139
|
+
date.currentMonthDateShortcut
|
|
147
140
|
];
|
|
148
|
-
const isValueEmpty = computed(() => {
|
|
149
|
-
if (isNoCalendarOpr.value) return false;
|
|
150
|
-
const value = whereQueryItem.value.value;
|
|
151
|
-
if (isRangeOpr.value) {
|
|
152
|
-
return value === null || value?.start === null && value?.end === null;
|
|
153
|
-
}
|
|
154
|
-
return value === null || value === "";
|
|
155
|
-
});
|
|
156
|
-
const displayValue = computed(() => {
|
|
157
|
-
if (isValueEmpty.value) return "";
|
|
158
|
-
if (isRangeOpr.value) {
|
|
159
|
-
const range = calendarValue.value;
|
|
160
|
-
const start = useDate().dateValueToDayjs(range?.start)?.format(dateFormat) || "";
|
|
161
|
-
const end = useDate().dateValueToDayjs(range?.end)?.format(dateFormat) || "";
|
|
162
|
-
return `${start} ~ ${end}`;
|
|
163
|
-
}
|
|
164
|
-
return useDate().dateValueToDayjs(calendarValue.value)?.format(dateFormat) || "";
|
|
165
|
-
});
|
|
166
141
|
</script>
|
|
167
142
|
|
|
168
143
|
<template>
|
|
169
144
|
<UPopover
|
|
170
145
|
v-model:open="popoverOpen"
|
|
146
|
+
:dismissible="false"
|
|
171
147
|
:content="{
|
|
172
148
|
align: 'start',
|
|
173
|
-
onCloseAutoFocus: (e) => e.preventDefault()
|
|
149
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
150
|
+
onOpenAutoFocus: (e) => e.preventDefault()
|
|
174
151
|
}"
|
|
175
152
|
>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
</UButton>
|
|
153
|
+
<!-- 输入框直接暴露 -->
|
|
154
|
+
<template v-if="isNoCalendarOpr" />
|
|
179
155
|
|
|
180
|
-
<template
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
156
|
+
<template v-else-if="isRangeOpr">
|
|
157
|
+
<!-- 必须加这个div,不然第一个输入框无法正确渲染 -->
|
|
158
|
+
<div />
|
|
159
|
+
<DatePickerInput
|
|
160
|
+
ref="startDateStrValueInput"
|
|
161
|
+
v-model:value="startDateStrValue"
|
|
162
|
+
icon=""
|
|
163
|
+
input-class="w-32"
|
|
164
|
+
placeholder="YYYY-MM-DD"
|
|
165
|
+
@focus="onOpenCalendar"
|
|
166
|
+
@blur="onCloseCalendar"
|
|
167
|
+
/>
|
|
168
|
+
<UBadge variant="outline" color="neutral">
|
|
169
|
+
~
|
|
170
|
+
</UBadge>
|
|
171
|
+
<DatePickerInput
|
|
172
|
+
ref="endDateStrValueInput"
|
|
173
|
+
v-model:value="endDateStrValue"
|
|
174
|
+
icon=""
|
|
175
|
+
input-class="w-32"
|
|
176
|
+
placeholder="YYYY-MM-DD"
|
|
177
|
+
@focus="onOpenCalendar"
|
|
178
|
+
@blur="onCloseCalendar"
|
|
179
|
+
/>
|
|
180
|
+
</template>
|
|
196
181
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
182
|
+
<template v-else>
|
|
183
|
+
<div />
|
|
184
|
+
<DatePickerInput
|
|
185
|
+
ref="singleDateStrValueInput"
|
|
186
|
+
v-model:value="singleDateStrValue"
|
|
187
|
+
icon=""
|
|
188
|
+
input-class="w-32"
|
|
189
|
+
placeholder="YYYY-MM-DD"
|
|
190
|
+
@focus="onOpenCalendar"
|
|
191
|
+
@blur="onCloseCalendar"
|
|
192
|
+
/>
|
|
193
|
+
</template>
|
|
204
194
|
|
|
195
|
+
<template #content>
|
|
196
|
+
<div
|
|
197
|
+
class="p-3 flex flex-col gap-2"
|
|
198
|
+
@mousedown.prevent
|
|
199
|
+
>
|
|
205
200
|
<UCalendar
|
|
206
201
|
v-if="!isNoCalendarOpr"
|
|
207
202
|
:model-value="calendarValue"
|
|
208
203
|
:range="isRangeOpr"
|
|
209
204
|
size="sm"
|
|
205
|
+
variant="subtle"
|
|
210
206
|
:disabled="disabled"
|
|
211
207
|
:number-of-months="app.isMobile.value || !isRangeOpr ? 1 : 2"
|
|
212
208
|
@update:model-value="(newValue) => calendarValue = newValue ?? null"
|
|
213
209
|
/>
|
|
214
210
|
|
|
215
|
-
<
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
211
|
+
<UFieldGroup class="ml-auto">
|
|
212
|
+
<UButton
|
|
213
|
+
v-for="shortcut in isRangeOpr ? dateRangeShortcuts : []"
|
|
214
|
+
:key="shortcut.label"
|
|
215
|
+
:label="shortcut.label"
|
|
216
|
+
size="xs"
|
|
217
|
+
color="neutral"
|
|
218
|
+
variant="outline"
|
|
219
|
+
:disabled="disabled"
|
|
220
|
+
:tabindex="-1"
|
|
221
|
+
@click="calendarValue = shortcut.dateFn()"
|
|
222
|
+
/>
|
|
223
|
+
<UButton
|
|
224
|
+
v-if="!isRangeOpr"
|
|
225
|
+
label="今天"
|
|
226
|
+
size="xs"
|
|
227
|
+
color="neutral"
|
|
228
|
+
variant="outline"
|
|
229
|
+
:tabindex="-1"
|
|
230
|
+
@click="() => {
|
|
231
|
+
calendarValue = now(TIME_ZONE);
|
|
232
|
+
}"
|
|
233
|
+
/>
|
|
234
|
+
</UFieldGroup>
|
|
229
235
|
</div>
|
|
230
236
|
</template>
|
|
231
237
|
</UPopover>
|
|
@@ -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
|
}) & {
|
|
@@ -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>;
|
|
@@ -12,3 +12,6 @@ export * from './useUserApi.js';
|
|
|
12
12
|
export * from '../useTableApi.js';
|
|
13
13
|
export * from '../useTableColumnApi.js';
|
|
14
14
|
export * from '../useTablePermissionApi.js';
|
|
15
|
+
export * from './useFlowApi.js';
|
|
16
|
+
export * from './useFlowNodeApi.js';
|
|
17
|
+
export * from './useFlowEdgeApi.js';
|
|
@@ -12,3 +12,6 @@ export * from "./useUserApi.js";
|
|
|
12
12
|
export * from "../useTableApi.js";
|
|
13
13
|
export * from "../useTableColumnApi.js";
|
|
14
14
|
export * from "../useTablePermissionApi.js";
|
|
15
|
+
export * from "./useFlowApi.js";
|
|
16
|
+
export * from "./useFlowNodeApi.js";
|
|
17
|
+
export * from "./useFlowEdgeApi.js";
|
|
@@ -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);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Node, Edge, Connection } from '@vue-flow/core';
|
|
2
|
+
import type { ComputedRef, ShallowRef, Ref } from 'vue';
|
|
3
|
+
import type { Flow, FlowNode, FlowApi, UseFlowResizeDimensions } from '#v/types';
|
|
4
|
+
export interface UseFlowOptions {
|
|
5
|
+
flow: ComputedRef<Flow | undefined>;
|
|
6
|
+
onUpdateModel?: ComputedRef<((model: Flow) => void) | undefined>;
|
|
7
|
+
/** CRUD API 回调,在节点/边增删改时调用 */
|
|
8
|
+
api?: ComputedRef<FlowApi | undefined>;
|
|
9
|
+
}
|
|
10
|
+
export interface UseFlowReturn {
|
|
11
|
+
nodes: ShallowRef<Node[]>;
|
|
12
|
+
edges: ShallowRef<Edge[]>;
|
|
13
|
+
GRID_SIZE: number;
|
|
14
|
+
/** 是否有 API 操作正在进行 */
|
|
15
|
+
loading: Ref<boolean>;
|
|
16
|
+
deleteNode: (nodeId: string) => Promise<void>;
|
|
17
|
+
deleteEdge: (edgeId: string) => Promise<void>;
|
|
18
|
+
createEdge: (params: Connection) => Promise<void>;
|
|
19
|
+
/** 重连边:乐观更新,立即移动到新位置(带 opacity),API 完成后恢复 */
|
|
20
|
+
reconnectEdge: (oldEdgeId: string, connection: Connection) => Promise<void>;
|
|
21
|
+
updateNodePosition: (nodeId: string, x: number, y: number) => Promise<void>;
|
|
22
|
+
updateNodeDimensions: (nodeId: string, dimensions: UseFlowResizeDimensions) => Promise<void>;
|
|
23
|
+
updateNode: (updatedNode: FlowNode) => Promise<void>;
|
|
24
|
+
createNode: () => Promise<void>;
|
|
25
|
+
syncNodes: (createHandlers: (nodeId: string) => Record<string, any>) => void;
|
|
26
|
+
updateEdgeLabel: (edgeId: string, label: string) => Promise<void>;
|
|
27
|
+
syncEdges: (createHandlers: (edgeId: string) => Record<string, any>) => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Flow 业务逻辑 Composable
|
|
31
|
+
* 管理节点和边的 CRUD 操作,并同步到外部数据模型
|
|
32
|
+
*/
|
|
33
|
+
export declare function useFlow(options: UseFlowOptions): UseFlowReturn;
|