@vnejs/module.controller.arrows.horizontal 0.2.3 → 0.2.4
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 -2
- package/dist/index.js +7 -0
- package/package.json +1 -1
- package/src/index.ts +8 -0
package/dist/index.d.ts
CHANGED
|
@@ -14,12 +14,13 @@ export declare abstract class ModuleControllerArrowsHorizontal<TEvents extends M
|
|
|
14
14
|
};
|
|
15
15
|
currentItem: number | null;
|
|
16
16
|
maxCurrentItem: number;
|
|
17
|
+
isShow: boolean;
|
|
17
18
|
subscribe: () => void;
|
|
18
19
|
getDefaultState: () => TState;
|
|
19
20
|
abstract getMaxCurrentItem: () => number | Promise<number>;
|
|
20
21
|
isArrowItemAvailable: (_index: number) => boolean | Promise<boolean>;
|
|
21
|
-
onShow: () => Promise<
|
|
22
|
-
onHide: () => Promise<
|
|
22
|
+
onShow: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:push">> | undefined;
|
|
23
|
+
onHide: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:pop">> | undefined;
|
|
23
24
|
incCurrentItem: () => Promise<void>;
|
|
24
25
|
decCurrentItem: () => Promise<void>;
|
|
25
26
|
setCurrentItem: (value: number, defaultValue: number, direction?: 1 | -1) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export class ModuleControllerArrowsHorizontal extends ModuleCore {
|
|
|
6
6
|
};
|
|
7
7
|
currentItem = null;
|
|
8
8
|
maxCurrentItem = 0;
|
|
9
|
+
isShow = false;
|
|
9
10
|
subscribe = () => {
|
|
10
11
|
this.on(this.EVENT_SHOW, this.onShow);
|
|
11
12
|
this.on(this.EVENT_HIDE, this.onHide);
|
|
@@ -13,6 +14,9 @@ export class ModuleControllerArrowsHorizontal extends ModuleCore {
|
|
|
13
14
|
getDefaultState = () => ({});
|
|
14
15
|
isArrowItemAvailable = (_index) => true;
|
|
15
16
|
onShow = () => {
|
|
17
|
+
if (this.isShow)
|
|
18
|
+
return;
|
|
19
|
+
this.isShow = true;
|
|
16
20
|
this.currentItem = null;
|
|
17
21
|
return this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
18
22
|
key: this.name,
|
|
@@ -22,6 +26,9 @@ export class ModuleControllerArrowsHorizontal extends ModuleCore {
|
|
|
22
26
|
});
|
|
23
27
|
};
|
|
24
28
|
onHide = () => {
|
|
29
|
+
if (!this.isShow)
|
|
30
|
+
return;
|
|
31
|
+
this.isShow = false;
|
|
25
32
|
this.currentItem = null;
|
|
26
33
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
|
|
27
34
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -41,6 +41,8 @@ export abstract class ModuleControllerArrowsHorizontal<
|
|
|
41
41
|
currentItem: number | null = null;
|
|
42
42
|
maxCurrentItem = 0;
|
|
43
43
|
|
|
44
|
+
isShow = false;
|
|
45
|
+
|
|
44
46
|
subscribe = () => {
|
|
45
47
|
this.on(this.EVENT_SHOW, this.onShow);
|
|
46
48
|
this.on(this.EVENT_HIDE, this.onHide);
|
|
@@ -53,6 +55,9 @@ export abstract class ModuleControllerArrowsHorizontal<
|
|
|
53
55
|
isArrowItemAvailable = (_index: number): boolean | Promise<boolean> => true;
|
|
54
56
|
|
|
55
57
|
onShow = () => {
|
|
58
|
+
if (this.isShow) return;
|
|
59
|
+
|
|
60
|
+
this.isShow = true;
|
|
56
61
|
this.currentItem = null;
|
|
57
62
|
|
|
58
63
|
return this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
@@ -64,6 +69,9 @@ export abstract class ModuleControllerArrowsHorizontal<
|
|
|
64
69
|
};
|
|
65
70
|
|
|
66
71
|
onHide = () => {
|
|
72
|
+
if (!this.isShow) return;
|
|
73
|
+
|
|
74
|
+
this.isShow = false;
|
|
67
75
|
this.currentItem = null;
|
|
68
76
|
|
|
69
77
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name } satisfies ControlsPopPayload);
|