yc-pro-components 0.0.85 → 1.0.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 (156) hide show
  1. package/es/components/index.d.ts +1 -0
  2. package/es/components/index.mjs +1 -0
  3. package/es/components/page/src/index.vue2.mjs +31 -13
  4. package/es/components/search/src/index.vue2.mjs +1 -0
  5. package/es/components/yc-plus-page/src/index.vue.mjs +1 -1
  6. package/es/components/yc-plus-page/src/index.vue2.mjs +24 -13
  7. package/es/components/yc-plus-page/src/type.d.ts +5 -0
  8. package/es/components/yc-query-filter/index.d.ts +7 -0
  9. package/es/components/yc-query-filter/index.mjs +6 -0
  10. package/es/components/yc-query-filter/src/index.vue.d.ts +32 -0
  11. package/es/components/yc-query-filter/src/index.vue.mjs +6 -0
  12. package/es/components/yc-query-filter/src/index.vue2.mjs +662 -0
  13. package/es/components/yc-query-filter/src/serialize.d.ts +4 -0
  14. package/es/components/yc-query-filter/src/serialize.mjs +17 -0
  15. package/es/constants/index.d.ts +1 -0
  16. package/es/constants/index.mjs +1 -0
  17. package/es/constants/query-filter.d.ts +69 -0
  18. package/es/constants/query-filter.mjs +3 -0
  19. package/es/hooks/index.d.ts +1 -0
  20. package/es/hooks/index.mjs +1 -0
  21. package/es/hooks/useQueryFilterConfig.d.ts +11 -0
  22. package/es/hooks/useQueryFilterConfig.mjs +38 -0
  23. package/es/index.css +12 -12
  24. package/es/index.d.ts +1 -1
  25. package/es/index.mjs +3 -0
  26. package/es/locale/lang/en.d.ts +33 -0
  27. package/es/locale/lang/en.mjs +33 -0
  28. package/es/locale/lang/ja.d.ts +33 -0
  29. package/es/locale/lang/ja.mjs +33 -0
  30. package/es/locale/lang/ko.d.ts +33 -0
  31. package/es/locale/lang/ko.mjs +33 -0
  32. package/es/locale/lang/zh-cn.d.ts +33 -0
  33. package/es/locale/lang/zh-cn.mjs +33 -0
  34. package/es/locale/lang/zh-tw.d.ts +33 -0
  35. package/es/locale/lang/zh-tw.mjs +33 -0
  36. package/es/version.d.ts +1 -1
  37. package/es/version.mjs +1 -1
  38. package/es/yc-components/index.d.ts +1 -1
  39. package/es/yc-components/version.d.ts +1 -1
  40. package/index.css +1 -1
  41. package/index.js +1069 -213
  42. package/index.min.css +1 -1
  43. package/index.min.js +16 -12
  44. package/index.min.mjs +16 -12
  45. package/index.mjs +1065 -215
  46. package/lib/components/index.d.ts +1 -0
  47. package/lib/components/index.js +3 -0
  48. package/lib/components/page/src/index.vue2.js +31 -13
  49. package/lib/components/search/src/index.vue2.js +1 -0
  50. package/lib/components/yc-plus-page/src/index.vue.js +1 -1
  51. package/lib/components/yc-plus-page/src/index.vue2.js +26 -15
  52. package/lib/components/yc-plus-page/src/type.d.ts +5 -0
  53. package/lib/components/yc-query-filter/index.d.ts +7 -0
  54. package/lib/components/yc-query-filter/index.js +9 -0
  55. package/lib/components/yc-query-filter/src/index.vue.d.ts +32 -0
  56. package/lib/components/yc-query-filter/src/index.vue.js +10 -0
  57. package/lib/components/yc-query-filter/src/index.vue2.js +666 -0
  58. package/lib/components/yc-query-filter/src/serialize.d.ts +4 -0
  59. package/lib/components/yc-query-filter/src/serialize.js +20 -0
  60. package/lib/constants/index.d.ts +1 -0
  61. package/lib/constants/index.js +2 -0
  62. package/lib/constants/query-filter.d.ts +69 -0
  63. package/lib/constants/query-filter.js +5 -0
  64. package/lib/hooks/index.d.ts +1 -0
  65. package/lib/hooks/index.js +4 -0
  66. package/lib/hooks/useQueryFilterConfig.d.ts +11 -0
  67. package/lib/hooks/useQueryFilterConfig.js +42 -0
  68. package/lib/index.css +9 -9
  69. package/lib/index.d.ts +1 -1
  70. package/lib/index.js +9 -0
  71. package/lib/locale/lang/en.d.ts +33 -0
  72. package/lib/locale/lang/en.js +33 -0
  73. package/lib/locale/lang/ja.d.ts +33 -0
  74. package/lib/locale/lang/ja.js +33 -0
  75. package/lib/locale/lang/ko.d.ts +33 -0
  76. package/lib/locale/lang/ko.js +33 -0
  77. package/lib/locale/lang/zh-cn.d.ts +33 -0
  78. package/lib/locale/lang/zh-cn.js +33 -0
  79. package/lib/locale/lang/zh-tw.d.ts +33 -0
  80. package/lib/locale/lang/zh-tw.js +33 -0
  81. package/lib/version.d.ts +1 -1
  82. package/lib/version.js +1 -1
  83. package/lib/yc-components/index.d.ts +1 -1
  84. package/lib/yc-components/version.d.ts +1 -1
  85. package/locale/en.d.ts +33 -0
  86. package/locale/en.js +34 -1
  87. package/locale/en.min.js +1 -1
  88. package/locale/en.min.mjs +1 -1
  89. package/locale/en.mjs +34 -1
  90. package/locale/ja.d.ts +33 -0
  91. package/locale/ja.js +34 -1
  92. package/locale/ja.min.js +1 -1
  93. package/locale/ja.min.mjs +1 -1
  94. package/locale/ja.mjs +34 -1
  95. package/locale/ko.d.ts +33 -0
  96. package/locale/ko.js +34 -1
  97. package/locale/ko.min.js +1 -1
  98. package/locale/ko.min.mjs +1 -1
  99. package/locale/ko.mjs +34 -1
  100. package/locale/zh-cn.d.ts +33 -0
  101. package/locale/zh-cn.js +34 -1
  102. package/locale/zh-cn.min.js +1 -1
  103. package/locale/zh-cn.min.mjs +1 -1
  104. package/locale/zh-cn.mjs +34 -1
  105. package/locale/zh-tw.d.ts +33 -0
  106. package/locale/zh-tw.js +34 -1
  107. package/locale/zh-tw.min.js +1 -1
  108. package/locale/zh-tw.min.mjs +1 -1
  109. package/locale/zh-tw.mjs +34 -1
  110. package/package.json +1 -1
  111. package/theme-chalk/index.css +1 -1
  112. package/theme-chalk/plus-yc-query-filter.css +1 -0
  113. package/theme-chalk/src/index.scss +1 -0
  114. package/theme-chalk/src/yc-query-filter.scss +163 -0
  115. package/es/components/breadcrumb/index.d.ts +0 -6985
  116. package/es/components/breadcrumb/src/index.vue.d.ts +0 -6947
  117. package/es/components/dialog-form/index.d.ts +0 -314
  118. package/es/components/dialog-form/src/index.vue.d.ts +0 -214
  119. package/es/components/display-item/index.d.ts +0 -580
  120. package/es/components/display-item/src/index.vue.d.ts +0 -446
  121. package/es/components/drawer-form/index.d.ts +0 -1592
  122. package/es/components/drawer-form/src/index.vue.d.ts +0 -630
  123. package/es/components/form/index.d.ts +0 -870
  124. package/es/components/form/src/form-content.vue.d.ts +0 -598
  125. package/es/components/form/src/index.vue.d.ts +0 -382
  126. package/es/components/form-item/index.d.ts +0 -1492
  127. package/es/components/form-item/src/index.vue.d.ts +0 -550
  128. package/es/components/page/index.d.ts +0 -10746
  129. package/es/components/page/src/index.vue.d.ts +0 -3775
  130. package/es/components/search/index.d.ts +0 -2977
  131. package/es/components/search/src/index.vue.d.ts +0 -1021
  132. package/es/components/table/src/table-column.vue.d.ts +0 -624
  133. package/es/components/yc-drawer/store.d.ts +0 -2359
  134. package/es/components/yc-plus-page/src/index.vue.d.ts +0 -8250
  135. package/es/hooks/usePlusFormReset.d.ts +0 -4501
  136. package/lib/components/breadcrumb/index.d.ts +0 -6985
  137. package/lib/components/breadcrumb/src/index.vue.d.ts +0 -6947
  138. package/lib/components/dialog-form/index.d.ts +0 -314
  139. package/lib/components/dialog-form/src/index.vue.d.ts +0 -214
  140. package/lib/components/display-item/index.d.ts +0 -580
  141. package/lib/components/display-item/src/index.vue.d.ts +0 -446
  142. package/lib/components/drawer-form/index.d.ts +0 -1592
  143. package/lib/components/drawer-form/src/index.vue.d.ts +0 -630
  144. package/lib/components/form/index.d.ts +0 -870
  145. package/lib/components/form/src/form-content.vue.d.ts +0 -598
  146. package/lib/components/form/src/index.vue.d.ts +0 -382
  147. package/lib/components/form-item/index.d.ts +0 -1492
  148. package/lib/components/form-item/src/index.vue.d.ts +0 -550
  149. package/lib/components/page/index.d.ts +0 -10746
  150. package/lib/components/page/src/index.vue.d.ts +0 -3775
  151. package/lib/components/search/index.d.ts +0 -2977
  152. package/lib/components/search/src/index.vue.d.ts +0 -1021
  153. package/lib/components/table/src/table-column.vue.d.ts +0 -624
  154. package/lib/components/yc-drawer/store.d.ts +0 -2359
  155. package/lib/components/yc-plus-page/src/index.vue.d.ts +0 -8250
  156. package/lib/hooks/usePlusFormReset.d.ts +0 -4501
