@progress/kendo-vue-treeview 3.3.4 → 3.3.6-dev.202206170937

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 (42) hide show
  1. package/dist/cdn/js/kendo-vue-treeview.js +1 -1
  2. package/dist/es/TreeView.d.ts +70 -0
  3. package/dist/es/TreeView.js +72 -1
  4. package/dist/es/TreeViewDragAnalyzer.d.ts +15 -2
  5. package/dist/es/TreeViewDragAnalyzer.js +14 -2
  6. package/dist/es/TreeViewDragClue.d.ts +33 -90
  7. package/dist/es/TreeViewDragClue.js +34 -1
  8. package/dist/es/TreeViewItem.d.ts +6 -0
  9. package/dist/es/TreeViewItem.js +8 -1
  10. package/dist/es/TreeViewProps.d.ts +1 -1
  11. package/dist/es/additionalTypes.ts +11 -0
  12. package/dist/es/handleTreeViewCheckChange.d.ts +22 -40
  13. package/dist/es/handleTreeViewCheckChange.js +22 -40
  14. package/dist/es/main.d.ts +3 -3
  15. package/dist/es/main.js +3 -3
  16. package/dist/es/moveTreeViewItem.d.ts +31 -94
  17. package/dist/es/moveTreeViewItem.js +32 -95
  18. package/dist/es/package-metadata.js +1 -1
  19. package/dist/es/processTreeViewItems.d.ts +16 -43
  20. package/dist/es/processTreeViewItems.js +17 -44
  21. package/dist/es/utils/SortedPublicItemIds.js +0 -2
  22. package/dist/npm/TreeView.d.ts +70 -0
  23. package/dist/npm/TreeView.js +72 -1
  24. package/dist/npm/TreeViewDragAnalyzer.d.ts +15 -2
  25. package/dist/npm/TreeViewDragAnalyzer.js +15 -2
  26. package/dist/npm/TreeViewDragClue.d.ts +33 -90
  27. package/dist/npm/TreeViewDragClue.js +34 -1
  28. package/dist/npm/TreeViewItem.d.ts +6 -0
  29. package/dist/npm/TreeViewItem.js +8 -1
  30. package/dist/npm/TreeViewProps.d.ts +1 -1
  31. package/dist/npm/additionalTypes.ts +11 -0
  32. package/dist/npm/handleTreeViewCheckChange.d.ts +22 -40
  33. package/dist/npm/handleTreeViewCheckChange.js +22 -40
  34. package/dist/npm/main.d.ts +3 -3
  35. package/dist/npm/main.js +3 -3
  36. package/dist/npm/moveTreeViewItem.d.ts +31 -94
  37. package/dist/npm/moveTreeViewItem.js +30 -96
  38. package/dist/npm/package-metadata.js +1 -1
  39. package/dist/npm/processTreeViewItems.d.ts +16 -43
  40. package/dist/npm/processTreeViewItems.js +18 -45
  41. package/dist/npm/utils/SortedPublicItemIds.js +0 -2
  42. package/package.json +6 -6
@@ -1,114 +1,48 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.moveTreeViewItem = void 0;
3
4
  var itemUtils_1 = require("./utils/itemUtils");
4
5
  var itemIdUtils_1 = require("./utils/itemIdUtils");
5
6
  var consts_1 = require("./utils/consts");
