@qynpm/ui 1.0.35 → 1.0.37
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 +85 -34
- package/dist/index.cjs +5 -4
- package/dist/index.mjs +61 -59
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +1 -1
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +1 -1
- package/dist/qy-drawer/index.cjs +1 -1
- package/dist/qy-drawer/index.mjs +1 -1
- package/dist/qy-file-picker/index.cjs +1 -1
- package/dist/qy-file-picker/index.mjs +1 -1
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +1 -1
- package/dist/qy-fullscreen/index.cjs +1 -1
- package/dist/qy-fullscreen/index.mjs +1 -1
- package/dist/qy-icon/index.cjs +1 -1
- package/dist/qy-icon/index.mjs +2 -2
- package/dist/qy-icon-picker/index.cjs +2 -2
- package/dist/qy-icon-picker/index.mjs +2 -2
- package/dist/qy-image-upload/index.cjs +1 -1
- package/dist/qy-image-upload/index.mjs +1 -1
- package/dist/qy-input-number/index.cjs +1 -1
- package/dist/qy-input-number/index.mjs +1 -1
- package/dist/qy-input-tag/index.cjs +1 -0
- package/dist/qy-input-tag/index.mjs +7 -0
- package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
- package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
- package/dist/qy-money-input/index.cjs +1 -1
- package/dist/qy-money-input/index.mjs +5 -2
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +1 -1
- package/dist/qy-remark-image/index.cjs +1 -1
- package/dist/qy-remark-image/index.mjs +1 -1
- package/dist/qy-remote-select/index.cjs +1 -1
- package/dist/qy-remote-select/index.mjs +1 -1
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +1 -1
- package/dist/qy-selection-dialog/index.cjs +1 -1
- package/dist/qy-selection-dialog/index.mjs +1 -1
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +5 -2
- package/dist/shared/index-3KGa3jVi.mjs +2754 -0
- package/dist/shared/{index-DY-CA7Vr.mjs → index-BF6f9QDU.mjs} +1 -1
- package/dist/shared/{index-Bi9wgcgT.cjs → index-BQEymEbE.cjs} +1 -1
- package/dist/shared/{index-3qEac4h8.cjs → index-BTbiht5h.cjs} +1 -1
- package/dist/shared/index-BYX0biqw.mjs +766 -0
- package/dist/shared/index-BxxwEr52.mjs +107 -0
- package/dist/shared/index-C1i-hd-W.cjs +1 -0
- package/dist/shared/{index-S8HW36Mc.mjs → index-Crr3HB8g.mjs} +1 -1
- package/dist/shared/index-D8kce2jH.cjs +1 -0
- package/dist/shared/index-Di_xbC7d.cjs +1 -0
- package/dist/shared/index-Dm8kY2v6.mjs +285 -0
- package/dist/shared/index-DnNIseRJ.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-BiIgNax-.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DIWWHODS.mjs +197 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DwFGEW4B.mjs +143 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-ccFLNRry.cjs +1 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-B1FgJZbw.mjs +148 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-CAW_QOyJ.cjs +1 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-DVXf-yUs.cjs +1 -0
- package/dist/shared/index.vue_vue_type_style_index_0_lang-Dr9Elmzn.mjs +317 -0
- package/index.d.ts +82 -25
- package/package.json +490 -483
- package/qy-file-picker/index.d.ts +4 -1
- package/qy-icon/index.d.ts +9 -6
- package/qy-image-preview/index.d.ts +0 -1
- package/qy-image-upload/index.d.ts +69 -12
- package/qy-input/index.d.ts +76 -18
- package/qy-input-number/index.d.ts +64 -30
- package/qy-input-tag/index.d.ts +69 -0
- package/qy-money-input/index.d.ts +87 -12
- package/qy-upload/index.d.ts +99 -5
- package/dist/shared/index-AMu0L6uU.cjs +0 -1
- package/dist/shared/index-BekN1g_r.mjs +0 -3541
- package/dist/shared/index-BkX9xlbI.cjs +0 -1
- package/dist/shared/index-C91mzAI3.mjs +0 -254
- package/dist/shared/index-C_1KP3l9.mjs +0 -129
- package/dist/shared/index-Ce_hvR--.cjs +0 -1
- package/dist/shared/index.vue_vue_type_style_index_0_lang-B0CXLnL1.mjs +0 -132
- package/dist/shared/index.vue_vue_type_style_index_0_lang-BcZb1U13.cjs +0 -1
- package/dist/shared/index.vue_vue_type_style_index_0_lang-CIcZet5j.mjs +0 -286
- package/dist/shared/index.vue_vue_type_style_index_0_lang-DccRGtZE.cjs +0 -1
- /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-q37rBg6Z.mjs → index.vue_vue_type_script_setup_true_lang-CGsXVhJy.mjs} +0 -0
- /package/dist/shared/{index.vue_vue_type_script_setup_true_lang-CglCPcj-.cjs → index.vue_vue_type_script_setup_true_lang-Dk83TGiU.cjs} +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { defineComponent as D, useAttrs as q, useSlots as B, inject as V, computed as y, markRaw as M, toRaw as F, ref as W, watchEffect as O, openBlock as I, createElementBlock as _, mergeProps as Y, unref as Q, createBlock as A, resolveDynamicComponent as N, createElementVNode as Z, normalizeClass as G, renderSlot as H, normalizeProps as J, guardReactiveProps as U, createCommentVNode as X } from "vue";
|
|
2
|
+
import { _ as ee } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
3
|
+
const R = Symbol("QyIconRegistry"), E = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
function C(e) {
|
|
5
|
+
const r = [], o = /* @__PURE__ */ new Map();
|
|
6
|
+
for (const s of (e == null ? void 0 : e.icons) ?? []) {
|
|
7
|
+
const n = w(s == null ? void 0 : s.name);
|
|
8
|
+
if (!n)
|
|
9
|
+
throw new Error("QyIcon definition name must not be empty.");
|
|
10
|
+
const a = b(n);
|
|
11
|
+
if (o.has(a))
|
|
12
|
+
throw new Error(`Duplicate icon name "${n}".`);
|
|
13
|
+
const i = re(s, n);
|
|
14
|
+
r.push(i), o.set(a, i);
|
|
15
|
+
}
|
|
16
|
+
const c = [], f = /* @__PURE__ */ new Map();
|
|
17
|
+
for (const s of x(e == null ? void 0 : e.aliases)) {
|
|
18
|
+
const n = w(s.name), a = w(s.target), i = b(n), v = b(a);
|
|
19
|
+
if (!n)
|
|
20
|
+
throw new Error("QyIcon alias name must not be empty.");
|
|
21
|
+
if (!a)
|
|
22
|
+
throw new Error(`QyIcon alias "${n}" target must not be empty.`);
|
|
23
|
+
if (o.has(i))
|
|
24
|
+
throw new Error(`Icon alias "${n}" conflicts with a canonical icon name.`);
|
|
25
|
+
if (f.has(i))
|
|
26
|
+
throw new Error(`Duplicate icon alias "${n}".`);
|
|
27
|
+
const p = o.get(v);
|
|
28
|
+
if (!p)
|
|
29
|
+
throw new Error(`Icon alias "${n}" target "${a}" not found.`);
|
|
30
|
+
f.set(i, b(p.name)), c.push(Object.freeze({ name: n, target: p.name }));
|
|
31
|
+
}
|
|
32
|
+
let l = Object.freeze({
|
|
33
|
+
definitions: Object.freeze(r),
|
|
34
|
+
aliases: Object.freeze(c),
|
|
35
|
+
byName: o,
|
|
36
|
+
aliasTargets: f
|
|
37
|
+
}), m, u = !1;
|
|
38
|
+
const d = () => {
|
|
39
|
+
if (!e.loader) return m ?? (m = Promise.resolve());
|
|
40
|
+
u = !1;
|
|
41
|
+
let s;
|
|
42
|
+
try {
|
|
43
|
+
s = e.loader();
|
|
44
|
+
} catch (n) {
|
|
45
|
+
s = Promise.reject(n);
|
|
46
|
+
}
|
|
47
|
+
return m = Promise.resolve(s).then((n) => {
|
|
48
|
+
let a;
|
|
49
|
+
try {
|
|
50
|
+
a = C({
|
|
51
|
+
icons: [...l.definitions, ...n.icons],
|
|
52
|
+
aliases: [...l.aliases, ...x(n.aliases)]
|
|
53
|
+
});
|
|
54
|
+
} catch (i) {
|
|
55
|
+
const v = i instanceof Error ? i.message : String(i);
|
|
56
|
+
throw new Error(`Icon registry load conflict: ${v}`);
|
|
57
|
+
}
|
|
58
|
+
l = E.get(a), E.set(h, l);
|
|
59
|
+
}).catch((n) => {
|
|
60
|
+
throw u = !0, n;
|
|
61
|
+
}), m;
|
|
62
|
+
}, h = Object.freeze({
|
|
63
|
+
resolve(s) {
|
|
64
|
+
const n = b(w(s)), a = l.aliasTargets.get(n) ?? n, i = l.byName.get(a);
|
|
65
|
+
return i ? P(i) : void 0;
|
|
66
|
+
},
|
|
67
|
+
has(s) {
|
|
68
|
+
const n = b(w(s));
|
|
69
|
+
return l.byName.has(l.aliasTargets.get(n) ?? n);
|
|
70
|
+
},
|
|
71
|
+
list() {
|
|
72
|
+
return Object.freeze(l.definitions.map(P));
|
|
73
|
+
},
|
|
74
|
+
load() {
|
|
75
|
+
return m ?? d();
|
|
76
|
+
},
|
|
77
|
+
retry() {
|
|
78
|
+
return u ? d() : Promise.reject(new Error("QyIcon registry retry is only available after a failed load."));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return E.set(h, l), h;
|
|
82
|
+
}
|
|
83
|
+
function ue(...e) {
|
|
84
|
+
const r = [], o = [];
|
|
85
|
+
for (const c of e) {
|
|
86
|
+
const f = E.get(c);
|
|
87
|
+
if (!f)
|
|
88
|
+
throw new TypeError("mergeQyIconRegistries accepts only QyIcon registries created by this package.");
|
|
89
|
+
r.push(...f.definitions), o.push(...f.aliases);
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
return C({ icons: r, aliases: o });
|
|
93
|
+
} catch (c) {
|
|
94
|
+
const f = c instanceof Error ? c.message : String(c);
|
|
95
|
+
throw new Error(`Icon registry merge conflict: ${f}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function fe(e) {
|
|
99
|
+
if (!E.has(e))
|
|
100
|
+
throw new TypeError("createQyIconPlugin accepts only a QyIcon registry created by this package.");
|
|
101
|
+
return Object.freeze({
|
|
102
|
+
install(r) {
|
|
103
|
+
r.provide(R, e);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function w(e) {
|
|
108
|
+
const r = typeof e == "string" || typeof e == "number" ? String(e).trim() : "";
|
|
109
|
+
if (!r) return "";
|
|
110
|
+
const o = /^#icon-(.+)$/i.exec(r);
|
|
111
|
+
if (o) return o[1].trim();
|
|
112
|
+
const c = /^icon-\[([^\[\]]+?)--([^\[\]]+?)\]$/i.exec(r);
|
|
113
|
+
return c ? `iconify:${c[1]}:${c[2]}` : r;
|
|
114
|
+
}
|
|
115
|
+
function b(e) {
|
|
116
|
+
return e.toLocaleLowerCase();
|
|
117
|
+
}
|
|
118
|
+
function x(e) {
|
|
119
|
+
return e ? Array.isArray(e) ? [...e] : Object.entries(e).map(([r, o]) => ({ name: r, target: o })) : [];
|
|
120
|
+
}
|
|
121
|
+
function re(e, r) {
|
|
122
|
+
const o = {
|
|
123
|
+
...e.label === void 0 ? {} : { label: te(e.label, r) },
|
|
124
|
+
...e.keywords === void 0 ? {} : { keywords: oe(e.keywords, r) }
|
|
125
|
+
};
|
|
126
|
+
switch (e.source) {
|
|
127
|
+
case "symbol":
|
|
128
|
+
return z({
|
|
129
|
+
name: r,
|
|
130
|
+
source: "symbol",
|
|
131
|
+
value: k("symbol", e.value, r),
|
|
132
|
+
...o
|
|
133
|
+
});
|
|
134
|
+
case "component":
|
|
135
|
+
return z({
|
|
136
|
+
name: r,
|
|
137
|
+
source: "component",
|
|
138
|
+
value: k("component", e.value, r),
|
|
139
|
+
...o
|
|
140
|
+
});
|
|
141
|
+
case "class":
|
|
142
|
+
return z({
|
|
143
|
+
name: r,
|
|
144
|
+
source: "class",
|
|
145
|
+
value: k("class", e.value, r),
|
|
146
|
+
...o
|
|
147
|
+
});
|
|
148
|
+
default:
|
|
149
|
+
throw new Error(`QyIcon definition "${r}" has unsupported source "${String(e.source)}".`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function k(e, r, o) {
|
|
153
|
+
if (e === "symbol") {
|
|
154
|
+
if (typeof r != "string" || !/^#[^\s#]+$/.test(r))
|
|
155
|
+
throw new Error(`QyIcon symbol "${o}" must be a same-document #fragment.`);
|
|
156
|
+
return r;
|
|
157
|
+
}
|
|
158
|
+
if (e === "component") {
|
|
159
|
+
if (typeof r != "object" && typeof r != "function" || r === null)
|
|
160
|
+
throw new Error(`QyIcon component "${o}" must be a Vue component.`);
|
|
161
|
+
return r;
|
|
162
|
+
}
|
|
163
|
+
if (e !== "class")
|
|
164
|
+
throw new Error(`QyIcon definition "${o}" has unsupported source "${String(e)}".`);
|
|
165
|
+
if (typeof r != "string" || !r.trim() || !/^[A-Za-z0-9_:.\/\[\]%-]+(?:\s+[A-Za-z0-9_:.\/\[\]%-]+)*$/.test(r.trim()))
|
|
166
|
+
throw new Error(`QyIcon class "${o}" must be a trusted static class string.`);
|
|
167
|
+
return r.trim();
|
|
168
|
+
}
|
|
169
|
+
function te(e, r) {
|
|
170
|
+
if (typeof e != "string")
|
|
171
|
+
throw new Error(`QyIcon label "${r}" must be a string.`);
|
|
172
|
+
return e;
|
|
173
|
+
}
|
|
174
|
+
function oe(e, r) {
|
|
175
|
+
if (!Array.isArray(e) || e.some((o) => typeof o != "string"))
|
|
176
|
+
throw new Error(`QyIcon keywords "${r}" must be strings.`);
|
|
177
|
+
return Object.freeze([...e]);
|
|
178
|
+
}
|
|
179
|
+
function z(e) {
|
|
180
|
+
return e.keywords && !Object.isFrozen(e.keywords) && (e = { ...e, keywords: Object.freeze([...e.keywords]) }), Object.freeze(e);
|
|
181
|
+
}
|
|
182
|
+
function P(e) {
|
|
183
|
+
return z({
|
|
184
|
+
...e,
|
|
185
|
+
...e.keywords ? { keywords: [...e.keywords] } : {}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const ne = ["role", "aria-label", "aria-hidden", "data-qy-icon-missing"], se = {
|
|
189
|
+
key: 1,
|
|
190
|
+
"aria-hidden": "true",
|
|
191
|
+
focusable: "false"
|
|
192
|
+
}, ae = ["href", "xlink:href"], ie = /* @__PURE__ */ D({
|
|
193
|
+
name: "QyIcon",
|
|
194
|
+
inheritAttrs: !1,
|
|
195
|
+
__name: "index",
|
|
196
|
+
props: {
|
|
197
|
+
name: {},
|
|
198
|
+
icon: {},
|
|
199
|
+
size: { default: "1em" },
|
|
200
|
+
color: { default: "currentColor" },
|
|
201
|
+
spin: { type: Boolean, default: !1 },
|
|
202
|
+
label: {}
|
|
203
|
+
},
|
|
204
|
+
setup(e) {
|
|
205
|
+
const r = e, o = q(), c = B(), f = V(R, null), l = y(
|
|
206
|
+
() => r.icon ? M(F(r.icon)) : void 0
|
|
207
|
+
), m = y(
|
|
208
|
+
() => r.name === void 0 || r.name === null ? "" : w(r.name)
|
|
209
|
+
), u = y(() => {
|
|
210
|
+
if (!(r.icon || !f || !m.value))
|
|
211
|
+
return f.resolve(m.value);
|
|
212
|
+
}), d = W(null), h = y(() => !!(!r.icon && m.value && !u.value)), s = y(() => {
|
|
213
|
+
const t = typeof r.label == "string" ? r.label.trim() : "";
|
|
214
|
+
if (t) return t;
|
|
215
|
+
const g = o["aria-label"];
|
|
216
|
+
return L(g) ? String(g) : "";
|
|
217
|
+
}), n = y(() => s.value ? "img" : o.role), a = y(() => K(r.size)), i = y(() => ({
|
|
218
|
+
width: a.value,
|
|
219
|
+
height: a.value,
|
|
220
|
+
fontSize: a.value,
|
|
221
|
+
color: r.color || "currentColor"
|
|
222
|
+
})), v = y(() => {
|
|
223
|
+
const t = {};
|
|
224
|
+
for (const [g, $] of Object.entries(o))
|
|
225
|
+
T(g) && (t[g] = $);
|
|
226
|
+
return t;
|
|
227
|
+
}), p = y(() => Object.freeze({ name: m.value }));
|
|
228
|
+
O(() => {
|
|
229
|
+
const t = u.value;
|
|
230
|
+
d.value && (t == null ? void 0 : t.source) === "symbol" && (d.value.setAttributeNS(
|
|
231
|
+
"http://www.w3.org/1999/xlink",
|
|
232
|
+
"xlink:href",
|
|
233
|
+
t.value
|
|
234
|
+
), d.value.setAttribute("xlink:href", t.value));
|
|
235
|
+
}), O(() => {
|
|
236
|
+
});
|
|
237
|
+
function K(t) {
|
|
238
|
+
return typeof t == "number" ? Number.isFinite(t) && t > 0 ? `${t}px` : "1em" : t.trim() || "1em";
|
|
239
|
+
}
|
|
240
|
+
function L(t) {
|
|
241
|
+
return typeof t == "string" ? t.trim().length > 0 : t != null && t !== !1;
|
|
242
|
+
}
|
|
243
|
+
function T(t) {
|
|
244
|
+
return t !== "class" && t !== "style" && t !== "role" && t !== "aria-label" && t !== "aria-hidden" && t !== "data-qy-icon-missing" && (t === "id" || t === "title" || t.startsWith("data-") || t.startsWith("aria-"));
|
|
245
|
+
}
|
|
246
|
+
return (t, g) => {
|
|
247
|
+
var $, S, j;
|
|
248
|
+
return I(), _("span", Y(v.value, {
|
|
249
|
+
class: ["qy-icon", [Q(o).class, { "is-spin": r.spin }]],
|
|
250
|
+
style: [Q(o).style, i.value],
|
|
251
|
+
role: n.value,
|
|
252
|
+
"aria-label": s.value || void 0,
|
|
253
|
+
"aria-hidden": s.value ? void 0 : "true",
|
|
254
|
+
"data-qy-icon-missing": h.value ? m.value : void 0
|
|
255
|
+
}), [
|
|
256
|
+
l.value ? (I(), A(N(l.value), {
|
|
257
|
+
key: 0,
|
|
258
|
+
"aria-hidden": "true"
|
|
259
|
+
})) : (($ = u.value) == null ? void 0 : $.source) === "symbol" ? (I(), _("svg", se, [
|
|
260
|
+
Z("use", {
|
|
261
|
+
ref_key: "symbolElement",
|
|
262
|
+
ref: d,
|
|
263
|
+
href: u.value.value,
|
|
264
|
+
"xlink:href": u.value.value
|
|
265
|
+
}, null, 8, ae)
|
|
266
|
+
])) : ((S = u.value) == null ? void 0 : S.source) === "component" ? (I(), A(N(u.value.value), {
|
|
267
|
+
key: 2,
|
|
268
|
+
"aria-hidden": "true"
|
|
269
|
+
})) : ((j = u.value) == null ? void 0 : j.source) === "class" ? (I(), _("span", {
|
|
270
|
+
key: 3,
|
|
271
|
+
class: G(["qy-icon__class", u.value.value]),
|
|
272
|
+
"aria-hidden": "true"
|
|
273
|
+
}, null, 2)) : h.value && Q(c).fallback ? H(t.$slots, "fallback", J(U(p.value)), void 0, !0, 4) : X("", !0)
|
|
274
|
+
], 16, ne);
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}), me = /* @__PURE__ */ ee(ie, [["__scopeId", "data-v-e4e9c6ae"]]);
|
|
278
|
+
export {
|
|
279
|
+
me as I,
|
|
280
|
+
R as Q,
|
|
281
|
+
C as a,
|
|
282
|
+
fe as c,
|
|
283
|
+
ue as m,
|
|
284
|
+
w as n
|
|
285
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),x=require("./index-C1i-hd-W.cjs"),V=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),w=["tabindex","aria-disabled","onClick","onKeydown"],C={class:"qy-file-picker__label"},D={key:0,class:"qy-file-picker__hint"},F=["disabled"],q=e.defineComponent({name:"QyFilePicker",__name:"index",props:{modelValue:{default:null},extensions:{default:()=>[]},maxSizeMb:{default:20},disabled:{type:Boolean,default:!1},drag:{type:Boolean,default:!0},placeholder:{default:"请选择文件"}},emits:["update:modelValue","change","clear","invalid"],setup(l,{expose:h,emit:b}){const a=l,t=b,n=e.ref(null),d=e.ref(!1),v=e.computed(()=>a.modelValue?[a.modelValue]:[]);let o=!1;function p(){var i;a.disabled||(i=n.value)==null||i.openFileDialog()}function c(){var i;o=!0,(i=n.value)==null||i.clearFiles(),o=!1,t("update:modelValue",null),t("change",null),t("clear")}function g(){a.disabled||c()}function u(){!a.disabled&&a.drag&&(d.value=!0)}function f(){d.value=!1}function k(i){if(o)return;const s=i[0]??null;t("update:modelValue",s),t("change",s)}function y(i){t("invalid",i)}return h({openFileDialog:p,clear:c}),(i,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["qy-file-picker",{"is-disabled":l.disabled,"is-dragover":d.value}])},[e.createVNode(x.Upload,{ref_key:"uploadRef",ref:n,variant:"file-list","auto-upload":!1,"selected-files":v.value,"file-type":l.extensions,"file-size":l.maxSizeMb,disabled:l.disabled,"disable-drag":!l.drag,multiple:!1,limit:1,"show-text":!1,"show-paste-input":!1,"onUpdate:selectedFiles":k,onInvalid:y},{trigger:e.withCtx(({open:r})=>{var m;return[e.createElementVNode("div",{class:e.normalizeClass(["qy-file-picker__dropzone",{"is-click-only":!l.drag}]),role:"button",tabindex:l.disabled?-1:0,"aria-disabled":l.disabled?"true":void 0,onClick:r,onKeydown:[e.withKeys(e.withModifiers(r,["prevent"]),["enter"]),e.withKeys(e.withModifiers(r,["prevent"]),["space"])],onDragenter:e.withModifiers(u,["prevent"]),onDragover:e.withModifiers(u,["prevent"]),onDragleave:e.withModifiers(f,["prevent"]),onDrop:f},[e.createElementVNode("span",C,e.toDisplayString(((m=l.modelValue)==null?void 0:m.name)||l.placeholder),1),l.drag?(e.openBlock(),e.createElementBlock("span",D," 点击选择或拖拽单个文件到此处 ")):e.createCommentVNode("",!0)],42,w)]}),_:1},8,["selected-files","file-type","file-size","disabled","disable-drag"]),l.modelValue?(e.openBlock(),e.createElementBlock("button",{key:0,class:"qy-file-picker__clear",type:"button",disabled:l.disabled,onClick:e.withModifiers(g,["stop"])}," 清空 ",8,F)):e.createCommentVNode("",!0)],2))}}),B=V._export_sfc(q,[["__scopeId","data-v-71a5d74d"]]);exports.FilePicker=B;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("vue"),A=require("element-plus"),S=a.defineComponent({name:"QyInputTag",inheritAttrs:!1,__name:"index",props:{modelValue:{default:()=>[]},max:{},trigger:{default:"enter"},tagTone:{default:"neutral"},tagEffect:{default:"light"},size:{},clearable:{type:Boolean},disabled:{type:Boolean},readonly:{type:Boolean},placeholder:{},autofocus:{type:Boolean},validateEvent:{type:Boolean,default:!0},id:{},tabindex:{},maxlength:{},minlength:{},autocomplete:{},ariaLabel:{}},emits:["update:modelValue","change","input","add","remove","clear","focus","blur"],setup(s,{expose:c,emit:f}){const t=s,o=f,g=a.useAttrs(),r=a.ref(null),u=a.ref(null),m=a.computed(()=>Object.fromEntries(Object.entries(g).filter(([e])=>e==="class"||e==="style"||e==="title"||e==="role"||e.startsWith("data-")||e.startsWith("aria-")))),p=a.computed(()=>t.tagTone==="neutral"?"info":t.tagTone),h=a.computed(()=>t.trigger==="space"?"Space":"Enter");function i(e){return e?[...e]:[]}function v(e,n){if(e.length!==n.length+1)return null;for(let l=0;l<e.length;l+=1)if(e[l]!==n[l]&&e.slice(l+1).every((d,z)=>d===n[l+z]))return{value:e[l],index:l};return{value:e[e.length-1],index:e.length-1}}function x(e){const n=i(t.modelValue),l=i(e);u.value=l.length===0&&n.length>0?null:v(n,l),o("update:modelValue",l)}function b(e){o("change",i(e))}function y(e){o("input",e)}function T(e){o("add",e)}function C(e){const n=u.value,l=(n==null?void 0:n.value)===e?n.index:i(t.modelValue).indexOf(e);o("remove",e,l),u.value=null}function B(){o("clear"),u.value=null}function V(e){o("focus",e)}function E(e){o("blur",e)}function R(){var e,n;(n=(e=r.value)==null?void 0:e.focus)==null||n.call(e)}function $(){var e,n;(n=(e=r.value)==null?void 0:e.blur)==null||n.call(e)}return c({focus:R,blur:$}),(e,n)=>(a.openBlock(),a.createBlock(a.unref(A.ElInputTag),a.mergeProps({ref_key:"inputTagRef",ref:r,class:"qy-input-tag"},m.value,{"model-value":t.modelValue,max:t.max,"tag-type":p.value,"tag-effect":t.tagEffect,trigger:h.value,size:t.size,clearable:t.clearable,disabled:t.disabled,readonly:t.readonly,placeholder:t.placeholder,autofocus:t.autofocus,"validate-event":t.validateEvent,id:t.id,tabindex:t.tabindex,maxlength:t.maxlength,minlength:t.minlength,autocomplete:t.autocomplete,"aria-label":t.ariaLabel,"onUpdate:modelValue":x,onChange:b,onInput:y,onAddTag:T,onRemoveTag:C,onClear:B,onFocusCapture:V,onBlurCapture:E}),a.createSlots({_:2},[e.$slots.tag?{name:"tag",fn:a.withCtx(({value:l,index:d})=>[a.renderSlot(e.$slots,"tag",{value:l,index:d})]),key:"0"}:void 0,e.$slots.prefix?{name:"prefix",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"prefix")]),key:"1"}:void 0,e.$slots.suffix?{name:"suffix",fn:a.withCtx(()=>[a.renderSlot(e.$slots,"suffix")]),key:"2"}:void 0]),1040,["model-value","max","tag-type","tag-effect","trigger","size","clearable","disabled","readonly","placeholder","autofocus","validate-event","id","tabindex","maxlength","minlength","autocomplete","aria-label"]))}});exports._sfc_main=S;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { defineComponent as R, useAttrs as U, ref as x, computed as D, watch as Q, openBlock as j, createBlock as q, unref as V, mergeProps as G, withKeys as H, createSlots as J, withCtx as m, renderSlot as p } from "vue";
|
|
2
|
+
import { ElInput as O } from "element-plus";
|
|
3
|
+
const Y = /* @__PURE__ */ R({
|
|
4
|
+
name: "QyMoneyInput",
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { default: "" },
|
|
9
|
+
precision: { default: 2 },
|
|
10
|
+
min: { default: void 0 },
|
|
11
|
+
max: { default: void 0 },
|
|
12
|
+
allowNegative: { type: Boolean, default: !1 },
|
|
13
|
+
formatTrigger: { default: "blur" },
|
|
14
|
+
emptyValue: { default: "" },
|
|
15
|
+
placeholder: { default: void 0 },
|
|
16
|
+
clearable: { type: Boolean, default: !1 },
|
|
17
|
+
disabled: { type: Boolean, default: !1 },
|
|
18
|
+
readonly: { type: Boolean, default: !1 },
|
|
19
|
+
size: { default: void 0 },
|
|
20
|
+
name: { default: void 0 },
|
|
21
|
+
id: { default: void 0 },
|
|
22
|
+
autocomplete: { default: void 0 },
|
|
23
|
+
autofocus: { type: Boolean, default: !1 },
|
|
24
|
+
maxlength: { default: void 0 },
|
|
25
|
+
minlength: { default: void 0 },
|
|
26
|
+
tabindex: { default: void 0 },
|
|
27
|
+
ariaLabel: { default: void 0 }
|
|
28
|
+
},
|
|
29
|
+
emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
|
|
30
|
+
setup(a, { expose: N, emit: $ }) {
|
|
31
|
+
const t = a, u = $, B = U(), r = x(null), f = x(l(t.modelValue)), M = D(() => l(t.modelValue));
|
|
32
|
+
Q(
|
|
33
|
+
() => t.modelValue,
|
|
34
|
+
(e) => {
|
|
35
|
+
f.value = l(e);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
function l(e) {
|
|
39
|
+
return e == null ? "" : String(e);
|
|
40
|
+
}
|
|
41
|
+
function g(e) {
|
|
42
|
+
return Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 2;
|
|
43
|
+
}
|
|
44
|
+
function c(e) {
|
|
45
|
+
const n = l(e);
|
|
46
|
+
let i = "", s = !1, y = !1;
|
|
47
|
+
const b = g(t.precision);
|
|
48
|
+
for (let d = 0; d < n.length; d += 1) {
|
|
49
|
+
const o = n[d];
|
|
50
|
+
if (o >= "0" && o <= "9") {
|
|
51
|
+
i += o;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (o === "." && b > 0 && !s) {
|
|
55
|
+
i += o, s = !0;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
o === "-" && t.allowNegative && d === 0 && !y && (i += o, y = !0);
|
|
59
|
+
}
|
|
60
|
+
if (b > 0 && s) {
|
|
61
|
+
const [d, o = ""] = i.split(".");
|
|
62
|
+
return `${d}.${o.slice(0, b)}`;
|
|
63
|
+
}
|
|
64
|
+
return i;
|
|
65
|
+
}
|
|
66
|
+
function k(e) {
|
|
67
|
+
let n = e;
|
|
68
|
+
return typeof t.min == "number" && Number.isFinite(t.min) && (n = Math.max(n, t.min)), typeof t.max == "number" && Number.isFinite(t.max) && (n = Math.min(n, t.max)), n;
|
|
69
|
+
}
|
|
70
|
+
function v(e) {
|
|
71
|
+
const n = c(e);
|
|
72
|
+
if (!n || n === "-" || n === ".")
|
|
73
|
+
return l(t.emptyValue);
|
|
74
|
+
const i = Number(n);
|
|
75
|
+
if (Number.isNaN(i)) return l(t.emptyValue);
|
|
76
|
+
const s = g(t.precision);
|
|
77
|
+
return k(i).toFixed(s);
|
|
78
|
+
}
|
|
79
|
+
function h(e) {
|
|
80
|
+
f.value = e, u("update:modelValue", e);
|
|
81
|
+
}
|
|
82
|
+
function z(e) {
|
|
83
|
+
const n = c(e);
|
|
84
|
+
h(n);
|
|
85
|
+
}
|
|
86
|
+
function w(e) {
|
|
87
|
+
const n = c(e);
|
|
88
|
+
f.value = n, u("input", n);
|
|
89
|
+
}
|
|
90
|
+
function C(e) {
|
|
91
|
+
const n = t.formatTrigger === "change" ? v(e) : c(e);
|
|
92
|
+
n !== l(t.modelValue) && h(n), u("change", n);
|
|
93
|
+
}
|
|
94
|
+
function F(e) {
|
|
95
|
+
u("focus", e);
|
|
96
|
+
}
|
|
97
|
+
function I(e) {
|
|
98
|
+
if (t.formatTrigger === "blur") {
|
|
99
|
+
const n = v(f.value);
|
|
100
|
+
n !== l(t.modelValue) && h(n);
|
|
101
|
+
}
|
|
102
|
+
u("blur", e);
|
|
103
|
+
}
|
|
104
|
+
function A() {
|
|
105
|
+
const e = l(t.emptyValue);
|
|
106
|
+
f.value = e, u("update:modelValue", e), u("clear");
|
|
107
|
+
}
|
|
108
|
+
function S(e) {
|
|
109
|
+
u("enter", e);
|
|
110
|
+
}
|
|
111
|
+
function T() {
|
|
112
|
+
var e, n;
|
|
113
|
+
(n = (e = r.value) == null ? void 0 : e.focus) == null || n.call(e);
|
|
114
|
+
}
|
|
115
|
+
function E() {
|
|
116
|
+
var e, n;
|
|
117
|
+
(n = (e = r.value) == null ? void 0 : e.blur) == null || n.call(e);
|
|
118
|
+
}
|
|
119
|
+
function K() {
|
|
120
|
+
var e, n;
|
|
121
|
+
(n = (e = r.value) == null ? void 0 : e.select) == null || n.call(e);
|
|
122
|
+
}
|
|
123
|
+
function L() {
|
|
124
|
+
var e, n;
|
|
125
|
+
(n = (e = r.value) == null ? void 0 : e.clear) == null || n.call(e);
|
|
126
|
+
}
|
|
127
|
+
function P() {
|
|
128
|
+
var e;
|
|
129
|
+
return ((e = r.value) == null ? void 0 : e.input) || null;
|
|
130
|
+
}
|
|
131
|
+
return N({
|
|
132
|
+
focus: T,
|
|
133
|
+
blur: E,
|
|
134
|
+
select: K,
|
|
135
|
+
clear: L,
|
|
136
|
+
getNativeInput: P
|
|
137
|
+
}), (e, n) => (j(), q(V(O), G({
|
|
138
|
+
ref_key: "inputRef",
|
|
139
|
+
ref: r
|
|
140
|
+
}, V(B), {
|
|
141
|
+
"model-value": M.value,
|
|
142
|
+
inputmode: "decimal",
|
|
143
|
+
placeholder: a.placeholder,
|
|
144
|
+
clearable: a.clearable,
|
|
145
|
+
disabled: a.disabled,
|
|
146
|
+
readonly: a.readonly,
|
|
147
|
+
size: a.size,
|
|
148
|
+
name: a.name,
|
|
149
|
+
id: a.id,
|
|
150
|
+
autocomplete: a.autocomplete,
|
|
151
|
+
autofocus: a.autofocus,
|
|
152
|
+
maxlength: a.maxlength,
|
|
153
|
+
minlength: a.minlength,
|
|
154
|
+
tabindex: a.tabindex,
|
|
155
|
+
"aria-label": a.ariaLabel,
|
|
156
|
+
"onUpdate:modelValue": z,
|
|
157
|
+
onInput: w,
|
|
158
|
+
onChange: C,
|
|
159
|
+
onFocus: F,
|
|
160
|
+
onBlur: I,
|
|
161
|
+
onClear: A,
|
|
162
|
+
onKeydown: H(S, ["enter"])
|
|
163
|
+
}), J({ _: 2 }, [
|
|
164
|
+
e.$slots.prefix ? {
|
|
165
|
+
name: "prefix",
|
|
166
|
+
fn: m(() => [
|
|
167
|
+
p(e.$slots, "prefix")
|
|
168
|
+
]),
|
|
169
|
+
key: "0"
|
|
170
|
+
} : void 0,
|
|
171
|
+
e.$slots.suffix ? {
|
|
172
|
+
name: "suffix",
|
|
173
|
+
fn: m(() => [
|
|
174
|
+
p(e.$slots, "suffix")
|
|
175
|
+
]),
|
|
176
|
+
key: "1"
|
|
177
|
+
} : void 0,
|
|
178
|
+
e.$slots.prepend ? {
|
|
179
|
+
name: "prepend",
|
|
180
|
+
fn: m(() => [
|
|
181
|
+
p(e.$slots, "prepend")
|
|
182
|
+
]),
|
|
183
|
+
key: "2"
|
|
184
|
+
} : void 0,
|
|
185
|
+
e.$slots.append ? {
|
|
186
|
+
name: "append",
|
|
187
|
+
fn: m(() => [
|
|
188
|
+
p(e.$slots, "append")
|
|
189
|
+
]),
|
|
190
|
+
key: "3"
|
|
191
|
+
} : void 0
|
|
192
|
+
]), 1040, ["model-value", "placeholder", "clearable", "disabled", "readonly", "size", "name", "id", "autocomplete", "autofocus", "maxlength", "minlength", "tabindex", "aria-label"]));
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
export {
|
|
196
|
+
Y as _
|
|
197
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { defineComponent as S, useAttrs as _, ref as f, computed as d, openBlock as j, createBlock as F, unref as L, mergeProps as U, createSlots as W, withCtx as s, renderSlot as c } from "vue";
|
|
2
|
+
import { ElInputTag as k } from "element-plus";
|
|
3
|
+
const M = /* @__PURE__ */ S({
|
|
4
|
+
name: "QyInputTag",
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { default: () => [] },
|
|
9
|
+
max: {},
|
|
10
|
+
trigger: { default: "enter" },
|
|
11
|
+
tagTone: { default: "neutral" },
|
|
12
|
+
tagEffect: { default: "light" },
|
|
13
|
+
size: {},
|
|
14
|
+
clearable: { type: Boolean },
|
|
15
|
+
disabled: { type: Boolean },
|
|
16
|
+
readonly: { type: Boolean },
|
|
17
|
+
placeholder: {},
|
|
18
|
+
autofocus: { type: Boolean },
|
|
19
|
+
validateEvent: { type: Boolean, default: !0 },
|
|
20
|
+
id: {},
|
|
21
|
+
tabindex: {},
|
|
22
|
+
maxlength: {},
|
|
23
|
+
minlength: {},
|
|
24
|
+
autocomplete: {},
|
|
25
|
+
ariaLabel: {}
|
|
26
|
+
},
|
|
27
|
+
emits: ["update:modelValue", "change", "input", "add", "remove", "clear", "focus", "blur"],
|
|
28
|
+
setup(g, { expose: m, emit: p }) {
|
|
29
|
+
const t = g, l = p, h = _(), i = f(null), o = f(null), v = d(() => Object.fromEntries(
|
|
30
|
+
Object.entries(h).filter(
|
|
31
|
+
([e]) => e === "class" || e === "style" || e === "title" || e === "role" || e.startsWith("data-") || e.startsWith("aria-")
|
|
32
|
+
)
|
|
33
|
+
)), x = d(
|
|
34
|
+
() => t.tagTone === "neutral" ? "info" : t.tagTone
|
|
35
|
+
), b = d(
|
|
36
|
+
() => t.trigger === "space" ? "Space" : "Enter"
|
|
37
|
+
);
|
|
38
|
+
function u(e) {
|
|
39
|
+
return e ? [...e] : [];
|
|
40
|
+
}
|
|
41
|
+
function y(e, a) {
|
|
42
|
+
if (e.length !== a.length + 1) return null;
|
|
43
|
+
for (let n = 0; n < e.length; n += 1)
|
|
44
|
+
if (e[n] !== a[n] && e.slice(n + 1).every((r, O) => r === a[n + O]))
|
|
45
|
+
return { value: e[n], index: n };
|
|
46
|
+
return { value: e[e.length - 1], index: e.length - 1 };
|
|
47
|
+
}
|
|
48
|
+
function T(e) {
|
|
49
|
+
const a = u(t.modelValue), n = u(e);
|
|
50
|
+
o.value = n.length === 0 && a.length > 0 ? null : y(a, n), l("update:modelValue", n);
|
|
51
|
+
}
|
|
52
|
+
function B(e) {
|
|
53
|
+
l("change", u(e));
|
|
54
|
+
}
|
|
55
|
+
function C(e) {
|
|
56
|
+
l("input", e);
|
|
57
|
+
}
|
|
58
|
+
function V(e) {
|
|
59
|
+
l("add", e);
|
|
60
|
+
}
|
|
61
|
+
function E(e) {
|
|
62
|
+
const a = o.value, n = (a == null ? void 0 : a.value) === e ? a.index : u(t.modelValue).indexOf(e);
|
|
63
|
+
l("remove", e, n), o.value = null;
|
|
64
|
+
}
|
|
65
|
+
function R() {
|
|
66
|
+
l("clear"), o.value = null;
|
|
67
|
+
}
|
|
68
|
+
function $(e) {
|
|
69
|
+
l("focus", e);
|
|
70
|
+
}
|
|
71
|
+
function z(e) {
|
|
72
|
+
l("blur", e);
|
|
73
|
+
}
|
|
74
|
+
function A() {
|
|
75
|
+
var e, a;
|
|
76
|
+
(a = (e = i.value) == null ? void 0 : e.focus) == null || a.call(e);
|
|
77
|
+
}
|
|
78
|
+
function I() {
|
|
79
|
+
var e, a;
|
|
80
|
+
(a = (e = i.value) == null ? void 0 : e.blur) == null || a.call(e);
|
|
81
|
+
}
|
|
82
|
+
return m({ focus: A, blur: I }), (e, a) => (j(), F(L(k), U({
|
|
83
|
+
ref_key: "inputTagRef",
|
|
84
|
+
ref: i,
|
|
85
|
+
class: "qy-input-tag"
|
|
86
|
+
}, v.value, {
|
|
87
|
+
"model-value": t.modelValue,
|
|
88
|
+
max: t.max,
|
|
89
|
+
"tag-type": x.value,
|
|
90
|
+
"tag-effect": t.tagEffect,
|
|
91
|
+
trigger: b.value,
|
|
92
|
+
size: t.size,
|
|
93
|
+
clearable: t.clearable,
|
|
94
|
+
disabled: t.disabled,
|
|
95
|
+
readonly: t.readonly,
|
|
96
|
+
placeholder: t.placeholder,
|
|
97
|
+
autofocus: t.autofocus,
|
|
98
|
+
"validate-event": t.validateEvent,
|
|
99
|
+
id: t.id,
|
|
100
|
+
tabindex: t.tabindex,
|
|
101
|
+
maxlength: t.maxlength,
|
|
102
|
+
minlength: t.minlength,
|
|
103
|
+
autocomplete: t.autocomplete,
|
|
104
|
+
"aria-label": t.ariaLabel,
|
|
105
|
+
"onUpdate:modelValue": T,
|
|
106
|
+
onChange: B,
|
|
107
|
+
onInput: C,
|
|
108
|
+
onAddTag: V,
|
|
109
|
+
onRemoveTag: E,
|
|
110
|
+
onClear: R,
|
|
111
|
+
onFocusCapture: $,
|
|
112
|
+
onBlurCapture: z
|
|
113
|
+
}), W({ _: 2 }, [
|
|
114
|
+
e.$slots.tag ? {
|
|
115
|
+
name: "tag",
|
|
116
|
+
fn: s(({ value: n, index: r }) => [
|
|
117
|
+
c(e.$slots, "tag", {
|
|
118
|
+
value: n,
|
|
119
|
+
index: r
|
|
120
|
+
})
|
|
121
|
+
]),
|
|
122
|
+
key: "0"
|
|
123
|
+
} : void 0,
|
|
124
|
+
e.$slots.prefix ? {
|
|
125
|
+
name: "prefix",
|
|
126
|
+
fn: s(() => [
|
|
127
|
+
c(e.$slots, "prefix")
|
|
128
|
+
]),
|
|
129
|
+
key: "1"
|
|
130
|
+
} : void 0,
|
|
131
|
+
e.$slots.suffix ? {
|
|
132
|
+
name: "suffix",
|
|
133
|
+
fn: s(() => [
|
|
134
|
+
c(e.$slots, "suffix")
|
|
135
|
+
]),
|
|
136
|
+
key: "2"
|
|
137
|
+
} : void 0
|
|
138
|
+
]), 1040, ["model-value", "max", "tag-type", "tag-effect", "trigger", "size", "clearable", "disabled", "readonly", "placeholder", "autofocus", "validate-event", "id", "tabindex", "maxlength", "minlength", "autocomplete", "aria-label"]));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
export {
|
|
142
|
+
M as _
|
|
143
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("vue"),q=require("element-plus"),E=t.defineComponent({name:"QyMoneyInput",inheritAttrs:!1,__name:"index",props:{modelValue:{default:""},precision:{default:2},min:{default:void 0},max:{default:void 0},allowNegative:{type:Boolean,default:!1},formatTrigger:{default:"blur"},emptyValue:{default:""},placeholder:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},size:{default:void 0},name:{default:void 0},id:{default:void 0},autocomplete:{default:void 0},autofocus:{type:Boolean,default:!1},maxlength:{default:void 0},minlength:{default:void 0},tabindex:{default:void 0},ariaLabel:{default:void 0}},emits:["update:modelValue","input","change","focus","blur","clear","enter"],setup(l,{expose:g,emit:y}){const a=l,i=y,V=t.useAttrs(),d=t.ref(null),s=t.ref(u(a.modelValue)),N=t.computed(()=>u(a.modelValue));t.watch(()=>a.modelValue,e=>{s.value=u(e)});function u(e){return e==null?"":String(e)}function b(e){return Number.isFinite(e)?Math.max(0,Math.floor(e)):2}function m(e){const n=u(e);let r="",c=!1,x=!1;const h=b(a.precision);for(let f=0;f<n.length;f+=1){const o=n[f];if(o>="0"&&o<="9"){r+=o;continue}if(o==="."&&h>0&&!c){r+=o,c=!0;continue}o==="-"&&a.allowNegative&&f===0&&!x&&(r+=o,x=!0)}if(h>0&&c){const[f,o=""]=r.split(".");return`${f}.${o.slice(0,h)}`}return r}function $(e){let n=e;return typeof a.min=="number"&&Number.isFinite(a.min)&&(n=Math.max(n,a.min)),typeof a.max=="number"&&Number.isFinite(a.max)&&(n=Math.min(n,a.max)),n}function v(e){const n=m(e);if(!n||n==="-"||n===".")return u(a.emptyValue);const r=Number(n);if(Number.isNaN(r))return u(a.emptyValue);const c=b(a.precision);return $(r).toFixed(c)}function p(e){s.value=e,i("update:modelValue",e)}function w(e){const n=m(e);p(n)}function B(e){const n=m(e);s.value=n,i("input",n)}function C(e){const n=a.formatTrigger==="change"?v(e):m(e);n!==u(a.modelValue)&&p(n),i("change",n)}function M(e){i("focus",e)}function k(e){if(a.formatTrigger==="blur"){const n=v(s.value);n!==u(a.modelValue)&&p(n)}i("blur",e)}function z(){const e=u(a.emptyValue);s.value=e,i("update:modelValue",e),i("clear")}function F(e){i("enter",e)}function I(){var e,n;(n=(e=d.value)==null?void 0:e.focus)==null||n.call(e)}function S(){var e,n;(n=(e=d.value)==null?void 0:e.blur)==null||n.call(e)}function A(){var e,n;(n=(e=d.value)==null?void 0:e.select)==null||n.call(e)}function P(){var e,n;(n=(e=d.value)==null?void 0:e.clear)==null||n.call(e)}function T(){var e;return((e=d.value)==null?void 0:e.input)||null}return g({focus:I,blur:S,select:A,clear:P,getNativeInput:T}),(e,n)=>(t.openBlock(),t.createBlock(t.unref(q.ElInput),t.mergeProps({ref_key:"inputRef",ref:d},t.unref(V),{"model-value":N.value,inputmode:"decimal",placeholder:l.placeholder,clearable:l.clearable,disabled:l.disabled,readonly:l.readonly,size:l.size,name:l.name,id:l.id,autocomplete:l.autocomplete,autofocus:l.autofocus,maxlength:l.maxlength,minlength:l.minlength,tabindex:l.tabindex,"aria-label":l.ariaLabel,"onUpdate:modelValue":w,onInput:B,onChange:C,onFocus:M,onBlur:k,onClear:z,onKeydown:t.withKeys(F,["enter"])}),t.createSlots({_:2},[e.$slots.prefix?{name:"prefix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"prefix")]),key:"0"}:void 0,e.$slots.suffix?{name:"suffix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"suffix")]),key:"1"}:void 0,e.$slots.prepend?{name:"prepend",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"prepend")]),key:"2"}:void 0,e.$slots.append?{name:"append",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"append")]),key:"3"}:void 0]),1040,["model-value","placeholder","clearable","disabled","readonly","size","name","id","autocomplete","autofocus","maxlength","minlength","tabindex","aria-label"]))}});exports._sfc_main=E;
|