valtech-components 2.0.291 → 2.0.293
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/avatar/avatar.component.mjs +3 -3
- package/esm2022/lib/components/atoms/box/box.component.mjs +3 -3
- package/esm2022/lib/components/atoms/button/button.component.mjs +45 -12
- package/esm2022/lib/components/atoms/display/display.component.mjs +47 -11
- package/esm2022/lib/components/atoms/display/types.mjs +1 -1
- package/esm2022/lib/components/atoms/divider/divider.component.mjs +3 -3
- package/esm2022/lib/components/atoms/href/href.component.mjs +3 -3
- package/esm2022/lib/components/atoms/icon/icon.component.mjs +3 -3
- package/esm2022/lib/components/atoms/image/image.component.mjs +3 -3
- package/esm2022/lib/components/atoms/progress-bar/progress-bar.component.mjs +3 -3
- package/esm2022/lib/components/atoms/text/text.component.mjs +3 -3
- package/esm2022/lib/components/atoms/title/title.component.mjs +77 -23
- package/esm2022/lib/components/atoms/title/types.mjs +30 -2
- package/esm2022/lib/components/molecules/alert-box/alert-box.component.mjs +57 -10
- package/esm2022/lib/components/molecules/alert-box/types.mjs +1 -1
- package/esm2022/lib/components/molecules/button-group/button-group.component.mjs +3 -3
- package/esm2022/lib/components/molecules/card/card.component.mjs +3 -3
- package/esm2022/lib/components/molecules/content-loader/content-loader.component.mjs +3 -3
- package/esm2022/lib/components/molecules/date-input/date-input.component.mjs +3 -3
- package/esm2022/lib/components/molecules/file-input/file-input.component.mjs +3 -3
- package/esm2022/lib/components/molecules/hint/hint.component.mjs +3 -3
- package/esm2022/lib/components/molecules/layered-card/layered-card.component.mjs +3 -3
- package/esm2022/lib/components/molecules/link/link.component.mjs +3 -3
- package/esm2022/lib/components/molecules/links-cake/links-cake.component.mjs +3 -3
- package/esm2022/lib/components/molecules/notes-box/notes-box.component.mjs +3 -3
- package/esm2022/lib/components/molecules/password-input/password-input.component.mjs +3 -3
- package/esm2022/lib/components/molecules/pin-input/pin-input.component.mjs +3 -3
- package/esm2022/lib/components/molecules/progress-status/progress-status.component.mjs +3 -3
- package/esm2022/lib/components/molecules/prompter/prompter.component.mjs +3 -3
- package/esm2022/lib/components/molecules/searchbar/searchbar.component.mjs +3 -3
- package/esm2022/lib/components/molecules/text-input/text-input.component.mjs +3 -3
- package/esm2022/lib/components/molecules/title-block/title-block.component.mjs +3 -3
- package/esm2022/lib/components/organisms/banner/banner.component.mjs +3 -3
- package/esm2022/lib/components/organisms/form/form.component.mjs +3 -3
- package/esm2022/lib/components/organisms/header/header.component.mjs +3 -3
- package/esm2022/lib/components/organisms/item-list/item-list.component.mjs +3 -3
- package/esm2022/lib/components/organisms/item-list/types.mjs +1 -1
- package/esm2022/lib/components/organisms/no-content/no-content.component.mjs +3 -3
- package/esm2022/lib/components/organisms/toolbar/toolbar.component.mjs +3 -3
- package/esm2022/lib/components/organisms/wizard/wizard.component.mjs +3 -3
- package/esm2022/lib/components/templates/layout/layout.component.mjs +2 -2
- package/esm2022/lib/components/types.mjs +1 -1
- package/esm2022/lib/examples/custom-content-demo.component.mjs +3 -3
- package/esm2022/lib/examples/display-demo.component.mjs +518 -0
- package/esm2022/lib/examples/display-simple-example.component.mjs +202 -0
- package/esm2022/lib/examples/multi-language-demo.component.mjs +304 -0
- package/esm2022/lib/services/lang-provider/content.mjs +34 -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/shared/utils/reactive-content.mjs +117 -0
- package/esm2022/public-api.mjs +5 -1
- package/fesm2022/valtech-components.mjs +3895 -2358
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/atoms/button/button.component.d.ts +10 -3
- package/lib/components/atoms/display/display.component.d.ts +12 -4
- package/lib/components/atoms/display/types.d.ts +13 -3
- package/lib/components/atoms/title/title.component.d.ts +6 -1
- package/lib/components/atoms/title/types.d.ts +29 -3
- package/lib/components/molecules/alert-box/alert-box.component.d.ts +17 -9
- package/lib/components/molecules/alert-box/types.d.ts +29 -0
- package/lib/components/organisms/item-list/types.d.ts +54 -9
- package/lib/components/types.d.ts +12 -3
- package/lib/examples/display-demo.component.d.ts +59 -0
- package/lib/examples/display-simple-example.component.d.ts +23 -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/shared/utils/reactive-content.d.ts +109 -0
- package/package.json +4 -2
- package/public-api.d.ts +4 -0
- package/src/lib/components/styles/overrides.scss +583 -0
- package/src/lib/components/styles/variables.scss +7 -3
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
import { EventEmitter } from '@angular/core';
|
|
1
|
+
import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ContentService } from '../../../services/content.service';
|
|
2
4
|
import { DownloadService } from '../../../services/download.service';
|
|
3
5
|
import { IconService } from '../../../services/icons.service';
|
|
4
6
|
import { NavigationService } from '../../../services/navigation.service';
|
|
5
7
|
import { ButtonMetadata } from '../../types';
|
|
6
8
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class ButtonComponent {
|
|
9
|
+
export declare class ButtonComponent implements OnInit, OnDestroy {
|
|
8
10
|
private download;
|
|
9
11
|
private navigation;
|
|
12
|
+
private contentService;
|
|
10
13
|
states: {
|
|
11
14
|
ENABLED: "ENABLED";
|
|
12
15
|
DISABLED: "DISABLED";
|
|
13
16
|
WORKING: "WORKING";
|
|
14
17
|
ERROR: "ERROR";
|
|
15
18
|
};
|
|
19
|
+
displayText$: Observable<string>;
|
|
20
|
+
private subscriptions;
|
|
16
21
|
props: ButtonMetadata;
|
|
17
22
|
/**
|
|
18
23
|
* Event emitted when the button is clicked.
|
|
19
24
|
*/
|
|
20
25
|
onClick: EventEmitter<string>;
|
|
21
|
-
constructor(download: DownloadService, icon: IconService, navigation: NavigationService);
|
|
26
|
+
constructor(download: DownloadService, icon: IconService, navigation: NavigationService, contentService: ContentService);
|
|
22
27
|
ngOnInit(): void;
|
|
28
|
+
ngOnDestroy(): void;
|
|
29
|
+
private initializeDisplayText;
|
|
23
30
|
clickHandler(): void;
|
|
24
31
|
static ɵfac: i0.ɵɵFactoryDeclaration<ButtonComponent, never>;
|
|
25
32
|
static ɵcmp: i0.ɵɵComponentDeclaration<ButtonComponent, "val-button", never, { "props": { "alias": "props"; "required": false; }; }, { "onClick": "onClick"; }, never, never, true, never>;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { OnInit } from '@angular/core';
|
|
1
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ContentService } from '../../../services/content.service';
|
|
2
4
|
import { DisplayMetadata } from './types';
|
|
3
5
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class DisplayComponent implements OnInit {
|
|
6
|
+
export declare class DisplayComponent implements OnInit, OnDestroy {
|
|
7
|
+
private contentService;
|
|
8
|
+
displayContent$: Observable<string>;
|
|
9
|
+
private subscriptions;
|
|
5
10
|
/**
|
|
6
11
|
* Display configuration object.
|
|
7
12
|
* @type {DisplayMetadata}
|
|
8
|
-
* @property content -
|
|
13
|
+
* @property content - Static text to display (takes precedence over contentConfig).
|
|
14
|
+
* @property contentConfig - Reactive content configuration.
|
|
9
15
|
* @property color - The text color (Ionic color string).
|
|
10
16
|
* @property size - The text size ('small' | 'medium' | 'large' | 'xlarge').
|
|
11
17
|
*/
|
|
12
18
|
props: DisplayMetadata;
|
|
13
|
-
constructor();
|
|
19
|
+
constructor(contentService: ContentService);
|
|
14
20
|
ngOnInit(): void;
|
|
21
|
+
ngOnDestroy(): void;
|
|
22
|
+
private initializeDisplayContent;
|
|
15
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<DisplayComponent, never>;
|
|
16
24
|
static ɵcmp: i0.ɵɵComponentDeclaration<DisplayComponent, "val-display", never, { "props": { "alias": "props"; "required": false; }; }, {}, never, never, true, never>;
|
|
17
25
|
}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { Color } from '@ionic/core';
|
|
2
2
|
/**
|
|
3
|
-
* Props for val-display component.
|
|
3
|
+
* Props for val-display component with reactive content support.
|
|
4
|
+
* Supports both static and reactive content patterns.
|
|
4
5
|
*
|
|
5
6
|
* @property size - The text size ('small' | 'medium' | 'large' | 'xlarge').
|
|
6
7
|
* @property color - The text color (Ionic color string).
|
|
7
|
-
* @property content -
|
|
8
|
+
* @property content - Static content text (takes precedence over contentConfig).
|
|
9
|
+
* @property contentConfig - Reactive content configuration.
|
|
8
10
|
*/
|
|
9
11
|
export interface DisplayMetadata {
|
|
10
12
|
size: 'small' | 'medium' | 'large' | 'xlarge';
|
|
11
13
|
color: Color;
|
|
12
|
-
content
|
|
14
|
+
/** Static content (takes precedence over contentConfig) */
|
|
15
|
+
content?: string;
|
|
16
|
+
/** Reactive content configuration */
|
|
17
|
+
contentConfig?: {
|
|
18
|
+
className?: string;
|
|
19
|
+
key: string;
|
|
20
|
+
fallback?: string;
|
|
21
|
+
interpolation?: Record<string, any>;
|
|
22
|
+
};
|
|
13
23
|
}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
2
3
|
import { TitleMetadata } from './types';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class TitleComponent implements OnInit {
|
|
5
6
|
/**
|
|
6
7
|
* Title configuration object.
|
|
7
8
|
* @type {TitleMetadata}
|
|
8
|
-
* @property content -
|
|
9
|
+
* @property content - Static title text (takes precedence over reactive content).
|
|
10
|
+
* @property contentConfig - Reactive content configuration.
|
|
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.
|
|
12
14
|
* @property thin - Whether the title is thin (optional).
|
|
13
15
|
*/
|
|
14
16
|
props: TitleMetadata;
|
|
17
|
+
private contentService;
|
|
18
|
+
private contentHelper;
|
|
19
|
+
displayContent$: Observable<string>;
|
|
15
20
|
constructor();
|
|
16
21
|
ngOnInit(): void;
|
|
17
22
|
static ɵfac: i0.ɵɵFactoryDeclaration<TitleComponent, never>;
|
|
@@ -1,17 +1,43 @@
|
|
|
1
1
|
import { Color } from '@ionic/core';
|
|
2
|
+
import { ReactiveTextMetadata } from '../../../shared/utils/reactive-content';
|
|
2
3
|
/**
|
|
3
4
|
* Props for val-title component.
|
|
5
|
+
* Supports both static content and reactive content from the language service.
|
|
4
6
|
*
|
|
5
|
-
* @property content -
|
|
7
|
+
* @property content - Static title text to display (takes precedence over reactive content).
|
|
8
|
+
* @property contentConfig - Reactive content configuration (used when content is not provided).
|
|
6
9
|
* @property color - The title color (Ionic color string).
|
|
7
10
|
* @property size - The title size ('small' | 'medium' | 'large' | 'xlarge').
|
|
8
11
|
* @property bold - Whether the title is bold.
|
|
9
12
|
* @property thin - Whether the title is thin (optional).
|
|
10
13
|
*/
|
|
11
|
-
export interface TitleMetadata {
|
|
14
|
+
export interface TitleMetadata extends ReactiveTextMetadata {
|
|
12
15
|
size: 'small' | 'medium' | 'large' | 'xlarge';
|
|
13
16
|
color: Color;
|
|
14
|
-
content: string;
|
|
15
17
|
bold: boolean;
|
|
16
18
|
thin?: boolean;
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Factory function to create title props with reactive content support.
|
|
22
|
+
*
|
|
23
|
+
* @param styleConfig - Title styling configuration
|
|
24
|
+
* @param contentConfig - Content configuration (static or reactive)
|
|
25
|
+
* @returns Complete TitleMetadata object
|
|
26
|
+
*
|
|
27
|
+
* @example Static content:
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const props = createTitleProps(
|
|
30
|
+
* { size: 'large', color: 'primary', bold: true },
|
|
31
|
+
* { content: 'Static Title' }
|
|
32
|
+
* );
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Reactive content:
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const props = createTitleProps(
|
|
38
|
+
* { size: 'large', color: 'primary', bold: true },
|
|
39
|
+
* { contentConfig: { key: 'pageTitle', fallback: 'Default Title' } }
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function createTitleProps(styleConfig: Pick<TitleMetadata, 'size' | 'color' | 'bold' | 'thin'>, contentConfig: Pick<TitleMetadata, 'content' | 'contentConfig'>): TitleMetadata;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { OnInit } from '@angular/core';
|
|
2
|
-
import {
|
|
1
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { ContentService } from '../../../services/content.service';
|
|
3
|
+
import { AlertBoxMetadata, ReactiveAlertBoxMetadata } from './types';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class AlertBoxComponent implements OnInit {
|
|
5
|
+
export declare class AlertBoxComponent implements OnInit, OnDestroy {
|
|
6
|
+
private contentService;
|
|
7
|
+
private subscriptions;
|
|
5
8
|
/**
|
|
6
9
|
* Alert box configuration object.
|
|
7
|
-
*
|
|
8
|
-
* @property box - Box configuration (see BoxMetadata).
|
|
9
|
-
* @property icon - Icon configuration (see IconMetadata).
|
|
10
|
-
* @property text - Text configuration (see TextMetadata).
|
|
10
|
+
* Supports both legacy AlertBoxMetadata and ReactiveAlertBoxMetadata patterns.
|
|
11
11
|
*/
|
|
12
|
-
props: AlertBoxMetadata;
|
|
13
|
-
|
|
12
|
+
props: AlertBoxMetadata | ReactiveAlertBoxMetadata;
|
|
13
|
+
/** Computed text properties for reactive pattern */
|
|
14
|
+
computedTextProps: any;
|
|
15
|
+
/** Whether this is using the legacy props pattern */
|
|
16
|
+
get isLegacyProps(): boolean;
|
|
17
|
+
/** Get text props for legacy pattern */
|
|
18
|
+
getLegacyTextProps(): any;
|
|
19
|
+
constructor(contentService: ContentService);
|
|
14
20
|
ngOnInit(): void;
|
|
21
|
+
ngOnDestroy(): void;
|
|
22
|
+
private initializeReactiveTextProps;
|
|
15
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<AlertBoxComponent, never>;
|
|
16
24
|
static ɵcmp: i0.ɵɵComponentDeclaration<AlertBoxComponent, "val-alert-box", never, { "props": { "alias": "props"; "required": false; }; }, {}, never, never, true, never>;
|
|
17
25
|
}
|
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
import { BoxMetadata } from '../../atoms/box/types';
|
|
2
2
|
import { IconMetadata } from '../../atoms/icon/types';
|
|
3
3
|
import { TextMetadata } from '../../atoms/text/types';
|
|
4
|
+
/**
|
|
5
|
+
* Alert box component metadata with support for reactive content.
|
|
6
|
+
* Provides both static and reactive content options for the text element.
|
|
7
|
+
*/
|
|
4
8
|
export interface AlertBoxMetadata {
|
|
5
9
|
box: BoxMetadata;
|
|
6
10
|
icon: IconMetadata;
|
|
7
11
|
text: TextMetadata;
|
|
8
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Enhanced alert box metadata with simplified reactive content support.
|
|
15
|
+
* Alternative to the standard AlertBoxMetadata for common use cases.
|
|
16
|
+
*/
|
|
17
|
+
export interface ReactiveAlertBoxMetadata {
|
|
18
|
+
/** Box styling configuration */
|
|
19
|
+
box: BoxMetadata;
|
|
20
|
+
/** Icon configuration */
|
|
21
|
+
icon: IconMetadata;
|
|
22
|
+
/** Static text (takes precedence over textConfig) */
|
|
23
|
+
text?: string;
|
|
24
|
+
/** Reactive content configuration for alert text */
|
|
25
|
+
textConfig?: {
|
|
26
|
+
className?: string;
|
|
27
|
+
key: string;
|
|
28
|
+
fallback?: string;
|
|
29
|
+
interpolation?: Record<string, any>;
|
|
30
|
+
};
|
|
31
|
+
/** Text styling options */
|
|
32
|
+
textStyle?: {
|
|
33
|
+
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
34
|
+
color?: string;
|
|
35
|
+
bold?: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -6,27 +6,40 @@ import { Color } from '@ionic/core';
|
|
|
6
6
|
import { ComponentState } from '../../types';
|
|
7
7
|
/**
|
|
8
8
|
* Representa una acción disponible en un elemento de la lista.
|
|
9
|
+
* Ahora soporta contenido reactivo para la descripción.
|
|
9
10
|
* @property token Identificador único de la acción.
|
|
10
11
|
* @property icon (opcional) Icono a mostrar.
|
|
11
|
-
* @property description Descripción de la acción.
|
|
12
|
+
* @property description (opcional) Descripción estática de la acción.
|
|
13
|
+
* @property descriptionConfig (opcional) Configuración de contenido reactivo para la descripción.
|
|
12
14
|
* @property state Estado de la acción (habilitado, deshabilitado, trabajando, etc).
|
|
13
15
|
*/
|
|
14
16
|
export type ItemAction = {
|
|
15
17
|
token: string;
|
|
16
18
|
icon?: string;
|
|
17
|
-
description
|
|
19
|
+
description?: string;
|
|
20
|
+
descriptionConfig?: {
|
|
21
|
+
className?: string;
|
|
22
|
+
key: string;
|
|
23
|
+
fallback?: string;
|
|
24
|
+
interpolation?: Record<string, any>;
|
|
25
|
+
};
|
|
18
26
|
state: ComponentState;
|
|
19
27
|
};
|
|
20
28
|
/**
|
|
21
29
|
* Metadatos de un elemento individual de la lista.
|
|
30
|
+
* Ahora soporta contenido reactivo para todos los campos de texto.
|
|
22
31
|
* @property token (opcional) Identificador único del elemento.
|
|
23
32
|
* @property mode Modo de visualización ('justext', 'subtitule', 'avatar', 'icon', 'route', 'actionable').
|
|
24
|
-
* @property text Texto principal del elemento.
|
|
33
|
+
* @property text (opcional) Texto estático principal del elemento.
|
|
34
|
+
* @property textConfig (opcional) Configuración de contenido reactivo para el texto principal.
|
|
25
35
|
* @property image (opcional) Imagen para modo avatar.
|
|
26
36
|
* @property icon (opcional) Icono para modo icon.
|
|
27
|
-
* @property comments (opcional) Comentarios
|
|
28
|
-
* @property
|
|
29
|
-
* @property
|
|
37
|
+
* @property comments (opcional) Comentarios estáticos.
|
|
38
|
+
* @property commentsConfig (opcional) Configuración de contenido reactivo para comentarios.
|
|
39
|
+
* @property subtitle (opcional) Subtítulo estático.
|
|
40
|
+
* @property subtitleConfig (opcional) Configuración de contenido reactivo para subtítulo.
|
|
41
|
+
* @property endNote (opcional) Nota estática al final del elemento.
|
|
42
|
+
* @property endNoteConfig (opcional) Configuración de contenido reactivo para la nota final.
|
|
30
43
|
* @property actions (opcional) Acciones disponibles para el elemento.
|
|
31
44
|
* @property color (opcional) Color personalizado.
|
|
32
45
|
* @property lines (opcional) Tipo de líneas ('full', 'inset', 'none').
|
|
@@ -43,12 +56,36 @@ export type ItemAction = {
|
|
|
43
56
|
export interface ItemMetadata {
|
|
44
57
|
token?: string;
|
|
45
58
|
mode: 'justext' | 'subtitule' | 'avatar' | 'icon' | 'route' | 'actionable';
|
|
46
|
-
text
|
|
59
|
+
text?: string;
|
|
60
|
+
textConfig?: {
|
|
61
|
+
className?: string;
|
|
62
|
+
key: string;
|
|
63
|
+
fallback?: string;
|
|
64
|
+
interpolation?: Record<string, any>;
|
|
65
|
+
};
|
|
47
66
|
image?: string;
|
|
48
67
|
icon?: string;
|
|
49
68
|
comments?: string;
|
|
69
|
+
commentsConfig?: {
|
|
70
|
+
className?: string;
|
|
71
|
+
key: string;
|
|
72
|
+
fallback?: string;
|
|
73
|
+
interpolation?: Record<string, any>;
|
|
74
|
+
};
|
|
50
75
|
subtitle?: string;
|
|
76
|
+
subtitleConfig?: {
|
|
77
|
+
className?: string;
|
|
78
|
+
key: string;
|
|
79
|
+
fallback?: string;
|
|
80
|
+
interpolation?: Record<string, any>;
|
|
81
|
+
};
|
|
51
82
|
endNote?: string;
|
|
83
|
+
endNoteConfig?: {
|
|
84
|
+
className?: string;
|
|
85
|
+
key: string;
|
|
86
|
+
fallback?: string;
|
|
87
|
+
interpolation?: Record<string, any>;
|
|
88
|
+
};
|
|
52
89
|
actions?: ItemAction[];
|
|
53
90
|
color?: string;
|
|
54
91
|
lines?: 'full' | 'inset' | 'none';
|
|
@@ -64,11 +101,13 @@ export interface ItemMetadata {
|
|
|
64
101
|
}
|
|
65
102
|
/**
|
|
66
103
|
* Metadatos de la lista de elementos.
|
|
104
|
+
* Ahora soporta contenido reactivo para el título.
|
|
67
105
|
* @property color Color principal de la lista.
|
|
68
106
|
* @property bordered Si la lista tiene borde.
|
|
69
107
|
* @property rounded Si la lista tiene bordes redondeados.
|
|
70
108
|
* @property shadowed Si la lista tiene sombra.
|
|
71
|
-
* @property title Título de la lista.
|
|
109
|
+
* @property title (opcional) Título estático de la lista.
|
|
110
|
+
* @property titleConfig (opcional) Configuración de contenido reactivo para el título.
|
|
72
111
|
* @property items Elementos a mostrar en la lista.
|
|
73
112
|
*/
|
|
74
113
|
export interface ListMetadata {
|
|
@@ -76,6 +115,12 @@ export interface ListMetadata {
|
|
|
76
115
|
bordered: boolean;
|
|
77
116
|
rounded: boolean;
|
|
78
117
|
shadowed: boolean;
|
|
79
|
-
title
|
|
118
|
+
title?: string;
|
|
119
|
+
titleConfig?: {
|
|
120
|
+
className?: string;
|
|
121
|
+
key: string;
|
|
122
|
+
fallback?: string;
|
|
123
|
+
interpolation?: Record<string, any>;
|
|
124
|
+
};
|
|
80
125
|
items: ItemMetadata[];
|
|
81
126
|
}
|
|
@@ -177,8 +177,10 @@ export interface IconMetada {
|
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* Button configuration object.
|
|
180
|
+
* Supports both static and reactive content.
|
|
180
181
|
* @type {ButtonMetadata}
|
|
181
|
-
* @property text -
|
|
182
|
+
* @property text - Static button label (takes precedence over textConfig).
|
|
183
|
+
* @property textConfig - Reactive content configuration for button text.
|
|
182
184
|
* @property color - The button color (Ionic color string).
|
|
183
185
|
* @property icon - Icon to display (optional).
|
|
184
186
|
* @property state - Button state (enabled, disabled, working, etc.).
|
|
@@ -201,8 +203,15 @@ export interface ButtonMetadata {
|
|
|
201
203
|
color: Color;
|
|
202
204
|
/** Button state */
|
|
203
205
|
state: ComponentState;
|
|
204
|
-
/**
|
|
205
|
-
text
|
|
206
|
+
/** Static display text (takes precedence over textConfig) */
|
|
207
|
+
text?: string;
|
|
208
|
+
/** Reactive content configuration for button text */
|
|
209
|
+
textConfig?: {
|
|
210
|
+
className?: string;
|
|
211
|
+
key: string;
|
|
212
|
+
fallback?: string;
|
|
213
|
+
interpolation?: Record<string, any>;
|
|
214
|
+
};
|
|
206
215
|
/** Associated icon */
|
|
207
216
|
icon?: IconMetada;
|
|
208
217
|
/** Button shape */
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { DisplayMetadata } from '../components/atoms/display/types';
|
|
4
|
+
import { ContentService } from '../services/content.service';
|
|
5
|
+
import { LangService } from '../services/lang-provider/lang-provider.service';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Componente de demostración para val-display con contenido reactivo.
|
|
9
|
+
* Muestra diferentes patrones de uso y casos de ejemplo.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DisplayDemoComponent implements OnInit {
|
|
12
|
+
private contentService;
|
|
13
|
+
private langService;
|
|
14
|
+
demoTitle$: Observable<string>;
|
|
15
|
+
languageLabel$: Observable<string>;
|
|
16
|
+
staticSectionTitle$: Observable<string>;
|
|
17
|
+
reactiveSectionTitle$: Observable<string>;
|
|
18
|
+
mixedSectionTitle$: Observable<string>;
|
|
19
|
+
dynamicSectionTitle$: Observable<string>;
|
|
20
|
+
analysisTitle$: Observable<string>;
|
|
21
|
+
reactiveContentTitle$: Observable<string>;
|
|
22
|
+
interpolationTitle$: Observable<string>;
|
|
23
|
+
fallbackTitle$: Observable<string>;
|
|
24
|
+
mixedContentTitle$: Observable<string>;
|
|
25
|
+
dynamicContentTitle$: Observable<string>;
|
|
26
|
+
updateButtonText$: Observable<string>;
|
|
27
|
+
currentLangLabel$: Observable<string>;
|
|
28
|
+
availableLangsLabel$: Observable<string>;
|
|
29
|
+
currentLanguage$: Observable<string>;
|
|
30
|
+
availableLanguages$: Observable<string[]>;
|
|
31
|
+
private counter;
|
|
32
|
+
smallStaticDisplay: DisplayMetadata;
|
|
33
|
+
mediumStaticDisplay: DisplayMetadata;
|
|
34
|
+
largeStaticDisplay: DisplayMetadata;
|
|
35
|
+
xlargeStaticDisplay: DisplayMetadata;
|
|
36
|
+
primaryDisplay: DisplayMetadata;
|
|
37
|
+
secondaryDisplay: DisplayMetadata;
|
|
38
|
+
successDisplay: DisplayMetadata;
|
|
39
|
+
warningDisplay: DisplayMetadata;
|
|
40
|
+
dangerDisplay: DisplayMetadata;
|
|
41
|
+
welcomeDisplay: DisplayMetadata;
|
|
42
|
+
descriptionDisplay: DisplayMetadata;
|
|
43
|
+
statusDisplay: DisplayMetadata;
|
|
44
|
+
userWelcomeDisplay: DisplayMetadata;
|
|
45
|
+
counterDisplay: DisplayMetadata;
|
|
46
|
+
missingKeyDisplay: DisplayMetadata;
|
|
47
|
+
noFallbackDisplay: DisplayMetadata;
|
|
48
|
+
staticMixedDisplay: DisplayMetadata;
|
|
49
|
+
reactiveMixedDisplay: DisplayMetadata;
|
|
50
|
+
dynamicCounterDisplay: DisplayMetadata;
|
|
51
|
+
constructor(contentService: ContentService, langService: LangService);
|
|
52
|
+
ngOnInit(): void;
|
|
53
|
+
private initializeContent;
|
|
54
|
+
private initializeLanguageState;
|
|
55
|
+
changeLanguage(language: string): void;
|
|
56
|
+
updateCounter(): void;
|
|
57
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DisplayDemoComponent, never>;
|
|
58
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DisplayDemoComponent, "val-display-demo", never, {}, {}, never, never, true, never>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DisplayMetadata } from '../components/atoms/display/types';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Ejemplo rápido de uso del componente val-display con contenido reactivo
|
|
5
|
+
*/
|
|
6
|
+
export declare class DisplayExampleComponent {
|
|
7
|
+
staticTitle: DisplayMetadata;
|
|
8
|
+
staticSubtitle: DisplayMetadata;
|
|
9
|
+
reactiveWelcome: DisplayMetadata;
|
|
10
|
+
reactiveDescription: DisplayMetadata;
|
|
11
|
+
userGreeting: DisplayMetadata;
|
|
12
|
+
statusMessage: DisplayMetadata;
|
|
13
|
+
smallText: DisplayMetadata;
|
|
14
|
+
mediumText: DisplayMetadata;
|
|
15
|
+
largeText: DisplayMetadata;
|
|
16
|
+
xlargeText: DisplayMetadata;
|
|
17
|
+
primaryText: DisplayMetadata;
|
|
18
|
+
successText: DisplayMetadata;
|
|
19
|
+
warningText: DisplayMetadata;
|
|
20
|
+
dangerText: DisplayMetadata;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DisplayExampleComponent, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DisplayExampleComponent, "app-display-example", never, {}, {}, never, never, true, never>;
|
|
23
|
+
}
|
|
@@ -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>;
|