6
7
  /**
7
8
  * A helper function which moves a TreeView item in an immutable way.
8
9
  *
9
- * @param sourceItemHierarchicalIndex - The hierarchical index of the item that will be moved.
10
- * @param sourceData - The tree which contains the item that will be moved.
11
- * @param operation - The specific move operation.
10
+ * {% meta height:400 %}
11
+ * {% embed_file drag/single/main.vue preview %}
12
+ * {% embed_file drag/single/main.js %}
13
+ * {% endmeta %}
12
14
  *
13
- * The available options are:
14
- * * `before`—Indicates that the source item will become the previous sibling of the target item.
15
- * * `after`—Indicates that the source item will become the next sibling of the target item.
16
- * * `child`—Indicates that the source item will become a child of the target item.
17
- * @param targetItemHierarchicalIndex - The hierarchical index of the item next to which the source item will be moved.
18
- * @param targetData - The tree which contains the target item.
19
- * If the argument is skipped, then the move operation will be executed within the same tree.
20
- * Setting the `sourceData` and `targetData` arguments to the same tree is also supported.
21
- * @param childrenField - The field that points to the dataItem sub items. Defaults to `items`.
22
- * @returns - The updated copies of the `sourceData` and `targetData` input arguments.
23
- * If `targetData` is not passed, then only the updated copy of the `sourceData` will be returned.
15
+ * #### Parameters
16
+ * ##### sourceItemHierarchicalIndex <span class='code'>string</span>
17
+ * The hierarchical index of the item that will be moved.
24
18
  *
25
- * @example
26
- * ```jsx
27
- * class App extends React.Component {
28
- * dragClue;
29
- * state = { tree };
19
+ * ##### sourceData <span class='code'>any[] | null | undefined</span>
20
+ * The tree which contains the item that will be moved.
30
21
  *
31
- * render() {
32
- * return (
33
- * <div>
34
- * <TreeView data={this.state.tree} draggable={true}
35
- * onItemDragOver={this.onItemDragOver} onItemDragEnd={this.onItemDragEnd} />
36
- * <TreeViewDragClue ref={dragClue => this.dragClue = dragClue} />
37
- * </div>
38
- * );
39
- * }
22
+ * ##### operation <span class='code'>"before" | "after" | "child"</span>
23
+ * The specific move operation.
40
24
  *
41
- * onItemDragOver = (event) => {
42
- * this.dragClue.show(event.pageY + 10, event.pageX, event.item.text, this.getClueClassName(event));
43
- * }
44
- * onItemDragEnd = (event) => {
45
- * this.dragClue.hide();
46
- * const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
25
+ * The available options are:
26
+ * * `before`&mdash;Indicates that the source item will become the previous sibling of the target item.
27
+ * * `after`&mdash;Indicates that the source item will become the next sibling of the target item.
28
+ * * `child`&mdash;Indicates that the source item will become a child of the target item.
47
29
  *
48
- * if (eventAnalyzer.isDropAllowed) {
49
- * const updatedTree = moveTreeViewItem(
50
- * event.itemHierarchicalIndex,
51
- * this.state.tree,
52
- * eventAnalyzer.getDropOperation(),
53
- * eventAnalyzer.destinationMeta.itemHierarchicalIndex,
54
- * );
30
+ * ##### targetItemHierarchicalIndex <span class='code'>string</span>
31
+ * The hierarchical index of the item next to which the source item will be moved.
55
32
  *
56
- * this.setState({ tree: updatedTree });
57
- * }
58
- * }
59
- * getClueClassName(event) {
60
- * const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
61
- * const itemIndex = eventAnalyzer.destinationMeta.itemHierarchicalIndex;
33
+ * ##### targetData? <span class='code'>any[] | null</span>
34
+ * The tree which contains the target item.
35
+ * If the argument is skipped, then the move operation will be executed within the same tree.
36
+ * Setting the `sourceData` and `targetData` arguments to the same tree is also supported.
62
37
  *
63
- * if (eventAnalyzer.isDropAllowed) {
64
- * switch (eventAnalyzer.getDropOperation()) {
65
- * case 'child':
66
- * return 'k-i-plus';
67
- * case 'before':
68
- * return itemIndex === '0' || itemIndex.endsWith(`${SEPARATOR}0`) ?
69
- * 'k-i-insert-up' : 'k-i-insert-middle';
70
- * case 'after':
71
- * const siblings = getSiblings(itemIndex, this.state.tree);
72
- * const lastIndex = Number(itemIndex.split(SEPARATOR).pop());
38
+ * ##### childrenField? <span class='code'>string</span>
39
+ * The field that points to the dataItem sub items. Defaults to `items`.
73
40
  *
74
- * return lastIndex < siblings.length - 1 ? 'k-i-insert-middle' : 'k-i-insert-down';
75
- * default:
76
- * break;
77
- * }
78
- * }
79
- *
80
- * return 'k-i-cancel';
81
- * }
82
- * }
83
- *
84
- * function getSiblings(itemIndex, data) {
85
- * let result = data;
86
- *
87
- * const indices = itemIndex.split(SEPARATOR).map(index => Number(index));
88
- * for (let i = 0; i < indices.length - 1; i++) {
89
- * result = result[indices[i]].items;
90
- * }
91
- *
92
- * return result;
93
- * }
94
- *
95
- * const SEPARATOR = '_';
96
- * const tree = [{
97
- * text: 'Furniture', expanded: true, items: [
98
- * { text: 'Tables & Chairs', expanded: true },
99
- * { text: 'Sofas', expanded: true },
100
- * { text: 'Occasional Furniture', expanded: true }]
101
- * }, {
102
- * text: 'Decor', expanded: true, items: [
103
- * { text: 'Bed Linen', expanded: true },
104
- * { text: 'Curtains & Blinds', expanded: true },
105
- * { text: 'Carpets', expanded: true }]
106
- * }];
107
- *
108
- * ReactDOM.render(<App />, document.querySelector('my-app'));
109
- * ```
41
+ * #### Returns
42
+ * <span class='code'>any[] | { sourceData: any[]; targetData: any[]; }</span> - The updated copies of the `sourceData` and `targetData` input arguments.
43
+ * If `targetData` is not passed, then only the updated copy of the `sourceData` will be returned.
110
44
  */
