@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.
Files changed (135) hide show
  1. package/dist/cdn/js/kendo-vue-buttons.js +1 -1
  2. package/dist/es/Button.js +1 -1
  3. package/dist/es/ButtonGroupInterface.js +1 -0
  4. package/dist/es/ButtonInterface.js +1 -0
  5. package/dist/es/Chip/Chip.js +1 -1
  6. package/dist/es/Chip/ChipList.js +1 -1
  7. package/dist/es/Chip/selection-reducer.js +8 -12
  8. package/dist/es/FloatingActionButton/FloatingActionButton.js +8 -8
  9. package/dist/es/FloatingActionButton/FloatingActionButtonItem.js +3 -3
  10. package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +1 -0
  11. package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +1 -0
  12. package/dist/es/FloatingActionButton/interfaces/FloatingActionButtonProps.js +1 -0
  13. package/dist/es/FloatingActionButton/models/align-offset.js +1 -0
  14. package/dist/es/FloatingActionButton/models/align.js +1 -0
  15. package/dist/es/FloatingActionButton/models/events.js +1 -0
  16. package/dist/es/FloatingActionButton/models/position-mode.js +1 -0
  17. package/dist/es/FloatingActionButton/models/shape.js +1 -0
  18. package/dist/es/FloatingActionButton/models/size.js +1 -0
  19. package/dist/es/FloatingActionButton/models/theme-color.js +1 -0
  20. package/dist/es/FloatingActionButton/utils.js +2 -2
  21. package/dist/es/ListButton/ButtonItem.js +1 -1
  22. package/dist/es/ListButton/DropDownButton.js +8 -8
  23. package/dist/es/ListButton/SplitButton.js +8 -8
  24. package/dist/es/ListButton/models/ButtonItemInterface.js +1 -0
  25. package/dist/es/ListButton/models/ListButtonProps.js +1 -0
  26. package/dist/es/ListButton/models/PopupSettings.js +1 -0
  27. package/dist/es/ListButton/models/events.js +1 -0
  28. package/dist/es/buttonLook.js +1 -0
  29. package/dist/es/models/index.js +1 -0
  30. package/dist/es/package-metadata.js +1 -1
  31. package/dist/es/util.d.ts +3 -3
  32. package/dist/esm/Button.d.ts +123 -0
  33. package/dist/esm/Button.js +280 -0
  34. package/dist/esm/ButtonGroup.d.ts +49 -0
  35. package/dist/esm/ButtonGroup.js +106 -0
  36. package/dist/esm/ButtonGroupInterface.d.ts +30 -0
  37. package/dist/esm/ButtonGroupInterface.js +2 -0
  38. package/dist/esm/ButtonInterface.d.ts +56 -0
  39. package/dist/esm/ButtonInterface.js +2 -0
  40. package/dist/esm/ButtonWrap.d.ts +19 -0
  41. package/dist/esm/ButtonWrap.js +33 -0
  42. package/dist/esm/Chip/Chip.d.ts +199 -0
  43. package/dist/esm/Chip/Chip.js +339 -0
  44. package/dist/esm/Chip/ChipList.d.ts +174 -0
  45. package/dist/esm/Chip/ChipList.js +263 -0
  46. package/dist/esm/Chip/data-reducer.d.ts +21 -0
  47. package/dist/esm/Chip/data-reducer.js +34 -0
  48. package/dist/esm/Chip/focus-reducer.d.ts +24 -0
  49. package/dist/esm/Chip/focus-reducer.js +38 -0
  50. package/dist/esm/Chip/selection-reducer.d.ts +29 -0
  51. package/dist/esm/Chip/selection-reducer.js +102 -0
  52. package/dist/esm/FloatingActionButton/FloatingActionButton.d.ts +49 -0
  53. package/dist/esm/FloatingActionButton/FloatingActionButton.js +494 -0
  54. package/dist/esm/FloatingActionButton/FloatingActionButtonItem.d.ts +118 -0
  55. package/dist/esm/FloatingActionButton/FloatingActionButtonItem.js +121 -0
  56. package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonHandle.d.ts +13 -0
  57. package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonHandle.js +1 -0
  58. package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.d.ts +24 -0
  59. package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonPopupSettings.js +1 -0
  60. package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonProps.d.ts +243 -0
  61. package/dist/esm/FloatingActionButton/interfaces/FloatingActionButtonProps.js +1 -0
  62. package/dist/esm/FloatingActionButton/models/align-offset.d.ts +20 -0
  63. package/dist/esm/FloatingActionButton/models/align-offset.js +1 -0
  64. package/dist/esm/FloatingActionButton/models/align.d.ts +27 -0
  65. package/dist/esm/FloatingActionButton/models/align.js +1 -0
  66. package/dist/esm/FloatingActionButton/models/events.d.ts +18 -0
  67. package/dist/esm/FloatingActionButton/models/events.js +2 -0
  68. package/dist/esm/FloatingActionButton/models/position-mode.d.ts +9 -0
  69. package/dist/esm/FloatingActionButton/models/position-mode.js +1 -0
  70. package/dist/esm/FloatingActionButton/models/shape.d.ts +13 -0
  71. package/dist/esm/FloatingActionButton/models/shape.js +1 -0
  72. package/dist/esm/FloatingActionButton/models/size.d.ts +10 -0
  73. package/dist/esm/FloatingActionButton/models/size.js +1 -0
  74. package/dist/esm/FloatingActionButton/models/theme-color.d.ts +17 -0
  75. package/dist/esm/FloatingActionButton/models/theme-color.js +1 -0
  76. package/dist/esm/FloatingActionButton/utils.d.ts +27 -0
  77. package/dist/esm/FloatingActionButton/utils.js +93 -0
  78. package/dist/esm/ListButton/ButtonItem.d.ts +58 -0
  79. package/dist/esm/ListButton/ButtonItem.js +138 -0
  80. package/dist/esm/ListButton/DropDownButton.d.ts +66 -0
  81. package/dist/esm/ListButton/DropDownButton.js +453 -0
  82. package/dist/esm/ListButton/SplitButton.d.ts +67 -0
  83. package/dist/esm/ListButton/SplitButton.js +515 -0
  84. package/dist/esm/ListButton/models/ButtonItemInterface.d.ts +29 -0
  85. package/dist/esm/ListButton/models/ButtonItemInterface.js +2 -0
  86. package/dist/esm/ListButton/models/ListButtonProps.d.ts +328 -0
  87. package/dist/esm/ListButton/models/ListButtonProps.js +2 -0
  88. package/dist/esm/ListButton/models/PopupSettings.d.ts +24 -0
  89. package/dist/esm/ListButton/models/PopupSettings.js +1 -0
  90. package/dist/esm/ListButton/models/events.d.ts +48 -0
  91. package/dist/esm/ListButton/models/events.js +1 -0
  92. package/dist/esm/ListButton/utils/navigation.d.ts +5 -0
  93. package/dist/esm/ListButton/utils/navigation.js +24 -0
  94. package/dist/esm/ListButton/utils/popup.d.ts +9 -0
  95. package/dist/esm/ListButton/utils/popup.js +20 -0
  96. package/dist/esm/additionalTypes.ts +21 -0
  97. package/dist/esm/buttonLook.d.ts +13 -0
  98. package/dist/esm/buttonLook.js +1 -0
  99. package/dist/esm/main.d.ts +30 -0
  100. package/dist/esm/main.js +15 -0
  101. package/dist/esm/models/index.d.ts +87 -0
  102. package/dist/esm/models/index.js +1 -0
  103. package/dist/esm/package-metadata.d.ts +5 -0
  104. package/dist/esm/package-metadata.js +11 -0
  105. package/dist/esm/package.json +3 -0
  106. package/dist/esm/toolbar/Toolbar.d.ts +112 -0
  107. package/dist/esm/toolbar/Toolbar.js +208 -0
  108. package/dist/esm/toolbar/tools/ToolbarItem.d.ts +64 -0
  109. package/dist/esm/toolbar/tools/ToolbarItem.js +58 -0
  110. package/dist/esm/toolbar/tools/ToolbarSeparator.d.ts +36 -0
  111. package/dist/esm/toolbar/tools/ToolbarSeparator.js +56 -0
  112. package/dist/esm/toolbar/tools/ToolbarSpacer.d.ts +36 -0
  113. package/dist/esm/toolbar/tools/ToolbarSpacer.js +53 -0
  114. package/dist/esm/util.d.ts +31 -0
  115. package/dist/esm/util.js +40 -0
  116. package/dist/npm/Button.js +5 -5
  117. package/dist/npm/ButtonGroup.js +4 -4
  118. package/dist/npm/ButtonWrap.js +1 -1
  119. package/dist/npm/Chip/Chip.js +10 -10
  120. package/dist/npm/Chip/ChipList.js +8 -8
  121. package/dist/npm/Chip/data-reducer.js +4 -2
  122. package/dist/npm/Chip/focus-reducer.js +4 -2
  123. package/dist/npm/Chip/selection-reducer.js +12 -14
  124. package/dist/npm/FloatingActionButton/FloatingActionButton.js +31 -31
  125. package/dist/npm/FloatingActionButton/FloatingActionButtonItem.js +8 -8
  126. package/dist/npm/FloatingActionButton/utils.js +14 -9
  127. package/dist/npm/ListButton/ButtonItem.js +1 -1
  128. package/dist/npm/ListButton/DropDownButton.js +19 -19
  129. package/dist/npm/ListButton/SplitButton.js +19 -19
  130. package/dist/npm/main.js +6 -2
  131. package/dist/npm/package-metadata.js +1 -1
  132. package/dist/npm/toolbar/Toolbar.js +2 -2
  133. package/dist/npm/toolbar/tools/ToolbarItem.js +1 -1
  134. package/dist/npm/util.d.ts +3 -3
  135. package/package.json +11 -5
