@progress/kendo-vue-treeview 3.3.3 → 3.3.5-dev.202206141337
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-vue-treeview.js +1 -1
- package/dist/es/TreeView.d.ts +70 -0
- package/dist/es/TreeView.js +72 -1
- package/dist/es/TreeViewDragAnalyzer.d.ts +11 -2
- package/dist/es/TreeViewDragAnalyzer.js +10 -2
- package/dist/es/TreeViewDragClue.d.ts +29 -90
- package/dist/es/TreeViewDragClue.js +30 -1
- package/dist/es/TreeViewItem.d.ts +6 -0
- package/dist/es/TreeViewItem.js +8 -1
- package/dist/es/TreeViewProps.d.ts +1 -1
- package/dist/es/additionalTypes.ts +11 -0
- package/dist/es/handleTreeViewCheckChange.d.ts +18 -40
- package/dist/es/handleTreeViewCheckChange.js +18 -40
- package/dist/es/main.d.ts +3 -3
- package/dist/es/main.js +3 -3
- package/dist/es/moveTreeViewItem.d.ts +27 -93
- package/dist/es/moveTreeViewItem.js +28 -94
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/processTreeViewItems.d.ts +13 -43
- package/dist/es/processTreeViewItems.js +14 -44
- package/dist/es/utils/SortedPublicItemIds.js +0 -2
- package/dist/npm/TreeView.d.ts +70 -0
- package/dist/npm/TreeView.js +72 -1
- package/dist/npm/TreeViewDragAnalyzer.d.ts +11 -2
- package/dist/npm/TreeViewDragAnalyzer.js +11 -2
- package/dist/npm/TreeViewDragClue.d.ts +29 -90
- package/dist/npm/TreeViewDragClue.js +30 -1
- package/dist/npm/TreeViewItem.d.ts +6 -0
- package/dist/npm/TreeViewItem.js +8 -1
- package/dist/npm/TreeViewProps.d.ts +1 -1
- package/dist/npm/additionalTypes.ts +11 -0
- package/dist/npm/handleTreeViewCheckChange.d.ts +18 -40
- package/dist/npm/handleTreeViewCheckChange.js +18 -40
- package/dist/npm/main.d.ts +3 -3
- package/dist/npm/main.js +3 -3
- package/dist/npm/moveTreeViewItem.d.ts +27 -93
- package/dist/npm/moveTreeViewItem.js +26 -95
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/processTreeViewItems.d.ts +13 -43
- package/dist/npm/processTreeViewItems.js +15 -45
- package/dist/npm/utils/SortedPublicItemIds.js +0 -2
- package/package.json +6 -6
|
@@ -4,109 +4,39 @@ import { CHILDREN_FIELD } from './utils/consts';
|
|
|
4
4
|
/**
|
|
5
5
|
* A helper function which moves a TreeView item in an immutable way.
|
|
6
6
|
*
|
|
7
|
-
* @param sourceItemHierarchicalIndex - The hierarchical index of the item that will be moved.
|
|
8
|
-
* @param sourceData - The tree which contains the item that will be moved.
|
|
9
|
-
* @param operation - The specific move operation.
|
|
10
7
|
*
|
|
11
|
-
* The available options are:
|
|
12
|
-
* * `before`—Indicates that the source item will become the previous sibling of the target item.
|
|
13
|
-
* * `after`—Indicates that the source item will become the next sibling of the target item.
|
|
14
|
-
* * `child`—Indicates that the source item will become a child of the target item.
|
|
15
|
-
* @param targetItemHierarchicalIndex - The hierarchical index of the item next to which the source item will be moved.
|
|
16
|
-
* @param targetData - The tree which contains the target item.
|
|
17
|
-
* If the argument is skipped, then the move operation will be executed within the same tree.
|
|
18
|
-
* Setting the `sourceData` and `targetData` arguments to the same tree is also supported.
|
|
19
|
-
* @param childrenField - The field that points to the dataItem sub items. Defaults to `items`.
|
|
20
|
-
* @returns - The updated copies of the `sourceData` and `targetData` input arguments.
|
|
21
|
-
* If `targetData` is not passed, then only the updated copy of the `sourceData` will be returned.
|
|
22
8
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* dragClue;
|
|
27
|
-
* state = { tree };
|
|
9
|
+
* #### Parameters
|
|
10
|
+
* ##### sourceItemHierarchicalIndex <span class='code'>string</span>
|
|
11
|
+
* The hierarchical index of the item that will be moved.
|
|
28
12
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* <div>
|
|
32
|
-
* <TreeView data={this.state.tree} draggable={true}
|
|
33
|
-
* onItemDragOver={this.onItemDragOver} onItemDragEnd={this.onItemDragEnd} />
|
|
34
|
-
* <TreeViewDragClue ref={dragClue => this.dragClue = dragClue} />
|
|
35
|
-
* </div>
|
|
36
|
-
* );
|
|
37
|
-
* }
|
|
13
|
+
* ##### sourceData <span class='code'>any[] | null | undefined</span>
|
|
14
|
+
* The tree which contains the item that will be moved.
|
|
38
15
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* }
|
|
42
|
-
* onItemDragEnd = (event) => {
|
|
43
|
-
* this.dragClue.hide();
|
|
44
|
-
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
16
|
+
* ##### operation <span class='code'>"before" | "after" | "child"</span>
|
|
17
|
+
* The specific move operation.
|
|
45
18
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* eventAnalyzer.getDropOperation(),
|
|
51
|
-
* eventAnalyzer.destinationMeta.itemHierarchicalIndex,
|
|
52
|
-
* );
|
|
19
|
+
* The available options are:
|
|
20
|
+
* * `before`—Indicates that the source item will become the previous sibling of the target item.
|
|
21
|
+
* * `after`—Indicates that the source item will become the next sibling of the target item.
|
|
22
|
+
* * `child`—Indicates that the source item will become a child of the target item.
|
|
53
23
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* }
|
|
57
|
-
* getClueClassName(event) {
|
|
58
|
-
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
59
|
-
* const itemIndex = eventAnalyzer.destinationMeta.itemHierarchicalIndex;
|
|
24
|
+
* ##### targetItemHierarchicalIndex <span class='code'>string</span>
|
|
25
|
+
* The hierarchical index of the item next to which the source item will be moved.
|
|
60
26
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* case 'before':
|
|
66
|
-
* return itemIndex === '0' || itemIndex.endsWith(`${SEPARATOR}0`) ?
|
|
67
|
-
* 'k-i-insert-up' : 'k-i-insert-middle';
|
|
68
|
-
* case 'after':
|
|
69
|
-
* const siblings = getSiblings(itemIndex, this.state.tree);
|
|
70
|
-
* const lastIndex = Number(itemIndex.split(SEPARATOR).pop());
|
|
27
|
+
* ##### targetData? <span class='code'>any[] | null</span>
|
|
28
|
+
* The tree which contains the target item.
|
|
29
|
+
* If the argument is skipped, then the move operation will be executed within the same tree.
|
|
30
|
+
* Setting the `sourceData` and `targetData` arguments to the same tree is also supported.
|
|
71
31
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* break;
|
|
75
|
-
* }
|
|
76
|
-
* }
|
|
32
|
+
* ##### childrenField? <span class='code'>string</span>
|
|
33
|
+
* The field that points to the dataItem sub items. Defaults to `items`.
|
|
77
34
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* function getSiblings(itemIndex, data) {
|
|
83
|
-
* let result = data;
|
|
84
|
-
*
|
|
85
|
-
* const indices = itemIndex.split(SEPARATOR).map(index => Number(index));
|
|
86
|
-
* for (let i = 0; i < indices.length - 1; i++) {
|
|
87
|
-
* result = result[indices[i]].items;
|
|
88
|
-
* }
|
|
89
|
-
*
|
|
90
|
-
* return result;
|
|
91
|
-
* }
|
|
92
|
-
*
|
|
93
|
-
* const SEPARATOR = '_';
|
|
94
|
-
* const tree = [{
|
|
95
|
-
* text: 'Furniture', expanded: true, items: [
|
|
96
|
-
* { text: 'Tables & Chairs', expanded: true },
|
|
97
|
-
* { text: 'Sofas', expanded: true },
|
|
98
|
-
* { text: 'Occasional Furniture', expanded: true }]
|
|
99
|
-
* }, {
|
|
100
|
-
* text: 'Decor', expanded: true, items: [
|
|
101
|
-
* { text: 'Bed Linen', expanded: true },
|
|
102
|
-
* { text: 'Curtains & Blinds', expanded: true },
|
|
103
|
-
* { text: 'Carpets', expanded: true }]
|
|
104
|
-
* }];
|
|
105
|
-
*
|
|
106
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
107
|
-
* ```
|
|
35
|
+
* #### Returns
|
|
36
|
+
* <span class='code'>any[] | { sourceData: any[]; targetData: any[]; }</span> - The updated copies of the `sourceData` and `targetData` input arguments.
|
|
37
|
+
* If `targetData` is not passed, then only the updated copy of the `sourceData` will be returned.
|
|
108
38
|
*/
|
|
109
|
-
|
|
39
|
+
var moveTreeViewItem = function (sourceItemHierarchicalIndex, sourceData, operation, targetItemHierarchicalIndex, targetData, childrenField) {
|
|
110
40
|
var subItemsField = childrenField || CHILDREN_FIELD;
|
|
111
41
|
if (!validateInput()) {
|
|
112
42
|
return prepareInputDataForReturn();
|
|
@@ -153,4 +83,8 @@ export default function moveTreeViewItem(sourceItemHierarchicalIndex, sourceData
|
|
|
153
83
|
}
|
|
154
84
|
return true;
|
|
155
85
|
}
|
|
156
|
-
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* @hidden
|
|
89
|
+
*/
|
|
90
|
+
export { moveTreeViewItem };
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-vue-treeview',
|
|
6
6
|
productName: 'Kendo UI for Vue',
|
|
7
7
|
productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1655213695,
|
|
9
9
|
version: '',
|
|
10
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
11
|
};
|
|
@@ -1,51 +1,21 @@
|
|
|
1
1
|
import { TreeViewOperationDescriptors } from './TreeViewOperationDescriptors';
|
|
2
2
|
/**
|
|
3
3
|
* A helper function which applies the specified operation descriptors to the data.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* [Expanding and collapsing items]({% slug expansion_ways_treeview %}#toc-using-a-helper-function)
|
|
5
|
+
* [Selecting and deselecting items]({% slug selection_ways_treeview %}#toc-using-a-helper-function)
|
|
6
|
+
* [Checking and unchecking items]({% slug check_helper_funcs_treeview %})
|
|
7
7
|
*
|
|
8
|
-
* @param data - The data that will be processed.
|
|
9
|
-
* @param operations - The operation descriptors that will be applied to the data.
|
|
10
|
-
* @returns - The processed copy of the input data.
|
|
11
8
|
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```jsx
|
|
14
|
-
* class App extends React.Component {
|
|
15
|
-
* state = { items: tree, expand: [], select: [], check: [] };
|
|
16
|
-
* render() {
|
|
17
|
-
* const { expand, select, check } = this.state;
|
|
18
|
-
* return (
|
|
19
|
-
* <TreeView
|
|
20
|
-
* data={processTreeViewItems(this.state.items, { expand, select, check })}
|
|
21
|
-
* expandIcons={true} onExpandChange={this.onExpandChange} checkboxes={true}
|
|
22
|
-
* onCheckChange={event => this.setState({ check: [ event.itemHierarchicalIndex ] })}
|
|
23
|
-
* onItemClick={event => this.setState({ select: [ event.itemHierarchicalIndex ] })}
|
|
24
|
-
* />
|
|
25
|
-
* );
|
|
26
|
-
* }
|
|
27
|
-
* onExpandChange = (event) => {
|
|
28
|
-
* let expand = this.state.expand.slice();
|
|
29
|
-
* const index = expand.indexOf(event.itemHierarchicalIndex);
|
|
30
|
-
* index === -1 ? expand.push(event.itemHierarchicalIndex) : expand.splice(index, 1);
|
|
31
|
-
* this.setState({ expand });
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
9
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* { text: 'Item1.1' },
|
|
39
|
-
* { text: 'Item1.2' },
|
|
40
|
-
* { text: 'Item1.3', items: [{ text: 'Item1.3.1' }] }]
|
|
41
|
-
* }, {
|
|
42
|
-
* text: 'Item2', disabled: true,
|
|
43
|
-
* items: [{ text: 'Item2.1' }, { text: 'Item2.2' }, { text: 'Item2.3' }]
|
|
44
|
-
* }, {
|
|
45
|
-
* text: 'Item3'
|
|
46
|
-
* }];
|
|
10
|
+
* #### Parameters
|
|
11
|
+
* ##### data <span class='code'>any[] | null | undefined</span>
|
|
12
|
+
* The data that will be processed.
|
|
47
13
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
14
|
+
* ##### operations <span class='code'>[TreeViewOperationDescriptors]({% slug api_treeview_treeviewoperationdescriptors %})</span>
|
|
15
|
+
* The operation descriptors that will be applied to the data.
|
|
16
|
+
*
|
|
17
|
+
* #### Returns
|
|
18
|
+
* <span class='code'>any[]</span> - The processed copy of the input data.
|
|
50
19
|
*/
|
|
51
|
-
|
|
20
|
+
declare const processTreeViewItems: (data: any[] | null | undefined, operations: TreeViewOperationDescriptors) => any[];
|
|
21
|
+
export { processTreeViewItems };
|
|
@@ -15,54 +15,23 @@ import { EXPAND_FIELD, SELECT_FIELD, CHECK_FIELD, CHECK_INDETERMINATE_FIELD, CHI
|
|
|
15
15
|
import { getNestedValue, isArray } from './utils/misc';
|
|
16
16
|
/**
|
|
17
17
|
* A helper function which applies the specified operation descriptors to the data.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* [Expanding and collapsing items]({% slug expansion_ways_treeview %}#toc-using-a-helper-function)
|
|
19
|
+
* [Selecting and deselecting items]({% slug selection_ways_treeview %}#toc-using-a-helper-function)
|
|
20
|
+
* [Checking and unchecking items]({% slug check_helper_funcs_treeview %})
|
|
21
21
|
*
|
|
22
|
-
* @param data - The data that will be processed.
|
|
23
|
-
* @param operations - The operation descriptors that will be applied to the data.
|
|
24
|
-
* @returns - The processed copy of the input data.
|
|
25
22
|
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```jsx
|
|
28
|
-
* class App extends React.Component {
|
|
29
|
-
* state = { items: tree, expand: [], select: [], check: [] };
|
|
30
|
-
* render() {
|
|
31
|
-
* const { expand, select, check } = this.state;
|
|
32
|
-
* return (
|
|
33
|
-
* <TreeView
|
|
34
|
-
* data={processTreeViewItems(this.state.items, { expand, select, check })}
|
|
35
|
-
* expandIcons={true} onExpandChange={this.onExpandChange} checkboxes={true}
|
|
36
|
-
* onCheckChange={event => this.setState({ check: [ event.itemHierarchicalIndex ] })}
|
|
37
|
-
* onItemClick={event => this.setState({ select: [ event.itemHierarchicalIndex ] })}
|
|
38
|
-
* />
|
|
39
|
-
* );
|
|
40
|
-
* }
|
|
41
|
-
* onExpandChange = (event) => {
|
|
42
|
-
* let expand = this.state.expand.slice();
|
|
43
|
-
* const index = expand.indexOf(event.itemHierarchicalIndex);
|
|
44
|
-
* index === -1 ? expand.push(event.itemHierarchicalIndex) : expand.splice(index, 1);
|
|
45
|
-
* this.setState({ expand });
|
|
46
|
-
* }
|
|
47
|
-
* }
|
|
48
23
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* { text: 'Item1.1' },
|
|
53
|
-
* { text: 'Item1.2' },
|
|
54
|
-
* { text: 'Item1.3', items: [{ text: 'Item1.3.1' }] }]
|
|
55
|
-
* }, {
|
|
56
|
-
* text: 'Item2', disabled: true,
|
|
57
|
-
* items: [{ text: 'Item2.1' }, { text: 'Item2.2' }, { text: 'Item2.3' }]
|
|
58
|
-
* }, {
|
|
59
|
-
* text: 'Item3'
|
|
60
|
-
* }];
|
|
24
|
+
* #### Parameters
|
|
25
|
+
* ##### data <span class='code'>any[] | null | undefined</span>
|
|
26
|
+
* The data that will be processed.
|
|
61
27
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
28
|
+
* ##### operations <span class='code'>[TreeViewOperationDescriptors]({% slug api_treeview_treeviewoperationdescriptors %})</span>
|
|
29
|
+
* The operation descriptors that will be applied to the data.
|
|
30
|
+
*
|
|
31
|
+
* #### Returns
|
|
32
|
+
* <span class='code'>any[]</span> - The processed copy of the input data.
|
|
64
33
|
*/
|
|
65
|
-
|
|
34
|
+
var processTreeViewItems = function (data, operations) {
|
|
66
35
|
if (!data || !data.length) {
|
|
67
36
|
return [];
|
|
68
37
|
}
|
|
@@ -77,7 +46,7 @@ export default function processTreeViewItems(data, operations) {
|
|
|
77
46
|
result = handleOperation(result, checkField, operations.check, cloneField, childrenField);
|
|
78
47
|
applyCheckIndeterminate(result, childrenField, operations.check);
|
|
79
48
|
return result;
|
|
80
|
-
}
|
|
49
|
+
};
|
|
81
50
|
function handleOperation(items, defaultField, operation, cloneField, childrenField) {
|
|
82
51
|
if (operation) {
|
|
83
52
|
var _a = parseOperation(operation, defaultField), ids = _a.ids, field = _a.field;
|
|
@@ -164,3 +133,4 @@ function applyCheckIndeterminateHelper(data, parents, childrenField, checkField,
|
|
|
164
133
|
}
|
|
165
134
|
}
|
|
166
135
|
}
|
|
136
|
+
export { processTreeViewItems };
|
package/dist/npm/TreeView.d.ts
CHANGED
|
@@ -41,6 +41,76 @@ export interface TreeViewData {
|
|
|
41
41
|
*/
|
|
42
42
|
export interface TreeViewAll extends Vue, TreeViewMethods, TreeViewData, TreeViewComputed, TreeViewState {
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
44
47
|
declare let TreeViewVue2: ComponentOptions<TreeViewAll, DefaultData<TreeViewData>, DefaultMethods<TreeViewAll>, TreeViewComputed, RecordPropsDefinition<TreeViewProps>>;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*
|
|
51
|
+
* Represents the [Kendo UI for Vue Native TreeView component]({% slug overview_treeview %}).
|
|
52
|
+
*
|
|
53
|
+
* ```jsx
|
|
54
|
+
* <template>
|
|
55
|
+
* <div>
|
|
56
|
+
* <TreeView :dataItems="tree" />
|
|
57
|
+
* </div>
|
|
58
|
+
* </template>
|
|
59
|
+
*
|
|
60
|
+
* <script>
|
|
61
|
+
* import { TreeView } from '@progress/kendo-vue-treeview';
|
|
62
|
+
*
|
|
63
|
+
* export default {
|
|
64
|
+
* components: {
|
|
65
|
+
* TreeView,
|
|
66
|
+
* },
|
|
67
|
+
* data() {
|
|
68
|
+
* return {
|
|
69
|
+
* tree: [
|
|
70
|
+
* {
|
|
71
|
+
* text: 'Furniture',
|
|
72
|
+
* expanded: true,
|
|
73
|
+
* items: [
|
|
74
|
+
* {
|
|
75
|
+
* text: 'Tables & Chairs',
|
|
76
|
+
* },
|
|
77
|
+
* {
|
|
78
|
+
* text: 'Sofas',
|
|
79
|
+
* },
|
|
80
|
+
* {
|
|
81
|
+
* text: 'Occasional Furniture',
|
|
82
|
+
* },
|
|
83
|
+
* ],
|
|
84
|
+
* },
|
|
85
|
+
* {
|
|
86
|
+
* text: 'Decor',
|
|
87
|
+
* expanded: true,
|
|
88
|
+
* items: [
|
|
89
|
+
* {
|
|
90
|
+
* text: 'Bed Linen',
|
|
91
|
+
* },
|
|
92
|
+
* {
|
|
93
|
+
* text: 'Curtains & Blinds',
|
|
94
|
+
* },
|
|
95
|
+
* {
|
|
96
|
+
* text: 'Carpets',
|
|
97
|
+
* },
|
|
98
|
+
* ],
|
|
99
|
+
* },
|
|
100
|
+
* ],
|
|
101
|
+
* };
|
|
102
|
+
* },
|
|
103
|
+
* };
|
|
104
|
+
* </script>
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
*
|
|
108
|
+
*
|
|
109
|
+
* ### props <span class='code'>Readonly<[TreeViewProps]({% slug api_treeview_treeviewprops %})></span>
|
|
110
|
+
* The props of the TreeView component.
|
|
111
|
+
*
|
|
112
|
+
* ### guid <span class='code'>string</span>
|
|
113
|
+
* Returns the `guid` which is associated with the TreeView.
|
|
114
|
+
*/
|
|
45
115
|
declare const TreeView: DefineComponent<TreeViewProps, any, TreeViewData, TreeViewComputed, TreeViewMethods, {}, {}, {}, string, TreeViewProps, TreeViewProps, {}>;
|
|
46
116
|
export { TreeView, TreeViewVue2 };
|
package/dist/npm/TreeView.js
CHANGED
|
@@ -26,7 +26,10 @@ var package_metadata_1 = require("./package-metadata");
|
|
|
26
26
|
|
|
27
27
|
var consts_1 = require("./utils/consts");
|
|
28
28
|
|
|
29
|
-
var sizeMap = kendo_vue_common_1.kendoThemeMaps.sizeMap;
|
|
29
|
+
var sizeMap = kendo_vue_common_1.kendoThemeMaps.sizeMap;
|
|
30
|
+
/**
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
30
33
|
|
|
31
34
|
var TreeViewVue2 = {
|
|
32
35
|
name: 'KendoTreeView',
|
|
@@ -376,5 +379,73 @@ var TreeViewVue2 = {
|
|
|
376
379
|
}
|
|
377
380
|
};
|
|
378
381
|
exports.TreeViewVue2 = TreeViewVue2;
|
|
382
|
+
/**
|
|
383
|
+
*
|
|
384
|
+
*
|
|
385
|
+
* Represents the [Kendo UI for Vue Native TreeView component]({% slug overview_treeview %}).
|
|
386
|
+
*
|
|
387
|
+
* ```jsx
|
|
388
|
+
* <template>
|
|
389
|
+
* <div>
|
|
390
|
+
* <TreeView :dataItems="tree" />
|
|
391
|
+
* </div>
|
|
392
|
+
* </template>
|
|
393
|
+
*
|
|
394
|
+
* <script>
|
|
395
|
+
* import { TreeView } from '@progress/kendo-vue-treeview';
|
|
396
|
+
*
|
|
397
|
+
* export default {
|
|
398
|
+
* components: {
|
|
399
|
+
* TreeView,
|
|
400
|
+
* },
|
|
401
|
+
* data() {
|
|
402
|
+
* return {
|
|
403
|
+
* tree: [
|
|
404
|
+
* {
|
|
405
|
+
* text: 'Furniture',
|
|
406
|
+
* expanded: true,
|
|
407
|
+
* items: [
|
|
408
|
+
* {
|
|
409
|
+
* text: 'Tables & Chairs',
|
|
410
|
+
* },
|
|
411
|
+
* {
|
|
412
|
+
* text: 'Sofas',
|
|
413
|
+
* },
|
|
414
|
+
* {
|
|
415
|
+
* text: 'Occasional Furniture',
|
|
416
|
+
* },
|
|
417
|
+
* ],
|
|
418
|
+
* },
|
|
419
|
+
* {
|
|
420
|
+
* text: 'Decor',
|
|
421
|
+
* expanded: true,
|
|
422
|
+
* items: [
|
|
423
|
+
* {
|
|
424
|
+
* text: 'Bed Linen',
|
|
425
|
+
* },
|
|
426
|
+
* {
|
|
427
|
+
* text: 'Curtains & Blinds',
|
|
428
|
+
* },
|
|
429
|
+
* {
|
|
430
|
+
* text: 'Carpets',
|
|
431
|
+
* },
|
|
432
|
+
* ],
|
|
433
|
+
* },
|
|
434
|
+
* ],
|
|
435
|
+
* };
|
|
436
|
+
* },
|
|
437
|
+
* };
|
|
438
|
+
* </script>
|
|
439
|
+
* ```
|
|
440
|
+
*
|
|
441
|
+
*
|
|
442
|
+
*
|
|
443
|
+
* ### props <span class='code'>Readonly<[TreeViewProps]({% slug api_treeview_treeviewprops %})></span>
|
|
444
|
+
* The props of the TreeView component.
|
|
445
|
+
*
|
|
446
|
+
* ### guid <span class='code'>string</span>
|
|
447
|
+
* Returns the `guid` which is associated with the TreeView.
|
|
448
|
+
*/
|
|
449
|
+
|
|
379
450
|
var TreeView = TreeViewVue2;
|
|
380
451
|
exports.TreeView = TreeView;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { TreeViewItemDragOverEvent, TreeViewItemDragEndEvent } from './events';
|
|
2
2
|
/**
|
|
3
3
|
* A class which provides an API for analyzing the `drag` events
|
|
4
|
-
*
|
|
4
|
+
* of the TreeView.
|
|
5
5
|
*
|
|
6
|
+
*
|
|
7
|
+
* ### destinationMeta <span class='code'>{ itemHierarchicalIndex: string; treeViewGuid: string; }</span>
|
|
8
|
+
* Returns an object which contains:
|
|
9
|
+
* * The `itemHierarchicalIndex` of the destination item (the item below the dragged item) and
|
|
10
|
+
* * The `guid` of the destination TreeView (the TreeView which renders the destination item).
|
|
11
|
+
*
|
|
12
|
+
* ### isDropAllowed <span class='code'>boolean</span>
|
|
13
|
+
* Returns `true` if dropping is allowed. Otherwise, returns `false`.
|
|
6
14
|
*/
|
|
7
|
-
|
|
15
|
+
declare class TreeViewDragAnalyzer {
|
|
8
16
|
private event;
|
|
9
17
|
private itemId;
|
|
10
18
|
private treeViewGuid;
|
|
@@ -48,3 +56,4 @@ export default class TreeViewDragAnalyzer {
|
|
|
48
56
|
getDropOperation(): "before" | "after" | "child";
|
|
49
57
|
private setDestimationMeta;
|
|
50
58
|
}
|
|
59
|
+
export { TreeViewDragAnalyzer };
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TreeViewDragAnalyzer = void 0;
|
|
3
4
|
var consts_1 = require("./utils/consts");
|
|
4
5
|
var DROPZONE_BOUNDARY_DELTA = 6;
|
|
5
6
|
/**
|
|
6
7
|
* A class which provides an API for analyzing the `drag` events
|
|
7
|
-
*
|
|
8
|
+
* of the TreeView.
|
|
8
9
|
*
|
|
10
|
+
*
|
|
11
|
+
* ### destinationMeta <span class='code'>{ itemHierarchicalIndex: string; treeViewGuid: string; }</span>
|
|
12
|
+
* Returns an object which contains:
|
|
13
|
+
* * The `itemHierarchicalIndex` of the destination item (the item below the dragged item) and
|
|
14
|
+
* * The `guid` of the destination TreeView (the TreeView which renders the destination item).
|
|
15
|
+
*
|
|
16
|
+
* ### isDropAllowed <span class='code'>boolean</span>
|
|
17
|
+
* Returns `true` if dropping is allowed. Otherwise, returns `false`.
|
|
9
18
|
*/
|
|
10
19
|
var TreeViewDragAnalyzer = /** @class */ (function () {
|
|
11
20
|
/**
|
|
@@ -98,4 +107,4 @@ var TreeViewDragAnalyzer = /** @class */ (function () {
|
|
|
98
107
|
};
|
|
99
108
|
return TreeViewDragAnalyzer;
|
|
100
109
|
}());
|
|
101
|
-
exports.
|
|
110
|
+
exports.TreeViewDragAnalyzer = TreeViewDragAnalyzer;
|
|
@@ -5,99 +5,10 @@ declare type DefaultMethods<V> = {
|
|
|
5
5
|
[key: string]: (this: V, ...args: any[]) => any;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
* Represents the props of the
|
|
8
|
+
* Represents the props of the Kendo UI for Vue TreeViewDragClue component.
|
|
9
9
|
*/
|
|
10
10
|
export interface TreeViewDragClueProps {
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Represents the KendoReact TreeViewDragClue component which renders a clue when an item is dragged.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```jsx
|
|
17
|
-
* class App extends React.Component {
|
|
18
|
-
* dragClue;
|
|
19
|
-
* state = { tree };
|
|
20
|
-
*
|
|
21
|
-
* render() {
|
|
22
|
-
* return (
|
|
23
|
-
* <div>
|
|
24
|
-
* <TreeView data={this.state.tree} draggable={true}
|
|
25
|
-
* onItemDragOver={this.onItemDragOver} onItemDragEnd={this.onItemDragEnd} />
|
|
26
|
-
* <TreeViewDragClue ref={dragClue => this.dragClue = dragClue} />
|
|
27
|
-
* </div>
|
|
28
|
-
* );
|
|
29
|
-
* }
|
|
30
|
-
*
|
|
31
|
-
* onItemDragOver = (event) => {
|
|
32
|
-
* this.dragClue.show(event.pageY + 10, event.pageX, event.item.text, this.getClueClassName(event));
|
|
33
|
-
* }
|
|
34
|
-
* onItemDragEnd = (event) => {
|
|
35
|
-
* this.dragClue.hide();
|
|
36
|
-
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
37
|
-
*
|
|
38
|
-
* if (eventAnalyzer.isDropAllowed) {
|
|
39
|
-
* const updatedTree = moveTreeViewItem(
|
|
40
|
-
* event.itemHierarchicalIndex,
|
|
41
|
-
* this.state.tree,
|
|
42
|
-
* eventAnalyzer.getDropOperation(),
|
|
43
|
-
* eventAnalyzer.destinationMeta.itemHierarchicalIndex,
|
|
44
|
-
* );
|
|
45
|
-
*
|
|
46
|
-
* this.setState({ tree: updatedTree });
|
|
47
|
-
* }
|
|
48
|
-
* }
|
|
49
|
-
* getClueClassName(event) {
|
|
50
|
-
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
51
|
-
* const itemIndex = eventAnalyzer.destinationMeta.itemHierarchicalIndex;
|
|
52
|
-
*
|
|
53
|
-
* if (eventAnalyzer.isDropAllowed) {
|
|
54
|
-
* switch (eventAnalyzer.getDropOperation()) {
|
|
55
|
-
* case 'child':
|
|
56
|
-
* return 'k-i-plus';
|
|
57
|
-
* case 'before':
|
|
58
|
-
* return itemIndex === '0' || itemIndex.endsWith(`${SEPARATOR}0`) ?
|
|
59
|
-
* 'k-i-insert-up' : 'k-i-insert-middle';
|
|
60
|
-
* case 'after':
|
|
61
|
-
* const siblings = getSiblings(itemIndex, this.state.tree);
|
|
62
|
-
* const lastIndex = Number(itemIndex.split(SEPARATOR).pop());
|
|
63
|
-
*
|
|
64
|
-
* return lastIndex < siblings.length - 1 ? 'k-i-insert-middle' : 'k-i-insert-down';
|
|
65
|
-
* default:
|
|
66
|
-
* break;
|
|
67
|
-
* }
|
|
68
|
-
* }
|
|
69
|
-
*
|
|
70
|
-
* return 'k-i-cancel';
|
|
71
|
-
* }
|
|
72
|
-
* }
|
|
73
|
-
*
|
|
74
|
-
* function getSiblings(itemIndex, data) {
|
|
75
|
-
* let result = data;
|
|
76
|
-
*
|
|
77
|
-
* const indices = itemIndex.split(SEPARATOR).map(index => Number(index));
|
|
78
|
-
* for (let i = 0; i < indices.length - 1; i++) {
|
|
79
|
-
* result = result[indices[i]].items;
|
|
80
|
-
* }
|
|
81
|
-
*
|
|
82
|
-
* return result;
|
|
83
|
-
* }
|
|
84
|
-
*
|
|
85
|
-
* const SEPARATOR = '_';
|
|
86
|
-
* const tree = [{
|
|
87
|
-
* text: 'Furniture', expanded: true, items: [
|
|
88
|
-
* { text: 'Tables & Chairs', expanded: true },
|
|
89
|
-
* { text: 'Sofas', expanded: true },
|
|
90
|
-
* { text: 'Occasional Furniture', expanded: true }]
|
|
91
|
-
* }, {
|
|
92
|
-
* text: 'Decor', expanded: true, items: [
|
|
93
|
-
* { text: 'Bed Linen', expanded: true },
|
|
94
|
-
* { text: 'Curtains & Blinds', expanded: true },
|
|
95
|
-
* { text: 'Carpets', expanded: true }]
|
|
96
|
-
* }];
|
|
97
|
-
*
|
|
98
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
12
|
/**
|
|
102
13
|
* @hidden
|
|
103
14
|
*/
|
|
@@ -130,6 +41,34 @@ export interface TreeViewDragClueData {
|
|
|
130
41
|
*/
|
|
131
42
|
export interface TreeViewDragClueAll extends Vue, TreeViewDragClueMethods, TreeViewDragClueData, TreeViewDragClueComputed, TreeViewDragClueState {
|
|
132
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
133
47
|
declare let TreeViewDragClueVue2: ComponentOptions<TreeViewDragClueAll, DefaultData<TreeViewDragClueData>, DefaultMethods<TreeViewDragClueAll>, TreeViewDragClueComputed, RecordPropsDefinition<TreeViewDragClueProps>>;
|
|
48
|
+
/**
|
|
49
|
+
* Represents the Kendo UI for Vue Native TreeViewDragClue component which renders a clue when an item is dragged.
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* ## Methods
|
|
53
|
+
*
|
|
54
|
+
* ### hide
|
|
55
|
+
* Hides the TreeViewDragClue component.
|
|
56
|
+
*
|
|
57
|
+
* ### show
|
|
58
|
+
* Displays the TreeViewDragClue component.
|
|
59
|
+
*
|
|
60
|
+
* #### Parameters
|
|
61
|
+
* ##### top <span class='code'>number</span>
|
|
62
|
+
* The `top` CSS position of the component.
|
|
63
|
+
*
|
|
64
|
+
* ##### left <span class='code'>number</span>
|
|
65
|
+
* The `left` CSS position of the component.
|
|
66
|
+
*
|
|
67
|
+
* ##### text <span class='code'>string</span>
|
|
68
|
+
* The text of the component.
|
|
69
|
+
*
|
|
70
|
+
* ##### operationClassName <span class='code'>string</span>
|
|
71
|
+
* The CSS class name which is related to the specific drop operation.
|
|
72
|
+
*/
|
|
134
73
|
declare const TreeViewDragClue: DefineComponent<TreeViewDragClueProps, any, TreeViewDragClueData, TreeViewDragClueComputed, TreeViewDragClueMethods, {}, {}, {}, string, TreeViewDragClueProps, TreeViewDragClueProps, {}>;
|
|
135
74
|
export { TreeViewDragClue, TreeViewDragClueVue2 };
|