@web-utils/form-ui 1.0.0-beta75 → 1.0.0-beta76

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 (66) hide show
  1. package/chunks/{CzA5Lt_l2.mjs → B-WTB0ce2.mjs} +1 -1
  2. package/chunks/{aG2VZRRm2.mjs → BLBHnUme2.mjs} +1 -1
  3. package/chunks/{CMyOgBni2.mjs → BM8snKHN2.mjs} +1 -1
  4. package/chunks/{nZTrOKQf2.mjs → BP_0cJ172.mjs} +66 -66
  5. package/chunks/{CEDZmNDG2.mjs → BTNnujZA2.mjs} +1 -1
  6. package/chunks/{BCI1maFm2.mjs → BaB0bq4I2.mjs} +1 -1
  7. package/chunks/{B2p5StJk2.mjs → BvlU_Z6D2.mjs} +1 -1
  8. package/chunks/C7rEqtOR.mjs +70 -0
  9. package/chunks/{BoXQg1h12.mjs → CF23xugU2.mjs} +2 -2
  10. package/chunks/{DS86zxjN2.mjs → CFKKwzh72.mjs} +2 -2
  11. package/chunks/{B5gBCT5G2.mjs → CI-pH-gR2.mjs} +1 -1
  12. package/chunks/{BA_en_FG2.mjs → CVM0lwn22.mjs} +1 -1
  13. package/chunks/{CizBLN6J2.mjs → CWaId08S2.mjs} +1 -1
  14. package/chunks/{Bh4XihEh.mjs → Cg6ahpHk.mjs} +1 -1
  15. package/chunks/{Cjxblk9N2.mjs → CpIXTVFU2.mjs} +2 -2
  16. package/chunks/{Dv-_PE3-.mjs → DLdsvozr.mjs} +2 -2
  17. package/chunks/{DCTK5oyK.mjs → DMDsZeqv.mjs} +1 -1
  18. package/chunks/{DjFlEzPM2.mjs → DNiq6hHj2.mjs} +3 -3
  19. package/chunks/{CfxgQ-wf2.mjs → DP7eF99m2.mjs} +1 -1
  20. package/chunks/{CstdEG9K2.mjs → DRXM1Mt22.mjs} +1 -1
  21. package/chunks/{Bp4VotK62.mjs → D_gR5ibl2.mjs} +2 -2
  22. package/chunks/{Cfz-cav7.mjs → Dgwcljur.mjs} +63 -41
  23. package/chunks/{_BhTD9wf.mjs → Dhdoa4M6.mjs} +1 -1
  24. package/chunks/{C_UxYEd72.mjs → Dje2xUVd2.mjs} +2 -2
  25. package/chunks/{BbO6NHlx2.mjs → DvkUImww2.mjs} +109 -109
  26. package/chunks/{VbE4wwJT2.mjs → kAaQhLJs2.mjs} +1 -1
  27. package/chunks/{CBsdczGQ.mjs → ohCkWdwS.mjs} +1 -1
  28. package/chunks/{C6AxHCkY2.mjs → x2jJ6cfy2.mjs} +1 -1
  29. package/form-cascader/index.mjs +1 -1
  30. package/form-checkbox/index.mjs +1 -1
  31. package/form-checkbox-group/index.mjs +1 -1
  32. package/form-date-picker/index.mjs +1 -1
  33. package/form-image/index.mjs +1 -1
  34. package/form-input/index.mjs +1 -1
  35. package/form-input-cron-expression/index.mjs +1 -1
  36. package/form-input-email/index.mjs +1 -1
  37. package/form-input-id-card/index.mjs +1 -1
  38. package/form-input-number/index.mjs +1 -1
  39. package/form-input-phone-number/index.mjs +1 -1
  40. package/form-input-tag/index.mjs +1 -1
  41. package/form-input-time/index.mjs +1 -1
  42. package/form-item-x/index.mjs +1 -1
  43. package/form-radio-group/index.mjs +1 -1
  44. package/form-rate/index.mjs +1 -1
  45. package/form-select/index.mjs +1 -1
  46. package/form-slider/index.mjs +1 -1
  47. package/form-switch/index.mjs +1 -1
  48. package/form-table/index.mjs +1 -1
  49. package/form-table-plus/index.mjs +1 -1
  50. package/form-text/index.mjs +1 -1
  51. package/form-textarea/index.mjs +1 -1
  52. package/form-time-select/index.mjs +1 -1
  53. package/form-tree-select/index.mjs +1 -1
  54. package/form-tree-select-multiple/index.mjs +1 -1
  55. package/helper/input.d.ts +3 -1
  56. package/helper/input.mjs +1 -1
  57. package/helper/sub-table-plus.d.ts +1 -1
  58. package/index.mjs +29 -29
  59. package/package.json +1 -1
  60. package/sub-table/index.mjs +1 -1
  61. package/sub-table-plus/index.mjs +1 -1
  62. package/table-view/index.mjs +1 -1
  63. package/tag-render/index.mjs +15 -16
  64. package/web-types.json +1 -1
  65. package/x-input-tag/index.mjs +36 -37
  66. package/chunks/UCeucUsB.mjs +0 -68
