@abpjs/text-template-management 2.9.0 → 3.1.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
@@ -137,6 +273,188 @@ declare namespace TextTemplateManagement {
137
273
  sorting?: string;
138
274
  }
139
275
  }
276
+ /**
277
+ * Input for getting template definition list
278
+ * Extends PagedResultRequestDto with optional filterText
279
+ * @since 3.1.0
280
+ */
281
+ interface GetTemplateDefinitionListInput {
282
+ /** Filter text for searching templates */
283
+ filterText?: string;
284
+ /** Skip count for pagination */
285
+ skipCount?: number;
286
+ /** Max result count for pagination */
287
+ maxResultCount?: number;
288
+ /** Sorting field and order */
289
+ sorting?: string;
290
+ }
291
+ /**
292
+ * Factory function to create GetTemplateDefinitionListInput
293
+ * @param initialValues Optional initial values
294
+ * @returns GetTemplateDefinitionListInput instance
295
+ * @since 3.1.0
296
+ */
297
+ declare function createGetTemplateDefinitionListInput(initialValues?: Partial<GetTemplateDefinitionListInput>): GetTemplateDefinitionListInput;
298
+
299
+ /**
300
+ * Text Template Management Extension Tokens
301
+ * Translated from @volo/abp.ng.text-template-management v3.0.0
302
+ *
303
+ * Default entity actions, toolbar actions, and entity props
304
+ * for the Text Template Management module extensibility system.
305
+ *
306
+ * @since 3.0.0
307
+ */
308
+
309
+ /**
310
+ * Entity action type for extensibility
311
+ * @since 3.0.0
312
+ */
313
+ interface EntityAction<T = unknown> {
314
+ text: string;
315
+ action?: (record: T) => void;
316
+ permission?: string;
317
+ visible?: (record: T) => boolean;
318
+ icon?: string;
319
+ }
320
+ /**
321
+ * Toolbar action type for extensibility
322
+ * @since 3.0.0
323
+ */
324
+ interface ToolbarAction<T = unknown> {
325
+ text: string;
326
+ action?: (data: T) => void;
327
+ permission?: string;
328
+ visible?: (data: T) => boolean;
329
+ icon?: string;
330
+ }
331
+ /**
332
+ * Entity prop type for extensibility
333
+ * @since 3.0.0
334
+ */
335
+ interface EntityProp<T = unknown> {
336
+ name: string;
337
+ displayName?: string;
338
+ sortable?: boolean;
339
+ valueResolver?: (record: T) => string | number | boolean | null | undefined;
340
+ permission?: string;
341
+ visible?: boolean;
342
+ }
343
+ /**
344
+ * Default entity actions for TextTemplates component
345
+ * @since 3.0.0
346
+ */
347
+ declare const DEFAULT_TEXT_TEMPLATES_ENTITY_ACTIONS: EntityAction<TextTemplateManagement.TemplateDefinitionDto>[];
348
+ /**
349
+ * Default entity actions aggregated by component
350
+ * @since 3.0.0
351
+ */
352
+ declare const DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTIONS: {
353
+ readonly "TextTemplateManagement.TextTemplates": EntityAction<TextTemplateManagement.TemplateDefinitionDto>[];
354
+ };
355
+ /**
356
+ * Default toolbar actions for TextTemplates component
357
+ * Note: Text Template Management typically doesn't have create functionality
358
+ * as templates are defined in code
359
+ * @since 3.0.0
360
+ */
361
+ declare const DEFAULT_TEXT_TEMPLATES_TOOLBAR_ACTIONS: ToolbarAction<TextTemplateManagement.TemplateDefinitionDto[]>[];
362
+ /**
363
+ * Default toolbar actions aggregated by component
364
+ * @since 3.0.0
365
+ */
366
+ declare const DEFAULT_TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTIONS: {
367
+ readonly "TextTemplateManagement.TextTemplates": ToolbarAction<TextTemplateManagement.TemplateDefinitionDto[]>[];
368
+ };
369
+ /**
370
+ * Default entity props for TextTemplates component
371
+ * @since 3.0.0
372
+ */
373
+ declare const DEFAULT_TEXT_TEMPLATES_ENTITY_PROPS: EntityProp<TextTemplateManagement.TemplateDefinitionDto>[];
374
+ /**
375
+ * Default entity props aggregated by component
376
+ * @since 3.0.0
377
+ */
378
+ declare const DEFAULT_TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROPS: {
379
+ readonly "TextTemplateManagement.TextTemplates": EntityProp<TextTemplateManagement.TemplateDefinitionDto>[];
380
+ };
381
+ /**
382
+ * Entity action contributor callback type
383
+ * @since 3.0.0
384
+ */
385
+ type EntityActionContributorCallback<T> = (actions: EntityAction<T>[]) => EntityAction<T>[];
386
+ /**
387
+ * Toolbar action contributor callback type
388
+ * @since 3.0.0
389
+ */
390
+ type ToolbarActionContributorCallback<T> = (actions: ToolbarAction<T>[]) => ToolbarAction<T>[];
391
+ /**
392
+ * Entity prop contributor callback type
393
+ * @since 3.0.0
394
+ */
395
+ type EntityPropContributorCallback<T> = (props: EntityProp<T>[]) => EntityProp<T>[];
396
+ /**
397
+ * Token for entity action contributors
398
+ * React equivalent of Angular InjectionToken
399
+ * @since 3.0.0
400
+ */
401
+ declare const TEXT_TEMPLATE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS: unique symbol;
402
+ /**
403
+ * Token for toolbar action contributors
404
+ * React equivalent of Angular InjectionToken
405
+ * @since 3.0.0
406
+ */
407
+ declare const TEXT_TEMPLATE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS: unique symbol;
408
+ /**
409
+ * Token for entity prop contributors
410
+ * React equivalent of Angular InjectionToken
411
+ * @since 3.0.0
412
+ */
413
+ declare const TEXT_TEMPLATE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS: unique symbol;
414
+
415
+ /**
416
+ * Text Template Management Config Options
417
+ * Translated from @volo/abp.ng.text-template-management v3.0.0
418
+ *
419
+ * Configuration options and contributor types for the Text Template Management module.
420
+ *
421
+ * @since 3.0.0
422
+ */
423
+
424
+ /**
425
+ * Entity action contributors type for Text Template Management
426
+ * @since 3.0.0
427
+ */
428
+ type TextTemplateManagementEntityActionContributors = Partial<{
429
+ [eTextTemplateManagementComponents.TextTemplates]: EntityActionContributorCallback<TextTemplateManagement.TemplateDefinitionDto>[];
430
+ }>;
431
+ /**
432
+ * Toolbar action contributors type for Text Template Management
433
+ * Note: Typo fixed in v3.0.0 (was TextTemplateManagementTooolbarActionContributors)
434
+ * @since 3.0.0
435
+ */
436
+ type TextTemplateManagementToolbarActionContributors = Partial<{
437
+ [eTextTemplateManagementComponents.TextTemplates]: ToolbarActionContributorCallback<TextTemplateManagement.TemplateDefinitionDto[]>[];
438
+ }>;
439
+ /**
440
+ * Entity prop contributors type for Text Template Management
441
+ * @since 3.0.0
442
+ */
443
+ type TextTemplateManagementEntityPropContributors = Partial<{
444
+ [eTextTemplateManagementComponents.TextTemplates]: EntityPropContributorCallback<TextTemplateManagement.TemplateDefinitionDto>[];
445
+ }>;
446
+ /**
447
+ * Configuration options interface for Text Template Management module
448
+ * @since 3.0.0
449
+ */
450
+ interface TextTemplateManagementConfigOptions {
451
+ /** Entity action contributors */
452
+ entityActionContributors?: TextTemplateManagementEntityActionContributors;
453
+ /** Toolbar action contributors */
454
+ toolbarActionContributors?: TextTemplateManagementToolbarActionContributors;
455
+ /** Entity prop contributors */
456
+ entityPropContributors?: TextTemplateManagementEntityPropContributors;
457
+ }
140
458
 
141
459
  /**
142
460
  * Text Template Management Routes
@@ -451,4 +769,4 @@ interface TemplateContentsComponentProps {
451
769
  */
452
770
  declare function TemplateContentsComponent({ templateName, cultures, defaultCultureName, onSave, onRestore, className, }: TemplateContentsComponentProps): React.ReactElement;
453
771
 
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 };
772
+ 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, type GetTemplateDefinitionListInput, 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, createGetTemplateDefinitionListInput, eTextTemplateManagementComponents, eTextTemplateManagementPolicyNames, eTextTemplateManagementRouteNames, initializeTextTemplateManagementRoutes, textTemplateManagementExtensionsGuard, useTextTemplateManagementExtensionsGuard, useTextTemplates };