@vnejs/module.controller.arrows.grid 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 +4 -0
- package/dist/index.js +8 -4
- package/package.json +1 -1
- package/src/index.ts +9 -4
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ 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
39
|
getDefaultState: () => TState;
|
|
36
40
|
getGridItems: () => Promise<unknown[]>;
|
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 });
|
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
|
|