@abpjs/theme-shared
Advanced tools
| /** | ||
| * Enums barrel export | ||
| * @since 3.0.0 | ||
| */ | ||
| export * from './route-names'; |
| /** | ||
| * Theme Shared Route Names | ||
| * Translated from @abp/ng.theme.shared/lib/enums/route-names.ts v3.0.0 | ||
| * | ||
| * @since 3.0.0 | ||
| */ | ||
| /** | ||
| * Enum for theme shared route names. | ||
| * These are used for navigation and route registration. | ||
| * | ||
| * @since 3.0.0 | ||
| */ | ||
| export declare enum eThemeSharedRouteNames { | ||
| Administration = "AbpUiNavigation::Menu:Administration" | ||
| } |
| /** | ||
| * useNavItems Hook | ||
| * @since 3.0.0 | ||
| * | ||
| * React hook for subscribing to NavItemsService changes. | ||
| */ | ||
| import { NavItem } from '../models/nav-item'; | ||
| import { NavItemsService } from '../services/nav-items.service'; | ||
| /** | ||
| * Hook to subscribe to nav items from NavItemsService. | ||
| * Returns the current sorted array of nav items. | ||
| * | ||
| * @param service - Optional NavItemsService instance (defaults to singleton) | ||
| * @returns Array of NavItem objects, sorted by order | ||
| * | ||
| * @since 3.0.0 | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * function MyNavComponent() { | ||
| * const navItems = useNavItems(); | ||
| * | ||
| * return ( | ||
| * <ul> | ||
| * {navItems.map((item) => ( | ||
| * <li key={item.id}>{item.id}</li> | ||
| * ))} | ||
| * </ul> | ||
| * ); | ||
| * } | ||
| * ``` | ||
| */ | ||
| export declare function useNavItems(service?: NavItemsService): NavItem[]; |
| /** | ||
| * Nav Item Model | ||
| * Translated from @abp/ng.theme.shared/lib/models/nav-item.ts v3.0.0 | ||
| * | ||
| * @since 3.0.0 - Added id property, changed permission to requiredPolicy | ||
| */ | ||
| import type { ComponentType } from 'react'; | ||
| /** | ||
| * Navigation item configuration. | ||
| * @since 3.0.0 - Added id property, changed permission to requiredPolicy | ||
| */ | ||
| export interface NavItem { | ||
| /** | ||
| * Unique identifier for the nav item. | ||
| * @since 3.0.0 | ||
| */ | ||
| id: string | number; | ||
| /** | ||
| * React component to render for this nav item. | ||
| */ | ||
| component?: ComponentType<any>; | ||
| /** | ||
| * Raw HTML string to render (use with caution for XSS). | ||
| */ | ||
| html?: string; | ||
| /** | ||
| * Action to execute when the nav item is clicked. | ||
| */ | ||
| action?: () => void; | ||
| /** | ||
| * Order for sorting nav items. Lower numbers appear first. | ||
| */ | ||
| order?: number; | ||
| /** | ||
| * Required policy to show this nav item. | ||
| * @since 3.0.0 - Renamed from permission | ||
| */ | ||
| requiredPolicy?: string; | ||
| } |
| /** | ||
| * Route Provider | ||
| * Translated from @abp/ng.theme.shared/lib/providers/route.provider.ts v3.0.0 | ||
| * | ||
| * Provides route configuration for the theme-shared module. | ||
| * | ||
| * @since 3.0.0 | ||
| */ | ||
| import { RoutesService } from '@abpjs/core'; | ||
| /** | ||
| * Configures the theme shared routes. | ||
| * This function is called during app initialization to register | ||
| * the Administration route that other modules can use as a parent. | ||
| * | ||
| * @param routes - The RoutesService instance | ||
| * @returns A function that performs the route configuration | ||
| * @since 3.0.0 | ||
| */ | ||
| export declare function configureRoutes(routes: RoutesService): () => void; | ||
| /** | ||
| * Theme shared route providers for initialization. | ||
| * Use this in your app setup to configure theme-shared routes. | ||
| * | ||
| * In React, you typically call this during app initialization: | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * import { initializeThemeSharedRoutes } from '@abpjs/theme-shared'; | ||
| * | ||
| * // In your app initialization | ||
| * initializeThemeSharedRoutes(); | ||
| * ``` | ||
| * | ||
| * @since 3.0.0 | ||
| */ | ||
| export declare const THEME_SHARED_ROUTE_PROVIDERS: { | ||
| configureRoutes: typeof configureRoutes; | ||
| }; | ||
| /** | ||
| * Initialize theme shared routes. | ||
| * Call this function during app initialization to register the Administration route. | ||
| * | ||
| * @since 3.0.0 | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * import { initializeThemeSharedRoutes } from '@abpjs/theme-shared'; | ||
| * | ||
| * // Call once during app initialization | ||
| * initializeThemeSharedRoutes(); | ||
| * ``` | ||
| */ | ||
| export declare function initializeThemeSharedRoutes(): void; |
| /** | ||
| * Services barrel export | ||
| * @since 3.0.0 | ||
| */ | ||
| export * from './nav-items.service'; |
| /** | ||
| * Nav Items Service | ||
| * Translated from @abp/ng.theme.shared/lib/services/nav-items.service.ts v3.0.0 | ||
| * | ||
| * Provides a service-based approach to managing navigation items, | ||
| * replacing the utility functions approach from v2.9.0. | ||
| * | ||
| * @since 3.0.0 | ||
| */ | ||
| import type { NavItem } from '../models/nav-item'; | ||
| /** | ||
| * NavItemsService manages navigation items with reactive updates. | ||
| * This is a singleton service that provides methods to add, remove, and patch nav items. | ||
| * | ||
| * @since 3.0.0 - Replaces the nav-items utility functions | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * const navItemsService = NavItemsService.getInstance(); | ||
| * | ||
| * // Add items | ||
| * navItemsService.addItems([ | ||
| * { id: 'profile', component: ProfileComponent, order: 1 }, | ||
| * { id: 'settings', component: SettingsComponent, order: 2 }, | ||
| * ]); | ||
| * | ||
| * // Subscribe to changes | ||
| * const unsubscribe = navItemsService.subscribe((items) => { | ||
| * console.log('Items changed:', items); | ||
| * }); | ||
| * | ||
| * // Remove an item | ||
| * navItemsService.removeItem('profile'); | ||
| * | ||
| * // Patch an item | ||
| * navItemsService.patchItem('settings', { order: 10 }); | ||
| * ``` | ||
| */ | ||
| export declare class NavItemsService { | ||
| private static _instance; | ||
| private _items; | ||
| private _listeners; | ||
| /** | ||
| * Get singleton instance | ||
| * @since 3.0.0 | ||
| */ | ||
| static getInstance(): NavItemsService; | ||
| /** | ||
| * Reset the singleton instance (useful for testing) | ||
| * @internal | ||
| */ | ||
| static resetInstance(): void; | ||
| /** | ||
| * Get current items (sorted by order) | ||
| * @since 3.0.0 | ||
| */ | ||
| get items(): NavItem[]; | ||
| /** | ||
| * Subscribe to item changes. | ||
| * Returns an unsubscribe function. | ||
| * | ||
| * @param listener - Callback function to receive item updates | ||
| * @returns Unsubscribe function | ||
| * @since 3.0.0 | ||
| */ | ||
| subscribe(listener: (items: NavItem[]) => void): () => void; | ||
| /** | ||
| * Get items as an observable-like interface. | ||
| * Compatible with Angular's Observable pattern. | ||
| * | ||
| * @returns Object with subscribe method | ||
| * @since 3.0.0 | ||
| */ | ||
| get items$(): { | ||
| subscribe: (callback: (items: NavItem[]) => void) => { | ||
| unsubscribe: () => void; | ||
| }; | ||
| }; | ||
| /** | ||
| * Add one or more items. | ||
| * Items are automatically sorted by order. | ||
| * | ||
| * @param items - Array of items to add | ||
| * @since 3.0.0 | ||
| */ | ||
| addItems(items: NavItem[]): void; | ||
| /** | ||
| * Remove an item by id. | ||
| * | ||
| * @param id - The id of the item to remove | ||
| * @since 3.0.0 | ||
| */ | ||
| removeItem(id: string | number): void; | ||
| /** | ||
| * Patch an existing item by id. | ||
| * Updates only the specified properties. | ||
| * | ||
| * @param id - The id of the item to patch | ||
| * @param patch - Partial item data to merge | ||
| * @since 3.0.0 | ||
| */ | ||
| patchItem(id: string | number, patch: Partial<Omit<NavItem, 'id'>>): void; | ||
| /** | ||
| * Clear all items. | ||
| * @since 3.0.0 | ||
| */ | ||
| clear(): void; | ||
| /** | ||
| * Notify all listeners of changes. | ||
| */ | ||
| private notify; | ||
| } | ||
| /** | ||
| * Get the NavItemsService singleton. | ||
| * @since 3.0.0 | ||
| */ | ||
| export declare function getNavItemsService(): NavItemsService; |
@@ -45,3 +45,3 @@ export interface LoaderBarProps { | ||
| */ | ||
| export declare function LoaderBar({ containerClass, progressClass, filter, intervalPeriod, stopDelay, }: LoaderBarProps): import("react/jsx-runtime").JSX.Element | null; | ||
| export declare function LoaderBar({ containerClass, progressClass, filter: _filter, intervalPeriod, stopDelay, }: LoaderBarProps): import("react/jsx-runtime").JSX.Element | null; | ||
| export default LoaderBar; |
@@ -1,2 +0,2 @@ | ||
| import { Toaster } from '../models'; | ||
| import { Confirmation } from '../models'; | ||
| import { ErrorComponentProps } from '../components/errors/ErrorComponent'; | ||
@@ -31,2 +31,3 @@ type NavigateFunction = (to: string) => void; | ||
| * Error handler interface. | ||
| * @since 3.0.0 - showError now returns Confirmation.Status instead of Toaster.Status | ||
| */ | ||
@@ -37,3 +38,3 @@ export interface ErrorHandler { | ||
| /** Show an error message in a confirmation dialog */ | ||
| showError: (message: string, title?: string) => Promise<Toaster.Status>; | ||
| showError: (message: string, title?: string) => Promise<Confirmation.Status>; | ||
| /** Navigate to the login page */ | ||
@@ -40,0 +41,0 @@ navigateToLogin: () => void; |
| export { useToaster, useToasts, useToasterContext } from '../contexts/toaster.context'; | ||
| export { useConfirmation, useConfirmationState, useConfirmationContext } from '../contexts/confirmation.context'; | ||
| export { useErrorHandler } from '../handlers/error.handler'; | ||
| export { useNavItems } from './use-nav-items'; |
+16
-1
@@ -5,3 +5,3 @@ /** | ||
| * ABP Framework Theme Shared components for React. | ||
| * Translated from @abp/ng.theme.shared v2.9.0 | ||
| * Translated from @abp/ng.theme.shared v3.0.0 | ||
| * | ||
@@ -11,2 +11,15 @@ * This package provides shared UI components, services, and utilities | ||
| * | ||
| * Changes in v3.0.0: | ||
| * - Added NavItemsService (replaces nav-items utility functions) | ||
| * - Added NavItem.id property (required unique identifier) | ||
| * - Changed NavItem.permission to NavItem.requiredPolicy | ||
| * - Added eThemeSharedRouteNames enum for route names | ||
| * - Added THEME_SHARED_ROUTE_PROVIDERS and configureRoutes | ||
| * - Added initializeThemeSharedRoutes for easy route setup | ||
| * - Removed Toaster.Status enum (use Confirmation.Status instead) | ||
| * - Removed Confirmation.Options.closable (use dismissible instead) | ||
| * - Removed setting-management model (use @abpjs/core SettingTabsService) | ||
| * - Removed nav-items utils (use NavItemsService) | ||
| * - Dependency updates to @abp/ng.core v3.0.0 | ||
| * | ||
| * Changes in v2.9.0: | ||
@@ -83,1 +96,3 @@ * - Added LocaleDirection type for RTL/LTR support | ||
| export * from './theme'; | ||
| export * from './enums'; | ||
| export * from './services'; |
| /** | ||
| * Confirmation namespace containing types for confirmation dialogs. | ||
| * Translated from @abp/ng.theme.shared/lib/models/confirmation.ts | ||
| * Translated from @abp/ng.theme.shared/lib/models/confirmation.ts v3.0.0 | ||
| * | ||
@@ -13,2 +13,3 @@ * @since 2.0.0 - Major changes: | ||
| * @since 2.9.0 - Added dismissible property, deprecated closable | ||
| * @since 3.0.0 - Removed closable property (use dismissible instead) | ||
| */ | ||
@@ -20,3 +21,3 @@ import type { Config } from '@abpjs/core'; | ||
| * @since 2.0.0 - No longer extends Toaster.Options | ||
| * @since 2.9.0 - Added dismissible, deprecated closable | ||
| * @since 3.0.0 - Removed closable (use dismissible instead) | ||
| */ | ||
@@ -43,7 +44,2 @@ interface Options { | ||
| yesText?: Config.LocalizationParam; | ||
| /** | ||
| * Whether the confirmation can be closed by clicking outside or pressing escape. | ||
| * @deprecated Use dismissible instead. To be deleted in v3.0. | ||
| */ | ||
| closable?: boolean; | ||
| } | ||
@@ -50,0 +46,0 @@ /** |
@@ -0,5 +1,10 @@ | ||
| /** | ||
| * Models barrel export | ||
| * @since 3.0.0 - Removed setting-management (now in @abpjs/core SettingTabsService) | ||
| * @since 3.0.0 - Added nav-item model | ||
| */ | ||
| export * from './common'; | ||
| export * from './toaster'; | ||
| export * from './confirmation'; | ||
| export * from './setting-management'; | ||
| export * from './nav-item'; | ||
| export * from './statistics'; | ||
| export * from './toaster'; |
| import type { Config } from '@abpjs/core'; | ||
| /** | ||
| * Toaster namespace containing types and interfaces for toast notifications. | ||
| * Translated from @abp/ng.theme.shared/lib/models/toaster.ts | ||
| * Translated from @abp/ng.theme.shared/lib/models/toaster.ts v3.0.0 | ||
| * | ||
@@ -12,3 +12,3 @@ * @since 2.0.0 - Major changes: | ||
| * | ||
| * @since 2.1.0 - Status enum deprecated, use Confirmation.Status instead | ||
| * @since 3.0.0 - Status enum removed, use Confirmation.Status instead | ||
| */ | ||
@@ -57,44 +57,2 @@ export declare namespace Toaster { | ||
| type Severity = 'neutral' | 'success' | 'info' | 'warning' | 'error'; | ||
| /** | ||
| * Status values for toast/confirmation interactions. | ||
| * @deprecated Status will be removed from toaster model in v3.0. Use Confirmation.Status instead. | ||
| * @since 2.1.0 - Deprecated in favor of Confirmation.Status | ||
| */ | ||
| enum Status { | ||
| confirm = "confirm", | ||
| reject = "reject", | ||
| dismiss = "dismiss" | ||
| } | ||
| /** | ||
| * @deprecated Use ToastOptions instead. Scheduled for removal in v3.0.0 | ||
| * Preserved for backward compatibility. | ||
| */ | ||
| interface Options { | ||
| /** Unique identifier for the toast */ | ||
| id?: string; | ||
| /** Whether the toast can be manually closed */ | ||
| closable?: boolean; | ||
| /** Duration in milliseconds before auto-dismiss (default varies by implementation) */ | ||
| life?: number; | ||
| /** If true, toast won't auto-dismiss */ | ||
| sticky?: boolean; | ||
| /** Custom data to attach to the toast */ | ||
| data?: unknown; | ||
| /** Parameters for localizing the message */ | ||
| messageLocalizationParams?: string[]; | ||
| /** Parameters for localizing the title */ | ||
| titleLocalizationParams?: string[]; | ||
| } | ||
| /** | ||
| * @deprecated Use Toast instead. Scheduled for removal in v3.0.0 | ||
| * Preserved for backward compatibility. | ||
| */ | ||
| interface Message extends Options { | ||
| /** The message content (can be a localization key) */ | ||
| message: string; | ||
| /** The title (can be a localization key) */ | ||
| title?: string; | ||
| /** Severity level of the message */ | ||
| severity: Severity; | ||
| } | ||
| } |
| export * from './ThemeSharedProvider'; | ||
| export * from './route.provider'; |
@@ -134,3 +134,3 @@ import React, { type ReactNode } from 'react'; | ||
| */ | ||
| export declare function ThemeSharedProvider({ children, renderToasts, renderConfirmation, themeOverrides, toastPosition, enableColorMode, defaultColorMode, locale, }: ThemeSharedProviderProps): React.ReactElement; | ||
| export declare function ThemeSharedProvider({ children, renderToasts, renderConfirmation, themeOverrides, toastPosition: _toastPosition, enableColorMode, defaultColorMode, locale, }: ThemeSharedProviderProps): React.ReactElement; | ||
| export default ThemeSharedProvider; |
@@ -0,3 +1,6 @@ | ||
| /** | ||
| * Utils barrel export | ||
| * @since 3.0.0 - Removed nav-items (use NavItemsService from services instead) | ||
| */ | ||
| export * from './styles'; | ||
| export * from './nav-items'; | ||
| export * from './validation-utils'; |
+5
-4
| { | ||
| "name": "@abpjs/theme-shared", | ||
| "version": "2.9.0", | ||
| "version": "3.0.0", | ||
| "description": "ABP Framework Theme Shared components for React - translated from @abp/ng.theme.shared", | ||
@@ -30,7 +30,8 @@ "main": "dist/index.js", | ||
| "react-icons": "^5.5.0", | ||
| "@abpjs/core": "2.9.0" | ||
| "@abpjs/core": "3.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@abp/ng.theme.shared": "2.9.0", | ||
| "@vitest/coverage-v8": "^3.2.0" | ||
| "@abp/ng.theme.shared": "3.0.0", | ||
| "@vitest/coverage-v8": "^1.6.0", | ||
| "vitest": "^1.6.0" | ||
| }, | ||
@@ -37,0 +38,0 @@ "author": "tekthar.com", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
270748
5.22%65
12.07%7640
6.81%3
50%+ Added
- Removed
Updated