@abpjs/setting-management 2.9.0 → 3.0.0

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.mts CHANGED
@@ -1,7 +1,90 @@
1
- import { SettingTab } from '@abpjs/theme-shared';
2
- export { SettingTab } from '@abpjs/theme-shared';
3
- import { ABP } from '@abpjs/core';
4
- import React from 'react';
1
+ import { RoutesService, SettingTabsService, ABP } from '@abpjs/core';
2
+ import React, { ComponentType } from 'react';
3
+
4
+ /**
5
+ * Route name keys for the Setting Management module config.
6
+ * These keys are used for route localization and identification.
7
+ *
8
+ * @since 3.0.0
9
+ */
10
+ declare const eSettingManagementRouteNames: {
11
+ /**
12
+ * Settings route name key.
13
+ * Used for the main settings management route.
14
+ */
15
+ readonly Settings: "AbpSettingManagement::Settings";
16
+ };
17
+ /**
18
+ * Type for setting management route name key values
19
+ */
20
+ type SettingManagementRouteNameKey = (typeof eSettingManagementRouteNames)[keyof typeof eSettingManagementRouteNames];
21
+
22
+ /**
23
+ * Route provider for Setting Management module.
24
+ * Provides route configuration for the setting management routes.
25
+ *
26
+ * @since 3.0.0
27
+ */
28
+
29
+ /**
30
+ * Configures the setting management module routes.
31
+ * Returns a function that adds the routes to the RoutesService.
32
+ *
33
+ * @param routes - The RoutesService instance to add routes to
34
+ * @returns A function that adds the setting management routes when called
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const routes = getRoutesService();
39
+ * const addRoutes = configureRoutes(routes);
40
+ * addRoutes();
41
+ * ```
42
+ */
43
+ declare function configureRoutes(routes: RoutesService): () => void;
44
+ /**
45
+ * Hides the setting management route if no setting tabs are registered.
46
+ * This function checks if there are any visible setting tabs and hides
47
+ * the route if none exist.
48
+ *
49
+ * @param routes - The RoutesService instance
50
+ * @param tabs - The SettingTabsService instance
51
+ * @returns A function that conditionally hides the route
52
+ *
53
+ * @since 3.0.0
54
+ */
55
+ declare function hideRoutes(routes: RoutesService, tabs: SettingTabsService): () => void;
56
+ /**
57
+ * Setting Management route providers configuration object.
58
+ * Use this to configure setting management routes in your application.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // In your app initialization:
63
+ * const routes = getRoutesService();
64
+ * const addRoutes = SETTING_MANAGEMENT_ROUTE_PROVIDERS.configureRoutes(routes);
65
+ * addRoutes();
66
+ *
67
+ * // To conditionally hide based on tabs:
68
+ * const tabs = getSettingTabsService();
69
+ * const hideIfEmpty = SETTING_MANAGEMENT_ROUTE_PROVIDERS.hideRoutes(routes, tabs);
70
+ * hideIfEmpty();
71
+ * ```
72
+ */
73
+ declare const SETTING_MANAGEMENT_ROUTE_PROVIDERS: {
74
+ configureRoutes: typeof configureRoutes;
75
+ hideRoutes: typeof hideRoutes;
76
+ };
77
+ /**
78
+ * Initializes the setting management module routes using the global services.
79
+ * Call this function during application startup to register setting management routes.
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * // In your app initialization:
84
+ * initializeSettingManagementRoutes();
85
+ * ```
86
+ */
87
+ declare function initializeSettingManagementRoutes(): void;
5
88
 
6
89
  /**
7
90
  * Component keys for the Setting Management module.
@@ -21,38 +104,40 @@ declare const eSettingManagementComponents: {
21
104
  type SettingManagementComponentKey = (typeof eSettingManagementComponents)[keyof typeof eSettingManagementComponents];
22
105
 
23
106
  /**
24
- * Route name keys for the Setting Management module.
25
- * These keys are used for route localization and identification.
26
- * @since 2.7.0
27
- */
28
- declare const eSettingManagementRouteNames: {
29
- /**
30
- * Settings route name key.
31
- * Used for the main settings management route.
32
- */
33
- readonly Settings: "AbpSettingManagement::Settings";
34
- };
35
- /**
36
- * Type for setting management route name key values
107
+ * Setting Management Models
108
+ * Translated from @abp/ng.setting-management v3.0.0
37
109
  */