111
- function moveTreeViewItem(sourceItemHierarchicalIndex, sourceData, operation, targetItemHierarchicalIndex, targetData, childrenField) {
45
+ var moveTreeViewItem = function (sourceItemHierarchicalIndex, sourceData, operation, targetItemHierarchicalIndex, targetData, childrenField) {
112
46
  var subItemsField = childrenField || consts_1.CHILDREN_FIELD;
113
47
  if (!validateInput()) {
114
48
  return prepareInputDataForReturn();
@@ -155,5 +89,5 @@ function moveTreeViewItem(sourceItemHierarchicalIndex, sourceData, operation, ta
155
89
  }
156
90
  return true;
157
91
  }
158
- }
159
- exports.default = moveTreeViewItem;
92
+ };
93
+ exports.moveTreeViewItem = moveTreeViewItem;
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-vue-treeview',
9
9
  productName: 'Kendo UI for Vue',
10
10
  productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
11
- publishDate: 1654589454,
11
+ publishDate: 1655458437,
12
12
  version: '',
13
13
  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'
14
14
  };
@@ -1,51 +1,24 @@
1
1
  import { TreeViewOperationDescriptors } from './TreeViewOperationDescriptors';
2
2
  /**
3
3
  * A helper function which applies the specified operation descriptors to the data.
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 %})
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.
8
+ * {% meta height:350 %}
9
+ * {% embed_file select/selection-update-helper-function/main.vue preview %}
10
+ * {% embed_file select/selection-update-helper-function/main.js %}
11
+ * {% endmeta %}
11
12
  *
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
- * }
13
+ * #### Parameters
14
+ * ##### data <span class='code'>any[] | null | undefined</span>
15
+ * The data that will be processed.
34
16
  *
35
- * const tree = [{
36
- * text: 'Item1',
37
- * items: [
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
- * }];
17
+ * ##### operations <span class='code'>[TreeViewOperationDescriptors]({% slug api_treeview_treeviewoperationdescriptors %})</span>
18
+ * The operation descriptors that will be applied to the data.
47
19
  *
48
- * ReactDOM.render(<App />, document.querySelector('my-app'));
49
- * ```
20
+ * #### Returns
21
+ * <span class='code'>any[]</span> - The processed copy of the input data.
50
22
  */
