@abpjs/text-template-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,6 +1,96 @@
1
- import { ABP, RestService, PagedResultRequestDto, ListResultDto } from '@abpjs/core';
1
+ import { ABP, RoutesService, RestService, PagedResultRequestDto, ListResultDto } from '@abpjs/core';
2
2
  import React from 'react';
3
3
 
4
+ /**
5
+ * Text Template Management Policy Names
6
+ * Translated from @volo/abp.ng.text-template-management/config v3.0.0
7
+ *
8
+ * Policy name constants for Text Template Management module permission checking.
9
+ * @since 3.0.0
10
+ */
11
+ /**
12
+ * Enum-like const object for Text Template Management policy names.
13
+ * Used for permission checking in Text Template Management module.
14
+ * @since 3.0.0
15
+ */
16
+ declare const eTextTemplateManagementPolicyNames: {
17
+ /** Policy for Text Templates management */
18
+ readonly TextTemplates: "TextTemplateManagement.TextTemplates";
19
+ };
20
+ /**
21
+ * Type for Text Template Management policy name values
22
+ * @since 3.0.0
23
+ */
24
+ type TextTemplateManagementPolicyNameKey = (typeof eTextTemplateManagementPolicyNames)[keyof typeof eTextTemplateManagementPolicyNames];
25
+
26
+ /**
27
+ * Text Template Management Route Names
28
+ * Translated from @volo/abp.ng.text-template-management/config v3.0.0
29
+ *
30
+ * Route name keys for the Text Template Management module.
31
+ * These keys are used for route localization and identification.
32
+ *
33
+ * @since 3.0.0
34
+ *
35
+ * Breaking changes in v3.0.0:
36
+ * - Removed 'Administration' key
37
+ */
38
+ /**
39
+ * Enum-like const object for Text Template Management route names.
40
+ * @since 3.0.0
41
+ */
42
+ declare const eTextTemplateManagementRouteNames: {
43
+ /**
44
+ * Text Templates route name key.
45
+ * Used for the text templates management route.
46
+ */
47
+ readonly TextTemplates: "TextTemplateManagement::Menu:TextTemplates";
48
+ };
49
+ /**
50
+ * Type for Text Template Management route name key values
51
+ * @since 3.0.0
52
+ */
53
+ type TextTemplateManagementRouteNameKey = (typeof eTextTemplateManagementRouteNames)[keyof typeof eTextTemplateManagementRouteNames];
54
+
55
+ /**
56
+ * Text Template Management Route Provider
57
+ * Translated from @volo/abp.ng.text-template-management/config v3.0.0
58
+ *
59
+ * Provides route configuration functionality for Text Template Management module.
60
+ * @since 3.0.0
61
+ */
62
+
63
+ /**
64
+ * Default Text Template Management route configuration
65
+ * @since 3.0.0
66
+ */
67
+ declare const TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG: ABP.Route;
68
+ /**
69
+ * Configure Text Template Management routes
70
+ * @param routes - The routes service instance
71
+ * @returns A function that adds Text Template Management routes
72
+ * @since 3.0.0
73
+ */
74
+ declare function configureRoutes(routes: RoutesService): () => void;
75
+ /**
76
+ * Initialize Text Template Management routes
77
+ * Helper function to immediately configure routes
78
+ * @param routes - The routes service instance
79
+ * @since 3.0.0
80
+ */
81
+ declare function initializeTextTemplateManagementRoutes(routes: RoutesService): void;
82
+ /**
83
+ * Text Template Management route providers configuration object
84
+ * React equivalent of Angular's APP_INITIALIZER pattern
85
+ * @since 3.0.0
86
+ */
87
+ declare const TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS: {
88
+ /** Configure function factory */
89
+ useFactory: typeof configureRoutes;
90
+ /** Dependencies required by the factory */
91
+ deps: readonly ["RoutesService"];
92
+ };
93
+
4
94
  /**
5
95
  * Component keys for the Text Template Management module.
6
96
  * These keys are used for component replacement/customization.
@@ -29,26 +119,72 @@ declare const eTextTemplateManagementComponents: {
29
119
  type TextTemplateManagementComponentKey = (typeof eTextTemplateManagementComponents)[keyof typeof eTextTemplateManagementComponents];
30
120
 
31
121
  /**
32
- * Route name keys for the Text Template Management module.
33
- * These keys are used for route localization and identification.
34
- * @since 2.7.0
122
+ * Text Template Management Extensions Guard
123
+ * Translated from @volo/abp.ng.text-template-management v3.0.0
124
+ *
125
+ * Guard for protecting Text Template Management routes and ensuring extensions are loaded.
126
+ *
127
+ * @since 3.0.0
35
128
  */
