@vnejs/module.controller.arrows.grid 0.2.1 → 0.2.2

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 CHANGED
@@ -25,6 +25,7 @@ export declare abstract class ModuleControllerArrowsGrid<TEvents extends ModuleC
25
25
  cachedGridIndex: number;
26
26
  cachedGridsCount: number;
27
27
  cachedItemsCount: number | null;
28
+ isShow: boolean;
28
29
  abstract getMaxRows: () => number;
29
30
  abstract getMaxColumns: () => number;
30
31
  getItemsCount: () => number;
@@ -34,15 +35,15 @@ export declare abstract class ModuleControllerArrowsGrid<TEvents extends ModuleC
34
35
  subscribe: () => void;
35
36
  getDefaultState: () => TState;
36
37
  getGridItems: () => Promise<unknown[]>;
37
- onGridClear: () => Promise<unknown[]> | undefined;
38
+ onGridClear: () => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
38
39
  onGridUpdateItems: () => Promise<void>;
39
40
  findNearestValidCell: (row: number, column: number) => {
40
41
  row: number;
41
42
  column: number;
42
43
  } | null;
43
44
  snapSelectionToGrid: () => void;
44
- onShow: () => Promise<unknown[]> | undefined;
45
- onHide: () => Promise<unknown[]> | undefined;
45
+ onShow: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:push">> | undefined;
46
+ onHide: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:pop">> | undefined;
46
47
  onStateUpdate: (payload?: Partial<TState>) => void;
47
48
  initRowAndColumns: () => void;
48
49
  isCellInGrid: (row: number, column: number) => boolean;
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
14
14
  cachedGridIndex = 0;
15
15
  cachedGridsCount = 1;
16
16
  cachedItemsCount = null;
17
+ isShow = false;
17
18
  getItemsCount = () => this.cachedItemsCount ?? this.getMaxRows() * this.getMaxColumns();
18
19
  getCurrentGridIndex = () => this.cachedGridIndex;
19
20
  getGridsCount = () => this.cachedGridsCount;
@@ -79,6 +80,9 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
79
80
  this.emitPosition();
80
81
  };
81
82
  onShow = () => {
83
+ if (this.isShow)
84
+ return;
85
+ this.isShow = true;
82
86
  this.gridRow = null;
83
87
  this.gridColumn = null;
84
88
  return this.emit(this.EVENTS.CONTROLS.PUSH, {
@@ -89,6 +93,9 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
89
93
  });
90
94
  };
91
95
  onHide = () => {
96
+ if (!this.isShow)
97
+ return;
98
+ this.isShow = false;
92
99
  this.gridRow = null;
93
100
  this.gridColumn = null;
94
101
  return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/module.controller.arrows.grid",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -54,6 +54,8 @@ export abstract class ModuleControllerArrowsGrid<
54
54
  cachedGridsCount = 1;
55
55
  cachedItemsCount: number | null = null;
56
56
 
57
+ isShow = false;
58
+
57
59
  abstract getMaxRows: () => number;
58
60
  abstract getMaxColumns: () => number;
59
61
 
@@ -134,6 +136,9 @@ export abstract class ModuleControllerArrowsGrid<
134
136
  };
135
137
 
136
138
  onShow = () => {
139
+ if (this.isShow) return;
140
+
141
+ this.isShow = true;
137
142
  this.gridRow = null;
138
143
  this.gridColumn = null;
139
144
 
@@ -146,6 +151,9 @@ export abstract class ModuleControllerArrowsGrid<
146
151
  };
147
152
 
148
153
  onHide = () => {
154
+ if (!this.isShow) return;
155
+
156
+ this.isShow = false;
149
157
  this.gridRow = null;
150
158
  this.gridColumn = null;
151
159