general-basic-form 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,6 +14,7 @@ app.use(ElementPlus)
14
14
 
15
15
  ```
16
16
  import GeneralBasicForm from 'general-basic-form'
17
+ import 'general-basic-form/style'
17
18
  ```
18
19
 
19
20
  <GeneralBasicForm
@@ -42,6 +43,7 @@ import GeneralBasicForm from 'general-basic-form'
42
43
  }
43
44
  noUrlParameters
44
45
  :afterReset="afterReset"
46
+ v-model:loading="loading"
45
47
  />
46
48
 
47
49
  <style lang="scss" scoped>
@@ -98,6 +100,7 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
98
100
  afterReset(); // 在重置按钮点击完后但还没重新请求时触发的的函数
99
101
  formOnly:true // 只展示表单不展示按钮
100
102
  noUrlParameters:true // 不接受和不改变url的参数
103
+ loading:false // 加载动画
101
104
  formItem: [
102
105
  {
103
106
  label: '',
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { defineComponent as _, inject as g, resolveComponent as i, openBlock as o, createBlock as s, mergeProps as h, withKeys as O, createSlots as F, renderList as S, withCtx as y, resolveDynamicComponent as D, createCommentVNode as f, ref as k, unref as b, resolveDirective as K, withDirectives as N, createElementBlock as $, createVNode as q, createElementVNode as M, computed as j, onBeforeUnmount as W, normalizeStyle as H, createTextVNode as I, toDisplayString as J, h as X, normalizeProps as Y, guardReactiveProps as Z, provide as z, Fragment as U, renderSlot as x, vShow as ee } from "vue";
2
- import { useRoute as te } from "vue-router";
3
- const E = {
1
+ import { defineComponent as _, inject as g, resolveComponent as l, openBlock as r, createBlock as a, mergeProps as h, withKeys as W, createSlots as F, renderList as S, withCtx as f, resolveDynamicComponent as U, createCommentVNode as y, ref as V, unref as v, resolveDirective as D, withDirectives as $, createElementBlock as q, createVNode as N, createElementVNode as H, computed as E, onBeforeUnmount as J, normalizeStyle as X, createTextVNode as I, toDisplayString as Y, h as Z, normalizeProps as x, guardReactiveProps as ee, provide as z, Fragment as B, renderSlot as te, vShow as ne } from "vue";
2
+ import { useRoute as oe } from "vue-router";
3
+ const G = {
4
4
  placeholder: "请输入",
5
5
  style: "width: 200px",
6
6
  clearable: !0
7
- }, ne = _({
7
+ }, re = _({
8
8
  components: {
9
9
  InputArchive: (e) => {
10
10
  const { templateEle: n } = e;
@@ -22,7 +22,7 @@ const E = {
22
22
  data() {
23
23
  return {
24
24
  inputSetting: {
25
- ...E,
25
+ ...G,
26
26
  ...this.item.inputSetting
27
27
  }
28
28
  };
@@ -46,118 +46,118 @@ const E = {
46
46
  // },
47
47
  }), P = (e, n) => {
48
48
  const t = e.__vccOpts || e;
49
- for (const [l, a] of n)
50
- t[l] = a;
49
+ for (const [s, i] of n)
50
+ t[s] = i;
51
51
  return t;
52
52
  };
53
- function re(e, n, t, l, a, u) {
54
- const c = i("el-input");
55
- return o(), s(c, h({
56
- onKeydown: O(e.getList, ["enter"]),
53
+ function ae(e, n, t, s, i, p) {
54
+ const c = l("el-input");
55
+ return r(), a(c, h({
56
+ onKeydown: W(e.getList, ["enter"]),
57
57
  modelValue: e.queryParams[e.item.prop],
58
- "onUpdate:modelValue": n[0] || (n[0] = (p) => e.queryParams[e.item.prop] = p),
58
+ "onUpdate:modelValue": n[0] || (n[0] = (u) => e.queryParams[e.item.prop] = u),
59
59
  size: e.size
60
60
  }, e.inputSetting), F({ _: 2 }, [
61
- S(e.item.template, (p, m) => ({
62
- name: m,
63
- fn: y(() => [
64
- p ? (o(), s(D(e.currentInputComponent()), {
65
- key: m,
66
- templateEle: p
67
- }, null, 8, ["templateEle"])) : f("", !0)
61
+ S(e.item.template, (u, d) => ({
62
+ name: d,
63
+ fn: f(() => [
64
+ u ? (r(), a(U(e.currentInputComponent()), {
65
+ key: d,
66
+ templateEle: u
67
+ }, null, 8, ["templateEle"])) : y("", !0)
68
68
  ])
69
69
  }))
70
70
  ]), 1040, ["onKeydown", "modelValue", "size"]);
71
71
  }
72
- const C = /* @__PURE__ */ P(ne, [["render", re]]), oe = /* @__PURE__ */ _({
72
+ const L = /* @__PURE__ */ P(re, [["render", ae]]), ie = /* @__PURE__ */ _({
73
73
  __name: "index",
74
74
  props: {
75
75
  item: {}
76
76
  },
77
77
  setup(e) {
78
- const { item: n } = e, t = g("queryParams", {}), l = g("size"), a = k({
79
- ...E,
78
+ const { item: n } = e, t = g("queryParams", {}), s = g("size"), i = V({
79
+ ...G,
80
80
  ...n.inputSetting
81
81
  });
82
- return (u, c) => {
83
- const p = i("el-input-number");
84
- return o(), s(p, h({
85
- modelValue: b(t)[u.item.prop],
86
- "onUpdate:modelValue": c[0] || (c[0] = (m) => b(t)[u.item.prop] = m),
87
- size: b(l)
88
- }, a.value), null, 16, ["modelValue", "size"]);
82
+ return (p, c) => {
83
+ const u = l("el-input-number");
84
+ return r(), a(u, h({
85
+ modelValue: v(t)[p.item.prop],
86
+ "onUpdate:modelValue": c[0] || (c[0] = (d) => v(t)[p.item.prop] = d),
87
+ size: v(s)
88
+ }, i.value), null, 16, ["modelValue", "size"]);
89
89
  };
90
90
  }
91
- }), ae = { class: "input-graphic-verification" }, se = ["src"], le = /* @__PURE__ */ _({
91
+ }), R = Symbol(), se = { class: "input-graphic-verification" }, le = ["src"], ue = /* @__PURE__ */ _({
92
92
  __name: "index",
93
93
  props: {
94
94
  item: {}
95
95
  },
96
96
  setup(e) {
97
- const { item: n } = e, { graphicSrc: t = "", getGraphic: l = () => {
98
- } } = n, a = k(!1), u = async () => {
99
- l && !a.value && (a.value = !0, await l(), a.value = !1);
97
+ const { item: n } = e, { graphicSrc: t = "", getGraphic: s = () => {
98
+ } } = n, { formLoading: i, updateFormLoading: p } = g(R), c = async () => {
99
+ s && !i.value && await s();
100
100
  };
101
- return (c, p) => {
102
- const m = K("loading");
103
- return N((o(), $("div", ae, [
104
- q(C, {
105
- item: c.item,
101
+ return (u, d) => {
102
+ const b = D("loading");
103
+ return $((r(), q("div", se, [
104
+ N(L, {
105
+ item: u.item,
106
106
  class: "input"
107
107
  }, null, 8, ["item"]),
108
- M("img", {
108
+ H("img", {
109
109
  class: "graphic",
110
- onClick: u,
111
- src: b(t)
112
- }, null, 8, se)
110
+ onClick: c,
111
+ src: v(t)
112
+ }, null, 8, le)
113
113
  ])), [
114
- [m, a.value]
114
+ [b, v(i)]
115
115
  ]);
116
116
  };
117
117
  }
118
118
  });
119
- const ie = /* @__PURE__ */ P(le, [["__scopeId", "data-v-768ce181"]]), v = "获取验证码", ue = 60, pe = /* @__PURE__ */ _({
119
+ const pe = /* @__PURE__ */ P(ue, [["__scopeId", "data-v-500ec9b0"]]), k = "获取验证码", ce = 60, de = /* @__PURE__ */ _({
120
120
  __name: "verification-button",
121
121
  props: {
122
122
  getSmscode: { type: Function }
123
123
  },
124
124
  setup(e) {
125
- const { getSmscode: n } = e, t = k(v), l = k(null), a = j(() => t.value === v), u = () => {
126
- l && (clearInterval(l.value), l.value = null, t.value = v);
125
+ const { getSmscode: n } = e, t = V(k), s = V(null), i = E(() => t.value === k), p = () => {
126
+ s && (clearInterval(s.value), s.value = null, t.value = k);
127
127
  }, c = async () => {
128
- if (t.value === v)
129
- if (t.value = ue, l.value = setInterval(() => {
128
+ if (t.value === k)
129
+ if (t.value = ce, s.value = setInterval(() => {
130
130
  if (Number(t.value) <= 0 || !t.value) {
131
- u();
131
+ p();
132
132
  return;
133
133
  } else
134
134
  t.value = Number(t.value) - 1;
135
135
  }, 1e3), n)
136
- await n() === !1 && u();
136
+ await n() === !1 && p();
137
137
  else
138
138
  return;
139
139
  };
140
- return W(() => {
141
- u();
142
- }), (p, m) => {
143
- const V = i("el-button");
144
- return o(), s(V, {
140
+ return J(() => {
141
+ p();
142
+ }), (u, d) => {
143
+ const b = l("el-button");
144
+ return r(), a(b, {
145
145
  class: "verifiaction-button",
146
- style: H({
147
- color: a.value ? "var(--color-primary, #409EFF)" : "var(--text-color-placeholder, #A8ABB2)",
148
- cursor: a.value ? "pointer" : "default"
146
+ style: X({
147
+ color: i.value ? "var(--color-primary, #409EFF)" : "var(--text-color-placeholder, #A8ABB2)",
148
+ cursor: i.value ? "pointer" : "default"
149
149
  }),
150
150
  onClick: c
151
151
  }, {
152
- default: y(() => [
153
- I(J(a.value ? v : t.value + "s"), 1)
152
+ default: f(() => [
153
+ I(Y(i.value ? k : t.value + "s"), 1)
154
154
  ]),
155
155
  _: 1
156
156
  }, 8, ["style"]);
157
157
  };
158
158
  }
159
159
  });
160
- const ce = /* @__PURE__ */ P(pe, [["__scopeId", "data-v-4074e137"]]), me = /* @__PURE__ */ _({
160
+ const me = /* @__PURE__ */ P(de, [["__scopeId", "data-v-4074e137"]]), fe = /* @__PURE__ */ _({
161
161
  __name: "index",
162
162
  props: {
163
163
  item: {}
@@ -165,15 +165,15 @@ const ce = /* @__PURE__ */ P(pe, [["__scopeId", "data-v-4074e137"]]), me = /* @_
165
165
  setup(e) {
166
166
  const { item: n } = e, t = n;
167
167
  return t.template = {
168
- append: () => X(ce, {
168
+ append: () => Z(me, {
169
169
  getSmscode: t.getSmscode
170
170
  })
171
- }, (l, a) => (o(), s(C, {
172
- item: b(t),
171
+ }, (s, i) => (r(), a(L, {
172
+ item: v(t),
173
173
  class: "input"
174
174
  }, null, 8, ["item"]));
175
175
  }
176
- }), de = _({
176
+ }), ye = _({
177
177
  components: {
178
178
  slotArchive: (e) => {
179
179
  const { templateEle: n } = e;
@@ -199,28 +199,28 @@ const ce = /* @__PURE__ */ P(pe, [["__scopeId", "data-v-4074e137"]]), me = /* @_
199
199
  }
200
200
  }
201
201
  });
202
- function ye(e, n, t, l, a, u) {
203
- const c = i("el-divider");
204
- return o(), s(c, Y(Z(e.dividerSetting)), F({ _: 2 }, [
205
- S(e.item.template, (p, m) => ({
206
- name: m,
207
- fn: y(() => [
208
- p ? (o(), s(D(e.currentInputComponent()), {
209
- key: m,
210
- templateEle: p
211
- }, null, 8, ["templateEle"])) : f("", !0)
202
+ function _e(e, n, t, s, i, p) {
203
+ const c = l("el-divider");
204
+ return r(), a(c, x(ee(e.dividerSetting)), F({ _: 2 }, [
205
+ S(e.item.template, (u, d) => ({
206
+ name: d,
207
+ fn: f(() => [
208
+ u ? (r(), a(U(e.currentInputComponent()), {
209
+ key: d,
210
+ templateEle: u
211
+ }, null, 8, ["templateEle"])) : y("", !0)
212
212
  ])
213
213
  }))
214
214
  ]), 1040);
215
215
  }
216
- const fe = /* @__PURE__ */ P(de, [["render", ye]]), _e = _({
216
+ const he = /* @__PURE__ */ P(ye, [["render", _e]]), ge = _({
217
217
  name: "GeneralBasicForm",
218
218
  components: {
219
- Input: C,
220
- InputNumber: oe,
221
- InputGraphicVerification: ie,
222
- InputMobileVerification: me,
223
- Divider: fe
219
+ Input: L,
220
+ InputNumber: ie,
221
+ InputGraphicVerification: pe,
222
+ InputMobileVerification: fe,
223
+ Divider: he
224
224
  },
225
225
  props: {
226
226
  showSearch: {
@@ -228,6 +228,11 @@ const fe = /* @__PURE__ */ P(de, [["render", ye]]), _e = _({
228
228
  type: Boolean,
229
229
  default: !0
230
230
  },
231
+ loading: {
232
+ // 加载动画
233
+ type: Boolean,
234
+ default: !1
235
+ },
231
236
  formOnly: {
232
237
  // 是否只展示表单不展示按钮
233
238
  type: Boolean,
@@ -274,6 +279,7 @@ const fe = /* @__PURE__ */ P(de, [["render", ye]]), _e = _({
274
279
  },
275
280
  data() {
276
281
  return {
282
+ formLoading: this.loading || !1,
277
283
  selectSetting: {
278
284
  placeholder: "请选择",
279
285
  clearable: !0,
@@ -288,14 +294,14 @@ const fe = /* @__PURE__ */ P(de, [["render", ye]]), _e = _({
288
294
  };
289
295
  },
290
296
  setup(e) {
291
- const { size: n, noUrlParameters: t, getList: l } = e, a = te(), u = k({
292
- ...t ? {} : a == null ? void 0 : a.query
297
+ const { size: n, noUrlParameters: t, getList: s } = e, i = oe(), p = V({
298
+ ...t ? {} : i == null ? void 0 : i.query
293
299
  });
294
300
  return z(
295
301
  /* 注入名 */
296
302
  "queryParams",
297
303
  /* 值 */
298
- u
304
+ p
299
305
  ), z(
300
306
  /* 注入名 */
301
307
  "size",
@@ -305,9 +311,9 @@ const fe = /* @__PURE__ */ P(de, [["render", ye]]), _e = _({
305
311
  /* 注入名 */
306
312
  "getList",
307
313
  /* 值 */
308
- l
314
+ s
309
315
  ), {
310
- queryParams: u
316
+ queryParams: p
311
317
  };
312
318
  },
313
319
  watch: {
@@ -316,8 +322,25 @@ const fe = /* @__PURE__ */ P(de, [["render", ye]]), _e = _({
316
322
  ...this.noUrlParameters ? {} : this.queryParams,
317
323
  ...e
318
324
  };
325
+ },
326
+ loading(e) {
327
+ this.formLoading !== e && (this.formLoading = e);
328
+ },
329
+ formLoading(e) {
330
+ this.loading !== e && this.$emit("update:loading", e);
319
331
  }
320
332
  },
333
+ provide() {
334
+ return {
335
+ // 显式提供一个计算属性
336
+ [R]: {
337
+ formLoading: E(() => this.formLoading),
338
+ updateFormLoading: (e) => {
339
+ this.formLoading = e;
340
+ }
341
+ }
342
+ };
343
+ },
321
344
  methods: {
322
345
  /** 搜索按钮操作 */
323
346
  handleQuery() {
@@ -346,93 +369,95 @@ const fe = /* @__PURE__ */ P(de, [["render", ye]]), _e = _({
346
369
  }
347
370
  }
348
371
  });
349
- function he(e, n, t, l, a, u) {
350
- const c = i("Input"), p = i("InputGraphicVerification"), m = i("InputMobileVerification"), V = i("Divider"), L = i("el-option"), G = i("el-select"), R = i("el-cascader"), A = i("el-date-picker"), Q = i("InputNumber"), w = i("el-form-item"), B = i("el-button"), T = i("el-form");
351
- return N((o(), s(T, h({
372
+ function ve(e, n, t, s, i, p) {
373
+ const c = l("Input"), u = l("InputGraphicVerification"), d = l("InputMobileVerification"), b = l("Divider"), A = l("el-option"), Q = l("el-select"), T = l("el-cascader"), K = l("el-date-picker"), O = l("InputNumber"), C = l("el-form-item"), w = l("el-button"), M = l("el-form"), j = D("loading");
374
+ return $((r(), a(M, h({
352
375
  model: e.queryParams,
353
376
  ref: "queryFormRef",
354
377
  inline: "",
355
378
  "label-position": "left",
356
379
  "label-width": e.labelWidth
357
380
  }, e.$attrs), {
358
- default: y(() => [
359
- (o(!0), $(U, null, S(e.formItem, (r) => (o(), s(w, {
360
- label: r.label,
361
- prop: r.prop,
362
- key: r.prop,
363
- rules: r.rules
381
+ default: f(() => [
382
+ (r(!0), q(B, null, S(e.formItem, (o) => (r(), a(C, {
383
+ label: o.label,
384
+ prop: o.prop,
385
+ key: o.prop,
386
+ rules: o.rules
364
387
  }, {
365
- default: y(() => [
366
- r.type === "input" ? (o(), s(c, {
388
+ default: f(() => [
389
+ o.type === "input" ? (r(), a(c, {
367
390
  key: 0,
368
- item: r
369
- }, null, 8, ["item"])) : f("", !0),
370
- r.type === "input-graphic-verification" ? (o(), s(p, {
371
- item: r,
372
- key: r.key
373
- }, null, 8, ["item"])) : f("", !0),
374
- r.type === "input-mobile-verification" ? (o(), s(m, {
391
+ item: o
392
+ }, null, 8, ["item"])) : y("", !0),
393
+ o.type === "input-graphic-verification" ? (r(), a(u, {
394
+ item: o,
395
+ key: o.key
396
+ }, null, 8, ["item"])) : y("", !0),
397
+ o.type === "input-mobile-verification" ? (r(), a(d, {
375
398
  key: 2,
376
- item: r
377
- }, null, 8, ["item"])) : f("", !0),
378
- r.type === "divider" ? (o(), s(V, {
399
+ item: o
400
+ }, null, 8, ["item"])) : y("", !0),
401
+ o.type === "divider" ? (r(), a(b, {
379
402
  key: 3,
380
- item: r
381
- }, null, 8, ["item"])) : r.type === "select" ? (o(), s(G, h({
403
+ item: o
404
+ }, null, 8, ["item"])) : o.type === "select" ? (r(), a(Q, h({
382
405
  key: 4,
383
406
  filterable: "",
384
- modelValue: e.queryParams[r.prop],
385
- "onUpdate:modelValue": (d) => e.queryParams[r.prop] = d,
407
+ modelValue: e.queryParams[o.prop],
408
+ "onUpdate:modelValue": (m) => e.queryParams[o.prop] = m,
386
409
  size: e.size
387
- }, r.selectSetting || e.selectSetting), {
388
- default: y(() => [
389
- (o(!0), $(U, null, S(r.option || [], (d) => (o(), s(L, {
390
- key: d.value,
391
- label: d.desc,
392
- value: d.value
410
+ }, o.selectSetting || e.selectSetting), {
411
+ default: f(() => [
412
+ (r(!0), q(B, null, S(o.option || [], (m) => (r(), a(A, {
413
+ key: m.value,
414
+ label: m.desc,
415
+ value: m.value
393
416
  }, null, 8, ["label", "value"]))), 128))
394
417
  ]),
395
418
  _: 2
396
- }, 1040, ["modelValue", "onUpdate:modelValue", "size"])) : r.type === "cascader" ? (o(), s(R, h({
419
+ }, 1040, ["modelValue", "onUpdate:modelValue", "size"])) : o.type === "cascader" ? (r(), a(T, h({
397
420
  key: 5,
398
421
  filterable: "",
399
- modelValue: e.queryParams[r.prop],
400
- "onUpdate:modelValue": (d) => e.queryParams[r.prop] = d,
422
+ modelValue: e.queryParams[o.prop],
423
+ "onUpdate:modelValue": (m) => e.queryParams[o.prop] = m,
401
424
  size: e.size,
402
- options: r.options || []
403
- }, r.selectSetting || e.selectSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options"])) : r.type === "date-picker" ? (o(), s(A, h({
425
+ options: o.options || []
426
+ }, o.selectSetting || e.selectSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options"])) : o.type === "date-picker" ? (r(), a(K, h({
404
427
  key: 6,
405
- modelValue: e.queryParams[r.prop],
406
- "onUpdate:modelValue": (d) => e.queryParams[r.prop] = d,
428
+ modelValue: e.queryParams[o.prop],
429
+ "onUpdate:modelValue": (m) => e.queryParams[o.prop] = m,
407
430
  size: e.size
408
- }, r.datePackerSetting || e.datePackerSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : f("", !0),
409
- r.type === "input-number" ? (o(), s(Q, {
431
+ }, o.datePackerSetting || e.datePackerSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : y("", !0),
432
+ o.type === "input-number" ? (r(), a(O, {
410
433
  key: 7,
411
- item: r
412
- }, null, 8, ["item"])) : f("", !0)
434
+ item: o
435
+ }, null, 8, ["item"])) : y("", !0)
413
436
  ]),
414
437
  _: 2
415
438
  }, 1032, ["label", "prop", "rules"]))), 128)),
416
- x(e.$slots, "default"),
417
- e.formOnly ? f("", !0) : (o(), s(w, { key: 0 }, {
418
- default: y(() => [
419
- q(B, {
439
+ te(e.$slots, "default"),
440
+ e.formOnly ? y("", !0) : (r(), a(C, { key: 0 }, {
441
+ default: f(() => [
442
+ $((r(), a(w, {
420
443
  type: "primary",
421
444
  icon: "el-icon-search",
422
445
  size: e.size,
423
446
  onClick: e.handleQuery
424
447
  }, {
425
- default: y(() => [
448
+ default: f(() => [
426
449
  I("查询")
427
450
  ]),
428
451
  _: 1
429
- }, 8, ["size", "onClick"]),
430
- q(B, {
452
+ }, 8, ["size", "onClick"])), [
453
+ [j, e.formLoading]
454
+ ]),
455
+ N(w, {
431
456
  icon: "el-icon-refresh",
432
457
  size: e.size,
433
458
  onClick: e.resetQuery
434
459
  }, {
435
- default: y(() => [
460
+ default: f(() => [
436
461
  I("重置")
437
462
  ]),
438
463
  _: 1
@@ -443,10 +468,10 @@ function he(e, n, t, l, a, u) {
443
468
  ]),
444
469
  _: 3
445
470
  }, 16, ["model", "label-width"])), [
446
- [ee, e.showSearch]
471
+ [ne, e.showSearch]
447
472
  ]);
448
473
  }
449
- const ve = /* @__PURE__ */ P(_e, [["render", he]]), ke = ve;
474
+ const be = /* @__PURE__ */ P(ge, [["render", ve]]), Se = be;
450
475
  export {
451
- ke as VGeneralBasicForm
476
+ Se as VGeneralBasicForm
452
477
  };
@@ -1 +1 @@
1
- (function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.Index={},d.Vue,d["vue-router"]))})(this,function(d,e,g){"use strict";const h={placeholder:"请输入",style:"width: 200px",clearable:!0},C=e.defineComponent({components:{InputArchive:t=>{const{templateEle:n}=t;return n()}},props:{item:null},setup(){const t=e.inject("queryParams",{}),n=e.inject("getList"),o=e.inject("size");return{queryParams:t,getList:n,size:o}},data(){return{inputSetting:{...h,...this.item.inputSetting}}},methods:{currentInputComponent(){return"input-archive"}}}),u=(t,n)=>{const o=t.__vccOpts||t;for(const[a,l]of n)o[a]=l;return o};function V(t,n,o,a,l,s){const c=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(c,e.mergeProps({onKeydown:e.withKeys(t.getList,["enter"]),modelValue:t.queryParams[t.item.prop],"onUpdate:modelValue":n[0]||(n[0]=i=>t.queryParams[t.item.prop]=i),size:t.size},t.inputSetting),e.createSlots({_:2},[e.renderList(t.item.template,(i,p)=>({name:p,fn:e.withCtx(()=>[i?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.currentInputComponent()),{key:p,templateEle:i},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040,["onKeydown","modelValue","size"])}const y=u(C,[["render",V]]),b=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),a=e.inject("size"),l=e.ref({...h,...n.inputSetting});return(s,c)=>{const i=e.resolveComponent("el-input-number");return e.openBlock(),e.createBlock(i,e.mergeProps({modelValue:e.unref(o)[s.item.prop],"onUpdate:modelValue":c[0]||(c[0]=p=>e.unref(o)[s.item.prop]=p),size:e.unref(a)},l.value),null,16,["modelValue","size"])}}}),P={class:"input-graphic-verification"},S=["src"],z=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,{graphicSrc:o="",getGraphic:a=()=>{}}=n,l=e.ref(!1),s=async()=>{a&&!l.value&&(l.value=!0,await a(),l.value=!1)};return(c,i)=>{const p=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createElementBlock("div",P,[e.createVNode(y,{item:c.item,class:"input"},null,8,["item"]),e.createElementVNode("img",{class:"graphic",onClick:s,src:e.unref(o)},null,8,S)])),[[p,l.value]])}}}),M="",q=u(z,[["__scopeId","data-v-768ce181"]]),f="获取验证码",$=60,w=e.defineComponent({__name:"verification-button",props:{getSmscode:{type:Function}},setup(t){const{getSmscode:n}=t,o=e.ref(f),a=e.ref(null),l=e.computed(()=>o.value===f),s=()=>{a&&(clearInterval(a.value),a.value=null,o.value=f)},c=async()=>{if(o.value===f)if(o.value=$,a.value=setInterval(()=>{if(Number(o.value)<=0||!o.value){s();return}else o.value=Number(o.value)-1},1e3),n)await n()===!1&&s();else return};return e.onBeforeUnmount(()=>{s()}),(i,p)=>{const _=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(_,{class:"verifiaction-button",style:e.normalizeStyle({color:l.value?"var(--color-primary, #409EFF)":"var(--text-color-placeholder, #A8ABB2)",cursor:l.value?"pointer":"default"}),onClick:c},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value?f:o.value+"s"),1)]),_:1},8,["style"])}}}),K="",I=u(w,[["__scopeId","data-v-4074e137"]]),N=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=n;return o.template={append:()=>e.h(I,{getSmscode:o.getSmscode})},(a,l)=>(e.openBlock(),e.createBlock(y,{item:e.unref(o),class:"input"},null,8,["item"]))}}),F=e.defineComponent({components:{slotArchive:t=>{const{templateEle:n}=t;return n()}},props:{item:null},setup(){},data(){return{dividerSetting:{...this.item.dividerSetting}}},methods:{currentInputComponent(){return"slot-archive"}}});function U(t,n,o,a,l,s){const c=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(c,e.normalizeProps(e.guardReactiveProps(t.dividerSetting)),e.createSlots({_:2},[e.renderList(t.item.template,(i,p)=>({name:p,fn:e.withCtx(()=>[i?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.currentInputComponent()),{key:p,templateEle:i},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040)}const D=u(F,[["render",U]]),L=e.defineComponent({name:"GeneralBasicForm",components:{Input:y,InputNumber:b,InputGraphicVerification:q,InputMobileVerification:N,Divider:D},props:{showSearch:{type:Boolean,default:!0},formOnly:{type:Boolean,default:!1},getList:{type:Function,default:()=>{}},afterReset:{type:Function,default:()=>{}},formItem:{type:Array,default:[]},size:{type:String,default:"medium"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}}},data(){return{selectSetting:{placeholder:"请选择",clearable:!0,style:"width: 200px"},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"}}},setup(t){const{size:n,noUrlParameters:o,getList:a}=t,l=g.useRoute(),s=e.ref({...o?{}:l==null?void 0:l.query});return e.provide("queryParams",s),e.provide("size",n),e.provide("getList",a),{queryParams:s}},watch:{formData(t){this.queryParams={...this.noUrlParameters?{}:this.queryParams,...t}}},methods:{handleQuery(){var o;const t={page:1,limit:10},n={...(o=this.$route)==null?void 0:o.query,...this.queryParams,...t};this.noUrlParameters||this.$router.push({query:{...n}}),this.getList({...n})},async resetQuery(){var n;this.$refs.queryFormRef.resetFields();const t={page:1};this.noUrlParameters||await this.$router.push({query:{...t}}),this.queryParams={...this.noUrlParameters?{}:(n=this.$route)==null?void 0:n.query},this.afterReset(),this.handleQuery()}}});function E(t,n,o,a,l,s){const c=e.resolveComponent("Input"),i=e.resolveComponent("InputGraphicVerification"),p=e.resolveComponent("InputMobileVerification"),_=e.resolveComponent("Divider"),G=e.resolveComponent("el-option"),j=e.resolveComponent("el-select"),R=e.resolveComponent("el-cascader"),A=e.resolveComponent("el-date-picker"),O=e.resolveComponent("InputNumber"),k=e.resolveComponent("el-form-item"),B=e.resolveComponent("el-button"),Q=e.resolveComponent("el-form");return e.withDirectives((e.openBlock(),e.createBlock(Q,e.mergeProps({model:t.queryParams,ref:"queryFormRef",inline:"","label-position":"left","label-width":t.labelWidth},t.$attrs),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.formItem,r=>(e.openBlock(),e.createBlock(k,{label:r.label,prop:r.prop,key:r.prop,rules:r.rules},{default:e.withCtx(()=>[r.type==="input"?(e.openBlock(),e.createBlock(c,{key:0,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="input-graphic-verification"?(e.openBlock(),e.createBlock(i,{item:r,key:r.key},null,8,["item"])):e.createCommentVNode("",!0),r.type==="input-mobile-verification"?(e.openBlock(),e.createBlock(p,{key:2,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="divider"?(e.openBlock(),e.createBlock(_,{key:3,item:r},null,8,["item"])):r.type==="select"?(e.openBlock(),e.createBlock(j,e.mergeProps({key:4,filterable:"",modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size},r.selectSetting||t.selectSetting),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.option||[],m=>(e.openBlock(),e.createBlock(G,{key:m.value,label:m.desc,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","size"])):r.type==="cascader"?(e.openBlock(),e.createBlock(R,e.mergeProps({key:5,filterable:"",modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size,options:r.options||[]},r.selectSetting||t.selectSetting),null,16,["modelValue","onUpdate:modelValue","size","options"])):r.type==="date-picker"?(e.openBlock(),e.createBlock(A,e.mergeProps({key:6,modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size},r.datePackerSetting||t.datePackerSetting),null,16,["modelValue","onUpdate:modelValue","size"])):e.createCommentVNode("",!0),r.type==="input-number"?(e.openBlock(),e.createBlock(O,{key:7,item:r},null,8,["item"])):e.createCommentVNode("",!0)]),_:2},1032,["label","prop","rules"]))),128)),e.renderSlot(t.$slots,"default"),t.formOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:0},{default:e.withCtx(()=>[e.createVNode(B,{type:"primary",icon:"el-icon-search",size:t.size,onClick:t.handleQuery},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1},8,["size","onClick"]),e.createVNode(B,{icon:"el-icon-refresh",size:t.size,onClick:t.resetQuery},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1},8,["size","onClick"])]),_:1}))]),_:3},16,["model","label-width"])),[[e.vShow,t.showSearch]])}const T=u(L,[["render",E]]);d.VGeneralBasicForm=T,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
1
+ (function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.Index={},d.Vue,d["vue-router"]))})(this,function(d,e,C){"use strict";const _={placeholder:"请输入",style:"width: 200px",clearable:!0},V=e.defineComponent({components:{InputArchive:t=>{const{templateEle:n}=t;return n()}},props:{item:null},setup(){const t=e.inject("queryParams",{}),n=e.inject("getList"),o=e.inject("size");return{queryParams:t,getList:n,size:o}},data(){return{inputSetting:{..._,...this.item.inputSetting}}},methods:{currentInputComponent(){return"input-archive"}}}),u=(t,n)=>{const o=t.__vccOpts||t;for(const[l,a]of n)o[l]=a;return o};function b(t,n,o,l,a,s){const c=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(c,e.mergeProps({onKeydown:e.withKeys(t.getList,["enter"]),modelValue:t.queryParams[t.item.prop],"onUpdate:modelValue":n[0]||(n[0]=i=>t.queryParams[t.item.prop]=i),size:t.size},t.inputSetting),e.createSlots({_:2},[e.renderList(t.item.template,(i,p)=>({name:p,fn:e.withCtx(()=>[i?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.currentInputComponent()),{key:p,templateEle:i},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040,["onKeydown","modelValue","size"])}const h=u(V,[["render",b]]),P=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),l=e.inject("size"),a=e.ref({..._,...n.inputSetting});return(s,c)=>{const i=e.resolveComponent("el-input-number");return e.openBlock(),e.createBlock(i,e.mergeProps({modelValue:e.unref(o)[s.item.prop],"onUpdate:modelValue":c[0]||(c[0]=p=>e.unref(o)[s.item.prop]=p),size:e.unref(l)},a.value),null,16,["modelValue","size"])}}}),k=Symbol(),S={class:"input-graphic-verification"},z=["src"],q=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,{graphicSrc:o="",getGraphic:l=()=>{}}=n,{formLoading:a,updateFormLoading:s}=e.inject(k),c=async()=>{l&&!a.value&&await l()};return(i,p)=>{const y=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createElementBlock("div",S,[e.createVNode(h,{item:i.item,class:"input"},null,8,["item"]),e.createElementVNode("img",{class:"graphic",onClick:c,src:e.unref(o)},null,8,z)])),[[y,e.unref(a)]])}}}),W="",$=u(q,[["__scopeId","data-v-500ec9b0"]]),f="获取验证码",w=60,I=e.defineComponent({__name:"verification-button",props:{getSmscode:{type:Function}},setup(t){const{getSmscode:n}=t,o=e.ref(f),l=e.ref(null),a=e.computed(()=>o.value===f),s=()=>{l&&(clearInterval(l.value),l.value=null,o.value=f)},c=async()=>{if(o.value===f)if(o.value=w,l.value=setInterval(()=>{if(Number(o.value)<=0||!o.value){s();return}else o.value=Number(o.value)-1},1e3),n)await n()===!1&&s();else return};return e.onBeforeUnmount(()=>{s()}),(i,p)=>{const y=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(y,{class:"verifiaction-button",style:e.normalizeStyle({color:a.value?"var(--color-primary, #409EFF)":"var(--text-color-placeholder, #A8ABB2)",cursor:a.value?"pointer":"default"}),onClick:c},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value?f:o.value+"s"),1)]),_:1},8,["style"])}}}),H="",L=u(I,[["__scopeId","data-v-4074e137"]]),N=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=n;return o.template={append:()=>e.h(L,{getSmscode:o.getSmscode})},(l,a)=>(e.openBlock(),e.createBlock(h,{item:e.unref(o),class:"input"},null,8,["item"]))}}),F=e.defineComponent({components:{slotArchive:t=>{const{templateEle:n}=t;return n()}},props:{item:null},setup(){},data(){return{dividerSetting:{...this.item.dividerSetting}}},methods:{currentInputComponent(){return"slot-archive"}}});function D(t,n,o,l,a,s){const c=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(c,e.normalizeProps(e.guardReactiveProps(t.dividerSetting)),e.createSlots({_:2},[e.renderList(t.item.template,(i,p)=>({name:p,fn:e.withCtx(()=>[i?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.currentInputComponent()),{key:p,templateEle:i},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040)}const U=u(F,[["render",D]]),E=e.defineComponent({name:"GeneralBasicForm",components:{Input:h,InputNumber:P,InputGraphicVerification:$,InputMobileVerification:N,Divider:U},props:{showSearch:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},formOnly:{type:Boolean,default:!1},getList:{type:Function,default:()=>{}},afterReset:{type:Function,default:()=>{}},formItem:{type:Array,default:[]},size:{type:String,default:"medium"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}}},data(){return{formLoading:this.loading||!1,selectSetting:{placeholder:"请选择",clearable:!0,style:"width: 200px"},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"}}},setup(t){const{size:n,noUrlParameters:o,getList:l}=t,a=C.useRoute(),s=e.ref({...o?{}:a==null?void 0:a.query});return e.provide("queryParams",s),e.provide("size",n),e.provide("getList",l),{queryParams:s}},watch:{formData(t){this.queryParams={...this.noUrlParameters?{}:this.queryParams,...t}},loading(t){this.formLoading!==t&&(this.formLoading=t)},formLoading(t){this.loading!==t&&this.$emit("update:loading",t)}},provide(){return{[k]:{formLoading:e.computed(()=>this.formLoading),updateFormLoading:t=>{this.formLoading=t}}}},methods:{handleQuery(){var o;const t={page:1,limit:10},n={...(o=this.$route)==null?void 0:o.query,...this.queryParams,...t};this.noUrlParameters||this.$router.push({query:{...n}}),this.getList({...n})},async resetQuery(){var n;this.$refs.queryFormRef.resetFields();const t={page:1};this.noUrlParameters||await this.$router.push({query:{...t}}),this.queryParams={...this.noUrlParameters?{}:(n=this.$route)==null?void 0:n.query},this.afterReset(),this.handleQuery()}}});function T(t,n,o,l,a,s){const c=e.resolveComponent("Input"),i=e.resolveComponent("InputGraphicVerification"),p=e.resolveComponent("InputMobileVerification"),y=e.resolveComponent("Divider"),G=e.resolveComponent("el-option"),R=e.resolveComponent("el-select"),A=e.resolveComponent("el-cascader"),O=e.resolveComponent("el-date-picker"),Q=e.resolveComponent("InputNumber"),g=e.resolveComponent("el-form-item"),B=e.resolveComponent("el-button"),K=e.resolveComponent("el-form"),M=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(K,e.mergeProps({model:t.queryParams,ref:"queryFormRef",inline:"","label-position":"left","label-width":t.labelWidth},t.$attrs),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.formItem,r=>(e.openBlock(),e.createBlock(g,{label:r.label,prop:r.prop,key:r.prop,rules:r.rules},{default:e.withCtx(()=>[r.type==="input"?(e.openBlock(),e.createBlock(c,{key:0,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="input-graphic-verification"?(e.openBlock(),e.createBlock(i,{item:r,key:r.key},null,8,["item"])):e.createCommentVNode("",!0),r.type==="input-mobile-verification"?(e.openBlock(),e.createBlock(p,{key:2,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="divider"?(e.openBlock(),e.createBlock(y,{key:3,item:r},null,8,["item"])):r.type==="select"?(e.openBlock(),e.createBlock(R,e.mergeProps({key:4,filterable:"",modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size},r.selectSetting||t.selectSetting),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.option||[],m=>(e.openBlock(),e.createBlock(G,{key:m.value,label:m.desc,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","size"])):r.type==="cascader"?(e.openBlock(),e.createBlock(A,e.mergeProps({key:5,filterable:"",modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size,options:r.options||[]},r.selectSetting||t.selectSetting),null,16,["modelValue","onUpdate:modelValue","size","options"])):r.type==="date-picker"?(e.openBlock(),e.createBlock(O,e.mergeProps({key:6,modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size},r.datePackerSetting||t.datePackerSetting),null,16,["modelValue","onUpdate:modelValue","size"])):e.createCommentVNode("",!0),r.type==="input-number"?(e.openBlock(),e.createBlock(Q,{key:7,item:r},null,8,["item"])):e.createCommentVNode("",!0)]),_:2},1032,["label","prop","rules"]))),128)),e.renderSlot(t.$slots,"default"),t.formOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(g,{key:0},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(B,{type:"primary",icon:"el-icon-search",size:t.size,onClick:t.handleQuery},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1},8,["size","onClick"])),[[M,t.formLoading]]),e.createVNode(B,{icon:"el-icon-refresh",size:t.size,onClick:t.resetQuery},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1},8,["size","onClick"])]),_:1}))]),_:3},16,["model","label-width"])),[[e.vShow,t.showSearch]])}const j=u(E,[["render",T]]);d.VGeneralBasicForm=j,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .input-graphic-verification[data-v-768ce181]{display:flex;gap:12px;width:100%}.input-graphic-verification .input[data-v-768ce181]{flex:auto}.input-graphic-verification .graphic[data-v-768ce181]{width:109px;height:43px;object-fit:fill;flex:none}.verifiaction-button[data-v-4074e137]{width:109px}
1
+ .input-graphic-verification[data-v-500ec9b0]{display:flex;gap:12px;width:100%}.input-graphic-verification .input[data-v-500ec9b0]{flex:auto}.input-graphic-verification .graphic[data-v-500ec9b0]{width:109px;height:43px;object-fit:fill;flex:none}.verifiaction-button[data-v-4074e137]{width:109px}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "general-basic-form",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "type": "module",
@@ -10,7 +10,8 @@
10
10
  "build-only": "vite build",
11
11
  "type-check": "tsc --noEmit -p tsconfig.json --composite false",
12
12
  "link": "tsx script/link.ts && yarn link",
13
- "unlink": "tsx script/unlink.ts && yarn unlink && run-p build"
13
+ "unlink": "tsx script/unlink.ts && yarn unlink && run-p build",
14
+ "unlinkSetting": "tsx script/unlink.ts"
14
15
  },
15
16
  "keywords": [
16
17
  "general-basic-form",
@@ -51,7 +52,8 @@
51
52
  ".": {
52
53
  "import": "./dist/index.js",
53
54
  "require": "./dist/index.umd.cjs"
54
- }
55
+ },
56
+ "./style": "./dist/style.css"
55
57
  },
56
58
  "files": [
57
59
  "/dist"