38
- type SettingManagementRouteNameKey = (typeof eSettingManagementRouteNames)[keyof typeof eSettingManagementRouteNames];
39
110
 
40
111
  /**
41
- * Setting Management Models
42
- * Translated from @abp/ng.setting-management v1.1.0
112
+ * SettingTab interface - extends ABP.Tab with url support for backward compatibility
113
+ *
114
+ * In Angular v3.0.0, settings tabs use ABP.Tab which has a component property.
115
+ * For backward compatibility, we extend it with an optional url property.
116
+ *
117
+ * @since 1.0.0
118
+ * @updated 3.0.0 - Extended from ABP.Tab, component is now optional
43
119
  */
44
-
120
+ interface SettingTab extends Omit<ABP.Tab, 'component'> {
121
+ /** React component to render for this tab (from ABP.Tab) */
122
+ component?: ComponentType<unknown>;
123
+ /** URL/route for this settings tab (for URL-based navigation) */
124
+ url?: string;
125
+ /** Order/priority for tab sorting - default from Nav but made required for sorting */
126
+ order: number;
127
+ }
45
128
  /**
46
129
  * Setting Management namespace containing types and interfaces
47
130
  * @since 1.1.0
131
+ * @updated 3.0.0 - Changed selectedTab type from SettingTab to ABP.Tab
48
132
  */
49
133
  declare namespace SettingManagement {
50
134
  /**
51
135
  * State interface for setting management
52
136
  * Tracks the currently selected setting tab
137
+ * @since 3.0.0 - selectedTab is now optional (SettingTab | undefined)
53
138
  */
54
139
  interface State {
55
- selectedTab: SettingTab | null;
140
+ selectedTab?: SettingTab;
56
141
  }
57
142
  }
58
143
 