36
- declare const eTextTemplateManagementRouteNames: {
37
- /**
38
- * Administration route name key.
39
- * Used for the administration menu group.
40
- */
41
- readonly Administration: "AbpUiNavigation::Menu:Administration";
42
- /**
43
- * Text Templates route name key.
44
- * Used for the text templates management route.
45
- */
46
- readonly TextTemplates: "TextTemplateManagement::Menu:TextTemplates";
129
+ /**
130
+ * Text Template Management extensions guard function
131
+ * Async guard function that can be used for route protection.
132
+ *
133
+ * @returns Promise<boolean> - True if navigation should proceed
134
+ * @since 3.0.0
135
+ *
136
+ * @example
137
+ * ```tsx
138
+ * // In route configuration
139
+ * const canActivate = await textTemplateManagementExtensionsGuard();
140
+ * if (canActivate) {
141
+ * // Proceed with navigation
142
+ * }
143
+ * ```
144
+ */
145
+ declare function textTemplateManagementExtensionsGuard(): Promise<boolean>;
146
+ /**
147
+ * Hook for Text Template Management extensions guard state
148
+ * Provides reactive state for extension loading.
149
+ *
150
+ * @returns Object with isLoaded and loading state
151
+ * @since 3.0.0
152
+ *
153
+ * @example
154
+ * ```tsx
155
+ * function ProtectedRoute({ children }) {
156
+ * const { isLoaded, loading } = useTextTemplateManagementExtensionsGuard();
157
+ *
158
+ * if (loading) return <Loading />;
159
+ * if (!isLoaded) return <Navigate to="/unauthorized" />;
160
+ *
161
+ * return children;
162
+ * }
163
+ * ```
164
+ */
165
+ declare function useTextTemplateManagementExtensionsGuard(): {
166
+ isLoaded: boolean;
167
+ loading: boolean;
47
168
  };
48
169
  /**
49
- * Type for text template management route name key values
170
+ * Text Template Management Extensions Guard class
171
+ * Class-based guard implementation for compatibility with Angular patterns.
172
+ *
173
+ * @since 3.0.0
174
+ *
175
+ * @example
176
+ * ```tsx
177
+ * const guard = new TextTemplateManagementExtensionsGuard();
178
+ * const canActivate = await guard.canActivate();
179
+ * ```
50
180
  */
51
- type TextTemplateManagementRouteNameKey = (typeof eTextTemplateManagementRouteNames)[keyof typeof eTextTemplateManagementRouteNames];
181
+ declare class TextTemplateManagementExtensionsGuard {
182
+ /**
183
+ * Check if the route can be activated
184
+ * @returns Promise<boolean> - True if navigation should proceed
185
+ */
186
+ canActivate(): Promise<boolean>;
187
+ }
52
188
 
53
189
  /**
54
190
  * Text Template Management Models
@@ -138,6 +274,166 @@ declare namespace TextTemplateManagement {
138
274
  }
139
275
  }
140
276
 
277
+ /**
278
+ * Text Template Management Extension Tokens
279
+ * Translated from @volo/abp.ng.text-template-management v3.0.0
280
+ *
281
+ * Default entity actions, toolbar actions, and entity props
282
+ * for the Text Template Management module extensibility system.
283
+ *
284
+ * @since 3.0.0
285
+ */
286
+
287
+ /**
288
+ * Entity action type for extensibility
289
+ * @since 3.0.0
290
+ */
291
+ interface EntityAction<T = unknown> {
292
+ text: string;
293
+ action?: (record: T) => void;
294
+ permission?: string;
295
+ visible?: (record: T) => boolean;
296
+ icon?: string;
297
+ }
298
+ /**
299
+ * Toolbar action type for extensibility
300
+ * @since 3.0.0
301
+ */
302
+ interface ToolbarAction<T = unknown> {
303
+ text: string;
304
+ action?: (data: T) => void;
305
+ permission?: string;
306
+ visible?: (data: T) => boolean;
307
+ icon?: string;
308
+ }
309
+ /**
310
+ * Entity prop type for extensibility
311
+ * @since 3.0.0
312
+ */
313
+ interface EntityProp<T = unknown> {
314
+ name: string;
315
+ displayName?: string;
316
+ sortable?: boolean;
317
+ valueResolver?: (record: T) => string | number | boolean | null | undefined;
318
+ permission?: string;
319
+ visible?: boolean;
320
+ }
321
+ /**
322
+ * Default entity actions for TextTemplates component
323
+ * @since 3.0.0
324
+ */
325
+ declare const DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS: EntityAction<TextTemplateManagement.TemplateDefinitionDto>[];
326
+ /**
327
+ * Default entity actions aggregated by component
328
+ * @since 3.0.0
329
+ */
330
+ declare const DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS: {
331
+ readonly "TextTemplateManagement.TextTemplates": EntityAction<TextTemplateManagement.TemplateDefinitionDto>[];
332
+ };
333
+ /**
334
+ * Default toolbar actions for TextTemplates component
335
+ * Note: Text Template Management typically doesn't have create functionality
336
+ * as templates are defined in code
337
+ * @since 3.0.0
338
+ */
339
+ declare const DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS: ToolbarAction<TextTemplateManagement.TemplateDefinitionDto[]>[];
340
+ /**
341
+ * Default toolbar actions aggregated by component
342
+ * @since 3.0.0
343
+ */
344
+ declare const DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS: {
345
+ readonly "TextTemplateManagement.TextTemplates": ToolbarAction<TextTemplateManagement.TemplateDefinitionDto[]>[];
346
+ };
347
+ /**
348
+ * Default entity props for TextTemplates component
349
+ * @since 3.0.0
350
+ */
351
+ declare const DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS: EntityProp<TextTemplateManagement.TemplateDefinitionDto>[];
352
+ /**
353
+ * Default entity props aggregated by component
354
+ * @since 3.0.0
355
+ */
356
+ declare const DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS: {
357
+ readonly "TextTemplateManagement.TextTemplates": EntityProp<TextTemplateManagement.TemplateDefinitionDto>[];
358
+ };
359
+ /**
360
+ * Entity action contributor callback type
361
+ * @since 3.0.0
362
+ */
363
+ type EntityActionContributorCallback<T> = (actions: EntityAction<T>[]) => EntityAction<T>[];
364
+ /**
365
+ * Toolbar action contributor callback type
366
+ * @since 3.0.0
367
+ */
368
+ type ToolbarActionContributorCallback<T> = (actions: ToolbarAction<T>[]) => ToolbarAction<T>[];
369
+ /**
370
+ * Entity prop contributor callback type
371
+ * @since 3.0.0
372
+ */
373
+ type EntityPropContributorCallback<T> = (props: EntityProp<T>[]) => EntityProp<T>[];
374
+ /**
375
+ * Token for entity action contributors
376
+ * React equivalent of Angular InjectionToken
377
+ * @since 3.0.0
378
+ */
379
+ declare const TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS: unique symbol;
380
+ /**
381
+ * Token for toolbar action contributors
382
+ * React equivalent of Angular InjectionToken
383
+ * @since 3.0.0
384
+ */
385
+ declare const TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS: unique symbol;
386
+ /**
387
+ * Token for entity prop contributors
388
+ * React equivalent of Angular InjectionToken
389
+ * @since 3.0.0
390
+ */
391
+ declare const TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS: unique symbol;
392
+
393
+ /**
394
+ * Text Template Management Config Options
395
+ * Translated from @volo/abp.ng.text-template-management v3.0.0
396
+ *
397
+ * Configuration options and contributor types for the Text Template Management module.
398
+ *
399
+ * @since 3.0.0
400
+ */
401
+
402
+ /**
403
+ * Entity action contributors type for Text Template Management
404
+ * @since 3.0.0
405
+ */
406
+ type TextTemplateManagementEntityActionContributors = Partial<{
407
+ [eTextTemplateManagementComponents.TextTemplates]: EntityActionContributorCallback<TextTemplateManagement.TemplateDefinitionDto>[];
408
+ }>;
409
+ /**
410
+ * Toolbar action contributors type for Text Template Management
411
+ * Note: Typo fixed in v3.0.0 (was TextTemplateManagementTooolbarActionContributors)
412
+ * @since 3.0.0
413
+ */
414
+ type TextTemplateManagementToolbarActionContributors = Partial<{
415
+ [eTextTemplateManagementComponents.TextTemplates]: ToolbarActionContributorCallback<TextTemplateManagement.TemplateDefinitionDto[]>[];
416
+ }>;
417
+ /**
418
+ * Entity prop contributors type for Text Template Management
419
+ * @since 3.0.0
420
+ */
421
+ type TextTemplateManagementEntityPropContributors = Partial<{
422
+ [eTextTemplateManagementComponents.TextTemplates]: EntityPropContributorCallback<TextTemplateManagement.TemplateDefinitionDto>[];
423
+ }>;
424
+ /**
425
+ * Configuration options interface for Text Template Management module
426
+ * @since 3.0.0
427
+ */
428
+ interface TextTemplateManagementConfigOptions {
429
+ /** Entity action contributors */
430
+ entityActionContributors?: TextTemplateManagementEntityActionContributors;
431
+ /** Toolbar action contributors */
432
+ toolbarActionContributors?: TextTemplateManagementToolbarActionContributors;
433
+ /** Entity prop contributors */
434
+ entityPropContributors?: TextTemplateManagementEntityPropContributors;
435
+ }
436
+
141
437
  /**
142
438
  * Text Template Management Routes
143
439
  * Translated from @volo/abp.ng.text-template-management v2.7.0
@@ -451,4 +747,4 @@ interface TemplateContentsComponentProps {
451
747
  */
452
748
  declare function TemplateContentsComponent({ templateName, cultures, defaultCultureName, onSave, onRestore, className, }: TemplateContentsComponentProps): React.ReactElement;
453
749
 
454
- export { TEXT_TEMPLATE_MANAGEMENT_ROUTES, TemplateContentService, TemplateContentsComponent, type TemplateContentsComponentProps, TemplateDefinitionService, TextTemplateManagement, type TextTemplateManagementComponentKey, type TextTemplateManagementRouteNameKey, TextTemplateManagementStateService, TextTemplatesComponent, type TextTemplatesComponentProps, type UseTextTemplatesReturn, eTextTemplateManagementComponents, eTextTemplateManagementRouteNames, useTextTemplates };
750
+ export { DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS, DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS, DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS, DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS, DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS, DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS, type EntityAction, type EntityActionContributorCallback, type EntityProp, type EntityPropContributorCallback, TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS, TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, TEXT_TEMPLATE_MANAGEMENT_ROUTES, TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG, TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS, TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, TemplateContentService, TemplateContentsComponent, type TemplateContentsComponentProps, TemplateDefinitionService, TextTemplateManagement, type TextTemplateManagementComponentKey, type TextTemplateManagementConfigOptions, type TextTemplateManagementEntityActionContributors, type TextTemplateManagementEntityPropContributors, TextTemplateManagementExtensionsGuard, type TextTemplateManagementPolicyNameKey, type TextTemplateManagementRouteNameKey, TextTemplateManagementStateService, type TextTemplateManagementToolbarActionContributors, TextTemplatesComponent, type TextTemplatesComponentProps, type ToolbarAction, type ToolbarActionContributorCallback, type UseTextTemplatesReturn, configureRoutes, eTextTemplateManagementComponents, eTextTemplateManagementPolicyNames, eTextTemplateManagementRouteNames, initializeTextTemplateManagementRoutes, textTemplateManagementExtensionsGuard, useTextTemplateManagementExtensionsGuard, useTextTemplates };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,96 @@
1
- import { ABP, RestService, PagedResultRequestDto, ListResultDto } from '@abpjs/core';
1
+ import { ABP, RoutesService, RestService, PagedResultRequestDto, ListResultDto } from '@abpjs/core';
2
2
  import React from 'react';
3
3
 
4
+ /**
5
+ * Text Template Management Policy Names
6
+ * Translated from @volo/abp.ng.text-template-management/config v3.0.0
7
+ *
8
+ * Policy name constants for Text Template Management module permission checking.
9
+ * @since 3.0.0
10
+ */
11
+ /**
12
+ * Enum-like const object for Text Template Management policy names.
13
+ * Used for permission checking in Text Template Management module.
14
+ * @since 3.0.0
15
+ */
16
+ declare const eTextTemplateManagementPolicyNames: {
17
+ /** Policy for Text Templates management */
18
+ readonly TextTemplates: "TextTemplateManagement.TextTemplates";
19
+ };
20
+ /**
21
+ * Type for Text Template Management policy name values
22
+ * @since 3.0.0
23
+ */
24
+ type TextTemplateManagementPolicyNameKey = (typeof eTextTemplateManagementPolicyNames)[keyof typeof eTextTemplateManagementPolicyNames];
25
+
26
+ /**
27
+ * Text Template Management Route Names
28
+ * Translated from @volo/abp.ng.text-template-management/config v3.0.0
29
+ *
30
+ * Route name keys for the Text Template Management module.
31
+ * These keys are used for route localization and identification.
32
+ *
33
+ * @since 3.0.0
34
+ *
35
+ * Breaking changes in v3.0.0:
36
+ * - Removed 'Administration' key
37
+ */
38
+ /**
39
+ * Enum-like const object for Text Template Management route names.
40
+ * @since 3.0.0
41
+ */
42
+ declare const eTextTemplateManagementRouteNames: {
43
+ /**
44
+ * Text Templates route name key.
45
+ * Used for the text templates management route.
46
+ */
47
+ readonly TextTemplates: "TextTemplateManagement::Menu:TextTemplates";
48
+ };
49
+ /**
50
+ * Type for Text Template Management route name key values
51
+ * @since 3.0.0
52
+ */
53
+ type TextTemplateManagementRouteNameKey = (typeof eTextTemplateManagementRouteNames)[keyof typeof eTextTemplateManagementRouteNames];
54
+
55
+ /**
56
+ * Text Template Management Route Provider
57
+ * Translated from @volo/abp.ng.text-template-management/config v3.0.0
58
+ *
59
+ * Provides route configuration functionality for Text Template Management module.
60
+ * @since 3.0.0
61
+ */
62
+
63
+ /**
64
+ * Default Text Template Management route configuration
65
+ * @since 3.0.0
66
+ */
67
+ declare const TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG: ABP.Route;
68
+ /**
69
+ * Configure Text Template Management routes
70
+ * @param routes - The routes service instance
71
+ * @returns A function that adds Text Template Management routes
72
+ * @since 3.0.0
73
+ */
74
+ declare function configureRoutes(routes: RoutesService): () => void;
75
+ /**
76
+ * Initialize Text Template Management routes
77
+ * Helper function to immediately configure routes
78
+ * @param routes - The routes service instance
79
+ * @since 3.0.0
80
+ */
81
+ declare function initializeTextTemplateManagementRoutes(routes: RoutesService): void;
82
+ /**
83
+ * Text Template Management route providers configuration object
84
+ * React equivalent of Angular's APP_INITIALIZER pattern
85
+ * @since 3.0.0
86
+ */
87
+ declare const TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS: {
88
+ /** Configure function factory */
89
+ useFactory: typeof configureRoutes;
90
+ /** Dependencies required by the factory */
91
+ deps: readonly ["RoutesService"];
92
+ };
93
+
4
94
  /**
5
95
  * Component keys for the Text Template Management module.
6
96
  * These keys are used for component replacement/customization.
@@ -29,26 +119,72 @@ declare const eTextTemplateManagementComponents: {
29
119
  type TextTemplateManagementComponentKey = (typeof eTextTemplateManagementComponents)[keyof typeof eTextTemplateManagementComponents];
30
120
 
31
121
  /**
32
- * Route name keys for the Text Template Management module.
33
- * These keys are used for route localization and identification.
34
- * @since 2.7.0
122
+ * Text Template Management Extensions Guard
123
+ * Translated from @volo/abp.ng.text-template-management v3.0.0
124
+ *
125
+ * Guard for protecting Text Template Management routes and ensuring extensions are loaded.
126
+ *
127
+ * @since 3.0.0
35
128
  */
36
- declare const eTextTemplateManagementRouteNames: {
37
- /**
38
- * Administration route name key.
39
- * Used for the administration menu group.
40
- */
41
- readonly Administration: "AbpUiNavigation::Menu:Administration";
42
- /**
43
- * Text Templates route name key.
44
- * Used for the text templates management route.
45
- */
46
- readonly TextTemplates: "TextTemplateManagement::Menu:TextTemplates";
129
+ /**
130
+ * Text Template Management extensions guard function
131
+ * Async guard function that can be used for route protection.
132
+ *
133
+ * @returns Promise<boolean> - True if navigation should proceed
134
+ * @since 3.0.0
135
+ *
136
+ * @example
137
+ * ```tsx
138
+ * // In route configuration
139
+ * const canActivate = await textTemplateManagementExtensionsGuard();
140
+ * if (canActivate) {
141
+ * // Proceed with navigation
142
+ * }
143
+ * ```
144
+ */
145
+ declare function textTemplateManagementExtensionsGuard(): Promise<boolean>;
146
+ /**
147
+ * Hook for Text Template Management extensions guard state
148
+ * Provides reactive state for extension loading.
149
+ *
150
+ * @returns Object with isLoaded and loading state
151
+ * @since 3.0.0
152
+ *
153
+ * @example
154
+ * ```tsx
155
+ * function ProtectedRoute({ children }) {
156
+ * const { isLoaded, loading } = useTextTemplateManagementExtensionsGuard();
157
+ *
158
+ * if (loading) return <Loading />;
159
+ * if (!isLoaded) return <Navigate to="/unauthorized" />;
160
+ *
161
+ * return children;
162
+ * }
163
+ * ```
164
+ */
165
+ declare function useTextTemplateManagementExtensionsGuard(): {
166
+ isLoaded: boolean;
167
+ loading: boolean;
47
168
  };
48
169
  /**
49
- * Type for text template management route name key values
170
+ * Text Template Management Extensions Guard class
171
+ * Class-based guard implementation for compatibility with Angular patterns.
172
+ *
173
+ * @since 3.0.0
174
+ *
175
+ * @example
176
+ * ```tsx
177
+ * const guard = new TextTemplateManagementExtensionsGuard();
178
+ * const canActivate = await guard.canActivate();
179
+ * ```
50
180
  */
51
- type TextTemplateManagementRouteNameKey = (typeof eTextTemplateManagementRouteNames)[keyof typeof eTextTemplateManagementRouteNames];
181
+ declare class TextTemplateManagementExtensionsGuard {
182
+ /**
183
+ * Check if the route can be activated
184
+ * @returns Promise<boolean> - True if navigation should proceed
185
+ */
186
+ canActivate(): Promise<boolean>;
187
+ }
52
188
 
53
189
  /**
54
190
  * Text Template Management Models
@@ -138,6 +274,166 @@ declare namespace TextTemplateManagement {
138
274
  }
139
275
  }
140
276
 
277
+ /**
278
+ * Text Template Management Extension Tokens
279
+ * Translated from @volo/abp.ng.text-template-management v3.0.0
280
+ *
281
+ * Default entity actions, toolbar actions, and entity props
282
+ * for the Text Template Management module extensibility system.
283
+ *
284
+ * @since 3.0.0
285
+ */
286
+
287
+ /**
288
+ * Entity action type for extensibility
289
+ * @since 3.0.0
290
+ */
291
+ interface EntityAction<T = unknown> {
292
+ text: string;
293
+ action?: (record: T) => void;
294
+ permission?: string;
295
+ visible?: (record: T) => boolean;
296
+ icon?: string;
297
+ }
298
+ /**
299
+ * Toolbar action type for extensibility
300
+ * @since 3.0.0
301
+ */
302
+ interface ToolbarAction<T = unknown> {
303
+ text: string;
304
+ action?: (data: T) => void;
305
+ permission?: string;
306
+ visible?: (data: T) => boolean;
307
+ icon?: string;
308
+ }
309
+ /**
310
+ * Entity prop type for extensibility
311
+ * @since 3.0.0
312
+ */
313
+ interface EntityProp<T = unknown> {
314
+ name: string;
315
+ displayName?: string;
316
+ sortable?: boolean;
317
+ valueResolver?: (record: T) => string | number | boolean | null | undefined;
318
+ permission?: string;
319
+ visible?: boolean;
320
+ }
321
+ /**
322
+ * Default entity actions for TextTemplates component
323
+ * @since 3.0.0
324
+ */
325
+ declare const DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS: EntityAction<TextTemplateManagement.TemplateDefinitionDto>[];
326
+ /**
327
+ * Default entity actions aggregated by component
328
+ * @since 3.0.0
329
+ */
330
+ declare const DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS: {
331
+ readonly "TextTemplateManagement.TextTemplates": EntityAction<TextTemplateManagement.TemplateDefinitionDto>[];
332
+ };
333
+ /**
334
+ * Default toolbar actions for TextTemplates component
335
+ * Note: Text Template Management typically doesn't have create functionality
336
+ * as templates are defined in code
337
+ * @since 3.0.0
338
+ */
339
+ declare const DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS: ToolbarAction<TextTemplateManagement.TemplateDefinitionDto[]>[];
340
+ /**
341
+ * Default toolbar actions aggregated by component
342
+ * @since 3.0.0
343
+ */
344
+ declare const DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS: {
345
+ readonly "TextTemplateManagement.TextTemplates": ToolbarAction<TextTemplateManagement.TemplateDefinitionDto[]>[];
346
+ };
347
+ /**
348
+ * Default entity props for TextTemplates component
349
+ * @since 3.0.0
350
+ */
351
+ declare const DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS: EntityProp<TextTemplateManagement.TemplateDefinitionDto>[];
352
+ /**
353
+ * Default entity props aggregated by component
354
+ * @since 3.0.0
355
+ */
356
+ declare const DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS: {
357
+ readonly "TextTemplateManagement.TextTemplates": EntityProp<TextTemplateManagement.TemplateDefinitionDto>[];
358
+ };
359
+ /**
360
+ * Entity action contributor callback type
361
+ * @since 3.0.0
362
+ */
363
+ type EntityActionContributorCallback<T> = (actions: EntityAction<T>[]) => EntityAction<T>[];
364
+ /**
365
+ * Toolbar action contributor callback type
366
+ * @since 3.0.0
367
+ */
368
+ type ToolbarActionContributorCallback<T> = (actions: ToolbarAction<T>[]) => ToolbarAction<T>[];
369
+ /**
370
+ * Entity prop contributor callback type
371
+ * @since 3.0.0
372
+ */
373
+ type EntityPropContributorCallback<T> = (props: EntityProp<T>[]) => EntityProp<T>[];
374
+ /**
375
+ * Token for entity action contributors
376
+ * React equivalent of Angular InjectionToken
377
+ * @since 3.0.0
378
+ */
379
+ declare const TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS: unique symbol;
380
+ /**
381
+ * Token for toolbar action contributors
382
+ * React equivalent of Angular InjectionToken
383
+ * @since 3.0.0
384
+ */
385
+ declare const TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS: unique symbol;
386
+ /**
387
+ * Token for entity prop contributors
388
+ * React equivalent of Angular InjectionToken
389
+ * @since 3.0.0
390
+ */
391
+ declare const TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS: unique symbol;
392
+
393
+ /**
394
+ * Text Template Management Config Options
395
+ * Translated from @volo/abp.ng.text-template-management v3.0.0
396
+ *
397
+ * Configuration options and contributor types for the Text Template Management module.
398
+ *
399
+ * @since 3.0.0
400
+ */
401
+
402
+ /**
403
+ * Entity action contributors type for Text Template Management
404
+ * @since 3.0.0
405
+ */
406
+ type TextTemplateManagementEntityActionContributors = Partial<{
407
+ [eTextTemplateManagementComponents.TextTemplates]: EntityActionContributorCallback<TextTemplateManagement.TemplateDefinitionDto>[];
408
+ }>;
409
+ /**
410
+ * Toolbar action contributors type for Text Template Management
411
+ * Note: Typo fixed in v3.0.0 (was TextTemplateManagementTooolbarActionContributors)
412
+ * @since 3.0.0
413
+ */
414
+ type TextTemplateManagementToolbarActionContributors = Partial<{
415
+ [eTextTemplateManagementComponents.TextTemplates]: ToolbarActionContributorCallback<TextTemplateManagement.TemplateDefinitionDto[]>[];
416
+ }>;
417
+ /**
418
+ * Entity prop contributors type for Text Template Management
419
+ * @since 3.0.0
420
+ */
421
+ type TextTemplateManagementEntityPropContributors = Partial<{
422
+ [eTextTemplateManagementComponents.TextTemplates]: EntityPropContributorCallback<TextTemplateManagement.TemplateDefinitionDto>[];
423
+ }>;
424
+ /**
425
+ * Configuration options interface for Text Template Management module
426
+ * @since 3.0.0
427
+ */
428
+ interface TextTemplateManagementConfigOptions {
429
+ /** Entity action contributors */
430
+ entityActionContributors?: TextTemplateManagementEntityActionContributors;
431
+ /** Toolbar action contributors */
432
+ toolbarActionContributors?: TextTemplateManagementToolbarActionContributors;
433
+ /** Entity prop contributors */
434
+ entityPropContributors?: TextTemplateManagementEntityPropContributors;
435
+ }
436
+
141
437
  /**
142
438
  * Text Template Management Routes
143
439
  * Translated from @volo/abp.ng.text-template-management v2.7.0
@@ -451,4 +747,4 @@ interface TemplateContentsComponentProps {
451
747
  */
452
748
  declare function TemplateContentsComponent({ templateName, cultures, defaultCultureName, onSave, onRestore, className, }: TemplateContentsComponentProps): React.ReactElement;
453
749
 
454
- export { TEXT_TEMPLATE_MANAGEMENT_ROUTES, TemplateContentService, TemplateContentsComponent, type TemplateContentsComponentProps, TemplateDefinitionService, TextTemplateManagement, type TextTemplateManagementComponentKey, type TextTemplateManagementRouteNameKey, TextTemplateManagementStateService, TextTemplatesComponent, type TextTemplatesComponentProps, type UseTextTemplatesReturn, eTextTemplateManagementComponents, eTextTemplateManagementRouteNames, useTextTemplates };
750
+ export { DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS, DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS, DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS, DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS, DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS, DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS, type EntityAction, type EntityActionContributorCallback, type EntityProp, type EntityPropContributorCallback, TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS, TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, TEXT_TEMPLATE_MANAGEMENT_ROUTES, TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG, TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS, TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, TemplateContentService, TemplateContentsComponent, type TemplateContentsComponentProps, TemplateDefinitionService, TextTemplateManagement, type TextTemplateManagementComponentKey, type TextTemplateManagementConfigOptions, type TextTemplateManagementEntityActionContributors, type TextTemplateManagementEntityPropContributors, TextTemplateManagementExtensionsGuard, type TextTemplateManagementPolicyNameKey, type TextTemplateManagementRouteNameKey, TextTemplateManagementStateService, type TextTemplateManagementToolbarActionContributors, TextTemplatesComponent, type TextTemplatesComponentProps, type ToolbarAction, type ToolbarActionContributorCallback, type UseTextTemplatesReturn, configureRoutes, eTextTemplateManagementComponents, eTextTemplateManagementPolicyNames, eTextTemplateManagementRouteNames, initializeTextTemplateManagementRoutes, textTemplateManagementExtensionsGuard, useTextTemplateManagementExtensionsGuard, useTextTemplates };
package/dist/index.js CHANGED
@@ -20,18 +20,74 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS: () => DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS,
24
+ DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS: () => DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS,
25
+ DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS: () => DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS,
26
+ DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS: () => DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS,
27
+ DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS: () => DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS,
28
+ DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS: () => DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS,
29
+ TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS: () => TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS,
30
+ TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS: () => TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS,
23
31
  TEXT_TEMPLATE_MANAGEMENT_ROUTES: () => TEXT_TEMPLATE_MANAGEMENT_ROUTES,
32
+ TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG: () => TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG,
33
+ TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS: () => TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS,
34
+ TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS: () => TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS,
24
35
  TemplateContentService: () => TemplateContentService,
25
36
  TemplateContentsComponent: () => TemplateContentsComponent,
26
37
  TemplateDefinitionService: () => TemplateDefinitionService,
38
+ TextTemplateManagementExtensionsGuard: () => TextTemplateManagementExtensionsGuard,
27
39
  TextTemplateManagementStateService: () => TextTemplateManagementStateService,
28
40
  TextTemplatesComponent: () => TextTemplatesComponent,
41
+ configureRoutes: () => configureRoutes,
29
42
  eTextTemplateManagementComponents: () => eTextTemplateManagementComponents,
43
+ eTextTemplateManagementPolicyNames: () => eTextTemplateManagementPolicyNames,
30
44
  eTextTemplateManagementRouteNames: () => eTextTemplateManagementRouteNames,
45
+ initializeTextTemplateManagementRoutes: () => initializeTextTemplateManagementRoutes,
46
+ textTemplateManagementExtensionsGuard: () => textTemplateManagementExtensionsGuard,
47
+ useTextTemplateManagementExtensionsGuard: () => useTextTemplateManagementExtensionsGuard,
31
48
  useTextTemplates: () => useTextTemplates
32
49
  });
