@schwarzdavid/ui-kit 0.0.1-alpha.12 → 0.0.1-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.d.ts +0 -10
- package/dist/main.js +230 -225
- package/dist/validators.d.ts +20 -0
- package/dist/validators.js +60 -48
- package/package.json +1 -1
- package/dist/usePluginContext-CyxsFQjN.js +0 -14
package/dist/main.d.ts
CHANGED
|
@@ -128,18 +128,8 @@ declare type PluginI18nMessageKey = 'save' | 'cancel' | 'close' | 'yes' | 'no';
|
|
|
128
128
|
|
|
129
129
|
declare interface PluginI18nOptions {
|
|
130
130
|
messages: Record<PluginI18nMessageKey, string>;
|
|
131
|
-
validation: PluginI18nValidationFn | PluginI18nValidationOptions;
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
declare type PluginI18nValidationFn = (validatorName: string) => string;
|
|
135
|
-
|
|
136
|
-
declare interface PluginI18nValidationOptions {
|
|
137
|
-
prefix: string;
|
|
138
|
-
transform: PluginI18nValidationTransform;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
declare type PluginI18nValidationTransform = 'snake_case' | 'camelCase' | 'PascalCase' | 'kebab-case' | 'none';
|
|
142
|
-
|
|
143
133
|
declare interface PluginLoadingOptions {
|
|
144
134
|
delay: number | false;
|
|
145
135
|
overlay: boolean;
|
package/dist/main.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { readonly as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import Ae from "@vuelidate/core";
|
|
1
|
+
import { getCurrentInstance as ge, inject as ye, readonly as Z, markRaw as oe, defineComponent as k, createElementBlock as U, openBlock as m, Fragment as M, renderList as J, unref as l, createBlock as p, resolveDynamicComponent as F, mergeProps as $, ref as E, computed as y, onMounted as Ce, createSlots as Te, withCtx as d, toDisplayString as G, createVNode as s, TransitionGroup as we, normalizeClass as le, isRef as xe, createTextVNode as te, createElementVNode as N, createCommentVNode as S, normalizeProps as re, toValue as ne, useTemplateRef as De } from "vue";
|
|
2
|
+
import { VAlert as Ve, VIcon as Ie, VOverlay as Ae, VProgressCircular as Re, VDialog as K, VCard as z, VCardTitle as ue, VBtn as A, VCardText as se, VCardActions as q, VToolbar as ce, VToolbarTitle as ie, VSpacer as B, VDivider as de, VDefaultsProvider as he } from "vuetify/components";
|
|
3
|
+
import { useI18n as me } from "vue-i18n";
|
|
4
|
+
import { useDisplay as fe } from "vuetify";
|
|
5
|
+
import { merge as Q } from "lodash";
|
|
6
|
+
import Ee from "@vuelidate/core";
|
|
8
7
|
const g = [];
|
|
9
8
|
for (let e = 0; e < 256; ++e)
|
|
10
9
|
g.push((e + 256).toString(16).slice(1));
|
|
@@ -12,36 +11,46 @@ function be(e, a = 0) {
|
|
|
12
11
|
return (g[e[a + 0]] + g[e[a + 1]] + g[e[a + 2]] + g[e[a + 3]] + "-" + g[e[a + 4]] + g[e[a + 5]] + "-" + g[e[a + 6]] + g[e[a + 7]] + "-" + g[e[a + 8]] + g[e[a + 9]] + "-" + g[e[a + 10]] + g[e[a + 11]] + g[e[a + 12]] + g[e[a + 13]] + g[e[a + 14]] + g[e[a + 15]]).toLowerCase();
|
|
13
12
|
}
|
|
14
13
|
let Y;
|
|
15
|
-
const
|
|
16
|
-
function
|
|
14
|
+
const ke = new Uint8Array(16);
|
|
15
|
+
function Oe() {
|
|
17
16
|
if (!Y) {
|
|
18
17
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
19
18
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
20
19
|
Y = crypto.getRandomValues.bind(crypto);
|
|
21
20
|
}
|
|
22
|
-
return Y(
|
|
21
|
+
return Y(ke);
|
|
23
22
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
23
|
+
const Ue = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ae = { randomUUID: Ue };
|
|
24
|
+
function ve(e, a, t) {
|
|
26
25
|
var o;
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
26
|
+
if (ae.randomUUID && !e)
|
|
27
|
+
return ae.randomUUID();
|
|
29
28
|
e = e || {};
|
|
30
|
-
const r = e.random ?? ((o = e.rng) == null ? void 0 : o.call(e)) ??
|
|
29
|
+
const r = e.random ?? ((o = e.rng) == null ? void 0 : o.call(e)) ?? Oe();
|
|
31
30
|
if (r.length < 16)
|
|
32
31
|
throw new Error("Random bytes length must be >= 16");
|
|
33
32
|
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, be(r);
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
var X = /* @__PURE__ */ ((e) => (e.NOT_INSTALLED = "Need to install with `app.use` function", e.UNEXPECTED_ERROR = "Unexpected error", e))(X || {});
|
|
35
|
+
function j() {
|
|
36
|
+
const e = ge();
|
|
37
|
+
if (!(e != null && e.appContext.app.__SCHWARZDAVID_UIKIT_SYMBOL__))
|
|
38
|
+
throw new Error(X.NOT_INSTALLED);
|
|
39
|
+
const a = e.appContext.app.__SCHWARZDAVID_UIKIT_SYMBOL__, t = ye(a);
|
|
40
|
+
if (!t)
|
|
41
|
+
throw new Error(X.UNEXPECTED_ERROR);
|
|
42
|
+
return t;
|
|
43
|
+
}
|
|
44
|
+
function pe() {
|
|
45
|
+
const { dialogQueue: e } = j();
|
|
37
46
|
function a() {
|
|
38
47
|
let o;
|
|
39
48
|
for (; ; )
|
|
40
|
-
if (o =
|
|
49
|
+
if (o = ve(), !e.value.some((u) => u.id === o))
|
|
41
50
|
return o;
|
|
42
51
|
}
|
|
43
52
|
function t(o) {
|
|
44
|
-
const u = a(), i =
|
|
53
|
+
const u = a(), i = oe({ ...o, id: u, resolve: (f) => {
|
|
45
54
|
r(u), o.resolve(f);
|
|
46
55
|
}, reject: (f) => {
|
|
47
56
|
r(u), o.reject(f);
|
|
@@ -53,16 +62,16 @@ function ve() {
|
|
|
53
62
|
c >= 0 && e.value.splice(c, 1);
|
|
54
63
|
}
|
|
55
64
|
return {
|
|
56
|
-
queue:
|
|
65
|
+
queue: Z(e),
|
|
57
66
|
addToQueue: t,
|
|
58
67
|
removeFromQueue: r
|
|
59
68
|
};
|
|
60
69
|
}
|
|
61
|
-
const
|
|
70
|
+
const Le = /* @__PURE__ */ k({
|
|
62
71
|
__name: "DialogOutlet",
|
|
63
72
|
setup(e) {
|
|
64
|
-
const { queue: a } =
|
|
65
|
-
return (t, r) => (m(!0),
|
|
73
|
+
const { queue: a } = pe();
|
|
74
|
+
return (t, r) => (m(!0), U(M, null, J(l(a), (o) => (m(), p(F(o.component), $({
|
|
66
75
|
key: o.id,
|
|
67
76
|
ref_for: !0
|
|
68
77
|
}, o.props, {
|
|
@@ -71,16 +80,16 @@ const Ee = /* @__PURE__ */ E({
|
|
|
71
80
|
}), null, 16, ["onResolve", "onReject"]))), 128));
|
|
72
81
|
}
|
|
73
82
|
});
|
|
74
|
-
function
|
|
75
|
-
const { toastQueue: e } =
|
|
83
|
+
function ee() {
|
|
84
|
+
const { toastQueue: e } = j();
|
|
76
85
|
function a() {
|
|
77
86
|
let o;
|
|
78
87
|
for (; ; )
|
|
79
|
-
if (o =
|
|
88
|
+
if (o = ve(), !e.value.some((u) => u.id === o))
|
|
80
89
|
return o;
|
|
81
90
|
}
|
|
82
91
|
function t(o) {
|
|
83
|
-
const u = a(), n =
|
|
92
|
+
const u = a(), n = oe({ ...o, id: u, resolve: () => {
|
|
84
93
|
r(u), o.resolve();
|
|
85
94
|
} });
|
|
86
95
|
return e.value.unshift(n), n;
|
|
@@ -90,52 +99,52 @@ function J() {
|
|
|
90
99
|
c >= 0 && e.value.splice(c, 1);
|
|
91
100
|
}
|
|
92
101
|
return {
|
|
93
|
-
queue:
|
|
102
|
+
queue: Z(e),
|
|
94
103
|
addToQueue: t,
|
|
95
104
|
removeFromQueue: r
|
|
96
105
|
};
|
|
97
106
|
}
|
|
98
|
-
var
|
|
99
|
-
const
|
|
107
|
+
var x = /* @__PURE__ */ ((e) => (e.SUCCESS = "success", e.INFO = "info", e.WARNING = "warning", e.ERROR = "error", e))(x || {});
|
|
108
|
+
const Se = { key: 0 }, je = { key: 1 }, Me = /* @__PURE__ */ k({
|
|
100
109
|
__name: "ToastEntry",
|
|
101
110
|
props: {
|
|
102
111
|
entry: {}
|
|
103
112
|
},
|
|
104
113
|
setup(e) {
|
|
105
114
|
const a = {
|
|
106
|
-
[
|
|
107
|
-
[
|
|
108
|
-
[
|
|
109
|
-
[
|
|
115
|
+
[x.ERROR]: "mdi-alert-circle-outline",
|
|
116
|
+
[x.SUCCESS]: "mdi-check-circle-outline",
|
|
117
|
+
[x.INFO]: "mdi-information-outline",
|
|
118
|
+
[x.WARNING]: "mdi-alert-circle-outline"
|
|
110
119
|
}, t = {
|
|
111
|
-
[
|
|
112
|
-
[
|
|
113
|
-
[
|
|
114
|
-
[
|
|
115
|
-
}, r = e, o =
|
|
120
|
+
[x.ERROR]: "error",
|
|
121
|
+
[x.SUCCESS]: "success",
|
|
122
|
+
[x.INFO]: "primary",
|
|
123
|
+
[x.WARNING]: "warning"
|
|
124
|
+
}, r = e, o = ee(), u = E(-1), c = y(() => a[r.entry.type]), n = y(() => t[r.entry.type]), { t: i } = me({ useScope: "global" });
|
|
116
125
|
function f() {
|
|
117
126
|
window.clearTimeout(u.value), o.removeFromQueue(r.entry.id);
|
|
118
127
|
}
|
|
119
|
-
return
|
|
128
|
+
return Ce(() => {
|
|
120
129
|
u.value = window.setTimeout(() => {
|
|
121
130
|
f();
|
|
122
131
|
}, r.entry.timeout);
|
|
123
|
-
}), (_,
|
|
132
|
+
}), (_, D) => (m(), p(l(Ve), {
|
|
124
133
|
theme: "dark",
|
|
125
134
|
class: "toast-entry",
|
|
126
135
|
closable: "",
|
|
127
136
|
"onClick:close": f,
|
|
128
137
|
density: "compact"
|
|
129
|
-
},
|
|
138
|
+
}, Te({
|
|
130
139
|
default: d(() => [
|
|
131
|
-
_.entry.translateMessage ? (m(),
|
|
140
|
+
_.entry.translateMessage ? (m(), U("span", Se, G(l(i)(_.entry.message)), 1)) : (m(), U("span", je, G(_.entry.message), 1))
|
|
132
141
|
]),
|
|
133
142
|
_: 2
|
|
134
143
|
}, [
|
|
135
144
|
c.value ? {
|
|
136
145
|
name: "prepend",
|
|
137
146
|
fn: d(() => [
|
|
138
|
-
s(l(
|
|
147
|
+
s(l(Ie), {
|
|
139
148
|
icon: c.value,
|
|
140
149
|
color: n.value
|
|
141
150
|
}, null, 8, ["icon", "color"])
|
|
@@ -144,27 +153,27 @@ const Ue = { key: 0 }, Oe = { key: 1 }, je = /* @__PURE__ */ E({
|
|
|
144
153
|
} : void 0
|
|
145
154
|
]), 1024));
|
|
146
155
|
}
|
|
147
|
-
}),
|
|
156
|
+
}), W = (e, a) => {
|
|
148
157
|
const t = e.__vccOpts || e;
|
|
149
158
|
for (const [r, o] of a)
|
|
150
159
|
t[r] = o;
|
|
151
160
|
return t;
|
|
152
|
-
},
|
|
161
|
+
}, Pe = /* @__PURE__ */ W(Me, [["__scopeId", "data-v-7b5e0267"]]), Ne = /* @__PURE__ */ k({
|
|
153
162
|
__name: "ToastOutlet",
|
|
154
163
|
setup(e) {
|
|
155
|
-
const { queue: a } =
|
|
164
|
+
const { queue: a } = ee(), { mobile: t } = fe(), r = y(() => t.value ? "" : "toast-outlet--desktop");
|
|
156
165
|
function o(u) {
|
|
157
166
|
const { width: c } = u.getBoundingClientRect();
|
|
158
167
|
u instanceof HTMLElement && (u.style.width = `${c.toFixed()}px`);
|
|
159
168
|
}
|
|
160
|
-
return (u, c) => (m(), p(
|
|
169
|
+
return (u, c) => (m(), p(we, {
|
|
161
170
|
name: "fade",
|
|
162
171
|
tag: "div",
|
|
163
|
-
class:
|
|
172
|
+
class: le(["toast-outlet", r.value]),
|
|
164
173
|
onBeforeLeave: o
|
|
165
174
|
}, {
|
|
166
175
|
default: d(() => [
|
|
167
|
-
(m(!0),
|
|
176
|
+
(m(!0), U(M, null, J(l(a), (n) => (m(), p(Pe, {
|
|
168
177
|
key: n.id,
|
|
169
178
|
entry: n
|
|
170
179
|
}, null, 8, ["entry"]))), 128))
|
|
@@ -172,22 +181,22 @@ const Ue = { key: 0 }, Oe = { key: 1 }, je = /* @__PURE__ */ E({
|
|
|
172
181
|
_: 1
|
|
173
182
|
}, 8, ["class"]));
|
|
174
183
|
}
|
|
175
|
-
}),
|
|
176
|
-
function
|
|
177
|
-
return
|
|
184
|
+
}), Qe = /* @__PURE__ */ W(Ne, [["__scopeId", "data-v-ba5c8268"]]), Fe = E(!1);
|
|
185
|
+
function _e() {
|
|
186
|
+
return Fe;
|
|
178
187
|
}
|
|
179
|
-
const
|
|
188
|
+
const $e = /* @__PURE__ */ k({
|
|
180
189
|
__name: "LoadingOverlay",
|
|
181
190
|
setup(e) {
|
|
182
|
-
const a =
|
|
183
|
-
return (t, r) => (m(), p(l(
|
|
191
|
+
const a = _e();
|
|
192
|
+
return (t, r) => (m(), p(l(Ae), {
|
|
184
193
|
modelValue: l(a),
|
|
185
|
-
"onUpdate:modelValue": r[0] || (r[0] = (o) =>
|
|
194
|
+
"onUpdate:modelValue": r[0] || (r[0] = (o) => xe(a) ? a.value = o : null),
|
|
186
195
|
persistent: "",
|
|
187
196
|
class: "d-flex align-center justify-center"
|
|
188
197
|
}, {
|
|
189
198
|
default: d(() => [
|
|
190
|
-
s(l(
|
|
199
|
+
s(l(Re), {
|
|
191
200
|
indeterminate: "",
|
|
192
201
|
color: "primary",
|
|
193
202
|
size: "100"
|
|
@@ -196,72 +205,72 @@ const Qe = /* @__PURE__ */ E({
|
|
|
196
205
|
_: 1
|
|
197
206
|
}, 8, ["modelValue"]));
|
|
198
207
|
}
|
|
199
|
-
}),
|
|
208
|
+
}), dt = /* @__PURE__ */ k({
|
|
200
209
|
__name: "UiKitOutlet",
|
|
201
210
|
setup(e) {
|
|
202
|
-
return (a, t) => (m(),
|
|
203
|
-
s(
|
|
204
|
-
s(
|
|
205
|
-
s(
|
|
211
|
+
return (a, t) => (m(), U(M, null, [
|
|
212
|
+
s(Le),
|
|
213
|
+
s(Qe),
|
|
214
|
+
s($e)
|
|
206
215
|
], 64));
|
|
207
216
|
}
|
|
208
|
-
}), C = /* @__PURE__ */
|
|
217
|
+
}), C = /* @__PURE__ */ k({
|
|
209
218
|
__name: "MaybeTranslation",
|
|
210
219
|
props: {
|
|
211
220
|
content: {},
|
|
212
221
|
translate: { type: Boolean, default: !0 }
|
|
213
222
|
},
|
|
214
223
|
setup(e) {
|
|
215
|
-
const { t: a } =
|
|
216
|
-
return (t, r) => t.translate ? (m(),
|
|
217
|
-
|
|
218
|
-
], 64)) : (m(),
|
|
219
|
-
|
|
224
|
+
const { t: a } = me({ useScope: "global" });
|
|
225
|
+
return (t, r) => t.translate ? (m(), U(M, { key: 0 }, [
|
|
226
|
+
te(G(l(a)(t.content)), 1)
|
|
227
|
+
], 64)) : (m(), U(M, { key: 1 }, [
|
|
228
|
+
te(G(t.content), 1)
|
|
220
229
|
], 64));
|
|
221
230
|
}
|
|
222
|
-
}),
|
|
231
|
+
}), We = { class: "d-flex justify-space-between pr-2 py-2" }, Ge = 650, Be = /* @__PURE__ */ k({
|
|
223
232
|
__name: "InfoDialog",
|
|
224
233
|
props: {
|
|
225
234
|
data: {}
|
|
226
235
|
},
|
|
227
236
|
emits: ["resolve", "reject"],
|
|
228
237
|
setup(e, { emit: a }) {
|
|
229
|
-
const t = e, r = a, { options: { i18n: { messages: { close: o } } } } =
|
|
238
|
+
const t = e, r = a, { options: { i18n: { messages: { close: o } } } } = j(), u = {
|
|
230
239
|
text: o,
|
|
231
240
|
translateText: !0,
|
|
232
241
|
value: null
|
|
233
242
|
};
|
|
234
243
|
let c = null;
|
|
235
|
-
const n =
|
|
244
|
+
const n = E(!0), i = y(() => Object.hasOwn(t.data, "content") ? {
|
|
236
245
|
content: t.data.content,
|
|
237
246
|
translateContent: t.data.translateContent
|
|
238
247
|
} : null), f = y(() => Object.hasOwn(t.data, "component") ? {
|
|
239
248
|
component: t.data.component,
|
|
240
249
|
props: t.data.props
|
|
241
|
-
} : null), _ = y(() => t.data.defaultCta === !1 ? null :
|
|
242
|
-
function
|
|
243
|
-
|
|
250
|
+
} : null), _ = y(() => t.data.defaultCta === !1 ? null : Q({}, u, t.data.defaultCta));
|
|
251
|
+
function D(v) {
|
|
252
|
+
R(v) ? v.action() : b(v.value);
|
|
244
253
|
}
|
|
245
|
-
function
|
|
254
|
+
function R(v) {
|
|
246
255
|
return Object.hasOwn(v, "action");
|
|
247
256
|
}
|
|
248
|
-
function
|
|
257
|
+
function b(v = null) {
|
|
249
258
|
c = v, n.value = !1;
|
|
250
259
|
}
|
|
251
|
-
function
|
|
260
|
+
function h() {
|
|
252
261
|
r("resolve", c);
|
|
253
262
|
}
|
|
254
|
-
return (v, T) => (m(), p(l(
|
|
263
|
+
return (v, T) => (m(), p(l(K), {
|
|
255
264
|
modelValue: n.value,
|
|
256
|
-
"onUpdate:modelValue": T[1] || (T[1] = (
|
|
257
|
-
"max-width": v.data.width ??
|
|
258
|
-
onAfterLeave:
|
|
265
|
+
"onUpdate:modelValue": T[1] || (T[1] = (V) => n.value = V),
|
|
266
|
+
"max-width": v.data.width ?? Ge,
|
|
267
|
+
onAfterLeave: h
|
|
259
268
|
}, {
|
|
260
269
|
default: d(() => [
|
|
261
|
-
s(l(
|
|
270
|
+
s(l(z), { class: "info-dialog-card" }, {
|
|
262
271
|
default: d(() => [
|
|
263
|
-
|
|
264
|
-
s(l(
|
|
272
|
+
N("div", We, [
|
|
273
|
+
s(l(ue), null, {
|
|
265
274
|
default: d(() => [
|
|
266
275
|
s(C, {
|
|
267
276
|
translate: v.data.translateTitle,
|
|
@@ -273,12 +282,12 @@ const Qe = /* @__PURE__ */ E({
|
|
|
273
282
|
s(l(A), {
|
|
274
283
|
icon: "$close",
|
|
275
284
|
variant: "text",
|
|
276
|
-
onClick: T[0] || (T[0] = (
|
|
285
|
+
onClick: T[0] || (T[0] = (V) => b(null))
|
|
277
286
|
})
|
|
278
287
|
]),
|
|
279
|
-
i.value ? (m(), p(l(
|
|
288
|
+
i.value ? (m(), p(l(se), { key: 0 }, {
|
|
280
289
|
default: d(() => [
|
|
281
|
-
|
|
290
|
+
N("p", null, [
|
|
282
291
|
s(C, {
|
|
283
292
|
translate: i.value.translateContent,
|
|
284
293
|
content: i.value.content
|
|
@@ -286,20 +295,20 @@ const Qe = /* @__PURE__ */ E({
|
|
|
286
295
|
])
|
|
287
296
|
]),
|
|
288
297
|
_: 1
|
|
289
|
-
})) :
|
|
290
|
-
f.value ? (m(), p(F(f.value.component),
|
|
291
|
-
s(l(
|
|
298
|
+
})) : S("", !0),
|
|
299
|
+
f.value ? (m(), p(F(f.value.component), re($({ key: 1 }, f.value.props)), null, 16)) : S("", !0),
|
|
300
|
+
s(l(q), { class: "justify-end" }, {
|
|
292
301
|
default: d(() => [
|
|
293
|
-
(m(!0),
|
|
294
|
-
key:
|
|
302
|
+
(m(!0), U(M, null, J(v.data.additionalCta ?? [], (V, I) => (m(), p(l(A), {
|
|
303
|
+
key: I,
|
|
295
304
|
color: "primary",
|
|
296
305
|
variant: "text",
|
|
297
|
-
onClick: () => V
|
|
306
|
+
onClick: () => D(V)
|
|
298
307
|
}, {
|
|
299
308
|
default: d(() => [
|
|
300
309
|
s(C, {
|
|
301
|
-
translate:
|
|
302
|
-
content:
|
|
310
|
+
translate: V.translateText,
|
|
311
|
+
content: V.text
|
|
303
312
|
}, null, 8, ["translate", "content"])
|
|
304
313
|
]),
|
|
305
314
|
_: 2
|
|
@@ -308,7 +317,7 @@ const Qe = /* @__PURE__ */ E({
|
|
|
308
317
|
key: 0,
|
|
309
318
|
color: "primary",
|
|
310
319
|
variant: "elevated",
|
|
311
|
-
onClick:
|
|
320
|
+
onClick: b
|
|
312
321
|
}, {
|
|
313
322
|
default: d(() => [
|
|
314
323
|
s(C, {
|
|
@@ -317,7 +326,7 @@ const Qe = /* @__PURE__ */ E({
|
|
|
317
326
|
}, null, 8, ["translate", "content"])
|
|
318
327
|
]),
|
|
319
328
|
_: 1
|
|
320
|
-
})) :
|
|
329
|
+
})) : S("", !0)
|
|
321
330
|
]),
|
|
322
331
|
_: 1
|
|
323
332
|
})
|
|
@@ -328,16 +337,16 @@ const Qe = /* @__PURE__ */ E({
|
|
|
328
337
|
_: 1
|
|
329
338
|
}, 8, ["modelValue", "max-width"]));
|
|
330
339
|
}
|
|
331
|
-
}),
|
|
332
|
-
var
|
|
333
|
-
function
|
|
340
|
+
}), He = /* @__PURE__ */ W(Be, [["__scopeId", "data-v-0f8116ef"]]);
|
|
341
|
+
var L = /* @__PURE__ */ ((e) => (e.SMALL = "sm", e.LARGE = "lg", e))(L || {});
|
|
342
|
+
function H(e, a) {
|
|
334
343
|
const r = {
|
|
335
|
-
text:
|
|
344
|
+
text: j().options.i18n.messages[a],
|
|
336
345
|
translateText: !0
|
|
337
346
|
};
|
|
338
|
-
return
|
|
347
|
+
return Q(r, e);
|
|
339
348
|
}
|
|
340
|
-
const
|
|
349
|
+
const Ke = /* @__PURE__ */ k({
|
|
341
350
|
__name: "PromptDialog",
|
|
342
351
|
props: {
|
|
343
352
|
data: {}
|
|
@@ -345,49 +354,49 @@ const We = /* @__PURE__ */ E({
|
|
|
345
354
|
emits: ["resolve", "reject"],
|
|
346
355
|
setup(e, { emit: a }) {
|
|
347
356
|
const t = e, r = a, o = {
|
|
348
|
-
[
|
|
349
|
-
[
|
|
350
|
-
}, u =
|
|
357
|
+
[L.SMALL]: 650,
|
|
358
|
+
[L.LARGE]: 1200
|
|
359
|
+
}, u = H(t.data.saveCta, "save"), c = H(t.data.abortCta, "cancel"), n = E(!0), i = E(ne(t.data.initialValue) ?? null), f = E(null), { mobile: _ } = fe(), D = y(() => t.data.required && !i.value), R = y(() => o[t.data.size ?? L.SMALL]), b = y(() => t.data.size === L.LARGE ? _.value : !1), h = y(() => t.data.size === L.LARGE ? "secondary" : "primary");
|
|
351
360
|
function v() {
|
|
352
361
|
return t.data.props ?? {};
|
|
353
362
|
}
|
|
354
363
|
function T() {
|
|
355
|
-
i.value =
|
|
364
|
+
i.value = ne(t.data.initialValue) ?? null, n.value = !1;
|
|
356
365
|
}
|
|
357
|
-
function
|
|
366
|
+
function V() {
|
|
358
367
|
n.value = !1;
|
|
359
368
|
}
|
|
360
|
-
function
|
|
369
|
+
function I() {
|
|
361
370
|
if (t.data.required && !i.value) {
|
|
362
371
|
r("reject");
|
|
363
372
|
return;
|
|
364
373
|
}
|
|
365
374
|
r("resolve", i.value);
|
|
366
375
|
}
|
|
367
|
-
return (
|
|
376
|
+
return (w, O) => (m(), p(l(K), {
|
|
368
377
|
modelValue: n.value,
|
|
369
|
-
"onUpdate:modelValue":
|
|
370
|
-
"max-width":
|
|
371
|
-
fullscreen:
|
|
372
|
-
scrollable:
|
|
373
|
-
onAfterLeave:
|
|
378
|
+
"onUpdate:modelValue": O[1] || (O[1] = (P) => n.value = P),
|
|
379
|
+
"max-width": R.value,
|
|
380
|
+
fullscreen: b.value,
|
|
381
|
+
scrollable: w.data.size === l(L).LARGE,
|
|
382
|
+
onAfterLeave: I
|
|
374
383
|
}, {
|
|
375
384
|
default: d(() => [
|
|
376
|
-
s(l(
|
|
385
|
+
s(l(z), { class: "prompt-dialog-card" }, {
|
|
377
386
|
default: d(() => [
|
|
378
|
-
s(l(
|
|
387
|
+
s(l(ce), { color: "primary" }, {
|
|
379
388
|
default: d(() => [
|
|
380
|
-
s(l(
|
|
389
|
+
s(l(ie), null, {
|
|
381
390
|
default: d(() => [
|
|
382
391
|
s(C, {
|
|
383
|
-
translate:
|
|
384
|
-
content:
|
|
392
|
+
translate: w.data.translateTitle,
|
|
393
|
+
content: w.data.title
|
|
385
394
|
}, null, 8, ["translate", "content"])
|
|
386
395
|
]),
|
|
387
396
|
_: 1
|
|
388
397
|
}),
|
|
389
398
|
s(l(B)),
|
|
390
|
-
|
|
399
|
+
N("div", {
|
|
391
400
|
ref_key: "toolbar",
|
|
392
401
|
ref: f,
|
|
393
402
|
class: "prompt-dialog-toolbar-slot"
|
|
@@ -399,17 +408,17 @@ const We = /* @__PURE__ */ E({
|
|
|
399
408
|
]),
|
|
400
409
|
_: 1
|
|
401
410
|
}),
|
|
402
|
-
f.value ? (m(), p(F(
|
|
411
|
+
f.value ? (m(), p(F(w.data.component), $({ key: 0 }, v(), {
|
|
403
412
|
modelValue: i.value,
|
|
404
|
-
"onUpdate:modelValue":
|
|
413
|
+
"onUpdate:modelValue": O[0] || (O[0] = (P) => i.value = P),
|
|
405
414
|
toolbar: f.value
|
|
406
|
-
}), null, 16, ["modelValue", "toolbar"])) :
|
|
407
|
-
s(l(
|
|
408
|
-
s(l(
|
|
415
|
+
}), null, 16, ["modelValue", "toolbar"])) : S("", !0),
|
|
416
|
+
s(l(de)),
|
|
417
|
+
s(l(q), null, {
|
|
409
418
|
default: d(() => [
|
|
410
419
|
s(l(B)),
|
|
411
420
|
s(l(A), {
|
|
412
|
-
color:
|
|
421
|
+
color: h.value,
|
|
413
422
|
onClick: T
|
|
414
423
|
}, {
|
|
415
424
|
default: d(() => [
|
|
@@ -422,9 +431,9 @@ const We = /* @__PURE__ */ E({
|
|
|
422
431
|
}, 8, ["color"]),
|
|
423
432
|
s(l(A), {
|
|
424
433
|
variant: "elevated",
|
|
425
|
-
color:
|
|
426
|
-
disabled:
|
|
427
|
-
onClick:
|
|
434
|
+
color: h.value,
|
|
435
|
+
disabled: D.value,
|
|
436
|
+
onClick: V
|
|
428
437
|
}, {
|
|
429
438
|
default: d(() => [
|
|
430
439
|
s(C, {
|
|
@@ -444,14 +453,14 @@ const We = /* @__PURE__ */ E({
|
|
|
444
453
|
_: 1
|
|
445
454
|
}, 8, ["modelValue", "max-width", "fullscreen", "scrollable"]));
|
|
446
455
|
}
|
|
447
|
-
}),
|
|
456
|
+
}), ze = /* @__PURE__ */ W(Ke, [["__scopeId", "data-v-6cec23a5"]]), qe = { class: "d-flex justify-space-between pr-2 py-2" }, Ye = 550, Xe = /* @__PURE__ */ k({
|
|
448
457
|
__name: "ConfirmDialog",
|
|
449
458
|
props: {
|
|
450
459
|
data: {}
|
|
451
460
|
},
|
|
452
461
|
emits: ["resolve", "reject"],
|
|
453
462
|
setup(e, { emit: a }) {
|
|
454
|
-
const t = e, r = a, { options: { i18n: { messages: { yes: o, no: u } } } } =
|
|
463
|
+
const t = e, r = a, { options: { i18n: { messages: { yes: o, no: u } } } } = j(), c = {
|
|
455
464
|
text: o,
|
|
456
465
|
translateText: !0
|
|
457
466
|
}, n = {
|
|
@@ -459,54 +468,54 @@ const We = /* @__PURE__ */ E({
|
|
|
459
468
|
translateText: !0
|
|
460
469
|
};
|
|
461
470
|
let i = !1;
|
|
462
|
-
const f =
|
|
471
|
+
const f = E(!0), _ = y(() => Object.hasOwn(t.data, "content") ? {
|
|
463
472
|
content: t.data.content,
|
|
464
473
|
translateContent: t.data.translateContent
|
|
465
|
-
} : null),
|
|
474
|
+
} : null), D = y(() => Object.hasOwn(t.data, "component") ? {
|
|
466
475
|
component: t.data.component,
|
|
467
476
|
props: t.data.props
|
|
468
|
-
} : null),
|
|
477
|
+
} : null), R = y(() => Q({}, c, t.data.confirmCta)), b = y(() => Q({}, n, t.data.rejectCta)), h = y(() => t.data.highlightCta ?? "confirm"), v = y(() => t.data.level ?? "primary");
|
|
469
478
|
function T() {
|
|
470
479
|
f.value = !1;
|
|
471
480
|
}
|
|
472
|
-
function
|
|
481
|
+
function V() {
|
|
473
482
|
i = !0, f.value = !1;
|
|
474
483
|
}
|
|
475
|
-
function
|
|
484
|
+
function I() {
|
|
476
485
|
if (t.data.throwOnReject && !i) {
|
|
477
486
|
r("reject");
|
|
478
487
|
return;
|
|
479
488
|
}
|
|
480
489
|
r("resolve", i);
|
|
481
490
|
}
|
|
482
|
-
return (
|
|
491
|
+
return (w, O) => (m(), p(l(K), {
|
|
483
492
|
modelValue: f.value,
|
|
484
|
-
"onUpdate:modelValue":
|
|
485
|
-
persistent: !!
|
|
486
|
-
"max-width":
|
|
487
|
-
onAfterLeave:
|
|
493
|
+
"onUpdate:modelValue": O[0] || (O[0] = (P) => f.value = P),
|
|
494
|
+
persistent: !!w.data.permanent,
|
|
495
|
+
"max-width": w.data.maxWidth ?? Ye,
|
|
496
|
+
onAfterLeave: I
|
|
488
497
|
}, {
|
|
489
498
|
default: d(() => [
|
|
490
|
-
s(l(
|
|
499
|
+
s(l(z), { class: "confirm-dialog-card" }, {
|
|
491
500
|
default: d(() => [
|
|
492
|
-
|
|
493
|
-
s(l(
|
|
501
|
+
N("div", qe, [
|
|
502
|
+
s(l(ue), null, {
|
|
494
503
|
default: d(() => [
|
|
495
504
|
s(C, {
|
|
496
|
-
translate:
|
|
497
|
-
content:
|
|
505
|
+
translate: w.data.translateTitle,
|
|
506
|
+
content: w.data.title
|
|
498
507
|
}, null, 8, ["translate", "content"])
|
|
499
508
|
]),
|
|
500
509
|
_: 1
|
|
501
510
|
}),
|
|
502
|
-
|
|
511
|
+
w.data.permanent ? S("", !0) : (m(), p(l(A), {
|
|
503
512
|
key: 0,
|
|
504
513
|
icon: "$close",
|
|
505
514
|
variant: "text",
|
|
506
515
|
onClick: T
|
|
507
516
|
}))
|
|
508
517
|
]),
|
|
509
|
-
_.value ? (m(), p(l(
|
|
518
|
+
_.value ? (m(), p(l(se), { key: 0 }, {
|
|
510
519
|
default: d(() => [
|
|
511
520
|
s(C, {
|
|
512
521
|
translate: _.value.translateContent,
|
|
@@ -514,35 +523,35 @@ const We = /* @__PURE__ */ E({
|
|
|
514
523
|
}, null, 8, ["translate", "content"])
|
|
515
524
|
]),
|
|
516
525
|
_: 1
|
|
517
|
-
})) :
|
|
518
|
-
|
|
519
|
-
s(l(
|
|
526
|
+
})) : S("", !0),
|
|
527
|
+
D.value ? (m(), p(F(D.value.component), re($({ key: 1 }, D.value.props)), null, 16)) : S("", !0),
|
|
528
|
+
s(l(q), { class: "justify-end" }, {
|
|
520
529
|
default: d(() => [
|
|
521
|
-
|
|
522
|
-
class:
|
|
530
|
+
N("div", {
|
|
531
|
+
class: le(["d-flex align-center", h.value === "confirm" ? "" : "flex-row-reverse"])
|
|
523
532
|
}, [
|
|
524
533
|
s(l(A), {
|
|
525
|
-
variant:
|
|
534
|
+
variant: h.value === "reject" ? "elevated" : "text",
|
|
526
535
|
color: v.value,
|
|
527
536
|
onClick: T
|
|
528
537
|
}, {
|
|
529
538
|
default: d(() => [
|
|
530
539
|
s(C, {
|
|
531
|
-
translate:
|
|
532
|
-
content:
|
|
540
|
+
translate: b.value.translateText,
|
|
541
|
+
content: b.value.text
|
|
533
542
|
}, null, 8, ["translate", "content"])
|
|
534
543
|
]),
|
|
535
544
|
_: 1
|
|
536
545
|
}, 8, ["variant", "color"]),
|
|
537
546
|
s(l(A), {
|
|
538
|
-
variant:
|
|
547
|
+
variant: h.value === "confirm" ? "elevated" : "text",
|
|
539
548
|
color: v.value,
|
|
540
|
-
onClick:
|
|
549
|
+
onClick: V
|
|
541
550
|
}, {
|
|
542
551
|
default: d(() => [
|
|
543
552
|
s(C, {
|
|
544
|
-
translate:
|
|
545
|
-
content:
|
|
553
|
+
translate: R.value.translateText,
|
|
554
|
+
content: R.value.text
|
|
546
555
|
}, null, 8, ["translate", "content"])
|
|
547
556
|
]),
|
|
548
557
|
_: 1
|
|
@@ -558,22 +567,22 @@ const We = /* @__PURE__ */ E({
|
|
|
558
567
|
_: 1
|
|
559
568
|
}, 8, ["modelValue", "persistent", "max-width"]));
|
|
560
569
|
}
|
|
561
|
-
}),
|
|
562
|
-
function
|
|
570
|
+
}), Ze = /* @__PURE__ */ W(Xe, [["__scopeId", "data-v-3e8b3358"]]);
|
|
571
|
+
function Je(e) {
|
|
563
572
|
return e ? new Promise((a) => {
|
|
564
573
|
setTimeout(() => {
|
|
565
574
|
a();
|
|
566
575
|
}, e);
|
|
567
576
|
}) : Promise.resolve();
|
|
568
577
|
}
|
|
569
|
-
function
|
|
570
|
-
const { options: { loading: { delay: t, overlay: r } } } =
|
|
578
|
+
function et(e, a = {}) {
|
|
579
|
+
const { options: { loading: { delay: t, overlay: r } } } = j(), o = E(!1), u = _e();
|
|
571
580
|
async function c(...n) {
|
|
572
581
|
o.value = !0, r && (u.value = !0);
|
|
573
582
|
try {
|
|
574
583
|
const [i] = await Promise.all([
|
|
575
584
|
e(...n),
|
|
576
|
-
|
|
585
|
+
Je(t)
|
|
577
586
|
]);
|
|
578
587
|
return i;
|
|
579
588
|
} catch (i) {
|
|
@@ -582,60 +591,60 @@ function Xe(e, a = {}) {
|
|
|
582
591
|
o.value = !1, r && (u.value = !1);
|
|
583
592
|
}
|
|
584
593
|
}
|
|
585
|
-
return { loading:
|
|
594
|
+
return { loading: Z(o), action: c };
|
|
586
595
|
}
|
|
587
|
-
const
|
|
596
|
+
const tt = /* @__PURE__ */ k({
|
|
588
597
|
__name: "FormDialog",
|
|
589
598
|
props: {
|
|
590
599
|
data: {}
|
|
591
600
|
},
|
|
592
601
|
emits: ["resolve", "reject"],
|
|
593
602
|
setup(e, { emit: a }) {
|
|
594
|
-
const t = e, r = a, o =
|
|
603
|
+
const t = e, r = a, o = H(t.data.saveCta, "save"), u = H(t.data.abortCta, "cancel"), c = De("formComponent"), n = E(!0), i = Ee(), { loading: f, action: _ } = et(v), D = y(() => ({
|
|
595
604
|
global: {
|
|
596
605
|
disabled: f.value
|
|
597
606
|
}
|
|
598
607
|
}));
|
|
599
|
-
let
|
|
600
|
-
function
|
|
608
|
+
let R = null;
|
|
609
|
+
function b() {
|
|
601
610
|
return t.data.props ?? {};
|
|
602
611
|
}
|
|
603
|
-
async function
|
|
612
|
+
async function h() {
|
|
604
613
|
await i.value.$validate() && await _();
|
|
605
614
|
}
|
|
606
615
|
async function v() {
|
|
607
616
|
if (!c.value)
|
|
608
617
|
throw new Error("Form component not mounted");
|
|
609
|
-
const
|
|
610
|
-
typeof t.data.action == "function" ?
|
|
618
|
+
const I = await c.value.finish();
|
|
619
|
+
typeof t.data.action == "function" ? R = await t.data.action(I) : R = I;
|
|
611
620
|
}
|
|
612
621
|
function T() {
|
|
613
622
|
n.value = !1;
|
|
614
623
|
}
|
|
615
|
-
function
|
|
616
|
-
if (t.data.rejectOnEmpty &&
|
|
624
|
+
function V() {
|
|
625
|
+
if (t.data.rejectOnEmpty && R === null) {
|
|
617
626
|
r("reject");
|
|
618
627
|
return;
|
|
619
628
|
}
|
|
620
|
-
r("resolve",
|
|
629
|
+
r("resolve", R);
|
|
621
630
|
}
|
|
622
|
-
return (
|
|
631
|
+
return (I, w) => (m(), p(l(K), {
|
|
623
632
|
modelValue: n.value,
|
|
624
|
-
"onUpdate:modelValue":
|
|
625
|
-
onAfterLeave:
|
|
633
|
+
"onUpdate:modelValue": w[0] || (w[0] = (O) => n.value = O),
|
|
634
|
+
onAfterLeave: V,
|
|
626
635
|
"max-width": "1200",
|
|
627
636
|
scrollable: ""
|
|
628
637
|
}, {
|
|
629
638
|
default: d(() => [
|
|
630
|
-
s(l(
|
|
639
|
+
s(l(z), null, {
|
|
631
640
|
default: d(() => [
|
|
632
|
-
s(l(
|
|
641
|
+
s(l(ce), { color: "primary" }, {
|
|
633
642
|
default: d(() => [
|
|
634
|
-
s(l(
|
|
643
|
+
s(l(ie), null, {
|
|
635
644
|
default: d(() => [
|
|
636
645
|
s(C, {
|
|
637
|
-
content:
|
|
638
|
-
translate: !!
|
|
646
|
+
content: I.data.title,
|
|
647
|
+
translate: !!I.data.translateTitle
|
|
639
648
|
}, null, 8, ["content", "translate"])
|
|
640
649
|
]),
|
|
641
650
|
_: 1
|
|
@@ -648,18 +657,18 @@ const Ze = /* @__PURE__ */ E({
|
|
|
648
657
|
]),
|
|
649
658
|
_: 1
|
|
650
659
|
}),
|
|
651
|
-
s(l(he), { defaults:
|
|
660
|
+
s(l(he), { defaults: D.value }, {
|
|
652
661
|
default: d(() => [
|
|
653
|
-
(m(), p(F(
|
|
662
|
+
(m(), p(F(I.data.component), $({
|
|
654
663
|
ref_key: "formComponent",
|
|
655
664
|
ref: c,
|
|
656
|
-
onSave:
|
|
657
|
-
},
|
|
665
|
+
onSave: h
|
|
666
|
+
}, b()), null, 16))
|
|
658
667
|
]),
|
|
659
668
|
_: 1
|
|
660
669
|
}, 8, ["defaults"]),
|
|
661
|
-
s(l(
|
|
662
|
-
s(l(
|
|
670
|
+
s(l(de)),
|
|
671
|
+
s(l(q), null, {
|
|
663
672
|
default: d(() => [
|
|
664
673
|
s(l(B)),
|
|
665
674
|
s(l(A), {
|
|
@@ -675,7 +684,7 @@ const Ze = /* @__PURE__ */ E({
|
|
|
675
684
|
_: 1
|
|
676
685
|
}),
|
|
677
686
|
s(l(A), {
|
|
678
|
-
onClick:
|
|
687
|
+
onClick: h,
|
|
679
688
|
variant: "elevated",
|
|
680
689
|
color: "primary"
|
|
681
690
|
}, {
|
|
@@ -698,8 +707,8 @@ const Ze = /* @__PURE__ */ E({
|
|
|
698
707
|
}, 8, ["modelValue"]));
|
|
699
708
|
}
|
|
700
709
|
});
|
|
701
|
-
function
|
|
702
|
-
const e =
|
|
710
|
+
function mt() {
|
|
711
|
+
const e = pe();
|
|
703
712
|
function a(u, c) {
|
|
704
713
|
let n;
|
|
705
714
|
return typeof u == "string" ? n = {
|
|
@@ -707,7 +716,7 @@ function it() {
|
|
|
707
716
|
content: c ?? ""
|
|
708
717
|
} : n = u, new Promise((i) => {
|
|
709
718
|
const f = {
|
|
710
|
-
component:
|
|
719
|
+
component: He,
|
|
711
720
|
props: { data: n },
|
|
712
721
|
resolve: i,
|
|
713
722
|
reject: () => {
|
|
@@ -720,7 +729,7 @@ function it() {
|
|
|
720
729
|
function t(u) {
|
|
721
730
|
return new Promise((c, n) => {
|
|
722
731
|
const i = {
|
|
723
|
-
component:
|
|
732
|
+
component: ze,
|
|
724
733
|
props: { data: u },
|
|
725
734
|
resolve: c,
|
|
726
735
|
reject: n
|
|
@@ -735,19 +744,19 @@ function it() {
|
|
|
735
744
|
content: c,
|
|
736
745
|
level: n
|
|
737
746
|
}), new Promise((f, _) => {
|
|
738
|
-
const
|
|
739
|
-
component:
|
|
747
|
+
const D = {
|
|
748
|
+
component: Ze,
|
|
740
749
|
props: { data: i },
|
|
741
750
|
resolve: f,
|
|
742
751
|
reject: _
|
|
743
752
|
};
|
|
744
|
-
e.addToQueue(
|
|
753
|
+
e.addToQueue(D);
|
|
745
754
|
});
|
|
746
755
|
}
|
|
747
756
|
function o(u) {
|
|
748
757
|
return new Promise((c, n) => {
|
|
749
758
|
const i = {
|
|
750
|
-
component:
|
|
759
|
+
component: tt,
|
|
751
760
|
props: { data: u },
|
|
752
761
|
resolve: c,
|
|
753
762
|
reject: n
|
|
@@ -762,9 +771,9 @@ function it() {
|
|
|
762
771
|
form: o
|
|
763
772
|
};
|
|
764
773
|
}
|
|
765
|
-
var
|
|
766
|
-
function
|
|
767
|
-
const e =
|
|
774
|
+
var nt = /* @__PURE__ */ ((e) => (e.DEFAULT = "primary", e.WARNING = "warning", e.DANGER = "error", e))(nt || {});
|
|
775
|
+
function ft() {
|
|
776
|
+
const e = ee(), { options: { toast: { timeout: a } } } = j();
|
|
768
777
|
function t(c, n) {
|
|
769
778
|
return new Promise((i) => {
|
|
770
779
|
e.addToQueue({
|
|
@@ -772,7 +781,7 @@ function dt() {
|
|
|
772
781
|
resolve: i,
|
|
773
782
|
timeout: (n == null ? void 0 : n.timeout) ?? a,
|
|
774
783
|
translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
|
|
775
|
-
type:
|
|
784
|
+
type: x.INFO
|
|
776
785
|
});
|
|
777
786
|
});
|
|
778
787
|
}
|
|
@@ -783,7 +792,7 @@ function dt() {
|
|
|
783
792
|
resolve: i,
|
|
784
793
|
timeout: (n == null ? void 0 : n.timeout) ?? a,
|
|
785
794
|
translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
|
|
786
|
-
type:
|
|
795
|
+
type: x.WARNING
|
|
787
796
|
});
|
|
788
797
|
});
|
|
789
798
|
}
|
|
@@ -794,7 +803,7 @@ function dt() {
|
|
|
794
803
|
resolve: i,
|
|
795
804
|
timeout: (n == null ? void 0 : n.timeout) ?? a,
|
|
796
805
|
translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
|
|
797
|
-
type:
|
|
806
|
+
type: x.ERROR
|
|
798
807
|
});
|
|
799
808
|
});
|
|
800
809
|
}
|
|
@@ -805,7 +814,7 @@ function dt() {
|
|
|
805
814
|
resolve: i,
|
|
806
815
|
timeout: (n == null ? void 0 : n.timeout) ?? a,
|
|
807
816
|
translateMessage: (n == null ? void 0 : n.translateMessage) ?? !0,
|
|
808
|
-
type:
|
|
817
|
+
type: x.SUCCESS
|
|
809
818
|
});
|
|
810
819
|
});
|
|
811
820
|
}
|
|
@@ -816,7 +825,7 @@ function dt() {
|
|
|
816
825
|
success: u
|
|
817
826
|
};
|
|
818
827
|
}
|
|
819
|
-
const
|
|
828
|
+
const at = () => ({
|
|
820
829
|
loading: {
|
|
821
830
|
delay: 2e3,
|
|
822
831
|
overlay: !1
|
|
@@ -831,34 +840,30 @@ const et = () => ({
|
|
|
831
840
|
cancel: "action.cancel",
|
|
832
841
|
close: "action.close",
|
|
833
842
|
save: "action.save"
|
|
834
|
-
},
|
|
835
|
-
validation: {
|
|
836
|
-
prefix: "validation",
|
|
837
|
-
transform: "none"
|
|
838
843
|
}
|
|
839
844
|
}
|
|
840
845
|
});
|
|
841
|
-
function
|
|
842
|
-
const a =
|
|
846
|
+
function ot(e) {
|
|
847
|
+
const a = E([]), t = E([]);
|
|
843
848
|
return {
|
|
844
849
|
dialogQueue: a,
|
|
845
850
|
toastQueue: t,
|
|
846
851
|
options: e
|
|
847
852
|
};
|
|
848
853
|
}
|
|
849
|
-
function
|
|
854
|
+
function vt(e) {
|
|
850
855
|
return (a) => {
|
|
851
|
-
const t =
|
|
856
|
+
const t = at(), r = Q(t, e), o = ot(r);
|
|
852
857
|
a.__SCHWARZDAVID_UIKIT_SYMBOL__ = Symbol("@schwarzdavid/ui-kit"), a.provide(a.__SCHWARZDAVID_UIKIT_SYMBOL__, o);
|
|
853
858
|
};
|
|
854
859
|
}
|
|
855
860
|
export {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
861
|
+
nt as ConfirmDialogLevel,
|
|
862
|
+
L as PromptDialogSize,
|
|
863
|
+
dt as UiKitOutlet,
|
|
864
|
+
vt as createUIKit,
|
|
865
|
+
mt as useDialog,
|
|
866
|
+
et as useLoading,
|
|
867
|
+
_e as useLoadingOverlay,
|
|
868
|
+
ft as useToast
|
|
864
869
|
};
|
package/dist/validators.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ComputedRef } from 'vue';
|
|
2
|
+
import { PartialDeep } from 'type-fest';
|
|
2
3
|
import { Ref } from 'vue';
|
|
4
|
+
import { TranslationFunction } from '@vuelidate/validators';
|
|
3
5
|
import { Validation } from '@vuelidate/core';
|
|
4
6
|
import { ValidationArgs } from '@vuelidate/core';
|
|
5
7
|
import { ValidationRuleWithoutParams } from '@vuelidate/core';
|
|
@@ -55,6 +57,8 @@ equalTo: E;
|
|
|
55
57
|
otherName: string;
|
|
56
58
|
}>;
|
|
57
59
|
|
|
60
|
+
export declare function setGlobalValidationSettings(opt: PartialDeep<ValidationOptions>): void;
|
|
61
|
+
|
|
58
62
|
export declare const url: ValidationRuleWithoutParams<any>;
|
|
59
63
|
|
|
60
64
|
export declare const useVuelidateErrors: <T extends object>(validation: Ref<Validation<ValidationArgs<T>, T>>) => ComputedRef<ValidationErrors<T>>;
|
|
@@ -63,4 +67,20 @@ export declare type ValidationErrors<T extends object> = {
|
|
|
63
67
|
[key in keyof T]: T[key] extends object ? ValidationErrors<T[key]> : string[];
|
|
64
68
|
};
|
|
65
69
|
|
|
70
|
+
export declare type ValidationMessageOptions = ValidationTranslationFn | ValidationTranslationTransformOptions;
|
|
71
|
+
|
|
72
|
+
export declare interface ValidationOptions {
|
|
73
|
+
t: typeof TranslationFunction;
|
|
74
|
+
message: ValidationMessageOptions;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export declare type ValidationTranslationFn = (validatorName: string) => string;
|
|
78
|
+
|
|
79
|
+
export declare type ValidationTranslationTransform = 'snake_case' | 'camelCase' | 'PascalCase' | 'kebab-case' | 'none';
|
|
80
|
+
|
|
81
|
+
export declare interface ValidationTranslationTransformOptions {
|
|
82
|
+
prefix: string;
|
|
83
|
+
transform: ValidationTranslationTransform;
|
|
84
|
+
}
|
|
85
|
+
|
|
66
86
|
export { }
|
package/dist/validators.js
CHANGED
|
@@ -1,77 +1,89 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { helpers as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as t from "@vuelidate/validators";
|
|
2
|
+
import { helpers as u } from "@vuelidate/validators";
|
|
3
|
+
import { clone as h, upperFirst as g, camelCase as c, snakeCase as d, kebabCase as p, assign as w } from "lodash";
|
|
4
|
+
import { computed as A, unref as b } from "vue";
|
|
5
|
+
const m = {
|
|
6
|
+
transform: "none",
|
|
7
|
+
prefix: "validation"
|
|
8
|
+
};
|
|
9
|
+
let o = null, a = h(m);
|
|
10
|
+
const n = t.createI18nMessage({
|
|
8
11
|
t: (...e) => {
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
if (!o)
|
|
13
|
+
throw new Error("No translation function provided");
|
|
14
|
+
return o(...e);
|
|
11
15
|
},
|
|
12
16
|
messagePath(e) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
try {
|
|
18
|
+
if (typeof a == "function")
|
|
19
|
+
return a(e.$validator);
|
|
20
|
+
const r = V(e.$validator, a.transform);
|
|
21
|
+
return `${a.prefix}.${r}`;
|
|
22
|
+
} catch (r) {
|
|
23
|
+
return console.log("Error while transforming validator: ", r), "yolo";
|
|
24
|
+
}
|
|
18
25
|
}
|
|
19
26
|
});
|
|
20
|
-
function
|
|
21
|
-
switch (
|
|
27
|
+
function V(e, r) {
|
|
28
|
+
switch (r) {
|
|
22
29
|
case "camelCase":
|
|
23
|
-
return
|
|
30
|
+
return c(e);
|
|
24
31
|
case "kebab-case":
|
|
25
|
-
return h(e);
|
|
26
|
-
case "snake_case":
|
|
27
32
|
return p(e);
|
|
33
|
+
case "snake_case":
|
|
34
|
+
return d(e);
|
|
28
35
|
case "PascalCase":
|
|
29
|
-
return
|
|
36
|
+
return g(c(e));
|
|
30
37
|
default:
|
|
31
38
|
return e;
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
|
-
const
|
|
41
|
+
const E = n(t.required), C = n(t.requiredIf, { withArguments: !0 }), I = n(t.requiredUnless, { withArguments: !0 }), L = n(t.minLength, { withArguments: !0 }), N = n(t.maxLength, { withArguments: !0 }), P = n(t.minValue, { withArguments: !0 }), T = n(t.maxValue, { withArguments: !0 }), U = n(t.between, { withArguments: !0 }), W = n(t.alpha), B = n(t.alphaNum), F = n(t.numeric), M = n(t.integer), S = n(t.decimal), _ = n(t.email), D = n(t.ipAddress), G = n(t.macAddress), R = n(t.sameAs, { withArguments: !0 }), k = n(t.url), z = n((e) => u.withParams({
|
|
35
42
|
type: "oneOf",
|
|
36
43
|
values: e
|
|
37
|
-
}, (
|
|
44
|
+
}, (r) => {
|
|
38
45
|
const s = Array.isArray(e) ? e : Object.values(e);
|
|
39
|
-
return !
|
|
40
|
-
}), { withArguments: !0 })
|
|
41
|
-
function
|
|
42
|
-
|
|
46
|
+
return !u.req(r) || s.includes(r);
|
|
47
|
+
}), { withArguments: !0 });
|
|
48
|
+
function H(e) {
|
|
49
|
+
e.t && (o = e.t), typeof e.message == "function" ? a = e.message : a = w({}, m, e.message);
|
|
50
|
+
}
|
|
51
|
+
const J = (e) => A(() => l(e.value));
|
|
52
|
+
function l(e) {
|
|
53
|
+
return Object.entries(e).map(([r, s]) => r.startsWith("$") ? [r, null] : O(s) ? [r, j(s)] : $(s) ? [r, l(s)] : (console.warn("Unknown validation type.", r, s), [r, null])).reduce((r, [s, i]) => (i && (r[s] = i), r), {});
|
|
43
54
|
}
|
|
44
|
-
function
|
|
45
|
-
return typeof e != "object" || e === null ? !1 : Object.hasOwn(e, "$model") && Object.entries(e).filter(([
|
|
55
|
+
function O(e) {
|
|
56
|
+
return typeof e != "object" || e === null ? !1 : Object.hasOwn(e, "$model") && Object.entries(e).filter(([r]) => !r.startsWith("$")).every(([, r]) => f(r));
|
|
46
57
|
}
|
|
47
|
-
function
|
|
48
|
-
return typeof e != "object" || e === null ? !1 : Object.entries(e).filter(([
|
|
58
|
+
function $(e) {
|
|
59
|
+
return typeof e != "object" || e === null ? !1 : Object.entries(e).filter(([r]) => !r.startsWith("$")).some(([, r]) => !f(r));
|
|
49
60
|
}
|
|
50
|
-
function
|
|
61
|
+
function f(e) {
|
|
51
62
|
return typeof e == "object" && e !== null && Object.hasOwn(e, "$params");
|
|
52
63
|
}
|
|
53
|
-
function
|
|
54
|
-
return e.$errors.map((
|
|
64
|
+
function j(e) {
|
|
65
|
+
return e.$errors.map((r) => b(r.$message));
|
|
55
66
|
}
|
|
56
67
|
export {
|
|
57
68
|
W as alpha,
|
|
58
69
|
B as alphaNum,
|
|
59
70
|
U as between,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
S as decimal,
|
|
72
|
+
_ as email,
|
|
73
|
+
M as integer,
|
|
74
|
+
D as ipAddress,
|
|
75
|
+
G as maxAddress,
|
|
76
|
+
N as maxLength,
|
|
77
|
+
T as maxValue,
|
|
67
78
|
L as minLength,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
P as minValue,
|
|
80
|
+
F as numeric,
|
|
81
|
+
z as oneOf,
|
|
82
|
+
E as required,
|
|
83
|
+
C as requiredIf,
|
|
73
84
|
I as requiredUnless,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
R as sameAs,
|
|
86
|
+
H as setGlobalValidationSettings,
|
|
87
|
+
k as url,
|
|
88
|
+
J as useVuelidateErrors
|
|
77
89
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { getCurrentInstance as r, inject as _ } from "vue";
|
|
2
|
-
var e = /* @__PURE__ */ ((t) => (t.NOT_INSTALLED = "Need to install with `app.use` function", t.UNEXPECTED_ERROR = "Unexpected error", t))(e || {});
|
|
3
|
-
function E() {
|
|
4
|
-
const t = r();
|
|
5
|
-
if (!(t != null && t.appContext.app.__SCHWARZDAVID_UIKIT_SYMBOL__))
|
|
6
|
-
throw new Error(e.NOT_INSTALLED);
|
|
7
|
-
const o = t.appContext.app.__SCHWARZDAVID_UIKIT_SYMBOL__, n = _(o);
|
|
8
|
-
if (!n)
|
|
9
|
-
throw new Error(e.UNEXPECTED_ERROR);
|
|
10
|
-
return n;
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
E as u
|
|
14
|
-
};
|