valtech-components 2.0.319 → 2.0.320
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/esm2022/lib/components/atoms/image/image.component.mjs +3 -3
- package/esm2022/lib/services/content-loader.service.mjs +124 -0
- package/esm2022/public-api.mjs +2 -1
- package/fesm2022/valtech-components.mjs +123 -3
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/services/content-loader.service.d.ts +81 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { LangService } from './lang-provider/lang-provider.service';
|
|
2
|
+
import { LanguagesContent } from './lang-provider/types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* ContentLoader Service - Dynamic content loading system.
|
|
6
|
+
*
|
|
7
|
+
* Allows loading content from distributed .content.ts files throughout the project,
|
|
8
|
+
* keeping content close to where it's used instead of centralizing everything in main.ts.
|
|
9
|
+
*
|
|
10
|
+
* @example Basic usage:
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // user-page.content.ts
|
|
13
|
+
* export const UserPageContent = {
|
|
14
|
+
* es: { title: 'Mi Página de Usuario', welcome: 'Bienvenido {{name}}' },
|
|
15
|
+
* en: { title: 'My User Page', welcome: 'Welcome {{name}}' }
|
|
16
|
+
* };
|
|
17
|
+
*
|
|
18
|
+
* // In component or main.ts
|
|
19
|
+
* import { UserPageContent } from './user-page.content';
|
|
20
|
+
* contentLoader.registerContent('UserPage', UserPageContent);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class ContentLoaderService {
|
|
24
|
+
private langService;
|
|
25
|
+
private registeredContent;
|
|
26
|
+
constructor(langService: LangService);
|
|
27
|
+
/**
|
|
28
|
+
* Register content for a specific component/page class.
|
|
29
|
+
*/
|
|
30
|
+
registerContent(className: string, content: LanguagesContent): void;
|
|
31
|
+
/**
|
|
32
|
+
* Register multiple content modules at once.
|
|
33
|
+
*/
|
|
34
|
+
loadContent(contentModules: ContentModule[]): void;
|
|
35
|
+
/**
|
|
36
|
+
* Check if content is registered for a class.
|
|
37
|
+
*/
|
|
38
|
+
hasContentFor(className: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Get all registered class names.
|
|
41
|
+
*/
|
|
42
|
+
getRegisteredClasses(): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Get registered content for a specific class.
|
|
45
|
+
*/
|
|
46
|
+
getContentFor(className: string): LanguagesContent | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Remove content registration for a class.
|
|
49
|
+
*/
|
|
50
|
+
unregisterContent(className: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Clear all registered content.
|
|
53
|
+
*/
|
|
54
|
+
clearAllContent(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Add content to the LangService content provider.
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
private addContentToLangService;
|
|
60
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ContentLoaderService, never>;
|
|
61
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ContentLoaderService>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Interface for content module registration.
|
|
65
|
+
*/
|
|
66
|
+
export interface ContentModule {
|
|
67
|
+
className: string;
|
|
68
|
+
content: LanguagesContent;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Helper function to create a content module.
|
|
72
|
+
*/
|
|
73
|
+
export declare function createContentModule(className: string, content: LanguagesContent): ContentModule;
|
|
74
|
+
/**
|
|
75
|
+
* Simple function to register content directly.
|
|
76
|
+
*/
|
|
77
|
+
export declare function registerContent(className: string, content: LanguagesContent): void;
|
|
78
|
+
/**
|
|
79
|
+
* Load all content from the global registry.
|
|
80
|
+
*/
|
|
81
|
+
export declare function loadRegisteredContent(contentLoader: ContentLoaderService): void;
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export * from './lib/components/templates/layout/layout.component';
|
|
|
88
88
|
export * from './lib/components/templates/simple/simple.component';
|
|
89
89
|
export * from './lib/components/templates/simple/types';
|
|
90
90
|
export * from './lib/services/content.service';
|
|
91
|
+
export * from './lib/services/content-loader.service';
|
|
91
92
|
export * from './lib/services/download.service';
|
|
92
93
|
export * from './lib/services/icons.service';
|
|
93
94
|
export * from './lib/services/in-app-browser.service';
|