tool_ui1 0.1.0
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/dist/affix/Affix.vue.d.ts +29 -0
- package/dist/affix/Affix.vue.d.ts.map +1 -0
- package/dist/affix/index.d.ts +49 -0
- package/dist/affix/index.d.ts.map +1 -0
- package/dist/avatar/Avatar.vue.d.ts +29 -0
- package/dist/avatar/Avatar.vue.d.ts.map +1 -0
- package/dist/avatar/index.d.ts +49 -0
- package/dist/avatar/index.d.ts.map +1 -0
- package/dist/button/Button.vue.d.ts +56 -0
- package/dist/button/Button.vue.d.ts.map +1 -0
- package/dist/button/index.d.ts +126 -0
- package/dist/button/index.d.ts.map +1 -0
- package/dist/card/Card.vue.d.ts +24 -0
- package/dist/card/Card.vue.d.ts.map +1 -0
- package/dist/card/index.d.ts +32 -0
- package/dist/card/index.d.ts.map +1 -0
- package/dist/checkbox/Checkbox.vue.d.ts +44 -0
- package/dist/checkbox/Checkbox.vue.d.ts.map +1 -0
- package/dist/checkbox/CheckboxGroup.vue.d.ts +31 -0
- package/dist/checkbox/CheckboxGroup.vue.d.ts.map +1 -0
- package/dist/checkbox/context.d.ts +9 -0
- package/dist/checkbox/context.d.ts.map +1 -0
- package/dist/checkbox/index.d.ts +125 -0
- package/dist/checkbox/index.d.ts.map +1 -0
- package/dist/dialog/Dialog.vue.d.ts +42 -0
- package/dist/dialog/Dialog.vue.d.ts.map +1 -0
- package/dist/dialog/index.d.ts +83 -0
- package/dist/dialog/index.d.ts.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/input/Input.vue.d.ts +24 -0
- package/dist/input/Input.vue.d.ts.map +1 -0
- package/dist/input/index.d.ts +29 -0
- package/dist/input/index.d.ts.map +1 -0
- package/dist/input-label/InputLabel.vue.d.ts +35 -0
- package/dist/input-label/InputLabel.vue.d.ts.map +1 -0
- package/dist/input-label/index.d.ts +42 -0
- package/dist/input-label/index.d.ts.map +1 -0
- package/dist/menu/Menu.vue.d.ts +22 -0
- package/dist/menu/Menu.vue.d.ts.map +1 -0
- package/dist/menu/index.d.ts +20 -0
- package/dist/menu/index.d.ts.map +1 -0
- package/dist/message/Message.vue.d.ts +25 -0
- package/dist/message/Message.vue.d.ts.map +1 -0
- package/dist/message/index.d.ts +64 -0
- package/dist/message/index.d.ts.map +1 -0
- package/dist/radio/Radio.vue.d.ts +32 -0
- package/dist/radio/Radio.vue.d.ts.map +1 -0
- package/dist/radio/RadioGroup.vue.d.ts +30 -0
- package/dist/radio/RadioGroup.vue.d.ts.map +1 -0
- package/dist/radio/context.d.ts +8 -0
- package/dist/radio/context.d.ts.map +1 -0
- package/dist/radio/index.d.ts +102 -0
- package/dist/radio/index.d.ts.map +1 -0
- package/dist/select/Select.vue.d.ts +19 -0
- package/dist/select/Select.vue.d.ts.map +1 -0
- package/dist/select/index.d.ts +25 -0
- package/dist/select/index.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/switch/Switch.vue.d.ts +20 -0
- package/dist/switch/Switch.vue.d.ts.map +1 -0
- package/dist/switch/index.d.ts +24 -0
- package/dist/switch/index.d.ts.map +1 -0
- package/dist/table/Table.vue.d.ts +81 -0
- package/dist/table/Table.vue.d.ts.map +1 -0
- package/dist/table/index.d.ts +105 -0
- package/dist/table/index.d.ts.map +1 -0
- package/dist/tag/Tag.vue.d.ts +31 -0
- package/dist/tag/Tag.vue.d.ts.map +1 -0
- package/dist/tag/index.d.ts +53 -0
- package/dist/tag/index.d.ts.map +1 -0
- package/dist/theme/applyTheme.d.ts +5 -0
- package/dist/theme/applyTheme.d.ts.map +1 -0
- package/dist/theme/createThemeCode.d.ts +3 -0
- package/dist/theme/createThemeCode.d.ts.map +1 -0
- package/dist/theme/index.cjs +3 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +45 -0
- package/dist/theme/tokens.d.ts +23 -0
- package/dist/theme/tokens.d.ts.map +1 -0
- package/dist/theme-editor/ThemeEditor.vue.d.ts +8 -0
- package/dist/theme-editor/ThemeEditor.vue.d.ts.map +1 -0
- package/dist/theme-editor/ThemeEditorDialog.vue.d.ts +16 -0
- package/dist/theme-editor/ThemeEditorDialog.vue.d.ts.map +1 -0
- package/dist/theme-editor/index.d.ts +3 -0
- package/dist/theme-editor/index.d.ts.map +1 -0
- package/dist/u1design.cjs +1 -0
- package/dist/u1design.js +1252 -0
- package/package.json +54 -0
package/dist/u1design.js
ADDED
|
@@ -0,0 +1,1252 @@
|
|
|
1
|
+
import { defineComponent as k, computed as g, openBlock as i, createElementBlock as u, normalizeStyle as I, normalizeClass as _, renderSlot as C, ref as U, watch as N, useAttrs as ae, mergeProps as H, createCommentVNode as $, createElementVNode as r, createTextVNode as z, toDisplayString as v, inject as W, onMounted as le, provide as X, toRef as Y, reactive as E, onBeforeUnmount as q, Fragment as S, renderList as D, withKeys as K, withModifiers as G, h as ne, createVNode as oe, render as J, unref as P, createBlock as F, withCtx as se } from "vue";
|
|
2
|
+
import { createU1ThemeCode as ie, u1ThemeTokens as A, applyU1Theme as ue, resetU1Theme as de } from "./theme/index.js";
|
|
3
|
+
const ce = /* @__PURE__ */ k({
|
|
4
|
+
name: "U1Affix",
|
|
5
|
+
__name: "Affix",
|
|
6
|
+
props: {
|
|
7
|
+
offset: { default: 0 },
|
|
8
|
+
position: { default: "top" },
|
|
9
|
+
zIndex: { default: 100 },
|
|
10
|
+
disabled: { type: Boolean, default: !1 }
|
|
11
|
+
},
|
|
12
|
+
setup(e) {
|
|
13
|
+
const l = e, t = g(() => typeof l.offset == "number" ? `${l.offset}px` : l.offset), s = g(() => {
|
|
14
|
+
if (l.disabled)
|
|
15
|
+
return {};
|
|
16
|
+
let a = {
|
|
17
|
+
position: "sticky",
|
|
18
|
+
zIndex: l.zIndex
|
|
19
|
+
};
|
|
20
|
+
return a[l.position] = t.value, a;
|
|
21
|
+
});
|
|
22
|
+
return (a, d) => (i(), u("div", {
|
|
23
|
+
class: _(["u1-affix", { "is-disabled": e.disabled }]),
|
|
24
|
+
style: I(s.value)
|
|
25
|
+
}, [
|
|
26
|
+
C(a.$slots, "default")
|
|
27
|
+
], 6));
|
|
28
|
+
}
|
|
29
|
+
}), re = ce, fe = ["src", "alt"], pe = {
|
|
30
|
+
key: 1,
|
|
31
|
+
class: "u1-avatar__text"
|
|
32
|
+
}, me = /* @__PURE__ */ k({
|
|
33
|
+
name: "U1Avatar",
|
|
34
|
+
__name: "Avatar",
|
|
35
|
+
props: {
|
|
36
|
+
src: { default: "" },
|
|
37
|
+
alt: { default: "" },
|
|
38
|
+
size: { default: "default" },
|
|
39
|
+
shape: { default: "circle" }
|
|
40
|
+
},
|
|
41
|
+
setup(e) {
|
|
42
|
+
const l = e, t = U(!1), s = g(() => !!l.src && !t.value);
|
|
43
|
+
return N(
|
|
44
|
+
() => l.src,
|
|
45
|
+
() => {
|
|
46
|
+
t.value = !1;
|
|
47
|
+
}
|
|
48
|
+
), (a, d) => (i(), u("span", {
|
|
49
|
+
class: _(["u1-avatar", [`u1-avatar--${e.size}`, `u1-avatar--${e.shape}`]])
|
|
50
|
+
}, [
|
|
51
|
+
s.value ? (i(), u("img", {
|
|
52
|
+
key: 0,
|
|
53
|
+
class: "u1-avatar__image",
|
|
54
|
+
src: e.src,
|
|
55
|
+
alt: e.alt,
|
|
56
|
+
onError: d[0] || (d[0] = (n) => t.value = !0)
|
|
57
|
+
}, null, 40, fe)) : (i(), u("span", pe, [
|
|
58
|
+
C(a.$slots, "default")
|
|
59
|
+
]))
|
|
60
|
+
], 2));
|
|
61
|
+
}
|
|
62
|
+
}), he = me, be = ["disabled", "type"], ge = {
|
|
63
|
+
key: 0,
|
|
64
|
+
class: "u1-button__loading",
|
|
65
|
+
"aria-hidden": "true"
|
|
66
|
+
}, ye = {
|
|
67
|
+
key: 1,
|
|
68
|
+
class: "u1-button__icon is-left"
|
|
69
|
+
}, ve = {
|
|
70
|
+
key: 2,
|
|
71
|
+
class: "u1-button__icon is-left",
|
|
72
|
+
"aria-hidden": "true"
|
|
73
|
+
}, _e = { class: "u1-button__content" }, $e = {
|
|
74
|
+
key: 3,
|
|
75
|
+
class: "u1-button__icon is-right",
|
|
76
|
+
"aria-hidden": "true"
|
|
77
|
+
}, ke = /* @__PURE__ */ k({
|
|
78
|
+
name: "U1Button",
|
|
79
|
+
inheritAttrs: !1,
|
|
80
|
+
__name: "Button",
|
|
81
|
+
props: {
|
|
82
|
+
type: { default: "default" },
|
|
83
|
+
size: { default: "default" },
|
|
84
|
+
disabled: { type: Boolean, default: !1 },
|
|
85
|
+
loading: { type: Boolean, default: !1 },
|
|
86
|
+
label: { default: "" },
|
|
87
|
+
icon: { default: "" },
|
|
88
|
+
iconLeft: { default: "" },
|
|
89
|
+
iconRight: { default: "" },
|
|
90
|
+
plain: { type: Boolean, default: !1 },
|
|
91
|
+
round: { type: Boolean, default: !1 },
|
|
92
|
+
circle: { type: Boolean, default: !1 },
|
|
93
|
+
text: { type: Boolean, default: !1 },
|
|
94
|
+
link: { type: Boolean, default: !1 },
|
|
95
|
+
bg: { type: Boolean, default: !1 },
|
|
96
|
+
nativeType: { default: "button" }
|
|
97
|
+
},
|
|
98
|
+
emits: ["click"],
|
|
99
|
+
setup(e, { emit: l }) {
|
|
100
|
+
const t = e, s = l, a = ae(), d = [
|
|
101
|
+
"add",
|
|
102
|
+
"edit",
|
|
103
|
+
"delete",
|
|
104
|
+
"save",
|
|
105
|
+
"search",
|
|
106
|
+
"refresh",
|
|
107
|
+
"upload",
|
|
108
|
+
"download",
|
|
109
|
+
"copy",
|
|
110
|
+
"export",
|
|
111
|
+
"home",
|
|
112
|
+
"menu",
|
|
113
|
+
"setting",
|
|
114
|
+
"user",
|
|
115
|
+
"role",
|
|
116
|
+
"permission",
|
|
117
|
+
"dashboard",
|
|
118
|
+
"back",
|
|
119
|
+
"left",
|
|
120
|
+
"right",
|
|
121
|
+
"table",
|
|
122
|
+
"list",
|
|
123
|
+
"chart",
|
|
124
|
+
"database",
|
|
125
|
+
"file",
|
|
126
|
+
"folder",
|
|
127
|
+
"filter",
|
|
128
|
+
"sort",
|
|
129
|
+
"calendar",
|
|
130
|
+
"time",
|
|
131
|
+
"check",
|
|
132
|
+
"close",
|
|
133
|
+
"info",
|
|
134
|
+
"warning",
|
|
135
|
+
"error",
|
|
136
|
+
"success",
|
|
137
|
+
"loading",
|
|
138
|
+
"lock",
|
|
139
|
+
"unlock",
|
|
140
|
+
"view",
|
|
141
|
+
"hide"
|
|
142
|
+
];
|
|
143
|
+
function n(c) {
|
|
144
|
+
return c ? `is-${d.includes(c) ? c : "close"}` : "";
|
|
145
|
+
}
|
|
146
|
+
const f = g(() => [
|
|
147
|
+
`u1-button--${t.type}`,
|
|
148
|
+
`u1-button--${t.size}`,
|
|
149
|
+
{
|
|
150
|
+
"is-disabled": t.disabled,
|
|
151
|
+
"is-loading": t.loading,
|
|
152
|
+
"is-plain": t.plain,
|
|
153
|
+
"is-round": t.round,
|
|
154
|
+
"is-circle": t.circle,
|
|
155
|
+
"is-text": t.text,
|
|
156
|
+
"is-link": t.link,
|
|
157
|
+
"is-has-bg": t.bg
|
|
158
|
+
}
|
|
159
|
+
]), m = g(() => n(t.iconLeft || t.icon)), b = g(() => n(t.iconRight)), x = g(() => {
|
|
160
|
+
const c = Object.entries(a).filter(([y]) => y !== "tag" && y !== "href" && y !== "dashed");
|
|
161
|
+
return Object.fromEntries(c);
|
|
162
|
+
}), w = g(() => t.disabled || t.loading);
|
|
163
|
+
function V(c) {
|
|
164
|
+
if (w.value) {
|
|
165
|
+
c.preventDefault(), c.stopPropagation();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
s("click", c);
|
|
169
|
+
}
|
|
170
|
+
return (c, y) => (i(), u("button", H(x.value, {
|
|
171
|
+
class: ["u1-button", f.value],
|
|
172
|
+
disabled: w.value,
|
|
173
|
+
type: e.nativeType,
|
|
174
|
+
onClick: V
|
|
175
|
+
}), [
|
|
176
|
+
e.loading ? (i(), u("span", ge)) : $("", !0),
|
|
177
|
+
c.$slots.icon ? (i(), u("span", ye, [
|
|
178
|
+
C(c.$slots, "icon")
|
|
179
|
+
])) : m.value ? (i(), u("span", ve, [
|
|
180
|
+
r("span", {
|
|
181
|
+
class: _(["u1-icon-mark", m.value])
|
|
182
|
+
}, null, 2)
|
|
183
|
+
])) : $("", !0),
|
|
184
|
+
r("span", _e, [
|
|
185
|
+
C(c.$slots, "default", {}, () => [
|
|
186
|
+
z(v(e.label), 1)
|
|
187
|
+
])
|
|
188
|
+
]),
|
|
189
|
+
b.value ? (i(), u("span", $e, [
|
|
190
|
+
r("span", {
|
|
191
|
+
class: _(["u1-icon-mark", b.value])
|
|
192
|
+
}, null, 2)
|
|
193
|
+
])) : $("", !0)
|
|
194
|
+
], 16, be));
|
|
195
|
+
}
|
|
196
|
+
}), xe = ke, we = {
|
|
197
|
+
key: 0,
|
|
198
|
+
class: "u1-card__header"
|
|
199
|
+
}, Ve = { class: "u1-card__body" }, Ce = /* @__PURE__ */ k({
|
|
200
|
+
name: "U1Card",
|
|
201
|
+
__name: "Card",
|
|
202
|
+
props: {
|
|
203
|
+
shadow: { default: "always" }
|
|
204
|
+
},
|
|
205
|
+
setup(e) {
|
|
206
|
+
return (l, t) => (i(), u("section", {
|
|
207
|
+
class: _(["u1-card", `u1-card--shadow-${e.shadow}`])
|
|
208
|
+
}, [
|
|
209
|
+
l.$slots.header ? (i(), u("header", we, [
|
|
210
|
+
C(l.$slots, "header")
|
|
211
|
+
])) : $("", !0),
|
|
212
|
+
r("div", Ve, [
|
|
213
|
+
C(l.$slots, "default")
|
|
214
|
+
])
|
|
215
|
+
], 2));
|
|
216
|
+
}
|
|
217
|
+
}), Be = Ce, Q = Symbol("U1CheckboxGroup"), Ue = { class: "u1-checkbox__input" }, Te = ["checked", "disabled", "aria-checked"], Se = { class: "u1-checkbox__label" }, Ie = /* @__PURE__ */ k({
|
|
218
|
+
name: "U1Checkbox",
|
|
219
|
+
__name: "Checkbox",
|
|
220
|
+
props: {
|
|
221
|
+
modelValue: { type: [String, Number, Boolean], default: !1 },
|
|
222
|
+
label: { type: [String, Number, Boolean], default: "" },
|
|
223
|
+
disabled: { type: Boolean, default: !1 },
|
|
224
|
+
indeterminate: { type: Boolean, default: !1 },
|
|
225
|
+
trueValue: { type: [String, Number, Boolean], default: !0 },
|
|
226
|
+
falseValue: { type: [String, Number, Boolean], default: !1 }
|
|
227
|
+
},
|
|
228
|
+
emits: ["update:modelValue", "change"],
|
|
229
|
+
setup(e, { emit: l }) {
|
|
230
|
+
const t = e, s = l, a = W(Q, void 0), d = U(), n = g(() => a ? a.modelValue.value.includes(t.label) : t.modelValue === t.trueValue), f = g(() => t.disabled || (a == null ? void 0 : a.disabled.value) === !0), m = g(() => t.indeterminate ? "mixed" : n.value ? "true" : "false");
|
|
231
|
+
function b() {
|
|
232
|
+
d.value && (d.value.indeterminate = t.indeterminate);
|
|
233
|
+
}
|
|
234
|
+
le(b), N(() => t.indeterminate, b);
|
|
235
|
+
function x(w) {
|
|
236
|
+
if (f.value)
|
|
237
|
+
return;
|
|
238
|
+
const V = w.target.checked;
|
|
239
|
+
if (a) {
|
|
240
|
+
a.change(t.label, V);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const c = V ? t.trueValue : t.falseValue;
|
|
244
|
+
s("update:modelValue", c), s("change", c);
|
|
245
|
+
}
|
|
246
|
+
return (w, V) => (i(), u("label", {
|
|
247
|
+
class: _(["u1-checkbox", {
|
|
248
|
+
"is-checked": n.value,
|
|
249
|
+
"is-disabled": f.value,
|
|
250
|
+
"is-indeterminate": e.indeterminate
|
|
251
|
+
}])
|
|
252
|
+
}, [
|
|
253
|
+
r("span", Ue, [
|
|
254
|
+
r("input", {
|
|
255
|
+
ref_key: "inputRef",
|
|
256
|
+
ref: d,
|
|
257
|
+
class: "u1-checkbox__original",
|
|
258
|
+
type: "checkbox",
|
|
259
|
+
checked: n.value,
|
|
260
|
+
disabled: f.value,
|
|
261
|
+
"aria-checked": m.value,
|
|
262
|
+
onChange: x
|
|
263
|
+
}, null, 40, Te),
|
|
264
|
+
V[0] || (V[0] = r("span", { class: "u1-checkbox__inner" }, null, -1))
|
|
265
|
+
]),
|
|
266
|
+
r("span", Se, [
|
|
267
|
+
C(w.$slots, "default", {}, () => [
|
|
268
|
+
z(v(e.label), 1)
|
|
269
|
+
])
|
|
270
|
+
])
|
|
271
|
+
], 2));
|
|
272
|
+
}
|
|
273
|
+
}), ze = {
|
|
274
|
+
class: "u1-checkbox-group",
|
|
275
|
+
role: "group"
|
|
276
|
+
}, Le = /* @__PURE__ */ k({
|
|
277
|
+
name: "U1CheckboxGroup",
|
|
278
|
+
__name: "CheckboxGroup",
|
|
279
|
+
props: {
|
|
280
|
+
modelValue: {},
|
|
281
|
+
disabled: { type: Boolean, default: !1 }
|
|
282
|
+
},
|
|
283
|
+
emits: ["update:modelValue", "change"],
|
|
284
|
+
setup(e, { emit: l }) {
|
|
285
|
+
const t = e, s = l, a = g(() => t.modelValue);
|
|
286
|
+
function d(n, f) {
|
|
287
|
+
const m = f ? [...t.modelValue, n] : t.modelValue.filter((b) => b !== n);
|
|
288
|
+
s("update:modelValue", m), s("change", m);
|
|
289
|
+
}
|
|
290
|
+
return X(Q, {
|
|
291
|
+
modelValue: a,
|
|
292
|
+
disabled: Y(t, "disabled"),
|
|
293
|
+
change: d
|
|
294
|
+
}), (n, f) => (i(), u("div", ze, [
|
|
295
|
+
C(n.$slots, "default")
|
|
296
|
+
]));
|
|
297
|
+
}
|
|
298
|
+
}), Me = Ie, De = Le, Ne = ["aria-label"], Re = { class: "u1-dialog__title" }, Ee = { class: "u1-dialog__body" }, Z = /* @__PURE__ */ k({
|
|
299
|
+
name: "U1Dialog",
|
|
300
|
+
__name: "Dialog",
|
|
301
|
+
props: {
|
|
302
|
+
modelValue: { type: Boolean, default: !1 },
|
|
303
|
+
title: { default: "" },
|
|
304
|
+
width: { default: "50%" },
|
|
305
|
+
top: { default: "15vh" },
|
|
306
|
+
showClose: { type: Boolean, default: !0 },
|
|
307
|
+
lockScroll: { type: Boolean, default: !0 },
|
|
308
|
+
draggable: { type: Boolean, default: !0 }
|
|
309
|
+
},
|
|
310
|
+
emits: ["update:modelValue", "close"],
|
|
311
|
+
setup(e, { emit: l }) {
|
|
312
|
+
const t = e, s = l, a = E({ x: 0, y: 0 }), d = E({ x: 0, y: 0 }), n = U(!1), f = U(""), m = U(!1), b = typeof document < "u", x = g(() => typeof t.top == "number" ? `${t.top}px` : t.top), w = g(() => ({
|
|
313
|
+
width: t.width,
|
|
314
|
+
top: x.value,
|
|
315
|
+
transform: `translateX(-50%) translate(${a.x}px, ${a.y}px)`
|
|
316
|
+
}));
|
|
317
|
+
N(
|
|
318
|
+
() => t.modelValue,
|
|
319
|
+
(B) => {
|
|
320
|
+
if (B) {
|
|
321
|
+
c(), y();
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
o(), T();
|
|
325
|
+
},
|
|
326
|
+
{ immediate: !0 }
|
|
327
|
+
), q(() => {
|
|
328
|
+
o();
|
|
329
|
+
});
|
|
330
|
+
function V() {
|
|
331
|
+
s("update:modelValue", !1), s("close");
|
|
332
|
+
}
|
|
333
|
+
function c() {
|
|
334
|
+
a.x = 0, a.y = 0, d.x = 0, d.y = 0;
|
|
335
|
+
}
|
|
336
|
+
function y() {
|
|
337
|
+
!t.lockScroll || !b || document.body.style.overflow === "hidden" || (f.value = document.body.style.overflow, document.body.style.overflow = "hidden", m.value = !0);
|
|
338
|
+
}
|
|
339
|
+
function o() {
|
|
340
|
+
!t.lockScroll || !b || !m.value || (document.body.style.overflow = f.value, m.value = !1);
|
|
341
|
+
}
|
|
342
|
+
function h(B) {
|
|
343
|
+
t.draggable && (B.preventDefault(), n.value = !0, d.x = B.clientX, d.y = B.clientY, document.addEventListener("mousemove", p), document.addEventListener("mouseup", T));
|
|
344
|
+
}
|
|
345
|
+
function p(B) {
|
|
346
|
+
n.value && (a.x += B.clientX - d.x, a.y += B.clientY - d.y, d.x = B.clientX, d.y = B.clientY);
|
|
347
|
+
}
|
|
348
|
+
function T() {
|
|
349
|
+
n.value = !1, b && (document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", T));
|
|
350
|
+
}
|
|
351
|
+
return (B, la) => e.modelValue ? (i(), u("section", {
|
|
352
|
+
key: 0,
|
|
353
|
+
class: _(["u1-dialog", { "is-dragging": n.value }]),
|
|
354
|
+
style: I(w.value),
|
|
355
|
+
role: "dialog",
|
|
356
|
+
"aria-modal": "true",
|
|
357
|
+
"aria-label": e.title
|
|
358
|
+
}, [
|
|
359
|
+
r("header", {
|
|
360
|
+
class: _(["u1-dialog__header", { "is-draggable": e.draggable, "is-dragging": n.value }]),
|
|
361
|
+
onMousedown: h
|
|
362
|
+
}, [
|
|
363
|
+
C(B.$slots, "header", {}, () => [
|
|
364
|
+
r("span", Re, v(e.title), 1)
|
|
365
|
+
]),
|
|
366
|
+
e.showClose ? (i(), u("button", {
|
|
367
|
+
key: 0,
|
|
368
|
+
class: "u1-dialog__close",
|
|
369
|
+
type: "button",
|
|
370
|
+
"aria-label": "Close dialog",
|
|
371
|
+
onClick: V
|
|
372
|
+
}, "x")) : $("", !0)
|
|
373
|
+
], 34),
|
|
374
|
+
r("div", Ee, [
|
|
375
|
+
C(B.$slots, "default")
|
|
376
|
+
])
|
|
377
|
+
], 14, Ne)) : $("", !0);
|
|
378
|
+
}
|
|
379
|
+
}), Oe = Z, Ae = ["type", "value", "placeholder", "disabled"], Ke = ["disabled"], Ge = ["disabled", "aria-pressed", "aria-label"], Pe = /* @__PURE__ */ k({
|
|
380
|
+
name: "U1Input",
|
|
381
|
+
__name: "Input",
|
|
382
|
+
props: {
|
|
383
|
+
modelValue: { default: "" },
|
|
384
|
+
placeholder: { default: "" },
|
|
385
|
+
disabled: { type: Boolean, default: !1 },
|
|
386
|
+
clearable: { type: Boolean, default: !1 },
|
|
387
|
+
showPassword: { type: Boolean, default: !1 }
|
|
388
|
+
},
|
|
389
|
+
emits: ["update:modelValue", "change", "clear"],
|
|
390
|
+
setup(e, { emit: l }) {
|
|
391
|
+
const t = e, s = l, a = U(!1), d = g(() => t.showPassword ? a.value ? "text" : "password" : "text");
|
|
392
|
+
function n(x) {
|
|
393
|
+
s("update:modelValue", x.target.value);
|
|
394
|
+
}
|
|
395
|
+
function f(x) {
|
|
396
|
+
s("change", x.target.value);
|
|
397
|
+
}
|
|
398
|
+
function m() {
|
|
399
|
+
s("update:modelValue", ""), s("clear");
|
|
400
|
+
}
|
|
401
|
+
function b() {
|
|
402
|
+
t.disabled || (a.value = !a.value);
|
|
403
|
+
}
|
|
404
|
+
return (x, w) => (i(), u("span", {
|
|
405
|
+
class: _(["u1-input", { "is-disabled": e.disabled }])
|
|
406
|
+
}, [
|
|
407
|
+
r("input", {
|
|
408
|
+
class: "u1-input__inner",
|
|
409
|
+
type: d.value,
|
|
410
|
+
value: e.modelValue,
|
|
411
|
+
placeholder: e.placeholder,
|
|
412
|
+
disabled: e.disabled,
|
|
413
|
+
onInput: n,
|
|
414
|
+
onChange: f
|
|
415
|
+
}, null, 40, Ae),
|
|
416
|
+
e.clearable && e.modelValue ? (i(), u("button", {
|
|
417
|
+
key: 0,
|
|
418
|
+
class: "u1-input__clear",
|
|
419
|
+
type: "button",
|
|
420
|
+
disabled: e.disabled,
|
|
421
|
+
"aria-label": "clear",
|
|
422
|
+
onClick: m
|
|
423
|
+
}, "x", 8, Ke)) : $("", !0),
|
|
424
|
+
e.showPassword ? (i(), u("button", {
|
|
425
|
+
key: 1,
|
|
426
|
+
class: "u1-input__password",
|
|
427
|
+
type: "button",
|
|
428
|
+
disabled: e.disabled,
|
|
429
|
+
"aria-pressed": a.value ? "true" : "false",
|
|
430
|
+
"aria-label": a.value ? "hide password" : "show password",
|
|
431
|
+
onClick: b
|
|
432
|
+
}, v(a.value ? "hide" : "show"), 9, Ge)) : $("", !0)
|
|
433
|
+
], 2));
|
|
434
|
+
}
|
|
435
|
+
}), Fe = Pe, je = ["value", "placeholder", "disabled", "readonly", "inputmode"], He = ["disabled", "aria-pressed", "aria-label"], We = /* @__PURE__ */ k({
|
|
436
|
+
name: "U1InputLabel",
|
|
437
|
+
__name: "InputLabel",
|
|
438
|
+
props: {
|
|
439
|
+
modelValue: { default: "" },
|
|
440
|
+
label: { default: "" },
|
|
441
|
+
labelWidth: { default: "80px" },
|
|
442
|
+
labelPosition: { default: "right" },
|
|
443
|
+
inputWidth: { default: "220px" },
|
|
444
|
+
placeholder: { default: "" },
|
|
445
|
+
disabled: { type: Boolean, default: !1 },
|
|
446
|
+
readonly: { type: Boolean, default: !1 },
|
|
447
|
+
type: { default: "text" },
|
|
448
|
+
show: { type: Boolean, default: !1 }
|
|
449
|
+
},
|
|
450
|
+
emits: ["update:modelValue", "change"],
|
|
451
|
+
setup(e, { emit: l }) {
|
|
452
|
+
const t = e, s = l, a = U(!1), d = g(() => x(String(t.modelValue ?? ""))), n = g(() => !t.show || a.value ? d.value : d.value ? "***" : ""), f = g(() => ({
|
|
453
|
+
width: b(t.labelWidth),
|
|
454
|
+
textAlign: t.labelPosition
|
|
455
|
+
})), m = g(() => ({
|
|
456
|
+
width: b(t.inputWidth)
|
|
457
|
+
}));
|
|
458
|
+
function b(o) {
|
|
459
|
+
return typeof o == "number" ? `${o}px` : o;
|
|
460
|
+
}
|
|
461
|
+
function x(o) {
|
|
462
|
+
return t.type !== "number" ? o : o.replace(/\D/g, "");
|
|
463
|
+
}
|
|
464
|
+
function w(o) {
|
|
465
|
+
return !t.show || a.value ? o : o ? "***" : "";
|
|
466
|
+
}
|
|
467
|
+
function V(o) {
|
|
468
|
+
const h = o.target, p = x(h.value);
|
|
469
|
+
h.value = w(p), s("update:modelValue", p);
|
|
470
|
+
}
|
|
471
|
+
function c(o) {
|
|
472
|
+
const h = o.target, p = t.show && !a.value ? d.value : x(h.value);
|
|
473
|
+
h.value = w(p), s("change", p);
|
|
474
|
+
}
|
|
475
|
+
function y() {
|
|
476
|
+
t.disabled || (a.value = !a.value);
|
|
477
|
+
}
|
|
478
|
+
return (o, h) => (i(), u("span", {
|
|
479
|
+
class: _(["u1-input-label", { "is-disabled": e.disabled, "is-readonly": e.readonly }])
|
|
480
|
+
}, [
|
|
481
|
+
r("span", {
|
|
482
|
+
class: "u1-input-label__label",
|
|
483
|
+
style: I(f.value)
|
|
484
|
+
}, v(e.label), 5),
|
|
485
|
+
r("span", {
|
|
486
|
+
class: "u1-input-label__control",
|
|
487
|
+
style: I(m.value)
|
|
488
|
+
}, [
|
|
489
|
+
r("input", {
|
|
490
|
+
class: "u1-input-label__inner",
|
|
491
|
+
value: n.value,
|
|
492
|
+
placeholder: e.placeholder,
|
|
493
|
+
disabled: e.disabled,
|
|
494
|
+
readonly: e.readonly,
|
|
495
|
+
inputmode: e.type === "number" ? "numeric" : void 0,
|
|
496
|
+
type: "text",
|
|
497
|
+
onInput: V,
|
|
498
|
+
onChange: c
|
|
499
|
+
}, null, 40, je),
|
|
500
|
+
e.show ? (i(), u("button", {
|
|
501
|
+
key: 0,
|
|
502
|
+
class: "u1-input-label__toggle",
|
|
503
|
+
type: "button",
|
|
504
|
+
disabled: e.disabled,
|
|
505
|
+
"aria-pressed": a.value ? "true" : "false",
|
|
506
|
+
"aria-label": a.value ? "hide value" : "show value",
|
|
507
|
+
onClick: y
|
|
508
|
+
}, [
|
|
509
|
+
r("span", {
|
|
510
|
+
class: _(["u1-icon-mark", a.value ? "is-hide" : "is-view"]),
|
|
511
|
+
"aria-hidden": "true"
|
|
512
|
+
}, null, 2)
|
|
513
|
+
], 8, He)) : $("", !0)
|
|
514
|
+
], 4)
|
|
515
|
+
], 2));
|
|
516
|
+
}
|
|
517
|
+
}), Xe = We, Ye = ["disabled", "aria-current", "onClick", "onKeydown"], qe = /* @__PURE__ */ k({
|
|
518
|
+
name: "U1Menu",
|
|
519
|
+
__name: "Menu",
|
|
520
|
+
props: {
|
|
521
|
+
items: {},
|
|
522
|
+
active: { default: "" },
|
|
523
|
+
mode: { default: "vertical" }
|
|
524
|
+
},
|
|
525
|
+
emits: ["update:active", "select"],
|
|
526
|
+
setup(e, { emit: l }) {
|
|
527
|
+
const t = l;
|
|
528
|
+
function s(a) {
|
|
529
|
+
a.disabled || (t("update:active", a.index), t("select", a.index));
|
|
530
|
+
}
|
|
531
|
+
return (a, d) => (i(), u("nav", {
|
|
532
|
+
class: _(["u1-menu", `u1-menu--${e.mode}`])
|
|
533
|
+
}, [
|
|
534
|
+
(i(!0), u(S, null, D(e.items, (n) => (i(), u("button", {
|
|
535
|
+
key: n.index,
|
|
536
|
+
class: _(["u1-menu__item", {
|
|
537
|
+
"is-active": n.index === e.active,
|
|
538
|
+
"is-disabled": n.disabled
|
|
539
|
+
}]),
|
|
540
|
+
type: "button",
|
|
541
|
+
disabled: n.disabled,
|
|
542
|
+
"aria-current": n.index === e.active ? "page" : void 0,
|
|
543
|
+
onClick: (f) => s(n),
|
|
544
|
+
onKeydown: [
|
|
545
|
+
K(G((f) => s(n), ["prevent"]), ["enter"]),
|
|
546
|
+
K(G((f) => s(n), ["prevent"]), ["space"])
|
|
547
|
+
]
|
|
548
|
+
}, v(n.label), 43, Ye))), 128))
|
|
549
|
+
], 2));
|
|
550
|
+
}
|
|
551
|
+
}), Je = qe, Qe = {
|
|
552
|
+
class: "u1-message__icon",
|
|
553
|
+
"aria-hidden": "true"
|
|
554
|
+
}, Ze = ["innerHTML"], et = {
|
|
555
|
+
key: 1,
|
|
556
|
+
class: "u1-message__content"
|
|
557
|
+
}, tt = {
|
|
558
|
+
key: 2,
|
|
559
|
+
class: "u1-message__repeat"
|
|
560
|
+
}, O = /* @__PURE__ */ k({
|
|
561
|
+
name: "U1Message",
|
|
562
|
+
__name: "Message",
|
|
563
|
+
props: {
|
|
564
|
+
type: { default: "info" },
|
|
565
|
+
message: {},
|
|
566
|
+
showClose: { type: Boolean, default: !1 },
|
|
567
|
+
repeatNum: { default: 1 },
|
|
568
|
+
dangerouslyUseHTMLString: { type: Boolean, default: !1 },
|
|
569
|
+
offset: { default: void 0 },
|
|
570
|
+
placement: { default: "top" },
|
|
571
|
+
zIndex: { default: void 0 }
|
|
572
|
+
},
|
|
573
|
+
emits: ["close"],
|
|
574
|
+
setup(e, { emit: l }) {
|
|
575
|
+
const t = e, s = l, a = U(!0);
|
|
576
|
+
N(
|
|
577
|
+
() => t.message,
|
|
578
|
+
() => {
|
|
579
|
+
a.value = !0;
|
|
580
|
+
}
|
|
581
|
+
);
|
|
582
|
+
const d = g(() => ({
|
|
583
|
+
success: "✓",
|
|
584
|
+
warning: "!",
|
|
585
|
+
info: "i",
|
|
586
|
+
error: "x"
|
|
587
|
+
})[t.type]), n = g(() => {
|
|
588
|
+
const m = {};
|
|
589
|
+
return t.offset !== void 0 && (t.placement.startsWith("bottom") ? m.bottom = `${t.offset}px` : m.top = `${t.offset}px`), t.zIndex !== void 0 && (m.zIndex = t.zIndex), m;
|
|
590
|
+
});
|
|
591
|
+
function f() {
|
|
592
|
+
a.value = !1, s("close");
|
|
593
|
+
}
|
|
594
|
+
return (m, b) => a.value ? (i(), u("div", {
|
|
595
|
+
key: 0,
|
|
596
|
+
class: _(["u1-message", [`u1-message--${e.type}`, `u1-message--${e.placement}`]]),
|
|
597
|
+
style: I(n.value),
|
|
598
|
+
role: "alert"
|
|
599
|
+
}, [
|
|
600
|
+
r("span", Qe, v(d.value), 1),
|
|
601
|
+
e.dangerouslyUseHTMLString ? (i(), u("span", {
|
|
602
|
+
key: 0,
|
|
603
|
+
class: "u1-message__content",
|
|
604
|
+
innerHTML: e.message
|
|
605
|
+
}, null, 8, Ze)) : (i(), u("span", et, v(e.message), 1)),
|
|
606
|
+
e.repeatNum > 1 ? (i(), u("span", tt, "x " + v(e.repeatNum), 1)) : $("", !0),
|
|
607
|
+
e.showClose ? (i(), u("button", {
|
|
608
|
+
key: 3,
|
|
609
|
+
class: "u1-message__close",
|
|
610
|
+
type: "button",
|
|
611
|
+
"aria-label": "close",
|
|
612
|
+
onClick: f
|
|
613
|
+
}, "x")) : $("", !0)
|
|
614
|
+
], 6)) : $("", !0);
|
|
615
|
+
}
|
|
616
|
+
}), at = 20, lt = 3e3, L = [];
|
|
617
|
+
let j = 1;
|
|
618
|
+
const nt = k({
|
|
619
|
+
props: {
|
|
620
|
+
state: {
|
|
621
|
+
type: Object,
|
|
622
|
+
required: !0
|
|
623
|
+
},
|
|
624
|
+
close: {
|
|
625
|
+
type: Function,
|
|
626
|
+
required: !0
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
setup(e) {
|
|
630
|
+
return () => ne(O, { ...e.state, onClose: e.close });
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
function ot(e, l) {
|
|
634
|
+
return typeof e == "string" ? {
|
|
635
|
+
message: e,
|
|
636
|
+
type: l ?? "info"
|
|
637
|
+
} : {
|
|
638
|
+
...e,
|
|
639
|
+
type: l ?? e.type ?? "info"
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
function st(e) {
|
|
643
|
+
return L.filter((l) => l.props.placement === e).reduce((l, t) => {
|
|
644
|
+
const s = t.container.firstElementChild, a = (s == null ? void 0 : s.getBoundingClientRect().height) || 44;
|
|
645
|
+
return l + a + 16;
|
|
646
|
+
}, at);
|
|
647
|
+
}
|
|
648
|
+
function it(e) {
|
|
649
|
+
return L.find((l) => e.grouping && l.props.grouping && l.props.message === e.message && l.props.type === e.type);
|
|
650
|
+
}
|
|
651
|
+
function ut(e) {
|
|
652
|
+
var t;
|
|
653
|
+
if (e.closed)
|
|
654
|
+
return;
|
|
655
|
+
e.closed = !0;
|
|
656
|
+
const l = L.findIndex((s) => s.id === e.id);
|
|
657
|
+
l !== -1 && L.splice(l, 1), J(null, e.container), e.container.remove(), (t = e.onClose) == null || t.call(e);
|
|
658
|
+
}
|
|
659
|
+
function R(e, l) {
|
|
660
|
+
const t = ot(e, l), s = it(t);
|
|
661
|
+
if (s)
|
|
662
|
+
return s.props.repeatNum += 1, {
|
|
663
|
+
close: s.close
|
|
664
|
+
};
|
|
665
|
+
const a = j;
|
|
666
|
+
j += 1;
|
|
667
|
+
const d = document.createElement("div"), n = t.placement ?? "top", f = E({
|
|
668
|
+
message: t.message,
|
|
669
|
+
type: t.type ?? "info",
|
|
670
|
+
duration: t.duration ?? lt,
|
|
671
|
+
showClose: t.showClose ?? !1,
|
|
672
|
+
grouping: t.grouping ?? !1,
|
|
673
|
+
dangerouslyUseHTMLString: t.dangerouslyUseHTMLString ?? !1,
|
|
674
|
+
placement: n,
|
|
675
|
+
offset: t.offset ?? st(n),
|
|
676
|
+
repeatNum: 1
|
|
677
|
+
}), m = {
|
|
678
|
+
id: a,
|
|
679
|
+
container: d,
|
|
680
|
+
props: f,
|
|
681
|
+
type: f.type,
|
|
682
|
+
close: () => ut(m),
|
|
683
|
+
onClose: t.onClose,
|
|
684
|
+
closed: !1
|
|
685
|
+
}, b = oe(nt, {
|
|
686
|
+
state: f,
|
|
687
|
+
close: m.close
|
|
688
|
+
});
|
|
689
|
+
return J(b, d), document.body.appendChild(d), L.push(m), f.duration > 0 && window.setTimeout(m.close, f.duration), {
|
|
690
|
+
close: m.close
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
const M = R;
|
|
694
|
+
M.success = (e) => R(e, "success");
|
|
695
|
+
M.warning = (e) => R(e, "warning");
|
|
696
|
+
M.info = (e) => R(e, "info");
|
|
697
|
+
M.error = (e) => R(e, "error");
|
|
698
|
+
M.closeAll = (e) => {
|
|
699
|
+
(e ? L.filter((t) => t.type === e) : [...L]).forEach((t) => t.close());
|
|
700
|
+
};
|
|
701
|
+
M.install = (e) => {
|
|
702
|
+
e.component(O.name, O);
|
|
703
|
+
};
|
|
704
|
+
const sa = O, ee = Symbol("U1RadioGroup"), dt = { class: "u1-radio__input" }, ct = ["checked", "disabled"], rt = { class: "u1-radio__label" }, ft = /* @__PURE__ */ k({
|
|
705
|
+
name: "U1Radio",
|
|
706
|
+
__name: "Radio",
|
|
707
|
+
props: {
|
|
708
|
+
modelValue: { type: [String, Number, Boolean], default: void 0 },
|
|
709
|
+
label: { type: [String, Number, Boolean] },
|
|
710
|
+
disabled: { type: Boolean, default: !1 }
|
|
711
|
+
},
|
|
712
|
+
emits: ["update:modelValue", "change"],
|
|
713
|
+
setup(e, { emit: l }) {
|
|
714
|
+
const t = e, s = l, a = W(ee, void 0), d = g(() => a ? a.modelValue.value === t.label : t.modelValue === t.label), n = g(() => t.disabled || (a == null ? void 0 : a.disabled.value) === !0);
|
|
715
|
+
function f() {
|
|
716
|
+
if (!n.value) {
|
|
717
|
+
if (a) {
|
|
718
|
+
a.change(t.label);
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
s("update:modelValue", t.label), s("change", t.label);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return (m, b) => (i(), u("label", {
|
|
725
|
+
class: _(["u1-radio", {
|
|
726
|
+
"is-checked": d.value,
|
|
727
|
+
"is-disabled": n.value
|
|
728
|
+
}]),
|
|
729
|
+
onClick: f
|
|
730
|
+
}, [
|
|
731
|
+
r("span", dt, [
|
|
732
|
+
r("input", {
|
|
733
|
+
class: "u1-radio__original",
|
|
734
|
+
type: "radio",
|
|
735
|
+
checked: d.value,
|
|
736
|
+
disabled: n.value,
|
|
737
|
+
onChange: f
|
|
738
|
+
}, null, 40, ct),
|
|
739
|
+
b[0] || (b[0] = r("span", { class: "u1-radio__inner" }, null, -1))
|
|
740
|
+
]),
|
|
741
|
+
r("span", rt, [
|
|
742
|
+
C(m.$slots, "default", {}, () => [
|
|
743
|
+
z(v(e.label), 1)
|
|
744
|
+
])
|
|
745
|
+
])
|
|
746
|
+
], 2));
|
|
747
|
+
}
|
|
748
|
+
}), pt = {
|
|
749
|
+
class: "u1-radio-group",
|
|
750
|
+
role: "radiogroup"
|
|
751
|
+
}, mt = /* @__PURE__ */ k({
|
|
752
|
+
name: "U1RadioGroup",
|
|
753
|
+
__name: "RadioGroup",
|
|
754
|
+
props: {
|
|
755
|
+
modelValue: { type: [String, Number, Boolean] },
|
|
756
|
+
disabled: { type: Boolean, default: !1 }
|
|
757
|
+
},
|
|
758
|
+
emits: ["update:modelValue", "change"],
|
|
759
|
+
setup(e, { emit: l }) {
|
|
760
|
+
const t = e, s = l, a = g(() => t.modelValue);
|
|
761
|
+
function d(n) {
|
|
762
|
+
s("update:modelValue", n), s("change", n);
|
|
763
|
+
}
|
|
764
|
+
return X(ee, {
|
|
765
|
+
modelValue: a,
|
|
766
|
+
disabled: Y(t, "disabled"),
|
|
767
|
+
change: d
|
|
768
|
+
}), (n, f) => (i(), u("div", pt, [
|
|
769
|
+
C(n.$slots, "default")
|
|
770
|
+
]));
|
|
771
|
+
}
|
|
772
|
+
}), ht = ft, bt = mt, gt = ["value", "disabled"], yt = {
|
|
773
|
+
key: 0,
|
|
774
|
+
value: "",
|
|
775
|
+
disabled: ""
|
|
776
|
+
}, vt = ["value"], _t = /* @__PURE__ */ k({
|
|
777
|
+
name: "U1Select",
|
|
778
|
+
__name: "Select",
|
|
779
|
+
props: {
|
|
780
|
+
modelValue: {},
|
|
781
|
+
options: {},
|
|
782
|
+
placeholder: {},
|
|
783
|
+
disabled: { type: Boolean }
|
|
784
|
+
},
|
|
785
|
+
emits: ["update:modelValue", "change"],
|
|
786
|
+
setup(e, { emit: l }) {
|
|
787
|
+
const t = e, s = l;
|
|
788
|
+
function a(d) {
|
|
789
|
+
const n = d.target.value, f = t.options.find((b) => String(b.value) === n), m = f ? f.value : n;
|
|
790
|
+
s("update:modelValue", m), s("change", m);
|
|
791
|
+
}
|
|
792
|
+
return (d, n) => (i(), u("span", {
|
|
793
|
+
class: _(["u1-select", { "is-disabled": e.disabled }])
|
|
794
|
+
}, [
|
|
795
|
+
r("select", {
|
|
796
|
+
class: "u1-select__inner",
|
|
797
|
+
value: e.modelValue,
|
|
798
|
+
disabled: e.disabled,
|
|
799
|
+
onChange: a
|
|
800
|
+
}, [
|
|
801
|
+
e.placeholder ? (i(), u("option", yt, v(e.placeholder), 1)) : $("", !0),
|
|
802
|
+
(i(!0), u(S, null, D(e.options, (f) => (i(), u("option", {
|
|
803
|
+
key: String(f.value),
|
|
804
|
+
value: f.value
|
|
805
|
+
}, v(f.label), 9, vt))), 128))
|
|
806
|
+
], 40, gt)
|
|
807
|
+
], 2));
|
|
808
|
+
}
|
|
809
|
+
}), $t = _t, kt = ["aria-checked", "disabled"], xt = {
|
|
810
|
+
key: 0,
|
|
811
|
+
class: "u1-switch__label"
|
|
812
|
+
}, wt = /* @__PURE__ */ k({
|
|
813
|
+
name: "U1Switch",
|
|
814
|
+
__name: "Switch",
|
|
815
|
+
props: {
|
|
816
|
+
modelValue: { type: Boolean, default: !1 },
|
|
817
|
+
disabled: { type: Boolean, default: !1 },
|
|
818
|
+
activeText: { default: "" },
|
|
819
|
+
inactiveText: { default: "" }
|
|
820
|
+
},
|
|
821
|
+
emits: ["update:modelValue", "change"],
|
|
822
|
+
setup(e, { emit: l }) {
|
|
823
|
+
const t = e, s = l;
|
|
824
|
+
function a() {
|
|
825
|
+
if (t.disabled)
|
|
826
|
+
return;
|
|
827
|
+
const d = !t.modelValue;
|
|
828
|
+
s("update:modelValue", d), s("change", d);
|
|
829
|
+
}
|
|
830
|
+
return (d, n) => (i(), u("button", {
|
|
831
|
+
class: _(["u1-switch", {
|
|
832
|
+
"is-checked": e.modelValue,
|
|
833
|
+
"is-disabled": e.disabled
|
|
834
|
+
}]),
|
|
835
|
+
type: "button",
|
|
836
|
+
role: "switch",
|
|
837
|
+
"aria-checked": e.modelValue ? "true" : "false",
|
|
838
|
+
disabled: e.disabled,
|
|
839
|
+
onClick: a
|
|
840
|
+
}, [
|
|
841
|
+
n[0] || (n[0] = r("span", { class: "u1-switch__core" }, null, -1)),
|
|
842
|
+
e.activeText || e.inactiveText ? (i(), u("span", xt, v(e.modelValue ? e.activeText : e.inactiveText), 1)) : $("", !0)
|
|
843
|
+
], 10, kt));
|
|
844
|
+
}
|
|
845
|
+
}), Vt = wt, Ct = { class: "u1-table__wrapper" }, Bt = { class: "u1-table__inner" }, Ut = { class: "u1-table__cell-content" }, Tt = { key: 0 }, St = ["title"], It = { class: "u1-table__cell-content" }, zt = {
|
|
846
|
+
key: 1,
|
|
847
|
+
class: "u1-table__actions"
|
|
848
|
+
}, Lt = { key: 1 }, Mt = ["colspan"], Dt = {
|
|
849
|
+
key: 0,
|
|
850
|
+
class: "u1-table__loading"
|
|
851
|
+
}, Nt = /* @__PURE__ */ k({
|
|
852
|
+
name: "U1Table",
|
|
853
|
+
__name: "Table",
|
|
854
|
+
props: {
|
|
855
|
+
columns: {},
|
|
856
|
+
data: {},
|
|
857
|
+
border: { type: Boolean, default: !1 },
|
|
858
|
+
stripe: { type: Boolean, default: !1 },
|
|
859
|
+
loading: { type: Boolean, default: !1 },
|
|
860
|
+
loadingText: { default: "Loading" },
|
|
861
|
+
emptyText: { default: "No data" },
|
|
862
|
+
rowKey: {},
|
|
863
|
+
size: { default: "default" },
|
|
864
|
+
showOverflowTooltip: { type: Boolean, default: !1 }
|
|
865
|
+
},
|
|
866
|
+
setup(e) {
|
|
867
|
+
const l = e, t = g(
|
|
868
|
+
() => l.columns.map((c) => ({
|
|
869
|
+
type: "default",
|
|
870
|
+
...c
|
|
871
|
+
}))
|
|
872
|
+
), s = g(() => [
|
|
873
|
+
`u1-table--${l.size}`,
|
|
874
|
+
{
|
|
875
|
+
"is-border": l.border,
|
|
876
|
+
"is-stripe": l.stripe,
|
|
877
|
+
"is-loading": l.loading
|
|
878
|
+
}
|
|
879
|
+
]);
|
|
880
|
+
function a(c, y) {
|
|
881
|
+
if (typeof l.rowKey == "function")
|
|
882
|
+
return l.rowKey(c, y);
|
|
883
|
+
if (l.rowKey) {
|
|
884
|
+
const o = c[l.rowKey];
|
|
885
|
+
return typeof o == "string" || typeof o == "number" ? o : y;
|
|
886
|
+
}
|
|
887
|
+
return y;
|
|
888
|
+
}
|
|
889
|
+
function d(c, y) {
|
|
890
|
+
return c.prop || `${c.type}-${y}`;
|
|
891
|
+
}
|
|
892
|
+
function n(c) {
|
|
893
|
+
return typeof c == "number" ? `${c}px` : c;
|
|
894
|
+
}
|
|
895
|
+
function f(c) {
|
|
896
|
+
return {
|
|
897
|
+
width: n(c.width),
|
|
898
|
+
minWidth: n(c.minWidth)
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
function m(c) {
|
|
902
|
+
return c ? `is-${c}` : "is-left";
|
|
903
|
+
}
|
|
904
|
+
function b(c) {
|
|
905
|
+
return [m(c.headerAlign || c.align)];
|
|
906
|
+
}
|
|
907
|
+
function x(c) {
|
|
908
|
+
return [
|
|
909
|
+
m(c.align),
|
|
910
|
+
{
|
|
911
|
+
"is-overflow": c.showOverflowTooltip || l.showOverflowTooltip
|
|
912
|
+
}
|
|
913
|
+
];
|
|
914
|
+
}
|
|
915
|
+
function w(c, y) {
|
|
916
|
+
if (!y.prop)
|
|
917
|
+
return "";
|
|
918
|
+
const o = c[y.prop];
|
|
919
|
+
return o == null ? "" : String(o);
|
|
920
|
+
}
|
|
921
|
+
function V(c, y) {
|
|
922
|
+
if (!(!y.showOverflowTooltip && !l.showOverflowTooltip))
|
|
923
|
+
return w(c, y);
|
|
924
|
+
}
|
|
925
|
+
return (c, y) => (i(), u("div", {
|
|
926
|
+
class: _(["u1-table", s.value])
|
|
927
|
+
}, [
|
|
928
|
+
r("div", Ct, [
|
|
929
|
+
r("table", Bt, [
|
|
930
|
+
r("thead", null, [
|
|
931
|
+
r("tr", null, [
|
|
932
|
+
(i(!0), u(S, null, D(t.value, (o, h) => (i(), u("th", {
|
|
933
|
+
key: d(o, h),
|
|
934
|
+
class: _(["u1-table__cell", b(o)]),
|
|
935
|
+
style: I(f(o))
|
|
936
|
+
}, [
|
|
937
|
+
r("div", Ut, [
|
|
938
|
+
o.prop ? C(c.$slots, `header-${o.prop}`, {
|
|
939
|
+
key: 0,
|
|
940
|
+
column: o,
|
|
941
|
+
index: h
|
|
942
|
+
}, () => [
|
|
943
|
+
z(v(o.label), 1)
|
|
944
|
+
]) : (i(), u(S, { key: 1 }, [
|
|
945
|
+
z(v(o.label), 1)
|
|
946
|
+
], 64))
|
|
947
|
+
])
|
|
948
|
+
], 6))), 128))
|
|
949
|
+
])
|
|
950
|
+
]),
|
|
951
|
+
e.data.length ? (i(), u("tbody", Tt, [
|
|
952
|
+
(i(!0), u(S, null, D(e.data, (o, h) => (i(), u("tr", {
|
|
953
|
+
key: a(o, h)
|
|
954
|
+
}, [
|
|
955
|
+
(i(!0), u(S, null, D(t.value, (p, T) => (i(), u("td", {
|
|
956
|
+
key: d(p, T),
|
|
957
|
+
class: _(["u1-table__cell", x(p)]),
|
|
958
|
+
style: I(f(p)),
|
|
959
|
+
title: V(o, p)
|
|
960
|
+
}, [
|
|
961
|
+
r("div", It, [
|
|
962
|
+
p.type === "index" ? (i(), u(S, { key: 0 }, [
|
|
963
|
+
z(v(h + 1), 1)
|
|
964
|
+
], 64)) : p.type === "action" ? (i(), u("div", zt, [
|
|
965
|
+
C(c.$slots, "action", {
|
|
966
|
+
row: o,
|
|
967
|
+
index: h
|
|
968
|
+
})
|
|
969
|
+
])) : p.prop ? C(c.$slots, `cell-${p.prop}`, {
|
|
970
|
+
key: 2,
|
|
971
|
+
row: o,
|
|
972
|
+
column: p,
|
|
973
|
+
index: h,
|
|
974
|
+
value: w(o, p)
|
|
975
|
+
}, () => [
|
|
976
|
+
z(v(w(o, p)), 1)
|
|
977
|
+
]) : $("", !0)
|
|
978
|
+
])
|
|
979
|
+
], 14, St))), 128))
|
|
980
|
+
]))), 128))
|
|
981
|
+
])) : (i(), u("tbody", Lt, [
|
|
982
|
+
r("tr", null, [
|
|
983
|
+
r("td", {
|
|
984
|
+
class: "u1-table__empty",
|
|
985
|
+
colspan: t.value.length || 1
|
|
986
|
+
}, v(e.emptyText), 9, Mt)
|
|
987
|
+
])
|
|
988
|
+
]))
|
|
989
|
+
]),
|
|
990
|
+
e.loading ? (i(), u("div", Dt, v(e.loadingText), 1)) : $("", !0)
|
|
991
|
+
])
|
|
992
|
+
], 2));
|
|
993
|
+
}
|
|
994
|
+
}), Rt = Nt, Et = { class: "u1-tag-component__content" }, Ot = /* @__PURE__ */ k({
|
|
995
|
+
name: "U1Tag",
|
|
996
|
+
__name: "Tag",
|
|
997
|
+
props: {
|
|
998
|
+
type: { default: "primary" },
|
|
999
|
+
effect: { default: "light" },
|
|
1000
|
+
closable: { type: Boolean, default: !1 }
|
|
1001
|
+
},
|
|
1002
|
+
emits: ["close"],
|
|
1003
|
+
setup(e, { emit: l }) {
|
|
1004
|
+
const t = e, s = l, a = U(!0);
|
|
1005
|
+
N(
|
|
1006
|
+
() => t.closable,
|
|
1007
|
+
() => {
|
|
1008
|
+
a.value = !0;
|
|
1009
|
+
}
|
|
1010
|
+
);
|
|
1011
|
+
function d() {
|
|
1012
|
+
a.value = !1, s("close");
|
|
1013
|
+
}
|
|
1014
|
+
return (n, f) => a.value ? (i(), u("span", {
|
|
1015
|
+
key: 0,
|
|
1016
|
+
class: _(["u1-tag-component", [`u1-tag-component--${e.type}`, `u1-tag-component--${e.effect}`]])
|
|
1017
|
+
}, [
|
|
1018
|
+
r("span", Et, [
|
|
1019
|
+
C(n.$slots, "default")
|
|
1020
|
+
]),
|
|
1021
|
+
e.closable ? (i(), u("button", {
|
|
1022
|
+
key: 0,
|
|
1023
|
+
class: "u1-tag-component__close",
|
|
1024
|
+
type: "button",
|
|
1025
|
+
"aria-label": "close",
|
|
1026
|
+
onClick: d
|
|
1027
|
+
}, "x")) : $("", !0)
|
|
1028
|
+
], 2)) : $("", !0);
|
|
1029
|
+
}
|
|
1030
|
+
}), At = Ot, Kt = { class: "u1-theme-editor" }, Gt = { class: "u1-theme-editor__columns" }, Pt = { class: "u1-theme-editor__form" }, Ft = ["for"], jt = { class: "u1-theme-editor__name" }, Ht = { class: "u1-theme-editor__var" }, Wt = { class: "u1-theme-editor__control" }, Xt = ["id", "value", "onInput"], Yt = ["id", "value", "onInput"], qt = { class: "u1-theme-editor__actions" }, Jt = { class: "u1-theme-editor__code" }, Qt = ["value"], Zt = /* @__PURE__ */ k({
|
|
1031
|
+
name: "U1ThemeEditor",
|
|
1032
|
+
__name: "ThemeEditor",
|
|
1033
|
+
props: {
|
|
1034
|
+
modelValue: { type: Boolean, default: !0 }
|
|
1035
|
+
},
|
|
1036
|
+
setup(e) {
|
|
1037
|
+
const l = Object.keys(A);
|
|
1038
|
+
function t(o) {
|
|
1039
|
+
return o !== "radiusBase" && o !== "shadowLight" && o !== "shadowFocus";
|
|
1040
|
+
}
|
|
1041
|
+
function s(o) {
|
|
1042
|
+
return {
|
|
1043
|
+
primary: "主题色",
|
|
1044
|
+
success: "成功色",
|
|
1045
|
+
warning: "警告色",
|
|
1046
|
+
danger: "危险色",
|
|
1047
|
+
info: "信息色",
|
|
1048
|
+
text: "主要文本",
|
|
1049
|
+
textRegular: "常规文本",
|
|
1050
|
+
border: "边框",
|
|
1051
|
+
borderLight: "浅边框",
|
|
1052
|
+
background: "背景色",
|
|
1053
|
+
radiusBase: "基础圆角",
|
|
1054
|
+
shadowLight: "轻阴影",
|
|
1055
|
+
shadowFocus: "聚焦阴影"
|
|
1056
|
+
}[o] ?? o;
|
|
1057
|
+
}
|
|
1058
|
+
function a(o) {
|
|
1059
|
+
return /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(o) ? o : "#000000";
|
|
1060
|
+
}
|
|
1061
|
+
const d = () => {
|
|
1062
|
+
const o = {};
|
|
1063
|
+
for (const [h, p] of Object.entries(A))
|
|
1064
|
+
o[h] = p.defaultValue;
|
|
1065
|
+
return o;
|
|
1066
|
+
}, n = E(d()), f = g(() => ie(n)), m = U("复制代码");
|
|
1067
|
+
let b = null;
|
|
1068
|
+
function x(o, h) {
|
|
1069
|
+
const p = h.target;
|
|
1070
|
+
n[o] = p.value, V();
|
|
1071
|
+
}
|
|
1072
|
+
function w(o, h) {
|
|
1073
|
+
const p = h.target;
|
|
1074
|
+
n[o] = p.value, V();
|
|
1075
|
+
}
|
|
1076
|
+
function V() {
|
|
1077
|
+
const o = {};
|
|
1078
|
+
for (const [h, p] of Object.entries(n))
|
|
1079
|
+
p && (o[h] = p);
|
|
1080
|
+
ue(o);
|
|
1081
|
+
}
|
|
1082
|
+
async function c() {
|
|
1083
|
+
try {
|
|
1084
|
+
await navigator.clipboard.writeText(f.value), m.value = "已复制";
|
|
1085
|
+
} catch {
|
|
1086
|
+
m.value = "复制失败";
|
|
1087
|
+
}
|
|
1088
|
+
b && clearTimeout(b), b = setTimeout(() => {
|
|
1089
|
+
m.value = "复制代码";
|
|
1090
|
+
}, 1600);
|
|
1091
|
+
}
|
|
1092
|
+
function y() {
|
|
1093
|
+
const o = d();
|
|
1094
|
+
for (const h of Object.keys(o))
|
|
1095
|
+
n[h] = o[h];
|
|
1096
|
+
de();
|
|
1097
|
+
}
|
|
1098
|
+
return q(() => {
|
|
1099
|
+
b && clearTimeout(b);
|
|
1100
|
+
}), (o, h) => (i(), u("section", Kt, [
|
|
1101
|
+
r("div", Gt, [
|
|
1102
|
+
r("div", Pt, [
|
|
1103
|
+
(i(!0), u(S, null, D(P(l), (p) => (i(), u("div", {
|
|
1104
|
+
key: p,
|
|
1105
|
+
class: "u1-theme-editor__field"
|
|
1106
|
+
}, [
|
|
1107
|
+
r("label", {
|
|
1108
|
+
for: `u1-theme-${p}`,
|
|
1109
|
+
class: "u1-theme-editor__label"
|
|
1110
|
+
}, [
|
|
1111
|
+
r("span", jt, v(s(p)), 1),
|
|
1112
|
+
r("span", Ht, v(P(A)[p].cssVar), 1)
|
|
1113
|
+
], 8, Ft),
|
|
1114
|
+
r("div", Wt, [
|
|
1115
|
+
t(p) ? (i(), u("input", {
|
|
1116
|
+
key: 0,
|
|
1117
|
+
id: `u1-theme-${p}`,
|
|
1118
|
+
class: "u1-theme-editor__color",
|
|
1119
|
+
type: "color",
|
|
1120
|
+
value: a(n[p]),
|
|
1121
|
+
onInput: (T) => x(p, T)
|
|
1122
|
+
}, null, 40, Xt)) : (i(), u("input", {
|
|
1123
|
+
key: 1,
|
|
1124
|
+
id: `u1-theme-${p}`,
|
|
1125
|
+
class: "u1-theme-editor__text",
|
|
1126
|
+
type: "text",
|
|
1127
|
+
value: n[p],
|
|
1128
|
+
onInput: (T) => w(p, T)
|
|
1129
|
+
}, null, 40, Yt)),
|
|
1130
|
+
t(p) ? (i(), u("span", {
|
|
1131
|
+
key: 2,
|
|
1132
|
+
class: "u1-theme-editor__swatch",
|
|
1133
|
+
style: I({ background: n[p] }),
|
|
1134
|
+
"aria-hidden": "true"
|
|
1135
|
+
}, null, 4)) : $("", !0)
|
|
1136
|
+
])
|
|
1137
|
+
]))), 128)),
|
|
1138
|
+
r("div", qt, [
|
|
1139
|
+
r("button", {
|
|
1140
|
+
class: "u1-theme-editor__btn u1-theme-editor__btn--copy",
|
|
1141
|
+
type: "button",
|
|
1142
|
+
onClick: c
|
|
1143
|
+
}, v(m.value), 1),
|
|
1144
|
+
r("button", {
|
|
1145
|
+
class: "u1-theme-editor__btn u1-theme-editor__btn--reset",
|
|
1146
|
+
type: "button",
|
|
1147
|
+
onClick: y
|
|
1148
|
+
}, " 重置默认 ")
|
|
1149
|
+
])
|
|
1150
|
+
]),
|
|
1151
|
+
r("div", Jt, [
|
|
1152
|
+
h[0] || (h[0] = r("label", {
|
|
1153
|
+
class: "u1-theme-editor__label",
|
|
1154
|
+
for: "u1-theme-code"
|
|
1155
|
+
}, "主题代码", -1)),
|
|
1156
|
+
r("textarea", {
|
|
1157
|
+
id: "u1-theme-code",
|
|
1158
|
+
class: "u1-theme-editor__textarea",
|
|
1159
|
+
style: { "font-family": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" },
|
|
1160
|
+
value: f.value,
|
|
1161
|
+
readonly: "",
|
|
1162
|
+
spellcheck: "false"
|
|
1163
|
+
}, null, 8, Qt),
|
|
1164
|
+
h[1] || (h[1] = r("p", { class: "u1-theme-editor__hint" }, " 复制到你的项目入口文件并执行,主题将在用户项目长期生效。 ", -1))
|
|
1165
|
+
])
|
|
1166
|
+
])
|
|
1167
|
+
]));
|
|
1168
|
+
}
|
|
1169
|
+
}), ea = (e, l) => {
|
|
1170
|
+
const t = e.__vccOpts || e;
|
|
1171
|
+
for (const [s, a] of l)
|
|
1172
|
+
t[s] = a;
|
|
1173
|
+
return t;
|
|
1174
|
+
}, te = /* @__PURE__ */ ea(Zt, [["__scopeId", "data-v-0949dd57"]]), ta = /* @__PURE__ */ k({
|
|
1175
|
+
name: "U1ThemeEditorDialog",
|
|
1176
|
+
__name: "ThemeEditorDialog",
|
|
1177
|
+
props: {
|
|
1178
|
+
modelValue: { type: Boolean, default: !1 },
|
|
1179
|
+
title: { default: "主题编辑器" },
|
|
1180
|
+
width: { default: "720px" }
|
|
1181
|
+
},
|
|
1182
|
+
emits: ["update:modelValue"],
|
|
1183
|
+
setup(e, { emit: l }) {
|
|
1184
|
+
const t = l;
|
|
1185
|
+
function s(a) {
|
|
1186
|
+
t("update:modelValue", a);
|
|
1187
|
+
}
|
|
1188
|
+
return (a, d) => (i(), F(Z, H({
|
|
1189
|
+
"model-value": e.modelValue,
|
|
1190
|
+
title: e.title,
|
|
1191
|
+
width: e.width
|
|
1192
|
+
}, a.$attrs, { "onUpdate:modelValue": s }), {
|
|
1193
|
+
default: se(() => [
|
|
1194
|
+
e.modelValue ? (i(), F(te, { key: 0 })) : $("", !0)
|
|
1195
|
+
]),
|
|
1196
|
+
_: 1
|
|
1197
|
+
}, 16, ["model-value", "title", "width"]));
|
|
1198
|
+
}
|
|
1199
|
+
}), aa = [
|
|
1200
|
+
re,
|
|
1201
|
+
xe,
|
|
1202
|
+
Fe,
|
|
1203
|
+
Xe,
|
|
1204
|
+
ht,
|
|
1205
|
+
bt,
|
|
1206
|
+
Me,
|
|
1207
|
+
De,
|
|
1208
|
+
Be,
|
|
1209
|
+
$t,
|
|
1210
|
+
Vt,
|
|
1211
|
+
he,
|
|
1212
|
+
At,
|
|
1213
|
+
M,
|
|
1214
|
+
Oe,
|
|
1215
|
+
Rt,
|
|
1216
|
+
Je,
|
|
1217
|
+
te,
|
|
1218
|
+
ta
|
|
1219
|
+
], ia = {
|
|
1220
|
+
install(e) {
|
|
1221
|
+
aa.forEach((l) => {
|
|
1222
|
+
if ("install" in l && typeof l.install == "function") {
|
|
1223
|
+
l.install(e);
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
e.component(l.name, l);
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
export {
|
|
1231
|
+
re as U1Affix,
|
|
1232
|
+
he as U1Avatar,
|
|
1233
|
+
xe as U1Button,
|
|
1234
|
+
Be as U1Card,
|
|
1235
|
+
Me as U1Checkbox,
|
|
1236
|
+
De as U1CheckboxGroup,
|
|
1237
|
+
Oe as U1Dialog,
|
|
1238
|
+
Fe as U1Input,
|
|
1239
|
+
Xe as U1InputLabel,
|
|
1240
|
+
Je as U1Menu,
|
|
1241
|
+
M as U1Message,
|
|
1242
|
+
sa as U1MessageComponent,
|
|
1243
|
+
ht as U1Radio,
|
|
1244
|
+
bt as U1RadioGroup,
|
|
1245
|
+
$t as U1Select,
|
|
1246
|
+
Vt as U1Switch,
|
|
1247
|
+
Rt as U1Table,
|
|
1248
|
+
At as U1Tag,
|
|
1249
|
+
te as U1ThemeEditor,
|
|
1250
|
+
ta as U1ThemeEditorDialog,
|
|
1251
|
+
ia as default
|
|
1252
|
+
};
|