@@ -74,11 +159,13 @@ declare const SETTING_MANAGEMENT_ROUTES: {
74
159
 
75
160
  /**
76
161
  * Setting Management Service
77
- * Translated from @abp/ng.setting-management v1.1.0
162
+ * Translated from @abp/ng.setting-management v3.0.0
78
163
  *
79
164
  * Note: In Angular, the SettingManagementService was removed in favor
80
165
  * of using Store directly. In React, we keep this service as it provides
81
166
  * a clean API for managing settings tabs without requiring a global store.
167
+ *
168
+ * @updated 3.0.0 - Uses SettingTab (alias for ABP.Tab) from local models
82
169
  */
83
170
 
84
171
  /**
@@ -147,10 +234,12 @@ declare function getSettingManagementService(): SettingManagementService;
147
234
 
148
235
  /**
149
236
  * Setting Management State Service
150
- * Translated from @abp/ng.setting-management v1.1.0
237
+ * Translated from @abp/ng.setting-management v3.0.0
151
238
  *
152
239
  * This service provides state management for setting tabs,
153
240
  * equivalent to the Angular NGXS SettingManagementState.
241
+ *
242
+ * @updated 3.0.0 - Changed state to use undefined instead of null
154
243
  */
155
244
 
156
245
  /**
@@ -158,6 +247,7 @@ declare function getSettingManagementService(): SettingManagementService;
158
247
  * Provides methods equivalent to Angular's NGXS state selectors and actions.
159
248
  *
160
249
  * @since 1.1.0
250
+ * @updated 3.0.0 - Uses undefined instead of null for selectedTab
161
251
  */
162
252
  declare class SettingManagementStateService {
163
253
  private _state;
@@ -165,14 +255,16 @@ declare class SettingManagementStateService {
165
255
  /**
166
256
  * Get the currently selected setting tab
167
257
  * Equivalent to Angular's @Selector() getSelectedTab
258
+ * @since 3.0.0 - Returns SettingTab | undefined instead of SettingTab | null
168
259
  */
169
- getSelectedTab(): SettingTab | null;
260
+ getSelectedTab(): SettingTab | undefined;
170
261
  /**
171
262
  * Set the selected setting tab
172
263
  * Equivalent to Angular's SetSelectedSettingTab action
173
264
  * @param tab The setting tab to select
265
+ * @since 3.0.0 - Accepts SettingTab | undefined instead of SettingTab | null
174
266
  */
175
- setSelectedTab(tab: SettingTab | null): void;
267
+ setSelectedTab(tab: SettingTab | undefined): void;
176
268
  /**
177
269
  * Get the current state
178
270
  */
@@ -262,7 +354,7 @@ declare function useSettingManagement(): UseSettingManagementReturn;
262
354
 
263
355
  /**
264
356
  * Setting Layout Component
265
- * Translated from @abp/ng.setting-management v0.9.0
357
+ * Translated from @abp/ng.setting-management v3.0.0
266
358
  */
267
359
 
268
360
  interface SettingLayoutProps {
@@ -299,4 +391,4 @@ interface SettingLayoutProps {
299
391
  */
300
392
  declare function SettingLayout({ children, onTabSelect, className, }: SettingLayoutProps): React.ReactElement;
301
393
 
302
- export { SETTING_MANAGEMENT_ROUTES, SettingLayout, type SettingLayoutProps, SettingManagement, type SettingManagementComponentKey, type SettingManagementRouteNameKey, SettingManagementService, SettingManagementStateService, type UseSettingManagementReturn, eSettingManagementComponents, eSettingManagementRouteNames, getSettingManagementService, getSettingManagementStateService, useSettingManagement };
394
+ export { SETTING_MANAGEMENT_ROUTES, SETTING_MANAGEMENT_ROUTE_PROVIDERS, SettingLayout, type SettingLayoutProps, SettingManagement, type SettingManagementComponentKey, type SettingManagementRouteNameKey, SettingManagementService, SettingManagementStateService, type SettingTab, type UseSettingManagementReturn, configureRoutes, eSettingManagementComponents, eSettingManagementRouteNames, getSettingManagementService, getSettingManagementStateService, hideRoutes, initializeSettingManagementRoutes, useSettingManagement };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,90 @@
1
- import { SettingTab } from '@abpjs/theme-shared';
2
- export { SettingTab } from '@abpjs/theme-shared';
3
- import { ABP } from '@abpjs/core';
4
- import React from 'react';
1
+ import { RoutesService, SettingTabsService, ABP } from '@abpjs/core';
2
+ import React, { ComponentType } from 'react';
3
+
4
+ /**
5
+ * Route name keys for the Setting Management module config.
6
+ * These keys are used for route localization and identification.
7
+ *
8
+ * @since 3.0.0
9
+ */
10
+ declare const eSettingManagementRouteNames: {
11
+ /**
12
+ * Settings route name key.
13
+ * Used for the main settings management route.
14
+ */
15
+ readonly Settings: "AbpSettingManagement::Settings";
16
+ };
17
+ /**
18
+ * Type for setting management route name key values
19
+ */
20
+ type SettingManagementRouteNameKey = (typeof eSettingManagementRouteNames)[keyof typeof eSettingManagementRouteNames];
21
+
22
+ /**
23
+ * Route provider for Setting Management module.
24
+ * Provides route configuration for the setting management routes.
25
+ *
26
+ * @since 3.0.0
27
+ */
28
+
29
+ /**
30
+ * Configures the setting management module routes.
31
+ * Returns a function that adds the routes to the RoutesService.
32
+ *
33
+ * @param routes - The RoutesService instance to add routes to
34
+ * @returns A function that adds the setting management routes when called
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const routes = getRoutesService();
39
+ * const addRoutes = configureRoutes(routes);
40
+ * addRoutes();
41
+ * ```
42
+ */
43
+ declare function configureRoutes(routes: RoutesService): () => void;
44
+ /**
45
+ * Hides the setting management route if no setting tabs are registered.
46
+ * This function checks if there are any visible setting tabs and hides
47
+ * the route if none exist.
48
+ *
49
+ * @param routes - The RoutesService instance
50
+ * @param tabs - The SettingTabsService instance
51
+ * @returns A function that conditionally hides the route
52
+ *
53
+ * @since 3.0.0
54
+ */
55
+ declare function hideRoutes(routes: RoutesService, tabs: SettingTabsService): () => void;
56
+ /**
57
+ * Setting Management route providers configuration object.
58
+ * Use this to configure setting management routes in your application.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // In your app initialization:
63
+ * const routes = getRoutesService();
64
+ * const addRoutes = SETTING_MANAGEMENT_ROUTE_PROVIDERS.configureRoutes(routes);
65
+ * addRoutes();
66
+ *
67
+ * // To conditionally hide based on tabs:
68
+ * const tabs = getSettingTabsService();
69
+ * const hideIfEmpty = SETTING_MANAGEMENT_ROUTE_PROVIDERS.hideRoutes(routes, tabs);
70
+ * hideIfEmpty();
71
+ * ```
72
+ */
73
+ declare const SETTING_MANAGEMENT_ROUTE_PROVIDERS: {
74
+ configureRoutes: typeof configureRoutes;
75
+ hideRoutes: typeof hideRoutes;
76
+ };
77
+ /**
78
+ * Initializes the setting management module routes using the global services.
79
+ * Call this function during application startup to register setting management routes.
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * // In your app initialization:
84
+ * initializeSettingManagementRoutes();
85
+ * ```
86
+ */
87
+ declare function initializeSettingManagementRoutes(): void;
5
88
 
6
89
  /**
7
90
  * Component keys for the Setting Management module.
@@ -21,38 +104,40 @@ declare const eSettingManagementComponents: {
21
104
  type SettingManagementComponentKey = (typeof eSettingManagementComponents)[keyof typeof eSettingManagementComponents];
22
105
 
23
106
  /**
24
- * Route name keys for the Setting Management module.
25
- * These keys are used for route localization and identification.
26
- * @since 2.7.0
27
- */
28
- declare const eSettingManagementRouteNames: {
29
- /**
30
- * Settings route name key.
31
- * Used for the main settings management route.
32
- */
33
- readonly Settings: "AbpSettingManagement::Settings";
34
- };
35
- /**
36
- * Type for setting management route name key values
107
+ * Setting Management Models
108
+ * Translated from @abp/ng.setting-management v3.0.0
37
109
  */
38
- type SettingManagementRouteNameKey = (typeof eSettingManagementRouteNames)[keyof typeof eSettingManagementRouteNames];
39
110
 
40
111
  /**
41
- * Setting Management Models
42
- * Translated from @abp/ng.setting-management v1.1.0
112
+ * SettingTab interface - extends ABP.Tab with url support for backward compatibility
113
+ *
114
+ * In Angular v3.0.0, settings tabs use ABP.Tab which has a component property.
115
+ * For backward compatibility, we extend it with an optional url property.
116
+ *
117
+ * @since 1.0.0
118
+ * @updated 3.0.0 - Extended from ABP.Tab, component is now optional
43
119
  */
44
-
120
+ interface SettingTab extends Omit<ABP.Tab, 'component'> {
121
+ /** React component to render for this tab (from ABP.Tab) */
122
+ component?: ComponentType<unknown>;
123
+ /** URL/route for this settings tab (for URL-based navigation) */
124
+ url?: string;
125
+ /** Order/priority for tab sorting - default from Nav but made required for sorting */
126
+ order: number;
127
+ }
45
128
  /**
46
129
  * Setting Management namespace containing types and interfaces
47
130
  * @since 1.1.0
131
+ * @updated 3.0.0 - Changed selectedTab type from SettingTab to ABP.Tab
48
132
  */
49
133
  declare namespace SettingManagement {
50
134
  /**
51
135
  * State interface for setting management
52
136
  * Tracks the currently selected setting tab
137
+ * @since 3.0.0 - selectedTab is now optional (SettingTab | undefined)
53
138
  */
54
139
  interface State {
55
- selectedTab: SettingTab | null;
140
+ selectedTab?: SettingTab;
56
141
  }
57
142
  }
58
143
 
@@ -74,11 +159,13 @@ declare const SETTING_MANAGEMENT_ROUTES: {
74
159
 
75
160
  /**
76
161
  * Setting Management Service
77
- * Translated from @abp/ng.setting-management v1.1.0
162
+ * Translated from @abp/ng.setting-management v3.0.0
78
163
  *
79
164
  * Note: In Angular, the SettingManagementService was removed in favor
80
165
  * of using Store directly. In React, we keep this service as it provides
81
166
  * a clean API for managing settings tabs without requiring a global store.
167
+ *
168
+ * @updated 3.0.0 - Uses SettingTab (alias for ABP.Tab) from local models
82
169
  */
83
170
 
84
171
  /**
@@ -147,10 +234,12 @@ declare function getSettingManagementService(): SettingManagementService;
147
234
 
148
235
  /**
149
236
  * Setting Management State Service
150
- * Translated from @abp/ng.setting-management v1.1.0
237
+ * Translated from @abp/ng.setting-management v3.0.0
151
238
  *
152
239
  * This service provides state management for setting tabs,
153
240
  * equivalent to the Angular NGXS SettingManagementState.
241
+ *
242
+ * @updated 3.0.0 - Changed state to use undefined instead of null
154
243
  */
155
244
 
156
245
  /**
@@ -158,6 +247,7 @@ declare function getSettingManagementService(): SettingManagementService;
158
247
  * Provides methods equivalent to Angular's NGXS state selectors and actions.
159
248
  *
160
249
  * @since 1.1.0
250
+ * @updated 3.0.0 - Uses undefined instead of null for selectedTab
161
251
  */
162
252
  declare class SettingManagementStateService {
163
253
  private _state;
@@ -165,14 +255,16 @@ declare class SettingManagementStateService {
165
255
  /**
166
256
  * Get the currently selected setting tab
167
257
  * Equivalent to Angular's @Selector() getSelectedTab
258
+ * @since 3.0.0 - Returns SettingTab | undefined instead of SettingTab | null
168
259
  */
169
- getSelectedTab(): SettingTab | null;
260
+ getSelectedTab(): SettingTab | undefined;
170
261
  /**
171
262
  * Set the selected setting tab
172
263
  * Equivalent to Angular's SetSelectedSettingTab action
173
264
  * @param tab The setting tab to select
265
+ * @since 3.0.0 - Accepts SettingTab | undefined instead of SettingTab | null
174
266
  */
175
- setSelectedTab(tab: SettingTab | null): void;
267
+ setSelectedTab(tab: SettingTab | undefined): void;
176
268
  /**
177
269
  * Get the current state
178
270
  */
@@ -262,7 +354,7 @@ declare function useSettingManagement(): UseSettingManagementReturn;
262
354
 
263
355
  /**
264
356
  * Setting Layout Component
265
- * Translated from @abp/ng.setting-management v0.9.0
357
+ * Translated from @abp/ng.setting-management v3.0.0
266
358
  */
267
359
 
268
360
  interface SettingLayoutProps {
@@ -299,4 +391,4 @@ interface SettingLayoutProps {
299
391
  */
300
392
  declare function SettingLayout({ children, onTabSelect, className, }: SettingLayoutProps): React.ReactElement;
301
393
 
302
- export { SETTING_MANAGEMENT_ROUTES, SettingLayout, type SettingLayoutProps, SettingManagement, type SettingManagementComponentKey, type SettingManagementRouteNameKey, SettingManagementService, SettingManagementStateService, type UseSettingManagementReturn, eSettingManagementComponents, eSettingManagementRouteNames, getSettingManagementService, getSettingManagementStateService, useSettingManagement };
394
+ export { SETTING_MANAGEMENT_ROUTES, SETTING_MANAGEMENT_ROUTE_PROVIDERS, SettingLayout, type SettingLayoutProps, SettingManagement, type SettingManagementComponentKey, type SettingManagementRouteNameKey, SettingManagementService, SettingManagementStateService, type SettingTab, type UseSettingManagementReturn, configureRoutes, eSettingManagementComponents, eSettingManagementRouteNames, getSettingManagementService, getSettingManagementStateService, hideRoutes, initializeSettingManagementRoutes, useSettingManagement };
package/dist/index.js CHANGED
@@ -21,17 +21,69 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  SETTING_MANAGEMENT_ROUTES: () => SETTING_MANAGEMENT_ROUTES,
24
+ SETTING_MANAGEMENT_ROUTE_PROVIDERS: () => SETTING_MANAGEMENT_ROUTE_PROVIDERS,
24
25
  SettingLayout: () => SettingLayout,
25
26
  SettingManagementService: () => SettingManagementService,
26
27
  SettingManagementStateService: () => SettingManagementStateService,
28
+ configureRoutes: () => configureRoutes,
27
29
  eSettingManagementComponents: () => eSettingManagementComponents,
28
30
  eSettingManagementRouteNames: () => eSettingManagementRouteNames,
29
31
  getSettingManagementService: () => getSettingManagementService,
30
32
  getSettingManagementStateService: () => getSettingManagementStateService,
33
+ hideRoutes: () => hideRoutes,
34
+ initializeSettingManagementRoutes: () => initializeSettingManagementRoutes,
31
35
  useSettingManagement: () => useSettingManagement
32
36
  });
33
37
  module.exports = __toCommonJS(index_exports);
34
38
 
39
+ // src/config/enums/route-names.ts
40
+ var eSettingManagementRouteNames = {
41
+ /**
42
+ * Settings route name key.
43
+ * Used for the main settings management route.
44
+ */
45
+ Settings: "AbpSettingManagement::Settings"
46
+ };
47
+
48
+ // src/config/providers/route.provider.ts
49
+ var import_core = require("@abpjs/core");
50
+ function configureRoutes(routes) {
51
+ return () => {
52
+ routes.add([
53
+ {
54
+ path: "/setting-management",
55
+ name: eSettingManagementRouteNames.Settings,
56
+ parentName: "AbpUiNavigation::Menu:Administration",
57
+ layout: import_core.eLayoutType.application,
58
+ iconClass: "bi bi-gear",
59
+ order: 100
60
+ }
61
+ ]);
62
+ };
63
+ }
64
+ function hideRoutes(routes, tabs) {
65
+ return () => {
66
+ const visibleTabs = tabs.visible;
67
+ if (!visibleTabs || visibleTabs.length === 0) {
68
+ routes.patch(eSettingManagementRouteNames.Settings, {
69
+ invisible: true
70
+ });
71
+ }
72
+ };
73
+ }
74
+ var SETTING_MANAGEMENT_ROUTE_PROVIDERS = {
75
+ configureRoutes,
76
+ hideRoutes
77
+ };
78
+ function initializeSettingManagementRoutes() {
79
+ const routes = (0, import_core.getRoutesService)();
80
+ const tabs = (0, import_core.getSettingTabsService)();
81
+ const addRoutes = configureRoutes(routes);
82
+ addRoutes();
83
+ const hideIfEmpty = hideRoutes(routes, tabs);
84
+ hideIfEmpty();
85
+ }
86
+
35
87
  // src/enums/components.ts
36
88
  var eSettingManagementComponents = {
37
89
  /**
@@ -41,15 +93,6 @@ var eSettingManagementComponents = {
41
93
  SettingManagement: "SettingManagement.SettingManagementComponent"
42
94
  };
43
95
 
44
- // src/enums/route-names.ts
45
- var eSettingManagementRouteNames = {
46
- /**
47
- * Settings route name key.
48
- * Used for the main settings management route.
49
- */
50
- Settings: "AbpSettingManagement::Settings"
51
- };
52
-
53
96
  // src/constants/routes.ts
54
97
  var SETTING_MANAGEMENT_ROUTES = {
55
98
  routes: [
@@ -186,13 +229,14 @@ function getSettingManagementService() {
186
229
  var SettingManagementStateService = class {
187
230
  constructor() {
188
231
  this._state = {
189
- selectedTab: null
232
+ selectedTab: void 0
190
233
  };
191
234
  this._subscribers = /* @__PURE__ */ new Set();
192
235
  }
193
236
  /**
194
237
  * Get the currently selected setting tab
195
238
  * Equivalent to Angular's @Selector() getSelectedTab
239
+ * @since 3.0.0 - Returns SettingTab | undefined instead of SettingTab | null
196
240
  */
197
241
  getSelectedTab() {
198
242
  return this._state.selectedTab;
@@ -201,6 +245,7 @@ var SettingManagementStateService = class {
201
245
  * Set the selected setting tab
202
246
  * Equivalent to Angular's SetSelectedSettingTab action
203
247
  * @param tab The setting tab to select
248
+ * @since 3.0.0 - Accepts SettingTab | undefined instead of SettingTab | null
204
249
  */
205
250
  setSelectedTab(tab) {
206
251
  this._state = {
@@ -220,7 +265,7 @@ var SettingManagementStateService = class {
220
265
  */
221
266
  reset() {
222
267
  this._state = {
223
- selectedTab: null
268
+ selectedTab: void 0
224
269
  };
225
270
  this.notifySubscribers();
226
271
  }
@@ -398,12 +443,16 @@ var styles = {
398
443
  // Annotate the CommonJS export names for ESM import in node:
399
444
  0 && (module.exports = {
400
445
  SETTING_MANAGEMENT_ROUTES,
446
+ SETTING_MANAGEMENT_ROUTE_PROVIDERS,
401
447
  SettingLayout,
402
448
  SettingManagementService,
403
449
  SettingManagementStateService,
450
+ configureRoutes,
404
451
  eSettingManagementComponents,
405
452
  eSettingManagementRouteNames,
406
453
  getSettingManagementService,
407
454
  getSettingManagementStateService,
455
+ hideRoutes,
456
+ initializeSettingManagementRoutes,
408
457
  useSettingManagement
409
458
  });
package/dist/index.mjs CHANGED
@@ -1,3 +1,55 @@
1
+ // src/config/enums/route-names.ts
2
+ var eSettingManagementRouteNames = {
3
+ /**
4
+ * Settings route name key.
5
+ * Used for the main settings management route.
6
+ */
7
+ Settings: "AbpSettingManagement::Settings"
8
+ };
9
+
10
+ // src/config/providers/route.provider.ts
11
+ import {
12
+ getRoutesService,
13
+ getSettingTabsService,
14
+ eLayoutType
15
+ } from "@abpjs/core";
16
+ function configureRoutes(routes) {
17
+ return () => {
18
+ routes.add([
19
+ {
20
+ path: "/setting-management",
21
+ name: eSettingManagementRouteNames.Settings,
22
+ parentName: "AbpUiNavigation::Menu:Administration",
23
+ layout: eLayoutType.application,
24
+ iconClass: "bi bi-gear",
25
+ order: 100
26
+ }
27
+ ]);
28
+ };
29
+ }
30
+ function hideRoutes(routes, tabs) {
31
+ return () => {
32
+ const visibleTabs = tabs.visible;
33
+ if (!visibleTabs || visibleTabs.length === 0) {
34
+ routes.patch(eSettingManagementRouteNames.Settings, {
35
+ invisible: true
36
+ });
37
+ }
38
+ };
39
+ }
40
+ var SETTING_MANAGEMENT_ROUTE_PROVIDERS = {
41
+ configureRoutes,
42
+ hideRoutes
43
+ };
44
+ function initializeSettingManagementRoutes() {
45
+ const routes = getRoutesService();
46
+ const tabs = getSettingTabsService();
47
+ const addRoutes = configureRoutes(routes);
48
+ addRoutes();
49
+ const hideIfEmpty = hideRoutes(routes, tabs);
50
+ hideIfEmpty();
51
+ }
52
+
1
53
  // src/enums/components.ts
2
54
  var eSettingManagementComponents = {
3
55
  /**
@@ -7,15 +59,6 @@ var eSettingManagementComponents = {
7
59
  SettingManagement: "SettingManagement.SettingManagementComponent"
8
60
  };
9
61
 
10
- // src/enums/route-names.ts
11
- var eSettingManagementRouteNames = {
12
- /**
13
- * Settings route name key.
14
- * Used for the main settings management route.
15
- */
16
- Settings: "AbpSettingManagement::Settings"
17
- };
18
-
19
62
  // src/constants/routes.ts
20
63
  var SETTING_MANAGEMENT_ROUTES = {
21
64
  routes: [
@@ -152,13 +195,14 @@ function getSettingManagementService() {
152
195
  var SettingManagementStateService = class {
153
196
  constructor() {
154
197
  this._state = {
155
- selectedTab: null
198
+ selectedTab: void 0
156
199
  };
157
200
  this._subscribers = /* @__PURE__ */ new Set();
158
201
  }
159
202
  /**
160
203
  * Get the currently selected setting tab
161
204
  * Equivalent to Angular's @Selector() getSelectedTab
205
+ * @since 3.0.0 - Returns SettingTab | undefined instead of SettingTab | null
162
206
  */
163
207
  getSelectedTab() {
164
208
  return this._state.selectedTab;
@@ -167,6 +211,7 @@ var SettingManagementStateService = class {
167
211
  * Set the selected setting tab
168
212
  * Equivalent to Angular's SetSelectedSettingTab action
169
213
  * @param tab The setting tab to select
214
+ * @since 3.0.0 - Accepts SettingTab | undefined instead of SettingTab | null
170
215
  */
171
216
  setSelectedTab(tab) {
172
217
  this._state = {
@@ -186,7 +231,7 @@ var SettingManagementStateService = class {
186
231
  */
187
232
  reset() {
188
233
  this._state = {
189
- selectedTab: null
234
+ selectedTab: void 0
190
235
  };
191
236
  this.notifySubscribers();
192
237
  }
@@ -363,12 +408,16 @@ var styles = {
363
408
  };
364
409
  export {
365
410
  SETTING_MANAGEMENT_ROUTES,
411
+ SETTING_MANAGEMENT_ROUTE_PROVIDERS,
366
412
  SettingLayout,
367
413
  SettingManagementService,
368
414
  SettingManagementStateService,
415
+ configureRoutes,
369
416
  eSettingManagementComponents,
370
417
  eSettingManagementRouteNames,
371
418
  getSettingManagementService,
372
419
  getSettingManagementStateService,
420
+ hideRoutes,
421
+ initializeSettingManagementRoutes,
373
422
  useSettingManagement
374
423
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/setting-management",
3
- "version": "2.9.0",
3
+ "version": "3.0.0",
4
4
  "description": "ABP Framework setting-management components for React - translated from @abp/ng.setting-management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,12 +25,12 @@
25
25
  "dependencies": {
26
26
  "@chakra-ui/react": "^3.2.0",
27
27
  "@emotion/react": "^11.11.0",
28
- "@abpjs/core": "2.9.0",
29
- "@abpjs/theme-shared": "2.9.0",
30
- "@abpjs/permission-management": "2.9.0"
28
+ "@abpjs/core": "3.0.0",
29
+ "@abpjs/theme-shared": "3.0.0",
30
+ "@abpjs/permission-management": "3.0.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@abp/ng.setting-management": "2.9.0",
33
+ "@abp/ng.setting-management": "3.0.0",
34
34
  "@testing-library/jest-dom": "^6.9.1",
35
35
  "@testing-library/react": "^14.0.0",
36
36
  "@testing-library/user-event": "^14.6.1",