@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.
- package/LICENSE.md +11 -0
- package/NOTICE.txt +86 -0
- package/README.md +52 -0
- package/dist/cdn/js/kendo-vue-listbox.js +1 -0
- package/dist/es/ListBox.d.ts +40 -0
- package/dist/es/ListBox.js +253 -0
- package/dist/es/ListBoxToolbar.d.ts +40 -0
- package/dist/es/ListBoxToolbar.js +166 -0
- package/dist/es/additionalTypes.ts +21 -0
- package/dist/es/interfaces/Enums.d.ts +7 -0
- package/dist/es/interfaces/Enums.js +8 -0
- package/dist/es/interfaces/ListBoxEvents.d.ts +13 -0
- package/dist/es/interfaces/ListBoxEvents.js +1 -0
- package/dist/es/interfaces/ListBoxProps.d.ts +93 -0
- package/dist/es/interfaces/ListBoxProps.js +2 -0
- package/dist/es/interfaces/ListBoxToolBarProps.d.ts +32 -0
- package/dist/es/interfaces/ListBoxToolBarProps.js +1 -0
- package/dist/es/main.d.ts +7 -0
- package/dist/es/main.js +4 -0
- package/dist/es/messages/main.d.ts +40 -0
- package/dist/es/messages/main.js +41 -0
- package/dist/es/package-metadata.d.ts +5 -0
- package/dist/es/package-metadata.js +11 -0
- package/dist/es/utils.d.ts +31 -0
- package/dist/es/utils.js +195 -0
- package/dist/esm/ListBox.d.ts +40 -0
- package/dist/esm/ListBox.js +253 -0
- package/dist/esm/ListBoxToolbar.d.ts +40 -0
- package/dist/esm/ListBoxToolbar.js +166 -0
- package/dist/esm/additionalTypes.ts +21 -0
- package/dist/esm/interfaces/Enums.d.ts +7 -0
- package/dist/esm/interfaces/Enums.js +8 -0
- package/dist/esm/interfaces/ListBoxEvents.d.ts +13 -0
- package/dist/esm/interfaces/ListBoxEvents.js +1 -0
- package/dist/esm/interfaces/ListBoxProps.d.ts +93 -0
- package/dist/esm/interfaces/ListBoxProps.js +2 -0
- package/dist/esm/interfaces/ListBoxToolBarProps.d.ts +32 -0
- package/dist/esm/interfaces/ListBoxToolBarProps.js +1 -0
- package/dist/esm/main.d.ts +7 -0
- package/dist/esm/main.js +4 -0
- package/dist/esm/messages/main.d.ts +40 -0
- package/dist/esm/messages/main.js +41 -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/utils.d.ts +31 -0
- package/dist/esm/utils.js +195 -0
- package/dist/npm/ListBox.d.ts +40 -0
- package/dist/npm/ListBox.js +260 -0
- package/dist/npm/ListBoxToolbar.d.ts +40 -0
- package/dist/npm/ListBoxToolbar.js +173 -0
- package/dist/npm/additionalTypes.ts +21 -0
- package/dist/npm/interfaces/Enums.d.ts +7 -0
- package/dist/npm/interfaces/Enums.js +14 -0
- package/dist/npm/interfaces/ListBoxEvents.d.ts +13 -0
- package/dist/npm/interfaces/ListBoxEvents.js +5 -0
- package/dist/npm/interfaces/ListBoxProps.d.ts +93 -0
- package/dist/npm/interfaces/ListBoxProps.js +3 -0
- package/dist/npm/interfaces/ListBoxToolBarProps.d.ts +32 -0
- package/dist/npm/interfaces/ListBoxToolBarProps.js +5 -0
- package/dist/npm/main.d.ts +7 -0
- package/dist/npm/main.js +11 -0
- package/dist/npm/messages/main.d.ts +40 -0
- package/dist/npm/messages/main.js +44 -0
- package/dist/npm/package-metadata.d.ts +5 -0
- package/dist/npm/package-metadata.js +14 -0
- package/dist/npm/utils.d.ts +31 -0
- package/dist/npm/utils.js +204 -0
- package/package.json +57 -0
|
@@ -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,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ListBoxVue2 = exports.ListBox = void 0;
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
var Vue = require("vue");
|
|
9
|
+
var allVue = Vue;
|
|
10
|
+
var gh = allVue.h;
|
|
11
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
12
|
+
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
13
|
+
var Enums_1 = require("./interfaces/Enums");
|
|
14
|
+
var package_metadata_1 = require("./package-metadata");
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
var ListBoxVue2 = {
|
|
19
|
+
name: 'KendoListBox',
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
emits: {
|
|
22
|
+
dragstart: null,
|
|
23
|
+
itemclick: null,
|
|
24
|
+
drop: null,
|
|
25
|
+
dragover: null,
|
|
26
|
+
keydown: null,
|
|
27
|
+
dragleave: null
|
|
28
|
+
},
|
|
29
|
+
props: {
|
|
30
|
+
size: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'medium',
|
|
33
|
+
validator: function validator(value) {
|
|
34
|
+
return [null, 'small', 'medium', 'large'].includes(value);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
toolbarPosition: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: Enums_1.toolbarPosition.RIGHT,
|
|
40
|
+
validator: function validator(value) {
|
|
41
|
+
return ['none', 'top', 'bottom', 'left', 'right'].includes(value);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
textField: String,
|
|
45
|
+
valueField: String,
|
|
46
|
+
keyField: String,
|
|
47
|
+
selectedField: String,
|
|
48
|
+
item: [String, Object, Function],
|
|
49
|
+
toolbar: [String, Object, Function],
|
|
50
|
+
tabIndex: Number,
|
|
51
|
+
dataItems: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default: function _default() {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
draggable: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
created: function created() {
|
|
63
|
+
(0, kendo_vue_common_1.validatePackage)(package_metadata_1.packageMetadata);
|
|
64
|
+
},
|
|
65
|
+
computed: {
|
|
66
|
+
wrapperClass: function wrapperClass() {
|
|
67
|
+
var _a;
|
|
68
|
+
var nonePosition = this.$props.toolbarPosition === Enums_1.toolbarPosition.NONE || this.$props.toolbar === undefined;
|
|
69
|
+
return _a = {
|
|
70
|
+
'k-listbox': true
|
|
71
|
+
}, _a["k-listbox-toolbar-".concat(this.$props.toolbarPosition)] = !nonePosition, _a;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
setup: !isV3 ? undefined : function () {
|
|
76
|
+
var v3 = !!isV3;
|
|
77
|
+
return {
|
|
78
|
+
v3: v3
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
render: function render(createElement) {
|
|
83
|
+
var _a;
|
|
84
|
+
var h = gh || createElement;
|
|
85
|
+
var toolbarTemplate = kendo_vue_common_1.templateRendering.call(this, this.$props.toolbar, kendo_vue_common_1.getListeners.call(this));
|
|
86
|
+
var toolbarRender = kendo_vue_common_1.getTemplate.call(this, {
|
|
87
|
+
h: h,
|
|
88
|
+
template: toolbarTemplate
|
|
89
|
+
});
|
|
90
|
+
return h("div", {
|
|
91
|
+
"class": this.wrapperClass,
|
|
92
|
+
unselectable: "on",
|
|
93
|
+
attrs: this.v3 ? undefined : {
|
|
94
|
+
unselectable: "on"
|
|
95
|
+
}
|
|
96
|
+
}, [this.$props.toolbarPosition !== 'bottom' && toolbarRender, h("div", {
|
|
97
|
+
"class": 'k-list-scroller k-selectable',
|
|
98
|
+
"data-role": 'selectable',
|
|
99
|
+
attrs: this.v3 ? undefined : {
|
|
100
|
+
"data-role": 'selectable'
|
|
101
|
+
},
|
|
102
|
+
onDragover: function onDragover(e) {
|
|
103
|
+
return e.preventDefault();
|
|
104
|
+
},
|
|
105
|
+
on: this.v3 ? undefined : {
|
|
106
|
+
"dragover": function onDragover(e) {
|
|
107
|
+
return e.preventDefault();
|
|
108
|
+
},
|
|
109
|
+
"drop": this.handleContainerDrop,
|
|
110
|
+
"dragleave": this.handleOnDragLeave
|
|
111
|
+
},
|
|
112
|
+
onDrop: this.handleContainerDrop,
|
|
113
|
+
onDragleave: this.handleOnDragLeave
|
|
114
|
+
}, [h("div", {
|
|
115
|
+
"class": (0, kendo_vue_common_1.classNames)('k-list', (_a = {}, _a["k-list-".concat(kendo_vue_common_1.kendoThemeMaps.sizeMap[this.$props.size] || this.$props.size)] = this.$props.size, _a))
|
|
116
|
+
}, [h("div", {
|
|
117
|
+
"class": 'k-list-content'
|
|
118
|
+
}, [h("ul", {
|
|
119
|
+
"class": 'k-list-ul',
|
|
120
|
+
role: 'listbox',
|
|
121
|
+
attrs: this.v3 ? undefined : {
|
|
122
|
+
role: 'listbox',
|
|
123
|
+
"aria-label": 'listbox-container',
|
|
124
|
+
tabIndex: this.tabIndex
|
|
125
|
+
},
|
|
126
|
+
"aria-label": 'listbox-container',
|
|
127
|
+
tabIndex: this.tabIndex,
|
|
128
|
+
onKeydown: this.handleKeyDown,
|
|
129
|
+
on: this.v3 ? undefined : {
|
|
130
|
+
"keydown": this.handleKeyDown
|
|
131
|
+
}
|
|
132
|
+
}, [this.$props.dataItems.map(function (item, index) {
|
|
133
|
+
var _this = this;
|
|
134
|
+
var selectedValue = this.setSelected(item);
|
|
135
|
+
var itemGuid = (0, kendo_vue_common_1.guid)();
|
|
136
|
+
var defaultRendering = h("span", {
|
|
137
|
+
"class": 'k-list-item-text'
|
|
138
|
+
}, [this.$props.textField ? item[this.$props.textField] : item.toString()]);
|
|
139
|
+
var itemTemplate = kendo_vue_common_1.templateRendering.call(this, this.$props.item, kendo_vue_common_1.getListeners.call(this));
|
|
140
|
+
var itemRender = kendo_vue_common_1.getTemplate.call(this, {
|
|
141
|
+
h: h,
|
|
142
|
+
template: itemTemplate,
|
|
143
|
+
defaultRendering: defaultRendering,
|
|
144
|
+
additionalProps: {
|
|
145
|
+
dataItem: item,
|
|
146
|
+
index: index
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return h("li", {
|
|
150
|
+
"class": (0, kendo_vue_common_1.classNames)('k-list-item', {
|
|
151
|
+
'k-selected': selectedValue
|
|
152
|
+
}, item.class),
|
|
153
|
+
style: item.style,
|
|
154
|
+
role: 'option',
|
|
155
|
+
attrs: this.v3 ? undefined : {
|
|
156
|
+
role: 'option',
|
|
157
|
+
"aria-selected": selectedValue,
|
|
158
|
+
id: itemGuid + index,
|
|
159
|
+
"data-uid": itemGuid + index,
|
|
160
|
+
draggable: this.$props.draggable
|
|
161
|
+
},
|
|
162
|
+
"aria-selected": selectedValue,
|
|
163
|
+
key: this.$props.keyField ? item[this.$props.keyField] : index,
|
|
164
|
+
id: itemGuid + index,
|
|
165
|
+
"data-uid": itemGuid + index,
|
|
166
|
+
draggable: this.$props.draggable,
|
|
167
|
+
onDragstart: function onDragstart(event) {
|
|
168
|
+
return _this.dispatchEvent('dragstart', event, item);
|
|
169
|
+
},
|
|
170
|
+
on: this.v3 ? undefined : {
|
|
171
|
+
"dragstart": function onDragstart(event) {
|
|
172
|
+
return _this.dispatchEvent('dragstart', event, item);
|
|
173
|
+
},
|
|
174
|
+
"dragOver": function dragOver(event) {
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
_this.dispatchEvent('dragover', event, item);
|
|
177
|
+
},
|
|
178
|
+
"drop": function drop(event) {
|
|
179
|
+
return _this.dispatchEvent('drop', event, item);
|
|
180
|
+
},
|
|
181
|
+
"click": function click(event) {
|
|
182
|
+
return _this.dispatchEvent('itemclick', event, item);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
onDragOver: function dragOver(event) {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
_this.dispatchEvent('dragover', event, item);
|
|
188
|
+
},
|
|
189
|
+
onDrop: function drop(event) {
|
|
190
|
+
return _this.dispatchEvent('drop', event, item);
|
|
191
|
+
},
|
|
192
|
+
onClick: function click(event) {
|
|
193
|
+
return _this.dispatchEvent('itemclick', event, item);
|
|
194
|
+
}
|
|
195
|
+
}, [itemRender]);
|
|
196
|
+
}, this)])])])]), this.$props.toolbarPosition === 'bottom' && toolbarRender, h("select", {
|
|
197
|
+
style: {
|
|
198
|
+
display: 'none'
|
|
199
|
+
},
|
|
200
|
+
multiple: true,
|
|
201
|
+
attrs: this.v3 ? undefined : {
|
|
202
|
+
multiple: true,
|
|
203
|
+
"data-role": "listbox"
|
|
204
|
+
},
|
|
205
|
+
"data-role": "listbox"
|
|
206
|
+
}, [this.$props.dataItems.map(function (item, index) {
|
|
207
|
+
var value = item[this.$props.valueField || this.$props.textField];
|
|
208
|
+
return h("option", {
|
|
209
|
+
key: index,
|
|
210
|
+
value: this.v3 ? value : null,
|
|
211
|
+
domProps: this.v3 ? undefined : {
|
|
212
|
+
"value": value
|
|
213
|
+
}
|
|
214
|
+
}, [value]);
|
|
215
|
+
}, this)])]);
|
|
216
|
+
},
|
|
217
|
+
methods: {
|
|
218
|
+
dispatchEvent: function dispatchEvent(eventName, event, item) {
|
|
219
|
+
this.$emit(eventName, {
|
|
220
|
+
event: event,
|
|
221
|
+
component: this,
|
|
222
|
+
dataItem: item
|
|
223
|
+
});
|
|
224
|
+
},
|
|
225
|
+
setSelected: function setSelected(item) {
|
|
226
|
+
if (this.$props.selectedField) {
|
|
227
|
+
return item[this.$props.selectedField] ? true : false;
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
handleKeyDown: function handleKeyDown(event) {
|
|
231
|
+
this.$emit('keydown', {
|
|
232
|
+
event: event,
|
|
233
|
+
component: this
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
handleContainerDrop: function handleContainerDrop(event) {
|
|
237
|
+
var targetElement = event.target;
|
|
238
|
+
var isTargetContainer = targetElement.classList.contains('k-list-scroller');
|
|
239
|
+
var items = this.$props.dataItems;
|
|
240
|
+
if (isTargetContainer) {
|
|
241
|
+
this.$emit('drop', {
|
|
242
|
+
event: event,
|
|
243
|
+
component: this,
|
|
244
|
+
dataItem: items.length > 0 ? items[items.length - 1] : null
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
handleOnDragLeave: function handleOnDragLeave(event) {
|
|
249
|
+
if (this.$props.onDragLeave && event.target.classList.contains('k-list-scroller')) {
|
|
250
|
+
this.$emit('dragleave', {
|
|
251
|
+
event: event,
|
|
252
|
+
component: this
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
exports.ListBoxVue2 = ListBoxVue2;
|
|
259
|
+
var ListBox = ListBoxVue2;
|
|
260
|
+
exports.ListBox = ListBox;
|
|
@@ -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 };
|