@skyfox2000/webui 1.0.14 → 1.2.1

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 (162) hide show
  1. package/lib/assets/modules/file-upload-CBUcsUnR.js +170 -0
  2. package/lib/assets/modules/form-validate-CgX7aR7T.js +297 -0
  3. package/lib/assets/modules/index-Civhd8xG.js +112 -0
  4. package/lib/assets/modules/index-DQMdt51R.js +726 -0
  5. package/lib/assets/modules/{index-BEWJ_qAH.js → index-DmWrkTXX.js} +1 -1
  6. package/lib/assets/modules/{menuTabs-BXdbFZor.js → menuTabs-BRYvFWA-.js} +131 -121
  7. package/lib/assets/modules/settingInfo-BZakNKIN.js +999 -0
  8. package/lib/assets/modules/uploadList-B7XoxGOh.js +278 -0
  9. package/lib/components/common/icon/index.vue.d.ts +1 -1
  10. package/lib/components/content/dialog/index.vue.d.ts +1 -1
  11. package/lib/components/content/drawer/index.vue.d.ts +1 -1
  12. package/lib/components/content/form/index.vue.d.ts +1 -1
  13. package/lib/components/content/search/index.vue.d.ts +1 -1
  14. package/lib/components/content/table/index.vue.d.ts +1 -1
  15. package/lib/components/content/table/tableOperate.vue.d.ts +1 -1
  16. package/lib/components/content/toolbar/icontool.vue.d.ts +1 -1
  17. package/lib/components/content/toolbar/index.vue.d.ts +1 -1
  18. package/lib/components/content/tree/index.vue.d.ts +1 -1
  19. package/lib/components/form/transfer/transferTable.vue.d.ts +1 -1
  20. package/lib/components/form/treeSelect/index.vue.d.ts +1 -1
  21. package/lib/components/form/upload/uploadList.vue.d.ts +1 -1
  22. package/lib/const/options.d.ts +32 -0
  23. package/lib/directives/enter-submit.d.ts +4 -0
  24. package/lib/directives/index.d.ts +2 -0
  25. package/lib/directives/permission.d.ts +5 -0
  26. package/lib/es/AceEditor/index.js +9 -8
  27. package/lib/es/BasicLayout/index.js +28 -24
  28. package/lib/es/Error403/index.js +15 -10
  29. package/lib/es/Error404/index.js +15 -10
  30. package/lib/es/ExcelForm/index.js +380 -175
  31. package/lib/es/UploadForm/index.js +23 -20
  32. package/lib/index.d.ts +43 -2
  33. package/lib/router/index.d.ts +16 -0
  34. package/lib/stores/appInfo.d.ts +34 -0
  35. package/lib/stores/hostInfo.d.ts +9 -0
  36. package/lib/stores/pageInfo.d.ts +18 -0
  37. package/lib/stores/pinia.d.ts +3 -0
  38. package/lib/stores/settingInfo.d.ts +8 -0
  39. package/lib/stores/userInfo.d.ts +21 -0
  40. package/lib/typings/data.d.ts +80 -0
  41. package/lib/typings/form.d.ts +171 -0
  42. package/lib/typings/menu.d.ts +7 -0
  43. package/lib/typings/option.d.ts +175 -0
  44. package/lib/typings/page.d.ts +69 -0
  45. package/lib/typings/table.d.ts +181 -0
  46. package/lib/typings/tools.d.ts +130 -0
  47. package/lib/typings/tree.d.ts +72 -0
  48. package/lib/typings/upload.d.ts +161 -0
  49. package/lib/typings/urls.d.ts +69 -0
  50. package/lib/utils/cache.d.ts +23 -0
  51. package/lib/utils/data.d.ts +6 -0
  52. package/lib/utils/download.d.ts +4 -0
  53. package/lib/utils/eventbus.d.ts +16 -0
  54. package/lib/utils/export-table.d.ts +12 -0
  55. package/lib/utils/file-upload.d.ts +15 -0
  56. package/lib/utils/form-excel.d.ts +30 -0
  57. package/lib/utils/form-validate.d.ts +29 -0
  58. package/lib/utils/form.d.ts +9 -0
  59. package/lib/utils/icon-loader.d.ts +125 -0
  60. package/lib/utils/isEmpty.d.ts +1 -0
  61. package/lib/utils/main-openapis.d.ts +9 -0
  62. package/lib/utils/menu.d.ts +6 -0
  63. package/lib/utils/options.d.ts +10 -0
  64. package/lib/utils/page.d.ts +25 -0
  65. package/lib/utils/table.d.ts +21 -0
  66. package/lib/utils/tools.d.ts +18 -0
  67. package/lib/utils/tree.d.ts +3 -0
  68. package/lib/vite-env.d.ts +8 -0
  69. package/lib/webui.css +1 -1
  70. package/lib/webui.es.js +890 -724
  71. package/package.json +7 -6
  72. package/src/components/common/icon/appicon.vue +1 -1
  73. package/src/components/common/icon/fullscreen.vue +2 -1
  74. package/src/components/common/icon/index.vue +1 -1
  75. package/src/components/common/icon/layoutIcon.vue +1 -1
  76. package/src/components/common/icon/projectIcon.vue +1 -1
  77. package/src/components/common/icon/toolIcon.vue +1 -1
  78. package/src/components/content/dialog/excelForm.vue +2 -2
  79. package/src/components/content/dialog/index.vue +1 -1
  80. package/src/components/content/dialog/uploadForm.vue +7 -6
  81. package/src/components/content/drawer/index.vue +43 -18
  82. package/src/components/content/form/formItem.vue +1 -1
  83. package/src/components/content/form/index.vue +1 -1
  84. package/src/components/content/search/index.vue +1 -1
  85. package/src/components/content/search/searchItem.vue +1 -1
  86. package/src/components/content/table/index.vue +3 -3
  87. package/src/components/content/table/tableOperate.vue +2 -2
  88. package/src/components/content/toolbar/icontool.vue +2 -2
  89. package/src/components/content/toolbar/index.vue +3 -2
  90. package/src/components/content/tree/index.vue +1 -1
  91. package/src/components/error/error403.vue +2 -2
  92. package/src/components/error/error404.vue +2 -2
  93. package/src/components/form/autoComplete/index.vue +1 -1
  94. package/src/components/form/cascader/index.vue +1 -2
  95. package/src/components/form/checkbox/index.vue +11 -5
  96. package/src/components/form/datePicker/index.vue +1 -1
  97. package/src/components/form/input/index.vue +1 -1
  98. package/src/components/form/input/inputNumber.vue +1 -1
  99. package/src/components/form/input/inputPassword.vue +1 -1
  100. package/src/components/form/radio/index.vue +1 -1
  101. package/src/components/form/radio/radioStatus.vue +1 -1
  102. package/src/components/form/rangePicker/index.vue +1 -1
  103. package/src/components/form/select/index.vue +1 -1
  104. package/src/components/form/switch/index.vue +7 -3
  105. package/src/components/form/textarea/index.vue +1 -1
  106. package/src/components/form/transfer/index.vue +1 -1
  107. package/src/components/form/transfer/transferTable.vue +42 -22
  108. package/src/components/form/treeSelect/index.vue +2 -3
  109. package/src/components/form/upload/uploadList.vue +1 -1
  110. package/src/components/layout/breadcrumb/index.vue +1 -1
  111. package/src/components/layout/header/headerExits.vue +1 -1
  112. package/src/components/layout/header/index.vue +1 -1
  113. package/src/components/layout/header/user.vue +2 -1
  114. package/src/components/layout/menu/index.vue +9 -3
  115. package/src/components/layout/menu/menuTabs.vue +10 -12
  116. package/src/components/layout/page/basicLayout.vue +1 -1
  117. package/src/const/options.ts +114 -0
  118. package/src/directives/enter-submit.ts +13 -0
  119. package/src/directives/index.ts +26 -0
  120. package/src/directives/permission.ts +144 -0
  121. package/src/index.ts +202 -0
  122. package/src/router/index.ts +196 -0
  123. package/src/stores/appInfo.ts +471 -0
  124. package/src/stores/hostInfo.ts +117 -0
  125. package/src/stores/pageInfo.ts +131 -0
  126. package/src/stores/pinia.ts +10 -0
  127. package/src/stores/settingInfo.ts +53 -0
  128. package/src/stores/userInfo.ts +392 -0
  129. package/src/typings/data.d.ts +81 -0
  130. package/src/typings/form.d.ts +172 -0
  131. package/src/typings/menu.d.ts +7 -0
  132. package/src/typings/option.d.ts +177 -0
  133. package/src/typings/page.d.ts +70 -0
  134. package/src/typings/table.d.ts +182 -0
  135. package/src/typings/tools.d.ts +131 -0
  136. package/src/typings/tree.d.ts +73 -0
  137. package/src/typings/upload.d.ts +162 -0
  138. package/src/typings/urls.d.ts +70 -0
  139. package/src/utils/cache.ts +175 -0
  140. package/src/utils/data.ts +189 -0
  141. package/src/utils/download.ts +80 -0
  142. package/src/utils/eventbus.ts +78 -0
  143. package/src/utils/export-table.ts +155 -0
  144. package/src/utils/file-upload.ts +304 -0
  145. package/src/utils/form-excel.ts +523 -0
  146. package/src/utils/form-validate.ts +368 -0
  147. package/src/utils/form.ts +188 -0
  148. package/src/utils/icon-loader.ts +412 -0
  149. package/src/utils/isEmpty.ts +18 -0
  150. package/src/utils/main-openapis.ts +72 -0
  151. package/src/utils/menu.ts +89 -0
  152. package/src/utils/options.ts +324 -0
  153. package/src/utils/page.ts +262 -0
  154. package/src/utils/table.ts +274 -0
  155. package/src/utils/tools.ts +362 -0
  156. package/src/utils/tree.ts +28 -0
  157. package/tsconfig.json +1 -8
  158. package/vite.config.ts +7 -4
  159. package/lib/assets/modules/index-BahGnrAq.js +0 -415
  160. package/lib/assets/modules/index-BoKIa2sr.js +0 -109
  161. package/lib/assets/modules/index-D47Ci-T3.js +0 -107
  162. package/lib/assets/modules/uploadList-Dzlg47V0.js +0 -182