33
50
  module.exports = __toCommonJS(index_exports);
34
51
 
52
+ // src/config/enums/policy-names.ts
53
+ var eTextTemplateManagementPolicyNames = {
54
+ /** Policy for Text Templates management */
55
+ TextTemplates: "TextTemplateManagement.TextTemplates"
56
+ };
57
+
58
+ // src/config/enums/route-names.ts
59
+ var eTextTemplateManagementRouteNames = {
60
+ /**
61
+ * Text Templates route name key.
62
+ * Used for the text templates management route.
63
+ */
64
+ TextTemplates: "TextTemplateManagement::Menu:TextTemplates"
65
+ };
66
+
67
+ // src/config/providers/route.provider.ts
68
+ var TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG = {
69
+ path: "/text-template-management",
70
+ name: eTextTemplateManagementRouteNames.TextTemplates,
71
+ iconClass: "fas fa-file-alt",
72
+ order: 100,
73
+ requiredPolicy: eTextTemplateManagementPolicyNames.TextTemplates
74
+ };
75
+ function configureRoutes(routes) {
76
+ return () => {
77
+ routes.add([TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG]);
78
+ };
79
+ }
80
+ function initializeTextTemplateManagementRoutes(routes) {
81
+ const configure = configureRoutes(routes);
82
+ configure();
83
+ }
84
+ var TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS = {
85
+ /** Configure function factory */
86
+ useFactory: configureRoutes,
87
+ /** Dependencies required by the factory */
88
+ deps: ["RoutesService"]
89
+ };
90
+
35
91
  // src/enums/components.ts
