@web-utils/component 2.8.26 → 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.26",
4
+ "version": "2.8.28",
5
5
  "author": "Simple",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -31,7 +31,9 @@ var f = function() {
31
31
  }, [e._v(" " + e._s(e.getTagName(s)) + " ")]);
32
32
  }) : e.enable ? e._e() : [n("span", {
33
33
  staticStyle: {
34
- color: "#b5b5b5"
34
+ color: "#b5b5b5",
35
+ "line-height": "16px",
36
+ "margin-left": "4px"
35
37
  }
36
38
  }, [e._v("无")])], e.enable ? n("ElButton", {
37
39
  staticClass: "add-tag",
@@ -92,22 +94,22 @@ const p = {
92
94
  }
93
95
  }
94
96
  }, u = {};
95
- var v = /* @__PURE__ */ g(
97
+ var h = /* @__PURE__ */ g(
96
98
  p,
97
99
  f,
98
100
  d,
99
101
  !1,
100
- h,
102
+ v,
101
103
  null,
102
104
  null,
103
105
  null
104
106
  );
105
- function h(e) {
107
+ function v(e) {
106
108
  for (let t in u)
107
109
  this[t] = u[t];
108
110
  }
109
111
  const $ = /* @__PURE__ */ function() {
110
- return v.exports;
112
+ return h.exports;
111
113
  }();
112
114
  export {
113
115
  $ as default
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.26",
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": [
@@ -20086,6 +20094,14 @@
20086
20094
  },
20087
20095
  "default": "','"
20088
20096
  },
20097
+ {
20098
+ "name": "count",
20099
+ "value": {
20100
+ "kind": "expression",
20101
+ "type": "boolean"
20102
+ },
20103
+ "default": "true"
20104
+ },
20089
20105
  {
20090
20106
  "name": "arrayMode",
20091
20107
  "value": {
@@ -20093,6 +20109,14 @@
20093
20109
  "type": "boolean"
20094
20110
  },
20095
20111
  "default": "true"
20112
+ },
20113
+ {
20114
+ "name": "objectMode",
20115
+ "value": {
20116
+ "kind": "expression",
20117
+ "type": "boolean"
20118
+ },
20119
+ "default": "true"
20096
20120
  }
20097
20121
  ],
20098
20122
  "events": [
@@ -1,71 +1,82 @@
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 y = Object.prototype.hasOwnProperty, b = 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, m = (t, a) => {
6
- for (var e in a || (a = {}))
7
- y.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
- b.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
- }, d = (t, a) => _(t, v(a));
13
- var u = (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));
17
- } catch (r) {
18
- n(r);
16
+ l(e.next(n));
17
+ } catch (u) {
18
+ i(u);
19
19
  }
20
- }, c = (i) => {
20
+ }, g = (n) => {
21
21
  try {
22
- l(e.throw(i));
23
- } catch (r) {
24
- n(r);
22
+ l(e.throw(n));
23
+ } catch (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
- staticClass: "fy-input-tag"
34
- }, [t._l(t.tags, function(s, n) {
33
+ staticClass: "x-input-tag"
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
- closable: !t.inputDisabled,
39
- "disable-transitions": !t.arrayMode
38
+ size: "medium",
39
+ "disable-transitions": "",
40
+ closable: !t.inputDisabled
40
41
  },
41
42
  on: {
42
43
  close: function(o) {
43
- return t.handleClose(s, n);
44
+ return t.handleClose(a, i);
44
45
  }
45
46
  }
46
- }, [t._v(" " + t._s(s.tagName) + " ")]);
47
- }), !t.inputDisabled && t.inputVisible ? e("ElInput", {
47
+ }, [t._v(" " + t._s(a.name || a) + " ")]);
48
+ }) : t.inputDisabled ? [e("span", {
49
+ staticStyle: {
50
+ color: "#b5b5b5"
51
+ }
52
+ }, [t._v("无")])] : t._e(), t.inputDisabled ? t._e() : e("ElInput", {
53
+ directives: [{
54
+ name: "show",
55
+ rawName: "v-show",
56
+ value: t.inputVisible,
57
+ expression: "inputVisible"
58
+ }],
48
59
  ref: "saveTagInput",
49
60
  staticClass: "input-new-tag",
50
61
  attrs: {
51
- size: "small"
62
+ size: "mini"
52
63
  },
53
64
  on: {
54
65
  blur: t.handleInputConfirm
55
66
  },
56
67
  nativeOn: {
57
- keyup: function(s) {
58
- 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);
59
70
  }
60
71
  },
61
72
  model: {
62
73
  value: t.inputValue,
63
- callback: function(s) {
64
- t.inputValue = s;
74
+ callback: function(a) {
75
+ t.inputValue = a;
65
76
  },
66
77
  expression: "inputValue"
67
78
  }
68
- }) : t._e(), !t.inputDisabled && !t.inputVisible ? e("ElButton", {
79
+ }), !t.inputDisabled && !t.inputVisible ? e("ElButton", {
69
80
  directives: [{
70
81
  name: "show",
71
82
  rawName: "v-show",
@@ -74,14 +85,16 @@ var w = function() {
74
85
  }],
75
86
  staticClass: "button-new-tag",
76
87
  attrs: {
77
- size: "small"
88
+ size: "mini"
78
89
  },
79
90
  on: {
80
91
  click: t.showInput
81
92
  }
82
- }, [t._v(" + 添加 ")]) : t._e()], 2);
93
+ }, [t._v(" + 添加 ")]) : t._e(), t.count ? e("span", {
94
+ staticClass: "tags-count"
95
+ }, [t._v(t._s(t.tags.length && t.tags[0] ? t.tags.length : ""))]) : t._e()], 2);
83
96
  }, x = [];
