primevue 3.15.0 → 3.16.2
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/autocomplete/AutoComplete.d.ts +182 -38
- package/autocomplete/AutoComplete.vue +636 -342
- package/autocomplete/autocomplete.cjs.js +745 -416
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +747 -418
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +745 -416
- package/autocomplete/autocomplete.min.js +1 -1
- package/button/Button.vue +4 -1
- package/button/button.cjs.js +5 -1
- package/button/button.cjs.min.js +1 -1
- package/button/button.esm.js +5 -1
- package/button/button.esm.min.js +1 -1
- package/button/button.js +5 -1
- package/button/button.min.js +1 -1
- package/calendar/Calendar.d.ts +51 -12
- package/calendar/Calendar.vue +259 -114
- package/calendar/calendar.cjs.js +414 -220
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +415 -221
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +414 -220
- package/calendar/calendar.min.js +1 -1
- package/carousel/Carousel.vue +25 -0
- package/carousel/carousel.cjs.js +25 -0
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +25 -0
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +25 -0
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/CascadeSelect.d.ts +97 -17
- package/cascadeselect/CascadeSelect.vue +560 -135
- package/cascadeselect/CascadeSelectSub.vue +48 -129
- package/cascadeselect/cascadeselect.cjs.js +670 -306
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.esm.js +672 -308
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +670 -306
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/checkbox/Checkbox.d.ts +40 -4
- package/checkbox/Checkbox.vue +50 -13
- package/checkbox/checkbox.cjs.js +64 -23
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.esm.js +65 -24
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +64 -23
- package/checkbox/checkbox.min.js +1 -1
- package/chips/Chips.d.ts +36 -12
- package/chips/Chips.vue +116 -22
- package/chips/chips.cjs.js +149 -37
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.esm.js +150 -38
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +150 -39
- package/chips/chips.min.js +1 -1
- package/colorpicker/ColorPicker.d.ts +3 -6
- package/colorpicker/ColorPicker.vue +1 -5
- package/colorpicker/colorpicker.cjs.js +2 -7
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +2 -7
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +2 -7
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/Column.d.ts +4 -0
- package/column/Column.vue +4 -0
- package/column/column.cjs.js +4 -0
- package/column/column.cjs.min.js +1 -1
- package/column/column.esm.js +4 -0
- package/column/column.esm.min.js +1 -1
- package/column/column.js +4 -0
- package/column/column.min.js +1 -1
- package/config/PrimeVue.d.ts +42 -0
- package/config/config.cjs.js +35 -4
- package/config/config.cjs.min.js +1 -1
- package/config/config.esm.js +35 -4
- package/config/config.esm.min.js +1 -1
- package/config/config.js +35 -4
- package/config/config.min.js +1 -1
- package/confirmdialog/ConfirmDialog.vue +4 -1
- package/confirmdialog/confirmdialog.cjs.js +6 -2
- package/confirmdialog/confirmdialog.cjs.min.js +1 -1
- package/confirmdialog/confirmdialog.esm.js +6 -2
- package/confirmdialog/confirmdialog.esm.min.js +1 -1
- package/confirmdialog/confirmdialog.js +6 -2
- package/confirmdialog/confirmdialog.min.js +1 -1
- package/contextmenu/ContextMenu.d.ts +1 -1
- package/contextmenu/ContextMenuSub.vue +3 -3
- package/contextmenu/contextmenu.cjs.js +14 -8
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +15 -9
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +14 -8
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +1128 -772
- package/core/core.min.js +12 -12
- package/datatable/BodyCell.vue +11 -2
- package/datatable/DataTable.vue +23 -2
- package/datatable/datatable.cjs.js +34 -4
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +34 -4
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +34 -4
- package/datatable/datatable.min.js +1 -1
- package/dialog/Dialog.d.ts +5 -1
- package/dropdown/Dropdown.d.ts +92 -38
- package/dropdown/Dropdown.vue +538 -399
- package/dropdown/dropdown.cjs.js +657 -486
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +659 -488
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +657 -486
- package/dropdown/dropdown.min.js +1 -1
- package/editor/Editor.d.ts +32 -0
- package/editor/Editor.vue +15 -1
- package/editor/editor.cjs.js +15 -1
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.esm.js +15 -1
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +15 -1
- package/editor/editor.min.js +1 -1
- package/inputmask/InputMask.vue +9 -6
- package/inputmask/inputmask.cjs.js +14 -6
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.esm.js +15 -7
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +14 -6
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/InputNumber.d.ts +31 -7
- package/inputnumber/InputNumber.vue +53 -20
- package/inputnumber/inputnumber.cjs.js +75 -29
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +76 -30
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +75 -29
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/InputSwitch.d.ts +24 -8
- package/inputswitch/InputSwitch.vue +27 -12
- package/inputswitch/inputswitch.cjs.js +38 -20
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.esm.js +39 -21
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +38 -20
- package/inputswitch/inputswitch.min.js +1 -1
- package/inputtext/InputText.vue +1 -2
- package/inputtext/inputtext.cjs.js +3 -4
- package/inputtext/inputtext.cjs.min.js +1 -1
- package/inputtext/inputtext.esm.js +4 -5
- package/inputtext/inputtext.esm.min.js +1 -1
- package/inputtext/inputtext.js +3 -4
- package/inputtext/inputtext.min.js +1 -1
- package/knob/Knob.d.ts +12 -0
- package/knob/Knob.vue +62 -2
- package/knob/knob.cjs.js +73 -5
- package/knob/knob.cjs.min.js +1 -1
- package/knob/knob.esm.js +73 -5
- package/knob/knob.esm.min.js +1 -1
- package/knob/knob.js +73 -5
- package/knob/knob.min.js +1 -1
- package/listbox/Listbox.d.ts +53 -7
- package/listbox/Listbox.vue +500 -135
- package/listbox/listbox.cjs.js +597 -193
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.esm.js +599 -195
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +597 -193
- package/listbox/listbox.min.js +1 -1
- package/menu/Menu.d.ts +1 -1
- package/menu/Menuitem.vue +2 -2
- package/menu/menu.cjs.js +12 -6
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +13 -7
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +12 -6
- package/menu/menu.min.js +1 -1
- package/menubar/MenubarSub.vue +3 -3
- package/menubar/menubar.cjs.js +14 -8
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +15 -9
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +14 -8
- package/menubar/menubar.min.js +1 -1
- package/menuitem/MenuItem.d.ts +1 -1
- package/multiselect/MultiSelect.d.ts +111 -51
- package/multiselect/MultiSelect.vue +629 -338
- package/multiselect/multiselect.cjs.js +748 -428
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +750 -430
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +748 -428
- package/multiselect/multiselect.min.js +1 -1
- package/overlaypanel/OverlayPanel.d.ts +1 -1
- package/overlaypanel/OverlayPanel.vue +14 -2
- package/overlaypanel/overlaypanel.cjs.js +14 -2
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +14 -2
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +14 -2
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +2 -2
- package/paginator/Paginator.d.ts +2 -2
- package/password/Password.d.ts +36 -8
- package/password/Password.vue +50 -14
- package/password/password.cjs.js +69 -24
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +71 -26
- package/password/password.esm.min.js +1 -1
- package/password/password.js +69 -24
- package/password/password.min.js +1 -1
- package/picklist/PickList.d.ts +8 -0
- package/picklist/PickList.vue +10 -2
- package/picklist/picklist.cjs.js +68 -50
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +69 -51
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +68 -50
- package/picklist/picklist.min.js +1 -1
- package/portal/Portal.d.ts +1 -1
- package/radiobutton/RadioButton.d.ts +28 -4
- package/radiobutton/RadioButton.vue +36 -11
- package/radiobutton/radiobutton.cjs.js +49 -23
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.esm.js +50 -24
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +49 -23
- package/radiobutton/radiobutton.min.js +1 -1
- package/rating/Rating.d.ts +4 -0
- package/rating/Rating.vue +61 -7
- package/rating/rating.cjs.js +90 -16
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +91 -17
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +90 -16
- package/rating/rating.min.js +1 -1
- package/resources/primevue.css +8 -0
- package/resources/primevue.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +82 -40
- package/resources/themes/arya-green/theme.css +82 -40
- package/resources/themes/arya-orange/theme.css +82 -40
- package/resources/themes/arya-purple/theme.css +82 -40
- package/resources/themes/bootstrap4-dark-blue/theme.css +82 -40
- package/resources/themes/bootstrap4-dark-purple/theme.css +82 -40
- package/resources/themes/bootstrap4-light-blue/theme.css +82 -40
- package/resources/themes/bootstrap4-light-purple/theme.css +82 -40
- package/resources/themes/fluent-light/theme.css +82 -40
- package/resources/themes/lara-dark-blue/theme.css +82 -40
- package/resources/themes/lara-dark-indigo/theme.css +82 -40
- package/resources/themes/lara-dark-purple/theme.css +82 -40
- package/resources/themes/lara-dark-teal/theme.css +82 -40
- package/resources/themes/lara-light-blue/theme.css +82 -40
- package/resources/themes/lara-light-indigo/theme.css +82 -40
- package/resources/themes/lara-light-purple/theme.css +82 -40
- package/resources/themes/lara-light-teal/theme.css +82 -40
- package/resources/themes/luna-amber/theme.css +82 -40
- package/resources/themes/luna-blue/theme.css +82 -40
- package/resources/themes/luna-green/theme.css +82 -40
- package/resources/themes/luna-pink/theme.css +82 -40
- package/resources/themes/md-dark-deeppurple/theme.css +82 -40
- package/resources/themes/md-dark-indigo/theme.css +82 -40
- package/resources/themes/md-light-deeppurple/theme.css +82 -40
- package/resources/themes/md-light-indigo/theme.css +82 -40
- package/resources/themes/mdc-dark-deeppurple/theme.css +82 -40
- package/resources/themes/mdc-dark-indigo/theme.css +82 -40
- package/resources/themes/mdc-light-deeppurple/theme.css +82 -40
- package/resources/themes/mdc-light-indigo/theme.css +82 -40
- package/resources/themes/nova/theme.css +82 -40
- package/resources/themes/nova-accent/theme.css +82 -40
- package/resources/themes/nova-alt/theme.css +82 -40
- package/resources/themes/nova-vue/theme.css +82 -40
- package/resources/themes/rhea/theme.css +82 -40
- package/resources/themes/saga-blue/theme.css +82 -40
- package/resources/themes/saga-green/theme.css +82 -40
- package/resources/themes/saga-orange/theme.css +82 -40
- package/resources/themes/saga-purple/theme.css +82 -40
- package/resources/themes/tailwind-light/theme.css +82 -40
- package/resources/themes/vela-blue/theme.css +82 -40
- package/resources/themes/vela-green/theme.css +82 -40
- package/resources/themes/vela-orange/theme.css +82 -40
- package/resources/themes/vela-purple/theme.css +82 -40
- package/ripple/ripple.cjs.js +1 -0
- package/ripple/ripple.cjs.min.js +1 -1
- package/ripple/ripple.esm.js +1 -0
- package/ripple/ripple.esm.min.js +1 -1
- package/ripple/ripple.js +1 -0
- package/ripple/ripple.min.js +1 -1
- package/selectbutton/SelectButton.d.ts +6 -2
- package/selectbutton/SelectButton.vue +89 -12
- package/selectbutton/selectbutton.cjs.js +97 -22
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.esm.js +99 -24
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +97 -22
- package/selectbutton/selectbutton.min.js +1 -1
- package/slider/Slider.d.ts +9 -1
- package/slider/Slider.vue +50 -34
- package/slider/slider.cjs.js +59 -38
- package/slider/slider.cjs.min.js +1 -1
- package/slider/slider.esm.js +59 -38
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +59 -38
- package/slider/slider.min.js +1 -1
- package/splitbutton/SplitButton.d.ts +1 -1
- package/splitter/Splitter.vue +30 -1
- package/splitter/splitter.cjs.js +30 -1
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +30 -1
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +30 -1
- package/splitter/splitter.min.js +1 -1
- package/textarea/Textarea.vue +1 -2
- package/textarea/textarea.cjs.js +3 -5
- package/textarea/textarea.cjs.min.js +1 -1
- package/textarea/textarea.esm.js +4 -6
- package/textarea/textarea.esm.min.js +1 -1
- package/textarea/textarea.js +3 -5
- package/textarea/textarea.min.js +1 -1
- package/tieredmenu/TieredMenu.d.ts +1 -1
- package/tieredmenu/TieredMenuSub.vue +3 -3
- package/tieredmenu/tieredmenu.cjs.js +14 -8
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +15 -9
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +14 -8
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/timeline/Timeline.d.ts +10 -1
- package/timeline/Timeline.vue +1 -1
- package/timeline/timeline.cjs.js +5 -1
- package/timeline/timeline.cjs.min.js +1 -1
- package/timeline/timeline.esm.js +5 -1
- package/timeline/timeline.esm.min.js +1 -1
- package/timeline/timeline.js +5 -1
- package/timeline/timeline.min.js +1 -1
- package/togglebutton/ToggleButton.d.ts +42 -0
- package/togglebutton/ToggleButton.vue +44 -7
- package/togglebutton/togglebutton.cjs.js +59 -13
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.esm.js +60 -14
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +59 -13
- package/togglebutton/togglebutton.min.js +1 -1
- package/tooltip/tooltip.cjs.js +20 -11
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +21 -12
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +20 -11
- package/tooltip/tooltip.min.js +1 -1
- package/tree/Tree.vue +5 -1
- package/tree/TreeNode.vue +20 -19
- package/tree/tree.cjs.js +47 -32
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +47 -32
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +47 -32
- package/tree/tree.min.js +1 -1
- package/treeselect/TreeSelect.d.ts +26 -10
- package/treeselect/TreeSelect.vue +52 -29
- package/treeselect/treeselect.cjs.js +74 -41
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +76 -43
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +74 -41
- package/treeselect/treeselect.min.js +1 -1
- package/tristatecheckbox/TriStateCheckbox.d.ts +20 -4
- package/tristatecheckbox/TriStateCheckbox.vue +52 -15
- package/tristatecheckbox/tristatecheckbox.cjs.js +67 -26
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +68 -27
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +67 -26
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/utils/Utils.d.ts +3 -2
- package/utils/utils.cjs.js +239 -173
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.esm.js +239 -173
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +239 -173
- package/utils/utils.min.js +1 -1
- package/vetur-attributes.json +612 -136
- package/vetur-tags.json +180 -59
- package/virtualscroller/VirtualScroller.d.ts +10 -0
- package/virtualscroller/VirtualScroller.vue +18 -17
- package/virtualscroller/virtualscroller.cjs.js +22 -20
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +22 -20
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +22 -20
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +1745 -338
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="container" :class="containerClass" @click="
|
|
2
|
+
<div ref="container" :class="containerClass" @click="onContainerClick($event)">
|
|
3
3
|
<div class="p-hidden-accessible">
|
|
4
|
-
<input ref="focusInput"
|
|
5
|
-
aria-haspopup="
|
|
4
|
+
<input ref="focusInput" :id="inputId" type="text" :style="inputStyle" :class="inputClass" readonly :disabled="disabled" :placeholder="placeholder" :tabindex="!disabled ? tabindex : -1"
|
|
5
|
+
role="combobox" :aria-label="ariaLabel" :aria-labelledby="ariaLabelledby" aria-haspopup="tree" :aria-expanded="overlayVisible" :aria-controls="id + '_tree'" :aria-activedescendant="focused ? focusedOptionId : undefined"
|
|
6
|
+
@focus="onFocus" @blur="onBlur" @keydown="onKeyDown" v-bind="inputProps" />
|
|
6
7
|
</div>
|
|
7
8
|
<span :class="labelClass">
|
|
8
9
|
<slot name="value" :value="modelValue" :placeholder="placeholder">
|
|
9
10
|
{{label}}
|
|
10
11
|
</slot>
|
|
11
12
|
</span>
|
|
12
|
-
<div class="p-cascadeselect-trigger" role="button"
|
|
13
|
+
<div class="p-cascadeselect-trigger" role="button" tabindex="-1" aria-hidden="true">
|
|
13
14
|
<slot name="indicator">
|
|
14
15
|
<span :class="dropdownIconClass"></span>
|
|
15
16
|
</slot>
|
|
16
17
|
</div>
|
|
18
|
+
<span role="status" aria-live="polite" class="p-hidden-accessible">
|
|
19
|
+
{{searchResultMessageText}}
|
|
20
|
+
</span>
|
|
17
21
|
<Portal :appendTo="appendTo">
|
|
18
|
-
<transition name="p-connected-overlay" @enter="onOverlayEnter" @leave="onOverlayLeave" @after-leave="onOverlayAfterLeave">
|
|
19
|
-
<div :ref="overlayRef" :
|
|
22
|
+
<transition name="p-connected-overlay" @enter="onOverlayEnter" @after-enter="onOverlayAfterEnter" @leave="onOverlayLeave" @after-leave="onOverlayAfterLeave">
|
|
23
|
+
<div v-if="overlayVisible" :ref="overlayRef" :style="panelStyle" :class="panelStyleClass" @click="onOverlayClick" @keydown="onOverlayKeyDown" v-bind="panelProps">
|
|
20
24
|
<div class="p-cascadeselect-items-wrapper">
|
|
21
|
-
<CascadeSelectSub :
|
|
22
|
-
:
|
|
23
|
-
:optionGroupLabel="optionGroupLabel" :optionGroupChildren="optionGroupChildren"
|
|
24
|
-
|
|
25
|
+
<CascadeSelectSub :id="id + '_tree'" role="tree" aria-orientation="horizontal" :selectId="id" :focusedOptionId="focused ? focusedOptionId : undefined"
|
|
26
|
+
:options="processedOptions" :activeOptionPath="activeOptionPath" :level="0" :templates="$slots" :optionLabel="optionLabel" :optionValue="optionValue" :optionDisabled="optionDisabled"
|
|
27
|
+
:optionGroupLabel="optionGroupLabel" :optionGroupChildren="optionGroupChildren" @option-change="onOptionChange" />
|
|
28
|
+
|
|
29
|
+
<span role="status" aria-live="polite" class="p-hidden-accessible">
|
|
30
|
+
{{selectedMessageText}}
|
|
31
|
+
</span>
|
|
25
32
|
</div>
|
|
26
33
|
</div>
|
|
27
34
|
</transition>
|
|
@@ -30,40 +37,36 @@
|
|
|
30
37
|
</template>
|
|
31
38
|
|
|
32
39
|
<script>
|
|
33
|
-
import {ConnectedOverlayScrollHandler,ObjectUtils,DomHandler,ZIndexUtils} from 'primevue/utils';
|
|
40
|
+
import {ConnectedOverlayScrollHandler,ObjectUtils,DomHandler,ZIndexUtils,UniqueComponentId} from 'primevue/utils';
|
|
34
41
|
import OverlayEventBus from 'primevue/overlayeventbus';
|
|
35
42
|
import CascadeSelectSub from './CascadeSelectSub.vue';
|
|
36
43
|
import Portal from 'primevue/portal';
|
|
37
44
|
|
|
38
45
|
export default {
|
|
39
46
|
name: 'CascadeSelect',
|
|
40
|
-
emits: ['update:modelValue','change','group-change', 'before-show','before-hide','hide','show'],
|
|
41
|
-
data() {
|
|
42
|
-
return {
|
|
43
|
-
selectionPath: null,
|
|
44
|
-
focused: false,
|
|
45
|
-
overlayVisible: false,
|
|
46
|
-
dirty: false
|
|
47
|
-
};
|
|
48
|
-
},
|
|
47
|
+
emits: ['update:modelValue', 'change', 'focus', 'blur', 'click', 'group-change', 'before-show', 'before-hide', 'hide', 'show'],
|
|
49
48
|
props: {
|
|
50
49
|
modelValue: null,
|
|
51
50
|
options: Array,
|
|
52
|
-
optionLabel:
|
|
53
|
-
optionValue:
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
optionLabel: null,
|
|
52
|
+
optionValue: null,
|
|
53
|
+
optionDisabled: null,
|
|
54
|
+
optionGroupLabel: null,
|
|
55
|
+
optionGroupChildren: null,
|
|
56
56
|
placeholder: String,
|
|
57
57
|
disabled: Boolean,
|
|
58
58
|
dataKey: null,
|
|
59
|
-
inputId:
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
inputId: null,
|
|
60
|
+
inputStyle: null,
|
|
61
|
+
inputClass: null,
|
|
62
|
+
inputProps: null,
|
|
63
|
+
panelStyle: null,
|
|
64
|
+
panelClass: null,
|
|
65
|
+
panelProps: null,
|
|
62
66
|
appendTo: {
|
|
63
67
|
type: String,
|
|
64
68
|
default: 'body'
|
|
65
69
|
},
|
|
66
|
-
panelClass: null,
|
|
67
70
|
loading: {
|
|
68
71
|
type: Boolean,
|
|
69
72
|
default: false
|
|
@@ -71,12 +74,74 @@ export default {
|
|
|
71
74
|
loadingIcon: {
|
|
72
75
|
type: String,
|
|
73
76
|
default: 'pi pi-spinner pi-spin'
|
|
77
|
+
},
|
|
78
|
+
autoOptionFocus: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true
|
|
81
|
+
},
|
|
82
|
+
searchLocale: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: undefined
|
|
85
|
+
},
|
|
86
|
+
searchMessage: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: null
|
|
89
|
+
},
|
|
90
|
+
selectionMessage: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: null
|
|
93
|
+
},
|
|
94
|
+
emptySelectionMessage: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: null
|
|
97
|
+
},
|
|
98
|
+
emptySearchMessage: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: null
|
|
101
|
+
},
|
|
102
|
+
emptyMessage: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: null
|
|
105
|
+
},
|
|
106
|
+
tabindex: {
|
|
107
|
+
type: Number,
|
|
108
|
+
default: 0
|
|
109
|
+
},
|
|
110
|
+
'aria-labelledby': {
|
|
111
|
+
type: String,
|
|
112
|
+
default: null
|
|
113
|
+
},
|
|
114
|
+
'aria-label': {
|
|
115
|
+
type: String,
|
|
116
|
+
default: null
|
|
74
117
|
}
|
|
75
118
|
},
|
|
76
119
|
outsideClickListener: null,
|
|
77
120
|
scrollHandler: null,
|
|
78
121
|
resizeListener: null,
|
|
79
122
|
overlay: null,
|
|
123
|
+
searchTimeout: null,
|
|
124
|
+
searchValue: null,
|
|
125
|
+
selectOnFocus: false,
|
|
126
|
+
focusOnHover: false,
|
|
127
|
+
data() {
|
|
128
|
+
return {
|
|
129
|
+
id: UniqueComponentId(),
|
|
130
|
+
focused: false,
|
|
131
|
+
focusedOptionInfo: { index: -1, level: 0, parentKey: '' },
|
|
132
|
+
activeOptionPath: [],
|
|
133
|
+
overlayVisible: false,
|
|
134
|
+
dirty: false
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
watch: {
|
|
138
|
+
options() {
|
|
139
|
+
this.autoUpdateModel();
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
mounted() {
|
|
143
|
+
this.id = this.$attrs.id || this.id;
|
|
144
|
+
},
|
|
80
145
|
beforeUnmount() {
|
|
81
146
|
this.unbindOutsideClickListener();
|
|
82
147
|
this.unbindResizeListener();
|
|
@@ -91,107 +156,317 @@ export default {
|
|
|
91
156
|
this.overlay = null;
|
|
92
157
|
}
|
|
93
158
|
},
|
|
94
|
-
mounted() {
|
|
95
|
-
this.updateSelectionPath();
|
|
96
|
-
},
|
|
97
|
-
watch: {
|
|
98
|
-
modelValue() {
|
|
99
|
-
this.updateSelectionPath();
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
159
|
methods: {
|
|
103
|
-
onOptionSelect(event) {
|
|
104
|
-
this.$emit('update:modelValue', event.value);
|
|
105
|
-
this.$emit('change', event);
|
|
106
|
-
this.hide();
|
|
107
|
-
this.$refs.focusInput.focus();
|
|
108
|
-
},
|
|
109
|
-
onOptionGroupSelect(event) {
|
|
110
|
-
this.dirty = true;
|
|
111
|
-
this.$emit('group-change', event);
|
|
112
|
-
},
|
|
113
160
|
getOptionLabel(option) {
|
|
114
161
|
return this.optionLabel ? ObjectUtils.resolveFieldData(option, this.optionLabel) : option;
|
|
115
162
|
},
|
|
116
163
|
getOptionValue(option) {
|
|
117
164
|
return this.optionValue ? ObjectUtils.resolveFieldData(option, this.optionValue) : option;
|
|
118
165
|
},
|
|
166
|
+
isOptionDisabled(option) {
|
|
167
|
+
return this.optionDisabled ? ObjectUtils.resolveFieldData(option, this.optionDisabled) : false;
|
|
168
|
+
},
|
|
169
|
+
getOptionGroupLabel(optionGroup) {
|
|
170
|
+
return this.optionGroupLabel ? ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel) : null;
|
|
171
|
+
},
|
|
119
172
|
getOptionGroupChildren(optionGroup, level) {
|
|
120
173
|
return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupChildren[level]);
|
|
121
174
|
},
|
|
122
175
|
isOptionGroup(option, level) {
|
|
123
176
|
return Object.prototype.hasOwnProperty.call(option, this.optionGroupChildren[level]);
|
|
124
177
|
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
for (let option of this.options) {
|
|
129
|
-
path = this.findModelOptionInGroup(option, 0);
|
|
130
|
-
if (path) {
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
this.selectionPath = path;
|
|
178
|
+
getProccessedOptionLabel(processedOption) {
|
|
179
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
|
180
|
+
return grouped ? this.getOptionGroupLabel(processedOption.option, processedOption.level) : this.getOptionLabel(processedOption.option);
|
|
137
181
|
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
let selectedOption;
|
|
141
|
-
for (let childOption of this.getOptionGroupChildren(option, level)) {
|
|
142
|
-
selectedOption = this.findModelOptionInGroup(childOption, level + 1);
|
|
143
|
-
if (selectedOption) {
|
|
144
|
-
selectedOption.unshift(option);
|
|
145
|
-
return selectedOption;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else if ((ObjectUtils.equals(this.modelValue, this.getOptionValue(option), this.dataKey))) {
|
|
150
|
-
return [option];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return null;
|
|
182
|
+
isProccessedOptionGroup(processedOption) {
|
|
183
|
+
return ObjectUtils.isNotEmpty(processedOption.children);
|
|
154
184
|
},
|
|
155
|
-
show() {
|
|
185
|
+
show(isFocus) {
|
|
156
186
|
this.$emit('before-show');
|
|
157
187
|
this.overlayVisible = true;
|
|
188
|
+
this.activeOptionPath = this.findOptionPathByValue(this.modelValue);
|
|
189
|
+
|
|
190
|
+
if (this.hasSelectedOption && ObjectUtils.isNotEmpty(this.activeOptionPath)) {
|
|
191
|
+
const processedOption = this.activeOptionPath[this.activeOptionPath.length - 1];
|
|
192
|
+
this.focusedOptionInfo = { index: (this.autoOptionFocus ? processedOption.index : -1), level: processedOption.level, parentKey: processedOption.parentKey };
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
this.focusedOptionInfo = { index: (this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1), level: 0, parentKey: '' };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
isFocus && this.$refs.focusInput.focus();
|
|
158
199
|
},
|
|
159
|
-
hide() {
|
|
160
|
-
|
|
161
|
-
|
|
200
|
+
hide(isFocus) {
|
|
201
|
+
const _hide = () => {
|
|
202
|
+
this.$emit('before-hide');
|
|
203
|
+
this.overlayVisible = false;
|
|
204
|
+
this.activeOptionPath = [];
|
|
205
|
+
this.focusedOptionInfo = { index: -1, level: 0, parentKey: '' };
|
|
206
|
+
|
|
207
|
+
isFocus && this.$refs.focusInput.focus();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
setTimeout(() => { _hide() }, 0); // For ScreenReaders
|
|
162
211
|
},
|
|
163
|
-
onFocus() {
|
|
212
|
+
onFocus(event) {
|
|
164
213
|
this.focused = true;
|
|
214
|
+
this.$emit('focus', event);
|
|
165
215
|
},
|
|
166
|
-
onBlur() {
|
|
216
|
+
onBlur(event) {
|
|
167
217
|
this.focused = false;
|
|
218
|
+
this.focusedOptionInfo = { index: -1, level: 0, parentKey: '' };
|
|
219
|
+
this.searchValue = '';
|
|
220
|
+
this.$emit('blur', event);
|
|
168
221
|
},
|
|
169
|
-
|
|
222
|
+
onKeyDown(event) {
|
|
170
223
|
if (this.disabled || this.loading) {
|
|
224
|
+
event.preventDefault();
|
|
171
225
|
return;
|
|
172
226
|
}
|
|
173
227
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
this.
|
|
177
|
-
|
|
178
|
-
|
|
228
|
+
switch (event.code) {
|
|
229
|
+
case 'ArrowDown':
|
|
230
|
+
this.onArrowDownKey(event);
|
|
231
|
+
break;
|
|
232
|
+
|
|
233
|
+
case 'ArrowUp':
|
|
234
|
+
this.onArrowUpKey(event);
|
|
235
|
+
break;
|
|
236
|
+
|
|
237
|
+
case 'ArrowLeft':
|
|
238
|
+
this.onArrowLeftKey(event);
|
|
239
|
+
break;
|
|
240
|
+
|
|
241
|
+
case 'ArrowRight':
|
|
242
|
+
this.onArrowRightKey(event);
|
|
243
|
+
break;
|
|
244
|
+
|
|
245
|
+
case 'Home':
|
|
246
|
+
this.onHomeKey(event);
|
|
247
|
+
break;
|
|
248
|
+
|
|
249
|
+
case 'End':
|
|
250
|
+
this.onEndKey(event);
|
|
251
|
+
break;
|
|
252
|
+
|
|
253
|
+
case 'Space':
|
|
254
|
+
this.onSpaceKey(event);
|
|
255
|
+
break;
|
|
256
|
+
|
|
257
|
+
case 'Enter':
|
|
258
|
+
this.onEnterKey(event);
|
|
259
|
+
break;
|
|
260
|
+
|
|
261
|
+
case 'Escape':
|
|
262
|
+
this.onEscapeKey(event);
|
|
263
|
+
break;
|
|
264
|
+
|
|
265
|
+
case 'Tab':
|
|
266
|
+
this.onTabKey(event);
|
|
267
|
+
break;
|
|
268
|
+
|
|
269
|
+
case 'PageDown':
|
|
270
|
+
case 'PageUp':
|
|
271
|
+
case 'Backspace':
|
|
272
|
+
case 'ShiftLeft':
|
|
273
|
+
case 'ShiftRight':
|
|
274
|
+
//NOOP
|
|
275
|
+
break;
|
|
276
|
+
|
|
277
|
+
default:
|
|
278
|
+
if (ObjectUtils.isPrintableCharacter(event.key)) {
|
|
279
|
+
!this.overlayVisible && this.show();
|
|
280
|
+
this.searchOptions(event, event.key);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
onOptionChange(event) {
|
|
287
|
+
const { originalEvent, processedOption, isFocus } = event;
|
|
288
|
+
const { index, level, parentKey, children } = processedOption;
|
|
289
|
+
const grouped = ObjectUtils.isNotEmpty(children);
|
|
290
|
+
|
|
291
|
+
const activeOptionPath = this.activeOptionPath.filter(p => p.parentKey !== parentKey);
|
|
292
|
+
activeOptionPath.push(processedOption);
|
|
293
|
+
|
|
294
|
+
this.focusedOptionInfo = { index, level, parentKey };
|
|
295
|
+
this.activeOptionPath = activeOptionPath;
|
|
296
|
+
|
|
297
|
+
grouped ? this.onOptionGroupSelect(originalEvent, processedOption) : this.onOptionSelect(originalEvent, processedOption);
|
|
298
|
+
isFocus && this.$refs.focusInput.focus();
|
|
299
|
+
},
|
|
300
|
+
onOptionSelect(event, processedOption) {
|
|
301
|
+
const value = this.getOptionValue(processedOption.option);
|
|
179
302
|
|
|
303
|
+
this.activeOptionPath.forEach(p => p.selected = true);
|
|
304
|
+
this.updateModel(event, value);
|
|
305
|
+
this.hide(true);
|
|
306
|
+
},
|
|
307
|
+
onOptionGroupSelect(event, processedOption) {
|
|
308
|
+
this.dirty = true;
|
|
309
|
+
this.$emit('group-change', { originalEvent: event, value: processedOption.option });
|
|
310
|
+
},
|
|
311
|
+
onContainerClick(event) {
|
|
312
|
+
if (this.disabled || this.loading) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (!this.overlay || !this.overlay.contains(event.target)) {
|
|
317
|
+
this.overlayVisible ? this.hide() : this.show();
|
|
180
318
|
this.$refs.focusInput.focus();
|
|
181
319
|
}
|
|
320
|
+
|
|
321
|
+
this.$emit('click', event);
|
|
322
|
+
},
|
|
323
|
+
onOverlayClick(event) {
|
|
324
|
+
OverlayEventBus.emit('overlay-click', {
|
|
325
|
+
originalEvent: event,
|
|
326
|
+
target: this.$el
|
|
327
|
+
});
|
|
328
|
+
},
|
|
329
|
+
onOverlayKeyDown(event) {
|
|
330
|
+
switch (event.code) {
|
|
331
|
+
case 'Escape':
|
|
332
|
+
this.onEscapeKey(event);
|
|
333
|
+
break;
|
|
334
|
+
|
|
335
|
+
default:
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
onArrowDownKey(event) {
|
|
340
|
+
const optionIndex = this.focusedOptionInfo.index !== -1 ? this.findNextOptionIndex(this.focusedOptionInfo.index) : this.findFirstFocusedOptionIndex();
|
|
341
|
+
|
|
342
|
+
this.changeFocusedOptionIndex(event, optionIndex);
|
|
343
|
+
|
|
344
|
+
!this.overlayVisible && this.show();
|
|
345
|
+
event.preventDefault();
|
|
346
|
+
},
|
|
347
|
+
onArrowUpKey(event) {
|
|
348
|
+
if (event.altKey) {
|
|
349
|
+
if (this.focusedOptionInfo.index !== -1) {
|
|
350
|
+
const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
|
|
351
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
|
352
|
+
!grouped && this.onOptionChange({ originalEvent: event, processedOption });
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
this.overlayVisible && this.hide();
|
|
356
|
+
event.preventDefault();
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
const optionIndex = this.focusedOptionInfo.index !== -1 ? this.findPrevOptionIndex(this.focusedOptionInfo.index) : this.findLastFocusedOptionIndex();
|
|
360
|
+
|
|
361
|
+
this.changeFocusedOptionIndex(event, optionIndex);
|
|
362
|
+
|
|
363
|
+
!this.overlayVisible && this.show();
|
|
364
|
+
event.preventDefault();
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
onArrowLeftKey(event) {
|
|
368
|
+
if (this.overlayVisible) {
|
|
369
|
+
const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
|
|
370
|
+
const parentOption = this.activeOptionPath.find(p => p.key === processedOption.parentKey);
|
|
371
|
+
const matched = this.focusedOptionInfo.parentKey === '' || (parentOption && parentOption.key === this.focusedOptionInfo.parentKey);
|
|
372
|
+
const root = ObjectUtils.isEmpty(processedOption.parent);
|
|
373
|
+
|
|
374
|
+
if (matched) {
|
|
375
|
+
this.activeOptionPath = this.activeOptionPath.filter(p => p.parentKey !== this.focusedOptionInfo.parentKey);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (!root) {
|
|
379
|
+
this.focusedOptionInfo = { index: -1, parentKey: parentOption ? parentOption.parentKey : '' };
|
|
380
|
+
this.searchValue = '';
|
|
381
|
+
this.onArrowDownKey(event);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
event.preventDefault();
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
onArrowRightKey(event) {
|
|
388
|
+
if (this.overlayVisible) {
|
|
389
|
+
const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
|
|
390
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
|
391
|
+
|
|
392
|
+
if (grouped) {
|
|
393
|
+
const matched = this.activeOptionPath.some(p => processedOption.key === p.key);
|
|
394
|
+
|
|
395
|
+
if (matched) {
|
|
396
|
+
this.focusedOptionInfo = { index: -1, parentKey: processedOption.key };
|
|
397
|
+
this.searchValue = '';
|
|
398
|
+
this.onArrowDownKey(event);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
this.onOptionChange({ originalEvent: event, processedOption });
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
event.preventDefault();
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
onHomeKey(event) {
|
|
409
|
+
this.changeFocusedOptionIndex(event, this.findFirstOptionIndex());
|
|
410
|
+
|
|
411
|
+
!this.overlayVisible && this.show();
|
|
412
|
+
event.preventDefault();
|
|
413
|
+
},
|
|
414
|
+
onEndKey(event) {
|
|
415
|
+
this.changeFocusedOptionIndex(event, this.findLastOptionIndex());
|
|
416
|
+
|
|
417
|
+
!this.overlayVisible && this.show();
|
|
418
|
+
event.preventDefault();
|
|
419
|
+
},
|
|
420
|
+
onEnterKey(event) {
|
|
421
|
+
if (!this.overlayVisible) {
|
|
422
|
+
this.onArrowDownKey(event);
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
if (this.focusedOptionInfo.index !== -1) {
|
|
426
|
+
const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
|
|
427
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
|
428
|
+
|
|
429
|
+
this.onOptionChange({ originalEvent: event, processedOption });
|
|
430
|
+
!grouped && this.hide();
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
event.preventDefault();
|
|
435
|
+
},
|
|
436
|
+
onSpaceKey(event) {
|
|
437
|
+
this.onEnterKey(event);
|
|
438
|
+
},
|
|
439
|
+
onEscapeKey(event) {
|
|
440
|
+
this.overlayVisible && this.hide(true);
|
|
441
|
+
event.preventDefault();
|
|
442
|
+
},
|
|
443
|
+
onTabKey(event) {
|
|
444
|
+
if (this.focusedOptionInfo.index !== -1) {
|
|
445
|
+
const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
|
|
446
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
|
447
|
+
|
|
448
|
+
!grouped && this.onOptionChange({ originalEvent: event, processedOption });
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
this.overlayVisible && this.hide();
|
|
182
452
|
},
|
|
183
453
|
onOverlayEnter(el) {
|
|
184
454
|
ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
|
|
185
455
|
this.alignOverlay();
|
|
456
|
+
this.scrollInView();
|
|
457
|
+
},
|
|
458
|
+
onOverlayAfterEnter() {
|
|
186
459
|
this.bindOutsideClickListener();
|
|
187
460
|
this.bindScrollListener();
|
|
188
461
|
this.bindResizeListener();
|
|
462
|
+
|
|
189
463
|
this.$emit('show');
|
|
190
464
|
},
|
|
191
465
|
onOverlayLeave() {
|
|
192
466
|
this.unbindOutsideClickListener();
|
|
193
467
|
this.unbindScrollListener();
|
|
194
468
|
this.unbindResizeListener();
|
|
469
|
+
|
|
195
470
|
this.$emit('hide');
|
|
196
471
|
this.overlay = null;
|
|
197
472
|
this.dirty = false;
|
|
@@ -256,67 +531,168 @@ export default {
|
|
|
256
531
|
this.resizeListener = null;
|
|
257
532
|
}
|
|
258
533
|
},
|
|
259
|
-
|
|
260
|
-
this.
|
|
534
|
+
isOptionMatched(processedOption) {
|
|
535
|
+
return this.isValidOption(processedOption) && this.getProccessedOptionLabel(processedOption).toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale));
|
|
261
536
|
},
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
537
|
+
isValidOption(processedOption) {
|
|
538
|
+
return !!processedOption && !this.isOptionDisabled(processedOption.option);
|
|
539
|
+
},
|
|
540
|
+
isValidSelectedOption(processedOption) {
|
|
541
|
+
return this.isValidOption(processedOption) && this.isSelected(processedOption);
|
|
542
|
+
},
|
|
543
|
+
isSelected(processedOption) {
|
|
544
|
+
return this.activeOptionPath.some(p => p.key === processedOption.key);
|
|
545
|
+
},
|
|
546
|
+
findFirstOptionIndex() {
|
|
547
|
+
return this.visibleOptions.findIndex(processedOption => this.isValidOption(processedOption));
|
|
548
|
+
},
|
|
549
|
+
findLastOptionIndex() {
|
|
550
|
+
return ObjectUtils.findLastIndex(this.visibleOptions, processedOption => this.isValidOption(processedOption));
|
|
551
|
+
},
|
|
552
|
+
findNextOptionIndex(index) {
|
|
553
|
+
const matchedOptionIndex = index < (this.visibleOptions.length - 1) ? this.visibleOptions.slice(index + 1).findIndex(processedOption => this.isValidOption(processedOption)) : -1;
|
|
554
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
|
|
555
|
+
},
|
|
556
|
+
findPrevOptionIndex(index) {
|
|
557
|
+
const matchedOptionIndex = index > 0 ? ObjectUtils.findLastIndex(this.visibleOptions.slice(0, index), processedOption => this.isValidOption(processedOption)) : -1;
|
|
558
|
+
return matchedOptionIndex > -1 ? matchedOptionIndex : index;
|
|
559
|
+
},
|
|
560
|
+
findSelectedOptionIndex() {
|
|
561
|
+
return this.visibleOptions.findIndex(processedOption => this.isValidSelectedOption(processedOption));
|
|
562
|
+
},
|
|
563
|
+
findFirstFocusedOptionIndex() {
|
|
564
|
+
const selectedIndex = this.findSelectedOptionIndex();
|
|
565
|
+
return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex;
|
|
566
|
+
},
|
|
567
|
+
findLastFocusedOptionIndex() {
|
|
568
|
+
const selectedIndex = this.findSelectedOptionIndex();
|
|
569
|
+
return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex;
|
|
570
|
+
},
|
|
571
|
+
findOptionPathByValue(value, processedOptions, level = 0) {
|
|
572
|
+
processedOptions = processedOptions || (level === 0 && this.processedOptions);
|
|
274
573
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
this.hide();
|
|
278
|
-
event.preventDefault();
|
|
279
|
-
}
|
|
280
|
-
break;
|
|
574
|
+
if (!processedOptions) return null;
|
|
575
|
+
if (ObjectUtils.isEmpty(value)) return [];
|
|
281
576
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
577
|
+
for (let i = 0; i < processedOptions.length; i++) {
|
|
578
|
+
const processedOption = processedOptions[i];
|
|
579
|
+
|
|
580
|
+
if (ObjectUtils.equals(value, this.getOptionValue(processedOption.option), this.equalityKey)) {
|
|
581
|
+
return [processedOption];
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
const matchedOptions = this.findOptionPathByValue(value, processedOption.children, level + 1);
|
|
585
|
+
if (matchedOptions) {
|
|
586
|
+
matchedOptions.unshift(processedOption);
|
|
587
|
+
|
|
588
|
+
return matchedOptions;
|
|
589
|
+
}
|
|
285
590
|
}
|
|
286
591
|
},
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
592
|
+
searchOptions(event, char) {
|
|
593
|
+
this.searchValue = (this.searchValue || '') + char;
|
|
594
|
+
|
|
595
|
+
let optionIndex = -1;
|
|
596
|
+
let matched = false;
|
|
597
|
+
|
|
598
|
+
if (this.focusedOptionInfo.index !== -1) {
|
|
599
|
+
optionIndex = this.visibleOptions.slice(this.focusedOptionInfo.index).findIndex(processedOption => this.isOptionMatched(processedOption));
|
|
600
|
+
optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionInfo.index).findIndex(processedOption => this.isOptionMatched(processedOption)) : optionIndex + this.focusedOptionInfo.index;
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
optionIndex = this.visibleOptions.findIndex(processedOption => this.isOptionMatched(processedOption));
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
if (optionIndex !== -1) {
|
|
607
|
+
matched = true;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (optionIndex === -1 && this.focusedOptionInfo.index === -1) {
|
|
611
|
+
optionIndex = this.findFirstFocusedOptionIndex();
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
if (optionIndex !== -1) {
|
|
615
|
+
this.changeFocusedOptionIndex(event, optionIndex);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
if (this.searchTimeout) {
|
|
619
|
+
clearTimeout(this.searchTimeout);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
this.searchTimeout = setTimeout(() => {
|
|
623
|
+
this.searchValue = '';
|
|
624
|
+
this.searchTimeout = null;
|
|
625
|
+
}, 500);
|
|
626
|
+
|
|
627
|
+
return matched;
|
|
628
|
+
},
|
|
629
|
+
changeFocusedOptionIndex(event, index) {
|
|
630
|
+
if (this.focusedOptionInfo.index !== index) {
|
|
631
|
+
this.focusedOptionInfo.index = index;
|
|
632
|
+
this.scrollInView();
|
|
633
|
+
|
|
634
|
+
if (this.selectOnFocus) {
|
|
635
|
+
this.updateModel(event, this.getOptionValue(this.visibleOptions[index]));
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
scrollInView(index = -1) {
|
|
640
|
+
const id = index !== -1 ? `${this.id}_${index}` : this.focusedOptionId;
|
|
641
|
+
const element = DomHandler.findSingle(this.list, `li[id="${id}"]`);
|
|
642
|
+
if (element) {
|
|
643
|
+
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'start' });
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
autoUpdateModel() {
|
|
647
|
+
if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption) {
|
|
648
|
+
this.focusedOptionInfo.index = this.findFirstFocusedOptionIndex();
|
|
649
|
+
const value = this.getOptionValue(this.visibleOptions[this.focusedOptionInfo.index]);
|
|
650
|
+
this.updateModel(null, value);
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
updateModel(event, value) {
|
|
654
|
+
this.$emit('update:modelValue', value);
|
|
655
|
+
this.$emit('change', { originalEvent: event, value });
|
|
656
|
+
},
|
|
657
|
+
createProcessedOptions(options, level = 0, parent = {}, parentKey = '') {
|
|
658
|
+
const processedOptions = [];
|
|
659
|
+
|
|
660
|
+
options && options.forEach((option, index) => {
|
|
661
|
+
const key = (parentKey !== '' ? parentKey + '_' : '') + index;
|
|
662
|
+
const newOption = {
|
|
663
|
+
option,
|
|
664
|
+
index,
|
|
665
|
+
level,
|
|
666
|
+
key,
|
|
667
|
+
parent,
|
|
668
|
+
parentKey
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
newOption['children'] = this.createProcessedOptions(this.getOptionGroupChildren(option, level), level + 1, newOption, key);
|
|
672
|
+
processedOptions.push(newOption);
|
|
291
673
|
});
|
|
674
|
+
|
|
675
|
+
return processedOptions;
|
|
676
|
+
},
|
|
677
|
+
overlayRef(el) {
|
|
678
|
+
this.overlay = el;
|
|
292
679
|
}
|
|
293
680
|
},
|
|
294
681
|
computed: {
|
|
295
682
|
containerClass() {
|
|
296
|
-
return [
|
|
297
|
-
'p-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
];
|
|
683
|
+
return ['p-cascadeselect p-component p-inputwrapper', {
|
|
684
|
+
'p-disabled': this.disabled,
|
|
685
|
+
'p-focus': this.focused,
|
|
686
|
+
'p-inputwrapper-filled': this.modelValue,
|
|
687
|
+
'p-inputwrapper-focus': this.focused || this.overlayVisible,
|
|
688
|
+
'p-overlay-open': this.overlayVisible
|
|
689
|
+
}];
|
|
305
690
|
},
|
|
306
691
|
labelClass() {
|
|
307
|
-
return [
|
|
308
|
-
'p-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
'p-cascadeselect-label-empty': !this.$slots['value'] && (this.label === 'p-emptylabel' || this.label.length === 0)
|
|
312
|
-
}
|
|
313
|
-
];
|
|
314
|
-
},
|
|
315
|
-
label() {
|
|
316
|
-
if (this.selectionPath)
|
|
317
|
-
return this.getOptionLabel(this.selectionPath[this.selectionPath.length - 1]);
|
|
318
|
-
else
|
|
319
|
-
return this.placeholder||'p-emptylabel';
|
|
692
|
+
return ['p-cascadeselect-label', {
|
|
693
|
+
'p-placeholder': this.label === this.placeholder,
|
|
694
|
+
'p-cascadeselect-label-empty': !this.$slots['value'] && (this.label === 'p-emptylabel' || this.label.length === 0)
|
|
695
|
+
}];
|
|
320
696
|
},
|
|
321
697
|
panelStyleClass() {
|
|
322
698
|
return ['p-cascadeselect-panel p-component', this.panelClass, {
|
|
@@ -326,6 +702,55 @@ export default {
|
|
|
326
702
|
},
|
|
327
703
|
dropdownIconClass() {
|
|
328
704
|
return ['p-cascadeselect-trigger-icon', this.loading ? this.loadingIcon : 'pi pi-chevron-down'];
|
|
705
|
+
},
|
|
706
|
+
hasSelectedOption() {
|
|
707
|
+
return ObjectUtils.isNotEmpty(this.modelValue);
|
|
708
|
+
},
|
|
709
|
+
label() {
|
|
710
|
+
const label = this.placeholder || 'p-emptylabel';
|
|
711
|
+
|
|
712
|
+
if (this.hasSelectedOption) {
|
|
713
|
+
const activeOptionPath = this.findOptionPathByValue(this.modelValue);
|
|
714
|
+
const processedOption = activeOptionPath.length ? activeOptionPath[activeOptionPath.length - 1] : null;
|
|
715
|
+
|
|
716
|
+
return processedOption ? this.getOptionLabel(processedOption.option) : label;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
return label;
|
|
720
|
+
},
|
|
721
|
+
processedOptions() {
|
|
722
|
+
return this.createProcessedOptions(this.options || []);
|
|
723
|
+
},
|
|
724
|
+
visibleOptions() {
|
|
725
|
+
const processedOption = this.activeOptionPath.find(p => p.key === this.focusedOptionInfo.parentKey);
|
|
726
|
+
return processedOption ? processedOption.children : this.processedOptions;
|
|
727
|
+
},
|
|
728
|
+
equalityKey() {
|
|
729
|
+
return this.optionValue ? null : this.dataKey;
|
|
730
|
+
},
|
|
731
|
+
searchResultMessageText() {
|
|
732
|
+
return ObjectUtils.isNotEmpty(this.visibleOptions) ? this.searchMessageText.replaceAll('{0}', this.visibleOptions.length) : this.emptySearchMessageText;
|
|
733
|
+
},
|
|
734
|
+
searchMessageText() {
|
|
735
|
+
return this.searchMessage || this.$primevue.config.locale.searchMessage || '';
|
|
736
|
+
},
|
|
737
|
+
emptySearchMessageText() {
|
|
738
|
+
return this.emptySearchMessage || this.$primevue.config.locale.emptySearchMessage || '';
|
|
739
|
+
},
|
|
740
|
+
emptyMessageText() {
|
|
741
|
+
return this.emptyMessage || this.$primevue.config.locale.emptyMessage || '';
|
|
742
|
+
},
|
|
743
|
+
selectionMessageText() {
|
|
744
|
+
return this.selectionMessage || this.$primevue.config.locale.selectionMessage || '';
|
|
745
|
+
},
|
|
746
|
+
emptySelectionMessageText() {
|
|
747
|
+
return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || '';
|
|
748
|
+
},
|
|
749
|
+
selectedMessageText() {
|
|
750
|
+
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText;
|
|
751
|
+
},
|
|
752
|
+
focusedOptionId() {
|
|
753
|
+
return this.focusedOptionInfo.index !== -1 ? `${this.id}${ObjectUtils.isNotEmpty(this.focusedOptionInfo.parentKey) ? '_' + this.focusedOptionInfo.parentKey : ''}_${this.focusedOptionInfo.index}` : null;
|
|
329
754
|
}
|
|
330
755
|
},
|
|
331
756
|
components: {
|