primeng 16.6.0 → 16.7.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/animate/animate.d.ts +3 -2
- package/animateonscroll/animateonscroll.d.ts +73 -0
- package/animateonscroll/index.d.ts +5 -0
- package/animateonscroll/public_api.d.ts +1 -0
- package/api/primengconfig.d.ts +1 -0
- package/autocomplete/autocomplete.d.ts +177 -54
- package/autocomplete/autocomplete.interface.d.ts +30 -0
- package/cascadeselect/cascadeselect.d.ts +188 -68
- package/cascadeselect/cascadeselect.interface.d.ts +19 -0
- package/checkbox/checkbox.d.ts +1 -4
- package/chips/chips.d.ts +21 -5
- package/colorpicker/colorpicker.d.ts +5 -5
- package/contextmenu/contextmenu.d.ts +1 -0
- package/dialog/dialog.d.ts +1 -2
- package/dom/domhandler.d.ts +4 -1
- package/dropdown/dropdown.d.ts +115 -37
- package/esm2022/accordion/accordion.mjs +11 -7
- package/esm2022/animate/animate.mjs +4 -1
- package/esm2022/animateonscroll/animateonscroll.mjs +185 -0
- package/esm2022/animateonscroll/primeng-animateonscroll.mjs +5 -0
- package/esm2022/animateonscroll/public_api.mjs +2 -0
- package/esm2022/api/primengconfig.mjs +2 -1
- package/esm2022/autocomplete/autocomplete.interface.mjs +1 -1
- package/esm2022/autocomplete/autocomplete.mjs +893 -617
- package/esm2022/carousel/carousel.mjs +5 -1
- package/esm2022/cascadeselect/cascadeselect.interface.mjs +1 -1
- package/esm2022/cascadeselect/cascadeselect.mjs +921 -482
- package/esm2022/checkbox/checkbox.mjs +90 -73
- package/esm2022/chips/chips.mjs +197 -53
- package/esm2022/colorpicker/colorpicker.mjs +56 -37
- package/esm2022/contextmenu/contextmenu.mjs +10 -1
- package/esm2022/dialog/dialog.mjs +6 -11
- package/esm2022/dom/domhandler.mjs +26 -8
- package/esm2022/dropdown/dropdown.mjs +707 -588
- package/esm2022/inputmask/inputmask.mjs +22 -9
- package/esm2022/inputnumber/inputnumber.mjs +142 -83
- package/esm2022/inputswitch/inputswitch.mjs +55 -49
- package/esm2022/knob/knob.mjs +92 -5
- package/esm2022/listbox/listbox.interface.mjs +1 -1
- package/esm2022/listbox/listbox.mjs +996 -454
- package/esm2022/multiselect/multiselect.mjs +1022 -604
- package/esm2022/overlaypanel/overlaypanel.mjs +2 -2
- package/esm2022/paginator/paginator.mjs +2 -2
- package/esm2022/password/password.mjs +29 -28
- package/esm2022/radiobutton/radiobutton.mjs +46 -33
- package/esm2022/rating/rating.mjs +172 -80
- package/esm2022/selectbutton/selectbutton.mjs +105 -34
- package/esm2022/slider/slider.mjs +151 -66
- package/esm2022/table/table.mjs +3 -3
- package/esm2022/togglebutton/togglebutton.mjs +47 -10
- package/esm2022/tristatecheckbox/tristatecheckbox.mjs +53 -35
- package/fesm2022/primeng-accordion.mjs +10 -6
- package/fesm2022/primeng-accordion.mjs.map +1 -1
- package/fesm2022/primeng-animate.mjs +3 -0
- package/fesm2022/primeng-animate.mjs.map +1 -1
- package/fesm2022/primeng-animateonscroll.mjs +190 -0
- package/fesm2022/primeng-animateonscroll.mjs.map +1 -0
- package/fesm2022/primeng-api.mjs +1 -0
- package/fesm2022/primeng-api.mjs.map +1 -1
- package/fesm2022/primeng-autocomplete.mjs +893 -617
- package/fesm2022/primeng-autocomplete.mjs.map +1 -1
- package/fesm2022/primeng-carousel.mjs +4 -0
- package/fesm2022/primeng-carousel.mjs.map +1 -1
- package/fesm2022/primeng-cascadeselect.mjs +920 -481
- package/fesm2022/primeng-cascadeselect.mjs.map +1 -1
- package/fesm2022/primeng-checkbox.mjs +89 -72
- package/fesm2022/primeng-checkbox.mjs.map +1 -1
- package/fesm2022/primeng-chips.mjs +195 -51
- package/fesm2022/primeng-chips.mjs.map +1 -1
- package/fesm2022/primeng-colorpicker.mjs +55 -36
- package/fesm2022/primeng-colorpicker.mjs.map +1 -1
- package/fesm2022/primeng-contextmenu.mjs +9 -0
- package/fesm2022/primeng-contextmenu.mjs.map +1 -1
- package/fesm2022/primeng-dialog.mjs +5 -10
- package/fesm2022/primeng-dialog.mjs.map +1 -1
- package/fesm2022/primeng-dom.mjs +25 -7
- package/fesm2022/primeng-dom.mjs.map +1 -1
- package/fesm2022/primeng-dropdown.mjs +707 -588
- package/fesm2022/primeng-dropdown.mjs.map +1 -1
- package/fesm2022/primeng-inputmask.mjs +20 -7
- package/fesm2022/primeng-inputmask.mjs.map +1 -1
- package/fesm2022/primeng-inputnumber.mjs +140 -81
- package/fesm2022/primeng-inputnumber.mjs.map +1 -1
- package/fesm2022/primeng-inputswitch.mjs +55 -49
- package/fesm2022/primeng-inputswitch.mjs.map +1 -1
- package/fesm2022/primeng-knob.mjs +92 -5
- package/fesm2022/primeng-knob.mjs.map +1 -1
- package/fesm2022/primeng-listbox.mjs +995 -453
- package/fesm2022/primeng-listbox.mjs.map +1 -1
- package/fesm2022/primeng-multiselect.mjs +1021 -603
- package/fesm2022/primeng-multiselect.mjs.map +1 -1
- package/fesm2022/primeng-overlaypanel.mjs +1 -1
- package/fesm2022/primeng-overlaypanel.mjs.map +1 -1
- package/fesm2022/primeng-paginator.mjs +1 -1
- package/fesm2022/primeng-paginator.mjs.map +1 -1
- package/fesm2022/primeng-password.mjs +27 -26
- package/fesm2022/primeng-password.mjs.map +1 -1
- package/fesm2022/primeng-radiobutton.mjs +46 -33
- package/fesm2022/primeng-radiobutton.mjs.map +1 -1
- package/fesm2022/primeng-rating.mjs +171 -79
- package/fesm2022/primeng-rating.mjs.map +1 -1
- package/fesm2022/primeng-selectbutton.mjs +104 -33
- package/fesm2022/primeng-selectbutton.mjs.map +1 -1
- package/fesm2022/primeng-slider.mjs +150 -65
- package/fesm2022/primeng-slider.mjs.map +1 -1
- package/fesm2022/primeng-table.mjs +2 -2
- package/fesm2022/primeng-table.mjs.map +1 -1
- package/fesm2022/primeng-togglebutton.mjs +46 -9
- package/fesm2022/primeng-togglebutton.mjs.map +1 -1
- package/fesm2022/primeng-tristatecheckbox.mjs +53 -35
- package/fesm2022/primeng-tristatecheckbox.mjs.map +1 -1
- package/inputmask/inputmask.d.ts +6 -1
- package/inputnumber/inputnumber.d.ts +6 -1
- package/inputswitch/inputswitch.d.ts +6 -9
- package/knob/knob.d.ts +20 -3
- package/listbox/listbox.d.ts +208 -39
- package/listbox/listbox.interface.d.ts +15 -0
- package/multiselect/multiselect.d.ts +171 -60
- package/package.json +126 -120
- package/password/password.d.ts +3 -4
- package/radiobutton/radiobutton.d.ts +1 -2
- package/rating/rating.d.ts +29 -7
- package/resources/components/dropdown/dropdown.css +16 -2
- package/resources/themes/arya-blue/theme.css +106 -84
- package/resources/themes/arya-green/theme.css +106 -84
- package/resources/themes/arya-orange/theme.css +106 -84
- package/resources/themes/arya-purple/theme.css +106 -84
- package/resources/themes/bootstrap4-dark-blue/theme.css +110 -88
- package/resources/themes/bootstrap4-dark-purple/theme.css +110 -88
- package/resources/themes/bootstrap4-light-blue/theme.css +110 -88
- package/resources/themes/bootstrap4-light-purple/theme.css +110 -88
- package/resources/themes/fluent-light/theme.css +103 -81
- package/resources/themes/lara-dark-blue/theme.css +106 -84
- package/resources/themes/lara-dark-indigo/theme.css +106 -84
- package/resources/themes/lara-dark-purple/theme.css +106 -84
- package/resources/themes/lara-dark-teal/theme.css +106 -84
- package/resources/themes/lara-light-blue/theme.css +109 -87
- package/resources/themes/lara-light-indigo/theme.css +109 -87
- package/resources/themes/lara-light-purple/theme.css +109 -87
- package/resources/themes/lara-light-teal/theme.css +109 -87
- package/resources/themes/luna-amber/theme.css +110 -88
- package/resources/themes/luna-blue/theme.css +110 -88
- package/resources/themes/luna-green/theme.css +110 -88
- package/resources/themes/luna-pink/theme.css +110 -88
- package/resources/themes/md-dark-deeppurple/theme.css +117 -95
- package/resources/themes/md-dark-indigo/theme.css +117 -95
- package/resources/themes/md-light-deeppurple/theme.css +117 -95
- package/resources/themes/md-light-indigo/theme.css +117 -95
- package/resources/themes/mdc-dark-deeppurple/theme.css +117 -95
- package/resources/themes/mdc-dark-indigo/theme.css +117 -95
- package/resources/themes/mdc-light-deeppurple/theme.css +117 -95
- package/resources/themes/mdc-light-indigo/theme.css +117 -95
- package/resources/themes/mira/theme.css +107 -85
- package/resources/themes/nano/theme.css +109 -87
- package/resources/themes/nova/theme.css +110 -88
- package/resources/themes/nova-accent/theme.css +109 -87
- package/resources/themes/nova-alt/theme.css +110 -88
- package/resources/themes/rhea/theme.css +109 -87
- package/resources/themes/saga-blue/theme.css +106 -84
- package/resources/themes/saga-green/theme.css +106 -84
- package/resources/themes/saga-orange/theme.css +106 -84
- package/resources/themes/saga-purple/theme.css +106 -84
- package/resources/themes/soho-dark/theme.css +109 -87
- package/resources/themes/soho-light/theme.css +109 -87
- package/resources/themes/tailwind-light/theme.css +110 -88
- package/resources/themes/vela-blue/theme.css +106 -84
- package/resources/themes/vela-green/theme.css +106 -84
- package/resources/themes/vela-orange/theme.css +106 -84
- package/resources/themes/vela-purple/theme.css +106 -84
- package/resources/themes/viva-dark/theme.css +109 -87
- package/resources/themes/viva-light/theme.css +109 -87
- package/selectbutton/selectbutton.d.ts +15 -3
- package/slider/slider.d.ts +12 -6
- package/togglebutton/togglebutton.d.ts +7 -1
- package/tristatecheckbox/tristatecheckbox.d.ts +8 -4
@@ -1,19 +1,19 @@
|
|
1
1
|
import * as i1 from '@angular/common';
|
2
2
|
import { CommonModule } from '@angular/common';
|
3
3
|
import * as i0 from '@angular/core';
|
4
|
-
import { forwardRef, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy,
|
4
|
+
import { forwardRef, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, signal, computed, effect, ViewChild, ContentChildren, NgModule } from '@angular/core';
|
5
5
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
6
6
|
import * as i3 from 'primeng/api';
|
7
7
|
import { PrimeTemplate, SharedModule } from 'primeng/api';
|
8
8
|
import { DomHandler } from 'primeng/dom';
|
9
|
+
import { AngleRightIcon } from 'primeng/icons/angleright';
|
10
|
+
import { ChevronDownIcon } from 'primeng/icons/chevrondown';
|
11
|
+
import { TimesIcon } from 'primeng/icons/times';
|
9
12
|
import * as i4 from 'primeng/overlay';
|
10
13
|
import { OverlayModule } from 'primeng/overlay';
|
11
14
|
import * as i2 from 'primeng/ripple';
|
12
15
|
import { RippleModule } from 'primeng/ripple';
|
13
|
-
import { ObjectUtils } from 'primeng/utils';
|
14
|
-
import { ChevronDownIcon } from 'primeng/icons/chevrondown';
|
15
|
-
import { AngleRightIcon } from 'primeng/icons/angleright';
|
16
|
-
import { TimesIcon } from 'primeng/icons/times';
|
16
|
+
import { ObjectUtils, UniqueComponentId } from 'primeng/utils';
|
17
17
|
|
18
18
|
const CASCADESELECT_VALUE_ACCESSOR = {
|
19
19
|
provide: NG_VALUE_ACCESSOR,
|
@@ -22,7 +22,11 @@ const CASCADESELECT_VALUE_ACCESSOR = {
|
|
22
22
|
};
|
23
23
|
class CascadeSelectSub {
|
24
24
|
el;
|
25
|
-
|
25
|
+
role;
|
26
|
+
selectId;
|
27
|
+
activeOptionPath;
|
28
|
+
optionDisabled;
|
29
|
+
focusedOptionId;
|
26
30
|
options;
|
27
31
|
optionGroupChildren;
|
28
32
|
optionTemplate;
|
@@ -33,137 +37,67 @@ class CascadeSelectSub {
|
|
33
37
|
optionGroupLabel;
|
34
38
|
dirty;
|
35
39
|
root;
|
36
|
-
|
37
|
-
|
38
|
-
get parentActive() {
|
39
|
-
return this._parentActive;
|
40
|
-
}
|
41
|
-
set parentActive(val) {
|
42
|
-
if (!val) {
|
43
|
-
this.activeOption = null;
|
44
|
-
}
|
45
|
-
this._parentActive = val;
|
46
|
-
}
|
47
|
-
activeOption = null;
|
48
|
-
_parentActive = false;
|
49
|
-
cascadeSelect;
|
50
|
-
constructor(cascadeSelect, el) {
|
40
|
+
onChange = new EventEmitter();
|
41
|
+
constructor(el) {
|
51
42
|
this.el = el;
|
52
|
-
this.cascadeSelect = cascadeSelect;
|
53
43
|
}
|
54
44
|
ngOnInit() {
|
55
|
-
if (this.selectionPath && this.options && !this.dirty) {
|
56
|
-
for (let option of this.options) {
|
57
|
-
if (this.selectionPath.includes(option)) {
|
58
|
-
this.activeOption = option;
|
59
|
-
break;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
45
|
if (!this.root) {
|
64
46
|
this.position();
|
65
47
|
}
|
66
48
|
}
|
67
49
|
onOptionClick(event, option) {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
});
|
74
|
-
}
|
75
|
-
else {
|
76
|
-
this.onSelect.emit({
|
77
|
-
originalEvent: event,
|
78
|
-
value: this.getOptionValue(option)
|
79
|
-
});
|
80
|
-
}
|
50
|
+
this.onChange.emit({
|
51
|
+
originalEvent: event,
|
52
|
+
value: option,
|
53
|
+
isFocus: true
|
54
|
+
});
|
81
55
|
}
|
82
|
-
|
83
|
-
this.
|
56
|
+
onOptionChange(event) {
|
57
|
+
this.onChange.emit(event);
|
84
58
|
}
|
85
|
-
|
86
|
-
this.
|
59
|
+
getOptionId(processedOption) {
|
60
|
+
return `${this.selectId}_${processedOption.key}`;
|
87
61
|
}
|
88
|
-
getOptionLabel(
|
89
|
-
return this.optionLabel ? ObjectUtils.resolveFieldData(option, this.optionLabel) : option;
|
62
|
+
getOptionLabel(processedOption) {
|
63
|
+
return this.optionLabel ? ObjectUtils.resolveFieldData(processedOption.option, this.optionLabel) : processedOption.option;
|
90
64
|
}
|
91
|
-
getOptionValue(
|
92
|
-
return this.optionValue ? ObjectUtils.resolveFieldData(option, this.optionValue) : option;
|
65
|
+
getOptionValue(processedOption) {
|
66
|
+
return this.optionValue ? ObjectUtils.resolveFieldData(processedOption.option, this.optionValue) : processedOption.option;
|
93
67
|
}
|
94
|
-
|
95
|
-
return this.
|
68
|
+
getOptionLabelToRender(processedOption) {
|
69
|
+
return this.isOptionGroup(processedOption) ? this.getOptionGroupLabel(processedOption) : this.getOptionLabel(processedOption);
|
70
|
+
}
|
71
|
+
isOptionDisabled(processedOption) {
|
72
|
+
return this.optionDisabled ? ObjectUtils.resolveFieldData(processedOption.option, this.optionDisabled) : false;
|
73
|
+
}
|
74
|
+
getOptionGroupLabel(processedOption) {
|
75
|
+
return this.optionGroupLabel ? ObjectUtils.resolveFieldData(processedOption.option, this.optionGroupLabel) : null;
|
96
76
|
}
|
97
|
-
getOptionGroupChildren(
|
98
|
-
return
|
77
|
+
getOptionGroupChildren(processedOption) {
|
78
|
+
return processedOption.children;
|
99
79
|
}
|
100
|
-
isOptionGroup(
|
101
|
-
return
|
80
|
+
isOptionGroup(processedOption) {
|
81
|
+
return ObjectUtils.isNotEmpty(processedOption.children);
|
102
82
|
}
|
103
|
-
|
104
|
-
return this.isOptionGroup(
|
83
|
+
isOptionSelected(processedOption) {
|
84
|
+
return !this.isOptionGroup(processedOption) && this.isOptionActive(processedOption);
|
85
|
+
}
|
86
|
+
isOptionActive(processedOption) {
|
87
|
+
return this.activeOptionPath.some((path) => path.key === processedOption.key);
|
88
|
+
}
|
89
|
+
isOptionFocused(processedOption) {
|
90
|
+
return this.focusedOptionId === this.getOptionId(processedOption);
|
105
91
|
}
|
106
92
|
getItemClass(option) {
|
107
93
|
return {
|
108
94
|
'p-cascadeselect-item': true,
|
109
95
|
'p-cascadeselect-item-group': this.isOptionGroup(option),
|
110
|
-
'p-cascadeselect-item-active p-highlight': this.isOptionActive(option)
|
96
|
+
'p-cascadeselect-item-active p-highlight': this.isOptionActive(option),
|
97
|
+
'p-focus': this.isOptionFocused(option),
|
98
|
+
'p-disabled': this.isOptionDisabled(option)
|
111
99
|
};
|
112
100
|
}
|
113
|
-
isOptionActive(option) {
|
114
|
-
return this.activeOption === option;
|
115
|
-
}
|
116
|
-
onKeyDown(event, option, index) {
|
117
|
-
let listItem = event.currentTarget.parentElement;
|
118
|
-
switch (event.key) {
|
119
|
-
case 'Down':
|
120
|
-
case 'ArrowDown':
|
121
|
-
var nextItem = this.el.nativeElement.children[0].children[index + 1];
|
122
|
-
if (nextItem) {
|
123
|
-
nextItem.children[0].focus();
|
124
|
-
}
|
125
|
-
event.preventDefault();
|
126
|
-
break;
|
127
|
-
case 'Up':
|
128
|
-
case 'ArrowUp':
|
129
|
-
var prevItem = this.el.nativeElement.children[0].children[index - 1];
|
130
|
-
if (prevItem) {
|
131
|
-
prevItem.children[0].focus();
|
132
|
-
}
|
133
|
-
event.preventDefault();
|
134
|
-
break;
|
135
|
-
case 'Right':
|
136
|
-
case 'ArrowRight':
|
137
|
-
if (this.isOptionGroup(option)) {
|
138
|
-
if (this.isOptionActive(option)) {
|
139
|
-
listItem.children[1].children[0].children[0].children[0].focus();
|
140
|
-
}
|
141
|
-
else {
|
142
|
-
this.activeOption = option;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
event.preventDefault();
|
146
|
-
break;
|
147
|
-
case 'Left':
|
148
|
-
case 'ArrowLeft':
|
149
|
-
this.activeOption = null;
|
150
|
-
var parentList = listItem.parentElement.parentElement.parentElement;
|
151
|
-
if (parentList) {
|
152
|
-
parentList.children[0].focus();
|
153
|
-
}
|
154
|
-
event.preventDefault();
|
155
|
-
break;
|
156
|
-
case 'Enter':
|
157
|
-
this.onOptionClick(event, option);
|
158
|
-
event.preventDefault();
|
159
|
-
break;
|
160
|
-
case 'Tab':
|
161
|
-
case 'Escape':
|
162
|
-
this.cascadeSelect.hide();
|
163
|
-
event.preventDefault();
|
164
|
-
break;
|
165
|
-
}
|
166
|
-
}
|
167
101
|
position() {
|
168
102
|
const parentItem = this.el.nativeElement.parentElement;
|
169
103
|
const containerOffset = DomHandler.getOffset(parentItem);
|
@@ -174,36 +108,47 @@ class CascadeSelectSub {
|
|
174
108
|
this.el.nativeElement.children[0].style.left = '-200%';
|
175
109
|
}
|
176
110
|
}
|
177
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CascadeSelectSub, deps: [{ token:
|
178
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: CascadeSelectSub, selector: "p-cascadeSelectSub", inputs: {
|
179
|
-
<ul class="p-cascadeselect-panel p-cascadeselect-items" [ngClass]="{ 'p-cascadeselect-panel-root': root }" role="
|
180
|
-
<ng-template ngFor let-
|
181
|
-
<li
|
182
|
-
|
111
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CascadeSelectSub, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
112
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: CascadeSelectSub, selector: "p-cascadeSelectSub", inputs: { role: "role", selectId: "selectId", activeOptionPath: "activeOptionPath", optionDisabled: "optionDisabled", focusedOptionId: "focusedOptionId", options: "options", optionGroupChildren: "optionGroupChildren", optionTemplate: "optionTemplate", groupIconTemplate: "groupIconTemplate", level: "level", optionLabel: "optionLabel", optionValue: "optionValue", optionGroupLabel: "optionGroupLabel", dirty: "dirty", root: "root" }, outputs: { onChange: "onChange" }, ngImport: i0, template: `
|
113
|
+
<ul class="p-cascadeselect-panel p-cascadeselect-items" [ngClass]="{ 'p-cascadeselect-panel-root': root }" [attr.role]="role" aria-orientation="horizontal" [attr.data-pc-section]="level === 0 ? 'list' : 'sublist'">
|
114
|
+
<ng-template ngFor let-processedOption [ngForOf]="options" let-i="index">
|
115
|
+
<li
|
116
|
+
[ngClass]="getItemClass(processedOption)"
|
117
|
+
role="treeitem"
|
118
|
+
[attr.aria-level]="level + 1"
|
119
|
+
[attr.aria-setsize]="options.length"
|
120
|
+
[attr.data-pc-section]="'item'"
|
121
|
+
[id]="getOptionId(processedOption)"
|
122
|
+
[attr.aria-label]="getOptionLabelToRender(processedOption)"
|
123
|
+
[attr.aria-selected]="isOptionGroup(processedOption) ? undefined : isOptionSelected(processedOption)"
|
124
|
+
[attr.aria-posinset]="i + 1"
|
125
|
+
>
|
126
|
+
<div class="p-cascadeselect-item-content" (click)="onOptionClick($event, processedOption)" [attr.tabindex]="0" pRipple [attr.data-pc-section]="'content'">
|
183
127
|
<ng-container *ngIf="optionTemplate; else defaultOptionTemplate">
|
184
|
-
<ng-container *ngTemplateOutlet="optionTemplate; context: { $implicit: option }"></ng-container>
|
128
|
+
<ng-container *ngTemplateOutlet="optionTemplate; context: { $implicit: processedOption.option }"></ng-container>
|
185
129
|
</ng-container>
|
186
130
|
<ng-template #defaultOptionTemplate>
|
187
|
-
<span class="p-cascadeselect-item-text">{{ getOptionLabelToRender(
|
131
|
+
<span class="p-cascadeselect-item-text" [attr.data-pc-section]="'text'">{{ getOptionLabelToRender(processedOption) }}</span>
|
188
132
|
</ng-template>
|
189
|
-
<span class="p-cascadeselect-group-icon" *ngIf="isOptionGroup(
|
133
|
+
<span class="p-cascadeselect-group-icon" *ngIf="isOptionGroup(processedOption)" [attr.data-pc-section]="'groupIcon'">
|
190
134
|
<AngleRightIcon *ngIf="!groupIconTemplate" />
|
191
135
|
<ng-template *ngTemplateOutlet="groupIconTemplate"></ng-template>
|
192
136
|
</span>
|
193
137
|
</div>
|
194
138
|
<p-cascadeSelectSub
|
195
|
-
*ngIf="isOptionGroup(
|
139
|
+
*ngIf="isOptionGroup(processedOption) && isOptionActive(processedOption)"
|
140
|
+
[role]="'group'"
|
196
141
|
class="p-cascadeselect-sublist"
|
197
|
-
[
|
198
|
-
[
|
142
|
+
[selectId]="selectId"
|
143
|
+
[focusedOptionId]="focusedOptionId"
|
144
|
+
[activeOptionPath]="activeOptionPath"
|
145
|
+
[options]="getOptionGroupChildren(processedOption)"
|
199
146
|
[optionLabel]="optionLabel"
|
200
147
|
[optionValue]="optionValue"
|
201
148
|
[level]="level + 1"
|
202
|
-
(
|
203
|
-
(onOptionGroupSelect)="onOptionGroupSelect()"
|
149
|
+
(onChange)="onOptionChange($event)"
|
204
150
|
[optionGroupLabel]="optionGroupLabel"
|
205
151
|
[optionGroupChildren]="optionGroupChildren"
|
206
|
-
[parentActive]="isOptionActive(option)"
|
207
152
|
[dirty]="dirty"
|
208
153
|
[optionTemplate]="optionTemplate"
|
209
154
|
>
|
@@ -211,41 +156,52 @@ class CascadeSelectSub {
|
|
211
156
|
</li>
|
212
157
|
</ng-template>
|
213
158
|
</ul>
|
214
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgTemplateOutlet; }), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(function () { return i2.Ripple; }), selector: "[pRipple]" }, { kind: "component", type: i0.forwardRef(function () { return AngleRightIcon; }), selector: "AngleRightIcon" }, { kind: "component", type: i0.forwardRef(function () { return CascadeSelectSub; }), selector: "p-cascadeSelectSub", inputs: ["
|
159
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgTemplateOutlet; }), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(function () { return i2.Ripple; }), selector: "[pRipple]" }, { kind: "component", type: i0.forwardRef(function () { return AngleRightIcon; }), selector: "AngleRightIcon" }, { kind: "component", type: i0.forwardRef(function () { return CascadeSelectSub; }), selector: "p-cascadeSelectSub", inputs: ["role", "selectId", "activeOptionPath", "optionDisabled", "focusedOptionId", "options", "optionGroupChildren", "optionTemplate", "groupIconTemplate", "level", "optionLabel", "optionValue", "optionGroupLabel", "dirty", "root"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
215
160
|
}
|
216
161
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CascadeSelectSub, decorators: [{
|
217
162
|
type: Component,
|
218
163
|
args: [{
|
219
164
|
selector: 'p-cascadeSelectSub',
|
220
165
|
template: `
|
221
|
-
<ul class="p-cascadeselect-panel p-cascadeselect-items" [ngClass]="{ 'p-cascadeselect-panel-root': root }" role="
|
222
|
-
<ng-template ngFor let-
|
223
|
-
<li
|
224
|
-
|
166
|
+
<ul class="p-cascadeselect-panel p-cascadeselect-items" [ngClass]="{ 'p-cascadeselect-panel-root': root }" [attr.role]="role" aria-orientation="horizontal" [attr.data-pc-section]="level === 0 ? 'list' : 'sublist'">
|
167
|
+
<ng-template ngFor let-processedOption [ngForOf]="options" let-i="index">
|
168
|
+
<li
|
169
|
+
[ngClass]="getItemClass(processedOption)"
|
170
|
+
role="treeitem"
|
171
|
+
[attr.aria-level]="level + 1"
|
172
|
+
[attr.aria-setsize]="options.length"
|
173
|
+
[attr.data-pc-section]="'item'"
|
174
|
+
[id]="getOptionId(processedOption)"
|
175
|
+
[attr.aria-label]="getOptionLabelToRender(processedOption)"
|
176
|
+
[attr.aria-selected]="isOptionGroup(processedOption) ? undefined : isOptionSelected(processedOption)"
|
177
|
+
[attr.aria-posinset]="i + 1"
|
178
|
+
>
|
179
|
+
<div class="p-cascadeselect-item-content" (click)="onOptionClick($event, processedOption)" [attr.tabindex]="0" pRipple [attr.data-pc-section]="'content'">
|
225
180
|
<ng-container *ngIf="optionTemplate; else defaultOptionTemplate">
|
226
|
-
<ng-container *ngTemplateOutlet="optionTemplate; context: { $implicit: option }"></ng-container>
|
181
|
+
<ng-container *ngTemplateOutlet="optionTemplate; context: { $implicit: processedOption.option }"></ng-container>
|
227
182
|
</ng-container>
|
228
183
|
<ng-template #defaultOptionTemplate>
|
229
|
-
<span class="p-cascadeselect-item-text">{{ getOptionLabelToRender(
|
184
|
+
<span class="p-cascadeselect-item-text" [attr.data-pc-section]="'text'">{{ getOptionLabelToRender(processedOption) }}</span>
|
230
185
|
</ng-template>
|
231
|
-
<span class="p-cascadeselect-group-icon" *ngIf="isOptionGroup(
|
186
|
+
<span class="p-cascadeselect-group-icon" *ngIf="isOptionGroup(processedOption)" [attr.data-pc-section]="'groupIcon'">
|
232
187
|
<AngleRightIcon *ngIf="!groupIconTemplate" />
|
233
188
|
<ng-template *ngTemplateOutlet="groupIconTemplate"></ng-template>
|
234
189
|
</span>
|
235
190
|
</div>
|
236
191
|
<p-cascadeSelectSub
|
237
|
-
*ngIf="isOptionGroup(
|
192
|
+
*ngIf="isOptionGroup(processedOption) && isOptionActive(processedOption)"
|
193
|
+
[role]="'group'"
|
238
194
|
class="p-cascadeselect-sublist"
|
239
|
-
[
|
240
|
-
[
|
195
|
+
[selectId]="selectId"
|
196
|
+
[focusedOptionId]="focusedOptionId"
|
197
|
+
[activeOptionPath]="activeOptionPath"
|
198
|
+
[options]="getOptionGroupChildren(processedOption)"
|
241
199
|
[optionLabel]="optionLabel"
|
242
200
|
[optionValue]="optionValue"
|
243
201
|
[level]="level + 1"
|
244
|
-
(
|
245
|
-
(onOptionGroupSelect)="onOptionGroupSelect()"
|
202
|
+
(onChange)="onOptionChange($event)"
|
246
203
|
[optionGroupLabel]="optionGroupLabel"
|
247
204
|
[optionGroupChildren]="optionGroupChildren"
|
248
|
-
[parentActive]="isOptionActive(option)"
|
249
205
|
[dirty]="dirty"
|
250
206
|
[optionTemplate]="optionTemplate"
|
251
207
|
>
|
@@ -257,10 +213,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
257
213
|
encapsulation: ViewEncapsulation.None,
|
258
214
|
changeDetection: ChangeDetectionStrategy.OnPush
|
259
215
|
}]
|
260
|
-
}], ctorParameters: function () { return [{ type:
|
261
|
-
|
262
|
-
|
263
|
-
|
216
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { role: [{
|
217
|
+
type: Input
|
218
|
+
}], selectId: [{
|
219
|
+
type: Input
|
220
|
+
}], activeOptionPath: [{
|
221
|
+
type: Input
|
222
|
+
}], optionDisabled: [{
|
223
|
+
type: Input
|
224
|
+
}], focusedOptionId: [{
|
264
225
|
type: Input
|
265
226
|
}], options: [{
|
266
227
|
type: Input
|
@@ -282,12 +243,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
282
243
|
type: Input
|
283
244
|
}], root: [{
|
284
245
|
type: Input
|
285
|
-
}],
|
286
|
-
type: Output
|
287
|
-
}], onGroupSelect: [{
|
246
|
+
}], onChange: [{
|
288
247
|
type: Output
|
289
|
-
}], parentActive: [{
|
290
|
-
type: Input
|
291
248
|
}] } });
|
292
249
|
/**
|
293
250
|
* CascadeSelect is a form component to select a value from a nested structure of options.
|
@@ -298,6 +255,60 @@ class CascadeSelect {
|
|
298
255
|
cd;
|
299
256
|
config;
|
300
257
|
overlayService;
|
258
|
+
/**
|
259
|
+
* Unique identifier of the component
|
260
|
+
* @group Props
|
261
|
+
*/
|
262
|
+
id;
|
263
|
+
/**
|
264
|
+
* Determines if the option will be selected on focus.
|
265
|
+
* @group Props
|
266
|
+
*/
|
267
|
+
selectOnFocus = false;
|
268
|
+
/**
|
269
|
+
* Text to display when the search is active. Defaults to global value in i18n translation configuration.
|
270
|
+
* @group Props
|
271
|
+
* @defaultValue '{0} results are available'
|
272
|
+
*/
|
273
|
+
searchMessage;
|
274
|
+
/**
|
275
|
+
* Text to display when there is no data. Defaults to global value in i18n translation configuration.
|
276
|
+
* @group Props
|
277
|
+
*/
|
278
|
+
emptyMessage;
|
279
|
+
/**
|
280
|
+
* Text to be displayed in hidden accessible field when options are selected. Defaults to global value in i18n translation configuration.
|
281
|
+
* @group Props
|
282
|
+
* @defaultValue '{0} items selected'
|
283
|
+
*/
|
284
|
+
selectionMessage;
|
285
|
+
/**
|
286
|
+
* Text to display when filtering does not return any results. Defaults to value from PrimeVue locale configuration.
|
287
|
+
* @group Props
|
288
|
+
* @defaultValue 'No available options'
|
289
|
+
*/
|
290
|
+
emptySearchMessage;
|
291
|
+
/**
|
292
|
+
* Text to display when filtering does not return any results. Defaults to global value in i18n translation configuration.
|
293
|
+
* @group Props
|
294
|
+
* @defaultValue 'No selected item'
|
295
|
+
*/
|
296
|
+
emptySelectionMessage;
|
297
|
+
/**
|
298
|
+
* Locale to use in searching. The default locale is the host environment's current locale.
|
299
|
+
* @group Props
|
300
|
+
*/
|
301
|
+
searchLocale;
|
302
|
+
/**
|
303
|
+
* Name of the disabled field of an option.
|
304
|
+
* @group Props
|
305
|
+
*/
|
306
|
+
optionDisabled;
|
307
|
+
/**
|
308
|
+
* Whether to focus on the first visible or selected element when the overlay panel is shown.
|
309
|
+
* @group Props
|
310
|
+
*/
|
311
|
+
autoOptionFocus = true;
|
301
312
|
/**
|
302
313
|
* Style class of the component.
|
303
314
|
* @group Props
|
@@ -357,7 +368,7 @@ class CascadeSelect {
|
|
357
368
|
* Index of the element in tabbing order.
|
358
369
|
* @group Props
|
359
370
|
*/
|
360
|
-
tabindex;
|
371
|
+
tabindex = 0;
|
361
372
|
/**
|
362
373
|
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
363
374
|
* @group Props
|
@@ -403,9 +414,33 @@ class CascadeSelect {
|
|
403
414
|
* @group Props
|
404
415
|
*/
|
405
416
|
overlayOptions;
|
417
|
+
/**
|
418
|
+
* Transition options of the show animation.
|
419
|
+
* @group Props
|
420
|
+
* @deprecated deprecated since v14.2.0, use overlayOptions property instead.
|
421
|
+
*/
|
422
|
+
get showTransitionOptions() {
|
423
|
+
return this._showTransitionOptions;
|
424
|
+
}
|
425
|
+
set showTransitionOptions(val) {
|
426
|
+
this._showTransitionOptions = val;
|
427
|
+
console.warn('The showTransitionOptions property is deprecated since v14.2.0, use overlayOptions property instead.');
|
428
|
+
}
|
429
|
+
/**
|
430
|
+
* Transition options of the hide animation.
|
431
|
+
* @group Props
|
432
|
+
* @deprecated deprecated since v14.2.0, use overlayOptions property instead.
|
433
|
+
*/
|
434
|
+
get hideTransitionOptions() {
|
435
|
+
return this._hideTransitionOptions;
|
436
|
+
}
|
437
|
+
set hideTransitionOptions(val) {
|
438
|
+
this._hideTransitionOptions = val;
|
439
|
+
console.warn('The hideTransitionOptions property is deprecated since v14.2.0, use overlayOptions property instead.');
|
440
|
+
}
|
406
441
|
/**
|
407
442
|
* Callback to invoke on value change.
|
408
|
-
* @param {
|
443
|
+
* @param {CascadeSelectChangeEvent} event - Custom change event.
|
409
444
|
* @group Emits
|
410
445
|
*/
|
411
446
|
onChange = new EventEmitter();
|
@@ -445,41 +480,30 @@ class CascadeSelect {
|
|
445
480
|
*/
|
446
481
|
onBeforeHide = new EventEmitter();
|
447
482
|
/**
|
448
|
-
*
|
449
|
-
* @
|
450
|
-
* @
|
483
|
+
* Callback to invoke when input receives focus.
|
484
|
+
* @param {FocusEvent} event - Focus event.
|
485
|
+
* @group Emits
|
451
486
|
*/
|
452
|
-
|
453
|
-
return this._showTransitionOptions;
|
454
|
-
}
|
455
|
-
set showTransitionOptions(val) {
|
456
|
-
this._showTransitionOptions = val;
|
457
|
-
console.warn('The showTransitionOptions property is deprecated since v14.2.0, use overlayOptions property instead.');
|
458
|
-
}
|
487
|
+
onFocus = new EventEmitter();
|
459
488
|
/**
|
460
|
-
*
|
461
|
-
* @
|
462
|
-
* @
|
489
|
+
* Callback to invoke when input loses focus.
|
490
|
+
* @param {FocusEvent} event - Focus event.
|
491
|
+
* @group Emits
|
463
492
|
*/
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
this._hideTransitionOptions = val;
|
469
|
-
console.warn('The hideTransitionOptions property is deprecated since v14.2.0, use overlayOptions property instead.');
|
470
|
-
}
|
471
|
-
focusInputEl;
|
472
|
-
containerEl;
|
473
|
-
panelEl;
|
493
|
+
onBlur = new EventEmitter();
|
494
|
+
focusInputViewChild;
|
495
|
+
containerViewChild;
|
496
|
+
panelViewChild;
|
474
497
|
overlayViewChild;
|
475
498
|
templates;
|
476
499
|
_showTransitionOptions = '';
|
477
500
|
_hideTransitionOptions = '';
|
478
501
|
selectionPath = null;
|
479
502
|
focused = false;
|
480
|
-
filled = false;
|
481
503
|
overlayVisible = false;
|
482
|
-
dirty =
|
504
|
+
dirty = true;
|
505
|
+
searchValue;
|
506
|
+
searchTimeout;
|
483
507
|
valueTemplate;
|
484
508
|
optionTemplate;
|
485
509
|
triggerIconTemplate;
|
@@ -487,109 +511,337 @@ class CascadeSelect {
|
|
487
511
|
clearIconTemplate;
|
488
512
|
onModelChange = () => { };
|
489
513
|
onModelTouched = () => { };
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
514
|
+
focusedOptionInfo = signal({ index: -1, level: 0, parentKey: '' });
|
515
|
+
activeOptionPath = signal([]);
|
516
|
+
modelValue = signal(null);
|
517
|
+
get containerClass() {
|
518
|
+
return {
|
519
|
+
'p-cascadeselect p-component p-inputwrapper': true,
|
520
|
+
'p-disabled': this.disabled,
|
521
|
+
'p-focus': this.focused,
|
522
|
+
'p-inputwrapper-filled': this.modelValue(),
|
523
|
+
'p-inputwrapper-focus': this.focused || this.overlayVisible,
|
524
|
+
'p-overlay-open': this.overlayVisible
|
525
|
+
};
|
495
526
|
}
|
496
|
-
|
497
|
-
|
527
|
+
get labelClass() {
|
528
|
+
return {
|
529
|
+
'p-cascadeselect-label': true,
|
530
|
+
'p-inputtext': true,
|
531
|
+
'p-placeholder': this.label() === this.placeholder,
|
532
|
+
'p-cascadeselect-label-empty': !this.value && (this.label() === 'p-emptylabel' || this.label().length === 0)
|
533
|
+
};
|
498
534
|
}
|
499
|
-
|
500
|
-
this.
|
501
|
-
switch (item.getType()) {
|
502
|
-
case 'value':
|
503
|
-
this.valueTemplate = item.template;
|
504
|
-
break;
|
505
|
-
case 'option':
|
506
|
-
this.optionTemplate = item.template;
|
507
|
-
break;
|
508
|
-
case 'triggericon':
|
509
|
-
this.triggerIconTemplate = item.template;
|
510
|
-
break;
|
511
|
-
case 'clearicon':
|
512
|
-
this.clearIconTemplate = item.template;
|
513
|
-
break;
|
514
|
-
case 'optiongroupicon':
|
515
|
-
this.groupIconTemplate = item.template;
|
516
|
-
break;
|
517
|
-
}
|
518
|
-
});
|
535
|
+
get focusedOptionId() {
|
536
|
+
return this.focusedOptionInfo().index !== -1 ? `${this.id}${ObjectUtils.isNotEmpty(this.focusedOptionInfo().parentKey) ? '_' + this.focusedOptionInfo().parentKey : ''}_${this.focusedOptionInfo().index}` : null;
|
519
537
|
}
|
520
|
-
|
521
|
-
this.
|
522
|
-
|
523
|
-
this.
|
524
|
-
this.onChange.emit(event);
|
525
|
-
this.hide();
|
526
|
-
this.focusInputEl?.nativeElement.focus();
|
538
|
+
get filled() {
|
539
|
+
if (typeof this.modelValue() === 'string')
|
540
|
+
return !!this.modelValue();
|
541
|
+
return this.modelValue() || this.modelValue() != null || this.modelValue() != undefined;
|
527
542
|
}
|
528
|
-
|
529
|
-
this.
|
530
|
-
this.onGroupChange.emit(event);
|
543
|
+
get searchResultMessageText() {
|
544
|
+
return ObjectUtils.isNotEmpty(this.visibleOptions()) ? this.searchMessageText.replaceAll('{0}', this.visibleOptions().length) : this.emptySearchMessageText;
|
531
545
|
}
|
532
|
-
|
533
|
-
return this.
|
546
|
+
get searchMessageText() {
|
547
|
+
return this.searchMessage || this.config.translation.searchMessage || '';
|
534
548
|
}
|
535
|
-
|
536
|
-
return this.
|
549
|
+
get emptySearchMessageText() {
|
550
|
+
return this.emptySearchMessage || this.config.translation.emptySearchMessage || '';
|
537
551
|
}
|
538
|
-
|
539
|
-
return
|
552
|
+
get emptyMessageText() {
|
553
|
+
return this.emptyMessage || this.config.translation.emptyMessage || '';
|
540
554
|
}
|
541
|
-
|
542
|
-
return
|
555
|
+
get selectionMessageText() {
|
556
|
+
return this.selectionMessage || this.config.translation.selectionMessage || '';
|
543
557
|
}
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
558
|
+
get emptySelectionMessageText() {
|
559
|
+
return this.emptySelectionMessage || this.config.translation.emptySelectionMessage || '';
|
560
|
+
}
|
561
|
+
get selectedMessageText() {
|
562
|
+
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText;
|
563
|
+
}
|
564
|
+
visibleOptions = computed(() => {
|
565
|
+
const processedOption = this.activeOptionPath().find((p) => p.key === this.focusedOptionInfo().parentKey);
|
566
|
+
return processedOption ? processedOption.children : this.processedOptions();
|
567
|
+
});
|
568
|
+
processedOptions = computed(() => {
|
569
|
+
return this.createProcessedOptions(this.options || []);
|
570
|
+
});
|
571
|
+
label = computed(() => {
|
572
|
+
const label = this.placeholder || 'p-emptylabel';
|
573
|
+
if (this.hasSelectedOption()) {
|
574
|
+
const activeOptionPath = this.findOptionPathByValue(this.modelValue(), null);
|
575
|
+
const processedOption = ObjectUtils.isNotEmpty(activeOptionPath) ? activeOptionPath[activeOptionPath.length - 1] : null;
|
576
|
+
return processedOption ? this.getOptionLabel(processedOption.option) : label;
|
577
|
+
}
|
578
|
+
return label;
|
579
|
+
});
|
580
|
+
get _label() {
|
581
|
+
const label = this.placeholder || 'p-emptylabel';
|
582
|
+
if (this.hasSelectedOption()) {
|
583
|
+
const activeOptionPath = this.findOptionPathByValue(this.modelValue(), null);
|
584
|
+
const processedOption = ObjectUtils.isNotEmpty(activeOptionPath) ? activeOptionPath[activeOptionPath.length - 1] : null;
|
585
|
+
return processedOption ? this.getOptionLabel(processedOption.option) : label;
|
586
|
+
}
|
587
|
+
return label;
|
588
|
+
}
|
589
|
+
hasSelectedOption() {
|
590
|
+
return ObjectUtils.isNotEmpty(this.modelValue());
|
591
|
+
}
|
592
|
+
createProcessedOptions(options, level = 0, parent = {}, parentKey = '') {
|
593
|
+
const processedOptions = [];
|
594
|
+
options &&
|
595
|
+
options.forEach((option, index) => {
|
596
|
+
const key = (parentKey !== '' ? parentKey + '_' : '') + index;
|
597
|
+
const newOption = {
|
598
|
+
option,
|
599
|
+
index,
|
600
|
+
level,
|
601
|
+
key,
|
602
|
+
parent,
|
603
|
+
parentKey
|
604
|
+
};
|
605
|
+
newOption['children'] = this.createProcessedOptions(this.getOptionGroupChildren(option, level), level + 1, newOption, key);
|
606
|
+
processedOptions.push(newOption);
|
607
|
+
});
|
608
|
+
return processedOptions;
|
609
|
+
}
|
610
|
+
onInputFocus(event) {
|
611
|
+
if (this.disabled) {
|
612
|
+
// For screenreaders
|
613
|
+
return;
|
614
|
+
}
|
615
|
+
this.focused = true;
|
616
|
+
this.onFocus.emit(event);
|
617
|
+
}
|
618
|
+
onInputBlur(event) {
|
619
|
+
this.focused = false;
|
620
|
+
this.focusedOptionInfo.set({ indeX: -1, level: 0, parentKey: '' });
|
621
|
+
this.searchValue = '';
|
622
|
+
this.onModelTouched();
|
623
|
+
this.onBlur.emit(event);
|
624
|
+
}
|
625
|
+
onInputKeyDown(event) {
|
626
|
+
if (this.disabled) {
|
627
|
+
event.preventDefault();
|
628
|
+
return;
|
629
|
+
}
|
630
|
+
const metaKey = event.metaKey || event.ctrlKey;
|
631
|
+
switch (event.code) {
|
632
|
+
case 'ArrowDown':
|
633
|
+
this.onArrowDownKey(event);
|
634
|
+
break;
|
635
|
+
case 'ArrowUp':
|
636
|
+
this.onArrowUpKey(event);
|
637
|
+
break;
|
638
|
+
case 'ArrowLeft':
|
639
|
+
this.onArrowLeftKey(event);
|
640
|
+
break;
|
641
|
+
case 'ArrowRight':
|
642
|
+
this.onArrowRightKey(event);
|
643
|
+
break;
|
644
|
+
case 'Home':
|
645
|
+
this.onHomeKey(event);
|
646
|
+
break;
|
647
|
+
case 'End':
|
648
|
+
this.onEndKey(event);
|
649
|
+
break;
|
650
|
+
case 'Space':
|
651
|
+
this.onSpaceKey(event);
|
652
|
+
break;
|
653
|
+
case 'Enter':
|
654
|
+
this.onEnterKey(event);
|
655
|
+
break;
|
656
|
+
case 'Escape':
|
657
|
+
this.onEscapeKey(event);
|
658
|
+
break;
|
659
|
+
case 'Tab':
|
660
|
+
this.onTabKey(event);
|
661
|
+
break;
|
662
|
+
case 'Backspace':
|
663
|
+
this.onBackspaceKey(event);
|
664
|
+
break;
|
665
|
+
case 'PageDown':
|
666
|
+
case 'PageUp':
|
667
|
+
case 'ShiftLeft':
|
668
|
+
case 'ShiftRight':
|
669
|
+
//NOOP
|
670
|
+
break;
|
671
|
+
default:
|
672
|
+
if (!metaKey && ObjectUtils.isPrintableCharacter(event.key)) {
|
673
|
+
!this.overlayVisible && this.show();
|
674
|
+
this.searchOptions(event, event.key);
|
551
675
|
}
|
676
|
+
break;
|
677
|
+
}
|
678
|
+
}
|
679
|
+
onArrowDownKey(event) {
|
680
|
+
const optionIndex = this.focusedOptionInfo().index !== -1 ? this.findNextOptionIndex(this.focusedOptionInfo().index) : this.findFirstFocusedOptionIndex();
|
681
|
+
this.changeFocusedOptionIndex(event, optionIndex);
|
682
|
+
!this.overlayVisible && this.show();
|
683
|
+
event.preventDefault();
|
684
|
+
}
|
685
|
+
onArrowUpKey(event) {
|
686
|
+
if (event.altKey) {
|
687
|
+
if (this.focusedOptionInfo().index !== -1) {
|
688
|
+
const processedOption = this.visibleOptions[this.focusedOptionInfo().index];
|
689
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
690
|
+
!grouped && this.onOptionChange({ originalEvent: event, value: processedOption });
|
552
691
|
}
|
692
|
+
this.overlayVisible && this.hide();
|
693
|
+
event.preventDefault();
|
694
|
+
}
|
695
|
+
else {
|
696
|
+
const optionIndex = this.focusedOptionInfo().index !== -1 ? this.findPrevOptionIndex(this.focusedOptionInfo().index) : this.findLastFocusedOptionIndex();
|
697
|
+
this.changeFocusedOptionIndex(event, optionIndex);
|
698
|
+
!this.overlayVisible && this.show();
|
699
|
+
event.preventDefault();
|
553
700
|
}
|
554
|
-
this.selectionPath = path;
|
555
|
-
this.updateFilledState();
|
556
701
|
}
|
557
|
-
|
558
|
-
|
702
|
+
onArrowLeftKey(event) {
|
703
|
+
if (this.overlayVisible) {
|
704
|
+
const processedOption = this.visibleOptions()[this.focusedOptionInfo().index];
|
705
|
+
const parentOption = this.activeOptionPath().find((p) => p.key === processedOption.parentKey);
|
706
|
+
const matched = this.focusedOptionInfo().parentKey === '' || (parentOption && parentOption.key === this.focusedOptionInfo().parentKey);
|
707
|
+
const root = ObjectUtils.isEmpty(processedOption.parent);
|
708
|
+
if (matched) {
|
709
|
+
const activeOptionPath = this.activeOptionPath().filter((p) => p.parentKey !== this.focusedOptionInfo().parentKey);
|
710
|
+
this.activeOptionPath.set(activeOptionPath);
|
711
|
+
}
|
712
|
+
if (!root) {
|
713
|
+
this.focusedOptionInfo.set({ index: -1, parentKey: parentOption ? parentOption.parentKey : '' });
|
714
|
+
this.searchValue = '';
|
715
|
+
this.onArrowDownKey(event);
|
716
|
+
}
|
717
|
+
event.preventDefault();
|
718
|
+
}
|
559
719
|
}
|
560
|
-
|
561
|
-
if (this.
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
720
|
+
onArrowRightKey(event) {
|
721
|
+
if (this.overlayVisible) {
|
722
|
+
const processedOption = this.visibleOptions()[this.focusedOptionInfo().index];
|
723
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
724
|
+
if (grouped) {
|
725
|
+
const matched = this.activeOptionPath().some((p) => processedOption.key === p.key);
|
726
|
+
if (matched) {
|
727
|
+
this.focusedOptionInfo.set({ index: -1, parentKey: processedOption.key });
|
728
|
+
this.searchValue = '';
|
729
|
+
this.onArrowDownKey(event);
|
730
|
+
}
|
731
|
+
else {
|
732
|
+
this.onOptionChange({ originalEvent: event, value: processedOption });
|
568
733
|
}
|
569
734
|
}
|
735
|
+
event.preventDefault();
|
570
736
|
}
|
571
|
-
|
572
|
-
|
737
|
+
}
|
738
|
+
onHomeKey(event) {
|
739
|
+
this.changeFocusedOptionIndex(event, this.findFirstOptionIndex());
|
740
|
+
!this.overlayVisible && this.show();
|
741
|
+
event.preventDefault();
|
742
|
+
}
|
743
|
+
onEndKey(event) {
|
744
|
+
this.changeFocusedOptionIndex(event, this.findLastOptionIndex());
|
745
|
+
!this.overlayVisible && this.show();
|
746
|
+
event.preventDefault();
|
747
|
+
}
|
748
|
+
onEnterKey(event) {
|
749
|
+
if (!this.overlayVisible) {
|
750
|
+
this.onArrowDownKey(event);
|
573
751
|
}
|
574
|
-
|
752
|
+
else {
|
753
|
+
if (this.focusedOptionInfo().index !== -1) {
|
754
|
+
const processedOption = this.visibleOptions()[this.focusedOptionInfo().index];
|
755
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
756
|
+
this.onOptionChange({ originalEvent: event, value: processedOption });
|
757
|
+
!grouped && this.hide();
|
758
|
+
}
|
759
|
+
}
|
760
|
+
event.preventDefault();
|
575
761
|
}
|
576
|
-
|
577
|
-
this.
|
762
|
+
onSpaceKey(event) {
|
763
|
+
this.onEnterKey(event);
|
578
764
|
}
|
579
|
-
|
580
|
-
this.overlayVisible
|
581
|
-
|
765
|
+
onEscapeKey(event) {
|
766
|
+
this.overlayVisible && this.hide(true);
|
767
|
+
event.preventDefault();
|
582
768
|
}
|
583
|
-
|
584
|
-
this.
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
769
|
+
onTabKey(event) {
|
770
|
+
if (this.focusedOptionInfo().index !== -1) {
|
771
|
+
const processedOption = this.visibleOptions()[this.focusedOptionInfo().index];
|
772
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
773
|
+
!grouped && this.onOptionChange({ originalEvent: event, value: processedOption });
|
774
|
+
}
|
775
|
+
this.overlayVisible && this.hide();
|
776
|
+
}
|
777
|
+
onBackspaceKey(event) {
|
778
|
+
if (ObjectUtils.isNotEmpty(this.modelValue()) && this.showClear) {
|
779
|
+
this.clear();
|
780
|
+
}
|
589
781
|
event.stopPropagation();
|
590
|
-
this.cd.markForCheck();
|
591
782
|
}
|
592
|
-
|
783
|
+
equalityKey() {
|
784
|
+
return this.optionValue ? null : this.dataKey;
|
785
|
+
}
|
786
|
+
updateModel(value, event) {
|
787
|
+
this.value = value;
|
788
|
+
this.onModelChange(value);
|
789
|
+
this.modelValue.set(value);
|
790
|
+
this.onChange.emit({
|
791
|
+
originalEvent: event,
|
792
|
+
value: value
|
793
|
+
});
|
794
|
+
}
|
795
|
+
autoUpdateModel() {
|
796
|
+
if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption()) {
|
797
|
+
this.focusedOptionInfo().index = this.findFirstFocusedOptionIndex();
|
798
|
+
this.onOptionChange({ originalEvent: null, processedOption: this.visibleOptions()[this.focusedOptionInfo().index], isHide: false });
|
799
|
+
!this.overlayVisible && this.focusedOptionInfo.set({ index: -1, level: 0, parentKey: '' });
|
800
|
+
}
|
801
|
+
}
|
802
|
+
scrollInView(index = -1) {
|
803
|
+
const id = index !== -1 ? `${this.id}_${index}` : this.focusedOptionId;
|
804
|
+
const element = DomHandler.findSingle(this.panelViewChild?.nativeElement, `li[id="${id}"]`);
|
805
|
+
if (element) {
|
806
|
+
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'start' });
|
807
|
+
}
|
808
|
+
}
|
809
|
+
changeFocusedOptionIndex(event, index) {
|
810
|
+
if (this.focusedOptionInfo().index !== index) {
|
811
|
+
this.focusedOptionInfo.mutate((value) => (value.index = index));
|
812
|
+
this.scrollInView();
|
813
|
+
}
|
814
|
+
if (this.selectOnFocus) {
|
815
|
+
this.onOptionChange({ originalEvent: event, processedOption: this.visibleOptions()[index], isHide: false });
|
816
|
+
}
|
817
|
+
}
|
818
|
+
onOptionChange(event) {
|
819
|
+
const { originalEvent, value, isFocus, isHide } = event;
|
820
|
+
if (ObjectUtils.isEmpty(value))
|
821
|
+
return;
|
822
|
+
const { index, level, parentKey, children } = value;
|
823
|
+
const grouped = ObjectUtils.isNotEmpty(children);
|
824
|
+
const activeOptionPath = this.activeOptionPath().filter((p) => p.parentKey !== parentKey);
|
825
|
+
activeOptionPath.push(value);
|
826
|
+
this.focusedOptionInfo.set({ index, level, parentKey });
|
827
|
+
this.activeOptionPath.set(activeOptionPath);
|
828
|
+
grouped ? this.onOptionGroupSelect({ originalEvent, value, isFocus: false }) : this.onOptionSelect({ originalEvent, value, isFocus });
|
829
|
+
isFocus && DomHandler.focus(this.focusInputViewChild.nativeElement);
|
830
|
+
}
|
831
|
+
onOptionSelect(event) {
|
832
|
+
const { originalEvent, value, isFocus } = event;
|
833
|
+
const newValue = this.getOptionValue(value.option);
|
834
|
+
const activeOptionPath = this.activeOptionPath();
|
835
|
+
activeOptionPath.forEach((p) => (p.selected = true));
|
836
|
+
this.activeOptionPath.set(activeOptionPath);
|
837
|
+
this.updateModel(newValue, originalEvent);
|
838
|
+
isFocus && this.hide(true);
|
839
|
+
}
|
840
|
+
onOptionGroupSelect(event) {
|
841
|
+
this.dirty = true;
|
842
|
+
this.onGroupChange.emit(event);
|
843
|
+
}
|
844
|
+
onContainerClick(event) {
|
593
845
|
if (this.disabled) {
|
594
846
|
return;
|
595
847
|
}
|
@@ -600,14 +852,203 @@ class CascadeSelect {
|
|
600
852
|
else {
|
601
853
|
this.show();
|
602
854
|
}
|
603
|
-
this.
|
855
|
+
this.focusInputViewChild?.nativeElement.focus();
|
604
856
|
}
|
605
857
|
}
|
606
|
-
|
607
|
-
this.
|
858
|
+
isOptionMatched(processedOption) {
|
859
|
+
return this.isValidOption(processedOption) && this.getProccessedOptionLabel(processedOption).toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale));
|
608
860
|
}
|
609
|
-
|
610
|
-
this.
|
861
|
+
isOptionDisabled(option) {
|
862
|
+
return this.optionDisabled ? ObjectUtils.resolveFieldData(option, this.optionDisabled) : false;
|
863
|
+
}
|
864
|
+
isValidOption(processedOption) {
|
865
|
+
return !!processedOption && !this.isOptionDisabled(processedOption.option);
|
866
|
+
}
|
867
|
+
isValidSelectedOption(processedOption) {
|
868
|
+
return this.isValidOption(processedOption) && this.isSelected(processedOption);
|
869
|
+
}
|
870
|
+
isSelected(processedOption) {
|
871
|
+
return this.activeOptionPath().some((p) => p.key === processedOption.key);
|
872
|
+
}
|
873
|
+
findOptionPathByValue(value, processedOptions, level = 0) {
|
874
|
+
processedOptions = processedOptions || (level === 0 && this.processedOptions());
|
875
|
+
if (!processedOptions)
|
876
|
+
return null;
|
877
|
+
if (ObjectUtils.isEmpty(value))
|
878
|
+
return [];
|
879
|
+
for (let i = 0; i < processedOptions.length; i++) {
|
880
|
+
const processedOption = processedOptions[i];
|
881
|
+
if (ObjectUtils.equals(value, this.getOptionValue(processedOption.option), this.equalityKey())) {
|
882
|
+
return [processedOption];
|
883
|
+
}
|
884
|
+
const matchedOptions = this.findOptionPathByValue(value, processedOption.children, level + 1);
|
885
|
+
if (matchedOptions) {
|
886
|
+
matchedOptions.unshift(processedOption);
|
887
|
+
return matchedOptions;
|
888
|
+
}
|
889
|
+
}
|
890
|
+
}
|
891
|
+
findFirstOptionIndex() {
|
892
|
+
return this.visibleOptions().findIndex((processedOption) => this.isValidOption(processedOption));
|
893
|
+
}
|
894
|
+
findLastOptionIndex() {
|
895
|
+
return ObjectUtils.findLastIndex(this.visibleOptions(), (processedOption) => this.isValidOption(processedOption));
|
896
|
+
}
|
897
|
+
findNextOptionIndex(index) {
|
898
|
+
const matchedOptionIndex = index < this.visibleOptions().length - 1
|
899
|
+
? this.visibleOptions()
|
900
|
+
.slice(index + 1)
|
901
|
+
.findIndex((processedOption) => this.isValidOption(processedOption))
|
902
|
+
: -1;
|
903
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
|
904
|
+
}
|
905
|
+
findPrevOptionIndex(index) {
|
906
|
+
const matchedOptionIndex = index > 0 ? ObjectUtils.findLastIndex(this.visibleOptions().slice(0, index), (processedOption) => this.isValidOption(processedOption)) : -1;
|
907
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex : index;
|
908
|
+
}
|
909
|
+
findSelectedOptionIndex() {
|
910
|
+
return this.visibleOptions().findIndex((processedOption) => this.isValidSelectedOption(processedOption));
|
911
|
+
}
|
912
|
+
findFirstFocusedOptionIndex() {
|
913
|
+
const selectedIndex = this.findSelectedOptionIndex();
|
914
|
+
return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex;
|
915
|
+
}
|
916
|
+
findLastFocusedOptionIndex() {
|
917
|
+
const selectedIndex = this.findSelectedOptionIndex();
|
918
|
+
return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex;
|
919
|
+
}
|
920
|
+
searchOptions(event, char) {
|
921
|
+
this.searchValue = (this.searchValue || '') + char;
|
922
|
+
let optionIndex = -1;
|
923
|
+
let matched = false;
|
924
|
+
const focusedOptionInfo = this.focusedOptionInfo();
|
925
|
+
if (focusedOptionInfo.index !== -1) {
|
926
|
+
optionIndex = this.visibleOptions()
|
927
|
+
.slice(focusedOptionInfo.index)
|
928
|
+
.findIndex((processedOption) => this.isOptionMatched(processedOption));
|
929
|
+
optionIndex =
|
930
|
+
optionIndex === -1
|
931
|
+
? this.visibleOptions()
|
932
|
+
.slice(0, focusedOptionInfo.index)
|
933
|
+
.findIndex((processedOption) => this.isOptionMatched(processedOption))
|
934
|
+
: optionIndex + focusedOptionInfo.index;
|
935
|
+
}
|
936
|
+
else {
|
937
|
+
optionIndex = this.visibleOptions().findIndex((processedOption) => this.isOptionMatched(processedOption));
|
938
|
+
}
|
939
|
+
if (optionIndex !== -1) {
|
940
|
+
matched = true;
|
941
|
+
}
|
942
|
+
if (optionIndex === -1 && focusedOptionInfo.index === -1) {
|
943
|
+
optionIndex = this.findFirstFocusedOptionIndex();
|
944
|
+
}
|
945
|
+
if (optionIndex !== -1) {
|
946
|
+
this.changeFocusedOptionIndex(event, optionIndex);
|
947
|
+
}
|
948
|
+
if (this.searchTimeout) {
|
949
|
+
clearTimeout(this.searchTimeout);
|
950
|
+
}
|
951
|
+
this.searchTimeout = setTimeout(() => {
|
952
|
+
this.searchValue = '';
|
953
|
+
this.searchTimeout = null;
|
954
|
+
}, 500);
|
955
|
+
return matched;
|
956
|
+
}
|
957
|
+
hide(event, isFocus = false) {
|
958
|
+
const _hide = () => {
|
959
|
+
this.overlayVisible = false;
|
960
|
+
this.activeOptionPath.set([]);
|
961
|
+
this.focusedOptionInfo.set({ index: -1, level: 0, parentKey: '' });
|
962
|
+
isFocus && DomHandler.focus(this.focusInputViewChild.nativeElement);
|
963
|
+
this.onHide.emit(event);
|
964
|
+
};
|
965
|
+
setTimeout(() => {
|
966
|
+
_hide();
|
967
|
+
}, 0); // For ScreenReaders
|
968
|
+
}
|
969
|
+
show(event, isFocus = false) {
|
970
|
+
this.onShow.emit(event);
|
971
|
+
this.overlayVisible = true;
|
972
|
+
const activeOptionPath = this.hasSelectedOption() ? this.findOptionPathByValue(this.modelValue()) : this.activeOptionPath();
|
973
|
+
this.activeOptionPath.set(activeOptionPath);
|
974
|
+
let focusedOptionInfo;
|
975
|
+
if (this.hasSelectedOption() && ObjectUtils.isNotEmpty(this.activeOptionPath())) {
|
976
|
+
const processedOption = this.activeOptionPath()[this.activeOptionPath().length - 1];
|
977
|
+
focusedOptionInfo = { index: this.autoOptionFocus ? processedOption.index : -1, level: processedOption.level, parentKey: processedOption.parentKey };
|
978
|
+
}
|
979
|
+
else {
|
980
|
+
focusedOptionInfo = { index: this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1, level: 0, parentKey: '' };
|
981
|
+
}
|
982
|
+
this.focusedOptionInfo.set(focusedOptionInfo);
|
983
|
+
isFocus && DomHandler.focus(this.focusInputViewChild.nativeElement);
|
984
|
+
}
|
985
|
+
clear(event) {
|
986
|
+
if (ObjectUtils.isNotEmpty(this.modelValue()) && this.showClear) {
|
987
|
+
this.updateModel(null);
|
988
|
+
this.focusedOptionInfo.set({ index: -1, level: 0, parentKey: '' });
|
989
|
+
this.activeOptionPath.set([]);
|
990
|
+
this.onClear.emit();
|
991
|
+
}
|
992
|
+
event && event.stopPropagation();
|
993
|
+
}
|
994
|
+
getOptionLabel(option) {
|
995
|
+
return this.optionLabel ? ObjectUtils.resolveFieldData(option, this.optionLabel) : option;
|
996
|
+
}
|
997
|
+
getOptionValue(option) {
|
998
|
+
return this.optionValue ? ObjectUtils.resolveFieldData(option, this.optionValue) : option;
|
999
|
+
}
|
1000
|
+
getOptionGroupLabel(optionGroup) {
|
1001
|
+
return this.optionGroupLabel ? ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel) : null;
|
1002
|
+
}
|
1003
|
+
getOptionGroupChildren(optionGroup, level) {
|
1004
|
+
return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupChildren[level]);
|
1005
|
+
}
|
1006
|
+
isOptionGroup(option, level) {
|
1007
|
+
return Object.prototype.hasOwnProperty.call(option, this.optionGroupChildren[level]);
|
1008
|
+
}
|
1009
|
+
isProccessedOptionGroup(processedOption) {
|
1010
|
+
return ObjectUtils.isNotEmpty(processedOption.children);
|
1011
|
+
}
|
1012
|
+
getProccessedOptionLabel(processedOption) {
|
1013
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
1014
|
+
return grouped ? this.getOptionGroupLabel(processedOption.option) : this.getOptionLabel(processedOption.option);
|
1015
|
+
}
|
1016
|
+
constructor(el, cd, config, overlayService) {
|
1017
|
+
this.el = el;
|
1018
|
+
this.cd = cd;
|
1019
|
+
this.config = config;
|
1020
|
+
this.overlayService = overlayService;
|
1021
|
+
effect(() => {
|
1022
|
+
const activeOptionPath = this.activeOptionPath();
|
1023
|
+
if (ObjectUtils.isNotEmpty(activeOptionPath)) {
|
1024
|
+
this.overlayViewChild.alignOverlay();
|
1025
|
+
}
|
1026
|
+
});
|
1027
|
+
}
|
1028
|
+
ngOnInit() {
|
1029
|
+
this.id = this.id || UniqueComponentId();
|
1030
|
+
this.autoUpdateModel();
|
1031
|
+
}
|
1032
|
+
ngAfterContentInit() {
|
1033
|
+
this.templates.forEach((item) => {
|
1034
|
+
switch (item.getType()) {
|
1035
|
+
case 'value':
|
1036
|
+
this.valueTemplate = item.template;
|
1037
|
+
break;
|
1038
|
+
case 'option':
|
1039
|
+
this.optionTemplate = item.template;
|
1040
|
+
break;
|
1041
|
+
case 'triggericon':
|
1042
|
+
this.triggerIconTemplate = item.template;
|
1043
|
+
break;
|
1044
|
+
case 'clearicon':
|
1045
|
+
this.clearIconTemplate = item.template;
|
1046
|
+
break;
|
1047
|
+
case 'optiongroupicon':
|
1048
|
+
this.groupIconTemplate = item.template;
|
1049
|
+
break;
|
1050
|
+
}
|
1051
|
+
});
|
611
1052
|
}
|
612
1053
|
onOverlayAnimationDone(event) {
|
613
1054
|
switch (event.toState) {
|
@@ -618,7 +1059,7 @@ class CascadeSelect {
|
|
618
1059
|
}
|
619
1060
|
writeValue(value) {
|
620
1061
|
this.value = value;
|
621
|
-
this.
|
1062
|
+
this.updateModel(value);
|
622
1063
|
this.cd.markForCheck();
|
623
1064
|
}
|
624
1065
|
registerOnChange(fn) {
|
@@ -631,230 +1072,224 @@ class CascadeSelect {
|
|
631
1072
|
this.disabled = val;
|
632
1073
|
this.cd.markForCheck();
|
633
1074
|
}
|
634
|
-
label() {
|
635
|
-
if (this.selectionPath) {
|
636
|
-
return this.getOptionLabel(this.selectionPath[this.selectionPath.length - 1]);
|
637
|
-
}
|
638
|
-
return this.placeholder || 'p-emptylabel';
|
639
|
-
}
|
640
|
-
onKeyDown(event) {
|
641
|
-
switch (event.code) {
|
642
|
-
case 'Down':
|
643
|
-
case 'ArrowDown':
|
644
|
-
if (this.overlayVisible) {
|
645
|
-
DomHandler.findSingle(this.panelEl?.nativeElement, '.p-cascadeselect-item').children[0].focus();
|
646
|
-
}
|
647
|
-
else if (event.altKey && this.options && this.options.length) {
|
648
|
-
this.show();
|
649
|
-
}
|
650
|
-
event.preventDefault();
|
651
|
-
break;
|
652
|
-
case 'Space':
|
653
|
-
case 'Enter':
|
654
|
-
if (!this.overlayVisible)
|
655
|
-
this.show();
|
656
|
-
else
|
657
|
-
this.hide();
|
658
|
-
event.preventDefault();
|
659
|
-
break;
|
660
|
-
case 'Tab':
|
661
|
-
case 'Escape':
|
662
|
-
if (this.overlayVisible) {
|
663
|
-
this.hide();
|
664
|
-
event.preventDefault();
|
665
|
-
}
|
666
|
-
break;
|
667
|
-
}
|
668
|
-
}
|
669
|
-
containerClass() {
|
670
|
-
return {
|
671
|
-
'p-cascadeselect p-component p-inputwrapper': true,
|
672
|
-
'p-disabled': this.disabled,
|
673
|
-
'p-focus': this.focused
|
674
|
-
};
|
675
|
-
}
|
676
|
-
labelClass() {
|
677
|
-
return {
|
678
|
-
'p-cascadeselect-label': true,
|
679
|
-
'p-inputtext': true,
|
680
|
-
'p-placeholder': this.label() === this.placeholder,
|
681
|
-
'p-cascadeselect-label-empty': !this.value && (this.label() === 'p-emptylabel' || this.label().length === 0)
|
682
|
-
};
|
683
|
-
}
|
684
1075
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CascadeSelect, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i3.PrimeNGConfig }, { token: i3.OverlayService }], target: i0.ɵɵFactoryTarget.Component });
|
685
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: CascadeSelect, selector: "p-cascadeSelect", inputs: { styleClass: "styleClass", style: "style", options: "options", optionLabel: "optionLabel", optionValue: "optionValue", optionGroupLabel: "optionGroupLabel", optionGroupChildren: "optionGroupChildren", placeholder: "placeholder", value: "value", dataKey: "dataKey", inputId: "inputId", tabindex: "tabindex", ariaLabelledBy: "ariaLabelledBy", inputLabel: "inputLabel", ariaLabel: "ariaLabel", appendTo: "appendTo", disabled: "disabled", showClear: "showClear", panelStyleClass: "panelStyleClass", panelStyle: "panelStyle", overlayOptions: "overlayOptions", showTransitionOptions: "showTransitionOptions", hideTransitionOptions: "hideTransitionOptions" }, outputs: { onChange: "onChange", onGroupChange: "onGroupChange", onShow: "onShow", onHide: "onHide", onClear: "onClear", onBeforeShow: "onBeforeShow", onBeforeHide: "onBeforeHide" }, host: { properties: { "class.p-inputwrapper-filled": "filled", "class.p-inputwrapper-focus": "focused || overlayVisible", "class.p-cascadeselect-clearable": "showClear && !disabled" }, classAttribute: "p-element p-inputwrapper" }, providers: [CASCADESELECT_VALUE_ACCESSOR], queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "
|
686
|
-
<div
|
687
|
-
<
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
<ng-
|
710
|
-
{{ label() }}
|
711
|
-
</ng-template>
|
712
|
-
</span>
|
713
|
-
|
714
|
-
<ng-container *ngIf="filled && !disabled && showClear">
|
715
|
-
<TimesIcon *ngIf="!clearIconTemplate" [styleClass]="'p-cascadeselect-clear-icon'" (click)="clear($event)" />
|
716
|
-
<span *ngIf="clearIconTemplate" class="p-cascadeselect-clear-icon" (click)="clear($event)">
|
717
|
-
<ng-template *ngTemplateOutlet="clearIconTemplate"></ng-template>
|
718
|
-
</span>
|
1076
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.2", type: CascadeSelect, selector: "p-cascadeSelect", inputs: { id: "id", selectOnFocus: "selectOnFocus", searchMessage: "searchMessage", emptyMessage: "emptyMessage", selectionMessage: "selectionMessage", emptySearchMessage: "emptySearchMessage", emptySelectionMessage: "emptySelectionMessage", searchLocale: "searchLocale", optionDisabled: "optionDisabled", autoOptionFocus: "autoOptionFocus", styleClass: "styleClass", style: "style", options: "options", optionLabel: "optionLabel", optionValue: "optionValue", optionGroupLabel: "optionGroupLabel", optionGroupChildren: "optionGroupChildren", placeholder: "placeholder", value: "value", dataKey: "dataKey", inputId: "inputId", tabindex: "tabindex", ariaLabelledBy: "ariaLabelledBy", inputLabel: "inputLabel", ariaLabel: "ariaLabel", appendTo: "appendTo", disabled: "disabled", showClear: "showClear", panelStyleClass: "panelStyleClass", panelStyle: "panelStyle", overlayOptions: "overlayOptions", showTransitionOptions: "showTransitionOptions", hideTransitionOptions: "hideTransitionOptions" }, outputs: { onChange: "onChange", onGroupChange: "onGroupChange", onShow: "onShow", onHide: "onHide", onClear: "onClear", onBeforeShow: "onBeforeShow", onBeforeHide: "onBeforeHide", onFocus: "onFocus", onBlur: "onBlur" }, host: { properties: { "class.p-inputwrapper-filled": "filled", "class.p-inputwrapper-focus": "focused || overlayVisible", "class.p-cascadeselect-clearable": "showClear && !disabled" }, classAttribute: "p-element p-inputwrapper" }, providers: [CASCADESELECT_VALUE_ACCESSOR], queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "focusInputViewChild", first: true, predicate: ["focusInput"], descendants: true }, { propertyName: "containerViewChild", first: true, predicate: ["container"], descendants: true }, { propertyName: "panelViewChild", first: true, predicate: ["panel"], descendants: true }, { propertyName: "overlayViewChild", first: true, predicate: ["overlay"], descendants: true }], ngImport: i0, template: ` <div #container [ngClass]="containerClass" [class]="styleClass" [ngStyle]="style" (click)="onContainerClick($event)" [attr.data-pc-name]="'cascadeselect'" [attr.data-pc-section]="'root'">
|
1077
|
+
<div class="p-hidden-accessible" [attr.data-pc-section]="'hiddenInputWrapper'">
|
1078
|
+
<input
|
1079
|
+
#focusInput
|
1080
|
+
readonly
|
1081
|
+
type="text"
|
1082
|
+
role="combobox"
|
1083
|
+
[disabled]="disabled"
|
1084
|
+
[placeholder]="placeholder"
|
1085
|
+
[tabindex]="!disabled ? tabindex : -1"
|
1086
|
+
[attr.id]="inputId"
|
1087
|
+
[attr.aria-label]="ariaLabel"
|
1088
|
+
[attr.aria-labelledby]="ariaLabelledBy"
|
1089
|
+
aria-haspopup="tree"
|
1090
|
+
[attr.aria-expanded]="overlayVisible"
|
1091
|
+
[attr.aria-controls]="id + '_tree'"
|
1092
|
+
[attr.aria-activedescendant]="focused ? focusedOptionId : undefined"
|
1093
|
+
(focus)="onInputFocus($event)"
|
1094
|
+
(blur)="onInputBlur($event)"
|
1095
|
+
(keydown)="onInputKeyDown($event)"
|
1096
|
+
/>
|
1097
|
+
</div>
|
1098
|
+
<span [ngClass]="labelClass" [attr.data-pc-section]="'label'">
|
1099
|
+
<ng-container *ngIf="valueTemplate; else defaultValueTemplate">
|
1100
|
+
<ng-container *ngTemplateOutlet="valueTemplate; context: { $implicit: value, placeholder: placeholder }"></ng-container>
|
719
1101
|
</ng-container>
|
1102
|
+
<ng-template #defaultValueTemplate>
|
1103
|
+
{{ label() }}
|
1104
|
+
</ng-template>
|
1105
|
+
</span>
|
720
1106
|
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
[showTransitionOptions]="showTransitionOptions"
|
734
|
-
[hideTransitionOptions]="hideTransitionOptions"
|
735
|
-
(onAnimationDone)="onOverlayAnimationDone($event)"
|
736
|
-
(onBeforeShow)="onBeforeShow.emit($event)"
|
737
|
-
(onShow)="onShow.emit($event)"
|
738
|
-
(onBeforeHide)="onBeforeHide.emit($event)"
|
739
|
-
(onHide)="onHide.emit($event)"
|
740
|
-
>
|
741
|
-
<ng-template pTemplate="content">
|
742
|
-
<div #panel class="p-cascadeselect-panel p-component" [class]="panelStyleClass" [ngStyle]="panelStyle">
|
743
|
-
<div class="p-cascadeselect-items-wrapper">
|
744
|
-
<p-cascadeSelectSub
|
745
|
-
[options]="options"
|
746
|
-
[selectionPath]="selectionPath"
|
747
|
-
class="p-cascadeselect-items"
|
748
|
-
[optionLabel]="optionLabel"
|
749
|
-
[optionValue]="optionValue"
|
750
|
-
[level]="0"
|
751
|
-
[optionTemplate]="optionTemplate"
|
752
|
-
[groupIconTemplate]="groupIconTemplate"
|
753
|
-
[optionGroupLabel]="optionGroupLabel"
|
754
|
-
[optionGroupChildren]="optionGroupChildren"
|
755
|
-
(onSelect)="onOptionSelect($event)"
|
756
|
-
(onGroupSelect)="onOptionGroupSelect($event)"
|
757
|
-
[dirty]="dirty"
|
758
|
-
[root]="true"
|
759
|
-
>
|
760
|
-
</p-cascadeSelectSub>
|
761
|
-
</div>
|
762
|
-
</div>
|
763
|
-
</ng-template>
|
764
|
-
</p-overlay>
|
1107
|
+
<ng-container *ngIf="filled && !disabled && showClear">
|
1108
|
+
<TimesIcon *ngIf="!clearIconTemplate" [styleClass]="'p-cascadeselect-clear-icon'" (click)="clear($event)" [attr.data-pc-section]="'clearicon'" [attr.aria-hidden]="true" />
|
1109
|
+
<span *ngIf="clearIconTemplate" class="p-cascadeselect-clear-icon" (click)="clear($event)" [attr.data-pc-section]="'clearicon'" [attr.aria-hidden]="true">
|
1110
|
+
<ng-template *ngTemplateOutlet="clearIconTemplate"></ng-template>
|
1111
|
+
</span>
|
1112
|
+
</ng-container>
|
1113
|
+
|
1114
|
+
<div class="p-cascadeselect-trigger" role="button" aria-haspopup="listbox" [attr.aria-expanded]="overlayVisible" [attr.data-pc-section]="'dropdownIcon'" [attr.aria-hidden]="true">
|
1115
|
+
<ChevronDownIcon *ngIf="!triggerIconTemplate" [styleClass]="'p-cascadeselect-trigger-icon'" />
|
1116
|
+
<span *ngIf="triggerIconTemplate" class="p-cascadeselect-trigger-icon">
|
1117
|
+
<ng-template *ngTemplateOutlet="triggerIconTemplate"></ng-template>
|
1118
|
+
</span>
|
765
1119
|
</div>
|
766
|
-
|
1120
|
+
<span role="status" aria-live="polite" class="p-hidden-accessible">
|
1121
|
+
{{ searchResultMessageText }}
|
1122
|
+
</span>
|
1123
|
+
<p-overlay
|
1124
|
+
#overlay
|
1125
|
+
[(visible)]="overlayVisible"
|
1126
|
+
[options]="overlayOptions"
|
1127
|
+
[target]="'@parent'"
|
1128
|
+
[appendTo]="appendTo"
|
1129
|
+
[showTransitionOptions]="showTransitionOptions"
|
1130
|
+
[hideTransitionOptions]="hideTransitionOptions"
|
1131
|
+
(onAnimationDone)="onOverlayAnimationDone($event)"
|
1132
|
+
(onBeforeShow)="onBeforeShow.emit($event)"
|
1133
|
+
(onShow)="show($event)"
|
1134
|
+
(onBeforeHide)="onBeforeHide.emit($event)"
|
1135
|
+
(onHide)="hide($event)"
|
1136
|
+
>
|
1137
|
+
<ng-template pTemplate="content">
|
1138
|
+
<div #panel class="p-cascadeselect-panel p-component" [class]="panelStyleClass" [ngStyle]="panelStyle" [attr.data-pc-section]="'panel'">
|
1139
|
+
<div class="p-cascadeselect-items-wrapper" [attr.data-pc-section]="'wrapper'">
|
1140
|
+
<p-cascadeSelectSub
|
1141
|
+
class="p-cascadeselect-items"
|
1142
|
+
[options]="processedOptions()"
|
1143
|
+
[selectId]="id"
|
1144
|
+
[focusedOptionId]="focused ? focusedOptionId : undefined"
|
1145
|
+
[activeOptionPath]="activeOptionPath()"
|
1146
|
+
[optionLabel]="optionLabel"
|
1147
|
+
[optionValue]="optionValue"
|
1148
|
+
[level]="0"
|
1149
|
+
[optionTemplate]="optionTemplate"
|
1150
|
+
[groupIconTemplate]="groupIconTemplate"
|
1151
|
+
[optionGroupLabel]="optionGroupLabel"
|
1152
|
+
[optionGroupChildren]="optionGroupChildren"
|
1153
|
+
[optionDisabled]="optionDisabled"
|
1154
|
+
[optionValue]="optionValue"
|
1155
|
+
[optionLabel]="optionLabel"
|
1156
|
+
[root]="true"
|
1157
|
+
(onChange)="onOptionChange($event)"
|
1158
|
+
[dirty]="dirty"
|
1159
|
+
[role]="'tree'"
|
1160
|
+
>
|
1161
|
+
</p-cascadeSelectSub>
|
1162
|
+
</div>
|
1163
|
+
<span role="status" aria-live="polite" class="p-hidden-accessible">
|
1164
|
+
{{ selectedMessageText }}
|
1165
|
+
</span>
|
1166
|
+
</div>
|
1167
|
+
</ng-template>
|
1168
|
+
</p-overlay>
|
1169
|
+
</div>`, isInline: true, styles: ["@layer primeng{.p-cascadeselect{display:inline-flex;cursor:pointer;position:relative;-webkit-user-select:none;user-select:none}.p-cascadeselect-trigger{display:flex;align-items:center;justify-content:center;flex-shrink:0}.p-cascadeselect-label{display:block;white-space:nowrap;overflow:hidden;flex:1 1 auto;width:1%;text-overflow:ellipsis;cursor:pointer}.p-cascadeselect-label-empty{overflow:hidden;visibility:hidden}.p-cascadeselect-item{cursor:pointer;font-weight:400;white-space:nowrap}.p-cascadeselect-item-content{display:flex;align-items:center;overflow:hidden;position:relative}.p-cascadeselect-group-icon{margin-left:auto}.p-cascadeselect-items{margin:0;padding:0;list-style-type:none}.p-fluid .p-cascadeselect{display:flex}.p-fluid .p-cascadeselect .p-cascadeselect-label{width:1%}.p-cascadeselect-sublist{position:absolute;min-width:100%;z-index:1;display:none}.p-cascadeselect-item-active{overflow:visible!important}.p-cascadeselect-item-active>.p-cascadeselect-sublist{display:block;left:100%;top:0}.p-cascadeselect-clear-icon{position:absolute;top:50%;margin-top:-.5rem;cursor:pointer}.p-cascadeselect-clearable,.p-overlay-modal .p-cascadeselect-sublist{position:relative}.p-overlay-modal .p-cascadeselect-item-active>.p-cascadeselect-sublist{left:0}}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(function () { return i1.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgTemplateOutlet; }), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(function () { return i1.NgStyle; }), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i0.forwardRef(function () { return i4.Overlay; }), selector: "p-overlay", inputs: ["visible", "mode", "style", "styleClass", "contentStyle", "contentStyleClass", "target", "appendTo", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "listener", "responsive", "options"], outputs: ["visibleChange", "onBeforeShow", "onShow", "onBeforeHide", "onHide", "onAnimationStart", "onAnimationDone"] }, { kind: "directive", type: i0.forwardRef(function () { return i3.PrimeTemplate; }), selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i0.forwardRef(function () { return ChevronDownIcon; }), selector: "ChevronDownIcon" }, { kind: "component", type: i0.forwardRef(function () { return TimesIcon; }), selector: "TimesIcon" }, { kind: "component", type: i0.forwardRef(function () { return CascadeSelectSub; }), selector: "p-cascadeSelectSub", inputs: ["role", "selectId", "activeOptionPath", "optionDisabled", "focusedOptionId", "options", "optionGroupChildren", "optionTemplate", "groupIconTemplate", "level", "optionLabel", "optionValue", "optionGroupLabel", "dirty", "root"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
767
1170
|
}
|
768
1171
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: CascadeSelect, decorators: [{
|
769
1172
|
type: Component,
|
770
|
-
args: [{ selector: 'p-cascadeSelect', template: `
|
771
|
-
<div
|
772
|
-
<
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
<ng-
|
795
|
-
{{ label() }}
|
796
|
-
</ng-template>
|
797
|
-
</span>
|
798
|
-
|
799
|
-
<ng-container *ngIf="filled && !disabled && showClear">
|
800
|
-
<TimesIcon *ngIf="!clearIconTemplate" [styleClass]="'p-cascadeselect-clear-icon'" (click)="clear($event)" />
|
801
|
-
<span *ngIf="clearIconTemplate" class="p-cascadeselect-clear-icon" (click)="clear($event)">
|
802
|
-
<ng-template *ngTemplateOutlet="clearIconTemplate"></ng-template>
|
803
|
-
</span>
|
1173
|
+
args: [{ selector: 'p-cascadeSelect', template: ` <div #container [ngClass]="containerClass" [class]="styleClass" [ngStyle]="style" (click)="onContainerClick($event)" [attr.data-pc-name]="'cascadeselect'" [attr.data-pc-section]="'root'">
|
1174
|
+
<div class="p-hidden-accessible" [attr.data-pc-section]="'hiddenInputWrapper'">
|
1175
|
+
<input
|
1176
|
+
#focusInput
|
1177
|
+
readonly
|
1178
|
+
type="text"
|
1179
|
+
role="combobox"
|
1180
|
+
[disabled]="disabled"
|
1181
|
+
[placeholder]="placeholder"
|
1182
|
+
[tabindex]="!disabled ? tabindex : -1"
|
1183
|
+
[attr.id]="inputId"
|
1184
|
+
[attr.aria-label]="ariaLabel"
|
1185
|
+
[attr.aria-labelledby]="ariaLabelledBy"
|
1186
|
+
aria-haspopup="tree"
|
1187
|
+
[attr.aria-expanded]="overlayVisible"
|
1188
|
+
[attr.aria-controls]="id + '_tree'"
|
1189
|
+
[attr.aria-activedescendant]="focused ? focusedOptionId : undefined"
|
1190
|
+
(focus)="onInputFocus($event)"
|
1191
|
+
(blur)="onInputBlur($event)"
|
1192
|
+
(keydown)="onInputKeyDown($event)"
|
1193
|
+
/>
|
1194
|
+
</div>
|
1195
|
+
<span [ngClass]="labelClass" [attr.data-pc-section]="'label'">
|
1196
|
+
<ng-container *ngIf="valueTemplate; else defaultValueTemplate">
|
1197
|
+
<ng-container *ngTemplateOutlet="valueTemplate; context: { $implicit: value, placeholder: placeholder }"></ng-container>
|
804
1198
|
</ng-container>
|
1199
|
+
<ng-template #defaultValueTemplate>
|
1200
|
+
{{ label() }}
|
1201
|
+
</ng-template>
|
1202
|
+
</span>
|
805
1203
|
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
[showTransitionOptions]="showTransitionOptions"
|
819
|
-
[hideTransitionOptions]="hideTransitionOptions"
|
820
|
-
(onAnimationDone)="onOverlayAnimationDone($event)"
|
821
|
-
(onBeforeShow)="onBeforeShow.emit($event)"
|
822
|
-
(onShow)="onShow.emit($event)"
|
823
|
-
(onBeforeHide)="onBeforeHide.emit($event)"
|
824
|
-
(onHide)="onHide.emit($event)"
|
825
|
-
>
|
826
|
-
<ng-template pTemplate="content">
|
827
|
-
<div #panel class="p-cascadeselect-panel p-component" [class]="panelStyleClass" [ngStyle]="panelStyle">
|
828
|
-
<div class="p-cascadeselect-items-wrapper">
|
829
|
-
<p-cascadeSelectSub
|
830
|
-
[options]="options"
|
831
|
-
[selectionPath]="selectionPath"
|
832
|
-
class="p-cascadeselect-items"
|
833
|
-
[optionLabel]="optionLabel"
|
834
|
-
[optionValue]="optionValue"
|
835
|
-
[level]="0"
|
836
|
-
[optionTemplate]="optionTemplate"
|
837
|
-
[groupIconTemplate]="groupIconTemplate"
|
838
|
-
[optionGroupLabel]="optionGroupLabel"
|
839
|
-
[optionGroupChildren]="optionGroupChildren"
|
840
|
-
(onSelect)="onOptionSelect($event)"
|
841
|
-
(onGroupSelect)="onOptionGroupSelect($event)"
|
842
|
-
[dirty]="dirty"
|
843
|
-
[root]="true"
|
844
|
-
>
|
845
|
-
</p-cascadeSelectSub>
|
846
|
-
</div>
|
847
|
-
</div>
|
848
|
-
</ng-template>
|
849
|
-
</p-overlay>
|
1204
|
+
<ng-container *ngIf="filled && !disabled && showClear">
|
1205
|
+
<TimesIcon *ngIf="!clearIconTemplate" [styleClass]="'p-cascadeselect-clear-icon'" (click)="clear($event)" [attr.data-pc-section]="'clearicon'" [attr.aria-hidden]="true" />
|
1206
|
+
<span *ngIf="clearIconTemplate" class="p-cascadeselect-clear-icon" (click)="clear($event)" [attr.data-pc-section]="'clearicon'" [attr.aria-hidden]="true">
|
1207
|
+
<ng-template *ngTemplateOutlet="clearIconTemplate"></ng-template>
|
1208
|
+
</span>
|
1209
|
+
</ng-container>
|
1210
|
+
|
1211
|
+
<div class="p-cascadeselect-trigger" role="button" aria-haspopup="listbox" [attr.aria-expanded]="overlayVisible" [attr.data-pc-section]="'dropdownIcon'" [attr.aria-hidden]="true">
|
1212
|
+
<ChevronDownIcon *ngIf="!triggerIconTemplate" [styleClass]="'p-cascadeselect-trigger-icon'" />
|
1213
|
+
<span *ngIf="triggerIconTemplate" class="p-cascadeselect-trigger-icon">
|
1214
|
+
<ng-template *ngTemplateOutlet="triggerIconTemplate"></ng-template>
|
1215
|
+
</span>
|
850
1216
|
</div>
|
851
|
-
|
1217
|
+
<span role="status" aria-live="polite" class="p-hidden-accessible">
|
1218
|
+
{{ searchResultMessageText }}
|
1219
|
+
</span>
|
1220
|
+
<p-overlay
|
1221
|
+
#overlay
|
1222
|
+
[(visible)]="overlayVisible"
|
1223
|
+
[options]="overlayOptions"
|
1224
|
+
[target]="'@parent'"
|
1225
|
+
[appendTo]="appendTo"
|
1226
|
+
[showTransitionOptions]="showTransitionOptions"
|
1227
|
+
[hideTransitionOptions]="hideTransitionOptions"
|
1228
|
+
(onAnimationDone)="onOverlayAnimationDone($event)"
|
1229
|
+
(onBeforeShow)="onBeforeShow.emit($event)"
|
1230
|
+
(onShow)="show($event)"
|
1231
|
+
(onBeforeHide)="onBeforeHide.emit($event)"
|
1232
|
+
(onHide)="hide($event)"
|
1233
|
+
>
|
1234
|
+
<ng-template pTemplate="content">
|
1235
|
+
<div #panel class="p-cascadeselect-panel p-component" [class]="panelStyleClass" [ngStyle]="panelStyle" [attr.data-pc-section]="'panel'">
|
1236
|
+
<div class="p-cascadeselect-items-wrapper" [attr.data-pc-section]="'wrapper'">
|
1237
|
+
<p-cascadeSelectSub
|
1238
|
+
class="p-cascadeselect-items"
|
1239
|
+
[options]="processedOptions()"
|
1240
|
+
[selectId]="id"
|
1241
|
+
[focusedOptionId]="focused ? focusedOptionId : undefined"
|
1242
|
+
[activeOptionPath]="activeOptionPath()"
|
1243
|
+
[optionLabel]="optionLabel"
|
1244
|
+
[optionValue]="optionValue"
|
1245
|
+
[level]="0"
|
1246
|
+
[optionTemplate]="optionTemplate"
|
1247
|
+
[groupIconTemplate]="groupIconTemplate"
|
1248
|
+
[optionGroupLabel]="optionGroupLabel"
|
1249
|
+
[optionGroupChildren]="optionGroupChildren"
|
1250
|
+
[optionDisabled]="optionDisabled"
|
1251
|
+
[optionValue]="optionValue"
|
1252
|
+
[optionLabel]="optionLabel"
|
1253
|
+
[root]="true"
|
1254
|
+
(onChange)="onOptionChange($event)"
|
1255
|
+
[dirty]="dirty"
|
1256
|
+
[role]="'tree'"
|
1257
|
+
>
|
1258
|
+
</p-cascadeSelectSub>
|
1259
|
+
</div>
|
1260
|
+
<span role="status" aria-live="polite" class="p-hidden-accessible">
|
1261
|
+
{{ selectedMessageText }}
|
1262
|
+
</span>
|
1263
|
+
</div>
|
1264
|
+
</ng-template>
|
1265
|
+
</p-overlay>
|
1266
|
+
</div>`, host: {
|
852
1267
|
class: 'p-element p-inputwrapper',
|
853
1268
|
'[class.p-inputwrapper-filled]': 'filled',
|
854
1269
|
'[class.p-inputwrapper-focus]': 'focused || overlayVisible',
|
855
1270
|
'[class.p-cascadeselect-clearable]': 'showClear && !disabled'
|
856
1271
|
}, providers: [CASCADESELECT_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styles: ["@layer primeng{.p-cascadeselect{display:inline-flex;cursor:pointer;position:relative;-webkit-user-select:none;user-select:none}.p-cascadeselect-trigger{display:flex;align-items:center;justify-content:center;flex-shrink:0}.p-cascadeselect-label{display:block;white-space:nowrap;overflow:hidden;flex:1 1 auto;width:1%;text-overflow:ellipsis;cursor:pointer}.p-cascadeselect-label-empty{overflow:hidden;visibility:hidden}.p-cascadeselect-item{cursor:pointer;font-weight:400;white-space:nowrap}.p-cascadeselect-item-content{display:flex;align-items:center;overflow:hidden;position:relative}.p-cascadeselect-group-icon{margin-left:auto}.p-cascadeselect-items{margin:0;padding:0;list-style-type:none}.p-fluid .p-cascadeselect{display:flex}.p-fluid .p-cascadeselect .p-cascadeselect-label{width:1%}.p-cascadeselect-sublist{position:absolute;min-width:100%;z-index:1;display:none}.p-cascadeselect-item-active{overflow:visible!important}.p-cascadeselect-item-active>.p-cascadeselect-sublist{display:block;left:100%;top:0}.p-cascadeselect-clear-icon{position:absolute;top:50%;margin-top:-.5rem;cursor:pointer}.p-cascadeselect-clearable,.p-overlay-modal .p-cascadeselect-sublist{position:relative}.p-overlay-modal .p-cascadeselect-item-active>.p-cascadeselect-sublist{left:0}}\n"] }]
|
857
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i3.PrimeNGConfig }, { type: i3.OverlayService }]; }, propDecorators: {
|
1272
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i3.PrimeNGConfig }, { type: i3.OverlayService }]; }, propDecorators: { id: [{
|
1273
|
+
type: Input
|
1274
|
+
}], selectOnFocus: [{
|
1275
|
+
type: Input
|
1276
|
+
}], searchMessage: [{
|
1277
|
+
type: Input
|
1278
|
+
}], emptyMessage: [{
|
1279
|
+
type: Input
|
1280
|
+
}], selectionMessage: [{
|
1281
|
+
type: Input
|
1282
|
+
}], emptySearchMessage: [{
|
1283
|
+
type: Input
|
1284
|
+
}], emptySelectionMessage: [{
|
1285
|
+
type: Input
|
1286
|
+
}], searchLocale: [{
|
1287
|
+
type: Input
|
1288
|
+
}], optionDisabled: [{
|
1289
|
+
type: Input
|
1290
|
+
}], autoOptionFocus: [{
|
1291
|
+
type: Input
|
1292
|
+
}], styleClass: [{
|
858
1293
|
type: Input
|
859
1294
|
}], style: [{
|
860
1295
|
type: Input
|
@@ -896,6 +1331,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
896
1331
|
type: Input
|
897
1332
|
}], overlayOptions: [{
|
898
1333
|
type: Input
|
1334
|
+
}], showTransitionOptions: [{
|
1335
|
+
type: Input
|
1336
|
+
}], hideTransitionOptions: [{
|
1337
|
+
type: Input
|
899
1338
|
}], onChange: [{
|
900
1339
|
type: Output
|
901
1340
|
}], onGroupChange: [{
|
@@ -910,17 +1349,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
910
1349
|
type: Output
|
911
1350
|
}], onBeforeHide: [{
|
912
1351
|
type: Output
|
913
|
-
}],
|
914
|
-
type:
|
915
|
-
}],
|
916
|
-
type:
|
917
|
-
}],
|
1352
|
+
}], onFocus: [{
|
1353
|
+
type: Output
|
1354
|
+
}], onBlur: [{
|
1355
|
+
type: Output
|
1356
|
+
}], focusInputViewChild: [{
|
918
1357
|
type: ViewChild,
|
919
1358
|
args: ['focusInput']
|
920
|
-
}],
|
1359
|
+
}], containerViewChild: [{
|
921
1360
|
type: ViewChild,
|
922
1361
|
args: ['container']
|
923
|
-
}],
|
1362
|
+
}], panelViewChild: [{
|
924
1363
|
type: ViewChild,
|
925
1364
|
args: ['panel']
|
926
1365
|
}], overlayViewChild: [{
|