@signal24/vue-foundation 4.13.6 → 4.13.7
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.
|
@@ -39,7 +39,7 @@ interface PropsWithCallback<T> {
|
|
|
39
39
|
}
|
|
40
40
|
type ComponentReturn<M extends OverlayComponent> = OverlayComponentProps<M> extends PropsWithCallback<infer R> ? R : never;
|
|
41
41
|
export type AnyComponentPublicInstance = {
|
|
42
|
-
|
|
42
|
+
$?: ComponentInternalInstance;
|
|
43
43
|
};
|
|
44
44
|
export declare function createOverlayInjection<C extends OverlayComponent>(component: C, props: OverlayComponentProps<C>, options?: OverlayOptions): OverlayInjection<C>;
|
|
45
45
|
export declare function dismissOverlayInjectionByInstance(instance: AnyComponentPublicInstance): void;
|
|
@@ -10,6 +10,6 @@ export declare function maskComponent(cmp: AnyComponentPublicInstance, message?:
|
|
|
10
10
|
export declare function unmaskComponent(cmp: AnyComponentPublicInstance): void;
|
|
11
11
|
export declare function maskEl(el: MaskElement, message?: string): () => void;
|
|
12
12
|
export declare function unmaskEl(el: MaskElement): void;
|
|
13
|
-
export declare function maskForm(formOrCmp: Element | AnyComponentPublicInstance, buttonSelector?: string | Element, buttonText?: string): () => void;
|
|
13
|
+
export declare function maskForm(formOrCmp: Element | AnyComponentPublicInstance, buttonSelector?: string | Element, buttonText?: string): (() => void) | undefined;
|
|
14
14
|
export declare function unmaskForm(formOrCmp: Element | AnyComponentPublicInstance): void;
|
|
15
15
|
export {};
|
|
@@ -74,6 +74,8 @@ const Mn = /* @__PURE__ */ Ce(nt, [["render", rt]]), lt = /* @__PURE__ */ x({
|
|
|
74
74
|
const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, i = O({ visibility: "hidden", top: "0", left: "0" }), s = O([]), o = ee();
|
|
75
75
|
L(l);
|
|
76
76
|
function l() {
|
|
77
|
+
if (!o)
|
|
78
|
+
return;
|
|
77
79
|
const p = o.vnode.el, { styles: g, classes: m } = r(p, n);
|
|
78
80
|
i.value = g, s.value = m;
|
|
79
81
|
}
|
|
@@ -142,7 +144,7 @@ function ie(e, t, n) {
|
|
|
142
144
|
return S.push(a), a;
|
|
143
145
|
}
|
|
144
146
|
function Hn(e) {
|
|
145
|
-
Le(e.$);
|
|
147
|
+
e.$ && Le(e.$);
|
|
146
148
|
}
|
|
147
149
|
function Le(e) {
|
|
148
150
|
let t = e;
|
|
@@ -233,11 +235,13 @@ async function Fn(e) {
|
|
|
233
235
|
}
|
|
234
236
|
const B = Symbol("MaskState");
|
|
235
237
|
function _n(e, t) {
|
|
236
|
-
|
|
238
|
+
var s;
|
|
239
|
+
const n = (s = e.$) == null ? void 0 : s.vnode.el, i = n.closest(".vf-modal");
|
|
237
240
|
return ht(i ?? n, t);
|
|
238
241
|
}
|
|
239
242
|
function Nn(e) {
|
|
240
|
-
|
|
243
|
+
var i;
|
|
244
|
+
const t = (i = e.$) == null ? void 0 : i.vnode.el, n = t.closest(".vf-modal");
|
|
241
245
|
return Me(n ?? t);
|
|
242
246
|
}
|
|
243
247
|
function ht(e, t) {
|
|
@@ -253,6 +257,8 @@ function Me(e) {
|
|
|
253
257
|
const Q = Symbol("FormMaskState");
|
|
254
258
|
function ft(e, t, n) {
|
|
255
259
|
const i = e instanceof Element ? e : He(e);
|
|
260
|
+
if (!i)
|
|
261
|
+
return;
|
|
256
262
|
i.classList.add("vf-masked");
|
|
257
263
|
const s = t instanceof Element ? t : i.querySelectorAll(t ?? 'button:not([disabled]):not([type="button"])')[0];
|
|
258
264
|
let o;
|
|
@@ -265,12 +271,16 @@ function ft(e, t, n) {
|
|
|
265
271
|
}, () => Ie(i);
|
|
266
272
|
}
|
|
267
273
|
function Ie(e) {
|
|
268
|
-
const t = e instanceof Element ? e : He(e)
|
|
274
|
+
const t = e instanceof Element ? e : He(e);
|
|
275
|
+
if (!t)
|
|
276
|
+
return;
|
|
277
|
+
const n = t[Q];
|
|
269
278
|
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]);
|
|
270
279
|
}
|
|
271
280
|
function He(e) {
|
|
272
|
-
|
|
273
|
-
|
|
281
|
+
var n;
|
|
282
|
+
const t = (n = e == null ? void 0 : e.$) == null ? void 0 : n.vnode.el;
|
|
283
|
+
return t ? t.tagName === "FORM" ? t : t.querySelector("form") : null;
|
|
274
284
|
}
|
|
275
285
|
const pt = ["id"], mt = {
|
|
276
286
|
key: 0,
|
package/package.json
CHANGED
|
@@ -25,7 +25,8 @@ const instance = getCurrentInstance();
|
|
|
25
25
|
onMounted(updateAttributes);
|
|
26
26
|
|
|
27
27
|
function updateAttributes() {
|
|
28
|
-
|
|
28
|
+
if (!instance) return;
|
|
29
|
+
const overlayEl = instance.vnode.el as HTMLElement;
|
|
29
30
|
const { styles, classes } = computeAnchoredStyle(overlayEl, anchorEl);
|
|
30
31
|
anchorStyles.value = styles;
|
|
31
32
|
anchorClasses.value = classes;
|
|
@@ -90,7 +90,7 @@ interface PropsWithCallback<T> {
|
|
|
90
90
|
}
|
|
91
91
|
type ComponentReturn<M extends OverlayComponent> = OverlayComponentProps<M> extends PropsWithCallback<infer R> ? R : never;
|
|
92
92
|
|
|
93
|
-
export type AnyComponentPublicInstance = {
|
|
93
|
+
export type AnyComponentPublicInstance = { $?: ComponentInternalInstance };
|
|
94
94
|
|
|
95
95
|
export function createOverlayInjection<C extends OverlayComponent>(
|
|
96
96
|
component: C,
|
|
@@ -124,7 +124,7 @@ export function createOverlayInjection<C extends OverlayComponent>(
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export function dismissOverlayInjectionByInstance(instance: AnyComponentPublicInstance) {
|
|
127
|
-
dismissOverlayInjectionByInternalInstance(instance.$);
|
|
127
|
+
instance.$ && dismissOverlayInjectionByInternalInstance(instance.$);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
export function dismissOverlayInjectionByInternalInstance(instance: ComponentInternalInstance) {
|
package/src/helpers/mask.ts
CHANGED
|
@@ -12,13 +12,13 @@ interface IMaskState {
|
|
|
12
12
|
type MaskElement = Element & IMaskState;
|
|
13
13
|
|
|
14
14
|
export function maskComponent(cmp: AnyComponentPublicInstance, message?: string) {
|
|
15
|
-
const el = cmp
|
|
15
|
+
const el = cmp.$?.vnode.el;
|
|
16
16
|
const modalParentlEl = el!.closest('.vf-modal');
|
|
17
17
|
return maskEl(modalParentlEl ?? el, message);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function unmaskComponent(cmp: AnyComponentPublicInstance) {
|
|
21
|
-
const el = cmp
|
|
21
|
+
const el = cmp.$?.vnode.el;
|
|
22
22
|
const modalParentlEl = el!.closest('.vf-modal');
|
|
23
23
|
return unmaskEl(modalParentlEl ?? el);
|
|
24
24
|
}
|
|
@@ -58,6 +58,8 @@ type FormMaskElement = Element & IFormMaskState;
|
|
|
58
58
|
|
|
59
59
|
export function maskForm(formOrCmp: Element | AnyComponentPublicInstance, buttonSelector?: string | Element, buttonText?: string) {
|
|
60
60
|
const form = formOrCmp instanceof Element ? formOrCmp : getFormFromCmp(formOrCmp);
|
|
61
|
+
if (!form) return;
|
|
62
|
+
|
|
61
63
|
form.classList.add('vf-masked');
|
|
62
64
|
|
|
63
65
|
const buttonEl = (
|
|
@@ -85,6 +87,7 @@ export function maskForm(formOrCmp: Element | AnyComponentPublicInstance, button
|
|
|
85
87
|
|
|
86
88
|
export function unmaskForm(formOrCmp: Element | AnyComponentPublicInstance) {
|
|
87
89
|
const form = formOrCmp instanceof Element ? formOrCmp : getFormFromCmp(formOrCmp);
|
|
90
|
+
if (!form) return;
|
|
88
91
|
|
|
89
92
|
const state = (form as FormMaskElement)[FormMaskState];
|
|
90
93
|
if (!state) return;
|
|
@@ -101,8 +104,9 @@ export function unmaskForm(formOrCmp: Element | AnyComponentPublicInstance) {
|
|
|
101
104
|
delete (form as FormMaskElement)[FormMaskState];
|
|
102
105
|
}
|
|
103
106
|
|
|
104
|
-
function getFormFromCmp(cmp: AnyComponentPublicInstance) {
|
|
105
|
-
const cmpEl = cmp
|
|
107
|
+
function getFormFromCmp(cmp: AnyComponentPublicInstance | null) {
|
|
108
|
+
const cmpEl = cmp?.$?.vnode.el;
|
|
109
|
+
if (!cmpEl) return null;
|
|
106
110
|
if (cmpEl.tagName === 'FORM') {
|
|
107
111
|
return cmpEl as HTMLElement;
|
|
108
112
|
} else {
|