@@ -0,0 +1,726 @@
1
+ var ie = Object.defineProperty;
2
+ var ue = (e, l, a) => l in e ? ie(e, l, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[l] = a;
3
+ var Y = (e, l, a) => ue(e, typeof l != "symbol" ? l + "" : l, a);
4
+ import E from "vue-m-message";
5
+ import { ResStatus as Z, fieldMapping as oe, httpPost as ce, parseFieldTemplate as fe } from "@skyfox2000/fapi";
6
+ import { r as ee, f as q, b as de, P as ve, a as I, i as H } from "./form-validate-CgX7aR7T.js";
7
+ import { O as pe, a as me } from "./settingInfo-BZakNKIN.js";
8
+ import { combineParams as ye } from "@skyfox2000/microbase";
9
+ import { watch as N, ref as S, inject as he, defineComponent as $, useAttrs as j, onMounted as B, onUnmounted as V, createElementBlock as x, openBlock as b, createVNode as R, unref as h, mergeProps as P, withCtx as F, createCommentVNode as _, Fragment as w, renderList as z, createBlock as G, normalizeClass as ae, createTextVNode as W, toDisplayString as T, createElementVNode as ge } from "vue";
10
+ import { AutoComplete as be, CheckboxGroup as Se, Checkbox as xe, RadioGroup as Oe, Radio as ke, Select as Me, SelectOption as Ne } from "ant-design-vue";
11
+ import "async-validator";
12
+ import "dayjs";
13
+ const U = {
14
+ /**
15
+ * 自动接口加载数据
16
+ * - 默认为true
17
+ */
18
+ autoload: {
19
+ type: Boolean,
20
+ required: !1,
21
+ default: !0
22
+ },
23
+ /**
24
+ * 是否显示全部选项
25
+ * - 默认为false
26
+ */
27
+ all: {
28
+ type: Boolean,
29
+ required: !1,
30
+ default: !1
31
+ },
32
+ /**
33
+ * 选择项数据
34
+ */
35
+ data: {
36
+ type: Array,
37
+ required: !1
38
+ },
39
+ /**
40
+ * 字段转换控制
41
+ * - Key:目的字段
42
+ * - Value:源字段,支持模板 ${}
43
+ */
44
+ fieldMap: {
45
+ type: Object,
46
+ required: !1
47
+ },
48
+ /**
49
+ * 接口定义
50
+ */
51
+ url: {
52
+ type: Object,
53
+ required: !1
54
+ },
55
+ /**
56
+ * 接口自定义QOD参数
57
+ */
58
+ params: {
59
+ type: Object,
60
+ required: !1
61
+ },
62
+ /**
63
+ * 返回文字内容或文字内容数组
64
+ */
65
+ labels: {
66
+ type: [String, Number, Array],
67
+ required: !1
68
+ },
69
+ /**
70
+ * 表单数据
71
+ */
72
+ formData: {
73
+ type: Object,
74
+ required: !1
75
+ },
76
+ /**
77
+ * 输出字段转换控制
78
+ * - Key:目的字段
79
+ * - Value:源字段,支持模板 ${}
80
+ */
81
+ outFields: {
82
+ type: Object,
83
+ required: !1
84
+ },
85
+ /**
86
+ * 通过消息重载数据,只允许改变查询条件
87
+ * - eventBus.on(组件限定前缀 +"."+ reloadEvent, { Q参数 } | 数据[])
88
+ * - 数据组仅用于联动显示
89
+ * - 其它情况使用Query参数
90
+ */
91
+ reloadEvent: {
92
+ type: String,
93
+ required: !1
94
+ },
95
+ /**
96
+ * 通过消息触发事件,只允许改变查询条件
97
+ * - eventBus.emit(changeEvent, { Q参数 } | 数据[])
98
+ * - 数据组仅用于联动显示
99
+ * - 其它情况使用Query参数
100
+ */
101
+ changeEvent: {
102
+ type: [String, Array],
103
+ required: !1
104
+ }
105
+ }, Ce = (e) => {
106
+ le(e);
107
+ }, He = (e) => {
108
+ const l = e.page, a = e.formData.value;
109
+ a[e.primaryKey ?? l.primaryKey] = null, le(e);
110
+ }, Le = (e) => {
111
+ e.visible.value = !1;
112
+ }, le = async (e) => {
113
+ var r;
114
+ const l = e.page;
115
+ if (e.isFormSaving.value = !0, ee(e), e.beforeSave && e.beforeSave() === !1)
116
+ return e.isFormSaving.value = !1, Promise.resolve();
117
+ if (e.formRules.value && await q(e), e.ruleResults.value)
118
+ return E.error("提交表单时,验证失败!"), console.error("表单验证失败!", e.ruleResults.value), e.isFormSaving.value = !1, Promise.resolve();
119
+ const a = e.formData.value;
120
+ return de(
121
+ {
122
+ page: l,
123
+ // 转换为AnyControl接口
124
+ reload: (r = e.grid) == null ? void 0 : r.reload
125
+ },
126
+ {
127
+ url: e.saveUrl,
128
+ primaryKey: e.primaryKey ?? l.primaryKey,
129
+ params: {
130
+ Data: a,
131
+ Query: {}
132
+ },
133
+ hideErrorToast: !0,
134
+ // 隐藏自动错误提示,特殊判断控制
135
+ loadingState: e.isFormSaving
136
+ }
137
+ ).then((t) => {
138
+ var s, n;
139
+ if ((t == null ? void 0 : t.status) === Z.SUCCESS)
140
+ E.success("保存成功!"), e.grid && (e.grid.reload.value = !0), e.afterSave && e.afterSave(), e.autoClose !== !1 && (e.visible.value = !1);
141
+ else if (t != null && t.msg && ((s = t == null ? void 0 : t.msg) == null ? void 0 : s.indexOf("Duplicate entry")) > -1) {
142
+ const u = (n = t == null ? void 0 : t.msg) == null ? void 0 : n.match(/Duplicate entry '([^']+)' for key '([^']+)'/);
143
+ if (u && u.length > 2 && u[1] && u[2]) {
144
+ const d = u[1], m = u[2].replace(/Idx_/g, "").split("_"), p = e.formRules.value;
145
+ if (p && m.length > 0) {
146
+ const f = {};
147
+ m.forEach((g) => {
148
+ p[g] && (f[g] = [
149
+ {
150
+ field: g,
151
+ fieldValue: d,
152
+ message: "数据重复"
153
+ }
154
+ ]);
155
+ }), Object.keys(f).length > 0 && (console.error("保存失败!", f), e.ruleResults.value = f);
156
+ }
157
+ E.error(`保存失败!数据 \`${d}\` 已存在!`);
158
+ } else E.error((t == null ? void 0 : t.msg) ?? "保存失败!");
159
+ } else
160
+ E.error((t == null ? void 0 : t.msg) ?? "保存失败!");
161
+ });
162
+ }, ze = (e) => {
163
+ const l = e.grid;
164
+ l && (l.rowData.value = void 0), e && (te(e), e.visible && (e.visible.value = !1), setTimeout(() => {
165
+ e.visible.value = !0;
166
+ }, 1));
167
+ }, Ge = (e, l) => {
168
+ te(e), e.formData.value = { ...e.formData.value, ...l };
169
+ }, te = (e) => {
170
+ e.formData.value = e.default ? JSON.parse(JSON.stringify(e.default)) : {}, ee(e);
171
+ };
172
+ var re = /* @__PURE__ */ ((e) => (e.SelectReload = "Select.Reload", e.RadioReload = "Radio.Reload", e.CheckboxReload = "Checkbox.Reload", e.TreeSelectReload = "TreeSelect.Reload", e.TreeCheckReload = "TreeCheck.Reload", e))(re || {});
173
+ class Ae {
174
+ constructor() {
175
+ Y(this, "listeners", {});
176
+ }
177
+ // 检查事件名是否符合前缀
178
+ isValidPrefix(l) {
179
+ return Object.values(re).some((a) => l.startsWith(a + "."));
180
+ }
181
+ /**
182
+ * 事件订阅
183
+ * @param event 事件名
184
+ * @param listener 处理器
185
+ */
186
+ on(l, a) {
187
+ if (!this.isValidPrefix(l)) {
188
+ console.error(`事件前缀不正确: ${l}`);
189
+ return;
190
+ }
191
+ this.listeners[l] || (this.listeners[l] = []), this.listeners[l].push(a);
192
+ }
193
+ /**
194
+ * 取消订阅事件
195
+ * @param event 事件名
196
+ * @param listener 处理器
197
+ */
198
+ off(l, a) {
199
+ if (!this.isValidPrefix(l)) {
200
+ console.error(`事件前缀不正确: ${l}`);
201
+ return;
202
+ }
203
+ this.listeners[l] && (this.listeners[l] = this.listeners[l].filter((r) => r !== a));
204
+ }
205
+ //
206
+ /**
207
+ * 触发事件
208
+ * @param event 事件名
209
+ * @param args 参数
210
+ */
211
+ emit(l, ...a) {
212
+ if (!this.isValidPrefix(l)) {
213
+ console.error(`事件前缀不正确: ${l}`);
214
+ return;
215
+ }
216
+ this.listeners[l] && this.listeners[l].forEach((r) => r(l, ...a));
217
+ }
218
+ }
219
+ const D = new Ae(), J = (e, l, a, r, t, s) => {
220
+ if (r && l.reloadEvent && (r.reloadHandler = (n, u) => {
221
+ Ee(t, l, u, a);
222
+ }, D.on(l.reloadEvent, r.reloadHandler)), l.data)
223
+ N(
224
+ () => l.data,
225
+ () => {
226
+ X(l, l.data, a, !0);
227
+ },
228
+ { deep: !0, immediate: !0 }
229
+ );
230
+ else if (t && t.url)
231
+ e !== !1 && se(t, l, s ?? {}, a);
232
+ else {
233
+ const n = S(he(ve.LabelText, ""));
234
+ E.error("`" + n.value + "` 未配置选项数据!", {
235
+ duration: 5e3
236
+ });
237
+ }
238
+ }, X = (e, l, a, r) => {
239
+ if (!l || l.length === 0) {
240
+ a.value = [];
241
+ return;
242
+ }
243
+ if (r) {
244
+ const t = {
245
+ ...e.fieldMap
246
+ };
247
+ l = oe(t, l);
248
+ }
249
+ l = JSON.parse(JSON.stringify(l)), e.all && l.unshift({
250
+ label: "全部",
251
+ value: void 0
252
+ }), a.value = l;
253
+ }, Ee = (e, l, a, r) => {
254
+ Array.isArray(a) ? X(l, a, r, !0) : se(e, l, { Query: a }, r);
255
+ }, Q = (e, l) => {
256
+ l && e.reloadEvent && l.reloadHandler && D.off(e.reloadEvent, l.reloadHandler);
257
+ }, se = (e, l, a, r) => {
258
+ const t = ye(e.params, a, l.params);
259
+ Fe(e, l.fieldMap, t).then((s) => {
260
+ X(l, s, r, !1);
261
+ });
262
+ }, Fe = (e, l, a) => {
263
+ const { fieldMap: r, ...t } = e, n = {
264
+ ...{
265
+ url: "",
266
+ cacheTime: 6e4,
267
+ fieldMap: {
268
+ ...l,
269
+ ...e.fieldMap
270
+ }
271
+ },
272
+ ...t
273
+ };
274
+ return n.loadingText = !1, a || (a = {}), a.Query || (a.Query = {}), ce(n, a).then((u) => (u == null ? void 0 : u.status) === Z.SUCCESS && u.data ? u.data : []);
275
+ }, Re = (e, l) => {
276
+ if (e !== void 0)
277
+ return Array.isArray(e) ? l.filter((a) => e.includes(a.value)) : l.find((a) => a.value === e);
278
+ }, L = (e, l, a) => {
279
+ const r = l.split(".");
280
+ let t = e;
281
+ for (let s = 0; s < r.length - 1; s++) {
282
+ const n = r[s];
283
+ t[n] || (t[n] = {}), t = t[n];
284
+ }
285
+ t[r[r.length - 1]] = a;
286
+ }, ne = (e, l, a) => {
287
+ if (a == null) {
288
+ Object.entries(l).forEach(([r]) => {
289
+ L(e, r, a);
290
+ });
291
+ return;
292
+ }
293
+ Array.isArray(a) || Object.entries(l).forEach(([r, t]) => {
294
+ if (t.includes("${")) {
295
+ const s = fe(t, a);
296
+ L(e, r, s);
297
+ } else
298
+ L(e, r, a[t]);
299
+ });
300
+ }, K = (e, l, a, r) => {
301
+ var s;
302
+ r.editorCtrl && ((s = r.errInfo) != null && s.value.errClass) && q(r.editorCtrl);
303
+ const t = Re(l, a.value);
304
+ return e.formData && e.outFields && ne(e.formData, e.outFields, t), e.changeEvent && (Array.isArray(e.changeEvent) ? e.changeEvent.every((n) => {
305
+ D.emit(n, l, t);
306
+ }) : D.emit(e.changeEvent, l, t)), r.inputEmit && r.inputEmit("change", l, t), t;
307
+ }, C = (e) => e === void 0 ? [] : Array.isArray(e) ? e.map((l) => l.label) : [e.label], We = /* @__PURE__ */ $({
308
+ inheritAttrs: !1,
309
+ __name: "index",
310
+ props: {
311
+ ...U,
312
+ autoload: {
313
+ type: Boolean,
314
+ default: !1
315
+ },
316
+ value: {
317
+ type: [String, Number, null, Array],
318
+ default: void 0
319
+ },
320
+ /**
321
+ * 查询字段
322
+ * - 模糊查询
323
+ */
324
+ searchField: {
325
+ type: String
326
+ },
327
+ /**
328
+ * 自定义查询参数
329
+ * - 查询参数
330
+ * - query参数
331
+ */
332
+ onsearch: {
333
+ type: Function
334
+ },
335
+ /**
336
+ * 修改输入数据则自动清空关联数据
337
+ */
338
+ autoClean: {
339
+ type: Boolean,
340
+ default: !0
341
+ }
342
+ },
343
+ emits: ["update:value", "select", "change", "update:labels"],
344
+ setup(e, { emit: l }) {
345
+ var k, o, v;
346
+ const a = e, r = j(), t = S({
347
+ ...a.url,
348
+ url: ((k = a.url) == null ? void 0 : k.url) || "",
349
+ fieldMap: a.fieldMap || ((o = a.url) == null ? void 0 : o.fieldMap),
350
+ params: a.params || ((v = a.url) == null ? void 0 : v.params),
351
+ loadingText: !1
352
+ }), s = S(void 0);
353
+ N(
354
+ () => a.value,
355
+ () => {
356
+ s.value = a.value;
357
+ },
358
+ { immediate: !0 }
359
+ ), N(
360
+ () => s.value,
361
+ (c) => {
362
+ a.autoClean && a.formData && a.outFields && c !== a.value && ne(a.formData, a.outFields, null);
363
+ }
364
+ );
365
+ const n = I(), { editorCtrl: u, errInfo: d, labelText: m } = n, p = l;
366
+ n.inputEmit = p;
367
+ const f = S([]), g = (c) => {
368
+ var M;
369
+ if (f.value = [], c === "") return;
370
+ let i = c.trim(), y = {
371
+ ...t.value.params,
372
+ Query: {
373
+ ...(M = t.value.params) == null ? void 0 : M.Query
374
+ }
375
+ };
376
+ a.searchField && (y.Query[a.searchField] = {
377
+ $like: "%" + i + "%"
378
+ }), a.onsearch && a.onsearch(i, y), J(!0, a, f, n, t.value, y);
379
+ }, O = (c) => {
380
+ const i = K(a, c, f, n);
381
+ p("update:value", c), p("select", c);
382
+ const y = C(i);
383
+ p("update:labels", y), d != null && d.value.errClass && u && q(u);
384
+ };
385
+ return B(() => {
386
+ t.value && !t.value.fieldMap && (t.value.fieldMap = {
387
+ title: "Name",
388
+ label: "Name",
389
+ value: "Name",
390
+ key: "Id"
391
+ });
392
+ }), V(() => {
393
+ Q(a, n);
394
+ }), (c, i) => {
395
+ var y;
396
+ return b(), x("div", null, [
397
+ R(h(be), P({
398
+ value: s.value,
399
+ "onUpdate:value": i[0] || (i[0] = (M) => s.value = M),
400
+ class: [(y = h(d)) == null ? void 0 : y.errClass, "error w-full"],
401
+ options: f.value,
402
+ onSearch: g,
403
+ onSelect: O,
404
+ placeholder: a.url && !a.url.loading ? "请输入并选择" + h(m) : ""
405
+ }, h(r)), null, 16, ["value", "class", "options", "placeholder"])
406
+ ]);
407
+ };
408
+ }
409
+ }), _e = { class: "min-h-[32px] pt-[5px]" }, we = {
410
+ key: 1,
411
+ class: "text-center text-gray-500"
412
+ }, Xe = /* @__PURE__ */ $({
413
+ inheritAttrs: !1,
414
+ __name: "index",
415
+ props: {
416
+ ...U,
417
+ nodata: {
418
+ type: String,
419
+ default: ""
420
+ },
421
+ /**
422
+ * 换行数量
423
+ */
424
+ wrap: {
425
+ type: Number
426
+ },
427
+ disabledItems: {
428
+ type: Array
429
+ }
430
+ },
431
+ emits: ["change", "update:labels"],
432
+ setup(e, { emit: l }) {
433
+ var p, f, g;
434
+ const a = e, r = j(), t = S({
435
+ ...a.url,
436
+ url: ((p = a.url) == null ? void 0 : p.url) || "",
437
+ fieldMap: a.fieldMap || ((f = a.url) == null ? void 0 : f.fieldMap),
438
+ params: a.params || ((g = a.url) == null ? void 0 : g.params),
439
+ loadingText: !1
440
+ }), s = I(), { errInfo: n } = s, u = l;
441
+ s.inputEmit = u;
442
+ const d = S([]), m = (O) => {
443
+ const o = K(a, O, d, s), v = C(o);
444
+ u("update:labels", v);
445
+ };
446
+ return B(() => {
447
+ t.value && !t.value.fieldMap && (t.value.fieldMap = {
448
+ title: "Name",
449
+ label: "Name",
450
+ value: "Id",
451
+ key: "Id"
452
+ }), J(a.autoload, a, d, s, t.value, t.value.params);
453
+ }), V(() => {
454
+ Q(a, s);
455
+ }), (O, k) => (b(), x("div", _e, [
456
+ R(h(Se), P({
457
+ onChange: m,
458
+ class: "w-full mb-[-3px]"
459
+ }, h(r)), {
460
+ default: F(() => [
461
+ d.value.length > 0 ? (b(!0), x(w, { key: 0 }, z(d.value, (o) => {
462
+ var v;
463
+ return b(), G(h(xe), {
464
+ key: o.value,
465
+ value: o.value,
466
+ disabled: o.disabled || o.value && e.disabledItems && e.disabledItems.indexOf(o.value.toString()) > -1,
467
+ class: ae([
468
+ ((v = h(n)) == null ? void 0 : v.errClass) === "error" ? "error !text-red-400" : "",
469
+ "text-nowrap",
470
+ "pb-1",
471
+ e.wrap ? `w-1/${a.wrap}` : ""
472
+ ])
473
+ }, {
474
+ default: F(() => [
475
+ W(T(o.label), 1)
476
+ ]),
477
+ _: 2
478
+ }, 1032, ["value", "disabled", "class"]);
479
+ }), 128)) : e.nodata ? (b(), x("div", we, T(e.nodata), 1)) : _("", !0)
480
+ ]),
481
+ _: 1
482
+ }, 16)
483
+ ]));
484
+ }
485
+ }), Te = { class: "min-h-[32px] pt-1" }, De = {
486
+ key: 1,
487
+ class: "text-center text-gray-500"
488
+ }, Ye = /* @__PURE__ */ $({
489
+ inheritAttrs: !1,
490
+ __name: "index",
491
+ props: {
492
+ ...U,
493
+ value: {
494
+ type: [String, Number, null, Array],
495
+ default: void 0
496
+ },
497
+ nodata: {
498
+ type: String,
499
+ default: "无数据"
500
+ },
501
+ /**
502
+ * 换行数量
503
+ */
504
+ wrap: {
505
+ type: Number
506
+ }
507
+ },
508
+ emits: ["change", "update:value", "update:labels"],
509
+ setup(e, { emit: l }) {
510
+ var g, O, k;
511
+ const a = e, r = j(), t = S({
512
+ ...a.url,
513
+ url: ((g = a.url) == null ? void 0 : g.url) || "",
514
+ fieldMap: a.fieldMap || ((O = a.url) == null ? void 0 : O.fieldMap),
515
+ params: a.params || ((k = a.url) == null ? void 0 : k.params),
516
+ loadingText: !1
517
+ }), s = S(a.value), n = I(), { errInfo: u } = n, d = S([]), m = l;
518
+ n.inputEmit = m, N(
519
+ () => s.value,
520
+ (o) => {
521
+ m("update:value", o);
522
+ }
523
+ );
524
+ const p = (o, v) => {
525
+ if (typeof o == "object" && typeof v == "object") {
526
+ const c = JSON.stringify(o) === JSON.stringify(v);
527
+ return c && (s.value = o), c;
528
+ }
529
+ return o === v;
530
+ }, f = (o) => {
531
+ const v = o.target.value, c = K(a, v, d, n), i = C(c);
532
+ m("update:labels", i);
533
+ };
534
+ return B(() => {
535
+ var o;
536
+ t.value && !t.value.fieldMap && (t.value.fieldMap = {
537
+ label: "Name",
538
+ value: "Id",
539
+ key: "Id"
540
+ }), J(a.autoload, a, d, n, t.value, (o = t.value) == null ? void 0 : o.params);
541
+ }), V(() => {
542
+ Q(a, n);
543
+ }), (o, v) => (b(), x("div", Te, [
544
+ R(h(Oe), P({
545
+ value: s.value,
546
+ "onUpdate:value": v[0] || (v[0] = (c) => s.value = c),
547
+ autocheck: !1,
548
+ onChange: f,
549
+ class: "w-full flex align-items flex-wrap mb-[-3px]"
550
+ }, h(r)), {
551
+ default: F(() => [
552
+ d.value.length > 0 ? (b(!0), x(w, { key: 0 }, z(d.value, (c) => {
553
+ var i;
554
+ return b(), x(w, {
555
+ key: c.value
556
+ }, [
557
+ c.visible !== !1 ? (b(), G(h(ke), {
558
+ key: 0,
559
+ checked: p(c.value, a.value),
560
+ value: c.value,
561
+ class: ae([
562
+ ((i = h(u)) == null ? void 0 : i.errClass) === "error" ? "error !text-red-400" : "",
563
+ "text-nowrap",
564
+ "pb-1",
565
+ e.wrap ? `w-1/${a.wrap}` : ""
566
+ ])
567
+ }, {
568
+ default: F(() => [
569
+ W(T(c.label), 1)
570
+ ]),
571
+ _: 2
572
+ }, 1032, ["checked", "value", "class"])) : _("", !0)
573
+ ], 64);
574
+ }), 128)) : e.nodata ? (b(), x("div", De, T(e.nodata), 1)) : _("", !0)
575
+ ]),
576
+ _: 1
577
+ }, 16, ["value"])
578
+ ]));
579
+ }
580
+ }), qe = {
581
+ key: 0,
582
+ class: "absolute z-10 mt-[5px] mr-[10px] text-[#999] flex items-center"
583
+ }, Ze = /* @__PURE__ */ $({
584
+ inheritAttrs: !1,
585
+ __name: "index",
586
+ props: {
587
+ ...U,
588
+ value: {
589
+ type: [String, Number, Array, null],
590
+ default: void 0
591
+ },
592
+ /**
593
+ * 自动选择第一个选项
594
+ */
595
+ selectFirst: {
596
+ type: Boolean,
597
+ default: !1
598
+ },
599
+ /**
600
+ * 数据源OPTIONS的key
601
+ */
602
+ dataKey: {
603
+ type: String,
604
+ required: !1
605
+ },
606
+ /**
607
+ * 是否显示全部选项
608
+ */
609
+ all: {
610
+ type: Boolean,
611
+ default: !1
612
+ },
613
+ /**
614
+ * 自定义全部选项的值
615
+ * 如果all为true,则显示全部选项
616
+ * 未设置allValue,则默认[0, 1]
617
+ */
618
+ allValue: {
619
+ type: [String, Number, Array],
620
+ required: !1
621
+ }
622
+ },
623
+ emits: ["change", "update:value", "update:labels"],
624
+ setup(e, { emit: l }) {
625
+ var o, v, c;
626
+ const a = e, r = j(), t = S({
627
+ ...a.url,
628
+ url: ((o = a.url) == null ? void 0 : o.url) || "",
629
+ fieldMap: a.fieldMap || ((v = a.url) == null ? void 0 : v.fieldMap),
630
+ params: a.params || ((c = a.url) == null ? void 0 : c.params),
631
+ loadingText: !1
632
+ }), s = I(), { editorCtrl: n, errInfo: u, labelText: d } = s, m = S(void 0), p = l;
633
+ s.inputEmit = p;
634
+ const f = S([]);
635
+ N(
636
+ () => f.value,
637
+ (i) => {
638
+ i.length > 0 && H(a.value) && a.selectFirst ? (m.value = i[0].value, k(i[0].value)) : m.value = a.value === null ? void 0 : a.value;
639
+ }
640
+ );
641
+ const g = S(r.placeholder);
642
+ N(
643
+ () => t.value.loading,
644
+ (i) => {
645
+ i ? g.value = "" : g.value || (g.value = "请选择" + d.value);
646
+ },
647
+ { immediate: !0 }
648
+ );
649
+ const O = S(a.value);
650
+ N(
651
+ () => m.value,
652
+ (i) => {
653
+ if (r.mode === "multiple" && H(i) && H(O.value)) {
654
+ p("update:value", O.value);
655
+ return;
656
+ }
657
+ p("update:value", i);
658
+ }
659
+ );
660
+ const k = (i) => {
661
+ const y = K(a, i, f, s), M = C(y);
662
+ m.value = i, p("update:labels", M), p("change", i), u != null && u.value.errClass && n && q(n);
663
+ };
664
+ return B(() => {
665
+ var i;
666
+ if (t.value && !t.value.fieldMap && (t.value.fieldMap = {
667
+ label: "Name",
668
+ value: "Id",
669
+ key: "Id"
670
+ }), a.dataKey) {
671
+ const y = JSON.parse(JSON.stringify(pe.getOptions(a.dataKey)));
672
+ f.value = y;
673
+ } else J(a.autoload, a, f, s, t.value, (i = t.value) == null ? void 0 : i.params);
674
+ }), V(() => {
675
+ Q(a, s);
676
+ }), (i, y) => {
677
+ var M;
678
+ return b(), x("div", null, [
679
+ a.url && a.url.loading === !0 ? (b(), x("div", qe, [
680
+ R(h(me), { class: "text-[#555] mx-[5px] !ml-[10px] !w-4 !h-4" }),
681
+ y[1] || (y[1] = ge("span", null, "数据加载中...", -1))
682
+ ])) : _("", !0),
683
+ R(h(Me), P({
684
+ class: [(M = h(u)) == null ? void 0 : M.errClass, "w-full"],
685
+ value: m.value,
686
+ "onUpdate:value": y[0] || (y[0] = (A) => m.value = A),
687
+ "allow-clear": !0,
688
+ onChange: k,
689
+ placeholder: g.value,
690
+ "label-in-value": !1
691
+ }, h(r)), {
692
+ default: F(() => [
693
+ (b(!0), x(w, null, z(f.value, (A) => (b(), x(w, {
694
+ key: A.value
695
+ }, [
696
+ A.visible !== !1 ? (b(), G(h(Ne), {
697
+ key: 0,
698
+ value: A.value
699
+ }, {
700
+ default: F(() => [
701
+ W(T(A.label), 1)
702
+ ]),
703
+ _: 2
704
+ }, 1032, ["value"])) : _("", !0)
705
+ ], 64))), 128))
706
+ ]),
707
+ _: 1
708
+ }, 16, ["class", "value", "placeholder"])
709
+ ]);
710
+ };
711
+ }
712
+ });
713
+ export {
714
+ U as O,
715
+ We as _,
716
+ He as a,
717
+ Ce as b,
718
+ ze as c,
719
+ Xe as d,
720
+ Ye as e,
721
+ Ze as f,
722
+ J as l,
723
+ Le as o,
724
+ Ge as s,
725
+ Q as u
726
+ };