36
92
  var eTextTemplateManagementComponents = {
37
93
  /**
@@ -51,18 +107,45 @@ var eTextTemplateManagementComponents = {
51
107
  InlineTemplateContent: "TextTemplateManagement.InlineTemplateContent"
52
108
  };
53
109
 
54
- // src/enums/route-names.ts
55
- var eTextTemplateManagementRouteNames = {
56
- /**
57
- * Administration route name key.
58
- * Used for the administration menu group.
59
- */
60
- Administration: "AbpUiNavigation::Menu:Administration",
110
+ // src/guards/extensions.guard.ts
111
+ var import_react = require("react");
112
+ async function textTemplateManagementExtensionsGuard() {
113
+ return Promise.resolve(true);
114
+ }
115
+ function useTextTemplateManagementExtensionsGuard() {
116
+ const [isLoaded, setIsLoaded] = (0, import_react.useState)(false);
117
+ const [loading, setLoading] = (0, import_react.useState)(true);
118
+ (0, import_react.useEffect)(() => {
119
+ let cancelled = false;
120
+ const checkExtensions = async () => {
121
+ try {
122
+ const result = await textTemplateManagementExtensionsGuard();
123
+ if (!cancelled) {
124
+ setIsLoaded(result);
125
+ setLoading(false);
126
+ }
127
+ } catch {
128
+ if (!cancelled) {
129
+ setIsLoaded(false);
130
+ setLoading(false);
131
+ }
132
+ }
133
+ };
134
+ checkExtensions();
135
+ return () => {
136
+ cancelled = true;
137
+ };
138
+ }, []);
139
+ return { isLoaded, loading };
140
+ }
141
+ var TextTemplateManagementExtensionsGuard = class {
61
142
  /**
62
- * Text Templates route name key.
63
- * Used for the text templates management route.
143
+ * Check if the route can be activated
144
+ * @returns Promise<boolean> - True if navigation should proceed
64
145
  */
65
- TextTemplates: "TextTemplateManagement::Menu:TextTemplates"
146
+ async canActivate() {
147
+ return textTemplateManagementExtensionsGuard();
148
+ }
66
149
  };
67
150
 
68
151
  // src/constants/routes.ts
@@ -254,26 +337,76 @@ var TextTemplateManagementStateService = class {
254
337
  }
255
338
  };