@@ -0,0 +1,662 @@
1
+ import { defineComponent, computed, inject, ref, openBlock, createElementBlock, createVNode, unref, withCtx, createTextVNode, toDisplayString, createElementVNode, createCommentVNode, Fragment, renderList, withModifiers, normalizeClass, createBlock } from 'vue';
2
+ import { routeLocationKey } from 'vue-router';
3
+ import { ElButton, ElPopover, ElEmpty, ElDialog, ElForm, ElFormItem, ElInput, ElSelect, ElOption, ElMessage, ElMessageBox } from 'element-plus';
4
+ import { Delete, EditPen, Share, RefreshLeft } from '@element-plus/icons-vue';
5
+ import { useLocale } from '../../../hooks/useLocale.mjs';
6
+ import 'sortablejs';
7
+ import { useQueryFilterConfig } from '../../../hooks/useQueryFilterConfig.mjs';
8
+ import { extractQueryFilterFields, serializeQueryFilter } from './serialize.mjs';
9
+
10
+ const _hoisted_1 = {
11
+ key: 0,
12
+ class: "yc-query-filter"
13
+ };
14
+ const _hoisted_2 = { class: "yc-query-filter__panel" };
15
+ const _hoisted_3 = {
16
+ key: 0,
17
+ class: "yc-query-filter__loading"
18
+ };
19
+ const _hoisted_4 = { class: "yc-query-filter__col" };
20
+ const _hoisted_5 = { class: "yc-query-filter__title" };
21
+ const _hoisted_6 = {
22
+ key: 0,
23
+ class: "yc-query-filter__empty"
24
+ };
25
+ const _hoisted_7 = {
26
+ key: 1,
27
+ class: "yc-query-filter__list"
28
+ };
29
+ const _hoisted_8 = ["onClick"];
30
+ const _hoisted_9 = { class: "yc-query-filter__ops" };
31
+ const _hoisted_10 = { class: "yc-query-filter__col yc-query-filter__col--right" };
32
+ const _hoisted_11 = { class: "yc-query-filter__title" };
33
+ const _hoisted_12 = { class: "yc-query-filter__tabs" };
34
+ const _hoisted_13 = {
35
+ key: 1,
36
+ class: "yc-query-filter__list"
37
+ };
38
+ const _hoisted_14 = ["onClick"];
39
+ const _hoisted_15 = { class: "yc-query-filter__meta" };
40
+ const _hoisted_16 = { class: "yc-query-filter__highlight" };
41
+ const _hoisted_17 = { class: "yc-query-filter__ops" };
42
+ const _hoisted_18 = {
43
+ key: 1,
44
+ class: "yc-query-filter__list"
45
+ };
46
+ const _hoisted_19 = ["onClick"];
47
+ const _hoisted_20 = { class: "yc-query-filter__meta" };
48
+ const _hoisted_21 = { class: "yc-query-filter__highlight" };
49
+ const _hoisted_22 = { class: "yc-query-filter__ops" };
50
+ var _sfc_main = /* @__PURE__ */ defineComponent({
51
+ ...{
52
+ name: "YcQueryFilterManager"
53
+ },
54
+ __name: "index",
55
+ props: {
56
+ pageInstance: {},
57
+ queryFilterKey: { default: "main" }
58
+ },
59
+ setup(__props) {
60
+ const props = __props;
61
+ const { t } = useLocale();
62
+ const config = useQueryFilterConfig();
63
+ const enabled = computed(
64
+ () => !!((config == null ? void 0 : config.enabled) && config.api && config.appCode && pageEnabled.value)
65
+ );
66
+ const route = inject(routeLocationKey, null);
67
+ const pageCode = computed(() => {
68
+ const custom = config == null ? void 0 : config.pageCode;
69
+ if (typeof custom === "function") return custom();
70
+ if (custom) return custom;
71
+ const routeName = String((route == null ? void 0 : route.name) || (route == null ? void 0 : route.path) || "unnamed");
72
+ return `${config == null ? void 0 : config.appCode}:${routeName}:${props.queryFilterKey}`;
73
+ });
74
+ const schemaVersion = ref(1);
75
+ const pageEnabled = ref(true);
76
+ const mine = ref([]);
77
+ const received = ref([]);
78
+ const shared = ref([]);
79
+ const rightTab = ref("received");
80
+ const panelVisible = ref(false);
81
+ const loading = ref(false);
82
+ const saveVisible = ref(false);
83
+ const saveName = ref("");
84
+ const editingId = ref(null);
85
+ const editingItem = ref(null);
86
+ const saving = ref(false);
87
+ const shareVisible = ref(false);
88
+ const sharingId = ref(null);
89
+ const shareUserIds = ref([]);
90
+ const userOptions = ref([]);
91
+ function getPage() {
92
+ return unref(props.pageInstance);
93
+ }
94
+ function getFormValues() {
95
+ var _a;
96
+ const page = getPage();
97
+ const values = (_a = page == null ? void 0 : page.getSearchFieldsValue) == null ? void 0 : _a.call(page);
98
+ return values && typeof values === "object" ? { ...values } : {};
99
+ }
100
+ function displayTime(value) {
101
+ if (!value) return "";
102
+ const matched = value.match(/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/);
103
+ return matched ? matched[1] : value;
104
+ }
105
+ function applyItem(item) {
106
+ var _a, _b;
107
+ const fields = extractQueryFilterFields(item.conditions);
108
+ const page = getPage();
109
+ if (page == null ? void 0 : page.replaceSearchFormValues) {
110
+ page.replaceSearchFormValues(fields);
111
+ } else {
112
+ (_a = page == null ? void 0 : page.clearSearchFieldsValue) == null ? void 0 : _a.call(page);
113
+ (_b = page == null ? void 0 : page.setSearchFieldsValue) == null ? void 0 : _b.call(page, fields);
114
+ }
115
+ if (schemaVersion.value && item.schemaVersion && item.schemaVersion !== schemaVersion.value) {
116
+ ElMessage.warning(t("plus.queryFilter.schemaMismatch"));
117
+ } else {
118
+ ElMessage.success(t("plus.queryFilter.applied"));
119
+ }
120
+ panelVisible.value = false;
121
+ }
122
+ async function refreshList() {
123
+ if (!(config == null ? void 0 : config.api)) return;
124
+ loading.value = true;
125
+ try {
126
+ const data = await config.api.list({
127
+ appCode: config.appCode,
128
+ pageCode: pageCode.value
129
+ });
130
+ schemaVersion.value = (data == null ? void 0 : data.schemaVersion) || 1;
131
+ pageEnabled.value = (data == null ? void 0 : data.enabled) !== false;
132
+ mine.value = (data == null ? void 0 : data.mine) || [];
133
+ received.value = (data == null ? void 0 : data.received) || [];
134
+ shared.value = (data == null ? void 0 : data.shared) || [];
135
+ } finally {
136
+ loading.value = false;
137
+ }
138
+ }
139
+ function openSaveAs() {
140
+ editingId.value = null;
141
+ editingItem.value = null;
142
+ saveName.value = "";
143
+ saveVisible.value = true;
144
+ }
145
+ function openEdit(item) {
146
+ editingId.value = item.id;
147
+ editingItem.value = item;
148
+ saveName.value = item.name;
149
+ saveVisible.value = true;
150
+ }
151
+ async function confirmSave() {
152
+ const name = saveName.value.trim();
153
+ if (!name) {
154
+ ElMessage.warning(t("plus.queryFilter.namePlaceholder"));
155
+ return;
156
+ }
157
+ if (!(config == null ? void 0 : config.api)) return;
158
+ saving.value = true;
159
+ try {
160
+ const owned = mine.value.some((item) => item.id === editingId.value);
161
+ if (editingId.value && owned) {
162
+ await config.api.update({ id: editingId.value, name });
163
+ } else {
164
+ const fields = editingItem.value ? extractQueryFilterFields(editingItem.value.conditions) : getFormValues();
165
+ await config.api.saveAs({
166
+ appCode: config.appCode,
167
+ pageCode: pageCode.value,
168
+ name,
169
+ conditions: serializeQueryFilter(fields, schemaVersion.value)
170
+ });
171
+ }
172
+ ElMessage.success(t("plus.queryFilter.saveSuccess"));
173
+ saveVisible.value = false;
174
+ await refreshList();
175
+ } catch (error) {
176
+ ElMessage.error(error instanceof Error ? error.message : t("plus.queryFilter.saveSuccess"));
177
+ } finally {
178
+ saving.value = false;
179
+ }
180
+ }
181
+ function confirmOptions() {
182
+ return {
183
+ type: "warning",
184
+ confirmButtonText: t("plus.dialog.confirmText"),
185
+ cancelButtonText: t("plus.dialog.cancelText")
186
+ };
187
+ }
188
+ async function removeItem(item) {
189
+ if (!(config == null ? void 0 : config.api)) return;
190
+ try {
191
+ await ElMessageBox.confirm(
192
+ t("plus.queryFilter.confirmDelete"),
193
+ t("plus.table.prompt"),
194
+ confirmOptions()
195
+ );
196
+ await config.api.delete({ id: item.id });
197
+ ElMessage.success(t("plus.queryFilter.deleteSuccess"));
198
+ await refreshList();
199
+ } catch (e) {
200
+ }
201
+ }
202
+ async function openShare(item) {
203
+ sharingId.value = item.id;
204
+ shareUserIds.value = [...item.recipientUserIds || []];
205
+ if (config == null ? void 0 : config.openUserSelector) {
206
+ try {
207
+ const ids = await config.openUserSelector();
208
+ if (ids == null ? void 0 : ids.length) {
209
+ await config.api.share({ id: item.id, recipientUserIds: ids });
210
+ ElMessage.success(t("plus.queryFilter.shareSuccess"));
211
+ await refreshList();
212
+ }
213
+ } catch (error) {
214
+ if (error instanceof Error && error.message) ElMessage.error(error.message);
215
+ }
216
+ return;
217
+ }
218
+ if (!(config == null ? void 0 : config.searchUsers)) {
219
+ ElMessage.warning(t("plus.queryFilter.noSelector"));
220
+ return;
221
+ }
222
+ userOptions.value = await config.searchUsers("");
223
+ shareVisible.value = true;
224
+ }
225
+ async function remoteSearchUsers(keyword) {
226
+ if (!(config == null ? void 0 : config.searchUsers)) return;
227
+ userOptions.value = await config.searchUsers(keyword);
228
+ }
229
+ async function confirmShare() {
230
+ if (!(config == null ? void 0 : config.api) || !sharingId.value) return;
231
+ if (!shareUserIds.value.length) {
232
+ ElMessage.warning(t("plus.queryFilter.sharePlaceholder"));
233
+ return;
234
+ }
235
+ try {
236
+ await config.api.share({ id: sharingId.value, recipientUserIds: shareUserIds.value });
237
+ ElMessage.success(t("plus.queryFilter.shareSuccess"));
238
+ shareVisible.value = false;
239
+ await refreshList();
240
+ } catch (error) {
241
+ ElMessage.error(error instanceof Error ? error.message : t("plus.queryFilter.shareSuccess"));
242
+ }
243
+ }
244
+ async function revokeShare(item, recipientUserIds) {
245
+ if (!(config == null ? void 0 : config.api)) return;
246
+ try {
247
+ await ElMessageBox.confirm(
248
+ t("plus.queryFilter.confirmRevoke"),
249
+ t("plus.table.prompt"),
250
+ confirmOptions()
251
+ );
252
+ await config.api.revoke({ id: item.id, recipientUserIds });
253
+ ElMessage.success(t("plus.queryFilter.revokeSuccess"));
254
+ await refreshList();
255
+ } catch (e) {
256
+ }
257
+ }
258
+ function receivedPrefix(item) {
259
+ return t("plus.queryFilter.sharedByPrefix", {
260
+ time: displayTime(item.sharedTime || item.createdTime),
261
+ sender: item.ownerUserName || item.ownerUserId
262
+ });
263
+ }
264
+ function sharedPrefix(item) {
265
+ var _a, _b;
266
+ const recipient = ((_a = item.recipientNames) == null ? void 0 : _a[0]) || (((_b = item.recipientUserIds) == null ? void 0 : _b.length) ? `${item.recipientUserIds.length}` : "");
267
+ return t("plus.queryFilter.sharedToPrefix", {
268
+ time: displayTime(item.sharedTime || item.updatedTime || item.createdTime),
269
+ recipient
270
+ });
271
+ }
272
+ return (_ctx, _cache) => {
273
+ return enabled.value ? (openBlock(), createElementBlock("span", _hoisted_1, [
274
+ createVNode(unref(ElButton), { onClick: openSaveAs }, {
275
+ default: withCtx(() => [
276
+ createTextVNode(
277
+ toDisplayString(unref(t)("plus.queryFilter.saveAs")),
278
+ 1
279
+ /* TEXT */
280
+ )
281
+ ]),
282
+ _: 1
283
+ /* STABLE */
284
+ }),
285
+ createVNode(unref(ElPopover), {
286
+ visible: panelVisible.value,
287
+ "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => panelVisible.value = $event),
288
+ placement: "bottom-end",
289
+ width: 720,
290
+ trigger: "click",
291
+ teleported: "",
292
+ onShow: refreshList
293
+ }, {
294
+ reference: withCtx(() => [
295
+ createVNode(unref(ElButton), null, {
296
+ default: withCtx(() => [
297
+ createTextVNode(
298
+ toDisplayString(unref(t)("plus.queryFilter.saved")),
299
+ 1
300
+ /* TEXT */
301
+ )
302
+ ]),
303
+ _: 1
304
+ /* STABLE */
305
+ })
306
+ ]),
307
+ default: withCtx(() => [
308
+ createElementVNode("div", _hoisted_2, [
309
+ loading.value ? (openBlock(), createElementBlock("div", _hoisted_3, "...")) : createCommentVNode("v-if", true),
310
+ createElementVNode("div", _hoisted_4, [
311
+ createElementVNode(
312
+ "div",
313
+ _hoisted_5,
314
+ toDisplayString(unref(t)("plus.queryFilter.savedTitle")),
315
+ 1
316
+ /* TEXT */
317
+ ),
318
+ !mine.value.length ? (openBlock(), createElementBlock(
319
+ "div",
320
+ _hoisted_6,
321
+ toDisplayString(unref(t)("plus.queryFilter.emptyMine")),
322
+ 1
323
+ /* TEXT */
324
+ )) : (openBlock(), createElementBlock("ul", _hoisted_7, [
325
+ (openBlock(true), createElementBlock(
326
+ Fragment,
327
+ null,
328
+ renderList(mine.value, (item) => {
329
+ return openBlock(), createElementBlock("li", {
330
+ key: item.id,
331
+ class: "yc-query-filter__item"
332
+ }, [
333
+ createElementVNode("button", {
334
+ type: "button",
335
+ class: "yc-query-filter__name",
336
+ onClick: ($event) => applyItem(item)
337
+ }, toDisplayString(item.name), 9, _hoisted_8),
338
+ createElementVNode("span", _hoisted_9, [
339
+ createVNode(unref(ElButton), {
340
+ link: "",
341
+ type: "danger",
342
+ icon: unref(Delete),
343
+ title: unref(t)("plus.queryFilter.remove"),
344
+ onClick: withModifiers(($event) => removeItem(item), ["stop"])
345
+ }, null, 8, ["icon", "title", "onClick"]),
346
+ createVNode(unref(ElButton), {
347
+ link: "",
348
+ icon: unref(EditPen),
349
+ title: unref(t)("plus.queryFilter.edit"),
350
+ onClick: withModifiers(($event) => openEdit(item), ["stop"])
351
+ }, null, 8, ["icon", "title", "onClick"]),
352
+ createVNode(unref(ElButton), {
353
+ link: "",
354
+ icon: unref(Share),
355
+ title: unref(t)("plus.queryFilter.share"),
356
+ onClick: withModifiers(($event) => openShare(item), ["stop"])
357
+ }, null, 8, ["icon", "title", "onClick"])
358
+ ])
359
+ ]);
360
+ }),
361
+ 128
362
+ /* KEYED_FRAGMENT */
363
+ ))
364
+ ]))
365
+ ]),
366
+ createElementVNode("div", _hoisted_10, [
367
+ createElementVNode(
368
+ "div",
369
+ _hoisted_11,
370
+ toDisplayString(unref(t)("plus.queryFilter.panelTitle")),
371
+ 1
372
+ /* TEXT */
373
+ ),
374
+ createElementVNode("div", _hoisted_12, [
375
+ createElementVNode(
376
+ "button",
377
+ {
378
+ type: "button",
379
+ class: normalizeClass({ "is-active": rightTab.value === "received" }),
380
+ onClick: _cache[0] || (_cache[0] = ($event) => rightTab.value = "received")
381
+ },
382
+ toDisplayString(unref(t)("plus.queryFilter.received")),
383
+ 3
384
+ /* TEXT, CLASS */
385
+ ),
386
+ createElementVNode(
387
+ "button",
388
+ {
389
+ type: "button",
390
+ class: normalizeClass({ "is-active": rightTab.value === "shared" }),
391
+ onClick: _cache[1] || (_cache[1] = ($event) => rightTab.value = "shared")
392
+ },
393
+ toDisplayString(unref(t)("plus.queryFilter.shared")),
394
+ 3
395
+ /* TEXT, CLASS */
396
+ )
397
+ ]),
398
+ rightTab.value === "received" ? (openBlock(), createElementBlock(
399
+ Fragment,
400
+ { key: 0 },
401
+ [
402
+ !received.value.length ? (openBlock(), createBlock(unref(ElEmpty), {
403
+ key: 0,
404
+ description: unref(t)("plus.queryFilter.emptyReceived"),
405
+ "image-size": 48
406
+ }, null, 8, ["description"])) : (openBlock(), createElementBlock("ul", _hoisted_13, [
407
+ (openBlock(true), createElementBlock(
408
+ Fragment,
409
+ null,
410
+ renderList(received.value, (item) => {
411
+ return openBlock(), createElementBlock("li", {
412
+ key: item.id,
413
+ class: "yc-query-filter__item"
414
+ }, [
415
+ createElementVNode("button", {
416
+ type: "button",
417
+ class: "yc-query-filter__line",
418
+ onClick: ($event) => applyItem(item)
419
+ }, [
420
+ createElementVNode(
421
+ "span",
422
+ _hoisted_15,
423
+ toDisplayString(receivedPrefix(item)),
424
+ 1
425
+ /* TEXT */
426
+ ),
427
+ createElementVNode(
428
+ "span",
429
+ _hoisted_16,
430
+ "\u3010" + toDisplayString(item.name) + "\u3011",
431
+ 1
432
+ /* TEXT */
433
+ )
434
+ ], 8, _hoisted_14),
435
+ createElementVNode("span", _hoisted_17, [
436
+ createVNode(unref(ElButton), {
437
+ link: "",
438
+ type: "danger",
439
+ icon: unref(Delete),
440
+ title: unref(t)("plus.queryFilter.remove"),
441
+ onClick: withModifiers(($event) => removeItem(item), ["stop"])
442
+ }, null, 8, ["icon", "title", "onClick"]),
443
+ createVNode(unref(ElButton), {
444
+ link: "",
445
+ icon: unref(EditPen),
446
+ title: unref(t)("plus.queryFilter.edit"),
447
+ onClick: withModifiers(($event) => openEdit(item), ["stop"])
448
+ }, null, 8, ["icon", "title", "onClick"])
449
+ ])
450
+ ]);
451
+ }),
452
+ 128
453
+ /* KEYED_FRAGMENT */
454
+ ))
455
+ ]))
456
+ ],
457
+ 64
458
+ /* STABLE_FRAGMENT */
459
+ )) : (openBlock(), createElementBlock(
460
+ Fragment,
461
+ { key: 1 },
462
+ [
463
+ !shared.value.length ? (openBlock(), createBlock(unref(ElEmpty), {
464
+ key: 0,
465
+ description: unref(t)("plus.queryFilter.emptyShared"),
466
+ "image-size": 48
467
+ }, null, 8, ["description"])) : (openBlock(), createElementBlock("ul", _hoisted_18, [
468
+ (openBlock(true), createElementBlock(
469
+ Fragment,
470
+ null,
471
+ renderList(shared.value, (item) => {
472
+ return openBlock(), createElementBlock("li", {
473
+ key: item.id,
474
+ class: "yc-query-filter__item"
475
+ }, [
476
+ createElementVNode("button", {
477
+ type: "button",
478
+ class: "yc-query-filter__line",
479
+ onClick: ($event) => applyItem(item)
480
+ }, [
481
+ createElementVNode(
482
+ "span",
483
+ _hoisted_20,
484
+ toDisplayString(sharedPrefix(item)),
485
+ 1
486
+ /* TEXT */
487
+ ),
488
+ createElementVNode(
489
+ "span",
490
+ _hoisted_21,
491
+ "\u3010" + toDisplayString(item.name) + "\u3011",
492
+ 1
493
+ /* TEXT */
494
+ )
495
+ ], 8, _hoisted_19),
496
+ createElementVNode("span", _hoisted_22, [
497
+ createVNode(unref(ElButton), {
498
+ link: "",
499
+ type: "danger",
500
+ icon: unref(RefreshLeft),
501
+ title: unref(t)("plus.queryFilter.revoke"),
502
+ onClick: withModifiers(($event) => revokeShare(item), ["stop"])
503
+ }, null, 8, ["icon", "title", "onClick"])
504
+ ])
505
+ ]);
506
+ }),
507
+ 128
508
+ /* KEYED_FRAGMENT */
509
+ ))
510
+ ]))
511
+ ],
512
+ 64
513
+ /* STABLE_FRAGMENT */
514
+ ))
515
+ ])
516
+ ])
517
+ ]),
518
+ _: 1
519
+ /* STABLE */
520
+ }, 8, ["visible"]),
521
+ createVNode(unref(ElDialog), {
522
+ modelValue: saveVisible.value,
523
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => saveVisible.value = $event),
524
+ title: unref(t)("plus.queryFilter.nameTitle"),
525
+ width: "420px",
526
+ "append-to-body": "",
527
+ "append-to": "body"
528
+ }, {
529
+ footer: withCtx(() => [
530
+ createVNode(unref(ElButton), {
531
+ type: "primary",
532
+ loading: saving.value,
533
+ onClick: confirmSave
534
+ }, {
535
+ default: withCtx(() => [
536
+ createTextVNode(
537
+ toDisplayString(unref(t)("plus.dialog.confirmText")),
538
+ 1
539
+ /* TEXT */
540
+ )
541
+ ]),
542
+ _: 1
543
+ /* STABLE */
544
+ }, 8, ["loading"]),
545
+ createVNode(unref(ElButton), {
546
+ onClick: _cache[4] || (_cache[4] = ($event) => saveVisible.value = false)
547
+ }, {
548
+ default: withCtx(() => [
549
+ createTextVNode(
550
+ toDisplayString(unref(t)("plus.dialog.cancelText")),
551
+ 1
552
+ /* TEXT */
553
+ )
554
+ ]),
555
+ _: 1
556
+ /* STABLE */
557
+ })
558
+ ]),
559
+ default: withCtx(() => [
560
+ createVNode(unref(ElForm), {
561
+ onSubmit: withModifiers(confirmSave, ["prevent"])
562
+ }, {
563
+ default: withCtx(() => [
564
+ createVNode(unref(ElFormItem), {
565
+ label: unref(t)("plus.queryFilter.nameTitle"),
566
+ required: ""
567
+ }, {
568
+ default: withCtx(() => [
569
+ createVNode(unref(ElInput), {
570
+ modelValue: saveName.value,
571
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => saveName.value = $event),
572
+ maxlength: "30",
573
+ placeholder: unref(t)("plus.queryFilter.namePlaceholder")
574
+ }, null, 8, ["modelValue", "placeholder"])
575
+ ]),
576
+ _: 1
577
+ /* STABLE */
578
+ }, 8, ["label"])
579
+ ]),
580
+ _: 1
581
+ /* STABLE */
582
+ })
583
+ ]),
584
+ _: 1
585
+ /* STABLE */
586
+ }, 8, ["modelValue", "title"]),
587
+ createVNode(unref(ElDialog), {
588
+ modelValue: shareVisible.value,
589
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => shareVisible.value = $event),
590
+ title: unref(t)("plus.queryFilter.shareTitle"),
591
+ width: "480px",
592
+ "append-to-body": "",
593
+ "append-to": "body"
594
+ }, {
595
+ footer: withCtx(() => [
596
+ createVNode(unref(ElButton), {
597
+ onClick: _cache[7] || (_cache[7] = ($event) => shareVisible.value = false)
598
+ }, {
599
+ default: withCtx(() => [
600
+ createTextVNode(
601
+ toDisplayString(unref(t)("plus.dialog.cancelText")),
602
+ 1
603
+ /* TEXT */
604
+ )
605
+ ]),
606
+ _: 1
607
+ /* STABLE */
608
+ }),
609
+ createVNode(unref(ElButton), {
610
+ type: "primary",
611
+ onClick: confirmShare
612
+ }, {
613
+ default: withCtx(() => [
614
+ createTextVNode(
615
+ toDisplayString(unref(t)("plus.dialog.confirmText")),
616
+ 1
617
+ /* TEXT */
618
+ )
619
+ ]),
620
+ _: 1
621
+ /* STABLE */
622
+ })
623
+ ]),
624
+ default: withCtx(() => [
625
+ createVNode(unref(ElSelect), {
626
+ modelValue: shareUserIds.value,
627
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => shareUserIds.value = $event),
628
+ multiple: "",
629
+ filterable: "",
630
+ remote: "",
631
+ "remote-method": remoteSearchUsers,
632
+ placeholder: unref(t)("plus.queryFilter.sharePlaceholder"),
633
+ style: { "width": "100%" }
634
+ }, {
635
+ default: withCtx(() => [
636
+ (openBlock(true), createElementBlock(
637
+ Fragment,
638
+ null,
639
+ renderList(userOptions.value, (user) => {
640
+ return openBlock(), createBlock(unref(ElOption), {
641
+ key: user.userId,
642
+ label: user.name,
643
+ value: user.userId
644
+ }, null, 8, ["label", "value"]);
645
+ }),
646
+ 128
647
+ /* KEYED_FRAGMENT */
648
+ ))
649
+ ]),
650
+ _: 1
651
+ /* STABLE */
652
+ }, 8, ["modelValue", "placeholder"])
653
+ ]),
654
+ _: 1
655
+ /* STABLE */
656
+ }, 8, ["modelValue", "title"])
657
+ ])) : createCommentVNode("v-if", true);
658
+ };
659
+ }
660
+ });
661
+
662
+ export { _sfc_main as default };
@@ -0,0 +1,4 @@
1
+ import { QueryFilterConditions } from 'yc-pro-components/es/constants';
2
+
3
+ export declare function serializeQueryFilter(fields: Record<string, unknown>, schemaVersion: number): QueryFilterConditions;
4
+ export declare function extractQueryFilterFields(conditions?: QueryFilterConditions | null): Record<string, unknown>;
@@ -0,0 +1,17 @@
1
+ function serializeQueryFilter(fields, schemaVersion) {
2
+ return {
3
+ schemaVersion,
4
+ fields: { ...fields || {} }
5
+ };
6
+ }
7
+ function extractQueryFilterFields(conditions) {
8
+ if (!conditions || typeof conditions !== "object") return {};
9
+ if (conditions.fields && typeof conditions.fields === "object") {
10
+ return { ...conditions.fields };
11
+ }
12
+ const rest = { ...conditions };
13
+ delete rest.schemaVersion;
14
+ return rest;
15
+ }
16
+
17
+ export { extractQueryFilterFields, serializeQueryFilter };
@@ -2,3 +2,4 @@ export * from './page';
2
2
  export * from './form';
3
3
  export * from './display-item';
4
4
  export * from './dict';
5
+ export * from './query-filter';