@abpjs/text-template-management 2.7.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
@@ -296,7 +592,7 @@ declare class TextTemplateManagementStateService {
296
592
 
297
593
  /**
298
594
  * useTextTemplates Hook
299
- * Translated from @volo/abp.ng.text-template-management v2.7.0
595
+ * Translated from @volo/abp.ng.text-template-management v2.9.0
300
596
  *
301
597
  * Provides a React hook for managing text templates with state management.
302
598
  */
@@ -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 };