256
339
 
340
+ // src/tokens/extensions.token.ts
341
+ var DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS = [
342
+ {
343
+ text: "TextTemplateManagement::EditContents",
344
+ permission: "TextTemplateManagement.TextTemplates.EditContents",
345
+ icon: "fa fa-edit"
346
+ }
347
+ ];
348
+ var DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS = {
349
+ [eTextTemplateManagementComponents.TextTemplates]: DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS
350
+ };
351
+ var DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS = [];
352
+ var DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS = {
353
+ [eTextTemplateManagementComponents.TextTemplates]: DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS
354
+ };
355
+ var DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS = [
356
+ {
357
+ name: "name",
358
+ displayName: "TextTemplateManagement::TemplateName",
359
+ sortable: true
360
+ },
361
+ {
362
+ name: "displayName",
363
+ displayName: "TextTemplateManagement::DisplayName",
364
+ sortable: true
365
+ },
366
+ {
367
+ name: "layout",
368
+ displayName: "TextTemplateManagement::Layout",
369
+ sortable: false
370
+ },
371
+ {
372
+ name: "defaultCultureName",
373
+ displayName: "TextTemplateManagement::DefaultCulture",
374
+ sortable: false
375
+ }
376
+ ];
377
+ var DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS = {
378
+ [eTextTemplateManagementComponents.TextTemplates]: DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS
379
+ };
380
+ var TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS = /* @__PURE__ */ Symbol(
381
+ "TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS"
382
+ );
383
+ var TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS = /* @__PURE__ */ Symbol(
384
+ "TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS"
385
+ );
386
+ var TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS = /* @__PURE__ */ Symbol(
387
+ "TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS"
388
+ );
389
+
257
390
  // src/hooks/useTextTemplates.ts
