@abpjs/theme-shared 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/components/loader-bar/LoaderBar.d.ts +1 -1
- package/dist/enums/index.d.ts +5 -0
- package/dist/enums/route-names.d.ts +15 -0
- package/dist/handlers/error.handler.d.ts +3 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-nav-items.d.ts +33 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.js +369 -245
- package/dist/index.mjs +226 -102
- package/dist/models/confirmation.d.ts +3 -7
- package/dist/models/index.d.ts +7 -2
- package/dist/models/nav-item.d.ts +39 -0
- package/dist/models/toaster.d.ts +2 -44
- package/dist/providers/ThemeSharedProvider.d.ts +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/route.provider.d.ts +53 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/nav-items.service.d.ts +117 -0
- package/dist/utils/index.d.ts +4 -1
- package/package.json +5 -4
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route Provider
|
|
3
|
+
* Translated from @abp/ng.theme.shared/lib/providers/route.provider.ts v3.0.0
|
|
4
|
+
*
|
|
5
|
+
* Provides route configuration for the theme-shared module.
|
|
6
|
+
*
|
|
7
|
+
* @since 3.0.0
|
|
8
|
+
*/
|
|
9
|
+
import { RoutesService } from '@abpjs/core';
|
|
10
|
+
/**
|
|
11
|
+
* Configures the theme shared routes.
|
|
12
|
+
* This function is called during app initialization to register
|
|
13
|
+
* the Administration route that other modules can use as a parent.
|
|
14
|
+
*
|
|
15
|
+
* @param routes - The RoutesService instance
|
|
16
|
+
* @returns A function that performs the route configuration
|
|
17
|
+
* @since 3.0.0
|
|
18
|
+
*/
|
|
19
|
+
export declare function configureRoutes(routes: RoutesService): () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Theme shared route providers for initialization.
|
|
22
|
+
* Use this in your app setup to configure theme-shared routes.
|
|
23
|
+
*
|
|
24
|
+
* In React, you typically call this during app initialization:
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* import { initializeThemeSharedRoutes } from '@abpjs/theme-shared';
|
|
29
|
+
*
|
|
30
|
+
* // In your app initialization
|
|
31
|
+
* initializeThemeSharedRoutes();
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @since 3.0.0
|
|
35
|
+
*/
|
|
36
|
+
export declare const THEME_SHARED_ROUTE_PROVIDERS: {
|
|
37
|
+
configureRoutes: typeof configureRoutes;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Initialize theme shared routes.
|
|
41
|
+
* Call this function during app initialization to register the Administration route.
|
|
42
|
+
*
|
|
43
|
+
* @since 3.0.0
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* import { initializeThemeSharedRoutes } from '@abpjs/theme-shared';
|
|
48
|
+
*
|
|
49
|
+
* // Call once during app initialization
|
|
50
|
+
* initializeThemeSharedRoutes();
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function initializeThemeSharedRoutes(): void;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nav Items Service
|
|
3
|
+
* Translated from @abp/ng.theme.shared/lib/services/nav-items.service.ts v3.0.0
|
|
4
|
+
*
|
|
5
|
+
* Provides a service-based approach to managing navigation items,
|
|
6
|
+
* replacing the utility functions approach from v2.9.0.
|
|
7
|
+
*
|
|
8
|
+
* @since 3.0.0
|
|
9
|
+
*/
|
|
10
|
+
import type { NavItem } from '../models/nav-item';
|
|
11
|
+
/**
|
|
12
|
+
* NavItemsService manages navigation items with reactive updates.
|
|
13
|
+
* This is a singleton service that provides methods to add, remove, and patch nav items.
|
|
14
|
+
*
|
|
15
|
+
* @since 3.0.0 - Replaces the nav-items utility functions
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const navItemsService = NavItemsService.getInstance();
|
|
20
|
+
*
|
|
21
|
+
* // Add items
|
|
22
|
+
* navItemsService.addItems([
|
|
23
|
+
* { id: 'profile', component: ProfileComponent, order: 1 },
|
|
24
|
+
* { id: 'settings', component: SettingsComponent, order: 2 },
|
|
25
|
+
* ]);
|
|
26
|
+
*
|
|
27
|
+
* // Subscribe to changes
|
|
28
|
+
* const unsubscribe = navItemsService.subscribe((items) => {
|
|
29
|
+
* console.log('Items changed:', items);
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Remove an item
|
|
33
|
+
* navItemsService.removeItem('profile');
|
|
34
|
+
*
|
|
35
|
+
* // Patch an item
|
|
36
|
+
* navItemsService.patchItem('settings', { order: 10 });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class NavItemsService {
|
|
40
|
+
private static _instance;
|
|
41
|
+
private _items;
|
|
42
|
+
private _listeners;
|
|
43
|
+
/**
|
|
44
|
+
* Get singleton instance
|
|
45
|
+
* @since 3.0.0
|
|
46
|
+
*/
|
|
47
|
+
static getInstance(): NavItemsService;
|
|
48
|
+
/**
|
|
49
|
+
* Reset the singleton instance (useful for testing)
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
static resetInstance(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Get current items (sorted by order)
|
|
55
|
+
* @since 3.0.0
|
|
56
|
+
*/
|
|
57
|
+
get items(): NavItem[];
|
|
58
|
+
/**
|
|
59
|
+
* Subscribe to item changes.
|
|
60
|
+
* Returns an unsubscribe function.
|
|
61
|
+
*
|
|
62
|
+
* @param listener - Callback function to receive item updates
|
|
63
|
+
* @returns Unsubscribe function
|
|
64
|
+
* @since 3.0.0
|
|
65
|
+
*/
|
|
66
|
+
subscribe(listener: (items: NavItem[]) => void): () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Get items as an observable-like interface.
|
|
69
|
+
* Compatible with Angular's Observable pattern.
|
|
70
|
+
*
|
|
71
|
+
* @returns Object with subscribe method
|
|
72
|
+
* @since 3.0.0
|
|
73
|
+
*/
|
|
74
|
+
get items$(): {
|
|
75
|
+
subscribe: (callback: (items: NavItem[]) => void) => {
|
|
76
|
+
unsubscribe: () => void;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Add one or more items.
|
|
81
|
+
* Items are automatically sorted by order.
|
|
82
|
+
*
|
|
83
|
+
* @param items - Array of items to add
|
|
84
|
+
* @since 3.0.0
|
|
85
|
+
*/
|
|
86
|
+
addItems(items: NavItem[]): void;
|
|
87
|
+
/**
|
|
88
|
+
* Remove an item by id.
|
|
89
|
+
*
|
|
90
|
+
* @param id - The id of the item to remove
|
|
91
|
+
* @since 3.0.0
|
|
92
|
+
*/
|
|
93
|
+
removeItem(id: string | number): void;
|
|
94
|
+
/**
|
|
95
|
+
* Patch an existing item by id.
|
|
96
|
+
* Updates only the specified properties.
|
|
97
|
+
*
|
|
98
|
+
* @param id - The id of the item to patch
|
|
99
|
+
* @param patch - Partial item data to merge
|
|
100
|
+
* @since 3.0.0
|
|
101
|
+
*/
|
|
102
|
+
patchItem(id: string | number, patch: Partial<Omit<NavItem, 'id'>>): void;
|
|
103
|
+
/**
|
|
104
|
+
* Clear all items.
|
|
105
|
+
* @since 3.0.0
|
|
106
|
+
*/
|
|
107
|
+
clear(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Notify all listeners of changes.
|
|
110
|
+
*/
|
|
111
|
+
private notify;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get the NavItemsService singleton.
|
|
115
|
+
* @since 3.0.0
|
|
116
|
+
*/
|
|
117
|
+
export declare function getNavItemsService(): NavItemsService;
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abpjs/theme-shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "ABP Framework Theme Shared components for React - translated from @abp/ng.theme.shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"next-themes": "^0.4.6",
|
|
28
28
|
"react-hook-form": "^7.48.0",
|
|
29
29
|
"react-icons": "^5.5.0",
|
|
30
|
-
"@abpjs/core": "
|
|
30
|
+
"@abpjs/core": "3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@abp/ng.theme.shared": "
|
|
34
|
-
"@vitest/coverage-v8": "^
|
|
33
|
+
"@abp/ng.theme.shared": "3.0.0",
|
|
34
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
35
|
+
"vitest": "^1.6.0"
|
|
35
36
|
},
|
|
36
37
|
"author": "tekthar.com",
|
|
37
38
|
"license": "LGPL-3.0",
|