@progress/kendo-react-listbox 6.1.1 → 7.0.0-develop.2

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 (51) hide show
  1. package/LICENSE.md +1 -1
  2. package/{dist/es/ListBox.d.ts → ListBox.d.ts} +5 -1
  3. package/{dist/npm/ListBoxToolbar.d.ts → ListBoxToolbar.d.ts} +5 -1
  4. package/dist/cdn/js/kendo-react-listbox.js +5 -1
  5. package/index.d.ts +11 -0
  6. package/index.js +5 -0
  7. package/index.mjs +294 -0
  8. package/interfaces/Enums.d.ts +11 -0
  9. package/{dist/es/interfaces → interfaces}/ListBoxEvents.d.ts +4 -0
  10. package/{dist/es/interfaces → interfaces}/ListBoxProps.d.ts +4 -0
  11. package/{dist/es/interfaces → interfaces}/ListBoxToolBarProps.d.ts +4 -0
  12. package/{dist/es/messages → messages}/index.d.ts +4 -0
  13. package/package-metadata.d.ts +9 -0
  14. package/package.json +28 -34
  15. package/{dist/npm/utils.d.ts → utils.d.ts} +4 -0
  16. package/about.md +0 -3
  17. package/dist/es/ListBox.js +0 -141
  18. package/dist/es/ListBoxToolbar.d.ts +0 -32
  19. package/dist/es/ListBoxToolbar.js +0 -172
  20. package/dist/es/interfaces/Enums.d.ts +0 -7
  21. package/dist/es/interfaces/Enums.js +0 -8
  22. package/dist/es/interfaces/ListBoxEvents.js +0 -1
  23. package/dist/es/interfaces/ListBoxProps.js +0 -2
  24. package/dist/es/interfaces/ListBoxToolBarProps.js +0 -1
  25. package/dist/es/main.d.ts +0 -7
  26. package/dist/es/main.js +0 -4
  27. package/dist/es/messages/index.js +0 -41
  28. package/dist/es/package-metadata.d.ts +0 -5
  29. package/dist/es/package-metadata.js +0 -11
  30. package/dist/es/utils.d.ts +0 -31
  31. package/dist/es/utils.js +0 -169
  32. package/dist/npm/ListBox.d.ts +0 -36
  33. package/dist/npm/ListBox.js +0 -144
  34. package/dist/npm/ListBoxToolbar.js +0 -175
  35. package/dist/npm/interfaces/Enums.d.ts +0 -7
  36. package/dist/npm/interfaces/Enums.js +0 -11
  37. package/dist/npm/interfaces/ListBoxEvents.d.ts +0 -16
  38. package/dist/npm/interfaces/ListBoxEvents.js +0 -2
  39. package/dist/npm/interfaces/ListBoxProps.d.ts +0 -90
  40. package/dist/npm/interfaces/ListBoxProps.js +0 -3
  41. package/dist/npm/interfaces/ListBoxToolBarProps.d.ts +0 -36
  42. package/dist/npm/interfaces/ListBoxToolBarProps.js +0 -2
  43. package/dist/npm/main.d.ts +0 -7
  44. package/dist/npm/main.js +0 -11
  45. package/dist/npm/messages/index.d.ts +0 -40
  46. package/dist/npm/messages/index.js +0 -44
  47. package/dist/npm/package-metadata.d.ts +0 -5
  48. package/dist/npm/package-metadata.js +0 -14
  49. package/dist/npm/utils.js +0 -175
  50. package/dist/systemjs/kendo-react-listbox.js +0 -1
  51. package/e2e-next/basic.tests.ts +0 -24
