@signal24/vue-foundation 4.7.1 → 4.7.3
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.
|
@@ -35,6 +35,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
35
35
|
disabled: PropType<boolean>;
|
|
36
36
|
optionsListId: PropType<string>;
|
|
37
37
|
debug: PropType<boolean>;
|
|
38
|
+
required: PropType<boolean>;
|
|
38
39
|
}, unknown, {
|
|
39
40
|
isLoading: boolean;
|
|
40
41
|
isLoaded: boolean;
|
|
@@ -64,7 +65,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
64
65
|
effectiveOptions(): OptionDescriptor[];
|
|
65
66
|
}, {
|
|
66
67
|
loadRemoteOptions(): Promise<void>;
|
|
67
|
-
handleSourceUpdate(): Promise<void> | undefined;
|
|
68
68
|
reloadOptions(): Promise<void>;
|
|
69
69
|
reloadOptionsIfSearching(): void;
|
|
70
70
|
handleKeyDown(e: KeyboardEvent): void;
|
|
@@ -83,7 +83,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
83
83
|
addRemoteOption(option: GenericObject): void;
|
|
84
84
|
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
85
85
|
optionsLoaded: (options: any[]) => void;
|
|
86
|
-
createItem: (searchText: string) => void;
|
|
87
86
|
'update:modelValue': (value: any) => void;
|
|
88
87
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
89
88
|
modelValue: {
|
|
@@ -111,10 +110,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
111
110
|
disabled: PropType<boolean>;
|
|
112
111
|
optionsListId: PropType<string>;
|
|
113
112
|
debug: PropType<boolean>;
|
|
113
|
+
required: PropType<boolean>;
|
|
114
114
|
}>> & {
|
|
115
115
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
116
116
|
onOptionsLoaded?: ((options: any[]) => any) | undefined;
|
|
117
|
-
onCreateItem?: ((searchText: string) => any) | undefined;
|
|
118
117
|
}, {
|
|
119
118
|
modelValue: any;
|
|
120
119
|
}, {}>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var Ve = Object.defineProperty;
|
|
2
2
|
var Fe = (e, t, n) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var v = (e, t, n) => (Fe(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { compact as Xe, debounce as Ye, isEqual as
|
|
4
|
+
import { defineComponent as C, defineProps as Ne, defineEmits as Re, ref as w, computed as V, openBlock as u, createElementBlock as f, createElementVNode as O, toDisplayString as x, withDirectives as U, createCommentVNode as T, Fragment as j, renderList as J, vModelSelect as Ke, getCurrentInstance as ee, onMounted as L, normalizeClass as k, normalizeStyle as Ue, withModifiers as te, renderSlot as K, reactive as je, h as W, Teleport as We, markRaw as Pe, onBeforeUnmount as ne, resolveDirective as Te, createBlock as ke, createSlots as qe, withCtx as Y, createTextVNode as ae, vModelText as ze, watch as ce, onActivated as Se, onDeactivated as Ce } from "vue";
|
|
5
|
+
import { compact as Xe, debounce as Ye, isEqual as xe, upperFirst as Ze, startCase as Ge, cloneDeep as Qe, remove as Je } from "lodash";
|
|
6
6
|
import { escapeHtml as et } from "@vue/shared";
|
|
7
|
-
import { escapeHtml as
|
|
7
|
+
import { escapeHtml as si } from "@vue/shared";
|
|
8
8
|
import { format as G } from "date-fns";
|
|
9
|
-
const tt =
|
|
9
|
+
const tt = C({
|
|
10
10
|
setup() {
|
|
11
11
|
const e = Ne();
|
|
12
12
|
Re(["update:modelValue"]);
|
|
13
|
-
const t = w(null), n = V(() => t.value ? t.value.map((o) => e.preprocesor ? e.preprocesor(o) : o[e.displayKey ?? ""]) : null),
|
|
14
|
-
return { props: e, options: t, renderOptions: n, selectedItem:
|
|
13
|
+
const t = w(null), n = V(() => t.value ? t.value.map((o) => e.preprocesor ? e.preprocesor(o) : o[e.displayKey ?? ""]) : null), i = w(e.modelValue ?? null);
|
|
14
|
+
return { props: e, options: t, renderOptions: n, selectedItem: i };
|
|
15
15
|
},
|
|
16
16
|
watch: {
|
|
17
17
|
loadFn() {
|
|
@@ -34,47 +34,47 @@ const tt = x({
|
|
|
34
34
|
}
|
|
35
35
|
}), Le = (e, t) => {
|
|
36
36
|
const n = e.__vccOpts || e;
|
|
37
|
-
for (const [
|
|
38
|
-
n[
|
|
37
|
+
for (const [i, s] of t)
|
|
38
|
+
n[i] = s;
|
|
39
39
|
return n;
|
|
40
40
|
}, nt = {
|
|
41
41
|
key: 0,
|
|
42
42
|
disabled: ""
|
|
43
|
-
},
|
|
43
|
+
}, it = {
|
|
44
44
|
key: 0,
|
|
45
45
|
value: null
|
|
46
|
-
},
|
|
47
|
-
function ot(e, t, n,
|
|
46
|
+
}, st = ["value"];
|
|
47
|
+
function ot(e, t, n, i, s, o) {
|
|
48
48
|
return e.renderOptions ? U((u(), f("select", {
|
|
49
49
|
key: 1,
|
|
50
50
|
"onUpdate:modelValue": t[0] || (t[0] = (r) => e.selectedItem = r)
|
|
51
51
|
}, [
|
|
52
|
-
e.props.nullText ? (u(), f("option",
|
|
52
|
+
e.props.nullText ? (u(), f("option", it, x(e.props.nullText), 1)) : T("", !0),
|
|
53
53
|
(u(!0), f(j, null, J(e.renderOptions, (r, l) => {
|
|
54
54
|
var c;
|
|
55
55
|
return u(), f("option", {
|
|
56
56
|
key: l,
|
|
57
57
|
value: (c = e.options) == null ? void 0 : c[l]
|
|
58
|
-
},
|
|
58
|
+
}, x(r), 9, st);
|
|
59
59
|
}), 128))
|
|
60
60
|
], 512)), [
|
|
61
61
|
[Ke, e.selectedItem]
|
|
62
62
|
]) : (u(), f("select", nt, [
|
|
63
|
-
O("option", null,
|
|
63
|
+
O("option", null, x(e.props.loadingText || "Loading..."), 1)
|
|
64
64
|
]));
|
|
65
65
|
}
|
|
66
|
-
const Hn = /* @__PURE__ */ Le(tt, [["render", ot]]), lt = ["onClick"], rt = /* @__PURE__ */
|
|
66
|
+
const Hn = /* @__PURE__ */ Le(tt, [["render", ot]]), lt = ["onClick"], rt = /* @__PURE__ */ C({
|
|
67
67
|
__name: "overlay-anchor",
|
|
68
68
|
props: {
|
|
69
69
|
overlayId: {},
|
|
70
70
|
anchor: {}
|
|
71
71
|
},
|
|
72
72
|
setup(e) {
|
|
73
|
-
const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el,
|
|
73
|
+
const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, i = w({ visibility: "hidden", top: "0", left: "0" }), s = w([]), o = ee();
|
|
74
74
|
L(r);
|
|
75
75
|
function r() {
|
|
76
76
|
const h = o.vnode.el, { styles: b, classes: m } = l(h, n);
|
|
77
|
-
|
|
77
|
+
i.value = b, s.value = m;
|
|
78
78
|
}
|
|
79
79
|
function l(h, b) {
|
|
80
80
|
const m = t.anchor instanceof HTMLElement ? {} : t.anchor, y = b.getBoundingClientRect(), p = h.getBoundingClientRect();
|
|
@@ -111,8 +111,8 @@ const Hn = /* @__PURE__ */ Le(tt, [["render", ot]]), lt = ["onClick"], rt = /* @
|
|
|
111
111
|
window.addEventListener("click", c);
|
|
112
112
|
}, 10);
|
|
113
113
|
}), (h, b) => (u(), f("div", {
|
|
114
|
-
class: k(["vf-overlay-anchor",
|
|
115
|
-
style: Ue(
|
|
114
|
+
class: k(["vf-overlay-anchor", s.value]),
|
|
115
|
+
style: Ue(i.value),
|
|
116
116
|
onClick: te(c, ["stop"])
|
|
117
117
|
}, [
|
|
118
118
|
K(h.$slots, "default")
|
|
@@ -120,18 +120,18 @@ const Hn = /* @__PURE__ */ Le(tt, [["render", ot]]), lt = ["onClick"], rt = /* @
|
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
let at = 0;
|
|
123
|
-
const S = je([]), _n =
|
|
123
|
+
const S = je([]), _n = C({
|
|
124
124
|
setup() {
|
|
125
125
|
return () => W("div", [
|
|
126
126
|
J(S, (e) => W(We, { key: e.id, to: "#vf-overlay-target" }, [e.wrapperVnode ?? e.vnode]))
|
|
127
127
|
]);
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
|
-
function
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
id:
|
|
130
|
+
function ie(e, t, n) {
|
|
131
|
+
const i = document.getElementById("vf-overlay-target") ?? document.createElement("div");
|
|
132
|
+
i.id = "vf-overlay-target", i.removeAttribute("inert"), document.body.appendChild(i);
|
|
133
|
+
const s = String(++at), o = Pe(e), r = W(o, t), l = n != null && n.anchor ? W(rt, { overlayId: s, anchor: n.anchor }, () => [r]) : void 0, c = {
|
|
134
|
+
id: s,
|
|
135
135
|
component: o,
|
|
136
136
|
props: t,
|
|
137
137
|
options: n ?? {},
|
|
@@ -160,36 +160,36 @@ function P(e) {
|
|
|
160
160
|
const t = S.indexOf(e);
|
|
161
161
|
t >= 0 && S.splice(t, 1);
|
|
162
162
|
}
|
|
163
|
-
async function
|
|
164
|
-
return new Promise((
|
|
165
|
-
let
|
|
163
|
+
async function se(e, t, n) {
|
|
164
|
+
return new Promise((i) => {
|
|
165
|
+
let s = null;
|
|
166
166
|
const r = { ...t, callback: (l) => {
|
|
167
|
-
P(
|
|
167
|
+
P(s), i(l);
|
|
168
168
|
} };
|
|
169
|
-
|
|
169
|
+
s = ie(e, r, n);
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
function q(e, t) {
|
|
173
173
|
return { title: t ? e : void 0, message: t ?? e };
|
|
174
174
|
}
|
|
175
175
|
async function de(e, t) {
|
|
176
|
-
await
|
|
176
|
+
await se(X, q(e, t));
|
|
177
177
|
}
|
|
178
178
|
async function $n(e, t) {
|
|
179
|
-
return await
|
|
179
|
+
return await se(X, {
|
|
180
180
|
...q(e, t),
|
|
181
181
|
shouldConfirm: !0
|
|
182
182
|
}) === !0;
|
|
183
183
|
}
|
|
184
184
|
async function An(e, t) {
|
|
185
|
-
return await
|
|
185
|
+
return await se(X, {
|
|
186
186
|
...q(e, t),
|
|
187
187
|
shouldConfirm: !0,
|
|
188
188
|
classes: ["destructive"]
|
|
189
189
|
}) === !0;
|
|
190
190
|
}
|
|
191
191
|
function Bn(e, t) {
|
|
192
|
-
const n =
|
|
192
|
+
const n = ie(X, {
|
|
193
193
|
...q(e, t),
|
|
194
194
|
isBare: !0,
|
|
195
195
|
classes: ["wait"],
|
|
@@ -231,8 +231,8 @@ async function Nn(e) {
|
|
|
231
231
|
}
|
|
232
232
|
const $ = Symbol("MaskState");
|
|
233
233
|
function Rn(e, t) {
|
|
234
|
-
const n = e.$.vnode.el,
|
|
235
|
-
return ht(
|
|
234
|
+
const n = e.$.vnode.el, i = n.closest(".vf-modal");
|
|
235
|
+
return ht(i ?? n, t);
|
|
236
236
|
}
|
|
237
237
|
function Kn(e) {
|
|
238
238
|
const t = e.$.vnode.el, n = t.closest(".vf-modal");
|
|
@@ -250,20 +250,21 @@ function Ie(e) {
|
|
|
250
250
|
}
|
|
251
251
|
const Q = Symbol("FormMaskState");
|
|
252
252
|
function ft(e, t, n) {
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
253
|
+
const i = e instanceof Element ? e : _e(e);
|
|
254
|
+
i.classList.add("vf-masked");
|
|
255
|
+
const s = t instanceof Element ? t : i.querySelectorAll(t ?? 'button:not([disabled]):not([type="button"])')[0];
|
|
256
|
+
let o;
|
|
257
|
+
s && (o = s.tagName === "INPUT" ? s.value : s.innerHTML, s.setAttribute("disabled", "disabled"), s.innerText = n ?? "Please wait...");
|
|
258
|
+
const l = [...i.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
|
|
259
|
+
return l.forEach((c) => c.setAttribute("disabled", "disabled")), i[Q] = {
|
|
259
260
|
disabledElements: l,
|
|
260
|
-
waitButton:
|
|
261
|
+
waitButton: s,
|
|
261
262
|
buttonHtml: o
|
|
262
|
-
}, () => He(
|
|
263
|
+
}, () => He(i);
|
|
263
264
|
}
|
|
264
265
|
function He(e) {
|
|
265
266
|
const t = e instanceof Element ? e : _e(e), n = t[Q];
|
|
266
|
-
n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((
|
|
267
|
+
n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((i) => i.removeAttribute("disabled")), n.waitButton && (n.waitButton.innerHTML = n.buttonHtml, n.waitButton.removeAttribute("disabled")), delete t[Q]);
|
|
267
268
|
}
|
|
268
269
|
function _e(e) {
|
|
269
270
|
const t = e.$.vnode.el;
|
|
@@ -275,7 +276,7 @@ const pt = ["id"], mt = {
|
|
|
275
276
|
}, vt = { class: "vf-modal-content" }, yt = {
|
|
276
277
|
key: 1,
|
|
277
278
|
class: "vf-modal-footer"
|
|
278
|
-
}, gt = /* @__PURE__ */
|
|
279
|
+
}, gt = /* @__PURE__ */ C({
|
|
279
280
|
__name: "modal",
|
|
280
281
|
props: {
|
|
281
282
|
id: {},
|
|
@@ -286,26 +287,26 @@ const pt = ["id"], mt = {
|
|
|
286
287
|
},
|
|
287
288
|
emits: ["formSubmit"],
|
|
288
289
|
setup(e, { expose: t }) {
|
|
289
|
-
const n = e,
|
|
290
|
+
const n = e, i = ee();
|
|
290
291
|
t({ mask: m, unmask: y, hide: p, unhide: a });
|
|
291
|
-
const
|
|
292
|
+
const s = w(), o = w(), r = w(!1), l = V(() => Xe([n.class, r.value && "hidden"]));
|
|
292
293
|
L(() => {
|
|
293
294
|
var d;
|
|
294
|
-
document.body.classList.add("vf-modal-open"), n.closeOnMaskClick && (window.addEventListener("keydown", h), (d =
|
|
295
|
+
document.body.classList.add("vf-modal-open"), n.closeOnMaskClick && (window.addEventListener("keydown", h), (d = s.value) == null || d.addEventListener("click", c));
|
|
295
296
|
}), ne(() => {
|
|
296
297
|
window.removeEventListener("keydown", h), document.body.querySelectorAll(".vf-modal").length > 0 || document.body.classList.remove("vf-modal-open");
|
|
297
298
|
});
|
|
298
299
|
function c(d) {
|
|
299
|
-
d.target ==
|
|
300
|
+
d.target == s.value && b();
|
|
300
301
|
}
|
|
301
302
|
function h(d) {
|
|
302
303
|
if (d.key === "Esc" || d.key === "Escape") {
|
|
303
304
|
const E = document.querySelectorAll(".vf-modal-wrap");
|
|
304
|
-
E[E.length - 1] ===
|
|
305
|
+
E[E.length - 1] === s.value && b();
|
|
305
306
|
}
|
|
306
307
|
}
|
|
307
308
|
function b() {
|
|
308
|
-
Me(
|
|
309
|
+
Me(i);
|
|
309
310
|
}
|
|
310
311
|
function m() {
|
|
311
312
|
ft(o.value);
|
|
@@ -323,7 +324,7 @@ const pt = ["id"], mt = {
|
|
|
323
324
|
id: d.id,
|
|
324
325
|
class: k(["vf-overlay vf-modal-wrap", l.value]),
|
|
325
326
|
ref_key: "overlay",
|
|
326
|
-
ref:
|
|
327
|
+
ref: s
|
|
327
328
|
}, [
|
|
328
329
|
O("form", {
|
|
329
330
|
action: ".",
|
|
@@ -350,7 +351,7 @@ const pt = ["id"], mt = {
|
|
|
350
351
|
], 10, pt));
|
|
351
352
|
}
|
|
352
353
|
});
|
|
353
|
-
const bt = ["innerHtml"], Et = ["innerText"], X = /* @__PURE__ */
|
|
354
|
+
const bt = ["innerHtml"], Et = ["innerText"], X = /* @__PURE__ */ C({
|
|
354
355
|
__name: "alert-modal",
|
|
355
356
|
props: {
|
|
356
357
|
isBare: { type: Boolean },
|
|
@@ -363,15 +364,15 @@ const bt = ["innerHtml"], Et = ["innerText"], X = /* @__PURE__ */ x({
|
|
|
363
364
|
},
|
|
364
365
|
setup(e) {
|
|
365
366
|
const t = e, n = V(() => t.message instanceof Error ? ut(t.message) : t.message);
|
|
366
|
-
return (
|
|
367
|
+
return (i, s) => {
|
|
367
368
|
const o = Te("autofocus");
|
|
368
369
|
return u(), ke(gt, {
|
|
369
|
-
class: k(["vf-alert",
|
|
370
|
+
class: k(["vf-alert", i.classes])
|
|
370
371
|
}, qe({
|
|
371
372
|
default: Y(() => [
|
|
372
|
-
|
|
373
|
+
i.isHtml ? (u(), f("div", {
|
|
373
374
|
key: 0,
|
|
374
|
-
innerHtml:
|
|
375
|
+
innerHtml: i.message,
|
|
375
376
|
class: "user-message"
|
|
376
377
|
}, null, 8, bt)) : (u(), f("div", {
|
|
377
378
|
key: 1,
|
|
@@ -380,20 +381,20 @@ const bt = ["innerHtml"], Et = ["innerText"], X = /* @__PURE__ */ x({
|
|
|
380
381
|
]),
|
|
381
382
|
_: 2
|
|
382
383
|
}, [
|
|
383
|
-
|
|
384
|
+
i.title ? {
|
|
384
385
|
name: "header",
|
|
385
386
|
fn: Y(() => [
|
|
386
|
-
O("h1", null,
|
|
387
|
+
O("h1", null, x(i.title), 1)
|
|
387
388
|
]),
|
|
388
389
|
key: "0"
|
|
389
390
|
} : void 0,
|
|
390
|
-
|
|
391
|
+
i.isBare ? void 0 : {
|
|
391
392
|
name: "footer",
|
|
392
393
|
fn: Y(() => [
|
|
393
|
-
|
|
394
|
+
i.shouldConfirm ? (u(), f(j, { key: 0 }, [
|
|
394
395
|
U((u(), f("button", {
|
|
395
396
|
class: "primary",
|
|
396
|
-
onClick:
|
|
397
|
+
onClick: s[0] || (s[0] = () => i.callback(!0))
|
|
397
398
|
}, [
|
|
398
399
|
ae("Confirm")
|
|
399
400
|
])), [
|
|
@@ -401,12 +402,12 @@ const bt = ["innerHtml"], Et = ["innerText"], X = /* @__PURE__ */ x({
|
|
|
401
402
|
]),
|
|
402
403
|
O("button", {
|
|
403
404
|
class: "default",
|
|
404
|
-
onClick:
|
|
405
|
+
onClick: s[1] || (s[1] = () => i.callback(!1))
|
|
405
406
|
}, "Cancel")
|
|
406
407
|
], 64)) : U((u(), f("button", {
|
|
407
408
|
key: 1,
|
|
408
409
|
class: "default",
|
|
409
|
-
onClick:
|
|
410
|
+
onClick: s[2] || (s[2] = () => i.callback(!0))
|
|
410
411
|
}, [
|
|
411
412
|
ae("OK")
|
|
412
413
|
])), [
|
|
@@ -439,22 +440,22 @@ function St(e, t, n) {
|
|
|
439
440
|
if (ue.randomUUID && !t && !e)
|
|
440
441
|
return ue.randomUUID();
|
|
441
442
|
e = e || {};
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
443
|
+
const i = e.random || (e.rng || wt)();
|
|
444
|
+
if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, t) {
|
|
444
445
|
n = n || 0;
|
|
445
|
-
for (let
|
|
446
|
-
t[n +
|
|
446
|
+
for (let s = 0; s < 16; ++s)
|
|
447
|
+
t[n + s] = i[s];
|
|
447
448
|
return t;
|
|
448
449
|
}
|
|
449
|
-
return Tt(
|
|
450
|
+
return Tt(i);
|
|
450
451
|
}
|
|
451
452
|
function Un(e) {
|
|
452
453
|
return e.replace(/\n/g, "<br>");
|
|
453
454
|
}
|
|
454
|
-
function
|
|
455
|
+
function Ct(e) {
|
|
455
456
|
return e.replace(/_/g, " ");
|
|
456
457
|
}
|
|
457
|
-
function
|
|
458
|
+
function xt(e) {
|
|
458
459
|
const t = e.replace(/\D/g, "").replace(/^1/, "");
|
|
459
460
|
return t.length != 10 ? e : "(" + t.substring(0, 3) + ") " + t.substring(3, 6) + "-" + t.substring(6);
|
|
460
461
|
}
|
|
@@ -490,11 +491,11 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
490
491
|
noResultsText: String,
|
|
491
492
|
disabled: Boolean,
|
|
492
493
|
optionsListId: String,
|
|
493
|
-
debug: Boolean
|
|
494
|
+
debug: Boolean,
|
|
495
|
+
required: Boolean
|
|
494
496
|
},
|
|
495
497
|
emits: {
|
|
496
498
|
optionsLoaded: Object,
|
|
497
|
-
createItem: Object,
|
|
498
499
|
"update:modelValue": Object
|
|
499
500
|
},
|
|
500
501
|
data() {
|
|
@@ -542,14 +543,14 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
542
543
|
optionsDescriptors() {
|
|
543
544
|
return this.allOptions.map((e, t) => {
|
|
544
545
|
var l, c;
|
|
545
|
-
const n = this.formatter(e),
|
|
546
|
+
const n = this.formatter(e), i = (l = this.subtitleFormatter) == null ? void 0 : l.call(this, e), s = n ? n.trim().toLowerCase() : "", o = i ? i.trim().toLowerCase() : "", r = [];
|
|
546
547
|
return this.searchFields ? this.searchFields.forEach((h) => {
|
|
547
548
|
e[h] && r.push(String(e[h]).toLowerCase());
|
|
548
|
-
}) : (r.push(
|
|
549
|
+
}) : (r.push(s), o && r.push(o)), {
|
|
549
550
|
// eslint-disable-next-line vue/no-use-computed-property-like-method
|
|
550
551
|
key: ((c = this.effectiveKeyExtractor) == null ? void 0 : c.call(this, e)) ?? String(t),
|
|
551
552
|
title: n,
|
|
552
|
-
subtitle:
|
|
553
|
+
subtitle: i,
|
|
553
554
|
searchContent: r.join(""),
|
|
554
555
|
ref: e
|
|
555
556
|
};
|
|
@@ -560,14 +561,14 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
560
561
|
if (this.isSearching) {
|
|
561
562
|
const t = this.searchText.trim().toLowerCase();
|
|
562
563
|
if (t.length) {
|
|
563
|
-
e = e.filter((
|
|
564
|
-
const n = et(this.searchText).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"),
|
|
565
|
-
e = e.map((
|
|
564
|
+
e = e.filter((s) => s.searchContent.includes(t));
|
|
565
|
+
const n = et(this.searchText).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"), i = new RegExp(`(${n})`, "ig");
|
|
566
|
+
e = e.map((s) => {
|
|
566
567
|
var o;
|
|
567
568
|
return {
|
|
568
|
-
...
|
|
569
|
-
title:
|
|
570
|
-
subtitle: (o =
|
|
569
|
+
...s,
|
|
570
|
+
title: s.title.replace(i, "<mark>$1</mark>"),
|
|
571
|
+
subtitle: (o = s.subtitle) == null ? void 0 : o.replace(i, "<mark>$1</mark>")
|
|
571
572
|
};
|
|
572
573
|
}), this.shouldShowCreateOption && (e.find((o) => o.searchContent === t) !== void 0 || e.push({
|
|
573
574
|
key: he,
|
|
@@ -588,7 +589,7 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
588
589
|
this.handleValueChanged();
|
|
589
590
|
},
|
|
590
591
|
options() {
|
|
591
|
-
this.loadedOptions = this.options ?? [];
|
|
592
|
+
this.loadedOptions = this.options ?? [], this.isLoaded = !0;
|
|
592
593
|
},
|
|
593
594
|
// data
|
|
594
595
|
optionsDescriptors() {
|
|
@@ -606,7 +607,7 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
606
607
|
}
|
|
607
608
|
},
|
|
608
609
|
async mounted() {
|
|
609
|
-
this.shouldShowCreateOption = this
|
|
610
|
+
this.shouldShowCreateOption = this.onCreateItem !== void 0, this.options ? (this.loadedOptions = this.options, this.isLoaded = !0) : this.preload && await this.loadRemoteOptions(), this.handleValueChanged(), this.$watch("selectedOption", () => {
|
|
610
611
|
this.selectedOption !== this.modelValue && this.$emit(
|
|
611
612
|
"update:modelValue",
|
|
612
613
|
this.selectedOption && this.valueExtractor ? this.valueExtractor(this.selectedOption) : this.selectedOption
|
|
@@ -617,11 +618,6 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
617
618
|
async loadRemoteOptions() {
|
|
618
619
|
await this.reloadOptions(), this.loadedOptions && this.$emit("optionsLoaded", this.loadedOptions);
|
|
619
620
|
},
|
|
620
|
-
handleSourceUpdate() {
|
|
621
|
-
if (this.preload)
|
|
622
|
-
return this.reloadOptions();
|
|
623
|
-
this.isLoaded && (this.isLoaded = !1, this.loadedOptions = []);
|
|
624
|
-
},
|
|
625
621
|
async reloadOptions() {
|
|
626
622
|
var t;
|
|
627
623
|
const e = this.remoteSearch && this.isSearching && this.searchText ? this.searchText : null;
|
|
@@ -671,10 +667,10 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
671
667
|
return this.effectiveKeyExtractor ? this.effectiveKeyExtractor(this.selectedOption) : ((t = this.getOptionDescriptor(e)) == null ? void 0 : t.key) ?? "";
|
|
672
668
|
},
|
|
673
669
|
getOptionDescriptor(e) {
|
|
674
|
-
const t = this.effectiveOptions.find((
|
|
670
|
+
const t = this.effectiveOptions.find((i) => i.ref === e);
|
|
675
671
|
if (t)
|
|
676
672
|
return t;
|
|
677
|
-
const n = this.effectiveOptions.find((
|
|
673
|
+
const n = this.effectiveOptions.find((i) => xe(i.ref, e));
|
|
678
674
|
return n || null;
|
|
679
675
|
},
|
|
680
676
|
handleInputBlurred() {
|
|
@@ -684,19 +680,19 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
684
680
|
this.isLoaded || this.loadRemoteOptions(), this.optionsListId && this.$refs.optionsContainer.setAttribute("id", this.optionsListId), this.teleportOptionsContainer();
|
|
685
681
|
},
|
|
686
682
|
teleportOptionsContainer() {
|
|
687
|
-
const e = this.$el.getBoundingClientRect(), t = e.y + e.height + 2, n = e.x,
|
|
688
|
-
for (let o in
|
|
689
|
-
/^(font|text)/.test(o) && (
|
|
690
|
-
if (
|
|
683
|
+
const e = this.$el.getBoundingClientRect(), t = e.y + e.height + 2, n = e.x, i = this.$refs.optionsContainer, s = window.getComputedStyle(this.$el);
|
|
684
|
+
for (let o in s)
|
|
685
|
+
/^(font|text)/.test(o) && (i.style[o] = s[o]);
|
|
686
|
+
if (i.style.top = t + "px", i.style.left = n + "px", i.style.minWidth = e.width + "px", !s.maxHeight || s.maxHeight == "none") {
|
|
691
687
|
const o = window.innerHeight - t - 12;
|
|
692
|
-
|
|
688
|
+
i.style.maxHeight = o + "px";
|
|
693
689
|
}
|
|
694
|
-
|
|
690
|
+
i.style.visibility = "visible", document.body.appendChild(i), setTimeout(this.highlightInitialOption, 0);
|
|
695
691
|
},
|
|
696
692
|
highlightInitialOption() {
|
|
697
693
|
if (!this.isLoaded || !this.highlightedOptionKey)
|
|
698
694
|
return;
|
|
699
|
-
const e = this.effectiveOptions.findIndex((
|
|
695
|
+
const e = this.effectiveOptions.findIndex((i) => i.key == this.highlightedOptionKey), t = this.$refs.optionsContainer, n = t.querySelectorAll(".option")[e];
|
|
700
696
|
t.scrollTop = n.offsetTop;
|
|
701
697
|
},
|
|
702
698
|
handleOptionHover(e) {
|
|
@@ -708,18 +704,19 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
708
704
|
if (n < 0 ? n = 0 : n >= this.effectiveOptions.length && (n = this.effectiveOptions.length - 1), t == n)
|
|
709
705
|
return;
|
|
710
706
|
this.highlightedOptionKey = this.effectiveOptions[n].key;
|
|
711
|
-
const
|
|
712
|
-
|
|
707
|
+
const i = this.$refs.optionsContainer, s = i.querySelectorAll(".option")[n];
|
|
708
|
+
s.offsetTop < i.scrollTop ? i.scrollTop = s.offsetTop : s.offsetTop + s.offsetHeight > i.scrollTop + i.clientHeight && (i.scrollTop = s.offsetTop + s.offsetHeight - i.clientHeight);
|
|
713
709
|
},
|
|
714
710
|
selectOption(e) {
|
|
711
|
+
var t;
|
|
715
712
|
if (this.isSearching = !1, e.key == H)
|
|
716
713
|
this.searchText = "", this.selectedOption = null, this.selectedOptionTitle = null;
|
|
717
714
|
else if (e.key === he) {
|
|
718
|
-
const
|
|
719
|
-
this.searchText = "", this.selectedOption = null, this.selectedOptionTitle = null, this
|
|
715
|
+
const n = this.searchText.trim();
|
|
716
|
+
this.searchText = "", this.selectedOption = null, this.selectedOptionTitle = null, (t = this.onCreateItem) == null || t.call(this, n);
|
|
720
717
|
} else {
|
|
721
|
-
const
|
|
722
|
-
this.selectedOption =
|
|
718
|
+
const i = this.optionsDescriptors.find((s) => s.key == e.key).ref;
|
|
719
|
+
this.selectedOption = i, this.selectedOptionTitle = this.formatter(i), this.searchText = this.selectedOptionTitle || "";
|
|
723
720
|
}
|
|
724
721
|
this.$refs.searchField.blur();
|
|
725
722
|
},
|
|
@@ -727,11 +724,11 @@ const H = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
727
724
|
this.modelValue ? (this.selectedOption = this.valueExtractor ? this.allOptions.find((e) => this.modelValue === this.valueExtractor(e)) : this.modelValue, this.selectedOptionTitle = this.selectedOption ? this.formatter(this.selectedOption) : null, this.searchText = this.selectedOptionTitle || "") : (this.selectedOption = null, this.selectedOptionTitle = null, this.searchText = "");
|
|
728
725
|
},
|
|
729
726
|
addRemoteOption(e) {
|
|
730
|
-
this.loadedOptions.
|
|
727
|
+
this.loadedOptions.unshift(e);
|
|
731
728
|
}
|
|
732
729
|
}
|
|
733
730
|
};
|
|
734
|
-
const Ht = ["placeholder"], _t = {
|
|
731
|
+
const Ht = ["placeholder", "required"], _t = {
|
|
735
732
|
key: 0,
|
|
736
733
|
ref: "optionsContainer",
|
|
737
734
|
class: "vf-smart-select-options"
|
|
@@ -742,7 +739,7 @@ const Ht = ["placeholder"], _t = {
|
|
|
742
739
|
key: 0,
|
|
743
740
|
class: "no-results"
|
|
744
741
|
};
|
|
745
|
-
function Ft(e, t, n,
|
|
742
|
+
function Ft(e, t, n, i, s, o) {
|
|
746
743
|
const r = Te("disabled");
|
|
747
744
|
return u(), f("div", {
|
|
748
745
|
class: k(["vf-smart-select", { disabled: o.effectiveDisabled, open: e.shouldDisplayOptions }])
|
|
@@ -755,7 +752,8 @@ function Ft(e, t, n, s, i, o) {
|
|
|
755
752
|
onKeydown: t[1] || (t[1] = (...l) => o.handleKeyDown && o.handleKeyDown(...l)),
|
|
756
753
|
placeholder: o.effectivePlaceholder,
|
|
757
754
|
onFocus: t[2] || (t[2] = (...l) => o.handleInputFocused && o.handleInputFocused(...l)),
|
|
758
|
-
onBlur: t[3] || (t[3] = (...l) => o.handleInputBlurred && o.handleInputBlurred(...l))
|
|
755
|
+
onBlur: t[3] || (t[3] = (...l) => o.handleInputBlurred && o.handleInputBlurred(...l)),
|
|
756
|
+
required: n.required
|
|
759
757
|
}, null, 42, Ht), [
|
|
760
758
|
[ze, e.searchText],
|
|
761
759
|
[r, o.effectiveDisabled]
|
|
@@ -780,12 +778,12 @@ function Ft(e, t, n, s, i, o) {
|
|
|
780
778
|
innerHTML: l.subtitle
|
|
781
779
|
}, null, 8, Bt)) : T("", !0)
|
|
782
780
|
], 42, $t))), 128)),
|
|
783
|
-
!o.effectiveOptions.length && e.searchText ? (u(), f("div", Vt,
|
|
781
|
+
!o.effectiveOptions.length && e.searchText ? (u(), f("div", Vt, x(o.effectiveNoResultsText), 1)) : T("", !0)
|
|
784
782
|
], 64)) : (u(), f("div", Dt, "Loading..."))
|
|
785
783
|
], 512)) : T("", !0)
|
|
786
784
|
], 2);
|
|
787
785
|
}
|
|
788
|
-
const Nt = /* @__PURE__ */ Le(It, [["render", Ft]]), Wn = /* @__PURE__ */
|
|
786
|
+
const Nt = /* @__PURE__ */ Le(It, [["render", Ft]]), Wn = /* @__PURE__ */ C({
|
|
789
787
|
__name: "ez-smart-select",
|
|
790
788
|
props: {
|
|
791
789
|
modelValue: {},
|
|
@@ -796,26 +794,26 @@ const Nt = /* @__PURE__ */ Le(It, [["render", Ft]]), Wn = /* @__PURE__ */ x({
|
|
|
796
794
|
},
|
|
797
795
|
emits: ["update:modelValue"],
|
|
798
796
|
setup(e, { emit: t }) {
|
|
799
|
-
const n = e,
|
|
797
|
+
const n = e, i = V(() => Array.isArray(n.options) ? n.options.map((r) => ({ value: r, label: r })) : Object.entries(n.options).map(([r, l]) => ({
|
|
800
798
|
value: r,
|
|
801
799
|
label: l
|
|
802
|
-
}))),
|
|
800
|
+
}))), s = V(() => n.formatter ? (r) => {
|
|
803
801
|
var l;
|
|
804
802
|
return (l = n.formatter) == null ? void 0 : l.call(n, r.label);
|
|
805
|
-
} : (r) => r.label), o = w(
|
|
803
|
+
} : (r) => r.label), o = w(i.value.find((r) => r.value === n.modelValue) ?? null);
|
|
806
804
|
return ce(
|
|
807
805
|
() => n.modelValue,
|
|
808
806
|
(r) => {
|
|
809
|
-
o.value =
|
|
807
|
+
o.value = i.value.find((l) => l.value === r) ?? null;
|
|
810
808
|
}
|
|
811
809
|
), ce(o, (r) => {
|
|
812
810
|
var l;
|
|
813
|
-
t("update:modelValue", r ? ((l =
|
|
811
|
+
t("update:modelValue", r ? ((l = i.value.find((c) => xe(c, r))) == null ? void 0 : l.value) ?? null : null);
|
|
814
812
|
}), (r, l) => (u(), ke(Nt, {
|
|
815
813
|
modelValue: o.value,
|
|
816
814
|
"onUpdate:modelValue": l[0] || (l[0] = (c) => o.value = c),
|
|
817
|
-
options:
|
|
818
|
-
formatter:
|
|
815
|
+
options: i.value,
|
|
816
|
+
formatter: s.value,
|
|
819
817
|
"null-title": r.nullTitle
|
|
820
818
|
}, null, 8, ["modelValue", "options", "formatter", "null-title"]));
|
|
821
819
|
}
|
|
@@ -825,7 +823,7 @@ const Nt = /* @__PURE__ */ Le(It, [["render", Ft]]), Wn = /* @__PURE__ */ x({
|
|
|
825
823
|
}, Wt = {
|
|
826
824
|
key: 0,
|
|
827
825
|
class: "progress-bar"
|
|
828
|
-
}, Pt = /* @__PURE__ */
|
|
826
|
+
}, Pt = /* @__PURE__ */ C({
|
|
829
827
|
__name: "toast",
|
|
830
828
|
props: {
|
|
831
829
|
message: {},
|
|
@@ -840,26 +838,26 @@ const Nt = /* @__PURE__ */ Le(It, [["render", Ft]]), Wn = /* @__PURE__ */ x({
|
|
|
840
838
|
function n() {
|
|
841
839
|
t.onClick ? t.onClick() : t.disableClose || t.callback();
|
|
842
840
|
}
|
|
843
|
-
const
|
|
841
|
+
const i = w();
|
|
844
842
|
return t.durationSecs !== null && L(() => {
|
|
845
843
|
var o;
|
|
846
|
-
const
|
|
847
|
-
(o =
|
|
848
|
-
duration:
|
|
844
|
+
const s = t.durationSecs ?? 5;
|
|
845
|
+
(o = i.value) == null || o.animate([{ width: "0%" }, { width: "100%" }], {
|
|
846
|
+
duration: s * 1e3,
|
|
849
847
|
easing: "linear"
|
|
850
|
-
}), setTimeout(() => t.callback(),
|
|
851
|
-
}), (
|
|
852
|
-
class: k(["vf-toast",
|
|
848
|
+
}), setTimeout(() => t.callback(), s * 1e3);
|
|
849
|
+
}), (s, o) => (u(), f("div", {
|
|
850
|
+
class: k(["vf-toast", s.className]),
|
|
853
851
|
onClick: te(n, ["stop"])
|
|
854
852
|
}, [
|
|
855
853
|
O("div", Kt, [
|
|
856
|
-
O("div", Ut,
|
|
857
|
-
|
|
854
|
+
O("div", Ut, x(s.message), 1),
|
|
855
|
+
s.disableClose ? T("", !0) : (u(), f("div", jt, "x"))
|
|
858
856
|
]),
|
|
859
|
-
|
|
857
|
+
s.durationSecs !== null ? (u(), f("div", Wt, [
|
|
860
858
|
O("div", {
|
|
861
859
|
ref_key: "progressInnerEl",
|
|
862
|
-
ref:
|
|
860
|
+
ref: i,
|
|
863
861
|
class: "inner"
|
|
864
862
|
}, null, 512)
|
|
865
863
|
])) : T("", !0)
|
|
@@ -867,15 +865,15 @@ const Nt = /* @__PURE__ */ Le(It, [["render", Ft]]), Wn = /* @__PURE__ */ x({
|
|
|
867
865
|
}
|
|
868
866
|
});
|
|
869
867
|
function Pn(e) {
|
|
870
|
-
const t =
|
|
868
|
+
const t = ie(Pt, {
|
|
871
869
|
...e,
|
|
872
870
|
callback: () => P(t)
|
|
873
871
|
});
|
|
874
872
|
return () => P(t);
|
|
875
873
|
}
|
|
876
874
|
function qt(e) {
|
|
877
|
-
const t = Math.floor(Math.log(e) / Math.log(1024)),
|
|
878
|
-
return `${
|
|
875
|
+
const t = Math.floor(Math.log(e) / Math.log(1024)), i = (e / Math.pow(1024, t)).toFixed(2), s = ["B", "KB", "MB", "GB", "TB"][t];
|
|
876
|
+
return `${i} ${s}`;
|
|
879
877
|
}
|
|
880
878
|
function zt(e) {
|
|
881
879
|
return e != null && String(e).length ? e : "-";
|
|
@@ -887,7 +885,7 @@ function Yt(e) {
|
|
|
887
885
|
return e === null || typeof e == "string" && !/^\d+$/.test(e) ? e : sn(Number(e));
|
|
888
886
|
}
|
|
889
887
|
function Zt(e) {
|
|
890
|
-
return e &&
|
|
888
|
+
return e && xt(e);
|
|
891
889
|
}
|
|
892
890
|
function Gt(e) {
|
|
893
891
|
return e ? Ze(e) : null;
|
|
@@ -899,7 +897,7 @@ function Jt(e) {
|
|
|
899
897
|
return e ? e.toUpperCase() : null;
|
|
900
898
|
}
|
|
901
899
|
function en(e) {
|
|
902
|
-
return e ?
|
|
900
|
+
return e ? Ct(e) : null;
|
|
903
901
|
}
|
|
904
902
|
function tn(e) {
|
|
905
903
|
return Lt(e);
|
|
@@ -920,30 +918,30 @@ const fe = {
|
|
|
920
918
|
...e(fe)
|
|
921
919
|
});
|
|
922
920
|
function zn(e, t, n) {
|
|
923
|
-
const
|
|
924
|
-
return
|
|
921
|
+
const i = typeof t == "function" ? e.findIndex(t) : e.indexOf(t);
|
|
922
|
+
return i === -1 ? !1 : (e.splice(i, 1, n), !0);
|
|
925
923
|
}
|
|
926
924
|
function Xn(e, t) {
|
|
927
925
|
const n = document.createElement("div");
|
|
928
926
|
n.classList.add("vf-overlay"), n.addEventListener("click", m), document.body.appendChild(n);
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
const
|
|
932
|
-
|
|
927
|
+
const i = document.createElement("div");
|
|
928
|
+
i.classList.add("vf-context-menu"), i.style.position = "absolute", n.appendChild(i);
|
|
929
|
+
const s = e.currentTarget;
|
|
930
|
+
s.style.userSelect = "none", s.classList.add("context-menu-active"), t.targetClass && s.classList.add(t.targetClass), t.class && i.classList.add(t.class), t.items.forEach((p) => {
|
|
933
931
|
if (p == "-") {
|
|
934
932
|
const d = document.createElement("div");
|
|
935
|
-
d.classList.add("separator"),
|
|
933
|
+
d.classList.add("separator"), i.appendChild(d);
|
|
936
934
|
return;
|
|
937
935
|
}
|
|
938
936
|
const a = document.createElement("div");
|
|
939
|
-
a.classList.add("item"), a.style.userSelect = "none", a.innerText = p.title,
|
|
937
|
+
a.classList.add("item"), a.style.userSelect = "none", a.innerText = p.title, i.appendChild(a), p.class && a.classList.add(p.class), p.shouldConfirm ? a.addEventListener("click", (d) => y(d, a, p.handler)) : a.addEventListener("click", () => p.handler());
|
|
940
938
|
});
|
|
941
|
-
const o = window.innerWidth - e.clientX, r = window.innerHeight - e.clientY, l =
|
|
942
|
-
|
|
943
|
-
|
|
939
|
+
const o = window.innerWidth - e.clientX, r = window.innerHeight - e.clientY, l = i.offsetHeight, c = i.offsetWidth, h = o < c ? e.clientX - c - 1 : e.clientX + 1, b = r < l ? e.clientY - l - 1 : e.clientY + 1;
|
|
940
|
+
i.style.left = h + "px", i.style.top = b + "px", setTimeout(() => {
|
|
941
|
+
i.style.width = i.offsetWidth + "px";
|
|
944
942
|
}, 50);
|
|
945
943
|
function m() {
|
|
946
|
-
t.targetClass &&
|
|
944
|
+
t.targetClass && s.classList.remove(t.targetClass), s.classList.remove("context-menu-active"), s.style.userSelect = "", n.remove();
|
|
947
945
|
}
|
|
948
946
|
function y(p, a, d) {
|
|
949
947
|
if (a.classList.contains("pending-confirm"))
|
|
@@ -965,14 +963,14 @@ function Zn(e, t) {
|
|
|
965
963
|
}
|
|
966
964
|
function Gn(e, t) {
|
|
967
965
|
const n = { ...e };
|
|
968
|
-
for (const
|
|
969
|
-
n[
|
|
966
|
+
for (const i of t)
|
|
967
|
+
n[i] === "" && (n[i] = null);
|
|
970
968
|
return n;
|
|
971
969
|
}
|
|
972
970
|
function on(e) {
|
|
973
971
|
return e instanceof Error && "status" in e && "body" in e;
|
|
974
972
|
}
|
|
975
|
-
function Qn({ apiClient: e, wrapper: t, onRequest: n, onError:
|
|
973
|
+
function Qn({ apiClient: e, wrapper: t, onRequest: n, onError: i, afterRequest: s, CancelablePromise: o }) {
|
|
976
974
|
const r = e.request.request.bind(e.request), l = t ?? ((c, h) => h(c));
|
|
977
975
|
e.request.request = (c) => l(c, (h) => (h = ln(h), n && (h = n(h)), new o((b, m, y) => {
|
|
978
976
|
const p = r(h);
|
|
@@ -982,15 +980,15 @@ function Qn({ apiClient: e, wrapper: t, onRequest: n, onError: s, afterRequest:
|
|
|
982
980
|
return m(new z(a.body.error));
|
|
983
981
|
a.message = `${a.body.error} (${a.status})`;
|
|
984
982
|
}
|
|
985
|
-
if (
|
|
986
|
-
const d =
|
|
983
|
+
if (i) {
|
|
984
|
+
const d = i(a, h);
|
|
987
985
|
if (d === null)
|
|
988
986
|
return;
|
|
989
987
|
if (d instanceof Error)
|
|
990
988
|
return m(d);
|
|
991
989
|
}
|
|
992
990
|
m(a);
|
|
993
|
-
}).finally(() =>
|
|
991
|
+
}).finally(() => s == null ? void 0 : s(h));
|
|
994
992
|
})));
|
|
995
993
|
}
|
|
996
994
|
class pe {
|
|
@@ -1006,12 +1004,12 @@ class pe {
|
|
|
1006
1004
|
}
|
|
1007
1005
|
}
|
|
1008
1006
|
function ln(e) {
|
|
1009
|
-
if (!(typeof e.body == "object" && Object.values(e.body).some((
|
|
1007
|
+
if (!(typeof e.body == "object" && Object.values(e.body).some((s) => s instanceof pe)))
|
|
1010
1008
|
return e;
|
|
1011
|
-
const n = {},
|
|
1012
|
-
for (const [
|
|
1013
|
-
o instanceof pe ? n[
|
|
1014
|
-
return n._payload = new Blob([JSON.stringify(
|
|
1009
|
+
const n = {}, i = {};
|
|
1010
|
+
for (const [s, o] of Object.entries(e.body))
|
|
1011
|
+
o instanceof pe ? n[s] = o.blob : i[s] = o;
|
|
1012
|
+
return n._payload = new Blob([JSON.stringify(i)], { type: "application/json" }), {
|
|
1015
1013
|
...e,
|
|
1016
1014
|
body: void 0,
|
|
1017
1015
|
formData: n
|
|
@@ -1020,25 +1018,25 @@ function ln(e) {
|
|
|
1020
1018
|
const le = Symbol("HookState");
|
|
1021
1019
|
function Jn(e, t) {
|
|
1022
1020
|
const n = t ?? ee();
|
|
1023
|
-
L(() => rn(n, e), n), Se(() => an(n), n),
|
|
1021
|
+
L(() => rn(n, e), n), Se(() => an(n), n), Ce(() => me(n), n), ne(() => me(n), n);
|
|
1024
1022
|
}
|
|
1025
1023
|
function rn(e, t) {
|
|
1026
1024
|
const n = {};
|
|
1027
1025
|
if (t.elScrolledToBottom && (n.el = new A(e.vnode.el, t.elScrolledToBottom)), t.ancestorScrolledToBottom) {
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1026
|
+
const i = De(e.vnode.el);
|
|
1027
|
+
i ? n.ancestor = new A(i, t.ancestorScrolledToBottom) : console.warn("[VueFoundation] No scollable ancestor found for component:", e);
|
|
1030
1028
|
}
|
|
1031
1029
|
t.windowScrolledToBottom && (n.window = new A(window, t.windowScrolledToBottom)), e[le] = n;
|
|
1032
1030
|
}
|
|
1033
1031
|
function an(e) {
|
|
1034
|
-
var n,
|
|
1032
|
+
var n, i, s;
|
|
1035
1033
|
const t = e[le];
|
|
1036
|
-
(n = t == null ? void 0 : t.el) == null || n.install(), (
|
|
1034
|
+
(n = t == null ? void 0 : t.el) == null || n.install(), (i = t == null ? void 0 : t.ancestor) == null || i.install(), (s = t == null ? void 0 : t.window) == null || s.install();
|
|
1037
1035
|
}
|
|
1038
1036
|
function me(e) {
|
|
1039
|
-
var n,
|
|
1037
|
+
var n, i, s;
|
|
1040
1038
|
const t = e[le];
|
|
1041
|
-
(n = t == null ? void 0 : t.el) == null || n.uninstall(), (
|
|
1039
|
+
(n = t == null ? void 0 : t.el) == null || n.uninstall(), (i = t == null ? void 0 : t.ancestor) == null || i.uninstall(), (s = t == null ? void 0 : t.window) == null || s.uninstall();
|
|
1042
1040
|
}
|
|
1043
1041
|
const Z = ["auto", "scroll"];
|
|
1044
1042
|
function De(e) {
|
|
@@ -1064,8 +1062,8 @@ class A {
|
|
|
1064
1062
|
Math.ceil(this.el.scrollTop + this.el.clientHeight + 5) >= this.el.scrollHeight ? this.isTripped || (this.handler(t), this.isTripped = !0) : this.isTripped && (this.isTripped = !1);
|
|
1065
1063
|
}
|
|
1066
1064
|
}
|
|
1067
|
-
function
|
|
1068
|
-
L(() => window.addEventListener("resize", e)), Se(() => window.addEventListener("resize", e)),
|
|
1065
|
+
function ei(e) {
|
|
1066
|
+
L(() => window.addEventListener("resize", e)), Se(() => window.addEventListener("resize", e)), Ce(() => window.removeEventListener("resize", e)), ne(() => window.removeEventListener("resize", e));
|
|
1069
1067
|
}
|
|
1070
1068
|
const cn = {
|
|
1071
1069
|
mounted: ye,
|
|
@@ -1091,14 +1089,14 @@ function un(e) {
|
|
|
1091
1089
|
return;
|
|
1092
1090
|
}
|
|
1093
1091
|
t.preventDefault(), t.stopImmediatePropagation();
|
|
1094
|
-
const
|
|
1092
|
+
const i = {
|
|
1095
1093
|
initTime: n,
|
|
1096
1094
|
preconfirmHtml: e.innerHTML,
|
|
1097
1095
|
resetHandler: () => {
|
|
1098
|
-
e.innerHTML =
|
|
1096
|
+
e.innerHTML = i.preconfirmHtml, e.blur(), e.removeEventListener("mouseout", i.resetHandler), delete e[_];
|
|
1099
1097
|
}
|
|
1100
1098
|
};
|
|
1101
|
-
e[_] =
|
|
1099
|
+
e[_] = i, e.innerHTML = "Confirm", e.addEventListener("mouseout", i.resetHandler);
|
|
1102
1100
|
});
|
|
1103
1101
|
}
|
|
1104
1102
|
const hn = {
|
|
@@ -1124,7 +1122,7 @@ function mn(e, t) {
|
|
|
1124
1122
|
if (!t.value)
|
|
1125
1123
|
return ((c = e.attributes.getNamedItem("placeholder")) == null ? void 0 : c.value) ?? "";
|
|
1126
1124
|
let n = "";
|
|
1127
|
-
const
|
|
1125
|
+
const i = t.value.replace(/ /g, "T").replace(/\.\d+Z$/, "Z"), s = e.attributes.getNamedItem("local") !== null ? i.replace(/Z$/, "") : i.replace(/(Z|\+00:00)?$/, "Z"), o = new Date(s);
|
|
1128
1126
|
e.attributes.getNamedItem("display-utc") !== null && o.setMinutes(o.getMinutes() - o.getTimezoneOffset());
|
|
1129
1127
|
let r = (h = e.attributes.getNamedItem("format")) == null ? void 0 : h.value;
|
|
1130
1128
|
if (!r && e.attributes.getNamedItem("relative-date") !== null) {
|
|
@@ -1161,9 +1159,9 @@ function Ee(e, t) {
|
|
|
1161
1159
|
return;
|
|
1162
1160
|
if (!t.value)
|
|
1163
1161
|
return Ae(e);
|
|
1164
|
-
const n = new Date(t.value),
|
|
1162
|
+
const n = new Date(t.value), i = (r = e.attributes.getNamedItem("base-time")) == null ? void 0 : r.value, s = n.getTime() - (i ? new Date(i).getTime() - t.value * 1e3 : 0), o = e.getAttribute("no-seconds") === null;
|
|
1165
1163
|
e[F] || re.push(e), e[F] = {
|
|
1166
|
-
startTs:
|
|
1164
|
+
startTs: s,
|
|
1167
1165
|
includeSeconds: o
|
|
1168
1166
|
}, $e(e);
|
|
1169
1167
|
}
|
|
@@ -1175,12 +1173,12 @@ function Ae(e) {
|
|
|
1175
1173
|
e[F] && (Je(re, e), delete e[F]), e.innerText = "-";
|
|
1176
1174
|
}
|
|
1177
1175
|
function En(e, t) {
|
|
1178
|
-
const n = [],
|
|
1179
|
-
|
|
1180
|
-
const
|
|
1181
|
-
(
|
|
1176
|
+
const n = [], i = Math.floor(e / 86400);
|
|
1177
|
+
i && n.push(i + "d"), e -= i * 86400;
|
|
1178
|
+
const s = Math.floor(e / 3600);
|
|
1179
|
+
(i || s) && n.push(s + "h"), e -= s * 3600;
|
|
1182
1180
|
const o = Math.floor(e / 60);
|
|
1183
|
-
return (
|
|
1181
|
+
return (i || s || o) && n.push(o + "m"), t ? n.length || n.push("0m") : (e -= o * 60, n.push(e + "s")), n.join(" ");
|
|
1184
1182
|
}
|
|
1185
1183
|
const D = Symbol("InfiniteScrollHandler"), On = {
|
|
1186
1184
|
mounted(e, t) {
|
|
@@ -1207,14 +1205,14 @@ const Tn = {
|
|
|
1207
1205
|
unmounted: Be
|
|
1208
1206
|
}, B = Symbol("TooltipState");
|
|
1209
1207
|
function we(e, t) {
|
|
1210
|
-
var
|
|
1211
|
-
let n = ((
|
|
1208
|
+
var i;
|
|
1209
|
+
let n = ((i = e.attributes.getNamedItem("tip")) == null ? void 0 : i.value) ?? t.value;
|
|
1212
1210
|
if (t.value || (n = null), n) {
|
|
1213
|
-
const
|
|
1211
|
+
const s = {
|
|
1214
1212
|
content: n,
|
|
1215
1213
|
html: e.getAttribute("html") !== null
|
|
1216
1214
|
};
|
|
1217
|
-
e[B] ? e[B].configure(
|
|
1215
|
+
e[B] ? e[B].configure(s) : e[B] = new kn(e, s);
|
|
1218
1216
|
} else
|
|
1219
1217
|
Be(e);
|
|
1220
1218
|
}
|
|
@@ -1258,9 +1256,9 @@ class kn {
|
|
|
1258
1256
|
this.shouldShow || this.tipEl && (this.tipEl.remove(), this.tipEl = void 0, this.titleEl = void 0, this.contentEl = void 0, this.checkInterval && (clearInterval(this.checkInterval), this.checkInterval = void 0), window.removeEventListener("mousemove", this.handleMouseMoveWithContext), this.mouseMoveBound = !1);
|
|
1259
1257
|
}
|
|
1260
1258
|
handleMouseMove(t) {
|
|
1261
|
-
const n = this.tipEl.offsetWidth,
|
|
1259
|
+
const n = this.tipEl.offsetWidth, i = this.tipEl.offsetHeight, s = window.innerWidth, o = window.innerHeight;
|
|
1262
1260
|
let r = t.pageX + 10, l = t.pageY + 20;
|
|
1263
|
-
r + n >
|
|
1261
|
+
r + n > s && (r = t.pageX - 5 - n), l + i > o && (l = t.pageY - 5 - i), this.tipEl.style.left = r + "px", this.tipEl.style.top = l + "px", this.lastMoveEvt = t;
|
|
1264
1262
|
}
|
|
1265
1263
|
checkMoveEvent() {
|
|
1266
1264
|
var t;
|
|
@@ -1273,7 +1271,7 @@ class kn {
|
|
|
1273
1271
|
function Sn(e) {
|
|
1274
1272
|
e.directive("autofocus", cn), e.directive("confirm-button", dn), e.directive("date-input", hn), e.directive("datetime", pn), e.directive("disabled", vn), e.directive("duration", gn), e.directive("infinite-scroll", On), e.directive("readonly", wn), e.directive("tooltip", Tn);
|
|
1275
1273
|
}
|
|
1276
|
-
function
|
|
1274
|
+
function ti(e) {
|
|
1277
1275
|
Sn(e);
|
|
1278
1276
|
}
|
|
1279
1277
|
export {
|
|
@@ -1288,28 +1286,28 @@ export {
|
|
|
1288
1286
|
Zn as cloneProp,
|
|
1289
1287
|
Vn as configureVf,
|
|
1290
1288
|
qn as createFilters,
|
|
1291
|
-
|
|
1292
|
-
|
|
1289
|
+
ie as createOverlayInjection,
|
|
1290
|
+
Ct as desnakeCase,
|
|
1293
1291
|
dt as dismissOverlayInjectionById,
|
|
1294
1292
|
Dn as dismissOverlayInjectionByInstance,
|
|
1295
1293
|
Me as dismissOverlayInjectionByInternalInstance,
|
|
1296
1294
|
ct as dismissOverlayInjectionByVnode,
|
|
1297
|
-
|
|
1295
|
+
si as escapeHtml,
|
|
1298
1296
|
ut as formatError,
|
|
1299
1297
|
sn as formatNumber,
|
|
1300
|
-
|
|
1298
|
+
xt as formatPhone,
|
|
1301
1299
|
Lt as formatUSCurrency,
|
|
1302
1300
|
Nn as handleError,
|
|
1303
1301
|
Fn as handleErrorAndAlert,
|
|
1304
1302
|
Qn as installApiClientInterceptors,
|
|
1305
|
-
|
|
1303
|
+
ti as installVf,
|
|
1306
1304
|
on as isApiError,
|
|
1307
1305
|
Rn as maskComponent,
|
|
1308
1306
|
ht as maskEl,
|
|
1309
1307
|
ft as maskForm,
|
|
1310
1308
|
Un as nl2br,
|
|
1311
1309
|
Gn as nullifyEmptyInputs,
|
|
1312
|
-
|
|
1310
|
+
se as presentOverlay,
|
|
1313
1311
|
P as removeOverlayInjection,
|
|
1314
1312
|
zn as replaceElement,
|
|
1315
1313
|
de as showAlert,
|
|
@@ -1325,6 +1323,6 @@ export {
|
|
|
1325
1323
|
Ie as unmaskEl,
|
|
1326
1324
|
He as unmaskForm,
|
|
1327
1325
|
Jn as useInfiniteScroll,
|
|
1328
|
-
|
|
1326
|
+
ei as useResizeWatcher,
|
|
1329
1327
|
jn as uuid
|
|
1330
1328
|
};
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
v-disabled="effectiveDisabled"
|
|
11
11
|
@focus="handleInputFocused"
|
|
12
12
|
@blur="handleInputBlurred"
|
|
13
|
+
:required="required"
|
|
13
14
|
/>
|
|
14
15
|
<div v-if="shouldDisplayOptions" ref="optionsContainer" class="vf-smart-select-options">
|
|
15
16
|
<div v-if="!isLoaded" class="no-results">Loading...</div>
|
|
@@ -83,12 +84,12 @@ export default {
|
|
|
83
84
|
noResultsText: String as PropType<string>,
|
|
84
85
|
disabled: Boolean as PropType<boolean>,
|
|
85
86
|
optionsListId: String as PropType<string>,
|
|
86
|
-
debug: Boolean as PropType<boolean
|
|
87
|
+
debug: Boolean as PropType<boolean>,
|
|
88
|
+
required: Boolean as PropType<boolean>
|
|
87
89
|
},
|
|
88
90
|
|
|
89
91
|
emits: {
|
|
90
92
|
optionsLoaded: Object as (options: any[]) => void,
|
|
91
|
-
createItem: Object as (searchText: string) => void,
|
|
92
93
|
'update:modelValue': Object as (value: any) => void
|
|
93
94
|
},
|
|
94
95
|
|
|
@@ -232,6 +233,7 @@ export default {
|
|
|
232
233
|
|
|
233
234
|
options() {
|
|
234
235
|
this.loadedOptions = this.options ?? [];
|
|
236
|
+
this.isLoaded = true;
|
|
235
237
|
},
|
|
236
238
|
|
|
237
239
|
// data
|
|
@@ -274,7 +276,7 @@ export default {
|
|
|
274
276
|
},
|
|
275
277
|
|
|
276
278
|
async mounted() {
|
|
277
|
-
this.shouldShowCreateOption = this
|
|
279
|
+
this.shouldShowCreateOption = this.onCreateItem !== undefined;
|
|
278
280
|
|
|
279
281
|
if (this.options) {
|
|
280
282
|
this.loadedOptions = this.options;
|
|
@@ -305,13 +307,6 @@ export default {
|
|
|
305
307
|
this.loadedOptions && this.$emit('optionsLoaded', this.loadedOptions);
|
|
306
308
|
},
|
|
307
309
|
|
|
308
|
-
handleSourceUpdate() {
|
|
309
|
-
if (this.preload) return this.reloadOptions();
|
|
310
|
-
if (!this.isLoaded) return;
|
|
311
|
-
this.isLoaded = false;
|
|
312
|
-
this.loadedOptions = [];
|
|
313
|
-
},
|
|
314
|
-
|
|
315
310
|
async reloadOptions() {
|
|
316
311
|
const searchText = this.remoteSearch && this.isSearching && this.searchText ? this.searchText : null;
|
|
317
312
|
this.isLoading = true;
|
|
@@ -509,7 +504,7 @@ export default {
|
|
|
509
504
|
this.searchText = '';
|
|
510
505
|
this.selectedOption = null;
|
|
511
506
|
this.selectedOptionTitle = null;
|
|
512
|
-
this
|
|
507
|
+
this.onCreateItem?.(createText);
|
|
513
508
|
} else {
|
|
514
509
|
const selectedDecoratedOption = this.optionsDescriptors.find(decoratedOption => decoratedOption.key == option.key);
|
|
515
510
|
const realOption = selectedDecoratedOption!.ref;
|
|
@@ -534,7 +529,7 @@ export default {
|
|
|
534
529
|
},
|
|
535
530
|
|
|
536
531
|
addRemoteOption(option: GenericObject) {
|
|
537
|
-
this.loadedOptions.
|
|
532
|
+
this.loadedOptions.unshift(option);
|
|
538
533
|
}
|
|
539
534
|
}
|
|
540
535
|
};
|
package/src/helpers/mask.ts
CHANGED
|
@@ -50,8 +50,8 @@ const FormMaskState = Symbol('FormMaskState');
|
|
|
50
50
|
interface IFormMaskState {
|
|
51
51
|
[FormMaskState]?: {
|
|
52
52
|
disabledElements: HTMLElement[];
|
|
53
|
-
waitButton
|
|
54
|
-
buttonHtml
|
|
53
|
+
waitButton?: HTMLElement;
|
|
54
|
+
buttonHtml?: string;
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
type FormMaskElement = Element & IFormMaskState;
|
|
@@ -62,10 +62,13 @@ export function maskForm(formOrCmp: Element | AnyComponentPublicInstance, button
|
|
|
62
62
|
|
|
63
63
|
const buttonEl = (
|
|
64
64
|
buttonSelector instanceof Element ? buttonSelector : form.querySelectorAll(buttonSelector ?? 'button:not([disabled]):not([type="button"])')[0]
|
|
65
|
-
) as HTMLElement;
|
|
66
|
-
|
|
67
|
-
buttonEl
|
|
68
|
-
|
|
65
|
+
) as HTMLElement | undefined;
|
|
66
|
+
let originalButtonHtml: string | undefined;
|
|
67
|
+
if (buttonEl) {
|
|
68
|
+
originalButtonHtml = buttonEl.tagName === 'INPUT' ? (buttonEl as HTMLInputElement).value : buttonEl.innerHTML;
|
|
69
|
+
buttonEl.setAttribute('disabled', 'disabled');
|
|
70
|
+
buttonEl.innerText = buttonText ?? 'Please wait...';
|
|
71
|
+
}
|
|
69
72
|
|
|
70
73
|
const inputsQR = form.querySelectorAll('input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])');
|
|
71
74
|
const inputs = [...inputsQR] as HTMLElement[];
|
|
@@ -89,8 +92,11 @@ export function unmaskForm(formOrCmp: Element | AnyComponentPublicInstance) {
|
|
|
89
92
|
form.classList.remove('vf-masked');
|
|
90
93
|
|
|
91
94
|
state.disabledElements.forEach(el => el.removeAttribute('disabled'));
|
|
92
|
-
|
|
93
|
-
state.waitButton
|
|
95
|
+
|
|
96
|
+
if (state.waitButton) {
|
|
97
|
+
state.waitButton.innerHTML = state.buttonHtml!;
|
|
98
|
+
state.waitButton.removeAttribute('disabled');
|
|
99
|
+
}
|
|
94
100
|
|
|
95
101
|
delete (form as FormMaskElement)[FormMaskState];
|
|
96
102
|
}
|