258
- var import_react = require("react");
391
+ var import_react2 = require("react");
259
392
  var import_core = require("@abpjs/core");
260
393
  function useTextTemplates() {
261
394
  const restService = (0, import_core.useRestService)();
262
- const templateDefinitionService = (0, import_react.useMemo)(
395
+ const templateDefinitionService = (0, import_react2.useMemo)(
263
396
  () => new TemplateDefinitionService(restService),
264
397
  [restService]
265
398
  );
266
- const templateContentService = (0, import_react.useMemo)(
399
+ const templateContentService = (0, import_react2.useMemo)(
267
400
  () => new TemplateContentService(restService),
268
401
  [restService]
269
402
  );
270
- const [templateDefinitions, setTemplateDefinitions] = (0, import_react.useState)([]);
271
- const [totalCount, setTotalCount] = (0, import_react.useState)(0);
272
- const [selectedTemplate, setSelectedTemplate] = (0, import_react.useState)(null);
273
- const [templateContent, setTemplateContent] = (0, import_react.useState)(null);
274
- const [isLoading, setIsLoading] = (0, import_react.useState)(false);
275
- const [error, setError] = (0, import_react.useState)(null);
276
- const fetchTemplateDefinitions = (0, import_react.useCallback)(
403
+ const [templateDefinitions, setTemplateDefinitions] = (0, import_react2.useState)([]);
404
+ const [totalCount, setTotalCount] = (0, import_react2.useState)(0);
405
+ const [selectedTemplate, setSelectedTemplate] = (0, import_react2.useState)(null);
406
+ const [templateContent, setTemplateContent] = (0, import_react2.useState)(null);
407
+ const [isLoading, setIsLoading] = (0, import_react2.useState)(false);
408
+ const [error, setError] = (0, import_react2.useState)(null);
409
+ const fetchTemplateDefinitions = (0, import_react2.useCallback)(
277
410
  async (params = {}) => {
278
411
  setIsLoading(true);
279
412
  setError(null);
@@ -291,7 +424,7 @@ function useTextTemplates() {
291
424
  },
292
425
  [templateDefinitionService]
293
426
  );
294
- const getTemplateContent = (0, import_react.useCallback)(
427
+ const getTemplateContent = (0, import_react2.useCallback)(
295
428
  async (params) => {
296
429
  setIsLoading(true);
297
430
  setError(null);
@@ -307,7 +440,7 @@ function useTextTemplates() {
307
440
  },
308
441
  [templateContentService]
309
442
  );
310
- const updateTemplateContent = (0, import_react.useCallback)(
443
+ const updateTemplateContent = (0, import_react2.useCallback)(
311
444
  async (body) => {
312
445
  setIsLoading(true);
313
446
  setError(null);
@@ -325,7 +458,7 @@ function useTextTemplates() {
325
458
  },
326
459
  [templateContentService]
327
460
  );
328
- const restoreToDefault = (0, import_react.useCallback)(
461
+ const restoreToDefault = (0, import_react2.useCallback)(
329
462
  async (params) => {
330
463
  setIsLoading(true);
331
464
  setError(null);
@@ -346,7 +479,7 @@ function useTextTemplates() {
346
479
  },
347
480
  [templateContentService]
348
481
  );
349
- const reset = (0, import_react.useCallback)(() => {
482
+ const reset = (0, import_react2.useCallback)(() => {
350
483
  setTemplateDefinitions([]);
351
484
  setTotalCount(0);
352
485
  setSelectedTemplate(null);
@@ -370,7 +503,7 @@ function useTextTemplates() {
370
503
  }
371
504
 
372
505
  // src/components/TextTemplatesComponent/TextTemplatesComponent.tsx
373
- var import_react2 = require("react");
506
+ var import_react3 = require("react");
374
507
  var import_jsx_runtime = require("react/jsx-runtime");
375
508
  function TextTemplatesComponent({
376
509
  onEditContents,
@@ -384,8 +517,8 @@ function TextTemplatesComponent({
384
517
  fetchTemplateDefinitions,
385
518
  setSelectedTemplate
386
519
  } = useTextTemplates();
387
- const [currentPage, setCurrentPage] = (0, import_react2.useState)(1);
388
- (0, import_react2.useEffect)(() => {
520
+ const [currentPage, setCurrentPage] = (0, import_react3.useState)(1);
521
+ (0, import_react3.useEffect)(() => {
389
522
  fetchTemplateDefinitions({
390
523
  skipCount: (currentPage - 1) * pageSize,
391
524
  maxResultCount: pageSize
@@ -563,7 +696,7 @@ var styles = {
563
696
  };
564
697
 
565
698
  // src/components/TemplateContentsComponent/TemplateContentsComponent.tsx
566
- var import_react3 = require("react");
699
+ var import_react4 = require("react");
567
700
  var import_jsx_runtime2 = require("react/jsx-runtime");
568
701
  function TemplateContentsComponent({
569
702
  templateName,
@@ -581,11 +714,11 @@ function TemplateContentsComponent({
581
714
  updateTemplateContent,
582
715
  restoreToDefault
583
716
  } = useTextTemplates();
584
- const [selectedCulture, setSelectedCulture] = (0, import_react3.useState)(defaultCultureName || "");
585
- const [content, setContent] = (0, import_react3.useState)("");
586
- const [referenceContent, setReferenceContent] = (0, import_react3.useState)("");
587
- const [isSaving, setIsSaving] = (0, import_react3.useState)(false);
588
- (0, import_react3.useEffect)(() => {
717
+ const [selectedCulture, setSelectedCulture] = (0, import_react4.useState)(defaultCultureName || "");
718
+ const [content, setContent] = (0, import_react4.useState)("");
719
+ const [referenceContent, setReferenceContent] = (0, import_react4.useState)("");
720
+ const [isSaving, setIsSaving] = (0, import_react4.useState)(false);
721
+ (0, import_react4.useEffect)(() => {
589
722
  if (templateName && selectedCulture) {
590
723
  getTemplateContent({
591
724
  templateName,
@@ -593,23 +726,23 @@ function TemplateContentsComponent({
593
726
  });
594
727
  }
595
728
  }, [templateName, selectedCulture, getTemplateContent]);
596
- (0, import_react3.useEffect)(() => {
729
+ (0, import_react4.useEffect)(() => {
597
730
  if (templateName && defaultCultureName && defaultCultureName !== selectedCulture) {
598
731
  setReferenceContent("Reference content would be loaded here");
599
732
  }
600
733
  }, [templateName, defaultCultureName, selectedCulture]);
601
- (0, import_react3.useEffect)(() => {
734
+ (0, import_react4.useEffect)(() => {
602
735
  if (templateContent) {
603
736
  setContent(templateContent.content || "");
604
737
  }
605
738
  }, [templateContent]);
606
- const handleCultureChange = (0, import_react3.useCallback)((e) => {
739
+ const handleCultureChange = (0, import_react4.useCallback)((e) => {
607
740
  setSelectedCulture(e.target.value);
608
741
  }, []);
609
- const handleContentChange = (0, import_react3.useCallback)((e) => {
742
+ const handleContentChange = (0, import_react4.useCallback)((e) => {
610
743
  setContent(e.target.value);
611
744
  }, []);
612
- const handleSave = (0, import_react3.useCallback)(async () => {
745
+ const handleSave = (0, import_react4.useCallback)(async () => {
613
746
  if (!templateName || !selectedCulture) return;
614
747
  setIsSaving(true);
615
748
  const result = await updateTemplateContent({
@@ -622,7 +755,7 @@ function TemplateContentsComponent({
622
755
  onSave?.(templateContent);
623
756
  }
624
757
  }, [templateName, selectedCulture, content, updateTemplateContent, templateContent, onSave]);
625
- const handleRestoreToDefault = (0, import_react3.useCallback)(async () => {
758
+ const handleRestoreToDefault = (0, import_react4.useCallback)(async () => {
626
759
  if (!templateName || !selectedCulture) return;
627
760
  const confirmed = window.confirm(
628
761
  "Are you sure you want to restore this template to its default content?"
@@ -817,13 +950,30 @@ var styles2 = {
817
950
  };
818
951
  // Annotate the CommonJS export names for ESM import in node:
819
952
  0 && (module.exports = {
953
+ DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS,
954
+ DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS,
955
+ DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS,
956
+ DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS,
957
+ DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS,
958
+ DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS,
959
+ TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS,
960
+ TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS,
820
961
  TEXT_TEMPLATE_MANAGEMENT_ROUTES,
962
+ TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG,
963
+ TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS,
964
+ TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS,
821
965
  TemplateContentService,
822
966
  TemplateContentsComponent,
823
967
  TemplateDefinitionService,
968
+ TextTemplateManagementExtensionsGuard,
824
969
  TextTemplateManagementStateService,
825
970
  TextTemplatesComponent,
971
+ configureRoutes,
826
972
  eTextTemplateManagementComponents,
973
+ eTextTemplateManagementPolicyNames,
827
974
  eTextTemplateManagementRouteNames,
975
+ initializeTextTemplateManagementRoutes,
976
+ textTemplateManagementExtensionsGuard,
977
+ useTextTemplateManagementExtensionsGuard,
828
978
  useTextTemplates
829
979
  });
package/dist/index.mjs CHANGED
@@ -1,3 +1,42 @@
1
+ // src/config/enums/policy-names.ts
2
+ var eTextTemplateManagementPolicyNames = {
3
+ /** Policy for Text Templates management */
4
+ TextTemplates: "TextTemplateManagement.TextTemplates"
5
+ };
6
+
7
+ // src/config/enums/route-names.ts
8
+ var eTextTemplateManagementRouteNames = {
9
+ /**
10
+ * Text Templates route name key.
11
+ * Used for the text templates management route.
12
+ */
13
+ TextTemplates: "TextTemplateManagement::Menu:TextTemplates"
14
+ };
15
+
16
+ // src/config/providers/route.provider.ts
17
+ var TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG = {
18
+ path: "/text-template-management",
19
+ name: eTextTemplateManagementRouteNames.TextTemplates,
20
+ iconClass: "fas fa-file-alt",
21
+ order: 100,
22
+ requiredPolicy: eTextTemplateManagementPolicyNames.TextTemplates
23
+ };
24
+ function configureRoutes(routes) {
25
+ return () => {
26
+ routes.add([TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG]);
27
+ };
28
+ }
29
+ function initializeTextTemplateManagementRoutes(routes) {
30
+ const configure = configureRoutes(routes);
31
+ configure();
32
+ }
33
+ var TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS = {
34
+ /** Configure function factory */
35
+ useFactory: configureRoutes,
36
+ /** Dependencies required by the factory */
37
+ deps: ["RoutesService"]
38
+ };
39
+
1
40
  // src/enums/components.ts
2
41
  var eTextTemplateManagementComponents = {
3
42
  /**
@@ -17,18 +56,45 @@ var eTextTemplateManagementComponents = {
17
56
  InlineTemplateContent: "TextTemplateManagement.InlineTemplateContent"
18
57
  };
19
58
 
20
- // src/enums/route-names.ts
21
- var eTextTemplateManagementRouteNames = {
22
- /**
23
- * Administration route name key.
24
- * Used for the administration menu group.
25
- */
26
- Administration: "AbpUiNavigation::Menu:Administration",
59
+ // src/guards/extensions.guard.ts
60
+ import { useState, useEffect } from "react";
61
+ async function textTemplateManagementExtensionsGuard() {
62
+ return Promise.resolve(true);
63
+ }
64
+ function useTextTemplateManagementExtensionsGuard() {
65
+ const [isLoaded, setIsLoaded] = useState(false);
66
+ const [loading, setLoading] = useState(true);
67
+ useEffect(() => {
68
+ let cancelled = false;
69
+ const checkExtensions = async () => {
70
+ try {
71
+ const result = await textTemplateManagementExtensionsGuard();
72
+ if (!cancelled) {
73
+ setIsLoaded(result);
74
+ setLoading(false);
75
+ }
76
+ } catch {
77
+ if (!cancelled) {
78
+ setIsLoaded(false);
79
+ setLoading(false);
80
+ }
81
+ }
82
+ };
83
+ checkExtensions();
84
+ return () => {
85
+ cancelled = true;
86
+ };
87
+ }, []);
88
+ return { isLoaded, loading };
89
+ }
90
+ var TextTemplateManagementExtensionsGuard = class {
27
91
  /**
28
- * Text Templates route name key.
29
- * Used for the text templates management route.
92
+ * Check if the route can be activated
93
+ * @returns Promise<boolean> - True if navigation should proceed
30
94
  */
31
- TextTemplates: "TextTemplateManagement::Menu:TextTemplates"
95
+ async canActivate() {
96
+ return textTemplateManagementExtensionsGuard();
97
+ }
32
98
  };
33
99
 
34
100
  // src/constants/routes.ts
@@ -220,8 +286,58 @@ var TextTemplateManagementStateService = class {
220
286
  }
221
287
  };
222
288
 
289
+ // src/tokens/extensions.token.ts
290
+ var DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS = [
291
+ {
292
+ text: "TextTemplateManagement::EditContents",
293
+ permission: "TextTemplateManagement.TextTemplates.EditContents",
294
+ icon: "fa fa-edit"
295
+ }
296
+ ];
297
+ var DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS = {
298
+ [eTextTemplateManagementComponents.TextTemplates]: DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS
299
+ };
300
+ var DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS = [];
301
+ var DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS = {
302
+ [eTextTemplateManagementComponents.TextTemplates]: DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS
303
+ };
304
+ var DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS = [
305
+ {
306
+ name: "name",
307
+ displayName: "TextTemplateManagement::TemplateName",
308
+ sortable: true
309
+ },
310
+ {
311
+ name: "displayName",
312
+ displayName: "TextTemplateManagement::DisplayName",
313
+ sortable: true
314
+ },
315
+ {
316
+ name: "layout",
317
+ displayName: "TextTemplateManagement::Layout",
318
+ sortable: false
319
+ },
320
+ {
321
+ name: "defaultCultureName",
322
+ displayName: "TextTemplateManagement::DefaultCulture",
323
+ sortable: false
324
+ }
325
+ ];
326
+ var DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS = {
327
+ [eTextTemplateManagementComponents.TextTemplates]: DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS
328
+ };
329
+ var TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS = /* @__PURE__ */ Symbol(
330
+ "TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS"
331
+ );
332
+ var TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS = /* @__PURE__ */ Symbol(
333
+ "TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS"
334
+ );
335
+ var TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS = /* @__PURE__ */ Symbol(
336
+ "TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS"
337
+ );
338
+
223
339
  // src/hooks/useTextTemplates.ts
224
- import { useState, useCallback, useMemo } from "react";
340
+ import { useState as useState2, useCallback, useMemo } from "react";
225
341
  import { useRestService } from "@abpjs/core";
226
342
  function useTextTemplates() {
227
343
  const restService = useRestService();
@@ -233,12 +349,12 @@ function useTextTemplates() {
233
349
  () => new TemplateContentService(restService),
234
350
  [restService]
235
351
  );
236
- const [templateDefinitions, setTemplateDefinitions] = useState([]);
237
- const [totalCount, setTotalCount] = useState(0);
238
- const [selectedTemplate, setSelectedTemplate] = useState(null);
239
- const [templateContent, setTemplateContent] = useState(null);
240
- const [isLoading, setIsLoading] = useState(false);
241
- const [error, setError] = useState(null);
352
+ const [templateDefinitions, setTemplateDefinitions] = useState2([]);
353
+ const [totalCount, setTotalCount] = useState2(0);
354
+ const [selectedTemplate, setSelectedTemplate] = useState2(null);
355
+ const [templateContent, setTemplateContent] = useState2(null);
356
+ const [isLoading, setIsLoading] = useState2(false);
357
+ const [error, setError] = useState2(null);
242
358
  const fetchTemplateDefinitions = useCallback(
243
359
  async (params = {}) => {
244
360
  setIsLoading(true);
@@ -336,7 +452,7 @@ function useTextTemplates() {
336
452
  }
337
453
 
338
454
  // src/components/TextTemplatesComponent/TextTemplatesComponent.tsx
339
- import { useEffect, useState as useState2 } from "react";
455
+ import { useEffect as useEffect2, useState as useState3 } from "react";
340
456
  import { jsx, jsxs } from "react/jsx-runtime";
341
457
  function TextTemplatesComponent({
342
458
  onEditContents,
@@ -350,8 +466,8 @@ function TextTemplatesComponent({
350
466
  fetchTemplateDefinitions,
351
467
  setSelectedTemplate
352
468
  } = useTextTemplates();
353
- const [currentPage, setCurrentPage] = useState2(1);
354
- useEffect(() => {
469
+ const [currentPage, setCurrentPage] = useState3(1);
470
+ useEffect2(() => {
355
471
  fetchTemplateDefinitions({
356
472
  skipCount: (currentPage - 1) * pageSize,
357
473
  maxResultCount: pageSize
@@ -529,7 +645,7 @@ var styles = {
529
645
  };
530
646
 
531
647
  // src/components/TemplateContentsComponent/TemplateContentsComponent.tsx
532
- import { useEffect as useEffect2, useState as useState3, useCallback as useCallback2 } from "react";
648
+ import { useEffect as useEffect3, useState as useState4, useCallback as useCallback2 } from "react";
533
649
  import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
534
650
  function TemplateContentsComponent({
535
651
  templateName,
@@ -547,11 +663,11 @@ function TemplateContentsComponent({
547
663
  updateTemplateContent,
548
664
  restoreToDefault
549
665
  } = useTextTemplates();
550
- const [selectedCulture, setSelectedCulture] = useState3(defaultCultureName || "");
551
- const [content, setContent] = useState3("");
552
- const [referenceContent, setReferenceContent] = useState3("");
553
- const [isSaving, setIsSaving] = useState3(false);
554
- useEffect2(() => {
666
+ const [selectedCulture, setSelectedCulture] = useState4(defaultCultureName || "");
667
+ const [content, setContent] = useState4("");
668
+ const [referenceContent, setReferenceContent] = useState4("");
669
+ const [isSaving, setIsSaving] = useState4(false);
670
+ useEffect3(() => {
555
671
  if (templateName && selectedCulture) {
556
672
  getTemplateContent({
557
673
  templateName,
@@ -559,12 +675,12 @@ function TemplateContentsComponent({
559
675
  });
560
676
  }
561
677
  }, [templateName, selectedCulture, getTemplateContent]);
562
- useEffect2(() => {
678
+ useEffect3(() => {
563
679
  if (templateName && defaultCultureName && defaultCultureName !== selectedCulture) {
564
680
  setReferenceContent("Reference content would be loaded here");
565
681
  }
566
682
  }, [templateName, defaultCultureName, selectedCulture]);
567
- useEffect2(() => {
683
+ useEffect3(() => {
568
684
  if (templateContent) {
569
685
  setContent(templateContent.content || "");
570
686
  }
@@ -782,13 +898,30 @@ var styles2 = {
782
898
  }
783
899
  };
784
900
  export {
901
+ DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS,
902
+ DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS,
903
+ DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS,
904
+ DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS,
905
+ DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS,
906
+ DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS,
907
+ TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS,
908
+ TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS,
785
909
  TEXT_TEMPLATE_MANAGEMENT_ROUTES,
910
+ TEXT_TEMPLATE_MANAGEMENT_ROUTE_CONFIG,
911
+ TEXT_TEMPLATE_MANAGEMENT_ROUTE_PROVIDERS,
912
+ TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS,
786
913
  TemplateContentService,
787
914
  TemplateContentsComponent,
788
915
  TemplateDefinitionService,
916
+ TextTemplateManagementExtensionsGuard,
789
917
  TextTemplateManagementStateService,
790
918
  TextTemplatesComponent,
919
+ configureRoutes,
791
920
  eTextTemplateManagementComponents,
921
+ eTextTemplateManagementPolicyNames,
792
922
  eTextTemplateManagementRouteNames,
923
+ initializeTextTemplateManagementRoutes,
924
+ textTemplateManagementExtensionsGuard,
925
+ useTextTemplateManagementExtensionsGuard,
793
926
  useTextTemplates
794
927
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/text-template-management",
3
- "version": "2.9.0",
3
+ "version": "3.0.0",
4
4
  "description": "ABP Framework text-template-management components for React - translated from @volo/abp.ng.text-template-management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,11 +25,11 @@
25
25
  "dependencies": {
26
26
  "@chakra-ui/react": "^3.2.0",
27
27
  "@emotion/react": "^11.11.0",
28
- "@abpjs/theme-shared": "2.9.0",
29
- "@abpjs/core": "2.9.0"
28
+ "@abpjs/core": "3.0.0",
29
+ "@abpjs/theme-shared": "3.0.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@volo/abp.ng.text-template-management": "2.9.0",
32
+ "@volo/abp.ng.text-template-management": "3.0.0",
33
33
  "@testing-library/jest-dom": "^6.9.1",
34
34
  "@testing-library/react": "^14.0.0",
35
35
  "@testing-library/user-event": "^14.6.1",