@@ -1,13 +1,12 @@
1
1
  import { t as e } from "../chunks/B1MSrc6f.mjs";
2
2
  import { t } from "../chunks/mnqSaATq.mjs";
3
- import { ElInput as n, ElMessage as r, ElPopover as i, ElTag as a } from "element-plus/es";
3
+ import { ElInput as n, ElMessage as r, ElPopover as i, ElTag as a, formContextKey as o, formItemContextKey as s } from "element-plus/es";
4
4
  import "element-plus/es/components/base/style/css";
5
5
  import "element-plus/es/components/input/style/css";
6
- import { Fragment as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, nextTick as f, normalizeClass as p, openBlock as m, renderList as h, toDisplayString as g, vShow as _, withCtx as v, withDirectives as y, withKeys as b } from "vue";
7
- import { isArray as x, isDef as S, isPlainObject as C, scrollIntoView as w } from "@web-utils/core";
6
+ import { Fragment as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, nextTick as m, normalizeClass as h, openBlock as g, renderList as _, toDisplayString as v, vShow as y, withCtx as b, withDirectives as x, withKeys as S } from "vue";
7
+ import { isArray as C, isDef as w, isPlainObject as T, scrollIntoView as E } from "@web-utils/core";
8
8
  import "element-plus/es/components/message/style/css";
9
- import { debounce as T } from "lodash-es";
10
- import { formContextKey as E, formItemContextKey as D } from "element-plus";
9
+ import { debounce as D } from "lodash-es";
11
10
  import "element-plus/es/components/popover/style/css";
12
11
  import "element-plus/es/components/tag/style/css";
13
12
  //#region src/components/form/XInputTag.vue
@@ -15,11 +14,11 @@ var O = {
15
14
  name: "XInputTag",
16
15
  inject: {
17
16
  elForm: {
18
- from: E,
17
+ from: o,
19
18
  default: ""
20
19
  },
21
20
  elFormItem: {
22
- from: D,
21
+ from: s,
23
22
  default: ""
24
23
  }
25
24
  },
@@ -74,7 +73,7 @@ var O = {
74
73
  }) : this.modelValue : [];
