@progress/kendo-vue-listbox 3.7.4-dev.202212300853

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 (69) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +86 -0
  3. package/README.md +52 -0
  4. package/dist/cdn/js/kendo-vue-listbox.js +1 -0
  5. package/dist/es/ListBox.d.ts +40 -0
  6. package/dist/es/ListBox.js +253 -0
  7. package/dist/es/ListBoxToolbar.d.ts +40 -0
  8. package/dist/es/ListBoxToolbar.js +166 -0
  9. package/dist/es/additionalTypes.ts +21 -0
  10. package/dist/es/interfaces/Enums.d.ts +7 -0
  11. package/dist/es/interfaces/Enums.js +8 -0
  12. package/dist/es/interfaces/ListBoxEvents.d.ts +13 -0
  13. package/dist/es/interfaces/ListBoxEvents.js +1 -0
  14. package/dist/es/interfaces/ListBoxProps.d.ts +93 -0
  15. package/dist/es/interfaces/ListBoxProps.js +2 -0
  16. package/dist/es/interfaces/ListBoxToolBarProps.d.ts +32 -0
  17. package/dist/es/interfaces/ListBoxToolBarProps.js +1 -0
  18. package/dist/es/main.d.ts +7 -0
  19. package/dist/es/main.js +4 -0
  20. package/dist/es/messages/main.d.ts +40 -0
  21. package/dist/es/messages/main.js +41 -0
  22. package/dist/es/package-metadata.d.ts +5 -0
  23. package/dist/es/package-metadata.js +11 -0
  24. package/dist/es/utils.d.ts +31 -0
  25. package/dist/es/utils.js +195 -0
  26. package/dist/esm/ListBox.d.ts +40 -0
  27. package/dist/esm/ListBox.js +253 -0
  28. package/dist/esm/ListBoxToolbar.d.ts +40 -0
  29. package/dist/esm/ListBoxToolbar.js +166 -0
  30. package/dist/esm/additionalTypes.ts +21 -0
  31. package/dist/esm/interfaces/Enums.d.ts +7 -0
  32. package/dist/esm/interfaces/Enums.js +8 -0
  33. package/dist/esm/interfaces/ListBoxEvents.d.ts +13 -0
  34. package/dist/esm/interfaces/ListBoxEvents.js +1 -0
  35. package/dist/esm/interfaces/ListBoxProps.d.ts +93 -0
  36. package/dist/esm/interfaces/ListBoxProps.js +2 -0
  37. package/dist/esm/interfaces/ListBoxToolBarProps.d.ts +32 -0
  38. package/dist/esm/interfaces/ListBoxToolBarProps.js +1 -0
  39. package/dist/esm/main.d.ts +7 -0
  40. package/dist/esm/main.js +4 -0
  41. package/dist/esm/messages/main.d.ts +40 -0
  42. package/dist/esm/messages/main.js +41 -0
  43. package/dist/esm/package-metadata.d.ts +5 -0
  44. package/dist/esm/package-metadata.js +11 -0
  45. package/dist/esm/package.json +3 -0
  46. package/dist/esm/utils.d.ts +31 -0
  47. package/dist/esm/utils.js +195 -0
  48. package/dist/npm/ListBox.d.ts +40 -0
  49. package/dist/npm/ListBox.js +260 -0
  50. package/dist/npm/ListBoxToolbar.d.ts +40 -0
  51. package/dist/npm/ListBoxToolbar.js +173 -0
  52. package/dist/npm/additionalTypes.ts +21 -0
  53. package/dist/npm/interfaces/Enums.d.ts +7 -0
  54. package/dist/npm/interfaces/Enums.js +14 -0
  55. package/dist/npm/interfaces/ListBoxEvents.d.ts +13 -0
  56. package/dist/npm/interfaces/ListBoxEvents.js +5 -0
  57. package/dist/npm/interfaces/ListBoxProps.d.ts +93 -0
  58. package/dist/npm/interfaces/ListBoxProps.js +3 -0
  59. package/dist/npm/interfaces/ListBoxToolBarProps.d.ts +32 -0
  60. package/dist/npm/interfaces/ListBoxToolBarProps.js +5 -0
  61. package/dist/npm/main.d.ts +7 -0
  62. package/dist/npm/main.js +11 -0
  63. package/dist/npm/messages/main.d.ts +40 -0
  64. package/dist/npm/messages/main.js +44 -0
  65. package/dist/npm/package-metadata.d.ts +5 -0
  66. package/dist/npm/package-metadata.js +14 -0
  67. package/dist/npm/utils.d.ts +31 -0
  68. package/dist/npm/utils.js +204 -0
  69. package/package.json +57 -0
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @hidden
3
+ */
4
+ export declare const moveUp = "listbox.moveUp";
5
+ /**
6
+ * @hidden
7
+ */
8
+ export declare const moveDown = "listbox.moveDown";
9
+ /**
10
+ * @hidden
11
+ */
12
+ export declare const transferTo = "listbox.transferTo";
13
+ /**
14
+ * @hidden
15
+ */
16
+ export declare const transferFrom = "listbox.transferFrom";
17
+ /**
18
+ * @hidden
19
+ */
20
+ export declare const transferAllTo = "listbox.transferAllTo";
21
+ /**
22
+ * @hidden
23
+ */
24
+ export declare const transferAllFrom = "listbox.transferAllFrom";
25
+ /**
26
+ * @hidden
27
+ */
28
+ export declare const remove = "listbox.remove";
29
+ /**
30
+ * @hidden
31
+ */
32
+ export declare const messages: {
33
+ "listbox.moveUp": string;
34
+ "listbox.moveDown": string;
35
+ "listbox.transferTo": string;
36
+ "listbox.transferFrom": string;
37
+ "listbox.transferAllTo": string;
38
+ "listbox.transferAllFrom": string;
39
+ "listbox.remove": string;
40
+ };
@@ -0,0 +1,41 @@
1
+ var _a;
2
+ /**
3
+ * @hidden
4
+ */
5
+ export var moveUp = 'listbox.moveUp';
6
+ /**
7
+ * @hidden
8
+ */
9
+ export var moveDown = 'listbox.moveDown';
10
+ /**
11
+ * @hidden
12
+ */
13
+ export var transferTo = 'listbox.transferTo';
14
+ /**
15
+ * @hidden
16
+ */
17
+ export var transferFrom = 'listbox.transferFrom';
18
+ /**
19
+ * @hidden
20
+ */
21
+ export var transferAllTo = 'listbox.transferAllTo';
22
+ /**
23
+ * @hidden
24
+ */
25
+ export var transferAllFrom = 'listbox.transferAllFrom';
26
+ /**
27
+ * @hidden
28
+ */
29
+ export var remove = 'listbox.remove';
30
+ /**
31
+ * @hidden
32
+ */
33
+ export var messages = (_a = {},
34
+ _a[moveUp] = 'Move Up',
35
+ _a[moveDown] = 'Move Down',
36
+ _a[transferTo] = 'Transfer To',
37
+ _a[transferFrom] = 'Transfer From',
38
+ _a[transferAllTo] = 'Transfer All To',
39
+ _a[transferAllFrom] = 'Transfer All From',
40
+ _a[remove] = 'Delete',
41
+ _a);
@@ -0,0 +1,5 @@
1
+ import { PackageMetadata } from '@progress/kendo-licensing';
2
+ /**
3
+ * @hidden
4
+ */
5
+ export declare const packageMetadata: PackageMetadata;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @hidden
3
+ */
4
+ export var packageMetadata = {
5
+ name: '@progress/kendo-vue-listbox',
6
+ productName: 'Kendo UI for Vue',
7
+ productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
8
+ publishDate: 1672390045,
9
+ version: '',
10
+ licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
11
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Process the data collection/s based on the clicked ListBoxToolbar tool.
3
+ *
4
+ * @param {T[]} listBoxOneData - The first data collection.
5
+ * @param {T[]} listBoxTwoData - The second data collection. Pass an empty array if there is only one ListBox.
6
+ * @param {string} toolName - The tool that was clicked.
7
+ * @param {string} selectedField - The field that contains the selected information in the data object.
8
+ * @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
9
+ */
10
+ export declare const processListBoxData: (listBoxOneData: Array<any>, listBoxTwoData: Array<any>, toolName: string, selectedField: string) => {
11
+ listBoxOneData: any[];
12
+ listBoxTwoData: any[];
13
+ };
14
+ /**
15
+ * @hidden
16
+ */
17
+ export declare const moveItem: (from: number, to: number, data: Array<any>) => any[];
18
+ /**
19
+ * Process the data collection/s based on the dragged and drop item.
20
+ *
21
+ * @param {T[]} listBoxOneData - The first data collection.
22
+ * @param {T[]} listBoxTwoData - The second data collection. Pass an empty array if there is only one ListBox.
23
+ * @param {any} dragItem - The item that was dragged.
24
+ * @param {any} dropItem - The drop target item.
25
+ * @param {string} valueField - The field which points to the unique value of each data item.
26
+ * @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
27
+ */
28
+ export declare const processListBoxDragAndDrop: (listBoxOneData: Array<any>, listBoxTwoData: Array<any>, dragItem: any, dropItem: any, valueField: string) => {
29
+ listBoxOneData: any[];
30
+ listBoxTwoData: any[];
31
+ };
@@ -0,0 +1,195 @@
1
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ /**
11
+ * Process the data collection/s based on the clicked ListBoxToolbar tool.
12
+ *
13
+ * @param {T[]} listBoxOneData - The first data collection.
14
+ * @param {T[]} listBoxTwoData - The second data collection. Pass an empty array if there is only one ListBox.
15
+ * @param {string} toolName - The tool that was clicked.
16
+ * @param {string} selectedField - The field that contains the selected information in the data object.
17
+ * @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
18
+ */
19
+ // tslint:disable-next-line: max-line-length
20
+ export var processListBoxData = function processListBoxData(listBoxOneData, listBoxTwoData, toolName, selectedField) {
21
+ if (listBoxOneData === void 0) {
22
+ listBoxOneData = [];
23
+ }
24
+ if (listBoxTwoData === void 0) {
25
+ listBoxTwoData = [];
26
+ }
27
+ var newFirstData = [];
28
+ var itemsForTransfer = [];
29
+ var newSecondData = [];
30
+ var result = {
31
+ listBoxOneData: listBoxOneData,
32
+ listBoxTwoData: listBoxTwoData
33
+ };
34
+ switch (toolName) {
35
+ case 'moveUp':
36
+ newFirstData = __spreadArray([], listBoxOneData, true);
37
+ newFirstData.forEach(function (item, index) {
38
+ if (item[selectedField]) {
39
+ newFirstData = moveItem(index, index - 1, newFirstData);
40
+ }
41
+ });
42
+ newSecondData = __spreadArray([], listBoxTwoData, true);
43
+ newSecondData.forEach(function (item, index) {
44
+ if (item[selectedField]) {
45
+ newSecondData = moveItem(index, index - 1, newSecondData);
46
+ }
47
+ });
48
+ result.listBoxOneData = newFirstData;
49
+ result.listBoxTwoData = newSecondData;
50
+ break;
51
+ case 'moveDown':
52
+ newFirstData = listBoxOneData.reverse();
53
+ newFirstData.forEach(function (item, index) {
54
+ if (item[selectedField]) {
55
+ newFirstData = moveItem(index, index - 1, newFirstData);
56
+ }
57
+ });
58
+ newSecondData = listBoxTwoData.reverse();
59
+ newSecondData.forEach(function (item, index) {
60
+ if (item[selectedField]) {
61
+ newSecondData = moveItem(index, index - 1, newSecondData);
62
+ }
63
+ });
64
+ result.listBoxOneData = __spreadArray([], newFirstData, true).reverse();
65
+ result.listBoxTwoData = __spreadArray([], newSecondData, true).reverse();
66
+ break;
67
+ case 'transferTo':
68
+ newFirstData = listBoxOneData.filter(function (item) {
69
+ return !item[selectedField];
70
+ });
71
+ itemsForTransfer = listBoxOneData.filter(function (item) {
72
+ return item[selectedField];
73
+ });
74
+ newSecondData = listBoxTwoData.concat(itemsForTransfer);
75
+ result.listBoxOneData = newFirstData;
76
+ result.listBoxTwoData = newSecondData;
77
+ break;
78
+ case 'transferFrom':
79
+ newSecondData = listBoxTwoData.filter(function (item) {
80
+ return !item[selectedField];
81
+ });
82
+ itemsForTransfer = listBoxTwoData.filter(function (item) {
83
+ return item[selectedField];
84
+ });
85
+ newFirstData = listBoxOneData.concat(itemsForTransfer);
86
+ result.listBoxOneData = newFirstData;
87
+ result.listBoxTwoData = newSecondData;
88
+ break;
89
+ case 'transferAllTo':
90
+ result.listBoxOneData = [];
91
+ result.listBoxTwoData = listBoxTwoData.concat(listBoxOneData);
92
+ break;
93
+ case 'transferAllFrom':
94
+ result.listBoxOneData = listBoxTwoData.concat(listBoxOneData);
95
+ result.listBoxTwoData = [];
96
+ break;
97
+ case 'remove':
98
+ newSecondData = listBoxTwoData.filter(function (item) {
99
+ return !item[selectedField];
100
+ });
101
+ newFirstData = listBoxOneData.filter(function (item) {
102
+ return !item[selectedField];
103
+ });
104
+ result.listBoxOneData = newFirstData;
105
+ result.listBoxTwoData = newSecondData;
106
+ break;
107
+ default:
108
+ }
109
+ return result;
110
+ };
111
+ /**
112
+ * @hidden
113
+ */
114
+ export var moveItem = function moveItem(from, to, data) {
115
+ var f = data.splice(from, 1)[0];
116
+ data.splice(to, 0, f);
117
+ return data;
118
+ };
119
+ /**
120
+ * Process the data collection/s based on the dragged and drop item.
121
+ *
122
+ * @param {T[]} listBoxOneData - The first data collection.
123
+ * @param {T[]} listBoxTwoData - The second data collection. Pass an empty array if there is only one ListBox.
124
+ * @param {any} dragItem - The item that was dragged.
125
+ * @param {any} dropItem - The drop target item.
126
+ * @param {string} valueField - The field which points to the unique value of each data item.
127
+ * @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
128
+ */
129
+ // tslint:disable-next-line: max-line-length
130
+ export var processListBoxDragAndDrop = function processListBoxDragAndDrop(listBoxOneData, listBoxTwoData, dragItem, dropItem, valueField) {
131
+ if (listBoxOneData === void 0) {
132
+ listBoxOneData = [];
133
+ }
134
+ if (listBoxTwoData === void 0) {
135
+ listBoxTwoData = [];
136
+ }
137
+ var dragItemIndexInFirstList = listBoxOneData.findIndex(function (item) {
138
+ return item[valueField] === dragItem[valueField];
139
+ });
140
+ var dragItemIndexInSecondList = listBoxTwoData.findIndex(function (item) {
141
+ return item[valueField] === dragItem[valueField];
142
+ });
143
+ var dropItemIndexInFirstList = dropItem !== null ? listBoxOneData.findIndex(function (item) {
144
+ return item[valueField] === dropItem[valueField];
145
+ }) : -1;
146
+ var dropItemIndexInSecondList = dropItem !== null ? listBoxTwoData.findIndex(function (item) {
147
+ return item[valueField] === dropItem[valueField];
148
+ }) : -1;
149
+ var isDragItemInFirstList = dragItemIndexInFirstList >= 0 ? true : false;
150
+ var isDragItemInSecondList = dragItemIndexInSecondList >= 0 ? true : false;
151
+ var isDropItemInFirstList = dropItemIndexInFirstList >= 0 ? true : false;
152
+ var isDropItemInSecondList = dropItemIndexInSecondList >= 0 ? true : false;
153
+ var firstDataSet = __spreadArray([], listBoxOneData, true);
154
+ var secondDataSet = __spreadArray([], listBoxTwoData, true);
155
+ if (isDragItemInFirstList && isDropItemInFirstList) {
156
+ return {
157
+ listBoxOneData: moveItem(dragItemIndexInFirstList, dropItemIndexInFirstList, listBoxOneData),
158
+ listBoxTwoData: listBoxTwoData
159
+ };
160
+ }
161
+ if (isDragItemInSecondList && isDropItemInSecondList) {
162
+ return {
163
+ listBoxOneData: listBoxOneData,
164
+ listBoxTwoData: moveItem(dragItemIndexInSecondList, dropItemIndexInSecondList, listBoxTwoData)
165
+ };
166
+ }
167
+ if (isDragItemInFirstList && (isDropItemInSecondList || dropItem === null)) {
168
+ if (dropItem === null) {
169
+ secondDataSet.push(listBoxOneData[dragItemIndexInFirstList]);
170
+ } else {
171
+ secondDataSet.splice(dropItemIndexInSecondList + 1, 0, listBoxOneData[dragItemIndexInFirstList]);
172
+ }
173
+ firstDataSet.splice(dragItemIndexInFirstList, 1);
174
+ return {
175
+ listBoxOneData: firstDataSet,
176
+ listBoxTwoData: secondDataSet
177
+ };
178
+ }
179
+ if (isDragItemInSecondList && (isDropItemInFirstList || dropItem === null)) {
180
+ if (dropItem === null) {
181
+ firstDataSet.push(listBoxTwoData[dragItemIndexInSecondList]);
182
+ } else {
183
+ firstDataSet.splice(dropItemIndexInFirstList + 1, 0, listBoxTwoData[dragItemIndexInSecondList]);
184
+ }
185
+ secondDataSet.splice(dragItemIndexInSecondList, 1);
186
+ return {
187
+ listBoxOneData: firstDataSet,
188
+ listBoxTwoData: secondDataSet
189
+ };
190
+ }
191
+ return {
192
+ listBoxOneData: listBoxOneData,
193
+ listBoxTwoData: listBoxTwoData
194
+ };
195
+ };
@@ -0,0 +1,40 @@
1
+ import { DefineComponent } from './additionalTypes';
2
+ import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
3
+ declare type DefaultData<V> = object | ((this: V) => {});
4
+ declare type DefaultMethods<V> = {
5
+ [key: string]: (this: V, ...args: any[]) => any;
6
+ };
7
+ import { ListBoxProps } from './interfaces/ListBoxProps';
8
+ /**
9
+ * @hidden
10
+ */
11
+ export interface ListBoxState {
12
+ }
13
+ /**
14
+ * @hidden
15
+ */
16
+ export interface ListBoxComputed {
17
+ [key: string]: any;
18
+ }
19
+ /**
20
+ * @hidden
21
+ */
22
+ export interface ListBoxMethods {
23
+ [key: string]: any;
24
+ }
25
+ /**
26
+ * @hidden
27
+ */
28
+ export interface ListBoxData {
29
+ }
30
+ /**
31
+ * @hidden
32
+ */
33
+ export interface ListBoxAll extends Vue, ListBoxMethods, ListBoxData, ListBoxComputed, ListBoxState {
34
+ }
35
+ /**
36
+ * @hidden
37
+ */
38
+ declare let ListBoxVue2: ComponentOptions<ListBoxAll, DefaultData<ListBoxData>, DefaultMethods<ListBoxAll>, ListBoxComputed, RecordPropsDefinition<ListBoxProps>>;
39
+ declare const ListBox: DefineComponent<ListBoxProps, any, ListBoxData, ListBoxComputed, ListBoxMethods, {}, {}, {}, string, ListBoxProps, ListBoxProps, {}>;
40
+ export { ListBox, ListBoxVue2 };
@@ -0,0 +1,253 @@
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, guid, kendoThemeMaps, validatePackage, templateRendering, getListeners, getTemplate } from '@progress/kendo-vue-common';
7
+ import { toolbarPosition } from './interfaces/Enums.js';
8
+ import { packageMetadata } from './package-metadata.js';
9
+ /**
10
+ * @hidden
11
+ */
12
+ var ListBoxVue2 = {
13
+ name: 'KendoListBox',
14
+ // @ts-ignore
15
+ emits: {
16
+ dragstart: null,
17
+ itemclick: null,
18
+ drop: null,
19
+ dragover: null,
20
+ keydown: null,
21
+ dragleave: null
22
+ },
23
+ props: {
24
+ size: {
25
+ type: String,
26
+ default: 'medium',
27
+ validator: function validator(value) {
28
+ return [null, 'small', 'medium', 'large'].includes(value);
29
+ }
30
+ },
31
+ toolbarPosition: {
32
+ type: String,
33
+ default: toolbarPosition.RIGHT,
34
+ validator: function validator(value) {
35
+ return ['none', 'top', 'bottom', 'left', 'right'].includes(value);
36
+ }
37
+ },
38
+ textField: String,
39
+ valueField: String,
40
+ keyField: String,
41
+ selectedField: String,
42
+ item: [String, Object, Function],
43
+ toolbar: [String, Object, Function],
44
+ tabIndex: Number,
45
+ dataItems: {
46
+ type: Array,
47
+ default: function _default() {
48
+ return [];
49
+ }
50
+ },
51
+ draggable: {
52
+ type: Boolean,
53
+ default: true
54
+ }
55
+ },
56
+ created: function created() {
57
+ validatePackage(packageMetadata);
58
+ },
59
+ computed: {
60
+ wrapperClass: function wrapperClass() {
61
+ var _a;
62
+ var nonePosition = this.$props.toolbarPosition === toolbarPosition.NONE || this.$props.toolbar === undefined;
63
+ return _a = {
64
+ 'k-listbox': true
65
+ }, _a["k-listbox-toolbar-".concat(this.$props.toolbarPosition)] = !nonePosition, _a;
66
+ }
67
+ },
68
+ // @ts-ignore
69
+ setup: !isV3 ? undefined : function () {
70
+ var v3 = !!isV3;
71
+ return {
72
+ v3: v3
73
+ };
74
+ },
75
+ // @ts-ignore
76
+ render: function render(createElement) {
77
+ var _a;
78
+ var h = gh || createElement;
79
+ var toolbarTemplate = templateRendering.call(this, this.$props.toolbar, getListeners.call(this));
80
+ var toolbarRender = getTemplate.call(this, {
81
+ h: h,
82
+ template: toolbarTemplate
83
+ });
84
+ return h("div", {
85
+ "class": this.wrapperClass,
86
+ unselectable: "on",
87
+ attrs: this.v3 ? undefined : {
88
+ unselectable: "on"
89
+ }
90
+ }, [this.$props.toolbarPosition !== 'bottom' && toolbarRender, h("div", {
91
+ "class": 'k-list-scroller k-selectable',
92
+ "data-role": 'selectable',
93
+ attrs: this.v3 ? undefined : {
94
+ "data-role": 'selectable'
95
+ },
96
+ onDragover: function onDragover(e) {
97
+ return e.preventDefault();
98
+ },
99
+ on: this.v3 ? undefined : {
100
+ "dragover": function onDragover(e) {
101
+ return e.preventDefault();
102
+ },
103
+ "drop": this.handleContainerDrop,
104
+ "dragleave": this.handleOnDragLeave
105
+ },
106
+ onDrop: this.handleContainerDrop,
107
+ onDragleave: this.handleOnDragLeave
108
+ }, [h("div", {
109
+ "class": classNames('k-list', (_a = {}, _a["k-list-".concat(kendoThemeMaps.sizeMap[this.$props.size] || this.$props.size)] = this.$props.size, _a))
110
+ }, [h("div", {
111
+ "class": 'k-list-content'
112
+ }, [h("ul", {
113
+ "class": 'k-list-ul',
114
+ role: 'listbox',
115
+ attrs: this.v3 ? undefined : {
116
+ role: 'listbox',
117
+ "aria-label": 'listbox-container',
118
+ tabIndex: this.tabIndex
119
+ },
120
+ "aria-label": 'listbox-container',
121
+ tabIndex: this.tabIndex,
122
+ onKeydown: this.handleKeyDown,
123
+ on: this.v3 ? undefined : {
124
+ "keydown": this.handleKeyDown
125
+ }
126
+ }, [this.$props.dataItems.map(function (item, index) {
127
+ var _this = this;
128
+ var selectedValue = this.setSelected(item);
129
+ var itemGuid = guid();
130
+ var defaultRendering = h("span", {
131
+ "class": 'k-list-item-text'
132
+ }, [this.$props.textField ? item[this.$props.textField] : item.toString()]);
133
+ var itemTemplate = templateRendering.call(this, this.$props.item, getListeners.call(this));
134
+ var itemRender = getTemplate.call(this, {
135
+ h: h,
136
+ template: itemTemplate,
137
+ defaultRendering: defaultRendering,
138
+ additionalProps: {
139
+ dataItem: item,
140
+ index: index
141
+ }
142
+ });
143
+ return h("li", {
144
+ "class": classNames('k-list-item', {
145
+ 'k-selected': selectedValue
146
+ }, item.class),
147
+ style: item.style,
148
+ role: 'option',
149
+ attrs: this.v3 ? undefined : {
150
+ role: 'option',
151
+ "aria-selected": selectedValue,
152
+ id: itemGuid + index,
153
+ "data-uid": itemGuid + index,
154
+ draggable: this.$props.draggable
155
+ },
156
+ "aria-selected": selectedValue,
157
+ key: this.$props.keyField ? item[this.$props.keyField] : index,
158
+ id: itemGuid + index,
159
+ "data-uid": itemGuid + index,
160
+ draggable: this.$props.draggable,
161
+ onDragstart: function onDragstart(event) {
162
+ return _this.dispatchEvent('dragstart', event, item);
163
+ },
164
+ on: this.v3 ? undefined : {
165
+ "dragstart": function onDragstart(event) {
166
+ return _this.dispatchEvent('dragstart', event, item);
167
+ },
168
+ "dragOver": function dragOver(event) {
169
+ event.preventDefault();
170
+ _this.dispatchEvent('dragover', event, item);
171
+ },
172
+ "drop": function drop(event) {
173
+ return _this.dispatchEvent('drop', event, item);
174
+ },
175
+ "click": function click(event) {
176
+ return _this.dispatchEvent('itemclick', event, item);
177
+ }
178
+ },
179
+ onDragOver: function dragOver(event) {
180
+ event.preventDefault();
181
+ _this.dispatchEvent('dragover', event, item);
182
+ },
183
+ onDrop: function drop(event) {
184
+ return _this.dispatchEvent('drop', event, item);
185
+ },
186
+ onClick: function click(event) {
187
+ return _this.dispatchEvent('itemclick', event, item);
188
+ }
189
+ }, [itemRender]);
190
+ }, this)])])])]), this.$props.toolbarPosition === 'bottom' && toolbarRender, h("select", {
191
+ style: {
192
+ display: 'none'
193
+ },
194
+ multiple: true,
195
+ attrs: this.v3 ? undefined : {
196
+ multiple: true,
197
+ "data-role": "listbox"
198
+ },
199
+ "data-role": "listbox"
200
+ }, [this.$props.dataItems.map(function (item, index) {
201
+ var value = item[this.$props.valueField || this.$props.textField];
202
+ return h("option", {
203
+ key: index,
204
+ value: this.v3 ? value : null,
205
+ domProps: this.v3 ? undefined : {
206
+ "value": value
207
+ }
208
+ }, [value]);
209
+ }, this)])]);
210
+ },
211
+ methods: {
212
+ dispatchEvent: function dispatchEvent(eventName, event, item) {
213
+ this.$emit(eventName, {
214
+ event: event,
215
+ component: this,
216
+ dataItem: item
217
+ });
218
+ },
219
+ setSelected: function setSelected(item) {
220
+ if (this.$props.selectedField) {
221
+ return item[this.$props.selectedField] ? true : false;
222
+ }
223
+ },
224
+ handleKeyDown: function handleKeyDown(event) {
225
+ this.$emit('keydown', {
226
+ event: event,
227
+ component: this
228
+ });
229
+ },
230
+ handleContainerDrop: function handleContainerDrop(event) {
231
+ var targetElement = event.target;
232
+ var isTargetContainer = targetElement.classList.contains('k-list-scroller');
233
+ var items = this.$props.dataItems;
234
+ if (isTargetContainer) {
235
+ this.$emit('drop', {
236
+ event: event,
237
+ component: this,
238
+ dataItem: items.length > 0 ? items[items.length - 1] : null
239
+ });
240
+ }
241
+ },
242
+ handleOnDragLeave: function handleOnDragLeave(event) {
243
+ if (this.$props.onDragLeave && event.target.classList.contains('k-list-scroller')) {
244
+ this.$emit('dragleave', {
245
+ event: event,
246
+ component: this
247
+ });
248
+ }
249
+ }
250
+ }
251
+ };
252
+ var ListBox = ListBoxVue2;
253
+ export { ListBox, ListBoxVue2 };
@@ -0,0 +1,40 @@
1
+ import { DefineComponent } from './additionalTypes';
2
+ import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
3
+ declare type DefaultData<V> = object | ((this: V) => {});
4
+ declare type DefaultMethods<V> = {
5
+ [key: string]: (this: V, ...args: any[]) => any;
6
+ };
7
+ import { ListBoxToolbarProps } from './interfaces/ListBoxToolBarProps';
8
+ /**
9
+ * @hidden
10
+ */
11
+ export interface ListBoxToolbarState {
12
+ }
13
+ /**
14
+ * @hidden
15
+ */
16
+ export interface ListBoxToolbarComputed {
17
+ [key: string]: any;
18
+ }
19
+ /**
20
+ * @hidden
21
+ */
22
+ export interface ListBoxToolbarMethods {
23
+ [key: string]: any;
24
+ }
25
+ /**
26
+ * @hidden
27
+ */
28
+ export interface ListBoxToolbarData {
29
+ }
30
+ /**
31
+ * @hidden
32
+ */
33
+ export interface ListBoxToolbarAll extends Vue, ListBoxToolbarMethods, ListBoxToolbarData, ListBoxToolbarComputed, ListBoxToolbarState {
34
+ }
35
+ /**
36
+ * @hidden
37
+ */
38
+ declare let ListBoxToolbarVue2: ComponentOptions<ListBoxToolbarAll, DefaultData<ListBoxToolbarData>, DefaultMethods<ListBoxToolbarAll>, ListBoxToolbarComputed, RecordPropsDefinition<ListBoxToolbarProps>>;
39
+ declare const ListBoxToolbar: DefineComponent<ListBoxToolbarProps, any, ListBoxToolbarData, ListBoxToolbarComputed, ListBoxToolbarMethods, {}, {}, {}, string, ListBoxToolbarProps, ListBoxToolbarProps, {}>;
40
+ export { ListBoxToolbar, ListBoxToolbarVue2 };