general-basic-form 2.0.53 → 2.0.55

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 (35) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +987 -0
  3. package/dist/index.umd.cjs +1 -0
  4. package/dist/style.css +1 -0
  5. package/package.json +14 -3
  6. package/README.assets/image-20210820173738506.png +0 -0
  7. package/script/link.ts +0 -36
  8. package/script/unlink.ts +0 -45
  9. package/src/Descriptions.vue +0 -106
  10. package/src/GeneralBasicForm.vue +0 -277
  11. package/src/InfiniteScrollList.vue +0 -170
  12. package/src/assets/image-20210820173037871.png +0 -0
  13. package/src/assets/logo.png +0 -0
  14. package/src/components/CustomCom/img-mask/index.vue +0 -79
  15. package/src/components/CustomCom/input-graphic-verification/index.vue +0 -82
  16. package/src/components/CustomCom/input-mobile-verification/index.vue +0 -52
  17. package/src/components/CustomCom/input-mobile-verification/verification-button.vue +0 -81
  18. package/src/components/VABasic/input/index.vue +0 -75
  19. package/src/components/VBasic/cascader/index.vue +0 -32
  20. package/src/components/VBasic/checkbox/index.vue +0 -37
  21. package/src/components/VBasic/date-picker/index.vue +0 -31
  22. package/src/components/VBasic/divider/index.vue +0 -53
  23. package/src/components/VBasic/input/index.vue +0 -67
  24. package/src/components/VBasic/input-number/index.vue +0 -31
  25. package/src/components/VBasic/radio/index.vue +0 -37
  26. package/src/components/VBasic/select/index.vue +0 -37
  27. package/src/components/setting.ts +0 -28
  28. package/src/index.ts +0 -30
  29. package/src/injectKey.ts +0 -2
  30. package/src/types/basicFrom.ts +0 -63
  31. package/src/types/componentType.ts +0 -6
  32. package/src/types/componentsProps.ts +0 -18
  33. package/tsconfig.json +0 -14
  34. package/vite.config.js +0 -123
  35. /package/{public → dist}/index.d.ts +0 -0
