@progress/kendo-vue-buttons 8.4.0-develop.2 → 8.4.0-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.d.ts +4 -3
- package/Button.js +1 -1
- package/Button.mjs +45 -45
- package/Chip/Chip.d.ts +6 -0
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +18 -16
- package/FloatingActionButton/FloatingActionButton.d.ts +5 -3
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +36 -39
- package/ListButton/ButtonItem.d.ts +6 -0
- package/ListButton/ButtonItem.js +1 -1
- package/ListButton/ButtonItem.mjs +14 -9
- package/ListButton/DropDownButton.d.ts +1 -4
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +99 -103
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +113 -114
- package/ListButton/messages/index.d.ts +17 -0
- package/SegmentedControl/SegmentedControl.d.ts +2 -2
- package/SmartPasteButton/SmartPasteButton.d.ts +3 -3
- package/SpeechToText/SpeechToTextButton.d.ts +2 -2
- package/dist/cdn/js/kendo-vue-buttons.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +5 -5
- package/toolbar/Toolbar.d.ts +2 -2
- package/toolbar/Toolbar.js +1 -1
- package/toolbar/Toolbar.mjs +2 -2
- package/toolbar/tools/ToolbarScrollButton.js +1 -1
- package/toolbar/tools/ToolbarScrollButton.mjs +22 -24
|
@@ -19,6 +19,8 @@ export interface ButtonItemProps {
|
|
|
19
19
|
id?: string;
|
|
20
20
|
textField?: string;
|
|
21
21
|
role?: string;
|
|
22
|
+
first?: boolean;
|
|
23
|
+
last?: boolean;
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* @hidden
|
|
@@ -32,6 +34,8 @@ declare const ButtonItem: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
32
34
|
id: PropType<string>;
|
|
33
35
|
textField: PropType<string>;
|
|
34
36
|
role: PropType<string>;
|
|
37
|
+
first: PropType<boolean>;
|
|
38
|
+
last: PropType<boolean>;
|
|
35
39
|
}>, {}, {}, {
|
|
36
40
|
wrapperClass(): object;
|
|
37
41
|
innerClass(): object;
|
|
@@ -50,6 +54,8 @@ declare const ButtonItem: import('vue').DefineComponent<import('vue').ExtractPro
|
|
|
50
54
|
id: PropType<string>;
|
|
51
55
|
textField: PropType<string>;
|
|
52
56
|
role: PropType<string>;
|
|
57
|
+
first: PropType<boolean>;
|
|
58
|
+
last: PropType<boolean>;
|
|
53
59
|
}>> & Readonly<{
|
|
54
60
|
onClick?: (event: any, index: number) => any;
|
|
55
61
|
onDown?: (event: any, index: number) => any;
|
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"),o=require("@progress/kendo-vue-common"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),o=require("@progress/kendo-vue-common"),c=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,first:Boolean,last:Boolean},computed:{wrapperClass(){return{"k-item":!0,"k-menu-item":!0,"k-first":this.$props.first,"k-last":this.$props.last,"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,a=function(){const{textField:s,index:l}=this.$props,i=e.text!==void 0?e.text:s?e[s]:e,d=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),i&&t.createVNode("span",{class:"k-menu-link-text"},[i])]);return o.getTemplate.call(this,{h:t.h,template:this.$props.dataItem.render||r,defaultRendering:d,additionalProps:{item:e,itemIndex:l,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},[a.call(this)])}});exports.ButtonItem=c;
|
|
@@ -5,9 +5,9 @@
|
|
|
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 d, 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 f = /* @__PURE__ */ d({
|
|
11
11
|
name: "KendoButtonItem",
|
|
12
12
|
emits: {
|
|
13
13
|
click: (e, n) => !0,
|
|
@@ -21,12 +21,17 @@ const x = /* @__PURE__ */ a({
|
|
|
21
21
|
dataItem: [String, Object],
|
|
22
22
|
id: String,
|
|
23
23
|
textField: String,
|
|
24
|
-
role: String
|
|
24
|
+
role: String,
|
|
25
|
+
first: Boolean,
|
|
26
|
+
last: Boolean
|
|
25
27
|
},
|
|
26
28
|
computed: {
|
|
27
29
|
wrapperClass() {
|
|
28
30
|
return {
|
|
29
31
|
"k-item": !0,
|
|
32
|
+
"k-menu-item": !0,
|
|
33
|
+
"k-first": this.$props.first,
|
|
34
|
+
"k-last": this.$props.last,
|
|
30
35
|
"k-focus": this.$props.focused
|
|
31
36
|
};
|
|
32
37
|
},
|
|
@@ -56,9 +61,9 @@ const x = /* @__PURE__ */ a({
|
|
|
56
61
|
render: o
|
|
57
62
|
} = this.$props, r = function() {
|
|
58
63
|
const {
|
|
59
|
-
textField:
|
|
64
|
+
textField: s,
|
|
60
65
|
index: l
|
|
61
|
-
} = this.$props,
|
|
66
|
+
} = this.$props, i = e.text !== void 0 ? e.text : s ? e[s] : e, a = t("span", {
|
|
62
67
|
tabindex: -1,
|
|
63
68
|
class: this.innerClass,
|
|
64
69
|
key: "icon"
|
|
@@ -75,13 +80,13 @@ const x = /* @__PURE__ */ a({
|
|
|
75
80
|
src: e.imageUrl,
|
|
76
81
|
role: "presentation",
|
|
77
82
|
key: "image"
|
|
78
|
-
}, null),
|
|
83
|
+
}, null), i && t("span", {
|
|
79
84
|
class: "k-menu-link-text"
|
|
80
|
-
}, [
|
|
85
|
+
}, [i])]);
|
|
81
86
|
return p.call(this, {
|
|
82
87
|
h: c,
|
|
83
88
|
template: this.$props.dataItem.render || o,
|
|
84
|
-
defaultRendering:
|
|
89
|
+
defaultRendering: a,
|
|
85
90
|
additionalProps: {
|
|
86
91
|
item: e,
|
|
87
92
|
itemIndex: l,
|
|
@@ -102,5 +107,5 @@ const x = /* @__PURE__ */ a({
|
|
|
102
107
|
}
|
|
103
108
|
});
|
|
104
109
|
export {
|
|
105
|
-
|
|
110
|
+
f as ButtonItem
|
|
106
111
|
};
|
|
@@ -97,10 +97,7 @@ declare const DropDownButton: import('vue').DefineComponent<import('vue').Extrac
|
|
|
97
97
|
focusedIndex: number;
|
|
98
98
|
}, {
|
|
99
99
|
computedOpened(): boolean;
|
|
100
|
-
wrapperClass():
|
|
101
|
-
'k-dropdown-button': boolean;
|
|
102
|
-
'k-focus': any;
|
|
103
|
-
};
|
|
100
|
+
wrapperClass(): any;
|
|
104
101
|
}, {
|
|
105
102
|
element(): HTMLButtonElement | null;
|
|
106
103
|
onKeyDown(event: any): void;
|
|
@@ -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"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),b=require("../Button.js"),s=require("@progress/kendo-vue-common"),$=require("./utils/navigation.js"),C=require("./ButtonItem.js"),k=require("@progress/kendo-vue-popup"),l=require("./utils/popup.js"),I=require("../package-metadata.js"),D=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:String,rounded:String,fillMode:{type:String,validator:function(e){return["flat","link","outline","solid"].includes(e)}},themeColor:{type:String,validator:function(e){return["base","dark","error","info","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(I.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(){}},setup(){return{kendoAnchorRef:i.ref(null)}},render(){const e=this.isRtl(),t=e?"rtl":void 0,{tabIndex:n,disabled:d}=this.$props,c=s.getDefaultSlots(this);this.buttonsData=this.$props.items;const h=function(){const{item:o,itemRender:p,textField:g}=this.$props,a=this.buttonsData.length;return a>0?this.buttonsData.map(function(u,r){const y=typeof u!="string"?{...u,render:s.templateRendering.call(this,u.render,s.getListeners.call(this))}:u;return i.createVNode(C.ButtonItem,{dataItem:y,textField:g,focused:this.focusedIndex===r,onClick:this.onItemClick,onDown:this.onItemDown,render:s.templateRendering.call(this,p,s.getListeners.call(this)),item:o,index:r,key:r,id:`${this.guid}-${r}`,first:r===0,last:r===a-1},null)},this):null},f=function(){const{popupSettings:o={},size:p}=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||l.getAnchorAlign(e),popupAlign:o.popupAlign||l.getPopupAlign(e),style:e?{direction:"rtl"}:void 0},{default:()=>[i.createVNode("ul",{class:"k-menu-group",role:"menu",id:this.guid},[h.call(this)])]})},m=this.$props.text||c?{default:()=>[this.$props.text,c]}:{};return i.createVNode("div",{class:this.wrapperClass,onKeydown:this.onKeyDown,onFocusin:this.onFocus,onFocusout:this.onBlur,dir:t},[i.createVNode(b.Button,{size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,onClick:this.onClickMainButton,onMousedown:this.mouseDown,disabled:d||void 0,tabIndex:n,accessKey:this.$props.accessKey,icon:this.$props.icon,svgIcon:this.$props.svgIcon,iconClass:this.$props.iconClass,class:s.classNames("k-menu-button",this.$props.buttonClass),imageUrl:this.$props.imageUrl,dir:t,ref:this._anchor,type:"button","aria-disabled":d||void 0,"aria-expanded":this.computedOpened,"aria-label":this.$props.ariaLabel||(this.$props.svgIcon||this.$props.icon||this.$props.iconClass?"Menu":void 0),"aria-controls":this.computedOpened?this.guid:void 0,"aria-activedescendant":this.computedOpened&&this.focusedIndex!==void 0&&this.focusedIndex>=0?`${this.guid}-${this.focusedIndex}`:void 0},m),f.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=$(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=D;
|
|
@@ -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
|
|
9
|
-
import { Button as
|
|
10
|
-
import { canUseDOM as
|
|
11
|
-
import
|
|
12
|
-
import { ButtonItem as
|
|
8
|
+
import { defineComponent as I, createVNode as r, ref as k } from "vue";
|
|
9
|
+
import { Button as O } from "../Button.mjs";
|
|
10
|
+
import { canUseDOM as D, Keys as s, getDefaultSlots as x, classNames as h, guid as l, validatePackage as w, templateRendering as f, getListeners as m } from "@progress/kendo-vue-common";
|
|
11
|
+
import S from "./utils/navigation.mjs";
|
|
12
|
+
import { ButtonItem as v } from "./ButtonItem.mjs";
|
|
13
13
|
import { Popup as B } from "@progress/kendo-vue-popup";
|
|
14
|
-
import { getPopupAlign as
|
|
15
|
-
import { packageMetadata as
|
|
16
|
-
const
|
|
14
|
+
import { getPopupAlign as E, getAnchorAlign as K } from "./utils/popup.mjs";
|
|
15
|
+
import { packageMetadata as P } from "../package-metadata.mjs";
|
|
16
|
+
const j = /* @__PURE__ */ I({
|
|
17
17
|
name: "KendoDropDownButton",
|
|
18
18
|
emits: {
|
|
19
|
-
focus: (
|
|
20
|
-
blur: (
|
|
21
|
-
itemclick: (
|
|
22
|
-
open: (
|
|
23
|
-
close: (
|
|
19
|
+
focus: (t) => !0,
|
|
20
|
+
blur: (t) => !0,
|
|
21
|
+
itemclick: (t) => !0,
|
|
22
|
+
open: (t) => !0,
|
|
23
|
+
close: (t) => !0
|
|
24
24
|
},
|
|
25
25
|
props: {
|
|
26
26
|
accessKey: String,
|
|
@@ -46,14 +46,14 @@ const U = /* @__PURE__ */ $({
|
|
|
46
46
|
rounded: String,
|
|
47
47
|
fillMode: {
|
|
48
48
|
type: String,
|
|
49
|
-
validator: function(
|
|
50
|
-
return ["flat", "link", "outline", "solid"].includes(
|
|
49
|
+
validator: function(t) {
|
|
50
|
+
return ["flat", "link", "outline", "solid"].includes(t);
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
themeColor: {
|
|
54
54
|
type: String,
|
|
55
|
-
validator: function(
|
|
56
|
-
return ["base", "dark", "error", "info", "inverse", "light", "primary", "secondary", "success", "tertiary", "warning"].includes(
|
|
55
|
+
validator: function(t) {
|
|
56
|
+
return ["base", "dark", "error", "info", "inverse", "light", "primary", "secondary", "success", "tertiary", "warning"].includes(t);
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
opened: {
|
|
@@ -64,7 +64,7 @@ const U = /* @__PURE__ */ $({
|
|
|
64
64
|
dir: String
|
|
65
65
|
},
|
|
66
66
|
created() {
|
|
67
|
-
this._blurTimeout = null, this._anchor =
|
|
67
|
+
this._blurTimeout = null, this._anchor = l(), this.wrapper = null, this.mainButton = null, this.guid = l(), this.buttonsData = [], w(P);
|
|
68
68
|
},
|
|
69
69
|
mounted() {
|
|
70
70
|
this.mainButton = this.$refs[this._anchor], (this.$props.dir === void 0 && this.isRtl() || this.computedOpened) && this.$forceUpdate();
|
|
@@ -84,10 +84,6 @@ const U = /* @__PURE__ */ $({
|
|
|
84
84
|
return this.$props.opened === void 0 ? this.currentOpened : this.$props.opened;
|
|
85
85
|
},
|
|
86
86
|
wrapperClass() {
|
|
87
|
-
return {
|
|
88
|
-
"k-dropdown-button": !0,
|
|
89
|
-
"k-focus": this.focused
|
|
90
|
-
};
|
|
91
87
|
}
|
|
92
88
|
},
|
|
93
89
|
setup() {
|
|
@@ -96,155 +92,155 @@ const U = /* @__PURE__ */ $({
|
|
|
96
92
|
};
|
|
97
93
|
},
|
|
98
94
|
render() {
|
|
99
|
-
const
|
|
95
|
+
const t = this.isRtl(), e = t ? "rtl" : void 0, {
|
|
100
96
|
tabIndex: i,
|
|
101
|
-
disabled:
|
|
102
|
-
} = this.$props,
|
|
97
|
+
disabled: u
|
|
98
|
+
} = this.$props, p = x(this);
|
|
103
99
|
this.buttonsData = this.$props.items;
|
|
104
|
-
const
|
|
100
|
+
const g = function() {
|
|
105
101
|
const {
|
|
106
102
|
item: n,
|
|
107
|
-
itemRender:
|
|
108
|
-
textField:
|
|
109
|
-
} = this.$props;
|
|
110
|
-
return
|
|
111
|
-
const
|
|
103
|
+
itemRender: c,
|
|
104
|
+
textField: C
|
|
105
|
+
} = this.$props, a = this.buttonsData.length;
|
|
106
|
+
return a > 0 ? this.buttonsData.map(function(d, o) {
|
|
107
|
+
const y = typeof d != "string" ? {
|
|
112
108
|
...d,
|
|
113
|
-
render:
|
|
109
|
+
render: f.call(this, d.render, m.call(this))
|
|
114
110
|
} : d;
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
focused: this.focusedIndex === u,
|
|
111
|
+
return r(v, {
|
|
112
|
+
dataItem: y,
|
|
113
|
+
textField: C,
|
|
114
|
+
focused: this.focusedIndex === o,
|
|
120
115
|
onClick: this.onItemClick,
|
|
121
116
|
onDown: this.onItemDown,
|
|
122
|
-
render:
|
|
117
|
+
render: f.call(this, c, m.call(this)),
|
|
123
118
|
item: n,
|
|
124
|
-
index:
|
|
125
|
-
key:
|
|
126
|
-
id: `${this.guid}-${
|
|
119
|
+
index: o,
|
|
120
|
+
key: o,
|
|
121
|
+
id: `${this.guid}-${o}`,
|
|
122
|
+
first: o === 0,
|
|
123
|
+
last: o === a - 1
|
|
127
124
|
}, null);
|
|
128
125
|
}, this) : null;
|
|
129
|
-
},
|
|
126
|
+
}, $ = function() {
|
|
130
127
|
const {
|
|
131
128
|
popupSettings: n = {},
|
|
132
|
-
size:
|
|
129
|
+
size: c
|
|
133
130
|
} = this.$props;
|
|
134
|
-
return
|
|
131
|
+
return r(B, {
|
|
135
132
|
anchor: this._anchor,
|
|
136
133
|
show: this.computedOpened,
|
|
137
134
|
animate: n.animate,
|
|
138
|
-
popupClass:
|
|
139
|
-
anchorAlign: n.anchorAlign ||
|
|
140
|
-
popupAlign: n.popupAlign ||
|
|
141
|
-
style:
|
|
135
|
+
popupClass: h("k-menu-popup", n.popupClass),
|
|
136
|
+
anchorAlign: n.anchorAlign || K(t),
|
|
137
|
+
popupAlign: n.popupAlign || E(t),
|
|
138
|
+
style: t ? {
|
|
142
139
|
direction: "rtl"
|
|
143
140
|
} : void 0
|
|
144
141
|
}, {
|
|
145
|
-
default: () => [
|
|
146
|
-
class:
|
|
142
|
+
default: () => [r("ul", {
|
|
143
|
+
class: "k-menu-group",
|
|
147
144
|
role: "menu",
|
|
148
145
|
id: this.guid
|
|
149
|
-
}, [
|
|
146
|
+
}, [g.call(this)])]
|
|
150
147
|
});
|
|
151
|
-
}
|
|
152
|
-
|
|
148
|
+
}, b = this.$props.text || p ? {
|
|
149
|
+
default: () => [this.$props.text, p]
|
|
150
|
+
} : {};
|
|
151
|
+
return r("div", {
|
|
153
152
|
class: this.wrapperClass,
|
|
154
153
|
onKeydown: this.onKeyDown,
|
|
155
154
|
onFocusin: this.onFocus,
|
|
156
155
|
onFocusout: this.onBlur,
|
|
157
|
-
dir:
|
|
158
|
-
}, [
|
|
156
|
+
dir: e
|
|
157
|
+
}, [r(O, {
|
|
159
158
|
size: this.$props.size,
|
|
160
159
|
rounded: this.$props.rounded,
|
|
161
160
|
fillMode: this.$props.fillMode,
|
|
162
161
|
themeColor: this.$props.themeColor,
|
|
163
162
|
onClick: this.onClickMainButton,
|
|
164
163
|
onMousedown: this.mouseDown,
|
|
165
|
-
disabled:
|
|
164
|
+
disabled: u || void 0,
|
|
166
165
|
tabIndex: i,
|
|
167
166
|
accessKey: this.$props.accessKey,
|
|
168
167
|
icon: this.$props.icon,
|
|
169
168
|
svgIcon: this.$props.svgIcon,
|
|
170
169
|
iconClass: this.$props.iconClass,
|
|
171
|
-
class: this.$props.buttonClass,
|
|
170
|
+
class: h("k-menu-button", this.$props.buttonClass),
|
|
172
171
|
imageUrl: this.$props.imageUrl,
|
|
173
|
-
dir:
|
|
172
|
+
dir: e,
|
|
174
173
|
ref: this._anchor,
|
|
175
174
|
type: "button",
|
|
176
|
-
"aria-disabled":
|
|
177
|
-
"aria-haspopup": "menu",
|
|
175
|
+
"aria-disabled": u || void 0,
|
|
178
176
|
"aria-expanded": this.computedOpened,
|
|
179
|
-
"aria-label": this.$props.ariaLabel ||
|
|
180
|
-
"aria-controls": this.guid,
|
|
181
|
-
"aria-activedescendant": this.focusedIndex !== void 0 && this.focusedIndex >= 0 ? `${this.guid}-${this.focusedIndex}` : void 0
|
|
182
|
-
},
|
|
183
|
-
default: () => [this.$props.text, l]
|
|
184
|
-
}), m.call(this)]);
|
|
177
|
+
"aria-label": this.$props.ariaLabel || (this.$props.svgIcon || this.$props.icon || this.$props.iconClass ? "Menu" : void 0),
|
|
178
|
+
"aria-controls": this.computedOpened ? this.guid : void 0,
|
|
179
|
+
"aria-activedescendant": this.computedOpened && this.focusedIndex !== void 0 && this.focusedIndex >= 0 ? `${this.guid}-${this.focusedIndex}` : void 0
|
|
180
|
+
}, b), $.call(this)]);
|
|
185
181
|
},
|
|
186
182
|
methods: {
|
|
187
183
|
element() {
|
|
188
184
|
return this.mainButton;
|
|
189
185
|
},
|
|
190
|
-
onKeyDown(
|
|
191
|
-
if (
|
|
192
|
-
!this.computedOpened &&
|
|
186
|
+
onKeyDown(t) {
|
|
187
|
+
if (t.altKey) {
|
|
188
|
+
!this.computedOpened && t.keyCode === s.down ? (this.dispatchPopupEvent(t, !0), this.focusedIndex = 0, this.currentOpened = !0) : this.computedOpened && t.keyCode === s.up && (this.dispatchPopupEvent(t, !1), this.focusedIndex = -1, this.currentOpened = !1);
|
|
193
189
|
return;
|
|
194
190
|
}
|
|
195
|
-
if (
|
|
196
|
-
const
|
|
197
|
-
this.focusedIndex =
|
|
198
|
-
const i =
|
|
199
|
-
!
|
|
191
|
+
if (t.keyCode === s.enter || t.keyCode === s.space ? (this.focusedIndex !== void 0 && this.focusedIndex >= 0 && this.dispatchClickEvent(t, this.focusedIndex), t.preventDefault(), this.focusedIndex = this.computedOpened ? -1 : 0, this.currentOpened = !this.computedOpened, this.dispatchPopupEvent(t, this.currentOpened)) : this.computedOpened && t.keyCode === s.esc && (this.focusedIndex = -1, this.currentOpened = !1, this.dispatchPopupEvent(t, this.currentOpened)), this.computedOpened) {
|
|
192
|
+
const e = S(this.focusedIndex, t.keyCode, t.altKey, this.buttonsData.length);
|
|
193
|
+
this.focusedIndex = e;
|
|
194
|
+
const i = t.keyCode === s.up || t.keyCode === s.down || t.keyCode === s.left || t.keyCode === s.right;
|
|
195
|
+
!t.altKey && i && t.preventDefault();
|
|
200
196
|
}
|
|
201
197
|
},
|
|
202
|
-
onFocus(
|
|
198
|
+
onFocus(t) {
|
|
203
199
|
this.focused || (this.focused = !0, this.$emit("focus", {
|
|
204
|
-
event:
|
|
200
|
+
event: t
|
|
205
201
|
})), this.focusedIndex = this.computedOpened ? 0 : -1, clearTimeout(this._blurTimeout);
|
|
206
202
|
},
|
|
207
|
-
onBlur(
|
|
208
|
-
clearTimeout(this._blurTimeout), this.createBlurTimeout(
|
|
203
|
+
onBlur(t) {
|
|
204
|
+
clearTimeout(this._blurTimeout), this.createBlurTimeout(t);
|
|
209
205
|
},
|
|
210
|
-
createBlurTimeout(
|
|
211
|
-
const
|
|
206
|
+
createBlurTimeout(t) {
|
|
207
|
+
const e = this;
|
|
212
208
|
this._blurTimeout = setTimeout(() => {
|
|
213
|
-
|
|
214
|
-
event:
|
|
215
|
-
}),
|
|
209
|
+
D && document.activeElement !== e.$el && (e.focused = !1, e.focusedIndex = -1, e.$emit("blur", {
|
|
210
|
+
event: t
|
|
211
|
+
}), e.computedOpened && (e.currentOpened = !1, e.dispatchPopupEvent(t, !1)));
|
|
216
212
|
}, 200);
|
|
217
213
|
},
|
|
218
|
-
onItemClick(
|
|
219
|
-
this.focusedIndex = -1, this.currentOpened = !1, this.dispatchClickEvent(
|
|
214
|
+
onItemClick(t, e) {
|
|
215
|
+
this.focusedIndex = -1, this.currentOpened = !1, this.dispatchClickEvent(t, e), this.dispatchPopupEvent(t, !1);
|
|
220
216
|
},
|
|
221
|
-
onItemDown(
|
|
222
|
-
document.activeElement === this.element() &&
|
|
217
|
+
onItemDown(t) {
|
|
218
|
+
document.activeElement === this.element() && t.preventDefault();
|
|
223
219
|
},
|
|
224
|
-
mouseDown(
|
|
225
|
-
|
|
220
|
+
mouseDown(t) {
|
|
221
|
+
t.preventDefault();
|
|
226
222
|
},
|
|
227
|
-
dispatchClickEvent(
|
|
228
|
-
this.isItemDisabled(
|
|
229
|
-
event:
|
|
230
|
-
item: this.buttonsData[
|
|
231
|
-
itemIndex:
|
|
223
|
+
dispatchClickEvent(t, e) {
|
|
224
|
+
this.isItemDisabled(e) || this.$emit("itemclick", {
|
|
225
|
+
event: t,
|
|
226
|
+
item: this.buttonsData[e],
|
|
227
|
+
itemIndex: e
|
|
232
228
|
});
|
|
233
229
|
},
|
|
234
|
-
onClickMainButton(
|
|
230
|
+
onClickMainButton(t) {
|
|
235
231
|
if (!this.buttonsData.length)
|
|
236
232
|
return;
|
|
237
|
-
const
|
|
238
|
-
this.currentOpened =
|
|
233
|
+
const e = !this.computedOpened;
|
|
234
|
+
this.currentOpened = e, this.focused = !0, this.focusedIndex = e ? 0 : -1, this.dispatchPopupEvent(t, e);
|
|
239
235
|
},
|
|
240
|
-
dispatchPopupEvent(
|
|
236
|
+
dispatchPopupEvent(t, e) {
|
|
241
237
|
const i = {
|
|
242
|
-
event:
|
|
238
|
+
event: t
|
|
243
239
|
};
|
|
244
|
-
this.$emit(
|
|
240
|
+
this.$emit(e ? "open" : "close", i);
|
|
245
241
|
},
|
|
246
|
-
isItemDisabled(
|
|
247
|
-
return this.buttonsData[
|
|
242
|
+
isItemDisabled(t) {
|
|
243
|
+
return this.buttonsData[t] ? this.buttonsData[t].disabled : this.$props.disabled;
|
|
248
244
|
},
|
|
249
245
|
isRtl() {
|
|
250
246
|
return this.$props.dir !== void 0 ? this.$props.dir === "rtl" : !!this.$el && getComputedStyle(this.$el).direction === "rtl";
|
|
@@ -252,5 +248,5 @@ const U = /* @__PURE__ */ $({
|
|
|
252
248
|
}
|
|
253
249
|
});
|
|
254
250
|
export {
|
|
255
|
-
|
|
251
|
+
j as DropDownButton
|
|
256
252
|
};
|
|
@@ -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"),l=require("../Button.js"),s=require("@progress/kendo-vue-common"),C=require("./ButtonItem.js"),$=require("./utils/navigation.js"),k=require("@progress/kendo-vue-popup"),h=require("./utils/popup.js"),O=require("@progress/kendo-svg-icons"),S=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:String,rounded:String,fillMode:{type:String,validator:function(e){return["flat","link","outline","solid"].includes(e)}},themeColor:{type:String,validator:function(e){return["base","dark","error","info","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=s.guid(),this.mainButton=null,this.guid=s.guid(),this.buttonsData=[],s.validatePackage(S.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:i,disabled:u}=this.$props,c=s.getDefaultSlots(this),f=function(){const{item:n,itemRender:p,textField:b}=this.$props,a=this.buttonsData.length;return a>0?this.buttonsData.map(function(d,r){const y=typeof d!="string"?{...d,render:s.templateRendering.call(this,d.render,s.getListeners.call(this))}:d;return o.createVNode(C.ButtonItem,{role:"menuitem",dataItem:y,textField:b,focused:this.focusedIndex===r,onClick:this.onItemClick,onDown:this.onItemDown,render:s.templateRendering.call(this,p,s.getListeners.call(this)),item:n,key:r,index:r,id:`${this.guid}-${r}`,first:r===0,last:r===a-1},null)},this):null},m=function(){const{popupSettings:n={},size:p}=this.$props;return o.createVNode(k.Popup,{anchor:this._anchor,show:this.computedOpened,animate:n.animate,popupClass:s.classNames("k-menu-popup",n.popupClass),anchorAlign:n.anchorAlign||h.getAnchorAlign(e),popupAlign:n.popupAlign||h.getPopupAlign(e),style:e?{direction:"rtl"}:void 0},{default:()=>[o.createVNode("ul",{class:"k-menu-group",role:"menu",id:this.guid},[f.call(this)])]})},g=this.$props.text||c?{default:()=>[this.$props.text,c]}:{};return o.createVNode("div",{class:this.wrapperClass,onKeydown:this.onKeyDown,onFocusin:this.onFocus,onFocusout:this.onBlur,dir:t},[o.createVNode(l.Button,{size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,onClick:n=>this.onItemClick(n,-1),disabled:u||void 0,tabIndex:i,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":u||void 0,"aria-label":this.$props.ariaLabel||(!this.$props.text&&!c&&(this.$props.svgIcon||this.$props.icon||this.$props.iconClass)?"Action":void 0)},g),o.createVNode(l.Button,{svgIcon:O.chevronDownIcon,size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,icon:"chevron-down",class:"k-split-button-arrow",disabled:u||void 0,tabIndex:-1,onClick:this.onSplitPartClick,onMousedown:this.onDownSplitPart,onPointerdown:this.onDownSplitPart,dir:t,"aria-label":"Toggle dropdown","aria-expanded":this.computedOpened,"aria-controls":this.computedOpened?this.guid:void 0},null),m.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}let t;if(e.keyCode===s.Keys.enter||e.keyCode===s.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===s.Keys.esc&&(t={focusedIndex:-1,currentOpened:!1},this.dispatchPopupEvent(e,t.currentOpened)),this.computedOpened){const i=$(this.focusedIndex,e.keyCode,e.altKey,this.buttonsData.length);i!==this.focusedIndex&&(t=t||{},t.focusedIndex=i);const u=e.keyCode===s.Keys.up||e.keyCode===s.Keys.down||e.keyCode===s.Keys.left||e.keyCode===s.Keys.right;!e.altKey&&u&&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 i=this.computedOpened;i&&(this.focusedIndex=0,this.currentOpened=!1),this.dispatchClickEvent(e,t),i&&this.dispatchPopupEvent(e,!1)},onBlur(e){clearTimeout(this._blurTimeout),this.createBlurTimeout(e)},createBlurTimeout(e){const t=this;this._blurTimeout=setTimeout(()=>{s.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 i={event:e};this.$emit(t?"open":"close",i)},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;
|