@abpjs/tenant-management 0.7.6

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.
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ /**
3
+ * Modal view type for tenant management
4
+ */
5
+ type ModalView = 'tenant' | 'connectionString';
6
+ /**
7
+ * Props for TenantManagementModal component
8
+ */
9
+ export interface TenantManagementModalProps {
10
+ /**
11
+ * Whether the modal is visible
12
+ */
13
+ visible: boolean;
14
+ /**
15
+ * Callback when visibility changes
16
+ */
17
+ onVisibleChange?: (visible: boolean) => void;
18
+ /**
19
+ * Tenant ID to edit (if editing)
20
+ */
21
+ tenantId?: string;
22
+ /**
23
+ * Initial view mode
24
+ */
25
+ initialView?: ModalView;
26
+ /**
27
+ * Callback fired when tenant is saved successfully
28
+ */
29
+ onSave?: () => void;
30
+ }
31
+ /**
32
+ * TenantManagementModal - Modal for managing tenants
33
+ *
34
+ * This is the React equivalent of Angular's TenantsComponent modal functionality.
35
+ * It displays a modal for creating/editing tenants and managing connection strings.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * function TenantsPage() {
40
+ * const [visible, setVisible] = useState(false);
41
+ * const [editId, setEditId] = useState<string | undefined>();
42
+ *
43
+ * return (
44
+ * <>
45
+ * <Button onClick={() => { setEditId(undefined); setVisible(true); }}>
46
+ * New Tenant
47
+ * </Button>
48
+ * <TenantManagementModal
49
+ * visible={visible}
50
+ * onVisibleChange={setVisible}
51
+ * tenantId={editId}
52
+ * onSave={() => console.log('Saved!')}
53
+ * />
54
+ * </>
55
+ * );
56
+ * }
57
+ * ```
58
+ */
59
+ export declare function TenantManagementModal({ visible, onVisibleChange, tenantId, initialView, onSave, }: TenantManagementModalProps): React.ReactElement;
60
+ export default TenantManagementModal;
@@ -0,0 +1,2 @@
1
+ export { TenantManagementModal, type TenantManagementModalProps, } from './TenantManagementModal';
2
+ export { TenantManagementModal as default } from './TenantManagementModal';
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ /**
3
+ * Modal view type for tenant management
4
+ */
5
+ type ModalView = 'tenant' | 'connectionString';
6
+ /**
7
+ * Props for TenantManagementModal component
8
+ */
9
+ export interface TenantManagementModalProps {
10
+ /**
11
+ * Whether the modal is visible
12
+ */
13
+ visible: boolean;
14
+ /**
15
+ * Callback when visibility changes
16
+ */
17
+ onVisibleChange?: (visible: boolean) => void;
18
+ /**
19
+ * Tenant ID to edit (if editing)
20
+ */
21
+ tenantId?: string;
22
+ /**
23
+ * Initial view mode
24
+ */
25
+ initialView?: ModalView;
26
+ /**
27
+ * Callback fired when tenant is saved successfully
28
+ */
29
+ onSave?: () => void;
30
+ }
31
+ /**
32
+ * TenantManagementModal - Modal for managing tenants
33
+ *
34
+ * This is the React equivalent of Angular's TenantsComponent modal functionality.
35
+ * It displays a modal for creating/editing tenants and managing connection strings.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * function TenantsPage() {
40
+ * const [visible, setVisible] = useState(false);
41
+ * const [editId, setEditId] = useState<string | undefined>();
42
+ *
43
+ * return (
44
+ * <>
45
+ * <Button onClick={() => { setEditId(undefined); setVisible(true); }}>
46
+ * New Tenant
47
+ * </Button>
48
+ * <TenantManagementModal
49
+ * visible={visible}
50
+ * onVisibleChange={setVisible}
51
+ * tenantId={editId}
52
+ * onSave={() => console.log('Saved!')}
53
+ * />
54
+ * </>
55
+ * );
56
+ * }
57
+ * ```
58
+ */
59
+ export declare function TenantManagementModal({ visible, onVisibleChange, tenantId, initialView, onSave, }: TenantManagementModalProps): React.ReactElement;
60
+ export default TenantManagementModal;
@@ -0,0 +1,2 @@
1
+ export { TenantManagementModal, type TenantManagementModalProps, } from './TenantManagementModal';
2
+ export { TenantManagementModal as default } from './TenantManagementModal';
@@ -0,0 +1 @@
1
+ export * from './TenantManagementModal';
@@ -0,0 +1 @@
1
+ export { useTenantManagement, type UseTenantManagementReturn, type TenantManagementResult, } from './useTenantManagement';
@@ -0,0 +1,80 @@
1
+ import { TenantManagement } from '../models';
2
+ /**
3
+ * Result from tenant management operations
4
+ */
5
+ export interface TenantManagementResult {
6
+ success: boolean;
7
+ error?: string;
8
+ }
9
+ /**
10
+ * Return type for useTenantManagement hook
11
+ */
12
+ export interface UseTenantManagementReturn {
13
+ /** List of tenants */
14
+ tenants: TenantManagement.Item[];
15
+ /** Currently selected tenant */
16
+ selectedTenant: TenantManagement.Item | null;
17
+ /** Loading state */
18
+ isLoading: boolean;
19
+ /** Error message if any */
20
+ error: string | null;
21
+ /** Default connection string for selected tenant */
22
+ defaultConnectionString: string;
23
+ /** Whether the selected tenant uses shared database */
24
+ useSharedDatabase: boolean;
25
+ /** Fetch all tenants */
26
+ fetchTenants: () => Promise<TenantManagementResult>;
27
+ /** Fetch a tenant by ID */
28
+ fetchTenantById: (id: string) => Promise<TenantManagementResult>;
29
+ /** Create a new tenant */
30
+ createTenant: (data: TenantManagement.AddRequest) => Promise<TenantManagementResult>;
31
+ /** Update an existing tenant */
32
+ updateTenant: (data: TenantManagement.UpdateRequest) => Promise<TenantManagementResult>;
33
+ /** Delete a tenant */
34
+ deleteTenant: (id: string) => Promise<TenantManagementResult>;
35
+ /** Fetch connection string for a tenant */
36
+ fetchConnectionString: (id: string) => Promise<TenantManagementResult>;
37
+ /** Update connection string for a tenant */
38
+ updateConnectionString: (id: string, connectionString: string) => Promise<TenantManagementResult>;
39
+ /** Delete connection string (use shared database) */
40
+ deleteConnectionString: (id: string) => Promise<TenantManagementResult>;
41
+ /** Set selected tenant */
42
+ setSelectedTenant: (tenant: TenantManagement.Item | null) => void;
43
+ /** Set use shared database flag */
44
+ setUseSharedDatabase: (value: boolean) => void;
45
+ /** Set default connection string */
46
+ setDefaultConnectionString: (value: string) => void;
47
+ /** Reset all state */
48
+ reset: () => void;
49
+ }
50
+ /**
51
+ * Hook for managing tenants
52
+ *
53
+ * This hook provides all the state and actions needed for the tenant
54
+ * management modal. It handles fetching, creating, updating, and deleting tenants,
55
+ * as well as managing connection strings.
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * function TenantModal() {
60
+ * const {
61
+ * tenants,
62
+ * selectedTenant,
63
+ * isLoading,
64
+ * fetchTenants,
65
+ * createTenant,
66
+ * updateTenant,
67
+ * deleteTenant,
68
+ * } = useTenantManagement();
69
+ *
70
+ * useEffect(() => {
71
+ * fetchTenants();
72
+ * }, [fetchTenants]);
73
+ *
74
+ * return (
75
+ * // ... modal UI
76
+ * );
77
+ * }
78
+ * ```
79
+ */
80
+ export declare function useTenantManagement(): UseTenantManagementReturn;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @abpjs/tenant-management
3
+ * ABP Framework Tenant Management module for React
4
+ * Translated from @abp/ng.tenant-management v0.7.6
5
+ */
6
+ export * from './models';
7
+ export * from './services';
8
+ export * from './hooks';
9
+ export * from './components';