@@ -0,0 +1,453 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+
6
+ for (var p in s) {
7
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ }; // @ts-ignore
16
+
17
+
18
+ import * as Vue from 'vue';
19
+ var allVue = Vue;
20
+ var gh = allVue.h;
21
+ var isV3 = allVue.version && allVue.version[0] === '3';
22
+ var ref = allVue.ref;
23
+ import { Button as KendoButton } from '../Button.js';
24
+ import { classNames, guid, Keys, kendoThemeMaps, getDefaultSlots } from '@progress/kendo-vue-common';
25
+ import navigation from './utils/navigation.js';
26
+ import { ButtonItem } from './ButtonItem.js';
27
+ import { Popup } from '@progress/kendo-vue-popup';
28
+ import { getAnchorAlign, getPopupAlign } from './utils/popup.js';
29
+ import { validatePackage, templateRendering, getListeners, canUseDOM } from '@progress/kendo-vue-common';
30
+ import { packageMetadata } from '../package-metadata.js';
31
+ /**
32
+ * @hidden
33
+ */
34
+
35
+ var DropDownButtonVue2 = {
36
+ name: 'KendoDropDownButton',
37
+ // @ts-ignore
38
+ emits: {
39
+ focus: null,
40
+ blur: null,
41
+ itemclick: null,
42
+ open: null,
43
+ close: null
44
+ },
45
+ props: {
46
+ accessKey: String,
47
+ primary: Boolean,
48
+ items: {
49
+ type: Array,
50
+ default: function _default() {
51
+ return [];
52
+ }
53
+ },
54
+ text: String,
55
+ textField: String,
56
+ tabIndex: Number,
57
+ disabled: Boolean,
58
+ icon: String,
59
+ iconClass: String,
60
+ imageUrl: String,
61
+ popupSettings: Object,
62
+ itemRender: [String, Object, Function],
63
+ item: Function,
64
+ size: {
65
+ type: String,
66
+ default: 'medium'
67
+ },
68
+ shape: {
69
+ type: String,
70
+ default: 'rectangle',
71
+ validator: function validator(value) {
72
+ return [null, 'rectangle', 'square'].includes(value);
73
+ }
74
+ },
75
+ rounded: {
76
+ type: String,
77
+ default: 'medium'
78
+ },
79
+ fillMode: {
80
+ type: String,
81
+ default: 'solid',
82
+ validator: function validator(value) {
83
+ return [null, 'flat', 'link', 'outline', 'solid'].includes(value);
84
+ }
85
+ },
86
+ // eslint-disable-next-line max-len
87
+ themeColor: {
88
+ type: String,
89
+ default: 'base',
90
+ validator: function validator(value) {
91
+ return [null, 'base', 'dark', 'error', 'info', 'inverse', 'inverse', 'light', 'primary', 'secondary', 'success', 'tertiary', 'warning'].includes(value);
92
+ }
93
+ },
94
+ opened: {
95
+ type: Boolean,
96
+ default: undefined
97
+ },
98
+ look: {
99
+ type: String,
100
+ validator: function validator(value) {
101
+ return ['default', 'flat', 'outline'].includes(value);
102
+ }
103
+ },
104
+ buttonClass: String,
105
+ dir: String
106
+ },
107
+ created: function created() {
108
+ this._blurTimeout = null;
109
+ this._anchor = guid();
110
+ this.wrapper = null;
111
+ this.mainButton = null;
112
+ this.guid = guid();
113
+ this.buttonsData = [];
114
+ validatePackage(packageMetadata);
115
+ },
116
+ mounted: function mounted() {
117
+ this.mainButton = this.$refs[this._anchor]; // If this.$props.opened is true during the initial render, the popup is not aligned.
118
+
119
+ if (this.$props.dir === undefined && this.isRtl() || this.computedOpened) {
120
+ this.$forceUpdate();
121
+ }
122
+ },
123
+ updated: function updated() {
124
+ if (this.focused && this.element()) {
125
+ this.mainButton = this.$refs[this._anchor];
126
+ this.mainButton.focus();
127
+ }
128
+ },
129
+ data: function data() {
130
+ return {
131
+ currentOpened: false,
132
+ focused: false,
133
+ focusedIndex: -1
134
+ };
135
+ },
136
+ computed: {
137
+ computedOpened: function computedOpened() {
138
+ return this.$props.opened === undefined ? this.currentOpened : this.$props.opened;
139
+ },
140
+ wrapperClass: function wrapperClass() {
141
+ return {
142
+ 'k-dropdown-button': true,
143
+ 'k-focus': this.focused
144
+ };
145
+ }
146
+ },
147
+ // @ts-ignore
148
+ setup: !isV3 ? undefined : function () {
149
+ var v3 = !!isV3;
150
+ var kendoAnchorRef = ref(null);
151
+ return {
152
+ v3: v3,
153
+ kendoAnchorRef: kendoAnchorRef
154
+ };
155
+ },
156
+ render: function render(createElement) {
157
+ var _this2 = this;
158
+
159
+ var h = gh || createElement;
160
+ var rtl = this.isRtl();
161
+ var dir = rtl ? 'rtl' : undefined;
162
+ var _a = this.$props,
163
+ tabIndex = _a.tabIndex,
164
+ disabled = _a.disabled;
165
+ var defaultSlot = getDefaultSlots(this);
166
+ this.buttonsData = this.$props.items;
167
+
168
+ var renderChildItems = function renderChildItems() {
169
+ var _a = this.$props,
170
+ item = _a.item,
171
+ itemRender = _a.itemRender,
172
+ textField = _a.textField;
173
+ return this.buttonsData.length > 0 ? this.buttonsData.map(function (dataItem, index) {
174
+ var currentDataItem = typeof dataItem !== 'string' ? __assign(__assign({}, dataItem), {
175
+ render: templateRendering.call(this, dataItem.render, getListeners.call(this))
176
+ }) : dataItem;
177
+ return (// @ts-ignore
178
+ h(ButtonItem, {
179
+ "class": "k-menu-item",
180
+ dataItem: currentDataItem,
181
+ attrs: this.v3 ? undefined : {
182
+ dataItem: currentDataItem,
183
+ textField: textField,
184
+ focused: this.focusedIndex === index,
185
+ render: templateRendering.call(this, itemRender, getListeners.call(this)),
186
+ item: item,
187
+ index: index,
188
+ id: "".concat(this.guid, "-").concat(index)
189
+ },
190
+ textField: textField,
191
+ focused: this.focusedIndex === index,
192
+ onClick: this.onItemClick,
193
+ on: this.v3 ? undefined : {
194
+ "click": this.onItemClick,
195
+ "down": this.onItemDown
196
+ },
197
+ onDown: this.onItemDown,
198
+ render: templateRendering.call(this, itemRender, getListeners.call(this)),
199
+ item: item,
200
+ index: index,
201
+ key: index,
202
+ id: "".concat(this.guid, "-").concat(index)
203
+ })
204
+ );
205
+ }, this) : null;
206
+ };
207
+
208
+ var renderPopup = function renderPopup() {
209
+ var _this = this;
210
+
211
+ var _a = this.$props,
212
+ _b = _a.popupSettings,
213
+ popupSettings = _b === void 0 ? {} : _b,
214
+ size = _a.size;
215
+ return (// @ts-ignore function children
216
+ h(Popup, {
217
+ anchor: this._anchor,
218
+ attrs: this.v3 ? undefined : {
219
+ anchor: this._anchor,
220
+ show: this.computedOpened,
221
+ animate: popupSettings.animate,
222
+ popupClass: classNames('k-menu-popup', popupSettings.popupClass),
223
+ anchorAlign: popupSettings.anchorAlign || getAnchorAlign(rtl),
224
+ popupAlign: popupSettings.popupAlign || getPopupAlign(rtl)
225
+ },
226
+ show: this.computedOpened,
227
+ animate: popupSettings.animate,
228
+ popupClass: classNames('k-menu-popup', popupSettings.popupClass),
229
+ anchorAlign: popupSettings.anchorAlign || getAnchorAlign(rtl),
230
+ popupAlign: popupSettings.popupAlign || getPopupAlign(rtl),
231
+ style: rtl ? {
232
+ direction: 'rtl'
233
+ } : undefined
234
+ }, this.v3 ? function () {
235
+ return [h("ul", {
236
+ "class": "k-group k-menu-group k-reset k-menu-group-".concat(kendoThemeMaps.sizeMap[size] || size),
237
+ role: "menu",
238
+ attrs: _this.v3 ? undefined : {
239
+ role: "menu",
240
+ id: _this.guid
241
+ },
242
+ id: _this.guid
243
+ }, [renderChildItems.call(_this)])];
244
+ } : [h("ul", {
245
+ "class": "k-group k-menu-group k-reset k-menu-group-".concat(kendoThemeMaps.sizeMap[size] || size),
246
+ role: "menu",
247
+ attrs: _this.v3 ? undefined : {
248
+ role: "menu",
249
+ id: _this.guid
250
+ },
251
+ id: _this.guid
252
+ }, [renderChildItems.call(_this)])])
253
+ );
254
+ };
255
+
256
+ return h("div", {
257
+ "class": this.wrapperClass,
258
+ onKeydown: this.onKeyDown,
259
+ on: this.v3 ? undefined : {
260
+ "keydown": this.onKeyDown,
261
+ "focusin": this.onFocus,
262
+ "focusout": this.onBlur
263
+ },
264
+ onFocusin: this.onFocus,
265
+ onFocusout: this.onBlur,
266
+ dir: dir,
267
+ attrs: this.v3 ? undefined : {
268
+ dir: dir
269
+ }
270
+ }, [// @ts-ignore function children
271
+ h(KendoButton, {
272
+ size: this.$props.size,
273
+ attrs: this.v3 ? undefined : {
274
+ size: this.$props.size,
275
+ shape: this.$props.shape,
276
+ rounded: this.$props.rounded,
277
+ fillMode: this.$props.fillMode,
278
+ themeColor: this.$props.themeColor,
279
+ disabled: disabled || undefined,
280
+ tabIndex: tabIndex,
281
+ accessKey: this.$props.accessKey,
282
+ icon: this.$props.icon,
283
+ iconClass: this.$props.iconClass,
284
+ imageUrl: this.$props.imageUrl,
285
+ look: this.$props.look,
286
+ primary: this.$props.primary,
287
+ dir: dir,
288
+ type: "button",
289
+ "aria-disabled": disabled,
290
+ "aria-haspopup": true,
291
+ "aria-expanded": this.computedOpened,
292
+ "aria-label": "".concat(this.$props.text, " dropdownbutton"),
293
+ "aria-owns": this.guid,
294
+ "aria-activedescendant": this.focusedIndex !== undefined && this.focusedIndex >= 0 ? "".concat(this.guid, "-").concat(this.focusedIndex) : undefined
295
+ },
296
+ shape: this.$props.shape,
297
+ rounded: this.$props.rounded,
298
+ fillMode: this.$props.fillMode,
299
+ themeColor: this.$props.themeColor,
300
+ onClick: this.onClickMainButton,
301
+ on: this.v3 ? undefined : {
302
+ "click": this.onClickMainButton,
303
+ "mousedown": this.mouseDown
304
+ },
305
+ onMousedown: this.mouseDown,
306
+ disabled: disabled || undefined,
307
+ tabIndex: tabIndex,
308
+ accessKey: this.$props.accessKey,
309
+ icon: this.$props.icon,
310
+ iconClass: this.$props.iconClass,
311
+ "class": this.$props.buttonClass,
312
+ imageUrl: this.$props.imageUrl,
313
+ look: this.$props.look,
314
+ primary: this.$props.primary,
315
+ dir: dir,
316
+ ref: this._anchor,
317
+ type: "button",
318
+ "aria-disabled": disabled,
319
+ "aria-haspopup": true,
320
+ "aria-expanded": this.computedOpened,
321
+ "aria-label": "".concat(this.$props.text, " dropdownbutton"),
322
+ "aria-owns": this.guid,
323
+ "aria-activedescendant": this.focusedIndex !== undefined && this.focusedIndex >= 0 ? "".concat(this.guid, "-").concat(this.focusedIndex) : undefined
324
+ }, this.v3 ? function () {
325
+ return [_this2.$props.text, defaultSlot];
326
+ } : [_this2.$props.text, defaultSlot]), renderPopup.call(this)]);
327
+ },
328
+ methods: {
329
+ element: function element() {
330
+ return this.mainButton;
331
+ },
332
+ onKeyDown: function onKeyDown(event) {
333
+ if (event.altKey) {
334
+ if (!this.computedOpened && event.keyCode === Keys.down) {
335
+ this.dispatchPopupEvent(event, true);
336
+ this.focusedIndex = 0;
337
+ this.currentOpened = true;
338
+ } else if (this.computedOpened && event.keyCode === Keys.up) {
339
+ this.dispatchPopupEvent(event, false);
340
+ this.focusedIndex = -1;
341
+ this.currentOpened = false;
342
+ }
343
+
344
+ return;
345
+ }
346
+
347
+ if (event.keyCode === Keys.enter || event.keyCode === Keys.space) {
348
+ if (this.focusedIndex !== undefined && this.focusedIndex >= 0) {
349
+ this.dispatchClickEvent(event, this.focusedIndex);
350
+ } // Prevent default because otherwise when an item is selected
351
+ // click on the default button gets emitted which opens the popup again.
352
+
353
+
354
+ event.preventDefault();
355
+ this.focusedIndex = this.computedOpened ? -1 : 0, this.currentOpened = !this.computedOpened;
356
+ this.dispatchPopupEvent(event, this.currentOpened);
357
+ } else if (this.computedOpened && event.keyCode === Keys.esc) {
358
+ this.focusedIndex = -1;
359
+ this.currentOpened = false;
360
+ this.dispatchPopupEvent(event, this.currentOpened);
361
+ }
362
+
363
+ if (this.computedOpened) {
364
+ var newFocused = navigation(this.focusedIndex, event.keyCode, event.altKey, this.buttonsData.length);
365
+ this.focusedIndex = newFocused;
366
+ var arrowKey = event.keyCode === Keys.up || event.keyCode === Keys.down || event.keyCode === Keys.left || event.keyCode === Keys.right;
367
+
368
+ if (!event.altKey && arrowKey) {
369
+ // Needed to notify the parent listeners that event is handled.
370
+ event.preventDefault();
371
+ }
372
+ }
373
+ },
374
+ onFocus: function onFocus(event) {
375
+ if (!this.focused) {
376
+ this.focused = true;
377
+ this.$emit('focus', event, this, undefined);
378
+ }
379
+
380
+ this.focusedIndex = this.computedOpened ? 0 : -1;
381
+ clearTimeout(this._blurTimeout);
382
+ },
383
+ onBlur: function onBlur(event) {
384
+ clearTimeout(this._blurTimeout);
385
+ this.createBlurTimeout(event);
386
+ },
387
+ createBlurTimeout: function createBlurTimeout(event) {
388
+ var that = this;
389
+ this._blurTimeout = setTimeout(function () {
390
+ if (canUseDOM && document.activeElement !== that.$el) {
391
+ that.focused = false;
392
+ that.focusedIndex = -1;
393
+ that.$emit('blur', event, that, undefined);
394
+ var fireCloseEvent = that.computedOpened;
395
+
396
+ if (fireCloseEvent) {
397
+ that.currentOpened = false;
398
+ that.dispatchPopupEvent(event, false);
399
+ }
400
+ }
401
+ }, 200);
402
+ },
403
+ onItemClick: function onItemClick(event, clickedItemIndex) {
404
+ this.focusedIndex = -1;
405
+ this.currentOpened = false;
406
+ this.dispatchClickEvent(event, clickedItemIndex);
407
+ this.dispatchPopupEvent(event, false);
408
+ },
409
+ onItemDown: function onItemDown(event) {
410
+ if (document.activeElement === this.element()) {
411
+ event.preventDefault();
412
+ }
413
+ },
414
+ mouseDown: function mouseDown(event) {
415
+ event.preventDefault();
416
+ },
417
+ dispatchClickEvent: function dispatchClickEvent(dispatchedEvent, index) {
418
+ if (!this.isItemDisabled(index)) {
419
+ this.$emit('itemclick', {
420
+ event: dispatchedEvent,
421
+ item: this.buttonsData[index],
422
+ itemIndex: index
423
+ });
424
+ }
425
+ },
426
+ onClickMainButton: function onClickMainButton(event) {
427
+ if (!this.buttonsData.length) {
428
+ return;
429
+ }
430
+
431
+ var toOpen = !this.computedOpened;
432
+ this.currentOpened = toOpen;
433
+ this.focused = true;
434
+ this.focusedIndex = toOpen ? 0 : -1;
435
+ this.dispatchPopupEvent(event, toOpen);
436
+ },
437
+ dispatchPopupEvent: function dispatchPopupEvent(dispatchedEvent, open) {
438
+ this.$emit(open ? 'open' : 'close', dispatchedEvent, this, undefined);
439
+ },
440
+ isItemDisabled: function isItemDisabled(index) {
441
+ return this.buttonsData[index] ? this.buttonsData[index].disabled : this.$props.disabled;
442
+ },
443
+ isRtl: function isRtl() {
444
+ return this.$props.dir !== undefined ? this.$props.dir === 'rtl' : !!this.$el && getComputedStyle(this.$el).direction === 'rtl';
445
+ }
446
+ }
447
+ };
448
+ /**
449
+ * @hidden
450
+ */
451
+
452
+ var DropDownButton = DropDownButtonVue2;
453
+ export { DropDownButton, DropDownButtonVue2 };
@@ -0,0 +1,67 @@
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 { SplitButtonProps } from './models/ListButtonProps';
7
+ /**
8
+ * @hidden
9
+ */
10
+ export interface SplitButtonData {
11
+ focusedIndex?: number;
12
+ focused?: boolean;
13
+ currentOpened: boolean;
14
+ }
15
+ /**
16
+ * @hidden
17
+ */
18
+ export interface SplitButtonComputed {
19
+ [key: string]: any;
20
+ computedOpened: boolean;
21
+ wrapperClass: object;
22
+ }
23
+ /**
24
+ * @hidden
25
+ */
26
+ export interface SplitButtonMethods {
27
+ [key: string]: any;
28
+ element: () => HTMLButtonElement | null;
29
+ onKeyDown: (event: any) => void;
30
+ onFocus: (event: any) => void;
31
+ onBlur: (event: any) => void;
32
+ onItemClick: (event: any, clickedItemIndex: number) => void;
33
+ onItemDown: (event: any) => void;
34
+ mouseDown: (event: any) => void;
35
+ dispatchClickEvent: (dispatchedEvent: any, index: number) => void;
36
+ onClickMainButton: () => void;
37
+ onDownSplitPart: () => void;
38
+ onSplitPartClick: (event: any) => void;
39
+ dispatchPopupEvent: (dispatchedEvent: any, open: boolean) => void;
40
+ isItemDisabled: (index: number) => boolean;
41
+ isRtl: () => boolean;
42
+ }
43
+ /**
44
+ * @hidden
45
+ */
46
+ export interface SplitButtonState {
47
+ mainButton: any;
48
+ guid: string;
49
+ buttonsData: Array<any>;
50
+ _anchor: string;
51
+ kendoAnchorRef: any;
52
+ v3: boolean;
53
+ }
54
+ /**
55
+ * @hidden
56
+ */
57
+ export interface SplitButtonAll extends Vue2type, SplitButtonMethods, SplitButtonData, SplitButtonComputed, SplitButtonState {
58
+ }
59
+ /**
60
+ * @hidden
61
+ */
62
+ declare let SplitButtonVue2: ComponentOptions<SplitButtonAll, DefaultData<SplitButtonData>, DefaultMethods<SplitButtonAll>, SplitButtonComputed, RecordPropsDefinition<SplitButtonProps>>;
63
+ /**
64
+ * @hidden
65
+ */
66
+ declare const SplitButton: DefineComponent<SplitButtonProps, any, SplitButtonData, SplitButtonComputed, SplitButtonMethods, {}, {}, {}, string, SplitButtonProps, SplitButtonProps, {}>;
67
+ export { SplitButton, SplitButtonVue2 };