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 +1 @@
|
|
|
1
|
-
this.primevue=this.primevue||{},this.primevue.inputnumber=function(e,t,n){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e),r=i(t),l={name:"InputNumber",inheritAttrs:!1,emits:["update:modelValue","input","focus","blur"],props:{modelValue:{type:Number,default:null},format:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!1},buttonLayout:{type:String,default:"stacked"},incrementButtonClass:{type:String,default:null},decrementButtonClass:{type:String,default:null},incrementButtonIcon:{type:String,default:"pi pi-angle-up"},decrementButtonIcon:{type:String,default:"pi pi-angle-down"},locale:{type:String,default:void 0},localeMatcher:{type:String,default:void 0},mode:{type:String,default:"decimal"},prefix:{type:String,default:null},suffix:{type:String,default:null},currency:{type:String,default:void 0},currencyDisplay:{type:String,default:void 0},useGrouping:{type:Boolean,default:!0},minFractionDigits:{type:Number,default:void 0},maxFractionDigits:{type:Number,default:void 0},min:{type:Number,default:null},max:{type:Number,default:null},step:{type:Number,default:1},allowEmpty:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1},style:null,class:null,inputStyle:null,inputClass:null},numberFormat:null,_numeral:null,_decimal:null,_group:null,_minusSign:null,_currency:null,_suffix:null,_prefix:null,_index:null,groupChar:"",isSpecialChar:null,prefixChar:null,suffixChar:null,timer:null,data(){return{d_modelValue:this.modelValue,focused:!1}},watch:{modelValue(e){this.d_modelValue=e},locale(e,t){this.updateConstructParser(e,t)},localeMatcher(e,t){this.updateConstructParser(e,t)},mode(e,t){this.updateConstructParser(e,t)},currency(e,t){this.updateConstructParser(e,t)},currencyDisplay(e,t){this.updateConstructParser(e,t)},useGrouping(e,t){this.updateConstructParser(e,t)},minFractionDigits(e,t){this.updateConstructParser(e,t)},maxFractionDigits(e,t){this.updateConstructParser(e,t)},suffix(e,t){this.updateConstructParser(e,t)},prefix(e,t){this.updateConstructParser(e,t)}},created(){this.constructParser()},methods:{getOptions(){return{localeMatcher:this.localeMatcher,style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay,useGrouping:this.useGrouping,minimumFractionDigits:this.minFractionDigits,maximumFractionDigits:this.maxFractionDigits}},constructParser(){this.numberFormat=new Intl.NumberFormat(this.locale,this.getOptions());const e=[...new Intl.NumberFormat(this.locale,{useGrouping:!1}).format(9876543210)].reverse(),t=new Map(e.map(((e,t)=>[e,t])));this._numeral=new RegExp(`[${e.join("")}]`,"g"),this._group=this.getGroupingExpression(),this._minusSign=this.getMinusSignExpression(),this._currency=this.getCurrencyExpression(),this._decimal=this.getDecimalExpression(),this._suffix=this.getSuffixExpression(),this._prefix=this.getPrefixExpression(),this._index=e=>t.get(e)},updateConstructParser(e,t){e!==t&&this.constructParser()},escapeRegExp:e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),getDecimalExpression(){const e=new Intl.NumberFormat(this.locale,{...this.getOptions(),useGrouping:!1});return new RegExp(`[${e.format(1.1).replace(this._currency,"").trim().replace(this._numeral,"")}]`,"g")},getGroupingExpression(){const e=new Intl.NumberFormat(this.locale,{useGrouping:!0});return this.groupChar=e.format(1e6).trim().replace(this._numeral,"").charAt(0),new RegExp(`[${this.groupChar}]`,"g")},getMinusSignExpression(){const e=new Intl.NumberFormat(this.locale,{useGrouping:!1});return new RegExp(`[${e.format(-1).trim().replace(this._numeral,"")}]`,"g")},getCurrencyExpression(){if(this.currency){const e=new Intl.NumberFormat(this.locale,{style:"currency",currency:this.currency,currencyDisplay:this.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});return new RegExp(`[${e.format(1).replace(/\s/g,"").replace(this._numeral,"").replace(this._group,"")}]`,"g")}return new RegExp("[]","g")},getPrefixExpression(){if(this.prefix)this.prefixChar=this.prefix;else{const e=new Intl.NumberFormat(this.locale,{style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay});this.prefixChar=e.format(1).split("1")[0]}return new RegExp(`${this.escapeRegExp(this.prefixChar||"")}`,"g")},getSuffixExpression(){if(this.suffix)this.suffixChar=this.suffix;else{const e=new Intl.NumberFormat(this.locale,{style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});this.suffixChar=e.format(1).split("1")[1]}return new RegExp(`${this.escapeRegExp(this.suffixChar||"")}`,"g")},formatValue(e){if(null!=e){if("-"===e)return e;if(this.format){let t=new Intl.NumberFormat(this.locale,this.getOptions()).format(e);return this.prefix&&(t=this.prefix+t),this.suffix&&(t+=this.suffix),t}return e.toString()}return""},parseValue(e){let t=e.replace(this._suffix,"").replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").replace(this._group,"").replace(this._minusSign,"-").replace(this._decimal,".").replace(this._numeral,this._index);if(t){if("-"===t)return t;let e=+t;return isNaN(e)?null:e}return null},repeat(e,t,n){if(this.readonly)return;let i=t||500;this.clearTimer(),this.timer=setTimeout((()=>{this.repeat(e,40,n)}),i),this.spin(e,n)},spin(e,t){if(this.$refs.input){let n=this.step*t,i=this.parseValue(this.$refs.input.$el.value)||0,s=this.validateValue(i+n);this.updateInput(s,null,"spin"),this.updateModel(e,s),this.handleOnInput(e,i,s)}},onUpButtonMouseDown(e){this.$attrs.disabled||(this.$refs.input.$el.focus(),this.repeat(e,null,1),e.preventDefault())},onUpButtonMouseUp(){this.$attrs.disabled||this.clearTimer()},onUpButtonMouseLeave(){this.$attrs.disabled||this.clearTimer()},onUpButtonKeyUp(){this.$attrs.disabled||this.clearTimer()},onUpButtonKeyDown(e){32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,1)},onDownButtonMouseDown(e){this.$attrs.disabled||(this.$refs.input.$el.focus(),this.repeat(e,null,-1),e.preventDefault())},onDownButtonMouseUp(){this.$attrs.disabled||this.clearTimer()},onDownButtonMouseLeave(){this.$attrs.disabled||this.clearTimer()},onDownButtonKeyUp(){this.$attrs.disabled||this.clearTimer()},onDownButtonKeyDown(e){32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,-1)},onUserInput(){this.isSpecialChar&&(this.$refs.input.$el.value=this.lastValue),this.isSpecialChar=!1},onInputKeyDown(e){if(this.readonly)return;if(this.lastValue=e.target.value,e.shiftKey||e.altKey)return void(this.isSpecialChar=!0);let t=e.target.selectionStart,n=e.target.selectionEnd,i=e.target.value,s=null;switch(e.altKey&&e.preventDefault(),e.which){case 38:this.spin(e,1),e.preventDefault();break;case 40:this.spin(e,-1),e.preventDefault();break;case 37:this.isNumeralChar(i.charAt(t-1))||e.preventDefault();break;case 39:this.isNumeralChar(i.charAt(t))||e.preventDefault();break;case 9:case 13:s=this.validateValue(this.parseValue(i)),this.$refs.input.$el.value=this.formatValue(s),this.$refs.input.$el.setAttribute("aria-valuenow",s),this.updateModel(e,s);break;case 8:if(e.preventDefault(),t===n){const n=i.charAt(t-1),{decimalCharIndex:r,decimalCharIndexWithoutPrefix:l}=this.getDecimalCharIndexes(i);if(this.isNumeralChar(n)){const e=this.getDecimalLength(i);if(this._group.test(n))this._group.lastIndex=0,s=i.slice(0,t-2)+i.slice(t-1);else if(this._decimal.test(n))this._decimal.lastIndex=0,e?this.$refs.input.$el.setSelectionRange(t-1,t-1):s=i.slice(0,t-1)+i.slice(t);else if(r>0&&t>r){const n=this.isDecimalMode()&&(this.minFractionDigits||0)<e?"":"0";s=i.slice(0,t-1)+n+i.slice(t)}else 1===l?(s=i.slice(0,t-1)+"0"+i.slice(t),s=this.parseValue(s)>0?s:""):s=i.slice(0,t-1)+i.slice(t)}this.updateValue(e,s,null,"delete-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range");break;case 46:if(e.preventDefault(),t===n){const n=i.charAt(t),{decimalCharIndex:r,decimalCharIndexWithoutPrefix:l}=this.getDecimalCharIndexes(i);if(this.isNumeralChar(n)){const e=this.getDecimalLength(i);if(this._group.test(n))this._group.lastIndex=0,s=i.slice(0,t)+i.slice(t+2);else if(this._decimal.test(n))this._decimal.lastIndex=0,e?this.$refs.input.$el.setSelectionRange(t+1,t+1):s=i.slice(0,t)+i.slice(t+1);else if(r>0&&t>r){const n=this.isDecimalMode()&&(this.minFractionDigits||0)<e?"":"0";s=i.slice(0,t)+n+i.slice(t+1)}else 1===l?(s=i.slice(0,t)+"0"+i.slice(t+1),s=this.parseValue(s)>0?s:""):s=i.slice(0,t)+i.slice(t+1)}this.updateValue(e,s,null,"delete-back-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range")}},onInputKeyPress(e){if(this.readonly)return;e.preventDefault();let t=e.which||e.keyCode,n=String.fromCharCode(t);const i=this.isDecimalSign(n),s=this.isMinusSign(n);(48<=t&&t<=57||s||i)&&this.insert(e,n,{isDecimalSign:i,isMinusSign:s})},onPaste(e){e.preventDefault();let t=(e.clipboardData||window.clipboardData).getData("Text");if(t){let n=this.parseValue(t);null!=n&&this.insert(e,n.toString())}},allowMinusSign(){return null===this.min||this.min<0},isMinusSign(e){return!(!this._minusSign.test(e)&&"-"!==e)&&(this._minusSign.lastIndex=0,!0)},isDecimalSign(e){return!!this._decimal.test(e)&&(this._decimal.lastIndex=0,!0)},isDecimalMode(){return"decimal"===this.mode},getDecimalCharIndexes(e){let t=e.search(this._decimal);this._decimal.lastIndex=0;const n=e.replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").search(this._decimal);return this._decimal.lastIndex=0,{decimalCharIndex:t,decimalCharIndexWithoutPrefix:n}},getCharIndexes(e){const t=e.search(this._decimal);this._decimal.lastIndex=0;const n=e.search(this._minusSign);this._minusSign.lastIndex=0;const i=e.search(this._suffix);this._suffix.lastIndex=0;const s=e.search(this._currency);return this._currency.lastIndex=0,{decimalCharIndex:t,minusCharIndex:n,suffixCharIndex:i,currencyCharIndex:s}},insert(e,t,n={isDecimalSign:!1,isMinusSign:!1}){const i=t.search(this._minusSign);if(this._minusSign.lastIndex=0,!this.allowMinusSign()&&-1!==i)return;const s=this.$refs.input.$el.selectionStart,r=this.$refs.input.$el.selectionEnd;let l=this.$refs.input.$el.value.trim();const{decimalCharIndex:u,minusCharIndex:a,suffixCharIndex:o,currencyCharIndex:p}=this.getCharIndexes(l);let h;if(n.isMinusSign)0===s&&(h=l,-1!==a&&0===r||(h=this.insertText(l,t,0,r)),this.updateValue(e,h,t,"insert"));else if(n.isDecimalSign)u>0&&s===u?this.updateValue(e,l,t,"insert"):(u>s&&u<r||-1===u&&this.maxFractionDigits)&&(h=this.insertText(l,t,s,r),this.updateValue(e,h,t,"insert"));else{const n=this.numberFormat.resolvedOptions().maximumFractionDigits,i=s!==r?"range-insert":"insert";if(u>0&&s>u){if(s+t.length-(u+1)<=n){const n=p>=s?p-1:o>=s?o:l.length;h=l.slice(0,s)+t+l.slice(s+t.length,n)+l.slice(n),this.updateValue(e,h,t,i)}}else h=this.insertText(l,t,s,r),this.updateValue(e,h,t,i)}},insertText(e,t,n,i){if(2===("."===t?t:t.split(".")).length){const s=e.slice(n,i).search(this._decimal);return this._decimal.lastIndex=0,s>0?e.slice(0,n)+this.formatValue(t)+e.slice(i):e||this.formatValue(t)}return i-n===e.length?this.formatValue(t):0===n?t+e.slice(i):i===e.length?e.slice(0,n)+t:e.slice(0,n)+t+e.slice(i)},deleteRange(e,t,n){let i;return i=n-t===e.length?"":0===t?e.slice(n):n===e.length?e.slice(0,t):e.slice(0,t)+e.slice(n),i},initCursor(){let e=this.$refs.input.$el.selectionStart,t=this.$refs.input.$el.value,n=t.length,i=null,s=(this.prefixChar||"").length;t=t.replace(this._prefix,""),e-=s;let r=t.charAt(e);if(this.isNumeralChar(r))return e+s;let l=e-1;for(;l>=0;){if(r=t.charAt(l),this.isNumeralChar(r)){i=l+s;break}l--}if(null!==i)this.$refs.input.$el.setSelectionRange(i+1,i+1);else{for(l=e;l<n;){if(r=t.charAt(l),this.isNumeralChar(r)){i=l+s;break}l++}null!==i&&this.$refs.input.$el.setSelectionRange(i,i)}return i||0},onInputClick(){this.readonly||this.initCursor()},isNumeralChar(e){return!(1!==e.length||!(this._numeral.test(e)||this._decimal.test(e)||this._group.test(e)||this._minusSign.test(e)))&&(this.resetRegex(),!0)},resetRegex(){this._numeral.lastIndex=0,this._decimal.lastIndex=0,this._group.lastIndex=0,this._minusSign.lastIndex=0},updateValue(e,t,n,i){let s=this.$refs.input.$el.value,r=null;null!=t&&(r=this.parseValue(t),r=r||this.allowEmpty?r:0,this.updateInput(r,n,i,t),this.handleOnInput(e,s,r))},handleOnInput(e,t,n){this.isValueChanged(t,n)&&this.$emit("input",{originalEvent:e,value:n})},isValueChanged(e,t){if(null===t&&null!==e)return!0;if(null!=t){return t!==("string"==typeof e?this.parseValue(e):e)}return!1},validateValue(e){return"-"===e||null==e?null:null!=this.min&&e<this.min?this.min:null!=this.max&&e>this.max?this.max:e},updateInput(e,t,n,i){t=t||"";let s=this.$refs.input.$el.value,r=this.formatValue(e),l=s.length;if(r!==i&&(r=this.concatValues(r,i)),0===l){this.$refs.input.$el.value=r,this.$refs.input.$el.setSelectionRange(0,0);const e=this.initCursor()+t.length;this.$refs.input.$el.setSelectionRange(e,e)}else{let e=this.$refs.input.$el.selectionStart,i=this.$refs.input.$el.selectionEnd;this.$refs.input.$el.value=r;let u=r.length;if("range-insert"===n){const n=this.parseValue((s||"").slice(0,e)),l=(null!==n?n.toString():"").split("").join(`(${this.groupChar})?`),u=new RegExp(l,"g");u.test(r);const a=t.split("").join(`(${this.groupChar})?`),o=new RegExp(a,"g");o.test(r.slice(u.lastIndex)),i=u.lastIndex+o.lastIndex,this.$refs.input.$el.setSelectionRange(i,i)}else if(u===l)"insert"===n||"delete-back-single"===n?this.$refs.input.$el.setSelectionRange(i+1,i+1):"delete-single"===n?this.$refs.input.$el.setSelectionRange(i-1,i-1):"delete-range"!==n&&"spin"!==n||this.$refs.input.$el.setSelectionRange(i,i);else if("delete-back-single"===n){let e=s.charAt(i-1),t=s.charAt(i),n=l-u,r=this._group.test(t);r&&1===n?i+=1:!r&&this.isNumeralChar(e)&&(i+=-1*n+1),this._group.lastIndex=0,this.$refs.input.$el.setSelectionRange(i,i)}else if("-"===s&&"insert"===n){this.$refs.input.$el.setSelectionRange(0,0);const e=this.initCursor()+t.length+1;this.$refs.input.$el.setSelectionRange(e,e)}else i+=u-l,this.$refs.input.$el.setSelectionRange(i,i)}this.$refs.input.$el.setAttribute("aria-valuenow",e)},concatValues(e,t){if(e&&t){let n=t.search(this._decimal);return this._decimal.lastIndex=0,-1!==n?e.split(this._decimal)[0]+t.slice(n):e}return e},getDecimalLength(e){if(e){const t=e.split(this._decimal);if(2===t.length)return t[1].replace(this._suffix,"").trim().replace(/\s/g,"").replace(this._currency,"").length}return 0},updateModel(e,t){this.d_modelValue=t,this.$emit("update:modelValue",t)},onInputFocus(e){this.focused=!0,this.$emit("focus",e)},onInputBlur(e){this.focused=!1;let t=e.target,n=this.validateValue(this.parseValue(t.value));this.$emit("blur",{originalEvent:e,value:t.value}),t.value=this.formatValue(n),t.setAttribute("aria-valuenow",n),this.updateModel(e,n)},clearTimer(){this.timer&&clearInterval(this.timer)},maxBoundry(){return this.d_modelValue>=this.max},minBoundry(){return this.d_modelValue<=this.min}},computed:{containerClass(){return["p-inputnumber p-component p-inputwrapper",this.class,{"p-inputwrapper-filled":this.filled,"p-inputwrapper-focus":this.focused,"p-inputnumber-buttons-stacked":this.showButtons&&"stacked"===this.buttonLayout,"p-inputnumber-buttons-horizontal":this.showButtons&&"horizontal"===this.buttonLayout,"p-inputnumber-buttons-vertical":this.showButtons&&"vertical"===this.buttonLayout}]},upButtonClass(){return["p-inputnumber-button p-inputnumber-button-up",this.incrementButtonClass,{"p-disabled":this.showButtons&&null!==this.max&&this.maxBoundry()}]},downButtonClass(){return["p-inputnumber-button p-inputnumber-button-down",this.decrementButtonClass,{"p-disabled":this.showButtons&&null!==this.min&&this.minBoundry()}]},filled(){return null!=this.modelValue&&this.modelValue.toString().length>0},upButtonListeners(){return{mousedown:e=>this.onUpButtonMouseDown(e),mouseup:e=>this.onUpButtonMouseUp(e),mouseleave:e=>this.onUpButtonMouseLeave(e),keydown:e=>this.onUpButtonKeyDown(e),keyup:e=>this.onUpButtonKeyUp(e)}},downButtonListeners(){return{mousedown:e=>this.onDownButtonMouseDown(e),mouseup:e=>this.onDownButtonMouseUp(e),mouseleave:e=>this.onDownButtonMouseLeave(e),keydown:e=>this.onDownButtonKeyDown(e),keyup:e=>this.onDownButtonKeyUp(e)}},formattedValue(){const e=this.modelValue||this.allowEmpty?this.modelValue:0;return this.formatValue(e)},getFormatter(){return this.numberFormat}},components:{INInputText:s.default,INButton:r.default}};const u={key:0,class:"p-inputnumber-button-group"};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("\n.p-inputnumber {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-inputnumber-button {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.p-inputnumber-buttons-stacked .p-button.p-inputnumber-button .p-button-label,\n.p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button .p-button-label {\n display: none;\n}\n.p-inputnumber-buttons-stacked .p-button.p-inputnumber-button-up {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n padding: 0;\n}\n.p-inputnumber-buttons-stacked .p-inputnumber-input {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-inputnumber-buttons-stacked .p-button.p-inputnumber-button-down {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-left-radius: 0;\n padding: 0;\n}\n.p-inputnumber-buttons-stacked .p-inputnumber-button-group {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-inputnumber-buttons-stacked .p-inputnumber-button-group .p-button.p-inputnumber-button {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n.p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button-up {\n -webkit-box-ordinal-group: 4;\n -ms-flex-order: 3;\n order: 3;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.p-inputnumber-buttons-horizontal .p-inputnumber-input {\n -webkit-box-ordinal-group: 3;\n -ms-flex-order: 2;\n order: 2;\n border-radius: 0;\n}\n.p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button-down {\n -webkit-box-ordinal-group: 2;\n -ms-flex-order: 1;\n order: 1;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-inputnumber-buttons-vertical {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-inputnumber-buttons-vertical .p-button.p-inputnumber-button-up {\n -webkit-box-ordinal-group: 2;\n -ms-flex-order: 1;\n order: 1;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n width: 100%;\n}\n.p-inputnumber-buttons-vertical .p-inputnumber-input {\n -webkit-box-ordinal-group: 3;\n -ms-flex-order: 2;\n order: 2;\n border-radius: 0;\n text-align: center;\n}\n.p-inputnumber-buttons-vertical .p-button.p-inputnumber-button-down {\n -webkit-box-ordinal-group: 4;\n -ms-flex-order: 3;\n order: 3;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n width: 100%;\n}\n.p-inputnumber-input {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n.p-fluid .p-inputnumber {\n width: 100%;\n}\n.p-fluid .p-inputnumber .p-inputnumber-input {\n width: 1%;\n}\n.p-fluid .p-inputnumber-buttons-vertical .p-inputnumber-input {\n width: 100%;\n}\n"),l.render=function(e,t,i,s,r,l){const a=n.resolveComponent("INInputText"),o=n.resolveComponent("INButton");return n.openBlock(),n.createElementBlock("span",{class:n.normalizeClass(l.containerClass),style:n.normalizeStyle(i.style)},[n.createVNode(a,n.mergeProps({ref:"input",class:["p-inputnumber-input",i.inputClass],style:i.inputStyle,value:l.formattedValue},e.$attrs,{"aria-valumin":i.min,"aria-valuemax":i.max,readonly:i.readonly,onInput:l.onUserInput,onKeydown:l.onInputKeyDown,onKeypress:l.onInputKeyPress,onPaste:l.onPaste,onClick:l.onInputClick,onFocus:l.onInputFocus,onBlur:l.onInputBlur}),null,16,["class","style","value","aria-valumin","aria-valuemax","readonly","onInput","onKeydown","onKeypress","onPaste","onClick","onFocus","onBlur"]),i.showButtons&&"stacked"===i.buttonLayout?(n.openBlock(),n.createElementBlock("span",u,[n.createVNode(o,n.mergeProps({class:l.upButtonClass,icon:i.incrementButtonIcon},n.toHandlers(l.upButtonListeners),{disabled:e.$attrs.disabled}),null,16,["class","icon","disabled"]),n.createVNode(o,n.mergeProps({class:l.downButtonClass,icon:i.decrementButtonIcon},n.toHandlers(l.downButtonListeners),{disabled:e.$attrs.disabled}),null,16,["class","icon","disabled"])])):n.createCommentVNode("",!0),i.showButtons&&"stacked"!==i.buttonLayout?(n.openBlock(),n.createBlock(o,n.mergeProps({key:1,class:l.upButtonClass,icon:i.incrementButtonIcon},n.toHandlers(l.upButtonListeners),{disabled:e.$attrs.disabled}),null,16,["class","icon","disabled"])):n.createCommentVNode("",!0),i.showButtons&&"stacked"!==i.buttonLayout?(n.openBlock(),n.createBlock(o,n.mergeProps({key:2,class:l.downButtonClass,icon:i.decrementButtonIcon},n.toHandlers(l.downButtonListeners),{disabled:e.$attrs.disabled}),null,16,["class","icon","disabled"])):n.createCommentVNode("",!0)],6)},l}(primevue.inputtext,primevue.button,Vue);
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.inputnumber=function(e,t,n){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(e),r=i(t),l={name:"InputNumber",emits:["update:modelValue","input","focus","blur"],props:{modelValue:{type:Number,default:null},format:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!1},buttonLayout:{type:String,default:"stacked"},incrementButtonClass:{type:String,default:null},decrementButtonClass:{type:String,default:null},incrementButtonIcon:{type:String,default:"pi pi-angle-up"},decrementButtonIcon:{type:String,default:"pi pi-angle-down"},locale:{type:String,default:void 0},localeMatcher:{type:String,default:void 0},mode:{type:String,default:"decimal"},prefix:{type:String,default:null},suffix:{type:String,default:null},currency:{type:String,default:void 0},currencyDisplay:{type:String,default:void 0},useGrouping:{type:Boolean,default:!0},minFractionDigits:{type:Number,default:void 0},maxFractionDigits:{type:Number,default:void 0},min:{type:Number,default:null},max:{type:Number,default:null},step:{type:Number,default:1},allowEmpty:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:null},inputId:null,inputClass:null,inputStyle:null,inputProps:null,incrementButtonProps:null,decrementButtonProps:null,"aria-labelledby":{type:String,default:null},"aria-label":{type:String,default:null}},numberFormat:null,_numeral:null,_decimal:null,_group:null,_minusSign:null,_currency:null,_suffix:null,_prefix:null,_index:null,groupChar:"",isSpecialChar:null,prefixChar:null,suffixChar:null,timer:null,data(){return{d_modelValue:this.modelValue,focused:!1}},watch:{modelValue(e){this.d_modelValue=e},locale(e,t){this.updateConstructParser(e,t)},localeMatcher(e,t){this.updateConstructParser(e,t)},mode(e,t){this.updateConstructParser(e,t)},currency(e,t){this.updateConstructParser(e,t)},currencyDisplay(e,t){this.updateConstructParser(e,t)},useGrouping(e,t){this.updateConstructParser(e,t)},minFractionDigits(e,t){this.updateConstructParser(e,t)},maxFractionDigits(e,t){this.updateConstructParser(e,t)},suffix(e,t){this.updateConstructParser(e,t)},prefix(e,t){this.updateConstructParser(e,t)}},created(){this.constructParser()},methods:{getOptions(){return{localeMatcher:this.localeMatcher,style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay,useGrouping:this.useGrouping,minimumFractionDigits:this.minFractionDigits,maximumFractionDigits:this.maxFractionDigits}},constructParser(){this.numberFormat=new Intl.NumberFormat(this.locale,this.getOptions());const e=[...new Intl.NumberFormat(this.locale,{useGrouping:!1}).format(9876543210)].reverse(),t=new Map(e.map(((e,t)=>[e,t])));this._numeral=new RegExp(`[${e.join("")}]`,"g"),this._group=this.getGroupingExpression(),this._minusSign=this.getMinusSignExpression(),this._currency=this.getCurrencyExpression(),this._decimal=this.getDecimalExpression(),this._suffix=this.getSuffixExpression(),this._prefix=this.getPrefixExpression(),this._index=e=>t.get(e)},updateConstructParser(e,t){e!==t&&this.constructParser()},escapeRegExp:e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),getDecimalExpression(){const e=new Intl.NumberFormat(this.locale,{...this.getOptions(),useGrouping:!1});return new RegExp(`[${e.format(1.1).replace(this._currency,"").trim().replace(this._numeral,"")}]`,"g")},getGroupingExpression(){const e=new Intl.NumberFormat(this.locale,{useGrouping:!0});return this.groupChar=e.format(1e6).trim().replace(this._numeral,"").charAt(0),new RegExp(`[${this.groupChar}]`,"g")},getMinusSignExpression(){const e=new Intl.NumberFormat(this.locale,{useGrouping:!1});return new RegExp(`[${e.format(-1).trim().replace(this._numeral,"")}]`,"g")},getCurrencyExpression(){if(this.currency){const e=new Intl.NumberFormat(this.locale,{style:"currency",currency:this.currency,currencyDisplay:this.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});return new RegExp(`[${e.format(1).replace(/\s/g,"").replace(this._numeral,"").replace(this._group,"")}]`,"g")}return new RegExp("[]","g")},getPrefixExpression(){if(this.prefix)this.prefixChar=this.prefix;else{const e=new Intl.NumberFormat(this.locale,{style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay});this.prefixChar=e.format(1).split("1")[0]}return new RegExp(`${this.escapeRegExp(this.prefixChar||"")}`,"g")},getSuffixExpression(){if(this.suffix)this.suffixChar=this.suffix;else{const e=new Intl.NumberFormat(this.locale,{style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});this.suffixChar=e.format(1).split("1")[1]}return new RegExp(`${this.escapeRegExp(this.suffixChar||"")}`,"g")},formatValue(e){if(null!=e){if("-"===e)return e;if(this.format){let t=new Intl.NumberFormat(this.locale,this.getOptions()).format(e);return this.prefix&&(t=this.prefix+t),this.suffix&&(t+=this.suffix),t}return e.toString()}return""},parseValue(e){let t=e.replace(this._suffix,"").replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").replace(this._group,"").replace(this._minusSign,"-").replace(this._decimal,".").replace(this._numeral,this._index);if(t){if("-"===t)return t;let e=+t;return isNaN(e)?null:e}return null},repeat(e,t,n){if(this.readonly)return;let i=t||500;this.clearTimer(),this.timer=setTimeout((()=>{this.repeat(e,40,n)}),i),this.spin(e,n)},spin(e,t){if(this.$refs.input){let n=this.step*t,i=this.parseValue(this.$refs.input.$el.value)||0,s=this.validateValue(i+n);this.updateInput(s,null,"spin"),this.updateModel(e,s),this.handleOnInput(e,i,s)}},onUpButtonMouseDown(e){this.disabled||(this.$refs.input.$el.focus(),this.repeat(e,null,1),e.preventDefault())},onUpButtonMouseUp(){this.disabled||this.clearTimer()},onUpButtonMouseLeave(){this.disabled||this.clearTimer()},onUpButtonKeyUp(){this.disabled||this.clearTimer()},onUpButtonKeyDown(e){32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,1)},onDownButtonMouseDown(e){this.disabled||(this.$refs.input.$el.focus(),this.repeat(e,null,-1),e.preventDefault())},onDownButtonMouseUp(){this.disabled||this.clearTimer()},onDownButtonMouseLeave(){this.disabled||this.clearTimer()},onDownButtonKeyUp(){this.disabled||this.clearTimer()},onDownButtonKeyDown(e){32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,-1)},onUserInput(){this.isSpecialChar&&(this.$refs.input.$el.value=this.lastValue),this.isSpecialChar=!1},onInputKeyDown(e){if(this.readonly)return;if(this.lastValue=e.target.value,e.shiftKey||e.altKey)return void(this.isSpecialChar=!0);let t=e.target.selectionStart,n=e.target.selectionEnd,i=e.target.value,s=null;switch(e.altKey&&e.preventDefault(),e.which){case 38:this.spin(e,1),e.preventDefault();break;case 40:this.spin(e,-1),e.preventDefault();break;case 37:this.isNumeralChar(i.charAt(t-1))||e.preventDefault();break;case 39:this.isNumeralChar(i.charAt(t))||e.preventDefault();break;case 9:case 13:s=this.validateValue(this.parseValue(i)),this.$refs.input.$el.value=this.formatValue(s),this.$refs.input.$el.setAttribute("aria-valuenow",s),this.updateModel(e,s);break;case 8:if(e.preventDefault(),t===n){const n=i.charAt(t-1),{decimalCharIndex:r,decimalCharIndexWithoutPrefix:l}=this.getDecimalCharIndexes(i);if(this.isNumeralChar(n)){const e=this.getDecimalLength(i);if(this._group.test(n))this._group.lastIndex=0,s=i.slice(0,t-2)+i.slice(t-1);else if(this._decimal.test(n))this._decimal.lastIndex=0,e?this.$refs.input.$el.setSelectionRange(t-1,t-1):s=i.slice(0,t-1)+i.slice(t);else if(r>0&&t>r){const n=this.isDecimalMode()&&(this.minFractionDigits||0)<e?"":"0";s=i.slice(0,t-1)+n+i.slice(t)}else 1===l?(s=i.slice(0,t-1)+"0"+i.slice(t),s=this.parseValue(s)>0?s:""):s=i.slice(0,t-1)+i.slice(t)}this.updateValue(e,s,null,"delete-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range");break;case 46:if(e.preventDefault(),t===n){const n=i.charAt(t),{decimalCharIndex:r,decimalCharIndexWithoutPrefix:l}=this.getDecimalCharIndexes(i);if(this.isNumeralChar(n)){const e=this.getDecimalLength(i);if(this._group.test(n))this._group.lastIndex=0,s=i.slice(0,t)+i.slice(t+2);else if(this._decimal.test(n))this._decimal.lastIndex=0,e?this.$refs.input.$el.setSelectionRange(t+1,t+1):s=i.slice(0,t)+i.slice(t+1);else if(r>0&&t>r){const n=this.isDecimalMode()&&(this.minFractionDigits||0)<e?"":"0";s=i.slice(0,t)+n+i.slice(t+1)}else 1===l?(s=i.slice(0,t)+"0"+i.slice(t+1),s=this.parseValue(s)>0?s:""):s=i.slice(0,t)+i.slice(t+1)}this.updateValue(e,s,null,"delete-back-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range");break;case 36:this.min&&(this.updateModel(e,this.min),e.preventDefault());break;case 35:this.max&&(this.updateModel(e,this.max),e.preventDefault())}},onInputKeyPress(e){if(this.readonly)return;e.preventDefault();let t=e.which||e.keyCode,n=String.fromCharCode(t);const i=this.isDecimalSign(n),s=this.isMinusSign(n);(48<=t&&t<=57||s||i)&&this.insert(e,n,{isDecimalSign:i,isMinusSign:s})},onPaste(e){e.preventDefault();let t=(e.clipboardData||window.clipboardData).getData("Text");if(t){let n=this.parseValue(t);null!=n&&this.insert(e,n.toString())}},allowMinusSign(){return null===this.min||this.min<0},isMinusSign(e){return!(!this._minusSign.test(e)&&"-"!==e)&&(this._minusSign.lastIndex=0,!0)},isDecimalSign(e){return!!this._decimal.test(e)&&(this._decimal.lastIndex=0,!0)},isDecimalMode(){return"decimal"===this.mode},getDecimalCharIndexes(e){let t=e.search(this._decimal);this._decimal.lastIndex=0;const n=e.replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").search(this._decimal);return this._decimal.lastIndex=0,{decimalCharIndex:t,decimalCharIndexWithoutPrefix:n}},getCharIndexes(e){const t=e.search(this._decimal);this._decimal.lastIndex=0;const n=e.search(this._minusSign);this._minusSign.lastIndex=0;const i=e.search(this._suffix);this._suffix.lastIndex=0;const s=e.search(this._currency);return this._currency.lastIndex=0,{decimalCharIndex:t,minusCharIndex:n,suffixCharIndex:i,currencyCharIndex:s}},insert(e,t,n={isDecimalSign:!1,isMinusSign:!1}){const i=t.search(this._minusSign);if(this._minusSign.lastIndex=0,!this.allowMinusSign()&&-1!==i)return;const s=this.$refs.input.$el.selectionStart,r=this.$refs.input.$el.selectionEnd;let l=this.$refs.input.$el.value.trim();const{decimalCharIndex:u,minusCharIndex:a,suffixCharIndex:o,currencyCharIndex:p}=this.getCharIndexes(l);let h;if(n.isMinusSign)0===s&&(h=l,-1!==a&&0===r||(h=this.insertText(l,t,0,r)),this.updateValue(e,h,t,"insert"));else if(n.isDecimalSign)u>0&&s===u?this.updateValue(e,l,t,"insert"):(u>s&&u<r||-1===u&&this.maxFractionDigits)&&(h=this.insertText(l,t,s,r),this.updateValue(e,h,t,"insert"));else{const n=this.numberFormat.resolvedOptions().maximumFractionDigits,i=s!==r?"range-insert":"insert";if(u>0&&s>u){if(s+t.length-(u+1)<=n){const n=p>=s?p-1:o>=s?o:l.length;h=l.slice(0,s)+t+l.slice(s+t.length,n)+l.slice(n),this.updateValue(e,h,t,i)}}else h=this.insertText(l,t,s,r),this.updateValue(e,h,t,i)}},insertText(e,t,n,i){if(2===("."===t?t:t.split(".")).length){const s=e.slice(n,i).search(this._decimal);return this._decimal.lastIndex=0,s>0?e.slice(0,n)+this.formatValue(t)+e.slice(i):e||this.formatValue(t)}return i-n===e.length?this.formatValue(t):0===n?t+e.slice(i):i===e.length?e.slice(0,n)+t:e.slice(0,n)+t+e.slice(i)},deleteRange(e,t,n){let i;return i=n-t===e.length?"":0===t?e.slice(n):n===e.length?e.slice(0,t):e.slice(0,t)+e.slice(n),i},initCursor(){let e=this.$refs.input.$el.selectionStart,t=this.$refs.input.$el.value,n=t.length,i=null,s=(this.prefixChar||"").length;t=t.replace(this._prefix,""),e-=s;let r=t.charAt(e);if(this.isNumeralChar(r))return e+s;let l=e-1;for(;l>=0;){if(r=t.charAt(l),this.isNumeralChar(r)){i=l+s;break}l--}if(null!==i)this.$refs.input.$el.setSelectionRange(i+1,i+1);else{for(l=e;l<n;){if(r=t.charAt(l),this.isNumeralChar(r)){i=l+s;break}l++}null!==i&&this.$refs.input.$el.setSelectionRange(i,i)}return i||0},onInputClick(){this.readonly||this.initCursor()},isNumeralChar(e){return!(1!==e.length||!(this._numeral.test(e)||this._decimal.test(e)||this._group.test(e)||this._minusSign.test(e)))&&(this.resetRegex(),!0)},resetRegex(){this._numeral.lastIndex=0,this._decimal.lastIndex=0,this._group.lastIndex=0,this._minusSign.lastIndex=0},updateValue(e,t,n,i){let s=this.$refs.input.$el.value,r=null;null!=t&&(r=this.parseValue(t),r=r||this.allowEmpty?r:0,this.updateInput(r,n,i,t),this.handleOnInput(e,s,r))},handleOnInput(e,t,n){this.isValueChanged(t,n)&&this.$emit("input",{originalEvent:e,value:n})},isValueChanged(e,t){if(null===t&&null!==e)return!0;if(null!=t){return t!==("string"==typeof e?this.parseValue(e):e)}return!1},validateValue(e){return"-"===e||null==e?null:null!=this.min&&e<this.min?this.min:null!=this.max&&e>this.max?this.max:e},updateInput(e,t,n,i){t=t||"";let s=this.$refs.input.$el.value,r=this.formatValue(e),l=s.length;if(r!==i&&(r=this.concatValues(r,i)),0===l){this.$refs.input.$el.value=r,this.$refs.input.$el.setSelectionRange(0,0);const e=this.initCursor()+t.length;this.$refs.input.$el.setSelectionRange(e,e)}else{let e=this.$refs.input.$el.selectionStart,i=this.$refs.input.$el.selectionEnd;this.$refs.input.$el.value=r;let u=r.length;if("range-insert"===n){const n=this.parseValue((s||"").slice(0,e)),l=(null!==n?n.toString():"").split("").join(`(${this.groupChar})?`),u=new RegExp(l,"g");u.test(r);const a=t.split("").join(`(${this.groupChar})?`),o=new RegExp(a,"g");o.test(r.slice(u.lastIndex)),i=u.lastIndex+o.lastIndex,this.$refs.input.$el.setSelectionRange(i,i)}else if(u===l)"insert"===n||"delete-back-single"===n?this.$refs.input.$el.setSelectionRange(i+1,i+1):"delete-single"===n?this.$refs.input.$el.setSelectionRange(i-1,i-1):"delete-range"!==n&&"spin"!==n||this.$refs.input.$el.setSelectionRange(i,i);else if("delete-back-single"===n){let e=s.charAt(i-1),t=s.charAt(i),n=l-u,r=this._group.test(t);r&&1===n?i+=1:!r&&this.isNumeralChar(e)&&(i+=-1*n+1),this._group.lastIndex=0,this.$refs.input.$el.setSelectionRange(i,i)}else if("-"===s&&"insert"===n){this.$refs.input.$el.setSelectionRange(0,0);const e=this.initCursor()+t.length+1;this.$refs.input.$el.setSelectionRange(e,e)}else i+=u-l,this.$refs.input.$el.setSelectionRange(i,i)}this.$refs.input.$el.setAttribute("aria-valuenow",e)},concatValues(e,t){if(e&&t){let n=t.search(this._decimal);return this._decimal.lastIndex=0,-1!==n?e.split(this._decimal)[0]+t.slice(n):e}return e},getDecimalLength(e){if(e){const t=e.split(this._decimal);if(2===t.length)return t[1].replace(this._suffix,"").trim().replace(/\s/g,"").replace(this._currency,"").length}return 0},updateModel(e,t){this.d_modelValue=t,this.$emit("update:modelValue",t)},onInputFocus(e){this.focused=!0,this.$emit("focus",e)},onInputBlur(e){this.focused=!1;let t=e.target,n=this.validateValue(this.parseValue(t.value));this.$emit("blur",{originalEvent:e,value:t.value}),t.value=this.formatValue(n),t.setAttribute("aria-valuenow",n),this.updateModel(e,n)},clearTimer(){this.timer&&clearInterval(this.timer)},maxBoundry(){return this.d_modelValue>=this.max},minBoundry(){return this.d_modelValue<=this.min}},computed:{containerClass(){return["p-inputnumber p-component p-inputwrapper",{"p-inputwrapper-filled":this.filled,"p-inputwrapper-focus":this.focused,"p-inputnumber-buttons-stacked":this.showButtons&&"stacked"===this.buttonLayout,"p-inputnumber-buttons-horizontal":this.showButtons&&"horizontal"===this.buttonLayout,"p-inputnumber-buttons-vertical":this.showButtons&&"vertical"===this.buttonLayout}]},upButtonClass(){return["p-inputnumber-button p-inputnumber-button-up",this.incrementButtonClass,{"p-disabled":this.showButtons&&null!==this.max&&this.maxBoundry()}]},downButtonClass(){return["p-inputnumber-button p-inputnumber-button-down",this.decrementButtonClass,{"p-disabled":this.showButtons&&null!==this.min&&this.minBoundry()}]},filled(){return null!=this.modelValue&&this.modelValue.toString().length>0},upButtonListeners(){return{mousedown:e=>this.onUpButtonMouseDown(e),mouseup:e=>this.onUpButtonMouseUp(e),mouseleave:e=>this.onUpButtonMouseLeave(e),keydown:e=>this.onUpButtonKeyDown(e),keyup:e=>this.onUpButtonKeyUp(e)}},downButtonListeners(){return{mousedown:e=>this.onDownButtonMouseDown(e),mouseup:e=>this.onDownButtonMouseUp(e),mouseleave:e=>this.onDownButtonMouseLeave(e),keydown:e=>this.onDownButtonKeyDown(e),keyup:e=>this.onDownButtonKeyUp(e)}},formattedValue(){const e=this.modelValue||this.allowEmpty?this.modelValue:0;return this.formatValue(e)},getFormatter(){return this.numberFormat}},components:{INInputText:s.default,INButton:r.default}};const u={key:0,class:"p-inputnumber-button-group"};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("\n.p-inputnumber {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-inputnumber-button {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.p-inputnumber-buttons-stacked .p-button.p-inputnumber-button .p-button-label,\n.p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button .p-button-label {\n display: none;\n}\n.p-inputnumber-buttons-stacked .p-button.p-inputnumber-button-up {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n padding: 0;\n}\n.p-inputnumber-buttons-stacked .p-inputnumber-input {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-inputnumber-buttons-stacked .p-button.p-inputnumber-button-down {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-left-radius: 0;\n padding: 0;\n}\n.p-inputnumber-buttons-stacked .p-inputnumber-button-group {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-inputnumber-buttons-stacked .p-inputnumber-button-group .p-button.p-inputnumber-button {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n.p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button-up {\n -webkit-box-ordinal-group: 4;\n -ms-flex-order: 3;\n order: 3;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.p-inputnumber-buttons-horizontal .p-inputnumber-input {\n -webkit-box-ordinal-group: 3;\n -ms-flex-order: 2;\n order: 2;\n border-radius: 0;\n}\n.p-inputnumber-buttons-horizontal .p-button.p-inputnumber-button-down {\n -webkit-box-ordinal-group: 2;\n -ms-flex-order: 1;\n order: 1;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-inputnumber-buttons-vertical {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-inputnumber-buttons-vertical .p-button.p-inputnumber-button-up {\n -webkit-box-ordinal-group: 2;\n -ms-flex-order: 1;\n order: 1;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n width: 100%;\n}\n.p-inputnumber-buttons-vertical .p-inputnumber-input {\n -webkit-box-ordinal-group: 3;\n -ms-flex-order: 2;\n order: 2;\n border-radius: 0;\n text-align: center;\n}\n.p-inputnumber-buttons-vertical .p-button.p-inputnumber-button-down {\n -webkit-box-ordinal-group: 4;\n -ms-flex-order: 3;\n order: 3;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n width: 100%;\n}\n.p-inputnumber-input {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n.p-fluid .p-inputnumber {\n width: 100%;\n}\n.p-fluid .p-inputnumber .p-inputnumber-input {\n width: 1%;\n}\n.p-fluid .p-inputnumber-buttons-vertical .p-inputnumber-input {\n width: 100%;\n}\n"),l.render=function(e,t,i,s,r,l){const a=n.resolveComponent("INInputText"),o=n.resolveComponent("INButton");return n.openBlock(),n.createElementBlock("span",{class:n.normalizeClass(l.containerClass)},[n.createVNode(a,n.mergeProps({ref:"input",class:["p-inputnumber-input",i.inputClass],role:"spinbutton",id:i.inputId,style:i.inputStyle,value:l.formattedValue,"aria-valuemin":i.min,"aria-valuemax":i.max,"aria-valuenow":i.modelValue,disabled:i.disabled,readonly:i.readonly,placeholder:i.placeholder,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,onInput:l.onUserInput,onKeydown:l.onInputKeyDown,onKeypress:l.onInputKeyPress,onPaste:l.onPaste,onClick:l.onInputClick,onFocus:l.onInputFocus,onBlur:l.onInputBlur},i.inputProps),null,16,["id","class","style","value","aria-valuemin","aria-valuemax","aria-valuenow","disabled","readonly","placeholder","aria-labelledby","aria-label","onInput","onKeydown","onKeypress","onPaste","onClick","onFocus","onBlur"]),i.showButtons&&"stacked"===i.buttonLayout?(n.openBlock(),n.createElementBlock("span",u,[n.createVNode(o,n.mergeProps({class:l.upButtonClass,icon:i.incrementButtonIcon},n.toHandlers(l.upButtonListeners),{disabled:i.disabled,tabindex:-1,"aria-hidden":"true"},i.incrementButtonProps),null,16,["class","icon","disabled"]),n.createVNode(o,n.mergeProps({class:l.downButtonClass,icon:i.decrementButtonIcon},n.toHandlers(l.downButtonListeners),{disabled:i.disabled,tabindex:-1,"aria-hidden":"true"},i.decrementButtonProps),null,16,["class","icon","disabled"])])):n.createCommentVNode("",!0),i.showButtons&&"stacked"!==i.buttonLayout?(n.openBlock(),n.createBlock(o,n.mergeProps({key:1,class:l.upButtonClass,icon:i.incrementButtonIcon},n.toHandlers(l.upButtonListeners),{disabled:i.disabled,tabindex:-1,"aria-hidden":"true"},i.incrementButtonProps),null,16,["class","icon","disabled"])):n.createCommentVNode("",!0),i.showButtons&&"stacked"!==i.buttonLayout?(n.openBlock(),n.createBlock(o,n.mergeProps({key:2,class:l.downButtonClass,icon:i.decrementButtonIcon},n.toHandlers(l.downButtonListeners),{disabled:i.disabled,tabindex:-1,"aria-hidden":"true"},i.decrementButtonProps),null,16,["class","icon","disabled"])):n.createCommentVNode("",!0)],2)},l}(primevue.inputtext,primevue.button,Vue);
|
|
@@ -5,14 +5,6 @@ export interface InputSwitchProps {
|
|
|
5
5
|
* Specifies whether a inputswitch should be checked or not.
|
|
6
6
|
*/
|
|
7
7
|
modelValue?: boolean | string | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* Inline style of the component.
|
|
10
|
-
*/
|
|
11
|
-
class?: any;
|
|
12
|
-
/**
|
|
13
|
-
* Style class of the component input field.
|
|
14
|
-
*/
|
|
15
|
-
style?: any;
|
|
16
8
|
/**
|
|
17
9
|
* Value in checked state.
|
|
18
10
|
*/
|
|
@@ -21,6 +13,30 @@ export interface InputSwitchProps {
|
|
|
21
13
|
* Value in unchecked state.
|
|
22
14
|
*/
|
|
23
15
|
falseValue?: any;
|
|
16
|
+
/**
|
|
17
|
+
* Identifier of the underlying input element.
|
|
18
|
+
*/
|
|
19
|
+
inputId?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Style class of the input field.
|
|
22
|
+
*/
|
|
23
|
+
inputClass?: any | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Inline style of the input field.
|
|
26
|
+
*/
|
|
27
|
+
inputStyle?: any | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Uses to pass all properties of the HTMLInputElement to the focusable input element inside the component.
|
|
30
|
+
*/
|
|
31
|
+
inputProps?: HTMLInputElement | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
|
34
|
+
*/
|
|
35
|
+
'aria-labelledby'?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Establishes a string value that labels the component.
|
|
38
|
+
*/
|
|
39
|
+
'aria-label'?: string | undefined;
|
|
24
40
|
}
|
|
25
41
|
|
|
26
42
|
export interface InputSwitchSlots {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="containerClass" @click="onClick($event)"
|
|
2
|
+
<div :class="containerClass" @click="onClick($event)">
|
|
3
3
|
<div class="p-hidden-accessible">
|
|
4
|
-
<input ref="input" type="checkbox" :checked="checked"
|
|
5
|
-
|
|
4
|
+
<input :id="inputId" ref="input" type="checkbox" role="switch" :class="inputClass" :style="inputStyle" :checked="checked" :disabled="disabled" :aria-checked="checked" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel"
|
|
5
|
+
@focus="onFocus($event)" @blur="onBlur($event)" v-bind="inputProps">
|
|
6
6
|
</div>
|
|
7
7
|
<span class="p-inputswitch-slider"></span>
|
|
8
8
|
</div>
|
|
@@ -11,15 +11,12 @@
|
|
|
11
11
|
<script>
|
|
12
12
|
export default {
|
|
13
13
|
name: 'InputSwitch',
|
|
14
|
-
|
|
15
|
-
emits: ['click', 'update:modelValue', 'change', 'input'],
|
|
14
|
+
emits: ['click', 'update:modelValue', 'change', 'input', 'focus', 'blur'],
|
|
16
15
|
props: {
|
|
17
16
|
modelValue: {
|
|
18
17
|
type: null,
|
|
19
18
|
default: false
|
|
20
19
|
},
|
|
21
|
-
class: null,
|
|
22
|
-
style: null,
|
|
23
20
|
trueValue: {
|
|
24
21
|
type: null,
|
|
25
22
|
default: true
|
|
@@ -27,6 +24,22 @@ export default {
|
|
|
27
24
|
falseValue: {
|
|
28
25
|
type: null,
|
|
29
26
|
default: false
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
inputId: null,
|
|
33
|
+
inputClass: null,
|
|
34
|
+
inputStyle: null,
|
|
35
|
+
inputProps: null,
|
|
36
|
+
'aria-labelledby': {
|
|
37
|
+
type: String,
|
|
38
|
+
default: null
|
|
39
|
+
},
|
|
40
|
+
'aria-label': {
|
|
41
|
+
type: String,
|
|
42
|
+
default: null
|
|
30
43
|
}
|
|
31
44
|
},
|
|
32
45
|
data() {
|
|
@@ -36,7 +49,7 @@ export default {
|
|
|
36
49
|
},
|
|
37
50
|
methods: {
|
|
38
51
|
onClick(event) {
|
|
39
|
-
if (!this
|
|
52
|
+
if (!this.disabled) {
|
|
40
53
|
const newValue = this.checked ? this.falseValue : this.trueValue;
|
|
41
54
|
this.$emit('click', event);
|
|
42
55
|
this.$emit('update:modelValue', newValue);
|
|
@@ -46,20 +59,22 @@ export default {
|
|
|
46
59
|
}
|
|
47
60
|
event.preventDefault();
|
|
48
61
|
},
|
|
49
|
-
onFocus() {
|
|
62
|
+
onFocus(event) {
|
|
50
63
|
this.focused = true;
|
|
64
|
+
this.$emit('focus', event);
|
|
51
65
|
},
|
|
52
|
-
onBlur() {
|
|
66
|
+
onBlur(event) {
|
|
53
67
|
this.focused = false;
|
|
68
|
+
this.$emit('blur', event);
|
|
54
69
|
}
|
|
55
70
|
},
|
|
56
71
|
computed: {
|
|
57
72
|
containerClass() {
|
|
58
73
|
return [
|
|
59
|
-
'p-inputswitch p-component',
|
|
74
|
+
'p-inputswitch p-component',
|
|
60
75
|
{
|
|
61
76
|
'p-inputswitch-checked': this.checked,
|
|
62
|
-
'p-disabled': this
|
|
77
|
+
'p-disabled': this.disabled,
|
|
63
78
|
'p-focus': this.focused
|
|
64
79
|
}
|
|
65
80
|
];
|
|
@@ -4,15 +4,12 @@ var vue = require('vue');
|
|
|
4
4
|
|
|
5
5
|
var script = {
|
|
6
6
|
name: 'InputSwitch',
|
|
7
|
-
|
|
8
|
-
emits: ['click', 'update:modelValue', 'change', 'input'],
|
|
7
|
+
emits: ['click', 'update:modelValue', 'change', 'input', 'focus', 'blur'],
|
|
9
8
|
props: {
|
|
10
9
|
modelValue: {
|
|
11
10
|
type: null,
|
|
12
11
|
default: false
|
|
13
12
|
},
|
|
14
|
-
class: null,
|
|
15
|
-
style: null,
|
|
16
13
|
trueValue: {
|
|
17
14
|
type: null,
|
|
18
15
|
default: true
|
|
@@ -20,6 +17,22 @@ var script = {
|
|
|
20
17
|
falseValue: {
|
|
21
18
|
type: null,
|
|
22
19
|
default: false
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
inputId: null,
|
|
26
|
+
inputClass: null,
|
|
27
|
+
inputStyle: null,
|
|
28
|
+
inputProps: null,
|
|
29
|
+
'aria-labelledby': {
|
|
30
|
+
type: String,
|
|
31
|
+
default: null
|
|
32
|
+
},
|
|
33
|
+
'aria-label': {
|
|
34
|
+
type: String,
|
|
35
|
+
default: null
|
|
23
36
|
}
|
|
24
37
|
},
|
|
25
38
|
data() {
|
|
@@ -29,7 +42,7 @@ var script = {
|
|
|
29
42
|
},
|
|
30
43
|
methods: {
|
|
31
44
|
onClick(event) {
|
|
32
|
-
if (!this
|
|
45
|
+
if (!this.disabled) {
|
|
33
46
|
const newValue = this.checked ? this.falseValue : this.trueValue;
|
|
34
47
|
this.$emit('click', event);
|
|
35
48
|
this.$emit('update:modelValue', newValue);
|
|
@@ -39,20 +52,22 @@ var script = {
|
|
|
39
52
|
}
|
|
40
53
|
event.preventDefault();
|
|
41
54
|
},
|
|
42
|
-
onFocus() {
|
|
55
|
+
onFocus(event) {
|
|
43
56
|
this.focused = true;
|
|
57
|
+
this.$emit('focus', event);
|
|
44
58
|
},
|
|
45
|
-
onBlur() {
|
|
59
|
+
onBlur(event) {
|
|
46
60
|
this.focused = false;
|
|
61
|
+
this.$emit('blur', event);
|
|
47
62
|
}
|
|
48
63
|
},
|
|
49
64
|
computed: {
|
|
50
65
|
containerClass() {
|
|
51
66
|
return [
|
|
52
|
-
'p-inputswitch p-component',
|
|
67
|
+
'p-inputswitch p-component',
|
|
53
68
|
{
|
|
54
69
|
'p-inputswitch-checked': this.checked,
|
|
55
|
-
'p-disabled': this
|
|
70
|
+
'p-disabled': this.disabled,
|
|
56
71
|
'p-focus': this.focused
|
|
57
72
|
}
|
|
58
73
|
];
|
|
@@ -64,30 +79,33 @@ var script = {
|
|
|
64
79
|
};
|
|
65
80
|
|
|
66
81
|
const _hoisted_1 = { class: "p-hidden-accessible" };
|
|
67
|
-
const _hoisted_2 = ["checked", "aria-checked"];
|
|
82
|
+
const _hoisted_2 = ["id", "checked", "disabled", "aria-checked", "aria-labelledby", "aria-label"];
|
|
68
83
|
const _hoisted_3 = /*#__PURE__*/vue.createElementVNode("span", { class: "p-inputswitch-slider" }, null, -1);
|
|
69
84
|
|
|
70
85
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
71
86
|
return (vue.openBlock(), vue.createElementBlock("div", {
|
|
72
87
|
class: vue.normalizeClass($options.containerClass),
|
|
73
|
-
onClick: _cache[
|
|
74
|
-
style: vue.normalizeStyle($props.style)
|
|
88
|
+
onClick: _cache[2] || (_cache[2] = $event => ($options.onClick($event)))
|
|
75
89
|
}, [
|
|
76
90
|
vue.createElementVNode("div", _hoisted_1, [
|
|
77
91
|
vue.createElementVNode("input", vue.mergeProps({
|
|
92
|
+
id: $props.inputId,
|
|
78
93
|
ref: "input",
|
|
79
94
|
type: "checkbox",
|
|
80
|
-
checked: $options.checked
|
|
81
|
-
}, _ctx.$attrs, {
|
|
82
|
-
onFocus: _cache[0] || (_cache[0] = $event => ($options.onFocus($event))),
|
|
83
|
-
onBlur: _cache[1] || (_cache[1] = $event => ($options.onBlur($event))),
|
|
84
|
-
onKeydown: _cache[2] || (_cache[2] = vue.withKeys(vue.withModifiers($event => ($options.onClick($event)), ["prevent"]), ["enter"])),
|
|
85
95
|
role: "switch",
|
|
86
|
-
|
|
87
|
-
|
|
96
|
+
class: $props.inputClass,
|
|
97
|
+
style: $props.inputStyle,
|
|
98
|
+
checked: $options.checked,
|
|
99
|
+
disabled: $props.disabled,
|
|
100
|
+
"aria-checked": $options.checked,
|
|
101
|
+
"aria-labelledby": _ctx.ariaLabelledby,
|
|
102
|
+
"aria-label": _ctx.ariaLabel,
|
|
103
|
+
onFocus: _cache[0] || (_cache[0] = $event => ($options.onFocus($event))),
|
|
104
|
+
onBlur: _cache[1] || (_cache[1] = $event => ($options.onBlur($event)))
|
|
105
|
+
}, $props.inputProps), null, 16, _hoisted_2)
|
|
88
106
|
]),
|
|
89
107
|
_hoisted_3
|
|
90
|
-
],
|
|
108
|
+
], 2))
|
|
91
109
|
}
|
|
92
110
|
|
|
93
111
|
function styleInject(css, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t={name:"InputSwitch",
|
|
1
|
+
"use strict";var e=require("vue"),t={name:"InputSwitch",emits:["click","update:modelValue","change","input","focus","blur"],props:{modelValue:{type:null,default:!1},trueValue:{type:null,default:!0},falseValue:{type:null,default:!1},disabled:{type:Boolean,default:!1},inputId:null,inputClass:null,inputStyle:null,inputProps:null,"aria-labelledby":{type:String,default:null},"aria-label":{type:String,default:null}},data:()=>({focused:!1}),methods:{onClick(e){if(!this.disabled){const t=this.checked?this.falseValue:this.trueValue;this.$emit("click",e),this.$emit("update:modelValue",t),this.$emit("change",e),this.$emit("input",t),this.$refs.input.focus()}e.preventDefault()},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)}},computed:{containerClass(){return["p-inputswitch p-component",{"p-inputswitch-checked":this.checked,"p-disabled":this.disabled,"p-focus":this.focused}]},checked(){return this.modelValue===this.trueValue}}};const l={class:"p-hidden-accessible"},i=["id","checked","disabled","aria-checked","aria-labelledby","aria-label"],n=e.createElementVNode("span",{class:"p-inputswitch-slider"},null,-1);!function(e,t){void 0===t&&(t={});var l=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===l&&i.firstChild?i.insertBefore(n,i.firstChild):i.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}('\n.p-inputswitch {\n position: relative;\n display: inline-block;\n}\n.p-inputswitch-slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n}\n.p-inputswitch-slider:before {\n position: absolute;\n content: "";\n top: 50%;\n}\n'),t.render=function(t,s,a,u,c,d){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(d.containerClass),onClick:s[2]||(s[2]=e=>d.onClick(e))},[e.createElementVNode("div",l,[e.createElementVNode("input",e.mergeProps({id:a.inputId,ref:"input",type:"checkbox",role:"switch",class:a.inputClass,style:a.inputStyle,checked:d.checked,disabled:a.disabled,"aria-checked":d.checked,"aria-labelledby":t.ariaLabelledby,"aria-label":t.ariaLabel,onFocus:s[0]||(s[0]=e=>d.onFocus(e)),onBlur:s[1]||(s[1]=e=>d.onBlur(e))},a.inputProps),null,16,i)]),n],2)},module.exports=t;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { openBlock, createElementBlock, normalizeClass,
|
|
1
|
+
import { openBlock, createElementBlock, normalizeClass, createElementVNode, mergeProps } from 'vue';
|
|
2
2
|
|
|
3
3
|
var script = {
|
|
4
4
|
name: 'InputSwitch',
|
|
5
|
-
|
|
6
|
-
emits: ['click', 'update:modelValue', 'change', 'input'],
|
|
5
|
+
emits: ['click', 'update:modelValue', 'change', 'input', 'focus', 'blur'],
|
|
7
6
|
props: {
|
|
8
7
|
modelValue: {
|
|
9
8
|
type: null,
|
|
10
9
|
default: false
|
|
11
10
|
},
|
|
12
|
-
class: null,
|
|
13
|
-
style: null,
|
|
14
11
|
trueValue: {
|
|
15
12
|
type: null,
|
|
16
13
|
default: true
|
|
@@ -18,6 +15,22 @@ var script = {
|
|
|
18
15
|
falseValue: {
|
|
19
16
|
type: null,
|
|
20
17
|
default: false
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
inputId: null,
|
|
24
|
+
inputClass: null,
|
|
25
|
+
inputStyle: null,
|
|
26
|
+
inputProps: null,
|
|
27
|
+
'aria-labelledby': {
|
|
28
|
+
type: String,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
'aria-label': {
|
|
32
|
+
type: String,
|
|
33
|
+
default: null
|
|
21
34
|
}
|
|
22
35
|
},
|
|
23
36
|
data() {
|
|
@@ -27,7 +40,7 @@ var script = {
|
|
|
27
40
|
},
|
|
28
41
|
methods: {
|
|
29
42
|
onClick(event) {
|
|
30
|
-
if (!this
|
|
43
|
+
if (!this.disabled) {
|
|
31
44
|
const newValue = this.checked ? this.falseValue : this.trueValue;
|
|
32
45
|
this.$emit('click', event);
|
|
33
46
|
this.$emit('update:modelValue', newValue);
|
|
@@ -37,20 +50,22 @@ var script = {
|
|
|
37
50
|
}
|
|
38
51
|
event.preventDefault();
|
|
39
52
|
},
|
|
40
|
-
onFocus() {
|
|
53
|
+
onFocus(event) {
|
|
41
54
|
this.focused = true;
|
|
55
|
+
this.$emit('focus', event);
|
|
42
56
|
},
|
|
43
|
-
onBlur() {
|
|
57
|
+
onBlur(event) {
|
|
44
58
|
this.focused = false;
|
|
59
|
+
this.$emit('blur', event);
|
|
45
60
|
}
|
|
46
61
|
},
|
|
47
62
|
computed: {
|
|
48
63
|
containerClass() {
|
|
49
64
|
return [
|
|
50
|
-
'p-inputswitch p-component',
|
|
65
|
+
'p-inputswitch p-component',
|
|
51
66
|
{
|
|
52
67
|
'p-inputswitch-checked': this.checked,
|
|
53
|
-
'p-disabled': this
|
|
68
|
+
'p-disabled': this.disabled,
|
|
54
69
|
'p-focus': this.focused
|
|
55
70
|
}
|
|
56
71
|
];
|
|
@@ -62,30 +77,33 @@ var script = {
|
|
|
62
77
|
};
|
|
63
78
|
|
|
64
79
|
const _hoisted_1 = { class: "p-hidden-accessible" };
|
|
65
|
-
const _hoisted_2 = ["checked", "aria-checked"];
|
|
80
|
+
const _hoisted_2 = ["id", "checked", "disabled", "aria-checked", "aria-labelledby", "aria-label"];
|
|
66
81
|
const _hoisted_3 = /*#__PURE__*/createElementVNode("span", { class: "p-inputswitch-slider" }, null, -1);
|
|
67
82
|
|
|
68
83
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
69
84
|
return (openBlock(), createElementBlock("div", {
|
|
70
85
|
class: normalizeClass($options.containerClass),
|
|
71
|
-
onClick: _cache[
|
|
72
|
-
style: normalizeStyle($props.style)
|
|
86
|
+
onClick: _cache[2] || (_cache[2] = $event => ($options.onClick($event)))
|
|
73
87
|
}, [
|
|
74
88
|
createElementVNode("div", _hoisted_1, [
|
|
75
89
|
createElementVNode("input", mergeProps({
|
|
90
|
+
id: $props.inputId,
|
|
76
91
|
ref: "input",
|
|
77
92
|
type: "checkbox",
|
|
78
|
-
checked: $options.checked
|
|
79
|
-
}, _ctx.$attrs, {
|
|
80
|
-
onFocus: _cache[0] || (_cache[0] = $event => ($options.onFocus($event))),
|
|
81
|
-
onBlur: _cache[1] || (_cache[1] = $event => ($options.onBlur($event))),
|
|
82
|
-
onKeydown: _cache[2] || (_cache[2] = withKeys(withModifiers($event => ($options.onClick($event)), ["prevent"]), ["enter"])),
|
|
83
93
|
role: "switch",
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
class: $props.inputClass,
|
|
95
|
+
style: $props.inputStyle,
|
|
96
|
+
checked: $options.checked,
|
|
97
|
+
disabled: $props.disabled,
|
|
98
|
+
"aria-checked": $options.checked,
|
|
99
|
+
"aria-labelledby": _ctx.ariaLabelledby,
|
|
100
|
+
"aria-label": _ctx.ariaLabel,
|
|
101
|
+
onFocus: _cache[0] || (_cache[0] = $event => ($options.onFocus($event))),
|
|
102
|
+
onBlur: _cache[1] || (_cache[1] = $event => ($options.onBlur($event)))
|
|
103
|
+
}, $props.inputProps), null, 16, _hoisted_2)
|
|
86
104
|
]),
|
|
87
105
|
_hoisted_3
|
|
88
|
-
],
|
|
106
|
+
], 2))
|
|
89
107
|
}
|
|
90
108
|
|
|
91
109
|
function styleInject(css, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{openBlock as e,createElementBlock as t,normalizeClass as
|
|
1
|
+
import{openBlock as e,createElementBlock as t,normalizeClass as i,createElementVNode as l,mergeProps as n}from"vue";var s={name:"InputSwitch",emits:["click","update:modelValue","change","input","focus","blur"],props:{modelValue:{type:null,default:!1},trueValue:{type:null,default:!0},falseValue:{type:null,default:!1},disabled:{type:Boolean,default:!1},inputId:null,inputClass:null,inputStyle:null,inputProps:null,"aria-labelledby":{type:String,default:null},"aria-label":{type:String,default:null}},data:()=>({focused:!1}),methods:{onClick(e){if(!this.disabled){const t=this.checked?this.falseValue:this.trueValue;this.$emit("click",e),this.$emit("update:modelValue",t),this.$emit("change",e),this.$emit("input",t),this.$refs.input.focus()}e.preventDefault()},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)}},computed:{containerClass(){return["p-inputswitch p-component",{"p-inputswitch-checked":this.checked,"p-disabled":this.disabled,"p-focus":this.focused}]},checked(){return this.modelValue===this.trueValue}}};const a={class:"p-hidden-accessible"},u=["id","checked","disabled","aria-checked","aria-labelledby","aria-label"],d=l("span",{class:"p-inputswitch-slider"},null,-1);!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}('\n.p-inputswitch {\n position: relative;\n display: inline-block;\n}\n.p-inputswitch-slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n}\n.p-inputswitch-slider:before {\n position: absolute;\n content: "";\n top: 50%;\n}\n'),s.render=function(s,c,o,p,r,h){return e(),t("div",{class:i(h.containerClass),onClick:c[2]||(c[2]=e=>h.onClick(e))},[l("div",a,[l("input",n({id:o.inputId,ref:"input",type:"checkbox",role:"switch",class:o.inputClass,style:o.inputStyle,checked:h.checked,disabled:o.disabled,"aria-checked":h.checked,"aria-labelledby":s.ariaLabelledby,"aria-label":s.ariaLabel,onFocus:c[0]||(c[0]=e=>h.onFocus(e)),onBlur:c[1]||(c[1]=e=>h.onBlur(e))},o.inputProps),null,16,u)]),d],2)};export{s as default};
|
|
@@ -4,15 +4,12 @@ this.primevue.inputswitch = (function (vue) {
|
|
|
4
4
|
|
|
5
5
|
var script = {
|
|
6
6
|
name: 'InputSwitch',
|
|
7
|
-
|
|
8
|
-
emits: ['click', 'update:modelValue', 'change', 'input'],
|
|
7
|
+
emits: ['click', 'update:modelValue', 'change', 'input', 'focus', 'blur'],
|
|
9
8
|
props: {
|
|
10
9
|
modelValue: {
|
|
11
10
|
type: null,
|
|
12
11
|
default: false
|
|
13
12
|
},
|
|
14
|
-
class: null,
|
|
15
|
-
style: null,
|
|
16
13
|
trueValue: {
|
|
17
14
|
type: null,
|
|
18
15
|
default: true
|
|
@@ -20,6 +17,22 @@ this.primevue.inputswitch = (function (vue) {
|
|
|
20
17
|
falseValue: {
|
|
21
18
|
type: null,
|
|
22
19
|
default: false
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
inputId: null,
|
|
26
|
+
inputClass: null,
|
|
27
|
+
inputStyle: null,
|
|
28
|
+
inputProps: null,
|
|
29
|
+
'aria-labelledby': {
|
|
30
|
+
type: String,
|
|
31
|
+
default: null
|
|
32
|
+
},
|
|
33
|
+
'aria-label': {
|
|
34
|
+
type: String,
|
|
35
|
+
default: null
|
|
23
36
|
}
|
|
24
37
|
},
|
|
25
38
|
data() {
|
|
@@ -29,7 +42,7 @@ this.primevue.inputswitch = (function (vue) {
|
|
|
29
42
|
},
|
|
30
43
|
methods: {
|
|
31
44
|
onClick(event) {
|
|
32
|
-
if (!this
|
|
45
|
+
if (!this.disabled) {
|
|
33
46
|
const newValue = this.checked ? this.falseValue : this.trueValue;
|
|
34
47
|
this.$emit('click', event);
|
|
35
48
|
this.$emit('update:modelValue', newValue);
|
|
@@ -39,20 +52,22 @@ this.primevue.inputswitch = (function (vue) {
|
|
|
39
52
|
}
|
|
40
53
|
event.preventDefault();
|
|
41
54
|
},
|
|
42
|
-
onFocus() {
|
|
55
|
+
onFocus(event) {
|
|
43
56
|
this.focused = true;
|
|
57
|
+
this.$emit('focus', event);
|
|
44
58
|
},
|
|
45
|
-
onBlur() {
|
|
59
|
+
onBlur(event) {
|
|
46
60
|
this.focused = false;
|
|
61
|
+
this.$emit('blur', event);
|
|
47
62
|
}
|
|
48
63
|
},
|
|
49
64
|
computed: {
|
|
50
65
|
containerClass() {
|
|
51
66
|
return [
|
|
52
|
-
'p-inputswitch p-component',
|
|
67
|
+
'p-inputswitch p-component',
|
|
53
68
|
{
|
|
54
69
|
'p-inputswitch-checked': this.checked,
|
|
55
|
-
'p-disabled': this
|
|
70
|
+
'p-disabled': this.disabled,
|
|
56
71
|
'p-focus': this.focused
|
|
57
72
|
}
|
|
58
73
|
];
|
|
@@ -64,30 +79,33 @@ this.primevue.inputswitch = (function (vue) {
|
|
|
64
79
|
};
|
|
65
80
|
|
|
66
81
|
const _hoisted_1 = { class: "p-hidden-accessible" };
|
|
67
|
-
const _hoisted_2 = ["checked", "aria-checked"];
|
|
82
|
+
const _hoisted_2 = ["id", "checked", "disabled", "aria-checked", "aria-labelledby", "aria-label"];
|
|
68
83
|
const _hoisted_3 = /*#__PURE__*/vue.createElementVNode("span", { class: "p-inputswitch-slider" }, null, -1);
|
|
69
84
|
|
|
70
85
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
71
86
|
return (vue.openBlock(), vue.createElementBlock("div", {
|
|
72
87
|
class: vue.normalizeClass($options.containerClass),
|
|
73
|
-
onClick: _cache[
|
|
74
|
-
style: vue.normalizeStyle($props.style)
|
|
88
|
+
onClick: _cache[2] || (_cache[2] = $event => ($options.onClick($event)))
|
|
75
89
|
}, [
|
|
76
90
|
vue.createElementVNode("div", _hoisted_1, [
|
|
77
91
|
vue.createElementVNode("input", vue.mergeProps({
|
|
92
|
+
id: $props.inputId,
|
|
78
93
|
ref: "input",
|
|
79
94
|
type: "checkbox",
|
|
80
|
-
checked: $options.checked
|
|
81
|
-
}, _ctx.$attrs, {
|
|
82
|
-
onFocus: _cache[0] || (_cache[0] = $event => ($options.onFocus($event))),
|
|
83
|
-
onBlur: _cache[1] || (_cache[1] = $event => ($options.onBlur($event))),
|
|
84
|
-
onKeydown: _cache[2] || (_cache[2] = vue.withKeys(vue.withModifiers($event => ($options.onClick($event)), ["prevent"]), ["enter"])),
|
|
85
95
|
role: "switch",
|
|
86
|
-
|
|
87
|
-
|
|
96
|
+
class: $props.inputClass,
|
|
97
|
+
style: $props.inputStyle,
|
|
98
|
+
checked: $options.checked,
|
|
99
|
+
disabled: $props.disabled,
|
|
100
|
+
"aria-checked": $options.checked,
|
|
101
|
+
"aria-labelledby": _ctx.ariaLabelledby,
|
|
102
|
+
"aria-label": _ctx.ariaLabel,
|
|
103
|
+
onFocus: _cache[0] || (_cache[0] = $event => ($options.onFocus($event))),
|
|
104
|
+
onBlur: _cache[1] || (_cache[1] = $event => ($options.onBlur($event)))
|
|
105
|
+
}, $props.inputProps), null, 16, _hoisted_2)
|
|
88
106
|
]),
|
|
89
107
|
_hoisted_3
|
|
90
|
-
],
|
|
108
|
+
], 2))
|
|
91
109
|
}
|
|
92
110
|
|
|
93
111
|
function styleInject(css, ref) {
|