@exhaustive-ui/core 3.0.0-alpha.0 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/exhaustive-ui-core-accordion.mjs +51 -78
- package/fesm2022/exhaustive-ui-core-accordion.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-animateonscroll.mjs +72 -73
- package/fesm2022/exhaustive-ui-core-animateonscroll.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-api.mjs +6 -13
- package/fesm2022/exhaustive-ui-core-api.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-autocomplete.mjs +485 -683
- package/fesm2022/exhaustive-ui-core-autocomplete.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-autofocus.mjs +21 -31
- package/fesm2022/exhaustive-ui-core-autofocus.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-avatar.mjs +47 -63
- package/fesm2022/exhaustive-ui-core-avatar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-badge.mjs +88 -115
- package/fesm2022/exhaustive-ui-core-badge.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-blockui.mjs +58 -91
- package/fesm2022/exhaustive-ui-core-blockui.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-breadcrumb.mjs +155 -169
- package/fesm2022/exhaustive-ui-core-breadcrumb.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-button.mjs +280 -385
- package/fesm2022/exhaustive-ui-core-button.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-carousel.mjs +379 -451
- package/fesm2022/exhaustive-ui-core-carousel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-cascadeselect.mjs +388 -507
- package/fesm2022/exhaustive-ui-core-cascadeselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-chart.mjs +75 -91
- package/fesm2022/exhaustive-ui-core-chart.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-checkbox.mjs +109 -160
- package/fesm2022/exhaustive-ui-core-checkbox.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-chip.mjs +98 -137
- package/fesm2022/exhaustive-ui-core-chip.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-colorpicker.mjs +123 -190
- package/fesm2022/exhaustive-ui-core-colorpicker.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-confirmdialog.mjs +157 -332
- package/fesm2022/exhaustive-ui-core-confirmdialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-confirmpopup.mjs +187 -210
- package/fesm2022/exhaustive-ui-core-confirmpopup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-contextmenu.mjs +315 -361
- package/fesm2022/exhaustive-ui-core-contextmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dataview.mjs +225 -272
- package/fesm2022/exhaustive-ui-core-dataview.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-datepicker.mjs +1012 -1157
- package/fesm2022/exhaustive-ui-core-datepicker.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dialog.mjs +370 -507
- package/fesm2022/exhaustive-ui-core-dialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dock.mjs +87 -115
- package/fesm2022/exhaustive-ui-core-dock.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dragdrop.mjs +98 -105
- package/fesm2022/exhaustive-ui-core-dragdrop.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-drawer.mjs +174 -235
- package/fesm2022/exhaustive-ui-core-drawer.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs +42 -280
- package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-editor.mjs +109 -121
- package/fesm2022/exhaustive-ui-core-editor.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-fieldset.mjs +90 -132
- package/fesm2022/exhaustive-ui-core-fieldset.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-fileupload.mjs +486 -541
- package/fesm2022/exhaustive-ui-core-fileupload.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-floatlabel.mjs +13 -16
- package/fesm2022/exhaustive-ui-core-floatlabel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-focustrap.mjs +44 -40
- package/fesm2022/exhaustive-ui-core-focustrap.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-galleria.mjs +642 -853
- package/fesm2022/exhaustive-ui-core-galleria.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-iconfield.mjs +15 -27
- package/fesm2022/exhaustive-ui-core-iconfield.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-icons-baseicon.mjs +8 -13
- package/fesm2022/exhaustive-ui-core-icons-baseicon.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-image.mjs +209 -251
- package/fesm2022/exhaustive-ui-core-image.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-imagecompare.mjs +39 -48
- package/fesm2022/exhaustive-ui-core-imagecompare.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inplace.mjs +64 -98
- package/fesm2022/exhaustive-ui-core-inplace.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputgroup.mjs +10 -20
- package/fesm2022/exhaustive-ui-core-inputgroup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs +15 -24
- package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputicon.mjs +11 -22
- package/fesm2022/exhaustive-ui-core-inputicon.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputmask.mjs +423 -392
- package/fesm2022/exhaustive-ui-core-inputmask.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputnumber.mjs +397 -469
- package/fesm2022/exhaustive-ui-core-inputnumber.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputotp.mjs +75 -95
- package/fesm2022/exhaustive-ui-core-inputotp.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputtext.mjs +27 -36
- package/fesm2022/exhaustive-ui-core-inputtext.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-keyfilter.mjs +29 -46
- package/fesm2022/exhaustive-ui-core-keyfilter.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-knob.mjs +140 -187
- package/fesm2022/exhaustive-ui-core-knob.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-listbox.mjs +365 -546
- package/fesm2022/exhaustive-ui-core-listbox.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-megamenu.mjs +320 -371
- package/fesm2022/exhaustive-ui-core-megamenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-menu.mjs +298 -348
- package/fesm2022/exhaustive-ui-core-menu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-menubar.mjs +277 -372
- package/fesm2022/exhaustive-ui-core-menubar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-metergroup.mjs +138 -166
- package/fesm2022/exhaustive-ui-core-metergroup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-multiselect.mjs +647 -835
- package/fesm2022/exhaustive-ui-core-multiselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-orderlist.mjs +337 -409
- package/fesm2022/exhaustive-ui-core-orderlist.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-organizationchart.mjs +114 -175
- package/fesm2022/exhaustive-ui-core-organizationchart.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-overlaybadge.mjs +22 -47
- package/fesm2022/exhaustive-ui-core-overlaybadge.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-paginator.mjs +232 -320
- package/fesm2022/exhaustive-ui-core-paginator.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-panel.mjs +114 -174
- package/fesm2022/exhaustive-ui-core-panel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-panelmenu.mjs +171 -282
- package/fesm2022/exhaustive-ui-core-panelmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-password.mjs +317 -377
- package/fesm2022/exhaustive-ui-core-password.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-picklist.mjs +557 -655
- package/fesm2022/exhaustive-ui-core-picklist.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-popover.mjs +154 -181
- package/fesm2022/exhaustive-ui-core-popover.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-rating.mjs +87 -119
- package/fesm2022/exhaustive-ui-core-rating.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scroller.mjs +465 -596
- package/fesm2022/exhaustive-ui-core-scroller.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scrollpanel.mjs +147 -155
- package/fesm2022/exhaustive-ui-core-scrollpanel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scrolltop.mjs +81 -115
- package/fesm2022/exhaustive-ui-core-scrolltop.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-select.mjs +581 -784
- package/fesm2022/exhaustive-ui-core-select.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-selectbutton.mjs +84 -120
- package/fesm2022/exhaustive-ui-core-selectbutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-slider.mjs +322 -352
- package/fesm2022/exhaustive-ui-core-slider.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-speeddial.mjs +209 -268
- package/fesm2022/exhaustive-ui-core-speeddial.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-splitbutton.mjs +153 -249
- package/fesm2022/exhaustive-ui-core-splitbutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-splitter.mjs +221 -237
- package/fesm2022/exhaustive-ui-core-splitter.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-steps.mjs +56 -72
- package/fesm2022/exhaustive-ui-core-steps.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-styleclass.mjs +145 -146
- package/fesm2022/exhaustive-ui-core-styleclass.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-table.mjs +2213 -2543
- package/fesm2022/exhaustive-ui-core-table.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-terminal.mjs +50 -67
- package/fesm2022/exhaustive-ui-core-terminal.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-textarea.mjs +23 -36
- package/fesm2022/exhaustive-ui-core-textarea.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tieredmenu.mjs +318 -394
- package/fesm2022/exhaustive-ui-core-tieredmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-timeline.mjs +56 -74
- package/fesm2022/exhaustive-ui-core-timeline.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-togglebutton.mjs +86 -129
- package/fesm2022/exhaustive-ui-core-togglebutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-toggleswitch.mjs +57 -94
- package/fesm2022/exhaustive-ui-core-toggleswitch.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-toolbar.mjs +36 -55
- package/fesm2022/exhaustive-ui-core-toolbar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tooltip.mjs +264 -343
- package/fesm2022/exhaustive-ui-core-tooltip.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tree.mjs +508 -639
- package/fesm2022/exhaustive-ui-core-tree.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-treeselect.mjs +327 -421
- package/fesm2022/exhaustive-ui-core-treeselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-treetable.mjs +1267 -1473
- package/fesm2022/exhaustive-ui-core-treetable.mjs.map +1 -1
- package/package.json +5 -5
- package/schematics/migrations/remove-dead-inputs/migration.js +213 -7
- package/schematics/migrations/renamed-inputs/migration.js +97 -0
- package/schematics/migrations/styleclass-to-class/migration.js +92 -1
- package/schematics/migrations.json +7 -2
- package/schematics/utils/removed-inputs.js +0 -0
- package/schematics/utils/renamed-inputs.js +175 -0
- package/schematics/utils/styleclass.js +24 -8
- package/schematics/utils/versions.json +8 -8
- package/types/exhaustive-ui-core-accordion.d.ts +8 -24
- package/types/exhaustive-ui-core-animateonscroll.d.ts +19 -21
- package/types/exhaustive-ui-core-api.d.ts +2 -3
- package/types/exhaustive-ui-core-autocomplete.d.ts +103 -176
- package/types/exhaustive-ui-core-autofocus.d.ts +4 -7
- package/types/exhaustive-ui-core-avatar.d.ts +18 -25
- package/types/exhaustive-ui-core-badge.d.ts +13 -27
- package/types/exhaustive-ui-core-blockui.d.ts +18 -30
- package/types/exhaustive-ui-core-breadcrumb.d.ts +21 -22
- package/types/exhaustive-ui-core-button.d.ts +57 -89
- package/types/exhaustive-ui-core-carousel.d.ts +56 -82
- package/types/exhaustive-ui-core-cascadeselect.d.ts +77 -111
- package/types/exhaustive-ui-core-chart.d.ts +21 -29
- package/types/exhaustive-ui-core-checkbox.d.ts +25 -39
- package/types/exhaustive-ui-core-chip.d.ts +31 -38
- package/types/exhaustive-ui-core-colorpicker.d.ts +23 -57
- package/types/exhaustive-ui-core-confirmdialog.d.ts +39 -109
- package/types/exhaustive-ui-core-confirmpopup.d.ts +24 -43
- package/types/exhaustive-ui-core-contextmenu.d.ts +54 -71
- package/types/exhaustive-ui-core-dataview.d.ts +42 -65
- package/types/exhaustive-ui-core-datepicker.d.ts +109 -191
- package/types/exhaustive-ui-core-dialog.d.ts +73 -123
- package/types/exhaustive-ui-core-dock.d.ts +16 -25
- package/types/exhaustive-ui-core-dragdrop.d.ts +32 -36
- package/types/exhaustive-ui-core-drawer.d.ts +32 -64
- package/types/exhaustive-ui-core-dynamicdialog.d.ts +9 -54
- package/types/exhaustive-ui-core-editor.d.ts +15 -25
- package/types/exhaustive-ui-core-fieldset.d.ts +15 -35
- package/types/exhaustive-ui-core-fileupload.d.ts +69 -95
- package/types/exhaustive-ui-core-floatlabel.d.ts +4 -6
- package/types/exhaustive-ui-core-focustrap.d.ts +5 -10
- package/types/exhaustive-ui-core-galleria.d.ts +124 -194
- package/types/exhaustive-ui-core-iconfield.d.ts +5 -13
- package/types/exhaustive-ui-core-icons-baseicon.d.ts +4 -5
- package/types/exhaustive-ui-core-image.d.ts +35 -68
- package/types/exhaustive-ui-core-imagecompare.d.ts +19 -20
- package/types/exhaustive-ui-core-inplace.d.ts +30 -42
- package/types/exhaustive-ui-core-inputgroup.d.ts +2 -9
- package/types/exhaustive-ui-core-inputgroupaddon.d.ts +6 -10
- package/types/exhaustive-ui-core-inputicon.d.ts +4 -11
- package/types/exhaustive-ui-core-inputmask.d.ts +53 -66
- package/types/exhaustive-ui-core-inputnumber.d.ts +62 -84
- package/types/exhaustive-ui-core-inputotp.d.ts +16 -20
- package/types/exhaustive-ui-core-inputtext.d.ts +5 -8
- package/types/exhaustive-ui-core-keyfilter.d.ts +11 -15
- package/types/exhaustive-ui-core-knob.d.ts +45 -60
- package/types/exhaustive-ui-core-listbox.d.ts +90 -126
- package/types/exhaustive-ui-core-megamenu.d.ts +45 -66
- package/types/exhaustive-ui-core-menu.d.ts +33 -53
- package/types/exhaustive-ui-core-menubar.d.ts +38 -85
- package/types/exhaustive-ui-core-metergroup.d.ts +39 -48
- package/types/exhaustive-ui-core-multiselect.d.ts +166 -219
- package/types/exhaustive-ui-core-orderlist.d.ts +58 -81
- package/types/exhaustive-ui-core-organizationchart.d.ts +32 -67
- package/types/exhaustive-ui-core-overlaybadge.d.ts +10 -20
- package/types/exhaustive-ui-core-paginator.d.ts +41 -69
- package/types/exhaustive-ui-core-panel.d.ts +18 -45
- package/types/exhaustive-ui-core-panelmenu.d.ts +31 -76
- package/types/exhaustive-ui-core-password.d.ts +56 -93
- package/types/exhaustive-ui-core-picklist.d.ts +107 -121
- package/types/exhaustive-ui-core-popover.d.ts +23 -47
- package/types/exhaustive-ui-core-rating.d.ts +18 -26
- package/types/exhaustive-ui-core-scroller.d.ts +90 -120
- package/types/exhaustive-ui-core-scrollpanel.d.ts +35 -46
- package/types/exhaustive-ui-core-scrolltop.d.ts +28 -45
- package/types/exhaustive-ui-core-select.d.ts +137 -188
- package/types/exhaustive-ui-core-selectbutton.d.ts +35 -44
- package/types/exhaustive-ui-core-slider.d.ts +52 -67
- package/types/exhaustive-ui-core-speeddial.d.ts +40 -56
- package/types/exhaustive-ui-core-splitbutton.d.ts +31 -71
- package/types/exhaustive-ui-core-splitter.d.ts +47 -59
- package/types/exhaustive-ui-core-steps.d.ts +24 -31
- package/types/exhaustive-ui-core-styleclass.d.ts +27 -33
- package/types/exhaustive-ui-core-table.d.ts +349 -453
- package/types/exhaustive-ui-core-terminal.d.ts +10 -22
- package/types/exhaustive-ui-core-textarea.d.ts +7 -10
- package/types/exhaustive-ui-core-tieredmenu.d.ts +49 -84
- package/types/exhaustive-ui-core-timeline.d.ts +20 -28
- package/types/exhaustive-ui-core-togglebutton.d.ts +32 -48
- package/types/exhaustive-ui-core-toggleswitch.d.ts +26 -37
- package/types/exhaustive-ui-core-toolbar.d.ts +17 -25
- package/types/exhaustive-ui-core-tooltip.d.ts +53 -88
- package/types/exhaustive-ui-core-tree.d.ts +82 -119
- package/types/exhaustive-ui-core-treeselect.d.ts +63 -92
- package/types/exhaustive-ui-core-treetable.d.ts +203 -280
- package/types/exhaustive-ui-core-types-chip.d.ts +1 -1
|
@@ -2,7 +2,7 @@ export * from '@exhaustive-ui/core/types/contextmenu';
|
|
|
2
2
|
import * as i1 from '@angular/common';
|
|
3
3
|
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { Injectable, InjectionToken, inject, ElementRef, Renderer2,
|
|
5
|
+
import { Injectable, InjectionToken, inject, ElementRef, Renderer2, input, booleanAttribute, numberAttribute, output, viewChild, linkedSignal, ViewEncapsulation, ChangeDetectionStrategy, Component, computed, signal, effect, contentChild, contentChildren, NgModule } from '@angular/core';
|
|
6
6
|
import * as i2 from '@angular/router';
|
|
7
7
|
import { RouterModule } from '@angular/router';
|
|
8
8
|
import { resolve, isNotEmpty, getOffset, getViewport, getHiddenElementOuterWidth, getOuterWidth, calculateScrollbarWidth, uuid, isIOS, isAndroid, focus, isPrintableCharacter, isEmpty, findSingle, appendChild, getHiddenElementOuterHeight, findLastIndex } from '@exhaustive-ui/utils';
|
|
@@ -26,15 +26,19 @@ const inlineStyles = {
|
|
|
26
26
|
root: { position: 'absolute' }
|
|
27
27
|
};
|
|
28
28
|
const classes = {
|
|
29
|
-
root: () => [
|
|
29
|
+
root: ({ instance }) => [
|
|
30
|
+
'p-contextmenu p-component',
|
|
31
|
+
{
|
|
32
|
+
'p-contextmenu-mobile': instance.queryMatches()
|
|
33
|
+
}
|
|
34
|
+
],
|
|
30
35
|
rootList: 'p-contextmenu-root-list',
|
|
31
36
|
item: ({ instance, processedItem }) => [
|
|
32
37
|
'p-contextmenu-item',
|
|
33
38
|
{
|
|
34
39
|
'p-contextmenu-item-active': instance.isItemActive(processedItem),
|
|
35
40
|
'p-focus': instance.isItemFocused(processedItem),
|
|
36
|
-
'p-disabled': instance.isItemDisabled(processedItem)
|
|
37
|
-
'p-contextmenu-mobile': instance.queryMatches
|
|
41
|
+
'p-disabled': instance.isItemDisabled(processedItem)
|
|
38
42
|
}
|
|
39
43
|
],
|
|
40
44
|
itemContent: 'p-contextmenu-item-content',
|
|
@@ -116,29 +120,27 @@ class ContextMenuSub extends BaseComponent {
|
|
|
116
120
|
el = inject(ElementRef);
|
|
117
121
|
renderer = inject(Renderer2);
|
|
118
122
|
contextMenu = inject(ContextMenu);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
motionOptions;
|
|
141
|
-
tabindex = 0;
|
|
123
|
+
visible = input(false, /* @ts-ignore */
|
|
124
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
125
|
+
items = input.required(/* @ts-ignore */
|
|
126
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
127
|
+
itemTemplate = input(undefined, /* @ts-ignore */
|
|
128
|
+
...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
|
|
129
|
+
root = input(false, { ...(ngDevMode ? { debugName: "root" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
130
|
+
menuId = input(undefined, /* @ts-ignore */
|
|
131
|
+
...(ngDevMode ? [{ debugName: "menuId" }] : /* istanbul ignore next */ []));
|
|
132
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
133
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
134
|
+
ariaLabelledBy = input(undefined, /* @ts-ignore */
|
|
135
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []));
|
|
136
|
+
level = input(0, { ...(ngDevMode ? { debugName: "level" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
137
|
+
focusedItemId = input(undefined, /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "focusedItemId" }] : /* istanbul ignore next */ []));
|
|
139
|
+
activeItemPath = input(/* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [undefined, { debugName: "activeItemPath" }] : /* istanbul ignore next */ []));
|
|
141
|
+
motionOptions = input(undefined, /* @ts-ignore */
|
|
142
|
+
...(ngDevMode ? [{ debugName: "motionOptions" }] : /* istanbul ignore next */ []));
|
|
143
|
+
tabindex = input(0, { ...(ngDevMode ? { debugName: "tabindex" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
142
144
|
itemClick = output();
|
|
143
145
|
itemMouseEnter = output();
|
|
144
146
|
menuFocus = output();
|
|
@@ -146,26 +148,25 @@ class ContextMenuSub extends BaseComponent {
|
|
|
146
148
|
menuKeydown = output();
|
|
147
149
|
sublistViewChild = viewChild('sublist', /* @ts-ignore */
|
|
148
150
|
...(ngDevMode ? [{ debugName: "sublistViewChild" }] : /* istanbul ignore next */ []));
|
|
149
|
-
render =
|
|
150
|
-
|
|
151
|
+
render = linkedSignal({ ...(ngDevMode ? { debugName: "render" } : /* istanbul ignore next */ {}), source: () => this.visible() || this.root(),
|
|
152
|
+
computation: (show, previous) => !!show || (previous?.value ?? false) });
|
|
151
153
|
hostName = 'ContextMenu';
|
|
152
154
|
_componentStyle = inject(ContextMenuStyle);
|
|
153
155
|
$pcContextMenu = inject(CONTEXTMENU_INSTANCE, { optional: true, skipSelf: true }) ?? undefined;
|
|
154
156
|
$pcContextMenuSub = inject(CONTEXTMENUSUB_INSTANCE, { optional: true, skipSelf: true }) ?? undefined;
|
|
155
|
-
_visible = false;
|
|
156
157
|
constructor() {
|
|
157
158
|
super();
|
|
158
|
-
this.contextMenu.handleSubmenuAfterLeave
|
|
159
|
-
if (this.root) {
|
|
159
|
+
this.contextMenu.handleSubmenuAfterLeave.set(() => {
|
|
160
|
+
if (this.root()) {
|
|
160
161
|
this.onAfterLeave();
|
|
161
162
|
}
|
|
162
|
-
};
|
|
163
|
+
});
|
|
163
164
|
}
|
|
164
165
|
getItemProp(processedItem, name, params = null) {
|
|
165
166
|
return processedItem && processedItem.item ? resolve(processedItem.item[name], params) : undefined;
|
|
166
167
|
}
|
|
167
168
|
getItemId(processedItem) {
|
|
168
|
-
return processedItem.item && processedItem.item?.id ? processedItem.item.id : `${this.menuId}_${processedItem.key}`;
|
|
169
|
+
return processedItem.item && processedItem.item?.id ? processedItem.item.id : `${this.menuId()}_${processedItem.key}`;
|
|
169
170
|
}
|
|
170
171
|
getItemKey(processedItem) {
|
|
171
172
|
return this.getItemId(processedItem);
|
|
@@ -174,24 +175,29 @@ class ContextMenuSub extends BaseComponent {
|
|
|
174
175
|
return this.getItemProp(processedItem, 'label');
|
|
175
176
|
}
|
|
176
177
|
getAriaSetSize() {
|
|
177
|
-
return this.items.filter((processedItem) => this.isItemVisible(processedItem) && !this.getItemProp(processedItem, 'separator')).length;
|
|
178
|
+
return this.items().filter((processedItem) => this.isItemVisible(processedItem) && !this.getItemProp(processedItem, 'separator')).length;
|
|
178
179
|
}
|
|
179
180
|
getAriaPosInset(index) {
|
|
180
|
-
return index -
|
|
181
|
+
return (index -
|
|
182
|
+
this.items()
|
|
183
|
+
.slice(0, index)
|
|
184
|
+
.filter((processedItem) => this.isItemVisible(processedItem) && this.getItemProp(processedItem, 'separator')).length +
|
|
185
|
+
1);
|
|
181
186
|
}
|
|
182
187
|
isItemVisible(processedItem) {
|
|
183
188
|
return this.getItemProp(processedItem, 'visible') !== false;
|
|
184
189
|
}
|
|
185
190
|
isItemActive(processedItem) {
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
const activeItemPath = this.activeItemPath();
|
|
192
|
+
if (activeItemPath) {
|
|
193
|
+
return activeItemPath.some((path) => path.key === processedItem.key);
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
196
|
isItemDisabled(processedItem) {
|
|
191
197
|
return this.getItemProp(processedItem, 'disabled');
|
|
192
198
|
}
|
|
193
199
|
isItemFocused(processedItem) {
|
|
194
|
-
return this.focusedItemId === this.getItemId(processedItem);
|
|
200
|
+
return this.focusedItemId() === this.getItemId(processedItem);
|
|
195
201
|
}
|
|
196
202
|
isItemGroup(processedItem) {
|
|
197
203
|
return isNotEmpty(processedItem.items);
|
|
@@ -240,30 +246,30 @@ class ContextMenuSub extends BaseComponent {
|
|
|
240
246
|
}
|
|
241
247
|
}
|
|
242
248
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ContextMenuSub, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
243
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: ContextMenuSub, isStandalone: true, selector: "p-contextMenuSub, p-contextmenu-sub", inputs: { visible: "visible",
|
|
249
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: ContextMenuSub, isStandalone: true, selector: "p-contextMenuSub, p-contextmenu-sub", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, root: { classPropertyName: "root", publicName: "root", isSignal: true, isRequired: false, transformFunction: null }, menuId: { classPropertyName: "menuId", publicName: "menuId", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "ariaLabelledBy", isSignal: true, isRequired: false, transformFunction: null }, level: { classPropertyName: "level", publicName: "level", isSignal: true, isRequired: false, transformFunction: null }, focusedItemId: { classPropertyName: "focusedItemId", publicName: "focusedItemId", isSignal: true, isRequired: false, transformFunction: null }, activeItemPath: { classPropertyName: "activeItemPath", publicName: "activeItemPath", isSignal: true, isRequired: false, transformFunction: null }, motionOptions: { classPropertyName: "motionOptions", publicName: "motionOptions", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick", itemMouseEnter: "itemMouseEnter", menuFocus: "menuFocus", menuBlur: "menuBlur", menuKeydown: "menuKeydown" }, providers: [ContextMenuStyle, { provide: CONTEXTMENUSUB_INSTANCE, useExisting: ContextMenuSub }, { provide: PARENT_INSTANCE, useExisting: ContextMenuSub }], viewQueries: [{ propertyName: "sublistViewChild", first: true, predicate: ["sublist"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
244
250
|
@if (render()) {
|
|
245
251
|
<ul
|
|
246
252
|
#sublist
|
|
247
253
|
role="menu"
|
|
248
|
-
[class]="root ? cx('rootList') : cx('submenu')"
|
|
249
|
-
[pBind]="_ptm(root ? 'rootList' : 'submenu')"
|
|
250
|
-
[attr.id]="menuId + '_list'"
|
|
251
|
-
[tabindex]="tabindex"
|
|
252
|
-
[attr.aria-label]="ariaLabel"
|
|
253
|
-
[attr.aria-labelledBy]="ariaLabelledBy"
|
|
254
|
-
[attr.aria-activedescendant]="focusedItemId"
|
|
254
|
+
[class]="root() ? cx('rootList') : cx('submenu')"
|
|
255
|
+
[pBind]="_ptm(root() ? 'rootList' : 'submenu')"
|
|
256
|
+
[attr.id]="menuId() + '_list'"
|
|
257
|
+
[tabindex]="tabindex()"
|
|
258
|
+
[attr.aria-label]="ariaLabel()"
|
|
259
|
+
[attr.aria-labelledBy]="ariaLabelledBy()"
|
|
260
|
+
[attr.aria-activedescendant]="focusedItemId()"
|
|
255
261
|
[attr.aria-orientation]="'vertical'"
|
|
256
262
|
(keydown)="menuKeydown.emit($event)"
|
|
257
263
|
(focus)="menuFocus.emit($event)"
|
|
258
264
|
(blur)="menuBlur.emit($event)"
|
|
259
|
-
[pMotion]="root ? true : visible"
|
|
265
|
+
[pMotion]="root() ? true : visible()"
|
|
260
266
|
[pMotionAppear]="true"
|
|
261
267
|
[pMotionName]="'p-anchored-overlay'"
|
|
262
|
-
[pMotionOptions]="motionOptions"
|
|
268
|
+
[pMotionOptions]="motionOptions()"
|
|
263
269
|
(pMotionOnBeforeEnter)="onBeforeEnter($event)"
|
|
264
270
|
(pMotionOnAfterLeave)="onAfterLeave()"
|
|
265
271
|
>
|
|
266
|
-
<ng-template ngFor let-processedItem [ngForOf]="items" let-index="index">
|
|
272
|
+
<ng-template ngFor let-processedItem [ngForOf]="items()" let-index="index">
|
|
267
273
|
<li
|
|
268
274
|
*ngIf="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
|
|
269
275
|
[attr.id]="getItemId(processedItem)"
|
|
@@ -284,7 +290,7 @@ class ContextMenuSub extends BaseComponent {
|
|
|
284
290
|
[attr.aria-disabled]="isItemDisabled(processedItem) || undefined"
|
|
285
291
|
[attr.aria-haspopup]="isItemGroup(processedItem) && !getItemProp(processedItem, 'to') ? 'menu' : undefined"
|
|
286
292
|
[attr.aria-expanded]="isItemGroup(processedItem) ? isItemActive(processedItem) : undefined"
|
|
287
|
-
[attr.aria-level]="level + 1"
|
|
293
|
+
[attr.aria-level]="level() + 1"
|
|
288
294
|
[attr.aria-setsize]="getAriaSetSize()"
|
|
289
295
|
[attr.aria-posinset]="getAriaPosInset(index)"
|
|
290
296
|
[style]="getItemProp(processedItem, 'style')"
|
|
@@ -295,7 +301,7 @@ class ContextMenuSub extends BaseComponent {
|
|
|
295
301
|
[pTooltipUnstyled]="unstyled()"
|
|
296
302
|
>
|
|
297
303
|
<div [class]="cx('itemContent')" [pBind]="getPTOptions(processedItem, index, 'itemContent')" (click)="onItemClick($event, processedItem)" (mouseenter)="onItemMouseEnter({ $event, processedItem })">
|
|
298
|
-
<ng-container *ngIf="!itemTemplate">
|
|
304
|
+
<ng-container *ngIf="!itemTemplate()">
|
|
299
305
|
<a
|
|
300
306
|
*ngIf="!getItemProp(processedItem, 'routerLink')"
|
|
301
307
|
[attr.href]="getItemProp(processedItem, 'url')"
|
|
@@ -337,12 +343,12 @@ class ContextMenuSub extends BaseComponent {
|
|
|
337
343
|
<ng-container *ngIf="isItemGroup(processedItem)">
|
|
338
344
|
<svg
|
|
339
345
|
data-p-icon="angle-right"
|
|
340
|
-
*ngIf="!contextMenu.submenuIconTemplate() && !contextMenu._submenuIconTemplate"
|
|
346
|
+
*ngIf="!contextMenu.submenuIconTemplate() && !contextMenu._submenuIconTemplate()"
|
|
341
347
|
[class]="cx('submenuIcon')"
|
|
342
348
|
[pBind]="getPTOptions(processedItem, index, 'submenuIcon')"
|
|
343
349
|
[attr.aria-hidden]="true"
|
|
344
350
|
/>
|
|
345
|
-
<ng-template *ngTemplateOutlet="contextMenu.submenuIconTemplate() || contextMenu._submenuIconTemplate; context: { class: 'p-contextmenu-submenu-icon' }" [attr.aria-hidden]="true"></ng-template>
|
|
351
|
+
<ng-template *ngTemplateOutlet="contextMenu.submenuIconTemplate() || contextMenu._submenuIconTemplate(); context: { class: 'p-contextmenu-submenu-icon' }" [attr.aria-hidden]="true"></ng-template>
|
|
346
352
|
</ng-container>
|
|
347
353
|
</a>
|
|
348
354
|
<a
|
|
@@ -394,72 +400,71 @@ class ContextMenuSub extends BaseComponent {
|
|
|
394
400
|
<ng-container *ngIf="isItemGroup(processedItem)">
|
|
395
401
|
<svg
|
|
396
402
|
data-p-icon="angle-right"
|
|
397
|
-
*ngIf="!contextMenu.submenuIconTemplate() && !contextMenu._submenuIconTemplate"
|
|
403
|
+
*ngIf="!contextMenu.submenuIconTemplate() && !contextMenu._submenuIconTemplate()"
|
|
398
404
|
[class]="cx('submenuIcon')"
|
|
399
405
|
[pBind]="getPTOptions(processedItem, index, 'submenuIcon')"
|
|
400
406
|
[attr.aria-hidden]="true"
|
|
401
407
|
/>
|
|
402
|
-
<ng-template *ngTemplateOutlet="contextMenu.submenuIconTemplate() || contextMenu._submenuIconTemplate; context: { class: 'p-contextmenu-submenu-icon' }" [attr.aria-hidden]="true"></ng-template>
|
|
408
|
+
<ng-template *ngTemplateOutlet="contextMenu.submenuIconTemplate() || contextMenu._submenuIconTemplate(); context: { class: 'p-contextmenu-submenu-icon' }" [attr.aria-hidden]="true"></ng-template>
|
|
403
409
|
</ng-container>
|
|
404
410
|
</a>
|
|
405
411
|
</ng-container>
|
|
406
|
-
<ng-container *ngIf="itemTemplate">
|
|
407
|
-
<ng-template *ngTemplateOutlet="itemTemplate; context: { $implicit: processedItem.item }"></ng-template>
|
|
412
|
+
<ng-container *ngIf="itemTemplate()">
|
|
413
|
+
<ng-template *ngTemplateOutlet="itemTemplate(); context: { $implicit: processedItem.item }"></ng-template>
|
|
408
414
|
</ng-container>
|
|
409
415
|
</div>
|
|
410
416
|
|
|
411
417
|
<p-contextmenu-sub
|
|
412
418
|
*ngIf="isItemVisible(processedItem) && isItemGroup(processedItem)"
|
|
413
419
|
[items]="processedItem.items"
|
|
414
|
-
[itemTemplate]="itemTemplate"
|
|
415
|
-
[menuId]="menuId"
|
|
420
|
+
[itemTemplate]="itemTemplate()"
|
|
421
|
+
[menuId]="menuId()"
|
|
416
422
|
[visible]="isItemActive(processedItem) && isItemGroup(processedItem)"
|
|
417
|
-
[activeItemPath]="activeItemPath"
|
|
418
|
-
[focusedItemId]="focusedItemId"
|
|
419
|
-
[level]="level + 1"
|
|
423
|
+
[activeItemPath]="activeItemPath()"
|
|
424
|
+
[focusedItemId]="focusedItemId()"
|
|
425
|
+
[level]="level() + 1"
|
|
420
426
|
(itemClick)="itemClick.emit($event)"
|
|
421
427
|
(itemMouseEnter)="onItemMouseEnter($event)"
|
|
422
428
|
[pt]="pt()"
|
|
423
|
-
[motionOptions]="motionOptions"
|
|
429
|
+
[motionOptions]="motionOptions()"
|
|
424
430
|
[unstyled]="unstyled()"
|
|
425
431
|
/>
|
|
426
432
|
</li>
|
|
427
433
|
</ng-template>
|
|
428
434
|
</ul>
|
|
429
435
|
}
|
|
430
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ContextMenuSub, selector: "p-contextMenuSub, p-contextmenu-sub", inputs: ["visible", "items", "itemTemplate", "root", "
|
|
436
|
+
`, isInline: true, dependencies: [{ kind: "component", type: ContextMenuSub, selector: "p-contextMenuSub, p-contextmenu-sub", inputs: ["visible", "items", "itemTemplate", "root", "menuId", "ariaLabel", "ariaLabelledBy", "level", "focusedItemId", "activeItemPath", "motionOptions", "tabindex"], outputs: ["itemClick", "itemMouseEnter", "menuFocus", "menuBlur", "menuKeydown"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: Ripple, selector: "[pRipple]" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "showOnEllipsis", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo", "ptTooltip", "pTooltipPT", "pTooltipUnstyled"] }, { kind: "directive", type: i4.Bind, selector: "[pBind]", inputs: ["pBind"] }, { kind: "component", type: AngleRightIcon, selector: "[data-p-icon=\"angle-right\"]" }, { kind: "ngmodule", type: BadgeModule }, { kind: "component", type: i5.Badge, selector: "p-badge", inputs: ["badgeSize", "size", "severity", "value", "badgeDisabled"] }, { kind: "ngmodule", type: SharedModule }, { kind: "ngmodule", type: BindModule }, { kind: "ngmodule", type: MotionModule }, { kind: "directive", type: i6.MotionDirective, selector: "[pMotion]", inputs: ["pMotion", "pMotionName", "pMotionType", "pMotionSafe", "pMotionDisabled", "pMotionAppear", "pMotionEnter", "pMotionLeave", "pMotionDuration", "pMotionHideStrategy", "pMotionEnterFromClass", "pMotionEnterToClass", "pMotionEnterActiveClass", "pMotionLeaveFromClass", "pMotionLeaveToClass", "pMotionLeaveActiveClass", "pMotionOptions"], outputs: ["pMotionOnBeforeEnter", "pMotionOnEnter", "pMotionOnAfterEnter", "pMotionOnEnterCancelled", "pMotionOnBeforeLeave", "pMotionOnLeave", "pMotionOnAfterLeave", "pMotionOnLeaveCancelled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
431
437
|
}
|
|
432
438
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ContextMenuSub, decorators: [{
|
|
433
439
|
type: Component,
|
|
434
440
|
args: [{
|
|
435
|
-
changeDetection: ChangeDetectionStrategy.
|
|
441
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
436
442
|
selector: 'p-contextMenuSub, p-contextmenu-sub',
|
|
437
|
-
standalone: true,
|
|
438
443
|
imports: [CommonModule, RouterModule, Ripple, TooltipModule, AngleRightIcon, BadgeModule, SharedModule, BindModule, MotionModule],
|
|
439
444
|
template: `
|
|
440
445
|
@if (render()) {
|
|
441
446
|
<ul
|
|
442
447
|
#sublist
|
|
443
448
|
role="menu"
|
|
444
|
-
[class]="root ? cx('rootList') : cx('submenu')"
|
|
445
|
-
[pBind]="_ptm(root ? 'rootList' : 'submenu')"
|
|
446
|
-
[attr.id]="menuId + '_list'"
|
|
447
|
-
[tabindex]="tabindex"
|
|
448
|
-
[attr.aria-label]="ariaLabel"
|
|
449
|
-
[attr.aria-labelledBy]="ariaLabelledBy"
|
|
450
|
-
[attr.aria-activedescendant]="focusedItemId"
|
|
449
|
+
[class]="root() ? cx('rootList') : cx('submenu')"
|
|
450
|
+
[pBind]="_ptm(root() ? 'rootList' : 'submenu')"
|
|
451
|
+
[attr.id]="menuId() + '_list'"
|
|
452
|
+
[tabindex]="tabindex()"
|
|
453
|
+
[attr.aria-label]="ariaLabel()"
|
|
454
|
+
[attr.aria-labelledBy]="ariaLabelledBy()"
|
|
455
|
+
[attr.aria-activedescendant]="focusedItemId()"
|
|
451
456
|
[attr.aria-orientation]="'vertical'"
|
|
452
457
|
(keydown)="menuKeydown.emit($event)"
|
|
453
458
|
(focus)="menuFocus.emit($event)"
|
|
454
459
|
(blur)="menuBlur.emit($event)"
|
|
455
|
-
[pMotion]="root ? true : visible"
|
|
460
|
+
[pMotion]="root() ? true : visible()"
|
|
456
461
|
[pMotionAppear]="true"
|
|
457
462
|
[pMotionName]="'p-anchored-overlay'"
|
|
458
|
-
[pMotionOptions]="motionOptions"
|
|
463
|
+
[pMotionOptions]="motionOptions()"
|
|
459
464
|
(pMotionOnBeforeEnter)="onBeforeEnter($event)"
|
|
460
465
|
(pMotionOnAfterLeave)="onAfterLeave()"
|
|
461
466
|
>
|
|
462
|
-
<ng-template ngFor let-processedItem [ngForOf]="items" let-index="index">
|
|
467
|
+
<ng-template ngFor let-processedItem [ngForOf]="items()" let-index="index">
|
|
463
468
|
<li
|
|
464
469
|
*ngIf="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
|
|
465
470
|
[attr.id]="getItemId(processedItem)"
|
|
@@ -480,7 +485,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
|
|
|
480
485
|
[attr.aria-disabled]="isItemDisabled(processedItem) || undefined"
|
|
481
486
|
[attr.aria-haspopup]="isItemGroup(processedItem) && !getItemProp(processedItem, 'to') ? 'menu' : undefined"
|
|
482
487
|
[attr.aria-expanded]="isItemGroup(processedItem) ? isItemActive(processedItem) : undefined"
|
|
483
|
-
[attr.aria-level]="level + 1"
|
|
488
|
+
[attr.aria-level]="level() + 1"
|
|
484
489
|
[attr.aria-setsize]="getAriaSetSize()"
|
|
485
490
|
[attr.aria-posinset]="getAriaPosInset(index)"
|
|
486
491
|
[style]="getItemProp(processedItem, 'style')"
|
|
@@ -491,7 +496,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
|
|
|
491
496
|
[pTooltipUnstyled]="unstyled()"
|
|
492
497
|
>
|
|
493
498
|
<div [class]="cx('itemContent')" [pBind]="getPTOptions(processedItem, index, 'itemContent')" (click)="onItemClick($event, processedItem)" (mouseenter)="onItemMouseEnter({ $event, processedItem })">
|
|
494
|
-
<ng-container *ngIf="!itemTemplate">
|
|
499
|
+
<ng-container *ngIf="!itemTemplate()">
|
|
495
500
|
<a
|
|
496
501
|
*ngIf="!getItemProp(processedItem, 'routerLink')"
|
|
497
502
|
[attr.href]="getItemProp(processedItem, 'url')"
|
|
@@ -533,12 +538,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
|
|
|
533
538
|
<ng-container *ngIf="isItemGroup(processedItem)">
|
|
534
539
|
<svg
|
|
535
540
|
data-p-icon="angle-right"
|
|
536
|
-
*ngIf="!contextMenu.submenuIconTemplate() && !contextMenu._submenuIconTemplate"
|
|
541
|
+
*ngIf="!contextMenu.submenuIconTemplate() && !contextMenu._submenuIconTemplate()"
|
|
537
542
|
[class]="cx('submenuIcon')"
|
|
538
543
|
[pBind]="getPTOptions(processedItem, index, 'submenuIcon')"
|
|
539
544
|
[attr.aria-hidden]="true"
|
|
540
545
|
/>
|
|
541
|
-
<ng-template *ngTemplateOutlet="contextMenu.submenuIconTemplate() || contextMenu._submenuIconTemplate; context: { class: 'p-contextmenu-submenu-icon' }" [attr.aria-hidden]="true"></ng-template>
|
|
546
|
+
<ng-template *ngTemplateOutlet="contextMenu.submenuIconTemplate() || contextMenu._submenuIconTemplate(); context: { class: 'p-contextmenu-submenu-icon' }" [attr.aria-hidden]="true"></ng-template>
|
|
542
547
|
</ng-container>
|
|
543
548
|
</a>
|
|
544
549
|
<a
|
|
@@ -590,33 +595,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
|
|
|
590
595
|
<ng-container *ngIf="isItemGroup(processedItem)">
|
|
591
596
|
<svg
|
|
592
597
|
data-p-icon="angle-right"
|
|
593
|
-
*ngIf="!contextMenu.submenuIconTemplate() && !contextMenu._submenuIconTemplate"
|
|
598
|
+
*ngIf="!contextMenu.submenuIconTemplate() && !contextMenu._submenuIconTemplate()"
|
|
594
599
|
[class]="cx('submenuIcon')"
|
|
595
600
|
[pBind]="getPTOptions(processedItem, index, 'submenuIcon')"
|
|
596
601
|
[attr.aria-hidden]="true"
|
|
597
602
|
/>
|
|
598
|
-
<ng-template *ngTemplateOutlet="contextMenu.submenuIconTemplate() || contextMenu._submenuIconTemplate; context: { class: 'p-contextmenu-submenu-icon' }" [attr.aria-hidden]="true"></ng-template>
|
|
603
|
+
<ng-template *ngTemplateOutlet="contextMenu.submenuIconTemplate() || contextMenu._submenuIconTemplate(); context: { class: 'p-contextmenu-submenu-icon' }" [attr.aria-hidden]="true"></ng-template>
|
|
599
604
|
</ng-container>
|
|
600
605
|
</a>
|
|
601
606
|
</ng-container>
|
|
602
|
-
<ng-container *ngIf="itemTemplate">
|
|
603
|
-
<ng-template *ngTemplateOutlet="itemTemplate; context: { $implicit: processedItem.item }"></ng-template>
|
|
607
|
+
<ng-container *ngIf="itemTemplate()">
|
|
608
|
+
<ng-template *ngTemplateOutlet="itemTemplate(); context: { $implicit: processedItem.item }"></ng-template>
|
|
604
609
|
</ng-container>
|
|
605
610
|
</div>
|
|
606
611
|
|
|
607
612
|
<p-contextmenu-sub
|
|
608
613
|
*ngIf="isItemVisible(processedItem) && isItemGroup(processedItem)"
|
|
609
614
|
[items]="processedItem.items"
|
|
610
|
-
[itemTemplate]="itemTemplate"
|
|
611
|
-
[menuId]="menuId"
|
|
615
|
+
[itemTemplate]="itemTemplate()"
|
|
616
|
+
[menuId]="menuId()"
|
|
612
617
|
[visible]="isItemActive(processedItem) && isItemGroup(processedItem)"
|
|
613
|
-
[activeItemPath]="activeItemPath"
|
|
614
|
-
[focusedItemId]="focusedItemId"
|
|
615
|
-
[level]="level + 1"
|
|
618
|
+
[activeItemPath]="activeItemPath()"
|
|
619
|
+
[focusedItemId]="focusedItemId()"
|
|
620
|
+
[level]="level() + 1"
|
|
616
621
|
(itemClick)="itemClick.emit($event)"
|
|
617
622
|
(itemMouseEnter)="onItemMouseEnter($event)"
|
|
618
623
|
[pt]="pt()"
|
|
619
|
-
[motionOptions]="motionOptions"
|
|
624
|
+
[motionOptions]="motionOptions()"
|
|
620
625
|
[unstyled]="unstyled()"
|
|
621
626
|
/>
|
|
622
627
|
</li>
|
|
@@ -627,43 +632,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
|
|
|
627
632
|
encapsulation: ViewEncapsulation.None,
|
|
628
633
|
providers: [ContextMenuStyle, { provide: CONTEXTMENUSUB_INSTANCE, useExisting: ContextMenuSub }, { provide: PARENT_INSTANCE, useExisting: ContextMenuSub }]
|
|
629
634
|
}]
|
|
630
|
-
}], ctorParameters: () => [], propDecorators: { visible: [{
|
|
631
|
-
type: Input
|
|
632
|
-
}], items: [{
|
|
633
|
-
type: Input
|
|
634
|
-
}], itemTemplate: [{
|
|
635
|
-
type: Input
|
|
636
|
-
}], root: [{
|
|
637
|
-
type: Input,
|
|
638
|
-
args: [{ transform: booleanAttribute }]
|
|
639
|
-
}], autoZIndex: [{
|
|
640
|
-
type: Input,
|
|
641
|
-
args: [{ transform: booleanAttribute }]
|
|
642
|
-
}], baseZIndex: [{
|
|
643
|
-
type: Input,
|
|
644
|
-
args: [{ transform: numberAttribute }]
|
|
645
|
-
}], popup: [{
|
|
646
|
-
type: Input,
|
|
647
|
-
args: [{ transform: booleanAttribute }]
|
|
648
|
-
}], menuId: [{
|
|
649
|
-
type: Input
|
|
650
|
-
}], ariaLabel: [{
|
|
651
|
-
type: Input
|
|
652
|
-
}], ariaLabelledBy: [{
|
|
653
|
-
type: Input
|
|
654
|
-
}], level: [{
|
|
655
|
-
type: Input,
|
|
656
|
-
args: [{ transform: numberAttribute }]
|
|
657
|
-
}], focusedItemId: [{
|
|
658
|
-
type: Input
|
|
659
|
-
}], activeItemPath: [{
|
|
660
|
-
type: Input
|
|
661
|
-
}], motionOptions: [{
|
|
662
|
-
type: Input
|
|
663
|
-
}], tabindex: [{
|
|
664
|
-
type: Input,
|
|
665
|
-
args: [{ transform: numberAttribute }]
|
|
666
|
-
}], itemClick: [{ type: i0.Output, args: ["itemClick"] }], itemMouseEnter: [{ type: i0.Output, args: ["itemMouseEnter"] }], menuFocus: [{ type: i0.Output, args: ["menuFocus"] }], menuBlur: [{ type: i0.Output, args: ["menuBlur"] }], menuKeydown: [{ type: i0.Output, args: ["menuKeydown"] }], sublistViewChild: [{ type: i0.ViewChild, args: ['sublist', { isSignal: true }] }] } });
|
|
635
|
+
}], ctorParameters: () => [], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], root: [{ type: i0.Input, args: [{ isSignal: true, alias: "root", required: false }] }], menuId: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuId", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledBy", required: false }] }], level: [{ type: i0.Input, args: [{ isSignal: true, alias: "level", required: false }] }], focusedItemId: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusedItemId", required: false }] }], activeItemPath: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeItemPath", required: false }] }], motionOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionOptions", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], itemClick: [{ type: i0.Output, args: ["itemClick"] }], itemMouseEnter: [{ type: i0.Output, args: ["itemMouseEnter"] }], menuFocus: [{ type: i0.Output, args: ["menuFocus"] }], menuBlur: [{ type: i0.Output, args: ["menuBlur"] }], menuKeydown: [{ type: i0.Output, args: ["menuKeydown"] }], sublistViewChild: [{ type: i0.ViewChild, args: ['sublist', { isSignal: true }] }] } });
|
|
667
636
|
/**
|
|
668
637
|
* ContextMenu displays an overlay menu on right click of its target. Note that components like Table has special integration with ContextMenu.
|
|
669
638
|
* @group Components
|
|
@@ -675,73 +644,78 @@ class ContextMenu extends BaseComponent {
|
|
|
675
644
|
* An array of menuitems.
|
|
676
645
|
* @group Props
|
|
677
646
|
*/
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
this._processedItems = this.createProcessedItems(this._model || []);
|
|
681
|
-
}
|
|
682
|
-
get model() {
|
|
683
|
-
return this._model;
|
|
684
|
-
}
|
|
647
|
+
model = input(undefined, /* @ts-ignore */
|
|
648
|
+
...(ngDevMode ? [{ debugName: "model" }] : /* istanbul ignore next */ []));
|
|
685
649
|
/**
|
|
686
650
|
* Event for which the menu must be displayed.
|
|
687
651
|
* @group Props
|
|
688
652
|
*/
|
|
689
|
-
triggerEvent = 'contextmenu'
|
|
653
|
+
triggerEvent = input('contextmenu', /* @ts-ignore */
|
|
654
|
+
...(ngDevMode ? [{ debugName: "triggerEvent" }] : /* istanbul ignore next */ []));
|
|
690
655
|
/**
|
|
691
656
|
* Local template variable name of the element to attach the context menu.
|
|
692
657
|
* @group Props
|
|
693
658
|
*/
|
|
694
|
-
target
|
|
659
|
+
target = input(undefined, /* @ts-ignore */
|
|
660
|
+
...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
|
|
695
661
|
/**
|
|
696
662
|
* Attaches the menu to document instead of a particular item.
|
|
697
663
|
* @group Props
|
|
698
664
|
*/
|
|
699
|
-
global;
|
|
665
|
+
global = input(undefined, { ...(ngDevMode ? { debugName: "global" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
700
666
|
/**
|
|
701
667
|
* Inline style of the component.
|
|
702
668
|
* @group Props
|
|
703
669
|
*/
|
|
704
|
-
style
|
|
670
|
+
style = input(undefined, /* @ts-ignore */
|
|
671
|
+
...(ngDevMode ? [{ debugName: "style" }] : /* istanbul ignore next */ []));
|
|
705
672
|
/**
|
|
706
673
|
* Style class of the component.
|
|
707
674
|
* @group Props
|
|
708
675
|
*/
|
|
709
|
-
styleClass
|
|
676
|
+
styleClass = input(undefined, /* @ts-ignore */
|
|
677
|
+
...(ngDevMode ? [{ debugName: "styleClass" }] : /* istanbul ignore next */ []));
|
|
710
678
|
/**
|
|
711
679
|
* Whether to automatically manage layering.
|
|
712
680
|
* @group Props
|
|
713
681
|
*/
|
|
714
|
-
autoZIndex = true;
|
|
682
|
+
autoZIndex = input(true, { ...(ngDevMode ? { debugName: "autoZIndex" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
715
683
|
/**
|
|
716
684
|
* Base zIndex value to use in layering.
|
|
717
685
|
* @group Props
|
|
718
686
|
*/
|
|
719
|
-
baseZIndex = 0;
|
|
687
|
+
baseZIndex = input(0, { ...(ngDevMode ? { debugName: "baseZIndex" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
720
688
|
/**
|
|
721
689
|
* Current id state as a string.
|
|
722
690
|
* @group Props
|
|
723
691
|
*/
|
|
724
|
-
id
|
|
692
|
+
id = input(undefined, /* @ts-ignore */
|
|
693
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
694
|
+
_id = computed(() => this.id() || uuid('pn_id_'), /* @ts-ignore */
|
|
695
|
+
...(ngDevMode ? [{ debugName: "_id" }] : /* istanbul ignore next */ []));
|
|
725
696
|
/**
|
|
726
697
|
* The breakpoint to define the maximum width boundary.
|
|
727
698
|
* @group Props
|
|
728
699
|
*/
|
|
729
|
-
breakpoint = '960px'
|
|
700
|
+
breakpoint = input('960px', /* @ts-ignore */
|
|
701
|
+
...(ngDevMode ? [{ debugName: "breakpoint" }] : /* istanbul ignore next */ []));
|
|
730
702
|
/**
|
|
731
703
|
* Defines a string value that labels an interactive element.
|
|
732
704
|
* @group Props
|
|
733
705
|
*/
|
|
734
|
-
ariaLabel
|
|
706
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
707
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
735
708
|
/**
|
|
736
709
|
* Identifier of the underlying input element.
|
|
737
710
|
* @group Props
|
|
738
711
|
*/
|
|
739
|
-
ariaLabelledBy
|
|
712
|
+
ariaLabelledBy = input(undefined, /* @ts-ignore */
|
|
713
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []));
|
|
740
714
|
/**
|
|
741
715
|
* Press delay in touch devices as miliseconds.
|
|
742
716
|
* @group Props
|
|
743
717
|
*/
|
|
744
|
-
pressDelay = 500;
|
|
718
|
+
pressDelay = input(500, { ...(ngDevMode ? { debugName: "pressDelay" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
745
719
|
/**
|
|
746
720
|
* Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
|
|
747
721
|
* @defaultValue 'self'
|
|
@@ -774,21 +748,28 @@ class ContextMenu extends BaseComponent {
|
|
|
774
748
|
onHide = output();
|
|
775
749
|
rootmenu = viewChild('rootmenu', /* @ts-ignore */
|
|
776
750
|
...(ngDevMode ? [{ debugName: "rootmenu" }] : /* istanbul ignore next */ []));
|
|
777
|
-
container
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
751
|
+
container = signal(undefined, /* @ts-ignore */
|
|
752
|
+
...(ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []));
|
|
753
|
+
handleSubmenuAfterLeave = signal(null, /* @ts-ignore */
|
|
754
|
+
...(ngDevMode ? [{ debugName: "handleSubmenuAfterLeave" }] : /* istanbul ignore next */ []));
|
|
755
|
+
resizeListener = signal(undefined, /* @ts-ignore */
|
|
756
|
+
...(ngDevMode ? [{ debugName: "resizeListener" }] : /* istanbul ignore next */ []));
|
|
757
|
+
triggerEventListener = signal(undefined, /* @ts-ignore */
|
|
758
|
+
...(ngDevMode ? [{ debugName: "triggerEventListener" }] : /* istanbul ignore next */ []));
|
|
759
|
+
documentClickListener = signal(undefined, /* @ts-ignore */
|
|
760
|
+
...(ngDevMode ? [{ debugName: "documentClickListener" }] : /* istanbul ignore next */ []));
|
|
761
|
+
touchEndListener = signal(undefined, /* @ts-ignore */
|
|
762
|
+
...(ngDevMode ? [{ debugName: "touchEndListener" }] : /* istanbul ignore next */ []));
|
|
763
|
+
pageX = signal(undefined, /* @ts-ignore */
|
|
764
|
+
...(ngDevMode ? [{ debugName: "pageX" }] : /* istanbul ignore next */ []));
|
|
765
|
+
pageY = signal(undefined, /* @ts-ignore */
|
|
766
|
+
...(ngDevMode ? [{ debugName: "pageY" }] : /* istanbul ignore next */ []));
|
|
787
767
|
visible = signal(false, /* @ts-ignore */
|
|
788
768
|
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
789
769
|
render = signal(false, /* @ts-ignore */
|
|
790
770
|
...(ngDevMode ? [{ debugName: "render" }] : /* istanbul ignore next */ []));
|
|
791
|
-
focused = false
|
|
771
|
+
focused = signal(false, /* @ts-ignore */
|
|
772
|
+
...(ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []));
|
|
792
773
|
activeItemPath = signal([], /* @ts-ignore */
|
|
793
774
|
...(ngDevMode ? [{ debugName: "activeItemPath" }] : /* istanbul ignore next */ []));
|
|
794
775
|
focusedItemInfo = signal({ index: -1, level: 0, parentKey: '', item: null }, /* @ts-ignore */
|
|
@@ -797,31 +778,33 @@ class ContextMenu extends BaseComponent {
|
|
|
797
778
|
...(ngDevMode ? [{ debugName: "submenuVisible" }] : /* istanbul ignore next */ []));
|
|
798
779
|
$appendTo = computed(() => this.appendTo() || this.config.overlayAppendTo(), /* @ts-ignore */
|
|
799
780
|
...(ngDevMode ? [{ debugName: "$appendTo" }] : /* istanbul ignore next */ []));
|
|
800
|
-
searchValue = ''
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
pressTimer
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
781
|
+
searchValue = signal('', /* @ts-ignore */
|
|
782
|
+
...(ngDevMode ? [{ debugName: "searchValue" }] : /* istanbul ignore next */ []));
|
|
783
|
+
searchTimeout = signal(undefined, /* @ts-ignore */
|
|
784
|
+
...(ngDevMode ? [{ debugName: "searchTimeout" }] : /* istanbul ignore next */ []));
|
|
785
|
+
pressTimer = signal(undefined, /* @ts-ignore */
|
|
786
|
+
...(ngDevMode ? [{ debugName: "pressTimer" }] : /* istanbul ignore next */ []));
|
|
787
|
+
hideCallback = signal(undefined, /* @ts-ignore */
|
|
788
|
+
...(ngDevMode ? [{ debugName: "hideCallback" }] : /* istanbul ignore next */ []));
|
|
789
|
+
matchMediaListener = signal(undefined, /* @ts-ignore */
|
|
790
|
+
...(ngDevMode ? [{ debugName: "matchMediaListener" }] : /* istanbul ignore next */ []));
|
|
791
|
+
query = signal(undefined, /* @ts-ignore */
|
|
792
|
+
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
808
793
|
queryMatches = signal(false, /* @ts-ignore */
|
|
809
794
|
...(ngDevMode ? [{ debugName: "queryMatches" }] : /* istanbul ignore next */ []));
|
|
810
795
|
_componentStyle = inject(ContextMenuStyle);
|
|
811
|
-
|
|
796
|
+
visibleItems = computed(() => {
|
|
812
797
|
const processedItem = this.activeItemPath().find((p) => p.key === this.focusedItemInfo().parentKey);
|
|
813
|
-
return processedItem ? processedItem.items : this.processedItems;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
return this._processedItems;
|
|
820
|
-
}
|
|
821
|
-
get focusedItemId() {
|
|
798
|
+
return processedItem ? processedItem.items : this.processedItems();
|
|
799
|
+
}, /* @ts-ignore */
|
|
800
|
+
...(ngDevMode ? [{ debugName: "visibleItems" }] : /* istanbul ignore next */ []));
|
|
801
|
+
processedItems = computed(() => this.createProcessedItems(this.model() || []), /* @ts-ignore */
|
|
802
|
+
...(ngDevMode ? [{ debugName: "processedItems" }] : /* istanbul ignore next */ []));
|
|
803
|
+
focusedItemId = computed(() => {
|
|
822
804
|
const focusedItem = this.focusedItemInfo();
|
|
823
|
-
return focusedItem.item && focusedItem.item?.id ? focusedItem.item.id : focusedItem.index !== -1 ? `${this.
|
|
824
|
-
}
|
|
805
|
+
return focusedItem.item && focusedItem.item?.id ? focusedItem.item.id : focusedItem.index !== -1 ? `${this._id()}${isNotEmpty(focusedItem.parentKey) ? '_' + focusedItem.parentKey : ''}_${focusedItem.index}` : null;
|
|
806
|
+
}, /* @ts-ignore */
|
|
807
|
+
...(ngDevMode ? [{ debugName: "focusedItemId" }] : /* istanbul ignore next */ []));
|
|
825
808
|
constructor() {
|
|
826
809
|
super();
|
|
827
810
|
effect(() => {
|
|
@@ -835,7 +818,6 @@ class ContextMenu extends BaseComponent {
|
|
|
835
818
|
});
|
|
836
819
|
}
|
|
837
820
|
onInit() {
|
|
838
|
-
this.id = this.id || uuid('pn_id_');
|
|
839
821
|
this.bindMatchMediaListener();
|
|
840
822
|
this.bindTriggerEventListener();
|
|
841
823
|
}
|
|
@@ -844,27 +826,28 @@ class ContextMenu extends BaseComponent {
|
|
|
844
826
|
}
|
|
845
827
|
bindTriggerEventListener() {
|
|
846
828
|
if (isPlatformBrowser(this.platformId)) {
|
|
847
|
-
if (!this.triggerEventListener) {
|
|
829
|
+
if (!this.triggerEventListener()) {
|
|
830
|
+
const target = this.target();
|
|
848
831
|
if (!this.isMobile()) {
|
|
849
|
-
if (this.global) {
|
|
850
|
-
this.triggerEventListener
|
|
832
|
+
if (this.global()) {
|
|
833
|
+
this.triggerEventListener.set(this.renderer.listen(this.document, this.triggerEvent(), (event) => {
|
|
851
834
|
this.show(event);
|
|
852
|
-
});
|
|
835
|
+
}));
|
|
853
836
|
}
|
|
854
|
-
else if (
|
|
855
|
-
this.triggerEventListener
|
|
837
|
+
else if (target) {
|
|
838
|
+
this.triggerEventListener.set(this.renderer.listen(target, this.triggerEvent(), (event) => {
|
|
856
839
|
this.show(event);
|
|
857
|
-
});
|
|
840
|
+
}));
|
|
858
841
|
}
|
|
859
842
|
}
|
|
860
843
|
else {
|
|
861
|
-
if (this.global) {
|
|
862
|
-
this.triggerEventListener
|
|
863
|
-
this.touchEndListener
|
|
844
|
+
if (this.global()) {
|
|
845
|
+
this.triggerEventListener.set(this.renderer.listen(this.document, 'touchstart', this.onTouchStart.bind(this)));
|
|
846
|
+
this.touchEndListener.set(this.renderer.listen(this.document, 'touchend', this.onTouchEnd.bind(this)));
|
|
864
847
|
}
|
|
865
|
-
else if (
|
|
866
|
-
this.triggerEventListener
|
|
867
|
-
this.touchEndListener
|
|
848
|
+
else if (target) {
|
|
849
|
+
this.triggerEventListener.set(this.renderer.listen(target, 'touchstart', this.onTouchStart.bind(this)));
|
|
850
|
+
this.touchEndListener.set(this.renderer.listen(target, 'touchend', this.onTouchEnd.bind(this)));
|
|
868
851
|
}
|
|
869
852
|
}
|
|
870
853
|
}
|
|
@@ -872,18 +855,18 @@ class ContextMenu extends BaseComponent {
|
|
|
872
855
|
}
|
|
873
856
|
bindGlobalListeners() {
|
|
874
857
|
if (isPlatformBrowser(this.platformId)) {
|
|
875
|
-
if (!this.documentClickListener) {
|
|
858
|
+
if (!this.documentClickListener()) {
|
|
876
859
|
const documentTarget = this.el ? this.el.nativeElement.ownerDocument : 'document';
|
|
877
|
-
this.documentClickListener
|
|
878
|
-
if (this.container?.offsetParent && this.isOutsideClicked(event) && !event.ctrlKey && event.button !== 2) {
|
|
860
|
+
this.documentClickListener.set(this.renderer.listen(documentTarget, 'click', (event) => {
|
|
861
|
+
if (this.container()?.offsetParent && this.isOutsideClicked(event) && !event.ctrlKey && event.button !== 2) {
|
|
879
862
|
this.hide();
|
|
880
863
|
}
|
|
881
|
-
});
|
|
864
|
+
}));
|
|
882
865
|
}
|
|
883
|
-
if (!this.resizeListener) {
|
|
884
|
-
this.resizeListener
|
|
866
|
+
if (!this.resizeListener()) {
|
|
867
|
+
this.resizeListener.set(this.renderer.listen(this.document.defaultView, 'resize', (event) => {
|
|
885
868
|
this.hide();
|
|
886
|
-
});
|
|
869
|
+
}));
|
|
887
870
|
}
|
|
888
871
|
}
|
|
889
872
|
}
|
|
@@ -899,23 +882,14 @@ class ContextMenu extends BaseComponent {
|
|
|
899
882
|
submenuIconTemplate = contentChild('submenuicon', { ...(ngDevMode ? { debugName: "submenuIconTemplate" } : /* istanbul ignore next */ {}), descendants: false });
|
|
900
883
|
templates = contentChildren(PrimeTemplate, /* @ts-ignore */
|
|
901
884
|
...(ngDevMode ? [{ debugName: "templates" }] : /* istanbul ignore next */ []));
|
|
902
|
-
_submenuIconTemplate
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
case 'item':
|
|
911
|
-
this._itemTemplate = item.template;
|
|
912
|
-
break;
|
|
913
|
-
default:
|
|
914
|
-
this._itemTemplate = item.template;
|
|
915
|
-
break;
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
}
|
|
885
|
+
_submenuIconTemplate = computed(() => this.templates()
|
|
886
|
+
.filter((item) => item.getType() === 'submenuicon')
|
|
887
|
+
.at(-1)?.template, /* @ts-ignore */
|
|
888
|
+
...(ngDevMode ? [{ debugName: "_submenuIconTemplate" }] : /* istanbul ignore next */ []));
|
|
889
|
+
_itemTemplate = computed(() => this.templates()
|
|
890
|
+
.filter((item) => item.getType() !== 'submenuicon')
|
|
891
|
+
.at(-1)?.template, /* @ts-ignore */
|
|
892
|
+
...(ngDevMode ? [{ debugName: "_itemTemplate" }] : /* istanbul ignore next */ []));
|
|
919
893
|
getPTOptions(key, item, index, id) {
|
|
920
894
|
return this.ptm(key, {
|
|
921
895
|
context: {
|
|
@@ -949,22 +923,23 @@ class ContextMenu extends BaseComponent {
|
|
|
949
923
|
}
|
|
950
924
|
bindMatchMediaListener() {
|
|
951
925
|
if (isPlatformBrowser(this.platformId)) {
|
|
952
|
-
if (!this.matchMediaListener) {
|
|
953
|
-
const query = window.matchMedia(`(max-width: ${this.breakpoint})`);
|
|
954
|
-
this.query
|
|
926
|
+
if (!this.matchMediaListener()) {
|
|
927
|
+
const query = window.matchMedia(`(max-width: ${this.breakpoint()})`);
|
|
928
|
+
this.query.set(query);
|
|
955
929
|
this.queryMatches.set(query.matches);
|
|
956
|
-
|
|
930
|
+
const matchMediaListener = () => {
|
|
957
931
|
this.queryMatches.set(query.matches);
|
|
958
|
-
this.cd.markForCheck();
|
|
959
932
|
};
|
|
960
|
-
|
|
933
|
+
this.matchMediaListener.set(matchMediaListener);
|
|
934
|
+
query.addEventListener('change', matchMediaListener);
|
|
961
935
|
}
|
|
962
936
|
}
|
|
963
937
|
}
|
|
964
938
|
unbindMatchMediaListener() {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
this.matchMediaListener
|
|
939
|
+
const matchMediaListener = this.matchMediaListener();
|
|
940
|
+
if (matchMediaListener) {
|
|
941
|
+
this.query()?.removeEventListener('change', matchMediaListener);
|
|
942
|
+
this.matchMediaListener.set(null);
|
|
968
943
|
}
|
|
969
944
|
}
|
|
970
945
|
getItemProp(item, name) {
|
|
@@ -995,7 +970,7 @@ class ContextMenu extends BaseComponent {
|
|
|
995
970
|
return this.getItemProp(item, 'separator');
|
|
996
971
|
}
|
|
997
972
|
isItemMatched(processedItem) {
|
|
998
|
-
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
|
973
|
+
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem).toLocaleLowerCase().startsWith(this.searchValue().toLocaleLowerCase());
|
|
999
974
|
}
|
|
1000
975
|
isProccessedItemGroup(processedItem) {
|
|
1001
976
|
return processedItem && isNotEmpty(processedItem.items);
|
|
@@ -1070,12 +1045,12 @@ class ContextMenu extends BaseComponent {
|
|
|
1070
1045
|
event.preventDefault();
|
|
1071
1046
|
}
|
|
1072
1047
|
onArrowRightKey(event) {
|
|
1073
|
-
const processedItem = this.visibleItems[this.focusedItemInfo().index];
|
|
1048
|
+
const processedItem = this.visibleItems()[this.focusedItemInfo().index];
|
|
1074
1049
|
const grouped = this.isProccessedItemGroup(processedItem);
|
|
1075
1050
|
if (grouped) {
|
|
1076
1051
|
this.onItemChange({ originalEvent: event, processedItem });
|
|
1077
1052
|
this.focusedItemInfo.set({ index: -1, parentKey: processedItem.key, item: processedItem.item });
|
|
1078
|
-
this.searchValue
|
|
1053
|
+
this.searchValue.set('');
|
|
1079
1054
|
this.onArrowDownKey(event);
|
|
1080
1055
|
}
|
|
1081
1056
|
event.preventDefault();
|
|
@@ -1083,7 +1058,7 @@ class ContextMenu extends BaseComponent {
|
|
|
1083
1058
|
onArrowUpKey(event) {
|
|
1084
1059
|
if (event.altKey) {
|
|
1085
1060
|
if (this.focusedItemInfo().index !== -1) {
|
|
1086
|
-
const processedItem = this.visibleItems[this.focusedItemInfo().index];
|
|
1061
|
+
const processedItem = this.visibleItems()[this.focusedItemInfo().index];
|
|
1087
1062
|
const grouped = this.isProccessedItemGroup(processedItem);
|
|
1088
1063
|
!grouped && this.onItemChange({ originalEvent: event, processedItem });
|
|
1089
1064
|
}
|
|
@@ -1097,12 +1072,12 @@ class ContextMenu extends BaseComponent {
|
|
|
1097
1072
|
}
|
|
1098
1073
|
}
|
|
1099
1074
|
onArrowLeftKey(event) {
|
|
1100
|
-
const processedItem = this.visibleItems[this.focusedItemInfo().index];
|
|
1075
|
+
const processedItem = this.visibleItems()[this.focusedItemInfo().index];
|
|
1101
1076
|
const parentItem = this.activeItemPath().find((p) => p.key === processedItem.parentKey);
|
|
1102
1077
|
const root = isEmpty(processedItem.parent);
|
|
1103
1078
|
if (!root) {
|
|
1104
1079
|
this.focusedItemInfo.set({ index: -1, parentKey: parentItem ? parentItem.parentKey : '', item: processedItem.item });
|
|
1105
|
-
this.searchValue
|
|
1080
|
+
this.searchValue.set('');
|
|
1106
1081
|
this.onArrowDownKey(event);
|
|
1107
1082
|
}
|
|
1108
1083
|
const activeItemPath = this.activeItemPath().filter((p) => p.parentKey !== this.focusedItemInfo().parentKey);
|
|
@@ -1129,7 +1104,7 @@ class ContextMenu extends BaseComponent {
|
|
|
1129
1104
|
}
|
|
1130
1105
|
onTabKey(event) {
|
|
1131
1106
|
if (this.focusedItemInfo().index !== -1) {
|
|
1132
|
-
const processedItem = this.visibleItems[this.focusedItemInfo().index];
|
|
1107
|
+
const processedItem = this.visibleItems()[this.focusedItemInfo().index];
|
|
1133
1108
|
const grouped = this.isProccessedItemGroup(processedItem);
|
|
1134
1109
|
!grouped && this.onItemChange({ originalEvent: event, processedItem });
|
|
1135
1110
|
}
|
|
@@ -1137,10 +1112,10 @@ class ContextMenu extends BaseComponent {
|
|
|
1137
1112
|
}
|
|
1138
1113
|
onEnterKey(event) {
|
|
1139
1114
|
if (this.focusedItemInfo().index !== -1) {
|
|
1140
|
-
const element = findSingle(this.rootmenu()?.el?.nativeElement, `li[id="${`${this.focusedItemId}`}"]`);
|
|
1115
|
+
const element = findSingle(this.rootmenu()?.el?.nativeElement, `li[id="${`${this.focusedItemId()}`}"]`);
|
|
1141
1116
|
const anchorElement = element && (findSingle(element, '[data-pc-section="itemlink"]') || findSingle(element, 'a,button'));
|
|
1142
1117
|
anchorElement ? anchorElement.click() : element && element.click();
|
|
1143
|
-
const processedItem = this.visibleItems[this.focusedItemInfo().index];
|
|
1118
|
+
const processedItem = this.visibleItems()[this.focusedItemInfo().index];
|
|
1144
1119
|
const grouped = this.isProccessedItemGroup(processedItem);
|
|
1145
1120
|
if (!grouped) {
|
|
1146
1121
|
const focusedItemInfo = this.focusedItemInfo();
|
|
@@ -1168,21 +1143,21 @@ class ContextMenu extends BaseComponent {
|
|
|
1168
1143
|
this.activeItemPath.set(activeItemPath);
|
|
1169
1144
|
}
|
|
1170
1145
|
onMenuFocus(event) {
|
|
1171
|
-
this.focused
|
|
1146
|
+
this.focused.set(true);
|
|
1172
1147
|
const focusedItemInfo = this.focusedItemInfo().index !== -1 ? this.focusedItemInfo() : { index: -1, level: 0, parentKey: '', item: null };
|
|
1173
1148
|
this.focusedItemInfo.set(focusedItemInfo);
|
|
1174
1149
|
}
|
|
1175
1150
|
onMenuBlur(event) {
|
|
1176
|
-
this.focused
|
|
1151
|
+
this.focused.set(false);
|
|
1177
1152
|
this.focusedItemInfo.set({ index: -1, level: 0, parentKey: '', item: null });
|
|
1178
|
-
this.searchValue
|
|
1153
|
+
this.searchValue.set('');
|
|
1179
1154
|
}
|
|
1180
1155
|
onBeforeEnter(event) {
|
|
1181
|
-
this.container
|
|
1156
|
+
this.container.set(event.element);
|
|
1182
1157
|
this.appendOverlay();
|
|
1183
1158
|
this.moveOnTop();
|
|
1184
1159
|
this.position();
|
|
1185
|
-
this.$attrSelector && this.container?.setAttribute(this.$attrSelector, '');
|
|
1160
|
+
this.$attrSelector && this.container()?.setAttribute(this.$attrSelector, '');
|
|
1186
1161
|
}
|
|
1187
1162
|
onAfterEnter() {
|
|
1188
1163
|
this.bindGlobalListeners();
|
|
@@ -1191,51 +1166,51 @@ class ContextMenu extends BaseComponent {
|
|
|
1191
1166
|
onAfterLeave() {
|
|
1192
1167
|
this.restoreOverlayAppend();
|
|
1193
1168
|
this.onOverlayHide();
|
|
1194
|
-
this.handleSubmenuAfterLeave?.();
|
|
1169
|
+
this.handleSubmenuAfterLeave()?.();
|
|
1195
1170
|
this.render.set(false);
|
|
1196
1171
|
}
|
|
1197
1172
|
appendOverlay() {
|
|
1198
1173
|
if (this.$appendTo() && this.$appendTo() !== 'self') {
|
|
1199
1174
|
if (this.$appendTo() === 'body') {
|
|
1200
|
-
appendChild(this.document.body, this.container);
|
|
1175
|
+
appendChild(this.document.body, this.container());
|
|
1201
1176
|
}
|
|
1202
1177
|
else {
|
|
1203
|
-
appendChild(this.$appendTo(), this.container);
|
|
1178
|
+
appendChild(this.$appendTo(), this.container());
|
|
1204
1179
|
}
|
|
1205
1180
|
}
|
|
1206
1181
|
}
|
|
1207
1182
|
restoreOverlayAppend() {
|
|
1208
|
-
|
|
1209
|
-
|
|
1183
|
+
const container = this.container();
|
|
1184
|
+
if (container && this.$appendTo() !== 'self') {
|
|
1185
|
+
this.el.nativeElement.appendChild(container);
|
|
1210
1186
|
}
|
|
1211
1187
|
}
|
|
1212
1188
|
moveOnTop() {
|
|
1213
|
-
|
|
1214
|
-
|
|
1189
|
+
const container = this.container();
|
|
1190
|
+
if (this.autoZIndex() && container) {
|
|
1191
|
+
ZIndexUtils.set('menu', container, this.baseZIndex() + this.config.zIndex.menu);
|
|
1215
1192
|
}
|
|
1216
1193
|
}
|
|
1217
1194
|
onOverlayHide() {
|
|
1218
1195
|
this.unbindGlobalListeners();
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
if (this.container && this.autoZIndex) {
|
|
1223
|
-
ZIndexUtils.clear(this.container);
|
|
1196
|
+
const container = this.container();
|
|
1197
|
+
if (container && this.autoZIndex()) {
|
|
1198
|
+
ZIndexUtils.clear(container);
|
|
1224
1199
|
}
|
|
1225
|
-
this.container
|
|
1200
|
+
this.container.set(null);
|
|
1226
1201
|
}
|
|
1227
1202
|
onTouchStart(event) {
|
|
1228
|
-
this.pressTimer
|
|
1203
|
+
this.pressTimer.set(setTimeout(() => {
|
|
1229
1204
|
this.show(event);
|
|
1230
|
-
}, this.pressDelay);
|
|
1205
|
+
}, this.pressDelay()));
|
|
1231
1206
|
}
|
|
1232
1207
|
onTouchEnd() {
|
|
1233
|
-
clearTimeout(this.pressTimer);
|
|
1208
|
+
clearTimeout(this.pressTimer());
|
|
1234
1209
|
}
|
|
1235
1210
|
hide() {
|
|
1236
1211
|
this.visible.set(false);
|
|
1237
1212
|
this.onHide.emit();
|
|
1238
|
-
this.hideCallback?.();
|
|
1213
|
+
this.hideCallback()?.();
|
|
1239
1214
|
this.activeItemPath.set([]);
|
|
1240
1215
|
this.focusedItemInfo.set({ index: -1, level: 0, parentKey: '', item: null });
|
|
1241
1216
|
}
|
|
@@ -1246,8 +1221,8 @@ class ContextMenu extends BaseComponent {
|
|
|
1246
1221
|
this.activeItemPath.set([]);
|
|
1247
1222
|
this.focusedItemInfo.set({ index: -1, level: 0, parentKey: '', item: null });
|
|
1248
1223
|
focus(this.rootmenu()?.sublistViewChild()?.nativeElement);
|
|
1249
|
-
this.pageX
|
|
1250
|
-
this.pageY
|
|
1224
|
+
this.pageX.set(event.pageX);
|
|
1225
|
+
this.pageY.set(event.pageY);
|
|
1251
1226
|
this.onShow.emit();
|
|
1252
1227
|
this.visible() ? this.position() : this.visible.set(true);
|
|
1253
1228
|
this.render.set(true);
|
|
@@ -1255,12 +1230,13 @@ class ContextMenu extends BaseComponent {
|
|
|
1255
1230
|
event.preventDefault();
|
|
1256
1231
|
}
|
|
1257
1232
|
position() {
|
|
1258
|
-
|
|
1233
|
+
const container = this.container();
|
|
1234
|
+
if (!this.document.scrollingElement || !container)
|
|
1259
1235
|
return;
|
|
1260
|
-
let left = this.pageX + 1;
|
|
1261
|
-
let top = this.pageY + 1;
|
|
1262
|
-
let width =
|
|
1263
|
-
let height =
|
|
1236
|
+
let left = this.pageX() + 1;
|
|
1237
|
+
let top = this.pageY() + 1;
|
|
1238
|
+
let width = container.offsetParent ? container.offsetWidth : getHiddenElementOuterWidth(container);
|
|
1239
|
+
let height = container.offsetParent ? container.offsetHeight : getHiddenElementOuterHeight(container);
|
|
1264
1240
|
let viewport = getViewport();
|
|
1265
1241
|
//flip
|
|
1266
1242
|
if (left + width - this.document.scrollingElement.scrollLeft > viewport.width) {
|
|
@@ -1278,19 +1254,26 @@ class ContextMenu extends BaseComponent {
|
|
|
1278
1254
|
if (top < this.document.scrollingElement.scrollTop) {
|
|
1279
1255
|
top = this.document.scrollingElement.scrollTop;
|
|
1280
1256
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1257
|
+
container.style.left = left + 'px';
|
|
1258
|
+
container.style.top = top + 'px';
|
|
1283
1259
|
}
|
|
1284
1260
|
searchItems(event, char) {
|
|
1285
|
-
this.searchValue
|
|
1261
|
+
this.searchValue.set((this.searchValue() || '') + char);
|
|
1286
1262
|
let itemIndex = -1;
|
|
1287
1263
|
let matched = false;
|
|
1288
1264
|
if (this.focusedItemInfo().index !== -1) {
|
|
1289
|
-
itemIndex = this.visibleItems
|
|
1290
|
-
|
|
1265
|
+
itemIndex = this.visibleItems()
|
|
1266
|
+
.slice(this.focusedItemInfo().index)
|
|
1267
|
+
.findIndex((processedItem) => this.isItemMatched(processedItem));
|
|
1268
|
+
itemIndex =
|
|
1269
|
+
itemIndex === -1
|
|
1270
|
+
? this.visibleItems()
|
|
1271
|
+
.slice(0, this.focusedItemInfo().index)
|
|
1272
|
+
.findIndex((processedItem) => this.isItemMatched(processedItem))
|
|
1273
|
+
: itemIndex + this.focusedItemInfo().index;
|
|
1291
1274
|
}
|
|
1292
1275
|
else {
|
|
1293
|
-
itemIndex = this.visibleItems.findIndex((processedItem) => this.isItemMatched(processedItem));
|
|
1276
|
+
itemIndex = this.visibleItems().findIndex((processedItem) => this.isItemMatched(processedItem));
|
|
1294
1277
|
}
|
|
1295
1278
|
if (itemIndex !== -1) {
|
|
1296
1279
|
matched = true;
|
|
@@ -1301,31 +1284,35 @@ class ContextMenu extends BaseComponent {
|
|
|
1301
1284
|
if (itemIndex !== -1) {
|
|
1302
1285
|
this.changeFocusedItemIndex(event, itemIndex);
|
|
1303
1286
|
}
|
|
1304
|
-
if (this.searchTimeout) {
|
|
1305
|
-
clearTimeout(this.searchTimeout);
|
|
1287
|
+
if (this.searchTimeout()) {
|
|
1288
|
+
clearTimeout(this.searchTimeout());
|
|
1306
1289
|
}
|
|
1307
|
-
this.searchTimeout
|
|
1308
|
-
this.searchValue
|
|
1309
|
-
this.searchTimeout
|
|
1310
|
-
}, 500);
|
|
1290
|
+
this.searchTimeout.set(setTimeout(() => {
|
|
1291
|
+
this.searchValue.set('');
|
|
1292
|
+
this.searchTimeout.set(null);
|
|
1293
|
+
}, 500));
|
|
1311
1294
|
return matched;
|
|
1312
1295
|
}
|
|
1313
1296
|
findVisibleItem(index) {
|
|
1314
|
-
return isNotEmpty(this.visibleItems) ? this.visibleItems[index] : null;
|
|
1297
|
+
return isNotEmpty(this.visibleItems()) ? this.visibleItems()[index] : null;
|
|
1315
1298
|
}
|
|
1316
1299
|
findLastFocusedItemIndex() {
|
|
1317
1300
|
const selectedIndex = this.findSelectedItemIndex();
|
|
1318
1301
|
return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex;
|
|
1319
1302
|
}
|
|
1320
1303
|
findLastItemIndex() {
|
|
1321
|
-
return findLastIndex(this.visibleItems, (processedItem) => this.isValidItem(processedItem));
|
|
1304
|
+
return findLastIndex(this.visibleItems(), (processedItem) => this.isValidItem(processedItem));
|
|
1322
1305
|
}
|
|
1323
1306
|
findPrevItemIndex(index) {
|
|
1324
|
-
const matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), (processedItem) => this.isValidItem(processedItem)) : -1;
|
|
1307
|
+
const matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems().slice(0, index), (processedItem) => this.isValidItem(processedItem)) : -1;
|
|
1325
1308
|
return matchedItemIndex > -1 ? matchedItemIndex : index;
|
|
1326
1309
|
}
|
|
1327
1310
|
findNextItemIndex(index) {
|
|
1328
|
-
const matchedItemIndex = index < this.visibleItems.length - 1
|
|
1311
|
+
const matchedItemIndex = index < this.visibleItems().length - 1
|
|
1312
|
+
? this.visibleItems()
|
|
1313
|
+
.slice(index + 1)
|
|
1314
|
+
.findIndex((processedItem) => this.isValidItem(processedItem))
|
|
1315
|
+
: -1;
|
|
1329
1316
|
return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index;
|
|
1330
1317
|
}
|
|
1331
1318
|
findFirstFocusedItemIndex() {
|
|
@@ -1333,10 +1320,10 @@ class ContextMenu extends BaseComponent {
|
|
|
1333
1320
|
return selectedIndex < 0 ? this.findFirstItemIndex() : selectedIndex;
|
|
1334
1321
|
}
|
|
1335
1322
|
findFirstItemIndex() {
|
|
1336
|
-
return this.visibleItems.findIndex((processedItem) => this.isValidItem(processedItem));
|
|
1323
|
+
return this.visibleItems().findIndex((processedItem) => this.isValidItem(processedItem));
|
|
1337
1324
|
}
|
|
1338
1325
|
findSelectedItemIndex() {
|
|
1339
|
-
return this.visibleItems.findIndex((processedItem) => this.isValidSelectedItem(processedItem));
|
|
1326
|
+
return this.visibleItems().findIndex((processedItem) => this.isValidSelectedItem(processedItem));
|
|
1340
1327
|
}
|
|
1341
1328
|
changeFocusedItemIndex(event, index) {
|
|
1342
1329
|
const processedItem = this.findVisibleItem(index);
|
|
@@ -1347,7 +1334,7 @@ class ContextMenu extends BaseComponent {
|
|
|
1347
1334
|
}
|
|
1348
1335
|
}
|
|
1349
1336
|
scrollInView(index = -1) {
|
|
1350
|
-
const id = index !== -1 ? `${this.
|
|
1337
|
+
const id = index !== -1 ? `${this._id()}_${index}` : this.focusedItemId();
|
|
1351
1338
|
const element = findSingle(this.rootmenu()?.el?.nativeElement, `li[id="${id}"]`);
|
|
1352
1339
|
if (element) {
|
|
1353
1340
|
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
@@ -1355,44 +1342,46 @@ class ContextMenu extends BaseComponent {
|
|
|
1355
1342
|
}
|
|
1356
1343
|
bindResizeListener() {
|
|
1357
1344
|
if (isPlatformBrowser(this.platformId)) {
|
|
1358
|
-
if (!this.resizeListener) {
|
|
1359
|
-
this.resizeListener
|
|
1345
|
+
if (!this.resizeListener()) {
|
|
1346
|
+
this.resizeListener.set(this.renderer.listen(this.document.defaultView, 'resize', (event) => {
|
|
1360
1347
|
this.hide();
|
|
1361
|
-
});
|
|
1348
|
+
}));
|
|
1362
1349
|
}
|
|
1363
1350
|
}
|
|
1364
1351
|
}
|
|
1365
1352
|
isOutsideClicked(event) {
|
|
1366
|
-
|
|
1353
|
+
const container = this.container();
|
|
1354
|
+
return !(container?.isSameNode(event.target) || container?.contains(event.target));
|
|
1367
1355
|
}
|
|
1368
1356
|
unbindResizeListener() {
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1357
|
+
const resizeListener = this.resizeListener();
|
|
1358
|
+
if (resizeListener) {
|
|
1359
|
+
resizeListener();
|
|
1360
|
+
this.resizeListener.set(null);
|
|
1372
1361
|
}
|
|
1373
1362
|
}
|
|
1374
1363
|
unbindGlobalListeners() {
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
if (this.documentTriggerListener) {
|
|
1380
|
-
this.documentTriggerListener();
|
|
1381
|
-
this.documentTriggerListener = null;
|
|
1364
|
+
const documentClickListener = this.documentClickListener();
|
|
1365
|
+
if (documentClickListener) {
|
|
1366
|
+
documentClickListener();
|
|
1367
|
+
this.documentClickListener.set(null);
|
|
1382
1368
|
}
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1369
|
+
const resizeListener = this.resizeListener();
|
|
1370
|
+
if (resizeListener) {
|
|
1371
|
+
resizeListener();
|
|
1372
|
+
this.resizeListener.set(null);
|
|
1386
1373
|
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1374
|
+
const touchEndListener = this.touchEndListener();
|
|
1375
|
+
if (touchEndListener) {
|
|
1376
|
+
touchEndListener();
|
|
1377
|
+
this.touchEndListener.set(null);
|
|
1390
1378
|
}
|
|
1391
1379
|
}
|
|
1392
1380
|
unbindTriggerEventListener() {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1381
|
+
const triggerEventListener = this.triggerEventListener();
|
|
1382
|
+
if (triggerEventListener) {
|
|
1383
|
+
triggerEventListener();
|
|
1384
|
+
this.triggerEventListener.set(null);
|
|
1396
1385
|
}
|
|
1397
1386
|
}
|
|
1398
1387
|
onDestroy() {
|
|
@@ -1403,14 +1392,14 @@ class ContextMenu extends BaseComponent {
|
|
|
1403
1392
|
this.onOverlayHide();
|
|
1404
1393
|
}
|
|
1405
1394
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ContextMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1406
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: ContextMenu, isStandalone: true, selector: "p-contextMenu, p-contextmenu, p-context-menu", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal:
|
|
1395
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: ContextMenu, isStandalone: true, selector: "p-contextMenu, p-contextmenu, p-context-menu", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, triggerEvent: { classPropertyName: "triggerEvent", publicName: "triggerEvent", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, global: { classPropertyName: "global", publicName: "global", isSignal: true, isRequired: false, transformFunction: null }, style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, autoZIndex: { classPropertyName: "autoZIndex", publicName: "autoZIndex", isSignal: true, isRequired: false, transformFunction: null }, baseZIndex: { classPropertyName: "baseZIndex", publicName: "baseZIndex", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, breakpoint: { classPropertyName: "breakpoint", publicName: "breakpoint", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "ariaLabelledBy", isSignal: true, isRequired: false, transformFunction: null }, pressDelay: { classPropertyName: "pressDelay", publicName: "pressDelay", isSignal: true, isRequired: false, transformFunction: null }, appendTo: { classPropertyName: "appendTo", publicName: "appendTo", isSignal: true, isRequired: false, transformFunction: null }, motionOptions: { classPropertyName: "motionOptions", publicName: "motionOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onShow: "onShow", onHide: "onHide" }, providers: [ContextMenuStyle, { provide: CONTEXTMENU_INSTANCE, useExisting: ContextMenu }], queries: [{ propertyName: "itemTemplate", first: true, predicate: ["item"], isSignal: true }, { propertyName: "submenuIconTemplate", first: true, predicate: ["submenuicon"], isSignal: true }, { propertyName: "templates", predicate: PrimeTemplate, isSignal: true }], viewQueries: [{ propertyName: "rootmenu", first: true, predicate: ["rootmenu"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
1407
1396
|
@if (render()) {
|
|
1408
1397
|
<div
|
|
1409
1398
|
#container
|
|
1410
|
-
[attr.id]="
|
|
1411
|
-
[class]="cn(cx('root'), styleClass)"
|
|
1399
|
+
[attr.id]="_id()"
|
|
1400
|
+
[class]="cn(cx('root'), styleClass())"
|
|
1412
1401
|
[style]="sx('root')"
|
|
1413
|
-
[ngStyle]="style"
|
|
1402
|
+
[ngStyle]="style()"
|
|
1414
1403
|
[pBind]="ptm('root')"
|
|
1415
1404
|
[pMotion]="visible()"
|
|
1416
1405
|
[pMotionName]="'p-anchored-overlay'"
|
|
@@ -1423,15 +1412,13 @@ class ContextMenu extends BaseComponent {
|
|
|
1423
1412
|
<p-contextmenu-sub
|
|
1424
1413
|
#rootmenu
|
|
1425
1414
|
[root]="true"
|
|
1426
|
-
[items]="processedItems"
|
|
1427
|
-
[itemTemplate]="itemTemplate() || _itemTemplate"
|
|
1428
|
-
[menuId]="
|
|
1429
|
-
[ariaLabel]="ariaLabel"
|
|
1430
|
-
[ariaLabelledBy]="ariaLabelledBy"
|
|
1431
|
-
[baseZIndex]="baseZIndex"
|
|
1432
|
-
[autoZIndex]="autoZIndex"
|
|
1415
|
+
[items]="processedItems()"
|
|
1416
|
+
[itemTemplate]="itemTemplate() || _itemTemplate()"
|
|
1417
|
+
[menuId]="_id()"
|
|
1418
|
+
[ariaLabel]="ariaLabel()"
|
|
1419
|
+
[ariaLabelledBy]="ariaLabelledBy()"
|
|
1433
1420
|
[visible]="submenuVisible()"
|
|
1434
|
-
[focusedItemId]="focused ? focusedItemId : undefined"
|
|
1421
|
+
[focusedItemId]="focused() ? focusedItemId() : undefined"
|
|
1435
1422
|
[activeItemPath]="activeItemPath()"
|
|
1436
1423
|
(itemClick)="onItemClick($event)"
|
|
1437
1424
|
(menuFocus)="onMenuFocus($event)"
|
|
@@ -1444,22 +1431,21 @@ class ContextMenu extends BaseComponent {
|
|
|
1444
1431
|
/>
|
|
1445
1432
|
</div>
|
|
1446
1433
|
}
|
|
1447
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ContextMenuSub, selector: "p-contextMenuSub, p-contextmenu-sub", inputs: ["visible", "items", "itemTemplate", "root", "
|
|
1434
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ContextMenuSub, selector: "p-contextMenuSub, p-contextmenu-sub", inputs: ["visible", "items", "itemTemplate", "root", "menuId", "ariaLabel", "ariaLabelledBy", "level", "focusedItemId", "activeItemPath", "motionOptions", "tabindex"], outputs: ["itemClick", "itemMouseEnter", "menuFocus", "menuBlur", "menuKeydown"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i4.Bind, selector: "[pBind]", inputs: ["pBind"] }, { kind: "ngmodule", type: BadgeModule }, { kind: "ngmodule", type: SharedModule }, { kind: "ngmodule", type: BindModule }, { kind: "ngmodule", type: MotionModule }, { kind: "directive", type: i6.MotionDirective, selector: "[pMotion]", inputs: ["pMotion", "pMotionName", "pMotionType", "pMotionSafe", "pMotionDisabled", "pMotionAppear", "pMotionEnter", "pMotionLeave", "pMotionDuration", "pMotionHideStrategy", "pMotionEnterFromClass", "pMotionEnterToClass", "pMotionEnterActiveClass", "pMotionLeaveFromClass", "pMotionLeaveToClass", "pMotionLeaveActiveClass", "pMotionOptions"], outputs: ["pMotionOnBeforeEnter", "pMotionOnEnter", "pMotionOnAfterEnter", "pMotionOnEnterCancelled", "pMotionOnBeforeLeave", "pMotionOnLeave", "pMotionOnAfterLeave", "pMotionOnLeaveCancelled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1448
1435
|
}
|
|
1449
1436
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ContextMenu, decorators: [{
|
|
1450
1437
|
type: Component,
|
|
1451
1438
|
args: [{
|
|
1452
1439
|
selector: 'p-contextMenu, p-contextmenu, p-context-menu',
|
|
1453
|
-
standalone: true,
|
|
1454
1440
|
imports: [CommonModule, ContextMenuSub, RouterModule, TooltipModule, BadgeModule, SharedModule, BindModule, MotionModule],
|
|
1455
1441
|
template: `
|
|
1456
1442
|
@if (render()) {
|
|
1457
1443
|
<div
|
|
1458
1444
|
#container
|
|
1459
|
-
[attr.id]="
|
|
1460
|
-
[class]="cn(cx('root'), styleClass)"
|
|
1445
|
+
[attr.id]="_id()"
|
|
1446
|
+
[class]="cn(cx('root'), styleClass())"
|
|
1461
1447
|
[style]="sx('root')"
|
|
1462
|
-
[ngStyle]="style"
|
|
1448
|
+
[ngStyle]="style()"
|
|
1463
1449
|
[pBind]="ptm('root')"
|
|
1464
1450
|
[pMotion]="visible()"
|
|
1465
1451
|
[pMotionName]="'p-anchored-overlay'"
|
|
@@ -1472,15 +1458,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
|
|
|
1472
1458
|
<p-contextmenu-sub
|
|
1473
1459
|
#rootmenu
|
|
1474
1460
|
[root]="true"
|
|
1475
|
-
[items]="processedItems"
|
|
1476
|
-
[itemTemplate]="itemTemplate() || _itemTemplate"
|
|
1477
|
-
[menuId]="
|
|
1478
|
-
[ariaLabel]="ariaLabel"
|
|
1479
|
-
[ariaLabelledBy]="ariaLabelledBy"
|
|
1480
|
-
[baseZIndex]="baseZIndex"
|
|
1481
|
-
[autoZIndex]="autoZIndex"
|
|
1461
|
+
[items]="processedItems()"
|
|
1462
|
+
[itemTemplate]="itemTemplate() || _itemTemplate()"
|
|
1463
|
+
[menuId]="_id()"
|
|
1464
|
+
[ariaLabel]="ariaLabel()"
|
|
1465
|
+
[ariaLabelledBy]="ariaLabelledBy()"
|
|
1482
1466
|
[visible]="submenuVisible()"
|
|
1483
|
-
[focusedItemId]="focused ? focusedItemId : undefined"
|
|
1467
|
+
[focusedItemId]="focused() ? focusedItemId() : undefined"
|
|
1484
1468
|
[activeItemPath]="activeItemPath()"
|
|
1485
1469
|
(itemClick)="onItemClick($event)"
|
|
1486
1470
|
(menuFocus)="onMenuFocus($event)"
|
|
@@ -1498,37 +1482,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
|
|
|
1498
1482
|
encapsulation: ViewEncapsulation.None,
|
|
1499
1483
|
providers: [ContextMenuStyle, { provide: CONTEXTMENU_INSTANCE, useExisting: ContextMenu }]
|
|
1500
1484
|
}]
|
|
1501
|
-
}], ctorParameters: () => [], propDecorators: { model: [{
|
|
1502
|
-
type: Input
|
|
1503
|
-
}], triggerEvent: [{
|
|
1504
|
-
type: Input
|
|
1505
|
-
}], target: [{
|
|
1506
|
-
type: Input
|
|
1507
|
-
}], global: [{
|
|
1508
|
-
type: Input,
|
|
1509
|
-
args: [{ transform: booleanAttribute }]
|
|
1510
|
-
}], style: [{
|
|
1511
|
-
type: Input
|
|
1512
|
-
}], styleClass: [{
|
|
1513
|
-
type: Input
|
|
1514
|
-
}], autoZIndex: [{
|
|
1515
|
-
type: Input,
|
|
1516
|
-
args: [{ transform: booleanAttribute }]
|
|
1517
|
-
}], baseZIndex: [{
|
|
1518
|
-
type: Input,
|
|
1519
|
-
args: [{ transform: numberAttribute }]
|
|
1520
|
-
}], id: [{
|
|
1521
|
-
type: Input
|
|
1522
|
-
}], breakpoint: [{
|
|
1523
|
-
type: Input
|
|
1524
|
-
}], ariaLabel: [{
|
|
1525
|
-
type: Input
|
|
1526
|
-
}], ariaLabelledBy: [{
|
|
1527
|
-
type: Input
|
|
1528
|
-
}], pressDelay: [{
|
|
1529
|
-
type: Input,
|
|
1530
|
-
args: [{ transform: numberAttribute }]
|
|
1531
|
-
}], appendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendTo", required: false }] }], motionOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionOptions", required: false }] }], onShow: [{ type: i0.Output, args: ["onShow"] }], onHide: [{ type: i0.Output, args: ["onHide"] }], rootmenu: [{ type: i0.ViewChild, args: ['rootmenu', { isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: ['item', { ...{ descendants: false }, isSignal: true }] }], submenuIconTemplate: [{ type: i0.ContentChild, args: ['submenuicon', { ...{ descendants: false }, isSignal: true }] }], templates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PrimeTemplate), { isSignal: true }] }] } });
|
|
1485
|
+
}], ctorParameters: () => [], propDecorators: { model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }], triggerEvent: [{ type: i0.Input, args: [{ isSignal: true, alias: "triggerEvent", required: false }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }], global: [{ type: i0.Input, args: [{ isSignal: true, alias: "global", required: false }] }], style: [{ type: i0.Input, args: [{ isSignal: true, alias: "style", required: false }] }], styleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleClass", required: false }] }], autoZIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoZIndex", required: false }] }], baseZIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseZIndex", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], breakpoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "breakpoint", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledBy", required: false }] }], pressDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "pressDelay", required: false }] }], appendTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendTo", required: false }] }], motionOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionOptions", required: false }] }], onShow: [{ type: i0.Output, args: ["onShow"] }], onHide: [{ type: i0.Output, args: ["onHide"] }], rootmenu: [{ type: i0.ViewChild, args: ['rootmenu', { isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: ['item', { ...{ descendants: false }, isSignal: true }] }], submenuIconTemplate: [{ type: i0.ContentChild, args: ['submenuicon', { ...{ descendants: false }, isSignal: true }] }], templates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PrimeTemplate), { isSignal: true }] }] } });
|
|
1532
1486
|
class ContextMenuModule {
|
|
1533
1487
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ContextMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1534
1488
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.2.1", ngImport: i0, type: ContextMenuModule, imports: [ContextMenu, SharedModule], exports: [ContextMenu, SharedModule] });
|