@progress/kendo-vue-buttons 7.1.0-develop.6 → 7.1.0-develop.7
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 +58 -76
- package/Chip/Chip.js +1 -1
- package/Chip/Chip.mjs +22 -30
- package/Chip/ChipList.js +1 -1
- package/Chip/ChipList.mjs +6 -13
- package/FloatingActionButton/FloatingActionButton.js +1 -1
- package/FloatingActionButton/FloatingActionButton.mjs +64 -87
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +24 -40
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +8 -16
- package/SpeechToText/SpeechToTextButton.js +1 -1
- package/SpeechToText/SpeechToTextButton.mjs +34 -47
- package/dist/cdn/js/kendo-vue-buttons.js +1 -1
- package/index.d.mts +122 -387
- package/index.d.ts +122 -387
- 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 +2 -4
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import { defineComponent as w, createVNode as o, ref as g } from "vue";
|
|
9
|
-
import { templateRendering as
|
|
9
|
+
import { templateRendering as M, getListeners as S, getTabIndex as A, Icon as $, classNames as p, setRef as k, Keys as n, canUseDOM as F, kendoThemeMaps as I, getRef as x, validatePackage as R, guid as c } from "@progress/kendo-vue-common";
|
|
10
10
|
import { FloatingActionButtonItem as E } from "./FloatingActionButtonItem.mjs";
|
|
11
11
|
import { packageMetadata as B } from "../package-metadata.mjs";
|
|
12
|
-
import { getPopupAlign as N, getAnchorAlign as P, position as
|
|
12
|
+
import { getPopupAlign as N, getAnchorAlign as P, position as O, getTextDirectionClass as K } from "./utils.mjs";
|
|
13
13
|
import { Popup as j } from "@progress/kendo-vue-popup";
|
|
14
14
|
const G = /* @__PURE__ */ w({
|
|
15
15
|
name: "KendoVueFloatingActionButton",
|
|
@@ -54,35 +54,15 @@ const G = /* @__PURE__ */ w({
|
|
|
54
54
|
return {};
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
|
|
58
|
-
type: String,
|
|
59
|
-
default: function() {
|
|
60
|
-
return "rectangle";
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
rounded: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: "full"
|
|
66
|
-
},
|
|
57
|
+
rounded: String,
|
|
67
58
|
fillMode: {
|
|
68
59
|
type: String,
|
|
69
|
-
default: "solid",
|
|
70
60
|
validator: function(e) {
|
|
71
|
-
return [
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
size: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: function() {
|
|
77
|
-
return "medium";
|
|
61
|
+
return ["flat", "link", "outline", "solid"].includes(e);
|
|
78
62
|
}
|
|
79
63
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
default: function() {
|
|
83
|
-
return "primary";
|
|
84
|
-
}
|
|
85
|
-
}
|
|
64
|
+
size: String,
|
|
65
|
+
themeColor: String
|
|
86
66
|
},
|
|
87
67
|
emits: {
|
|
88
68
|
click: (e) => !0,
|
|
@@ -105,31 +85,28 @@ const G = /* @__PURE__ */ w({
|
|
|
105
85
|
};
|
|
106
86
|
},
|
|
107
87
|
created() {
|
|
108
|
-
R(B), this.element = void 0, this._anchor =
|
|
88
|
+
R(B), this.element = void 0, this._anchor = c(), this.listId = c(), this.buttonId = c();
|
|
109
89
|
},
|
|
110
90
|
mounted() {
|
|
111
|
-
this.element = this.kendoAnchorRef, this.list = x(this, "list"), this.popup = x(this, "popup"), this.currentDir = this.$props.dir !== void 0 ? this.$props.dir : this.$el && getComputedStyle(this.$el).direction === "rtl" || !1, this.isRtl = this.currentDir === "rtl", this.opened !== void 0 &&
|
|
91
|
+
this.element = this.kendoAnchorRef, this.list = x(this, "list"), this.popup = x(this, "popup"), this.currentDir = this.$props.dir !== void 0 ? this.$props.dir : this.$el && getComputedStyle(this.$el).direction === "rtl" || !1, this.isRtl = this.currentDir === "rtl", this.opened !== void 0 && O(this.$el, this.$props.align, this.$props.alignOffset, this.isRtl);
|
|
112
92
|
},
|
|
113
93
|
updated() {
|
|
114
|
-
|
|
94
|
+
O(this.$el, this.$props.align, this.$props.alignOffset, this.isRtl), this.currentFocused && this.element && this.element.focus();
|
|
115
95
|
},
|
|
116
96
|
computed: {
|
|
117
97
|
buttonClassNames() {
|
|
118
98
|
const {
|
|
119
99
|
size: e,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
fillMode: r,
|
|
124
|
-
rounded: a
|
|
100
|
+
themeColor: t,
|
|
101
|
+
fillMode: i,
|
|
102
|
+
rounded: s
|
|
125
103
|
} = this.$props;
|
|
126
104
|
return {
|
|
127
105
|
"k-fab": !0,
|
|
128
|
-
[`k-fab-${s || "rectangle"}`]: s !== null,
|
|
129
106
|
[`k-fab-${I.sizeMap[e] || e}`]: e,
|
|
130
|
-
[`k-rounded-${I.roundedMap[
|
|
131
|
-
[`k-fab-${
|
|
132
|
-
[`k-fab-${
|
|
107
|
+
[`k-rounded-${I.roundedMap[s] || s}`]: s,
|
|
108
|
+
[`k-fab-${i}`]: i,
|
|
109
|
+
[`k-fab-${t}`]: t,
|
|
133
110
|
"k-disabled": this.$props.disabled,
|
|
134
111
|
"k-focus": this.currentFocused,
|
|
135
112
|
[`k-${this.$props.align.vertical}-${this.$props.align.horizontal}`]: !0
|
|
@@ -139,7 +116,7 @@ const G = /* @__PURE__ */ w({
|
|
|
139
116
|
return this.$props.opened === void 0 ? this.currentOpened : this.$props.opened;
|
|
140
117
|
},
|
|
141
118
|
rootClassNames() {
|
|
142
|
-
return
|
|
119
|
+
return p({
|
|
143
120
|
"k-pos-absolute": this.$props.positionMode === "absolute",
|
|
144
121
|
"k-pos-fixed": this.$props.positionMode === "fixed"
|
|
145
122
|
});
|
|
@@ -190,7 +167,7 @@ const G = /* @__PURE__ */ w({
|
|
|
190
167
|
F && document.activeElement === this.element && e.preventDefault();
|
|
191
168
|
},
|
|
192
169
|
handleKeyDown(e) {
|
|
193
|
-
const t = this.focusedIndex,
|
|
170
|
+
const t = this.focusedIndex, i = this.$props.items ? this.$props.items.length - 1 : -1, s = this.$props.align.vertical === "bottom";
|
|
194
171
|
switch (e.keyCode) {
|
|
195
172
|
case n.enter:
|
|
196
173
|
case n.space:
|
|
@@ -203,15 +180,15 @@ const G = /* @__PURE__ */ w({
|
|
|
203
180
|
e.preventDefault(), this.focusedIndex = 0;
|
|
204
181
|
break;
|
|
205
182
|
case n.end:
|
|
206
|
-
e.preventDefault(), this.focusedIndex =
|
|
183
|
+
e.preventDefault(), this.focusedIndex = i;
|
|
207
184
|
break;
|
|
208
185
|
case n.down:
|
|
209
186
|
case n.right:
|
|
210
|
-
e.preventDefault(), t <
|
|
187
|
+
e.preventDefault(), t < i && !s && (this.focusedIndex = t + 1), t > 0 && s && (this.focusedIndex = t - 1);
|
|
211
188
|
break;
|
|
212
189
|
case n.up:
|
|
213
190
|
case n.left:
|
|
214
|
-
e.preventDefault(), t > 0 && !
|
|
191
|
+
e.preventDefault(), t > 0 && !s && (this.focusedIndex = t - 1), t < i && s && (this.focusedIndex = t + 1);
|
|
215
192
|
break;
|
|
216
193
|
}
|
|
217
194
|
this.$emit("keydown", e, void 0);
|
|
@@ -228,48 +205,48 @@ const G = /* @__PURE__ */ w({
|
|
|
228
205
|
const {
|
|
229
206
|
align: e,
|
|
230
207
|
disabled: t,
|
|
231
|
-
icon:
|
|
232
|
-
svgIcon:
|
|
233
|
-
iconClass:
|
|
234
|
-
id:
|
|
235
|
-
items:
|
|
236
|
-
text:
|
|
237
|
-
tabIndex:
|
|
238
|
-
accessKey:
|
|
239
|
-
popupSettings:
|
|
240
|
-
} = this.$props,
|
|
241
|
-
return
|
|
208
|
+
icon: i,
|
|
209
|
+
svgIcon: s,
|
|
210
|
+
iconClass: h,
|
|
211
|
+
id: f,
|
|
212
|
+
items: r,
|
|
213
|
+
text: a,
|
|
214
|
+
tabIndex: v,
|
|
215
|
+
accessKey: C,
|
|
216
|
+
popupSettings: l
|
|
217
|
+
} = this.$props, y = M.call(this, this.$props.item, S.call(this)), D = function() {
|
|
218
|
+
return r && r.map(function(d, u) {
|
|
242
219
|
return o(E, {
|
|
243
|
-
key:
|
|
244
|
-
index:
|
|
245
|
-
id: `${this.listId}-${
|
|
246
|
-
disabled: t ||
|
|
247
|
-
focused: this.focusedIndex ===
|
|
248
|
-
dataItem:
|
|
249
|
-
item:
|
|
250
|
-
class:
|
|
220
|
+
key: u,
|
|
221
|
+
index: u,
|
|
222
|
+
id: `${this.listId}-${u}`,
|
|
223
|
+
disabled: t || d.disabled,
|
|
224
|
+
focused: this.focusedIndex === u,
|
|
225
|
+
dataItem: d,
|
|
226
|
+
item: y,
|
|
227
|
+
class: p(d.className, K(this.currentDir || "ltr", e.horizontal)),
|
|
251
228
|
onClick: this.handleItemClick,
|
|
252
229
|
onDown: this.handleItemDown
|
|
253
230
|
}, null);
|
|
254
231
|
}, this);
|
|
255
|
-
}, m =
|
|
232
|
+
}, m = i && !a, b = (this.element ? this.element.offsetWidth : 0) / 2 - 32 / 2;
|
|
256
233
|
return o("div", {
|
|
257
234
|
class: this.rootClassNames
|
|
258
235
|
}, [o("button", {
|
|
259
|
-
ref: (
|
|
260
|
-
this.kendoAnchorRef =
|
|
236
|
+
ref: (d) => {
|
|
237
|
+
this.kendoAnchorRef = d;
|
|
261
238
|
},
|
|
262
|
-
id:
|
|
263
|
-
role:
|
|
239
|
+
id: f || this.buttonId,
|
|
240
|
+
role: r ? "menubutton" : "button",
|
|
264
241
|
type: "button",
|
|
265
242
|
"aria-disabled": t,
|
|
266
|
-
"aria-expanded":
|
|
267
|
-
"aria-haspopup": !!
|
|
268
|
-
"aria-label": `${
|
|
269
|
-
"aria-owns":
|
|
270
|
-
"aria-activedescendant": this.focusedIndex >= 0 &&
|
|
271
|
-
tabindex: A(
|
|
272
|
-
accesskey:
|
|
243
|
+
"aria-expanded": r ? this.computedOpened : void 0,
|
|
244
|
+
"aria-haspopup": !!r,
|
|
245
|
+
"aria-label": `${a || ""} floatingactionbutton`,
|
|
246
|
+
"aria-owns": r ? this.listId : void 0,
|
|
247
|
+
"aria-activedescendant": this.focusedIndex >= 0 && r ? `${this.listId}-${this.focusedIndex}` : void 0,
|
|
248
|
+
tabindex: A(v, t),
|
|
249
|
+
accesskey: C,
|
|
273
250
|
dir: this.currentDir,
|
|
274
251
|
disabled: t,
|
|
275
252
|
class: this.buttonClassNames,
|
|
@@ -279,22 +256,22 @@ const G = /* @__PURE__ */ w({
|
|
|
279
256
|
onFocusin: this.handleFocus,
|
|
280
257
|
onBlur: this.handleBlur,
|
|
281
258
|
onKeydown: this.handleKeyDown
|
|
282
|
-
}, [
|
|
283
|
-
name:
|
|
284
|
-
icon:
|
|
259
|
+
}, [i || s ? o($, {
|
|
260
|
+
name: i,
|
|
261
|
+
icon: s,
|
|
285
262
|
class: "k-fab-icon"
|
|
286
|
-
}, null) :
|
|
287
|
-
class:
|
|
288
|
-
}, null) : null,
|
|
263
|
+
}, null) : h ? o($, {
|
|
264
|
+
class: h
|
|
265
|
+
}, null) : null, a && o("span", {
|
|
289
266
|
class: "k-fab-text"
|
|
290
|
-
}, [
|
|
267
|
+
}, [a])]), o(j, {
|
|
291
268
|
ref: k(this, "popup"),
|
|
292
269
|
show: this.computedOpened,
|
|
293
270
|
anchor: this._anchor,
|
|
294
|
-
animate:
|
|
295
|
-
popupClass:
|
|
296
|
-
anchorAlign:
|
|
297
|
-
popupAlign:
|
|
271
|
+
animate: l.animate,
|
|
272
|
+
popupClass: p("k-popup-transparent k-fab-popup", l.popupClass),
|
|
273
|
+
anchorAlign: l.anchorAlign || P(e, this.isRtl),
|
|
274
|
+
popupAlign: l.popupAlign || N(e, this.isRtl),
|
|
298
275
|
style: {
|
|
299
276
|
boxShadow: "none"
|
|
300
277
|
}
|
|
@@ -302,9 +279,9 @@ const G = /* @__PURE__ */ w({
|
|
|
302
279
|
default: () => [o("ul", {
|
|
303
280
|
ref: k(this, "list"),
|
|
304
281
|
role: "menu",
|
|
305
|
-
"aria-labelledby":
|
|
282
|
+
"aria-labelledby": f,
|
|
306
283
|
id: this.listId,
|
|
307
|
-
class:
|
|
284
|
+
class: p("k-fab-items", {
|
|
308
285
|
"k-fab-items-bottom": e.vertical !== "bottom",
|
|
309
286
|
"k-fab-items-top": e.vertical === "bottom"
|
|
310
287
|
}),
|
|
@@ -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"),
|
|
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"),a=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: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($.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:p}=this.$props,c=s.getDefaultSlots(this);this.buttonsData=this.$props.items;const h=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},l=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||a.getAnchorAlign(e),popupAlign:o.popupAlign||a.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},[h.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,rounded:this.$props.rounded,fillMode:this.$props.fillMode,themeColor:this.$props.themeColor,onClick:this.onClickMainButton,onMousedown:this.mouseDown,disabled:p||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":p,"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]}),l.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;
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import { defineComponent as $, createVNode as o, ref as k } from "vue";
|
|
9
|
-
import { Button as
|
|
10
|
-
import { canUseDOM as
|
|
9
|
+
import { Button as C } from "../Button.mjs";
|
|
10
|
+
import { canUseDOM as y, Keys as s, getDefaultSlots as I, guid as a, validatePackage as D, classNames as O, kendoThemeMaps as x, templateRendering as c, getListeners as h } 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
|
|
13
|
+
import { Popup as B } from "@progress/kendo-vue-popup";
|
|
14
|
+
import { getPopupAlign as v, getAnchorAlign as E } from "./utils/popup.mjs";
|
|
15
15
|
import { packageMetadata as K } from "../package-metadata.mjs";
|
|
16
16
|
const U = /* @__PURE__ */ $({
|
|
17
17
|
name: "KendoDropDownButton",
|
|
@@ -42,33 +42,18 @@ const U = /* @__PURE__ */ $({
|
|
|
42
42
|
popupSettings: Object,
|
|
43
43
|
itemRender: [String, Object, Function],
|
|
44
44
|
item: Function,
|
|
45
|
-
size:
|
|
46
|
-
|
|
47
|
-
default: "medium"
|
|
48
|
-
},
|
|
49
|
-
shape: {
|
|
50
|
-
type: String,
|
|
51
|
-
default: "rectangle",
|
|
52
|
-
validator: function(e) {
|
|
53
|
-
return [null, "rectangle", "square"].includes(e);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
rounded: {
|
|
57
|
-
type: String,
|
|
58
|
-
default: "medium"
|
|
59
|
-
},
|
|
45
|
+
size: String,
|
|
46
|
+
rounded: String,
|
|
60
47
|
fillMode: {
|
|
61
48
|
type: String,
|
|
62
|
-
default: "solid",
|
|
63
49
|
validator: function(e) {
|
|
64
|
-
return [
|
|
50
|
+
return ["flat", "link", "outline", "solid"].includes(e);
|
|
65
51
|
}
|
|
66
52
|
},
|
|
67
53
|
themeColor: {
|
|
68
54
|
type: String,
|
|
69
|
-
default: "base",
|
|
70
55
|
validator: function(e) {
|
|
71
|
-
return [
|
|
56
|
+
return ["base", "dark", "error", "info", "inverse", "light", "primary", "secondary", "success", "tertiary", "warning"].includes(e);
|
|
72
57
|
}
|
|
73
58
|
},
|
|
74
59
|
opened: {
|
|
@@ -114,7 +99,7 @@ const U = /* @__PURE__ */ $({
|
|
|
114
99
|
const e = this.isRtl(), t = e ? "rtl" : void 0, {
|
|
115
100
|
tabIndex: i,
|
|
116
101
|
disabled: p
|
|
117
|
-
} = this.$props,
|
|
102
|
+
} = this.$props, l = I(this);
|
|
118
103
|
this.buttonsData = this.$props.items;
|
|
119
104
|
const f = function() {
|
|
120
105
|
const {
|
|
@@ -122,23 +107,23 @@ const U = /* @__PURE__ */ $({
|
|
|
122
107
|
itemRender: r,
|
|
123
108
|
textField: g
|
|
124
109
|
} = this.$props;
|
|
125
|
-
return this.buttonsData.length > 0 ? this.buttonsData.map(function(
|
|
126
|
-
const b = typeof
|
|
127
|
-
...
|
|
128
|
-
render: c.call(this,
|
|
129
|
-
} :
|
|
110
|
+
return this.buttonsData.length > 0 ? this.buttonsData.map(function(d, u) {
|
|
111
|
+
const b = typeof d != "string" ? {
|
|
112
|
+
...d,
|
|
113
|
+
render: c.call(this, d.render, h.call(this))
|
|
114
|
+
} : d;
|
|
130
115
|
return o(S, {
|
|
131
116
|
class: "k-menu-item",
|
|
132
117
|
dataItem: b,
|
|
133
118
|
textField: g,
|
|
134
|
-
focused: this.focusedIndex ===
|
|
119
|
+
focused: this.focusedIndex === u,
|
|
135
120
|
onClick: this.onItemClick,
|
|
136
121
|
onDown: this.onItemDown,
|
|
137
|
-
render: c.call(this, r,
|
|
122
|
+
render: c.call(this, r, h.call(this)),
|
|
138
123
|
item: n,
|
|
139
|
-
index:
|
|
140
|
-
key:
|
|
141
|
-
id: `${this.guid}-${
|
|
124
|
+
index: u,
|
|
125
|
+
key: u,
|
|
126
|
+
id: `${this.guid}-${u}`
|
|
142
127
|
}, null);
|
|
143
128
|
}, this) : null;
|
|
144
129
|
}, m = function() {
|
|
@@ -146,13 +131,13 @@ const U = /* @__PURE__ */ $({
|
|
|
146
131
|
popupSettings: n = {},
|
|
147
132
|
size: r
|
|
148
133
|
} = this.$props;
|
|
149
|
-
return o(
|
|
134
|
+
return o(B, {
|
|
150
135
|
anchor: this._anchor,
|
|
151
136
|
show: this.computedOpened,
|
|
152
137
|
animate: n.animate,
|
|
153
138
|
popupClass: O("k-menu-popup", n.popupClass),
|
|
154
139
|
anchorAlign: n.anchorAlign || E(e),
|
|
155
|
-
popupAlign: n.popupAlign ||
|
|
140
|
+
popupAlign: n.popupAlign || v(e),
|
|
156
141
|
style: e ? {
|
|
157
142
|
direction: "rtl"
|
|
158
143
|
} : void 0
|
|
@@ -170,9 +155,8 @@ const U = /* @__PURE__ */ $({
|
|
|
170
155
|
onFocusin: this.onFocus,
|
|
171
156
|
onFocusout: this.onBlur,
|
|
172
157
|
dir: t
|
|
173
|
-
}, [o(
|
|
158
|
+
}, [o(C, {
|
|
174
159
|
size: this.$props.size,
|
|
175
|
-
shape: this.$props.shape,
|
|
176
160
|
rounded: this.$props.rounded,
|
|
177
161
|
fillMode: this.$props.fillMode,
|
|
178
162
|
themeColor: this.$props.themeColor,
|
|
@@ -196,7 +180,7 @@ const U = /* @__PURE__ */ $({
|
|
|
196
180
|
"aria-controls": this.guid,
|
|
197
181
|
"aria-activedescendant": this.focusedIndex !== void 0 && this.focusedIndex >= 0 ? `${this.guid}-${this.focusedIndex}` : void 0
|
|
198
182
|
}, {
|
|
199
|
-
default: () => [this.$props.text,
|
|
183
|
+
default: () => [this.$props.text, l]
|
|
200
184
|
}), m.call(this)]);
|
|
201
185
|
},
|
|
202
186
|
methods: {
|
|
@@ -226,7 +210,7 @@ const U = /* @__PURE__ */ $({
|
|
|
226
210
|
createBlurTimeout(e) {
|
|
227
211
|
const t = this;
|
|
228
212
|
this._blurTimeout = setTimeout(() => {
|
|
229
|
-
|
|
213
|
+
y && document.activeElement !== t.$el && (t.focused = !1, t.focusedIndex = -1, t.$emit("blur", {
|
|
230
214
|
event: e
|
|
231
215
|
}), t.computedOpened && (t.currentOpened = !1, t.dispatchPopupEvent(e, !1)));
|
|
232
216
|
}, 200);
|
|
@@ -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"),a=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: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=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,c){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===c,onClick:this.onItemClick,onDown:this.onItemDown,render:i.templateRendering.call(this,u,i.getListeners.call(this)),item:n,key:c,index:c,id:`${this.guid}-${c}`},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(a.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(a.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;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { defineComponent as C, createVNode as o, ref as k } from "vue";
|
|
9
9
|
import { Button as a } from "../Button.mjs";
|
|
10
|
-
import { canUseDOM as y, Keys as s, getDefaultSlots as I, guid as
|
|
10
|
+
import { canUseDOM as y, Keys as s, getDefaultSlots as I, guid as c, validatePackage as O, classNames as S, kendoThemeMaps as x, templateRendering as l, 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
13
|
import { Popup as v } from "@progress/kendo-vue-popup";
|
|
@@ -39,26 +39,18 @@ const N = /* @__PURE__ */ C({
|
|
|
39
39
|
disabled: Boolean,
|
|
40
40
|
icon: String,
|
|
41
41
|
svgIcon: Object,
|
|
42
|
-
size:
|
|
43
|
-
|
|
44
|
-
default: "medium"
|
|
45
|
-
},
|
|
46
|
-
rounded: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: "medium"
|
|
49
|
-
},
|
|
42
|
+
size: String,
|
|
43
|
+
rounded: String,
|
|
50
44
|
fillMode: {
|
|
51
45
|
type: String,
|
|
52
|
-
default: "solid",
|
|
53
46
|
validator: function(e) {
|
|
54
|
-
return [
|
|
47
|
+
return ["flat", "link", "outline", "solid"].includes(e);
|
|
55
48
|
}
|
|
56
49
|
},
|
|
57
50
|
themeColor: {
|
|
58
51
|
type: String,
|
|
59
|
-
default: "base",
|
|
60
52
|
validator: function(e) {
|
|
61
|
-
return [
|
|
53
|
+
return ["base", "dark", "error", "info", "inverse", "light", "primary", "secondary", "success", "tertiary", "warning"].includes(e);
|
|
62
54
|
}
|
|
63
55
|
},
|
|
64
56
|
opened: {
|
|
@@ -82,7 +74,7 @@ const N = /* @__PURE__ */ C({
|
|
|
82
74
|
};
|
|
83
75
|
},
|
|
84
76
|
created() {
|
|
85
|
-
this._blurTimeout = null, this._anchor =
|
|
77
|
+
this._blurTimeout = null, this._anchor = c(), this.mainButton = null, this.guid = c(), this.buttonsData = [], O(K);
|
|
86
78
|
},
|
|
87
79
|
mounted() {
|
|
88
80
|
this.mainButton = this.$refs[this._anchor], (this.$props.dir === void 0 && this.isRtl() || this.computedOpened) && this.$forceUpdate();
|
|
@@ -121,7 +113,7 @@ const N = /* @__PURE__ */ C({
|
|
|
121
113
|
return this.buttonsData.length > 0 ? this.buttonsData.map(function(u, p) {
|
|
122
114
|
const $ = typeof u != "string" ? {
|
|
123
115
|
...u,
|
|
124
|
-
render:
|
|
116
|
+
render: l.call(this, u.render, h.call(this))
|
|
125
117
|
} : u;
|
|
126
118
|
return o(D, {
|
|
127
119
|
class: "k-menu-item",
|
|
@@ -131,7 +123,7 @@ const N = /* @__PURE__ */ C({
|
|
|
131
123
|
focused: this.focusedIndex === p,
|
|
132
124
|
onClick: this.onItemClick,
|
|
133
125
|
onDown: this.onItemDown,
|
|
134
|
-
render:
|
|
126
|
+
render: l.call(this, d, h.call(this)),
|
|
135
127
|
item: n,
|
|
136
128
|
key: p,
|
|
137
129
|
index: p,
|
|
@@ -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"),x=require("@progress/kendo-webspeech-common"),k=require("../Button.js"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),x=require("@progress/kendo-webspeech-common"),k=require("../Button.js"),h=require("@progress/kendo-svg-icons");function T(e){return new x.KendoSpeechRecognition(e)}let d=function(e){return e.WebSpeech="WebSpeech",e.None="None",e}({});const E=i.defineComponent({name:"KendoSpeechToTextButton",props:{lang:{type:String,default:"en-US"},continuous:{type:Boolean,default:!1},interimResults:{type:Boolean,default:!1},maxAlternatives:{type:Number,default:1},integrationMode:{type:String,default:d.WebSpeech},onStart:{type:Function},onResult:{type:Function},onEnd:{type:Function},onError:{type:Function},svgIcon:{type:Object,default:h.microphoneOutlineIcon},iconSize:{type:String},disabled:{type:Boolean,default:void 0},size:String,rounded:String,fillMode:String,themeColor:String,title:{type:String,default:"Speech to Text Button"},ariaLabel:{type:String,default:"Start speech recognition"}},setup(e,{emit:s,expose:f}){const o=i.ref(null),n=i.ref(!1),S=()=>{var t;return(t=o.value)==null?void 0:t.isActive()},a=()=>e.integrationMode!==d.None,c=typeof window!="undefined"&&!("webkitSpeechRecognition"in window||"SpeechRecognition"in window)?(e.onError&&e.onError({errorMessage:"Speech Recognition API is not supported in this browser."}),!1):!0,l=()=>{var t;n.value||(a&&((t=o.value)==null||t.start()),n.value=!0)},r=()=>{var t;n.value&&(a&&((t=o.value)==null||t.stop()),n.value=!1)},g=()=>{var t;n.value&&a&&((t=o.value)==null||t.abort(),n.value=!1)},v=()=>{c&&(n.value?p():u())},u=async()=>{n.value||e.onStart&&(await e.onStart(),l())},R=t=>{const b=t.results,B=b.length-1,w=b[B],M=Array.from(w).map(I=>({transcript:I.transcript,confidence:I.confidence}));s("result",{isFinal:w.isFinal,alternatives:M})},p=async()=>{n.value&&e.onEnd&&(await e.onEnd(),r())},A=t=>{s("error",t)},y=()=>{var t;c&&e.integrationMode===d.WebSpeech&&((t=o.value)!=null&&t.isActive()&&r(),o.value=T({lang:e.lang,continuous:e.continuous,interimResults:e.interimResults,integrationMode:e.integrationMode,maxAlternatives:e.maxAlternatives,events:{start:u,result:R,end:p,error:A}}))};return i.watch(()=>({lang:e.lang,continuous:e.continuous,interimResults:e.interimResults,integrationMode:e.integrationMode,maxAlternatives:e.maxAlternatives}),()=>{y()},{deep:!0}),i.onMounted(()=>{y()}),i.onUnmounted(()=>{var t;(t=o.value)!=null&&t.isInActiveState&&r()}),f({start:l,stop:r,abort:g,isActive:S}),{clickHandler:v,isInActiveState:n}},render(){const{ariaLabel:e,svgIcon:s,fillMode:f,rounded:o,size:n,disabled:S,themeColor:a,iconSize:m,title:c}=this.$props,{className:l,style:r,id:g}=this.$attrs,v=i.computed(()=>["k-speech-to-text-button",l,{"k-listening":this.isInActiveState}]),u=i.computed(()=>this.isInActiveState?h.stopSmIcon:s||h.microphoneOutlineIcon);return i.createVNode(k.Button,{id:g,style:r,class:v.value,onClick:this.clickHandler,svgIcon:u.value,iconSize:m,fillMode:f,rounded:o,size:n,themeColor:a,"aria-label":e,disabled:S,title:c},null)}});exports.SpeechToTextButton=E;exports.SpeechToTextButtonMode=d;
|