@@ -1,32 +0,0 @@
1
- import * as React from 'react';
2
- import { ListBoxToolbarProps } from './interfaces/ListBoxToolBarProps';
3
- import * as PropTypes from 'prop-types';
4
- export declare class ListBoxToolbar extends React.PureComponent<ListBoxToolbarProps, {}> {
5
- /**
6
- * @hidden
7
- */
8
- static propTypes: {
9
- data: PropTypes.Requireable<any[]>;
10
- dataConnected: PropTypes.Requireable<any[]>;
11
- tools: PropTypes.Requireable<any[]>;
12
- selectedField: PropTypes.Requireable<string>;
13
- dir: PropTypes.Requireable<string>;
14
- };
15
- /**
16
- * @hidden
17
- */
18
- static defaultProps: {
19
- data: never[];
20
- dataConnected: never[];
21
- selectedField: string;
22
- };
23
- private get isRtl();
24
- /**
25
- * @hidden
26
- */
27
- render(): JSX.Element;
28
- private checkSvgIcon;
29
- private checkFontIcon;
30
- private handleToolClick;
31
- private isItemDisabled;
32
- }
@@ -1,172 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
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");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import * as React from 'react';
17
- import { classNames, dispatchEvent } from '@progress/kendo-react-common';
18
- import { Button } from '@progress/kendo-react-buttons';
19
- import { provideLocalizationService, registerForLocalization } from '@progress/kendo-react-intl';
20
- import { messages } from './messages';
21
- import * as PropTypes from 'prop-types';
22
- import { caretAltUpIcon, caretAltDownIcon, caretAltRightIcon, caretAltLeftIcon, caretDoubleAltRightIcon, caretDoubleAltLeftIcon, xIcon } from '@progress/kendo-svg-icons';
23
- var tools = [
24
- { name: 'moveUp', iconName: 'caret-alt-up', svgIcon: caretAltUpIcon },
25
- { name: 'moveDown', iconName: 'caret-alt-down', svgIcon: caretAltDownIcon },
26
- { name: 'transferTo', iconName: 'caret-alt-right', svgIcon: caretAltRightIcon },
27
- { name: 'transferFrom', iconName: 'caret-alt-left', svgIcon: caretAltLeftIcon },
28
- { name: 'transferAllTo', iconName: 'caret-double-alt-right', svgIcon: caretDoubleAltRightIcon },
29
- { name: 'transferAllFrom', iconName: 'caret-double-alt-left', svgIcon: caretDoubleAltLeftIcon },
30
- { name: 'remove', iconName: 'x', svgIcon: xIcon }
31
- ];
32
- var ListBoxToolbar = /** @class */ (function (_super) {
33
- __extends(ListBoxToolbar, _super);
34
- function ListBoxToolbar() {
35
- var _this = _super !== null && _super.apply(this, arguments) || this;
36
- _this.checkSvgIcon = function (toolIcon) {
37
- switch (toolIcon.name) {
38
- case 'caret-alt-right':
39
- return caretAltLeftIcon;
40
- case 'caret-alt-left':
41
- return caretAltRightIcon;
42
- case 'caret-double-alt-right':
43
- return caretDoubleAltLeftIcon;
44
- case 'caret-double-alt-left':
45
- return caretDoubleAltRightIcon;
46
- default:
47
- }
48
- return toolIcon;
49
- };
50
- _this.checkFontIcon = function (toolIcon) {
51
- switch (toolIcon) {
52
- case 'caret-alt-right':
53
- return 'caret-alt-left';
54
- case 'caret-alt-left':
55
- return 'caret-alt-right';
56
- case 'caret-double-alt-right':
57
- return 'caret-double-alt-left';
58
- case 'caret-double-alt-left':
59
- return 'caret-double-alt-right';
60
- default:
61
- }
62
- return toolIcon;
63
- };
64
- _this.handleToolClick = function (event, name) {
65
- dispatchEvent(_this.props.onToolClick, event, _this, { toolName: name });
66
- };
67
- _this.isItemDisabled = function (tool) {
68
- var disabled = true;
69
- var selectedField = _this.props.selectedField || 'selected';
70
- var dataLength = _this.props.data.length;
71
- var dataConnectedLength = _this.props.dataConnected.length;
72
- var hasSelected = _this.props.data.findIndex(function (item) { return item[selectedField] === true; }) >= 0;
73
- var hasSelectedTwo = _this.props.dataConnected.findIndex(function (item) { return item[selectedField] === true; }) >= 0;
74
- switch (tool) {
75
- case 'moveUp':
76
- if (hasSelected) {
77
- disabled = _this.props.data.length > 0 ? _this.props.data[0].selected : true;
78
- }
79
- else if (hasSelectedTwo) {
80
- disabled = _this.props.dataConnected.length > 0 ? _this.props.dataConnected[0].selected : true;
81
- }
82
- else {
83
- disabled = true;
84
- }
85
- break;
86
- case 'moveDown':
87
- if (hasSelected) {
88
- disabled = _this.props.data[dataLength - 1] ? _this.props.data[dataLength - 1].selected : true;
89
- }
90
- else if (hasSelectedTwo) {
91
- disabled = _this.props.dataConnected.length > 0 ?
92
- _this.props.dataConnected[dataConnectedLength - 1].selected :
93
- true;
94
- }
95
- else {
96
- disabled = true;
97
- }
98
- break;
99
- case 'transferTo':
100
- disabled = !(_this.props.dataConnected && hasSelected);
101
- break;
102
- case 'transferFrom':
103
- if (_this.props.dataConnected) {
104
- disabled = !(_this.props.dataConnected && hasSelectedTwo);
105
- }
106
- else {
107
- disabled = true;
108
- }
109
- break;
110
- case 'transferAllTo':
111
- disabled = !(_this.props.dataConnected && _this.props.data.length > 0);
112
- break;
113
- case 'transferAllFrom':
114
- disabled = !(_this.props.dataConnected && _this.props.dataConnected.length > 0);
115
- break;
116
- case 'remove':
117
- disabled = !(hasSelected || hasSelectedTwo);
118
- break;
119
- default:
120
- }
121
- return disabled;
122
- };
123
- return _this;
124
- }
125
- Object.defineProperty(ListBoxToolbar.prototype, "isRtl", {
126
- get: function () {
127
- return this.props.dir === 'rtl';
128
- },
129
- enumerable: false,
130
- configurable: true
131
- });
132
- ;
133
- /**
134
- * @hidden
135
- */
136
- ListBoxToolbar.prototype.render = function () {
137
- var _this = this;
138
- var localizationService = provideLocalizationService(this);
139
- return (React.createElement("div", { className: classNames('k-listbox-actions') }, this.props.tools && this.props.tools.map(function (tool, index) {
140
- var indexOfTool = tools.findIndex(function (x) { return x.name === tool; });
141
- var currentTool = tools[indexOfTool];
142
- var isDisabled = _this.isItemDisabled(currentTool.name);
143
- var toolKey = "listbox.".concat(currentTool.name);
144
- var title = localizationService.toLanguageString(toolKey, messages[toolKey]);
145
- return (React.createElement(Button, { key: index, disabled: isDisabled, "data-command": currentTool.name, title: title, "aria-label": title, icon: _this.isRtl ? _this.checkFontIcon(currentTool.iconName) : currentTool.iconName, svgIcon: _this.isRtl ? _this.checkSvgIcon(currentTool.svgIcon) : currentTool.svgIcon, onClick: function (e) {
146
- e.preventDefault();
147
- _this.handleToolClick(e, currentTool.name || null);
148
- } }));
149
- })));
150
- };
151
- /**
152
- * @hidden
153
- */
154
- ListBoxToolbar.propTypes = {
155
- data: PropTypes.array,
156
- dataConnected: PropTypes.array,
157
- tools: PropTypes.array,
158
- selectedField: PropTypes.string,
159
- dir: PropTypes.string
160
- };
161
- /**
162
- * @hidden
163
- */
164
- ListBoxToolbar.defaultProps = {
165
- data: [],
166
- dataConnected: [],
167
- selectedField: 'selected'
168
- };
169
- return ListBoxToolbar;
170
- }(React.PureComponent));
171
- export { ListBoxToolbar };
172
- registerForLocalization(ListBoxToolbar);
@@ -1,7 +0,0 @@
1
- export declare enum toolbarPosition {
2
- TOP = "top",
3
- BOTTOM = "bottom",
4
- LEFT = "left",
5
- RIGHT = "right",
6
- NONE = "none"
7
- }
@@ -1,8 +0,0 @@
1
- export var toolbarPosition;
2
- (function (toolbarPosition) {
3
- toolbarPosition["TOP"] = "top";
4
- toolbarPosition["BOTTOM"] = "bottom";
5
- toolbarPosition["LEFT"] = "left";
6
- toolbarPosition["RIGHT"] = "right";
7
- toolbarPosition["NONE"] = "none";
8
- })(toolbarPosition || (toolbarPosition = {}));
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export {};
2
- // tslint:enable:max-line-length
@@ -1 +0,0 @@
1
- export {};
package/dist/es/main.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { ListBox } from './ListBox';
2
- import { ListBoxProps } from './interfaces/ListBoxProps';
3
- import { ListBoxToolbar } from './ListBoxToolbar';
4
- import { ListBoxToolbarProps } from './interfaces/ListBoxToolBarProps';
5
- import { processListBoxData, moveItem, processListBoxDragAndDrop } from './utils';
6
- import { ListBoxDragEvent, ListBoxItemClickEvent, ListBoxKeyDownEvent, ListBoxToolbarClickEvent } from './interfaces/ListBoxEvents';
7
- export { ListBox, ListBoxProps, ListBoxToolbar, ListBoxToolbarProps, processListBoxData, moveItem, processListBoxDragAndDrop, ListBoxDragEvent, ListBoxItemClickEvent, ListBoxKeyDownEvent, ListBoxToolbarClickEvent };
package/dist/es/main.js DELETED
@@ -1,4 +0,0 @@
1
- import { ListBox } from './ListBox';
2
- import { ListBoxToolbar } from './ListBoxToolbar';
3
- import { processListBoxData, moveItem, processListBoxDragAndDrop } from './utils';
4
- export { ListBox, ListBoxToolbar, processListBoxData, moveItem, processListBoxDragAndDrop };
@@ -1,41 +0,0 @@
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);
@@ -1,5 +0,0 @@
1
- import { PackageMetadata } from '@progress/kendo-licensing';
2
- /**
3
- * @hidden
4
- */
5
- export declare const packageMetadata: PackageMetadata;
@@ -1,11 +0,0 @@
1
- /**
2
- * @hidden
3
- */
4
- export var packageMetadata = {
5
- name: '@progress/kendo-react-listbox',
6
- productName: 'KendoReact',
7
- productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1700064772,
9
- version: '',
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
- };
@@ -1,31 +0,0 @@
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: any[] | undefined, listBoxTwoData: any[] | undefined, 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: any[] | undefined, listBoxTwoData: any[] | undefined, dragItem: any, dropItem: any, valueField: string) => {
29
- listBoxOneData: any[];
30
- listBoxTwoData: any[];
31
- };
package/dist/es/utils.js DELETED
@@ -1,169 +0,0 @@
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 (listBoxOneData, listBoxTwoData, toolName, selectedField) {
21
- if (listBoxOneData === void 0) { listBoxOneData = []; }
22
- if (listBoxTwoData === void 0) { listBoxTwoData = []; }
23
- var newFirstData = [];
24
- var itemsForTransfer = [];
25
- var newSecondData = [];
26
- var result = {
27
- listBoxOneData: listBoxOneData,
28
- listBoxTwoData: listBoxTwoData
29
- };
30
- switch (toolName) {
31
- case 'moveUp':
32
- newFirstData = __spreadArray([], listBoxOneData, true);
33
- newFirstData.forEach(function (item, index) {
34
- if (item[selectedField]) {
35
- newFirstData = moveItem(index, index - 1, newFirstData);
36
- }
37
- });
38
- newSecondData = __spreadArray([], listBoxTwoData, true);
39
- newSecondData.forEach(function (item, index) {
40
- if (item[selectedField]) {
41
- newSecondData = moveItem(index, index - 1, newSecondData);
42
- }
43
- });
44
- result.listBoxOneData = newFirstData;
45
- result.listBoxTwoData = newSecondData;
46
- break;
47
- case 'moveDown':
48
- newFirstData = listBoxOneData.reverse();
49
- newFirstData.forEach(function (item, index) {
50
- if (item[selectedField]) {
51
- newFirstData = moveItem(index, index - 1, newFirstData);
52
- }
53
- });
54
- newSecondData = listBoxTwoData.reverse();
55
- newSecondData.forEach(function (item, index) {
56
- if (item[selectedField]) {
57
- newSecondData = moveItem(index, index - 1, newSecondData);
58
- }
59
- });
60
- result.listBoxOneData = __spreadArray([], newFirstData, true).reverse();
61
- result.listBoxTwoData = __spreadArray([], newSecondData, true).reverse();
62
- break;
63
- case 'transferTo':
64
- newFirstData = listBoxOneData.filter(function (item) { return !item[selectedField]; });
65
- itemsForTransfer = listBoxOneData.filter(function (item) { return item[selectedField]; });
66
- newSecondData = listBoxTwoData.concat(itemsForTransfer);
67
- result.listBoxOneData = newFirstData;
68
- result.listBoxTwoData = newSecondData;
69
- break;
70
- case 'transferFrom':
71
- newSecondData = listBoxTwoData.filter(function (item) { return !item[selectedField]; });
72
- itemsForTransfer = listBoxTwoData.filter(function (item) { return item[selectedField]; });
73
- newFirstData = listBoxOneData.concat(itemsForTransfer);
74
- result.listBoxOneData = newFirstData;
75
- result.listBoxTwoData = newSecondData;
76
- break;
77
- case 'transferAllTo':
78
- result.listBoxOneData = [];
79
- result.listBoxTwoData = listBoxTwoData.concat(listBoxOneData);
80
- break;
81
- case 'transferAllFrom':
82
- result.listBoxOneData = listBoxTwoData.concat(listBoxOneData);
83
- result.listBoxTwoData = [];
84
- break;
85
- case 'remove':
86
- newSecondData = listBoxTwoData.filter(function (item) { return !item[selectedField]; });
87
- newFirstData = listBoxOneData.filter(function (item) { return !item[selectedField]; });
88
- result.listBoxOneData = newFirstData;
89
- result.listBoxTwoData = newSecondData;
90
- break;
91
- default:
92
- }
93
- return result;
94
- };
95
- /**
96
- * @hidden
97
- */
98
- export var moveItem = function (from, to, data) {
99
- var f = data.splice(from, 1)[0];
100
- data.splice(to, 0, f);
101
- return data;
102
- };
103
- /**
104
- * Process the data collection/s based on the dragged and drop item.
105
- *
106
- * @param {T[]} listBoxOneData - The first data collection.
107
- * @param {T[]} listBoxTwoData - The second data collection. Pass an empty array if there is only one ListBox.
108
- * @param {any} dragItem - The item that was dragged.
109
- * @param {any} dropItem - The drop target item.
110
- * @param {string} valueField - The field which points to the unique value of each data item.
111
- * @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
112
- */
113
- // tslint:disable-next-line: max-line-length
114
- export var processListBoxDragAndDrop = function (listBoxOneData, listBoxTwoData, dragItem, dropItem, valueField) {
115
- if (listBoxOneData === void 0) { listBoxOneData = []; }
116
- if (listBoxTwoData === void 0) { listBoxTwoData = []; }
117
- var dragItemIndexInFirstList = listBoxOneData.findIndex(function (item) { return item[valueField] === dragItem[valueField]; });
118
- var dragItemIndexInSecondList = listBoxTwoData.findIndex(function (item) { return item[valueField] === dragItem[valueField]; });
119
- var dropItemIndexInFirstList = dropItem !== null ? listBoxOneData.findIndex(function (item) { return item[valueField] === dropItem[valueField]; }) : -1;
120
- var dropItemIndexInSecondList = dropItem !== null ? listBoxTwoData.findIndex(function (item) { return item[valueField] === dropItem[valueField]; }) : -1;
121
- var isDragItemInFirstList = dragItemIndexInFirstList >= 0 ? true : false;
122
- var isDragItemInSecondList = dragItemIndexInSecondList >= 0 ? true : false;
123
- var isDropItemInFirstList = dropItemIndexInFirstList >= 0 ? true : false;
124
- var isDropItemInSecondList = dropItemIndexInSecondList >= 0 ? true : false;
125
- var firstDataSet = __spreadArray([], listBoxOneData, true);
126
- var secondDataSet = __spreadArray([], listBoxTwoData, true);
127
- if (isDragItemInFirstList && isDropItemInFirstList) {
128
- return {
129
- listBoxOneData: moveItem(dragItemIndexInFirstList, dropItemIndexInFirstList, listBoxOneData),
130
- listBoxTwoData: listBoxTwoData
131
- };
132
- }
133
- if (isDragItemInSecondList && isDropItemInSecondList) {
134
- return {
135
- listBoxOneData: listBoxOneData,
136
- listBoxTwoData: moveItem(dragItemIndexInSecondList, dropItemIndexInSecondList, listBoxTwoData)
137
- };
138
- }
139
- if (isDragItemInFirstList && (isDropItemInSecondList || dropItem === null)) {
140
- if (dropItem === null) {
141
- secondDataSet.push(listBoxOneData[dragItemIndexInFirstList]);
142
- }
143
- else {
144
- secondDataSet.splice(dropItemIndexInSecondList + 1, 0, listBoxOneData[dragItemIndexInFirstList]);
145
- }
146
- firstDataSet.splice(dragItemIndexInFirstList, 1);
147
- return {
148
- listBoxOneData: firstDataSet,
149
- listBoxTwoData: secondDataSet
150
- };
151
- }
152
- if (isDragItemInSecondList && (isDropItemInFirstList || dropItem === null)) {
153
- if (dropItem === null) {
154
- firstDataSet.push(listBoxTwoData[dragItemIndexInSecondList]);
155
- }
156
- else {
157
- firstDataSet.splice(dropItemIndexInFirstList + 1, 0, listBoxTwoData[dragItemIndexInSecondList]);
158
- }
159
- secondDataSet.splice(dragItemIndexInSecondList, 1);
160
- return {
161
- listBoxOneData: firstDataSet,
162
- listBoxTwoData: secondDataSet
163
- };
164
- }
165
- return {
166
- listBoxOneData: listBoxOneData,
167
- listBoxTwoData: listBoxTwoData
168
- };
169
- };
@@ -1,36 +0,0 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
3
- import { ListBoxProps } from './interfaces/ListBoxProps';
4
- import { toolbarPosition } from './interfaces/Enums';
5
- export declare class ListBox extends React.PureComponent<ListBoxProps, {}> {
6
- /**
7
- * @hidden
8
- */
9
- static propTypes: {
10
- size: PropTypes.Requireable<string | null>;
11
- toolbarPosition: PropTypes.Requireable<string>;
12
- textField: PropTypes.Requireable<string>;
13
- valueField: PropTypes.Requireable<string>;
14
- selectedField: PropTypes.Requireable<string>;
15
- data: PropTypes.Requireable<any[]>;
16
- };
17
- /**
18
- * @hidden
19
- */
20
- static defaultProps: {
21
- toolbarPosition: toolbarPosition;
22
- draggable: boolean;
23
- size: string;
24
- };
25
- constructor(props: ListBoxProps);
26
- /**
27
- * @hidden
28
- */
29
- render(): JSX.Element;
30
- private setSelected;
31
- private renderItem;
32
- private handleKeyDown;
33
- private handleContainerDrop;
34
- private setToolbarPosition;
35
- private handleOnDragLeave;
36
- }