@vnejs/module.controller.arrows.grid 0.2.4 → 0.2.6

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
@@ -36,7 +36,6 @@ export declare abstract class ModuleControllerArrowsGrid<TEvents extends ModuleC
36
36
  onArrowBottom: () => void | Promise<void>;
37
37
  onArrowLeft: () => void | Promise<void>;
38
38
  subscribe: () => void;
39
- getDefaultState: () => TState;
40
39
  getGridItems: () => Promise<unknown[]>;
41
40
  onGridClear: () => Promise<import("@vnejs/shared").EmitResults<string>> | undefined;
42
41
  onGridUpdateItems: () => Promise<void>;
@@ -47,6 +46,7 @@ export declare abstract class ModuleControllerArrowsGrid<TEvents extends ModuleC
47
46
  snapSelectionToGrid: () => void;
48
47
  onShow: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:push">> | undefined;
49
48
  onHide: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:pop">> | undefined;
49
+ onHideCleanup: () => Promise<import("@vnejs/shared").EmitResults<string> | undefined>;
50
50
  onStateUpdate: (payload?: Partial<TState>) => void;
51
51
  initRowAndColumns: () => void;
52
52
  isCellInGrid: (row: number, column: number) => boolean;
package/dist/index.js CHANGED
@@ -26,12 +26,12 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
26
26
  const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
27
27
  this.on(this.EVENT_SHOW, this.onShow, { priority: SHOW.CONTROLS });
28
28
  this.on(this.EVENT_HIDE, this.onHide, { priority: HIDE.CONTROLS });
29
+ this.on(this.EVENT_HIDE, this.onHideCleanup, { priority: HIDE.CLEANUP });
29
30
  this.on(this.EVENT_UPDATE_STATE, this.onStateUpdate);
30
31
  this.on(this.EVENT_GRID_CLEAR, this.onGridClear);
31
32
  if (this.EVENT_GRID_UPDATE_ITEMS)
32
33
  this.on(this.EVENT_GRID_UPDATE_ITEMS, this.onGridUpdateItems);
33
34
  };
34
- getDefaultState = () => ({ isShow: false });
35
35
  getGridItems = async () => [];
36
36
  onGridClear = () => {
37
37
  this.gridRow = null;
@@ -84,7 +84,6 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
84
84
  this.emitPosition();
85
85
  };
86
86
  onShow = () => {
87
- this.updateState({ isShow: true });
88
87
  this.gridRow = null;
89
88
  this.gridColumn = null;
90
89
  return this.emit(this.EVENTS.CONTROLS.PUSH, {
@@ -95,13 +94,17 @@ export class ModuleControllerArrowsGrid extends ModuleCore {
95
94
  });
96
95
  };
97
96
  onHide = () => {
98
- if (!this.state.isShow)
99
- return;
100
- this.updateState({ isShow: false });
101
97
  this.gridRow = null;
102
98
  this.gridColumn = null;
103
99
  return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
104
100
  };
101
+ onHideCleanup = async () => {
102
+ this.gridRow = null;
103
+ this.gridColumn = null;
104
+ const unset = { gridRow: undefined, gridColumn: undefined };
105
+ await this.emit(this.EVENT_UPDATE_STATE, unset);
106
+ return this.emit(this.EVENT_UPDATE_FAST);
107
+ };
105
108
  onStateUpdate = (payload = {}) => {
106
109
  this.updateState(payload);
107
110
  if (payload.gridIndex !== undefined)
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/module.controller.arrows.grid",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -73,13 +73,12 @@ export abstract class ModuleControllerArrowsGrid<
73
73
 
74
74
  this.on(this.EVENT_SHOW, this.onShow, { priority: SHOW.CONTROLS });
75
75
  this.on(this.EVENT_HIDE, this.onHide, { priority: HIDE.CONTROLS });
76
+ this.on(this.EVENT_HIDE, this.onHideCleanup, { priority: HIDE.CLEANUP });
76
77
  this.on(this.EVENT_UPDATE_STATE, this.onStateUpdate);
77
78
  this.on(this.EVENT_GRID_CLEAR, this.onGridClear);
78
79
  if (this.EVENT_GRID_UPDATE_ITEMS) this.on(this.EVENT_GRID_UPDATE_ITEMS, this.onGridUpdateItems);
79
80
  };
80
81
 
81
- getDefaultState = (): TState => ({ isShow: false }) as TState;
82
-
83
82
  getGridItems = async (): Promise<unknown[]> => [];
84
83
 
85
84
  onGridClear = () => {
@@ -141,7 +140,6 @@ export abstract class ModuleControllerArrowsGrid<
141
140
  };
142
141
 
143
142
  onShow = () => {
144
- this.updateState({ isShow: true } as Partial<TState>);
145
143
  this.gridRow = null;
146
144
  this.gridColumn = null;
147
145
 
@@ -154,15 +152,23 @@ export abstract class ModuleControllerArrowsGrid<
154
152
  };
155
153
 
156
154
  onHide = () => {
157
- if (!this.state.isShow) return;
158
-
159
- this.updateState({ isShow: false } as Partial<TState>);
160
155
  this.gridRow = null;
161
156
  this.gridColumn = null;
162
157
 
163
158
  return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name } satisfies ControlsPopPayload);
164
159
  };
165
160
 
161
+ onHideCleanup = async () => {
162
+ this.gridRow = null;
163
+ this.gridColumn = null;
164
+
165
+ const unset = { gridRow: undefined, gridColumn: undefined } satisfies Partial<ModuleControllerArrowsGridState>;
166
+
167
+ await this.emit(this.EVENT_UPDATE_STATE, unset);
168
+
169
+ return this.emit(this.EVENT_UPDATE_FAST);
170
+ };
171
+
166
172
  onStateUpdate = (payload: Partial<TState> = {} as Partial<TState>) => {
167
173
  this.updateState(payload);
168
174
 
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;