@po-ui/ng-components 19.11.0 → 19.12.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.
@@ -261,8 +261,8 @@ export interface PoDynamicFormField extends PoDynamicField {
261
261
  * `po-lookup` e `po-textarea` não é necessário passar a propriedade `requiredFieldErrorMessage`.
262
262
  *
263
263
  *
264
- * **Componentes compatíveis:** `po-datepicker`, `po-input`, `po-number`, `po-decimal`, `po-password`, `po-datepicker-range`,
265
- * `po-select`, `po-checkbox-group`, `po-radio-group`, `po-multiselect`, `po-combo`, `po-lookup`, `po-textarea`.
264
+ * **Componentes compatíveis:** `po-checkbox-group`, `po-combo`, `po-datepicker`, `po-datepicker-range`,
265
+ * `po-decimal`, `po-input`, `po-lookup`, `po-multiselect`, `po-number`, `po-password`, `po-radio-group`, `po-select`, `po-switch`, `po-textarea`.
266
266
  */
267
267
  errorMessage?: string;
268
268
  /**
@@ -275,8 +275,8 @@ export interface PoDynamicFormField extends PoDynamicField {
275
275
  * > Caso essa propriedade seja definida como `true`, a mensagem de erro será limitada a duas linhas
276
276
  * e um tooltip será exibido ao passar o mouse sobre a mensagem para mostrar o conteúdo completo.
277
277
  *
278
- * **Componentes compatíveis:** `po-datepicker`, `po-input`, `po-number`, `po-decimal`, `po-password`, `po-datepicker-range`,
279
- * `po-select`, `po-checkbox-group`, `po-radio-group`, `po-multiselect`, `po-combo`, `po-lookup`, `po-textarea`.
278
+ * **Componentes compatíveis:** `po-checkbox-group`, `po-combo`, `po-datepicker`, `po-datepicker-range`,
279
+ * `po-decimal`, `po-input`, `po-lookup`, `po-multiselect`, `po-number`, `po-password`, `po-radio-group`, `po-select`, `po-switch`, `po-textarea`.
280
280
  *
281
281
  * @default `false`
282
282
  */
@@ -733,4 +733,14 @@ export interface PoDynamicFormField extends PoDynamicField {
733
733
  * @default `medium`
734
734
  */
735
735
  size?: string;
736
+ /**
737
+ * Define qual valor será considerado como inválido para exibir a mensagem da propriedade `p-field-error-message`.
738
+ *
739
+ * > Caso essa propriedade seja definida como `true`, a mensagem de erro será exibida quando o campo estiver ligado(on/true).
740
+ *
741
+ * **Componente compatível**: `po-switch`
742
+ *
743
+ * @default `false`
744
+ */
745
+ invalidValue?: boolean;
736
746
  }
@@ -1,4 +1,5 @@
1
- import { ChangeDetectorRef, ElementRef } from '@angular/core';
1
+ import { AfterViewInit, ChangeDetectorRef, ElementRef, Injector, OnDestroy } from '@angular/core';
2
+ import { AbstractControl, ValidationErrors, Validator } from '@angular/forms';
2
3
  import { PoThemeService } from '../../../services';
3
4
  import { PoFieldModel } from '../po-field.model';
4
5
  import { PoSwitchLabelPosition } from './po-switch-label-position.enum';
@@ -78,9 +79,10 @@ import * as i0 from "@angular/core";
78
79
  * <file name="sample-po-switch-order-reactive-form/sample-po-switch-order-reactive-form.component.ts"> </file>
79
80
  * </example>
80
81
  */
81
- export declare class PoSwitchComponent extends PoFieldModel<any> {
82
+ export declare class PoSwitchComponent extends PoFieldModel<any> implements Validator, AfterViewInit, OnDestroy {
82
83
  protected poThemeService: PoThemeService;
83
- private changeDetector;
84
+ private readonly changeDetector;
85
+ private readonly injector;
84
86
  switchContainer: ElementRef;
85
87
  id: string;
86
88
  value: boolean;
@@ -89,6 +91,7 @@ export declare class PoSwitchComponent extends PoFieldModel<any> {
89
91
  private _labelPosition;
90
92
  private _formatModel;
91
93
  private _size?;
94
+ private statusChangesSubscription;
92
95
  /**
93
96
  * @optional
94
97
  *
@@ -138,6 +141,41 @@ export declare class PoSwitchComponent extends PoFieldModel<any> {
138
141
  */
139
142
  set labelOn(label: string);
140
143
  get labelOn(): string;
144
+ /**
145
+ * @optional
146
+ *
147
+ * @description
148
+ *
149
+ * Exibe a mensagem de erro configurada quando o campo estiver desligado(off/false).
150
+ *
151
+ *
152
+ */
153
+ fieldErrorMessage: string;
154
+ /**
155
+ * @optional
156
+ *
157
+ * @description
158
+ *
159
+ * Limita a exibição da mensagem de erro a duas linhas e exibe um tooltip com o texto completo.
160
+ *
161
+ * > Caso essa propriedade seja definida como `true`, a mensagem de erro será limitada a duas linhas
162
+ * e um tooltip será exibido ao passar o mouse sobre a mensagem para mostrar o conteúdo completo.
163
+ *
164
+ * @default `false`
165
+ */
166
+ errorLimit: boolean;
167
+ /**
168
+ * @optional
169
+ *
170
+ * @description
171
+ *
172
+ * Define qual valor será considerado como inválido para exibir a mensagem da propriedade `p-field-error-message`.
173
+ *
174
+ * > Caso essa propriedade seja definida como `true`, a mensagem de erro será exibida quando o campo estiver ligado(on/true).
175
+ *
176
+ * @default `false`
177
+ */
178
+ invalidValue: boolean;
141
179
  /**
142
180
  * @optional
143
181
  *
@@ -155,7 +193,11 @@ export declare class PoSwitchComponent extends PoFieldModel<any> {
155
193
  */
156
194
  set size(value: string);
157
195
  get size(): string;
158
- constructor(poThemeService: PoThemeService, changeDetector: ChangeDetectorRef);
196
+ private readonly el;
197
+ private readonly injectOptions;
198
+ private control;
199
+ constructor(poThemeService: PoThemeService, changeDetector: ChangeDetectorRef, injector: Injector);
200
+ ngOnDestroy(): void;
159
201
  /**
160
202
  * Função que atribui foco ao componente.
161
203
  *
@@ -180,8 +222,13 @@ export declare class PoSwitchComponent extends PoFieldModel<any> {
180
222
  changeValue(value: any): void;
181
223
  eventClick(): void;
182
224
  onWriteValue(value: any): void;
225
+ validate(control: AbstractControl): ValidationErrors | null;
226
+ ngAfterViewInit(): void;
227
+ private setControl;
228
+ getErrorPattern(): string;
229
+ hasInvalidClass(): boolean;
183
230
  static ɵfac: i0.ɵɵFactoryDeclaration<PoSwitchComponent, never>;
184
- static ɵcmp: i0.ɵɵComponentDeclaration<PoSwitchComponent, "po-switch", never, { "value": { "alias": "p-value"; "required": false; }; "formatModel": { "alias": "p-format-model"; "required": false; }; "hideLabelStatus": { "alias": "p-hide-label-status"; "required": false; }; "labelPosition": { "alias": "p-label-position"; "required": false; }; "labelOff": { "alias": "p-label-off"; "required": false; }; "labelOn": { "alias": "p-label-on"; "required": false; }; "size": { "alias": "p-size"; "required": false; }; }, {}, never, never, false, never>;
231
+ static ɵcmp: i0.ɵɵComponentDeclaration<PoSwitchComponent, "po-switch", never, { "value": { "alias": "p-value"; "required": false; }; "formatModel": { "alias": "p-format-model"; "required": false; }; "hideLabelStatus": { "alias": "p-hide-label-status"; "required": false; }; "labelPosition": { "alias": "p-label-position"; "required": false; }; "labelOff": { "alias": "p-label-off"; "required": false; }; "labelOn": { "alias": "p-label-on"; "required": false; }; "fieldErrorMessage": { "alias": "p-field-error-message"; "required": false; }; "errorLimit": { "alias": "p-error-limit"; "required": false; }; "invalidValue": { "alias": "p-invalid-value"; "required": false; }; "size": { "alias": "p-size"; "required": false; }; }, {}, never, never, false, never>;
185
232
  static ngAcceptInputType_value: any;
186
233
  static ngAcceptInputType_formatModel: any;
187
234
  static ngAcceptInputType_hideLabelStatus: any;
@@ -8,7 +8,7 @@ import * as i0 from "@angular/core";
8
8
  *
9
9
  * O `PoThemeService` possibilita a personalização das cores do tema padrão do `PO-UI`, permitindo a alteração dos valores das variáveis de estilo usadas no CSS padrão.
10
10
  *
11
- * > Para saber mais sobre como customizar as cores do tema padrão verifique o item [Customizando cores do tema padrão](https://po-ui.io/guides/colors-customization) na aba `Guias`.
11
+ * > Para saber mais sobre como customizar o tema padrão verifique o item [Customização de Temas usando o serviço PO-UI](guides/theme-service) na aba `Guias`.
12
12
  *
13
13
  * > Obs.: Não está documentado aqui e não indicamos a customização das cores de 'feedback' por motivos de acessibilidade e usabilidade.
14
14
  */
@@ -75,38 +75,51 @@ export declare class PoThemeService {
75
75
  * A classe do tema é aplicada no HTML e pode ser formatada como `html[class*="-light-AA"]` para personalizações
76
76
  * em temas específicos.
77
77
  *
78
- * @param {PoThemeActive} active - Objeto que define o tema ativo, com `type` e `a11y`.
78
+ * @param {PoThemeActive} active - Configuração do tema ativo:
79
79
  * @param {any} perComponent - Objeto contendo os estilos específicos para componentes a serem aplicados.
80
80
  * @param {any} onRoot - Objeto contendo tokens de estilo que serão aplicados diretamente no seletor `:root` do HTML.
81
+ * @param {string | Array<string>} [classPrefix] - Prefixo(s) de classe para direcionamento preciso.
81
82
  *
82
83
  * @example
84
+ * #### 1. Com prefixo único
85
+ * ```typescript
86
+ * setPerComponentAndOnRoot(
87
+ * { type: 'dark', a11y: 'AA' },
88
+ * { 'po-input': { background: '#222' } },
89
+ * { '--text-color': '#fff' },
90
+ * 'myTheme'
91
+ * );
92
+ * ```
93
+ * **Saída:**
94
+ * ```css
95
+ * :root[class*="-dark-AA"][class*="myTheme"] {
96
+ * --text-color: #fff;
97
+ * po-input { background: #222; }
98
+ * }
99
+ * ```
100
+ *
101
+ * #### 2. Com múltiplos prefixos
102
+ * ```typescript
103
+ * setPerComponentAndOnRoot(
104
+ * { type: 'light' },
105
+ * null,
106
+ * { '--primary': '#3e8ed0' },
107
+ * ['myTheme', 'portal-v2']
108
+ * );
109
+ * ```
110
+ * **Saída:**
111
+ * ```css
112
+ * :root[class*="-light"][class*="myTheme"],
113
+ * :root[class*="-light"][class*="portal-v2"] {
114
+ * --primary: #3e8ed0;
115
+ * }
116
+ * ```
117
+ *
118
+ * - Quando usado com array, gera um seletor CSS com múltiplos targets (separados por vírgula).
119
+ * - Mantém a especificidade original do tema (`[class*="-type-a11y"]`) combinada com cada prefixo.
83
120
  *
84
- * // Exemplo de utilização com um tema ativo e tokens de estilo
85
- * const themeActive = { type: 'light', a11y: 'AA' };
86
- * const perComponentStyles = {
87
- * 'po-listbox [hidden]': {
88
- * 'display': 'flex !important'
89
- * }
90
- * };
91
- * const onRootStyles = {
92
- * '--font-family': 'Roboto',
93
- * '--background-color': '#fff'
94
- * };
95
- *
96
- * this.setPerComponentAndOnRoot(themeActive, perComponentStyles, onRootStyles);
97
- *
98
- * // Resultado:
99
- * // Gera e aplica os seguintes estilos no DOM
100
- * // html[class*="-light-AA"]:root {
101
- * // --font-family: 'Roboto';
102
- * // --background-color: '#fff';
103
- * // po-listbox [hidden] {
104
- * // display: flex !important;
105
- * // }
106
- * // }
107
- *
108
- */
109
- setPerComponentAndOnRoot(active: PoThemeActive, perComponent: any, onRoot: any): void;
121
+ */
122
+ setPerComponentAndOnRoot(active: PoThemeActive, perComponent: any, onRoot: any, classPrefix?: string | Array<string>): void;
110
123
  /**
111
124
  * @docsPrivate
112
125
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@po-ui/ng-components",
3
- "version": "19.11.0",
3
+ "version": "19.12.0",
4
4
  "description": "PO UI - Components",
5
5
  "author": "PO UI",
6
6
  "license": "MIT",
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@angular/cdk": "~19.0.3",
25
- "@po-ui/style": "19.11.0",
26
- "@po-ui/ng-schematics": "19.11.0",
25
+ "@po-ui/style": "19.12.0",
26
+ "@po-ui/ng-schematics": "19.12.0",
27
27
  "tslib": "^2.6.2"
28
28
  },
29
29
  "peerDependencies": {
@@ -37,7 +37,7 @@
37
37
  "@angular/platform-browser-dynamic": "^19",
38
38
  "@angular/router": "^19",
39
39
  "@angular-devkit/schematics": "^19",
40
- "@po-ui/style": "19.11.0",
40
+ "@po-ui/style": "19.12.0",
41
41
  "rxjs": "~7.8.1",
42
42
  "zone.js": "~0.15.0"
43
43
  },
Binary file
@@ -18,7 +18,7 @@ function default_1(options) {
18
18
  }
19
19
  function addPoPackageAndInstall() {
20
20
  return (tree, context) => {
21
- (0, package_config_1.addPackageToPackageJson)(tree, '@po-ui/ng-components', '19.11.0');
21
+ (0, package_config_1.addPackageToPackageJson)(tree, '@po-ui/ng-components', '19.12.0');
22
22
  // install packages
23
23
  context.addTask(new tasks_1.NodePackageInstallTask());
24
24
  };
@@ -6,7 +6,7 @@ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
6
  const package_config_1 = require("@po-ui/ng-schematics/package-config");
7
7
  const changes_1 = require("./changes");
8
8
  function default_1() {
9
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), postUpdate()]);
9
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), postUpdate()]);
10
10
  }
11
11
  function postUpdate() {
12
12
  return (_, context) => {
@@ -11,7 +11,7 @@ const changes_1 = require("./changes");
11
11
  const httpClientModuleName = 'HttpClientModule';
12
12
  const httpClientModuleSourcePath = '@angular/common/http';
13
13
  function default_1() {
14
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
14
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
15
15
  }
16
16
  function postUpdate() {
17
17
  return (_, context) => {
@@ -6,7 +6,7 @@ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
6
  const package_config_1 = require("@po-ui/ng-schematics/package-config");
7
7
  const changes_1 = require("./changes");
8
8
  function default_1() {
9
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), postUpdate()]);
9
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), postUpdate()]);
10
10
  }
11
11
  function postUpdate() {
12
12
  return (_, context) => {
@@ -6,7 +6,7 @@ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
6
  const package_config_1 = require("@po-ui/ng-schematics/package-config");
7
7
  const changes_1 = require("./changes");
8
8
  function default_1() {
9
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), postUpdate()]);
9
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), postUpdate()]);
10
10
  }
11
11
  function postUpdate() {
12
12
  return (_, context) => {
@@ -40,11 +40,11 @@ function main(options) {
40
40
  configureNewIcon.toLowerCase() === 'y' ||
41
41
  configureNewIcon.toLowerCase() === 'sim' ||
42
42
  configureNewIcon.toLowerCase() === '') {
43
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
43
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
44
44
  }
45
45
  else {
46
46
  return (0, schematics_1.chain)([
47
- (0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion),
47
+ (0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion),
48
48
  addImportOnly(options, [IconsDictionaryName, poIconDictionary], poModuleSourcePath),
49
49
  addProviderToAppModule(options, newProviderDictionary),
50
50
  updateAppConfigFileRule(),
@@ -40,11 +40,11 @@ function main(options) {
40
40
  configureNewIcon.toLowerCase() === 'y' ||
41
41
  configureNewIcon.toLowerCase() === 'sim' ||
42
42
  configureNewIcon.toLowerCase() === '') {
43
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
43
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
44
44
  }
45
45
  else {
46
46
  return (0, schematics_1.chain)([
47
- (0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion),
47
+ (0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion),
48
48
  addImportOnly(options, [IconsDictionaryName, poIconDictionary], poModuleSourcePath),
49
49
  addProviderToAppModule(options, newProviderDictionary),
50
50
  updateAppConfigFileRule(),
@@ -10,7 +10,7 @@ const package_config_1 = require("@po-ui/ng-schematics/package-config");
10
10
  const changes_1 = require("./changes");
11
11
  function updateToV2() {
12
12
  return (0, schematics_1.chain)([
13
- updatePackageJson('19.11.0', changes_1.dependeciesChanges),
13
+ updatePackageJson('19.12.0', changes_1.dependeciesChanges),
14
14
  (0, replace_1.replaceInFile)('tslint.json', changes_1.tsLintReplaces),
15
15
  (0, replace_1.replaceInFile)('angular.json', changes_1.angularJsonReplaces),
16
16
  createUpgradeRule(),
@@ -7,7 +7,7 @@ const project_1 = require("@po-ui/ng-schematics/project");
7
7
  const package_config_1 = require("@po-ui/ng-schematics/package-config");
8
8
  const changes_1 = require("./changes");
9
9
  function updateToV3() {
10
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
10
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
11
11
  }
12
12
  function postUpdate() {
13
13
  return (_, context) => {
@@ -7,7 +7,7 @@ const project_1 = require("@po-ui/ng-schematics/project");
7
7
  const package_config_1 = require("@po-ui/ng-schematics/package-config");
8
8
  const changes_1 = require("./changes");
9
9
  function default_1() {
10
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
10
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
11
11
  }
12
12
  function postUpdate() {
13
13
  return (_, context) => {
@@ -7,7 +7,7 @@ const project_1 = require("@po-ui/ng-schematics/project");
7
7
  const package_config_1 = require("@po-ui/ng-schematics/package-config");
8
8
  const changes_1 = require("./changes");
9
9
  function default_1() {
10
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
10
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
11
11
  }
12
12
  function postUpdate() {
13
13
  return (_, context) => {
@@ -6,7 +6,7 @@ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
6
  const package_config_1 = require("@po-ui/ng-schematics/package-config");
7
7
  const changes_1 = require("./changes");
8
8
  function default_1() {
9
- return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.11.0', changes_1.updateDepedenciesVersion), postUpdate()]);
9
+ return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('19.12.0', changes_1.updateDepedenciesVersion), postUpdate()]);
10
10
  }
11
11
  function postUpdate() {
12
12
  return (_, context) => {
Binary file