@progress/kendo-react-listbox 5.4.0-dev.202205200719 → 5.4.0-dev.202206061009
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-react-listbox.js +1 -1
- package/dist/es/ListBox.d.ts +1 -1
- package/dist/es/ListBox.js +6 -4
- package/dist/es/ListBoxToolbar.d.ts +2 -2
- package/dist/es/ListBoxToolbar.js +4 -2
- package/dist/es/interfaces/ListBoxEvents.js +1 -0
- package/dist/es/interfaces/ListBoxProps.js +1 -0
- package/dist/es/interfaces/ListBoxToolBarProps.js +1 -0
- package/dist/es/messages/index.d.ts +7 -7
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/utils.d.ts +3 -3
- package/dist/es/utils.js +15 -6
- package/dist/npm/ListBox.d.ts +1 -1
- package/dist/npm/ListBox.js +20 -17
- package/dist/npm/ListBoxToolbar.d.ts +2 -2
- package/dist/npm/ListBoxToolbar.js +9 -6
- package/dist/npm/interfaces/Enums.js +1 -0
- package/dist/npm/main.js +6 -5
- package/dist/npm/messages/index.d.ts +7 -7
- package/dist/npm/messages/index.js +2 -1
- package/dist/npm/package-metadata.js +2 -1
- package/dist/npm/utils.d.ts +3 -3
- package/dist/npm/utils.js +28 -15
- package/dist/systemjs/kendo-react-listbox.js +1 -1
- package/package.json +5 -5
package/dist/es/ListBox.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class ListBox extends React.PureComponent<ListBoxProps, {}> {
|
|
|
7
7
|
* @hidden
|
|
8
8
|
*/
|
|
9
9
|
static propTypes: {
|
|
10
|
-
size: PropTypes.Requireable<string>;
|
|
10
|
+
size: PropTypes.Requireable<string | null>;
|
|
11
11
|
toolbarPosition: PropTypes.Requireable<string>;
|
|
12
12
|
textField: PropTypes.Requireable<string>;
|
|
13
13
|
valueField: PropTypes.Requireable<string>;
|
package/dist/es/ListBox.js
CHANGED
|
@@ -2,10 +2,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
2
2
|
var extendStatics = function (d, b) {
|
|
3
3
|
extendStatics = Object.setPrototypeOf ||
|
|
4
4
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
6
|
return extendStatics(d, b);
|
|
7
7
|
};
|
|
8
8
|
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
9
11
|
extendStatics(d, b);
|
|
10
12
|
function __() { this.constructor = d; }
|
|
11
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -59,7 +61,7 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
59
61
|
if (_this.props.toolbarPosition === toolbarPosition.NONE || _this.props.toolbar === undefined) {
|
|
60
62
|
return '';
|
|
61
63
|
}
|
|
62
|
-
return "k-listbox-toolbar-"
|
|
64
|
+
return "k-listbox-toolbar-".concat(_this.props.toolbarPosition);
|
|
63
65
|
};
|
|
64
66
|
_this.handleOnDragLeave = function (event) {
|
|
65
67
|
if (_this.props.onDragLeave && event.target.classList.contains('k-list-scroller')) {
|
|
@@ -73,13 +75,13 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
73
75
|
* @hidden
|
|
74
76
|
*/
|
|
75
77
|
ListBox.prototype.render = function () {
|
|
76
|
-
var _this = this;
|
|
77
78
|
var _a;
|
|
79
|
+
var _this = this;
|
|
78
80
|
return (React.createElement("div", { className: classNames(this.props.className, 'k-listbox', this.setToolbarPosition()), style: this.props.style, unselectable: "on" },
|
|
79
81
|
this.props.toolbar && this.props.toolbarPosition !== 'bottom' && React.createElement(this.props.toolbar, null),
|
|
80
82
|
React.createElement("div", { className: 'k-list-scroller k-selectable', "data-role": 'selectable', onDragOver: function (e) { return e.preventDefault(); }, onDrop: this.handleContainerDrop, onDragLeave: this.handleOnDragLeave },
|
|
81
83
|
React.createElement("div", { className: classNames('k-list', (_a = {},
|
|
82
|
-
_a["k-list-"
|
|
84
|
+
_a["k-list-".concat(kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
|
|
83
85
|
_a)) },
|
|
84
86
|
React.createElement("div", { className: 'k-list-content' },
|
|
85
87
|
React.createElement("ul", { className: 'k-list-ul', role: 'listbox', tabIndex: 0, onKeyDown: this.handleKeyDown }, this.props.data.map(function (item, index) {
|
|
@@ -2,10 +2,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
2
2
|
var extendStatics = function (d, b) {
|
|
3
3
|
extendStatics = Object.setPrototypeOf ||
|
|
4
4
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
6
|
return extendStatics(d, b);
|
|
7
7
|
};
|
|
8
8
|
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
9
11
|
extendStatics(d, b);
|
|
10
12
|
function __() { this.constructor = d; }
|
|
11
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -102,7 +104,7 @@ var ListBoxToolbar = /** @class */ (function (_super) {
|
|
|
102
104
|
var indexOfTool = tools.findIndex(function (x) { return x.name === tool; });
|
|
103
105
|
var currentTool = tools[indexOfTool];
|
|
104
106
|
var isDisabled = _this.isItemDisabled(currentTool.name);
|
|
105
|
-
var toolKey = "listbox."
|
|
107
|
+
var toolKey = "listbox.".concat(currentTool.name);
|
|
106
108
|
return (React.createElement("li", { key: index },
|
|
107
109
|
React.createElement(Button, { disabled: isDisabled, "data-command": currentTool.name, title: localizationService.toLanguageString(toolKey, messages[toolKey]), "aria-label": localizationService.toLanguageString(toolKey, messages[toolKey]), iconClass: currentTool.iconClassName, onClick: function (e) {
|
|
108
110
|
e.preventDefault();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -30,11 +30,11 @@ export declare const remove = "listbox.remove";
|
|
|
30
30
|
* @hidden
|
|
31
31
|
*/
|
|
32
32
|
export declare const messages: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
40
|
};
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-listbox',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1654509613,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
11
|
};
|
package/dist/es/utils.d.ts
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* @param {string} selectedField - The field that contains the selected information in the data object.
|
|
8
8
|
* @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
|
|
9
9
|
*/
|
|
10
|
-
export declare const processListBoxData: (listBoxOneData: any[], listBoxTwoData: any[], toolName: string, selectedField: string) => {
|
|
10
|
+
export declare const processListBoxData: (listBoxOneData: any[] | undefined, listBoxTwoData: any[] | undefined, toolName: string, selectedField: string) => {
|
|
11
11
|
listBoxOneData: any[];
|
|
12
12
|
listBoxTwoData: any[];
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* @hidden
|
|
16
16
|
*/
|
|
17
|
-
export declare const moveItem: (from: number, to: number, data: any
|
|
17
|
+
export declare const moveItem: (from: number, to: number, data: Array<any>) => any[];
|
|
18
18
|
/**
|
|
19
19
|
* Process the data collection/s based on the dragged and drop item.
|
|
20
20
|
*
|
|
@@ -25,7 +25,7 @@ export declare const moveItem: (from: number, to: number, data: any[]) => any[];
|
|
|
25
25
|
* @param {string} valueField - The field which points to the unique value of each data item.
|
|
26
26
|
* @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
|
|
27
27
|
*/
|
|
28
|
-
export declare const processListBoxDragAndDrop: (listBoxOneData: any[], listBoxTwoData: any[], dragItem: any, dropItem: any, valueField: string) => {
|
|
28
|
+
export declare const processListBoxDragAndDrop: (listBoxOneData: any[] | undefined, listBoxTwoData: any[] | undefined, dragItem: any, dropItem: any, valueField: string) => {
|
|
29
29
|
listBoxOneData: any[];
|
|
30
30
|
listBoxTwoData: any[];
|
|
31
31
|
};
|
package/dist/es/utils.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
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
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
* Process the data collection/s based on the clicked ListBoxToolbar tool.
|
|
3
12
|
*
|
|
@@ -20,13 +29,13 @@ export var processListBoxData = function (listBoxOneData, listBoxTwoData, toolNa
|
|
|
20
29
|
};
|
|
21
30
|
switch (toolName) {
|
|
22
31
|
case 'moveUp':
|
|
23
|
-
newFirstData = listBoxOneData
|
|
32
|
+
newFirstData = __spreadArray([], listBoxOneData, true);
|
|
24
33
|
newFirstData.forEach(function (item, index) {
|
|
25
34
|
if (item[selectedField]) {
|
|
26
35
|
newFirstData = moveItem(index, index - 1, newFirstData);
|
|
27
36
|
}
|
|
28
37
|
});
|
|
29
|
-
newSecondData = listBoxTwoData
|
|
38
|
+
newSecondData = __spreadArray([], listBoxTwoData, true);
|
|
30
39
|
newSecondData.forEach(function (item, index) {
|
|
31
40
|
if (item[selectedField]) {
|
|
32
41
|
newSecondData = moveItem(index, index - 1, newSecondData);
|
|
@@ -48,8 +57,8 @@ export var processListBoxData = function (listBoxOneData, listBoxTwoData, toolNa
|
|
|
48
57
|
newSecondData = moveItem(index, index - 1, newSecondData);
|
|
49
58
|
}
|
|
50
59
|
});
|
|
51
|
-
result.listBoxOneData = newFirstData
|
|
52
|
-
result.listBoxTwoData = newSecondData
|
|
60
|
+
result.listBoxOneData = __spreadArray([], newFirstData, true).reverse();
|
|
61
|
+
result.listBoxTwoData = __spreadArray([], newSecondData, true).reverse();
|
|
53
62
|
break;
|
|
54
63
|
case 'transferTo':
|
|
55
64
|
newFirstData = listBoxOneData.filter(function (item) { return !item[selectedField]; });
|
|
@@ -113,8 +122,8 @@ export var processListBoxDragAndDrop = function (listBoxOneData, listBoxTwoData,
|
|
|
113
122
|
var isDragItemInSecondList = dragItemIndexInSecondList >= 0 ? true : false;
|
|
114
123
|
var isDropItemInFirstList = dropItemIndexInFirstList >= 0 ? true : false;
|
|
115
124
|
var isDropItemInSecondList = dropItemIndexInSecondList >= 0 ? true : false;
|
|
116
|
-
var firstDataSet = listBoxOneData
|
|
117
|
-
var secondDataSet = listBoxTwoData
|
|
125
|
+
var firstDataSet = __spreadArray([], listBoxOneData, true);
|
|
126
|
+
var secondDataSet = __spreadArray([], listBoxTwoData, true);
|
|
118
127
|
if (isDragItemInFirstList && isDropItemInFirstList) {
|
|
119
128
|
return {
|
|
120
129
|
listBoxOneData: moveItem(dragItemIndexInFirstList, dropItemIndexInFirstList, listBoxOneData),
|
package/dist/npm/ListBox.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class ListBox extends React.PureComponent<ListBoxProps, {}> {
|
|
|
7
7
|
* @hidden
|
|
8
8
|
*/
|
|
9
9
|
static propTypes: {
|
|
10
|
-
size: PropTypes.Requireable<string>;
|
|
10
|
+
size: PropTypes.Requireable<string | null>;
|
|
11
11
|
toolbarPosition: PropTypes.Requireable<string>;
|
|
12
12
|
textField: PropTypes.Requireable<string>;
|
|
13
13
|
valueField: PropTypes.Requireable<string>;
|
package/dist/npm/ListBox.js
CHANGED
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -24,6 +26,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
24
26
|
return __assign.apply(this, arguments);
|
|
25
27
|
};
|
|
26
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ListBox = void 0;
|
|
27
30
|
var React = require("react");
|
|
28
31
|
var PropTypes = require("prop-types");
|
|
29
32
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
@@ -44,7 +47,7 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
44
47
|
};
|
|
45
48
|
_this.handleKeyDown = function (event) {
|
|
46
49
|
if (_this.props.onKeyDown) {
|
|
47
|
-
kendo_react_common_1.dispatchEvent(_this.props.onKeyDown, event, _this, undefined);
|
|
50
|
+
(0, kendo_react_common_1.dispatchEvent)(_this.props.onKeyDown, event, _this, undefined);
|
|
48
51
|
}
|
|
49
52
|
;
|
|
50
53
|
};
|
|
@@ -53,42 +56,42 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
53
56
|
var isTargetContainer = targetElement.classList.contains('k-list-scroller');
|
|
54
57
|
if (isTargetContainer) {
|
|
55
58
|
_this.props.data.length > 0 ?
|
|
56
|
-
kendo_react_common_1.dispatchEvent(_this.props.onDrop, event, _this, { dataItem: _this.props.data[_this.props.data.length - 1] }) :
|
|
57
|
-
kendo_react_common_1.dispatchEvent(_this.props.onDrop, event, _this, { dataItem: null });
|
|
59
|
+
(0, kendo_react_common_1.dispatchEvent)(_this.props.onDrop, event, _this, { dataItem: _this.props.data[_this.props.data.length - 1] }) :
|
|
60
|
+
(0, kendo_react_common_1.dispatchEvent)(_this.props.onDrop, event, _this, { dataItem: null });
|
|
58
61
|
}
|
|
59
62
|
};
|
|
60
63
|
_this.setToolbarPosition = function () {
|
|
61
64
|
if (_this.props.toolbarPosition === Enums_1.toolbarPosition.NONE || _this.props.toolbar === undefined) {
|
|
62
65
|
return '';
|
|
63
66
|
}
|
|
64
|
-
return "k-listbox-toolbar-"
|
|
67
|
+
return "k-listbox-toolbar-".concat(_this.props.toolbarPosition);
|
|
65
68
|
};
|
|
66
69
|
_this.handleOnDragLeave = function (event) {
|
|
67
70
|
if (_this.props.onDragLeave && event.target.classList.contains('k-list-scroller')) {
|
|
68
|
-
kendo_react_common_1.dispatchEvent(_this.props.onDragLeave, event, _this, undefined);
|
|
71
|
+
(0, kendo_react_common_1.dispatchEvent)(_this.props.onDragLeave, event, _this, undefined);
|
|
69
72
|
}
|
|
70
73
|
};
|
|
71
|
-
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
74
|
+
(0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
|
|
72
75
|
return _this;
|
|
73
76
|
}
|
|
74
77
|
/**
|
|
75
78
|
* @hidden
|
|
76
79
|
*/
|
|
77
80
|
ListBox.prototype.render = function () {
|
|
78
|
-
var _this = this;
|
|
79
81
|
var _a;
|
|
80
|
-
|
|
82
|
+
var _this = this;
|
|
83
|
+
return (React.createElement("div", { className: (0, kendo_react_common_1.classNames)(this.props.className, 'k-listbox', this.setToolbarPosition()), style: this.props.style, unselectable: "on" },
|
|
81
84
|
this.props.toolbar && this.props.toolbarPosition !== 'bottom' && React.createElement(this.props.toolbar, null),
|
|
82
85
|
React.createElement("div", { className: 'k-list-scroller k-selectable', "data-role": 'selectable', onDragOver: function (e) { return e.preventDefault(); }, onDrop: this.handleContainerDrop, onDragLeave: this.handleOnDragLeave },
|
|
83
|
-
React.createElement("div", { className: kendo_react_common_1.classNames('k-list', (_a = {},
|
|
84
|
-
_a["k-list-"
|
|
86
|
+
React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-list', (_a = {},
|
|
87
|
+
_a["k-list-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[this.props.size] || this.props.size)] = this.props.size,
|
|
85
88
|
_a)) },
|
|
86
89
|
React.createElement("div", { className: 'k-list-content' },
|
|
87
90
|
React.createElement("ul", { className: 'k-list-ul', role: 'listbox', tabIndex: 0, onKeyDown: this.handleKeyDown }, this.props.data.map(function (item, index) {
|
|
88
91
|
var selectedValue = _this.setSelected(item);
|
|
89
|
-
var itemGuid = kendo_react_common_1.guid();
|
|
92
|
+
var itemGuid = (0, kendo_react_common_1.guid)();
|
|
90
93
|
var itemOptions = {
|
|
91
|
-
className: kendo_react_common_1.classNames('k-list-item', {
|
|
94
|
+
className: (0, kendo_react_common_1.classNames)('k-list-item', {
|
|
92
95
|
'k-selected': selectedValue
|
|
93
96
|
}),
|
|
94
97
|
role: 'option',
|
|
@@ -97,13 +100,13 @@ var ListBox = /** @class */ (function (_super) {
|
|
|
97
100
|
id: itemGuid + index,
|
|
98
101
|
'data-uid': itemGuid + index,
|
|
99
102
|
draggable: _this.props.draggable,
|
|
100
|
-
onDragStart: function (event) { return kendo_react_common_1.dispatchEvent(_this.props.onDragStart, event, _this, { dataItem: item }); },
|
|
103
|
+
onDragStart: function (event) { return (0, kendo_react_common_1.dispatchEvent)(_this.props.onDragStart, event, _this, { dataItem: item }); },
|
|
101
104
|
onDragOver: function (event) {
|
|
102
105
|
event.preventDefault();
|
|
103
|
-
kendo_react_common_1.dispatchEvent(_this.props.onDragOver, event, _this, { dataItem: item });
|
|
106
|
+
(0, kendo_react_common_1.dispatchEvent)(_this.props.onDragOver, event, _this, { dataItem: item });
|
|
104
107
|
},
|
|
105
|
-
onDrop: function (event) { return kendo_react_common_1.dispatchEvent(_this.props.onDrop, event, _this, { dataItem: item }); },
|
|
106
|
-
onClick: function (event) { return kendo_react_common_1.dispatchEvent(_this.props.onItemClick, event, _this, { dataItem: item }); }
|
|
108
|
+
onDrop: function (event) { return (0, kendo_react_common_1.dispatchEvent)(_this.props.onDrop, event, _this, { dataItem: item }); },
|
|
109
|
+
onClick: function (event) { return (0, kendo_react_common_1.dispatchEvent)(_this.props.onItemClick, event, _this, { dataItem: item }); }
|
|
107
110
|
};
|
|
108
111
|
return (_this.props.item
|
|
109
112
|
? React.createElement(_this.props.item, __assign({ selected: selectedValue, dataItem: item }, itemOptions),
|
|
@@ -3,16 +3,19 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
15
|
};
|
|
14
16
|
})();
|
|
15
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ListBoxToolbar = void 0;
|
|
16
19
|
var React = require("react");
|
|
17
20
|
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
18
21
|
var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
@@ -33,7 +36,7 @@ var ListBoxToolbar = /** @class */ (function (_super) {
|
|
|
33
36
|
function ListBoxToolbar() {
|
|
34
37
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
35
38
|
_this.handleToolClick = function (event, name) {
|
|
36
|
-
kendo_react_common_1.dispatchEvent(_this.props.onToolClick, event, _this, { toolName: name });
|
|
39
|
+
(0, kendo_react_common_1.dispatchEvent)(_this.props.onToolClick, event, _this, { toolName: name });
|
|
37
40
|
};
|
|
38
41
|
_this.isItemDisabled = function (tool) {
|
|
39
42
|
var disabled = true;
|
|
@@ -98,13 +101,13 @@ var ListBoxToolbar = /** @class */ (function (_super) {
|
|
|
98
101
|
*/
|
|
99
102
|
ListBoxToolbar.prototype.render = function () {
|
|
100
103
|
var _this = this;
|
|
101
|
-
var localizationService = kendo_react_intl_1.provideLocalizationService(this);
|
|
102
|
-
return (React.createElement("div", { className: kendo_react_common_1.classNames('k-listbox-toolbar') },
|
|
104
|
+
var localizationService = (0, kendo_react_intl_1.provideLocalizationService)(this);
|
|
105
|
+
return (React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-listbox-toolbar') },
|
|
103
106
|
React.createElement("ul", { className: "k-reset" }, this.props.tools && this.props.tools.map(function (tool, index) {
|
|
104
107
|
var indexOfTool = tools.findIndex(function (x) { return x.name === tool; });
|
|
105
108
|
var currentTool = tools[indexOfTool];
|
|
106
109
|
var isDisabled = _this.isItemDisabled(currentTool.name);
|
|
107
|
-
var toolKey = "listbox."
|
|
110
|
+
var toolKey = "listbox.".concat(currentTool.name);
|
|
108
111
|
return (React.createElement("li", { key: index },
|
|
109
112
|
React.createElement(kendo_react_buttons_1.Button, { disabled: isDisabled, "data-command": currentTool.name, title: localizationService.toLanguageString(toolKey, messages_1.messages[toolKey]), "aria-label": localizationService.toLanguageString(toolKey, messages_1.messages[toolKey]), iconClass: currentTool.iconClassName, onClick: function (e) {
|
|
110
113
|
e.preventDefault();
|
|
@@ -132,4 +135,4 @@ var ListBoxToolbar = /** @class */ (function (_super) {
|
|
|
132
135
|
return ListBoxToolbar;
|
|
133
136
|
}(React.PureComponent));
|
|
134
137
|
exports.ListBoxToolbar = ListBoxToolbar;
|
|
135
|
-
kendo_react_intl_1.registerForLocalization(ListBoxToolbar);
|
|
138
|
+
(0, kendo_react_intl_1.registerForLocalization)(ListBoxToolbar);
|
package/dist/npm/main.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processListBoxDragAndDrop = exports.moveItem = exports.processListBoxData = exports.ListBoxToolbar = exports.ListBox = void 0;
|
|
3
4
|
var ListBox_1 = require("./ListBox");
|
|
4
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "ListBox", { enumerable: true, get: function () { return ListBox_1.ListBox; } });
|
|
5
6
|
var ListBoxToolbar_1 = require("./ListBoxToolbar");
|
|
6
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "ListBoxToolbar", { enumerable: true, get: function () { return ListBoxToolbar_1.ListBoxToolbar; } });
|
|
7
8
|
var utils_1 = require("./utils");
|
|
8
|
-
exports
|
|
9
|
-
exports
|
|
10
|
-
exports
|
|
9
|
+
Object.defineProperty(exports, "processListBoxData", { enumerable: true, get: function () { return utils_1.processListBoxData; } });
|
|
10
|
+
Object.defineProperty(exports, "moveItem", { enumerable: true, get: function () { return utils_1.moveItem; } });
|
|
11
|
+
Object.defineProperty(exports, "processListBoxDragAndDrop", { enumerable: true, get: function () { return utils_1.processListBoxDragAndDrop; } });
|
|
@@ -30,11 +30,11 @@ export declare const remove = "listbox.remove";
|
|
|
30
30
|
* @hidden
|
|
31
31
|
*/
|
|
32
32
|
export declare const messages: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
40
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.messages = exports.remove = exports.transferAllFrom = exports.transferAllTo = exports.transferFrom = exports.transferTo = exports.moveDown = exports.moveUp = void 0;
|
|
4
5
|
/**
|
|
5
6
|
* @hidden
|
|
6
7
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.packageMetadata = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* @hidden
|
|
5
6
|
*/
|
|
@@ -7,7 +8,7 @@ exports.packageMetadata = {
|
|
|
7
8
|
name: '@progress/kendo-react-listbox',
|
|
8
9
|
productName: 'KendoReact',
|
|
9
10
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
10
|
-
publishDate:
|
|
11
|
+
publishDate: 1654509613,
|
|
11
12
|
version: '',
|
|
12
13
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
13
14
|
};
|
package/dist/npm/utils.d.ts
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* @param {string} selectedField - The field that contains the selected information in the data object.
|
|
8
8
|
* @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
|
|
9
9
|
*/
|
|
10
|
-
export declare const processListBoxData: (listBoxOneData: any[], listBoxTwoData: any[], toolName: string, selectedField: string) => {
|
|
10
|
+
export declare const processListBoxData: (listBoxOneData: any[] | undefined, listBoxTwoData: any[] | undefined, toolName: string, selectedField: string) => {
|
|
11
11
|
listBoxOneData: any[];
|
|
12
12
|
listBoxTwoData: any[];
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* @hidden
|
|
16
16
|
*/
|
|
17
|
-
export declare const moveItem: (from: number, to: number, data: any
|
|
17
|
+
export declare const moveItem: (from: number, to: number, data: Array<any>) => any[];
|
|
18
18
|
/**
|
|
19
19
|
* Process the data collection/s based on the dragged and drop item.
|
|
20
20
|
*
|
|
@@ -25,7 +25,7 @@ export declare const moveItem: (from: number, to: number, data: any[]) => any[];
|
|
|
25
25
|
* @param {string} valueField - The field which points to the unique value of each data item.
|
|
26
26
|
* @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
|
|
27
27
|
*/
|
|
28
|
-
export declare const processListBoxDragAndDrop: (listBoxOneData: any[], listBoxTwoData: any[], dragItem: any, dropItem: any, valueField: string) => {
|
|
28
|
+
export declare const processListBoxDragAndDrop: (listBoxOneData: any[] | undefined, listBoxTwoData: any[] | undefined, dragItem: any, dropItem: any, valueField: string) => {
|
|
29
29
|
listBoxOneData: any[];
|
|
30
30
|
listBoxTwoData: any[];
|
|
31
31
|
};
|
package/dist/npm/utils.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.processListBoxDragAndDrop = exports.moveItem = exports.processListBoxData = void 0;
|
|
3
13
|
/**
|
|
4
14
|
* Process the data collection/s based on the clicked ListBoxToolbar tool.
|
|
5
15
|
*
|
|
@@ -10,7 +20,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
20
|
* @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
|
|
11
21
|
*/
|
|
12
22
|
// tslint:disable-next-line: max-line-length
|
|
13
|
-
|
|
23
|
+
var processListBoxData = function (listBoxOneData, listBoxTwoData, toolName, selectedField) {
|
|
14
24
|
if (listBoxOneData === void 0) { listBoxOneData = []; }
|
|
15
25
|
if (listBoxTwoData === void 0) { listBoxTwoData = []; }
|
|
16
26
|
var newFirstData = [];
|
|
@@ -22,16 +32,16 @@ exports.processListBoxData = function (listBoxOneData, listBoxTwoData, toolName,
|
|
|
22
32
|
};
|
|
23
33
|
switch (toolName) {
|
|
24
34
|
case 'moveUp':
|
|
25
|
-
newFirstData = listBoxOneData
|
|
35
|
+
newFirstData = __spreadArray([], listBoxOneData, true);
|
|
26
36
|
newFirstData.forEach(function (item, index) {
|
|
27
37
|
if (item[selectedField]) {
|
|
28
|
-
newFirstData = exports.moveItem(index, index - 1, newFirstData);
|
|
38
|
+
newFirstData = (0, exports.moveItem)(index, index - 1, newFirstData);
|
|
29
39
|
}
|
|
30
40
|
});
|
|
31
|
-
newSecondData = listBoxTwoData
|
|
41
|
+
newSecondData = __spreadArray([], listBoxTwoData, true);
|
|
32
42
|
newSecondData.forEach(function (item, index) {
|
|
33
43
|
if (item[selectedField]) {
|
|
34
|
-
newSecondData = exports.moveItem(index, index - 1, newSecondData);
|
|
44
|
+
newSecondData = (0, exports.moveItem)(index, index - 1, newSecondData);
|
|
35
45
|
}
|
|
36
46
|
});
|
|
37
47
|
result.listBoxOneData = newFirstData;
|
|
@@ -41,17 +51,17 @@ exports.processListBoxData = function (listBoxOneData, listBoxTwoData, toolName,
|
|
|
41
51
|
newFirstData = listBoxOneData.reverse();
|
|
42
52
|
newFirstData.forEach(function (item, index) {
|
|
43
53
|
if (item[selectedField]) {
|
|
44
|
-
newFirstData = exports.moveItem(index, index - 1, newFirstData);
|
|
54
|
+
newFirstData = (0, exports.moveItem)(index, index - 1, newFirstData);
|
|
45
55
|
}
|
|
46
56
|
});
|
|
47
57
|
newSecondData = listBoxTwoData.reverse();
|
|
48
58
|
newSecondData.forEach(function (item, index) {
|
|
49
59
|
if (item[selectedField]) {
|
|
50
|
-
newSecondData = exports.moveItem(index, index - 1, newSecondData);
|
|
60
|
+
newSecondData = (0, exports.moveItem)(index, index - 1, newSecondData);
|
|
51
61
|
}
|
|
52
62
|
});
|
|
53
|
-
result.listBoxOneData = newFirstData
|
|
54
|
-
result.listBoxTwoData = newSecondData
|
|
63
|
+
result.listBoxOneData = __spreadArray([], newFirstData, true).reverse();
|
|
64
|
+
result.listBoxTwoData = __spreadArray([], newSecondData, true).reverse();
|
|
55
65
|
break;
|
|
56
66
|
case 'transferTo':
|
|
57
67
|
newFirstData = listBoxOneData.filter(function (item) { return !item[selectedField]; });
|
|
@@ -85,14 +95,16 @@ exports.processListBoxData = function (listBoxOneData, listBoxTwoData, toolName,
|
|
|
85
95
|
}
|
|
86
96
|
return result;
|
|
87
97
|
};
|
|
98
|
+
exports.processListBoxData = processListBoxData;
|
|
88
99
|
/**
|
|
89
100
|
* @hidden
|
|
90
101
|
*/
|
|
91
|
-
|
|
102
|
+
var moveItem = function (from, to, data) {
|
|
92
103
|
var f = data.splice(from, 1)[0];
|
|
93
104
|
data.splice(to, 0, f);
|
|
94
105
|
return data;
|
|
95
106
|
};
|
|
107
|
+
exports.moveItem = moveItem;
|
|
96
108
|
/**
|
|
97
109
|
* Process the data collection/s based on the dragged and drop item.
|
|
98
110
|
*
|
|
@@ -104,7 +116,7 @@ exports.moveItem = function (from, to, data) {
|
|
|
104
116
|
* @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
|
|
105
117
|
*/
|
|
106
118
|
// tslint:disable-next-line: max-line-length
|
|
107
|
-
|
|
119
|
+
var processListBoxDragAndDrop = function (listBoxOneData, listBoxTwoData, dragItem, dropItem, valueField) {
|
|
108
120
|
if (listBoxOneData === void 0) { listBoxOneData = []; }
|
|
109
121
|
if (listBoxTwoData === void 0) { listBoxTwoData = []; }
|
|
110
122
|
var dragItemIndexInFirstList = listBoxOneData.findIndex(function (item) { return item[valueField] === dragItem[valueField]; });
|
|
@@ -115,18 +127,18 @@ exports.processListBoxDragAndDrop = function (listBoxOneData, listBoxTwoData, dr
|
|
|
115
127
|
var isDragItemInSecondList = dragItemIndexInSecondList >= 0 ? true : false;
|
|
116
128
|
var isDropItemInFirstList = dropItemIndexInFirstList >= 0 ? true : false;
|
|
117
129
|
var isDropItemInSecondList = dropItemIndexInSecondList >= 0 ? true : false;
|
|
118
|
-
var firstDataSet = listBoxOneData
|
|
119
|
-
var secondDataSet = listBoxTwoData
|
|
130
|
+
var firstDataSet = __spreadArray([], listBoxOneData, true);
|
|
131
|
+
var secondDataSet = __spreadArray([], listBoxTwoData, true);
|
|
120
132
|
if (isDragItemInFirstList && isDropItemInFirstList) {
|
|
121
133
|
return {
|
|
122
|
-
listBoxOneData: exports.moveItem(dragItemIndexInFirstList, dropItemIndexInFirstList, listBoxOneData),
|
|
134
|
+
listBoxOneData: (0, exports.moveItem)(dragItemIndexInFirstList, dropItemIndexInFirstList, listBoxOneData),
|
|
123
135
|
listBoxTwoData: listBoxTwoData
|
|
124
136
|
};
|
|
125
137
|
}
|
|
126
138
|
if (isDragItemInSecondList && isDropItemInSecondList) {
|
|
127
139
|
return {
|
|
128
140
|
listBoxOneData: listBoxOneData,
|
|
129
|
-
listBoxTwoData: exports.moveItem(dragItemIndexInSecondList, dropItemIndexInSecondList, listBoxTwoData)
|
|
141
|
+
listBoxTwoData: (0, exports.moveItem)(dragItemIndexInSecondList, dropItemIndexInSecondList, listBoxTwoData)
|
|
130
142
|
};
|
|
131
143
|
}
|
|
132
144
|
if (isDragItemInFirstList && (isDropItemInSecondList || dropItem === null)) {
|
|
@@ -160,3 +172,4 @@ exports.processListBoxDragAndDrop = function (listBoxOneData, listBoxTwoData, dr
|
|
|
160
172
|
listBoxTwoData: listBoxTwoData
|
|
161
173
|
};
|
|
162
174
|
};
|
|
175
|
+
exports.processListBoxDragAndDrop = processListBoxDragAndDrop;
|