valtech-components 2.0.326 → 2.0.328
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/button/button.component.mjs +18 -18
- package/esm2022/lib/components/atoms/display/display.component.mjs +13 -16
- package/esm2022/lib/components/atoms/text/text.component.mjs +19 -19
- package/esm2022/lib/components/atoms/title/title.component.mjs +7 -7
- package/esm2022/lib/components/atoms/title/types.mjs +6 -2
- package/esm2022/lib/components/molecules/alert-box/alert-box.component.mjs +6 -6
- package/esm2022/lib/components/molecules/language-selector/language-selector.component.mjs +6 -17
- package/esm2022/lib/components/organisms/form/form.component.mjs +1 -1
- package/esm2022/lib/services/lang-provider/lang-provider.service.mjs +66 -1
- package/esm2022/lib/shared/utils/simple-content.mjs +119 -0
- package/esm2022/public-api.mjs +3 -3
- package/fesm2022/valtech-components.mjs +413 -680
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/atoms/button/button.component.d.ts +3 -3
- package/lib/components/atoms/display/display.component.d.ts +2 -3
- package/lib/components/atoms/text/text.component.d.ts +3 -3
- package/lib/components/atoms/title/title.component.d.ts +1 -2
- package/lib/components/atoms/title/types.d.ts +10 -4
- package/lib/components/molecules/alert-box/alert-box.component.d.ts +3 -3
- package/lib/components/molecules/language-selector/language-selector.component.d.ts +1 -3
- package/lib/services/lang-provider/lang-provider.service.d.ts +50 -0
- package/lib/shared/utils/simple-content.d.ts +120 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -2
- package/esm2022/lib/services/content.service.mjs +0 -327
- package/esm2022/lib/shared/utils/reactive-content.mjs +0 -117
- package/lib/services/content.service.d.ts +0 -296
- package/lib/shared/utils/reactive-content.d.ts +0 -109
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { ContentService } from '../../../services/content.service';
|
|
4
3
|
import { DownloadService } from '../../../services/download.service';
|
|
5
4
|
import { IconService } from '../../../services/icons.service';
|
|
5
|
+
import { LangService } from '../../../services/lang-provider/lang-provider.service';
|
|
6
6
|
import { NavigationService } from '../../../services/navigation.service';
|
|
7
7
|
import { ButtonContentConfig, ButtonMetadata } from '../../types';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
9
|
export declare class ButtonComponent implements OnInit, OnDestroy {
|
|
10
10
|
private download;
|
|
11
11
|
private navigation;
|
|
12
|
-
private
|
|
12
|
+
private langService;
|
|
13
13
|
states: {
|
|
14
14
|
ENABLED: "ENABLED";
|
|
15
15
|
DISABLED: "DISABLED";
|
|
@@ -27,7 +27,7 @@ export declare class ButtonComponent implements OnInit, OnDestroy {
|
|
|
27
27
|
* Event emitted when the button is clicked.
|
|
28
28
|
*/
|
|
29
29
|
onClick: EventEmitter<string>;
|
|
30
|
-
constructor(download: DownloadService, icon: IconService, navigation: NavigationService,
|
|
30
|
+
constructor(download: DownloadService, icon: IconService, navigation: NavigationService, langService: LangService);
|
|
31
31
|
ngOnInit(): void;
|
|
32
32
|
ngOnDestroy(): void;
|
|
33
33
|
/**
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { ContentService } from '../../../services/content.service';
|
|
4
3
|
import { DisplayContentConfig, DisplayMetadata } from './types';
|
|
5
4
|
import * as i0 from "@angular/core";
|
|
6
5
|
export declare class DisplayComponent implements OnInit, OnDestroy {
|
|
7
|
-
private contentService;
|
|
8
6
|
displayContent$: Observable<string>;
|
|
9
7
|
private subscriptions;
|
|
10
8
|
/**
|
|
@@ -16,7 +14,8 @@ export declare class DisplayComponent implements OnInit, OnDestroy {
|
|
|
16
14
|
* @property size - The text size ('small' | 'medium' | 'large' | 'xlarge').
|
|
17
15
|
*/
|
|
18
16
|
props: DisplayMetadata;
|
|
19
|
-
|
|
17
|
+
private langService;
|
|
18
|
+
constructor();
|
|
20
19
|
ngOnInit(): void;
|
|
21
20
|
ngOnDestroy(): void;
|
|
22
21
|
private initializeDisplayContent;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
3
|
+
import { LangService } from '../../../services/lang-provider/lang-provider.service';
|
|
4
4
|
import { LinkProcessorService } from '../../../services/link-processor.service';
|
|
5
5
|
import { TextContentConfig, TextMetadata } from './types';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export declare class TextComponent implements OnInit, OnDestroy {
|
|
8
|
-
private
|
|
8
|
+
private langService;
|
|
9
9
|
private linkProcessor;
|
|
10
10
|
/**
|
|
11
11
|
* Text configuration object.
|
|
@@ -35,7 +35,7 @@ export declare class TextComponent implements OnInit, OnDestroy {
|
|
|
35
35
|
*/
|
|
36
36
|
displayContent$: Observable<string>;
|
|
37
37
|
private subscription;
|
|
38
|
-
constructor(
|
|
38
|
+
constructor(langService: LangService, linkProcessor: LinkProcessorService);
|
|
39
39
|
ngOnInit(): void;
|
|
40
40
|
ngOnDestroy(): void;
|
|
41
41
|
/**
|
|
@@ -14,8 +14,7 @@ export declare class TitleComponent implements OnInit {
|
|
|
14
14
|
* @property thin - Whether the title is thin (optional).
|
|
15
15
|
*/
|
|
16
16
|
props: TitleMetadata;
|
|
17
|
-
private
|
|
18
|
-
private contentHelper;
|
|
17
|
+
private langService;
|
|
19
18
|
displayContent$: Observable<string>;
|
|
20
19
|
constructor();
|
|
21
20
|
ngOnInit(): void;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Color } from '@ionic/core';
|
|
2
|
-
import { ReactiveTextMetadata } from '../../../shared/utils/
|
|
2
|
+
import { ReactiveTextMetadata } from '../../../shared/utils/simple-content';
|
|
3
3
|
/**
|
|
4
4
|
* Props for val-title component.
|
|
5
5
|
* Supports both static content and reactive content from the language service.
|
|
6
6
|
*
|
|
7
7
|
* @property content - Static title text to display (takes precedence over reactive content).
|
|
8
|
-
* @property
|
|
8
|
+
* @property contentKey - Content key for reactive content lookup.
|
|
9
|
+
* @property contentClass - Component class name for content lookup.
|
|
10
|
+
* @property contentFallback - Fallback text if content is not found.
|
|
9
11
|
* @property color - The title color (Ionic color string).
|
|
10
12
|
* @property size - The title size ('small' | 'medium' | 'large' | 'xlarge').
|
|
11
13
|
* @property bold - Whether the title is bold.
|
|
@@ -36,8 +38,12 @@ export interface TitleMetadata extends ReactiveTextMetadata {
|
|
|
36
38
|
* ```typescript
|
|
37
39
|
* const props = createTitleProps(
|
|
38
40
|
* { size: 'large', color: 'primary', bold: true },
|
|
39
|
-
* {
|
|
41
|
+
* {
|
|
42
|
+
* contentKey: 'pageTitle',
|
|
43
|
+
* contentClass: 'MyComponent',
|
|
44
|
+
* contentFallback: 'Default Title'
|
|
45
|
+
* }
|
|
40
46
|
* );
|
|
41
47
|
* ```
|
|
42
48
|
*/
|
|
43
|
-
export declare function createTitleProps(styleConfig: Pick<TitleMetadata, 'size' | 'color' | 'bold' | 'thin'>, contentConfig: Pick<TitleMetadata, 'content' | '
|
|
49
|
+
export declare function createTitleProps(styleConfig: Pick<TitleMetadata, 'size' | 'color' | 'bold' | 'thin'>, contentConfig: Pick<TitleMetadata, 'content' | 'contentKey' | 'contentClass' | 'contentFallback'>): TitleMetadata;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { LangService } from '../../../services/lang-provider/lang-provider.service';
|
|
3
3
|
import { AlertBoxMetadata, ReactiveAlertBoxMetadata } from './types';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class AlertBoxComponent implements OnInit, OnDestroy {
|
|
6
|
-
private
|
|
6
|
+
private langService;
|
|
7
7
|
private subscriptions;
|
|
8
8
|
/**
|
|
9
9
|
* Alert box configuration object.
|
|
@@ -16,7 +16,7 @@ export declare class AlertBoxComponent implements OnInit, OnDestroy {
|
|
|
16
16
|
get isLegacyProps(): boolean;
|
|
17
17
|
/** Get text props for legacy pattern */
|
|
18
18
|
getLegacyTextProps(): any;
|
|
19
|
-
constructor(
|
|
19
|
+
constructor(langService: LangService);
|
|
20
20
|
ngOnInit(): void;
|
|
21
21
|
ngOnDestroy(): void;
|
|
22
22
|
private initializeReactiveTextProps;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { ContentService } from '../../../services/content.service';
|
|
4
3
|
import { LangService } from '../../../services/lang-provider/lang-provider.service';
|
|
5
4
|
import { LangOption } from '../../../services/lang-provider/types';
|
|
6
5
|
import { PopoverSelectorMetadata } from '../popover-selector/types';
|
|
@@ -8,7 +7,6 @@ import { LanguageSelectorMetadata } from './types';
|
|
|
8
7
|
import * as i0 from "@angular/core";
|
|
9
8
|
export declare class LanguageSelectorComponent implements OnInit, OnDestroy {
|
|
10
9
|
private langService;
|
|
11
|
-
private contentService;
|
|
12
10
|
/**
|
|
13
11
|
* Language selector configuration object.
|
|
14
12
|
* @type {LanguageSelectorMetadata}
|
|
@@ -32,7 +30,7 @@ export declare class LanguageSelectorComponent implements OnInit, OnDestroy {
|
|
|
32
30
|
private readonly defaultLanguageNames;
|
|
33
31
|
/** Default flag icons for languages */
|
|
34
32
|
private readonly defaultLanguageFlags;
|
|
35
|
-
constructor(langService: LangService
|
|
33
|
+
constructor(langService: LangService);
|
|
36
34
|
ngOnInit(): void;
|
|
37
35
|
ngOnDestroy(): void;
|
|
38
36
|
private initializeLanguageState;
|
|
@@ -207,6 +207,56 @@ export declare class LangService {
|
|
|
207
207
|
* Useful for testing or complete reinitialization.
|
|
208
208
|
*/
|
|
209
209
|
clearAllContent(): void;
|
|
210
|
+
/**
|
|
211
|
+
* Get content with interpolation support.
|
|
212
|
+
* Retrieves content and replaces placeholders with provided values.
|
|
213
|
+
*
|
|
214
|
+
* @param className - The component class name
|
|
215
|
+
* @param key - The text key
|
|
216
|
+
* @param interpolationData - Object with values to interpolate
|
|
217
|
+
* @param fallback - Optional fallback text if key is not found
|
|
218
|
+
* @returns Text with interpolated values
|
|
219
|
+
*/
|
|
220
|
+
getTextWithInterpolation(className: string, key: string, interpolationData?: Record<string, string | number>, fallback?: string): string;
|
|
221
|
+
/**
|
|
222
|
+
* Get reactive content with interpolation support.
|
|
223
|
+
* Returns an Observable that emits interpolated content when language changes.
|
|
224
|
+
*
|
|
225
|
+
* @param className - The component class name
|
|
226
|
+
* @param key - The text key
|
|
227
|
+
* @param interpolationData - Object with values to interpolate
|
|
228
|
+
* @param fallback - Optional fallback text if key is not found
|
|
229
|
+
* @returns Observable that emits interpolated text
|
|
230
|
+
*/
|
|
231
|
+
getContentWithInterpolation(className: string, key: string, interpolationData?: Record<string, string | number>, fallback?: string): Observable<string>;
|
|
232
|
+
/**
|
|
233
|
+
* Interpolate a string with provided values.
|
|
234
|
+
* Replaces placeholders like {{key}} or {key} with actual values.
|
|
235
|
+
*
|
|
236
|
+
* @param content - Content string with placeholders
|
|
237
|
+
* @param values - Values to interpolate
|
|
238
|
+
* @returns Interpolated string
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* interpolateString('Hello {{name}}!', { name: 'World' })
|
|
243
|
+
* // Returns: 'Hello World!'
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
private interpolateString;
|
|
247
|
+
/**
|
|
248
|
+
* Legacy function equivalent to the old fromContentWithInterpolation.
|
|
249
|
+
* Provides reactive content with interpolation support for backward compatibility.
|
|
250
|
+
*
|
|
251
|
+
* @param className - The component class name
|
|
252
|
+
* @param key - The text key
|
|
253
|
+
* @param interpolationData - Object with values to interpolate
|
|
254
|
+
* @param fallback - Optional fallback text if key is not found
|
|
255
|
+
* @returns Observable that emits interpolated text
|
|
256
|
+
*
|
|
257
|
+
* @deprecated Use getContentWithInterpolation instead
|
|
258
|
+
*/
|
|
259
|
+
fromContentWithInterpolation(className: string, key: string, interpolationData?: Record<string, string | number>, fallback?: string): Observable<string>;
|
|
210
260
|
get Lang(): LangOption;
|
|
211
261
|
set Lang(lang: LangOption);
|
|
212
262
|
static ɵfac: i0.ɵɵFactoryDeclaration<LangService, never>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simplified content utilities for the new LangService-only system.
|
|
3
|
+
* This replaces the old reactive-content.ts with a much simpler approach.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Base metadata for components that support reactive content.
|
|
7
|
+
* Simplified version that works directly with LangService.
|
|
8
|
+
*/
|
|
9
|
+
export interface ReactiveContentMetadata {
|
|
10
|
+
/** Static content text (takes precedence over reactive content) */
|
|
11
|
+
content?: string;
|
|
12
|
+
/** Content key for reactive content from LangService */
|
|
13
|
+
contentKey?: string;
|
|
14
|
+
/** Component class name for content lookup */
|
|
15
|
+
contentClass?: string;
|
|
16
|
+
/** Fallback text if content is not found */
|
|
17
|
+
contentFallback?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Extended metadata for text-based components with reactive content support.
|
|
21
|
+
*/
|
|
22
|
+
export interface ReactiveTextMetadata extends ReactiveContentMetadata {
|
|
23
|
+
/** Static content text */
|
|
24
|
+
content?: string;
|
|
25
|
+
/** Content key for reactive lookup */
|
|
26
|
+
contentKey?: string;
|
|
27
|
+
/** Component class name */
|
|
28
|
+
contentClass?: string;
|
|
29
|
+
/** Fallback text */
|
|
30
|
+
contentFallback?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Extended metadata for components that support content interpolation.
|
|
34
|
+
*/
|
|
35
|
+
export interface ReactiveContentWithInterpolation extends ReactiveContentMetadata {
|
|
36
|
+
/** Interpolation data for parameterized content */
|
|
37
|
+
contentInterpolation?: Record<string, string | number>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Helper function to determine if component should use reactive content.
|
|
41
|
+
* @param metadata Component metadata
|
|
42
|
+
* @returns True if component should use reactive content
|
|
43
|
+
*/
|
|
44
|
+
export declare function shouldUseReactiveContent(metadata: ReactiveContentMetadata): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Extract content configuration from metadata.
|
|
47
|
+
* @param metadata Component metadata
|
|
48
|
+
* @returns Content configuration for LangService
|
|
49
|
+
*/
|
|
50
|
+
export declare function extractContentConfig(metadata: ReactiveContentMetadata): {
|
|
51
|
+
className: string;
|
|
52
|
+
key: string;
|
|
53
|
+
fallback: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Create reactive content metadata with defaults.
|
|
57
|
+
* @param config Partial content configuration
|
|
58
|
+
* @returns Complete reactive content metadata
|
|
59
|
+
*/
|
|
60
|
+
export declare function createReactiveContentMetadata(config: Partial<ReactiveContentMetadata>): ReactiveContentMetadata;
|
|
61
|
+
/**
|
|
62
|
+
* Interpolate content string with values.
|
|
63
|
+
* Replaces placeholders like {{key}} or {key} with actual values.
|
|
64
|
+
*
|
|
65
|
+
* @param content - Content string with placeholders
|
|
66
|
+
* @param values - Values to interpolate
|
|
67
|
+
* @returns Interpolated string
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* interpolateContent('Hello {{name}}!', { name: 'World' })
|
|
72
|
+
* // Returns: 'Hello World!'
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function interpolateContent(content: string, values?: Record<string, string | number>): string;
|
|
76
|
+
/**
|
|
77
|
+
* Check if component should use reactive content with interpolation.
|
|
78
|
+
* @param metadata Component metadata with interpolation
|
|
79
|
+
* @returns True if component should use reactive content with interpolation
|
|
80
|
+
*/
|
|
81
|
+
export declare function shouldUseReactiveContentWithInterpolation(metadata: ReactiveContentWithInterpolation): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Extract content configuration with interpolation from metadata.
|
|
84
|
+
* @param metadata Component metadata with interpolation
|
|
85
|
+
* @returns Content configuration for LangService with interpolation data
|
|
86
|
+
*/
|
|
87
|
+
export declare function extractContentConfigWithInterpolation(metadata: ReactiveContentWithInterpolation): {
|
|
88
|
+
className: string;
|
|
89
|
+
key: string;
|
|
90
|
+
fallback: string;
|
|
91
|
+
interpolation: Record<string, string | number>;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Helper function to get reactive content with interpolation using LangService.
|
|
95
|
+
* This provides a unified way to get reactive, interpolated content.
|
|
96
|
+
*
|
|
97
|
+
* @param langService - The LangService instance
|
|
98
|
+
* @param metadata - Component metadata with interpolation
|
|
99
|
+
* @returns Observable that emits interpolated content
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const content$ = fromContentWithInterpolation(this.langService, {
|
|
104
|
+
* contentClass: 'MyComponent',
|
|
105
|
+
* contentKey: 'greeting',
|
|
106
|
+
* contentInterpolation: { name: 'World' }
|
|
107
|
+
* });
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare function fromContentWithInterpolation(langService: any, // LangService type would cause circular dependency
|
|
111
|
+
metadata: ReactiveContentWithInterpolation): any;
|
|
112
|
+
/**
|
|
113
|
+
* Helper function to get static content with interpolation.
|
|
114
|
+
* This provides interpolation for static content strings.
|
|
115
|
+
*
|
|
116
|
+
* @param content - Static content string
|
|
117
|
+
* @param interpolationData - Values to interpolate
|
|
118
|
+
* @returns Interpolated string
|
|
119
|
+
*/
|
|
120
|
+
export declare function interpolateStaticContent(content: string, interpolationData?: Record<string, string | number>): string;
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -87,7 +87,6 @@ export * from './lib/components/organisms/article/types';
|
|
|
87
87
|
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
|
-
export * from './lib/services/content.service';
|
|
91
90
|
export * from './lib/services/download.service';
|
|
92
91
|
export * from './lib/services/icons.service';
|
|
93
92
|
export * from './lib/services/in-app-browser.service';
|
|
@@ -105,6 +104,6 @@ export * from './lib/shared/pipes/process-links.pipe';
|
|
|
105
104
|
export * from './lib/shared/utils/content';
|
|
106
105
|
export * from './lib/shared/utils/dom';
|
|
107
106
|
export * from './lib/shared/utils/form-defaults';
|
|
108
|
-
export
|
|
107
|
+
export { createReactiveContentMetadata, extractContentConfig, extractContentConfigWithInterpolation, interpolateStaticContent, ReactiveContentMetadata, ReactiveContentWithInterpolation, ReactiveTextMetadata, shouldUseReactiveContent, shouldUseReactiveContentWithInterpolation, } from './lib/shared/utils/simple-content';
|
|
109
108
|
export * from './lib/shared/utils/styles';
|
|
110
109
|
export * from './lib/shared/utils/text';
|