@progress/kendo-vue-buttons 7.0.1-develop.2 → 7.0.1-develop.3
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/Button.js +1 -1
- package/Button.mjs +42 -38
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +5 -5
- package/Chip/ChipList.js +1 -1
- package/Chip/ChipList.mjs +41 -37
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +45 -41
- package/FloatingActionButton/FloatingActionButtonItem.js +1 -1
- package/FloatingActionButton/FloatingActionButtonItem.mjs +14 -14
- package/ListButton/ButtonItem.js +1 -1
- package/ListButton/ButtonItem.mjs +16 -16
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +41 -34
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +47 -38
- package/dist/cdn/js/kendo-vue-buttons.js +1 -1
- package/index.d.mts +193 -96
- package/index.d.ts +193 -96
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +5 -5
- package/toolbar/Toolbar.js +1 -1
- package/toolbar/Toolbar.mjs +6 -3
- package/toolbar/tools/ToolbarOverflowSection.js +1 -1
- package/toolbar/tools/ToolbarOverflowSection.mjs +11 -9
- package/toolbar/tools/ToolbarScrollButton.js +1 -1
- package/toolbar/tools/ToolbarScrollButton.mjs +7 -5
- package/toolbar/tools/ToolbarScrollable.js +1 -1
- package/toolbar/tools/ToolbarScrollable.mjs +12 -10
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),n=require("@progress/kendo-vue-common"),m=t.defineComponent({name:"KendoVueFloatingActionButtonItem",props:{id:String,disabled:Boolean,focused:Boolean,index:Number,icon:String,item:[String,Function,Object],dataItem:Object,text:String,tabIndex:Number,customProp:[String,Function,Object],class:String},emits:{click:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),n=require("@progress/kendo-vue-common"),m=t.defineComponent({name:"KendoVueFloatingActionButtonItem",props:{id:String,disabled:Boolean,focused:Boolean,index:Number,icon:String,item:[String,Function,Object],dataItem:Object,text:String,tabIndex:Number,customProp:[String,Function,Object],class:String},emits:{click:(e,o)=>!0,down:e=>!0},mounted(){this.element=n.getRef(this,"element")},computed:{itemClassNames(){return n.classNames("k-fab-item",{"k-focus":this.focused,"k-disabled":this.disabled})}},methods:{handleClick(e){this.$props.index!==void 0&&!this.$props.disabled&&this.$emit("click",e,this.$props.index)},focusElement(){this.$el&&this.$el.focus()},onMouseDown(e){this.$emit("down",e)}},setup(){return{elementRef:t.ref(null)}},render(){const{disabled:e,id:o,tabIndex:d,dataItem:c}=this.$props,{text:i,icon:s,svgIcon:a}=c;let l;const r=t.createVNode("li",{ref:n.setRef(this,"element"),id:o,class:this.itemClassNames,role:"menuitem",tabindex:n.getTabIndex(d,e),"aria-disabled":e,"aria-label":`${i||""} floatingactionbutton item`,onClick:this.handleClick,onMousedown:this.onMouseDown,onPointerdown:this.onMouseDown},[i&&t.createVNode("span",{class:"k-fab-item-text"},[i]),(a||s)&&t.createVNode(n.Icon,{name:s,icon:a,class:"k-fab-item-icon"},null)]);return l=n.getTemplate.call(this,{h:t.h,template:this.$props.item,defaultRendering:r,additionalProps:this.$props,additionalListeners:{click:this.handleClick}}),l}});exports.FloatingActionButtonItem=m;
|
|
@@ -23,8 +23,8 @@ const I = /* @__PURE__ */ m({
|
|
|
23
23
|
class: String
|
|
24
24
|
},
|
|
25
25
|
emits: {
|
|
26
|
-
click:
|
|
27
|
-
down:
|
|
26
|
+
click: (e, n) => !0,
|
|
27
|
+
down: (e) => !0
|
|
28
28
|
},
|
|
29
29
|
mounted() {
|
|
30
30
|
this.element = k(this, "element");
|
|
@@ -56,21 +56,21 @@ const I = /* @__PURE__ */ m({
|
|
|
56
56
|
render() {
|
|
57
57
|
const {
|
|
58
58
|
disabled: e,
|
|
59
|
-
id:
|
|
60
|
-
tabIndex:
|
|
59
|
+
id: n,
|
|
60
|
+
tabIndex: l,
|
|
61
61
|
dataItem: d
|
|
62
62
|
} = this.$props, {
|
|
63
63
|
text: t,
|
|
64
|
-
icon:
|
|
65
|
-
svgIcon:
|
|
64
|
+
icon: s,
|
|
65
|
+
svgIcon: o
|
|
66
66
|
} = d;
|
|
67
|
-
let
|
|
67
|
+
let a;
|
|
68
68
|
const c = i("li", {
|
|
69
69
|
ref: p(this, "element"),
|
|
70
|
-
id:
|
|
70
|
+
id: n,
|
|
71
71
|
class: this.itemClassNames,
|
|
72
72
|
role: "menuitem",
|
|
73
|
-
tabindex: h(
|
|
73
|
+
tabindex: h(l, e),
|
|
74
74
|
"aria-disabled": e,
|
|
75
75
|
"aria-label": `${t || ""} floatingactionbutton item`,
|
|
76
76
|
onClick: this.handleClick,
|
|
@@ -78,12 +78,12 @@ const I = /* @__PURE__ */ m({
|
|
|
78
78
|
onPointerdown: this.onMouseDown
|
|
79
79
|
}, [t && i("span", {
|
|
80
80
|
class: "k-fab-item-text"
|
|
81
|
-
}, [t]), (
|
|
82
|
-
name:
|
|
83
|
-
icon:
|
|
81
|
+
}, [t]), (o || s) && i(f, {
|
|
82
|
+
name: s,
|
|
83
|
+
icon: o,
|
|
84
84
|
class: "k-fab-item-icon"
|
|
85
85
|
}, null)]);
|
|
86
|
-
return
|
|
86
|
+
return a = b.call(this, {
|
|
87
87
|
h: r,
|
|
88
88
|
template: this.$props.item,
|
|
89
89
|
defaultRendering: c,
|
|
@@ -91,7 +91,7 @@ const I = /* @__PURE__ */ m({
|
|
|
91
91
|
additionalListeners: {
|
|
92
92
|
click: this.handleClick
|
|
93
93
|
}
|
|
94
|
-
}),
|
|
94
|
+
}), a;
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
export {
|
package/ListButton/ButtonItem.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),o=require("@progress/kendo-vue-common"),l=t.defineComponent({name:"KendoButtonItem",emits:{click:(e,n)=>!0,down:(e,n)=>!0},props:{focused:Boolean,index:Number,item:Object,render:[String,Object,Function],dataItem:[String,Object],id:String,textField:String,role:String},computed:{wrapperClass(){return{"k-item":!0,"k-focus":this.$props.focused}},innerClass(){const{dataItem:e}=this.$props;return{"k-link k-menu-link":!0,"k-selected":e.selected,"k-disabled":e.disabled}}},methods:{onClick(e){this.$emit("click",e,this.$props.index)},onDown(e){this.$emit("down",e,this.$props.index)}},render(){const{dataItem:e,id:n,render:r}=this.$props,d=function(){const{textField:i,index:a}=this.$props,s=e.text!==void 0?e.text:i?e[i]:e,c=t.createVNode("span",{tabindex:-1,class:this.innerClass,key:"icon"},[e.icon||e.svgIcon?t.createVNode(o.Icon,{name:e.icon,icon:e.svgIcon,class:e.iconClass},null):e.iconClass&&t.createVNode("span",{class:e.iconClass,role:"presentation"},null),e.imageUrl&&t.createVNode("img",{class:"k-icon",alt:"",src:e.imageUrl,role:"presentation",key:"image"},null),s&&t.createVNode("span",{class:"k-menu-link-text"},[s])]);return o.getTemplate.call(this,{h:t.h,template:this.$props.dataItem.render||r,defaultRendering:c,additionalProps:{item:e,itemIndex:a,innerClass:this.innerClass,focused:this.focused}})};return t.createVNode("li",{id:n,class:this.wrapperClass,onClick:this.onClick,onMousedown:this.onDown,onPointerdown:this.onDown,role:"menuitem","aria-disabled":e.disabled||void 0},[d.call(this)])}});exports.ButtonItem=l;
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
8
|
+
import { defineComponent as a, createVNode as t, h as c } from "vue";
|
|
9
9
|
import { Icon as m, getTemplate as p } from "@progress/kendo-vue-common";
|
|
10
|
-
const
|
|
10
|
+
const x = /* @__PURE__ */ a({
|
|
11
11
|
name: "KendoButtonItem",
|
|
12
12
|
emits: {
|
|
13
|
-
click:
|
|
14
|
-
down:
|
|
13
|
+
click: (e, n) => !0,
|
|
14
|
+
down: (e, n) => !0
|
|
15
15
|
},
|
|
16
16
|
props: {
|
|
17
17
|
focused: Boolean,
|
|
@@ -52,36 +52,36 @@ const C = /* @__PURE__ */ d({
|
|
|
52
52
|
render() {
|
|
53
53
|
const {
|
|
54
54
|
dataItem: e,
|
|
55
|
-
id:
|
|
55
|
+
id: n,
|
|
56
56
|
render: o
|
|
57
57
|
} = this.$props, r = function() {
|
|
58
58
|
const {
|
|
59
|
-
textField:
|
|
59
|
+
textField: i,
|
|
60
60
|
index: l
|
|
61
|
-
} = this.$props,
|
|
61
|
+
} = this.$props, s = e.text !== void 0 ? e.text : i ? e[i] : e, d = t("span", {
|
|
62
62
|
tabindex: -1,
|
|
63
63
|
class: this.innerClass,
|
|
64
64
|
key: "icon"
|
|
65
|
-
}, [e.icon || e.svgIcon ?
|
|
65
|
+
}, [e.icon || e.svgIcon ? t(m, {
|
|
66
66
|
name: e.icon,
|
|
67
67
|
icon: e.svgIcon,
|
|
68
68
|
class: e.iconClass
|
|
69
|
-
}, null) : e.iconClass &&
|
|
69
|
+
}, null) : e.iconClass && t("span", {
|
|
70
70
|
class: e.iconClass,
|
|
71
71
|
role: "presentation"
|
|
72
|
-
}, null), e.imageUrl &&
|
|
72
|
+
}, null), e.imageUrl && t("img", {
|
|
73
73
|
class: "k-icon",
|
|
74
74
|
alt: "",
|
|
75
75
|
src: e.imageUrl,
|
|
76
76
|
role: "presentation",
|
|
77
77
|
key: "image"
|
|
78
|
-
}, null),
|
|
78
|
+
}, null), s && t("span", {
|
|
79
79
|
class: "k-menu-link-text"
|
|
80
|
-
}, [
|
|
80
|
+
}, [s])]);
|
|
81
81
|
return p.call(this, {
|
|
82
82
|
h: c,
|
|
83
83
|
template: this.$props.dataItem.render || o,
|
|
84
|
-
defaultRendering:
|
|
84
|
+
defaultRendering: d,
|
|
85
85
|
additionalProps: {
|
|
86
86
|
item: e,
|
|
87
87
|
itemIndex: l,
|
|
@@ -90,8 +90,8 @@ const C = /* @__PURE__ */ d({
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
-
return
|
|
94
|
-
id:
|
|
93
|
+
return t("li", {
|
|
94
|
+
id: n,
|
|
95
95
|
class: this.wrapperClass,
|
|
96
96
|
onClick: this.onClick,
|
|
97
97
|
onMousedown: this.onDown,
|
|
@@ -102,5 +102,5 @@ const C = /* @__PURE__ */ d({
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
export {
|
|
105
|
-
|
|
105
|
+
x as ButtonItem
|
|
106
106
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),g=require("../Button.js"),s=require("@progress/kendo-vue-common"),y=require("./utils/navigation.js"),b=require("./ButtonItem.js"),k=require("@progress/kendo-vue-popup"),p=require("./utils/popup.js"),$=require("../package-metadata.js"),C=i.defineComponent({name:"KendoDropDownButton",emits:{focus:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),g=require("../Button.js"),s=require("@progress/kendo-vue-common"),y=require("./utils/navigation.js"),b=require("./ButtonItem.js"),k=require("@progress/kendo-vue-popup"),p=require("./utils/popup.js"),$=require("../package-metadata.js"),C=i.defineComponent({name:"KendoDropDownButton",emits:{focus:e=>!0,blur:e=>!0,itemclick:e=>!0,open:e=>!0,close:e=>!0},props:{accessKey:String,items:{type:Array,default:function(){return[]}},ariaLabel:String,text:String,textField:String,tabIndex:Number,disabled:Boolean,icon:String,svgIcon:Object,iconClass:String,imageUrl:String,popupSettings:Object,itemRender:[String,Object,Function],item:Function,size:{type:String,default:"medium"},shape:{type:String,default:"rectangle",validator:function(e){return[null,"rectangle","square"].includes(e)}},rounded:{type:String,default:"medium"},fillMode:{type:String,default:"solid",validator:function(e){return[null,"flat","link","outline","solid"].includes(e)}},themeColor:{type:String,default:"base",validator:function(e){return[null,"base","dark","error","info","inverse","inverse","light","primary","secondary","success","tertiary","warning"].includes(e)}},opened:{type:Boolean,default:void 0},buttonClass:String,dir:String},created(){this._blurTimeout=null,this._anchor=s.guid(),this.wrapper=null,this.mainButton=null,this.guid=s.guid(),this.buttonsData=[],s.validatePackage($.packageMetadata)},mounted(){this.mainButton=this.$refs[this._anchor],(this.$props.dir===void 0&&this.isRtl()||this.computedOpened)&&this.$forceUpdate()},updated(){this.focused&&this.element()&&(this.mainButton=this.$refs[this._anchor],this.mainButton.focus())},data(){return{currentOpened:!1,focused:!1,focusedIndex:-1}},computed:{computedOpened(){return this.$props.opened===void 0?this.currentOpened:this.$props.opened},wrapperClass(){return{"k-dropdown-button":!0,"k-focus":this.focused}}},setup(){return{kendoAnchorRef:i.ref(null)}},render(){const e=this.isRtl(),t=e?"rtl":void 0,{tabIndex:n,disabled:a}=this.$props,c=s.getDefaultSlots(this);this.buttonsData=this.$props.items;const l=function(){const{item:o,itemRender:r,textField:f}=this.$props;return this.buttonsData.length>0?this.buttonsData.map(function(u,d){const m=typeof u!="string"?{...u,render:s.templateRendering.call(this,u.render,s.getListeners.call(this))}:u;return i.createVNode(b.ButtonItem,{class:"k-menu-item",dataItem:m,textField:f,focused:this.focusedIndex===d,onClick:this.onItemClick,onDown:this.onItemDown,render:s.templateRendering.call(this,r,s.getListeners.call(this)),item:o,index:d,key:d,id:`${this.guid}-${d}`},null)},this):null},h=function(){const{popupSettings:o={},size:r}=this.$props;return i.createVNode(k.Popup,{anchor:this._anchor,show:this.computedOpened,animate:o.animate,popupClass:s.classNames("k-menu-popup",o.popupClass),anchorAlign:o.anchorAlign||p.getAnchorAlign(e),popupAlign:o.popupAlign||p.getPopupAlign(e),style:e?{direction:"rtl"}:void 0},{default:()=>[i.createVNode("ul",{class:`k-group k-menu-group k-reset k-menu-group-${s.kendoThemeMaps.sizeMap[r]||r}`,role:"menu",id:this.guid},[l.call(this)])]})};return i.createVNode("div",{class:this.wrapperClass,onKeydown:this.onKeyDown,onFocusin:this.onFocus,onFocusout:this.onBlur,dir:t},[i.createVNode(g.Button,{size:this.$props.size,shape:this.$props.shape,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,onClick:this.onClickMainButton,onMousedown:this.mouseDown,disabled:a||void 0,tabIndex:n,accessKey:this.$props.accessKey,icon:this.$props.icon,svgIcon:this.$props.svgIcon,iconClass:this.$props.iconClass,class:this.$props.buttonClass,imageUrl:this.$props.imageUrl,dir:t,ref:this._anchor,type:"button","aria-disabled":a,"aria-haspopup":"menu","aria-expanded":this.computedOpened,"aria-label":this.$props.ariaLabel||`${this.$props.text||""} dropdownbutton`,"aria-controls":this.guid,"aria-activedescendant":this.focusedIndex!==void 0&&this.focusedIndex>=0?`${this.guid}-${this.focusedIndex}`:void 0},{default:()=>[this.$props.text,c]}),h.call(this)])},methods:{element(){return this.mainButton},onKeyDown(e){if(e.altKey){!this.computedOpened&&e.keyCode===s.Keys.down?(this.dispatchPopupEvent(e,!0),this.focusedIndex=0,this.currentOpened=!0):this.computedOpened&&e.keyCode===s.Keys.up&&(this.dispatchPopupEvent(e,!1),this.focusedIndex=-1,this.currentOpened=!1);return}if(e.keyCode===s.Keys.enter||e.keyCode===s.Keys.space?(this.focusedIndex!==void 0&&this.focusedIndex>=0&&this.dispatchClickEvent(e,this.focusedIndex),e.preventDefault(),this.focusedIndex=this.computedOpened?-1:0,this.currentOpened=!this.computedOpened,this.dispatchPopupEvent(e,this.currentOpened)):this.computedOpened&&e.keyCode===s.Keys.esc&&(this.focusedIndex=-1,this.currentOpened=!1,this.dispatchPopupEvent(e,this.currentOpened)),this.computedOpened){const t=y(this.focusedIndex,e.keyCode,e.altKey,this.buttonsData.length);this.focusedIndex=t;const n=e.keyCode===s.Keys.up||e.keyCode===s.Keys.down||e.keyCode===s.Keys.left||e.keyCode===s.Keys.right;!e.altKey&&n&&e.preventDefault()}},onFocus(e){this.focused||(this.focused=!0,this.$emit("focus",{event:e})),this.focusedIndex=this.computedOpened?0:-1,clearTimeout(this._blurTimeout)},onBlur(e){clearTimeout(this._blurTimeout),this.createBlurTimeout(e)},createBlurTimeout(e){const t=this;this._blurTimeout=setTimeout(()=>{s.canUseDOM&&document.activeElement!==t.$el&&(t.focused=!1,t.focusedIndex=-1,t.$emit("blur",{event:e}),t.computedOpened&&(t.currentOpened=!1,t.dispatchPopupEvent(e,!1)))},200)},onItemClick(e,t){this.focusedIndex=-1,this.currentOpened=!1,this.dispatchClickEvent(e,t),this.dispatchPopupEvent(e,!1)},onItemDown(e){document.activeElement===this.element()&&e.preventDefault()},mouseDown(e){e.preventDefault()},dispatchClickEvent(e,t){this.isItemDisabled(t)||this.$emit("itemclick",{event:e,item:this.buttonsData[t],itemIndex:t})},onClickMainButton(e){if(!this.buttonsData.length)return;const t=!this.computedOpened;this.currentOpened=t,this.focused=!0,this.focusedIndex=t?0:-1,this.dispatchPopupEvent(e,t)},dispatchPopupEvent(e,t){const n={event:e};this.$emit(t?"open":"close",n)},isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.$props.disabled},isRtl(){return this.$props.dir!==void 0?this.$props.dir==="rtl":!!this.$el&&getComputedStyle(this.$el).direction==="rtl"}}});exports.DropDownButton=C;
|
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as $, createVNode as
|
|
8
|
+
import { defineComponent as $, createVNode as o, ref as k } from "vue";
|
|
9
9
|
import { Button as y } from "../Button.mjs";
|
|
10
|
-
import { canUseDOM as C, Keys as
|
|
10
|
+
import { canUseDOM as C, Keys as s, getDefaultSlots as I, guid as a, validatePackage as D, classNames as O, kendoThemeMaps as x, templateRendering as c, getListeners as l } from "@progress/kendo-vue-common";
|
|
11
11
|
import w from "./utils/navigation.mjs";
|
|
12
12
|
import { ButtonItem as S } from "./ButtonItem.mjs";
|
|
13
|
-
import { Popup as
|
|
14
|
-
import { getPopupAlign as
|
|
15
|
-
import { packageMetadata as
|
|
13
|
+
import { Popup as v } from "@progress/kendo-vue-popup";
|
|
14
|
+
import { getPopupAlign as B, getAnchorAlign as E } from "./utils/popup.mjs";
|
|
15
|
+
import { packageMetadata as K } from "../package-metadata.mjs";
|
|
16
16
|
const U = /* @__PURE__ */ $({
|
|
17
17
|
name: "KendoDropDownButton",
|
|
18
18
|
emits: {
|
|
19
|
-
focus:
|
|
20
|
-
blur:
|
|
21
|
-
itemclick:
|
|
22
|
-
open:
|
|
23
|
-
close:
|
|
19
|
+
focus: (e) => !0,
|
|
20
|
+
blur: (e) => !0,
|
|
21
|
+
itemclick: (e) => !0,
|
|
22
|
+
open: (e) => !0,
|
|
23
|
+
close: (e) => !0
|
|
24
24
|
},
|
|
25
25
|
props: {
|
|
26
26
|
accessKey: String,
|
|
@@ -79,7 +79,7 @@ const U = /* @__PURE__ */ $({
|
|
|
79
79
|
dir: String
|
|
80
80
|
},
|
|
81
81
|
created() {
|
|
82
|
-
this._blurTimeout = null, this._anchor = a(), this.wrapper = null, this.mainButton = null, this.guid = a(), this.buttonsData = [], D(
|
|
82
|
+
this._blurTimeout = null, this._anchor = a(), this.wrapper = null, this.mainButton = null, this.guid = a(), this.buttonsData = [], D(K);
|
|
83
83
|
},
|
|
84
84
|
mounted() {
|
|
85
85
|
this.mainButton = this.$refs[this._anchor], (this.$props.dir === void 0 && this.isRtl() || this.computedOpened) && this.$forceUpdate();
|
|
@@ -112,30 +112,30 @@ const U = /* @__PURE__ */ $({
|
|
|
112
112
|
},
|
|
113
113
|
render() {
|
|
114
114
|
const e = this.isRtl(), t = e ? "rtl" : void 0, {
|
|
115
|
-
tabIndex:
|
|
115
|
+
tabIndex: i,
|
|
116
116
|
disabled: p
|
|
117
117
|
} = this.$props, h = I(this);
|
|
118
118
|
this.buttonsData = this.$props.items;
|
|
119
119
|
const f = function() {
|
|
120
120
|
const {
|
|
121
|
-
item:
|
|
121
|
+
item: n,
|
|
122
122
|
itemRender: r,
|
|
123
123
|
textField: g
|
|
124
124
|
} = this.$props;
|
|
125
125
|
return this.buttonsData.length > 0 ? this.buttonsData.map(function(u, d) {
|
|
126
126
|
const b = typeof u != "string" ? {
|
|
127
127
|
...u,
|
|
128
|
-
render:
|
|
128
|
+
render: c.call(this, u.render, l.call(this))
|
|
129
129
|
} : u;
|
|
130
|
-
return
|
|
130
|
+
return o(S, {
|
|
131
131
|
class: "k-menu-item",
|
|
132
132
|
dataItem: b,
|
|
133
133
|
textField: g,
|
|
134
134
|
focused: this.focusedIndex === d,
|
|
135
135
|
onClick: this.onItemClick,
|
|
136
136
|
onDown: this.onItemDown,
|
|
137
|
-
render:
|
|
138
|
-
item:
|
|
137
|
+
render: c.call(this, r, l.call(this)),
|
|
138
|
+
item: n,
|
|
139
139
|
index: d,
|
|
140
140
|
key: d,
|
|
141
141
|
id: `${this.guid}-${d}`
|
|
@@ -143,34 +143,34 @@ const U = /* @__PURE__ */ $({
|
|
|
143
143
|
}, this) : null;
|
|
144
144
|
}, m = function() {
|
|
145
145
|
const {
|
|
146
|
-
popupSettings:
|
|
146
|
+
popupSettings: n = {},
|
|
147
147
|
size: r
|
|
148
148
|
} = this.$props;
|
|
149
|
-
return
|
|
149
|
+
return o(v, {
|
|
150
150
|
anchor: this._anchor,
|
|
151
151
|
show: this.computedOpened,
|
|
152
|
-
animate:
|
|
153
|
-
popupClass: O("k-menu-popup",
|
|
154
|
-
anchorAlign:
|
|
155
|
-
popupAlign:
|
|
152
|
+
animate: n.animate,
|
|
153
|
+
popupClass: O("k-menu-popup", n.popupClass),
|
|
154
|
+
anchorAlign: n.anchorAlign || E(e),
|
|
155
|
+
popupAlign: n.popupAlign || B(e),
|
|
156
156
|
style: e ? {
|
|
157
157
|
direction: "rtl"
|
|
158
158
|
} : void 0
|
|
159
159
|
}, {
|
|
160
|
-
default: () => [
|
|
160
|
+
default: () => [o("ul", {
|
|
161
161
|
class: `k-group k-menu-group k-reset k-menu-group-${x.sizeMap[r] || r}`,
|
|
162
162
|
role: "menu",
|
|
163
163
|
id: this.guid
|
|
164
164
|
}, [f.call(this)])]
|
|
165
165
|
});
|
|
166
166
|
};
|
|
167
|
-
return
|
|
167
|
+
return o("div", {
|
|
168
168
|
class: this.wrapperClass,
|
|
169
169
|
onKeydown: this.onKeyDown,
|
|
170
170
|
onFocusin: this.onFocus,
|
|
171
171
|
onFocusout: this.onBlur,
|
|
172
172
|
dir: t
|
|
173
|
-
}, [
|
|
173
|
+
}, [o(y, {
|
|
174
174
|
size: this.$props.size,
|
|
175
175
|
shape: this.$props.shape,
|
|
176
176
|
rounded: this.$props.rounded,
|
|
@@ -179,7 +179,7 @@ const U = /* @__PURE__ */ $({
|
|
|
179
179
|
onClick: this.onClickMainButton,
|
|
180
180
|
onMousedown: this.mouseDown,
|
|
181
181
|
disabled: p || void 0,
|
|
182
|
-
tabIndex:
|
|
182
|
+
tabIndex: i,
|
|
183
183
|
accessKey: this.$props.accessKey,
|
|
184
184
|
icon: this.$props.icon,
|
|
185
185
|
svgIcon: this.$props.svgIcon,
|
|
@@ -205,18 +205,20 @@ const U = /* @__PURE__ */ $({
|
|
|
205
205
|
},
|
|
206
206
|
onKeyDown(e) {
|
|
207
207
|
if (e.altKey) {
|
|
208
|
-
!this.computedOpened && e.keyCode ===
|
|
208
|
+
!this.computedOpened && e.keyCode === s.down ? (this.dispatchPopupEvent(e, !0), this.focusedIndex = 0, this.currentOpened = !0) : this.computedOpened && e.keyCode === s.up && (this.dispatchPopupEvent(e, !1), this.focusedIndex = -1, this.currentOpened = !1);
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
|
-
if (e.keyCode ===
|
|
211
|
+
if (e.keyCode === s.enter || e.keyCode === s.space ? (this.focusedIndex !== void 0 && this.focusedIndex >= 0 && this.dispatchClickEvent(e, this.focusedIndex), e.preventDefault(), this.focusedIndex = this.computedOpened ? -1 : 0, this.currentOpened = !this.computedOpened, this.dispatchPopupEvent(e, this.currentOpened)) : this.computedOpened && e.keyCode === s.esc && (this.focusedIndex = -1, this.currentOpened = !1, this.dispatchPopupEvent(e, this.currentOpened)), this.computedOpened) {
|
|
212
212
|
const t = w(this.focusedIndex, e.keyCode, e.altKey, this.buttonsData.length);
|
|
213
213
|
this.focusedIndex = t;
|
|
214
|
-
const
|
|
215
|
-
!e.altKey &&
|
|
214
|
+
const i = e.keyCode === s.up || e.keyCode === s.down || e.keyCode === s.left || e.keyCode === s.right;
|
|
215
|
+
!e.altKey && i && e.preventDefault();
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
218
|
onFocus(e) {
|
|
219
|
-
this.focused || (this.focused = !0, this.$emit("focus",
|
|
219
|
+
this.focused || (this.focused = !0, this.$emit("focus", {
|
|
220
|
+
event: e
|
|
221
|
+
})), this.focusedIndex = this.computedOpened ? 0 : -1, clearTimeout(this._blurTimeout);
|
|
220
222
|
},
|
|
221
223
|
onBlur(e) {
|
|
222
224
|
clearTimeout(this._blurTimeout), this.createBlurTimeout(e);
|
|
@@ -224,7 +226,9 @@ const U = /* @__PURE__ */ $({
|
|
|
224
226
|
createBlurTimeout(e) {
|
|
225
227
|
const t = this;
|
|
226
228
|
this._blurTimeout = setTimeout(() => {
|
|
227
|
-
C && document.activeElement !== t.$el && (t.focused = !1, t.focusedIndex = -1, t.$emit("blur",
|
|
229
|
+
C && document.activeElement !== t.$el && (t.focused = !1, t.focusedIndex = -1, t.$emit("blur", {
|
|
230
|
+
event: e
|
|
231
|
+
}), t.computedOpened && (t.currentOpened = !1, t.dispatchPopupEvent(e, !1)));
|
|
228
232
|
}, 200);
|
|
229
233
|
},
|
|
230
234
|
onItemClick(e, t) {
|
|
@@ -250,7 +254,10 @@ const U = /* @__PURE__ */ $({
|
|
|
250
254
|
this.currentOpened = t, this.focused = !0, this.focusedIndex = t ? 0 : -1, this.dispatchPopupEvent(e, t);
|
|
251
255
|
},
|
|
252
256
|
dispatchPopupEvent(e, t) {
|
|
253
|
-
|
|
257
|
+
const i = {
|
|
258
|
+
event: e
|
|
259
|
+
};
|
|
260
|
+
this.$emit(t ? "open" : "close", i);
|
|
254
261
|
},
|
|
255
262
|
isItemDisabled(e) {
|
|
256
263
|
return this.buttonsData[e] ? this.buttonsData[e].disabled : this.$props.disabled;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),c=require("../Button.js"),i=require("@progress/kendo-vue-common"),b=require("./ButtonItem.js"),y=require("./utils/navigation.js"),k=require("@progress/kendo-vue-popup"),p=require("./utils/popup.js"),$=require("@progress/kendo-svg-icons"),C=require("../package-metadata.js"),I=o.defineComponent({name:"KendoSplitButton",emits:{focus:e=>!0,blur:e=>!0,buttonclick:e=>!0,itemclick:e=>!0,open:e=>!0,close:e=>!0},props:{accessKey:String,ariaLabel:String,text:String,items:{type:Array,default:function(){return[]}},textField:String,tabIndex:Number,disabled:Boolean,icon:String,svgIcon:Object,size:{type:String,default:"medium"},rounded:{type:String,default:"medium"},fillMode:{type:String,default:"solid",validator:function(e){return[null,"flat","link","outline","solid"].includes(e)}},themeColor:{type:String,default:"base",validator:function(e){return[null,"base","dark","error","info","inverse","inverse","light","primary","secondary","success","tertiary","warning"].includes(e)}},opened:{type:Boolean,default:void 0},iconClass:String,imageUrl:String,popupSettings:Object,itemRender:[String,Function,Object],item:[String,Function,Object],className:String,buttonClass:String,dir:String},data(){return{focused:!1,focusedIndex:-1,currentOpened:!1}},created(){this._blurTimeout=null,this._anchor=i.guid(),this.mainButton=null,this.guid=i.guid(),this.buttonsData=[],i.validatePackage(C.packageMetadata)},mounted(){this.mainButton=this.$refs[this._anchor],(this.$props.dir===void 0&&this.isRtl()||this.computedOpened)&&this.$forceUpdate()},updated(){this.focused&&this.element()&&(this.mainButton=this.$refs[this._anchor],this.mainButton.focus())},computed:{computedOpened(){return this.$props.opened===void 0?this.currentOpened:this.$props.opened},wrapperClass(){return{"k-split-button":!0,"k-button-group":!0,"k-focus":this.focused}}},setup(){return{kendoAnchorRef:o.ref(null)}},render(){this.buttonsData=this.$props.items;const e=this.isRtl(),t=e?"rtl":void 0,{tabIndex:s,disabled:r}=this.$props,l=i.getDefaultSlots(this),h=function(){const{item:n,itemRender:u,textField:m}=this.$props;return this.buttonsData.length>0?this.buttonsData.map(function(d,a){const g=typeof d!="string"?{...d,render:i.templateRendering.call(this,d.render,i.getListeners.call(this))}:d;return o.createVNode(b.ButtonItem,{class:"k-menu-item",role:"menuitem",dataItem:g,textField:m,focused:this.focusedIndex===a,onClick:this.onItemClick,onDown:this.onItemDown,render:i.templateRendering.call(this,u,i.getListeners.call(this)),item:n,key:a,index:a,id:`${this.guid}-${a}`},null)},this):null},f=function(){const{popupSettings:n={},size:u}=this.$props;return o.createVNode(k.Popup,{anchor:this._anchor,show:this.computedOpened,animate:n.animate,popupClass:i.classNames("k-menu-popup",n.popupClass),anchorAlign:n.anchorAlign||p.getAnchorAlign(e),popupAlign:n.popupAlign||p.getPopupAlign(e),style:e?{direction:"rtl"}:void 0},{default:()=>[o.createVNode("ul",{class:`k-group k-menu-group k-reset k-menu-group-${i.kendoThemeMaps.sizeMap[u]||u}`,role:"menu",id:this.guid,"aria-labelledby":this._anchor},[h.call(this)])]})};return o.createVNode("div",{class:this.wrapperClass,onKeydown:this.onKeyDown,onFocusin:this.onFocus,onFocusout:this.onBlur,dir:t},[o.createVNode(c.Button,{size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,onClick:n=>this.onItemClick(n,-1),disabled:r||void 0,tabIndex:s,accessKey:this.$props.accessKey,class:this.$props.buttonClass,icon:this.$props.icon,svgIcon:this.$props.svgIcon,iconClass:this.$props.iconClass,imageUrl:this.$props.imageUrl,dir:t,id:this._anchor,ref:this._anchor,type:"button","aria-disabled":r,"aria-haspopup":"menu","aria-expanded":this.computedOpened,"aria-label":this.$props.ariaLabel||`${this.$props.text||""} splitbutton`,"aria-controls":this.guid,"aria-activedescendant":this.focusedIndex!==void 0&&this.focusedIndex>=0?`${this.guid}-${this.focusedIndex}`:void 0},{default:()=>[this.$props.text,l]}),o.createVNode(c.Button,{svgIcon:$.caretAltDownIcon,size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,icon:"caret-alt-down",disabled:r||void 0,tabIndex:-1,onClick:this.onSplitPartClick,onMousedown:this.onDownSplitPart,onPointerdown:this.onDownSplitPart,dir:t,"aria-label":"menu toggling button"},null),f.call(this)])},methods:{element(){return this.mainButton},onKeyDown(e){if(e.altKey){!this.computedOpened&&e.keyCode===i.Keys.down?(this.dispatchPopupEvent(e,!0),this.focusedIndex=0,this.currentOpened=!0):this.computedOpened&&e.keyCode===i.Keys.up&&(this.dispatchPopupEvent(e,!1),this.focusedIndex=-1,this.currentOpened=!1);return}let t;if(e.keyCode===i.Keys.enter||e.keyCode===i.Keys.space?(e.preventDefault(),this.dispatchClickEvent(e,this.focusedIndex),this.focusedIndex!==void 0&&this.focusedIndex>=0&&(t={focusedIndex:this.computedOpened?-1:0,currentOpened:!this.computedOpened},this.dispatchPopupEvent(e,t.currentOpened))):this.computedOpened&&e.keyCode===i.Keys.esc&&(t={focusedIndex:-1,currentOpened:!1},this.dispatchPopupEvent(e,t.currentOpened)),this.computedOpened){const s=y(this.focusedIndex,e.keyCode,e.altKey,this.buttonsData.length);s!==this.focusedIndex&&(t=t||{},t.focusedIndex=s);const r=e.keyCode===i.Keys.up||e.keyCode===i.Keys.down||e.keyCode===i.Keys.left||e.keyCode===i.Keys.right;!e.altKey&&r&&e.preventDefault()}t&&(this.focusedIndex=t.focusedIndex,this.focused=t.focused,t.currentOpened!==void 0&&(this.currentOpened=t.currentOpened))},onFocus(e){this.focused||(this.$emit("focus",{event:e}),this.focused=!0),this.focusedIndex=-1,clearTimeout(this._blurTimeout)},onItemClick(e,t){const s=this.computedOpened;s&&(this.focusedIndex=0,this.currentOpened=!1),this.dispatchClickEvent(e,t),s&&this.dispatchPopupEvent(e,!1)},onBlur(e){clearTimeout(this._blurTimeout),this.createBlurTimeout(e)},createBlurTimeout(e){const t=this;this._blurTimeout=setTimeout(()=>{i.canUseDOM&&document.activeElement!==t.mainButton&&(t.focused=!1,t.focusedIndex=-1,t.$emit("blur",{event:e}),t.computedOpened&&(t.currentOpened=!1,t.dispatchPopupEvent(e,!1)))},200)},dispatchClickEvent(e,t){this.isItemDisabled(t)||(t===-1?this.$emit("buttonclick",{event:e}):this.$emit("itemclick",{event:e,component:this,item:this.buttonsData[t],itemIndex:t}))},onSplitPartClick(e){if(this.buttonsData.length){const t=!this.computedOpened;this.dispatchPopupEvent(e,t),this.focusedIndex=t?0:-1,this.currentOpened=t,this.focused=!0}},onDownSplitPart(e){e.preventDefault(),this.element()&&document.activeElement!==this.element()&&this.element().focus()},onItemDown(e){document.activeElement===this.element()&&e.preventDefault()},dispatchPopupEvent(e,t){const s={event:e};this.$emit(t?"open":"close",s)},isItemDisabled(e){return this.buttonsData[e]?this.buttonsData[e].disabled:this.$props.disabled},isRtl(){return this.$props.dir!==void 0?this.$props.dir==="rtl":!!this.$el&&getComputedStyle(this.$el).direction==="rtl"}}});exports.SplitButton=I;
|
|
@@ -6,23 +6,23 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import { defineComponent as C, createVNode as o, ref as k } from "vue";
|
|
9
|
-
import { Button as
|
|
10
|
-
import { canUseDOM as y, Keys as
|
|
9
|
+
import { Button as a } from "../Button.mjs";
|
|
10
|
+
import { canUseDOM as y, Keys as s, getDefaultSlots as I, guid as l, validatePackage as O, classNames as S, kendoThemeMaps as x, templateRendering as c, getListeners as h } from "@progress/kendo-vue-common";
|
|
11
11
|
import { ButtonItem as D } from "./ButtonItem.mjs";
|
|
12
12
|
import w from "./utils/navigation.mjs";
|
|
13
|
-
import { Popup as
|
|
14
|
-
import { getPopupAlign as
|
|
15
|
-
import { caretAltDownIcon as
|
|
16
|
-
import { packageMetadata as
|
|
13
|
+
import { Popup as v } from "@progress/kendo-vue-popup";
|
|
14
|
+
import { getPopupAlign as P, getAnchorAlign as B } from "./utils/popup.mjs";
|
|
15
|
+
import { caretAltDownIcon as E } from "@progress/kendo-svg-icons";
|
|
16
|
+
import { packageMetadata as K } from "../package-metadata.mjs";
|
|
17
17
|
const N = /* @__PURE__ */ C({
|
|
18
18
|
name: "KendoSplitButton",
|
|
19
19
|
emits: {
|
|
20
|
-
focus:
|
|
21
|
-
blur:
|
|
22
|
-
buttonclick:
|
|
23
|
-
itemclick:
|
|
24
|
-
open:
|
|
25
|
-
close:
|
|
20
|
+
focus: (e) => !0,
|
|
21
|
+
blur: (e) => !0,
|
|
22
|
+
buttonclick: (e) => !0,
|
|
23
|
+
itemclick: (e) => !0,
|
|
24
|
+
open: (e) => !0,
|
|
25
|
+
close: (e) => !0
|
|
26
26
|
},
|
|
27
27
|
props: {
|
|
28
28
|
accessKey: String,
|
|
@@ -82,7 +82,7 @@ const N = /* @__PURE__ */ C({
|
|
|
82
82
|
};
|
|
83
83
|
},
|
|
84
84
|
created() {
|
|
85
|
-
this._blurTimeout = null, this._anchor =
|
|
85
|
+
this._blurTimeout = null, this._anchor = l(), this.mainButton = null, this.guid = l(), this.buttonsData = [], O(K);
|
|
86
86
|
},
|
|
87
87
|
mounted() {
|
|
88
88
|
this.mainButton = this.$refs[this._anchor], (this.$props.dir === void 0 && this.isRtl() || this.computedOpened) && this.$forceUpdate();
|
|
@@ -110,7 +110,7 @@ const N = /* @__PURE__ */ C({
|
|
|
110
110
|
render() {
|
|
111
111
|
this.buttonsData = this.$props.items;
|
|
112
112
|
const e = this.isRtl(), t = e ? "rtl" : void 0, {
|
|
113
|
-
tabIndex:
|
|
113
|
+
tabIndex: i,
|
|
114
114
|
disabled: r
|
|
115
115
|
} = this.$props, f = I(this), m = function() {
|
|
116
116
|
const {
|
|
@@ -118,7 +118,7 @@ const N = /* @__PURE__ */ C({
|
|
|
118
118
|
itemRender: d,
|
|
119
119
|
textField: b
|
|
120
120
|
} = this.$props;
|
|
121
|
-
return this.buttonsData.length > 0 ? this.buttonsData.map(function(u,
|
|
121
|
+
return this.buttonsData.length > 0 ? this.buttonsData.map(function(u, p) {
|
|
122
122
|
const $ = typeof u != "string" ? {
|
|
123
123
|
...u,
|
|
124
124
|
render: c.call(this, u.render, h.call(this))
|
|
@@ -128,14 +128,14 @@ const N = /* @__PURE__ */ C({
|
|
|
128
128
|
role: "menuitem",
|
|
129
129
|
dataItem: $,
|
|
130
130
|
textField: b,
|
|
131
|
-
focused: this.focusedIndex ===
|
|
131
|
+
focused: this.focusedIndex === p,
|
|
132
132
|
onClick: this.onItemClick,
|
|
133
133
|
onDown: this.onItemDown,
|
|
134
134
|
render: c.call(this, d, h.call(this)),
|
|
135
135
|
item: n,
|
|
136
|
-
key:
|
|
137
|
-
index:
|
|
138
|
-
id: `${this.guid}-${
|
|
136
|
+
key: p,
|
|
137
|
+
index: p,
|
|
138
|
+
id: `${this.guid}-${p}`
|
|
139
139
|
}, null);
|
|
140
140
|
}, this) : null;
|
|
141
141
|
}, g = function() {
|
|
@@ -143,13 +143,13 @@ const N = /* @__PURE__ */ C({
|
|
|
143
143
|
popupSettings: n = {},
|
|
144
144
|
size: d
|
|
145
145
|
} = this.$props;
|
|
146
|
-
return o(
|
|
146
|
+
return o(v, {
|
|
147
147
|
anchor: this._anchor,
|
|
148
148
|
show: this.computedOpened,
|
|
149
149
|
animate: n.animate,
|
|
150
150
|
popupClass: S("k-menu-popup", n.popupClass),
|
|
151
|
-
anchorAlign: n.anchorAlign ||
|
|
152
|
-
popupAlign: n.popupAlign ||
|
|
151
|
+
anchorAlign: n.anchorAlign || B(e),
|
|
152
|
+
popupAlign: n.popupAlign || P(e),
|
|
153
153
|
style: e ? {
|
|
154
154
|
direction: "rtl"
|
|
155
155
|
} : void 0
|
|
@@ -168,14 +168,14 @@ const N = /* @__PURE__ */ C({
|
|
|
168
168
|
onFocusin: this.onFocus,
|
|
169
169
|
onFocusout: this.onBlur,
|
|
170
170
|
dir: t
|
|
171
|
-
}, [o(
|
|
171
|
+
}, [o(a, {
|
|
172
172
|
size: this.$props.size,
|
|
173
173
|
rounded: this.$props.rounded,
|
|
174
174
|
fillMode: this.$props.fillMode,
|
|
175
175
|
themeColor: this.$props.themeColor,
|
|
176
176
|
onClick: (n) => this.onItemClick(n, -1),
|
|
177
177
|
disabled: r || void 0,
|
|
178
|
-
tabIndex:
|
|
178
|
+
tabIndex: i,
|
|
179
179
|
accessKey: this.$props.accessKey,
|
|
180
180
|
class: this.$props.buttonClass,
|
|
181
181
|
icon: this.$props.icon,
|
|
@@ -194,8 +194,8 @@ const N = /* @__PURE__ */ C({
|
|
|
194
194
|
"aria-activedescendant": this.focusedIndex !== void 0 && this.focusedIndex >= 0 ? `${this.guid}-${this.focusedIndex}` : void 0
|
|
195
195
|
}, {
|
|
196
196
|
default: () => [this.$props.text, f]
|
|
197
|
-
}), o(
|
|
198
|
-
svgIcon:
|
|
197
|
+
}), o(a, {
|
|
198
|
+
svgIcon: E,
|
|
199
199
|
size: this.$props.size,
|
|
200
200
|
rounded: this.$props.rounded,
|
|
201
201
|
fillMode: this.$props.fillMode,
|
|
@@ -216,30 +216,32 @@ const N = /* @__PURE__ */ C({
|
|
|
216
216
|
},
|
|
217
217
|
onKeyDown(e) {
|
|
218
218
|
if (e.altKey) {
|
|
219
|
-
!this.computedOpened && e.keyCode ===
|
|
219
|
+
!this.computedOpened && e.keyCode === s.down ? (this.dispatchPopupEvent(e, !0), this.focusedIndex = 0, this.currentOpened = !0) : this.computedOpened && e.keyCode === s.up && (this.dispatchPopupEvent(e, !1), this.focusedIndex = -1, this.currentOpened = !1);
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
let t;
|
|
223
|
-
if (e.keyCode ===
|
|
223
|
+
if (e.keyCode === s.enter || e.keyCode === s.space ? (e.preventDefault(), this.dispatchClickEvent(e, this.focusedIndex), this.focusedIndex !== void 0 && this.focusedIndex >= 0 && (t = {
|
|
224
224
|
focusedIndex: this.computedOpened ? -1 : 0,
|
|
225
225
|
currentOpened: !this.computedOpened
|
|
226
|
-
}, this.dispatchPopupEvent(e, t.currentOpened))) : this.computedOpened && e.keyCode ===
|
|
226
|
+
}, this.dispatchPopupEvent(e, t.currentOpened))) : this.computedOpened && e.keyCode === s.esc && (t = {
|
|
227
227
|
focusedIndex: -1,
|
|
228
228
|
currentOpened: !1
|
|
229
229
|
}, this.dispatchPopupEvent(e, t.currentOpened)), this.computedOpened) {
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
const r = e.keyCode ===
|
|
230
|
+
const i = w(this.focusedIndex, e.keyCode, e.altKey, this.buttonsData.length);
|
|
231
|
+
i !== this.focusedIndex && (t = t || {}, t.focusedIndex = i);
|
|
232
|
+
const r = e.keyCode === s.up || e.keyCode === s.down || e.keyCode === s.left || e.keyCode === s.right;
|
|
233
233
|
!e.altKey && r && e.preventDefault();
|
|
234
234
|
}
|
|
235
235
|
t && (this.focusedIndex = t.focusedIndex, this.focused = t.focused, t.currentOpened !== void 0 && (this.currentOpened = t.currentOpened));
|
|
236
236
|
},
|
|
237
237
|
onFocus(e) {
|
|
238
|
-
this.focused || (this.$emit("focus",
|
|
238
|
+
this.focused || (this.$emit("focus", {
|
|
239
|
+
event: e
|
|
240
|
+
}), this.focused = !0), this.focusedIndex = -1, clearTimeout(this._blurTimeout);
|
|
239
241
|
},
|
|
240
242
|
onItemClick(e, t) {
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
+
const i = this.computedOpened;
|
|
244
|
+
i && (this.focusedIndex = 0, this.currentOpened = !1), this.dispatchClickEvent(e, t), i && this.dispatchPopupEvent(e, !1);
|
|
243
245
|
},
|
|
244
246
|
onBlur(e) {
|
|
245
247
|
clearTimeout(this._blurTimeout), this.createBlurTimeout(e);
|
|
@@ -247,11 +249,15 @@ const N = /* @__PURE__ */ C({
|
|
|
247
249
|
createBlurTimeout(e) {
|
|
248
250
|
const t = this;
|
|
249
251
|
this._blurTimeout = setTimeout(() => {
|
|
250
|
-
y && document.activeElement !== t.mainButton && (t.focused = !1, t.focusedIndex = -1, t.$emit("blur",
|
|
252
|
+
y && document.activeElement !== t.mainButton && (t.focused = !1, t.focusedIndex = -1, t.$emit("blur", {
|
|
253
|
+
event: e
|
|
254
|
+
}), t.computedOpened && (t.currentOpened = !1, t.dispatchPopupEvent(e, !1)));
|
|
251
255
|
}, 200);
|
|
252
256
|
},
|
|
253
257
|
dispatchClickEvent(e, t) {
|
|
254
|
-
this.isItemDisabled(t) || (t === -1 ? this.$emit("buttonclick",
|
|
258
|
+
this.isItemDisabled(t) || (t === -1 ? this.$emit("buttonclick", {
|
|
259
|
+
event: e
|
|
260
|
+
}) : this.$emit("itemclick", {
|
|
255
261
|
event: e,
|
|
256
262
|
component: this,
|
|
257
263
|
item: this.buttonsData[t],
|
|
@@ -271,7 +277,10 @@ const N = /* @__PURE__ */ C({
|
|
|
271
277
|
document.activeElement === this.element() && e.preventDefault();
|
|
272
278
|
},
|
|
273
279
|
dispatchPopupEvent(e, t) {
|
|
274
|
-
|
|
280
|
+
const i = {
|
|
281
|
+
event: e
|
|
282
|
+
};
|
|
283
|
+
this.$emit(t ? "open" : "close", i);
|
|
275
284
|
},
|
|
276
285
|
isItemDisabled(e) {
|
|
277
286
|
return this.buttonsData[e] ? this.buttonsData[e].disabled : this.$props.disabled;
|