valtech-components 2.0.290 → 2.0.292
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/examples/comprehensive-link-test.component.mjs +208 -0
- package/esm2022/lib/examples/custom-content-demo.component.mjs +3 -3
- package/esm2022/lib/examples/link-processing-example.component.mjs +26 -4
- package/esm2022/lib/examples/multi-language-demo.component.mjs +304 -0
- package/esm2022/lib/services/lang-provider/content.mjs +33 -2
- package/esm2022/lib/services/lang-provider/lang-provider.service.mjs +199 -13
- package/esm2022/lib/services/lang-provider/types.mjs +15 -6
- package/esm2022/lib/services/link-processor.service.mjs +70 -27
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/valtech-components.mjs +839 -48
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/examples/comprehensive-link-test.component.d.ts +23 -0
- package/lib/examples/link-processing-example.component.d.ts +1 -0
- package/lib/examples/multi-language-demo.component.d.ts +34 -0
- package/lib/services/lang-provider/content.d.ts +4 -1
- package/lib/services/lang-provider/lang-provider.service.d.ts +64 -2
- package/lib/services/lang-provider/types.d.ts +19 -4
- package/lib/services/link-processor.service.d.ts +6 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/src/lib/components/styles/overrides.scss +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TextMetadata } from '../components/atoms/text/types';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* ComprehensiveLinkTestComponent - Componente de prueba exhaustiva para el procesamiento de enlaces.
|
|
5
|
+
*
|
|
6
|
+
* Este componente demuestra todos los casos edge y escenarios complejos de procesamiento de enlaces,
|
|
7
|
+
* incluyendo puntuación, URLs complejas, y mezclas de formatos.
|
|
8
|
+
*
|
|
9
|
+
* @example Uso en template:
|
|
10
|
+
* ```html
|
|
11
|
+
* <val-comprehensive-link-test></val-comprehensive-link-test>
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare class ComprehensiveLinkTestComponent {
|
|
15
|
+
punctuationProps: TextMetadata;
|
|
16
|
+
complexUrlProps: TextMetadata;
|
|
17
|
+
parenthesesProps: TextMetadata;
|
|
18
|
+
mixedFormatsProps: TextMetadata;
|
|
19
|
+
edgeCasesProps: TextMetadata;
|
|
20
|
+
devUrlsProps: TextMetadata;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComprehensiveLinkTestComponent, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComprehensiveLinkTestComponent, "val-comprehensive-link-test", never, {}, {}, never, never, true, never>;
|
|
23
|
+
}
|
|
@@ -20,6 +20,7 @@ export declare class LinkProcessingExampleComponent {
|
|
|
20
20
|
markdownLinksProps: TextMetadata;
|
|
21
21
|
mixedFormatsProps: TextMetadata;
|
|
22
22
|
punctuationTestProps: TextMetadata;
|
|
23
|
+
complexUrlsProps: TextMetadata;
|
|
23
24
|
static ɵfac: i0.ɵɵFactoryDeclaration<LinkProcessingExampleComponent, never>;
|
|
24
25
|
static ɵcmp: i0.ɵɵComponentDeclaration<LinkProcessingExampleComponent, "val-link-processing-example", never, {}, {}, never, never, true, never>;
|
|
25
26
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { ContentService } from '../services/content.service';
|
|
3
|
+
import { LangService } from '../services/lang-provider/lang-provider.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* MultiLanguageDemoComponent - Demuestra el sistema de idiomas flexible.
|
|
7
|
+
*
|
|
8
|
+
* Este componente muestra cómo el sistema maneja múltiples idiomas,
|
|
9
|
+
* fallbacks automáticos y warnings por traducciones faltantes.
|
|
10
|
+
*/
|
|
11
|
+
export declare class MultiLanguageDemoComponent implements OnInit {
|
|
12
|
+
content: ContentService;
|
|
13
|
+
langService: LangService;
|
|
14
|
+
availableLanguages: string[];
|
|
15
|
+
analysisResults: {
|
|
16
|
+
availableLanguages: string[];
|
|
17
|
+
missingKeys: string[];
|
|
18
|
+
} | null;
|
|
19
|
+
okButton$: import("rxjs").Observable<string>;
|
|
20
|
+
cancelButton$: import("rxjs").Observable<string>;
|
|
21
|
+
saveButton$: import("rxjs").Observable<string>;
|
|
22
|
+
deleteButton$: import("rxjs").Observable<string>;
|
|
23
|
+
nextButton$: import("rxjs").Observable<string>;
|
|
24
|
+
finishButton$: import("rxjs").Observable<string>;
|
|
25
|
+
searchPlaceholder$: import("rxjs").Observable<string>;
|
|
26
|
+
noDataMessage$: import("rxjs").Observable<string>;
|
|
27
|
+
constructor(content: ContentService, langService: LangService);
|
|
28
|
+
ngOnInit(): void;
|
|
29
|
+
switchLanguage(lang: string): void;
|
|
30
|
+
getLanguageName(lang: string): string;
|
|
31
|
+
analyzeCurrentComponent(): void;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MultiLanguageDemoComponent, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MultiLanguageDemoComponent, "val-multi-language-demo", never, {}, {}, never, never, true, never>;
|
|
34
|
+
}
|
|
@@ -5,7 +5,10 @@ export interface Provider {
|
|
|
5
5
|
/**
|
|
6
6
|
* Global content that can be used across all components.
|
|
7
7
|
* These are common texts like buttons, actions, states, etc.
|
|
8
|
-
* Structure: {es: {key1: 'value1', key2: 'value2'}, en: {key1: 'value1', key2: 'value2'}}
|
|
8
|
+
* Structure: {es: {key1: 'value1', key2: 'value2'}, en: {key1: 'value1', key2: 'value2'}, fr: {...}}
|
|
9
|
+
*
|
|
10
|
+
* Note: You can add any language code. The system will automatically detect available languages
|
|
11
|
+
* and provide intelligent fallbacks with warnings for missing translations.
|
|
9
12
|
*/
|
|
10
13
|
declare const globalContentData: LanguagesContent;
|
|
11
14
|
declare const GlobalContent: TextContent;
|
|
@@ -8,6 +8,9 @@ import * as i0 from "@angular/core";
|
|
|
8
8
|
* This service provides reactive content management with Observable-based language switching.
|
|
9
9
|
* Components can subscribe to content changes and automatically update when the language changes.
|
|
10
10
|
*
|
|
11
|
+
* The service automatically detects available languages from the content configuration
|
|
12
|
+
* and provides intelligent fallbacks with console warnings for missing translations.
|
|
13
|
+
*
|
|
11
14
|
* @example Basic usage:
|
|
12
15
|
* ```typescript
|
|
13
16
|
* constructor(private langService: LangService) {}
|
|
@@ -27,10 +30,30 @@ import * as i0 from "@angular/core";
|
|
|
27
30
|
*/
|
|
28
31
|
export declare class LangService {
|
|
29
32
|
private content;
|
|
30
|
-
private
|
|
33
|
+
private defaultLang;
|
|
34
|
+
private availableLanguages;
|
|
31
35
|
private selectedLang;
|
|
32
36
|
private config;
|
|
37
|
+
private warnedMissingLanguages;
|
|
33
38
|
constructor(config: ValtechConfig);
|
|
39
|
+
/**
|
|
40
|
+
* Detect available languages from the content configuration.
|
|
41
|
+
* Scans all component content to find which languages are actually configured.
|
|
42
|
+
*/
|
|
43
|
+
private detectAvailableLanguages;
|
|
44
|
+
/**
|
|
45
|
+
* Determine the best default language based on available content.
|
|
46
|
+
*/
|
|
47
|
+
private determineDefaultLanguage;
|
|
48
|
+
/**
|
|
49
|
+
* Validate if a language is available in the content.
|
|
50
|
+
*/
|
|
51
|
+
private validateLanguage;
|
|
52
|
+
/**
|
|
53
|
+
* Get the best available language for a component and key.
|
|
54
|
+
* Provides intelligent fallback with warnings.
|
|
55
|
+
*/
|
|
56
|
+
private getBestAvailableContent;
|
|
34
57
|
/**
|
|
35
58
|
* Observable that emits the current language whenever it changes.
|
|
36
59
|
* Use this to subscribe to language changes in components.
|
|
@@ -40,10 +63,20 @@ export declare class LangService {
|
|
|
40
63
|
* Get the current language synchronously.
|
|
41
64
|
*/
|
|
42
65
|
get currentLang(): LangOption;
|
|
66
|
+
/**
|
|
67
|
+
* Get array of available languages detected from content.
|
|
68
|
+
*/
|
|
69
|
+
get availableLangs(): LangOption[];
|
|
70
|
+
/**
|
|
71
|
+
* Get the default language.
|
|
72
|
+
*/
|
|
73
|
+
get defaultLanguage(): LangOption;
|
|
43
74
|
/**
|
|
44
75
|
* Set the current language and persist it to localStorage.
|
|
45
76
|
* This will trigger updates in all reactive content subscriptions.
|
|
46
77
|
*
|
|
78
|
+
* Validates that the language is available and warns if not.
|
|
79
|
+
*
|
|
47
80
|
* @param lang - The language to set
|
|
48
81
|
*/
|
|
49
82
|
setLang(lang: LangOption): void;
|
|
@@ -55,6 +88,7 @@ export declare class LangService {
|
|
|
55
88
|
Text(className: string): LanguageText;
|
|
56
89
|
/**
|
|
57
90
|
* Get a single content string synchronously for the current language.
|
|
91
|
+
* Provides intelligent fallback with warnings for missing translations.
|
|
58
92
|
*
|
|
59
93
|
* @param className - The component class name
|
|
60
94
|
* @param key - The text key
|
|
@@ -65,6 +99,7 @@ export declare class LangService {
|
|
|
65
99
|
/**
|
|
66
100
|
* Get a reactive Observable for a specific text key that updates when language changes.
|
|
67
101
|
* This is the recommended method for components that need reactive content.
|
|
102
|
+
* Provides intelligent fallback with warnings for missing translations.
|
|
68
103
|
*
|
|
69
104
|
* @param className - The component class name
|
|
70
105
|
* @param key - The text key
|
|
@@ -74,6 +109,7 @@ export declare class LangService {
|
|
|
74
109
|
getContent(className: string, key: string, fallback?: string): Observable<string>;
|
|
75
110
|
/**
|
|
76
111
|
* Get reactive content for multiple keys at once.
|
|
112
|
+
* Provides intelligent fallback with warnings for missing translations.
|
|
77
113
|
*
|
|
78
114
|
* @param className - The component class name
|
|
79
115
|
* @param keys - Array of text keys to retrieve
|
|
@@ -81,13 +117,39 @@ export declare class LangService {
|
|
|
81
117
|
*/
|
|
82
118
|
getMultipleContent(className: string, keys: string[]): Observable<Record<string, string>>;
|
|
83
119
|
/**
|
|
84
|
-
* Check if a content key exists for a component.
|
|
120
|
+
* Check if a content key exists for a component in any available language.
|
|
85
121
|
*
|
|
86
122
|
* @param className - The component class name
|
|
87
123
|
* @param key - The text key
|
|
88
124
|
* @returns True if the key exists in any language
|
|
89
125
|
*/
|
|
90
126
|
hasContent(className: string, key: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Check if a content key exists for a component in a specific language.
|
|
129
|
+
*
|
|
130
|
+
* @param className - The component class name
|
|
131
|
+
* @param key - The text key
|
|
132
|
+
* @param lang - The language to check (defaults to current language)
|
|
133
|
+
* @returns True if the key exists in the specified language
|
|
134
|
+
*/
|
|
135
|
+
hasContentInLanguage(className: string, key: string, lang?: LangOption): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Get available languages for a specific component.
|
|
138
|
+
*
|
|
139
|
+
* @param className - The component class name
|
|
140
|
+
* @returns Array of language codes available for the component
|
|
141
|
+
*/
|
|
142
|
+
getAvailableLanguagesForComponent(className: string): LangOption[];
|
|
143
|
+
/**
|
|
144
|
+
* Get missing content keys for a component in a specific language.
|
|
145
|
+
* Useful for identifying incomplete translations.
|
|
146
|
+
*
|
|
147
|
+
* @param className - The component class name
|
|
148
|
+
* @param lang - The language to check
|
|
149
|
+
* @param referenceLang - The reference language to compare against (defaults to default language)
|
|
150
|
+
* @returns Array of missing keys
|
|
151
|
+
*/
|
|
152
|
+
getMissingContentKeys(className: string, lang: LangOption, referenceLang?: LangOption): string[];
|
|
91
153
|
get Lang(): LangOption;
|
|
92
154
|
set Lang(lang: LangOption);
|
|
93
155
|
static ɵfac: i0.ɵɵFactoryDeclaration<LangService, never>;
|
|
@@ -9,7 +9,22 @@ export declare class TextContent {
|
|
|
9
9
|
constructor(text: LanguagesContent);
|
|
10
10
|
get Content(): LanguagesContent;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Language code type - supports any valid language code string.
|
|
14
|
+
* Common examples: 'es', 'en', 'fr', 'de', 'pt', 'it', 'zh', 'ja', etc.
|
|
15
|
+
*/
|
|
16
|
+
export type LangOption = string;
|
|
17
|
+
/**
|
|
18
|
+
* Common language constants for convenience.
|
|
19
|
+
* Users can still use any language code string directly.
|
|
20
|
+
*/
|
|
21
|
+
export declare const LANGUAGES: {
|
|
22
|
+
readonly ES: "es";
|
|
23
|
+
readonly EN: "en";
|
|
24
|
+
readonly FR: "fr";
|
|
25
|
+
readonly DE: "de";
|
|
26
|
+
readonly PT: "pt";
|
|
27
|
+
readonly IT: "it";
|
|
28
|
+
readonly ZH: "zh";
|
|
29
|
+
readonly JA: "ja";
|
|
30
|
+
};
|
|
@@ -37,6 +37,12 @@ export declare class LinkProcessorService {
|
|
|
37
37
|
private readonly internalRouteRegex;
|
|
38
38
|
private readonly markdownLinkRegex;
|
|
39
39
|
constructor(sanitizer: DomSanitizer);
|
|
40
|
+
/**
|
|
41
|
+
* Limpia la puntuación del final de una URL.
|
|
42
|
+
* Mantiene caracteres válidos de URL pero remueve signos de puntuación comunes al final.
|
|
43
|
+
* Preserva parámetros de consulta, fragmentos y caracteres válidos en URLs.
|
|
44
|
+
*/
|
|
45
|
+
private cleanUrlPunctuation;
|
|
40
46
|
/**
|
|
41
47
|
* Procesa texto para convertir enlaces en elementos <a> clickeables.
|
|
42
48
|
* Detecta automáticamente URLs externas, rutas internas y enlaces estilo Markdown.
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -79,8 +79,10 @@ export * from './lib/components/organisms/wizard/wizard.component';
|
|
|
79
79
|
export * from './lib/components/templates/layout/layout.component';
|
|
80
80
|
export * from './lib/components/templates/simple/simple.component';
|
|
81
81
|
export * from './lib/components/templates/simple/types';
|
|
82
|
+
export * from './lib/examples/comprehensive-link-test.component';
|
|
82
83
|
export * from './lib/examples/custom-content-demo.component';
|
|
83
84
|
export * from './lib/examples/link-processing-example.component';
|
|
85
|
+
export * from './lib/examples/multi-language-demo.component';
|
|
84
86
|
export * from './lib/services/content.service';
|
|
85
87
|
export * from './lib/services/download.service';
|
|
86
88
|
export * from './lib/services/icons.service';
|
|
@@ -231,9 +231,9 @@ ion-modal.modal-sheet ion-header ion-toolbar:last-of-type {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
.internal-link {
|
|
234
|
-
color: var(--ion-color-
|
|
234
|
+
color: var(--ion-color-primary, #0cd1e8);
|
|
235
235
|
|
|
236
236
|
&:hover {
|
|
237
|
-
color: var(--ion-color-
|
|
237
|
+
color: var(--ion-color-primary-shade, #0bb8cc);
|
|
238
238
|
}
|
|
239
239
|
}
|