@vnejs/module.controller.arrows.horizontal 0.2.7 → 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 +1 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
- package/src/index.ts +11 -0
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare abstract class ModuleControllerArrowsHorizontal<TEvents extends M
|
|
|
21
21
|
onArrowRight: () => void | Promise<void>;
|
|
22
22
|
onShow: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:push">> | undefined;
|
|
23
23
|
onHide: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:pop">> | undefined;
|
|
24
|
+
onHideCleanup: () => Promise<import("@vnejs/shared").EmitResults<string> | undefined>;
|
|
24
25
|
incCurrentItem: () => Promise<void>;
|
|
25
26
|
decCurrentItem: () => Promise<void>;
|
|
26
27
|
setCurrentItem: (value: number, defaultValue: number, direction?: 1 | -1) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export class ModuleControllerArrowsHorizontal extends ModuleCore {
|
|
|
10
10
|
const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
|
|
11
11
|
this.on(this.EVENT_SHOW, this.onShow, { priority: SHOW.CONTROLS });
|
|
12
12
|
this.on(this.EVENT_HIDE, this.onHide, { priority: HIDE.CONTROLS });
|
|
13
|
+
this.on(this.EVENT_HIDE, this.onHideCleanup, { priority: HIDE.CLEANUP });
|
|
13
14
|
this.on(this.EVENT_UPDATE_STATE, this.updateState);
|
|
14
15
|
};
|
|
15
16
|
getMaxCurrentItem = () => 0;
|
|
@@ -29,6 +30,12 @@ export class ModuleControllerArrowsHorizontal extends ModuleCore {
|
|
|
29
30
|
this.currentItem = null;
|
|
30
31
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
|
|
31
32
|
};
|
|
33
|
+
onHideCleanup = async () => {
|
|
34
|
+
this.currentItem = null;
|
|
35
|
+
const unset = { currentArrowHorizontalItem: undefined };
|
|
36
|
+
await this.emit(this.EVENT_UPDATE_STATE, unset);
|
|
37
|
+
return this.emit(this.EVENT_UPDATE_FAST);
|
|
38
|
+
};
|
|
32
39
|
incCurrentItem = async () => {
|
|
33
40
|
await this.syncMaxCurrentItem();
|
|
34
41
|
return this.setCurrentItem((this.currentItem ?? 0) + 1, 0, 1);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -46,6 +46,7 @@ export abstract class ModuleControllerArrowsHorizontal<
|
|
|
46
46
|
|
|
47
47
|
this.on(this.EVENT_SHOW, this.onShow, { priority: SHOW.CONTROLS });
|
|
48
48
|
this.on(this.EVENT_HIDE, this.onHide, { priority: HIDE.CONTROLS });
|
|
49
|
+
this.on(this.EVENT_HIDE, this.onHideCleanup, { priority: HIDE.CLEANUP });
|
|
49
50
|
this.on(this.EVENT_UPDATE_STATE, this.updateState);
|
|
50
51
|
};
|
|
51
52
|
|
|
@@ -73,6 +74,16 @@ export abstract class ModuleControllerArrowsHorizontal<
|
|
|
73
74
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name } satisfies ControlsPopPayload);
|
|
74
75
|
};
|
|
75
76
|
|
|
77
|
+
onHideCleanup = async () => {
|
|
78
|
+
this.currentItem = null;
|
|
79
|
+
|
|
80
|
+
const unset = { currentArrowHorizontalItem: undefined } satisfies Partial<ModuleControllerArrowsHorizontalState>;
|
|
81
|
+
|
|
82
|
+
await this.emit(this.EVENT_UPDATE_STATE, unset);
|
|
83
|
+
|
|
84
|
+
return this.emit(this.EVENT_UPDATE_FAST);
|
|
85
|
+
};
|
|
86
|
+
|
|
76
87
|
incCurrentItem = async () => {
|
|
77
88
|
await this.syncMaxCurrentItem();
|
|
78
89
|
|