@progress/kendo-vue-buttons 3.5.0 → 3.5.1-dev.202208150613
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/dist/cdn/js/kendo-vue-buttons.js +1 -1
- package/dist/es/Button.js +1 -1
- package/dist/es/ButtonGroupInterface.js +1 -0
- package/dist/es/ButtonInterface.js +1 -0
- package/dist/es/Chip/Chip.js +1 -1
- package/dist/es/Chip/ChipList.js +1 -1
- package/dist/es/Chip/selection-reducer.js +8 -12
- package/dist/es/FloatingActionButton/FloatingActionButton.js +8 -8
- package/dist/es/FloatingActionButton/FloatingActionButtonItem.js +3 -3
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +1 -0
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +1 -0
- package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.js +1 -0
- package/dist/es/FloatingActionButton/models/align-offset.js +1 -0
- package/dist/es/FloatingActionButton/models/align.js +1 -0
- package/dist/es/FloatingActionButton/models/events.js +1 -0
- package/dist/es/FloatingActionButton/models/position-mode.js +1 -0
- package/dist/es/FloatingActionButton/models/shape.js +1 -0
- package/dist/es/FloatingActionButton/models/size.js +1 -0
- package/dist/es/FloatingActionButton/models/theme-color.js +1 -0
- package/dist/es/FloatingActionButton/utils.js +2 -2
- package/dist/es/ListButton/ButtonItem.js +1 -1
- package/dist/es/ListButton/DropDownButton.js +8 -8
- package/dist/es/ListButton/SplitButton.js +8 -8
- package/dist/es/ListButton/models/ButtonItemInterface.js +1 -0
- package/dist/es/ListButton/models/ListButtonProps.js +1 -0
- package/dist/es/ListButton/models/PopupSettings.js +1 -0
- package/dist/es/ListButton/models/events.js +1 -0
- package/dist/es/buttonLook.js +1 -0
- package/dist/es/models/index.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/util.d.ts +3 -3
- package/dist/esm/Button.d.ts +123 -0
- package/dist/esm/Button.js +280 -0
- package/dist/esm/ButtonGroup.d.ts +49 -0
- package/dist/esm/ButtonGroup.js +106 -0
- package/dist/esm/ButtonGroupInterface.d.ts +30 -0
- package/dist/esm/ButtonGroupInterface.js +2 -0
- package/dist/esm/ButtonInterface.d.ts +56 -0
- package/dist/esm/ButtonInterface.js +2 -0
- package/dist/esm/ButtonWrap.d.ts +19 -0
- package/dist/esm/ButtonWrap.js +33 -0
- package/dist/esm/Chip/Chip.d.ts +199 -0
- package/dist/esm/Chip/Chip.js +339 -0
- package/dist/esm/Chip/ChipList.d.ts +174 -0
- package/dist/esm/Chip/ChipList.js +263 -0
- package/dist/esm/Chip/data-reducer.d.ts +21 -0
- package/dist/esm/Chip/data-reducer.js +34 -0
- package/dist/esm/Chip/focus-reducer.d.ts +24 -0
- package/dist/esm/Chip/focus-reducer.js +38 -0
- package/dist/esm/Chip/selection-reducer.d.ts +29 -0
- package/dist/esm/Chip/selection-reducer.js +102 -0
- package/dist/esm/FloatingActionButton/FloatingActionButton.d.ts +49 -0
- package/dist/esm/FloatingActionButton/FloatingActionButton.js +494 -0
- package/dist/esm/FloatingActionButton/FloatingActionButtonItem.d.ts +118 -0
- package/dist/esm/FloatingActionButton/FloatingActionButtonItem.js +121 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +13 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +1 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.d.ts +24 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +1 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +243 -0
- package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonProps.js +1 -0
- package/dist/esm/FloatingActionButton/models/align-offset.d.ts +20 -0
- package/dist/esm/FloatingActionButton/models/align-offset.js +1 -0
- package/dist/esm/FloatingActionButton/models/align.d.ts +27 -0
- package/dist/esm/FloatingActionButton/models/align.js +1 -0
- package/dist/esm/FloatingActionButton/models/events.d.ts +18 -0
- package/dist/esm/FloatingActionButton/models/events.js +2 -0
- package/dist/esm/FloatingActionButton/models/position-mode.d.ts +9 -0
- package/dist/esm/FloatingActionButton/models/position-mode.js +1 -0
- package/dist/esm/FloatingActionButton/models/shape.d.ts +13 -0
- package/dist/esm/FloatingActionButton/models/shape.js +1 -0
- package/dist/esm/FloatingActionButton/models/size.d.ts +10 -0
- package/dist/esm/FloatingActionButton/models/size.js +1 -0
- package/dist/esm/FloatingActionButton/models/theme-color.d.ts +17 -0
- package/dist/esm/FloatingActionButton/models/theme-color.js +1 -0
- package/dist/esm/FloatingActionButton/utils.d.ts +27 -0
- package/dist/esm/FloatingActionButton/utils.js +93 -0
- package/dist/esm/ListButton/ButtonItem.d.ts +58 -0
- package/dist/esm/ListButton/ButtonItem.js +138 -0
- package/dist/esm/ListButton/DropDownButton.d.ts +66 -0
- package/dist/esm/ListButton/DropDownButton.js +453 -0
- package/dist/esm/ListButton/SplitButton.d.ts +67 -0
- package/dist/esm/ListButton/SplitButton.js +515 -0
- package/dist/esm/ListButton/models/ButtonItemInterface.d.ts +29 -0
- package/dist/esm/ListButton/models/ButtonItemInterface.js +2 -0
- package/dist/esm/ListButton/models/ListButtonProps.d.ts +328 -0
- package/dist/esm/ListButton/models/ListButtonProps.js +2 -0
- package/dist/esm/ListButton/models/PopupSettings.d.ts +24 -0
- package/dist/esm/ListButton/models/PopupSettings.js +1 -0
- package/dist/esm/ListButton/models/events.d.ts +48 -0
- package/dist/esm/ListButton/models/events.js +1 -0
- package/dist/esm/ListButton/utils/navigation.d.ts +5 -0
- package/dist/esm/ListButton/utils/navigation.js +24 -0
- package/dist/esm/ListButton/utils/popup.d.ts +9 -0
- package/dist/esm/ListButton/utils/popup.js +20 -0
- package/dist/esm/additionalTypes.ts +21 -0
- package/dist/esm/buttonLook.d.ts +13 -0
- package/dist/esm/buttonLook.js +1 -0
- package/dist/esm/main.d.ts +30 -0
- package/dist/esm/main.js +15 -0
- package/dist/esm/models/index.d.ts +87 -0
- package/dist/esm/models/index.js +1 -0
- package/dist/esm/package-metadata.d.ts +5 -0
- package/dist/esm/package-metadata.js +11 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/toolbar/Toolbar.d.ts +112 -0
- package/dist/esm/toolbar/Toolbar.js +208 -0
- package/dist/esm/toolbar/tools/ToolbarItem.d.ts +64 -0
- package/dist/esm/toolbar/tools/ToolbarItem.js +58 -0
- package/dist/esm/toolbar/tools/ToolbarSeparator.d.ts +36 -0
- package/dist/esm/toolbar/tools/ToolbarSeparator.js +56 -0
- package/dist/esm/toolbar/tools/ToolbarSpacer.d.ts +36 -0
- package/dist/esm/toolbar/tools/ToolbarSpacer.js +53 -0
- package/dist/esm/util.d.ts +31 -0
- package/dist/esm/util.js +40 -0
- package/dist/npm/Button.js +5 -5
- package/dist/npm/ButtonGroup.js +4 -4
- package/dist/npm/ButtonWrap.js +1 -1
- package/dist/npm/Chip/Chip.js +10 -10
- package/dist/npm/Chip/ChipList.js +8 -8
- package/dist/npm/Chip/data-reducer.js +4 -2
- package/dist/npm/Chip/focus-reducer.js +4 -2
- package/dist/npm/Chip/selection-reducer.js +12 -14
- package/dist/npm/FloatingActionButton/FloatingActionButton.js +31 -31
- package/dist/npm/FloatingActionButton/FloatingActionButtonItem.js +8 -8
- package/dist/npm/FloatingActionButton/utils.js +14 -9
- package/dist/npm/ListButton/ButtonItem.js +1 -1
- package/dist/npm/ListButton/DropDownButton.js +19 -19
- package/dist/npm/ListButton/SplitButton.js +19 -19
- package/dist/npm/main.js +6 -2
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/toolbar/Toolbar.js +2 -2
- package/dist/npm/toolbar/tools/ToolbarItem.js +1 -1
- package/dist/npm/util.d.ts +3 -3
- package/package.json +11 -5
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
|
+
import { classNames, getDefaultSlots, validatePackage, kendoThemeMaps } from '@progress/kendo-vue-common';
|
|
7
|
+
import { packageMetadata } from './package-metadata.js';
|
|
8
|
+
import util from './util.js';
|
|
9
|
+
var styles = util.styles;
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
var ButtonVue2 = {
|
|
15
|
+
name: 'KendoButton',
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
emits: {
|
|
18
|
+
click: null,
|
|
19
|
+
mousedown: null,
|
|
20
|
+
mouseup: null,
|
|
21
|
+
pointerdown: null,
|
|
22
|
+
pointerup: null,
|
|
23
|
+
focus: null,
|
|
24
|
+
blur: null,
|
|
25
|
+
keypress: null,
|
|
26
|
+
keydown: null
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
ariaLabel: String,
|
|
30
|
+
dir: String,
|
|
31
|
+
selected: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: undefined
|
|
34
|
+
},
|
|
35
|
+
togglable: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
icon: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: function _default() {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
iconClass: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: function _default() {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
imageUrl: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: function _default() {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
imageAlt: String,
|
|
58
|
+
disabled: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: undefined
|
|
61
|
+
},
|
|
62
|
+
size: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: 'medium'
|
|
65
|
+
},
|
|
66
|
+
shape: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'rectangle',
|
|
69
|
+
validator: function validator(value) {
|
|
70
|
+
return [null, 'rectangle', 'square'].includes(value);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
rounded: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: 'medium'
|
|
76
|
+
},
|
|
77
|
+
fillMode: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'solid'
|
|
80
|
+
},
|
|
81
|
+
// eslint-disable-next-line max-len
|
|
82
|
+
themeColor: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: 'base'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
created: function created() {
|
|
88
|
+
validatePackage(packageMetadata);
|
|
89
|
+
this.currentActive = this.$props.togglable === true && this.$props.selected === true;
|
|
90
|
+
this._activeTemp = undefined;
|
|
91
|
+
},
|
|
92
|
+
data: function data() {
|
|
93
|
+
return {
|
|
94
|
+
currentActive: null
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
computed: {
|
|
98
|
+
computedSelected: function computedSelected() {
|
|
99
|
+
return this._activeTemp !== undefined ? this._activeTemp : this.$props.selected !== undefined ? this.$props.selected : this.currentActive;
|
|
100
|
+
},
|
|
101
|
+
buttonClasses: function buttonClasses() {
|
|
102
|
+
var _a;
|
|
103
|
+
|
|
104
|
+
var _b = this.$props,
|
|
105
|
+
disabled = _b.disabled,
|
|
106
|
+
icon = _b.icon,
|
|
107
|
+
iconClass = _b.iconClass,
|
|
108
|
+
imageUrl = _b.imageUrl,
|
|
109
|
+
dir = _b.dir,
|
|
110
|
+
size = _b.size,
|
|
111
|
+
shape = _b.shape,
|
|
112
|
+
rounded = _b.rounded,
|
|
113
|
+
fillMode = _b.fillMode,
|
|
114
|
+
themeColor = _b.themeColor;
|
|
115
|
+
var hasIcon = icon !== undefined || iconClass !== undefined || imageUrl !== undefined;
|
|
116
|
+
var defaultSlot = getDefaultSlots(this);
|
|
117
|
+
var hasChildren = defaultSlot;
|
|
118
|
+
return _a = {}, _a[styles.button] = true, _a["k-button-".concat(kendoThemeMaps.sizeMap[size] || size)] = size, _a["k-button-".concat(shape)] = shape && shape !== 'rectangle', _a["k-rounded-".concat(kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded, _a['k-icon-button'] = !hasChildren && hasIcon, _a['k-disabled'] = disabled, _a['k-selected'] = this.computedSelected, _a['k-rtl'] = dir === 'rtl', _a["k-button-".concat(fillMode)] = fillMode, _a["k-button-".concat(fillMode, "-").concat(themeColor)] = fillMode && themeColor, _a;
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
updated: function updated() {
|
|
122
|
+
if (this.$props.togglable && this.$props.selected !== undefined && this.$props.selected !== this.currentActive) {
|
|
123
|
+
this.currentActive = this.$props.selected;
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
methods: {
|
|
127
|
+
focus: function focus(e) {
|
|
128
|
+
this.$el.focus(e);
|
|
129
|
+
},
|
|
130
|
+
toggleIfApplicable: function toggleIfApplicable() {
|
|
131
|
+
if (!this.disabled && this.$props.togglable && this.$props.selected === undefined) {
|
|
132
|
+
var active = !this.currentActive;
|
|
133
|
+
this._activeTemp = active;
|
|
134
|
+
this.currentActive = active;
|
|
135
|
+
this._activeTemp = undefined;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
handleClick: function handleClick(event) {
|
|
139
|
+
this.toggleIfApplicable();
|
|
140
|
+
|
|
141
|
+
if (!this.disabled) {
|
|
142
|
+
this.$emit('click', event);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
handleMouseDown: function handleMouseDown(event) {
|
|
146
|
+
if (!this.disabled) {
|
|
147
|
+
this.$emit('mousedown', event);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
handlePointerDown: function handlePointerDown(event) {
|
|
151
|
+
if (!this.disabled) {
|
|
152
|
+
this.$emit('pointerdown', event);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
handleMouseUp: function handleMouseUp(event) {
|
|
156
|
+
if (!this.disabled) {
|
|
157
|
+
this.$emit('mouseup', event);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
handlePointerUp: function handlePointerUp(event) {
|
|
161
|
+
if (!this.disabled) {
|
|
162
|
+
this.$emit('pointerup', event);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
handleFocus: function handleFocus(event) {
|
|
166
|
+
if (!this.disabled) {
|
|
167
|
+
this.$emit('focus', event);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
handleBlur: function handleBlur(event) {
|
|
171
|
+
if (!this.disabled) {
|
|
172
|
+
this.$emit('blur', event);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
handleKeypress: function handleKeypress(event) {
|
|
176
|
+
if (!this.disabled) {
|
|
177
|
+
this.$emit('keypress', event);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
handleKeydown: function handleKeydown(event) {
|
|
181
|
+
if (!this.disabled) {
|
|
182
|
+
this.$emit('keydown', event);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
// @ts-ignore
|
|
187
|
+
setup: !isV3 ? undefined : function () {
|
|
188
|
+
var v3 = !!isV3;
|
|
189
|
+
return {
|
|
190
|
+
v3: v3
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
// @ts-ignore
|
|
194
|
+
render: function render(createElement) {
|
|
195
|
+
var h = gh || createElement;
|
|
196
|
+
var _a = this.$props,
|
|
197
|
+
togglable = _a.togglable,
|
|
198
|
+
icon = _a.icon,
|
|
199
|
+
iconClass = _a.iconClass,
|
|
200
|
+
imageUrl = _a.imageUrl,
|
|
201
|
+
imageAlt = _a.imageAlt;
|
|
202
|
+
var defaultSlot = getDefaultSlots(this);
|
|
203
|
+
|
|
204
|
+
var iconElement = function iconElement() {
|
|
205
|
+
if (imageUrl) {
|
|
206
|
+
return h("img", {
|
|
207
|
+
role: "presentation",
|
|
208
|
+
attrs: this.v3 ? undefined : {
|
|
209
|
+
role: "presentation",
|
|
210
|
+
alt: imageAlt,
|
|
211
|
+
src: imageUrl
|
|
212
|
+
},
|
|
213
|
+
"class": 'k-image',
|
|
214
|
+
alt: imageAlt,
|
|
215
|
+
src: imageUrl
|
|
216
|
+
});
|
|
217
|
+
} else if (icon) {
|
|
218
|
+
var iconClasses = classNames('k-icon', 'k-button-icon', 'k-i-' + icon);
|
|
219
|
+
return h("span", {
|
|
220
|
+
role: "presentation",
|
|
221
|
+
attrs: this.v3 ? undefined : {
|
|
222
|
+
role: "presentation"
|
|
223
|
+
},
|
|
224
|
+
"class": iconClasses
|
|
225
|
+
});
|
|
226
|
+
} else if (iconClass) {
|
|
227
|
+
return h("span", {
|
|
228
|
+
role: "presentation",
|
|
229
|
+
attrs: this.v3 ? undefined : {
|
|
230
|
+
role: "presentation"
|
|
231
|
+
},
|
|
232
|
+
"class": iconClass
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return null;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
return h("button", {
|
|
240
|
+
"class": this.buttonClasses,
|
|
241
|
+
onClick: this.handleClick,
|
|
242
|
+
on: this.v3 ? undefined : {
|
|
243
|
+
"click": this.handleClick,
|
|
244
|
+
"mousedown": this.handleMouseDown,
|
|
245
|
+
"mouseup": this.handleMouseUp,
|
|
246
|
+
"pointerdown": this.handlePointerDown,
|
|
247
|
+
"pointerup": this.handlePointerUp,
|
|
248
|
+
"focus": this.handleFocus,
|
|
249
|
+
"blur": this.handleBlur,
|
|
250
|
+
"keypress": this.handleKeypress,
|
|
251
|
+
"keydown": this.handleKeydown
|
|
252
|
+
},
|
|
253
|
+
onMousedown: this.handleMouseDown,
|
|
254
|
+
onMouseup: this.handleMouseUp,
|
|
255
|
+
onPointerdown: this.handlePointerDown,
|
|
256
|
+
onPointerup: this.handlePointerUp,
|
|
257
|
+
onFocus: this.handleFocus,
|
|
258
|
+
onBlur: this.handleBlur,
|
|
259
|
+
onKeypress: this.handleKeypress,
|
|
260
|
+
onKeydown: this.handleKeydown // Accessibility properties
|
|
261
|
+
,
|
|
262
|
+
role: togglable ? 'checkbox' : undefined,
|
|
263
|
+
attrs: this.v3 ? undefined : {
|
|
264
|
+
role: togglable ? 'checkbox' : undefined,
|
|
265
|
+
"aria-label": this.ariaLabel,
|
|
266
|
+
"aria-disabled": this.$props.disabled || undefined,
|
|
267
|
+
"aria-pressed": togglable ? this.currentActive ? true : undefined : undefined
|
|
268
|
+
},
|
|
269
|
+
"aria-label": this.ariaLabel,
|
|
270
|
+
"aria-disabled": this.$props.disabled || undefined,
|
|
271
|
+
"aria-pressed": togglable ? this.currentActive ? true : undefined : undefined
|
|
272
|
+
}, [iconElement.call(this), defaultSlot]);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* @hidden
|
|
277
|
+
*/
|
|
278
|
+
|
|
279
|
+
var Button = ButtonVue2;
|
|
280
|
+
export { Button, ButtonVue2 };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { ButtonGroupInterface } from './ButtonGroupInterface';
|
|
7
|
+
/**
|
|
8
|
+
* Represents the props of the [Kendo UI for Vue ButtonGroup component]({% slug overview_buttongroup %}).
|
|
9
|
+
*/
|
|
10
|
+
export interface ButtonGroupProps extends ButtonGroupInterface {
|
|
11
|
+
/**
|
|
12
|
+
* Sets the `className` of the ButtonGroup component.
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export interface ButtonGroupState {
|
|
20
|
+
v3: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
export interface ButtonGroupMethods {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
mapButtons: (children: any) => any;
|
|
28
|
+
renderButton: (child: any, index: number, isLast: boolean, isRtl: boolean) => any;
|
|
29
|
+
isValidButton: (child: any) => any;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
export interface ButtonGroupData {
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
export interface ButtonGroupAll extends Vue2type, ButtonGroupMethods, ButtonGroupData, ButtonGroupState {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @hidden
|
|
43
|
+
*/
|
|
44
|
+
declare let ButtonGroupVue2: ComponentOptions<ButtonGroupAll, DefaultData<ButtonGroupData>, DefaultMethods<ButtonGroupAll>, {}, RecordPropsDefinition<ButtonGroupProps>>;
|
|
45
|
+
/**
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
declare const ButtonGroup: DefineComponent<ButtonGroupProps, any, ButtonGroupData, {}, ButtonGroupMethods, {}, {}, {}, string, ButtonGroupProps, ButtonGroupProps, {}>;
|
|
49
|
+
export { ButtonGroup, ButtonGroupVue2 };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
|
+
import { classNames, getDefaultSlots, validatePackage } from '@progress/kendo-vue-common';
|
|
7
|
+
import { ButtonWrap } from './ButtonWrap.js';
|
|
8
|
+
import { packageMetadata } from './package-metadata.js';
|
|
9
|
+
import util from './util.js';
|
|
10
|
+
var styles = util.styles;
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var ButtonGroupVue2 = {
|
|
16
|
+
name: 'KendoButtonGroup',
|
|
17
|
+
props: {
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: undefined
|
|
21
|
+
},
|
|
22
|
+
width: String,
|
|
23
|
+
dir: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: function _default() {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
created: function created() {
|
|
31
|
+
validatePackage(packageMetadata);
|
|
32
|
+
},
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
setup: !isV3 ? undefined : function () {
|
|
35
|
+
var v3 = !!isV3;
|
|
36
|
+
return {
|
|
37
|
+
v3: v3
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
render: function render(createElement) {
|
|
42
|
+
var _a;
|
|
43
|
+
|
|
44
|
+
var h = gh || createElement;
|
|
45
|
+
var defaultSlot = getDefaultSlots(this);
|
|
46
|
+
|
|
47
|
+
var renderButton = function renderButton(child, index, isLast, isRtl) {
|
|
48
|
+
var _a;
|
|
49
|
+
|
|
50
|
+
var className = classNames((_a = {}, _a[styles['state-disabled']] = this.$props.disabled, _a[styles['group-start']] = isRtl ? isLast : index === 0, _a[styles['group-end']] = isRtl ? index === 0 : isLast, _a));
|
|
51
|
+
return h(ButtonWrap, {
|
|
52
|
+
class: className,
|
|
53
|
+
attrs: this.v3 ? undefined : {
|
|
54
|
+
'aria-disabled': this.$props.disabled
|
|
55
|
+
},
|
|
56
|
+
'aria-disabled': this.$props.disabled
|
|
57
|
+
}, this.v3 ? function () {
|
|
58
|
+
return [child];
|
|
59
|
+
} : [child]);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var mapButtons = function mapButtons(children) {
|
|
63
|
+
var _this = this;
|
|
64
|
+
|
|
65
|
+
var count = children.length;
|
|
66
|
+
var rtl = this.$props.dir !== undefined ? this.$props.dir === 'rtl' : this.$el && getComputedStyle(this.$el).direction === 'rtl' || false;
|
|
67
|
+
return children.map(function (child, index) {
|
|
68
|
+
if (_this.isValidButton(child)) {
|
|
69
|
+
return renderButton.call(_this, child, index, index === count - 1, rtl);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return child;
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var groupClasses = classNames([styles['button-group']], (_a = {}, _a['k-disabled'] = this.$props.disabled, _a[styles['button-group-stretched']] = !!this.$props.width, _a));
|
|
77
|
+
return h("div", {
|
|
78
|
+
style: {
|
|
79
|
+
width: this.width
|
|
80
|
+
},
|
|
81
|
+
dir: this.$props.dir // Accessibility properties
|
|
82
|
+
,
|
|
83
|
+
attrs: this.v3 ? undefined : {
|
|
84
|
+
dir: this.$props.dir,
|
|
85
|
+
role: 'group',
|
|
86
|
+
"aria-disabled": this.$props.disabled,
|
|
87
|
+
"aria-multiselectable": true
|
|
88
|
+
},
|
|
89
|
+
role: 'group',
|
|
90
|
+
"aria-disabled": this.$props.disabled,
|
|
91
|
+
"aria-multiselectable": true,
|
|
92
|
+
"class": groupClasses
|
|
93
|
+
}, [mapButtons.call(this, defaultSlot)]);
|
|
94
|
+
},
|
|
95
|
+
methods: {
|
|
96
|
+
isValidButton: function isValidButton(child) {
|
|
97
|
+
return child && child.tag && child.tag.toLowerCase().indexOf('button') !== -1 || child.componentOptions && child.componentOptions.tag && child.componentOptions.tag.toLowerCase().indexOf('button') !== -1 || child.type && child.type.name && child.type.name.toLowerCase().indexOf('kendobutton') !== -1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* @hidden
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
var ButtonGroup = ButtonGroupVue2;
|
|
106
|
+
export { ButtonGroup, ButtonGroupVue2 };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the properties which can be set to a ButtonGroup.
|
|
3
|
+
*/
|
|
4
|
+
export interface ButtonGroupInterface {
|
|
5
|
+
/**
|
|
6
|
+
* By default, the ButtonGroup is enabled ([see example]({% slug disabledstate_buttongroup %})). To disable the whole group of buttons,
|
|
7
|
+
* set its `disabled` attribute to `true`. To disable a specific button, set its own `disabled` attribute to `true` and leave the `disabled` attribute of the ButtonGroup undefined.
|
|
8
|
+
*
|
|
9
|
+
* If you define the `disabled` attribute of the ButtonGroup, it will take precedence over the `disabled` attributes
|
|
10
|
+
* of the underlying buttons and they will be ignored.
|
|
11
|
+
*/
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Sets the width of the ButtonGroup.
|
|
15
|
+
*
|
|
16
|
+
* If the width of the ButtonGroup is set:
|
|
17
|
+
* - The buttons resize automatically to fill the full width of the group wrapper.
|
|
18
|
+
* - The buttons acquire the same width.
|
|
19
|
+
*/
|
|
20
|
+
width?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Sets the direction of the ButtonGroup ([more information](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)).
|
|
23
|
+
*
|
|
24
|
+
* The available options are:
|
|
25
|
+
* * `rtl`
|
|
26
|
+
* * `ltr`
|
|
27
|
+
* * `auto`
|
|
28
|
+
*/
|
|
29
|
+
dir?: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inherits the native HTML Button. Represents the properties which can be set to a Button.
|
|
3
|
+
*/
|
|
4
|
+
export interface ButtonInterface {
|
|
5
|
+
/**
|
|
6
|
+
* **Deprecated**. Use [`fillMode`]({% slug api_buttons_buttonprops %}#toc-fillmode) prop instead.
|
|
7
|
+
*
|
|
8
|
+
* The available values are:
|
|
9
|
+
* `flat` | `outline`
|
|
10
|
+
* * `clear`
|
|
11
|
+
*/
|
|
12
|
+
look?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Adds visual weight to the Button and makes it primary ([see example]({% slug primary_button %})).
|
|
15
|
+
* **Deprecated**. Use [`themeColor`]({% slug api_buttons_buttonprops %}#toc-themecolor) prop instead.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
19
|
+
primary?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Specifies if the Button is disabled ([see example]({% slug disabled_button %})). Defaults to `false`.
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Sets the aria-label of the Button.
|
|
26
|
+
*/
|
|
27
|
+
ariaLabel?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the direction of the Button.
|
|
30
|
+
*/
|
|
31
|
+
dir?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the selected state of the Button. Can be used for controlled state.
|
|
34
|
+
*/
|
|
35
|
+
selected?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Provides visual styling that indicates if the Button is selected ([see example]({% slug toggleable_button %})). Defaults to `false`.
|
|
38
|
+
*/
|
|
39
|
+
togglable?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Defines the name for an existing icon in a Kendo UI for Vue theme ([see example]({% slug icons_button %})). The icon is rendered inside the Button by a `span.k-icon` element.
|
|
42
|
+
*/
|
|
43
|
+
icon?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Defines a CSS class—or multiple classes separated by spaces—which are applied to a `span` element inside the Button ([see example]({% slug icons_button %})). Allows the usage of custom icons.
|
|
46
|
+
*/
|
|
47
|
+
iconClass?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Defines a URL which is used as an `img` element inside the Button ([see example]({% slug icons_button %})). The URL can be relative or absolute. If relative, it is evaluated with relation to the URL of the web page.
|
|
50
|
+
*/
|
|
51
|
+
imageUrl?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Defines the alternative text of the image rendered inside the Button component.
|
|
54
|
+
*/
|
|
55
|
+
imageAlt?: string;
|
|
56
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export interface ButtonAll extends Vue2type {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
declare let ButtonWrapVue2: ComponentOptions<ButtonAll, DefaultData<{}>, DefaultMethods<ButtonAll>, {}, RecordPropsDefinition<{}>>;
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
declare const ButtonWrap: DefineComponent<{}, any, {}, {}, {}, {}, {}, {}, string, {}, {}, {}>;
|
|
19
|
+
export { ButtonWrap, ButtonWrapVue2 };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
|
+
import { getDefaultSlots } from '@progress/kendo-vue-common';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var ButtonWrapVue2 = {
|
|
12
|
+
name: 'KendoButtonWrap',
|
|
13
|
+
props: {},
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
setup: !isV3 ? undefined : function () {
|
|
16
|
+
var v3 = !!isV3;
|
|
17
|
+
return {
|
|
18
|
+
v3: v3
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
render: function render(createElement) {
|
|
23
|
+
var h = gh || createElement;
|
|
24
|
+
var defaultSlot = getDefaultSlots(this);
|
|
25
|
+
return defaultSlot[0];
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
var ButtonWrap = ButtonWrapVue2;
|
|
33
|
+
export { ButtonWrap, ButtonWrapVue2 };
|