primevue 4.1.0 → 4.1.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/README.md +2 -94
- package/accordion/index.d.ts +2 -2
- package/accordioncontent/index.d.ts +2 -2
- package/accordionheader/index.d.ts +2 -2
- package/accordionpanel/index.d.ts +2 -2
- package/accordiontab/index.d.ts +2 -2
- package/autocomplete/index.d.ts +2 -2
- package/autocomplete/style/index.mjs +1 -1
- package/autocomplete/style/index.mjs.map +1 -1
- package/avatar/index.d.ts +2 -2
- package/avatargroup/index.d.ts +2 -2
- package/badge/index.d.ts +2 -2
- package/blockui/index.d.ts +2 -2
- package/breadcrumb/index.d.ts +2 -2
- package/button/index.d.ts +2 -2
- package/buttongroup/index.d.ts +2 -2
- package/calendar/index.d.ts +2 -2
- package/card/index.d.ts +2 -2
- package/carousel/index.d.ts +2 -2
- package/cascadeselect/CascadeSelect.vue +54 -32
- package/cascadeselect/CascadeSelectSub.vue +8 -17
- package/cascadeselect/index.d.ts +2 -2
- package/cascadeselect/index.mjs +100 -63
- package/cascadeselect/index.mjs.map +1 -1
- package/cascadeselect/style/index.mjs +2 -2
- package/cascadeselect/style/index.mjs.map +1 -1
- package/chart/index.d.ts +2 -2
- package/checkbox/index.d.ts +2 -2
- package/chip/index.d.ts +2 -2
- package/chips/index.d.ts +2 -2
- package/colorpicker/index.d.ts +2 -2
- package/column/index.d.ts +2 -2
- package/columngroup/index.d.ts +2 -2
- package/confirmdialog/index.d.ts +2 -2
- package/confirmpopup/index.d.ts +2 -2
- package/contextmenu/ContextMenu.vue +8 -3
- package/contextmenu/index.d.ts +2 -2
- package/contextmenu/index.mjs +6 -3
- package/contextmenu/index.mjs.map +1 -1
- package/contextmenu/style/index.mjs +1 -1
- package/contextmenu/style/index.mjs.map +1 -1
- package/datatable/DataTable.vue +2 -2
- package/datatable/index.d.ts +2 -2
- package/datatable/index.mjs +4 -4
- package/datatable/index.mjs.map +1 -1
- package/datatable/style/index.mjs +1 -1
- package/datatable/style/index.mjs.map +1 -1
- package/dataview/index.d.ts +2 -2
- package/datepicker/index.d.ts +2 -2
- package/deferredcontent/index.d.ts +2 -2
- package/dialog/index.d.ts +2 -2
- package/divider/index.d.ts +2 -2
- package/dock/index.d.ts +2 -2
- package/drawer/index.d.ts +2 -2
- package/dropdown/index.d.ts +2 -2
- package/dynamicdialog/index.d.ts +2 -2
- package/editor/index.d.ts +2 -2
- package/fieldset/index.d.ts +2 -2
- package/fileupload/index.d.ts +2 -2
- package/floatlabel/index.d.ts +2 -2
- package/fluid/index.d.ts +2 -2
- package/galleria/index.d.ts +2 -2
- package/iconfield/index.d.ts +2 -2
- package/iftalabel/index.d.ts +2 -2
- package/image/index.d.ts +2 -2
- package/imagecompare/index.d.ts +2 -2
- package/inlinemessage/index.d.ts +2 -2
- package/inplace/index.d.ts +2 -2
- package/inputchips/index.d.ts +2 -2
- package/inputgroup/index.d.ts +2 -2
- package/inputgroupaddon/index.d.ts +2 -2
- package/inputicon/index.d.ts +2 -2
- package/inputmask/index.d.ts +2 -2
- package/inputnumber/index.d.ts +2 -2
- package/inputnumber/style/index.mjs +1 -1
- package/inputnumber/style/index.mjs.map +1 -1
- package/inputotp/index.d.ts +2 -2
- package/inputswitch/index.d.ts +2 -2
- package/inputtext/index.d.ts +2 -2
- package/inputtext/style/index.mjs +1 -1
- package/inputtext/style/index.mjs.map +1 -1
- package/knob/index.d.ts +2 -2
- package/listbox/index.d.ts +2 -2
- package/megamenu/BaseMegaMenu.vue +4 -0
- package/megamenu/MegaMenu.vue +15 -5
- package/megamenu/index.d.ts +7 -2
- package/megamenu/index.mjs +23 -6
- package/megamenu/index.mjs.map +1 -1
- package/megamenu/style/index.mjs +5 -5
- package/megamenu/style/index.mjs.map +1 -1
- package/menu/index.d.ts +2 -2
- package/menubar/Menubar.vue +8 -3
- package/menubar/index.d.ts +2 -2
- package/menubar/index.mjs +6 -3
- package/menubar/index.mjs.map +1 -1
- package/menubar/style/index.mjs +1 -1
- package/menubar/style/index.mjs.map +1 -1
- package/message/index.d.ts +2 -2
- package/metergroup/index.d.ts +2 -2
- package/multiselect/index.d.ts +2 -2
- package/orderlist/index.d.ts +2 -2
- package/organizationchart/index.d.ts +2 -2
- package/overlaybadge/index.d.ts +2 -2
- package/overlaypanel/index.d.ts +2 -2
- package/package.json +3 -3
- package/paginator/index.d.ts +2 -2
- package/panel/index.d.ts +2 -2
- package/panelmenu/index.d.ts +2 -2
- package/password/index.d.ts +2 -2
- package/picklist/index.d.ts +2 -2
- package/popover/index.d.ts +2 -2
- package/portal/index.d.ts +2 -2
- package/progressbar/index.d.ts +2 -2
- package/progressspinner/index.d.ts +2 -2
- package/radiobutton/index.d.ts +2 -2
- package/rating/index.d.ts +2 -2
- package/row/index.d.ts +2 -2
- package/scrollpanel/index.d.ts +2 -2
- package/scrolltop/index.d.ts +2 -2
- package/select/index.d.ts +2 -2
- package/selectbutton/index.d.ts +2 -2
- package/sidebar/index.d.ts +2 -2
- package/skeleton/index.d.ts +2 -2
- package/slider/index.d.ts +2 -2
- package/slider/style/index.mjs +1 -1
- package/slider/style/index.mjs.map +1 -1
- package/speeddial/index.d.ts +2 -2
- package/splitbutton/index.d.ts +2 -2
- package/splitter/index.d.ts +2 -2
- package/splitterpanel/index.d.ts +2 -2
- package/step/index.d.ts +2 -2
- package/stepitem/index.d.ts +2 -2
- package/steplist/index.d.ts +2 -2
- package/steppanel/index.d.ts +2 -2
- package/steppanels/index.d.ts +2 -2
- package/stepper/index.d.ts +2 -2
- package/steps/index.d.ts +2 -2
- package/tab/index.d.ts +2 -2
- package/tablist/index.d.ts +2 -2
- package/tabmenu/index.d.ts +2 -2
- package/tabpanel/index.d.ts +2 -2
- package/tabpanels/index.d.ts +2 -2
- package/tabs/index.d.ts +2 -2
- package/tabview/index.d.ts +2 -2
- package/tag/index.d.ts +2 -2
- package/terminal/index.d.ts +2 -2
- package/textarea/index.d.ts +2 -2
- package/tieredmenu/TieredMenu.vue +8 -3
- package/tieredmenu/index.d.ts +2 -2
- package/tieredmenu/index.mjs +6 -3
- package/tieredmenu/index.mjs.map +1 -1
- package/tieredmenu/style/index.mjs +1 -1
- package/tieredmenu/style/index.mjs.map +1 -1
- package/timeline/index.d.ts +2 -2
- package/toast/index.d.ts +2 -2
- package/togglebutton/index.d.ts +2 -2
- package/toggleswitch/index.d.ts +2 -2
- package/toolbar/index.d.ts +2 -2
- package/tooltip/style/index.mjs +1 -1
- package/tooltip/style/index.mjs.map +1 -1
- package/tree/Tree.vue +1 -1
- package/tree/index.d.ts +2 -2
- package/tree/index.mjs +3 -2
- package/tree/index.mjs.map +1 -1
- package/tree/style/index.mjs +2 -1
- package/tree/style/index.mjs.map +1 -1
- package/treeselect/index.d.ts +2 -2
- package/treeselect/style/index.mjs +1 -1
- package/treeselect/style/index.mjs.map +1 -1
- package/treetable/index.d.ts +2 -2
- package/treetable/style/index.mjs +1 -1
- package/treetable/style/index.mjs.map +1 -1
- package/umd/primevue.min.js +1 -1
- package/virtualscroller/index.d.ts +2 -2
- package/web-types.json +2 -2
|
@@ -71,9 +71,10 @@
|
|
|
71
71
|
:optionGroupIcon="optionGroupIcon"
|
|
72
72
|
:optionGroupLabel="optionGroupLabel"
|
|
73
73
|
:optionGroupChildren="optionGroupChildren"
|
|
74
|
-
|
|
75
|
-
@option-
|
|
76
|
-
@option-focus-
|
|
74
|
+
:value="modelValue"
|
|
75
|
+
@option-change="onOptionClick"
|
|
76
|
+
@option-focus-change="onOptionMouseMove"
|
|
77
|
+
@option-focus-enter-change="onOptionMouseEnter"
|
|
77
78
|
:pt="pt"
|
|
78
79
|
:unstyled="unstyled"
|
|
79
80
|
/>
|
|
@@ -304,51 +305,68 @@ export default {
|
|
|
304
305
|
|
|
305
306
|
this.clicked = false;
|
|
306
307
|
},
|
|
307
|
-
onOptionChange(event
|
|
308
|
-
const {
|
|
308
|
+
onOptionChange(event) {
|
|
309
|
+
const { processedOption, type } = event;
|
|
309
310
|
|
|
310
311
|
if (isEmpty(processedOption)) return;
|
|
311
312
|
|
|
312
313
|
const { index, key, level, parentKey, children } = processedOption;
|
|
313
314
|
const grouped = isNotEmpty(children);
|
|
314
|
-
const
|
|
315
|
+
const activeOptionPath = this.activeOptionPath.filter((p) => p.parentKey !== parentKey && p.parentKey !== key);
|
|
316
|
+
|
|
317
|
+
this.focusedOptionInfo = { index, level, parentKey };
|
|
318
|
+
|
|
319
|
+
if (type == 'hover' && this.queryMatches) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (grouped) {
|
|
324
|
+
activeOptionPath.push(processedOption);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
this.activeOptionPath = activeOptionPath;
|
|
328
|
+
},
|
|
329
|
+
onOptionClick(event) {
|
|
330
|
+
const { originalEvent, processedOption, isFocus, isHide, preventSelection } = event;
|
|
331
|
+
const { index, key, level, parentKey } = processedOption;
|
|
332
|
+
const grouped = this.isProccessedOptionGroup(processedOption);
|
|
315
333
|
const selected = this.isSelected(processedOption);
|
|
316
334
|
|
|
317
335
|
if (selected) {
|
|
318
|
-
this.focusedOptionInfo = { index, level, parentKey };
|
|
319
336
|
this.activeOptionPath = this.activeOptionPath.filter((p) => key !== p.key && key.startsWith(p.key));
|
|
320
|
-
|
|
321
|
-
this.dirty = !root;
|
|
337
|
+
this.focusedOptionInfo = { index, level, parentKey };
|
|
322
338
|
} else {
|
|
323
|
-
|
|
339
|
+
if (grouped) {
|
|
340
|
+
this.onOptionChange(event);
|
|
341
|
+
this.onOptionGroupSelect(originalEvent, processedOption);
|
|
342
|
+
} else {
|
|
343
|
+
const activeOptionPath = this.activeOptionPath.filter((p) => p.parentKey !== parentKey);
|
|
324
344
|
|
|
325
|
-
|
|
345
|
+
activeOptionPath.push(processedOption);
|
|
326
346
|
|
|
327
|
-
|
|
328
|
-
this.activeOptionPath = activeOptionPath;
|
|
329
|
-
}
|
|
347
|
+
this.focusedOptionInfo = { index, level, parentKey };
|
|
330
348
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
349
|
+
if (!preventSelection || processedOption?.children.length !== 0) {
|
|
350
|
+
this.activeOptionPath = activeOptionPath;
|
|
351
|
+
this.onOptionSelect(originalEvent, processedOption, isHide);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
336
354
|
}
|
|
337
355
|
|
|
338
356
|
isFocus && focus(this.$refs.focusInput);
|
|
339
357
|
},
|
|
340
|
-
|
|
358
|
+
onOptionMouseEnter(event) {
|
|
341
359
|
if (this.focusOnHover) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
360
|
+
if (this.dirty || (!this.dirty && isNotEmpty(this.modelValue))) {
|
|
361
|
+
this.onOptionChange({ ...event, type: 'hover' });
|
|
362
|
+
} else if (!this.dirty && event.processedOption.level === 0) {
|
|
363
|
+
this.onOptionClick({ ...event, type: 'hover' });
|
|
364
|
+
}
|
|
347
365
|
}
|
|
348
366
|
},
|
|
349
|
-
|
|
350
|
-
if (this.
|
|
351
|
-
this.
|
|
367
|
+
onOptionMouseMove(event) {
|
|
368
|
+
if (this.focused && this.focusOnHover) {
|
|
369
|
+
this.changeFocusedOptionIndex(event, event.processedOption.index);
|
|
352
370
|
}
|
|
353
371
|
},
|
|
354
372
|
onOptionSelect(event, processedOption, isHide = true) {
|
|
@@ -397,7 +415,7 @@ export default {
|
|
|
397
415
|
} else {
|
|
398
416
|
const optionIndex = this.focusedOptionInfo.index !== -1 ? this.findNextOptionIndex(this.focusedOptionInfo.index) : this.clicked ? this.findFirstOptionIndex() : this.findFirstFocusedOptionIndex();
|
|
399
417
|
|
|
400
|
-
this.changeFocusedOptionIndex(event, optionIndex);
|
|
418
|
+
this.changeFocusedOptionIndex(event, optionIndex, true);
|
|
401
419
|
}
|
|
402
420
|
|
|
403
421
|
event.preventDefault();
|
|
@@ -416,7 +434,7 @@ export default {
|
|
|
416
434
|
} else {
|
|
417
435
|
const optionIndex = this.focusedOptionInfo.index !== -1 ? this.findPrevOptionIndex(this.focusedOptionInfo.index) : this.clicked ? this.findLastOptionIndex() : this.findLastFocusedOptionIndex();
|
|
418
436
|
|
|
419
|
-
this.changeFocusedOptionIndex(event, optionIndex);
|
|
437
|
+
this.changeFocusedOptionIndex(event, optionIndex, true);
|
|
420
438
|
|
|
421
439
|
!this.overlayVisible && this.show();
|
|
422
440
|
event.preventDefault();
|
|
@@ -483,7 +501,7 @@ export default {
|
|
|
483
501
|
const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
|
|
484
502
|
const grouped = this.isProccessedOptionGroup(processedOption);
|
|
485
503
|
|
|
486
|
-
this.
|
|
504
|
+
this.onOptionClick({ originalEvent: event, processedOption, preventSelection: false });
|
|
487
505
|
!grouped && this.hide();
|
|
488
506
|
}
|
|
489
507
|
}
|
|
@@ -713,11 +731,15 @@ export default {
|
|
|
713
731
|
|
|
714
732
|
return matched;
|
|
715
733
|
},
|
|
716
|
-
changeFocusedOptionIndex(event, index) {
|
|
734
|
+
changeFocusedOptionIndex(event, index, preventSelection) {
|
|
717
735
|
if (this.focusedOptionInfo.index !== index) {
|
|
718
736
|
this.focusedOptionInfo.index = index;
|
|
719
737
|
this.scrollInView();
|
|
720
738
|
|
|
739
|
+
if (this.focusOnHover) {
|
|
740
|
+
this.onOptionClick({ originalEvent: event, processedOption: this.visibleOptions[index], isHide: false, preventSelection });
|
|
741
|
+
}
|
|
742
|
+
|
|
721
743
|
if (this.selectOnFocus) {
|
|
722
744
|
this.onOptionChange({ originalEvent: event, processedOption: this.visibleOptions[index], isHide: false });
|
|
723
745
|
}
|
|
@@ -51,9 +51,10 @@
|
|
|
51
51
|
:optionGroupIcon="optionGroupIcon"
|
|
52
52
|
:optionGroupLabel="optionGroupLabel"
|
|
53
53
|
:optionGroupChildren="optionGroupChildren"
|
|
54
|
-
|
|
55
|
-
@option-
|
|
56
|
-
@option-focus-
|
|
54
|
+
:value="value"
|
|
55
|
+
@option-change="$emit('option-change', $event)"
|
|
56
|
+
@option-focus-change="$emit('option-focus-change', $event)"
|
|
57
|
+
@option-focus-enter-change="$emit('option-focus-enter-change', $event)"
|
|
57
58
|
:pt="pt"
|
|
58
59
|
:unstyled="unstyled"
|
|
59
60
|
/>
|
|
@@ -63,11 +64,10 @@
|
|
|
63
64
|
</template>
|
|
64
65
|
|
|
65
66
|
<script>
|
|
66
|
-
import { isNotEmpty, resolveFieldData } from '@primeuix/utils/object';
|
|
67
|
+
import { equals, isNotEmpty, resolveFieldData } from '@primeuix/utils/object';
|
|
67
68
|
import BaseComponent from '@primevue/core/basecomponent';
|
|
68
69
|
import AngleRightIcon from '@primevue/icons/angleright';
|
|
69
70
|
import Ripple from 'primevue/ripple';
|
|
70
|
-
|
|
71
71
|
export default {
|
|
72
72
|
name: 'CascadeSelectSub',
|
|
73
73
|
hostName: 'CascadeSelect',
|
|
@@ -89,9 +89,9 @@ export default {
|
|
|
89
89
|
},
|
|
90
90
|
activeOptionPath: Array,
|
|
91
91
|
level: Number,
|
|
92
|
-
templates: null
|
|
92
|
+
templates: null,
|
|
93
|
+
value: null
|
|
93
94
|
},
|
|
94
|
-
|
|
95
95
|
methods: {
|
|
96
96
|
getOptionId(processedOption) {
|
|
97
97
|
return `${this.selectId}_${processedOption.key}`;
|
|
@@ -128,7 +128,7 @@ export default {
|
|
|
128
128
|
return isNotEmpty(processedOption.children);
|
|
129
129
|
},
|
|
130
130
|
isOptionSelected(processedOption) {
|
|
131
|
-
return
|
|
131
|
+
return equals(this.value, processedOption?.option);
|
|
132
132
|
},
|
|
133
133
|
isOptionActive(processedOption) {
|
|
134
134
|
return this.activeOptionPath.some((path) => path.key === processedOption.key);
|
|
@@ -148,15 +148,6 @@ export default {
|
|
|
148
148
|
onOptionMouseMove(event, processedOption) {
|
|
149
149
|
this.$emit('option-focus-change', { originalEvent: event, processedOption });
|
|
150
150
|
},
|
|
151
|
-
onOptionChange(event) {
|
|
152
|
-
this.$emit('option-change', event);
|
|
153
|
-
},
|
|
154
|
-
onOptionFocusChange(event) {
|
|
155
|
-
this.$emit('option-focus-change', event);
|
|
156
|
-
},
|
|
157
|
-
onOptionFocusEnterChange(event) {
|
|
158
|
-
this.$emit('option-focus-enter-change', event);
|
|
159
|
-
},
|
|
160
151
|
containerRef(el) {
|
|
161
152
|
this.container = el;
|
|
162
153
|
},
|
package/cascadeselect/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module cascadeselect
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
import type { DefineComponent, DesignToken, EmitFn,
|
|
10
|
+
import type { DefineComponent, DesignToken, EmitFn, HintedString, PassThrough } from '@primevue/core';
|
|
11
11
|
import type { ComponentHooks } from '@primevue/core/basecomponent';
|
|
12
12
|
import type { PassThroughOptions } from 'primevue/passthrough';
|
|
13
13
|
import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
|
|
@@ -609,7 +609,7 @@ declare const CascadeSelect: DefineComponent<CascadeSelectProps, CascadeSelectSl
|
|
|
609
609
|
|
|
610
610
|
declare module 'vue' {
|
|
611
611
|
export interface GlobalComponents {
|
|
612
|
-
CascadeSelect:
|
|
612
|
+
CascadeSelect: DefineComponent<CascadeSelectProps, CascadeSelectSlots, CascadeSelectEmits>;
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
|
package/cascadeselect/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { focus, addStyle, relativePosition, getOuterWidth, absolutePosition, isTouchDevice, findSingle } from '@primeuix/utils/dom';
|
|
2
|
-
import { resolveFieldData, isNotEmpty, isString, isPrintableCharacter, isEmpty, findLastIndex
|
|
2
|
+
import { resolveFieldData, isNotEmpty, equals, isString, isPrintableCharacter, isEmpty, findLastIndex } from '@primeuix/utils/object';
|
|
3
3
|
import { ZIndex } from '@primeuix/utils/zindex';
|
|
4
4
|
import { UniqueComponentId, ConnectedOverlayScrollHandler } from '@primevue/core/utils';
|
|
5
5
|
import AngleRightIcon from '@primevue/icons/angleright';
|
|
@@ -181,7 +181,8 @@ var script$1 = {
|
|
|
181
181
|
},
|
|
182
182
|
activeOptionPath: Array,
|
|
183
183
|
level: Number,
|
|
184
|
-
templates: null
|
|
184
|
+
templates: null,
|
|
185
|
+
value: null
|
|
185
186
|
},
|
|
186
187
|
methods: {
|
|
187
188
|
getOptionId: function getOptionId(processedOption) {
|
|
@@ -219,7 +220,7 @@ var script$1 = {
|
|
|
219
220
|
return isNotEmpty(processedOption.children);
|
|
220
221
|
},
|
|
221
222
|
isOptionSelected: function isOptionSelected(processedOption) {
|
|
222
|
-
return
|
|
223
|
+
return equals(this.value, processedOption === null || processedOption === void 0 ? void 0 : processedOption.option);
|
|
223
224
|
},
|
|
224
225
|
isOptionActive: function isOptionActive(processedOption) {
|
|
225
226
|
return this.activeOptionPath.some(function (path) {
|
|
@@ -251,15 +252,6 @@ var script$1 = {
|
|
|
251
252
|
processedOption: processedOption
|
|
252
253
|
});
|
|
253
254
|
},
|
|
254
|
-
onOptionChange: function onOptionChange(event) {
|
|
255
|
-
this.$emit('option-change', event);
|
|
256
|
-
},
|
|
257
|
-
onOptionFocusChange: function onOptionFocusChange(event) {
|
|
258
|
-
this.$emit('option-focus-change', event);
|
|
259
|
-
},
|
|
260
|
-
onOptionFocusEnterChange: function onOptionFocusEnterChange(event) {
|
|
261
|
-
this.$emit('option-focus-enter-change', event);
|
|
262
|
-
},
|
|
263
255
|
containerRef: function containerRef(el) {
|
|
264
256
|
this.container = el;
|
|
265
257
|
},
|
|
@@ -356,17 +348,30 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
356
348
|
optionGroupIcon: $props.optionGroupIcon,
|
|
357
349
|
optionGroupLabel: $props.optionGroupLabel,
|
|
358
350
|
optionGroupChildren: $props.optionGroupChildren,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
351
|
+
value: $props.value,
|
|
352
|
+
onOptionChange: _cache[0] || (_cache[0] = function ($event) {
|
|
353
|
+
return _ctx.$emit('option-change', $event);
|
|
354
|
+
}),
|
|
355
|
+
onOptionFocusChange: _cache[1] || (_cache[1] = function ($event) {
|
|
356
|
+
return _ctx.$emit('option-focus-change', $event);
|
|
357
|
+
}),
|
|
358
|
+
onOptionFocusEnterChange: _cache[2] || (_cache[2] = function ($event) {
|
|
359
|
+
return _ctx.$emit('option-focus-enter-change', $event);
|
|
360
|
+
}),
|
|
362
361
|
pt: _ctx.pt,
|
|
363
362
|
unstyled: _ctx.unstyled
|
|
364
|
-
}, null, 8, ["class", "selectId", "focusedOptionId", "options", "activeOptionPath", "level", "templates", "optionLabel", "optionValue", "optionDisabled", "optionGroupIcon", "optionGroupLabel", "optionGroupChildren", "
|
|
363
|
+
}, null, 8, ["class", "selectId", "focusedOptionId", "options", "activeOptionPath", "level", "templates", "optionLabel", "optionValue", "optionDisabled", "optionGroupIcon", "optionGroupLabel", "optionGroupChildren", "value", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_1$1);
|
|
365
364
|
}), 128))], 16);
|
|
366
365
|
}
|
|
367
366
|
|
|
368
367
|
script$1.render = render$1;
|
|
369
368
|
|
|
369
|
+
function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$1(o); }
|
|
370
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
371
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
372
|
+
function _defineProperty$1(e, r, t) { return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
373
|
+
function _toPropertyKey$1(t) { var i = _toPrimitive$1(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; }
|
|
374
|
+
function _toPrimitive$1(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
370
375
|
var script = {
|
|
371
376
|
name: 'CascadeSelect',
|
|
372
377
|
"extends": script$2,
|
|
@@ -569,11 +574,8 @@ var script = {
|
|
|
569
574
|
this.clicked = false;
|
|
570
575
|
},
|
|
571
576
|
onOptionChange: function onOptionChange(event) {
|
|
572
|
-
var
|
|
573
|
-
|
|
574
|
-
processedOption = event.processedOption,
|
|
575
|
-
isFocus = event.isFocus,
|
|
576
|
-
isHide = event.isHide;
|
|
577
|
+
var processedOption = event.processedOption,
|
|
578
|
+
type = event.type;
|
|
577
579
|
if (isEmpty(processedOption)) return;
|
|
578
580
|
var index = processedOption.index,
|
|
579
581
|
key = processedOption.key,
|
|
@@ -581,56 +583,81 @@ var script = {
|
|
|
581
583
|
parentKey = processedOption.parentKey,
|
|
582
584
|
children = processedOption.children;
|
|
583
585
|
var grouped = isNotEmpty(children);
|
|
584
|
-
var
|
|
586
|
+
var activeOptionPath = this.activeOptionPath.filter(function (p) {
|
|
587
|
+
return p.parentKey !== parentKey && p.parentKey !== key;
|
|
588
|
+
});
|
|
589
|
+
this.focusedOptionInfo = {
|
|
590
|
+
index: index,
|
|
591
|
+
level: level,
|
|
592
|
+
parentKey: parentKey
|
|
593
|
+
};
|
|
594
|
+
if (type == 'hover' && this.queryMatches) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
if (grouped) {
|
|
598
|
+
activeOptionPath.push(processedOption);
|
|
599
|
+
}
|
|
600
|
+
this.activeOptionPath = activeOptionPath;
|
|
601
|
+
},
|
|
602
|
+
onOptionClick: function onOptionClick(event) {
|
|
603
|
+
var originalEvent = event.originalEvent,
|
|
604
|
+
processedOption = event.processedOption,
|
|
605
|
+
isFocus = event.isFocus,
|
|
606
|
+
isHide = event.isHide,
|
|
607
|
+
preventSelection = event.preventSelection;
|
|
608
|
+
var index = processedOption.index,
|
|
609
|
+
key = processedOption.key,
|
|
610
|
+
level = processedOption.level,
|
|
611
|
+
parentKey = processedOption.parentKey;
|
|
612
|
+
var grouped = this.isProccessedOptionGroup(processedOption);
|
|
585
613
|
var selected = this.isSelected(processedOption);
|
|
586
614
|
if (selected) {
|
|
587
|
-
this.focusedOptionInfo = {
|
|
588
|
-
index: index,
|
|
589
|
-
level: level,
|
|
590
|
-
parentKey: parentKey
|
|
591
|
-
};
|
|
592
615
|
this.activeOptionPath = this.activeOptionPath.filter(function (p) {
|
|
593
616
|
return key !== p.key && key.startsWith(p.key);
|
|
594
617
|
});
|
|
595
|
-
this.dirty = !root;
|
|
596
|
-
} else {
|
|
597
|
-
var activeOptionPath = this.activeOptionPath.filter(function (p) {
|
|
598
|
-
return p.parentKey !== parentKey && p.parentKey !== key;
|
|
599
|
-
});
|
|
600
|
-
activeOptionPath.push(processedOption);
|
|
601
618
|
this.focusedOptionInfo = {
|
|
602
619
|
index: index,
|
|
603
620
|
level: level,
|
|
604
621
|
parentKey: parentKey
|
|
605
622
|
};
|
|
606
|
-
this.activeOptionPath = activeOptionPath;
|
|
607
|
-
}
|
|
608
|
-
if (grouped) {
|
|
609
|
-
this.dirty = true;
|
|
610
|
-
this.onOptionGroupSelect(originalEvent, processedOption);
|
|
611
623
|
} else {
|
|
612
|
-
|
|
624
|
+
if (grouped) {
|
|
625
|
+
this.onOptionChange(event);
|
|
626
|
+
this.onOptionGroupSelect(originalEvent, processedOption);
|
|
627
|
+
} else {
|
|
628
|
+
var activeOptionPath = this.activeOptionPath.filter(function (p) {
|
|
629
|
+
return p.parentKey !== parentKey;
|
|
630
|
+
});
|
|
631
|
+
activeOptionPath.push(processedOption);
|
|
632
|
+
this.focusedOptionInfo = {
|
|
633
|
+
index: index,
|
|
634
|
+
level: level,
|
|
635
|
+
parentKey: parentKey
|
|
636
|
+
};
|
|
637
|
+
if (!preventSelection || (processedOption === null || processedOption === void 0 ? void 0 : processedOption.children.length) !== 0) {
|
|
638
|
+
this.activeOptionPath = activeOptionPath;
|
|
639
|
+
this.onOptionSelect(originalEvent, processedOption, isHide);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
613
642
|
}
|
|
614
643
|
isFocus && focus(this.$refs.focusInput);
|
|
615
644
|
},
|
|
616
|
-
|
|
645
|
+
onOptionMouseEnter: function onOptionMouseEnter(event) {
|
|
617
646
|
if (this.focusOnHover) {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
};
|
|
628
|
-
this.changeFocusedOptionIndex(originalEvent, index);
|
|
647
|
+
if (this.dirty || !this.dirty && isNotEmpty(this.modelValue)) {
|
|
648
|
+
this.onOptionChange(_objectSpread$1(_objectSpread$1({}, event), {}, {
|
|
649
|
+
type: 'hover'
|
|
650
|
+
}));
|
|
651
|
+
} else if (!this.dirty && event.processedOption.level === 0) {
|
|
652
|
+
this.onOptionClick(_objectSpread$1(_objectSpread$1({}, event), {}, {
|
|
653
|
+
type: 'hover'
|
|
654
|
+
}));
|
|
655
|
+
}
|
|
629
656
|
}
|
|
630
657
|
},
|
|
631
|
-
|
|
632
|
-
if (this.
|
|
633
|
-
this.
|
|
658
|
+
onOptionMouseMove: function onOptionMouseMove(event) {
|
|
659
|
+
if (this.focused && this.focusOnHover) {
|
|
660
|
+
this.changeFocusedOptionIndex(event, event.processedOption.index);
|
|
634
661
|
}
|
|
635
662
|
},
|
|
636
663
|
onOptionSelect: function onOptionSelect(event, processedOption) {
|
|
@@ -678,7 +705,7 @@ var script = {
|
|
|
678
705
|
this.show();
|
|
679
706
|
} else {
|
|
680
707
|
var optionIndex = this.focusedOptionInfo.index !== -1 ? this.findNextOptionIndex(this.focusedOptionInfo.index) : this.clicked ? this.findFirstOptionIndex() : this.findFirstFocusedOptionIndex();
|
|
681
|
-
this.changeFocusedOptionIndex(event, optionIndex);
|
|
708
|
+
this.changeFocusedOptionIndex(event, optionIndex, true);
|
|
682
709
|
}
|
|
683
710
|
event.preventDefault();
|
|
684
711
|
},
|
|
@@ -696,7 +723,7 @@ var script = {
|
|
|
696
723
|
event.preventDefault();
|
|
697
724
|
} else {
|
|
698
725
|
var optionIndex = this.focusedOptionInfo.index !== -1 ? this.findPrevOptionIndex(this.focusedOptionInfo.index) : this.clicked ? this.findLastOptionIndex() : this.findLastFocusedOptionIndex();
|
|
699
|
-
this.changeFocusedOptionIndex(event, optionIndex);
|
|
726
|
+
this.changeFocusedOptionIndex(event, optionIndex, true);
|
|
700
727
|
!this.overlayVisible && this.show();
|
|
701
728
|
event.preventDefault();
|
|
702
729
|
}
|
|
@@ -769,9 +796,10 @@ var script = {
|
|
|
769
796
|
if (this.focusedOptionInfo.index !== -1) {
|
|
770
797
|
var processedOption = this.visibleOptions[this.focusedOptionInfo.index];
|
|
771
798
|
var grouped = this.isProccessedOptionGroup(processedOption);
|
|
772
|
-
this.
|
|
799
|
+
this.onOptionClick({
|
|
773
800
|
originalEvent: event,
|
|
774
|
-
processedOption: processedOption
|
|
801
|
+
processedOption: processedOption,
|
|
802
|
+
preventSelection: false
|
|
775
803
|
});
|
|
776
804
|
!grouped && this.hide();
|
|
777
805
|
}
|
|
@@ -1009,10 +1037,18 @@ var script = {
|
|
|
1009
1037
|
}, 500);
|
|
1010
1038
|
return matched;
|
|
1011
1039
|
},
|
|
1012
|
-
changeFocusedOptionIndex: function changeFocusedOptionIndex(event, index) {
|
|
1040
|
+
changeFocusedOptionIndex: function changeFocusedOptionIndex(event, index, preventSelection) {
|
|
1013
1041
|
if (this.focusedOptionInfo.index !== index) {
|
|
1014
1042
|
this.focusedOptionInfo.index = index;
|
|
1015
1043
|
this.scrollInView();
|
|
1044
|
+
if (this.focusOnHover) {
|
|
1045
|
+
this.onOptionClick({
|
|
1046
|
+
originalEvent: event,
|
|
1047
|
+
processedOption: this.visibleOptions[index],
|
|
1048
|
+
isHide: false,
|
|
1049
|
+
preventSelection: preventSelection
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1016
1052
|
if (this.selectOnFocus) {
|
|
1017
1053
|
this.onOptionChange({
|
|
1018
1054
|
originalEvent: event,
|
|
@@ -1277,12 +1313,13 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1277
1313
|
optionGroupIcon: _ctx.optionGroupIcon,
|
|
1278
1314
|
optionGroupLabel: _ctx.optionGroupLabel,
|
|
1279
1315
|
optionGroupChildren: _ctx.optionGroupChildren,
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1316
|
+
value: _ctx.modelValue,
|
|
1317
|
+
onOptionChange: $options.onOptionClick,
|
|
1318
|
+
onOptionFocusChange: $options.onOptionMouseMove,
|
|
1319
|
+
onOptionFocusEnterChange: $options.onOptionMouseEnter,
|
|
1283
1320
|
pt: _ctx.pt,
|
|
1284
1321
|
unstyled: _ctx.unstyled
|
|
1285
|
-
}, null, 8, ["id", "selectId", "focusedOptionId", "options", "activeOptionPath", "templates", "optionLabel", "optionValue", "optionDisabled", "optionGroupIcon", "optionGroupLabel", "optionGroupChildren", "onOptionChange", "
|
|
1322
|
+
}, null, 8, ["id", "selectId", "focusedOptionId", "options", "activeOptionPath", "templates", "optionLabel", "optionValue", "optionDisabled", "optionGroupIcon", "optionGroupLabel", "optionGroupChildren", "value", "onOptionChange", "onOptionFocusChange", "onOptionFocusEnterChange", "pt", "unstyled"])], 16), createElementVNode("span", mergeProps({
|
|
1286
1323
|
role: "status",
|
|
1287
1324
|
"aria-live": "polite",
|
|
1288
1325
|
"class": "p-hidden-accessible"
|