51
- export default function processTreeViewItems(data: any[] | null | undefined, operations: TreeViewOperationDescriptors): any[];
23
+ declare const processTreeViewItems: (data: any[] | null | undefined, operations: TreeViewOperationDescriptors) => any[];
24
+ export { processTreeViewItems };
@@ -12,59 +12,32 @@ var __assign = (this && this.__assign) || function () {
12
12
  return __assign.apply(this, arguments);
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.processTreeViewItems = void 0;
15
16
  var itemUtils_1 = require("./utils/itemUtils");
16
17
  var consts_1 = require("./utils/consts");
17
18
  var misc_1 = require("./utils/misc");
18
19
  /**
19
20
  * A helper function which applies the specified operation descriptors to the data.
20
- * * [Expanding and collapsing items]({% slug expansion_ways_treeview %}#toc-using-a-helper-function)
21
- * * [Selecting and deselecting items]({% slug selection_ways_treeview %}#toc-using-a-helper-function)
22
- * * [Checking and unchecking items]({% slug check_helper_funcs_treeview %})
21
+ * [Expanding and collapsing items]({% slug expansion_ways_treeview %}#toc-using-a-helper-function)
22
+ * [Selecting and deselecting items]({% slug selection_ways_treeview %}#toc-using-a-helper-function)
23
+ * [Checking and unchecking items]({% slug check_helper_funcs_treeview %})
23
24
  *
24
- * @param data - The data that will be processed.
25
- * @param operations - The operation descriptors that will be applied to the data.
26
- * @returns - The processed copy of the input data.
25
+ * {% meta height:350 %}
26
+ * {% embed_file select/selection-update-helper-function/main.vue preview %}
27
+ * {% embed_file select/selection-update-helper-function/main.js %}
28
+ * {% endmeta %}
27
29
  *
28
- * @example
29
- * ```jsx
30
- * class App extends React.Component {
31
- * state = { items: tree, expand: [], select: [], check: [] };
32
- * render() {
33
- * const { expand, select, check } = this.state;
34
- * return (
35
- * <TreeView
36
- * data={processTreeViewItems(this.state.items, { expand, select, check })}
37
- * expandIcons={true} onExpandChange={this.onExpandChange} checkboxes={true}
38
- * onCheckChange={event => this.setState({ check: [ event.itemHierarchicalIndex ] })}
39
- * onItemClick={event => this.setState({ select: [ event.itemHierarchicalIndex ] })}
40
- * />
41
- * );
42
- * }
43
- * onExpandChange = (event) => {
44
- * let expand = this.state.expand.slice();
45
- * const index = expand.indexOf(event.itemHierarchicalIndex);
46
- * index === -1 ? expand.push(event.itemHierarchicalIndex) : expand.splice(index, 1);
47
- * this.setState({ expand });
48
- * }
49
- * }
30
+ * #### Parameters
31
+ * ##### data <span class='code'>any[] | null | undefined</span>
32
+ * The data that will be processed.
50
33
  *
51
- * const tree = [{
52
- * text: 'Item1',
53
- * items: [
54
- * { text: 'Item1.1' },
55
- * { text: 'Item1.2' },
56
- * { text: 'Item1.3', items: [{ text: 'Item1.3.1' }] }]
57
- * }, {
58
- * text: 'Item2', disabled: true,
59
- * items: [{ text: 'Item2.1' }, { text: 'Item2.2' }, { text: 'Item2.3' }]
60
- * }, {
61
- * text: 'Item3'
62
- * }];
34
+ * ##### operations <span class='code'>[TreeViewOperationDescriptors]({% slug api_treeview_treeviewoperationdescriptors %})</span>
35
+ * The operation descriptors that will be applied to the data.
63
36
  *
64
- * ReactDOM.render(<App />, document.querySelector('my-app'));
65
- * ```
37
+ * #### Returns
38
+ * <span class='code'>any[]</span> - The processed copy of the input data.
66
39
  */
67
- function processTreeViewItems(data, operations) {
40
+ var processTreeViewItems = function (data, operations) {
68
41
  if (!data || !data.length) {
69
42
  return [];
70
43
  }
@@ -79,8 +52,8 @@ function processTreeViewItems(data, operations) {
79
52
  result = handleOperation(result, checkField, operations.check, cloneField, childrenField);
80
53
  applyCheckIndeterminate(result, childrenField, operations.check);
81
54
  return result;
82
- }
83
- exports.default = processTreeViewItems;
55
+ };
56
+ exports.processTreeViewItems = processTreeViewItems;
84
57
  function handleOperation(items, defaultField, operation, cloneField, childrenField) {
85
58
  if (operation) {
86
59
  var _a = parseOperation(operation, defaultField), ids = _a.ids, field = _a.field;
@@ -4,8 +4,6 @@ var PROPS_COUNT_LIMIT = 50000;
4
4
  /**
5
5
  * @hidden
6
6
  */
7
- // An alternative is to use array.sort() and
8
- // implement a binary search function.
9
7
  var SortedPublicItemIds = /** @class */ (function () {
10
8
  function SortedPublicItemIds() {
11
9
  this.objects = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-vue-treeview",
3
- "version": "3.3.4",
3
+ "version": "3.3.6-dev.202206170937",
4
4
  "description": "Kendo Ui for Vue TreeView package",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,14 +34,14 @@
34
34
  "vue": "^2.6.12 || ^3.0.2"
35
35
  },
36
36
  "dependencies": {
37
- "@progress/kendo-vue-common": "3.3.4"
37
+ "@progress/kendo-vue-common": "3.3.6-dev.202206170937"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@progress/kendo-licensing": "^1.0.1",
41
- "@progress/kendo-vue-animation": "3.3.4",
42
- "@progress/kendo-vue-dropdowns": "3.3.4",
43
- "@progress/kendo-vue-inputs": "3.3.4",
44
- "@progress/kendo-vue-intl": "3.3.4"
41
+ "@progress/kendo-vue-animation": "3.3.6-dev.202206170937",
42
+ "@progress/kendo-vue-dropdowns": "3.3.6-dev.202206170937",
43
+ "@progress/kendo-vue-inputs": "3.3.6-dev.202206170937",
44
+ "@progress/kendo-vue-intl": "3.3.6-dev.202206170937"
45
45
  },
46
46
  "@progress": {
47
47
  "friendlyName": "TreeView",