@shival99/z-ui-svelte 0.1.21 → 0.1.22
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/components/z-drawer/ZDrawer.svelte +5 -2
- package/dist/components/z-drawer/ZDrawer.svelte.d.ts +2 -0
- package/dist/components/z-drawer/ZDrawerHost.svelte +1 -1
- package/dist/components/z-drawer/z-drawer.options.d.ts +2 -0
- package/dist/components/z-drawer/z-drawer.ref.svelte.js +1 -0
- package/dist/components/z-modal/ZModal.svelte +4 -1
- package/dist/components/z-modal/ZModal.svelte.d.ts +2 -0
- package/dist/components/z-modal/z-modal.options.d.ts +2 -0
- package/dist/components/z-modal/z-modal.ref.svelte.js +1 -0
- package/dist/components/z-modal/z-modal.service.js +1 -0
- package/dist/components/z-modal/z-modal.types.d.ts +2 -0
- package/dist/overlay/dialog-ref.svelte.d.ts +2 -0
- package/dist/overlay/dialog-ref.svelte.js +1 -1
- package/package.json +1 -1
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
zOkDestructive?: boolean;
|
|
47
47
|
zOkDisabled?: boolean;
|
|
48
48
|
zLoading?: boolean;
|
|
49
|
+
/** Cancel, the close button, Escape and the backdrop keep working while `zLoading` is true. */
|
|
50
|
+
zCancelWhileLoading?: boolean;
|
|
49
51
|
zOverlay?: ZDrawerOverlayType;
|
|
50
52
|
zShadow?: boolean;
|
|
51
53
|
zShape?: ZDrawerShape;
|
|
@@ -94,6 +96,7 @@
|
|
|
94
96
|
zOkDestructive = false,
|
|
95
97
|
zOkDisabled = false,
|
|
96
98
|
zLoading = false,
|
|
99
|
+
zCancelWhileLoading = false,
|
|
97
100
|
zOverlay = zDefaultOverlayType(),
|
|
98
101
|
zShadow = false,
|
|
99
102
|
zShape = 'rounded',
|
|
@@ -126,7 +129,7 @@
|
|
|
126
129
|
snap = index;
|
|
127
130
|
onSnapChange?.(index);
|
|
128
131
|
},
|
|
129
|
-
canDismiss: () => zMaskClosable && !zLoading,
|
|
132
|
+
canDismiss: () => zMaskClosable && (!zLoading || zCancelWhileLoading),
|
|
130
133
|
dismiss: () => cancel(),
|
|
131
134
|
});
|
|
132
135
|
const resize = new ZDrawerResizeController(
|
|
@@ -157,7 +160,7 @@
|
|
|
157
160
|
};
|
|
158
161
|
|
|
159
162
|
const cancel = (): void => {
|
|
160
|
-
if (zLoading) {
|
|
163
|
+
if (zLoading && !zCancelWhileLoading) {
|
|
161
164
|
return;
|
|
162
165
|
}
|
|
163
166
|
onCancel?.();
|
|
@@ -33,6 +33,8 @@ interface Props {
|
|
|
33
33
|
zOkDestructive?: boolean;
|
|
34
34
|
zOkDisabled?: boolean;
|
|
35
35
|
zLoading?: boolean;
|
|
36
|
+
/** Cancel, the close button, Escape and the backdrop keep working while `zLoading` is true. */
|
|
37
|
+
zCancelWhileLoading?: boolean;
|
|
36
38
|
zOverlay?: ZDrawerOverlayType;
|
|
37
39
|
zShadow?: boolean;
|
|
38
40
|
zShape?: ZDrawerShape;
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
ref.snap = index;
|
|
53
53
|
options.onSnapChange?.(index);
|
|
54
54
|
},
|
|
55
|
-
canDismiss: () => (options.zMaskClosable ?? true) && !ref.busy,
|
|
55
|
+
canDismiss: () => (options.zMaskClosable ?? true) && (!ref.busy || !!options.zCancelWhileLoading),
|
|
56
56
|
dismiss: () => void ref._trigger('cancel'),
|
|
57
57
|
})
|
|
58
58
|
: null;
|
|
@@ -49,6 +49,8 @@ export interface ZDrawerOptions<R = unknown, U = unknown, T = unknown> {
|
|
|
49
49
|
zOkDestructive?: boolean;
|
|
50
50
|
zOkDisabled?: ZMaybeGetter<boolean>;
|
|
51
51
|
zLoading?: ZMaybeGetter<boolean>;
|
|
52
|
+
/** Keep Cancel, the close button, Escape and the backdrop working while loading (default: ignored). */
|
|
53
|
+
zCancelWhileLoading?: boolean;
|
|
52
54
|
zContentLoading?: ZMaybeGetter<boolean>;
|
|
53
55
|
/** Defaults to 6 for left/right, 3 for top/bottom. */
|
|
54
56
|
zSkeletonRows?: number;
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
zOkDestructive?: boolean;
|
|
34
34
|
zOkDisabled?: boolean;
|
|
35
35
|
zLoading?: boolean;
|
|
36
|
+
/** Cancel, the close button, Escape and the backdrop keep working while `zLoading` is true. */
|
|
37
|
+
zCancelWhileLoading?: boolean;
|
|
36
38
|
zContentLoading?: boolean;
|
|
37
39
|
zSkeletonRows?: number;
|
|
38
40
|
zOverlay?: ZModalOverlayType;
|
|
@@ -66,6 +68,7 @@
|
|
|
66
68
|
zOkDestructive = false,
|
|
67
69
|
zOkDisabled = false,
|
|
68
70
|
zLoading = false,
|
|
71
|
+
zCancelWhileLoading = false,
|
|
69
72
|
zContentLoading = false,
|
|
70
73
|
zSkeletonRows = 3,
|
|
71
74
|
zOverlay = zDefaultOverlayType(),
|
|
@@ -102,7 +105,7 @@
|
|
|
102
105
|
};
|
|
103
106
|
|
|
104
107
|
const cancel = (): void => {
|
|
105
|
-
if (zLoading) {
|
|
108
|
+
if (zLoading && !zCancelWhileLoading) {
|
|
106
109
|
return;
|
|
107
110
|
}
|
|
108
111
|
onCancel?.();
|
|
@@ -22,6 +22,8 @@ interface Props {
|
|
|
22
22
|
zOkDestructive?: boolean;
|
|
23
23
|
zOkDisabled?: boolean;
|
|
24
24
|
zLoading?: boolean;
|
|
25
|
+
/** Cancel, the close button, Escape and the backdrop keep working while `zLoading` is true. */
|
|
26
|
+
zCancelWhileLoading?: boolean;
|
|
25
27
|
zContentLoading?: boolean;
|
|
26
28
|
zSkeletonRows?: number;
|
|
27
29
|
zOverlay?: ZModalOverlayType;
|
|
@@ -41,6 +41,8 @@ export interface ZModalOptions<R = unknown, U = unknown, T = unknown> {
|
|
|
41
41
|
zOkDisabled?: ZMaybeGetter<boolean>;
|
|
42
42
|
/** OK button loading state, e.g. `() => saving`. `ref.loading` works too. */
|
|
43
43
|
zLoading?: ZMaybeGetter<boolean>;
|
|
44
|
+
/** Keep Cancel, the close button, Escape and the backdrop working while loading (default: ignored). */
|
|
45
|
+
zCancelWhileLoading?: boolean;
|
|
44
46
|
/** Shows a skeleton while true, e.g. `() => loading`. */
|
|
45
47
|
zContentLoading?: ZMaybeGetter<boolean>;
|
|
46
48
|
zSkeletonRows?: number;
|
|
@@ -44,6 +44,7 @@ export class ZModalService {
|
|
|
44
44
|
zConfirmIcon: options.zIcon ?? (options.zConfirmStyle === 'dialog' ? preset.dialogIcon : preset.icon),
|
|
45
45
|
zConfirmStyle: options.zConfirmStyle,
|
|
46
46
|
zMaskClosable: options.zMaskClosable ?? true,
|
|
47
|
+
zCancelWhileLoading: options.zCancelWhileLoading,
|
|
47
48
|
zWidth: options.zWidth ?? '500px',
|
|
48
49
|
zConfirmType: type,
|
|
49
50
|
zData: options.zData,
|
|
@@ -21,6 +21,8 @@ export interface ZModalConfirmOptions<U = unknown> {
|
|
|
21
21
|
/** `null` hides the cancel button */
|
|
22
22
|
zCancelText?: string | null;
|
|
23
23
|
zMaskClosable?: boolean;
|
|
24
|
+
/** Keep Cancel, Escape and the backdrop working while `onOk` is pending. */
|
|
25
|
+
zCancelWhileLoading?: boolean;
|
|
24
26
|
zConfirmStyle?: ZModalConfirmStyle;
|
|
25
27
|
zWidth?: string;
|
|
26
28
|
zData?: U;
|
|
@@ -7,6 +7,8 @@ interface ZDialogRefInit<Ref, R, U> {
|
|
|
7
7
|
onOk?: ZDialogHandler<Ref, R>;
|
|
8
8
|
onCancel?: ZDialogHandler<Ref, R>;
|
|
9
9
|
zLoading?: ZMaybeGetter<boolean>;
|
|
10
|
+
/** Cancel stays available while an action is loading. */
|
|
11
|
+
zCancelWhileLoading?: boolean;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Shared handle behind `ZModalRef` / `ZDrawerRef`. Plain reactive class fields instead of
|
|
@@ -51,7 +51,7 @@ export class ZDialogRef {
|
|
|
51
51
|
}
|
|
52
52
|
/** @internal */
|
|
53
53
|
async _trigger(action) {
|
|
54
|
-
if (this.busy
|
|
54
|
+
if (this.#closing || (this.busy && !(action === 'cancel' && this.#init.zCancelWhileLoading))) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
const handler = action === 'ok' ? this.#init.onOk : this.#init.onCancel;
|