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.
Files changed (109) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -0
  3. package/dist/runtime/components/Watermark.d.vue.ts +3 -3
  4. package/dist/runtime/components/Watermark.vue.d.ts +3 -3
  5. package/dist/runtime/components/button/CircleColor.d.vue.ts +17 -0
  6. package/dist/runtime/components/button/CircleColor.vue +37 -0
  7. package/dist/runtime/components/button/CircleColor.vue.d.ts +17 -0
  8. package/dist/runtime/components/button/Dropdown.vue +5 -1
  9. package/dist/runtime/components/date-picker/Input.d.vue.ts +9 -1
  10. package/dist/runtime/components/date-picker/Input.vue +55 -11
  11. package/dist/runtime/components/date-picker/Input.vue.d.ts +9 -1
  12. package/dist/runtime/components/date-picker/index.vue +3 -3
  13. package/dist/runtime/components/flow/FlowEdge.client.vue +170 -41
  14. package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +51 -0
  15. package/dist/runtime/components/flow/FlowEditor.client.vue +287 -0
  16. package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +51 -0
  17. package/dist/runtime/components/flow/FlowNode.client.d.vue.ts +13 -2
  18. package/dist/runtime/components/flow/FlowNode.client.vue +44 -48
  19. package/dist/runtime/components/flow/FlowNode.client.vue.d.ts +13 -2
  20. package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +41 -5
  21. package/dist/runtime/components/flow/FlowToolbar.vue +554 -88
  22. package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +41 -5
  23. package/dist/runtime/components/flow/FlowToolbarItemWrapper.d.vue.ts +17 -0
  24. package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue +16 -0
  25. package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue.d.ts +17 -0
  26. package/dist/runtime/components/form/field/DatePicker.vue +1 -1
  27. package/dist/runtime/components/sys/flow/CreateModal.d.vue.ts +13 -0
  28. package/dist/runtime/components/sys/flow/CreateModal.vue +32 -0
  29. package/dist/runtime/components/sys/flow/CreateModal.vue.d.ts +13 -0
  30. package/dist/runtime/components/sys/flow/EditNodeModal.d.vue.ts +13 -0
  31. package/dist/runtime/components/sys/flow/EditNodeModal.vue +30 -0
  32. package/dist/runtime/components/sys/flow/EditNodeModal.vue.d.ts +13 -0
  33. package/dist/runtime/components/sys/flow/Table.d.vue.ts +3 -0
  34. package/dist/runtime/components/sys/flow/Table.vue +103 -0
  35. package/dist/runtime/components/sys/flow/Table.vue.d.ts +3 -0
  36. package/dist/runtime/components/sys/table/CreateModal.vue +9 -193
  37. package/dist/runtime/components/sys/table/Table.vue +6 -15
  38. package/dist/runtime/components/sys/table/TableColumnList.d.vue.ts +54 -0
  39. package/dist/runtime/components/sys/table/TableColumnList.vue +196 -0
  40. package/dist/runtime/components/sys/table/TableColumnList.vue.d.ts +54 -0
  41. package/dist/runtime/components/sys/table/TableColumnModal.d.vue.ts +3 -13
  42. package/dist/runtime/components/sys/table/TableColumnModal.vue +32 -100
  43. package/dist/runtime/components/sys/table/TableColumnModal.vue.d.ts +3 -13
  44. package/dist/runtime/components/sys/user/Table.vue +44 -27
  45. package/dist/runtime/components/table/permission/TablePermissionConfig.d.vue.ts +2 -2
  46. package/dist/runtime/components/table/permission/TablePermissionConfig.vue +3 -3
  47. package/dist/runtime/components/table/permission/TablePermissionConfig.vue.d.ts +2 -2
  48. package/dist/runtime/components/table/permission/TablePermissionTab.vue +7 -4
  49. package/dist/runtime/components/table/query/order/Item.d.vue.ts +2 -2
  50. package/dist/runtime/components/table/query/order/Item.vue.d.ts +2 -2
  51. package/dist/runtime/components/table/query/where/Newer.vue +2 -0
  52. package/dist/runtime/components/table/query/where/index.vue +46 -15
  53. package/dist/runtime/components/table/query/where/simple/item/ColumnPicker.vue +9 -4
  54. package/dist/runtime/components/table/query/where/simple/item/OprPicker.vue +3 -3
  55. package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue +45 -48
  56. package/dist/runtime/components/table/query/where/simple/item/opr/DatePicker.vue +137 -131
  57. package/dist/runtime/components/table/query/where/simple/item/opr/Select.d.vue.ts +4 -2
  58. package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue +40 -40
  59. package/dist/runtime/components/table/query/where/simple/item/opr/Select.vue.d.ts +4 -2
  60. package/dist/runtime/components/table/query/where/simple/item/opr/index.vue +2 -0
  61. package/dist/runtime/components/table/settings/TableSettings.d.vue.ts +1 -1
  62. package/dist/runtime/components/table/settings/TableSettings.vue +0 -3
  63. package/dist/runtime/components/table/settings/TableSettings.vue.d.ts +1 -1
  64. package/dist/runtime/composables/api/sys/index.d.ts +3 -0
  65. package/dist/runtime/composables/api/sys/index.js +3 -0
  66. package/dist/runtime/composables/api/sys/useFlowApi.d.ts +2 -0
  67. package/dist/runtime/composables/api/sys/useFlowApi.js +5 -0
  68. package/dist/runtime/composables/api/sys/useFlowEdgeApi.d.ts +2 -0
  69. package/dist/runtime/composables/api/sys/useFlowEdgeApi.js +3 -0
  70. package/dist/runtime/composables/api/sys/useFlowNodeApi.d.ts +2 -0
  71. package/dist/runtime/composables/api/sys/useFlowNodeApi.js +3 -0
  72. package/dist/runtime/composables/api/sys/useRoleApi.js +3 -1
  73. package/dist/runtime/composables/api/sys/useUserApi.js +3 -1
  74. package/dist/runtime/composables/flow/index.d.ts +3 -0
  75. package/dist/runtime/composables/flow/index.js +3 -0
  76. package/dist/runtime/composables/flow/useFlow.d.ts +33 -0
  77. package/dist/runtime/composables/flow/useFlow.js +401 -0
  78. package/dist/runtime/composables/flow/useFlowNode.d.ts +17 -0
  79. package/dist/runtime/composables/flow/useFlowNode.js +106 -0
  80. package/dist/runtime/composables/flow/useFlowResize.d.ts +21 -0
  81. package/dist/runtime/composables/flow/useFlowResize.js +84 -0
  82. package/dist/runtime/composables/flow/useFlowStyles.d.ts +62 -9
  83. package/dist/runtime/composables/flow/useFlowStyles.js +127 -23
  84. package/dist/runtime/composables/table/useTableColumnPermission.d.ts +36 -0
  85. package/dist/runtime/composables/useDate.js +8 -8
  86. package/dist/runtime/composables/useSidebarMenu.js +0 -2
  87. package/dist/runtime/composables/useTheme.d.ts +1 -1
  88. package/dist/runtime/composables/useTheme.js +0 -1
  89. package/dist/runtime/constants/flow.d.ts +166 -0
  90. package/dist/runtime/constants/flow.js +171 -0
  91. package/dist/runtime/constants/index.d.ts +1 -0
  92. package/dist/runtime/constants/index.js +1 -0
  93. package/dist/runtime/constants/options.js +2 -3
  94. package/dist/runtime/constants/table.d.ts +2 -0
  95. package/dist/runtime/constants/table.js +8 -0
  96. package/dist/runtime/index.css +1 -1
  97. package/dist/runtime/types/components/table/column.d.ts +4 -3
  98. package/dist/runtime/types/components/table/query/where.d.ts +1 -5
  99. package/dist/runtime/types/models/flow.d.ts +61 -0
  100. package/dist/runtime/types/models/flow.js +0 -0
  101. package/dist/runtime/types/models/index.d.ts +1 -0
  102. package/dist/runtime/types/models/index.js +1 -0
  103. package/dist/runtime/types/models/table.d.ts +1 -0
  104. package/dist/runtime/types/storage.d.ts +3 -4
  105. package/dist/runtime/types/storage.js +3 -4
  106. package/package.json +3 -2
  107. package/dist/runtime/components/table/query/where/simple/index.d.vue.ts +0 -21
  108. package/dist/runtime/components/table/query/where/simple/index.vue +0 -52
  109. 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, startOfWeek, endOfWeek, startOfMonth, endOfMonth } from "@internationalized/date";
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 { dateFormat, TIME_ZONE } from "#v/constants";
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 createDateStrComputed = (getValue, setValue) => computed({
59
- get: getValue,
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
- setValue(void 0);
67
+ calendarValue.value = { ...calendarValue.value, start: void 0 };
63
68
  return;
64
69
  }
65
- const formattedDayjs = dayjs(newValue, dateFormat, true);
70
+ const formattedDayjs = dayjs(newValue, displayDateFormat, true);
66
71
  if (formattedDayjs.isValid()) {
67
- setValue(useDate().dayjsToDateValue(formattedDayjs));
72
+ calendarValue.value = {
73
+ ...calendarValue.value,
74
+ start: useDate().dayjsToDateValue(formattedDayjs)
75
+ };
68
76
  }
69
77
  }
