@po-ui/ng-components 21.8.0 → 21.9.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.
- package/fesm2022/po-ui-ng-components.mjs +4720 -351
- package/fesm2022/po-ui-ng-components.mjs.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/po-button/po-button-base.component.d.ts +10 -0
- package/lib/components/po-calendar/constants/po-calendar-range-presets.constant.d.ts +2 -0
- package/lib/components/po-calendar/index.d.ts +2 -0
- package/lib/components/po-calendar/interfaces/po-calendar-range-preset.interface.d.ts +16 -0
- package/lib/components/po-calendar/po-calendar-base.component.d.ts +54 -0
- package/lib/components/po-calendar/po-calendar-footer/po-calendar-footer.component.d.ts +16 -0
- package/lib/components/po-calendar/po-calendar-preset-list/po-calendar-preset-list.component.d.ts +28 -0
- package/lib/components/po-calendar/po-calendar-wrapper/po-calendar-wrapper.component.d.ts +9 -3
- package/lib/components/po-calendar/po-calendar.component.d.ts +28 -3
- package/lib/components/po-calendar/services/po-calendar.lang.service.d.ts +2 -0
- package/lib/components/po-dynamic/po-dynamic-form/interfaces/po-dynamic-form-field.interface.d.ts +58 -7
- package/lib/components/po-field/index.d.ts +3 -0
- package/lib/components/po-field/po-datepicker-range/po-datepicker-range-base.component.d.ts +54 -0
- package/lib/components/po-field/po-datepicker-range/po-datepicker-range.component.d.ts +18 -0
- package/lib/components/po-field/po-textarea/po-textarea.component.d.ts +2 -1
- package/lib/components/po-field/po-timepicker/enums/po-timepicker-iso-format.enum.d.ts +13 -0
- package/lib/components/po-field/po-timepicker/index.d.ts +3 -0
- package/lib/components/po-field/po-timepicker/po-timepicker-base.component.d.ts +374 -0
- package/lib/components/po-field/po-timepicker/po-timepicker.component.d.ts +206 -0
- package/lib/components/po-field/po-timepicker/po-timepicker.literals.d.ts +46 -0
- package/lib/components/po-field/po-timepicker/po-timepicker.module.d.ts +7 -0
- package/lib/components/po-search/po-search.component.d.ts +0 -1
- package/lib/components/po-timer/enums/po-timer-format.enum.d.ts +13 -0
- package/lib/components/po-timer/index.d.ts +4 -0
- package/lib/components/po-timer/po-timer-base.component.d.ts +255 -0
- package/lib/components/po-timer/po-timer-scroll.helper.d.ts +40 -0
- package/lib/components/po-timer/po-timer.component.d.ts +208 -0
- package/lib/components/po-timer/po-timer.literals.d.ts +22 -0
- package/lib/components/po-timer/po-timer.module.d.ts +6 -0
- package/package.json +4 -4
- package/po-ui-ng-components-21.9.0.tgz +0 -0
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-update/v14/index.js +1 -1
- package/schematics/ng-update/v15/index.js +1 -1
- package/schematics/ng-update/v16/index.js +1 -1
- package/schematics/ng-update/v17/index.js +1 -1
- package/schematics/ng-update/v18/index.js +2 -2
- package/schematics/ng-update/v19/index.js +2 -2
- package/schematics/ng-update/v2/index.js +1 -1
- package/schematics/ng-update/v20/index.js +2 -2
- package/schematics/ng-update/v21/index.js +1 -1
- package/schematics/ng-update/v3/index.js +1 -1
- package/schematics/ng-update/v4/index.js +1 -1
- package/schematics/ng-update/v5/index.js +1 -1
- package/schematics/ng-update/v6/index.js +1 -1
- package/types/po-ui-ng-components.d.ts +1533 -164
- package/po-ui-ng-components-21.8.0.tgz +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import { PoLanguageService } from '../../services/po-language/po-language.service';
|
|
4
|
+
import { PoTimerFormat } from './enums/po-timer-format.enum';
|
|
5
|
+
/**
|
|
6
|
+
* @docsPrivate
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
*
|
|
10
|
+
* O `po-timer` é um componente de seleção de horário que apresenta colunas de horas, minutos e, opcionalmente, segundos
|
|
11
|
+
* para que a pessoa usuária escolha um horário de forma intuitiva.
|
|
12
|
+
*
|
|
13
|
+
* O componente é recomendado para cenários onde é necessário selecionar um horário específico, podendo ser utilizado
|
|
14
|
+
* de forma independente ou integrado ao `po-timepicker` como painel flutuante de seleção.
|
|
15
|
+
*
|
|
16
|
+
* O valor de saída segue o formato ISO 8601 para horários (`HH:mm` ou `HH:mm:ss`).
|
|
17
|
+
*
|
|
18
|
+
* **Importante:**
|
|
19
|
+
* - Horários fora do intervalo (`p-min-time` / `p-max-time`) aparecem desabilitados sem alterar o *model*.
|
|
20
|
+
*
|
|
21
|
+
* #### Boas práticas
|
|
22
|
+
*
|
|
23
|
+
* - Utilize o formato de 24 horas quando o contexto for profissional ou técnico (ex: agendamentos, logs).
|
|
24
|
+
* - Utilize o formato de 12 horas (AM/PM) quando o público-alvo estiver habituado a esse padrão.
|
|
25
|
+
* - Defina intervalos de minutos adequados ao contexto: intervalos de 5 minutos para agendamentos gerais,
|
|
26
|
+
* intervalos de 15 minutos para reuniões, ou intervalos de 1 minuto para precisão.
|
|
27
|
+
* - Configure limites mínimo e máximo para impedir seleção de horários inválidos no contexto da aplicação.
|
|
28
|
+
*
|
|
29
|
+
* #### Acessibilidade tratada no componente
|
|
30
|
+
*
|
|
31
|
+
* Algumas diretrizes de acessibilidade já são tratadas no componente, internamente, e não podem ser alteradas pelo
|
|
32
|
+
* proprietário do conteúdo. São elas:
|
|
33
|
+
*
|
|
34
|
+
* - Navegação por teclado: O componente permite interação via tecla Tab entre as colunas e navegação nas células
|
|
35
|
+
* por meio das setas direcionais (Arrow Up/Down).
|
|
36
|
+
* - Foco visual: A área de foco possui espessura de pelo menos 2 pixels CSS e não é sobreposta por outros elementos da tela,
|
|
37
|
+
* garantindo visibilidade para usuários que utilizam teclado.
|
|
38
|
+
* [WCAG 2.4.12: Focus Appearance](https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance-enhanced)
|
|
39
|
+
* - Leitores de tela: Cada coluna e célula possui atributos ARIA para correta leitura por leitores de tela
|
|
40
|
+
* como NVDA e VoiceOver.
|
|
41
|
+
*
|
|
42
|
+
* #### Tokens customizáveis
|
|
43
|
+
*
|
|
44
|
+
* É possível alterar o estilo do componente usando os seguintes tokens (CSS):
|
|
45
|
+
*
|
|
46
|
+
* > Para maiores informações, acesse o guia [Personalizando o Tema Padrão com Tokens CSS](https://po-ui.io/guides/theme-customization).
|
|
47
|
+
*
|
|
48
|
+
* | Propriedade | Descrição | Valor Padrão |
|
|
49
|
+
* |--------------------------------|------------------------------------------------------|-----------------------------------|
|
|
50
|
+
* | **Base** | | |
|
|
51
|
+
* | `--background` | Cor de fundo | `var(--color-neutral-light-00)` |
|
|
52
|
+
* | `--border-color` | Cor da borda | `var(--color-neutral-light-20)` |
|
|
53
|
+
* | `--border-radius` | Raio da borda | `var(--border-radius-md)` |
|
|
54
|
+
* | `--border-width` | Largura da borda | `var(--border-width-sm)` |
|
|
55
|
+
* | `--shadow` | Contém o valor da sombra do elemento | `var(--shadow-md)` |
|
|
56
|
+
* | **Display** | | |
|
|
57
|
+
* | `--color-display` | Cor da fonte do display | `var(--color-brand-01-base)` |
|
|
58
|
+
* | `--font-weight-display` | Peso da fonte do display | `var(--font-weight-bold)` |
|
|
59
|
+
* | `--border-radius-display` | Raio da borda do display | `var(--border-radius-md)` |
|
|
60
|
+
* | **Hover** | | |
|
|
61
|
+
* | `--color-hover-display` | Cor da fonte do display ao passar o mouse | `var(--color-brand-01-darkest)` |
|
|
62
|
+
* | `--background-hover-display` | Cor de fundo do display ao passar o mouse | `var(--color-brand-01-lighter)` |
|
|
63
|
+
* | **Focus** | | |
|
|
64
|
+
* | `--outline-color-focused-display` | Cor do outline do estado de focus | `var(--color-brand-01-darkest)` |
|
|
65
|
+
* | **Pressed** | | |
|
|
66
|
+
* | `--background-pressed-display` | Cor de fundo do display ao pressionar | `var(--color-brand-01-light)` |
|
|
67
|
+
* | **Disabled** | | |
|
|
68
|
+
* | `--color-disabled-display` | Cor da fonte do display desabilitado | `var(--color-neutral-light-30)` |
|
|
69
|
+
* | **Transitions** | | |
|
|
70
|
+
* | `--transition-duration` | Duração da transição do display | `var(--duration-extra-fast)` |
|
|
71
|
+
* | `--transition-property` | Atributo da transição do display | `all` |
|
|
72
|
+
* | `--transition-timing` | Tipo de transição do display | `var(--timing-standart)` |
|
|
73
|
+
*/
|
|
74
|
+
export declare class PoTimerBaseComponent implements ControlValueAccessor {
|
|
75
|
+
protected languageService: PoLanguageService;
|
|
76
|
+
private _format;
|
|
77
|
+
private _locale;
|
|
78
|
+
private _maxTime;
|
|
79
|
+
private _minTime;
|
|
80
|
+
private _minuteInterval;
|
|
81
|
+
private _secondInterval;
|
|
82
|
+
private _showSeconds;
|
|
83
|
+
private _size?;
|
|
84
|
+
private _initialSize;
|
|
85
|
+
private readonly shortLanguage;
|
|
86
|
+
protected onChangePropagate: (value: string) => void;
|
|
87
|
+
protected onTouched: () => void;
|
|
88
|
+
/**
|
|
89
|
+
* @optional
|
|
90
|
+
*
|
|
91
|
+
* @description
|
|
92
|
+
*
|
|
93
|
+
* Evento disparado ao selecionar um horário.
|
|
94
|
+
* Retorna uma `string` no formato ISO 8601 (`HH:mm` ou `HH:mm:ss`).
|
|
95
|
+
*/
|
|
96
|
+
change: EventEmitter<string>;
|
|
97
|
+
/**
|
|
98
|
+
* @optional
|
|
99
|
+
*
|
|
100
|
+
* @description
|
|
101
|
+
*
|
|
102
|
+
* Define um valor inicial para o componente no formato ISO 8601 (`HH:mm` ou `HH:mm:ss`).
|
|
103
|
+
*/
|
|
104
|
+
set value(value: string);
|
|
105
|
+
get value(): string;
|
|
106
|
+
/**
|
|
107
|
+
* @optional
|
|
108
|
+
*
|
|
109
|
+
* @description
|
|
110
|
+
*
|
|
111
|
+
* Define o formato de exibição do timer.
|
|
112
|
+
*
|
|
113
|
+
* Valores válidos:
|
|
114
|
+
* - `24`: formato de 24 horas (padrão)
|
|
115
|
+
* - `12`: formato de 12 horas com indicador AM/PM
|
|
116
|
+
*
|
|
117
|
+
* @default `24`
|
|
118
|
+
*/
|
|
119
|
+
set format(value: PoTimerFormat);
|
|
120
|
+
get format(): PoTimerFormat;
|
|
121
|
+
/**
|
|
122
|
+
* @optional
|
|
123
|
+
*
|
|
124
|
+
* @description
|
|
125
|
+
*
|
|
126
|
+
* Idioma do componente.
|
|
127
|
+
*
|
|
128
|
+
* > O locale padrão será recuperado com base no [`PoI18nService`](/documentation/po-i18n) ou *browser*.
|
|
129
|
+
*/
|
|
130
|
+
set locale(locale: string);
|
|
131
|
+
get locale(): string;
|
|
132
|
+
/**
|
|
133
|
+
* @optional
|
|
134
|
+
*
|
|
135
|
+
* @description
|
|
136
|
+
*
|
|
137
|
+
* Define o horário máximo permitido para seleção.
|
|
138
|
+
* Horários posteriores ao limite ficam desabilitados.
|
|
139
|
+
*
|
|
140
|
+
* Formato aceito: `HH:mm` ou `HH:mm:ss`.
|
|
141
|
+
*/
|
|
142
|
+
set maxTime(value: string);
|
|
143
|
+
get maxTime(): string;
|
|
144
|
+
/**
|
|
145
|
+
* @optional
|
|
146
|
+
*
|
|
147
|
+
* @description
|
|
148
|
+
*
|
|
149
|
+
* Define o horário mínimo permitido para seleção.
|
|
150
|
+
* Horários anteriores ao limite ficam desabilitados.
|
|
151
|
+
*
|
|
152
|
+
* Formato aceito: `HH:mm` ou `HH:mm:ss`.
|
|
153
|
+
*/
|
|
154
|
+
set minTime(value: string);
|
|
155
|
+
get minTime(): string;
|
|
156
|
+
/**
|
|
157
|
+
* @optional
|
|
158
|
+
*
|
|
159
|
+
* @description
|
|
160
|
+
*
|
|
161
|
+
* Define o intervalo entre os minutos exibidos no painel.
|
|
162
|
+
*
|
|
163
|
+
* @default `5`
|
|
164
|
+
*/
|
|
165
|
+
set minuteInterval(value: number);
|
|
166
|
+
get minuteInterval(): number;
|
|
167
|
+
/**
|
|
168
|
+
* @optional
|
|
169
|
+
*
|
|
170
|
+
* @description
|
|
171
|
+
*
|
|
172
|
+
* Define o intervalo entre os segundos exibidos no painel.
|
|
173
|
+
* Utilizado apenas quando `p-show-seconds` está ativo.
|
|
174
|
+
*
|
|
175
|
+
* @default `1`
|
|
176
|
+
*/
|
|
177
|
+
set secondInterval(value: number);
|
|
178
|
+
get secondInterval(): number;
|
|
179
|
+
/**
|
|
180
|
+
* @optional
|
|
181
|
+
*
|
|
182
|
+
* @description
|
|
183
|
+
*
|
|
184
|
+
* Exibe a coluna de segundos no painel de seleção.
|
|
185
|
+
*
|
|
186
|
+
* @default `false`
|
|
187
|
+
*/
|
|
188
|
+
set showSeconds(value: boolean);
|
|
189
|
+
get showSeconds(): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* @optional
|
|
192
|
+
*
|
|
193
|
+
* @description
|
|
194
|
+
*
|
|
195
|
+
* Define o tamanho do componente.
|
|
196
|
+
*
|
|
197
|
+
* > Caso a acessibilidade AA não esteja configurada, o tamanho `medium` será mantido.
|
|
198
|
+
* Para mais detalhes, consulte a documentação do [po-theme](https://po-ui.io/documentation/po-theme).
|
|
199
|
+
*
|
|
200
|
+
* @default `medium`
|
|
201
|
+
*/
|
|
202
|
+
set size(value: string);
|
|
203
|
+
get size(): string;
|
|
204
|
+
literals: {
|
|
205
|
+
hours: string;
|
|
206
|
+
minutes: string;
|
|
207
|
+
seconds: string;
|
|
208
|
+
};
|
|
209
|
+
hours: Array<number>;
|
|
210
|
+
minutes: Array<number>;
|
|
211
|
+
seconds: Array<number>;
|
|
212
|
+
selectedHour: number;
|
|
213
|
+
selectedMinute: number;
|
|
214
|
+
selectedSecond: number;
|
|
215
|
+
period: string;
|
|
216
|
+
constructor(languageService: PoLanguageService);
|
|
217
|
+
get is12HourFormat(): boolean;
|
|
218
|
+
protected onThemeChange(): void;
|
|
219
|
+
/** Gera a lista de horas disponíveis de acordo com o formato. */
|
|
220
|
+
protected generateHours(): void;
|
|
221
|
+
/** Gera a lista de minutos de acordo com o intervalo configurado. */
|
|
222
|
+
protected generateMinutes(): void;
|
|
223
|
+
/** Gera a lista de segundos de acordo com o intervalo configurado. */
|
|
224
|
+
protected generateSeconds(): void;
|
|
225
|
+
/** Formata um número com dois dígitos. */
|
|
226
|
+
protected formatValue(value: number): string;
|
|
227
|
+
/** Verifica se uma hora está desabilitada com base nos limites min/max. */
|
|
228
|
+
protected isHourDisabled(hour: number): boolean;
|
|
229
|
+
/** Verifica se um minuto está desabilitado com base nos limites min/max e hora selecionada. */
|
|
230
|
+
protected isMinuteDisabled(minute: number): boolean;
|
|
231
|
+
/** Verifica se um segundo está desabilitado com base nos limites min/max, hora e minuto selecionados. */
|
|
232
|
+
protected isSecondDisabled(second: number): boolean;
|
|
233
|
+
protected isMinuteAllowedForHour(hour: number, minute: number): boolean;
|
|
234
|
+
protected isSecondAllowed(hour: number, minute: number, second: number): boolean;
|
|
235
|
+
/** Gera o valor ISO 8601 com base na seleção atual. */
|
|
236
|
+
protected buildTimeValue(): string;
|
|
237
|
+
/** Define o horário a partir de uma string ISO. */
|
|
238
|
+
setTimeFromString(time: string): void;
|
|
239
|
+
/** Converte hora 24h para formato de exibicao 12h com periodo. */
|
|
240
|
+
private convertTo12HourDisplay;
|
|
241
|
+
writeValue(value: any): void;
|
|
242
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
243
|
+
registerOnTouched(fn: () => void): void;
|
|
244
|
+
setDisabledState(_isDisabled: boolean): void;
|
|
245
|
+
protected emitChange(): void;
|
|
246
|
+
protected callOnTouched(): void;
|
|
247
|
+
private updateModel;
|
|
248
|
+
/** Converte hora no formato atual para formato de 24 horas. */
|
|
249
|
+
protected convertTo24Hour(hour: number): number;
|
|
250
|
+
/** Extrai componente do tempo (hora, minuto ou segundo) de uma string. */
|
|
251
|
+
protected parseTimeComponent(time: string, component: 'hour' | 'minute' | 'second'): number;
|
|
252
|
+
private applySizeBasedOnA11y;
|
|
253
|
+
private isValidTimeString;
|
|
254
|
+
private setLiterals;
|
|
255
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @docsPrivate
|
|
3
|
+
*
|
|
4
|
+
* Helper com funcoes puras de matematica e layout para o infinity scroll
|
|
5
|
+
* do po-timer. Nenhuma dessas funcoes acessa estado do componente — recebem
|
|
6
|
+
* e devolvem apenas valores, facilitando testes unitarios isolados.
|
|
7
|
+
*/
|
|
8
|
+
export declare class PoTimerScrollHelper {
|
|
9
|
+
/**
|
|
10
|
+
* Normaliza o offset para o intervalo [sectionHeight, 2 * sectionHeight).
|
|
11
|
+
*
|
|
12
|
+
* Matematica:
|
|
13
|
+
* mod = ((offset - sH) % sH + sH) % sH → resultado em [0, sH)
|
|
14
|
+
* retorno = mod + sH → resultado em [sH, 2*sH)
|
|
15
|
+
*
|
|
16
|
+
* Funciona para qualquer valor de offset (positivo, negativo, multiplos).
|
|
17
|
+
*/
|
|
18
|
+
static wrapOffset(offset: number, sectionHeight: number): number;
|
|
19
|
+
/**
|
|
20
|
+
* Calcula o passo (em px) por item, incluindo o gap entre itens.
|
|
21
|
+
*
|
|
22
|
+
* Para N itens num flex-column com altura H, gap G e padding P:
|
|
23
|
+
* scrollHeight = N*H + (N-1)*G + 2*P
|
|
24
|
+
* passo = H + G = (scrollHeight - 2*P + G) / N
|
|
25
|
+
*/
|
|
26
|
+
static getCellStep(itemsEl: HTMLElement, displayCount: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* Calcula o indice no displayArray do item visivel no topo a partir do offset.
|
|
29
|
+
* Usa Math.round para snap ao item mais proximo.
|
|
30
|
+
*/
|
|
31
|
+
static computeTopDisplayIndex(offset: number, step: number, displayLength: number): number;
|
|
32
|
+
/**
|
|
33
|
+
* Repete o array fonte o numero necessario de vezes para manter
|
|
34
|
+
* o infinity scroll com pelo menos INFINITY_SCROLL_MIN_ITEMS itens.
|
|
35
|
+
*
|
|
36
|
+
* Quando o array fonte tem menos de 6 itens, retorna uma copia simples
|
|
37
|
+
* (sem repeticao), pois o infinity scroll nao e utilizado.
|
|
38
|
+
*/
|
|
39
|
+
static repeatArray(source: Array<number>): Array<number>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { AfterViewInit, AfterViewChecked, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { PoTimerBaseComponent } from './po-timer-base.component';
|
|
3
|
+
/** Tipo dos eixos das colunas. */
|
|
4
|
+
type PoTimerColumnType = 'hour' | 'minute' | 'second' | 'period';
|
|
5
|
+
/**
|
|
6
|
+
* @docsPrivate
|
|
7
|
+
*
|
|
8
|
+
* @docsExtends PoTimerBaseComponent
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* <example name="po-timer-basic" title="PO Timer Basic">
|
|
13
|
+
* <file name="sample-po-timer-basic/sample-po-timer-basic.component.html"> </file>
|
|
14
|
+
* <file name="sample-po-timer-basic/sample-po-timer-basic.component.ts"> </file>
|
|
15
|
+
* </example>
|
|
16
|
+
*
|
|
17
|
+
* <example name="po-timer-labs" title="PO Timer Labs">
|
|
18
|
+
* <file name="sample-po-timer-labs/sample-po-timer-labs.component.html"> </file>
|
|
19
|
+
* <file name="sample-po-timer-labs/sample-po-timer-labs.component.ts"> </file>
|
|
20
|
+
* </example>
|
|
21
|
+
*
|
|
22
|
+
* <example name="po-timer-alarm" title="PO Timer - Alarm">
|
|
23
|
+
* <file name="sample-po-timer-alarm/sample-po-timer-alarm.component.html"> </file>
|
|
24
|
+
* <file name="sample-po-timer-alarm/sample-po-timer-alarm.component.ts"> </file>
|
|
25
|
+
* </example>
|
|
26
|
+
*
|
|
27
|
+
* <example name="po-timer-shift" title="PO Timer - Shift">
|
|
28
|
+
* <file name="sample-po-timer-shift/sample-po-timer-shift.component.html"> </file>
|
|
29
|
+
* <file name="sample-po-timer-shift/sample-po-timer-shift.component.ts"> </file>
|
|
30
|
+
* </example>
|
|
31
|
+
*/
|
|
32
|
+
export declare class PoTimerComponent extends PoTimerBaseComponent implements OnInit, OnChanges, AfterViewInit, AfterViewChecked, OnDestroy {
|
|
33
|
+
hourCells: QueryList<ElementRef>;
|
|
34
|
+
minuteCells: QueryList<ElementRef>;
|
|
35
|
+
secondCells: QueryList<ElementRef>;
|
|
36
|
+
periodCells: QueryList<ElementRef>;
|
|
37
|
+
hourItemsRefs: QueryList<ElementRef<HTMLElement>>;
|
|
38
|
+
minuteItemsRefs: QueryList<ElementRef<HTMLElement>>;
|
|
39
|
+
secondItemsRefs: QueryList<ElementRef<HTMLElement>>;
|
|
40
|
+
displayHours: Array<number>;
|
|
41
|
+
displayMinutes: Array<number>;
|
|
42
|
+
displaySeconds: Array<number>;
|
|
43
|
+
boundaryTab: EventEmitter<{
|
|
44
|
+
direction: "forward" | "backward";
|
|
45
|
+
event: KeyboardEvent;
|
|
46
|
+
column: PoTimerColumnType;
|
|
47
|
+
}>;
|
|
48
|
+
private readonly changeDetector;
|
|
49
|
+
private readonly ngZone;
|
|
50
|
+
private readonly domDocument;
|
|
51
|
+
private hasViewInitialized;
|
|
52
|
+
private currentRenderedSize;
|
|
53
|
+
/** ID do requestAnimationFrame pendente para throttle do wheel. */
|
|
54
|
+
private wheelRafId;
|
|
55
|
+
/**
|
|
56
|
+
* Offset atual (em px) de cada coluna, mantido em JS.
|
|
57
|
+
* O container de itens e posicionado via translateY(-offset).
|
|
58
|
+
* O offset e mantido sempre no intervalo [sectionHeight, 2*sectionHeight)
|
|
59
|
+
* para que o salto de reposicionamento seja sempre invisivel (as secoes
|
|
60
|
+
* sao identicas por serem copias do mesmo array fonte).
|
|
61
|
+
*/
|
|
62
|
+
private columnOffsets;
|
|
63
|
+
/**
|
|
64
|
+
* Indice no displayArray do item focado em cada coluna.
|
|
65
|
+
* Usado para redirecionar o foco ao botao correto ao entrar na coluna via Tab.
|
|
66
|
+
*/
|
|
67
|
+
private focusedDisplayIndex;
|
|
68
|
+
activeDescendantIds: Record<PoTimerColumnType, string>;
|
|
69
|
+
disabledMinuteCache: Set<number>;
|
|
70
|
+
disabledSecondCache: Set<number>;
|
|
71
|
+
constructor();
|
|
72
|
+
ngOnInit(): void;
|
|
73
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
74
|
+
ngAfterViewInit(): void;
|
|
75
|
+
ngAfterViewChecked(): void;
|
|
76
|
+
ngOnDestroy(): void;
|
|
77
|
+
onSelectHour(hour: number): void;
|
|
78
|
+
onSelectMinute(minute: number): void;
|
|
79
|
+
onSelectSecond(second: number): void;
|
|
80
|
+
onSelectPeriod(newPeriod: string): void;
|
|
81
|
+
onCellFocus(type: PoTimerColumnType, displayIndex: number): void;
|
|
82
|
+
getCellTabIndex(type: PoTimerColumnType, displayIndex: number): number;
|
|
83
|
+
onCellKeydown(event: KeyboardEvent, type: PoTimerColumnType): void;
|
|
84
|
+
onPeriodKeydown(event: KeyboardEvent): void;
|
|
85
|
+
onColumnWheel(event: WheelEvent, type: PoTimerColumnType): void;
|
|
86
|
+
writeValue(time: string): void;
|
|
87
|
+
trackByIndex(index: number, _item: number): number;
|
|
88
|
+
focusFirstVisibleCell(): void;
|
|
89
|
+
focusLastVisibleCell(): void;
|
|
90
|
+
initAllColumnOffsets(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Posiciona o container de itens na secao do meio do array repetido,
|
|
93
|
+
* alinhando o item selecionado ao topo da janela visivel.
|
|
94
|
+
*
|
|
95
|
+
* Estrutura do array repetido (exemplo sourceLength = 24, repeats = 3):
|
|
96
|
+
* [secao 0: itens 0-23] [secao 1: itens 0-23] [secao 2: itens 0-23]
|
|
97
|
+
* ^--- usuario fica aqui (offset em [sH, 2*sH))
|
|
98
|
+
*
|
|
99
|
+
* Usar a secao do meio garante que qualquer deslize para cima ou para baixo
|
|
100
|
+
* tem espaco antes de precisar fazer o wrap.
|
|
101
|
+
*/
|
|
102
|
+
private initColumnOffset;
|
|
103
|
+
private getFirstAvailableIndexByType;
|
|
104
|
+
private getReferenceHourForConstraints;
|
|
105
|
+
private getReferenceMinuteForConstraints;
|
|
106
|
+
private isValueDisabledByType;
|
|
107
|
+
/**
|
|
108
|
+
* Desloca a coluna pelo numero de passos indicado e aplica o wrap modular.
|
|
109
|
+
*
|
|
110
|
+
* O wrap mantem o offset em [sectionHeight, 2*sectionHeight), aproveitando
|
|
111
|
+
* o fato de que as secoes sao identicas — o salto e impercetivel visualmente.
|
|
112
|
+
*/
|
|
113
|
+
private scrollColumnByStep;
|
|
114
|
+
private wrapOffset;
|
|
115
|
+
private getCellStep;
|
|
116
|
+
/**
|
|
117
|
+
* Foca o botao nativo (<button> interno ao po-button) no indice indicado
|
|
118
|
+
* do displayArray da coluna. O po-button tem tabindex=-1 para nao aparecer
|
|
119
|
+
* no fluxo natural do Tab, mas pode receber foco programatico.
|
|
120
|
+
*/
|
|
121
|
+
private focusButtonAt;
|
|
122
|
+
private focusActiveButton;
|
|
123
|
+
private computeTopDisplayIndex;
|
|
124
|
+
/**
|
|
125
|
+
* Foca a proxima coluna visivel do componente.
|
|
126
|
+
* Se a coluna atual for a ultima, nao cancela o evento e deixa o browser
|
|
127
|
+
* mover o foco para o proximo elemento focavel apos o componente.
|
|
128
|
+
*/
|
|
129
|
+
private focusNextColumn;
|
|
130
|
+
/**
|
|
131
|
+
* Foca a coluna anterior visivel do componente.
|
|
132
|
+
* Se a coluna atual for a primeira, nao cancela o evento e deixa o browser
|
|
133
|
+
* mover o foco para o elemento focavel antes do componente.
|
|
134
|
+
*/
|
|
135
|
+
private focusPreviousColumn;
|
|
136
|
+
/**
|
|
137
|
+
* Retorna, em ordem DOM, os elementos focaveis de todas as colunas visiveis.
|
|
138
|
+
* Inclui o div da coluna AM/PM (se visivel), cujos botoes internos recebem
|
|
139
|
+
* o foco diretamente pois nao usam o padrao de roving focus.
|
|
140
|
+
*/
|
|
141
|
+
private getVisibleColumnTypes;
|
|
142
|
+
private getCellsForType;
|
|
143
|
+
/** Atualiza aria-activedescendant para o indice focado no displayArray. */
|
|
144
|
+
private updateActiveDescendant;
|
|
145
|
+
/**
|
|
146
|
+
* Move o foco para o proximo item habilitado na direcao indicada.
|
|
147
|
+
* So aplica translate quando o item focado fica parcial ou totalmente fora da viewport.
|
|
148
|
+
*/
|
|
149
|
+
private moveFocusByStep;
|
|
150
|
+
private movePeriodFocusByStep;
|
|
151
|
+
private selectFocusedPeriod;
|
|
152
|
+
private getFocusableDisplayIndex;
|
|
153
|
+
/** Seleciona o item atualmente focado na coluna. */
|
|
154
|
+
private selectFocusedItem;
|
|
155
|
+
private shouldTranslateToRevealFocusedItem;
|
|
156
|
+
private getStepsToRevealFocusedItem;
|
|
157
|
+
private getColumnViewportHeight;
|
|
158
|
+
private getNextEnabledDisplayIndex;
|
|
159
|
+
private getForwardDistance;
|
|
160
|
+
private getNormalizedDisplayIndex;
|
|
161
|
+
private getDisplayIndexForSourceNearViewport;
|
|
162
|
+
private getItemsElement;
|
|
163
|
+
private normalizeFocusedIndex;
|
|
164
|
+
private getNormalizedFocusedIndex;
|
|
165
|
+
private getCurrentFocusedDisplayIndex;
|
|
166
|
+
private getDomFocusedDisplayIndex;
|
|
167
|
+
private isDisplayIndexDisabled;
|
|
168
|
+
private getSelectedValue;
|
|
169
|
+
private buildDisplayArrays;
|
|
170
|
+
/** Reconstroi os caches de minutos e segundos desabilitados. */
|
|
171
|
+
private rebuildDisabledCaches;
|
|
172
|
+
private getFirstAvailableMinuteForCurrentHour;
|
|
173
|
+
private getFirstAvailableSecondForCurrentHourAndMinute;
|
|
174
|
+
private realignColumnsToSelection;
|
|
175
|
+
private refreshRovingTabIndex;
|
|
176
|
+
private repeatArray;
|
|
177
|
+
private getSourceArray;
|
|
178
|
+
private getDisplayArray;
|
|
179
|
+
/**
|
|
180
|
+
* Propaga atributos ARIA (role, aria-selected, aria-setsize, aria-posinset)
|
|
181
|
+
* dos elementos host <po-button> para os elementos nativos <button> internos,
|
|
182
|
+
* garantindo que leitores de tela como NVDA recebam a semantica correta.
|
|
183
|
+
*
|
|
184
|
+
* Usa a secao fixa do meio [sourceLength, 2*sourceLength) como canonica.
|
|
185
|
+
* Quando o item focado esta fora dessa secao (na fronteira do infinity scroll),
|
|
186
|
+
* ele substitui o item equivalente na secao fixa para manter exatamente
|
|
187
|
+
* sourceLength itens com role="option".
|
|
188
|
+
*
|
|
189
|
+
* Duplicatas recebem aria-hidden="true" e role="none" no <button> nativo
|
|
190
|
+
* (nao apenas no host <po-button>), pois NVDA ignora aria-hidden em
|
|
191
|
+
* elementos customizados e conta <button> filhos de role="listbox".
|
|
192
|
+
*/
|
|
193
|
+
private syncAriaToNativeButtons;
|
|
194
|
+
/**
|
|
195
|
+
* Determina se um item do displayArray e canonico para fins de ARIA.
|
|
196
|
+
*
|
|
197
|
+
* - Sem infinity scroll: todos sao canonicos.
|
|
198
|
+
* - Com infinity scroll: a secao que contem o item focado e canonica.
|
|
199
|
+
*/
|
|
200
|
+
private isCanonicalDisplayItem;
|
|
201
|
+
/**
|
|
202
|
+
* Sincroniza os atributos ARIA de um unico par host/nativeButton.
|
|
203
|
+
* Chamado tanto por syncAriaToNativeButtons (batch) quanto por
|
|
204
|
+
* focusButtonAt (antes do .focus()) para evitar leitura duplicada.
|
|
205
|
+
*/
|
|
206
|
+
private syncSingleButtonAria;
|
|
207
|
+
}
|
|
208
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const poTimerLiterals: {
|
|
2
|
+
en: {
|
|
3
|
+
hours: string;
|
|
4
|
+
minutes: string;
|
|
5
|
+
seconds: string;
|
|
6
|
+
};
|
|
7
|
+
es: {
|
|
8
|
+
hours: string;
|
|
9
|
+
minutes: string;
|
|
10
|
+
seconds: string;
|
|
11
|
+
};
|
|
12
|
+
pt: {
|
|
13
|
+
hours: string;
|
|
14
|
+
minutes: string;
|
|
15
|
+
seconds: string;
|
|
16
|
+
};
|
|
17
|
+
ru: {
|
|
18
|
+
hours: string;
|
|
19
|
+
minutes: string;
|
|
20
|
+
seconds: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@po-ui/ng-components",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.9.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": "~21.0.3",
|
|
25
|
-
"@po-ui/style": "21.
|
|
26
|
-
"@po-ui/ng-schematics": "21.
|
|
25
|
+
"@po-ui/style": "21.9.0",
|
|
26
|
+
"@po-ui/ng-schematics": "21.9.0",
|
|
27
27
|
"echarts": "^5.6.0",
|
|
28
28
|
"tslib": "^2.6.2"
|
|
29
29
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@angular/platform-browser-dynamic": "^21",
|
|
39
39
|
"@angular/router": "^21",
|
|
40
40
|
"@angular-devkit/schematics": "^21",
|
|
41
|
-
"@po-ui/style": "21.
|
|
41
|
+
"@po-ui/style": "21.9.0",
|
|
42
42
|
"rxjs": "~7.8.1",
|
|
43
43
|
"zone.js": "~0.15.0"
|
|
44
44
|
},
|
|
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', '21.
|
|
21
|
+
(0, package_config_1.addPackageToPackageJson)(tree, '@po-ui/ng-components', '21.9.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)('21.
|
|
9
|
+
return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('21.9.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)('21.
|
|
14
|
+
return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('21.9.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)('21.
|
|
9
|
+
return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('21.9.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)('21.
|
|
9
|
+
return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('21.9.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)('21.
|
|
43
|
+
return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('21.9.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
return (0, schematics_1.chain)([
|
|
47
|
-
(0, package_config_1.updatePackageJson)('21.
|
|
47
|
+
(0, package_config_1.updatePackageJson)('21.9.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)('21.
|
|
43
|
+
return (0, schematics_1.chain)([(0, package_config_1.updatePackageJson)('21.9.0', changes_1.updateDepedenciesVersion), createUpgradeRule(), postUpdate()]);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
return (0, schematics_1.chain)([
|
|
47
|
-
(0, package_config_1.updatePackageJson)('21.
|
|
47
|
+
(0, package_config_1.updatePackageJson)('21.9.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('21.
|
|
13
|
+
updatePackageJson('21.9.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(),
|