@progress/kendo-vue-treelist 5.3.0-dev.202410141143 → 5.3.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.
- package/README.md +26 -34
- package/TreeList.js +8 -0
- package/TreeList.mjs +722 -0
- package/TreeListNav.js +8 -0
- package/TreeListNav.mjs +98 -0
- package/cells/EditCells/TreeListBooleanEditor.js +8 -0
- package/cells/EditCells/TreeListBooleanEditor.mjs +154 -0
- package/cells/EditCells/TreeListDateEditor.js +8 -0
- package/cells/EditCells/TreeListDateEditor.mjs +140 -0
- package/cells/EditCells/TreeListNumericEditor.js +8 -0
- package/cells/EditCells/TreeListNumericEditor.mjs +140 -0
- package/cells/EditCells/TreeListTextEditor.js +8 -0
- package/cells/EditCells/TreeListTextEditor.mjs +157 -0
- package/cells/FilterCells/TreeListBooleanFilter.js +8 -0
- package/cells/FilterCells/TreeListBooleanFilter.mjs +54 -0
- package/cells/FilterCells/TreeListDateFilter.js +8 -0
- package/cells/FilterCells/TreeListDateFilter.mjs +54 -0
- package/cells/FilterCells/TreeListNumericFilter.js +8 -0
- package/cells/FilterCells/TreeListNumericFilter.mjs +54 -0
- package/cells/FilterCells/TreeListTextFilter.js +8 -0
- package/cells/FilterCells/TreeListTextFilter.mjs +54 -0
- package/cells/FilterCells/utils.js +8 -0
- package/cells/FilterCells/utils.mjs +59 -0
- package/cells/TreeListCell.js +8 -0
- package/cells/TreeListCell.mjs +184 -0
- package/cells/TreeListSelectionCell.js +8 -0
- package/cells/TreeListSelectionCell.mjs +146 -0
- package/constants/main.js +8 -0
- package/constants/main.mjs +14 -0
- package/dist/cdn/js/kendo-vue-treelist.js +8 -1
- package/index.d.mts +1814 -0
- package/index.d.ts +1814 -0
- package/index.js +8 -0
- package/index.mjs +58 -0
- package/messages/main.js +8 -0
- package/messages/main.mjs +112 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +18 -0
- package/package.json +24 -61
- package/rows/RowDragClue.js +8 -0
- package/rows/RowDragClue.mjs +56 -0
- package/rows/TreeListDraggableRow.js +8 -0
- package/rows/TreeListDraggableRow.mjs +113 -0
- package/rows/TreeListRow.js +8 -0
- package/rows/TreeListRow.mjs +124 -0
- package/utils/data-operations.js +8 -0
- package/utils/data-operations.mjs +103 -0
- package/utils/main.js +8 -0
- package/utils/main.mjs +53 -0
- package/dist/es/ScrollMode.d.ts +0 -1
- package/dist/es/ScrollMode.js +0 -1
- package/dist/es/TreeList.d.ts +0 -56
- package/dist/es/TreeList.js +0 -1289
- package/dist/es/TreeListNav.d.ts +0 -46
- package/dist/es/TreeListNav.js +0 -123
- package/dist/es/additionalTypes.ts +0 -21
- package/dist/es/cells/EditCells/TreeListBooleanEditor.d.ts +0 -49
- package/dist/es/cells/EditCells/TreeListBooleanEditor.js +0 -194
- package/dist/es/cells/EditCells/TreeListDateEditor.d.ts +0 -49
- package/dist/es/cells/EditCells/TreeListDateEditor.js +0 -174
- package/dist/es/cells/EditCells/TreeListNumericEditor.d.ts +0 -49
- package/dist/es/cells/EditCells/TreeListNumericEditor.js +0 -174
- package/dist/es/cells/EditCells/TreeListTextEditor.d.ts +0 -50
- package/dist/es/cells/EditCells/TreeListTextEditor.js +0 -190
- package/dist/es/cells/FilterCells/TreeListBooleanFilter.d.ts +0 -22
- package/dist/es/cells/FilterCells/TreeListBooleanFilter.js +0 -89
- package/dist/es/cells/FilterCells/TreeListDateFilter.d.ts +0 -22
- package/dist/es/cells/FilterCells/TreeListDateFilter.js +0 -89
- package/dist/es/cells/FilterCells/TreeListNumericFilter.d.ts +0 -22
- package/dist/es/cells/FilterCells/TreeListNumericFilter.js +0 -89
- package/dist/es/cells/FilterCells/TreeListTextFilter.d.ts +0 -25
- package/dist/es/cells/FilterCells/TreeListTextFilter.js +0 -89
- package/dist/es/cells/FilterCells/utils.d.ts +0 -38
- package/dist/es/cells/FilterCells/utils.js +0 -66
- package/dist/es/cells/TreeListCell.d.ts +0 -41
- package/dist/es/cells/TreeListCell.js +0 -256
- package/dist/es/cells/TreeListSelectionCell.d.ts +0 -41
- package/dist/es/cells/TreeListSelectionCell.js +0 -181
- package/dist/es/constants/main.d.ts +0 -6
- package/dist/es/constants/main.js +0 -7
- package/dist/es/interfaces/DataItemWrapper.d.ts +0 -10
- package/dist/es/interfaces/DataItemWrapper.js +0 -1
- package/dist/es/interfaces/TreeListCellProps.d.ts +0 -35
- package/dist/es/interfaces/TreeListCellProps.js +0 -1
- package/dist/es/interfaces/TreeListColumnProps.d.ts +0 -33
- package/dist/es/interfaces/TreeListColumnProps.js +0 -1
- package/dist/es/interfaces/TreeListFilterCellProps.d.ts +0 -6
- package/dist/es/interfaces/TreeListFilterCellProps.js +0 -1
- package/dist/es/interfaces/TreeListFilterOperator.d.ts +0 -6
- package/dist/es/interfaces/TreeListFilterOperator.js +0 -1
- package/dist/es/interfaces/TreeListHeaderCellProps.d.ts +0 -6
- package/dist/es/interfaces/TreeListHeaderCellProps.js +0 -1
- package/dist/es/interfaces/TreeListProps.d.ts +0 -345
- package/dist/es/interfaces/TreeListProps.js +0 -1
- package/dist/es/interfaces/TreeListRowProps.d.ts +0 -92
- package/dist/es/interfaces/TreeListRowProps.js +0 -1
- package/dist/es/interfaces/TreeListSelectableSettings.d.ts +0 -18
- package/dist/es/interfaces/TreeListSelectableSettings.js +0 -1
- package/dist/es/interfaces/TreeListSortSettings.d.ts +0 -9
- package/dist/es/interfaces/TreeListSortSettings.js +0 -1
- package/dist/es/interfaces/TreeListToolbarProps.d.ts +0 -5
- package/dist/es/interfaces/TreeListToolbarProps.js +0 -1
- package/dist/es/interfaces/events.d.ts +0 -286
- package/dist/es/interfaces/events.js +0 -1
- package/dist/es/main.d.ts +0 -27
- package/dist/es/main.js +0 -17
- package/dist/es/messages/main.d.ts +0 -239
- package/dist/es/messages/main.js +0 -240
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/rows/RowDragClue.d.ts +0 -40
- package/dist/es/rows/RowDragClue.js +0 -76
- package/dist/es/rows/TreeListDraggableRow.d.ts +0 -38
- package/dist/es/rows/TreeListDraggableRow.js +0 -175
- package/dist/es/rows/TreeListRow.d.ts +0 -36
- package/dist/es/rows/TreeListRow.js +0 -154
- package/dist/es/utils/data-operations.d.ts +0 -115
- package/dist/es/utils/data-operations.js +0 -250
- package/dist/es/utils/main.d.ts +0 -17
- package/dist/es/utils/main.js +0 -68
- package/dist/esm/ScrollMode.d.ts +0 -1
- package/dist/esm/ScrollMode.js +0 -1
- package/dist/esm/TreeList.d.ts +0 -56
- package/dist/esm/TreeList.js +0 -1289
- package/dist/esm/TreeListNav.d.ts +0 -46
- package/dist/esm/TreeListNav.js +0 -123
- package/dist/esm/additionalTypes.ts +0 -21
- package/dist/esm/cells/EditCells/TreeListBooleanEditor.d.ts +0 -49
- package/dist/esm/cells/EditCells/TreeListBooleanEditor.js +0 -194
- package/dist/esm/cells/EditCells/TreeListDateEditor.d.ts +0 -49
- package/dist/esm/cells/EditCells/TreeListDateEditor.js +0 -174
- package/dist/esm/cells/EditCells/TreeListNumericEditor.d.ts +0 -49
- package/dist/esm/cells/EditCells/TreeListNumericEditor.js +0 -174
- package/dist/esm/cells/EditCells/TreeListTextEditor.d.ts +0 -50
- package/dist/esm/cells/EditCells/TreeListTextEditor.js +0 -190
- package/dist/esm/cells/FilterCells/TreeListBooleanFilter.d.ts +0 -22
- package/dist/esm/cells/FilterCells/TreeListBooleanFilter.js +0 -89
- package/dist/esm/cells/FilterCells/TreeListDateFilter.d.ts +0 -22
- package/dist/esm/cells/FilterCells/TreeListDateFilter.js +0 -89
- package/dist/esm/cells/FilterCells/TreeListNumericFilter.d.ts +0 -22
- package/dist/esm/cells/FilterCells/TreeListNumericFilter.js +0 -89
- package/dist/esm/cells/FilterCells/TreeListTextFilter.d.ts +0 -25
- package/dist/esm/cells/FilterCells/TreeListTextFilter.js +0 -89
- package/dist/esm/cells/FilterCells/utils.d.ts +0 -38
- package/dist/esm/cells/FilterCells/utils.js +0 -66
- package/dist/esm/cells/TreeListCell.d.ts +0 -41
- package/dist/esm/cells/TreeListCell.js +0 -256
- package/dist/esm/cells/TreeListSelectionCell.d.ts +0 -41
- package/dist/esm/cells/TreeListSelectionCell.js +0 -181
- package/dist/esm/constants/main.d.ts +0 -6
- package/dist/esm/constants/main.js +0 -7
- package/dist/esm/interfaces/DataItemWrapper.d.ts +0 -10
- package/dist/esm/interfaces/DataItemWrapper.js +0 -1
- package/dist/esm/interfaces/TreeListCellProps.d.ts +0 -35
- package/dist/esm/interfaces/TreeListCellProps.js +0 -1
- package/dist/esm/interfaces/TreeListColumnProps.d.ts +0 -33
- package/dist/esm/interfaces/TreeListColumnProps.js +0 -1
- package/dist/esm/interfaces/TreeListFilterCellProps.d.ts +0 -6
- package/dist/esm/interfaces/TreeListFilterCellProps.js +0 -1
- package/dist/esm/interfaces/TreeListFilterOperator.d.ts +0 -6
- package/dist/esm/interfaces/TreeListFilterOperator.js +0 -1
- package/dist/esm/interfaces/TreeListHeaderCellProps.d.ts +0 -6
- package/dist/esm/interfaces/TreeListHeaderCellProps.js +0 -1
- package/dist/esm/interfaces/TreeListProps.d.ts +0 -345
- package/dist/esm/interfaces/TreeListProps.js +0 -1
- package/dist/esm/interfaces/TreeListRowProps.d.ts +0 -92
- package/dist/esm/interfaces/TreeListRowProps.js +0 -1
- package/dist/esm/interfaces/TreeListSelectableSettings.d.ts +0 -18
- package/dist/esm/interfaces/TreeListSelectableSettings.js +0 -1
- package/dist/esm/interfaces/TreeListSortSettings.d.ts +0 -9
- package/dist/esm/interfaces/TreeListSortSettings.js +0 -1
- package/dist/esm/interfaces/TreeListToolbarProps.d.ts +0 -5
- package/dist/esm/interfaces/TreeListToolbarProps.js +0 -1
- package/dist/esm/interfaces/events.d.ts +0 -286
- package/dist/esm/interfaces/events.js +0 -1
- package/dist/esm/main.d.ts +0 -27
- package/dist/esm/main.js +0 -17
- package/dist/esm/messages/main.d.ts +0 -239
- package/dist/esm/messages/main.js +0 -240
- package/dist/esm/package-metadata.d.ts +0 -5
- package/dist/esm/package-metadata.js +0 -11
- package/dist/esm/package.json +0 -3
- package/dist/esm/rows/RowDragClue.d.ts +0 -40
- package/dist/esm/rows/RowDragClue.js +0 -76
- package/dist/esm/rows/TreeListDraggableRow.d.ts +0 -38
- package/dist/esm/rows/TreeListDraggableRow.js +0 -175
- package/dist/esm/rows/TreeListRow.d.ts +0 -36
- package/dist/esm/rows/TreeListRow.js +0 -154
- package/dist/esm/utils/data-operations.d.ts +0 -115
- package/dist/esm/utils/data-operations.js +0 -250
- package/dist/esm/utils/main.d.ts +0 -17
- package/dist/esm/utils/main.js +0 -68
- package/dist/npm/ScrollMode.d.ts +0 -1
- package/dist/npm/ScrollMode.js +0 -2
- package/dist/npm/TreeList.d.ts +0 -56
- package/dist/npm/TreeList.js +0 -1296
- package/dist/npm/TreeListNav.d.ts +0 -46
- package/dist/npm/TreeListNav.js +0 -130
- package/dist/npm/additionalTypes.ts +0 -21
- package/dist/npm/cells/EditCells/TreeListBooleanEditor.d.ts +0 -49
- package/dist/npm/cells/EditCells/TreeListBooleanEditor.js +0 -201
- package/dist/npm/cells/EditCells/TreeListDateEditor.d.ts +0 -49
- package/dist/npm/cells/EditCells/TreeListDateEditor.js +0 -181
- package/dist/npm/cells/EditCells/TreeListNumericEditor.d.ts +0 -49
- package/dist/npm/cells/EditCells/TreeListNumericEditor.js +0 -181
- package/dist/npm/cells/EditCells/TreeListTextEditor.d.ts +0 -50
- package/dist/npm/cells/EditCells/TreeListTextEditor.js +0 -197
- package/dist/npm/cells/FilterCells/TreeListBooleanFilter.d.ts +0 -22
- package/dist/npm/cells/FilterCells/TreeListBooleanFilter.js +0 -96
- package/dist/npm/cells/FilterCells/TreeListDateFilter.d.ts +0 -22
- package/dist/npm/cells/FilterCells/TreeListDateFilter.js +0 -96
- package/dist/npm/cells/FilterCells/TreeListNumericFilter.d.ts +0 -22
- package/dist/npm/cells/FilterCells/TreeListNumericFilter.js +0 -96
- package/dist/npm/cells/FilterCells/TreeListTextFilter.d.ts +0 -25
- package/dist/npm/cells/FilterCells/TreeListTextFilter.js +0 -96
- package/dist/npm/cells/FilterCells/utils.d.ts +0 -38
- package/dist/npm/cells/FilterCells/utils.js +0 -70
- package/dist/npm/cells/TreeListCell.d.ts +0 -41
- package/dist/npm/cells/TreeListCell.js +0 -263
- package/dist/npm/cells/TreeListSelectionCell.d.ts +0 -41
- package/dist/npm/cells/TreeListSelectionCell.js +0 -188
- package/dist/npm/constants/main.d.ts +0 -6
- package/dist/npm/constants/main.js +0 -10
- package/dist/npm/interfaces/DataItemWrapper.d.ts +0 -10
- package/dist/npm/interfaces/DataItemWrapper.js +0 -2
- package/dist/npm/interfaces/TreeListCellProps.d.ts +0 -35
- package/dist/npm/interfaces/TreeListCellProps.js +0 -2
- package/dist/npm/interfaces/TreeListColumnProps.d.ts +0 -33
- package/dist/npm/interfaces/TreeListColumnProps.js +0 -2
- package/dist/npm/interfaces/TreeListFilterCellProps.d.ts +0 -6
- package/dist/npm/interfaces/TreeListFilterCellProps.js +0 -2
- package/dist/npm/interfaces/TreeListFilterOperator.d.ts +0 -6
- package/dist/npm/interfaces/TreeListFilterOperator.js +0 -2
- package/dist/npm/interfaces/TreeListHeaderCellProps.d.ts +0 -6
- package/dist/npm/interfaces/TreeListHeaderCellProps.js +0 -2
- package/dist/npm/interfaces/TreeListProps.d.ts +0 -345
- package/dist/npm/interfaces/TreeListProps.js +0 -2
- package/dist/npm/interfaces/TreeListRowProps.d.ts +0 -92
- package/dist/npm/interfaces/TreeListRowProps.js +0 -2
- package/dist/npm/interfaces/TreeListSelectableSettings.d.ts +0 -18
- package/dist/npm/interfaces/TreeListSelectableSettings.js +0 -2
- package/dist/npm/interfaces/TreeListSortSettings.d.ts +0 -9
- package/dist/npm/interfaces/TreeListSortSettings.js +0 -2
- package/dist/npm/interfaces/TreeListToolbarProps.d.ts +0 -5
- package/dist/npm/interfaces/TreeListToolbarProps.js +0 -5
- package/dist/npm/interfaces/events.d.ts +0 -286
- package/dist/npm/interfaces/events.js +0 -2
- package/dist/npm/main.d.ts +0 -27
- package/dist/npm/main.js +0 -52
- package/dist/npm/messages/main.d.ts +0 -239
- package/dist/npm/messages/main.js +0 -244
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/rows/RowDragClue.d.ts +0 -40
- package/dist/npm/rows/RowDragClue.js +0 -83
- package/dist/npm/rows/TreeListDraggableRow.d.ts +0 -38
- package/dist/npm/rows/TreeListDraggableRow.js +0 -182
- package/dist/npm/rows/TreeListRow.d.ts +0 -36
- package/dist/npm/rows/TreeListRow.js +0 -161
- package/dist/npm/utils/data-operations.d.ts +0 -115
- package/dist/npm/utils/data-operations.js +0 -265
- package/dist/npm/utils/main.d.ts +0 -17
- package/dist/npm/utils/main.js +0 -74
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
|
-
import { getNestedValue } from './main';
|
|
22
|
-
import { filterBy as filterByCommon, orderBy as orderByCommon } from '@progress/kendo-vue-data-tools';
|
|
23
|
-
import { mapTree as mapTreeCommon, mapTreeItem as mapTreeItemCommon, extendDataItem as extendDataItemCommon, getItemPath as getItemPathCommon } from '@progress/kendo-vue-common';
|
|
24
|
-
/**
|
|
25
|
-
* Orders the specified tree according to the provided sort descriptors.
|
|
26
|
-
*
|
|
27
|
-
* @param {T[]} data - The data that will be sorted.
|
|
28
|
-
* @param {SortDescriptor[]} descriptors - The descriptors by which the data will be sorted.
|
|
29
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
30
|
-
* @returns {T[]} - The sorted data.
|
|
31
|
-
*/
|
|
32
|
-
export function orderBy(data, descriptors, subItemsField) {
|
|
33
|
-
return orderByCommon(data, descriptors, subItemsField);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Filters the provided data tree according to the specified `Array<FilterDescriptor|CompositeFilterDescriptor>`.
|
|
37
|
-
*
|
|
38
|
-
* @param {T[]} data - The data that will be filtered.
|
|
39
|
-
* @param {FilterDescriptor[]|CompositeFilterDescriptor[]} descriptors - The filter criteria that will be applied.
|
|
40
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
41
|
-
* @returns {T[]} - The filtered data.
|
|
42
|
-
*/
|
|
43
|
-
export function filterBy(data, descriptors, subItemsField) {
|
|
44
|
-
return filterByCommon(data, descriptors, subItemsField);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Creates a new array with the results of calling the provided callback function
|
|
48
|
-
* on every element in the provided data tree.
|
|
49
|
-
*
|
|
50
|
-
* @param {any[]} tree - The data tree.
|
|
51
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
52
|
-
* @param {(value: any) => any} callback - The callback function.
|
|
53
|
-
* @returns {any[]} - The new data tree.
|
|
54
|
-
*/
|
|
55
|
-
export var mapTree = function (tree, subItemsField, callback) {
|
|
56
|
-
return mapTreeCommon(tree, subItemsField, callback);
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Creates a new array with the results of calling the provided callback function
|
|
60
|
-
* on the element which match the `level` in the provided data tree.
|
|
61
|
-
*
|
|
62
|
-
* @param {any[]} tree - The data tree.
|
|
63
|
-
* @param {number[]} level - An array of indexes of each parent and current item in the data tree.
|
|
64
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
65
|
-
* @param {(value: any) => any} callback - The callback function.
|
|
66
|
-
* @returns {any[]} - The new data tree.
|
|
67
|
-
*/
|
|
68
|
-
export var mapTreeItem = function (tree, level, subItemsField, callback) {
|
|
69
|
-
return mapTreeItemCommon(tree, level, subItemsField, callback);
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* @hidden
|
|
73
|
-
*/
|
|
74
|
-
export function flatData(data, getChildren, itemMap) {
|
|
75
|
-
var stack = [];
|
|
76
|
-
var flatted = [];
|
|
77
|
-
// we start from end as push() improves performance by up to 50%
|
|
78
|
-
for (var i = data.length - 1; i >= 0; i--) {
|
|
79
|
-
var root = data[i];
|
|
80
|
-
stack.push({
|
|
81
|
-
root: root,
|
|
82
|
-
data: getChildren(root),
|
|
83
|
-
level: [i],
|
|
84
|
-
levelCount: data.length
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
while (stack.length > 0) {
|
|
88
|
-
var stackItem = stack.pop();
|
|
89
|
-
flatted.push(__assign(__assign({ dataItem: stackItem.root, level: __spreadArray([], stackItem.level, true) }, itemMap(stackItem.root)), { levelCount: stackItem.levelCount }));
|
|
90
|
-
if (stackItem.data.length) {
|
|
91
|
-
for (var i = stackItem.data.length - 1; i >= 0; i--) {
|
|
92
|
-
var root = stackItem.data[i];
|
|
93
|
-
stack.push({
|
|
94
|
-
root: root,
|
|
95
|
-
data: getChildren(root),
|
|
96
|
-
level: __spreadArray(__spreadArray([], stackItem.level, true), [i], false),
|
|
97
|
-
levelCount: stackItem.data.length
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return flatted;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Creates a flat data array from the passed tree dataset.
|
|
106
|
-
*
|
|
107
|
-
* @param {object[]} dataset - The source dataset of data items.
|
|
108
|
-
* @param {string} expandField - The field which points to the expanded value of each data item.
|
|
109
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
110
|
-
* @returns {object[]} - A collection of the generated data items that are in a flat structure.
|
|
111
|
-
*/
|
|
112
|
-
export var treeToFlat = function (data, expandField, subItemsField) {
|
|
113
|
-
var expanded = function (dataItem) { return Boolean(getNestedValue(expandField, dataItem)); };
|
|
114
|
-
var hasChildren = function (dataItem) { return Boolean(getNestedValue(subItemsField, dataItem)); };
|
|
115
|
-
var getChildren = function (dataItem) {
|
|
116
|
-
var items = [];
|
|
117
|
-
if (expanded(dataItem) && hasChildren(dataItem)) {
|
|
118
|
-
items.push.apply(items, getNestedValue(subItemsField, dataItem));
|
|
119
|
-
}
|
|
120
|
-
return items;
|
|
121
|
-
};
|
|
122
|
-
var flatItems = function (dataItem, flatted, level) {
|
|
123
|
-
flatted.push(__assign(__assign({}, dataItem), { level: level }));
|
|
124
|
-
getChildren(dataItem).forEach(function (root) { return flatItems(root, flatted, level + 1); });
|
|
125
|
-
};
|
|
126
|
-
var flattedData = [];
|
|
127
|
-
data.forEach(function (root) { return flatItems(root, flattedData, 0); });
|
|
128
|
-
return flattedData;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Creates a tree from the passed dataset.
|
|
132
|
-
*
|
|
133
|
-
* @param {object[]} dataset - The source dataset of data items.
|
|
134
|
-
* @param {(item: object) => any} getId - A function which will return the id of the data item.
|
|
135
|
-
* @param {(item: object) => any} getParentId - A function which will return the data item id of its parent data item.
|
|
136
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
137
|
-
* @returns {object[]} - A collection of the generated data items that are structured in a tree.
|
|
138
|
-
*/
|
|
139
|
-
export var createDataTree = function (dataset, getId, getParentId, subItemsField) {
|
|
140
|
-
var hashTable = {}, dataTree = [], parentItem;
|
|
141
|
-
dataset.forEach(function (dataItem) { return hashTable[getId(dataItem)] = __assign({}, dataItem); });
|
|
142
|
-
dataset.forEach(function (dataItem) {
|
|
143
|
-
parentItem = hashTable[getParentId(dataItem)];
|
|
144
|
-
if (parentItem) {
|
|
145
|
-
parentItem[subItemsField] = parentItem[subItemsField] || [];
|
|
146
|
-
parentItem[subItemsField].push(hashTable[getId(dataItem)]);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
dataTree.push(hashTable[getId(dataItem)]);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
return dataTree;
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* Similar to the `Object.assign` function. Additionally, creates a new array for the subitems.
|
|
156
|
-
*
|
|
157
|
-
* @param {object} item - The source data item.
|
|
158
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
159
|
-
* @param {object} propsToExtend - The props with which the source data item will be extended.
|
|
160
|
-
* @returns {object} - The target data item.
|
|
161
|
-
*/
|
|
162
|
-
export var extendDataItem = function (item, subItemsField, propsToExtend) {
|
|
163
|
-
return extendDataItemCommon(item, subItemsField, propsToExtend);
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Removes the items from the passed `data` which match the passed `condition`.
|
|
167
|
-
*
|
|
168
|
-
* @param {any[]} data - The data tree.
|
|
169
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
170
|
-
* @param {(item: object) => Boolean} condition - A function that will be executed for each data item
|
|
171
|
-
* in the tree data and the items for which returns true will be removed.
|
|
172
|
-
* @returns {any[]} - The new data tree.
|
|
173
|
-
*/
|
|
174
|
-
export var removeItems = function (data, subItemsField, condition) {
|
|
175
|
-
var _a;
|
|
176
|
-
var newData = mapTree([(_a = {}, _a[subItemsField] = __spreadArray([], data, true), _a)], subItemsField, function (item) { return removeChild(item, condition, subItemsField); });
|
|
177
|
-
return __spreadArray([], newData[0][subItemsField], true);
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* @hidden
|
|
181
|
-
*/
|
|
182
|
-
var removeChild = function (item, condition, subItemsField) {
|
|
183
|
-
var _a;
|
|
184
|
-
var subItems = item[subItemsField] || [];
|
|
185
|
-
var childIndex = subItems.findIndex(condition);
|
|
186
|
-
if (childIndex !== -1) {
|
|
187
|
-
var newChildren = __spreadArray([], subItems, true);
|
|
188
|
-
newChildren.splice(childIndex, 1);
|
|
189
|
-
return __assign(__assign({}, item), (_a = {}, _a[subItemsField] = newChildren, _a));
|
|
190
|
-
}
|
|
191
|
-
return item;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Changes the `subItems` collection of each data item which matches the passed `condition`.
|
|
195
|
-
*
|
|
196
|
-
* @param {any[]} data - The data tree.
|
|
197
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
198
|
-
* @param {(item: object) => Boolean} condition - A function that will be executed for each data item and
|
|
199
|
-
* will return `true` for items that have to change the subitems collection.
|
|
200
|
-
* @param {(subItems: object[]) => object[]} change - A function which
|
|
201
|
-
* has as a parameter the subitems collection of the matched items and which will return the new subitems collection.
|
|
202
|
-
* @returns {any[]} - The new data tree.
|
|
203
|
-
*/
|
|
204
|
-
export var modifySubItems = function (data, subItemsField, condition, change) {
|
|
205
|
-
return mapTree(data, subItemsField, function (item) {
|
|
206
|
-
var _a;
|
|
207
|
-
return condition(item) ? __assign(__assign({}, item), (_a = {}, _a[subItemsField] = change(item[subItemsField] || []), _a)) :
|
|
208
|
-
item;
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* Returns the data item path in the tree based on the level parameter.
|
|
213
|
-
*
|
|
214
|
-
* @param {any[]} tree - The data tree.
|
|
215
|
-
* @param {number[]} level - The level of the target tree item.
|
|
216
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
217
|
-
* @returns {any[]} - The path of the data item.
|
|
218
|
-
*/
|
|
219
|
-
export var getItemPath = function (tree, level, subItemsField) {
|
|
220
|
-
return getItemPathCommon(tree, level, subItemsField);
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* Moves the targeted item in the tree to another position.
|
|
224
|
-
*
|
|
225
|
-
* @param {any[]} data - The data tree.
|
|
226
|
-
* @param {number[]} target - The level of the target tree item which will be moved.
|
|
227
|
-
* @param {number[] | null} destination - The level of the destination tree item where the target item will be moved in.
|
|
228
|
-
* If it is null, the target item will be added at the root level.
|
|
229
|
-
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
|
|
230
|
-
* @returns {any[]} - The new data tree.
|
|
231
|
-
*/
|
|
232
|
-
export var moveTreeItem = function (data, target, destination, subItemsField) {
|
|
233
|
-
var tree = __spreadArray([], data, true);
|
|
234
|
-
var targetItemPath = getItemPath(tree, target, subItemsField);
|
|
235
|
-
var targetItem = targetItemPath.pop();
|
|
236
|
-
var targetParent = targetItemPath.pop();
|
|
237
|
-
var targetItemIndex = target[target.length - 1];
|
|
238
|
-
if (destination) {
|
|
239
|
-
var destinationItemPath = getItemPath(tree, destination, subItemsField);
|
|
240
|
-
var destinationItem = destinationItemPath.pop();
|
|
241
|
-
(targetParent ? targetParent[subItemsField] : tree).splice(targetItemIndex, 1);
|
|
242
|
-
destinationItem[subItemsField] = destinationItem[subItemsField] || [];
|
|
243
|
-
destinationItem[subItemsField].push(targetItem);
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
(targetParent ? targetParent[subItemsField] : tree).splice(targetItemIndex, 1);
|
|
247
|
-
tree.push(targetItem);
|
|
248
|
-
}
|
|
249
|
-
return tree;
|
|
250
|
-
};
|
package/dist/es/utils/main.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DataItemWrapper } from '../interfaces/DataItemWrapper';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
*/
|
|
5
|
-
export declare function getNestedValue(fieldName: string | undefined, dataItem: any): any;
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
export declare function setHeaderRowsTop(table: HTMLTableElement, toolbarHeight: number, rowHeight?: (row: HTMLTableRowElement) => string | undefined): void;
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export declare function tableRowsVirtualization(args: {
|
|
14
|
-
rows: DataItemWrapper[];
|
|
15
|
-
tableViewPortHeight: number;
|
|
16
|
-
scrollTop: number;
|
|
17
|
-
}): DataItemWrapper[];
|
package/dist/es/utils/main.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @hidden
|
|
3
|
-
*/
|
|
4
|
-
export function getNestedValue(fieldName, dataItem) {
|
|
5
|
-
var path = (fieldName || '').split('.');
|
|
6
|
-
var data = dataItem;
|
|
7
|
-
path.forEach(function (p) {
|
|
8
|
-
data = data ? data[p] : undefined;
|
|
9
|
-
});
|
|
10
|
-
return data;
|
|
11
|
-
}
|
|
12
|
-
function inPX(value) {
|
|
13
|
-
return value !== undefined && (typeof value === 'number' || /px$/i.test(String(value)));
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
*/
|
|
18
|
-
export function setHeaderRowsTop(table, toolbarHeight, rowHeight) {
|
|
19
|
-
var rows = Array.from(table.tHead && table.tHead.rows || []);
|
|
20
|
-
var heights = [toolbarHeight];
|
|
21
|
-
var height;
|
|
22
|
-
var calculateRowHeight = rowHeight ||
|
|
23
|
-
(function (row) { return window.getComputedStyle(row).height || undefined; });
|
|
24
|
-
rows.forEach(function (row) {
|
|
25
|
-
var computedHeight = calculateRowHeight(row);
|
|
26
|
-
heights.push(inPX(computedHeight) ? parseFloat(String(computedHeight)) : row.offsetHeight);
|
|
27
|
-
});
|
|
28
|
-
for (var i = 0; i < rows.length; i++) {
|
|
29
|
-
height = heights.slice(0, i + 1).reduce(function (acc, curr) { return acc + curr; });
|
|
30
|
-
Array.from(rows[i].cells).forEach(function (c) { return c.style.top = height + 'px'; });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
var MAX_LEVEL = 1000000;
|
|
34
|
-
/**
|
|
35
|
-
* @hidden
|
|
36
|
-
*/
|
|
37
|
-
export function tableRowsVirtualization(args) {
|
|
38
|
-
var rows = args.rows, tableViewPortHeight = args.tableViewPortHeight, scrollTop = args.scrollTop;
|
|
39
|
-
if (rows.length === 0) {
|
|
40
|
-
return [];
|
|
41
|
-
}
|
|
42
|
-
var itemHeight = rows[0].height;
|
|
43
|
-
var scrollItemIndex = Math.min(Math.round(scrollTop / itemHeight), rows.length);
|
|
44
|
-
var itemsOnOneScreen = Math.round(tableViewPortHeight / itemHeight);
|
|
45
|
-
var start = Math.max(0, scrollItemIndex - itemsOnOneScreen);
|
|
46
|
-
var end = Math.min(rows.length, scrollItemIndex + (2 * itemsOnOneScreen));
|
|
47
|
-
var items = rows.slice(start, end);
|
|
48
|
-
var lastItem = items[items.length - 1];
|
|
49
|
-
if (start > 0) {
|
|
50
|
-
items.unshift({
|
|
51
|
-
dataItem: {},
|
|
52
|
-
level: [MAX_LEVEL],
|
|
53
|
-
offsetTop: 0,
|
|
54
|
-
height: items[0].offsetTop,
|
|
55
|
-
levelCount: 0
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
if (end < rows.length - 1) {
|
|
59
|
-
items.push({
|
|
60
|
-
dataItem: {},
|
|
61
|
-
level: [MAX_LEVEL, MAX_LEVEL],
|
|
62
|
-
offsetTop: lastItem.offsetTop + lastItem.height,
|
|
63
|
-
height: (rows.length - end) * itemHeight,
|
|
64
|
-
levelCount: 0
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return items;
|
|
68
|
-
}
|
package/dist/esm/ScrollMode.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare type ScrollMode = 'none' | 'scrollable' | 'virtual';
|
package/dist/esm/ScrollMode.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/esm/TreeList.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
-
declare type DefaultData<V> = object | ((this: V) => TreeListData);
|
|
3
|
-
declare type DefaultMethods<V> = {
|
|
4
|
-
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
-
};
|
|
6
|
-
import { ColumnResize, CommonDragLogic, ExtendedColumnProps } from '@progress/kendo-vue-data-tools';
|
|
7
|
-
import { TreeListProps } from './interfaces/TreeListProps';
|
|
8
|
-
import { DataItemWrapper } from './interfaces/DataItemWrapper';
|
|
9
|
-
import { TreeListColumnProps } from './interfaces/TreeListColumnProps';
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export interface TreeListMethods {
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @hidden
|
|
18
|
-
*/
|
|
19
|
-
export interface TreeListData {
|
|
20
|
-
wrapperScrollLeft: number;
|
|
21
|
-
wrapperScrollTop: number;
|
|
22
|
-
updateOnScroll: boolean;
|
|
23
|
-
tbodyOffsetTop: number;
|
|
24
|
-
prevData: any[];
|
|
25
|
-
prevColumns: TreeListColumnProps[] | undefined;
|
|
26
|
-
flattedData: DataItemWrapper[];
|
|
27
|
-
extendedColumn: ExtendedColumnProps[];
|
|
28
|
-
columnsMap: number[][];
|
|
29
|
-
columnResize: ColumnResize;
|
|
30
|
-
element: HTMLDivElement | null;
|
|
31
|
-
dragLogic: CommonDragLogic;
|
|
32
|
-
_treeListId: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @hidden
|
|
36
|
-
*/
|
|
37
|
-
export interface TreeListState {
|
|
38
|
-
v3: boolean;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @hidden
|
|
42
|
-
*/
|
|
43
|
-
export interface TreeListComputed {
|
|
44
|
-
[key: string]: any;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @hidden
|
|
48
|
-
*/
|
|
49
|
-
export interface TreeListAll extends TreeListMethods, TreeListData, TreeListState, TreeListComputed, TreeListProps, Vue2type {
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @hidden
|
|
53
|
-
*/
|
|
54
|
-
declare let TreeListVue2: ComponentOptions<Vue2type, DefaultData<TreeListData>, DefaultMethods<TreeListAll>, TreeListComputed, RecordPropsDefinition<TreeListProps>>;
|
|
55
|
-
declare const TreeList: DefineComponent<TreeListProps, any, TreeListData, TreeListComputed, TreeListMethods, {}, {}, {}, string, TreeListProps, TreeListProps, {}>;
|
|
56
|
-
export { TreeList, TreeListVue2 };
|