@vnejs/module.controller.arrows.grid 0.2.3 → 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 -1
- package/dist/index.js +8 -9
- package/dist/types.d.ts +0 -1
- package/package.json +1 -1
- package/src/index.ts +9 -10
- package/src/types.ts +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -31,8 +31,11 @@ export declare abstract class ModuleControllerArrowsGrid<TEvents extends ModuleC
|
|
|
31
31
|
getCurrentGridIndex: () => number;
|
|
32
32
|
getGridsCount: () => number;
|
|
33
33
|
getGridItemsCount: (gridItems?: unknown[]) => number;
|
|
34
|
+
onArrowUp: () => void | Promise<void>;
|
|
35
|
+
onArrowRight: () => void | Promise<void>;
|
|
36
|
+
onArrowBottom: () => void | Promise<void>;
|
|
37
|
+
onArrowLeft: () => void | Promise<void>;
|
|
34
38
|
subscribe: () => void;
|
|
35
|
-
getDefaultState: () => TState;
|
|
36
39
|
getGridItems: () => Promise<unknown[]>;
|
|
37
40
|
onGridClear: () => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
|
|
38
41
|
onGridUpdateItems: () => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import { ModuleCore } from "@vnejs/module.core";
|
|
|
2
2
|
export class ModuleControllerArrowsGrid extends ModuleCore {
|
|
3
3
|
EVENT_GRID_UPDATE_ITEMS;
|
|
4
4
|
CONTROLS = {
|
|
5
|
-
[this.CONST.CONTROLS.BUTTONS.ARROW_UP]: () => void this.
|
|
6
|
-
[this.CONST.CONTROLS.BUTTONS.ARROW_RIGHT]: () => void this.
|
|
7
|
-
[this.CONST.CONTROLS.BUTTONS.ARROW_BOTTOM]: () => void this.
|
|
8
|
-
[this.CONST.CONTROLS.BUTTONS.ARROW_LEFT]: () => void this.
|
|
5
|
+
[this.CONST.CONTROLS.BUTTONS.ARROW_UP]: () => void this.onArrowUp(),
|
|
6
|
+
[this.CONST.CONTROLS.BUTTONS.ARROW_RIGHT]: () => void this.onArrowRight(),
|
|
7
|
+
[this.CONST.CONTROLS.BUTTONS.ARROW_BOTTOM]: () => void this.onArrowBottom(),
|
|
8
|
+
[this.CONST.CONTROLS.BUTTONS.ARROW_LEFT]: () => void this.onArrowLeft(),
|
|
9
9
|
};
|
|
10
10
|
gridRow = null;
|
|
11
11
|
gridColumn = null;
|
|
@@ -18,6 +18,10 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
|
|
|
18
18
|
getCurrentGridIndex = () => this.cachedGridIndex;
|
|
19
19
|
getGridsCount = () => this.cachedGridsCount;
|
|
20
20
|
getGridItemsCount = (gridItems = []) => gridItems.filter((item) => !item?.isStub).length;
|
|
21
|
+
onArrowUp = () => void this.decRow();
|
|
22
|
+
onArrowRight = () => void this.incColumn();
|
|
23
|
+
onArrowBottom = () => void this.incRow();
|
|
24
|
+
onArrowLeft = () => void this.decColumn();
|
|
21
25
|
subscribe = () => {
|
|
22
26
|
const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
|
|
23
27
|
this.on(this.EVENT_SHOW, this.onShow, { priority: SHOW.CONTROLS });
|
|
@@ -27,7 +31,6 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
|
|
|
27
31
|
if (this.EVENT_GRID_UPDATE_ITEMS)
|
|
28
32
|
this.on(this.EVENT_GRID_UPDATE_ITEMS, this.onGridUpdateItems);
|
|
29
33
|
};
|
|
30
|
-
getDefaultState = () => ({ isShow: false });
|
|
31
34
|
getGridItems = async () => [];
|
|
32
35
|
onGridClear = () => {
|
|
33
36
|
this.gridRow = null;
|
|
@@ -80,7 +83,6 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
|
|
|
80
83
|
this.emitPosition();
|
|
81
84
|
};
|
|
82
85
|
onShow = () => {
|
|
83
|
-
this.updateState({ isShow: true });
|
|
84
86
|
this.gridRow = null;
|
|
85
87
|
this.gridColumn = null;
|
|
86
88
|
return this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
@@ -91,9 +93,6 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
|
|
|
91
93
|
});
|
|
92
94
|
};
|
|
93
95
|
onHide = () => {
|
|
94
|
-
if (!this.state.isShow)
|
|
95
|
-
return;
|
|
96
|
-
this.updateState({ isShow: false });
|
|
97
96
|
this.gridRow = null;
|
|
98
97
|
this.gridColumn = null;
|
|
99
98
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export type ModuleControllerArrowsGridConstants = ModuleCoreConstants & Record<C
|
|
|
5
5
|
export type ModuleControllerArrowsGridSettings = ModuleCoreSettings;
|
|
6
6
|
export type ModuleControllerArrowsGridParams = ModuleCoreParams;
|
|
7
7
|
export type ModuleControllerArrowsGridState = {
|
|
8
|
-
isShow: boolean;
|
|
9
8
|
gridRow?: number | null;
|
|
10
9
|
gridColumn?: number | null;
|
|
11
10
|
gridIndex?: number;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -38,10 +38,10 @@ export abstract class ModuleControllerArrowsGrid<
|
|
|
38
38
|
abstract CONTROLS_ZINDEX: number;
|
|
39
39
|
|
|
40
40
|
CONTROLS = {
|
|
41
|
-
[this.CONST.CONTROLS.BUTTONS.ARROW_UP]: () => void this.
|
|
42
|
-
[this.CONST.CONTROLS.BUTTONS.ARROW_RIGHT]: () => void this.
|
|
43
|
-
[this.CONST.CONTROLS.BUTTONS.ARROW_BOTTOM]: () => void this.
|
|
44
|
-
[this.CONST.CONTROLS.BUTTONS.ARROW_LEFT]: () => void this.
|
|
41
|
+
[this.CONST.CONTROLS.BUTTONS.ARROW_UP]: () => void this.onArrowUp(),
|
|
42
|
+
[this.CONST.CONTROLS.BUTTONS.ARROW_RIGHT]: () => void this.onArrowRight(),
|
|
43
|
+
[this.CONST.CONTROLS.BUTTONS.ARROW_BOTTOM]: () => void this.onArrowBottom(),
|
|
44
|
+
[this.CONST.CONTROLS.BUTTONS.ARROW_LEFT]: () => void this.onArrowLeft(),
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
gridRow: number | null = null;
|
|
@@ -63,6 +63,11 @@ export abstract class ModuleControllerArrowsGrid<
|
|
|
63
63
|
|
|
64
64
|
getGridItemsCount = (gridItems: unknown[] = []) => gridItems.filter((item) => !(item as { isStub?: boolean } | null | undefined)?.isStub).length;
|
|
65
65
|
|
|
66
|
+
onArrowUp = (): void | Promise<void> => void this.decRow();
|
|
67
|
+
onArrowRight = (): void | Promise<void> => void this.incColumn();
|
|
68
|
+
onArrowBottom = (): void | Promise<void> => void this.incRow();
|
|
69
|
+
onArrowLeft = (): void | Promise<void> => void this.decColumn();
|
|
70
|
+
|
|
66
71
|
subscribe = () => {
|
|
67
72
|
const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
|
|
68
73
|
|
|
@@ -73,8 +78,6 @@ export abstract class ModuleControllerArrowsGrid<
|
|
|
73
78
|
if (this.EVENT_GRID_UPDATE_ITEMS) this.on(this.EVENT_GRID_UPDATE_ITEMS, this.onGridUpdateItems);
|
|
74
79
|
};
|
|
75
80
|
|
|
76
|
-
getDefaultState = (): TState => ({ isShow: false }) as TState;
|
|
77
|
-
|
|
78
81
|
getGridItems = async (): Promise<unknown[]> => [];
|
|
79
82
|
|
|
80
83
|
onGridClear = () => {
|
|
@@ -136,7 +139,6 @@ export abstract class ModuleControllerArrowsGrid<
|
|
|
136
139
|
};
|
|
137
140
|
|
|
138
141
|
onShow = () => {
|
|
139
|
-
this.updateState({ isShow: true } as Partial<TState>);
|
|
140
142
|
this.gridRow = null;
|
|
141
143
|
this.gridColumn = null;
|
|
142
144
|
|
|
@@ -149,9 +151,6 @@ export abstract class ModuleControllerArrowsGrid<
|
|
|
149
151
|
};
|
|
150
152
|
|
|
151
153
|
onHide = () => {
|
|
152
|
-
if (!this.state.isShow) return;
|
|
153
|
-
|
|
154
|
-
this.updateState({ isShow: false } as Partial<TState>);
|
|
155
154
|
this.gridRow = null;
|
|
156
155
|
this.gridColumn = null;
|
|
157
156
|
|
package/src/types.ts
CHANGED
|
@@ -10,7 +10,6 @@ export type ModuleControllerArrowsGridSettings = ModuleCoreSettings;
|
|
|
10
10
|
export type ModuleControllerArrowsGridParams = ModuleCoreParams;
|
|
11
11
|
|
|
12
12
|
export type ModuleControllerArrowsGridState = {
|
|
13
|
-
isShow: boolean;
|
|
14
13
|
gridRow?: number | null;
|
|
15
14
|
gridColumn?: number | null;
|
|
16
15
|
gridIndex?: number;
|