@vtj/ui 0.0.6 → 0.4.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/LICENSE +21 -0
- package/cdn/index.js +1 -0
- package/cdn/style.css +1 -0
- package/lib/index.js +2039 -0
- package/lib/style.css +1 -1
- package/package.json +24 -33
- package/types/components/block/Block.vue.d.ts +143 -0
- package/types/components/block/block.d.ts +68 -0
- package/types/components/block/index.d.ts +319 -0
- package/types/components/config/Config.d.ts +26 -0
- package/types/components/config/index.d.ts +19 -0
- package/types/components/config/props.d.ts +6 -0
- package/types/components/container/Container.vue.d.ts +52 -0
- package/types/components/container/container.d.ts +46 -0
- package/types/components/container/index.d.ts +159 -0
- package/types/components/cron/Cron.vue.d.ts +9 -0
- package/types/components/cron/cron.d.ts +23 -0
- package/types/components/cron/index.d.ts +11 -0
- package/types/components/dialog/Dialog.vue.d.ts +289 -0
- package/types/components/dialog/create.d.ts +6 -0
- package/types/components/dialog/dialog.d.ts +155 -0
- package/types/components/dialog/hooks.d.ts +927 -0
- package/types/components/dialog/index.d.ts +638 -0
- package/types/components/element/Element.d.ts +25 -0
- package/types/components/element/index.d.ts +21 -0
- package/types/components/field/Field.vue.d.ts +802 -0
- package/types/components/field/field.d.ts +230 -0
- package/types/components/field/hooks.d.ts +23 -0
- package/types/components/field/index.d.ts +2034 -0
- package/types/components/field/setters/InputSetter.d.ts +45 -0
- package/types/components/field/setters/SelectSetter.d.ts +45 -0
- package/types/components/field/setters/factory.d.ts +54 -0
- package/types/components/field/setters/index.d.ts +93 -0
- package/types/components/form/Form.vue.d.ts +5352 -0
- package/types/components/form/form.d.ts +384 -0
- package/types/components/form/hooks.d.ts +1906 -0
- package/types/components/form/index.d.ts +15373 -0
- package/types/components/help/Help.vue.d.ts +315 -0
- package/types/components/help/help.d.ts +172 -0
- package/types/components/help/hooks.d.ts +18 -0
- package/types/components/help/index.d.ts +316 -0
- package/types/components/icon/Icon.vue.d.ts +52 -0
- package/types/components/icon/icon.d.ts +30 -0
- package/types/components/icon/index.d.ts +166 -0
- package/types/components/index.d.ts +16 -0
- package/types/components/page/Page.vue.d.ts +22 -0
- package/types/components/page/index.d.ts +118 -0
- package/types/components/page/page.d.ts +9 -0
- package/types/components/panel/Panel.vue.d.ts +573 -0
- package/types/components/panel/index.d.ts +1207 -0
- package/types/components/panel/panel.d.ts +227 -0
- package/types/components/text/Text.vue.d.ts +52 -0
- package/types/components/text/index.d.ts +165 -0
- package/types/components/text/text.d.ts +37 -0
- package/types/components/tool/Tool.vue.d.ts +158 -0
- package/types/components/tool/Trigger.d.ts +29 -0
- package/types/components/tool/hooks.d.ts +250 -0
- package/types/components/tool/index.d.ts +371 -0
- package/types/components/tool/tool.d.ts +91 -0
- package/types/components/toolbar/Toolbar.vue.d.ts +44 -0
- package/types/components/toolbar/hooks.d.ts +14 -0
- package/types/components/toolbar/index.d.ts +161 -0
- package/types/components/toolbar/toolbar.d.ts +45 -0
- package/types/components/wrapper/Wrapper.vue.d.ts +268 -0
- package/types/components/wrapper/index.d.ts +601 -0
- package/types/components/wrapper/wrapper.d.ts +145 -0
- package/types/constants.d.ts +4 -0
- package/types/hooks/index.d.ts +4 -0
- package/types/hooks/useConfig.d.ts +5 -0
- package/types/hooks/useDraggable.d.ts +13 -0
- package/types/hooks/useIcon.d.ts +4 -0
- package/types/hooks/useResizable.d.ts +25 -0
- package/types/index.d.ts +13 -4
- package/types/list.d.ts +21588 -0
- package/types/utils/emits.d.ts +6 -0
- package/types/utils/index.d.ts +4 -0
- package/types/utils/install.d.ts +9 -0
- package/types/utils/make-install.d.ts +5 -0
- package/types/utils/util.d.ts +8 -0
- package/README.md +0 -4
- package/lib/cdn/index.cjs.js +0 -1
- package/lib/cdn/index.es.js +0 -261
- package/lib/cdn/index.umd.js +0 -1
- package/lib/cdn/style.css +0 -1
- package/lib/index.cjs.js +0 -1
- package/lib/index.es.js +0 -265
- package/lib/index.umd.js +0 -1
- package/src/components/XChart/Chart.vue +0 -42
- package/src/components/XChart/index.ts +0 -8
- package/src/components/XChart/style.scss +0 -0
- package/src/components/XChartBar/Bar.vue +0 -27
- package/src/components/XChartBar/index.ts +0 -8
- package/src/components/XChartLine/Line.vue +0 -27
- package/src/components/XChartLine/index.ts +0 -8
- package/src/components/XChartPie/Pie.vue +0 -54
- package/src/components/XChartPie/index.ts +0 -8
- package/src/components/XElement/Element.vue +0 -14
- package/src/components/XElement/index.ts +0 -8
- package/src/components/XTestSuit/TestSuit.vue +0 -47
- package/src/components/XTestSuit/index.ts +0 -8
- package/src/components/XTestSuit/style.scss +0 -14
- package/src/hooks/useECharts.ts +0 -55
- package/src/hooks/useRectChart.ts +0 -46
- package/src/index.ts +0 -25
- package/src/theme/_vars.scss +0 -8
- package/src/theme/base.scss +0 -0
- package/src/theme/index.scss +0 -4
- package/types/dev/vite-env.d.ts +0 -7
- package/types/src/components/XChart/Chart.vue.d.ts +0 -69
- package/types/src/components/XChart/index.d.ts +0 -2
- package/types/src/components/XChartBar/Bar.vue.d.ts +0 -124
- package/types/src/components/XChartBar/index.d.ts +0 -2
- package/types/src/components/XChartLine/Line.vue.d.ts +0 -124
- package/types/src/components/XChartLine/index.d.ts +0 -2
- package/types/src/components/XChartPie/Pie.vue.d.ts +0 -111
- package/types/src/components/XChartPie/index.d.ts +0 -2
- package/types/src/components/XElement/Element.vue.d.ts +0 -23
- package/types/src/components/XElement/index.d.ts +0 -2
- package/types/src/components/XTestSuit/TestSuit.vue.d.ts +0 -59
- package/types/src/components/XTestSuit/index.d.ts +0 -2
- package/types/src/hooks/useECharts.d.ts +0 -15
- package/types/src/hooks/useRectChart.d.ts +0 -4
- package/types/src/index.d.ts +0 -7
package/lib/index.js
ADDED
|
@@ -0,0 +1,2039 @@
|
|
|
1
|
+
import { defineComponent as x, renderSlot as C, unref as s, ref as S, getCurrentInstance as I, provide as ne, openBlock as p, createBlock as y, mergeProps as _, withCtx as v, computed as g, createElementBlock as P, normalizeClass as D, normalizeStyle as le, h as M, useAttrs as ze, markRaw as Qe, resolveDynamicComponent as q, createCommentVNode as w, createVNode as E, createTextVNode as T, isVNode as G, Fragment as R, renderList as U, createElementVNode as V, normalizeProps as se, toDisplayString as X, withModifiers as Ee, createSlots as K, useSlots as Be, toRef as Je, reactive as et, toRefs as tt, watch as O, onMounted as Q, Teleport as ot, withDirectives as nt, vShow as lt, render as fe, onUpdated as st, inject as Oe, onUnmounted as je, shallowReactive as rt, effectScope as at } from "vue";
|
|
2
|
+
import { ElIcon as it, ElTooltip as me, ElBadge as pe, ElDropdown as ct, ElDropdownMenu as ut, ElDropdownItem as dt, ElDivider as ft, ElButtonGroup as mt, ElButton as L, ElRow as pt, ElCol as gt, formItemProps as bt, ElInput as yt, ElOption as vt, ElSelect as ht, ElFormItem as _t, ElForm as Ct } from "element-plus";
|
|
3
|
+
import { Close as wt, QuestionFilled as xt, RefreshLeft as Pe, Check as Ie, InfoFilled as kt } from "@element-plus/icons-vue";
|
|
4
|
+
import { useElementBounding as re, useElementSize as De, useDraggable as St, useEventListener as te } from "@vueuse/core";
|
|
5
|
+
import { Minimize as $t, Maximize as zt, Popup as Et, Close as Bt } from "@vtj/icons";
|
|
6
|
+
import { merge as Te } from "@vtj/utils";
|
|
7
|
+
function ge(e) {
|
|
8
|
+
return typeof e == "string" ? e : `${e}px`;
|
|
9
|
+
}
|
|
10
|
+
function be(e = 0, t) {
|
|
11
|
+
if (typeof e == "number")
|
|
12
|
+
return e;
|
|
13
|
+
if (/(%|vh|vw)$/i.test(e)) {
|
|
14
|
+
const o = Number.parseInt(e);
|
|
15
|
+
return t * o / 100;
|
|
16
|
+
}
|
|
17
|
+
return Number.parseInt(e);
|
|
18
|
+
}
|
|
19
|
+
function Y(e, t) {
|
|
20
|
+
const n = {};
|
|
21
|
+
return Object.keys(e).forEach((o) => {
|
|
22
|
+
t.includes(o) || (n[o] = e[o]);
|
|
23
|
+
}), n;
|
|
24
|
+
}
|
|
25
|
+
function On(e, t) {
|
|
26
|
+
const n = {};
|
|
27
|
+
return Object.keys(e).forEach((o) => {
|
|
28
|
+
t.includes(o) && (n[o] = e[o]);
|
|
29
|
+
}), n;
|
|
30
|
+
}
|
|
31
|
+
const Ot = () => {
|
|
32
|
+
}, $ = (e, t) => {
|
|
33
|
+
if (e.install = (n) => {
|
|
34
|
+
for (const o of [e, ...Object.values(t ?? {})])
|
|
35
|
+
typeof o == "function" ? n.use(o) : o.name && n.component(o.name, o);
|
|
36
|
+
}, t)
|
|
37
|
+
for (const [n, o] of Object.entries(t))
|
|
38
|
+
e[n] = o;
|
|
39
|
+
return e;
|
|
40
|
+
}, jt = (e, t) => (e.install = (n) => {
|
|
41
|
+
e._context = n._context, n.config.globalProperties[t] = e;
|
|
42
|
+
}, e), jn = (e, t) => (e.install = (n) => {
|
|
43
|
+
n.directive(t, e);
|
|
44
|
+
}, e), Pn = (e) => (e.install = Ot, e), Pt = {
|
|
45
|
+
elementTag: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "div"
|
|
48
|
+
}
|
|
49
|
+
}, oe = Symbol("ConfigContext");
|
|
50
|
+
function Ve(e, t) {
|
|
51
|
+
const n = S(e);
|
|
52
|
+
return bn(n), t?.provide ? t.provide(oe, n) : I() && ne(oe, n), n;
|
|
53
|
+
}
|
|
54
|
+
const It = x({
|
|
55
|
+
name: "XConfig",
|
|
56
|
+
inheritAttrs: !1,
|
|
57
|
+
props: Pt,
|
|
58
|
+
setup(e, { slots: t }) {
|
|
59
|
+
const n = Ve(e);
|
|
60
|
+
return () => C(t, "default", { config: s(n) });
|
|
61
|
+
}
|
|
62
|
+
}), Dt = $(It), Tt = {
|
|
63
|
+
fit: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: !0
|
|
66
|
+
}
|
|
67
|
+
}, Vt = /* @__PURE__ */ x({
|
|
68
|
+
name: "XPage",
|
|
69
|
+
__name: "Page",
|
|
70
|
+
props: Tt,
|
|
71
|
+
setup(e) {
|
|
72
|
+
const t = e;
|
|
73
|
+
return (n, o) => (p(), y(s(j), _({
|
|
74
|
+
class: "x-page",
|
|
75
|
+
flex: !1,
|
|
76
|
+
fit: t.fit
|
|
77
|
+
}, n.$attrs), {
|
|
78
|
+
default: v(() => [
|
|
79
|
+
C(n.$slots, "default")
|
|
80
|
+
]),
|
|
81
|
+
_: 3
|
|
82
|
+
}, 16, ["fit"]));
|
|
83
|
+
}
|
|
84
|
+
}), Xt = $(Vt), Nt = {
|
|
85
|
+
flex: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: !0
|
|
88
|
+
},
|
|
89
|
+
width: {
|
|
90
|
+
type: [String, Number]
|
|
91
|
+
},
|
|
92
|
+
height: {
|
|
93
|
+
type: [String, Number]
|
|
94
|
+
},
|
|
95
|
+
direction: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: "column"
|
|
98
|
+
},
|
|
99
|
+
grow: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: !0
|
|
102
|
+
},
|
|
103
|
+
shrink: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: !1
|
|
106
|
+
},
|
|
107
|
+
wrap: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: "initial"
|
|
110
|
+
},
|
|
111
|
+
justify: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: "start"
|
|
114
|
+
},
|
|
115
|
+
align: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: "stretch"
|
|
118
|
+
},
|
|
119
|
+
border: {
|
|
120
|
+
type: Boolean
|
|
121
|
+
},
|
|
122
|
+
radius: {
|
|
123
|
+
type: Boolean
|
|
124
|
+
},
|
|
125
|
+
background: {
|
|
126
|
+
type: Boolean
|
|
127
|
+
},
|
|
128
|
+
split: {
|
|
129
|
+
type: Boolean
|
|
130
|
+
},
|
|
131
|
+
fit: {
|
|
132
|
+
type: Boolean
|
|
133
|
+
},
|
|
134
|
+
overflow: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: "auto"
|
|
137
|
+
},
|
|
138
|
+
padding: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: !0
|
|
141
|
+
}
|
|
142
|
+
}, Ft = /* @__PURE__ */ x({
|
|
143
|
+
name: "XBlock",
|
|
144
|
+
__name: "Block",
|
|
145
|
+
props: Nt,
|
|
146
|
+
setup(e) {
|
|
147
|
+
const t = e, n = I(), o = g(() => {
|
|
148
|
+
const u = n?.parent;
|
|
149
|
+
return u?.type.name === "XBlock" ? u?.props.direction : "column";
|
|
150
|
+
}), l = g(() => o.value.includes("column") ? t.height ? !1 : t.grow : t.width ? !1 : t.grow), a = g(() => !t.fit && o.value.includes("column") && t.grow && !t.height), r = g(() => !t.fit && o.value.includes("row") && t.grow && !t.width), i = g(() => ({
|
|
151
|
+
"is-flex": t.flex,
|
|
152
|
+
[`is-${t.direction}`]: !0,
|
|
153
|
+
"is-grow": l.value,
|
|
154
|
+
"is-shrink": t.shrink,
|
|
155
|
+
[`is-${t.wrap}`]: !0,
|
|
156
|
+
[`is-justify-${t.justify}`]: !0,
|
|
157
|
+
[`is-align-${t.align}`]: !0,
|
|
158
|
+
"is-border": t.border,
|
|
159
|
+
"is-radius": t.radius,
|
|
160
|
+
"is-background": t.background,
|
|
161
|
+
[`is-split-${t.direction}`]: t.split,
|
|
162
|
+
"is-fit": t.fit,
|
|
163
|
+
"is-padding": t.padding,
|
|
164
|
+
[`is-overflow-${t.overflow}`]: !!t.overflow,
|
|
165
|
+
"is-grow-height": a.value,
|
|
166
|
+
"is-grow-width": r.value
|
|
167
|
+
})), m = g(() => {
|
|
168
|
+
const u = t.width ? ge(t.width) : void 0, f = t.height ? ge(t.height) : void 0;
|
|
169
|
+
return {
|
|
170
|
+
width: u,
|
|
171
|
+
height: f
|
|
172
|
+
};
|
|
173
|
+
});
|
|
174
|
+
return (u, f) => (p(), P("div", {
|
|
175
|
+
class: D(["x-block", i.value]),
|
|
176
|
+
style: le(m.value)
|
|
177
|
+
}, [
|
|
178
|
+
C(u.$slots, "default")
|
|
179
|
+
], 6));
|
|
180
|
+
}
|
|
181
|
+
}), j = $(Ft), Rt = {
|
|
182
|
+
tag: {
|
|
183
|
+
type: String,
|
|
184
|
+
default: yn("elementTag", "div")
|
|
185
|
+
}
|
|
186
|
+
}, At = x({
|
|
187
|
+
name: "XElement",
|
|
188
|
+
props: Rt,
|
|
189
|
+
setup(e, { slots: t }) {
|
|
190
|
+
return () => M(
|
|
191
|
+
e.tag,
|
|
192
|
+
{
|
|
193
|
+
class: "x-element"
|
|
194
|
+
},
|
|
195
|
+
t
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}), Mt = $(At), Lt = {
|
|
199
|
+
default: 14,
|
|
200
|
+
small: 12,
|
|
201
|
+
large: 18
|
|
202
|
+
}, Wt = {
|
|
203
|
+
icon: {
|
|
204
|
+
type: [String, Object]
|
|
205
|
+
},
|
|
206
|
+
color: {
|
|
207
|
+
type: String
|
|
208
|
+
},
|
|
209
|
+
size: {
|
|
210
|
+
type: [Number, String],
|
|
211
|
+
default: "inherit"
|
|
212
|
+
},
|
|
213
|
+
src: {
|
|
214
|
+
type: String
|
|
215
|
+
},
|
|
216
|
+
disabled: {
|
|
217
|
+
type: Boolean
|
|
218
|
+
}
|
|
219
|
+
}, Ht = ["src"], Ut = /* @__PURE__ */ x({
|
|
220
|
+
name: "XIcon",
|
|
221
|
+
__name: "Icon",
|
|
222
|
+
props: Wt,
|
|
223
|
+
setup(e) {
|
|
224
|
+
const t = e, n = ze(), o = g(() => typeof t.icon == "object" ? Qe(t.icon) : null), l = g(() => {
|
|
225
|
+
const r = {
|
|
226
|
+
"is-pointer": !!n.onClick
|
|
227
|
+
};
|
|
228
|
+
return !o.value && t.icon && (r[t.icon] = !0), r;
|
|
229
|
+
}), a = g(() => typeof t.size == "number" ? t.size : Lt[t.size] ?? void 0);
|
|
230
|
+
return (r, i) => (p(), y(s(it), {
|
|
231
|
+
class: D(["x-icon", l.value]),
|
|
232
|
+
color: t.color,
|
|
233
|
+
size: a.value
|
|
234
|
+
}, {
|
|
235
|
+
default: v(() => [
|
|
236
|
+
C(r.$slots, "default", {}, () => [
|
|
237
|
+
o.value ? (p(), y(q(o.value), { key: 0 })) : w("", !0),
|
|
238
|
+
t.src ? (p(), P("img", {
|
|
239
|
+
key: 1,
|
|
240
|
+
src: t.src
|
|
241
|
+
}, null, 8, Ht)) : w("", !0)
|
|
242
|
+
])
|
|
243
|
+
]),
|
|
244
|
+
_: 3
|
|
245
|
+
}, 8, ["class", "color", "size"]));
|
|
246
|
+
}
|
|
247
|
+
}), N = $(Ut), Gt = {
|
|
248
|
+
label: {
|
|
249
|
+
type: String
|
|
250
|
+
},
|
|
251
|
+
value: {
|
|
252
|
+
type: [String, Number, Symbol]
|
|
253
|
+
},
|
|
254
|
+
icon: {
|
|
255
|
+
type: [String, Object]
|
|
256
|
+
},
|
|
257
|
+
size: {
|
|
258
|
+
type: [Number, String]
|
|
259
|
+
},
|
|
260
|
+
disabled: {
|
|
261
|
+
type: [Boolean, Function]
|
|
262
|
+
},
|
|
263
|
+
// 下拉菜单
|
|
264
|
+
menus: {
|
|
265
|
+
type: Array
|
|
266
|
+
},
|
|
267
|
+
// 默认选中的菜单项
|
|
268
|
+
active: {
|
|
269
|
+
type: [String, Number, Object]
|
|
270
|
+
},
|
|
271
|
+
// 下拉菜单组件配置参数
|
|
272
|
+
dropdown: {
|
|
273
|
+
type: Object
|
|
274
|
+
},
|
|
275
|
+
badge: {
|
|
276
|
+
type: [Number, Object]
|
|
277
|
+
},
|
|
278
|
+
tooltip: {
|
|
279
|
+
type: [String, Object]
|
|
280
|
+
}
|
|
281
|
+
}, Kt = {
|
|
282
|
+
click: (e) => !0,
|
|
283
|
+
// 下拉菜单点击事件
|
|
284
|
+
command: (e) => !!e,
|
|
285
|
+
// 点击关闭图标触发
|
|
286
|
+
close: (e) => !!e
|
|
287
|
+
};
|
|
288
|
+
function Yt(e) {
|
|
289
|
+
const t = {
|
|
290
|
+
placement: "top"
|
|
291
|
+
}, n = g(() => {
|
|
292
|
+
const r = J(e.icon);
|
|
293
|
+
return r.value ? {
|
|
294
|
+
...r.value,
|
|
295
|
+
size: e.size
|
|
296
|
+
} : null;
|
|
297
|
+
}), o = g(() => e.badge ? typeof e.badge == "number" ? { value: e.badge } : e.badge : null), l = g(() => e.tooltip ? typeof e.tooltip == "string" ? { ...t, content: e.tooltip } : { ...t, ...e.tooltip } : null), a = g(() => typeof e.disabled == "function" ? !!e.disabled() : !!e.disabled);
|
|
298
|
+
return {
|
|
299
|
+
icon: n,
|
|
300
|
+
badge: o,
|
|
301
|
+
tooltip: l,
|
|
302
|
+
disabled: a
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function Zt(e, t, n) {
|
|
306
|
+
return {
|
|
307
|
+
onClick: () => {
|
|
308
|
+
n.value || t("click", e.value);
|
|
309
|
+
},
|
|
310
|
+
onCommand: (r) => {
|
|
311
|
+
const i = (e.menus || []).find((m) => m.value === r);
|
|
312
|
+
i && t("command", i);
|
|
313
|
+
},
|
|
314
|
+
onClose: (r) => {
|
|
315
|
+
t("close", r);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function qt(e) {
|
|
320
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !G(e);
|
|
321
|
+
}
|
|
322
|
+
const ye = /* @__PURE__ */ x({
|
|
323
|
+
components: {
|
|
324
|
+
ElTooltip: me,
|
|
325
|
+
ElBadge: pe,
|
|
326
|
+
XIcon: N
|
|
327
|
+
},
|
|
328
|
+
props: {
|
|
329
|
+
badge: {
|
|
330
|
+
type: Object
|
|
331
|
+
},
|
|
332
|
+
tooltip: {
|
|
333
|
+
type: Object
|
|
334
|
+
},
|
|
335
|
+
icon: {
|
|
336
|
+
type: Object
|
|
337
|
+
},
|
|
338
|
+
label: {
|
|
339
|
+
type: String
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
setup(e, {
|
|
343
|
+
slots: t
|
|
344
|
+
}) {
|
|
345
|
+
return () => {
|
|
346
|
+
let n = t.default ? t.default() : E("div", {
|
|
347
|
+
class: "x-tool__inner"
|
|
348
|
+
}, [e.icon ? E(N, e.icon, null) : null, e.label ? E("span", {
|
|
349
|
+
class: "x-tool__label"
|
|
350
|
+
}, [e.label]) : null]);
|
|
351
|
+
if (e.badge) {
|
|
352
|
+
const o = function() {
|
|
353
|
+
return n;
|
|
354
|
+
}();
|
|
355
|
+
n = E(pe, e.badge, {
|
|
356
|
+
default: () => [T(" "), o]
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
if (e.tooltip) {
|
|
360
|
+
const o = function() {
|
|
361
|
+
return n;
|
|
362
|
+
}();
|
|
363
|
+
n = E(me, e.tooltip, qt(n) ? n : {
|
|
364
|
+
default: () => [o]
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
return E("div", {
|
|
368
|
+
class: {
|
|
369
|
+
"is-icon": !t.default,
|
|
370
|
+
"x-tool__trigger": !0
|
|
371
|
+
}
|
|
372
|
+
}, [T(" "), n]);
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
}), Qt = { class: "x-tool__item" }, Jt = /* @__PURE__ */ x({
|
|
376
|
+
name: "XTool",
|
|
377
|
+
__name: "Tool",
|
|
378
|
+
props: Gt,
|
|
379
|
+
emits: Kt,
|
|
380
|
+
setup(e, { emit: t }) {
|
|
381
|
+
const n = e, { icon: o, badge: l, tooltip: a, disabled: r } = Yt(n), { onClick: i, onCommand: m, onClose: u } = Zt(n, t, r);
|
|
382
|
+
return (f, c) => n.menus ? (p(), y(s(ct), _({
|
|
383
|
+
key: 0,
|
|
384
|
+
class: "x-tool",
|
|
385
|
+
size: "small"
|
|
386
|
+
}, n.dropdown, {
|
|
387
|
+
disabled: s(r),
|
|
388
|
+
onCommand: s(m)
|
|
389
|
+
}), {
|
|
390
|
+
dropdown: v(() => [
|
|
391
|
+
E(s(ut), null, {
|
|
392
|
+
default: v(() => [
|
|
393
|
+
(p(!0), P(R, null, U(n.menus || [], (d) => (p(), y(s(dt), {
|
|
394
|
+
key: d.value,
|
|
395
|
+
command: d.value,
|
|
396
|
+
disabled: d.disabled,
|
|
397
|
+
divided: d.divided,
|
|
398
|
+
class: D(["x-tool__menu", { "is-active": d.value === n.active }])
|
|
399
|
+
}, {
|
|
400
|
+
default: v(() => [
|
|
401
|
+
V("span", Qt, [
|
|
402
|
+
d.icon ? (p(), y(s(N), se(_({ key: 0 }, s(J)(d.icon).value)), null, 16)) : w("", !0),
|
|
403
|
+
C(f.$slots, "menu", { item: d }, () => [
|
|
404
|
+
T(X(d.label), 1)
|
|
405
|
+
])
|
|
406
|
+
]),
|
|
407
|
+
d.closable ? (p(), y(s(N), {
|
|
408
|
+
key: 0,
|
|
409
|
+
class: "x-tool__close",
|
|
410
|
+
icon: s(wt),
|
|
411
|
+
onClick: Ee((b) => s(u)(d), ["stop"])
|
|
412
|
+
}, null, 8, ["icon", "onClick"])) : w("", !0)
|
|
413
|
+
]),
|
|
414
|
+
_: 2
|
|
415
|
+
}, 1032, ["command", "disabled", "divided", "class"]))), 128))
|
|
416
|
+
]),
|
|
417
|
+
_: 3
|
|
418
|
+
})
|
|
419
|
+
]),
|
|
420
|
+
default: v(() => [
|
|
421
|
+
E(s(ye), {
|
|
422
|
+
class: D({ "is-disabled": s(r) }),
|
|
423
|
+
label: n.label,
|
|
424
|
+
icon: s(o),
|
|
425
|
+
badge: s(l),
|
|
426
|
+
tooltip: s(a),
|
|
427
|
+
onClick: s(i)
|
|
428
|
+
}, K({ _: 2 }, [
|
|
429
|
+
f.$slots.default ? {
|
|
430
|
+
name: "default",
|
|
431
|
+
fn: v(() => [
|
|
432
|
+
C(f.$slots, "default")
|
|
433
|
+
]),
|
|
434
|
+
key: "0"
|
|
435
|
+
} : void 0
|
|
436
|
+
]), 1032, ["class", "label", "icon", "badge", "tooltip", "onClick"])
|
|
437
|
+
]),
|
|
438
|
+
_: 3
|
|
439
|
+
}, 16, ["disabled", "onCommand"])) : (p(), y(s(ye), {
|
|
440
|
+
key: 1,
|
|
441
|
+
class: D(["x-tool", { "is-disabled": s(r) }]),
|
|
442
|
+
label: n.label,
|
|
443
|
+
icon: s(o),
|
|
444
|
+
badge: s(l),
|
|
445
|
+
tooltip: s(a),
|
|
446
|
+
onClick: s(i)
|
|
447
|
+
}, K({ _: 2 }, [
|
|
448
|
+
f.$slots.default ? {
|
|
449
|
+
name: "default",
|
|
450
|
+
fn: v(() => [
|
|
451
|
+
C(f.$slots, "default")
|
|
452
|
+
]),
|
|
453
|
+
key: "0"
|
|
454
|
+
} : void 0
|
|
455
|
+
]), 1032, ["class", "label", "icon", "badge", "tooltip", "onClick"]));
|
|
456
|
+
}
|
|
457
|
+
}), A = $(Jt), eo = {
|
|
458
|
+
type: {
|
|
459
|
+
type: String,
|
|
460
|
+
default: "default"
|
|
461
|
+
},
|
|
462
|
+
icon: {
|
|
463
|
+
type: Object,
|
|
464
|
+
default: () => ({
|
|
465
|
+
icon: xt
|
|
466
|
+
})
|
|
467
|
+
},
|
|
468
|
+
tooltip: {
|
|
469
|
+
type: String
|
|
470
|
+
},
|
|
471
|
+
url: {
|
|
472
|
+
type: String
|
|
473
|
+
},
|
|
474
|
+
// code: {
|
|
475
|
+
// type: String
|
|
476
|
+
// },
|
|
477
|
+
// api: {
|
|
478
|
+
// type: Function as PropType<HelpApi>
|
|
479
|
+
// },
|
|
480
|
+
openType: {
|
|
481
|
+
type: String,
|
|
482
|
+
default: "dialog"
|
|
483
|
+
},
|
|
484
|
+
dialog: {
|
|
485
|
+
type: Object
|
|
486
|
+
}
|
|
487
|
+
}, to = {
|
|
488
|
+
open: () => !0
|
|
489
|
+
};
|
|
490
|
+
function oo(e) {
|
|
491
|
+
const t = {
|
|
492
|
+
default: "#909399",
|
|
493
|
+
primary: "#409eff",
|
|
494
|
+
success: "#67c23a",
|
|
495
|
+
warning: "#e6a23c",
|
|
496
|
+
danger: "#f56c6c"
|
|
497
|
+
};
|
|
498
|
+
return g(() => ({
|
|
499
|
+
...e.icon,
|
|
500
|
+
color: t[e.type ?? "default"]
|
|
501
|
+
}));
|
|
502
|
+
}
|
|
503
|
+
function no(e) {
|
|
504
|
+
return {
|
|
505
|
+
openDialog: (n) => {
|
|
506
|
+
if (!n)
|
|
507
|
+
return;
|
|
508
|
+
const o = typeof n == "string" ? { src: n } : { content: M("div", { class: "x-help__inner" }, n()) };
|
|
509
|
+
Me.create({
|
|
510
|
+
...o,
|
|
511
|
+
title: "帮助",
|
|
512
|
+
icon: e.icon,
|
|
513
|
+
bodyPadding: !1,
|
|
514
|
+
footer: !1,
|
|
515
|
+
...e.dialog
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
function lo(e, t, n, o) {
|
|
521
|
+
const { openDialog: l } = no(e), a = n?.proxy?.$router;
|
|
522
|
+
return {
|
|
523
|
+
onClick: () => {
|
|
524
|
+
switch (t("open"), e.openType) {
|
|
525
|
+
case "dialog":
|
|
526
|
+
l(e.url || o.default);
|
|
527
|
+
break;
|
|
528
|
+
case "window":
|
|
529
|
+
e.url && window.open(e.url);
|
|
530
|
+
break;
|
|
531
|
+
case "href":
|
|
532
|
+
e.url && (location.href = e.url);
|
|
533
|
+
break;
|
|
534
|
+
case "router":
|
|
535
|
+
e.url && a && a.push(e.url);
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
const so = /* @__PURE__ */ x({
|
|
542
|
+
name: "XHelp",
|
|
543
|
+
inheritAttrs: !1,
|
|
544
|
+
__name: "Help",
|
|
545
|
+
props: eo,
|
|
546
|
+
emits: to,
|
|
547
|
+
setup(e, { expose: t, emit: n }) {
|
|
548
|
+
const o = e, l = I(), a = Be(), r = oo(o), { onClick: i } = lo(o, n, l, a);
|
|
549
|
+
return console.log(a), t({}), (m, u) => (p(), y(s(A), _({
|
|
550
|
+
icon: s(r),
|
|
551
|
+
tooltip: o.tooltip,
|
|
552
|
+
onClick: s(i)
|
|
553
|
+
}, m.$attrs), null, 16, ["icon", "tooltip", "onClick"]));
|
|
554
|
+
}
|
|
555
|
+
}), Xe = $(so), ro = {
|
|
556
|
+
title: {
|
|
557
|
+
type: String
|
|
558
|
+
},
|
|
559
|
+
icon: {
|
|
560
|
+
type: [String, Object]
|
|
561
|
+
},
|
|
562
|
+
shadow: {
|
|
563
|
+
type: String,
|
|
564
|
+
default: "none"
|
|
565
|
+
},
|
|
566
|
+
small: {
|
|
567
|
+
type: Boolean,
|
|
568
|
+
default: !1
|
|
569
|
+
},
|
|
570
|
+
toolbar: {
|
|
571
|
+
type: Object
|
|
572
|
+
},
|
|
573
|
+
header: {
|
|
574
|
+
type: [Boolean, Object],
|
|
575
|
+
default: !0
|
|
576
|
+
},
|
|
577
|
+
body: {
|
|
578
|
+
type: Object
|
|
579
|
+
},
|
|
580
|
+
footer: {
|
|
581
|
+
type: [Boolean, Object],
|
|
582
|
+
default: !0
|
|
583
|
+
}
|
|
584
|
+
}, ao = {
|
|
585
|
+
toolClick: (e) => !0,
|
|
586
|
+
toolCommand: (e, t) => !0,
|
|
587
|
+
toolClose: (e, t) => !0
|
|
588
|
+
}, io = { class: "x-panel__title" }, co = { class: "x-panel__label" }, uo = /* @__PURE__ */ x({
|
|
589
|
+
name: "XPanel",
|
|
590
|
+
__name: "Panel",
|
|
591
|
+
props: ro,
|
|
592
|
+
emits: ao,
|
|
593
|
+
setup(e, { expose: t, emit: n }) {
|
|
594
|
+
const o = e, l = J(o.icon), a = I(), r = g(() => a?.proxy), i = g(() => ({
|
|
595
|
+
"is-small": o.small,
|
|
596
|
+
[`is-shadow-${o.shadow}`]: !!o.shadow
|
|
597
|
+
})), m = (c) => {
|
|
598
|
+
n("toolClick", c);
|
|
599
|
+
}, u = (c, d) => {
|
|
600
|
+
n("toolCommand", c, d);
|
|
601
|
+
}, f = (c, d) => {
|
|
602
|
+
n("toolClose", c, d);
|
|
603
|
+
};
|
|
604
|
+
return t({ panel: r }), (c, d) => (p(), y(s(j), {
|
|
605
|
+
class: D(["x-panel", i.value]),
|
|
606
|
+
padding: !1
|
|
607
|
+
}, {
|
|
608
|
+
default: v(() => [
|
|
609
|
+
o.header !== !1 ? (p(), y(s(j), _({
|
|
610
|
+
key: 0,
|
|
611
|
+
class: "x-panel__header",
|
|
612
|
+
direction: "row",
|
|
613
|
+
justify: "between",
|
|
614
|
+
align: "center",
|
|
615
|
+
grow: !1,
|
|
616
|
+
overflow: "visible",
|
|
617
|
+
background: ""
|
|
618
|
+
}, o.header), {
|
|
619
|
+
default: v(() => [
|
|
620
|
+
C(c.$slots, "header", {}, () => [
|
|
621
|
+
V("div", io, [
|
|
622
|
+
s(l) ? (p(), y(s(N), _({ key: 0 }, s(l), { class: "x-panel__icon" }), null, 16)) : w("", !0),
|
|
623
|
+
C(c.$slots, "title", {}, () => [
|
|
624
|
+
V("span", co, X(o.title), 1)
|
|
625
|
+
])
|
|
626
|
+
])
|
|
627
|
+
]),
|
|
628
|
+
o.toolbar ? (p(), y(s(Fe), _({ key: 0 }, o.toolbar, {
|
|
629
|
+
padding: !1,
|
|
630
|
+
overflow: "visible",
|
|
631
|
+
class: "x-panel__toolbar",
|
|
632
|
+
onClick: m,
|
|
633
|
+
onCommand: u,
|
|
634
|
+
onClose: f
|
|
635
|
+
}), null, 16)) : w("", !0)
|
|
636
|
+
]),
|
|
637
|
+
_: 3
|
|
638
|
+
}, 16)) : w("", !0),
|
|
639
|
+
E(s(j), _({ flex: !1 }, o.body, { class: "x-panel__body" }), {
|
|
640
|
+
default: v(() => [
|
|
641
|
+
C(c.$slots, "default")
|
|
642
|
+
]),
|
|
643
|
+
_: 3
|
|
644
|
+
}, 16),
|
|
645
|
+
o.footer !== !1 && c.$slots.footer ? (p(), y(s(j), _({
|
|
646
|
+
key: 1,
|
|
647
|
+
class: "x-panel__footer",
|
|
648
|
+
grow: !1,
|
|
649
|
+
direction: "row"
|
|
650
|
+
}, o.footer), {
|
|
651
|
+
default: v(() => [
|
|
652
|
+
C(c.$slots, "footer")
|
|
653
|
+
]),
|
|
654
|
+
_: 3
|
|
655
|
+
}, 16)) : w("", !0)
|
|
656
|
+
]),
|
|
657
|
+
_: 3
|
|
658
|
+
}, 8, ["class"]));
|
|
659
|
+
}
|
|
660
|
+
}), Ne = $(uo), fo = {
|
|
661
|
+
type: {
|
|
662
|
+
type: String,
|
|
663
|
+
defualt: "p"
|
|
664
|
+
},
|
|
665
|
+
// 缩进
|
|
666
|
+
indent: {
|
|
667
|
+
type: Boolean,
|
|
668
|
+
default: !1
|
|
669
|
+
},
|
|
670
|
+
// 次要内容
|
|
671
|
+
secondary: {
|
|
672
|
+
type: Boolean
|
|
673
|
+
},
|
|
674
|
+
// 占位内容
|
|
675
|
+
placeholder: {
|
|
676
|
+
type: Boolean
|
|
677
|
+
},
|
|
678
|
+
// 禁用
|
|
679
|
+
disabled: {
|
|
680
|
+
type: Boolean
|
|
681
|
+
}
|
|
682
|
+
}, mo = {
|
|
683
|
+
// eventName: (param: any) => true
|
|
684
|
+
}, po = /* @__PURE__ */ x({
|
|
685
|
+
name: "XText",
|
|
686
|
+
__name: "Text",
|
|
687
|
+
props: fo,
|
|
688
|
+
emits: mo,
|
|
689
|
+
setup(e, { expose: t, emit: n }) {
|
|
690
|
+
const o = e, l = g(() => o.type || "p"), a = g(() => ({
|
|
691
|
+
[`is-type-${o.type}`]: !!o.type,
|
|
692
|
+
"is-indent": o.indent,
|
|
693
|
+
"is-secondary": o.secondary,
|
|
694
|
+
"is-placeholder": o.placeholder,
|
|
695
|
+
"is-disabled": o.disabled
|
|
696
|
+
}));
|
|
697
|
+
return t({}), (r, i) => (p(), y(q(l.value), {
|
|
698
|
+
class: D(["x-text", a.value])
|
|
699
|
+
}, {
|
|
700
|
+
default: v(() => [
|
|
701
|
+
C(r.$slots, "default")
|
|
702
|
+
]),
|
|
703
|
+
_: 3
|
|
704
|
+
}, 8, ["class"]));
|
|
705
|
+
}
|
|
706
|
+
}), go = $(po), bo = {
|
|
707
|
+
// 按钮模式
|
|
708
|
+
button: {
|
|
709
|
+
type: [Boolean, Object]
|
|
710
|
+
},
|
|
711
|
+
// 工具按钮项
|
|
712
|
+
items: {
|
|
713
|
+
type: Array,
|
|
714
|
+
default: () => []
|
|
715
|
+
},
|
|
716
|
+
// disabled时隐藏工具
|
|
717
|
+
hiddenOnDisabled: {
|
|
718
|
+
type: Boolean
|
|
719
|
+
}
|
|
720
|
+
}, yo = {
|
|
721
|
+
click: (e) => !0,
|
|
722
|
+
command: (e, t) => !0,
|
|
723
|
+
close: (e, t) => !0
|
|
724
|
+
};
|
|
725
|
+
function ve(e) {
|
|
726
|
+
return typeof e == "function" ? e() : e;
|
|
727
|
+
}
|
|
728
|
+
function vo(e) {
|
|
729
|
+
const t = (l, a) => {
|
|
730
|
+
const r = a ?? l.disabled, i = {
|
|
731
|
+
...typeof e.button == "object" ? e.button : {},
|
|
732
|
+
...l,
|
|
733
|
+
icon: vn(l.icon),
|
|
734
|
+
disabled: ve(r)
|
|
735
|
+
};
|
|
736
|
+
return Y(i, [
|
|
737
|
+
"menus",
|
|
738
|
+
"label",
|
|
739
|
+
"value",
|
|
740
|
+
"badge",
|
|
741
|
+
"tooltip",
|
|
742
|
+
"divided",
|
|
743
|
+
"children"
|
|
744
|
+
]);
|
|
745
|
+
}, n = (l) => Y(l, ["children", "divided"]), o = g(() => e.hiddenOnDisabled ? (e.items || []).filter((l) => !ve(l.disabled)) : e.items);
|
|
746
|
+
return {
|
|
747
|
+
mergeButtonProps: t,
|
|
748
|
+
mergeToolProps: n,
|
|
749
|
+
visibleItems: o
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
function ho(e, t) {
|
|
753
|
+
return {
|
|
754
|
+
onClick: (a) => {
|
|
755
|
+
t("click", a);
|
|
756
|
+
},
|
|
757
|
+
onCommand: (a, r) => {
|
|
758
|
+
t("command", a, r);
|
|
759
|
+
},
|
|
760
|
+
onClose: (a, r) => {
|
|
761
|
+
t("close", a, r);
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
const _o = /* @__PURE__ */ x({
|
|
766
|
+
name: "XToolbar",
|
|
767
|
+
__name: "Toolbar",
|
|
768
|
+
props: bo,
|
|
769
|
+
emits: yo,
|
|
770
|
+
setup(e, { expose: t, emit: n }) {
|
|
771
|
+
const o = e, { mergeButtonProps: l, mergeToolProps: a, visibleItems: r } = vo(o), { onClick: i, onCommand: m, onClose: u } = ho(o, n);
|
|
772
|
+
return t({}), (f, c) => (p(), y(s(j), {
|
|
773
|
+
class: "x-toolbar",
|
|
774
|
+
direction: "row",
|
|
775
|
+
grow: !1,
|
|
776
|
+
align: "center"
|
|
777
|
+
}, {
|
|
778
|
+
default: v(() => [
|
|
779
|
+
(p(!0), P(R, null, U(s(r), (d) => (p(), P(R, null, [
|
|
780
|
+
d.divided ? (p(), y(s(ft), {
|
|
781
|
+
key: 0,
|
|
782
|
+
class: "x-toolbar__divider",
|
|
783
|
+
direction: "vertical"
|
|
784
|
+
})) : w("", !0),
|
|
785
|
+
d.slot ? (p(), y(s(A), _({ key: 1 }, s(a)(d), {
|
|
786
|
+
onClick: s(i),
|
|
787
|
+
onCommand: (b) => s(m)(d.value, b),
|
|
788
|
+
onClose: (b) => s(u)(d.value, b)
|
|
789
|
+
}), {
|
|
790
|
+
default: v(() => [
|
|
791
|
+
C(f.$slots, d.slot, { item: d })
|
|
792
|
+
]),
|
|
793
|
+
_: 2
|
|
794
|
+
}, 1040, ["onClick", "onCommand", "onClose"])) : o.button ? (p(), y(s(A), _({ key: 2 }, s(a)(d), {
|
|
795
|
+
onCommand: (b) => s(m)(d.value, b),
|
|
796
|
+
onClose: (b) => s(u)(d.value, b)
|
|
797
|
+
}), {
|
|
798
|
+
default: v(() => [
|
|
799
|
+
d.children?.length ? (p(), y(s(mt), se(_({ key: 0 }, o.button)), {
|
|
800
|
+
default: v(() => [
|
|
801
|
+
(p(!0), P(R, null, U(d.children, (b) => (p(), y(s(L), _(s(l)(b, d.disabled), {
|
|
802
|
+
onClick: (k) => s(i)(b.value)
|
|
803
|
+
}), {
|
|
804
|
+
default: v(() => [
|
|
805
|
+
T(X(b.label), 1)
|
|
806
|
+
]),
|
|
807
|
+
_: 2
|
|
808
|
+
}, 1040, ["onClick"]))), 256))
|
|
809
|
+
]),
|
|
810
|
+
_: 2
|
|
811
|
+
}, 1040)) : (p(), y(s(L), _({ key: 1 }, s(l)(d), {
|
|
812
|
+
onClick: (b) => s(i)(d.value)
|
|
813
|
+
}), {
|
|
814
|
+
default: v(() => [
|
|
815
|
+
T(X(d.label), 1)
|
|
816
|
+
]),
|
|
817
|
+
_: 2
|
|
818
|
+
}, 1040, ["onClick"]))
|
|
819
|
+
]),
|
|
820
|
+
_: 2
|
|
821
|
+
}, 1040, ["onCommand", "onClose"])) : (p(), y(s(A), _({ key: 3 }, s(a)(d), {
|
|
822
|
+
onClick: s(i),
|
|
823
|
+
onCommand: (b) => s(m)(d.value, b),
|
|
824
|
+
onClose: (b) => s(u)(d.value, b)
|
|
825
|
+
}), null, 16, ["onClick", "onCommand", "onClose"]))
|
|
826
|
+
], 64))), 256))
|
|
827
|
+
]),
|
|
828
|
+
_: 3
|
|
829
|
+
}));
|
|
830
|
+
}
|
|
831
|
+
}), Fe = $(_o), he = Symbol("close"), _e = Symbol("maximizable"), Ce = Symbol("minimizable"), we = Symbol("popup"), Co = Symbol("DialogContextKey"), ae = S(1e3), wo = {
|
|
832
|
+
modelValue: {
|
|
833
|
+
type: Boolean,
|
|
834
|
+
default: !0
|
|
835
|
+
},
|
|
836
|
+
width: {
|
|
837
|
+
type: [Number, String],
|
|
838
|
+
default: "80%"
|
|
839
|
+
},
|
|
840
|
+
height: {
|
|
841
|
+
type: [Number, String],
|
|
842
|
+
default: "80%"
|
|
843
|
+
},
|
|
844
|
+
// 自动根据浏览器窗口调整窗口位置和尺寸,当draggable和resizable为false才有效
|
|
845
|
+
autoFit: {
|
|
846
|
+
type: Boolean,
|
|
847
|
+
default: !0
|
|
848
|
+
},
|
|
849
|
+
modal: {
|
|
850
|
+
type: Boolean,
|
|
851
|
+
default: !0
|
|
852
|
+
},
|
|
853
|
+
title: {
|
|
854
|
+
type: String,
|
|
855
|
+
default: ""
|
|
856
|
+
},
|
|
857
|
+
icon: {
|
|
858
|
+
type: [String, Object]
|
|
859
|
+
},
|
|
860
|
+
small: {
|
|
861
|
+
type: Boolean
|
|
862
|
+
},
|
|
863
|
+
draggable: {
|
|
864
|
+
type: [Boolean, Object],
|
|
865
|
+
default: !0
|
|
866
|
+
},
|
|
867
|
+
resizable: {
|
|
868
|
+
type: [Boolean, Object],
|
|
869
|
+
default: !0
|
|
870
|
+
},
|
|
871
|
+
footer: {
|
|
872
|
+
type: Boolean,
|
|
873
|
+
default: !0
|
|
874
|
+
},
|
|
875
|
+
closable: {
|
|
876
|
+
type: Boolean,
|
|
877
|
+
default: !0
|
|
878
|
+
},
|
|
879
|
+
maximizable: {
|
|
880
|
+
type: Boolean,
|
|
881
|
+
default: !0
|
|
882
|
+
},
|
|
883
|
+
minimizable: {
|
|
884
|
+
type: Boolean,
|
|
885
|
+
default: !0
|
|
886
|
+
},
|
|
887
|
+
tools: {
|
|
888
|
+
type: Array,
|
|
889
|
+
default: () => []
|
|
890
|
+
},
|
|
891
|
+
closeOnClickModal: {
|
|
892
|
+
type: Boolean
|
|
893
|
+
},
|
|
894
|
+
confirmText: {
|
|
895
|
+
type: [Boolean, String],
|
|
896
|
+
default: "确定"
|
|
897
|
+
},
|
|
898
|
+
confirm: {
|
|
899
|
+
type: Function
|
|
900
|
+
},
|
|
901
|
+
cancelText: {
|
|
902
|
+
type: [Boolean, String],
|
|
903
|
+
default: "取消"
|
|
904
|
+
},
|
|
905
|
+
cancel: {
|
|
906
|
+
type: Function
|
|
907
|
+
},
|
|
908
|
+
beforeClose: {
|
|
909
|
+
type: Function
|
|
910
|
+
},
|
|
911
|
+
src: {
|
|
912
|
+
type: String
|
|
913
|
+
},
|
|
914
|
+
content: {
|
|
915
|
+
type: Object
|
|
916
|
+
},
|
|
917
|
+
zIndex: {
|
|
918
|
+
type: Number,
|
|
919
|
+
default() {
|
|
920
|
+
return ++ae.value;
|
|
921
|
+
}
|
|
922
|
+
},
|
|
923
|
+
bodyPadding: {
|
|
924
|
+
type: Boolean,
|
|
925
|
+
default: !0
|
|
926
|
+
},
|
|
927
|
+
theme: {
|
|
928
|
+
type: String,
|
|
929
|
+
default: "newpearl"
|
|
930
|
+
}
|
|
931
|
+
}, xo = {
|
|
932
|
+
dragStart: (e) => !0,
|
|
933
|
+
dragEnd: (e) => !0,
|
|
934
|
+
dragging: (e) => !0,
|
|
935
|
+
resizeStart: (e) => !0,
|
|
936
|
+
resizeEnd: (e) => !0,
|
|
937
|
+
resizing: (e) => !0,
|
|
938
|
+
"update:modelValue": (e) => !0,
|
|
939
|
+
toolClick: (e) => !0,
|
|
940
|
+
toolCommand: (e, t) => !0,
|
|
941
|
+
toolClose: (e, t) => !0,
|
|
942
|
+
open: () => !0,
|
|
943
|
+
show: () => !0,
|
|
944
|
+
close: () => !0,
|
|
945
|
+
hide: () => !0,
|
|
946
|
+
maximized: () => !0,
|
|
947
|
+
restore: () => !0,
|
|
948
|
+
stateChange: (e) => !0,
|
|
949
|
+
confirm: () => !0,
|
|
950
|
+
cancel: () => !0
|
|
951
|
+
};
|
|
952
|
+
function ko(e) {
|
|
953
|
+
const t = S(), n = S(), o = g(() => e.draggable ? {
|
|
954
|
+
...typeof e.draggable == "object" ? e.draggable : {},
|
|
955
|
+
selector: ".x-panel__header",
|
|
956
|
+
wrapper: t
|
|
957
|
+
} : void 0), l = g(() => e.resizable ? {
|
|
958
|
+
minWidth: 100,
|
|
959
|
+
minHeight: 100,
|
|
960
|
+
...typeof e.resizable == "object" ? e.resizable : {}
|
|
961
|
+
} : void 0), a = g(() => e.small ? "small" : "default"), r = g(() => n.value?.$el);
|
|
962
|
+
return {
|
|
963
|
+
wrapperRef: t,
|
|
964
|
+
dialogRef: n,
|
|
965
|
+
draggable: o,
|
|
966
|
+
resizable: l,
|
|
967
|
+
buttonSize: a,
|
|
968
|
+
dialogElRef: r
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
function So(e, t, n) {
|
|
972
|
+
const o = Je(e, "modelValue"), l = et({
|
|
973
|
+
maximized: !1,
|
|
974
|
+
minimized: !1,
|
|
975
|
+
visible: !!o.value,
|
|
976
|
+
width: 0,
|
|
977
|
+
height: 0,
|
|
978
|
+
left: 0,
|
|
979
|
+
top: 0,
|
|
980
|
+
zIndex: e.zIndex ?? 1
|
|
981
|
+
}), { width: a, height: r, update: i } = re(n), { maximized: m, minimized: u, visible: f } = tt(l), c = () => {
|
|
982
|
+
i(), l.width = be(e.width, a.value), l.height = be(e.height, r.value), l.left = (a.value - l.width) / 2, l.top = Math.max((r.value - l.height) / 2, 0);
|
|
983
|
+
};
|
|
984
|
+
O(n, c), O([a, r], () => {
|
|
985
|
+
e.autoFit && !e.draggable && !e.resizable && c();
|
|
986
|
+
}), O(l, () => {
|
|
987
|
+
t("update:modelValue", l.visible), t("stateChange", l);
|
|
988
|
+
}), O(f, (h) => {
|
|
989
|
+
h ? (t("open"), l.zIndex = ++ae.value) : t("close");
|
|
990
|
+
}), O(m, (h) => t(h ? "maximized" : "restore")), O(u, (h) => t(h ? "hide" : "show")), O(o, (h) => l.visible = !!h);
|
|
991
|
+
const d = () => l.minimized = !0, b = async () => {
|
|
992
|
+
(!e.beforeClose || await e.beforeClose()) && (l.visible = !1);
|
|
993
|
+
}, k = () => {
|
|
994
|
+
l.minimized = !1, l.visible = !0;
|
|
995
|
+
};
|
|
996
|
+
return Q(() => {
|
|
997
|
+
f.value && t("open");
|
|
998
|
+
}), {
|
|
999
|
+
state: l,
|
|
1000
|
+
show: k,
|
|
1001
|
+
hide: d,
|
|
1002
|
+
close: b
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
function $o(e, t, n, o) {
|
|
1006
|
+
const l = g(() => ({
|
|
1007
|
+
width: `${t.width}px`,
|
|
1008
|
+
height: `${t.height}px`,
|
|
1009
|
+
left: `${t.left}px`,
|
|
1010
|
+
top: `${t.top}px`
|
|
1011
|
+
})), a = g(() => ({
|
|
1012
|
+
"is-draggable": !!e.draggable,
|
|
1013
|
+
"is-resizable": !!e.resizable,
|
|
1014
|
+
"is-maximized": t.maximized,
|
|
1015
|
+
"is-resizing": n.value,
|
|
1016
|
+
"is-dragging": o.value,
|
|
1017
|
+
[`is-theme-${e.theme}`]: !!e.theme
|
|
1018
|
+
})), r = g(() => ({
|
|
1019
|
+
zIndex: t.zIndex
|
|
1020
|
+
}));
|
|
1021
|
+
return {
|
|
1022
|
+
dialogStyle: l,
|
|
1023
|
+
dialogClass: a,
|
|
1024
|
+
wrapperStyle: r
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
function zo(e, t, n, o, l) {
|
|
1028
|
+
const a = () => t("resizeStart", l), r = () => t("resizeEnd", l), i = () => t("resizing", l), { direction: m, left: u, top: f, height: c, width: d, update: b, resizing: k } = wn(n, {
|
|
1029
|
+
...s(o),
|
|
1030
|
+
onStart: a,
|
|
1031
|
+
onEnd: r,
|
|
1032
|
+
onResizing: i
|
|
1033
|
+
});
|
|
1034
|
+
return O([u, f, c, d], ([h, z, F, B]) => {
|
|
1035
|
+
!e.resizable || l.minimized || l.maximized || (l.left = h, l.top = z, l.height = F, l.width = B);
|
|
1036
|
+
}), {
|
|
1037
|
+
direction: m,
|
|
1038
|
+
update: b,
|
|
1039
|
+
resizing: k
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
function Eo(e, t, n, o, l, a) {
|
|
1043
|
+
const r = () => t("dragStart", l), i = () => {
|
|
1044
|
+
a(), t("dragEnd", l);
|
|
1045
|
+
}, m = () => t("dragging", l), { x: u, y: f, isDragging: c } = hn(n, {
|
|
1046
|
+
...s(o),
|
|
1047
|
+
onStart: r,
|
|
1048
|
+
onEnd: i,
|
|
1049
|
+
onMove: m
|
|
1050
|
+
});
|
|
1051
|
+
return O([u, f], () => {
|
|
1052
|
+
!e.draggable || l.minimized || l.maximized || (l.left = u.value, l.top = f.value);
|
|
1053
|
+
}), {
|
|
1054
|
+
x: u,
|
|
1055
|
+
y: f,
|
|
1056
|
+
isDragging: c
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
function Bo(e, t, n, o) {
|
|
1060
|
+
const l = g(() => [
|
|
1061
|
+
...e.tools || [],
|
|
1062
|
+
{
|
|
1063
|
+
value: Ce,
|
|
1064
|
+
icon: $t,
|
|
1065
|
+
disabled: !e.minimizable
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
value: _e,
|
|
1069
|
+
icon: zt,
|
|
1070
|
+
disabled: !e.maximizable || n.maximized
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
value: we,
|
|
1074
|
+
icon: Et,
|
|
1075
|
+
disabled: !e.maximizable || !n.maximized
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
value: he,
|
|
1079
|
+
icon: Bt,
|
|
1080
|
+
disabled: !e.closable
|
|
1081
|
+
}
|
|
1082
|
+
]), a = (m) => {
|
|
1083
|
+
switch (m) {
|
|
1084
|
+
case he:
|
|
1085
|
+
o();
|
|
1086
|
+
break;
|
|
1087
|
+
case _e:
|
|
1088
|
+
n.maximized = !0;
|
|
1089
|
+
break;
|
|
1090
|
+
case we:
|
|
1091
|
+
n.maximized = !1;
|
|
1092
|
+
break;
|
|
1093
|
+
case Ce:
|
|
1094
|
+
n.minimized = !0;
|
|
1095
|
+
break;
|
|
1096
|
+
default:
|
|
1097
|
+
t("toolClick", m);
|
|
1098
|
+
break;
|
|
1099
|
+
}
|
|
1100
|
+
}, r = (m, u) => {
|
|
1101
|
+
t("toolCommand", m, u);
|
|
1102
|
+
}, i = (m, u) => {
|
|
1103
|
+
t("toolClose", m, u);
|
|
1104
|
+
};
|
|
1105
|
+
return g(() => ({
|
|
1106
|
+
hiddenOnDisabled: !0,
|
|
1107
|
+
items: l.value,
|
|
1108
|
+
onClick: a,
|
|
1109
|
+
onCommand: r,
|
|
1110
|
+
onClose: i
|
|
1111
|
+
}));
|
|
1112
|
+
}
|
|
1113
|
+
function Oo(e, t, n) {
|
|
1114
|
+
return {
|
|
1115
|
+
onModalClick: () => {
|
|
1116
|
+
e.closeOnClickModal && n();
|
|
1117
|
+
},
|
|
1118
|
+
onDialogClick: () => {
|
|
1119
|
+
t.zIndex = ++ae.value;
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
function jo(e, t, n, o) {
|
|
1124
|
+
const l = S(!1), a = S(!1);
|
|
1125
|
+
return {
|
|
1126
|
+
onConfirmClick: async () => {
|
|
1127
|
+
t("confirm"), l.value = !0, (!e.confirm || await e.confirm()) && (l.value = !1, o());
|
|
1128
|
+
},
|
|
1129
|
+
onCancelClick: async () => {
|
|
1130
|
+
t("cancel"), a.value = !0, (!e.cancel || await e.cancel()) && (a.value = !1, o());
|
|
1131
|
+
},
|
|
1132
|
+
confirmLoading: l,
|
|
1133
|
+
cancelLoading: a
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
const Po = ["src"], Io = { class: "x-dialog__extra" }, Do = { class: "x-dialog__action" }, Re = /* @__PURE__ */ x({
|
|
1137
|
+
name: "XDialog",
|
|
1138
|
+
inheritAttrs: !1,
|
|
1139
|
+
__name: "Dialog",
|
|
1140
|
+
props: wo,
|
|
1141
|
+
emits: xo,
|
|
1142
|
+
setup(e, { expose: t, emit: n }) {
|
|
1143
|
+
const o = e, { wrapperRef: l, dialogRef: a, draggable: r, resizable: i, buttonSize: m, dialogElRef: u } = ko(o), { state: f, show: c, hide: d, close: b } = So(o, n, l), { update: k, resizing: h } = zo(
|
|
1144
|
+
o,
|
|
1145
|
+
n,
|
|
1146
|
+
u,
|
|
1147
|
+
i,
|
|
1148
|
+
f
|
|
1149
|
+
), { isDragging: z } = Eo(
|
|
1150
|
+
o,
|
|
1151
|
+
n,
|
|
1152
|
+
u,
|
|
1153
|
+
r,
|
|
1154
|
+
f,
|
|
1155
|
+
k
|
|
1156
|
+
), F = Bo(o, n, f, b), { onConfirmClick: B, onCancelClick: ie, confirmLoading: W, cancelLoading: ee } = jo(o, n, f, b), { dialogClass: Ge, dialogStyle: Ke, wrapperStyle: Ye } = $o(
|
|
1157
|
+
o,
|
|
1158
|
+
f,
|
|
1159
|
+
h,
|
|
1160
|
+
z
|
|
1161
|
+
), { onModalClick: ce, onDialogClick: Ze } = Oo(o, f, b), ue = I();
|
|
1162
|
+
return ne(Co, ue), t({
|
|
1163
|
+
instance: ue,
|
|
1164
|
+
isDragging: z,
|
|
1165
|
+
resizing: h,
|
|
1166
|
+
state: f,
|
|
1167
|
+
show: c,
|
|
1168
|
+
hide: d,
|
|
1169
|
+
close: b
|
|
1170
|
+
}), (H, de) => s(f).visible ? (p(), y(ot, {
|
|
1171
|
+
key: 0,
|
|
1172
|
+
to: "body"
|
|
1173
|
+
}, [
|
|
1174
|
+
nt(V("div", _({
|
|
1175
|
+
ref_key: "wrapperRef",
|
|
1176
|
+
ref: l,
|
|
1177
|
+
class: "x-dialog__wrapper",
|
|
1178
|
+
style: s(Ye)
|
|
1179
|
+
}, H.$attrs), [
|
|
1180
|
+
o.modal ? (p(), P("div", {
|
|
1181
|
+
key: 0,
|
|
1182
|
+
onClick: de[0] || (de[0] = Ee(
|
|
1183
|
+
//@ts-ignore
|
|
1184
|
+
(...qe) => s(ce) && s(ce)(...qe),
|
|
1185
|
+
["stop"]
|
|
1186
|
+
)),
|
|
1187
|
+
class: "x-dialog__modal"
|
|
1188
|
+
})) : w("", !0),
|
|
1189
|
+
E(s(Ne), {
|
|
1190
|
+
ref_key: "dialogRef",
|
|
1191
|
+
ref: a,
|
|
1192
|
+
class: D(["x-dialog", s(Ge)]),
|
|
1193
|
+
style: le(s(Ke)),
|
|
1194
|
+
title: o.title,
|
|
1195
|
+
icon: o.icon,
|
|
1196
|
+
small: o.small,
|
|
1197
|
+
toolbar: s(F),
|
|
1198
|
+
border: "",
|
|
1199
|
+
radius: "",
|
|
1200
|
+
shadow: "always",
|
|
1201
|
+
overflow: "hidden",
|
|
1202
|
+
body: { padding: H.bodyPadding, flex: !!o.src },
|
|
1203
|
+
footer: { justify: "between", align: "center" },
|
|
1204
|
+
onMousedown: s(Ze)
|
|
1205
|
+
}, K({
|
|
1206
|
+
default: v(() => [
|
|
1207
|
+
C(H.$slots, "default", {}, () => [
|
|
1208
|
+
o.content ? (p(), y(q(o.content), { key: 0 })) : w("", !0),
|
|
1209
|
+
o.src ? (p(), P("iframe", {
|
|
1210
|
+
key: 1,
|
|
1211
|
+
src: o.src,
|
|
1212
|
+
border: "0",
|
|
1213
|
+
class: "x-dialog__frame"
|
|
1214
|
+
}, null, 8, Po)) : w("", !0)
|
|
1215
|
+
])
|
|
1216
|
+
]),
|
|
1217
|
+
_: 2
|
|
1218
|
+
}, [
|
|
1219
|
+
o.footer ? {
|
|
1220
|
+
name: "footer",
|
|
1221
|
+
fn: v(() => [
|
|
1222
|
+
V("div", Io, [
|
|
1223
|
+
C(H.$slots, "extra")
|
|
1224
|
+
]),
|
|
1225
|
+
V("div", Do, [
|
|
1226
|
+
C(H.$slots, "action"),
|
|
1227
|
+
o.cancelText ? (p(), y(s(L), {
|
|
1228
|
+
key: 0,
|
|
1229
|
+
type: "default",
|
|
1230
|
+
loading: s(ee),
|
|
1231
|
+
icon: s(Pe),
|
|
1232
|
+
size: s(m),
|
|
1233
|
+
onClick: s(ie)
|
|
1234
|
+
}, {
|
|
1235
|
+
default: v(() => [
|
|
1236
|
+
T(X(o.cancelText), 1)
|
|
1237
|
+
]),
|
|
1238
|
+
_: 1
|
|
1239
|
+
}, 8, ["loading", "icon", "size", "onClick"])) : w("", !0),
|
|
1240
|
+
o.confirmText ? (p(), y(s(L), {
|
|
1241
|
+
key: 1,
|
|
1242
|
+
type: "primary",
|
|
1243
|
+
icon: s(Ie),
|
|
1244
|
+
loading: s(W),
|
|
1245
|
+
size: s(m),
|
|
1246
|
+
onClick: s(B)
|
|
1247
|
+
}, {
|
|
1248
|
+
default: v(() => [
|
|
1249
|
+
T(X(o.confirmText), 1)
|
|
1250
|
+
]),
|
|
1251
|
+
_: 1
|
|
1252
|
+
}, 8, ["icon", "loading", "size", "onClick"])) : w("", !0)
|
|
1253
|
+
])
|
|
1254
|
+
]),
|
|
1255
|
+
key: "0"
|
|
1256
|
+
} : void 0
|
|
1257
|
+
]), 1032, ["class", "style", "title", "icon", "small", "toolbar", "body", "onMousedown"])
|
|
1258
|
+
], 16), [
|
|
1259
|
+
[lt, !s(f).minimized]
|
|
1260
|
+
])
|
|
1261
|
+
])) : w("", !0);
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1264
|
+
function Ae(e = {}, t) {
|
|
1265
|
+
const n = document.createElement("div"), o = E(Re, e);
|
|
1266
|
+
return o.appContext = t ?? Ae._context, fe(o, n), document.body.appendChild(n), o.props.onDestroy = () => {
|
|
1267
|
+
fe(null, n), n.parentNode?.removeChild(n);
|
|
1268
|
+
}, o;
|
|
1269
|
+
}
|
|
1270
|
+
const To = jt(Ae, "$dialog"), Me = $(Re, { create: To }), Vo = {
|
|
1271
|
+
position: {
|
|
1272
|
+
type: String,
|
|
1273
|
+
default: "bottom"
|
|
1274
|
+
},
|
|
1275
|
+
fixed: {
|
|
1276
|
+
type: Object
|
|
1277
|
+
},
|
|
1278
|
+
body: {
|
|
1279
|
+
type: Object
|
|
1280
|
+
}
|
|
1281
|
+
}, Xo = {
|
|
1282
|
+
// eventName: (param: any) => true
|
|
1283
|
+
}, No = /* @__PURE__ */ x({
|
|
1284
|
+
name: "XWrapper",
|
|
1285
|
+
__name: "Wrapper",
|
|
1286
|
+
props: Vo,
|
|
1287
|
+
emits: Xo,
|
|
1288
|
+
setup(e, { expose: t, emit: n }) {
|
|
1289
|
+
const o = e, l = I(), a = S(), r = S(0), i = S(), m = () => {
|
|
1290
|
+
i.value = l?.proxy?.$el;
|
|
1291
|
+
const c = a.value?.$el;
|
|
1292
|
+
c && (r.value = c.getBoundingClientRect().height);
|
|
1293
|
+
}, u = g(() => ({
|
|
1294
|
+
[`is-fixed-${o.position}`]: !!o.position
|
|
1295
|
+
})), f = g(() => o.position === "none" ? null : o.position === "top" ? {
|
|
1296
|
+
paddingTop: `${r.value}px`
|
|
1297
|
+
} : {
|
|
1298
|
+
paddingBottom: `${r.value}px`
|
|
1299
|
+
});
|
|
1300
|
+
return Q(m), t({}), (c, d) => (p(), y(s(j), _({
|
|
1301
|
+
fit: "",
|
|
1302
|
+
padding: !1,
|
|
1303
|
+
class: ["x-wrapper", u.value]
|
|
1304
|
+
}, c.$attrs), {
|
|
1305
|
+
default: v(() => [
|
|
1306
|
+
E(s(j), _({
|
|
1307
|
+
flex: !1,
|
|
1308
|
+
grow: c.position !== "none",
|
|
1309
|
+
class: ["x-wrapper__body", u.value],
|
|
1310
|
+
style: f.value
|
|
1311
|
+
}, o.body), {
|
|
1312
|
+
default: v(() => [
|
|
1313
|
+
C(c.$slots, "default")
|
|
1314
|
+
]),
|
|
1315
|
+
_: 3
|
|
1316
|
+
}, 16, ["grow", "class", "style"]),
|
|
1317
|
+
c.$slots.fixed ? (p(), y(s(j), _({
|
|
1318
|
+
key: 0,
|
|
1319
|
+
ref_key: "fixed",
|
|
1320
|
+
ref: a,
|
|
1321
|
+
grow: !1,
|
|
1322
|
+
direction: "row",
|
|
1323
|
+
justify: "end",
|
|
1324
|
+
overflow: "visible",
|
|
1325
|
+
class: ["x-wrapper__fixed", u.value]
|
|
1326
|
+
}, o.fixed), {
|
|
1327
|
+
default: v(() => [
|
|
1328
|
+
C(c.$slots, "fixed")
|
|
1329
|
+
]),
|
|
1330
|
+
_: 3
|
|
1331
|
+
}, 16, ["class"])) : w("", !0)
|
|
1332
|
+
]),
|
|
1333
|
+
_: 3
|
|
1334
|
+
}, 16, ["class"]));
|
|
1335
|
+
}
|
|
1336
|
+
}), Le = $(No), Fo = {
|
|
1337
|
+
items: {
|
|
1338
|
+
type: [Number, Array]
|
|
1339
|
+
},
|
|
1340
|
+
columns: {
|
|
1341
|
+
type: [Number, Object]
|
|
1342
|
+
},
|
|
1343
|
+
row: {
|
|
1344
|
+
type: Object
|
|
1345
|
+
},
|
|
1346
|
+
col: {
|
|
1347
|
+
type: Object
|
|
1348
|
+
},
|
|
1349
|
+
border: {
|
|
1350
|
+
type: Boolean
|
|
1351
|
+
}
|
|
1352
|
+
}, Ro = {
|
|
1353
|
+
// eventName: (param: any) => true
|
|
1354
|
+
}, Ao = /* @__PURE__ */ x({
|
|
1355
|
+
name: "XContainer",
|
|
1356
|
+
__name: "Container",
|
|
1357
|
+
props: Fo,
|
|
1358
|
+
emits: Ro,
|
|
1359
|
+
setup(e, { expose: t, emit: n }) {
|
|
1360
|
+
const o = e, l = g(() => ({
|
|
1361
|
+
...o.row
|
|
1362
|
+
})), a = g(() => typeof o.columns == "number" ? {
|
|
1363
|
+
span: Math.ceil(24 / o.columns)
|
|
1364
|
+
} : Object.entries(o.columns).reduce(
|
|
1365
|
+
(i, [m, u]) => (i[m] = {
|
|
1366
|
+
span: Math.ceil(24 / u)
|
|
1367
|
+
}, i),
|
|
1368
|
+
{}
|
|
1369
|
+
)), r = g(() => ({
|
|
1370
|
+
...a.value,
|
|
1371
|
+
...o.col
|
|
1372
|
+
}));
|
|
1373
|
+
return t({}), (i, m) => (p(), y(s(j), {
|
|
1374
|
+
class: D(["x-container", { "is-split-border": o.border }]),
|
|
1375
|
+
border: o.border,
|
|
1376
|
+
flex: !1,
|
|
1377
|
+
grow: !1
|
|
1378
|
+
}, {
|
|
1379
|
+
default: v(() => [
|
|
1380
|
+
E(s(pt), _({ class: "x-container__row" }, l.value), {
|
|
1381
|
+
default: v(() => [
|
|
1382
|
+
(p(!0), P(R, null, U(o.items, (u) => (p(), y(s(gt), _({
|
|
1383
|
+
class: ["x-container__col", { "is-split": o.border }]
|
|
1384
|
+
}, r.value), {
|
|
1385
|
+
default: v(() => [
|
|
1386
|
+
C(i.$slots, "default", { item: u })
|
|
1387
|
+
]),
|
|
1388
|
+
_: 2
|
|
1389
|
+
}, 1040, ["class"]))), 256))
|
|
1390
|
+
]),
|
|
1391
|
+
_: 3
|
|
1392
|
+
}, 16)
|
|
1393
|
+
]),
|
|
1394
|
+
_: 3
|
|
1395
|
+
}, 8, ["class", "border"]));
|
|
1396
|
+
}
|
|
1397
|
+
}), Mo = $(Ao), Lo = {
|
|
1398
|
+
...bt,
|
|
1399
|
+
prop: {
|
|
1400
|
+
type: String
|
|
1401
|
+
},
|
|
1402
|
+
// 错误提示图标样式,用来自定义显示位置
|
|
1403
|
+
iconStyle: {
|
|
1404
|
+
type: Object
|
|
1405
|
+
},
|
|
1406
|
+
// 定义输入组件
|
|
1407
|
+
setter: {
|
|
1408
|
+
type: [String, Object]
|
|
1409
|
+
},
|
|
1410
|
+
// 双向绑定输入组件
|
|
1411
|
+
modelValue: {
|
|
1412
|
+
type: [String, Number, Boolean, Object, Array],
|
|
1413
|
+
default: ""
|
|
1414
|
+
},
|
|
1415
|
+
width: {
|
|
1416
|
+
type: String
|
|
1417
|
+
},
|
|
1418
|
+
help: {
|
|
1419
|
+
type: Object
|
|
1420
|
+
}
|
|
1421
|
+
}, Wo = {
|
|
1422
|
+
"update:modelValue": (e) => !0,
|
|
1423
|
+
change: (e) => !0,
|
|
1424
|
+
focus: (e) => !0,
|
|
1425
|
+
blur: (e) => !0
|
|
1426
|
+
};
|
|
1427
|
+
function We(e) {
|
|
1428
|
+
return x({
|
|
1429
|
+
name: e.name,
|
|
1430
|
+
props: {
|
|
1431
|
+
modelValue: {
|
|
1432
|
+
type: String,
|
|
1433
|
+
...e.modelValue
|
|
1434
|
+
},
|
|
1435
|
+
loader: {
|
|
1436
|
+
type: [Array, Function]
|
|
1437
|
+
},
|
|
1438
|
+
auto: {
|
|
1439
|
+
type: Boolean,
|
|
1440
|
+
default: !0
|
|
1441
|
+
},
|
|
1442
|
+
ref: {
|
|
1443
|
+
type: String,
|
|
1444
|
+
default: "setter"
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
data() {
|
|
1448
|
+
return {
|
|
1449
|
+
options: []
|
|
1450
|
+
};
|
|
1451
|
+
},
|
|
1452
|
+
methods: {
|
|
1453
|
+
focus() {
|
|
1454
|
+
this.$refs[this.ref]?.focus();
|
|
1455
|
+
},
|
|
1456
|
+
blur() {
|
|
1457
|
+
this.$refs[this.ref]?.blur();
|
|
1458
|
+
},
|
|
1459
|
+
async load() {
|
|
1460
|
+
this.options = typeof this.loader == "function" ? await this.loader() : this.loader ?? [];
|
|
1461
|
+
}
|
|
1462
|
+
},
|
|
1463
|
+
watch: {
|
|
1464
|
+
loader: {
|
|
1465
|
+
immediate: !0,
|
|
1466
|
+
handler(t) {
|
|
1467
|
+
this.auto && this.load();
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
render() {
|
|
1472
|
+
return e.createVNode ? e.createVNode(this) : null;
|
|
1473
|
+
}
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
const Ho = We({
|
|
1477
|
+
name: "InputSetter",
|
|
1478
|
+
modelValue: {
|
|
1479
|
+
type: String,
|
|
1480
|
+
default: ""
|
|
1481
|
+
},
|
|
1482
|
+
createVNode({ $props: e, $attrs: t }) {
|
|
1483
|
+
return M(yt, {
|
|
1484
|
+
...e,
|
|
1485
|
+
...t
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
}), Uo = We({
|
|
1489
|
+
name: "SelectSetter",
|
|
1490
|
+
modelValue: {
|
|
1491
|
+
type: [String, Number, Boolean, Object, Array],
|
|
1492
|
+
default: ""
|
|
1493
|
+
},
|
|
1494
|
+
createVNode({ $props: e, $attrs: t, options: n }) {
|
|
1495
|
+
const { modelValue: o = "" } = e, l = n.map(({ label: a, value: r, disabled: i }) => M(vt, { label: a, value: r, disabled: i }));
|
|
1496
|
+
return M(
|
|
1497
|
+
ht,
|
|
1498
|
+
{
|
|
1499
|
+
modelValue: o,
|
|
1500
|
+
...t
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
default: () => l
|
|
1504
|
+
}
|
|
1505
|
+
);
|
|
1506
|
+
}
|
|
1507
|
+
}), xe = {
|
|
1508
|
+
InputSetter: Ho,
|
|
1509
|
+
SelectSetter: Uo
|
|
1510
|
+
};
|
|
1511
|
+
function Go(e) {
|
|
1512
|
+
const t = I(), n = S(), o = g(() => e.iconStyle ?? {
|
|
1513
|
+
left: `${n.value}px`
|
|
1514
|
+
}), l = S(), { width: a, height: r } = De(l), i = () => {
|
|
1515
|
+
if (l.value = t?.proxy?.$el, l.value) {
|
|
1516
|
+
const m = l.value.querySelector("input"), u = l.value.querySelector(".el-input__prefix"), f = m?.getBoundingClientRect(), c = u?.getBoundingClientRect();
|
|
1517
|
+
n.value = f ? f.width + (c?.width || 0) - 6 : void 0;
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
return st(i), Q(i), O([a, r], i), {
|
|
1521
|
+
left: n,
|
|
1522
|
+
style: o
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
function Ko(e, t) {
|
|
1526
|
+
const n = S(), o = g(() => {
|
|
1527
|
+
if (!e.setter)
|
|
1528
|
+
return null;
|
|
1529
|
+
if (typeof e.setter == "string")
|
|
1530
|
+
return xe[e.setter];
|
|
1531
|
+
if (G(e.setter))
|
|
1532
|
+
return e.setter;
|
|
1533
|
+
{
|
|
1534
|
+
const c = e.setter.name;
|
|
1535
|
+
return typeof c == "string" ? xe[c] : c;
|
|
1536
|
+
}
|
|
1537
|
+
}), l = (c) => {
|
|
1538
|
+
t("update:modelValue", c), t("change", c);
|
|
1539
|
+
}, a = () => {
|
|
1540
|
+
t("focus", e);
|
|
1541
|
+
}, r = () => {
|
|
1542
|
+
t("blur", e);
|
|
1543
|
+
}, i = g(() => {
|
|
1544
|
+
const c = {
|
|
1545
|
+
modelValue: e.modelValue,
|
|
1546
|
+
"onUpdate:modelValue": l,
|
|
1547
|
+
onFocus: a,
|
|
1548
|
+
onBlur: r
|
|
1549
|
+
};
|
|
1550
|
+
if (!e.setter || G(e.setter))
|
|
1551
|
+
return c;
|
|
1552
|
+
if (typeof e.setter == "string")
|
|
1553
|
+
return {};
|
|
1554
|
+
{
|
|
1555
|
+
const { props: d, loader: b, auto: k } = e.setter;
|
|
1556
|
+
return {
|
|
1557
|
+
...d,
|
|
1558
|
+
...c,
|
|
1559
|
+
loader: b,
|
|
1560
|
+
auto: k
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
return {
|
|
1565
|
+
setter: o,
|
|
1566
|
+
setterProps: i,
|
|
1567
|
+
setterRef: n,
|
|
1568
|
+
focus: () => {
|
|
1569
|
+
const c = n.value?.focus;
|
|
1570
|
+
c ? c() : console.warn("setter无实现focus方法");
|
|
1571
|
+
},
|
|
1572
|
+
blur: () => {
|
|
1573
|
+
const c = n.value?.blur;
|
|
1574
|
+
c ? c() : console.warn("setter无实现blur方法");
|
|
1575
|
+
},
|
|
1576
|
+
load: async () => {
|
|
1577
|
+
const c = n.value?.load;
|
|
1578
|
+
c ? await c() : console.warn("setter无实现focus方法");
|
|
1579
|
+
}
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
function Yo(e, t) {
|
|
1583
|
+
const n = I()?.proxy, o = Oe(Ue, null), l = Y(e, ["modelValue", "setter", "iconStyle", "help"]), a = g(() => e.width ? {
|
|
1584
|
+
width: e.width
|
|
1585
|
+
} : null), r = g(() => ({
|
|
1586
|
+
"is-has-extra": !!e.help || !!t.extra
|
|
1587
|
+
}));
|
|
1588
|
+
return Q(() => {
|
|
1589
|
+
o?.$.exposed?.addField(n);
|
|
1590
|
+
}), je(() => {
|
|
1591
|
+
o?.$.exposed?.removeField(n);
|
|
1592
|
+
}), {
|
|
1593
|
+
itemProps: l,
|
|
1594
|
+
itemStyle: a,
|
|
1595
|
+
itemClass: r
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
const Zo = /* @__PURE__ */ x({
|
|
1599
|
+
name: "XField",
|
|
1600
|
+
__name: "Field",
|
|
1601
|
+
props: Lo,
|
|
1602
|
+
emits: Wo,
|
|
1603
|
+
setup(e, { expose: t, emit: n }) {
|
|
1604
|
+
const o = e, l = Be(), a = S(), { style: r } = Go(o), { setter: i, setterProps: m, setterRef: u, focus: f, blur: c, load: d } = Ko(
|
|
1605
|
+
o,
|
|
1606
|
+
n
|
|
1607
|
+
), { itemProps: b, itemStyle: k, itemClass: h } = Yo(o, l);
|
|
1608
|
+
return t({
|
|
1609
|
+
item: a,
|
|
1610
|
+
setterRef: u,
|
|
1611
|
+
focus: f,
|
|
1612
|
+
blur: c,
|
|
1613
|
+
load: d
|
|
1614
|
+
}), (z, F) => (p(), y(s(_t), _({
|
|
1615
|
+
ref_key: "item",
|
|
1616
|
+
ref: a,
|
|
1617
|
+
class: ["x-field", s(h)],
|
|
1618
|
+
style: s(k)
|
|
1619
|
+
}, s(b)), {
|
|
1620
|
+
label: v(({ label: B }) => [
|
|
1621
|
+
C(z.$slots, "label", { label: B })
|
|
1622
|
+
]),
|
|
1623
|
+
error: v(({ error: B }) => [
|
|
1624
|
+
C(z.$slots, "error", { error: B }, () => [
|
|
1625
|
+
E(s(A), {
|
|
1626
|
+
class: "x-field__error",
|
|
1627
|
+
style: le(s(r)),
|
|
1628
|
+
icon: s(kt),
|
|
1629
|
+
tooltip: B
|
|
1630
|
+
}, null, 8, ["style", "icon", "tooltip"])
|
|
1631
|
+
])
|
|
1632
|
+
]),
|
|
1633
|
+
default: v(() => [
|
|
1634
|
+
C(z.$slots, "default", {}, () => [
|
|
1635
|
+
s(i) ? (p(), y(q(s(i)), _({
|
|
1636
|
+
key: 0,
|
|
1637
|
+
ref_key: "setterRef",
|
|
1638
|
+
ref: u
|
|
1639
|
+
}, s(m)), null, 16)) : w("", !0)
|
|
1640
|
+
]),
|
|
1641
|
+
C(z.$slots, "extra", {}, () => [
|
|
1642
|
+
o.help ? (p(), y(s(Xe), se(_({ key: 0 }, o.help)), null, 16)) : w("", !0)
|
|
1643
|
+
])
|
|
1644
|
+
]),
|
|
1645
|
+
_: 3
|
|
1646
|
+
}, 16, ["class", "style"]));
|
|
1647
|
+
}
|
|
1648
|
+
}), He = $(Zo), Ue = Symbol("FormContextKey"), qo = {
|
|
1649
|
+
wrapper: {
|
|
1650
|
+
type: Object
|
|
1651
|
+
},
|
|
1652
|
+
// 启用fixed区块
|
|
1653
|
+
fixed: {
|
|
1654
|
+
type: Boolean,
|
|
1655
|
+
default: !0
|
|
1656
|
+
},
|
|
1657
|
+
submitText: {
|
|
1658
|
+
type: String,
|
|
1659
|
+
default: "确定"
|
|
1660
|
+
},
|
|
1661
|
+
resetText: {
|
|
1662
|
+
type: String,
|
|
1663
|
+
default: "重置"
|
|
1664
|
+
},
|
|
1665
|
+
// 字段集
|
|
1666
|
+
fields: {
|
|
1667
|
+
type: Array
|
|
1668
|
+
},
|
|
1669
|
+
model: {
|
|
1670
|
+
type: Object
|
|
1671
|
+
},
|
|
1672
|
+
submiting: {
|
|
1673
|
+
type: Boolean
|
|
1674
|
+
},
|
|
1675
|
+
submit: {
|
|
1676
|
+
type: Function
|
|
1677
|
+
},
|
|
1678
|
+
fieldWidth: {
|
|
1679
|
+
type: String
|
|
1680
|
+
},
|
|
1681
|
+
labelWidth: {
|
|
1682
|
+
type: String
|
|
1683
|
+
}
|
|
1684
|
+
}, Qo = {
|
|
1685
|
+
submit: (e) => !0,
|
|
1686
|
+
error: (e) => !0,
|
|
1687
|
+
reset: () => !0
|
|
1688
|
+
};
|
|
1689
|
+
function Jo(e) {
|
|
1690
|
+
const t = S(), n = g(() => ze().size || "default"), o = g(() => e.model ?? {}), l = g(() => Te(
|
|
1691
|
+
{
|
|
1692
|
+
position: "none",
|
|
1693
|
+
fixed: {
|
|
1694
|
+
justify: "between"
|
|
1695
|
+
}
|
|
1696
|
+
},
|
|
1697
|
+
e.wrapper
|
|
1698
|
+
));
|
|
1699
|
+
return {
|
|
1700
|
+
size: n,
|
|
1701
|
+
wrapper: l,
|
|
1702
|
+
form: t,
|
|
1703
|
+
model: o
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
function en(e, t, n) {
|
|
1707
|
+
const o = S(!1);
|
|
1708
|
+
return {
|
|
1709
|
+
onSubmit: async () => {
|
|
1710
|
+
const r = await n.value?.validate().catch((i) => i);
|
|
1711
|
+
r === !0 ? (e.submit && (o.value = !0, await e.submit(e.model), o.value = !1), t("submit", e.model)) : t("error", r);
|
|
1712
|
+
},
|
|
1713
|
+
onReset: () => {
|
|
1714
|
+
n.value?.resetFields(), t("reset");
|
|
1715
|
+
},
|
|
1716
|
+
loading: o
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
function tn() {
|
|
1720
|
+
const e = rt({}), t = (r) => {
|
|
1721
|
+
const i = r.prop || r.$.uid.toString();
|
|
1722
|
+
e[i] = r;
|
|
1723
|
+
}, n = (r) => {
|
|
1724
|
+
const i = r.prop || r.$.uid.toString();
|
|
1725
|
+
delete e[i];
|
|
1726
|
+
}, o = (r) => e[r].$.exposed;
|
|
1727
|
+
return {
|
|
1728
|
+
fields: e,
|
|
1729
|
+
addField: t,
|
|
1730
|
+
removeField: n,
|
|
1731
|
+
focus: (r) => {
|
|
1732
|
+
o(r)?.focus();
|
|
1733
|
+
},
|
|
1734
|
+
blur: (r) => {
|
|
1735
|
+
o(r)?.blur();
|
|
1736
|
+
},
|
|
1737
|
+
getField: o
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
function on(e, t) {
|
|
1741
|
+
const n = (o) => (o = o.replace(/[^\\x00-\\xff]/gi, "**"), o.length);
|
|
1742
|
+
return g(() => {
|
|
1743
|
+
let o = e.labelWidth;
|
|
1744
|
+
if (o)
|
|
1745
|
+
return o;
|
|
1746
|
+
const l = Object.values(t);
|
|
1747
|
+
return l.sort((r, i) => (i.label || "").length - (r.label || "").length), `${n(l[0]?.label || "") * 14}px`;
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
const nn = { class: "x-form__extra" }, ln = { class: "x-form__actions" }, sn = /* @__PURE__ */ x({
|
|
1751
|
+
name: "XForm",
|
|
1752
|
+
inheritAttrs: !1,
|
|
1753
|
+
__name: "Form",
|
|
1754
|
+
props: qo,
|
|
1755
|
+
emits: Qo,
|
|
1756
|
+
setup(e, { expose: t, emit: n }) {
|
|
1757
|
+
const o = e, { size: l, wrapper: a, form: r, model: i } = Jo(o), { onSubmit: m, onReset: u, loading: f } = en(o, n, r), { fields: c, addField: d, removeField: b, focus: k, blur: h, getField: z } = tn(), F = on(o, c);
|
|
1758
|
+
return t({
|
|
1759
|
+
form: r,
|
|
1760
|
+
reset: u,
|
|
1761
|
+
submit: m,
|
|
1762
|
+
fields: c,
|
|
1763
|
+
addField: d,
|
|
1764
|
+
removeField: b,
|
|
1765
|
+
focus: k,
|
|
1766
|
+
blur: h,
|
|
1767
|
+
getField: z
|
|
1768
|
+
}), ne(Ue, I()?.proxy), (B, ie) => (p(), y(s(Le), _({ class: "x-form" }, s(a)), K({
|
|
1769
|
+
default: v(() => [
|
|
1770
|
+
E(s(Ct), _({
|
|
1771
|
+
ref_key: "form",
|
|
1772
|
+
ref: r,
|
|
1773
|
+
model: o.model,
|
|
1774
|
+
"label-width": s(F)
|
|
1775
|
+
}, B.$attrs), {
|
|
1776
|
+
default: v(() => [
|
|
1777
|
+
C(B.$slots, "default", {}, () => [
|
|
1778
|
+
(p(!0), P(R, null, U(o.fields, (W) => (p(), y(s(He), _({
|
|
1779
|
+
width: o.fieldWidth
|
|
1780
|
+
}, W, {
|
|
1781
|
+
modelValue: s(i)[W.prop],
|
|
1782
|
+
"onUpdate:modelValue": (ee) => s(i)[W.prop] = ee
|
|
1783
|
+
}), null, 16, ["width", "modelValue", "onUpdate:modelValue"]))), 256))
|
|
1784
|
+
])
|
|
1785
|
+
]),
|
|
1786
|
+
_: 3
|
|
1787
|
+
}, 16, ["model", "label-width"])
|
|
1788
|
+
]),
|
|
1789
|
+
_: 2
|
|
1790
|
+
}, [
|
|
1791
|
+
o.fixed ? {
|
|
1792
|
+
name: "fixed",
|
|
1793
|
+
fn: v(() => [
|
|
1794
|
+
V("div", nn, [
|
|
1795
|
+
C(B.$slots, "extra")
|
|
1796
|
+
]),
|
|
1797
|
+
V("div", ln, [
|
|
1798
|
+
C(B.$slots, "action"),
|
|
1799
|
+
o.resetText ? (p(), y(s(L), {
|
|
1800
|
+
key: 0,
|
|
1801
|
+
type: "default",
|
|
1802
|
+
icon: s(Pe),
|
|
1803
|
+
size: s(l),
|
|
1804
|
+
onClick: s(u)
|
|
1805
|
+
}, {
|
|
1806
|
+
default: v(() => [
|
|
1807
|
+
T(X(o.resetText), 1)
|
|
1808
|
+
]),
|
|
1809
|
+
_: 1
|
|
1810
|
+
}, 8, ["icon", "size", "onClick"])) : w("", !0),
|
|
1811
|
+
o.submitText ? (p(), y(s(L), {
|
|
1812
|
+
key: 1,
|
|
1813
|
+
type: "primary",
|
|
1814
|
+
icon: s(Ie),
|
|
1815
|
+
size: s(l),
|
|
1816
|
+
loading: o.submiting || s(f),
|
|
1817
|
+
onClick: s(m)
|
|
1818
|
+
}, {
|
|
1819
|
+
default: v(() => [
|
|
1820
|
+
T(X(o.submitText), 1)
|
|
1821
|
+
]),
|
|
1822
|
+
_: 1
|
|
1823
|
+
}, 8, ["icon", "size", "loading", "onClick"])) : w("", !0)
|
|
1824
|
+
])
|
|
1825
|
+
]),
|
|
1826
|
+
key: "0"
|
|
1827
|
+
} : void 0
|
|
1828
|
+
]), 1040));
|
|
1829
|
+
}
|
|
1830
|
+
}), rn = $(sn), an = {
|
|
1831
|
+
// prop: {
|
|
1832
|
+
// type: String as PropType<string>,
|
|
1833
|
+
// default: 'default'
|
|
1834
|
+
// }
|
|
1835
|
+
}, cn = {
|
|
1836
|
+
// eventName: (param: any) => true
|
|
1837
|
+
}, un = { class: "x-cron" }, dn = /* @__PURE__ */ x({
|
|
1838
|
+
name: "XCron",
|
|
1839
|
+
__name: "Cron",
|
|
1840
|
+
props: an,
|
|
1841
|
+
emits: cn,
|
|
1842
|
+
setup(e, { expose: t, emit: n }) {
|
|
1843
|
+
return t({}), (o, l) => (p(), P("div", un, "Cron"));
|
|
1844
|
+
}
|
|
1845
|
+
}), fn = $(dn), ke = Symbol("INSTALLED_KEY"), Se = "is-dragging", $e = "is-resizing", mn = (e = []) => ({
|
|
1846
|
+
install: (n, o) => {
|
|
1847
|
+
n[ke] || (n[ke] = !0, e.forEach((l) => n.use(l)), o && Ve(o, n));
|
|
1848
|
+
}
|
|
1849
|
+
}), pn = [
|
|
1850
|
+
Dt,
|
|
1851
|
+
Xt,
|
|
1852
|
+
j,
|
|
1853
|
+
Mt,
|
|
1854
|
+
N,
|
|
1855
|
+
A,
|
|
1856
|
+
Ne,
|
|
1857
|
+
go,
|
|
1858
|
+
Fe,
|
|
1859
|
+
Me,
|
|
1860
|
+
Le,
|
|
1861
|
+
Mo,
|
|
1862
|
+
He,
|
|
1863
|
+
rn,
|
|
1864
|
+
Xe,
|
|
1865
|
+
fn
|
|
1866
|
+
], Z = S({});
|
|
1867
|
+
function gn(e, t) {
|
|
1868
|
+
const n = I() ? Oe(oe, Z) : Z;
|
|
1869
|
+
return g(() => e ? n.value[e] ?? t : n);
|
|
1870
|
+
}
|
|
1871
|
+
function bn(e) {
|
|
1872
|
+
Z.value = Te(s(Z), s(e));
|
|
1873
|
+
}
|
|
1874
|
+
function yn(e, t) {
|
|
1875
|
+
return (...n) => {
|
|
1876
|
+
const l = gn(e, t).value;
|
|
1877
|
+
return typeof l == "function" ? l.apply(l, n) : l;
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
function J(e) {
|
|
1881
|
+
return g(() => e ? typeof e == "string" || e.setup || e.render || G(e) ? {
|
|
1882
|
+
icon: e
|
|
1883
|
+
} : e : null);
|
|
1884
|
+
}
|
|
1885
|
+
function vn(e) {
|
|
1886
|
+
const t = J(e);
|
|
1887
|
+
return t.value ? x({ render: () => M(N, t.value) }) : null;
|
|
1888
|
+
}
|
|
1889
|
+
function hn(e, t = {}) {
|
|
1890
|
+
const n = t.edge || 40, o = g(() => t.selector ? typeof t.selector == "string" ? s(e)?.querySelector(t.selector) : s(e) : null), l = g(() => s(t.wrapper)), { x: a, y: r, isDragging: i } = St(e, {
|
|
1891
|
+
preventDefault: !1,
|
|
1892
|
+
stopPropagation: !1,
|
|
1893
|
+
handle: t.selector ? o : null,
|
|
1894
|
+
...Y(t, ["handle", "edge"])
|
|
1895
|
+
}), m = (u, f, c, d, b, k) => {
|
|
1896
|
+
const h = [-c.value + n, d.value - n];
|
|
1897
|
+
f.value = Math.min(Math.max(f.value, k.value), b.value - n), u.value < h[0] && (u.value = h[0]), u.value > h[1] && (u.value = h[1]);
|
|
1898
|
+
};
|
|
1899
|
+
if (t.wrapper) {
|
|
1900
|
+
const { width: u, height: f, top: c } = re(l), { width: d } = De(e);
|
|
1901
|
+
O([a, r], () => {
|
|
1902
|
+
m(a, r, d, u, f, c);
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
return O(i, (u) => {
|
|
1906
|
+
u ? document.body.classList.add(Se) : document.body.classList.remove(Se);
|
|
1907
|
+
}), {
|
|
1908
|
+
x: a,
|
|
1909
|
+
y: r,
|
|
1910
|
+
isDragging: i
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
function _n(e, t, n) {
|
|
1914
|
+
const { dirs: o = ["n", "s", "w", "e"], edge: l = 5 } = e;
|
|
1915
|
+
let a = "";
|
|
1916
|
+
const { left: r, top: i, width: m, height: u } = n, { clientX: f, clientY: c } = t;
|
|
1917
|
+
return o.includes("n") && c > i.value - l && c < i.value + l ? a += "n" : o.includes("s") && c < i.value + u.value + l && c > i.value + u.value - l && (a += "s"), o.includes("w") && f > r.value - l && f < r.value + l ? a += "w" : o.includes("e") && f < r.value + m.value + l && f > r.value + m.value - l && (a += "e"), a;
|
|
1918
|
+
}
|
|
1919
|
+
function Cn(e, t, n, o) {
|
|
1920
|
+
if (!n)
|
|
1921
|
+
return;
|
|
1922
|
+
const { minWidth: l = 0, minHeight: a = 0, maxWidth: r, maxHeight: i } = e, { clientX: m, clientY: u } = t, { left: f, top: c, width: d, height: b } = o;
|
|
1923
|
+
n.includes("e") && (d.value = Math.max(m - f.value, l)), n.includes("w") && (d.value = Math.max(d.value + f.value - m, l), f.value = m), n.includes("s") && (b.value = Math.max(u - c.value, a)), n.includes("n") && (b.value = Math.max(b.value + c.value - u, a), c.value = u), r && (d.value = Math.min(d.value, r)), i && (b.value = Math.min(b.value, i)), e.onResizing && e.onResizing(o);
|
|
1924
|
+
}
|
|
1925
|
+
function wn(e, t = {}) {
|
|
1926
|
+
const n = {
|
|
1927
|
+
edge: 5,
|
|
1928
|
+
minWidth: 50,
|
|
1929
|
+
minHeight: 50,
|
|
1930
|
+
dirs: ["n", "s", "w", "e"],
|
|
1931
|
+
...t
|
|
1932
|
+
}, o = at(), l = S(""), a = S(!1), { onStart: r, onEnd: i, boundingOptions: m } = n, u = re(e, m), { left: f, top: c, width: d, height: b, update: k } = u;
|
|
1933
|
+
return o.run(() => {
|
|
1934
|
+
te(document, "mousemove", (h) => {
|
|
1935
|
+
a.value ? Cn(n, h, l.value, u) : l.value = _n(n, h, u);
|
|
1936
|
+
}), te(document, "mousedown", () => {
|
|
1937
|
+
k(), l.value && (a.value = !0, r && r(u));
|
|
1938
|
+
}), te(document, "mouseup", () => {
|
|
1939
|
+
a.value = !1, l.value = "", i && i(u), k();
|
|
1940
|
+
}), O(l, (h) => {
|
|
1941
|
+
const z = document.body;
|
|
1942
|
+
z.style.cursor = h ? `${h}-resize` : "", h ? z.classList.add($e) : z.classList.remove($e);
|
|
1943
|
+
});
|
|
1944
|
+
}), je(() => {
|
|
1945
|
+
o.stop();
|
|
1946
|
+
}), {
|
|
1947
|
+
left: f,
|
|
1948
|
+
top: c,
|
|
1949
|
+
width: d,
|
|
1950
|
+
height: b,
|
|
1951
|
+
direction: l,
|
|
1952
|
+
resizing: a,
|
|
1953
|
+
update: k
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
const xn = mn(pn), In = xn.install;
|
|
1957
|
+
export {
|
|
1958
|
+
Ft as Block,
|
|
1959
|
+
he as DIALOG_CLOSE_VALUE,
|
|
1960
|
+
_e as DIALOG_MAXIMIZABLE_VALUE,
|
|
1961
|
+
Ce as DIALOG_MINIMIZABLE_VALUE,
|
|
1962
|
+
we as DIALOG_POPUP_VALUE,
|
|
1963
|
+
At as Element,
|
|
1964
|
+
ke as INSTALLED_KEY,
|
|
1965
|
+
Se as IS_DRAGGING_CLASS_NAME,
|
|
1966
|
+
$e as IS_RESIZING_CLASS_NAME,
|
|
1967
|
+
Ot as NOOP,
|
|
1968
|
+
Vt as Page,
|
|
1969
|
+
j as XBlock,
|
|
1970
|
+
Dt as XConfig,
|
|
1971
|
+
Mo as XContainer,
|
|
1972
|
+
fn as XCron,
|
|
1973
|
+
Me as XDialog,
|
|
1974
|
+
Mt as XElement,
|
|
1975
|
+
He as XField,
|
|
1976
|
+
rn as XForm,
|
|
1977
|
+
Xe as XHelp,
|
|
1978
|
+
N as XIcon,
|
|
1979
|
+
Xt as XPage,
|
|
1980
|
+
Ne as XPanel,
|
|
1981
|
+
go as XText,
|
|
1982
|
+
A as XTool,
|
|
1983
|
+
Fe as XToolbar,
|
|
1984
|
+
Le as XWrapper,
|
|
1985
|
+
Nt as blockProps,
|
|
1986
|
+
pn as components,
|
|
1987
|
+
oe as configContextKey,
|
|
1988
|
+
Pt as configProps,
|
|
1989
|
+
Ro as containerEmits,
|
|
1990
|
+
Fo as containerProps,
|
|
1991
|
+
cn as cronEmits,
|
|
1992
|
+
an as cronProps,
|
|
1993
|
+
xn as default,
|
|
1994
|
+
We as defineSetter,
|
|
1995
|
+
Co as dialogContextKey,
|
|
1996
|
+
xo as dialogEmits,
|
|
1997
|
+
wo as dialogProps,
|
|
1998
|
+
ae as dialogZIndex,
|
|
1999
|
+
Rt as elementProps,
|
|
2000
|
+
Wo as fieldEmits,
|
|
2001
|
+
Lo as fieldProps,
|
|
2002
|
+
Ue as formContextKey,
|
|
2003
|
+
Qo as formEmits,
|
|
2004
|
+
qo as formProps,
|
|
2005
|
+
yn as getConfigValue,
|
|
2006
|
+
ge as getSizeValue,
|
|
2007
|
+
to as helpEmits,
|
|
2008
|
+
eo as helpProps,
|
|
2009
|
+
Wt as iconProps,
|
|
2010
|
+
Lt as iconSizeMap,
|
|
2011
|
+
In as install,
|
|
2012
|
+
mn as makeInstaller,
|
|
2013
|
+
Y as omit,
|
|
2014
|
+
Tt as pageProps,
|
|
2015
|
+
ao as panelEmits,
|
|
2016
|
+
ro as panelProps,
|
|
2017
|
+
be as parseSize,
|
|
2018
|
+
On as pick,
|
|
2019
|
+
Ve as provideConfig,
|
|
2020
|
+
bn as setConfig,
|
|
2021
|
+
xe as setters,
|
|
2022
|
+
mo as textEmits,
|
|
2023
|
+
fo as textProps,
|
|
2024
|
+
Kt as toolEmits,
|
|
2025
|
+
Gt as toolProps,
|
|
2026
|
+
yo as toolbarEmits,
|
|
2027
|
+
bo as toolbarProps,
|
|
2028
|
+
gn as useConfig,
|
|
2029
|
+
hn as useDraggable,
|
|
2030
|
+
vn as useIcon,
|
|
2031
|
+
J as useIconProps,
|
|
2032
|
+
wn as useResizable,
|
|
2033
|
+
$ as withInstall,
|
|
2034
|
+
jn as withInstallDirective,
|
|
2035
|
+
jt as withInstallFunction,
|
|
2036
|
+
Pn as withNoopInstall,
|
|
2037
|
+
Xo as wrapperEmits,
|
|
2038
|
+
Vo as wrapperProps
|
|
2039
|
+
};
|