84
- const I = {
97
+ const C = {
85
98
  name: "XInputTag",
86
99
  inject: {
87
100
  elForm: {
@@ -101,9 +114,17 @@ const I = {
101
114
  type: String,
102
115
  default: ","
103
116
  },
117
+ count: {
118
+ type: Boolean,
119
+ default: !0
120
+ },
104
121
  arrayMode: {
105
122
  type: Boolean,
106
123
  default: !0
124
+ },
125
+ objectMode: {
126
+ type: Boolean,
127
+ default: !0
107
128
  }
108
129
  },
109
130
  data() {
@@ -119,49 +140,49 @@ const I = {
119
140
  },
120
141
  tags: {
121
142
  get() {
122
- var t, a;
143
+ var t, s;
123
144
  if (this.arrayMode)
124
- return (t = this.value) != null && t.length ? this.value.map((e) => e.id > 0 ? e : d(m({}, 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 : [];
125
146
  {
126
- const e = ((a = this.value) == null ? void 0 : a.split(this.separator)) || [];
127
- 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) : [];
128
149
  }
129
150
  }
130
151
  }
131
152
  },
132
153
  methods: {
133
154
  showInput() {
134
- return u(this, null, function* () {
155
+ return r(this, null, function* () {
135
156
  this.inputVisible = !0, yield this.$nextTick(), this.$refs.saveTagInput.$refs.input.focus();
136
157
  });
137
158
  },
138
159
  handleClose(t) {
139
- const a = this.tags.filter((e) => e !== t);
140
- 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));
141
162
  },
142
163
  handleInputConfirm() {
143
- return u(this, null, function* () {
144
- var a;
164
+ return r(this, null, function* () {
165
+ var s;
145
166
  if (this.tags.length >= this.maxTag) {
146
167
  this.$message.warning({ message: "标签已达上限,请删除一些标签再添加!", showClose: !0 }), this.inputVisible = !1, this.inputValue = "";
147
168
  return;
148
169
  }
149
170
  const t = this.inputValue;
150
171
  if (t) {
151
- if (this.tags.some((s) => s.tagName === t)) {
172
+ if (this.tags.some((a) => (a.name || a) === t)) {
152
173
  this.inputVisible = !1, this.inputValue = "", this.$message.warning({ message: "标签已存在!", showClose: !0 });
153
174
  return;
154
175
  }
155
176
  const e = [...this.tags];
156
- 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();
157
178
  }
158
179
  this.inputVisible = !1, this.inputValue = "";
159
180
  });
160
181
  }
161
182
  }
162
- }, g = {};
163
- var C = /* @__PURE__ */ V(
164
- I,
183
+ }, m = {};
184
+ var I = /* @__PURE__ */ V(
185
+ C,
165
186
  w,
166
187
  x,
167
188
  !1,
@@ -171,12 +192,12 @@ var C = /* @__PURE__ */ V(
171
192
  null
172
193
  );
173
194
  function T(t) {
174
- for (let a in g)
175
- this[a] = g[a];
195
+ for (let s in m)
196
+ this[s] = m[s];
176
197
  }
177
- const $ = /* @__PURE__ */ function() {
178
- return C.exports;
198
+ const j = /* @__PURE__ */ function() {
199
+ return I.exports;
179
200
  }();
180
201
  export {
181
- $ as default
202
+ j as default
182
203
  };
@@ -1 +1 @@
1
- .el-form-item.is-error .fy-input-tag{border-color:#f56c6c}.fy-input-tag{height:120px;padding:0 10px 10px;overflow:auto;border:1px solid var(--border-color);border-radius:4px}.fy-input-tag .el-tag{margin-top:10px;margin-right:10px}.fy-input-tag .el-tag+.el-tag{margin-right:10px}.fy-input-tag .button-new-tag{height:28px;margin-top:10px;padding-top:0;padding-bottom:0;line-height:26px}.fy-input-tag .el-input.input-new-tag{width:170px;height:28px;margin-top:10px;line-height:26px;vertical-align:bottom}
1
+ .el-form-item.is-error .x-input-tag{border-color:#f56c6c}.x-input-tag{height:120px;overflow:auto;border:1px solid var(--border-color);border-radius:4px;line-height:0;padding-top:4px;padding-right:4px}.x-input-tag .el-tag .el-tag__close:hover{background-color:#ee8677}.x-input-tag .el-tag,.x-input-tag .button-new-tag{margin-left:4px;margin-bottom:4px}.x-input-tag .el-input.input-new-tag{width:120px;margin-left:4px;margin-bottom:4px}.x-input-tag .tags-count{position:absolute;right:6px;bottom:10px;color:#b7b7b7;font-size:.9em}