@vnejs/module.controller.accept 0.2.4 → 0.2.5
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/index.d.ts +4 -3
- package/dist/index.js +15 -6
- package/package.json +1 -1
- package/src/index.ts +12 -2
package/dist/index.d.ts
CHANGED
|
@@ -10,11 +10,12 @@ export declare abstract class ModuleControllerAccept<TEvents extends ModuleContr
|
|
|
10
10
|
abstract CONTROLS_ZINDEX: number;
|
|
11
11
|
IS_ACCEPT_ENABLED: boolean;
|
|
12
12
|
IS_INTERACT_ENABLED: boolean;
|
|
13
|
-
|
|
13
|
+
isShow: boolean;
|
|
14
|
+
emitAccept: () => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
|
|
14
15
|
get CONTROLS(): Record<string, () => void>;
|
|
15
16
|
subscribe: () => void;
|
|
16
17
|
getDefaultState: () => TState;
|
|
17
18
|
abstract onAccept: () => void | Promise<void>;
|
|
18
|
-
onShow: () => Promise<
|
|
19
|
-
onHide: () => Promise<
|
|
19
|
+
onShow: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:push">> | undefined;
|
|
20
|
+
onHide: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:pop">> | undefined;
|
|
20
21
|
}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export class ModuleControllerAccept extends ModuleCore {
|
|
|
3
3
|
EVENT_STATE_UPDATE;
|
|
4
4
|
IS_ACCEPT_ENABLED = true;
|
|
5
5
|
IS_INTERACT_ENABLED = true;
|
|
6
|
+
isShow = false;
|
|
6
7
|
emitAccept = () => this.emit(this.EVENT_ACCEPT);
|
|
7
8
|
get CONTROLS() {
|
|
8
9
|
const controls = {};
|
|
@@ -20,13 +21,21 @@ export class ModuleControllerAccept extends ModuleCore {
|
|
|
20
21
|
this.on(this.EVENT_STATE_UPDATE, this.updateState);
|
|
21
22
|
};
|
|
22
23
|
getDefaultState = () => ({});
|
|
23
|
-
onShow = () =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
onShow = () => {
|
|
25
|
+
if (this.isShow)
|
|
26
|
+
return;
|
|
27
|
+
this.isShow = true;
|
|
28
|
+
return this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
29
|
+
key: this.name,
|
|
30
|
+
controls: this.CONTROLS,
|
|
31
|
+
index: this.CONTROLS_ZINDEX + 1,
|
|
32
|
+
checkNext: true,
|
|
33
|
+
});
|
|
34
|
+
};
|
|
29
35
|
onHide = () => {
|
|
36
|
+
if (!this.isShow)
|
|
37
|
+
return;
|
|
38
|
+
this.isShow = false;
|
|
30
39
|
this.setDefaultState();
|
|
31
40
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
|
|
32
41
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -24,6 +24,8 @@ export abstract class ModuleControllerAccept<
|
|
|
24
24
|
IS_ACCEPT_ENABLED = true;
|
|
25
25
|
IS_INTERACT_ENABLED = true;
|
|
26
26
|
|
|
27
|
+
isShow = false;
|
|
28
|
+
|
|
27
29
|
emitAccept = () => this.emit(this.EVENT_ACCEPT);
|
|
28
30
|
|
|
29
31
|
get CONTROLS() {
|
|
@@ -46,15 +48,23 @@ export abstract class ModuleControllerAccept<
|
|
|
46
48
|
|
|
47
49
|
abstract onAccept: () => void | Promise<void>;
|
|
48
50
|
|
|
49
|
-
onShow = () =>
|
|
50
|
-
|
|
51
|
+
onShow = () => {
|
|
52
|
+
if (this.isShow) return;
|
|
53
|
+
|
|
54
|
+
this.isShow = true;
|
|
55
|
+
|
|
56
|
+
return this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
51
57
|
key: this.name,
|
|
52
58
|
controls: this.CONTROLS,
|
|
53
59
|
index: this.CONTROLS_ZINDEX + 1,
|
|
54
60
|
checkNext: true,
|
|
55
61
|
} satisfies ControlsPushPayload);
|
|
62
|
+
};
|
|
56
63
|
|
|
57
64
|
onHide = () => {
|
|
65
|
+
if (!this.isShow) return;
|
|
66
|
+
|
|
67
|
+
this.isShow = false;
|
|
58
68
|
this.setDefaultState();
|
|
59
69
|
|
|
60
70
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name } satisfies ControlsPopPayload);
|