@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,166 @@
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 { Button } from '@progress/kendo-vue-buttons';
7
+ import { provideLocalizationService } from '@progress/kendo-vue-intl';
8
+ import { messages } from './messages/main.js';
9
+ var tools = [{
10
+ name: 'moveUp',
11
+ iconName: 'caret-alt-up'
12
+ }, {
13
+ name: 'moveDown',
14
+ iconName: 'caret-alt-down'
15
+ }, {
16
+ name: 'transferTo',
17
+ iconName: 'caret-alt-right'
18
+ }, {
19
+ name: 'transferFrom',
20
+ iconName: 'caret-alt-left'
21
+ }, {
22
+ name: 'transferAllTo',
23
+ iconName: 'caret-double-alt-right'
24
+ }, {
25
+ name: 'transferAllFrom',
26
+ iconName: 'caret-double-alt-left'
27
+ }, {
28
+ name: 'remove',
29
+ iconName: 'x'
30
+ }];
31
+ /**
32
+ * @hidden
33
+ */
34
+ var ListBoxToolbarVue2 = {
35
+ name: 'KendoListBoxToolbar',
36
+ props: {
37
+ dataItems: Array,
38
+ dataConnected: Array,
39
+ tools: Array,
40
+ selectedField: {
41
+ type: String,
42
+ default: 'selected'
43
+ }
44
+ },
45
+ inject: {
46
+ kendoLocalizationService: {
47
+ default: null
48
+ }
49
+ },
50
+ // @ts-ignore
51
+ setup: !isV3 ? undefined : function () {
52
+ var v3 = !!isV3;
53
+ return {
54
+ v3: v3
55
+ };
56
+ },
57
+ // @ts-ignore
58
+ render: function render(createElement) {
59
+ var h = gh || createElement;
60
+ var localizationService = provideLocalizationService(this);
61
+ return h("div", {
62
+ "class": 'k-listbox-toolbar'
63
+ }, [h("ul", {
64
+ "class": "k-reset"
65
+ }, [this.$props.tools && this.$props.tools.map(function (tool, index) {
66
+ var _this = this;
67
+ var indexOfTool = tools.findIndex(function (x) {
68
+ return x.name === tool;
69
+ });
70
+ var currentTool = tools[indexOfTool];
71
+ var isDisabled = this.isItemDisabled(currentTool.name);
72
+ var toolKey = "listbox.".concat(currentTool.name);
73
+ var title = localizationService.toLanguageString(toolKey, messages[toolKey]);
74
+ return h("li", {
75
+ key: index
76
+ }, [h(Button, {
77
+ disabled: isDisabled,
78
+ attrs: this.v3 ? undefined : {
79
+ disabled: isDisabled,
80
+ "data-command": currentTool.name,
81
+ title: title,
82
+ "aria-label": title,
83
+ icon: currentTool.iconName
84
+ },
85
+ "data-command": currentTool.name,
86
+ title: title,
87
+ "aria-label": title,
88
+ icon: currentTool.iconName,
89
+ onClick: function onClick(e) {
90
+ e.preventDefault();
91
+ _this.handleToolClick(e, currentTool.name || null);
92
+ },
93
+ on: this.v3 ? undefined : {
94
+ "click": function onClick(e) {
95
+ e.preventDefault();
96
+ _this.handleToolClick(e, currentTool.name || null);
97
+ }
98
+ }
99
+ })]);
100
+ }, this)])]);
101
+ },
102
+ methods: {
103
+ handleToolClick: function handleToolClick(event, name) {
104
+ this.$emit('toolclick', {
105
+ event: event,
106
+ component: this,
107
+ toolName: name
108
+ });
109
+ },
110
+ isItemDisabled: function isItemDisabled(tool) {
111
+ var disabled = true;
112
+ var selectedField = this.$props.selectedField || 'selected';
113
+ var dataLength = this.$props.dataItems.length;
114
+ var dataConnectedLength = this.$props.dataConnected.length;
115
+ var hasSelected = this.$props.dataItems.findIndex(function (item) {
116
+ return item[selectedField] === true;
117
+ }) >= 0;
118
+ var hasSelectedTwo = this.$props.dataConnected.findIndex(function (item) {
119
+ return item[selectedField] === true;
120
+ }) >= 0;
121
+ switch (tool) {
122
+ case 'moveUp':
123
+ if (hasSelected) {
124
+ disabled = this.$props.dataItems.length > 0 ? this.$props.dataItems[0].selected : true;
125
+ } else if (hasSelectedTwo) {
126
+ disabled = this.$props.dataConnected.length > 0 ? this.$props.dataConnected[0].selected : true;
127
+ } else {
128
+ disabled = true;
129
+ }
130
+ break;
131
+ case 'moveDown':
132
+ if (hasSelected) {
133
+ disabled = this.$props.dataItems[dataLength - 1] ? this.$props.dataItems[dataLength - 1].selectedField : true;
134
+ } else if (hasSelectedTwo) {
135
+ disabled = this.$props.dataConnected.length > 0 ? this.$props.dataConnected[dataConnectedLength - 1].selected : true;
136
+ } else {
137
+ disabled = true;
138
+ }
139
+ break;
140
+ case 'transferTo':
141
+ disabled = !(this.$props.dataConnected && hasSelected);
142
+ break;
143
+ case 'transferFrom':
144
+ if (this.$props.dataConnected) {
145
+ disabled = !(this.$props.dataConnected && hasSelectedTwo);
146
+ } else {
147
+ disabled = true;
148
+ }
149
+ break;
150
+ case 'transferAllTo':
151
+ disabled = !(this.$props.dataConnected && this.$props.dataItems.length > 0);
152
+ break;
153
+ case 'transferAllFrom':
154
+ disabled = !(this.$props.dataConnected && this.$props.dataConnected.length > 0);
155
+ break;
156
+ case 'remove':
157
+ disabled = !(hasSelected || hasSelectedTwo);
158
+ break;
159
+ default:
160
+ }
161
+ return disabled;
162
+ }
163
+ }
164
+ };
165
+ var ListBoxToolbar = ListBoxToolbarVue2;
166
+ export { ListBoxToolbar, ListBoxToolbarVue2 };
@@ -0,0 +1,21 @@
1
+ // @ts-ignore
2
+ import { DefineComponent } from 'vue';
3
+ // @ts-ignore
4
+ import * as Vue from 'vue';
5
+
6
+ /**
7
+ * @hidden
8
+ */
9
+ // @ts-ignore
10
+ type Vue2type = Vue.default;
11
+
12
+ /**
13
+ * @hidden
14
+ */
15
+ // @ts-ignore
16
+ import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
17
+ /**
18
+ * @hidden
19
+ */
20
+ // @ts-ignore
21
+ export { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type };
@@ -0,0 +1,7 @@
1
+ export declare enum toolbarPosition {
2
+ TOP = "top",
3
+ BOTTOM = "bottom",
4
+ LEFT = "left",
5
+ RIGHT = "right",
6
+ NONE = "none"
7
+ }
@@ -0,0 +1,8 @@
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 = {}));
@@ -0,0 +1,13 @@
1
+ export interface ListBoxItemClickEvent {
2
+ dataItem?: any;
3
+ }
4
+ export interface ListBoxKeyDownEvent {
5
+ }
6
+ export interface ListBoxDragLeaveEvent {
7
+ }
8
+ export interface ListBoxToolbarClickEvent {
9
+ toolName?: string;
10
+ }
11
+ export interface ListBoxDragEvent {
12
+ dataItem?: any;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,93 @@
1
+ import { ListBoxItemClickEvent, ListBoxKeyDownEvent, ListBoxDragEvent, ListBoxDragLeaveEvent } from './ListBoxEvents';
2
+ import { toolbarPosition } from './Enums';
3
+ /**
4
+ * Represents the props of the [Kendo UI for Vue ListBox component]({% slug overview_listbox %}).
5
+ */
6
+ export interface ListBoxProps {
7
+ /**
8
+ * Sets a class of the Tooltip animation container.
9
+ */
10
+ className?: string;
11
+ /**
12
+ * Configures the `size` of the ListBox.
13
+ *
14
+ * The available options are:
15
+ * - small
16
+ * - medium
17
+ * - large
18
+ * - null—Does not set a size `className`.
19
+ *
20
+ * @default `medium`
21
+ */
22
+ size?: null | 'small' | 'medium' | 'large' | string;
23
+ /**
24
+ * Set the data of the ListBox.
25
+ */
26
+ dataItems: Array<any>;
27
+ /**
28
+ * Makes the items of the ListBox draggable. The items are draggable by default.
29
+ */
30
+ draggable?: boolean;
31
+ /**
32
+ * Set the selected field of the ListBox. Based on that value of that field, an item will be selected or not.
33
+ */
34
+ selectedField?: string;
35
+ /**
36
+ * Sets the data item field that represents the item text. If the data contains only primitive values, do not define it.
37
+ */
38
+ textField: string;
39
+ /**
40
+ * The field that be used during form submit. Defaults to the textField if not set.
41
+ */
42
+ valueField?: string;
43
+ /**
44
+ * The field that is used for rendering key of the items.
45
+ */
46
+ keyField?: string;
47
+ /**
48
+ * Sets the position of the toolbar of the ListBox if one is set. The ListBox may have no toolbar.
49
+ * * The possible values are:
50
+ * * `top`
51
+ * * `bottom`
52
+ * * `left`
53
+ * * `right` (Default)
54
+ * * `none`
55
+ */
56
+ toolbarPosition?: toolbarPosition | string;
57
+ /**
58
+ * Renders a toolbar component next to the ListBox.
59
+ */
60
+ toolbar?: string | object | Function;
61
+ /**
62
+ * Sets the `tabIndex` attribute of the ListBox.
63
+ */
64
+ tabIndex?: number;
65
+ /**
66
+ * Defines the component that will be rendered for each item of the data collection.
67
+ */
68
+ item?: string | object | Function;
69
+ /**
70
+ * Fires when an item from the ListBox is clicked. Contains the clicked item.
71
+ */
72
+ onItemclick?: (event: ListBoxItemClickEvent) => void;
73
+ /**
74
+ * Fires on keydown over the ListBox list items. It can be use to add keyboard extra keyboard navigation option.
75
+ */
76
+ onKeydown?: (event: ListBoxKeyDownEvent) => void;
77
+ /**
78
+ * Fires when an the user start to drag an item from the ListBox. The event contains information for the item that is being dragged.
79
+ */
80
+ onDragstart?: (event: ListBoxDragEvent) => void;
81
+ /**
82
+ * Fires when an the user drags over an item from the ListBox. The event contains information for the item that is dragged over.
83
+ */
84
+ onDragover?: (event: ListBoxDragEvent) => void;
85
+ /**
86
+ * Fires when an the user drops an item. The event contains information for the drop target item.
87
+ */
88
+ onDrop?: (event: ListBoxDragEvent) => void;
89
+ /**
90
+ * Fires when a dragged element or text selection leaves the ListBox element.
91
+ */
92
+ onDragleave?: (event: ListBoxDragLeaveEvent) => void;
93
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ // tslint:enable:max-line-length
@@ -0,0 +1,32 @@
1
+ import { ListBoxToolbarClickEvent } from './ListBoxEvents';
2
+ export interface ListBoxToolbarProps {
3
+ /**
4
+ * Sets the tools of the ListBoxToolbar. By default, the ListBoxToolbar renders no tools.
5
+ * The built-in tools are:
6
+ * * `moveUp`
7
+ * * `moveDown`
8
+ * * `transferTo`
9
+ * * `transferFrom`
10
+ * * `transferAllTo`
11
+ * * `transferAllFrom`
12
+ * * `remove`
13
+ */
14
+ tools?: Array<string>;
15
+ /**
16
+ * The data of the main ListBox.
17
+ */
18
+ dataItems: Array<any>;
19
+ /**
20
+ * The data of the connected ListBox.
21
+ */
22
+ dataConnected: Array<any>;
23
+ /**
24
+ * Set the selected field of the ListBoxToolbar.
25
+ * Based on that value of that field the ListBoxToolbar will determine which actions are allowed and which disabled.
26
+ */
27
+ selectedField?: string;
28
+ /**
29
+ * Fires when one of the ListBoxToolbar tools is clicked.
30
+ */
31
+ onToolclick?: (event: ListBoxToolbarClickEvent) => void;
32
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
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 };
@@ -0,0 +1,4 @@
1
+ import { ListBox } from './ListBox.js';
2
+ import { ListBoxToolbar } from './ListBoxToolbar.js';
3
+ import { processListBoxData, moveItem, processListBoxDragAndDrop } from './utils.js';
4
+ export { ListBox, ListBoxToolbar, processListBoxData, moveItem, processListBoxDragAndDrop };
@@ -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,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -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
+ };