@abpjs/theme-shared 0.7.6 → 0.9.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/change-password/ChangePassword.d.ts +26 -0
- package/dist/components/change-password/index.d.ts +1 -0
- package/dist/components/errors/ErrorComponent.d.ts +35 -0
- package/dist/components/errors/index.d.ts +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/loader-bar/LoaderBar.d.ts +34 -0
- package/dist/components/loader-bar/index.d.ts +1 -0
- package/dist/components/modal/Modal.d.ts +9 -1
- package/dist/components/profile/Profile.d.ts +28 -0
- package/dist/components/profile/index.d.ts +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/styles.d.ts +24 -0
- package/dist/handlers/error.handler.d.ts +14 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +688 -87
- package/dist/index.mjs +670 -63
- package/dist/models/index.d.ts +2 -0
- package/dist/models/setting-management.d.ts +17 -0
- package/dist/models/statistics.d.ts +25 -0
- package/package.json +4 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ChangePasswordProps {
|
|
3
|
+
/** Whether the modal is visible */
|
|
4
|
+
visible: boolean;
|
|
5
|
+
/** Callback when visibility changes */
|
|
6
|
+
onVisibleChange: (visible: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Change password modal component.
|
|
10
|
+
* Translated from Angular ChangePasswordComponent (moved from theme-basic in v0.9.0).
|
|
11
|
+
*
|
|
12
|
+
* Provides a modal dialog for changing the user's password with:
|
|
13
|
+
* - Current password input
|
|
14
|
+
* - New password input with validation
|
|
15
|
+
* - Confirm new password with match validation
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <ChangePassword
|
|
20
|
+
* visible={isOpen}
|
|
21
|
+
* onVisibleChange={setIsOpen}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function ChangePassword({ visible, onVisibleChange, }: ChangePasswordProps): React.ReactElement;
|
|
26
|
+
export default ChangePassword;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChangePassword';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface ErrorComponentProps {
|
|
2
|
+
/** Error title (e.g., "404", "500", "Error") */
|
|
3
|
+
title?: string;
|
|
4
|
+
/** Error details/message */
|
|
5
|
+
details?: string;
|
|
6
|
+
/** Callback when user wants to dismiss/destroy the error display */
|
|
7
|
+
onDestroy?: () => void;
|
|
8
|
+
/** Whether to show a close/back button */
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
/** Custom close button text */
|
|
11
|
+
closeButtonText?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A component for displaying error pages/messages.
|
|
15
|
+
* Can be used for HTTP errors (404, 500, etc.) or general error states.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* // Basic error display
|
|
20
|
+
* <ErrorComponent
|
|
21
|
+
* title="404"
|
|
22
|
+
* details="The page you are looking for was not found."
|
|
23
|
+
* />
|
|
24
|
+
*
|
|
25
|
+
* // With close button
|
|
26
|
+
* <ErrorComponent
|
|
27
|
+
* title="Error"
|
|
28
|
+
* details="Something went wrong."
|
|
29
|
+
* showCloseButton
|
|
30
|
+
* onDestroy={() => navigate('/')}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function ErrorComponent({ title, details, onDestroy, showCloseButton, closeButtonText, }: ErrorComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export default ErrorComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ErrorComponent';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface LoaderBarProps {
|
|
2
|
+
/** CSS class for the container element */
|
|
3
|
+
containerClass?: string;
|
|
4
|
+
/** CSS class for the progress bar element */
|
|
5
|
+
progressClass?: string;
|
|
6
|
+
/** Custom filter function to determine if loading should be shown */
|
|
7
|
+
filter?: (request: {
|
|
8
|
+
url?: string;
|
|
9
|
+
method?: string;
|
|
10
|
+
}) => boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A loading progress bar component that automatically shows/hides
|
|
14
|
+
* based on HTTP request activity tracked by the loader state.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Basic usage - place in your layout
|
|
19
|
+
* <LoaderBar />
|
|
20
|
+
*
|
|
21
|
+
* // With custom classes
|
|
22
|
+
* <LoaderBar
|
|
23
|
+
* containerClass="my-loader-container"
|
|
24
|
+
* progressClass="my-progress-bar"
|
|
25
|
+
* />
|
|
26
|
+
*
|
|
27
|
+
* // With filter to only show for specific requests
|
|
28
|
+
* <LoaderBar
|
|
29
|
+
* filter={(req) => !req.url?.includes('/api/silent')}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function LoaderBar({ containerClass, progressClass, filter, }: LoaderBarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
34
|
+
export default LoaderBar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoaderBar';
|
|
@@ -9,12 +9,18 @@ export interface ModalProps {
|
|
|
9
9
|
visible: boolean;
|
|
10
10
|
/** Callback when visibility changes */
|
|
11
11
|
onVisibleChange?: (visible: boolean) => void;
|
|
12
|
+
/** Whether the modal is in a busy/loading state (v0.9.0) */
|
|
13
|
+
busy?: boolean;
|
|
12
14
|
/** Modal size */
|
|
13
15
|
size?: ModalSize;
|
|
14
16
|
/** Center the modal vertically */
|
|
15
17
|
centered?: boolean;
|
|
16
18
|
/** Custom CSS class for the modal container */
|
|
17
19
|
modalClass?: string;
|
|
20
|
+
/** Fixed height for the modal (v0.9.0) */
|
|
21
|
+
height?: number | string;
|
|
22
|
+
/** Minimum height for the modal (v0.9.0) */
|
|
23
|
+
minHeight?: number | string;
|
|
18
24
|
/** Header content */
|
|
19
25
|
header?: ReactNode;
|
|
20
26
|
/** Body content (children) */
|
|
@@ -31,6 +37,8 @@ export interface ModalProps {
|
|
|
31
37
|
closeOnEscape?: boolean;
|
|
32
38
|
/** Whether to scroll the modal body if content overflows */
|
|
33
39
|
scrollBehavior?: 'inside' | 'outside';
|
|
40
|
+
/** Callback when modal is initialized/opened (v0.9.0) */
|
|
41
|
+
onInit?: () => void;
|
|
34
42
|
/**
|
|
35
43
|
* Motion preset for modal animation.
|
|
36
44
|
* @default 'scale'
|
|
@@ -78,7 +86,7 @@ export interface ModalProps {
|
|
|
78
86
|
* }
|
|
79
87
|
* ```
|
|
80
88
|
*/
|
|
81
|
-
export declare function Modal({ visible, onVisibleChange, size, centered, modalClass, header, children, footer, showCloseButton, closeOnOverlayClick, closeOnEscape, scrollBehavior, motionPreset, trapFocus, preventScroll, }: ModalProps): React.ReactElement;
|
|
89
|
+
export declare function Modal({ visible, onVisibleChange, busy, size, centered, modalClass, height, minHeight, header, children, footer, showCloseButton, closeOnOverlayClick, closeOnEscape, scrollBehavior, motionPreset, trapFocus, preventScroll, onInit, }: ModalProps): React.ReactElement;
|
|
82
90
|
/**
|
|
83
91
|
* Re-export Chakra v3 dialog parts for convenience.
|
|
84
92
|
* Users can use these for more custom modal layouts.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ProfileProps {
|
|
3
|
+
/** Whether the modal is visible */
|
|
4
|
+
visible: boolean;
|
|
5
|
+
/** Callback when visibility changes */
|
|
6
|
+
onVisibleChange: (visible: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Profile modal component for editing user profile.
|
|
10
|
+
* Translated from Angular ProfileComponent (moved from theme-basic in v0.9.0).
|
|
11
|
+
*
|
|
12
|
+
* Provides a modal dialog for editing user profile with:
|
|
13
|
+
* - Username (required)
|
|
14
|
+
* - Email (required)
|
|
15
|
+
* - Name
|
|
16
|
+
* - Surname
|
|
17
|
+
* - Phone number
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Profile
|
|
22
|
+
* visible={isOpen}
|
|
23
|
+
* onVisibleChange={setIsOpen}
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function Profile({ visible, onVisibleChange, }: ProfileProps): React.ReactElement;
|
|
28
|
+
export default Profile;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Profile';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './styles';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default global styles for ABP theme shared components.
|
|
3
|
+
* These styles can be injected into your app's global CSS or used with a style tag.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* // Option 1: Use with a style tag in your app
|
|
8
|
+
* import { DEFAULT_STYLES } from '@abpjs/theme-shared';
|
|
9
|
+
*
|
|
10
|
+
* function App() {
|
|
11
|
+
* return (
|
|
12
|
+
* <>
|
|
13
|
+
* <style>{DEFAULT_STYLES}</style>
|
|
14
|
+
* <YourApp />
|
|
15
|
+
* </>
|
|
16
|
+
* );
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* // Option 2: Add to your global CSS file
|
|
20
|
+
* // Copy the content of DEFAULT_STYLES to your styles.css
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_STYLES = "\n.is-invalid .form-control {\n border-color: #dc3545;\n border-style: solid !important;\n}\n\n.is-invalid .invalid-feedback,\n.is-invalid + * .invalid-feedback {\n display: block;\n}\n\n.data-tables-filter {\n text-align: right;\n}\n\n.pointer {\n cursor: pointer;\n}\n\n.navbar .dropdown-submenu a::after {\n transform: rotate(-90deg);\n position: absolute;\n right: 16px;\n top: 18px;\n}\n\n.modal {\n background-color: rgba(0, 0, 0, .6);\n}\n\n.abp-ellipsis {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* <animations */\n\n.fade-in-top {\n animation: fadeInTop 0.4s ease-in-out;\n}\n\n.fade-out-top {\n animation: fadeOutTop 0.4s ease-in-out;\n}\n\n@keyframes fadeInTop {\n from {\n transform: translateY(-5px);\n opacity: 0;\n }\n\n to {\n transform: translateY(5px);\n opacity: 1;\n }\n}\n\n@keyframes fadeOutTop {\n to {\n transform: translateY(-5px);\n opacity: 0;\n }\n}\n\n/* </animations */\n\n/* Loader bar styles */\n.abp-loader-bar {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: 3px;\n z-index: 9999;\n background-color: rgba(0, 0, 0, 0.1);\n overflow: hidden;\n}\n\n.abp-progress {\n height: 100%;\n background-color: #3182ce;\n transition: width 0.3s ease-out;\n}\n";
|
|
24
|
+
export default DEFAULT_STYLES;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Toaster } from '../models';
|
|
2
|
+
import { ErrorComponentProps } from '../components/errors/ErrorComponent';
|
|
2
3
|
type NavigateFunction = (to: string) => void;
|
|
3
4
|
/**
|
|
4
5
|
* HTTP error response structure (matching ABP error format).
|
|
@@ -18,6 +19,13 @@ export interface HttpErrorResponse {
|
|
|
18
19
|
};
|
|
19
20
|
};
|
|
20
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Error component instance configuration.
|
|
24
|
+
*/
|
|
25
|
+
export interface ErrorComponentInstance {
|
|
26
|
+
title: string;
|
|
27
|
+
details: string;
|
|
28
|
+
}
|
|
21
29
|
/**
|
|
22
30
|
* Error handler interface.
|
|
23
31
|
*/
|
|
@@ -28,6 +36,12 @@ export interface ErrorHandler {
|
|
|
28
36
|
showError: (message: string, title?: string) => Promise<Toaster.Status>;
|
|
29
37
|
/** Navigate to the login page */
|
|
30
38
|
navigateToLogin: () => void;
|
|
39
|
+
/** Create error component props for full-page error display */
|
|
40
|
+
createErrorComponent: (instance: Partial<ErrorComponentInstance>) => ErrorComponentProps;
|
|
41
|
+
/** Current error component props (null if no error) */
|
|
42
|
+
errorComponentProps: ErrorComponentProps | null;
|
|
43
|
+
/** Clear the current error component */
|
|
44
|
+
clearErrorComponent: () => void;
|
|
31
45
|
}
|
|
32
46
|
export interface UseErrorHandlerOptions {
|
|
33
47
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
* @abpjs/theme-shared
|
|
3
3
|
*
|
|
4
4
|
* ABP Framework Theme Shared components for React.
|
|
5
|
-
* Translated from @abp/ng.theme.shared v0.
|
|
5
|
+
* Translated from @abp/ng.theme.shared v0.9.0
|
|
6
6
|
*
|
|
7
7
|
* This package provides shared UI components, services, and utilities
|
|
8
8
|
* for theme/modal management in ABP Framework React applications.
|
|
9
|
+
*
|
|
10
|
+
* New in v0.9.0:
|
|
11
|
+
* - ChangePassword component (moved from theme-basic)
|
|
12
|
+
* - Profile component (moved from theme-basic)
|
|
13
|
+
* - Modal busy prop for preventing close during operations
|
|
14
|
+
* - Modal height/minHeight props
|
|
15
|
+
* - Modal onInit callback
|
|
9
16
|
*/
|
|
10
17
|
export * from './models';
|
|
18
|
+
export * from './constants';
|
|
11
19
|
export * from './contexts';
|
|
12
20
|
export * from './hooks';
|
|
13
21
|
export * from './components';
|