@seniorsistemas/angular-components 19.0.9 → 19.1.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/breadcrumb/lib/breadcrumb/breadcrumb-models.d.ts +2 -0
- package/button/lib/button/button.component.d.ts +8 -2
- package/checkbox/lib/checkbox/checkbox.component.d.ts +5 -1
- package/dialog/lib/src/dialog/dialog.component.d.ts +7 -1
- package/esm2022/accordion/lib/accordion/components/accordion-panel/accordion-panel.component.mjs +2 -2
- package/esm2022/breadcrumb/lib/breadcrumb/breadcrumb-models.mjs +1 -1
- package/esm2022/breadcrumb/lib/breadcrumb/breadcrumb.component.mjs +3 -3
- package/esm2022/breadcrumb/lib/dynamic-breadcrumb/dynamic-breadcrumb.component.mjs +8 -6
- package/esm2022/button/lib/button/button.component.mjs +20 -8
- package/esm2022/checkbox/lib/checkbox/checkbox.component.mjs +8 -5
- package/esm2022/confirm-dialog/lib/popup-confirm-dialog/popup-confirm-dialog.component.mjs +2 -2
- package/esm2022/content-generator/lib/content-generator/content-generator.component.mjs +1 -1
- package/esm2022/dialog/lib/src/dialog/dialog.component.mjs +9 -3
- package/esm2022/dynamic-form/dynamic-form/components/grid/row/row.component.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/components/lookup/lookup.component.mjs +2 -2
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/bignumber/bignumber-field.component.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/boolean/boolean-radio-field/boolean-field.component.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/boolean/boolean-switch-field/boolean-switch-field.component.mjs +2 -2
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/button-field/button-field.component.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/number/number-field.component.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/password/password-field.component.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/radio-button/radio-button-field.component.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/select/select-field.component.mjs +2 -2
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/text/text-field.component.mjs +1 -1
- package/esm2022/empty-state/lib/empty-state/empty-state.component.mjs +1 -1
- package/esm2022/file-picker/lib/file-picker/file-picker.component.mjs +1 -1
- package/esm2022/global-search/lib/global-search/components/dropdown/global-search-dropdown-item.component.mjs +1 -1
- package/esm2022/global-search/lib/global-search/global-search.component.mjs +1 -1
- package/esm2022/help-popover/lib/help-popover/help-popover/help-popover.component.mjs +1 -1
- package/esm2022/image-cropper/lib/image-cropper/image-cropper.component.mjs +1 -1
- package/esm2022/inline-edit/lib/inline-edit/components/fields/inline-edit-number/inline-edit-number.component.mjs +1 -1
- package/esm2022/inline-edit/lib/inline-edit/components/inline-edit-item/inline-edit-item.component.mjs +1 -1
- package/esm2022/kanban/lib/kanban/components/kanban-column/kanban-column.component.mjs +1 -1
- package/esm2022/kanban/lib/kanban/components/kanban-item/kanban-item.component.mjs +1 -1
- package/esm2022/lib/locale/fallback.mjs +13 -2
- package/esm2022/navigation-button/lib/navigation-button/navigation-button.component.mjs +1 -1
- package/esm2022/object-card/lib/object-card/elements/field/object-card-field.component.mjs +1 -1
- package/esm2022/object-card/lib/object-card/elements/main/object-card-main.component.mjs +1 -1
- package/esm2022/paginator/lib/paginator/paginator.component.mjs +2 -2
- package/esm2022/picklist/lib/picklist/picklist.component.mjs +1 -1
- package/esm2022/profile-picture-picker/lib/profile-picture-picker/profile-picture-picker.component.mjs +1 -1
- package/esm2022/select/lib/select/components/select-option/select-option.component.mjs +3 -3
- package/esm2022/select/lib/select/select.component.mjs +132 -20
- package/esm2022/shared/lib/accessibility/paginator-accessibility.directive.mjs +182 -0
- package/esm2022/shared/lib/accessibility/table-checkbox-accessibility.directive.mjs +174 -0
- package/esm2022/shared/public-api.mjs +6 -4
- package/esm2022/switch/lib/switch/switch.component.mjs +19 -8
- package/esm2022/table/lib/table/table-paging/table-paging.component.mjs +1 -1
- package/esm2022/tiered-menu/lib/tiered-menu/components/tiered-menu/tiered-menu.component.mjs +18 -8
- package/esm2022/tiered-menu/lib/tiered-menu/components/tiered-menu-item/tiered-menu-item.component.mjs +1 -1
- package/esm2022/tiered-menu/lib/tiered-menu/services/tiered-menu.service.mjs +1 -1
- package/esm2022/tiered-menu/lib/tiered-menu/tiered-menu.directive.mjs +11 -3
- package/esm2022/tooltip/lib/tooltip/tooltip.component.mjs +17 -11
- package/esm2022/tooltip/lib/tooltip/tooltip.directive.mjs +108 -241
- package/esm2022/tooltip/lib/tooltip/tooltip.module.mjs +4 -6
- package/esm2022/topbar/lib/topbar/topbar.component.mjs +2 -2
- package/fesm2022/seniorsistemas-angular-components-accordion.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-accordion.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-breadcrumb.mjs +9 -7
- package/fesm2022/seniorsistemas-angular-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-button.mjs +19 -7
- package/fesm2022/seniorsistemas-angular-components-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-checkbox.mjs +7 -4
- package/fesm2022/seniorsistemas-angular-components-checkbox.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-confirm-dialog.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-content-generator.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-content-generator.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-dialog.mjs +8 -2
- package/fesm2022/seniorsistemas-angular-components-dialog.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs +11 -11
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-empty-state.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-empty-state.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-file-picker.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-file-picker.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-global-search.mjs +2 -2
- package/fesm2022/seniorsistemas-angular-components-global-search.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-help-popover.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-help-popover.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-image-cropper.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-image-cropper.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-inline-edit.mjs +2 -2
- package/fesm2022/seniorsistemas-angular-components-inline-edit.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-kanban.mjs +2 -2
- package/fesm2022/seniorsistemas-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-navigation-button.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-navigation-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-object-card.mjs +2 -2
- package/fesm2022/seniorsistemas-angular-components-object-card.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-paginator.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-paginator.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-picklist.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-picklist.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-profile-picture-picker.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-profile-picture-picker.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-select.mjs +133 -21
- package/fesm2022/seniorsistemas-angular-components-select.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-shared.mjs +354 -2
- package/fesm2022/seniorsistemas-angular-components-shared.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-switch.mjs +18 -7
- package/fesm2022/seniorsistemas-angular-components-switch.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-table.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-table.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tiered-menu.mjs +26 -8
- package/fesm2022/seniorsistemas-angular-components-tiered-menu.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tooltip.mjs +125 -254
- package/fesm2022/seniorsistemas-angular-components-tooltip.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-topbar.mjs +2 -2
- package/fesm2022/seniorsistemas-angular-components-topbar.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components.mjs +12 -1
- package/fesm2022/seniorsistemas-angular-components.mjs.map +1 -1
- package/package.json +1 -1
- package/select/lib/select/select.component.d.ts +23 -2
- package/shared/lib/accessibility/paginator-accessibility.directive.d.ts +30 -0
- package/shared/lib/accessibility/table-checkbox-accessibility.directive.d.ts +46 -0
- package/shared/public-api.d.ts +7 -5
- package/switch/lib/switch/switch.component.d.ts +9 -5
- package/tiered-menu/lib/tiered-menu/components/tiered-menu/tiered-menu.component.d.ts +1 -0
- package/tiered-menu/lib/tiered-menu/tiered-menu.directive.d.ts +4 -2
- package/tooltip/lib/tooltip/tooltip.component.d.ts +13 -7
- package/tooltip/lib/tooltip/tooltip.directive.d.ts +27 -40
- package/tooltip/lib/tooltip/tooltip.module.d.ts +3 -4
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Input, NgModule } from '@angular/core';
|
|
2
|
+
import { Component, Input, NgModule, Directive } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2 from '@seniorsistemas/angular-components/tooltip';
|
|
6
6
|
import { TooltipModule } from '@seniorsistemas/angular-components/tooltip';
|
|
7
|
+
import * as i1$1 from '@ngx-translate/core';
|
|
7
8
|
|
|
8
9
|
var EnumSeverity;
|
|
9
10
|
(function (EnumSeverity) {
|
|
@@ -82,9 +83,360 @@ function CheckDisabled(disabledField = 'disabled') {
|
|
|
82
83
|
};
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Diretiva para melhorar a acessibilidade dos botões do paginador PrimeNG
|
|
88
|
+
* Adiciona tabindex="0" aos botões habilitados e tabindex="-1" aos desabilitados
|
|
89
|
+
* Adiciona aria-labels traduzidos para os botões do paginador
|
|
90
|
+
*/
|
|
91
|
+
class PaginatorAccessibilityDirective {
|
|
92
|
+
el;
|
|
93
|
+
renderer;
|
|
94
|
+
translateService;
|
|
95
|
+
observer = null;
|
|
96
|
+
equalWebSpanMarker = 'data-equalweb-sr-only';
|
|
97
|
+
isObserverPaused = false;
|
|
98
|
+
observedPaginatorElement = null;
|
|
99
|
+
constructor(el, renderer, translateService) {
|
|
100
|
+
this.el = el;
|
|
101
|
+
this.renderer = renderer;
|
|
102
|
+
this.translateService = translateService;
|
|
103
|
+
}
|
|
104
|
+
ngOnInit() {
|
|
105
|
+
// Aguarda o próximo ciclo para garantir que o paginador foi renderizado
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
this.updatePaginatorButtons();
|
|
108
|
+
this.observePaginatorChanges();
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
ngOnDestroy() {
|
|
112
|
+
if (this.observer) {
|
|
113
|
+
this.observer.disconnect();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
updatePaginatorButtons() {
|
|
117
|
+
const paginatorElement = this.el.nativeElement.querySelector('p-paginator');
|
|
118
|
+
if (!paginatorElement) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
// Atualiza botões de navegação (first, prev, next, last)
|
|
122
|
+
const navigationSelectors = {
|
|
123
|
+
'.p-paginator-first': this.translateService.instant('platform.angular_components.aria_first_page'),
|
|
124
|
+
'.p-paginator-prev': this.translateService.instant('platform.angular_components.aria_previous_page'),
|
|
125
|
+
'.p-paginator-next': this.translateService.instant('platform.angular_components.aria_next_page'),
|
|
126
|
+
'.p-paginator-last': this.translateService.instant('platform.angular_components.aria_last_page'),
|
|
127
|
+
'.p-select-label': this.translateService.instant('platform.angular_components.aria_page_selection')
|
|
128
|
+
};
|
|
129
|
+
Object.entries(navigationSelectors).forEach(([selector, label]) => {
|
|
130
|
+
const button = paginatorElement.querySelector(selector);
|
|
131
|
+
if (button) {
|
|
132
|
+
const isDisabled = this.isButtonDisabled(button);
|
|
133
|
+
this.updateTabIndex(button, isDisabled);
|
|
134
|
+
if (isDisabled) {
|
|
135
|
+
this.renderer.removeAttribute(button, 'data-ind-readable');
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this.renderer.setAttribute(button, 'data-ind-readable', 'true');
|
|
139
|
+
}
|
|
140
|
+
this.renderer.setAttribute(button, 'aria-label', label);
|
|
141
|
+
this.applyEqualWebTextFix(button, label, isDisabled);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
// Atualiza botões de página numérica
|
|
145
|
+
const pageButtons = paginatorElement.querySelectorAll('.p-paginator-page');
|
|
146
|
+
pageButtons.forEach((button) => {
|
|
147
|
+
const pageNumber = this.getPaginatorPageNumber(button);
|
|
148
|
+
if (pageNumber) {
|
|
149
|
+
const isDisabled = this.isButtonDisabled(button);
|
|
150
|
+
const isSelected = button.classList.contains('p-paginator-page-selected');
|
|
151
|
+
const ariaLabel = isSelected
|
|
152
|
+
? this.translateService.instant('platform.angular_components.aria_current_page', { page: pageNumber })
|
|
153
|
+
: this.translateService.instant('platform.angular_components.aria_page_number', { page: pageNumber });
|
|
154
|
+
this.renderer.setAttribute(button, 'aria-label', ariaLabel);
|
|
155
|
+
this.updateTabIndex(button, isDisabled);
|
|
156
|
+
this.applyEqualWebTextFix(button, ariaLabel, isDisabled);
|
|
157
|
+
if (isSelected) {
|
|
158
|
+
this.renderer.setAttribute(button, 'aria-current', 'page');
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
this.renderer.removeAttribute(button, 'aria-current');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
isButtonDisabled(button) {
|
|
167
|
+
return button.hasAttribute('disabled') || button.classList.contains('p-disabled');
|
|
168
|
+
}
|
|
169
|
+
updateTabIndex(button, isDisabled) {
|
|
170
|
+
if (isDisabled) {
|
|
171
|
+
this.renderer.removeAttribute(button, 'tabindex');
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.renderer.setAttribute(button, 'tabindex', '0');
|
|
175
|
+
}
|
|
176
|
+
getPaginatorPageNumber(button) {
|
|
177
|
+
const buttonElement = button;
|
|
178
|
+
// Evita pegar texto do span sr-only criado pela diretiva.
|
|
179
|
+
const visualLabel = buttonElement.querySelector(`span:not([${this.equalWebSpanMarker}])`);
|
|
180
|
+
const visualText = visualLabel?.textContent?.trim();
|
|
181
|
+
if (visualText) {
|
|
182
|
+
return visualText;
|
|
183
|
+
}
|
|
184
|
+
// Fallback para casos em que o PrimeNG renderiza sem span interno.
|
|
185
|
+
const srOnlyText = buttonElement.querySelector(`span[${this.equalWebSpanMarker}="true"]`)?.textContent?.trim() || '';
|
|
186
|
+
const fullText = buttonElement.textContent?.trim() || '';
|
|
187
|
+
return fullText.replace(srOnlyText, '').trim();
|
|
188
|
+
}
|
|
189
|
+
applyEqualWebTextFix(button, accessibleText, isDisabled) {
|
|
190
|
+
const buttonElement = button;
|
|
191
|
+
// Oculta spans visuais do PrimeNG para o script do EqualWeb.
|
|
192
|
+
const visualSpans = buttonElement.querySelectorAll(`span:not([${this.equalWebSpanMarker}])`);
|
|
193
|
+
visualSpans.forEach((span) => {
|
|
194
|
+
this.renderer.setAttribute(span, 'aria-hidden', 'true');
|
|
195
|
+
});
|
|
196
|
+
const existingSrOnly = buttonElement.querySelector(`span[${this.equalWebSpanMarker}="true"]`);
|
|
197
|
+
// Não mantém texto extra em botões desabilitados.
|
|
198
|
+
if (isDisabled) {
|
|
199
|
+
if (existingSrOnly) {
|
|
200
|
+
this.renderer.removeChild(buttonElement, existingSrOnly);
|
|
201
|
+
}
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (existingSrOnly) {
|
|
205
|
+
this.renderer.removeAttribute(existingSrOnly, 'tabindex');
|
|
206
|
+
this.renderer.setProperty(existingSrOnly, 'textContent', accessibleText);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const srOnlySpan = this.renderer.createElement('span');
|
|
210
|
+
this.renderer.addClass(srOnlySpan, 'sr-only');
|
|
211
|
+
this.renderer.setAttribute(srOnlySpan, this.equalWebSpanMarker, 'true');
|
|
212
|
+
this.renderer.removeAttribute(srOnlySpan, 'tabindex');
|
|
213
|
+
const srOnlyText = this.renderer.createText(accessibleText);
|
|
214
|
+
this.renderer.appendChild(srOnlySpan, srOnlyText);
|
|
215
|
+
this.renderer.appendChild(buttonElement, srOnlySpan);
|
|
216
|
+
}
|
|
217
|
+
observePaginatorChanges() {
|
|
218
|
+
const paginatorElement = this.el.nativeElement.querySelector('p-paginator');
|
|
219
|
+
if (!paginatorElement) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
this.observedPaginatorElement = paginatorElement;
|
|
223
|
+
// Observa mudanças no paginador (quando botões são habilitados/desabilitados)
|
|
224
|
+
this.observer = new MutationObserver(() => {
|
|
225
|
+
this.updateWithObserverPaused();
|
|
226
|
+
});
|
|
227
|
+
this.startObserving();
|
|
228
|
+
}
|
|
229
|
+
updateWithObserverPaused() {
|
|
230
|
+
if (!this.observer || this.isObserverPaused) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
this.isObserverPaused = true;
|
|
234
|
+
this.observer.disconnect();
|
|
235
|
+
try {
|
|
236
|
+
this.updatePaginatorButtons();
|
|
237
|
+
}
|
|
238
|
+
finally {
|
|
239
|
+
this.startObserving();
|
|
240
|
+
this.isObserverPaused = false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
startObserving() {
|
|
244
|
+
if (!this.observer || !this.observedPaginatorElement) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
this.observer.observe(this.observedPaginatorElement, {
|
|
248
|
+
attributes: true,
|
|
249
|
+
childList: true,
|
|
250
|
+
subtree: true,
|
|
251
|
+
attributeFilter: ['disabled', 'class', 'tabindex']
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PaginatorAccessibilityDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
255
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: PaginatorAccessibilityDirective, isStandalone: true, selector: "[sPaginatorAccessibility]", ngImport: i0 });
|
|
256
|
+
}
|
|
257
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PaginatorAccessibilityDirective, decorators: [{
|
|
258
|
+
type: Directive,
|
|
259
|
+
args: [{
|
|
260
|
+
selector: '[sPaginatorAccessibility]',
|
|
261
|
+
standalone: true
|
|
262
|
+
}]
|
|
263
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$1.TranslateService }] });
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Diretiva para corrigir a acessibilidade de checkboxes em tabelas PrimeNG.
|
|
267
|
+
*
|
|
268
|
+
* Propaga o `aria-label` dos custom elements wrapper (`p-tablecheckbox` e
|
|
269
|
+
* `p-tableheadercheckbox`) para os `<input type="checkbox">` internos e
|
|
270
|
+
* remove o atributo do wrapper, eliminando as violações WCAG 4.1.2:
|
|
271
|
+
* - `label` (crítica): input sem nome acessível
|
|
272
|
+
* - `aria-prohibited-attr` (séria): aria-label em custom element sem role ARIA
|
|
273
|
+
*
|
|
274
|
+
* Remove também o `aria-label` do `p-checkbox` intermediário e monitora
|
|
275
|
+
* mutations de atributo para re-aplicar o label correto caso o binding
|
|
276
|
+
* interno do PrimeNG sobrescreva o valor no input via change detection.
|
|
277
|
+
*
|
|
278
|
+
* Utiliza MutationObserver para tratar linhas adicionadas dinamicamente
|
|
279
|
+
* (paginação, lazy loading).
|
|
280
|
+
*
|
|
281
|
+
* Uso: `<p-table sTableCheckboxAccessibility ...>`
|
|
282
|
+
*/
|
|
283
|
+
class TableCheckboxAccessibilityDirective {
|
|
284
|
+
el;
|
|
285
|
+
childListObserver = null;
|
|
286
|
+
attributeObserver = null;
|
|
287
|
+
isChildListPaused = false;
|
|
288
|
+
isAttributePaused = false;
|
|
289
|
+
observedElements = [];
|
|
290
|
+
inputLabelMap = new Map();
|
|
291
|
+
static CHECKBOX_SELECTOR = 'p-tablecheckbox, p-tableheadercheckbox';
|
|
292
|
+
static INNER_CHECKBOX_SELECTOR = 'p-checkbox';
|
|
293
|
+
static INPUT_SELECTOR = 'input[type="checkbox"]';
|
|
294
|
+
static ARIA_LABEL_ATTR = 'aria-label';
|
|
295
|
+
constructor(el) {
|
|
296
|
+
this.el = el;
|
|
297
|
+
}
|
|
298
|
+
ngOnInit() {
|
|
299
|
+
setTimeout(() => {
|
|
300
|
+
this.updateCheckboxLabels();
|
|
301
|
+
this.observeTableChanges();
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
ngOnDestroy() {
|
|
305
|
+
this.childListObserver?.disconnect();
|
|
306
|
+
this.attributeObserver?.disconnect();
|
|
307
|
+
this.inputLabelMap.clear();
|
|
308
|
+
}
|
|
309
|
+
updateCheckboxLabels() {
|
|
310
|
+
const host = this.el.nativeElement;
|
|
311
|
+
const checkboxWrappers = host.querySelectorAll(TableCheckboxAccessibilityDirective.CHECKBOX_SELECTOR);
|
|
312
|
+
checkboxWrappers.forEach((wrapper) => {
|
|
313
|
+
const wrapperAriaLabel = wrapper.getAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);
|
|
314
|
+
if (!wrapperAriaLabel?.trim()) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const input = wrapper.querySelector(TableCheckboxAccessibilityDirective.INPUT_SELECTOR);
|
|
318
|
+
if (!input) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
this.applyLabelToInput(input, wrapperAriaLabel);
|
|
322
|
+
wrapper.removeAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);
|
|
323
|
+
this.removeInnerCheckboxAriaLabel(wrapper);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
applyLabelToInput(input, label) {
|
|
327
|
+
this.inputLabelMap.set(input, label);
|
|
328
|
+
input.setAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR, label);
|
|
329
|
+
}
|
|
330
|
+
removeInnerCheckboxAriaLabel(wrapper) {
|
|
331
|
+
const innerCheckbox = wrapper.querySelector(TableCheckboxAccessibilityDirective.INNER_CHECKBOX_SELECTOR);
|
|
332
|
+
if (innerCheckbox) {
|
|
333
|
+
innerCheckbox.removeAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
observeTableChanges() {
|
|
337
|
+
const host = this.el.nativeElement;
|
|
338
|
+
const tbody = host.querySelector('tbody');
|
|
339
|
+
const thead = host.querySelector('thead');
|
|
340
|
+
if (tbody) {
|
|
341
|
+
this.observedElements.push(tbody);
|
|
342
|
+
}
|
|
343
|
+
if (thead) {
|
|
344
|
+
this.observedElements.push(thead);
|
|
345
|
+
}
|
|
346
|
+
if (this.observedElements.length === 0) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
this.childListObserver = new MutationObserver(() => {
|
|
350
|
+
this.handleChildListMutation();
|
|
351
|
+
});
|
|
352
|
+
this.attributeObserver = new MutationObserver((mutations) => {
|
|
353
|
+
this.handleAttributeMutations(mutations);
|
|
354
|
+
});
|
|
355
|
+
this.startObserving();
|
|
356
|
+
}
|
|
357
|
+
handleAttributeMutations(mutations) {
|
|
358
|
+
if (this.isAttributePaused) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
this.isAttributePaused = true;
|
|
362
|
+
try {
|
|
363
|
+
mutations
|
|
364
|
+
.filter((m) => m.attributeName === TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR)
|
|
365
|
+
.forEach((mutation) => {
|
|
366
|
+
const target = mutation.target;
|
|
367
|
+
const tagName = target.tagName?.toLowerCase();
|
|
368
|
+
if (tagName === 'p-checkbox') {
|
|
369
|
+
target.removeAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);
|
|
370
|
+
}
|
|
371
|
+
else if (tagName === 'input') {
|
|
372
|
+
this.enforceInputLabel(target);
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
// Outros elementos não precisam de tratamento
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
finally {
|
|
380
|
+
this.isAttributePaused = false;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
enforceInputLabel(input) {
|
|
384
|
+
const correctLabel = this.inputLabelMap.get(input);
|
|
385
|
+
if (!correctLabel) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const currentLabel = input.getAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);
|
|
389
|
+
if (currentLabel !== correctLabel) {
|
|
390
|
+
input.setAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR, correctLabel);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
handleChildListMutation() {
|
|
394
|
+
if (!this.childListObserver || this.isChildListPaused) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
this.isChildListPaused = true;
|
|
398
|
+
this.childListObserver.disconnect();
|
|
399
|
+
try {
|
|
400
|
+
this.updateCheckboxLabels();
|
|
401
|
+
}
|
|
402
|
+
finally {
|
|
403
|
+
this.startObserving();
|
|
404
|
+
this.isChildListPaused = false;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
startObserving() {
|
|
408
|
+
const { childListObserver, attributeObserver, observedElements } = this;
|
|
409
|
+
if (!childListObserver) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
observedElements.forEach((element) => {
|
|
413
|
+
childListObserver.observe(element, {
|
|
414
|
+
childList: true,
|
|
415
|
+
subtree: true,
|
|
416
|
+
});
|
|
417
|
+
if (attributeObserver) {
|
|
418
|
+
attributeObserver.observe(element, {
|
|
419
|
+
attributes: true,
|
|
420
|
+
subtree: true,
|
|
421
|
+
attributeFilter: [TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR],
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TableCheckboxAccessibilityDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
427
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: TableCheckboxAccessibilityDirective, isStandalone: true, selector: "[sTableCheckboxAccessibility]", ngImport: i0 });
|
|
428
|
+
}
|
|
429
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TableCheckboxAccessibilityDirective, decorators: [{
|
|
430
|
+
type: Directive,
|
|
431
|
+
args: [{
|
|
432
|
+
selector: '[sTableCheckboxAccessibility]',
|
|
433
|
+
standalone: true,
|
|
434
|
+
}]
|
|
435
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
|
436
|
+
|
|
85
437
|
/**
|
|
86
438
|
* Generated bundle index. Do not edit.
|
|
87
439
|
*/
|
|
88
440
|
|
|
89
|
-
export { BorderButtonComponent, BorderButtonModule, CheckDisabled, EnumSeverity };
|
|
441
|
+
export { BorderButtonComponent, BorderButtonModule, CheckDisabled, EnumSeverity, PaginatorAccessibilityDirective, TableCheckboxAccessibilityDirective };
|
|
90
442
|
//# sourceMappingURL=seniorsistemas-angular-components-shared.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seniorsistemas-angular-components-shared.mjs","sources":["../../projects/angular-components/shared/src/lib/shared/models/severities.ts","../../projects/angular-components/shared/src/lib/shared/border-button/border-button.component.ts","../../projects/angular-components/shared/src/lib/shared/border-button/border-button.component.html","../../projects/angular-components/shared/src/lib/shared/border-button/border-button.module.ts","../../projects/angular-components/shared/src/lib/shared/helpers.ts","../../projects/angular-components/shared/src/seniorsistemas-angular-components-shared.ts"],"sourcesContent":["export type Severities = 'default' | 'info' | 'warn' | 'error' | 'success';\n\nexport enum EnumSeverity {\n Default = 'default',\n Info = 'info',\n Warn = 'warn',\n Error = 'error',\n Success = 'success',\n}\n","import { Component, Input } from '@angular/core';\n\nimport { BorderButtonOptions } from '../models/border-button-options';\nimport { Severities } from '../models/severities';\n\n/**\n * @description Botão com borda que varia de estilo de acordo com a severidade informada.\n * Utilizado internamente por outros componentes da biblioteca.\n *\n * @category Shared\n */\n@Component({\n selector: 's-border-button',\n templateUrl: './border-button.component.html',\n styleUrls: ['./border-button.component.scss'],\n})\nexport class BorderButtonComponent {\n /** @description Nível de severidade que define a cor e estilo do botão. @default 'default' */\n @Input()\n public severity: Severities = 'default';\n\n /** @description Opções de configuração do botão (rótulo, ação, etc.). */\n @Input()\n public options?: BorderButtonOptions;\n}\n\n","<button\n class=\"border-button\"\n [ngClass]=\"{\n 'border-button--severity-default': severity === 'default',\n 'border-button--severity-info': severity === 'info',\n 'border-button--severity-warn': severity === 'warn',\n 'border-button--severity-error': severity === 'error',\n 'border-button--severity-success': severity === 'success',\n 'border-button--disabled': options?.disabled ? options?.disabled(severity) : false,\n }\"\n (click)=\"options?.onClick ? options?.onClick(severity) : null\"\n [sTooltip]=\"options?.tooltip?.(severity)\"\n tooltipPosition=\"left\"\n [disabled]=\"options?.disabled ? options?.disabled(severity) : false\"\n>\n <span class=\"border-button__label\">\n {{ options?.label ? options?.label(severity) : null }}\n </span>\n @if (options?.icon ? options?.icon(severity) : false) {\n <span class=\"border-button__icon {{ options?.icon(severity) }}\"></span>\n }\n</button>\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { BorderButtonComponent } from \"./border-button.component\";\nimport { TooltipModule } from \"@seniorsistemas/angular-components/tooltip\";\n\n@NgModule({\n imports: [CommonModule, TooltipModule],\n declarations: [BorderButtonComponent],\n exports: [BorderButtonComponent]\n})\nexport class BorderButtonModule { }\n","/**\n * A decorator that can be used to disable functions based on a boolean property on the component.\n *\n * @param disabledField The name of the boolean property that will be used to determine if the decorated\n * function should be disabled. Defaults to 'disabled'.\n * @returns A decorator function that can be used to decorate a function.\n *\n * @example\n * class MyComponent {\n * disabled = true;\n *\n * @CheckDisabled()\n * onClick() {\n * console.log('Button was clicked');\n * }\n * }\n */\nexport function CheckDisabled(disabledField = 'disabled') {\n return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n descriptor.value = function (...args: any[]) {\n const self = this as Record<string, any>;\n if (self[disabledField]) {\n return;\n }\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;IAEY,aAMX;AAND,CAAA,UAAY,YAAY,EAAA;AACpB,IAAA,YAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,YAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,YAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,YAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,YAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACvB,C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;AAAlB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,iBAHZ,qBAAqB,CAAA,EAAA,OAAA,EAAA,CAD1B,YAAY,EAAE,aAAa,aAE3B,qBAAqB,CAAA,EAAA,CAAA,CAAA;yGAEtB,kBAAkB,EAAA,OAAA,EAAA,CAJjB,YAAY,EAAE,aAAa,CAAA,EAAA,CAAA,CAAA;;4FAI5B,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAL9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;oBACtC,YAAY,EAAE,CAAC,qBAAqB,CAAC;oBACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;AACnC,iBAAA,CAAA;;;ACTD;;;;;;;;;;;;;;;;AAgBG;AACa,SAAA,aAAa,CAAC,aAAa,GAAG,UAAU,EAAA;AACpD,IAAA,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B,EAAA;AAC/E,QAAA,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;AACxC,QAAA,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAW,EAAA;YACvC,MAAM,IAAI,GAAG,IAA2B,CAAC;AACzC,YAAA,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE;gBACrB,OAAO;aACV;YACD,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5C,SAAC,CAAC;AAEF,QAAA,OAAO,UAAU,CAAC;AACtB,KAAC,CAAC;AACN;;AC9BA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"seniorsistemas-angular-components-shared.mjs","sources":["../../projects/angular-components/shared/src/lib/shared/models/severities.ts","../../projects/angular-components/shared/src/lib/shared/border-button/border-button.component.ts","../../projects/angular-components/shared/src/lib/shared/border-button/border-button.component.html","../../projects/angular-components/shared/src/lib/shared/border-button/border-button.module.ts","../../projects/angular-components/shared/src/lib/shared/helpers.ts","../../projects/angular-components/shared/src/lib/accessibility/paginator-accessibility.directive.ts","../../projects/angular-components/shared/src/lib/accessibility/table-checkbox-accessibility.directive.ts","../../projects/angular-components/shared/src/seniorsistemas-angular-components-shared.ts"],"sourcesContent":["export type Severities = 'default' | 'info' | 'warn' | 'error' | 'success';\n\nexport enum EnumSeverity {\n Default = 'default',\n Info = 'info',\n Warn = 'warn',\n Error = 'error',\n Success = 'success',\n}\n","import { Component, Input } from '@angular/core';\n\nimport { BorderButtonOptions } from '../models/border-button-options';\nimport { Severities } from '../models/severities';\n\n/**\n * @description Botão com borda que varia de estilo de acordo com a severidade informada.\n * Utilizado internamente por outros componentes da biblioteca.\n *\n * @category Shared\n */\n@Component({\n selector: 's-border-button',\n templateUrl: './border-button.component.html',\n styleUrls: ['./border-button.component.scss'],\n})\nexport class BorderButtonComponent {\n /** @description Nível de severidade que define a cor e estilo do botão. @default 'default' */\n @Input()\n public severity: Severities = 'default';\n\n /** @description Opções de configuração do botão (rótulo, ação, etc.). */\n @Input()\n public options?: BorderButtonOptions;\n}\n\n","<button\n class=\"border-button\"\n [ngClass]=\"{\n 'border-button--severity-default': severity === 'default',\n 'border-button--severity-info': severity === 'info',\n 'border-button--severity-warn': severity === 'warn',\n 'border-button--severity-error': severity === 'error',\n 'border-button--severity-success': severity === 'success',\n 'border-button--disabled': options?.disabled ? options?.disabled(severity) : false,\n }\"\n (click)=\"options?.onClick ? options?.onClick(severity) : null\"\n [sTooltip]=\"options?.tooltip?.(severity)\"\n tooltipPosition=\"left\"\n [disabled]=\"options?.disabled ? options?.disabled(severity) : false\"\n>\n <span class=\"border-button__label\">\n {{ options?.label ? options?.label(severity) : null }}\n </span>\n @if (options?.icon ? options?.icon(severity) : false) {\n <span class=\"border-button__icon {{ options?.icon(severity) }}\"></span>\n }\n</button>\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { BorderButtonComponent } from \"./border-button.component\";\nimport { TooltipModule } from \"@seniorsistemas/angular-components/tooltip\";\n\n@NgModule({\n imports: [CommonModule, TooltipModule],\n declarations: [BorderButtonComponent],\n exports: [BorderButtonComponent]\n})\nexport class BorderButtonModule { }\n","/**\n * A decorator that can be used to disable functions based on a boolean property on the component.\n *\n * @param disabledField The name of the boolean property that will be used to determine if the decorated\n * function should be disabled. Defaults to 'disabled'.\n * @returns A decorator function that can be used to decorate a function.\n *\n * @example\n * class MyComponent {\n * disabled = true;\n *\n * @CheckDisabled()\n * onClick() {\n * console.log('Button was clicked');\n * }\n * }\n */\nexport function CheckDisabled(disabledField = 'disabled') {\n return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n descriptor.value = function (...args: any[]) {\n const self = this as Record<string, any>;\n if (self[disabledField]) {\n return;\n }\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n };\n}\n","import { Directive, ElementRef, OnInit, Renderer2, OnDestroy } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\n\n/**\n * Diretiva para melhorar a acessibilidade dos botões do paginador PrimeNG\n * Adiciona tabindex=\"0\" aos botões habilitados e tabindex=\"-1\" aos desabilitados\n * Adiciona aria-labels traduzidos para os botões do paginador\n */\n@Directive({\n selector: '[sPaginatorAccessibility]',\n standalone: true\n})\nexport class PaginatorAccessibilityDirective implements OnInit, OnDestroy {\n private observer: MutationObserver | null = null;\n private readonly equalWebSpanMarker = 'data-equalweb-sr-only';\n private isObserverPaused = false;\n private observedPaginatorElement: Element | null = null;\n\n constructor(\n private readonly el: ElementRef,\n private readonly renderer: Renderer2,\n private readonly translateService: TranslateService\n ) {}\n\n ngOnInit() {\n // Aguarda o próximo ciclo para garantir que o paginador foi renderizado\n setTimeout(() => {\n this.updatePaginatorButtons();\n this.observePaginatorChanges();\n });\n }\n\n ngOnDestroy() {\n if (this.observer) {\n this.observer.disconnect();\n }\n }\n\n private updatePaginatorButtons() {\n const paginatorElement = this.el.nativeElement.querySelector('p-paginator');\n if (!paginatorElement) {\n return;\n }\n\n // Atualiza botões de navegação (first, prev, next, last)\n const navigationSelectors = {\n '.p-paginator-first': this.translateService.instant('platform.angular_components.aria_first_page'),\n '.p-paginator-prev': this.translateService.instant('platform.angular_components.aria_previous_page'),\n '.p-paginator-next': this.translateService.instant('platform.angular_components.aria_next_page'),\n '.p-paginator-last': this.translateService.instant('platform.angular_components.aria_last_page'),\n '.p-select-label': this.translateService.instant('platform.angular_components.aria_page_selection')\n };\n\n Object.entries(navigationSelectors).forEach(([selector, label]) => {\n const button = paginatorElement.querySelector(selector);\n if (button) {\n const isDisabled = this.isButtonDisabled(button);\n this.updateTabIndex(button, isDisabled);\n if (isDisabled) {\n this.renderer.removeAttribute(button, 'data-ind-readable');\n } else {\n this.renderer.setAttribute(button, 'data-ind-readable', 'true');\n }\n this.renderer.setAttribute(button, 'aria-label', label);\n this.applyEqualWebTextFix(button, label, isDisabled);\n }\n });\n\n // Atualiza botões de página numérica\n const pageButtons = paginatorElement.querySelectorAll('.p-paginator-page');\n pageButtons.forEach((button: Element) => {\n const pageNumber = this.getPaginatorPageNumber(button);\n if (pageNumber) {\n const isDisabled = this.isButtonDisabled(button);\n const isSelected = button.classList.contains('p-paginator-page-selected');\n const ariaLabel = isSelected \n ? this.translateService.instant('platform.angular_components.aria_current_page', { page: pageNumber })\n : this.translateService.instant('platform.angular_components.aria_page_number', { page: pageNumber });\n this.renderer.setAttribute(button, 'aria-label', ariaLabel);\n this.updateTabIndex(button, isDisabled);\n this.applyEqualWebTextFix(button, ariaLabel, isDisabled);\n \n if (isSelected) {\n this.renderer.setAttribute(button, 'aria-current', 'page');\n } else {\n this.renderer.removeAttribute(button, 'aria-current');\n }\n }\n });\n }\n\n private isButtonDisabled(button: Element): boolean {\n return button.hasAttribute('disabled') || button.classList.contains('p-disabled');\n }\n\n private updateTabIndex(button: Element, isDisabled: boolean) {\n if (isDisabled) {\n this.renderer.removeAttribute(button, 'tabindex');\n return;\n }\n\n this.renderer.setAttribute(button, 'tabindex', '0');\n }\n\n private getPaginatorPageNumber(button: Element): string {\n const buttonElement = button as HTMLElement;\n\n // Evita pegar texto do span sr-only criado pela diretiva.\n const visualLabel = buttonElement.querySelector(`span:not([${this.equalWebSpanMarker}])`);\n const visualText = visualLabel?.textContent?.trim();\n if (visualText) {\n return visualText;\n }\n\n // Fallback para casos em que o PrimeNG renderiza sem span interno.\n const srOnlyText = buttonElement.querySelector(`span[${this.equalWebSpanMarker}=\"true\"]`)?.textContent?.trim() || '';\n const fullText = buttonElement.textContent?.trim() || '';\n return fullText.replace(srOnlyText, '').trim();\n }\n\n private applyEqualWebTextFix(button: Element, accessibleText: string, isDisabled: boolean) {\n const buttonElement = button as HTMLElement;\n\n // Oculta spans visuais do PrimeNG para o script do EqualWeb.\n const visualSpans = buttonElement.querySelectorAll(`span:not([${this.equalWebSpanMarker}])`);\n visualSpans.forEach((span: Element) => {\n this.renderer.setAttribute(span, 'aria-hidden', 'true');\n });\n\n const existingSrOnly = buttonElement.querySelector(`span[${this.equalWebSpanMarker}=\"true\"]`);\n\n // Não mantém texto extra em botões desabilitados.\n if (isDisabled) {\n if (existingSrOnly) {\n this.renderer.removeChild(buttonElement, existingSrOnly);\n }\n return;\n }\n\n if (existingSrOnly) {\n this.renderer.removeAttribute(existingSrOnly, 'tabindex');\n this.renderer.setProperty(existingSrOnly, 'textContent', accessibleText);\n return;\n }\n\n const srOnlySpan = this.renderer.createElement('span');\n this.renderer.addClass(srOnlySpan, 'sr-only');\n this.renderer.setAttribute(srOnlySpan, this.equalWebSpanMarker, 'true');\n this.renderer.removeAttribute(srOnlySpan, 'tabindex');\n const srOnlyText = this.renderer.createText(accessibleText);\n this.renderer.appendChild(srOnlySpan, srOnlyText);\n this.renderer.appendChild(buttonElement, srOnlySpan);\n }\n\n private observePaginatorChanges() {\n const paginatorElement = this.el.nativeElement.querySelector('p-paginator');\n if (!paginatorElement) {\n return;\n }\n\n this.observedPaginatorElement = paginatorElement;\n\n // Observa mudanças no paginador (quando botões são habilitados/desabilitados)\n this.observer = new MutationObserver(() => {\n this.updateWithObserverPaused();\n });\n\n this.startObserving();\n }\n\n private updateWithObserverPaused() {\n if (!this.observer || this.isObserverPaused) {\n return;\n }\n\n this.isObserverPaused = true;\n this.observer.disconnect();\n\n try {\n this.updatePaginatorButtons();\n } finally {\n this.startObserving();\n this.isObserverPaused = false;\n }\n }\n\n private startObserving() {\n if (!this.observer || !this.observedPaginatorElement) {\n return;\n }\n\n this.observer.observe(this.observedPaginatorElement, {\n attributes: true,\n childList: true,\n subtree: true,\n attributeFilter: ['disabled', 'class', 'tabindex']\n });\n }\n}\n","import { Directive, ElementRef, OnInit, OnDestroy } from '@angular/core';\n\n/**\n * Diretiva para corrigir a acessibilidade de checkboxes em tabelas PrimeNG.\n *\n * Propaga o `aria-label` dos custom elements wrapper (`p-tablecheckbox` e\n * `p-tableheadercheckbox`) para os `<input type=\"checkbox\">` internos e\n * remove o atributo do wrapper, eliminando as violações WCAG 4.1.2:\n * - `label` (crítica): input sem nome acessível\n * - `aria-prohibited-attr` (séria): aria-label em custom element sem role ARIA\n *\n * Remove também o `aria-label` do `p-checkbox` intermediário e monitora\n * mutations de atributo para re-aplicar o label correto caso o binding\n * interno do PrimeNG sobrescreva o valor no input via change detection.\n *\n * Utiliza MutationObserver para tratar linhas adicionadas dinamicamente\n * (paginação, lazy loading).\n *\n * Uso: `<p-table sTableCheckboxAccessibility ...>`\n */\n@Directive({\n selector: '[sTableCheckboxAccessibility]',\n standalone: true,\n})\nexport class TableCheckboxAccessibilityDirective implements OnInit, OnDestroy {\n private childListObserver: MutationObserver | null = null;\n private attributeObserver: MutationObserver | null = null;\n private isChildListPaused = false;\n private isAttributePaused = false;\n private readonly observedElements: Element[] = [];\n private readonly inputLabelMap = new Map<Element, string>();\n\n private static readonly CHECKBOX_SELECTOR = 'p-tablecheckbox, p-tableheadercheckbox';\n private static readonly INNER_CHECKBOX_SELECTOR = 'p-checkbox';\n private static readonly INPUT_SELECTOR = 'input[type=\"checkbox\"]';\n private static readonly ARIA_LABEL_ATTR = 'aria-label';\n\n constructor(private readonly el: ElementRef<HTMLElement>) {}\n\n ngOnInit() {\n setTimeout(() => {\n this.updateCheckboxLabels();\n this.observeTableChanges();\n });\n }\n\n ngOnDestroy() {\n this.childListObserver?.disconnect();\n this.attributeObserver?.disconnect();\n this.inputLabelMap.clear();\n }\n\n private updateCheckboxLabels() {\n const host = this.el.nativeElement;\n const checkboxWrappers = host.querySelectorAll(TableCheckboxAccessibilityDirective.CHECKBOX_SELECTOR);\n\n checkboxWrappers.forEach((wrapper) => {\n const wrapperAriaLabel = wrapper.getAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);\n if (!wrapperAriaLabel?.trim()) {\n return;\n }\n\n const input = wrapper.querySelector(TableCheckboxAccessibilityDirective.INPUT_SELECTOR);\n if (!input) {\n return;\n }\n\n this.applyLabelToInput(input, wrapperAriaLabel);\n wrapper.removeAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);\n this.removeInnerCheckboxAriaLabel(wrapper);\n });\n }\n\n private applyLabelToInput(input: Element, label: string) {\n this.inputLabelMap.set(input, label);\n input.setAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR, label);\n }\n\n private removeInnerCheckboxAriaLabel(wrapper: Element) {\n const innerCheckbox = wrapper.querySelector(TableCheckboxAccessibilityDirective.INNER_CHECKBOX_SELECTOR);\n if (innerCheckbox) {\n innerCheckbox.removeAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);\n }\n }\n\n private observeTableChanges() {\n const host = this.el.nativeElement;\n const tbody = host.querySelector('tbody');\n const thead = host.querySelector('thead');\n\n if (tbody) {\n this.observedElements.push(tbody);\n }\n if (thead) {\n this.observedElements.push(thead);\n }\n\n if (this.observedElements.length === 0) {\n return;\n }\n\n this.childListObserver = new MutationObserver(() => {\n this.handleChildListMutation();\n });\n\n this.attributeObserver = new MutationObserver((mutations) => {\n this.handleAttributeMutations(mutations);\n });\n\n this.startObserving();\n }\n\n private handleAttributeMutations(mutations: MutationRecord[]) {\n if (this.isAttributePaused) {\n return;\n }\n\n this.isAttributePaused = true;\n\n try {\n mutations\n .filter((m) => m.attributeName === TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR)\n .forEach((mutation) => {\n const target = mutation.target as Element;\n const tagName = target.tagName?.toLowerCase();\n\n if (tagName === 'p-checkbox') {\n target.removeAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);\n } else if (tagName === 'input') {\n this.enforceInputLabel(target);\n } else {\n // Outros elementos não precisam de tratamento\n }\n });\n } finally {\n this.isAttributePaused = false;\n }\n }\n\n private enforceInputLabel(input: Element) {\n const correctLabel = this.inputLabelMap.get(input);\n if (!correctLabel) {\n return;\n }\n\n const currentLabel = input.getAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR);\n if (currentLabel !== correctLabel) {\n input.setAttribute(TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR, correctLabel);\n }\n }\n\n private handleChildListMutation() {\n if (!this.childListObserver || this.isChildListPaused) {\n return;\n }\n\n this.isChildListPaused = true;\n this.childListObserver.disconnect();\n\n try {\n this.updateCheckboxLabels();\n } finally {\n this.startObserving();\n this.isChildListPaused = false;\n }\n }\n\n private startObserving() {\n const { childListObserver, attributeObserver, observedElements } = this;\n\n if (!childListObserver) {\n return;\n }\n\n observedElements.forEach((element) => {\n childListObserver.observe(element, {\n childList: true,\n subtree: true,\n });\n\n if (attributeObserver) {\n attributeObserver.observe(element, {\n attributes: true,\n subtree: true,\n attributeFilter: [TableCheckboxAccessibilityDirective.ARIA_LABEL_ATTR],\n });\n }\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;IAEY,aAMX;AAND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AC,OAAO,EAAE;AAC/B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,OAAO,EAAE,IAAI;AACb,oBAAA,eAAe,EAAE,CAAC,mCAAmC,CAAC,eAAe,CAAC;AACzE,iBAAA,CAAC,CAAC;aACN;AACL,SAAC,CAAC,CAAC;KACN;wGApKQ,mCAAmC,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;4FAAnC,mCAAmC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,+BAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAnC,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAJ/C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,+BAA+B;AACzC,oBAAA,UAAU,EAAE,IAAI;AACnB,iBAAA,CAAA;;;ACvBD;;AAEG;;;;"}
|
|
@@ -19,12 +19,14 @@ import { CommonModule } from '@angular/common';
|
|
|
19
19
|
class SwitchComponent {
|
|
20
20
|
/** @description Impede alterações pelo usuário sem desabilitar o campo. @default false */
|
|
21
21
|
readonly = false;
|
|
22
|
-
/** @description Rótulo exibido quando o valor é `true`. */
|
|
23
|
-
trueLabel;
|
|
24
|
-
/** @description Rótulo exibido quando o valor é `false`. */
|
|
25
|
-
falseLabel;
|
|
22
|
+
/** @description Rótulo exibido quando o valor é `true`. @default 'Ligado' */
|
|
23
|
+
trueLabel = 'Ligado';
|
|
24
|
+
/** @description Rótulo exibido quando o valor é `false`. @default 'Desligado' */
|
|
25
|
+
falseLabel = 'Desligado';
|
|
26
26
|
/** @description `id` do elemento `<input>` interno para associação com `<label>`. */
|
|
27
27
|
inputId;
|
|
28
|
+
/** @description Nome acessível descritivo do switch para tecnologias assistivas (aria-label). */
|
|
29
|
+
label;
|
|
28
30
|
/** @description Atributo `name` do `<input>` interno. */
|
|
29
31
|
inputName;
|
|
30
32
|
/** @description Desabilita o componente, impedindo interação e alterações. @default false */
|
|
@@ -33,6 +35,8 @@ class SwitchComponent {
|
|
|
33
35
|
valueChanged = new EventEmitter();
|
|
34
36
|
/** @description Valor atual do switch. @default false */
|
|
35
37
|
value = false;
|
|
38
|
+
/** @description Controla se deve ou não exibir o value do componente. @default true */
|
|
39
|
+
showStatusLabel = true;
|
|
36
40
|
switchRef;
|
|
37
41
|
_onChange;
|
|
38
42
|
_onTouched;
|
|
@@ -59,6 +63,9 @@ class SwitchComponent {
|
|
|
59
63
|
this.disabled = disabled;
|
|
60
64
|
}
|
|
61
65
|
toggleCheck() {
|
|
66
|
+
if (this.readonly) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
62
69
|
this.value = !this.value;
|
|
63
70
|
this.valueChanged.emit(this.value);
|
|
64
71
|
if (this._onChange) {
|
|
@@ -69,13 +76,13 @@ class SwitchComponent {
|
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
78
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
79
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: SwitchComponent, selector: "s-switch", inputs: { readonly: "readonly", trueLabel: "trueLabel", falseLabel: "falseLabel", inputId: "inputId", label: "label", inputName: "inputName", disabled: "disabled", value: "value", showStatusLabel: "showStatusLabel" }, outputs: { valueChanged: "valueChanged" }, host: { listeners: { "focusin": "onFocusIn()", "focusout": "onFocusOut()" } }, providers: [
|
|
73
80
|
{
|
|
74
81
|
provide: NG_VALUE_ACCESSOR,
|
|
75
82
|
useExisting: forwardRef(() => SwitchComponent),
|
|
76
83
|
multi: true,
|
|
77
84
|
},
|
|
78
|
-
], viewQueries: [{ propertyName: "switchRef", first: true, predicate: ["switch"], descendants: true, static: true }], ngImport: i0, template: "<div\n #switch\n class=\"switch\"\n [ngClass]=\"{ 'switch--disabled': disabled }\"\n>\n <label class=\"switch-toggle\">\n <input\n #input\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"checkbox\"\n [checked]=\"value\"\n [disabled]=\"readonly ||
|
|
85
|
+
], viewQueries: [{ propertyName: "switchRef", first: true, predicate: ["switch"], descendants: true, static: true }], ngImport: i0, template: "<div\n #switch\n class=\"switch\"\n [ngClass]=\"{ 'switch--disabled': disabled }\"\n [attr.aria-disabled]=\"disabled || null\"\n>\n <label class=\"switch-toggle\">\n <input\n #input\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"checkbox\"\n role=\"switch\"\n [attr.aria-checked]=\"value\"\n [attr.aria-label]=\"label || null\"\n [checked]=\"value\"\n [disabled]=\"disabled\"\n [attr.aria-readonly]=\"readonly || null\"\n (change)=\"toggleCheck()\"\n />\n <span\n class=\"slider\"\n aria-hidden=\"true\"\n ></span>\n </label>\n @if (showStatusLabel) {\n <span class=\"label\">{{ value ? trueLabel : falseLabel }}</span>\n }\n</div>\n\n", styles: [".switch{display:inline-flex;align-items:center}.switch .switch-toggle{display:inline-block;height:24px;margin:0;position:relative;width:40px}.switch .switch-toggle input{height:0;opacity:0;width:0}.switch .switch-toggle input:focus-visible+.slider{box-shadow:0 0 0 2px #000;outline:2px solid #000;outline-offset:1px}.switch .switch-toggle input:checked+.slider{background-color:#428bca;border-radius:15px}.switch .switch-toggle input:checked+.slider:before{transform:translate(16px)}.switch .switch-toggle .slider{background-color:#a5a5b2;border-radius:15px;cursor:pointer;inset:0;position:absolute;transition:.4s}.switch .switch-toggle .slider:before{background-color:#fff;border-radius:50%;bottom:4px;content:\"\";height:16px;left:4px;position:absolute;transition:.4s;width:16px}.switch .label{color:#212533;font-family:\"Open Sans\" sans-serif;font-size:.875rem;font-weight:400;line-height:150%;margin-left:12px}.switch .label.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.switch--disabled{opacity:.5}.switch--focus .switch-toggle .slider{box-shadow:0 0 0 2px #428bca80}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
79
86
|
}
|
|
80
87
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchComponent, decorators: [{
|
|
81
88
|
type: Component,
|
|
@@ -85,7 +92,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
85
92
|
useExisting: forwardRef(() => SwitchComponent),
|
|
86
93
|
multi: true,
|
|
87
94
|
},
|
|
88
|
-
], template: "<div\n #switch\n class=\"switch\"\n [ngClass]=\"{ 'switch--disabled': disabled }\"\n>\n <label class=\"switch-toggle\">\n <input\n #input\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"checkbox\"\n [checked]=\"value\"\n [disabled]=\"readonly ||
|
|
95
|
+
], template: "<div\n #switch\n class=\"switch\"\n [ngClass]=\"{ 'switch--disabled': disabled }\"\n [attr.aria-disabled]=\"disabled || null\"\n>\n <label class=\"switch-toggle\">\n <input\n #input\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"checkbox\"\n role=\"switch\"\n [attr.aria-checked]=\"value\"\n [attr.aria-label]=\"label || null\"\n [checked]=\"value\"\n [disabled]=\"disabled\"\n [attr.aria-readonly]=\"readonly || null\"\n (change)=\"toggleCheck()\"\n />\n <span\n class=\"slider\"\n aria-hidden=\"true\"\n ></span>\n </label>\n @if (showStatusLabel) {\n <span class=\"label\">{{ value ? trueLabel : falseLabel }}</span>\n }\n</div>\n\n", styles: [".switch{display:inline-flex;align-items:center}.switch .switch-toggle{display:inline-block;height:24px;margin:0;position:relative;width:40px}.switch .switch-toggle input{height:0;opacity:0;width:0}.switch .switch-toggle input:focus-visible+.slider{box-shadow:0 0 0 2px #000;outline:2px solid #000;outline-offset:1px}.switch .switch-toggle input:checked+.slider{background-color:#428bca;border-radius:15px}.switch .switch-toggle input:checked+.slider:before{transform:translate(16px)}.switch .switch-toggle .slider{background-color:#a5a5b2;border-radius:15px;cursor:pointer;inset:0;position:absolute;transition:.4s}.switch .switch-toggle .slider:before{background-color:#fff;border-radius:50%;bottom:4px;content:\"\";height:16px;left:4px;position:absolute;transition:.4s;width:16px}.switch .label{color:#212533;font-family:\"Open Sans\" sans-serif;font-size:.875rem;font-weight:400;line-height:150%;margin-left:12px}.switch .label.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.switch--disabled{opacity:.5}.switch--focus .switch-toggle .slider{box-shadow:0 0 0 2px #428bca80}\n"] }]
|
|
89
96
|
}], propDecorators: { readonly: [{
|
|
90
97
|
type: Input
|
|
91
98
|
}], trueLabel: [{
|
|
@@ -94,6 +101,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
94
101
|
type: Input
|
|
95
102
|
}], inputId: [{
|
|
96
103
|
type: Input
|
|
104
|
+
}], label: [{
|
|
105
|
+
type: Input
|
|
97
106
|
}], inputName: [{
|
|
98
107
|
type: Input
|
|
99
108
|
}], disabled: [{
|
|
@@ -102,6 +111,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
102
111
|
type: Output
|
|
103
112
|
}], value: [{
|
|
104
113
|
type: Input
|
|
114
|
+
}], showStatusLabel: [{
|
|
115
|
+
type: Input
|
|
105
116
|
}], switchRef: [{
|
|
106
117
|
type: ViewChild,
|
|
107
118
|
args: ['switch', { static: true }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seniorsistemas-angular-components-switch.mjs","sources":["../../projects/angular-components/switch/src/lib/switch/switch.component.ts","../../projects/angular-components/switch/src/lib/switch/switch.component.html","../../projects/angular-components/switch/src/lib/switch/switch.module.ts","../../projects/angular-components/switch/src/seniorsistemas-angular-components-switch.ts"],"sourcesContent":["import { Component, ElementRef, EventEmitter, HostListener, Input, Output, ViewChild, forwardRef } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n/**\n * @description Componente de chave tipo switch (liga/desliga) que implementa\n * `ControlValueAccessor` para uso em formulários Angular. Suporta rótulos\n * personalizados para os estados verdadeiro e falso, além de modo somente leitura.\n *\n * @example\n * ```html\n * <s-switch formControlName=\"ativo\" trueLabel=\"Ativo\" falseLabel=\"Inativo\" />\n * ```\n *\n * @category Inputs\n */\n@Component({\n selector: 's-switch',\n templateUrl: './switch.component.html',\n styleUrls: ['./switch.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SwitchComponent),\n multi: true,\n },\n ],\n})\nexport class SwitchComponent implements ControlValueAccessor {\n /** @description Impede alterações pelo usuário sem desabilitar o campo. @default false */\n @Input()\n public readonly = false;\n\n /** @description Rótulo exibido quando o valor é `true`. */\n @Input()\n public trueLabel
|
|
1
|
+
{"version":3,"file":"seniorsistemas-angular-components-switch.mjs","sources":["../../projects/angular-components/switch/src/lib/switch/switch.component.ts","../../projects/angular-components/switch/src/lib/switch/switch.component.html","../../projects/angular-components/switch/src/lib/switch/switch.module.ts","../../projects/angular-components/switch/src/seniorsistemas-angular-components-switch.ts"],"sourcesContent":["import { Component, ElementRef, EventEmitter, HostListener, Input, Output, ViewChild, forwardRef } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n/**\n * @description Componente de chave tipo switch (liga/desliga) que implementa\n * `ControlValueAccessor` para uso em formulários Angular. Suporta rótulos\n * personalizados para os estados verdadeiro e falso, além de modo somente leitura.\n *\n * @example\n * ```html\n * <s-switch formControlName=\"ativo\" trueLabel=\"Ativo\" falseLabel=\"Inativo\" />\n * ```\n *\n * @category Inputs\n */\n@Component({\n selector: 's-switch',\n templateUrl: './switch.component.html',\n styleUrls: ['./switch.component.scss'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SwitchComponent),\n multi: true,\n },\n ],\n})\nexport class SwitchComponent implements ControlValueAccessor {\n /** @description Impede alterações pelo usuário sem desabilitar o campo. @default false */\n @Input()\n public readonly = false;\n\n /** @description Rótulo exibido quando o valor é `true`. @default 'Ligado' */\n @Input()\n public trueLabel = 'Ligado';\n\n /** @description Rótulo exibido quando o valor é `false`. @default 'Desligado' */\n @Input()\n public falseLabel = 'Desligado';\n\n /** @description `id` do elemento `<input>` interno para associação com `<label>`. */\n @Input()\n public inputId?: string;\n /** @description Nome acessível descritivo do switch para tecnologias assistivas (aria-label). */\n @Input()\n public label?: string;\n\n /** @description Atributo `name` do `<input>` interno. */\n @Input()\n public inputName?: string;\n\n /** @description Desabilita o componente, impedindo interação e alterações. @default false */\n @Input()\n public disabled = false;\n\n /** @description Emitido quando o valor do switch muda, com o novo estado booleano. */\n @Output()\n public valueChanged = new EventEmitter<boolean>();\n\n /** @description Valor atual do switch. @default false */\n @Input()\n public value = false;\n\n /** @description Controla se deve ou não exibir o value do componente. @default true */\n @Input()\n public showStatusLabel = true;\n\n @ViewChild('switch', { static: true })\n public switchRef!: ElementRef;\n\n private _onChange?: (value: boolean) => void;\n private _onTouched?: (value: boolean) => void;\n\n @HostListener('focusin')\n public onFocusIn(): void {\n const switchElement = this.switchRef.nativeElement as HTMLDivElement;\n switchElement.classList.add('switch--focus');\n }\n\n @HostListener('focusout')\n public onFocusOut(): void {\n const switchElement = this.switchRef.nativeElement as HTMLDivElement;\n switchElement.classList.remove('switch--focus');\n }\n\n public writeValue(value: boolean): void {\n if (!this.disabled) {\n this.value = value;\n }\n }\n\n public registerOnChange(onChange: (value: boolean) => void): void {\n this._onChange = onChange;\n }\n\n public registerOnTouched(onTouched: (value: boolean) => void): void {\n this._onTouched = onTouched;\n }\n\n public setDisabledState?(disabled: boolean): void {\n this.disabled = disabled;\n }\n\n public toggleCheck() {\n if (this.readonly) {\n return;\n }\n this.value = !this.value;\n this.valueChanged.emit(this.value);\n\n if (this._onChange) {\n this._onChange(this.value);\n }\n\n if (this._onTouched) {\n this._onTouched(this.value);\n }\n }\n}\n\n","<div\n #switch\n class=\"switch\"\n [ngClass]=\"{ 'switch--disabled': disabled }\"\n [attr.aria-disabled]=\"disabled || null\"\n>\n <label class=\"switch-toggle\">\n <input\n #input\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"checkbox\"\n role=\"switch\"\n [attr.aria-checked]=\"value\"\n [attr.aria-label]=\"label || null\"\n [checked]=\"value\"\n [disabled]=\"disabled\"\n [attr.aria-readonly]=\"readonly || null\"\n (change)=\"toggleCheck()\"\n />\n <span\n class=\"slider\"\n aria-hidden=\"true\"\n ></span>\n </label>\n @if (showStatusLabel) {\n <span class=\"label\">{{ value ? trueLabel : falseLabel }}</span>\n }\n</div>\n\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { SwitchComponent } from './switch.component';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [SwitchComponent],\n exports: [SwitchComponent],\n})\nexport class SwitchModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAGA;;;;;;;;;;;AAWG;MAaU,eAAe,CAAA;;IAGjB,QAAQ,GAAG,KAAK,CAAC;;IAIjB,SAAS,GAAG,QAAQ,CAAC;;IAIrB,UAAU,GAAG,WAAW,CAAC;;AAIzB,IAAA,OAAO,CAAU;;AAGjB,IAAA,KAAK,CAAU;;AAIf,IAAA,SAAS,CAAU;;IAInB,QAAQ,GAAG,KAAK,CAAC;;AAIjB,IAAA,YAAY,GAAG,IAAI,YAAY,EAAW,CAAC;;IAI3C,KAAK,GAAG,KAAK,CAAC;;IAId,eAAe,GAAG,IAAI,CAAC;AAGvB,IAAA,SAAS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EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,EAHN,YAAA,EAAA,CAAA,eAAe,CADpB,EAAA,OAAA,EAAA,CAAA,YAAY,aAEZ,eAAe,CAAA,EAAA,CAAA,CAAA;AAEhB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,YAJX,YAAY,CAAA,EAAA,CAAA,CAAA;;4FAIb,YAAY,EAAA,UAAA,EAAA,CAAA;kBALxB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,YAAY,EAAE,CAAC,eAAe,CAAC;oBAC/B,OAAO,EAAE,CAAC,eAAe,CAAC;AAC7B,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
|
|
@@ -922,7 +922,7 @@ class TablePagingComponent {
|
|
|
922
922
|
return tableData;
|
|
923
923
|
}
|
|
924
924
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TablePagingComponent, deps: [{ token: i2.TranslateService }, { token: HostProjectConfigsInjectionToken }], target: i0.ɵɵFactoryTarget.Component });
|
|
925
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: TablePagingComponent, selector: "s-table-paging", inputs: { totalRecords: "totalRecords", exportFileName: "exportFileName", table: "table", exportable: "exportable", enableExportSelectedRecords: "enableExportSelectedRecords", customActions: "customActions", loadAllRecords: "loadAllRecords", loadCurrentPageRecords: "loadCurrentPageRecords", loadSelectedRecords: "loadSelectedRecords" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"paging-container\">\n <span class=\"total-records\">\n {{ totalRecordsText }}\n </span>\n @if (exportable) {\n <s-button\n class=\"export-button\"\n priority=\"default\"\n iconClass=\"fa fa-fw fa-file-export\"\n [disabled]=\"false\"\n [auxiliary]=\"true\"\n [tooltip]=\"getTooltipText()\"\n [menuOptions]=\"getActions()\"\n >\n </s-button>\n }\n</div>\n", styles: [".paging-container{display:flex;align-items:center}.export-button{margin-left:6px}\n"], dependencies: [{ kind: "component", type: i2$1.ButtonComponent, selector: "s-button", inputs: ["id", "label", "tooltip", "tooltipPosition", "iconClass", "rightIconClass", "caret", "styleClass", "baseZIndex", "disabled", "auxiliary", "type", "priority", "menuOptions", "
|
|
925
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: TablePagingComponent, selector: "s-table-paging", inputs: { totalRecords: "totalRecords", exportFileName: "exportFileName", table: "table", exportable: "exportable", enableExportSelectedRecords: "enableExportSelectedRecords", customActions: "customActions", loadAllRecords: "loadAllRecords", loadCurrentPageRecords: "loadCurrentPageRecords", loadSelectedRecords: "loadSelectedRecords" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"paging-container\">\n <span class=\"total-records\">\n {{ totalRecordsText }}\n </span>\n @if (exportable) {\n <s-button\n class=\"export-button\"\n priority=\"default\"\n iconClass=\"fa fa-fw fa-file-export\"\n [disabled]=\"false\"\n [auxiliary]=\"true\"\n [tooltip]=\"getTooltipText()\"\n [menuOptions]=\"getActions()\"\n >\n </s-button>\n }\n</div>\n", styles: [".paging-container{display:flex;align-items:center}.export-button{margin-left:6px}\n"], dependencies: [{ kind: "component", type: i2$1.ButtonComponent, selector: "s-button", inputs: ["id", "label", "tooltip", "tooltipPosition", "iconClass", "rightIconClass", "caret", "styleClass", "baseZIndex", "disabled", "auxiliary", "type", "priority", "menuOptions", "size", "slide", "animation", "badge", "iconColor", "menuAriaLabel"], outputs: ["clicked"] }] });
|
|
926
926
|
}
|
|
927
927
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TablePagingComponent, decorators: [{
|
|
928
928
|
type: Component,
|