@web-utils/component 2.8.27 → 2.8.28

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.
@@ -1,66 +1,70 @@
1
- var i = Object.defineProperty;
1
+ var p = Object.defineProperty;
2
2
  var a = Object.getOwnPropertySymbols;
3
- var p = Object.prototype.hasOwnProperty, c = Object.prototype.propertyIsEnumerable;
4
- var l = (r, e, t) => e in r ? i(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, n = (r, e) => {
5
- for (var t in e || (e = {}))
6
- p.call(e, t) && l(r, t, e[t]);
3
+ var c = Object.prototype.hasOwnProperty, m = Object.prototype.propertyIsEnumerable;
4
+ var l = (e, r, t) => r in e ? p(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, n = (e, r) => {
5
+ for (var t in r || (r = {}))
6
+ c.call(r, t) && l(e, t, r[t]);
7
7
  if (a)
8
- for (var t of a(e))
9
- c.call(e, t) && l(r, t, e[t]);
10
- return r;
8
+ for (var t of a(r))
9
+ m.call(r, t) && l(e, t, r[t]);
10
+ return e;
11
11
  };
12
- import { f as m } from "../chunks/form-input-mixin.4632ad36.mjs";
13
- import { d, n as f } from "../chunks/index.57f871af.mjs";
14
- import _ from "@web-utils/component/x-input-tag";
12
+ import { f as d } from "../chunks/form-input-mixin.4632ad36.mjs";
13
+ import { d as f, n as _ } from "../chunks/index.57f871af.mjs";
14
+ import s from "@web-utils/component/x-input-tag";
15
15
  import "@web-utils/component/x-input-tag/style.css";
16
16
  import { n as y } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
17
- var v = function() {
18
- var r = this, e = r.$createElement, t = r._self._c || e;
19
- return t("FormItem", r._b({
17
+ var b = function() {
18
+ var e = this, r = e.$createElement, t = e._self._c || r;
19
+ return t("FormItem", e._b({
20
20
  attrs: {
21
- block: r.block,
22
- rules: r.computeRules,
23
- disabled: r.inputDisabled
21
+ block: e.block,
22
+ rules: e.computeRules,
23
+ disabled: e.inputDisabled
24
24
  },
25
- scopedSlots: r._u([{
25
+ scopedSlots: e._u([{
26
26
  key: "default",
27
27
  fn: function() {
28
- return [t("XInputTag", r._g(r._b({
28
+ return [t("XInputTag", e._g(e._b({
29
29
  attrs: {
30
- value: r.value,
31
- readonly: r.readonly,
32
- disabled: r.inputDisabled,
33
- placeholder: r.computePlaceholder,
34
- "array-mode": r.arrayMode
30
+ value: e.value,
31
+ readonly: e.readonly,
32
+ disabled: e.inputDisabled,
33
+ placeholder: e.computePlaceholder,
34
+ "array-mode": e.arrayMode,
35
+ "object-mode": e.objectMode
35
36
  },
36
37
  on: {
37
38
  input: function(o) {
38
- return r.$emit("input", o);
39
+ return e.$emit("input", o);
39
40
  }
40
41
  }
41
- }, "XInputTag", r.inputProps, !1), r.listeners))];
42
+ }, "XInputTag", e.inputProps, !1), e.listeners))];
42
43
  },
43
44
  proxy: !0
44
45
  }, {
45
46
  key: "error",
46
47
  fn: function(o) {
47
- var s = o.error;
48
- return [r._t("error", null, {
49
- error: s
48
+ var i = o.error;
49
+ return [e._t("error", null, {
50
+ error: i
50
51
  })];
51
52
  }
52
53
  }, {
53
54
  key: "label",
54
55
  fn: function() {
55
- return [r._t("label")];
56
+ return [e._t("label")];
56
57
  },
57
58
  proxy: !0
58
59
  }], null, !0)
59
- }, "FormItem", r.formItemProps, !1));
60
- }, b = [];
61
- const I = Object.keys(_.props).filter((r) => !["value", "placeholder", "disabled"].includes(r)), h = {
60
+ }, "FormItem", e.formItemProps, !1));
61
+ }, v = [];
62
+ const I = Object.keys(s.props).filter((e) => !["value", "placeholder", "disabled"].includes(e)), h = {
62
63
  name: "FormInputTag",
63
- mixins: [m],
64
+ components: {
65
+ XInputTag: s
66
+ },
67
+ mixins: [d],
64
68
  props: {
65
69
  value: [Array, String],
66
70
  block: {
@@ -70,27 +74,31 @@ const I = Object.keys(_.props).filter((r) => !["value", "placeholder", "disabled
70
74
  arrayMode: {
71
75
  type: Boolean,
72
76
  default: !0
77
+ },
78
+ objectMode: {
79
+ type: Boolean,
80
+ default: !0
73
81
  }
74
82
  },
75
83
  computed: {
76
84
  inputProps() {
77
- return d(n(n({}, f(this.$attrs)), this.$props), I);
85
+ return f(n(n({}, _(this.$attrs)), this.$props), I);
78
86
  }
79
87
  }
80
88
  }, u = {};
81
89
  var g = /* @__PURE__ */ y(
82
90
  h,
83
- v,
84
91
  b,
92
+ v,
85
93
  !1,
86
94
  k,
87
95
  null,
88
96
  null,
89
97
  null
90
98
  );
91
- function k(r) {
92
- for (let e in u)
93
- this[e] = u[e];
99
+ function k(e) {
100
+ for (let r in u)
101
+ this[r] = u[r];
94
102
  }
95
103
  const B = /* @__PURE__ */ function() {
96
104
  return g.exports;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@web-utils/component",
3
3
  "description": "Web Components",
4
- "version": "2.8.27",
4
+ "version": "2.8.28",
5
5
  "author": "Simple",
6
6
  "license": "MIT",
7
7
  "type": "module",
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "@web-utils/component",
5
- "version": "2.8.27",
5
+ "version": "2.8.28",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "description-markup": "markdown",
@@ -5894,6 +5894,14 @@
5894
5894
  "type": "boolean"
5895
5895
  },
5896
5896
  "default": "true"
5897
+ },
5898
+ {
5899
+ "name": "objectMode",
5900
+ "value": {
5901
+ "kind": "expression",
5902
+ "type": "boolean"
5903
+ },
5904
+ "default": "true"
5897
5905
  }
5898
5906
  ],
5899
5907
  "events": [
@@ -20101,6 +20109,14 @@
20101
20109
  "type": "boolean"
20102
20110
  },
20103
20111
  "default": "true"
20112
+ },
20113
+ {
20114
+ "name": "objectMode",
20115
+ "value": {
20116
+ "kind": "expression",
20117
+ "type": "boolean"
20118
+ },
20119
+ "default": "true"
20104
20120
  }
20105
20121
  ],
20106
20122
  "events": [
@@ -1,39 +1,39 @@
1
1
  var f = Object.defineProperty, _ = Object.defineProperties;
2
- var v = Object.getOwnPropertyDescriptors;
2
+ var b = Object.getOwnPropertyDescriptors;
3
3
  var p = Object.getOwnPropertySymbols;
4
- var b = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
5
- var h = (t, a, e) => a in t ? f(t, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[a] = e, g = (t, a) => {
6
- for (var e in a || (a = {}))
7
- b.call(a, e) && h(t, e, a[e]);
4
+ var v = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
5
+ var h = (t, s, e) => s in t ? f(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e, d = (t, s) => {
6
+ for (var e in s || (s = {}))
7
+ v.call(s, e) && h(t, e, s[e]);
8
8
  if (p)
9
- for (var e of p(a))
10
- y.call(a, e) && h(t, e, a[e]);
9
+ for (var e of p(s))
10
+ y.call(s, e) && h(t, e, s[e]);
11
11
  return t;
12
- }, m = (t, a) => _(t, v(a));
13
- var r = (t, a, e) => new Promise((s, n) => {
14
- var o = (i) => {
12
+ }, c = (t, s) => _(t, b(s));
13
+ var r = (t, s, e) => new Promise((a, i) => {
14
+ var o = (n) => {
15
15
  try {
16
- l(e.next(i));
16
+ l(e.next(n));
17
17
  } catch (u) {
18
- n(u);
18
+ i(u);
19
19
  }
20
- }, c = (i) => {
20
+ }, g = (n) => {
21
21
  try {
22
- l(e.throw(i));
22
+ l(e.throw(n));
23
23
  } catch (u) {
24
- n(u);
24
+ i(u);
25
25
  }
26
- }, l = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(o, c);
27
- l((e = e.apply(t, a)).next());
26
+ }, l = (n) => n.done ? a(n.value) : Promise.resolve(n.value).then(o, g);
27
+ l((e = e.apply(t, s)).next());
28
28
  });
29
29
  import { n as V } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
30
30
  var w = function() {
31
- var t = this, a = t.$createElement, e = t._self._c || a;
31
+ var t = this, s = t.$createElement, e = t._self._c || s;
32
32
  return e("div", {
33
33
  staticClass: "x-input-tag"
34
- }, [t.tags && t.tags.length && t.tags[0] ? t._l(t.tags, function(s, n) {
34
+ }, [t.tags && t.tags.length && t.tags[0] ? t._l(t.tags, function(a, i) {
35
35
  return e("ElTag", {
36
- key: s.id,
36
+ key: a.id || a,
37
37
  attrs: {
38
38
  size: "medium",
39
39
  "disable-transitions": "",
@@ -41,10 +41,10 @@ var w = function() {
41
41
  },
42
42
  on: {
43
43
  close: function(o) {
44
- return t.handleClose(s, n);
44
+ return t.handleClose(a, i);
45
45
  }
46
46
  }
47
- }, [t._v(" " + t._s(s.tagName) + " ")]);
47
+ }, [t._v(" " + t._s(a.name || a) + " ")]);
48
48
  }) : t.inputDisabled ? [e("span", {
49
49
  staticStyle: {
50
50
  color: "#b5b5b5"
@@ -65,14 +65,14 @@ var w = function() {
65
65
  blur: t.handleInputConfirm
66
66
  },
67
67
  nativeOn: {
68
- keyup: function(s) {
69
- return !s.type.indexOf("key") && t._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : t.handleInputConfirm.apply(null, arguments);
68
+ keyup: function(a) {
69
+ return !a.type.indexOf("key") && t._k(a.keyCode, "enter", 13, a.key, "Enter") ? null : t.handleInputConfirm.apply(null, arguments);
70
70
  }
71
71
  },
72
72
  model: {
73
73
  value: t.inputValue,
74
- callback: function(s) {
75
- t.inputValue = s;
74
+ callback: function(a) {
75
+ t.inputValue = a;
76
76
  },
77
77
  expression: "inputValue"
78
78
  }
@@ -121,6 +121,10 @@ const C = {
121
121
  arrayMode: {
122
122
  type: Boolean,
123
123
  default: !0
124
+ },
125
+ objectMode: {
126
+ type: Boolean,
127
+ default: !0
124
128
  }
125
129
  },
126
130
  data() {
@@ -136,12 +140,12 @@ const C = {
136
140
  },
137
141
  tags: {
138
142
  get() {
139
- var t, a;
143
+ var t, s;
140
144
  if (this.arrayMode)
141
- return (t = this.value) != null && t.length ? this.value.map((e) => e.id > 0 ? e : m(g({}, e), { id: Math.random() })) : [];
145
+ return (t = this.value) != null && t.length ? this.objectMode ? this.value.map((e) => e.id > 0 ? e : c(d({}, e), { id: Math.random() })) : this.value : [];
142
146
  {
143
- const e = ((a = this.value) == null ? void 0 : a.split(this.separator)) || [];
144
- return e.length && e[0] ? e.map((s) => ({ tagName: s, id: Math.random() })) : [];
147
+ const e = ((s = this.value) == null ? void 0 : s.split(this.separator)) || [];
148
+ return e.length && e[0] ? e.map((a) => this.objectMode ? { name: a, id: Math.random() } : a) : [];
145
149
  }
146
150
  }
147
151
  }
@@ -153,30 +157,30 @@ const C = {
153
157
  });
154
158
  },
155
159
  handleClose(t) {
156
- const a = this.tags.filter((e) => e !== t);
157
- this.$emit("input", this.arrayMode ? a : a.map((e) => e.tagName).join(this.separator));
160
+ const s = this.tags.filter((e) => e !== t);
161
+ this.$emit("input", this.arrayMode ? s : s.map((e) => e.name || e).join(this.separator));
158
162
  },
159
163
  handleInputConfirm() {
160
164
  return r(this, null, function* () {
161
- var a;
165
+ var s;
162
166
  if (this.tags.length >= this.maxTag) {
163
167
  this.$message.warning({ message: "标签已达上限,请删除一些标签再添加!", showClose: !0 }), this.inputVisible = !1, this.inputValue = "";
164
168
  return;
165
169
  }
166
170
  const t = this.inputValue;
167
171
  if (t) {
168
- if (this.tags.some((s) => s.tagName === t)) {
172
+ if (this.tags.some((a) => (a.name || a) === t)) {
169
173
  this.inputVisible = !1, this.inputValue = "", this.$message.warning({ message: "标签已存在!", showClose: !0 });
170
174
  return;
171
175
  }
172
176
  const e = [...this.tags];
173
- e.push({ id: Date.now(), tagName: this.inputValue }), this.$emit("input", this.arrayMode ? e : e.map((s) => s.tagName).join(this.separator)), yield this.$nextTick(), (a = this.elFormItem) == null || a.clearValidate();
177
+ e.push(this.objectMode ? { id: Date.now(), name: this.inputValue } : this.inputValue), this.$emit("input", this.arrayMode ? e : e.map((a) => a.name || a).join(this.separator)), yield this.$nextTick(), (s = this.elFormItem) == null || s.clearValidate();
174
178
  }
175
179
  this.inputVisible = !1, this.inputValue = "";
176
180
  });
177
181
  }
178
182
  }
179
- }, d = {};
183
+ }, m = {};
180
184
  var I = /* @__PURE__ */ V(
181
185
  C,
182
186
  w,
@@ -188,12 +192,12 @@ var I = /* @__PURE__ */ V(
188
192
  null
189
193
  );
190
194
  function T(t) {
191
- for (let a in d)
192
- this[a] = d[a];
195
+ for (let s in m)
196
+ this[s] = m[s];
193
197
  }
194
- const $ = /* @__PURE__ */ function() {
198
+ const j = /* @__PURE__ */ function() {
195
199
  return I.exports;
196
200
  }();
197
201
  export {
198
- $ as default
202
+ j as default
199
203
  };