primeng 16.9.8-lts → 16.9.10-lts
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/accordion/accordion.d.ts +2 -0
- package/autofocus/autofocus.d.ts +8 -4
- package/calendar/calendar.d.ts +5 -2
- package/dom/domhandler.d.ts +5 -1
- package/dropdown/dropdown.d.ts +1 -0
- package/esm2022/accordion/accordion.mjs +19 -7
- package/esm2022/autofocus/autofocus.mjs +35 -18
- package/esm2022/calendar/calendar.mjs +84 -15
- package/esm2022/dom/domhandler.mjs +65 -2
- package/esm2022/dropdown/dropdown.mjs +16 -5
- package/esm2022/focustrap/focustrap.mjs +49 -25
- package/esm2022/inputnumber/inputnumber.mjs +15 -6
- package/esm2022/table/table.mjs +6 -3
- package/esm2022/tooltip/tooltip.mjs +25 -8
- package/fesm2022/primeng-accordion.mjs +18 -6
- package/fesm2022/primeng-accordion.mjs.map +1 -1
- package/fesm2022/primeng-autofocus.mjs +34 -17
- package/fesm2022/primeng-autofocus.mjs.map +1 -1
- package/fesm2022/primeng-calendar.mjs +83 -14
- package/fesm2022/primeng-calendar.mjs.map +1 -1
- package/fesm2022/primeng-dom.mjs +64 -1
- package/fesm2022/primeng-dom.mjs.map +1 -1
- package/fesm2022/primeng-dropdown.mjs +15 -4
- package/fesm2022/primeng-dropdown.mjs.map +1 -1
- package/fesm2022/primeng-focustrap.mjs +48 -24
- package/fesm2022/primeng-focustrap.mjs.map +1 -1
- package/fesm2022/primeng-inputnumber.mjs +14 -5
- package/fesm2022/primeng-inputnumber.mjs.map +1 -1
- package/fesm2022/primeng-table.mjs +5 -2
- package/fesm2022/primeng-table.mjs.map +1 -1
- package/fesm2022/primeng-tooltip.mjs +24 -7
- package/fesm2022/primeng-tooltip.mjs.map +1 -1
- package/focustrap/focustrap.d.ts +11 -3
- package/package.json +280 -280
- package/resources/components/dropdown/dropdown.css +4 -0
@@ -1,38 +1,67 @@
|
|
1
1
|
import { DomHandler } from 'primeng/dom';
|
2
2
|
import { LicenseManager } from 'primeng/api';
|
3
|
-
import { CommonModule } from '@angular/common';
|
3
|
+
import { DOCUMENT, isPlatformBrowser, CommonModule } from '@angular/common';
|
4
4
|
import * as i0 from '@angular/core';
|
5
|
-
import { Directive, Input,
|
5
|
+
import { inject, PLATFORM_ID, ElementRef, booleanAttribute, Directive, Input, NgModule } from '@angular/core';
|
6
6
|
|
7
7
|
/**
|
8
8
|
* Focus Trap keeps focus within a certain DOM element while tabbing.
|
9
9
|
* @group Components
|
10
10
|
*/
|
11
11
|
class FocusTrap {
|
12
|
-
el;
|
13
12
|
/**
|
14
13
|
* When set as true, focus wouldn't be managed.
|
15
14
|
* @group Props
|
16
15
|
*/
|
17
16
|
pFocusTrapDisabled = false;
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
focusableElement.focus();
|
27
|
-
focusableElement.select?.();
|
28
|
-
}
|
17
|
+
platformId = inject(PLATFORM_ID);
|
18
|
+
host = inject(ElementRef);
|
19
|
+
document = inject(DOCUMENT);
|
20
|
+
firstHiddenFocusableElement;
|
21
|
+
lastHiddenFocusableElement;
|
22
|
+
ngOnInit() {
|
23
|
+
if (isPlatformBrowser(this.platformId) && !this.pFocusTrapDisabled) {
|
24
|
+
this.createHiddenFocusableElements();
|
29
25
|
}
|
30
26
|
}
|
27
|
+
getComputedSelector(selector) {
|
28
|
+
return `:not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])${selector ?? ''}`;
|
29
|
+
}
|
30
|
+
createHiddenFocusableElements() {
|
31
|
+
const tabindex = '0';
|
32
|
+
const createFocusableElement = (onFocus) => {
|
33
|
+
return DomHandler.createElement('span', {
|
34
|
+
class: 'p-hidden-accessible p-hidden-focusable',
|
35
|
+
tabindex,
|
36
|
+
role: 'presentation',
|
37
|
+
'aria-hidden': true,
|
38
|
+
'data-p-hidden-accessible': true,
|
39
|
+
'data-p-hidden-focusable': true,
|
40
|
+
onFocus: onFocus?.bind(this)
|
41
|
+
});
|
42
|
+
};
|
43
|
+
this.firstHiddenFocusableElement = createFocusableElement(this.onFirstHiddenElementFocus);
|
44
|
+
this.lastHiddenFocusableElement = createFocusableElement(this.onLastHiddenElementFocus);
|
45
|
+
this.firstHiddenFocusableElement.setAttribute('data-pc-section', 'firstfocusableelement');
|
46
|
+
this.lastHiddenFocusableElement.setAttribute('data-pc-section', 'lastfocusableelement');
|
47
|
+
this.host.nativeElement.prepend(this.firstHiddenFocusableElement);
|
48
|
+
this.host.nativeElement.append(this.lastHiddenFocusableElement);
|
49
|
+
}
|
50
|
+
onFirstHiddenElementFocus(event) {
|
51
|
+
const { currentTarget, relatedTarget } = event;
|
52
|
+
const focusableElement = relatedTarget === this.lastHiddenFocusableElement || !this.host.nativeElement?.contains(relatedTarget) ? DomHandler.getFirstFocusableElement(currentTarget.parentElement, ':not(.p-hidden-focusable)') : this.lastHiddenFocusableElement;
|
53
|
+
DomHandler.focus(focusableElement);
|
54
|
+
}
|
55
|
+
onLastHiddenElementFocus(event) {
|
56
|
+
const { currentTarget, relatedTarget } = event;
|
57
|
+
const focusableElement = relatedTarget === this.firstHiddenFocusableElement || !this.host.nativeElement?.contains(relatedTarget) ? DomHandler.getLastFocusableElement(currentTarget.parentElement, ':not(.p-hidden-focusable)') : this.firstHiddenFocusableElement;
|
58
|
+
DomHandler.focus(focusableElement);
|
59
|
+
}
|
31
60
|
ngAfterViewInit() {
|
32
61
|
LicenseManager.check();
|
33
62
|
}
|
34
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: FocusTrap, deps: [
|
35
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.0", type: FocusTrap, selector: "[pFocusTrap]", inputs: { pFocusTrapDisabled: "pFocusTrapDisabled"
|
63
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: FocusTrap, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
64
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.0", type: FocusTrap, selector: "[pFocusTrap]", inputs: { pFocusTrapDisabled: ["pFocusTrapDisabled", "pFocusTrapDisabled", booleanAttribute] }, host: { classAttribute: "p-element" }, ngImport: i0 });
|
36
65
|
}
|
37
66
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: FocusTrap, decorators: [{
|
38
67
|
type: Directive,
|
@@ -42,14 +71,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.0", ngImpor
|
|
42
71
|
class: 'p-element'
|
43
72
|
}
|
44
73
|
}]
|
45
|
-
}],
|
46
|
-
type: Input
|
47
|
-
|
48
|
-
type: HostListener,
|
49
|
-
args: ['keydown.tab', ['$event']]
|
50
|
-
}, {
|
51
|
-
type: HostListener,
|
52
|
-
args: ['keydown.shift.tab', ['$event']]
|
74
|
+
}], propDecorators: { pFocusTrapDisabled: [{
|
75
|
+
type: Input,
|
76
|
+
args: [{ transform: booleanAttribute }]
|
53
77
|
}] } });
|
54
78
|
class FocusTrapModule {
|
55
79
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: FocusTrapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"primeng-focustrap.mjs","sources":["../../src/app/components/focustrap/focustrap.ts","../../src/app/components/focustrap/primeng-focustrap.ts"],"sourcesContent":["import { DomHandler } from 'primeng/dom';\nimport { LicenseManager } from 'primeng/api';\nimport { CommonModule } from '@angular/common';\nimport { Directive, ElementRef,
|
1
|
+
{"version":3,"file":"primeng-focustrap.mjs","sources":["../../src/app/components/focustrap/focustrap.ts","../../src/app/components/focustrap/primeng-focustrap.ts"],"sourcesContent":["import { DomHandler } from 'primeng/dom';\nimport { LicenseManager } from 'primeng/api';\nimport { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Directive, ElementRef, Input, NgModule, inject, booleanAttribute, PLATFORM_ID } from '@angular/core';\n/**\n * Focus Trap keeps focus within a certain DOM element while tabbing.\n * @group Components\n */\n@Directive({\n selector: '[pFocusTrap]',\n host: {\n class: 'p-element'\n }\n})\nexport class FocusTrap {\n /**\n * When set as true, focus wouldn't be managed.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) pFocusTrapDisabled: boolean = false;\n\n platformId = inject(PLATFORM_ID);\n\n host: ElementRef = inject(ElementRef);\n\n document: Document = inject(DOCUMENT);\n\n firstHiddenFocusableElement!: HTMLElement;\n\n lastHiddenFocusableElement!: HTMLElement;\n\n ngOnInit() {\n if (isPlatformBrowser(this.platformId) && !this.pFocusTrapDisabled) {\n this.createHiddenFocusableElements();\n }\n }\n\n getComputedSelector(selector) {\n return `:not(.p-hidden-focusable):not([data-p-hidden-focusable=\"true\"])${selector ?? ''}`;\n }\n\n createHiddenFocusableElements() {\n const tabindex = '0';\n\n const createFocusableElement = (onFocus) => {\n return DomHandler.createElement('span', {\n class: 'p-hidden-accessible p-hidden-focusable',\n tabindex,\n role: 'presentation',\n 'aria-hidden': true,\n 'data-p-hidden-accessible': true,\n 'data-p-hidden-focusable': true,\n onFocus: onFocus?.bind(this)\n });\n };\n\n this.firstHiddenFocusableElement = createFocusableElement(this.onFirstHiddenElementFocus);\n this.lastHiddenFocusableElement = createFocusableElement(this.onLastHiddenElementFocus);\n\n this.firstHiddenFocusableElement.setAttribute('data-pc-section', 'firstfocusableelement');\n this.lastHiddenFocusableElement.setAttribute('data-pc-section', 'lastfocusableelement');\n\n this.host.nativeElement.prepend(this.firstHiddenFocusableElement);\n this.host.nativeElement.append(this.lastHiddenFocusableElement);\n }\n\n onFirstHiddenElementFocus(event) {\n const { currentTarget, relatedTarget } = event;\n const focusableElement =\n relatedTarget === this.lastHiddenFocusableElement || !this.host.nativeElement?.contains(relatedTarget) ? DomHandler.getFirstFocusableElement(currentTarget.parentElement, ':not(.p-hidden-focusable)') : this.lastHiddenFocusableElement;\n\n DomHandler.focus(focusableElement);\n }\n\n onLastHiddenElementFocus(event) {\n const { currentTarget, relatedTarget } = event;\n const focusableElement =\n relatedTarget === this.firstHiddenFocusableElement || !this.host.nativeElement?.contains(relatedTarget) ? DomHandler.getLastFocusableElement(currentTarget.parentElement, ':not(.p-hidden-focusable)') : this.firstHiddenFocusableElement;\n\n DomHandler.focus(focusableElement);\n }\n ngAfterViewInit() {\n LicenseManager.check();\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [FocusTrap],\n declarations: [FocusTrap]\n})\nexport class FocusTrapModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAIA;;;AAGG;AACH,MAMa,SAAS,CAAA;AAClB;;;AAGG;IACqC,kBAAkB,GAAY,KAAK,CAAC;AAE5E,IAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEjC,IAAA,IAAI,GAAe,MAAM,CAAC,UAAU,CAAC,CAAC;AAEtC,IAAA,QAAQ,GAAa,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEtC,IAAA,2BAA2B,CAAe;AAE1C,IAAA,0BAA0B,CAAe;IAEzC,QAAQ,GAAA;QACJ,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAChE,IAAI,CAAC,6BAA6B,EAAE,CAAC;AACxC,SAAA;KACJ;AAED,IAAA,mBAAmB,CAAC,QAAQ,EAAA;AACxB,QAAA,OAAO,CAAkE,+DAAA,EAAA,QAAQ,IAAI,EAAE,EAAE,CAAC;KAC7F;IAED,6BAA6B,GAAA;QACzB,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB,QAAA,MAAM,sBAAsB,GAAG,CAAC,OAAO,KAAI;AACvC,YAA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AAA,CAAA,CAAA;AAAf,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,EA7Ef,YAAA,EAAA,CAAA,SAAS,CAyER,EAAA,OAAA,EAAA,CAAA,YAAY,aAzEb,SAAS,CAAA,EAAA,CAAA,CAAA;AA6ET,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAJd,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAIb,eAAe,EAAA,UAAA,EAAA,CAAA;kBAL3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,SAAS,CAAC;oBACpB,YAAY,EAAE,CAAC,SAAS,CAAC;AAC5B,iBAAA,CAAA;;;AC1FD;;AAEG;;;;"}
|
@@ -409,10 +409,10 @@ class InputNumber {
|
|
409
409
|
if (this.format) {
|
410
410
|
let formatter = new Intl.NumberFormat(this.locale, this.getOptions());
|
411
411
|
let formattedValue = formatter.format(value);
|
412
|
-
if (this.prefix) {
|
412
|
+
if (this.prefix && value != this.prefix) {
|
413
413
|
formattedValue = this.prefix + formattedValue;
|
414
414
|
}
|
415
|
-
if (this.suffix) {
|
415
|
+
if (this.suffix && value != this.suffix) {
|
416
416
|
formattedValue = formattedValue + this.suffix;
|
417
417
|
}
|
418
418
|
return formattedValue;
|
@@ -422,12 +422,15 @@ class InputNumber {
|
|
422
422
|
return '';
|
423
423
|
}
|
424
424
|
parseValue(text) {
|
425
|
+
const suffixRegex = new RegExp(this._suffix, '');
|
426
|
+
const prefixRegex = new RegExp(this._prefix, '');
|
427
|
+
const currencyRegex = new RegExp(this._currency, '');
|
425
428
|
let filteredText = text
|
426
|
-
.replace(
|
427
|
-
.replace(
|
429
|
+
.replace(suffixRegex, '')
|
430
|
+
.replace(prefixRegex, '')
|
428
431
|
.trim()
|
429
432
|
.replace(/\s/g, '')
|
430
|
-
.replace(
|
433
|
+
.replace(currencyRegex, '')
|
431
434
|
.replace(this._group, '')
|
432
435
|
.replace(this._minusSign, '-')
|
433
436
|
.replace(this._decimal, '.')
|
@@ -584,6 +587,9 @@ class InputNumber {
|
|
584
587
|
case 'Backspace': {
|
585
588
|
event.preventDefault();
|
586
589
|
if (selectionStart === selectionEnd) {
|
590
|
+
if ((selectionStart == 1 && this.prefix) || (selectionStart == inputValue.length && this.suffix)) {
|
591
|
+
break;
|
592
|
+
}
|
587
593
|
const deleteChar = inputValue.charAt(selectionStart - 1);
|
588
594
|
const { decimalCharIndex, decimalCharIndexWithoutPrefix } = this.getDecimalCharIndexes(inputValue);
|
589
595
|
if (this.isNumeralChar(deleteChar)) {
|
@@ -624,6 +630,9 @@ class InputNumber {
|
|
624
630
|
case 'Delete':
|
625
631
|
event.preventDefault();
|
626
632
|
if (selectionStart === selectionEnd) {
|
633
|
+
if ((selectionStart == 0 && this.prefix) || (selectionStart == inputValue.length - 1 && this.suffix)) {
|
634
|
+
break;
|
635
|
+
}
|
627
636
|
const deleteChar = inputValue.charAt(selectionStart);
|
628
637
|
const { decimalCharIndex, decimalCharIndexWithoutPrefix } = this.getDecimalCharIndexes(inputValue);
|
629
638
|
if (this.isNumeralChar(deleteChar)) {
|