x-essential-lib 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +5 -0
- package/.eslintignore +1 -0
- package/.eslintrc.cjs +18 -0
- package/.husky/pre-commit +1 -0
- package/.prettierignore +7 -0
- package/.prettierrc +16 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +513 -0
- package/index.html +12 -0
- package/package.json +11 -10
- package/public/index.d.ts +89 -0
- package/src/App.vue +9 -0
- package/src/components/confirmDlg/index.vue +98 -0
- package/src/components/loading/index.vue +131 -0
- package/src/components/message/index.vue +70 -0
- package/src/components/message/item.vue +75 -0
- package/src/components/promptDlg/index.vue +119 -0
- package/src/components/waitDlg/index.vue +41 -0
- package/src/index.ts +38 -0
- package/src/main.ts +5 -0
- package/src/plugins/vuetify.ts +4 -0
- package/src/utils/core.ts +31 -0
- package/src/utils/dialog.ts +87 -0
- package/src/utils/message.ts +17 -0
- package/src/utils/misc.ts +23 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +9 -0
- package/vite.config.ts +37 -0
- package/dist/index.es.js +0 -36
- package/types/index.d.ts +0 -2
- package/types/utils/core.d.ts +0 -3
package/.editorconfig
ADDED
package/.eslintignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dist/
|
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-env node */
|
|
2
|
+
require('@rushstack/eslint-patch/modern-module-resolution')
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
root: true,
|
|
6
|
+
extends: [
|
|
7
|
+
'plugin:vue/vue3-essential',
|
|
8
|
+
'eslint:recommended',
|
|
9
|
+
'@vue/eslint-config-typescript',
|
|
10
|
+
'@vue/eslint-config-prettier/skip-formatting'
|
|
11
|
+
],
|
|
12
|
+
parserOptions: {
|
|
13
|
+
ecmaVersion: 'latest'
|
|
14
|
+
},
|
|
15
|
+
rules: {
|
|
16
|
+
'vue/multi-word-component-names': 'off'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm run lint-staged
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# global
|
|
2
|
+
printWidth: 80
|
|
3
|
+
tabWidth: 2
|
|
4
|
+
useTabs: false
|
|
5
|
+
# common
|
|
6
|
+
singleQuote: true
|
|
7
|
+
bracketSpacing: true
|
|
8
|
+
bracketSameLine: false
|
|
9
|
+
singleAttributePerLine: false
|
|
10
|
+
# javascript
|
|
11
|
+
semi: false
|
|
12
|
+
quoteProps: consistent
|
|
13
|
+
arrowParens: avoid
|
|
14
|
+
trailingComma: none
|
|
15
|
+
# html
|
|
16
|
+
htmlWhitespaceSensitivity: ignore
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { DefineComponent } from 'vue'
|
|
2
|
+
|
|
3
|
+
export declare const XConfirmDlg: DefineComponent<
|
|
4
|
+
{
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: Boolean
|
|
7
|
+
required: true
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
'update:modelValue'(value: boolean): void
|
|
12
|
+
},
|
|
13
|
+
unknown
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
export declare const XLoading: DefineComponent<
|
|
17
|
+
{
|
|
18
|
+
zIndex: {
|
|
19
|
+
type: Number
|
|
20
|
+
default: 1
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{},
|
|
24
|
+
unknown
|
|
25
|
+
>
|
|
26
|
+
|
|
27
|
+
export declare const XMessage: DefineComponent<{}, {}, unknown>
|
|
28
|
+
|
|
29
|
+
export declare const XPromptDlg: DefineComponent<
|
|
30
|
+
{
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: Boolean
|
|
33
|
+
required: true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
'update:modelValue'(value: boolean): void
|
|
38
|
+
},
|
|
39
|
+
unknown
|
|
40
|
+
>
|
|
41
|
+
|
|
42
|
+
export declare const XMessage: DefineComponent<{}, {}, unknown>
|
|
43
|
+
|
|
44
|
+
export declare function waitMs(ms: number): Promise<void>
|
|
45
|
+
|
|
46
|
+
export declare function waitUtil(
|
|
47
|
+
conditionFunc: () => boolean,
|
|
48
|
+
timeout?: number,
|
|
49
|
+
interval?: number
|
|
50
|
+
): Promise<boolean>
|
|
51
|
+
|
|
52
|
+
interface ButtonOptions {
|
|
53
|
+
color?: string
|
|
54
|
+
text?: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ConfirmParams {
|
|
58
|
+
title: string
|
|
59
|
+
text: string
|
|
60
|
+
cancel?: ButtonOptions
|
|
61
|
+
confirm?: ButtonOptions
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare function openConfirmDlg(
|
|
65
|
+
params: ConfirmParams
|
|
66
|
+
): Promise<boolean | undefined>
|
|
67
|
+
|
|
68
|
+
interface PromptParams {
|
|
69
|
+
title: string
|
|
70
|
+
text?: string
|
|
71
|
+
label?: string
|
|
72
|
+
placeholder?: string
|
|
73
|
+
rules?: ((val: string) => string | boolean)[]
|
|
74
|
+
value?: string
|
|
75
|
+
cancel?: ButtonOptions
|
|
76
|
+
confirm?: ButtonOptions
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export declare function openPromptDlg(params: PromptParams): Promise<any>
|
|
80
|
+
|
|
81
|
+
export declare function openWaitDlg()
|
|
82
|
+
export declare function closeWaitDlg()
|
|
83
|
+
|
|
84
|
+
export declare function messageError(text: string, timeout?: number)
|
|
85
|
+
export declare function messageInfo(text: string, timeout?: number)
|
|
86
|
+
export declare function messageSuccess(text: string, timeout?: number)
|
|
87
|
+
export declare function messageWarning(text: string, timeout?: number)
|
|
88
|
+
|
|
89
|
+
export declare function appAppear(name: string)
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode('.x-cont[data-v-a8f3d91f]{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;align-items:center;justify-content:center}.lds-spinner[data-v-a8f3d91f]{color:official;display:inline-block;position:relative;width:40px;height:40px}.lds-spinner div[data-v-a8f3d91f]{transform-origin:20px 20px;animation:lds-spinner-a8f3d91f 1.2s linear infinite}.lds-spinner div[data-v-a8f3d91f]:after{content:" ";display:block;position:absolute;top:3px;left:18px;width:2px;height:6px;border-radius:5%;background:#9e9e9e}.lds-spinner div[data-v-a8f3d91f]:nth-child(1){transform:rotate(0);animation-delay:-1.1s}.lds-spinner div[data-v-a8f3d91f]:nth-child(2){transform:rotate(30deg);animation-delay:-1s}.lds-spinner div[data-v-a8f3d91f]:nth-child(3){transform:rotate(60deg);animation-delay:-.9s}.lds-spinner div[data-v-a8f3d91f]:nth-child(4){transform:rotate(90deg);animation-delay:-.8s}.lds-spinner div[data-v-a8f3d91f]:nth-child(5){transform:rotate(120deg);animation-delay:-.7s}.lds-spinner div[data-v-a8f3d91f]:nth-child(6){transform:rotate(150deg);animation-delay:-.6s}.lds-spinner div[data-v-a8f3d91f]:nth-child(7){transform:rotate(180deg);animation-delay:-.5s}.lds-spinner div[data-v-a8f3d91f]:nth-child(8){transform:rotate(210deg);animation-delay:-.4s}.lds-spinner div[data-v-a8f3d91f]:nth-child(9){transform:rotate(240deg);animation-delay:-.3s}.lds-spinner div[data-v-a8f3d91f]:nth-child(10){transform:rotate(270deg);animation-delay:-.2s}.lds-spinner div[data-v-a8f3d91f]:nth-child(11){transform:rotate(300deg);animation-delay:-.1s}.lds-spinner div[data-v-a8f3d91f]:nth-child(12){transform:rotate(330deg);animation-delay:0s}@keyframes lds-spinner-a8f3d91f{0%{opacity:1}to{opacity:0}}.x-cont[data-v-70ed4b89]{position:absolute;left:50%;bottom:20px;transform:translate(-50%);z-index:9999}')),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
import { getCurrentInstance as oe, inject as F, defineComponent as I, useModel as G, ref as _, computed as w, onMounted as W, onBeforeUnmount as L, watch as O, resolveComponent as m, openBlock as V, createBlock as M, withKeys as j, withModifiers as R, withCtx as p, createVNode as g, createTextVNode as h, toDisplayString as D, createElementBlock as K, normalizeStyle as le, pushScopeId as ae, popScopeId as se, createElementVNode as v, reactive as re, Fragment as ce, renderList as ie, unref as ue } from "vue";
|
|
3
|
+
function de(t) {
|
|
4
|
+
return { all: t = t || /* @__PURE__ */ new Map(), on: function(n, e) {
|
|
5
|
+
var o = t.get(n);
|
|
6
|
+
o ? o.push(e) : t.set(n, [e]);
|
|
7
|
+
}, off: function(n, e) {
|
|
8
|
+
var o = t.get(n);
|
|
9
|
+
o && (e ? o.splice(o.indexOf(e) >>> 0, 1) : t.set(n, []));
|
|
10
|
+
}, emit: function(n, e) {
|
|
11
|
+
var o = t.get(n);
|
|
12
|
+
o && o.slice().map(function(l) {
|
|
13
|
+
l(e);
|
|
14
|
+
}), (o = t.get("*")) && o.slice().map(function(l) {
|
|
15
|
+
l(n, e);
|
|
16
|
+
});
|
|
17
|
+
} };
|
|
18
|
+
}
|
|
19
|
+
const s = de();
|
|
20
|
+
async function ke(t) {
|
|
21
|
+
return new Promise((n) => {
|
|
22
|
+
setTimeout(n, t);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function X(t, n, e) {
|
|
26
|
+
const o = Date.now();
|
|
27
|
+
return new Promise((l) => {
|
|
28
|
+
const u = async () => {
|
|
29
|
+
t() ? l(!0) : n && Date.now() - o > n ? l(!1) : setTimeout(u, e ?? 30);
|
|
30
|
+
};
|
|
31
|
+
u();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function fe(t, n) {
|
|
35
|
+
const e = oe();
|
|
36
|
+
if (!e)
|
|
37
|
+
throw new Error(`[Vuetify] ${t} must be called from inside a setup function`);
|
|
38
|
+
return e;
|
|
39
|
+
}
|
|
40
|
+
const me = Symbol.for("vuetify:locale");
|
|
41
|
+
function z() {
|
|
42
|
+
const t = F(me);
|
|
43
|
+
if (!t)
|
|
44
|
+
throw new Error("[Vuetify] Could not find injected locale instance");
|
|
45
|
+
return t;
|
|
46
|
+
}
|
|
47
|
+
const pe = Symbol.for("vuetify:theme");
|
|
48
|
+
function ve() {
|
|
49
|
+
fe("useTheme");
|
|
50
|
+
const t = F(pe, null);
|
|
51
|
+
if (!t)
|
|
52
|
+
throw new Error("Could not find Vuetify theme injection");
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
const Ie = /* @__PURE__ */ I({
|
|
56
|
+
__name: "index",
|
|
57
|
+
props: {
|
|
58
|
+
modelValue: { type: Boolean, required: !0 },
|
|
59
|
+
modelModifiers: {}
|
|
60
|
+
},
|
|
61
|
+
emits: ["update:modelValue"],
|
|
62
|
+
setup(t) {
|
|
63
|
+
const n = z(), e = G(t, "modelValue"), o = _(""), l = _(""), u = _(), c = _(), i = w(() => {
|
|
64
|
+
var r;
|
|
65
|
+
return ((r = u.value) == null ? void 0 : r.color) ?? "primary";
|
|
66
|
+
}), f = w(() => {
|
|
67
|
+
var r;
|
|
68
|
+
return ((r = u.value) == null ? void 0 : r.text) ?? n.t("cancel");
|
|
69
|
+
}), d = w(() => {
|
|
70
|
+
var r;
|
|
71
|
+
return ((r = c.value) == null ? void 0 : r.color) ?? "primary";
|
|
72
|
+
}), b = w(() => {
|
|
73
|
+
var r;
|
|
74
|
+
return ((r = c.value) == null ? void 0 : r.text) ?? n.t("confirm");
|
|
75
|
+
});
|
|
76
|
+
let T = 0, C = !1;
|
|
77
|
+
const B = (r) => {
|
|
78
|
+
o.value = r.title, l.value = r.text, u.value = r.cancel, c.value = r.confirm, T = r.seq, C = !1, e.value = !0;
|
|
79
|
+
};
|
|
80
|
+
W(() => {
|
|
81
|
+
s.on("confirmDlg", B);
|
|
82
|
+
}), L(() => {
|
|
83
|
+
s.off("confirmDlg", B);
|
|
84
|
+
});
|
|
85
|
+
const E = () => {
|
|
86
|
+
e.value = !1, C || (s.emit("confirmDlgResult" + T, !0), C = !0);
|
|
87
|
+
};
|
|
88
|
+
return O(e, (r) => {
|
|
89
|
+
!r && !C && (s.emit("confirmDlgResult" + T, !1), C = !0);
|
|
90
|
+
}), (r, y) => {
|
|
91
|
+
const k = m("v-card-title"), U = m("v-card-text"), $ = m("v-btn"), a = m("v-card-actions"), x = m("v-card"), N = m("v-dialog");
|
|
92
|
+
return V(), M(N, {
|
|
93
|
+
modelValue: e.value,
|
|
94
|
+
"onUpdate:modelValue": y[1] || (y[1] = (q) => e.value = q),
|
|
95
|
+
onKeydown: [
|
|
96
|
+
y[2] || (y[2] = j(R((q) => e.value = !1, ["stop", "prevent"]), ["esc"])),
|
|
97
|
+
j(R(E, ["stop", "prevent"]), ["enter"])
|
|
98
|
+
],
|
|
99
|
+
transition: "dialog-top-transition",
|
|
100
|
+
"max-width": "600px"
|
|
101
|
+
}, {
|
|
102
|
+
default: p(() => [
|
|
103
|
+
g(x, null, {
|
|
104
|
+
default: p(() => [
|
|
105
|
+
g(k, null, {
|
|
106
|
+
default: p(() => [
|
|
107
|
+
h(D(o.value), 1)
|
|
108
|
+
]),
|
|
109
|
+
_: 1
|
|
110
|
+
}),
|
|
111
|
+
g(U, null, {
|
|
112
|
+
default: p(() => [
|
|
113
|
+
h(D(l.value), 1)
|
|
114
|
+
]),
|
|
115
|
+
_: 1
|
|
116
|
+
}),
|
|
117
|
+
g(a, { class: "d-flex justify-end" }, {
|
|
118
|
+
default: p(() => [
|
|
119
|
+
g($, {
|
|
120
|
+
onClick: y[0] || (y[0] = (q) => e.value = !1),
|
|
121
|
+
color: i.value,
|
|
122
|
+
variant: "text"
|
|
123
|
+
}, {
|
|
124
|
+
default: p(() => [
|
|
125
|
+
h(D(f.value), 1)
|
|
126
|
+
]),
|
|
127
|
+
_: 1
|
|
128
|
+
}, 8, ["color"]),
|
|
129
|
+
g($, {
|
|
130
|
+
onClick: E,
|
|
131
|
+
color: d.value,
|
|
132
|
+
variant: "text"
|
|
133
|
+
}, {
|
|
134
|
+
default: p(() => [
|
|
135
|
+
h(D(b.value), 1)
|
|
136
|
+
]),
|
|
137
|
+
_: 1
|
|
138
|
+
}, 8, ["color"])
|
|
139
|
+
]),
|
|
140
|
+
_: 1
|
|
141
|
+
})
|
|
142
|
+
]),
|
|
143
|
+
_: 1
|
|
144
|
+
})
|
|
145
|
+
]),
|
|
146
|
+
_: 1
|
|
147
|
+
}, 8, ["modelValue", "onKeydown"]);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}), _e = (t) => (ae("data-v-a8f3d91f"), t = t(), se(), t), ge = /* @__PURE__ */ _e(() => /* @__PURE__ */ v("div", { class: "lds-spinner" }, [
|
|
151
|
+
/* @__PURE__ */ v("div"),
|
|
152
|
+
/* @__PURE__ */ v("div"),
|
|
153
|
+
/* @__PURE__ */ v("div"),
|
|
154
|
+
/* @__PURE__ */ v("div"),
|
|
155
|
+
/* @__PURE__ */ v("div"),
|
|
156
|
+
/* @__PURE__ */ v("div"),
|
|
157
|
+
/* @__PURE__ */ v("div"),
|
|
158
|
+
/* @__PURE__ */ v("div"),
|
|
159
|
+
/* @__PURE__ */ v("div"),
|
|
160
|
+
/* @__PURE__ */ v("div"),
|
|
161
|
+
/* @__PURE__ */ v("div"),
|
|
162
|
+
/* @__PURE__ */ v("div")
|
|
163
|
+
], -1)), xe = [
|
|
164
|
+
ge
|
|
165
|
+
], ye = /* @__PURE__ */ I({
|
|
166
|
+
__name: "index",
|
|
167
|
+
props: {
|
|
168
|
+
zIndex: {
|
|
169
|
+
type: Number,
|
|
170
|
+
default: 1
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
setup(t) {
|
|
174
|
+
const n = ve(), e = t, o = w(() => ({
|
|
175
|
+
background: n.current.value.dark ? "#1e1e1e" : "#ffffff",
|
|
176
|
+
zIndex: e.zIndex
|
|
177
|
+
}));
|
|
178
|
+
return (l, u) => (V(), K("div", {
|
|
179
|
+
class: "x-cont",
|
|
180
|
+
style: le(o.value)
|
|
181
|
+
}, xe, 4));
|
|
182
|
+
}
|
|
183
|
+
}), H = (t, n) => {
|
|
184
|
+
const e = t.__vccOpts || t;
|
|
185
|
+
for (const [o, l] of n)
|
|
186
|
+
e[o] = l;
|
|
187
|
+
return e;
|
|
188
|
+
}, Te = /* @__PURE__ */ H(ye, [["__scopeId", "data-v-a8f3d91f"]]), we = /* @__PURE__ */ I({
|
|
189
|
+
__name: "item",
|
|
190
|
+
props: {
|
|
191
|
+
id: {
|
|
192
|
+
type: Number,
|
|
193
|
+
required: !0
|
|
194
|
+
},
|
|
195
|
+
type: {
|
|
196
|
+
type: String,
|
|
197
|
+
required: !0
|
|
198
|
+
},
|
|
199
|
+
text: {
|
|
200
|
+
type: String,
|
|
201
|
+
required: !0
|
|
202
|
+
},
|
|
203
|
+
timeout: {
|
|
204
|
+
type: Number,
|
|
205
|
+
default: 5e3
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
emits: ["timeout"],
|
|
209
|
+
setup(t, { emit: n }) {
|
|
210
|
+
const e = t, o = _(!0), l = n, u = w(() => {
|
|
211
|
+
let c = "";
|
|
212
|
+
switch (e.type) {
|
|
213
|
+
case "error":
|
|
214
|
+
c = "cancel";
|
|
215
|
+
break;
|
|
216
|
+
case "info":
|
|
217
|
+
c = "info";
|
|
218
|
+
break;
|
|
219
|
+
case "success":
|
|
220
|
+
c = "check-circle";
|
|
221
|
+
break;
|
|
222
|
+
case "warning":
|
|
223
|
+
c = "error";
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
return c;
|
|
227
|
+
});
|
|
228
|
+
return W(() => {
|
|
229
|
+
setTimeout(() => {
|
|
230
|
+
l("timeout", e.id);
|
|
231
|
+
}, e.timeout);
|
|
232
|
+
}), O(o, (c) => {
|
|
233
|
+
c || l("timeout", e.id);
|
|
234
|
+
}), (c, i) => {
|
|
235
|
+
const f = m("v-alert");
|
|
236
|
+
return V(), M(f, {
|
|
237
|
+
modelValue: o.value,
|
|
238
|
+
"onUpdate:modelValue": i[0] || (i[0] = (d) => o.value = d),
|
|
239
|
+
class: "mt-2",
|
|
240
|
+
type: t.type,
|
|
241
|
+
icon: u.value,
|
|
242
|
+
text: t.text,
|
|
243
|
+
"max-width": "90%",
|
|
244
|
+
width: "500px",
|
|
245
|
+
elevation: "1",
|
|
246
|
+
density: "compact",
|
|
247
|
+
closable: ""
|
|
248
|
+
}, null, 8, ["modelValue", "type", "icon", "text"]);
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}), De = /* @__PURE__ */ I({
|
|
252
|
+
__name: "index",
|
|
253
|
+
setup(t) {
|
|
254
|
+
const n = re({ items: [] });
|
|
255
|
+
W(() => {
|
|
256
|
+
s.on("message", e);
|
|
257
|
+
}), L(() => {
|
|
258
|
+
s.off("message", e);
|
|
259
|
+
});
|
|
260
|
+
const e = (i) => {
|
|
261
|
+
u(i.type, i.text, i.timeout);
|
|
262
|
+
}, o = (i) => {
|
|
263
|
+
c(i);
|
|
264
|
+
};
|
|
265
|
+
let l = 0;
|
|
266
|
+
const u = (i, f, d) => {
|
|
267
|
+
const b = l++;
|
|
268
|
+
n.items.push({ id: b, type: i, text: f, timeout: d });
|
|
269
|
+
}, c = (i) => {
|
|
270
|
+
const f = n.items.findIndex((d) => d.id === i);
|
|
271
|
+
f >= 0 && n.items.splice(f, 1);
|
|
272
|
+
};
|
|
273
|
+
return (i, f) => (V(), K("div", {
|
|
274
|
+
onClick: f[0] || (f[0] = R(() => {
|
|
275
|
+
}, ["stop"])),
|
|
276
|
+
class: "x-cont d-flex flex-column-reverse align-center"
|
|
277
|
+
}, [
|
|
278
|
+
(V(!0), K(ce, null, ie(n.items, (d) => (V(), M(we, {
|
|
279
|
+
onTimeout: o,
|
|
280
|
+
id: d.id,
|
|
281
|
+
type: d.type,
|
|
282
|
+
text: d.text,
|
|
283
|
+
timeout: d.timeout,
|
|
284
|
+
key: d.id
|
|
285
|
+
}, null, 8, ["id", "type", "text", "timeout"]))), 128))
|
|
286
|
+
]));
|
|
287
|
+
}
|
|
288
|
+
}), $e = /* @__PURE__ */ H(De, [["__scopeId", "data-v-70ed4b89"]]), qe = /* @__PURE__ */ I({
|
|
289
|
+
__name: "index",
|
|
290
|
+
props: {
|
|
291
|
+
modelValue: { type: Boolean, required: !0 },
|
|
292
|
+
modelModifiers: {}
|
|
293
|
+
},
|
|
294
|
+
emits: ["update:modelValue"],
|
|
295
|
+
setup(t) {
|
|
296
|
+
const n = z(), e = G(t, "modelValue"), o = _(""), l = _(""), u = _(), c = _(), i = _(), f = _(""), d = _(), b = _(), T = w(() => {
|
|
297
|
+
var a;
|
|
298
|
+
return ((a = d.value) == null ? void 0 : a.color) ?? "primary";
|
|
299
|
+
}), C = w(() => {
|
|
300
|
+
var a;
|
|
301
|
+
return ((a = d.value) == null ? void 0 : a.text) ?? n.t("cancel");
|
|
302
|
+
}), B = w(() => {
|
|
303
|
+
var a;
|
|
304
|
+
return ((a = b.value) == null ? void 0 : a.color) ?? "primary";
|
|
305
|
+
}), E = w(() => {
|
|
306
|
+
var a;
|
|
307
|
+
return ((a = b.value) == null ? void 0 : a.text) ?? n.t("confirm");
|
|
308
|
+
}), r = _();
|
|
309
|
+
let y = 0, k = !1;
|
|
310
|
+
const U = async (a) => {
|
|
311
|
+
var x;
|
|
312
|
+
o.value = a.title, l.value = a.text, u.value = a.label, c.value = a.placeholder, i.value = a.rules, f.value = a.value, d.value = a.cancel, b.value = a.confirm, y = a.seq, k = !1, e.value = !0, await X(() => r.value !== void 0, 1e3), (x = r.value) == null || x.focus();
|
|
313
|
+
};
|
|
314
|
+
W(() => {
|
|
315
|
+
s.on("promptDlg", U);
|
|
316
|
+
}), L(() => {
|
|
317
|
+
s.off("promptDlg", U);
|
|
318
|
+
});
|
|
319
|
+
const $ = () => {
|
|
320
|
+
e.value = !1, k || (s.emit("promptDlgResult" + y, f.value ?? ""), k = !0);
|
|
321
|
+
};
|
|
322
|
+
return O(e, (a) => {
|
|
323
|
+
!a && !k && (s.emit("promptDlgResult" + y, void 0), k = !0);
|
|
324
|
+
}), (a, x) => {
|
|
325
|
+
const N = m("v-card-title"), q = m("v-card-text"), Y = m("v-text-field"), Z = m("v-form"), P = m("v-btn"), ee = m("v-card-actions"), te = m("v-card"), ne = m("v-dialog");
|
|
326
|
+
return V(), M(ne, {
|
|
327
|
+
modelValue: e.value,
|
|
328
|
+
"onUpdate:modelValue": x[2] || (x[2] = (S) => e.value = S),
|
|
329
|
+
onKeydown: [
|
|
330
|
+
x[3] || (x[3] = j(R((S) => e.value = !1, ["stop", "prevent"]), ["esc"])),
|
|
331
|
+
j(R($, ["stop", "prevent"]), ["enter"])
|
|
332
|
+
],
|
|
333
|
+
transition: "dialog-top-transition",
|
|
334
|
+
"max-width": "600px"
|
|
335
|
+
}, {
|
|
336
|
+
default: p(() => [
|
|
337
|
+
g(te, null, {
|
|
338
|
+
default: p(() => [
|
|
339
|
+
g(N, null, {
|
|
340
|
+
default: p(() => [
|
|
341
|
+
h(D(o.value), 1)
|
|
342
|
+
]),
|
|
343
|
+
_: 1
|
|
344
|
+
}),
|
|
345
|
+
g(q, null, {
|
|
346
|
+
default: p(() => [
|
|
347
|
+
h(D(l.value), 1)
|
|
348
|
+
]),
|
|
349
|
+
_: 1
|
|
350
|
+
}),
|
|
351
|
+
g(Z, { class: "mx-3" }, {
|
|
352
|
+
default: p(() => [
|
|
353
|
+
g(Y, {
|
|
354
|
+
modelValue: f.value,
|
|
355
|
+
"onUpdate:modelValue": x[0] || (x[0] = (S) => f.value = S),
|
|
356
|
+
label: u.value,
|
|
357
|
+
placeholder: c.value,
|
|
358
|
+
rules: i.value,
|
|
359
|
+
ref_key: "target",
|
|
360
|
+
ref: r
|
|
361
|
+
}, null, 8, ["modelValue", "label", "placeholder", "rules"])
|
|
362
|
+
]),
|
|
363
|
+
_: 1
|
|
364
|
+
}),
|
|
365
|
+
g(ee, { class: "d-flex justify-end" }, {
|
|
366
|
+
default: p(() => [
|
|
367
|
+
g(P, {
|
|
368
|
+
onClick: x[1] || (x[1] = (S) => e.value = !1),
|
|
369
|
+
color: T.value,
|
|
370
|
+
variant: "text"
|
|
371
|
+
}, {
|
|
372
|
+
default: p(() => [
|
|
373
|
+
h(D(C.value), 1)
|
|
374
|
+
]),
|
|
375
|
+
_: 1
|
|
376
|
+
}, 8, ["color"]),
|
|
377
|
+
g(P, {
|
|
378
|
+
onClick: $,
|
|
379
|
+
color: B.value,
|
|
380
|
+
variant: "text"
|
|
381
|
+
}, {
|
|
382
|
+
default: p(() => [
|
|
383
|
+
h(D(E.value), 1)
|
|
384
|
+
]),
|
|
385
|
+
_: 1
|
|
386
|
+
}, 8, ["color"])
|
|
387
|
+
]),
|
|
388
|
+
_: 1
|
|
389
|
+
})
|
|
390
|
+
]),
|
|
391
|
+
_: 1
|
|
392
|
+
})
|
|
393
|
+
]),
|
|
394
|
+
_: 1
|
|
395
|
+
}, 8, ["modelValue", "onKeydown"]);
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
}), he = { class: "mx-auto my-auto" }, Ve = { class: "d-flex align-center justify-center w-100 h-100" }, Se = /* @__PURE__ */ I({
|
|
399
|
+
__name: "index",
|
|
400
|
+
setup(t) {
|
|
401
|
+
const n = z(), e = _(!1), o = () => {
|
|
402
|
+
e.value = !0;
|
|
403
|
+
}, l = () => {
|
|
404
|
+
e.value = !1;
|
|
405
|
+
};
|
|
406
|
+
return W(() => {
|
|
407
|
+
s.on("openWaitDlg", o), s.on("closeWaitDlg", l);
|
|
408
|
+
}), L(() => {
|
|
409
|
+
s.off("openWaitDlg", o), s.off("closeWaitDlg", l);
|
|
410
|
+
}), (u, c) => {
|
|
411
|
+
const i = m("v-card"), f = m("v-dialog");
|
|
412
|
+
return V(), M(f, {
|
|
413
|
+
"model-value": e.value,
|
|
414
|
+
"onUpdate:modelValue": c[0] || (c[0] = (d) => e.value = d),
|
|
415
|
+
persistent: "",
|
|
416
|
+
"no-click-animation": "",
|
|
417
|
+
fullscreen: ""
|
|
418
|
+
}, {
|
|
419
|
+
default: p(() => [
|
|
420
|
+
v("div", he, [
|
|
421
|
+
g(i, {
|
|
422
|
+
width: "300px",
|
|
423
|
+
height: "80px",
|
|
424
|
+
loading: ""
|
|
425
|
+
}, {
|
|
426
|
+
default: p(() => [
|
|
427
|
+
v("div", Ve, [
|
|
428
|
+
v("span", null, D(ue(n).t("waitingResponse")), 1)
|
|
429
|
+
])
|
|
430
|
+
]),
|
|
431
|
+
_: 1
|
|
432
|
+
})
|
|
433
|
+
])
|
|
434
|
+
]),
|
|
435
|
+
_: 1
|
|
436
|
+
}, 8, ["model-value"]);
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
let A = Date.now();
|
|
441
|
+
function J() {
|
|
442
|
+
const t = Date.now();
|
|
443
|
+
return t - A > 500 ? (A = t, !0) : !1;
|
|
444
|
+
}
|
|
445
|
+
let be = 0;
|
|
446
|
+
function Q() {
|
|
447
|
+
return ++be;
|
|
448
|
+
}
|
|
449
|
+
async function Re(t) {
|
|
450
|
+
if (!J())
|
|
451
|
+
return;
|
|
452
|
+
let n = !1, e;
|
|
453
|
+
const o = (u) => {
|
|
454
|
+
e = u, n = !0;
|
|
455
|
+
}, l = Q();
|
|
456
|
+
return s.on("confirmDlgResult" + l, o), s.emit("confirmDlg", { ...t, seq: l }), await X(() => n), s.off("confirmDlgResult" + l, o), e;
|
|
457
|
+
}
|
|
458
|
+
async function We(t) {
|
|
459
|
+
if (!J())
|
|
460
|
+
return;
|
|
461
|
+
let n = !1, e;
|
|
462
|
+
const o = (u) => {
|
|
463
|
+
e = u, n = !0;
|
|
464
|
+
}, l = Q();
|
|
465
|
+
return s.on("promptDlgResult" + l, o), s.emit("promptDlg", { ...t, seq: l }), await X(() => n), s.off("promptDlgResult" + l, o), e;
|
|
466
|
+
}
|
|
467
|
+
function Me() {
|
|
468
|
+
s.emit("openWaitDlg");
|
|
469
|
+
}
|
|
470
|
+
function Be() {
|
|
471
|
+
s.emit("closeWaitDlg");
|
|
472
|
+
}
|
|
473
|
+
function Ee(t, n) {
|
|
474
|
+
s.emit("message", { type: "error", text: t, timeout: n });
|
|
475
|
+
}
|
|
476
|
+
function Ue(t, n) {
|
|
477
|
+
s.emit("message", { type: "info", text: t, timeout: n });
|
|
478
|
+
}
|
|
479
|
+
function je(t, n) {
|
|
480
|
+
s.emit("message", { type: "success", text: t, timeout: n });
|
|
481
|
+
}
|
|
482
|
+
function Le(t, n) {
|
|
483
|
+
s.emit("message", { type: "warning", text: t, timeout: n });
|
|
484
|
+
}
|
|
485
|
+
function Ne(t) {
|
|
486
|
+
var o, l;
|
|
487
|
+
if (!window.appAppear) {
|
|
488
|
+
window.appAppear = !0;
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
const n = "single-spa-application:" + t, e = (o = document.getElementById(n)) == null ? void 0 : o.classList;
|
|
492
|
+
e && (e.remove("app-left", "app-right", "app-reset"), (l = window.routeExtras) != null && l.forward ? e.add("app-left") : e.add("app-right"), setTimeout(() => {
|
|
493
|
+
e.add("app-reset");
|
|
494
|
+
}, 0));
|
|
495
|
+
}
|
|
496
|
+
export {
|
|
497
|
+
Ie as XConfirmDlg,
|
|
498
|
+
Te as XLoading,
|
|
499
|
+
$e as XMessage,
|
|
500
|
+
qe as XPromptDlg,
|
|
501
|
+
Se as XWaitDlg,
|
|
502
|
+
Ne as appAppear,
|
|
503
|
+
Be as closeWaitDlg,
|
|
504
|
+
Ee as messageError,
|
|
505
|
+
Ue as messageInfo,
|
|
506
|
+
je as messageSuccess,
|
|
507
|
+
Le as messageWarning,
|
|
508
|
+
Re as openConfirmDlg,
|
|
509
|
+
We as openPromptDlg,
|
|
510
|
+
Me as openWaitDlg,
|
|
511
|
+
ke as waitMs,
|
|
512
|
+
X as waitUtil
|
|
513
|
+
};
|
package/index.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>x-essential-lib</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
<script type="module" src="/src/main.ts"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|