package/dist/index.js ADDED
@@ -0,0 +1,987 @@
1
+ import { defineComponent as k, inject as y, resolveComponent as d, openBlock as r, createBlock as c, mergeProps as v, withKeys as Z, createSlots as X, renderList as q, withCtx as _, resolveDynamicComponent as w, createCommentVNode as g, ref as b, unref as m, onMounted as ue, createElementBlock as S, computed as M, shallowRef as T, onBeforeUnmount as ce, createTextVNode as D, toDisplayString as E, h as J, normalizeProps as pe, guardReactiveProps as me, Fragment as x, provide as j, resolveDirective as Q, withDirectives as A, renderSlot as K, createVNode as ee, vShow as de, watch as te, createElementVNode as fe } from "vue";
2
+ import { useRoute as ye } from "vue-router";
3
+ const Y = {
4
+ placeholder: "请输入",
5
+ style: "width: 200px",
6
+ clearable: !0
7
+ }, he = {
8
+ style: "width: 227px",
9
+ "start-placeholder": "开始日期",
10
+ "end-placeholder": "结束日期",
11
+ type: "daterange"
12
+ }, ne = {
13
+ placeholder: "请选择",
14
+ filterable: !0,
15
+ clearable: !0,
16
+ style: "width: 200px"
17
+ }, _e = k({
18
+ components: {
19
+ InputArchive: (e) => {
20
+ const { templateEle: t } = e;
21
+ return t();
22
+ }
23
+ },
24
+ props: {
25
+ item: null
26
+ // null就是any
27
+ },
28
+ setup() {
29
+ const e = y("queryParams", {}), t = y("getList"), n = y("size", "default");
30
+ return { queryParams: e, getList: t, size: n };
31
+ },
32
+ data() {
33
+ return {
34
+ inputSetting: {
35
+ ...Y,
36
+ ...this.item.inputSetting,
37
+ ...this.item.setting
38
+ }
39
+ };
40
+ },
41
+ // created() {
42
+ // console.log("new", this.item);
43
+ // console.log("new", this.inputSetting);
44
+ // },
45
+ methods: {
46
+ currentInputComponent() {
47
+ return "input-archive";
48
+ }
49
+ }
50
+ // watch: {
51
+ // item(val) {
52
+ // console.log("item", val);
53
+ // },
54
+ // size(val) {
55
+ // console.log(val);
56
+ // },
57
+ // },
58
+ }), B = (e, t) => {
59
+ const n = e.__vccOpts || e;
60
+ for (const [l, s] of t)
61
+ n[l] = s;
62
+ return n;
63
+ };
64
+ function ge(e, t, n, l, s, u) {
65
+ const a = d("el-input");
66
+ return r(), c(a, v({
67
+ onKeydown: Z(e.getList, ["enter"]),
68
+ modelValue: e.queryParams[e.item.prop],
69
+ "onUpdate:modelValue": t[0] || (t[0] = (i) => e.queryParams[e.item.prop] = i),
70
+ size: e.size
71
+ }, e.inputSetting), X({ _: 2 }, [
72
+ q(e.item.template, (i, o) => ({
73
+ name: o,
74
+ fn: _(() => [
75
+ i ? (r(), c(w(e.currentInputComponent()), {
76
+ key: o,
77
+ templateEle: i
78
+ }, null, 8, ["templateEle"])) : g("", !0)
79
+ ])
80
+ }))
81
+ ]), 1040, ["onKeydown", "modelValue", "size"]);
82
+ }
83
+ const U = /* @__PURE__ */ B(_e, [["render", ge]]), ve = /* @__PURE__ */ k({
84
+ __name: "index",
85
+ props: {
86
+ item: {}
87
+ },
88
+ setup(e) {
89
+ const t = y("queryParams", {}), n = y("size"), l = b({
90
+ ...Y,
91
+ ...e.item.inputSetting,
92
+ ...e.item.setting
93
+ });
94
+ return (s, u) => {
95
+ const a = d("el-input-number");
96
+ return r(), c(a, v({
97
+ modelValue: m(t)[s.item.prop],
98
+ "onUpdate:modelValue": u[0] || (u[0] = (i) => m(t)[s.item.prop] = i),
99
+ size: m(n)
100
+ }, l.value), null, 16, ["modelValue", "size"]);
101
+ };
102
+ }
103
+ }), be = k({
104
+ components: {
105
+ InputArchive: (e) => {
106
+ const { templateEle: t } = e;
107
+ return t();
108
+ }
109
+ },
110
+ props: {
111
+ item: null
112
+ // null就是any
113
+ },
114
+ setup() {
115
+ const e = y("queryParams", {}), t = y("getList", () => {
116
+ }), n = y("size", "default"), s = y("Form").useInjectFormItemContext();
117
+ return { queryParams: e, getList: t, size: n, formItemContext: s };
118
+ },
119
+ data() {
120
+ return {
121
+ inputSetting: {
122
+ ...Y,
123
+ ...this.item.inputSetting,
124
+ ...this.item.setting
125
+ }
126
+ };
127
+ },
128
+ // created() {
129
+ // console.log("new", this.item);
130
+ // console.log("new", this.inputSetting);
131
+ // },
132
+ methods: {
133
+ currentInputComponent() {
134
+ return "input-archive";
135
+ },
136
+ onInputChange(e) {
137
+ this.queryParams[this.item.prop] = e.target.value, this.formItemContext.onFieldChange();
138
+ }
139
+ }
140
+ // watch: {
141
+ // item(val) {
142
+ // console.log("item", val);
143
+ // },
144
+ // size(val) {
145
+ // console.log(val);
146
+ // },
147
+ // },
148
+ });
149
+ function ke(e, t, n, l, s, u) {
150
+ const a = d("a-input");
151
+ return r(), c(a, v({
152
+ onKeydown: Z(e.getList, ["enter"]),
153
+ onChange: e.onInputChange,
154
+ value: e.queryParams[e.item.prop],
155
+ size: e.size
156
+ }, e.inputSetting), X({ _: 2 }, [
157
+ q(e.item.template, (i, o) => ({
158
+ name: o,
159
+ fn: _(() => [
160
+ i ? (r(), c(w(e.currentInputComponent()), {
161
+ key: o,
162
+ templateEle: i
163
+ }, null, 8, ["templateEle"])) : g("", !0)
164
+ ])
165
+ }))
166
+ ]), 1040, ["onKeydown", "onChange", "value", "size"]);
167
+ }
168
+ const oe = /* @__PURE__ */ B(be, [["render", ke]]), re = Symbol(), Se = /* @__PURE__ */ k({
169
+ __name: "index",
170
+ props: {
171
+ imgSrc: {}
172
+ },
173
+ setup(e) {
174
+ const t = b();
175
+ return ue(() => {
176
+ const n = new Image(), l = [], s = 8, u = 8;
177
+ let a = 0, i = 0;
178
+ const o = 300, f = t.value, $ = f.getContext("2d");
179
+ n.onload = function() {
180
+ f.width = n.width, f.height = n.height, i = Math.floor(n.width / s), a = Math.floor(n.height / u), P(), C();
181
+ }, n.src = e.imgSrc;
182
+ const P = () => {
183
+ for (let z = 0; z < u; z++)
184
+ for (let h = 0; h < s; h++)
185
+ l.push({
186
+ x: i * h,
187
+ y: a * z,
188
+ offsetX: (Math.random() - 0.5) * o,
189
+ offsetY: (Math.random() - 0.5) * o
190
+ });
191
+ }, C = () => {
192
+ $.clearRect(0, 0, f.width, f.height);
193
+ let z = !0;
194
+ l.forEach((h, F) => {
195
+ $.drawImage(n, h.x, h.y, i, a, h.x + h.offsetX, h.y + h.offsetY, i, a), Math.abs(h.offsetX) > 0.5 && (z = !1, h.offsetX *= 0.95), Math.abs(h.offsetY) > 0.5 && (h.offsetY *= 0.95, z = !1);
196
+ }), z ? setTimeout(() => {
197
+ P(), C();
198
+ }, 300) : requestAnimationFrame(C);
199
+ };
200
+ }), (n, l) => (r(), S("canvas", {
201
+ ref_key: "loadingCanvas",
202
+ ref: t
203
+ }, null, 512));
204
+ }
205
+ }), $e = { class: "input-graphic-verification" }, Ie = ["src", "alt"], Pe = /* @__PURE__ */ k({
206
+ __name: "index",
207
+ props: {
208
+ item: {},
209
+ componentType: { default: "Element Plus" },
210
+ loading: { type: Boolean, default: !1 }
211
+ },
212
+ setup(e) {
213
+ const {
214
+ graphicSrc: t = "",
215
+ graphicAlt: n = "",
216
+ getGraphic: l = () => {
217
+ },
218
+ key: s
219
+ } = e.item, { formLoading: u } = y(re, !1), a = M(() => (u == null ? void 0 : u.value) || e.loading), i = async () => {
220
+ l && !(a != null && a.value) && await l();
221
+ }, o = T(U);
222
+ switch (e.componentType) {
223
+ case "Element Plus":
224
+ o.value = U;
225
+ break;
226
+ case "Ant Design Vue":
227
+ o.value = oe;
228
+ break;
229
+ }
230
+ return (f, $) => (r(), S("div", $e, [
231
+ (r(), c(w(o.value), {
232
+ item: f.item,
233
+ class: "input"
234
+ }, null, 8, ["item"])),
235
+ a.value ? (r(), c(Se, {
236
+ key: 0,
237
+ class: "graphic",
238
+ imgSrc: m(t)
239
+ }, null, 8, ["imgSrc"])) : (r(), S("img", {
240
+ key: 1,
241
+ class: "graphic",
242
+ onClick: i,
243
+ src: m(t),
244
+ alt: m(n) || `${m(s)}`
245
+ }, null, 8, Ie))
246
+ ]));
247
+ }
248
+ });
249
+ const se = /* @__PURE__ */ B(Pe, [["__scopeId", "data-v-f76fdd37"]]), R = "获取验证码", ze = 60, Ve = /* @__PURE__ */ k({
250
+ __name: "verification-button",
251
+ props: {
252
+ getSmscode: { type: Function },
253
+ componentType: { default: "Element Plus" },
254
+ item: {}
255
+ },
256
+ setup(e) {
257
+ const t = b(R), n = b(null), l = M(() => t.value === R), s = T("el-button");
258
+ switch (e.componentType) {
259
+ case "Element Plus":
260
+ s.value = "el-button";
261
+ break;
262
+ case "Ant Design Vue":
263
+ s.value = "a-button";
264
+ break;
265
+ }
266
+ const u = () => {
267
+ n && (clearInterval(n.value), n.value = null, t.value = R);
268
+ }, a = async () => {
269
+ if (t.value === R)
270
+ if (t.value = ze, n.value = setInterval(() => {
271
+ if (Number(t.value) <= 0 || !t.value) {
272
+ u();
273
+ return;
274
+ } else
275
+ t.value = Number(t.value) - 1;
276
+ }, 1e3), e.getSmscode)
277
+ await e.getSmscode() === !1 && u();
278
+ else
279
+ return;
280
+ };
281
+ ce(() => {
282
+ u();
283
+ });
284
+ const i = { ...e.item.buttonSetting };
285
+ return (o, f) => (r(), c(w(s.value), v({
286
+ class: "verifiaction-button",
287
+ style: {
288
+ color: l.value ? "var(--color-primary, #409EFF)" : "var(--text-color-placeholder, #A8ABB2)",
289
+ cursor: l.value ? "pointer" : "default"
290
+ },
291
+ onClick: a
292
+ }, i), {
293
+ default: _(() => [
294
+ D(E(l.value ? R : t.value + "s"), 1)
295
+ ]),
296
+ _: 1
297
+ }, 16, ["style"]));
298
+ }
299
+ });
300
+ const H = /* @__PURE__ */ B(Ve, [["__scopeId", "data-v-f5cd774b"]]), ie = /* @__PURE__ */ k({
301
+ __name: "index",
302
+ props: {
303
+ item: {},
304
+ componentType: { default: "Element Plus" }
305
+ },
306
+ setup(e) {
307
+ const t = e.item, n = T(U);
308
+ switch (e.componentType) {
309
+ case "Element Plus":
310
+ n.value = U, t.template = {
311
+ append: () => J(H, {
312
+ getSmscode: t.getSmscode,
313
+ item: e.item
314
+ })
315
+ };
316
+ break;
317
+ case "Ant Design Vue":
318
+ n.value = oe, t.template = {
319
+ suffix: () => J(H, {
320
+ getSmscode: t.getSmscode,
321
+ item: e.item
322
+ })
323
+ };
324
+ break;
325
+ }
326
+ return (l, s) => (r(), c(w(n.value), {
327
+ item: m(t),
328
+ class: "input"
329
+ }, null, 8, ["item"]));
330
+ }
331
+ }), qe = k({
332
+ components: {
333
+ slotArchive: (e) => {
334
+ const { templateEle: t } = e;
335
+ return t();
336
+ }
337
+ },
338
+ props: {
339
+ item: null
340
+ // null就是any
341
+ },
342
+ setup() {
343
+ },
344
+ data() {
345
+ return {
346
+ dividerSetting: {
347
+ ...this.item.dividerSetting,
348
+ ...this.item.setting
349
+ }
350
+ };
351
+ },
352
+ methods: {
353
+ currentInputComponent() {
354
+ return "slot-archive";
355
+ }
356
+ }
357
+ });
358
+ function Ce(e, t, n, l, s, u) {
359
+ const a = d("el-divider");
360
+ return r(), c(a, pe(me(e.dividerSetting)), X({ _: 2 }, [
361
+ q(e.item.template, (i, o) => ({
362
+ name: o,
363
+ fn: _(() => [
364
+ i ? (r(), c(w(e.currentInputComponent()), {
365
+ key: o,
366
+ templateEle: i
367
+ }, null, 8, ["templateEle"])) : g("", !0)
368
+ ])
369
+ }))
370
+ ]), 1040);
371
+ }
372
+ const we = /* @__PURE__ */ B(qe, [["render", Ce]]), Le = /* @__PURE__ */ k({
373
+ __name: "index",
374
+ props: {
375
+ item: {}
376
+ },
377
+ setup(e) {
378
+ const t = y("queryParams", {}), n = y("size"), l = b({
379
+ ...e.item.radioGroupSetting,
380
+ ...e.item.setting
381
+ });
382
+ return (s, u) => {
383
+ const a = d("el-radio"), i = d("el-radio-group");
384
+ return r(), c(i, v({
385
+ modelValue: m(t)[s.item.prop],
386
+ "onUpdate:modelValue": u[0] || (u[0] = (o) => m(t)[s.item.prop] = o),
387
+ size: m(n)
388
+ }, l.value), {
389
+ default: _(() => [
390
+ (r(!0), S(x, null, q(s.item.option || [], (o) => (r(), c(a, v({
391
+ size: m(n),
392
+ key: o.value,
393
+ ref_for: !0
394
+ }, o), {
395
+ default: _(() => [
396
+ D(E(o.label), 1)
397
+ ]),
398
+ _: 2
399
+ }, 1040, ["size"]))), 128))
400
+ ]),
401
+ _: 1
402
+ }, 16, ["modelValue", "size"]);
403
+ };
404
+ }
405
+ }), De = /* @__PURE__ */ k({
406
+ __name: "index",
407
+ props: {
408
+ item: {}
409
+ },
410
+ setup(e) {
411
+ const t = y("queryParams", {}), n = y("size"), l = b({
412
+ ...e.item.checkboxGroupSetting,
413
+ ...e.item.setting
414
+ });
415
+ return (s, u) => {
416
+ const a = d("el-checkbox"), i = d("el-checkbox-group");
417
+ return r(), c(i, v({
418
+ modelValue: m(t)[s.item.prop],
419
+ "onUpdate:modelValue": u[0] || (u[0] = (o) => m(t)[s.item.prop] = o),
420
+ size: m(n)
421
+ }, l.value), {
422
+ default: _(() => [
423
+ (r(!0), S(x, null, q(s.item.option || [], (o) => (r(), c(a, v({
424
+ size: m(n),
425
+ key: o.value,
426
+ ref_for: !0
427
+ }, o), {
428
+ default: _(() => [
429
+ D(E(o.label), 1)
430
+ ]),
431
+ _: 2
432
+ }, 1040, ["size"]))), 128))
433
+ ]),
434
+ _: 1
435
+ }, 16, ["modelValue", "size"]);
436
+ };
437
+ }
438
+ }), xe = /* @__PURE__ */ k({
439
+ __name: "index",
440
+ props: {
441
+ item: {}
442
+ },
443
+ setup(e) {
444
+ const t = y("queryParams", {}), n = y("size"), l = b({
445
+ ...he,
446
+ ...e.item.datePackerSetting,
447
+ ...e.item.setting
448
+ });
449
+ return (s, u) => {
450
+ const a = d("el-date-picker");
451
+ return r(), c(a, v({
452
+ modelValue: m(t)[s.item.prop],
453
+ "onUpdate:modelValue": u[0] || (u[0] = (i) => m(t)[s.item.prop] = i),
454
+ size: m(n)
455
+ }, l.value), null, 16, ["modelValue", "size"]);
456
+ };
457
+ }
458
+ }), Be = /* @__PURE__ */ k({
459
+ __name: "index",
460
+ props: {
461
+ item: {}
462
+ },
463
+ setup(e) {
464
+ const t = y("queryParams", {}), n = y("size"), l = b({
465
+ ...ne,
466
+ ...e.item.selectSetting,
467
+ ...e.item.setting
468
+ });
469
+ return (s, u) => {
470
+ const a = d("el-option"), i = d("el-select");
471
+ return r(), c(i, v({
472
+ modelValue: m(t)[s.item.prop],
473
+ "onUpdate:modelValue": u[0] || (u[0] = (o) => m(t)[s.item.prop] = o),
474
+ size: m(n)
475
+ }, l.value), {
476
+ default: _(() => [
477
+ (r(!0), S(x, null, q(s.item.option || [], (o) => (r(), c(a, v({
478
+ key: o.value,
479
+ ref_for: !0
480
+ }, o), null, 16))), 128))
481
+ ]),
482
+ _: 1
483
+ }, 16, ["modelValue", "size"]);
484
+ };
485
+ }
486
+ }), Fe = /* @__PURE__ */ k({
487
+ __name: "index",
488
+ props: {
489
+ item: {}
490
+ },
491
+ setup(e) {
492
+ const t = y("queryParams", {}), n = y("size"), l = b({
493
+ ...ne,
494
+ ...e.item.selectSetting,
495
+ ...e.item.setting
496
+ });
497
+ return (s, u) => {
498
+ const a = d("el-cascader");
499
+ return r(), c(a, v({
500
+ modelValue: m(t)[s.item.prop],
501
+ "onUpdate:modelValue": u[0] || (u[0] = (i) => m(t)[s.item.prop] = i),
502
+ size: m(n),
503
+ options: s.item.options || []
504
+ }, l.value), null, 16, ["modelValue", "size", "options"]);
505
+ };
506
+ }
507
+ }), Ee = k({
508
+ name: "GeneralBasicForm",
509
+ components: {
510
+ Input: U,
511
+ InputNumber: ve,
512
+ InputGraphicVerification: se,
513
+ InputMobileVerification: ie,
514
+ Divider: we,
515
+ Radio: Le,
516
+ Checkbox: De,
517
+ DatePicker: xe,
518
+ Select: Be,
519
+ Cascader: Fe
520
+ },
521
+ props: {
522
+ showSearch: {
523
+ // 是否展示所有元素
524
+ type: Boolean,
525
+ default: !0
526
+ },
527
+ loading: {
528
+ // 加载动画
529
+ type: Boolean,
530
+ default: !1
531
+ },
532
+ formOnly: {
533
+ // 是否只展示表单不展示按钮
534
+ type: Boolean,
535
+ default: !1
536
+ },
537
+ getList: {
538
+ // 查找数据调用的函数
539
+ type: Function,
540
+ default: () => {
541
+ }
542
+ },
543
+ afterReset: {
544
+ // 在重置按钮点击完后但还没重新请求时触发的的函数
545
+ type: Function,
546
+ default: () => {
547
+ }
548
+ },
549
+ formItem: {
550
+ // 定义表单的数据
551
+ type: Array,
552
+ default: []
553
+ },
554
+ size: {
555
+ // 控制按钮大小
556
+ type: String,
557
+ default: "default"
558
+ },
559
+ labelWidth: {
560
+ // 表单文字宽度
561
+ type: String,
562
+ default: "90px"
563
+ },
564
+ noUrlParameters: {
565
+ // 不接受和不改变url的参数
566
+ type: Boolean,
567
+ default: () => !1
568
+ },
569
+ formData: {
570
+ // 外部传入的表单数据,用于回填
571
+ type: Object,
572
+ default: () => {
573
+ }
574
+ },
575
+ noInputBlank: {
576
+ // 用于判断input框是否校验仅空格
577
+ type: Boolean,
578
+ default: () => !1
579
+ }
580
+ },
581
+ data() {
582
+ return {
583
+ formLoading: this.loading || !1,
584
+ trimRegex: /\S/
585
+ };
586
+ },
587
+ setup(e) {
588
+ const { size: t, noUrlParameters: n, getList: l } = e, s = ye(), u = b({
589
+ ...n ? {} : s == null ? void 0 : s.query
590
+ });
591
+ return j(
592
+ /* 注入名 */
593
+ "queryParams",
594
+ /* 值 */
595
+ u
596
+ ), j(
597
+ /* 注入名 */
598
+ "size",
599
+ /* 值 */
600
+ t
601
+ ), j(
602
+ /* 注入名 */
603
+ "getList",
604
+ /* 值 */
605
+ l
606
+ ), {
607
+ queryParams: u
608
+ };
609
+ },
610
+ watch: {
611
+ formData: {
612
+ handler(e, t) {
613
+ JSON.stringify(e) !== JSON.stringify(t) && (this.queryParams = {
614
+ ...this.noUrlParameters ? {} : this.queryParams,
615
+ ...e
616
+ });
617
+ },
618
+ // watch 默认是懒执行的:仅当数据源变化时,才会执行回调。但在某些场景中,我们希望在创建侦听器时,立即执行一遍回调。举例来说,我们想请求一些初始数据,然后在相关状态更改时重新请求数据。
619
+ // https://cn.vuejs.org/guide/essentials/watchers.html#deep-watchers
620
+ immediate: !0
621
+ // deep: true,
622
+ },
623
+ queryParams: {
624
+ handler(e) {
625
+ this.$emit("update:formData", e);
626
+ },
627
+ deep: !0
628
+ },
629
+ loading(e) {
630
+ this.formLoading !== e && (this.formLoading = e);
631
+ },
632
+ formLoading(e) {
633
+ this.loading !== e && this.$emit("update:loading", e);
634
+ }
635
+ },
636
+ provide() {
637
+ return {
638
+ // 显式提供一个计算属性
639
+ [re]: {
640
+ formLoading: M(() => this.formLoading),
641
+ updateFormLoading: (e) => {
642
+ this.formLoading = e;
643
+ }
644
+ }
645
+ };
646
+ },
647
+ methods: {
648
+ /** 搜索按钮操作 */
649
+ handleQuery() {
650
+ var n;
651
+ const e = { page: 1, limit: 10 }, t = {
652
+ ...(n = this.$route) == null ? void 0 : n.query,
653
+ ...this.queryParams,
654
+ ...e
655
+ };
656
+ this.noUrlParameters || this.$router.push({
657
+ query: { ...t }
658
+ }), this.getList({
659
+ ...t
660
+ });
661
+ },
662
+ /** 重置按钮操作 */
663
+ async resetQuery() {
664
+ var t;
665
+ this.$refs.queryFormRef.resetFields();
666
+ const e = { page: 1 };
667
+ this.noUrlParameters || await this.$router.push({
668
+ query: { ...e }
669
+ }), this.queryParams = {
670
+ ...this.noUrlParameters ? {} : (t = this.$route) == null ? void 0 : t.query
671
+ }, this.afterReset(), this.handleQuery();
672
+ },
673
+ getItemRules(e) {
674
+ const { type: t, rules: n = [] } = e, l = [...n];
675
+ return this.noInputBlank && t === "input" && l.push({
676
+ pattern: this.trimRegex,
677
+ message: "请输入(不能仅输入空格)",
678
+ trigger: "blur"
679
+ }), l;
680
+ }
681
+ }
682
+ });
683
+ function Re(e, t, n, l, s, u) {
684
+ const a = d("Input"), i = d("Radio"), o = d("Select"), f = d("Divider"), $ = d("Cascader"), P = d("Checkbox"), C = d("DatePicker"), z = d("InputNumber"), h = d("InputMobileVerification"), F = d("InputGraphicVerification"), L = d("el-form-item"), G = d("el-button"), N = d("el-form"), I = Q("loading");
685
+ return A((r(), c(N, v({
686
+ model: e.queryParams,
687
+ ref: "queryFormRef",
688
+ inline: "",
689
+ "label-position": "left",
690
+ "label-width": e.labelWidth
691
+ }, e.$attrs), {
692
+ default: _(() => [
693
+ (r(!0), S(x, null, q(e.formItem, (p) => (r(), c(L, {
694
+ label: p.label,
695
+ prop: p.prop,
696
+ key: p.prop,
697
+ rules: e.getItemRules(p)
698
+ }, {
699
+ default: _(() => [
700
+ /^input$/i.test(p.type) ? (r(), c(a, {
701
+ key: 0,
702
+ item: p
703
+ }, null, 8, ["item"])) : g("", !0),
704
+ /^radio$/i.test(p.type) ? (r(), c(i, {
705
+ key: 1,
706
+ item: p
707
+ }, null, 8, ["item"])) : g("", !0),
708
+ /^select$/i.test(p.type) ? (r(), c(o, {
709
+ key: 2,
710
+ item: p
711
+ }, null, 8, ["item"])) : g("", !0),
712
+ /^divider$/i.test(p.type) ? (r(), c(f, {
713
+ key: 3,
714
+ item: p
715
+ }, null, 8, ["item"])) : g("", !0),
716
+ /^cascader$/i.test(p.type) ? (r(), c($, {
717
+ key: 4,
718
+ item: p
719
+ }, null, 8, ["item"])) : g("", !0),
720
+ /^checkbox$/i.test(p.type) ? (r(), c(P, {
721
+ key: 5,
722
+ item: p
723
+ }, null, 8, ["item"])) : g("", !0),
724
+ /^date-picker$/i.test(p.type) ? (r(), c(C, {
725
+ key: 6,
726
+ item: p
727
+ }, null, 8, ["item"])) : g("", !0),
728
+ /^input-number$/i.test(p.type) ? (r(), c(z, {
729
+ key: 7,
730
+ item: p
731
+ }, null, 8, ["item"])) : g("", !0),
732
+ /^form-item-slot$/i.test(p.type) ? K(e.$slots, p.name, { key: 8 }) : g("", !0),
733
+ /^input-mobile-verification$/i.test(p.type) ? (r(), c(h, {
734
+ key: 9,
735
+ item: p
736
+ }, null, 8, ["item"])) : g("", !0),
737
+ /^input-graphic-verification$/i.test(p.type) ? (r(), c(F, {
738
+ item: p,
739
+ key: p.key
740
+ }, null, 8, ["item"])) : g("", !0)
741
+ ]),
742
+ _: 2
743
+ }, 1032, ["label", "prop", "rules"]))), 128)),
744
+ K(e.$slots, "default"),
745
+ e.formOnly ? g("", !0) : (r(), c(L, { key: 0 }, {
746
+ default: _(() => [
747
+ A((r(), c(G, {
748
+ type: "primary",
749
+ size: e.size,
750
+ onClick: e.handleQuery
751
+ }, {
752
+ default: _(() => t[0] || (t[0] = [
753
+ D("查询")
754
+ ])),
755
+ _: 1
756
+ }, 8, ["size", "onClick"])), [
757
+ [I, e.formLoading]
758
+ ]),
759
+ ee(G, {
760
+ size: e.size,
761
+ onClick: e.resetQuery
762
+ }, {
763
+ default: _(() => t[1] || (t[1] = [
764
+ D("重置")
765
+ ])),
766
+ _: 1
767
+ }, 8, ["size", "onClick"])
768
+ ]),
769
+ _: 1
770
+ })),
771
+ K(e.$slots, "behind-the-button")
772
+ ]),
773
+ _: 3
774
+ }, 16, ["model", "label-width"])), [
775
+ [de, e.showSearch]
776
+ ]);
777
+ }
778
+ const Ae = /* @__PURE__ */ B(Ee, [["render", Re]]), Te = ["infinite-scroll-disabled"], Ue = ["infinite-scroll-disabled"], Ge = { class: "checkbox" }, Me = /* @__PURE__ */ k({
779
+ __name: "InfiniteScrollList",
780
+ props: {
781
+ search: {
782
+ type: Function,
783
+ required: !0
784
+ },
785
+ checkbox: {
786
+ type: Boolean,
787
+ required: !1
788
+ },
789
+ id: {
790
+ type: String,
791
+ required: !0
792
+ },
793
+ name: {
794
+ type: String,
795
+ required: !0
796
+ },
797
+ extra: {
798
+ type: null,
799
+ required: !1
800
+ },
801
+ defaultSelection: {
802
+ type: Array,
803
+ required: !1
804
+ }
805
+ },
806
+ setup(e, { expose: t }) {
807
+ const n = e, { search: l, id: s, name: u, extra: a } = n, i = b([]), o = b(1), f = b(!1), $ = b([]), P = b(!1), C = (I, p) => {
808
+ const { i: O } = I;
809
+ return a && a !== "false" ? a(O) : "";
810
+ }, z = (I) => {
811
+ $.value = I.map((p) => typeof p == "object" ? p[s] : p);
812
+ };
813
+ te(
814
+ () => n.defaultSelection,
815
+ (I = [], p = []) => {
816
+ z(I);
817
+ },
818
+ { immediate: !0 }
819
+ );
820
+ const h = () => {
821
+ F(), $.value = [];
822
+ }, F = () => {
823
+ o.value = 1, i.value = [], f.value = !1;
824
+ }, L = async () => {
825
+ if (P.value || f.value)
826
+ return;
827
+ P.value = !0;
828
+ const I = await l(o.value);
829
+ I && I.length > 0 ? (i.value = [...i.value, ...I], o.value += 1) : f.value = !0, P.value = !1;
830
+ }, G = () => {
831
+ F(), L();
832
+ }, N = M(
833
+ () => i.value.filter((I) => $.value.includes(I[s]))
834
+ ) || {};
835
+ return t({
836
+ reset: h,
837
+ lowReset: F,
838
+ loadList: L,
839
+ selectInfo: N,
840
+ list: i,
841
+ ifbottom: f,
842
+ refreshList: G
843
+ }), (I, p) => {
844
+ const O = d("el-checkbox"), ae = d("el-checkbox-group"), W = Q("infinite-scroll"), le = Q("loading");
845
+ return n.checkbox ? A((r(), c(ae, v({
846
+ key: 0,
847
+ modelValue: $.value,
848
+ "onUpdate:modelValue": p[0] || (p[0] = (V) => $.value = V)
849
+ }, n), {
850
+ default: _(() => [
851
+ A((r(), S("ul", {
852
+ class: "list",
853
+ "infinite-scroll-disabled": f.value
854
+ }, [
855
+ (r(!0), S(x, null, q(i.value, (V) => (r(), S("li", {
856
+ key: V[m(s)],
857
+ class: "list-item"
858
+ }, [
859
+ ee(O, {
860
+ value: V[m(s)],
861
+ class: "checkbox"
862
+ }, {
863
+ default: _(() => [
864
+ D(E(V[m(u)]) + " ", 1),
865
+ n.extra ? (r(), c(C, {
866
+ key: 0,
867
+ i: V
868
+ }, null, 8, ["i"])) : g("", !0)
869
+ ]),
870
+ _: 2
871
+ }, 1032, ["value"])
872
+ ]))), 128))
873
+ ], 8, Te)), [
874
+ [W, L]
875
+ ])
876
+ ]),
877
+ _: 1
878
+ }, 16, ["modelValue"])), [
879
+ [le, P.value]
880
+ ]) : A((r(), S("ul", v({
881
+ key: 1,
882
+ class: "list",
883
+ "infinite-scroll-disabled": f.value
884
+ }, n), [
885
+ (r(!0), S(x, null, q(i.value, (V) => (r(), S("li", {
886
+ key: V[m(s)],
887
+ class: "list-item"
888
+ }, [
889
+ fe("div", Ge, [
890
+ D(E(V[m(u)]) + " ", 1),
891
+ n.extra ? (r(), c(C, {
892
+ key: 0,
893
+ i: V
894
+ }, null, 8, ["i"])) : g("", !0)
895
+ ])
896
+ ]))), 128))
897
+ ], 16, Ue)), [
898
+ [W, L]
899
+ ]);
900
+ };
901
+ }
902
+ });
903
+ const Ne = /* @__PURE__ */ B(Me, [["__scopeId", "data-v-77737aab"]]), Oe = { key: 1 }, je = /* @__PURE__ */ k({
904
+ __name: "Descriptions",
905
+ props: {
906
+ formData: {
907
+ type: Object,
908
+ required: !0
909
+ },
910
+ formItem: {
911
+ type: Array,
912
+ required: !0
913
+ },
914
+ componentType: {
915
+ type: String,
916
+ default: "Element Plus"
917
+ },
918
+ strict: {
919
+ // 使用strict参数后,如果formData内的某个字段没有值,对应的描述元素将不会展示(包括标签文字),但有render的字段仍然会展示
920
+ type: Boolean,
921
+ default: !1
922
+ }
923
+ },
924
+ setup(e) {
925
+ const t = e, n = b([]);
926
+ te(
927
+ () => [t.formData, t.formItem],
928
+ ([a = {}, i = []]) => {
929
+ let o = i;
930
+ if (t.strict) {
931
+ console.log(a), console.log(o);
932
+ for (const f in a)
933
+ Object.prototype.hasOwnProperty.call(a, f) && (a[f] || (o = o.filter((P) => P.prop !== f || P.render)));
934
+ }
935
+ console.log(o), n.value = o;
936
+ },
937
+ { immediate: !0 }
938
+ );
939
+ const l = T("el-descriptions-item"), s = T("descriptions-item");
940
+ switch (t.componentType) {
941
+ case "Element Plus":
942
+ l.value = "el-descriptions-item", s.value = "el-descriptions-item";
943
+ break;
944
+ case "Ant Design Vue":
945
+ l.value = "a-descriptions", s.value = "a-descriptions-item";
946
+ break;
947
+ }
948
+ const u = (a, i) => {
949
+ const { i: o, render: f, formData: $ } = a;
950
+ return f({
951
+ row: $,
952
+ $index: o
953
+ });
954
+ };
955
+ return (a, i) => (r(), c(w(l.value), v({
956
+ column: 1,
957
+ border: "",
958
+ class: "form-width"
959
+ }, a.$attrs), {
960
+ default: _(() => [
961
+ (r(!0), S(x, null, q(n.value, (o, f) => (r(), c(w(s.value), v({
962
+ key: o.prop,
963
+ label: o.label,
964
+ ref_for: !0
965
+ }, o.descriptionsItemProps), {
966
+ default: _(() => [
967
+ o.render ? (r(), c(u, {
968
+ key: 0,
969
+ i: f,
970
+ render: o.render,
971
+ formData: e.formData
972
+ }, null, 8, ["i", "render", "formData"])) : (r(), S("span", Oe, E(e.formData[o.prop]), 1))
973
+ ]),
974
+ _: 2
975
+ }, 1040, ["label"]))), 128))
976
+ ]),
977
+ _: 1
978
+ }, 16));
979
+ }
980
+ }), Xe = Ae, Ye = Ne, We = je, Je = se, He = ie;
981
+ export {
982
+ We as VDescriptions,
983
+ Xe as VGeneralBasicForm,
984
+ Ye as VInfiniteScrollList,
985
+ Je as VInputGraphicVerification,
986
+ He as VInputMobilecVerification
987
+ };