@signal24/vue-foundation 4.3.5 → 4.3.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.
- package/dist/src/components/alert-modal.vue.d.ts +25 -48
- package/dist/src/components/ez-smart-select.vue.d.ts +23 -38
- package/dist/src/components/modal-container.d.ts +22 -11
- package/dist/src/components/modal.vue.d.ts +23 -34
- package/dist/vue-foundation.es.js +1 -1
- package/package.json +1 -1
- package/src/components/modal-container.ts +28 -12
- package/src/helpers/context-menu.ts +3 -2
|
@@ -1,50 +1,27 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{
|
|
2
|
-
isBare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
message:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type: import(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
-
isBare: {
|
|
27
|
-
type: import("vue").PropType<boolean>;
|
|
28
|
-
};
|
|
29
|
-
isHtml: {
|
|
30
|
-
type: import("vue").PropType<boolean>;
|
|
31
|
-
};
|
|
32
|
-
classes: {
|
|
33
|
-
type: import("vue").PropType<string[]>;
|
|
34
|
-
};
|
|
35
|
-
title: {
|
|
36
|
-
type: import("vue").PropType<string>;
|
|
37
|
-
};
|
|
38
|
-
message: {
|
|
39
|
-
type: import("vue").PropType<string | Error>;
|
|
40
|
-
required: true;
|
|
41
|
-
};
|
|
42
|
-
shouldConfirm: {
|
|
43
|
-
type: import("vue").PropType<boolean>;
|
|
44
|
-
};
|
|
45
|
-
callback: {
|
|
46
|
-
type: import("vue").PropType<(ok: boolean) => void>;
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
isBare?: boolean | undefined;
|
|
3
|
+
isHtml?: boolean | undefined;
|
|
4
|
+
classes?: string[] | undefined;
|
|
5
|
+
title?: string | undefined;
|
|
6
|
+
message: string | Error;
|
|
7
|
+
shouldConfirm?: boolean | undefined;
|
|
8
|
+
callback: (ok: boolean) => void;
|
|
9
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
10
|
+
isBare?: boolean | undefined;
|
|
11
|
+
isHtml?: boolean | undefined;
|
|
12
|
+
classes?: string[] | undefined;
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
message: string | Error;
|
|
15
|
+
shouldConfirm?: boolean | undefined;
|
|
16
|
+
callback: (ok: boolean) => void;
|
|
17
|
+
}>>>, {}, {}>;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
20
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
21
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
22
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
23
|
+
} : {
|
|
24
|
+
type: import('vue').PropType<T[K]>;
|
|
47
25
|
required: true;
|
|
48
26
|
};
|
|
49
|
-
}
|
|
50
|
-
export default _default;
|
|
27
|
+
};
|
|
@@ -1,42 +1,27 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{
|
|
2
|
-
modelValue:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
placeholder: {
|
|
10
|
-
type: import("vue").PropType<string>;
|
|
11
|
-
};
|
|
12
|
-
options: {
|
|
13
|
-
type: import("vue").PropType<string[] | Record<string, string>>;
|
|
14
|
-
required: true;
|
|
15
|
-
};
|
|
16
|
-
formatter: {
|
|
17
|
-
type: import("vue").PropType<(value: any) => string>;
|
|
18
|
-
};
|
|
19
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
modelValue: string | null | undefined;
|
|
3
|
+
nullTitle?: string | undefined;
|
|
4
|
+
placeholder?: string | undefined;
|
|
5
|
+
options: string[] | Record<string, string>;
|
|
6
|
+
formatter?: ((value: any) => string) | undefined;
|
|
7
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
8
|
"update:modelValue": (value: string | null) => void;
|
|
21
|
-
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
-
modelValue:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
placeholder: {
|
|
30
|
-
type: import("vue").PropType<string>;
|
|
31
|
-
};
|
|
32
|
-
options: {
|
|
33
|
-
type: import("vue").PropType<string[] | Record<string, string>>;
|
|
34
|
-
required: true;
|
|
35
|
-
};
|
|
36
|
-
formatter: {
|
|
37
|
-
type: import("vue").PropType<(value: any) => string>;
|
|
38
|
-
};
|
|
39
|
-
}>> & {
|
|
9
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
10
|
+
modelValue: string | null | undefined;
|
|
11
|
+
nullTitle?: string | undefined;
|
|
12
|
+
placeholder?: string | undefined;
|
|
13
|
+
options: string[] | Record<string, string>;
|
|
14
|
+
formatter?: ((value: any) => string) | undefined;
|
|
15
|
+
}>>> & {
|
|
40
16
|
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
41
17
|
}, {}, {}>;
|
|
42
18
|
export default _default;
|
|
19
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
20
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
21
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
22
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
23
|
+
} : {
|
|
24
|
+
type: import('vue').PropType<T[K]>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Writable } from 'type-fest';
|
|
2
2
|
import { type AllowedComponentProps, type ComponentInternalInstance, type ComponentPublicInstance, type ComputedOptions, type MethodOptions, type Raw, type VNode, type VNodeProps } from 'vue';
|
|
3
|
-
interface ModalInjection<C extends
|
|
3
|
+
interface ModalInjection<C extends ModalComponent> {
|
|
4
4
|
id: string;
|
|
5
|
-
component:
|
|
6
|
-
props:
|
|
5
|
+
component: ModalComponentUnwrapped<C>;
|
|
6
|
+
props: ModalComponentProps<C>;
|
|
7
7
|
vnode: VNode;
|
|
8
8
|
}
|
|
9
9
|
export declare const ModalContainer: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
@@ -15,19 +15,30 @@ export type Vue__ComponentPublicInstanceConstructor<T extends ComponentPublicIns
|
|
|
15
15
|
__isSuspense?: never;
|
|
16
16
|
new (...args: any[]): T;
|
|
17
17
|
};
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
export type ObjectComponentConfig<T extends Vue__ComponentPublicInstanceConstructor> = T extends Vue__ComponentPublicInstanceConstructor<infer P> ? P : never;
|
|
19
|
+
export type ObjectComponentProps<T extends Vue__ComponentPublicInstanceConstructor> = Writable<Omit<ObjectComponentConfig<T>['$props'], keyof VNodeProps | keyof AllowedComponentProps>>;
|
|
20
|
+
type ObjectOrDefault<T> = T extends object ? T : PropsWithCallback<{}>;
|
|
21
|
+
export type ModalComponent = Vue__ComponentPublicInstanceConstructor | ((props: any) => any);
|
|
22
|
+
export type ModalComponentConfig<T> = T extends Vue__ComponentPublicInstanceConstructor ? {
|
|
23
|
+
props: ObjectComponentProps<T>;
|
|
24
|
+
component: Raw<T>;
|
|
25
|
+
} : T extends (props: infer P) => any ? {
|
|
26
|
+
props: Omit<ObjectOrDefault<P>, keyof VNodeProps | keyof AllowedComponentProps>;
|
|
27
|
+
component: T;
|
|
28
|
+
} : never;
|
|
29
|
+
export type ModalComponentUnwrapped<T extends ModalComponent> = ModalComponentConfig<T>['component'];
|
|
30
|
+
export type ModalComponentProps<T extends ModalComponent> = ModalComponentConfig<T>['props'];
|
|
23
31
|
interface PropsWithCallback<T> {
|
|
24
32
|
callback?: (result: T) => void;
|
|
25
33
|
}
|
|
26
|
-
type ComponentReturn<
|
|
27
|
-
export
|
|
34
|
+
type ComponentReturn<M extends ModalComponent> = ModalComponentProps<M> extends PropsWithCallback<infer R> ? R : never;
|
|
35
|
+
export type AnyComponentPublicInstance = {
|
|
36
|
+
$: ComponentInternalInstance;
|
|
37
|
+
};
|
|
38
|
+
export declare function createModalInjection<C extends ModalComponent>(component: C, props: ModalComponentProps<C>): ModalInjection<C>;
|
|
28
39
|
export declare function removeModalInjection(injection: ModalInjection<any>): void;
|
|
29
40
|
export declare function removeModalInjectionByInstance(instance: AnyComponentPublicInstance): void;
|
|
30
41
|
export declare function removeModalInjectionByInternalInstance(instance: ComponentInternalInstance): void;
|
|
31
42
|
export declare function removeModalInjectionByVnode(vnode: VNode): boolean;
|
|
32
|
-
export declare function presentModal<C extends
|
|
43
|
+
export declare function presentModal<C extends ModalComponent, R extends ComponentReturn<C>>(component: C, props: Omit<ModalComponentProps<C>, 'callback'>): Promise<R | undefined>;
|
|
33
44
|
export {};
|
|
@@ -1,41 +1,21 @@
|
|
|
1
1
|
declare function mask(): void;
|
|
2
2
|
declare function unmask(): void;
|
|
3
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
4
|
-
id
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
scrolls: {
|
|
11
|
-
type: import("vue").PropType<boolean>;
|
|
12
|
-
};
|
|
13
|
-
closeX: {
|
|
14
|
-
type: import("vue").PropType<boolean>;
|
|
15
|
-
};
|
|
16
|
-
class: {
|
|
17
|
-
type: import("vue").PropType<string>;
|
|
18
|
-
};
|
|
19
|
-
}, {
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
id?: string | undefined;
|
|
5
|
+
closeOnMaskClick?: boolean | undefined;
|
|
6
|
+
scrolls?: boolean | undefined;
|
|
7
|
+
closeX?: boolean | undefined;
|
|
8
|
+
class?: string | undefined;
|
|
9
|
+
}>, {
|
|
20
10
|
mask: typeof mask;
|
|
21
11
|
unmask: typeof unmask;
|
|
22
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "formSubmit"[], "formSubmit", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
-
id
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
scrolls: {
|
|
30
|
-
type: import("vue").PropType<boolean>;
|
|
31
|
-
};
|
|
32
|
-
closeX: {
|
|
33
|
-
type: import("vue").PropType<boolean>;
|
|
34
|
-
};
|
|
35
|
-
class: {
|
|
36
|
-
type: import("vue").PropType<string>;
|
|
37
|
-
};
|
|
38
|
-
}>> & {
|
|
12
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "formSubmit"[], "formSubmit", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
13
|
+
id?: string | undefined;
|
|
14
|
+
closeOnMaskClick?: boolean | undefined;
|
|
15
|
+
scrolls?: boolean | undefined;
|
|
16
|
+
closeX?: boolean | undefined;
|
|
17
|
+
class?: string | undefined;
|
|
18
|
+
}>>> & {
|
|
39
19
|
onFormSubmit?: ((...args: any[]) => any) | undefined;
|
|
40
20
|
}, {}, {}>, {
|
|
41
21
|
header?(_: {}): any;
|
|
@@ -43,6 +23,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
43
23
|
footer?(_: {}): any;
|
|
44
24
|
}>;
|
|
45
25
|
export default _default;
|
|
26
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
27
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
28
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
29
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
30
|
+
} : {
|
|
31
|
+
type: import('vue').PropType<T[K]>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
46
35
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
47
36
|
new (): {
|
|
48
37
|
$slots: S;
|
|
@@ -819,7 +819,7 @@ function Dn(e, t) {
|
|
|
819
819
|
return;
|
|
820
820
|
}
|
|
821
821
|
const g = document.createElement("div");
|
|
822
|
-
g.classList.add("item"), g.style.userSelect = "none", g.innerText = f.title, i.appendChild(g), f.class && g.classList.add(f.class), f.shouldConfirm ? g.addEventListener("click", () => f.handler
|
|
822
|
+
g.classList.add("item"), g.style.userSelect = "none", g.innerText = f.title, i.appendChild(g), f.class && g.classList.add(f.class), f.shouldConfirm ? g.addEventListener("click", () => E(g, f.handler)) : g.addEventListener("click", () => f.handler());
|
|
823
823
|
});
|
|
824
824
|
const o = window.innerWidth - e.clientX, r = window.innerHeight - e.clientY, l = i.offsetHeight, a = i.offsetWidth, v = o < a ? e.clientX - a - 1 : e.clientX + 1, h = r < l ? e.clientY - l - 1 : e.clientY + 1;
|
|
825
825
|
i.style.left = v + "px", i.style.top = h + "px", setTimeout(() => {
|
package/package.json
CHANGED
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
type VNodeProps
|
|
16
16
|
} from 'vue';
|
|
17
17
|
|
|
18
|
-
interface ModalInjection<C extends
|
|
18
|
+
interface ModalInjection<C extends ModalComponent> {
|
|
19
19
|
id: string;
|
|
20
|
-
component:
|
|
21
|
-
props:
|
|
20
|
+
component: ModalComponentUnwrapped<C>;
|
|
21
|
+
props: ModalComponentProps<C>;
|
|
22
22
|
vnode: VNode;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -51,21 +51,37 @@ export type Vue__ComponentPublicInstanceConstructor<
|
|
|
51
51
|
new (...args: any[]): T;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
export type
|
|
54
|
+
export type ObjectComponentConfig<T extends Vue__ComponentPublicInstanceConstructor> = T extends Vue__ComponentPublicInstanceConstructor<infer P>
|
|
55
55
|
? P
|
|
56
56
|
: never;
|
|
57
|
-
export type
|
|
58
|
-
Omit<
|
|
57
|
+
export type ObjectComponentProps<T extends Vue__ComponentPublicInstanceConstructor> = Writable<
|
|
58
|
+
Omit<ObjectComponentConfig<T>['$props'], keyof VNodeProps | keyof AllowedComponentProps>
|
|
59
59
|
>;
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
type ObjectOrDefault<T> = T extends object ? T : PropsWithCallback<{}>;
|
|
62
|
+
export type ModalComponent = Vue__ComponentPublicInstanceConstructor | ((props: any) => any);
|
|
63
|
+
export type ModalComponentConfig<T> = T extends Vue__ComponentPublicInstanceConstructor
|
|
64
|
+
? {
|
|
65
|
+
props: ObjectComponentProps<T>;
|
|
66
|
+
component: Raw<T>;
|
|
67
|
+
}
|
|
68
|
+
: T extends (props: infer P) => any
|
|
69
|
+
? {
|
|
70
|
+
props: Omit<ObjectOrDefault<P>, keyof VNodeProps | keyof AllowedComponentProps>;
|
|
71
|
+
component: T;
|
|
72
|
+
}
|
|
73
|
+
: never;
|
|
74
|
+
export type ModalComponentUnwrapped<T extends ModalComponent> = ModalComponentConfig<T>['component'];
|
|
75
|
+
export type ModalComponentProps<T extends ModalComponent> = ModalComponentConfig<T>['props'];
|
|
62
76
|
|
|
63
77
|
interface PropsWithCallback<T> {
|
|
64
78
|
callback?: (result: T) => void;
|
|
65
79
|
}
|
|
66
|
-
type ComponentReturn<
|
|
80
|
+
type ComponentReturn<M extends ModalComponent> = ModalComponentProps<M> extends PropsWithCallback<infer R> ? R : never;
|
|
81
|
+
|
|
82
|
+
export type AnyComponentPublicInstance = { $: ComponentInternalInstance };
|
|
67
83
|
|
|
68
|
-
export function createModalInjection<C extends
|
|
84
|
+
export function createModalInjection<C extends ModalComponent>(component: C, props: ModalComponentProps<C>): ModalInjection<C> {
|
|
69
85
|
// create or reconfigure the existing modal target
|
|
70
86
|
// re-injecting every time keeps the modal container at the very end of the DOM
|
|
71
87
|
const targetEl = document.getElementById('vf-modal-target') ?? document.createElement('div');
|
|
@@ -115,9 +131,9 @@ export function removeModalInjectionByVnode(vnode: VNode) {
|
|
|
115
131
|
return false;
|
|
116
132
|
}
|
|
117
133
|
|
|
118
|
-
export async function presentModal<C extends
|
|
134
|
+
export async function presentModal<C extends ModalComponent, R extends ComponentReturn<C>>(
|
|
119
135
|
component: C,
|
|
120
|
-
props: Omit<
|
|
136
|
+
props: Omit<ModalComponentProps<C>, 'callback'>
|
|
121
137
|
): Promise<R | undefined> {
|
|
122
138
|
return new Promise<R>(resolve => {
|
|
123
139
|
let modalInjection: ModalInjection<C> | null = null;
|
|
@@ -125,7 +141,7 @@ export async function presentModal<C extends Vue__ComponentPublicInstanceConstru
|
|
|
125
141
|
removeModalInjection(modalInjection!);
|
|
126
142
|
resolve(result);
|
|
127
143
|
};
|
|
128
|
-
const resolvedProps = { ...props, callback } as
|
|
144
|
+
const resolvedProps = { ...props, callback } as ModalComponentProps<C>;
|
|
129
145
|
modalInjection = createModalInjection(component, resolvedProps);
|
|
130
146
|
});
|
|
131
147
|
}
|
|
@@ -53,9 +53,9 @@ export function showContextMenu(e: MouseEvent, config: ContextMenuConfig) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
if (item.shouldConfirm) {
|
|
56
|
-
itemEl.addEventListener('click', () => item.handler());
|
|
57
|
-
} else {
|
|
58
56
|
itemEl.addEventListener('click', () => confirmAction(itemEl, item.handler));
|
|
57
|
+
} else {
|
|
58
|
+
itemEl.addEventListener('click', () => item.handler());
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -106,3 +106,4 @@ export function showContextMenu(e: MouseEvent, config: ContextMenuConfig) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// TODO: actually de-select text rather than just using CSS to hide its selection
|
|
109
|
+
// TODO: confirm isn't working
|