@vnejs/module.controller.tabs 0.2.2 → 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 CHANGED
@@ -17,7 +17,7 @@ export declare abstract class ModuleControllerTabs<TEvents extends ModuleControl
17
17
  getTabKeys: () => string[];
18
18
  onShow: ({ tab }?: ModuleControllerTabsTabSetPayload) => Promise<unknown[]> | undefined;
19
19
  onHide: () => Promise<unknown[]> | undefined;
20
- onTabSet: ({ tab }?: ModuleControllerTabsTabSetPayload) => void | "" | undefined;
20
+ onTabSet: ({ tab }?: ModuleControllerTabsTabSetPayload) => void;
21
21
  onPrevTab: () => undefined;
22
22
  onNextTab: () => undefined;
23
23
  getNewTab: (isNext: boolean) => string;
package/dist/index.js CHANGED
@@ -22,7 +22,11 @@ export class ModuleControllerTabs extends ModuleCore {
22
22
  });
23
23
  };
24
24
  onHide = () => this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
25
- onTabSet = ({ tab } = {}) => tab && this.updateState({ currentTab: tab });
25
+ onTabSet = ({ tab } = {}) => {
26
+ if (tab === undefined || tab === "")
27
+ return;
28
+ this.updateState({ currentTab: tab });
29
+ };
26
30
  onPrevTab = () => void this.emit(this.EVENT_TAB_SET, { tab: this.getNewTab(false) });
27
31
  onNextTab = () => void this.emit(this.EVENT_TAB_SET, { tab: this.getNewTab(true) });
28
32
  getNewTab = (isNext) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/module.controller.tabs",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -63,7 +63,11 @@ export abstract class ModuleControllerTabs<
63
63
 
64
64
  onHide = () => this.emit(this.EVENTS.CONTROLS.POP, { key: this.name } satisfies ControlsPopPayload);
65
65
 
66
- onTabSet = ({ tab }: ModuleControllerTabsTabSetPayload = {}) => tab && this.updateState({ currentTab: tab } as Partial<TState>);
66
+ onTabSet = ({ tab }: ModuleControllerTabsTabSetPayload = {}) => {
67
+ if (tab === undefined || tab === "") return;
68
+
69
+ this.updateState({ currentTab: tab } as Partial<TState>);
70
+ };
67
71
 
68
72
  onPrevTab = () => void this.emit(this.EVENT_TAB_SET, { tab: this.getNewTab(false) } satisfies ModuleControllerTabsTabSetPayload);
69
73
  onNextTab = () => void this.emit(this.EVENT_TAB_SET, { tab: this.getNewTab(true) } satisfies ModuleControllerTabsTabSetPayload);
package/src/types.ts CHANGED
@@ -1,9 +1,5 @@
1
1
  import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
- import type {
3
- Constants as ControlsConstants,
4
- PluginName as ControlsPluginName,
5
- SubscribeEvents as ControlsSubscribeEvents,
6
- } from "@vnejs/contracts.controls";
2
+ import type { Constants as ControlsConstants, PluginName as ControlsPluginName, SubscribeEvents as ControlsSubscribeEvents } from "@vnejs/contracts.controls";
7
3
 
8
4
  export type ModuleControllerTabsEvents = ModuleCoreEvents & Record<ControlsPluginName, ControlsSubscribeEvents>;
9
5