70
78
  });
71
- const startDateStrValueInput = useTemplateRef("startDateStrValueInput");
72
- const startDateStrValue = createDateStrComputed(
73
- () => useDate().dateValueToDayjs(calendarValue.value?.start)?.format(dateFormat) ?? void 0,
74
- (start) => {
75
- calendarValue.value = { ...calendarValue.value, start };
76
- }
77
- );
78
- const endDateStrValue = createDateStrComputed(
79
- () => useDate().dateValueToDayjs(calendarValue.value?.end)?.format(dateFormat) ?? void 0,
80
- (end) => {
81
- calendarValue.value = { ...calendarValue.value, end };
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 = createDateStrComputed(
86
- () => useDate().dateValueToDayjs(calendarValue.value)?.format(dateFormat) || void 0,
87
- (date) => {
88
- calendarValue.value = date;
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 dateStrInputFocus = () => {
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
- const input = isRangeOpr.value ? startDateStrValueInput : singleDateStrValueInput;
94
- input.value?.focus();
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
- popoverOpen.value = true;
101
- dateStrInputFocus();
131
+ focusStartInput();
102
132
  }
103
133
  });
134
+ const date = useDate();
104
135
  const dateRangeShortcuts = [
105
- {
106
- label: "\u672C\u5468",
107
- dateFn: () => {
108
- const today = now(TIME_ZONE);
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
- <UButton size="sm" color="neutral" variant="outline">
177
- {{ isValueEmpty ? "--" : displayValue }}
178
- </UButton>
153
+ <!-- 输入框直接暴露 -->
154
+ <template v-if="isNoCalendarOpr" />
179
155
 
180
- <template #content>
181
- <div class="p-3 flex flex-col gap-2">
182
- <UFieldGroup v-if="isRangeOpr" :orientation="app.isMobile.value ? 'vertical' : 'horizontal'">
183
- <DatePickerInput
184
- ref="startDateStrValueInput"
185
- v-model:value="startDateStrValue"
186
- placeholder="YYYY/MM/DD 开始日期"
187
- :disabled="disabled"
188
- />
189
- <DatePickerInput
190
- ref="endDateStrValueInput"
191
- v-model:value="endDateStrValue"
192
- placeholder="YYYY/MM/DD 结束日期"
193
- :disabled="disabled"
194
- />
195
- </UFieldGroup>
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
- <DatePickerInput
198
- v-else
199
- ref="singleDateStrValueInput"
200
- v-model:value="singleDateStrValue"
201
- placeholder="YYYY/MM/DD 日期"
202
- :disabled="disabled"
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
- <div v-if="isRangeOpr" class="ml-auto">
216
- <UFieldGroup>
217
- <UButton
218
- v-for="shortcut in dateRangeShortcuts"
219
- :key="shortcut.label"
220
- :label="shortcut.label"
221
- size="xs"
222
- color="neutral"
223
- variant="outline"
224
- :disabled="disabled"
225
- @click="calendarValue = shortcut.dateFn()"
226
- />
227
- </UFieldGroup>
228
- </div>
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 { SelectOption, WhereQueryItem } from '#v/types';
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: SelectOption[];
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 queryValue = computed({
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 groups = computed(() => [
18
- {
19
- id: "fields",
20
- items: props.items,
21
- ignoreFilter: true
17
+ const searchTerm = ref("");
18
+ const filteredItems = computed(() => {
19
+ if (!searchTerm.value) {
20
+ return props.items;
22
21
  }
23
- ]);
24
- const ref = useTemplateRef("dropdownBtn");
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
- ref.value?.focus();
27
+ inputMenuRef.value?.inputRef.focus();
28
28
  }
29
29
  });
30
30
  </script>
31
31
 
32
32
  <template>
33
- <ButtonDropdown
34
- ref="dropdownBtn"
35
- v-model="queryValue"
36
- :groups="groups"
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
- enable-footer-toolbar
39
- >
40
- <UButton
41
- size="sm"
42
- color="neutral"
43
- variant="outline"
44
- >
45
- <div v-if="!queryValue || queryValue.length === 0">
46
- --
47
- </div>
48
- <div v-else-if="queryValue.length <= 2" class="flex items-center gap-1">
49
- {{ queryValue.map((value2) => items.find((item) => item.value === value2)?.label || value2).join(", ") }}
50
- </div>
51
- <div v-else>
52
- <!-- 打印前两项,后面+1代替 -->
53
- <div class="flex items-center gap-1">
54
- <div v-for="value in queryValue.slice(0, 2)" :key="value">
55
- {{ items.find((item) => item.value === value)?.label || value }}
56
- </div>
57
- <span>+{{ queryValue.length - 2 }}</span>
58
- </div>
59
- </div>
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 { SelectOption, WhereQueryItem } from '#v/types';
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: SelectOption[];
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";
@@ -0,0 +1,2 @@
1
+ import type { ApiGroup, Flow } from '#v/types';
2
+ export declare const useFlowApi: () => ApiGroup<Flow>;
@@ -0,0 +1,5 @@
1
+ import { createSharedComposable } from "@vueuse/core";
2
+ import { useApi } from "../useApi.js";
3
+ export const useFlowApi = createSharedComposable(() => ({
4
+ ...useApi("/flows")
5
+ }));
@@ -0,0 +1,2 @@
1
+ import type { FlowEdge } from '#v/types';
2
+ export declare const useFlowEdgeApi: () => import("#v/types").ApiGroup<FlowEdge>;
@@ -0,0 +1,3 @@
1
+ import { createSharedComposable } from "@vueuse/core";
2
+ import { useApi } from "../useApi.js";
3
+ export const useFlowEdgeApi = createSharedComposable(() => useApi("/flows/edges"));
@@ -0,0 +1,2 @@
1
+ import type { FlowNode } from '#v/types';
2
+ export declare const useFlowNodeApi: () => import("#v/types").ApiGroup<FlowNode>;
@@ -0,0 +1,3 @@
1
+ import { createSharedComposable } from "@vueuse/core";
2
+ import { useApi } from "../useApi.js";
3
+ export const useFlowNodeApi = createSharedComposable(() => useApi("/flows/nodes"));
@@ -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);
@@ -1 +1,4 @@
1
+ export * from './useFlow.js';
2
+ export * from './useFlowNode.js';
3
+ export * from './useFlowResize.js';
1
4
  export * from './useFlowStyles.js';
@@ -1 +1,4 @@
1
+ export * from "./useFlow.js";
2
+ export * from "./useFlowNode.js";
3
+ export * from "./useFlowResize.js";
1
4
  export * from "./useFlowStyles.js";
@@ -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;