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