75
74
  } else {
76
75
  var t;
77
- let e = this.arrayMode ? this.modelValue || [] : x(this.modelValue) ? this.modelValue : ((t = this.modelValue) == null ? void 0 : t.split(this.separator)) || [];
76
+ let e = this.arrayMode ? this.modelValue || [] : C(this.modelValue) ? this.modelValue : ((t = this.modelValue) == null ? void 0 : t.split(this.separator)) || [];
78
77
  return e.length && e[0] ? e.map((e) => this.objectMode ? {
79
78
  name: e,
80
79
  id: null
@@ -83,25 +82,25 @@ var O = {
83
82
  } }
84
83
  },
85
84
  created() {
86
- this.query && (this.debounceQuery = T(async () => {
85
+ this.query && (this.debounceQuery = D(async () => {
87
86
  this.query ? (this.items = await this.query(this.inputValue), this.currentIndex = 0) : this.currentIndex = null;
88
87
  }, 200));
89
88
  },
90
89
  methods: {
91
90
  async showInput() {
92
91
  var e;
93
- this.inputVisible = !0, await f(), this.$refs.saveTagInput.$refs.input.focus(), (e = this.items) != null && e.length && (this.currentIndex = 0);
92
+ this.inputVisible = !0, await m(), this.$refs.saveTagInput.$refs.input.focus(), (e = this.items) != null && e.length && (this.currentIndex = 0);
94
93
  },
95
94
  handleClose(e) {
96
95
  let t = this.tags.filter((t) => t !== e);
97
96
  this.$emit("update:modelValue", this.arrayMode ? t : t.map((e) => e.name || e).join(this.separator));
98
97
  },
99
98
  async handleInputConfirm() {
100
- await f(), S(this.currentIndex) && this.items[this.currentIndex] ? await this.addTag(this.items[this.currentIndex]) : this.inputValue ? await this.addTag(this.inputValue) : await this.reset();
99
+ await m(), w(this.currentIndex) && this.items[this.currentIndex] ? await this.addTag(this.items[this.currentIndex]) : this.inputValue ? await this.addTag(this.inputValue) : await this.reset();
101
100
  },
102
101
  async reset() {
103
102
  var e;
104
- (e = this.$refs.popover) == null || e.hide(), await f(), this.inputVisible = !1, this.inputValue = "", this.currentIndex = null;
103
+ (e = this.$refs.popover) == null || e.hide(), await m(), this.inputVisible = !1, this.inputValue = "", this.currentIndex = null;
105
104
  },
106
105
  async addTag(e) {
107
106
  if (this.tags.length >= this.maxTag) {
@@ -113,7 +112,7 @@ var O = {
113
112
  }
114
113
  if (e) {
115
114
  var t;
116
- let n = C(e);
115
+ let n = T(e);
117
116
  if (this.tags.some((t) => (this.objectMode && t.name || t) === (n && e.name || e))) {
118
117
  this.inputVisible = !1, this.inputValue = "", r.warning({
119
118
  message: `${this.type}已存在!`,
@@ -147,7 +146,7 @@ var O = {
147
146
  },
148
147
  select(e) {
149
148
  var t;
150
- (t = this.items) != null && t.length && (e === 1 ? this.currentIndex > 0 ? this.currentIndex-- : this.currentIndex = this.items.length - 1 : e === 2 && (this.currentIndex < this.items.length - 1 ? this.currentIndex++ : this.currentIndex = 0), w(this.$refs.list, this.$refs.items[this.currentIndex]));
149
+ (t = this.items) != null && t.length && (e === 1 ? this.currentIndex > 0 ? this.currentIndex-- : this.currentIndex = this.items.length - 1 : e === 2 && (this.currentIndex < this.items.length - 1 ? this.currentIndex++ : this.currentIndex = 0), E(this.$refs.list, this.$refs.items[this.currentIndex]));
151
150
  }
152
151
  }
153
152
  }, k = { class: "x-input-tag" }, A = {
@@ -164,31 +163,31 @@ var O = {
164
163
  ref: "list",
165
164
  class: "dropdown-item-list"
166
165
  }, N = ["onMouseenter", "onClick"];
167
- function P(e, r, f, x, S, C) {
166
+ function P(e, r, o, s, m, C) {
168
167
  let w = a, T = n, E = t, D = i;
169
- return m(), l("div", k, [
170
- C.tags && C.tags.length && C.tags[0] ? (m(!0), l(o, { key: 0 }, h(C.tags, (e, t) => (m(), s(w, {
168
+ return g(), d("div", k, [
169
+ C.tags && C.tags.length && C.tags[0] ? (g(!0), d(c, { key: 0 }, _(C.tags, (e, t) => (g(), l(w, {
171
170
  key: e.id || e.name || e,
172
171
  size: "small",
173
172
  "disable-transitions": "",
174
173
  closable: !C.inputDisabled,
175
174
  onClose: (n) => C.handleClose(e, t)
176
175
  }, {
177
- default: v(() => [d(g(e.name || e), 1)]),
176
+ default: b(() => [p(v(e.name || e), 1)]),
178
177
  _: 2
179
- }, 1032, ["closable", "onClose"]))), 128)) : C.inputDisabled ? (m(), l("span", A, "无")) : c("v-if", !0),
180
- C.inputDisabled ? c("v-if", !0) : y((m(), s(T, {
178
+ }, 1032, ["closable", "onClose"]))), 128)) : C.inputDisabled ? (g(), d("span", A, "无")) : u("v-if", !0),
179
+ C.inputDisabled ? u("v-if", !0) : x((g(), l(T, {
181
180
  key: 2,
182
181
  ref: "saveTagInput",
183
- modelValue: S.inputValue,
184
- "onUpdate:modelValue": [r[0] || (r[0] = (e) => S.inputValue = e), C.tryQuery],
182
+ modelValue: m.inputValue,
183
+ "onUpdate:modelValue": [r[0] || (r[0] = (e) => m.inputValue = e), C.tryQuery],
185
184
  class: "input-new-tag",
186
185
  size: "small",
187
186
  onKeyup: [
188
- r[1] || (r[1] = b((e) => C.select(1), ["up"])),
189
- r[2] || (r[2] = b((e) => C.select(2), ["down"])),
190
- b(C.onInputBlur, ["esc"]),
191
- b(C.handleInputConfirm, ["enter"])
187
+ r[1] || (r[1] = S((e) => C.select(1), ["up"])),
188
+ r[2] || (r[2] = S((e) => C.select(2), ["down"])),
189
+ S(C.onInputBlur, ["esc"]),
190
+ S(C.handleInputConfirm, ["enter"])
192
191
  ],
193
192
  onBlur: C.onInputBlur
194
193
  }, null, 8, [
@@ -196,18 +195,18 @@ function P(e, r, f, x, S, C) {
196
195
  "onUpdate:modelValue",
197
196
  "onKeyup",
198
197
  "onBlur"
199
- ])), [[_, S.inputVisible]]),
200
- !C.inputDisabled && !S.inputVisible ? y((m(), s(E, {
198
+ ])), [[y, m.inputVisible]]),
199
+ !C.inputDisabled && !m.inputVisible ? x((g(), l(E, {
201
200
  key: 3,
202
201
  class: "button-new-tag",
203
202
  size: "small",
204
203
  onClick: C.showInput
205
204
  }, {
206
- default: v(() => [...r[3] || (r[3] = [d(" + 添加 ", -1)])]),
205
+ default: b(() => [...r[3] || (r[3] = [p(" + 添加 ", -1)])]),
207
206
  _: 1
208
- }, 8, ["onClick"])), [[_, C.tags.length < S.maxTag]]) : c("v-if", !0),
209
- f.count ? (m(), l("span", j, g(C.tags.length && C.tags[0] ? C.tags.length : ""), 1)) : c("v-if", !0),
210
- f.query ? (m(), s(D, {
207
+ }, 8, ["onClick"])), [[y, C.tags.length < m.maxTag]]) : u("v-if", !0),
208
+ o.count ? (g(), d("span", j, v(C.tags.length && C.tags[0] ? C.tags.length : ""), 1)) : u("v-if", !0),
209
+ o.query ? (g(), l(D, {
211
210
  key: 5,
212
211
  ref: "popover",
213
212
  "virtual-ref": e.$refs.saveTagInput,
@@ -216,16 +215,16 @@ function P(e, r, f, x, S, C) {
216
215
  "popper-class": "dropdown-popup",
217
216
  trigger: "manual"
218
217
  }, {
219
- default: v(() => [u("ul", M, [(m(!0), l(o, null, h(S.items, (e, t) => (m(), l("li", {
218
+ default: b(() => [f("ul", M, [(g(!0), d(c, null, _(m.items, (e, t) => (g(), d("li", {
220
219
  ref_for: !0,
221
220
  ref: "items",
222
221
  key: e.id || e.name || e,
223
- class: p(["dropdown-item", { active: S.currentIndex === t }]),
224
- onMouseenter: (e) => S.currentIndex = t,
222
+ class: h(["dropdown-item", { active: m.currentIndex === t }]),
223
+ onMouseenter: (e) => m.currentIndex = t,
225
224
  onClick: (t) => C.onDropdownItemClick(e)
226
- }, g(e.name || e), 43, N))), 128))], 512)]),
225
+ }, v(e.name || e), 43, N))), 128))], 512)]),
227
226
  _: 1
228
- }, 8, ["virtual-ref"])) : c("v-if", !0)
227
+ }, 8, ["virtual-ref"])) : u("v-if", !0)
229
228
  ]);
230
229
  }
231
230
  var F = /* @__PURE__ */ e(O, [["render", P]]);
@@ -1,68 +0,0 @@
1
- import { n as e, o as t, t as n } from "./Cfz-cav7.mjs";
2
- import { allProps as r, predicate as i } from "../props/input.mjs";
3
- import { ElInput as a } from "element-plus/es";
4
- import "element-plus/es/components/base/style/css";
5
- import "element-plus/es/components/input/style/css";
6
- import { computed as o, createVNode as s, mergeProps as c, useModel as l } from "vue";
7
- import { validatePhoneNum as u } from "@web-utils/core";
8
- //#region src/utils/form-validate.ts
9
- var d = (e, t, n) => t && !/^[A-Za-z0-9\u4e00-\u9fa5_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(t) ? n(/* @__PURE__ */ Error("invalid")) : n();
10
- function f(e, t, n) {
11
- t && !/^[1-9][0-9]{5}(18|19|(2[0-9]))[0-9]{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)[0-9]{3}[0-9Xx]$/.test(t) ? n(/* @__PURE__ */ Error("invalid")) : n();
12
- }
13
- function p(e, t, n) {
14
- if (this.$refs.table.$refs.table.records.length === 0) {
15
- n(Error(e.message || `请添加${e.label}`));
16
- return;
17
- }
18
- n();
19
- }
20
- //#endregion
21
- //#region src/components/form/FormInput.vue
22
- var m = {
23
- name: "FormInput",
24
- inheritAttrs: !1,
25
- props: { ...r },
26
- emits: { ...e },
27
- setup(e, { emit: r, slots: p, attrs: m }) {
28
- let h = l(e, "modelValue"), g = `请输入正确的${e.label}!`, { render: _, placeholder: v, disabled: y, listeners: b, inputProps: x, printing: S } = t(e, {
29
- emit: r,
30
- slots: p,
31
- attrs: m,
32
- rules: o(() => {
33
- if (!e.type || e.type === "textarea") return null;
34
- let t = {
35
- message: g,
36
- trigger: "blur"
37
- };
38
- if (e.type === "email") t.validator = d;
39
- else if (e.type === "idcard") t.validator = f;
40
- else if (e.type === "phone") t.validator = u;
41
- else return null;
42
- return [t];
43
- }),
44
- predicate: i
45
- });
46
- return () => _({ vNodes: S.value ? e.modelValue : s(a, c(b.value, x.value, {
47
- class: ["form-input", {
48
- "is-readonly": e.readonlyGrey && e.readonly && !e.picker,
49
- "el-input-cursor-pointer": e.picker && !y.value
50
- }],
51
- modelValue: h.value,
52
- "onUpdate:modelValue": (e) => h.value = e,
53
- disabled: y.value,
54
- placeholder: v.value,
55
- readonly: e.readonly || e.picker,
56
- "prefix-icon": n({ icon: e.picker ? "el-icon-search" : e.prefixIcon }),
57
- "suffix-icon": n({ icon: e.suffixIcon })
58
- }), {
59
- prefix: p.prefix || e.prefix ? () => e.prefix : null,
60
- suffix: p.suffix || e.suffix ? () => e.suffix : null,
61
- "password-icon": p["password-icon"],
62
- prepend: p.prepend || e.prepend ? () => e.prepend : null,
63
- append: p.append || e.append ? () => e.append : null
64
- }) });
65
- }
66
- };
67
- //#endregion
68
- export { p as n, m as t };