@vnejs/module.controller.accept 0.2.6 → 0.2.8
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 +3 -4
- package/dist/index.js +15 -22
- package/dist/types.d.ts +1 -3
- package/package.json +1 -1
- package/src/index.ts +15 -23
- package/src/types.ts +1 -3
package/dist/index.d.ts
CHANGED
|
@@ -10,11 +10,10 @@ 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
|
-
emitAccept: () => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
|
|
14
|
-
get CONTROLS(): Record<string, () => void>;
|
|
15
13
|
subscribe: () => void;
|
|
16
|
-
getDefaultState: () => TState;
|
|
17
|
-
abstract onAccept: () => void | Promise<void>;
|
|
18
14
|
onShow: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:push">> | undefined;
|
|
19
15
|
onHide: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:pop">> | undefined;
|
|
16
|
+
abstract onAccept: () => void | Promise<void>;
|
|
17
|
+
emitAccept: () => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
|
|
18
|
+
get CONTROLS(): Record<string, () => void>;
|
|
20
19
|
}
|
package/dist/index.js
CHANGED
|
@@ -3,15 +3,6 @@ export class ModuleControllerAccept extends ModuleCore {
|
|
|
3
3
|
EVENT_UPDATE_STATE;
|
|
4
4
|
IS_ACCEPT_ENABLED = true;
|
|
5
5
|
IS_INTERACT_ENABLED = true;
|
|
6
|
-
emitAccept = () => this.emit(this.EVENT_ACCEPT);
|
|
7
|
-
get CONTROLS() {
|
|
8
|
-
const controls = {};
|
|
9
|
-
if (this.IS_ACCEPT_ENABLED)
|
|
10
|
-
controls[this.CONST.CONTROLS.BUTTONS.ACCEPT] = () => void this.emitAccept();
|
|
11
|
-
if (this.IS_INTERACT_ENABLED)
|
|
12
|
-
controls[this.CONST.CONTROLS.BUTTONS.INTERACT] = () => void this.emitAccept();
|
|
13
|
-
return controls;
|
|
14
|
-
}
|
|
15
6
|
subscribe = () => {
|
|
16
7
|
const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
|
|
17
8
|
this.on(this.EVENT_SHOW, this.onShow, { priority: SHOW.CONTROLS });
|
|
@@ -20,21 +11,23 @@ export class ModuleControllerAccept extends ModuleCore {
|
|
|
20
11
|
if (this.EVENT_UPDATE_STATE)
|
|
21
12
|
this.on(this.EVENT_UPDATE_STATE, this.updateState);
|
|
22
13
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
index: this.CONTROLS_ZINDEX + 1,
|
|
30
|
-
checkNext: true,
|
|
31
|
-
});
|
|
32
|
-
};
|
|
14
|
+
onShow = () => this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
15
|
+
key: this.name,
|
|
16
|
+
controls: this.CONTROLS,
|
|
17
|
+
index: this.CONTROLS_ZINDEX + 1,
|
|
18
|
+
checkNext: true,
|
|
19
|
+
});
|
|
33
20
|
onHide = () => {
|
|
34
|
-
if (!this.state.isShow)
|
|
35
|
-
return;
|
|
36
|
-
this.updateState({ isShow: false });
|
|
37
21
|
this.setDefaultState();
|
|
38
22
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
|
|
39
23
|
};
|
|
24
|
+
emitAccept = () => this.emit(this.EVENT_ACCEPT);
|
|
25
|
+
get CONTROLS() {
|
|
26
|
+
const controls = {};
|
|
27
|
+
if (this.IS_ACCEPT_ENABLED)
|
|
28
|
+
controls[this.CONST.CONTROLS.BUTTONS.ACCEPT] = () => void this.emitAccept();
|
|
29
|
+
if (this.IS_INTERACT_ENABLED)
|
|
30
|
+
controls[this.CONST.CONTROLS.BUTTONS.INTERACT] = () => void this.emitAccept();
|
|
31
|
+
return controls;
|
|
32
|
+
}
|
|
40
33
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,6 +4,4 @@ export type ModuleControllerAcceptEvents = ModuleCoreEvents & Record<ControlsPlu
|
|
|
4
4
|
export type ModuleControllerAcceptConstants = ModuleCoreConstants & Record<ControlsPluginName, ControlsConstants>;
|
|
5
5
|
export type ModuleControllerAcceptSettings = ModuleCoreSettings;
|
|
6
6
|
export type ModuleControllerAcceptParams = ModuleCoreParams;
|
|
7
|
-
export type ModuleControllerAcceptState =
|
|
8
|
-
isShow: boolean;
|
|
9
|
-
};
|
|
7
|
+
export type ModuleControllerAcceptState = object;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -36,17 +36,6 @@ export abstract class ModuleControllerAccept<
|
|
|
36
36
|
IS_ACCEPT_ENABLED = true;
|
|
37
37
|
IS_INTERACT_ENABLED = true;
|
|
38
38
|
|
|
39
|
-
emitAccept = () => this.emit(this.EVENT_ACCEPT);
|
|
40
|
-
|
|
41
|
-
get CONTROLS() {
|
|
42
|
-
const controls: Record<string, () => void> = {};
|
|
43
|
-
|
|
44
|
-
if (this.IS_ACCEPT_ENABLED) controls[this.CONST.CONTROLS.BUTTONS.ACCEPT] = () => void this.emitAccept();
|
|
45
|
-
if (this.IS_INTERACT_ENABLED) controls[this.CONST.CONTROLS.BUTTONS.INTERACT] = () => void this.emitAccept();
|
|
46
|
-
|
|
47
|
-
return controls;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
39
|
subscribe = () => {
|
|
51
40
|
const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
|
|
52
41
|
|
|
@@ -56,27 +45,30 @@ export abstract class ModuleControllerAccept<
|
|
|
56
45
|
if (this.EVENT_UPDATE_STATE) this.on(this.EVENT_UPDATE_STATE, this.updateState);
|
|
57
46
|
};
|
|
58
47
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
abstract onAccept: () => void | Promise<void>;
|
|
62
|
-
|
|
63
|
-
onShow = () => {
|
|
64
|
-
this.updateState({ isShow: true } as Partial<TState>);
|
|
65
|
-
|
|
66
|
-
return this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
48
|
+
onShow = () =>
|
|
49
|
+
this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
67
50
|
key: this.name,
|
|
68
51
|
controls: this.CONTROLS,
|
|
69
52
|
index: this.CONTROLS_ZINDEX + 1,
|
|
70
53
|
checkNext: true,
|
|
71
54
|
} satisfies ControlsPushPayload);
|
|
72
|
-
};
|
|
73
55
|
|
|
74
56
|
onHide = () => {
|
|
75
|
-
if (!this.state.isShow) return;
|
|
76
|
-
|
|
77
|
-
this.updateState({ isShow: false } as Partial<TState>);
|
|
78
57
|
this.setDefaultState();
|
|
79
58
|
|
|
80
59
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name } satisfies ControlsPopPayload);
|
|
81
60
|
};
|
|
61
|
+
|
|
62
|
+
abstract onAccept: () => void | Promise<void>;
|
|
63
|
+
|
|
64
|
+
emitAccept = () => this.emit(this.EVENT_ACCEPT);
|
|
65
|
+
|
|
66
|
+
get CONTROLS() {
|
|
67
|
+
const controls: Record<string, () => void> = {};
|
|
68
|
+
|
|
69
|
+
if (this.IS_ACCEPT_ENABLED) controls[this.CONST.CONTROLS.BUTTONS.ACCEPT] = () => void this.emitAccept();
|
|
70
|
+
if (this.IS_INTERACT_ENABLED) controls[this.CONST.CONTROLS.BUTTONS.INTERACT] = () => void this.emitAccept();
|
|
71
|
+
|
|
72
|
+
return controls;
|
|
73
|
+
}
|
|
82
74
|
}
|
package/src/types.ts
CHANGED