@web-utils/component 2.8.0 → 2.8.1

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.
@@ -0,0 +1,182 @@
1
+ var f = Object.defineProperty, _ = Object.defineProperties;
2
+ var v = Object.getOwnPropertyDescriptors;
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]);
8
+ if (p)
9
+ for (var e of p(a))
10
+ b.call(a, e) && h(t, e, a[e]);
11
+ return t;
12
+ }, d = (t, a) => _(t, v(a));
13
+ var u = (t, a, e) => new Promise((s, n) => {
14
+ var o = (i) => {
15
+ try {
16
+ l(e.next(i));
17
+ } catch (r) {
18
+ n(r);
19
+ }
20
+ }, c = (i) => {
21
+ try {
22
+ l(e.throw(i));
23
+ } catch (r) {
24
+ n(r);
25
+ }
26
+ }, l = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(o, c);
27
+ l((e = e.apply(t, a)).next());
28
+ });
29
+ import { n as V } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
30
+ var w = function() {
31
+ var t = this, a = t.$createElement, e = t._self._c || a;
32
+ return e("div", {
33
+ staticClass: "fy-input-tag"
34
+ }, [t._l(t.tags, function(s, n) {
35
+ return e("ElTag", {
36
+ key: s.id,
37
+ attrs: {
38
+ closable: !t.inputDisabled,
39
+ "disable-transitions": !t.arrayMode
40
+ },
41
+ on: {
42
+ close: function(o) {
43
+ return t.handleClose(s, n);
44
+ }
45
+ }
46
+ }, [t._v(" " + t._s(s.tagName) + " ")]);
47
+ }), !t.inputDisabled && t.inputVisible ? e("ElInput", {
48
+ ref: "saveTagInput",
49
+ staticClass: "input-new-tag",
50
+ attrs: {
51
+ size: "small"
52
+ },
53
+ on: {
54
+ blur: t.handleInputConfirm
55
+ },
56
+ 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);
59
+ }
60
+ },
61
+ model: {
62
+ value: t.inputValue,
63
+ callback: function(s) {
64
+ t.inputValue = s;
65
+ },
66
+ expression: "inputValue"
67
+ }
68
+ }) : t._e(), !t.inputDisabled && !t.inputVisible ? e("ElButton", {
69
+ directives: [{
70
+ name: "show",
71
+ rawName: "v-show",
72
+ value: t.tags.length < t.maxTag,
73
+ expression: "tags.length < maxTag"
74
+ }],
75
+ staticClass: "button-new-tag",
76
+ attrs: {
77
+ size: "small"
78
+ },
79
+ on: {
80
+ click: t.showInput
81
+ }
82
+ }, [t._v(" + 添加 ")]) : t._e()], 2);
83
+ }, x = [];
84
+ const I = {
85
+ name: "XInputTag",
86
+ inject: {
87
+ elForm: {
88
+ default: ""
89
+ },
90
+ elFormItem: {
91
+ default: ""
92
+ }
93
+ },
94
+ props: {
95
+ value: {
96
+ type: [Array, String],
97
+ default: () => []
98
+ },
99
+ disabled: Boolean,
100
+ separator: {
101
+ type: String,
102
+ default: ","
103
+ },
104
+ arrayMode: {
105
+ type: Boolean,
106
+ default: !0
107
+ }
108
+ },
109
+ data() {
110
+ return {
111
+ inputVisible: !1,
112
+ inputValue: "",
113
+ maxTag: 20
114
+ };
115
+ },
116
+ computed: {
117
+ inputDisabled() {
118
+ return this.disabled || (this.elForm || {}).disabled;
119
+ },
120
+ tags: {
121
+ get() {
122
+ var t, a;
123
+ 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() })) : [];
125
+ {
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() })) : [];
128
+ }
129
+ }
130
+ }
131
+ },
132
+ methods: {
133
+ showInput() {
134
+ return u(this, null, function* () {
135
+ this.inputVisible = !0, yield this.$nextTick(), this.$refs.saveTagInput.$refs.input.focus();
136
+ });
137
+ },
138
+ 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));
141
+ },
142
+ handleInputConfirm() {
143
+ return u(this, null, function* () {
144
+ var a;
145
+ if (this.tags.length >= this.maxTag) {
146
+ this.$message.warning({ message: "标签已达上限,请删除一些标签再添加!", showClose: !0 }), this.inputVisible = !1, this.inputValue = "";
147
+ return;
148
+ }
149
+ const t = this.inputValue;
150
+ if (t) {
151
+ if (this.tags.some((s) => s.tagName === t)) {
152
+ this.inputVisible = !1, this.inputValue = "", this.$message.warning({ message: "标签已存在!", showClose: !0 });
153
+ return;
154
+ }
155
+ 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();
157
+ }
158
+ this.inputVisible = !1, this.inputValue = "";
159
+ });
160
+ }
161
+ }
162
+ }, g = {};
163
+ var C = /* @__PURE__ */ V(
164
+ I,
165
+ w,
166
+ x,
167
+ !1,
168
+ T,
169
+ null,
170
+ null,
171
+ null
172
+ );
173
+ function T(t) {
174
+ for (let a in g)
175
+ this[a] = g[a];
176
+ }
177
+ const $ = /* @__PURE__ */ function() {
178
+ return C.exports;
179
+ }();
180
+ export {
181
+ $ as default
182
+ };
@@ -0,0 +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}