@progress/kendo-vue-treeview 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 -35
- package/TreeView.js +8 -0
- package/TreeView.mjs +294 -0
- package/TreeViewDragAnalyzer.js +8 -0
- package/TreeViewDragAnalyzer.mjs +74 -0
- package/TreeViewDragClue.js +8 -0
- package/TreeViewDragClue.mjs +56 -0
- package/TreeViewItem.js +8 -0
- package/TreeViewItem.mjs +271 -0
- package/dist/cdn/js/kendo-vue-treeview.js +8 -1
- package/handleTreeViewCheckChange.js +8 -0
- package/handleTreeViewCheckChange.mjs +64 -0
- package/index.d.mts +950 -0
- package/index.d.ts +950 -0
- package/index.js +8 -0
- package/index.mjs +23 -0
- package/moveTreeViewItem.js +8 -0
- package/moveTreeViewItem.mjs +45 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +18 -0
- package/package.json +25 -46
- package/processTreeViewItems.js +8 -0
- package/processTreeViewItems.mjs +90 -0
- package/utils/FieldsService.js +8 -0
- package/utils/FieldsService.mjs +59 -0
- package/utils/SortedPublicItemIds.js +8 -0
- package/utils/SortedPublicItemIds.mjs +26 -0
- package/utils/consts.js +8 -0
- package/utils/consts.mjs +20 -0
- package/utils/getItemIdUponKeyboardNavigation.js +8 -0
- package/utils/getItemIdUponKeyboardNavigation.mjs +65 -0
- package/utils/itemIdUtils.js +8 -0
- package/utils/itemIdUtils.mjs +82 -0
- package/utils/itemUtils.js +8 -0
- package/utils/itemUtils.mjs +140 -0
- package/utils/misc.js +8 -0
- package/utils/misc.mjs +21 -0
- package/dist/es/ItemRenderProps.d.ts +0 -13
- package/dist/es/ItemRenderProps.js +0 -2
- package/dist/es/TreeView.d.ts +0 -116
- package/dist/es/TreeView.js +0 -450
- package/dist/es/TreeViewDragAnalyzer.d.ts +0 -63
- package/dist/es/TreeViewDragAnalyzer.js +0 -111
- package/dist/es/TreeViewDragClue.d.ts +0 -78
- package/dist/es/TreeViewDragClue.js +0 -116
- package/dist/es/TreeViewItem.d.ts +0 -85
- package/dist/es/TreeViewItem.js +0 -415
- package/dist/es/TreeViewOperationDescriptors.d.ts +0 -76
- package/dist/es/TreeViewOperationDescriptors.js +0 -2
- package/dist/es/TreeViewProps.d.ts +0 -126
- package/dist/es/TreeViewProps.js +0 -1
- package/dist/es/additionalTypes.ts +0 -21
- package/dist/es/events.d.ts +0 -143
- package/dist/es/events.js +0 -2
- package/dist/es/handleTreeViewCheckChange.d.ts +0 -49
- package/dist/es/handleTreeViewCheckChange.js +0 -177
- package/dist/es/main.d.ts +0 -12
- package/dist/es/main.js +0 -8
- package/dist/es/moveTreeViewItem.d.ts +0 -46
- package/dist/es/moveTreeViewItem.js +0 -93
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/processTreeViewItems.d.ts +0 -24
- package/dist/es/processTreeViewItems.js +0 -139
- package/dist/es/utils/FieldsService.d.ts +0 -26
- package/dist/es/utils/FieldsService.js +0 -50
- package/dist/es/utils/SortedPublicItemIds.d.ts +0 -8
- package/dist/es/utils/SortedPublicItemIds.js +0 -24
- package/dist/es/utils/consts.d.ts +0 -40
- package/dist/es/utils/consts.js +0 -40
- package/dist/es/utils/getItemIdUponKeyboardNavigation.d.ts +0 -5
- package/dist/es/utils/getItemIdUponKeyboardNavigation.js +0 -77
- package/dist/es/utils/itemIdUtils.d.ts +0 -60
- package/dist/es/utils/itemIdUtils.js +0 -117
- package/dist/es/utils/itemUtils.d.ts +0 -45
- package/dist/es/utils/itemUtils.js +0 -191
- package/dist/es/utils/misc.d.ts +0 -9
- package/dist/es/utils/misc.js +0 -17
- package/dist/esm/ItemRenderProps.d.ts +0 -13
- package/dist/esm/ItemRenderProps.js +0 -2
- package/dist/esm/TreeView.d.ts +0 -116
- package/dist/esm/TreeView.js +0 -450
- package/dist/esm/TreeViewDragAnalyzer.d.ts +0 -63
- package/dist/esm/TreeViewDragAnalyzer.js +0 -111
- package/dist/esm/TreeViewDragClue.d.ts +0 -78
- package/dist/esm/TreeViewDragClue.js +0 -116
- package/dist/esm/TreeViewItem.d.ts +0 -85
- package/dist/esm/TreeViewItem.js +0 -415
- package/dist/esm/TreeViewOperationDescriptors.d.ts +0 -76
- package/dist/esm/TreeViewOperationDescriptors.js +0 -2
- package/dist/esm/TreeViewProps.d.ts +0 -126
- package/dist/esm/TreeViewProps.js +0 -1
- package/dist/esm/additionalTypes.ts +0 -21
- package/dist/esm/events.d.ts +0 -143
- package/dist/esm/events.js +0 -2
- package/dist/esm/handleTreeViewCheckChange.d.ts +0 -49
- package/dist/esm/handleTreeViewCheckChange.js +0 -177
- package/dist/esm/main.d.ts +0 -12
- package/dist/esm/main.js +0 -8
- package/dist/esm/moveTreeViewItem.d.ts +0 -46
- package/dist/esm/moveTreeViewItem.js +0 -93
- 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/processTreeViewItems.d.ts +0 -24
- package/dist/esm/processTreeViewItems.js +0 -139
- package/dist/esm/utils/FieldsService.d.ts +0 -26
- package/dist/esm/utils/FieldsService.js +0 -50
- package/dist/esm/utils/SortedPublicItemIds.d.ts +0 -8
- package/dist/esm/utils/SortedPublicItemIds.js +0 -24
- package/dist/esm/utils/consts.d.ts +0 -40
- package/dist/esm/utils/consts.js +0 -40
- package/dist/esm/utils/getItemIdUponKeyboardNavigation.d.ts +0 -5
- package/dist/esm/utils/getItemIdUponKeyboardNavigation.js +0 -77
- package/dist/esm/utils/itemIdUtils.d.ts +0 -60
- package/dist/esm/utils/itemIdUtils.js +0 -117
- package/dist/esm/utils/itemUtils.d.ts +0 -45
- package/dist/esm/utils/itemUtils.js +0 -191
- package/dist/esm/utils/misc.d.ts +0 -9
- package/dist/esm/utils/misc.js +0 -17
- package/dist/npm/ItemRenderProps.d.ts +0 -13
- package/dist/npm/ItemRenderProps.js +0 -3
- package/dist/npm/TreeView.d.ts +0 -116
- package/dist/npm/TreeView.js +0 -457
- package/dist/npm/TreeViewDragAnalyzer.d.ts +0 -63
- package/dist/npm/TreeViewDragAnalyzer.js +0 -114
- package/dist/npm/TreeViewDragClue.d.ts +0 -78
- package/dist/npm/TreeViewDragClue.js +0 -123
- package/dist/npm/TreeViewItem.d.ts +0 -85
- package/dist/npm/TreeViewItem.js +0 -422
- package/dist/npm/TreeViewOperationDescriptors.d.ts +0 -76
- package/dist/npm/TreeViewOperationDescriptors.js +0 -3
- package/dist/npm/TreeViewProps.d.ts +0 -126
- package/dist/npm/TreeViewProps.js +0 -2
- package/dist/npm/additionalTypes.ts +0 -21
- package/dist/npm/events.d.ts +0 -143
- package/dist/npm/events.js +0 -3
- package/dist/npm/handleTreeViewCheckChange.d.ts +0 -49
- package/dist/npm/handleTreeViewCheckChange.js +0 -181
- package/dist/npm/main.d.ts +0 -12
- package/dist/npm/main.js +0 -17
- package/dist/npm/moveTreeViewItem.d.ts +0 -46
- package/dist/npm/moveTreeViewItem.js +0 -93
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/processTreeViewItems.d.ts +0 -24
- package/dist/npm/processTreeViewItems.js +0 -142
- package/dist/npm/utils/FieldsService.d.ts +0 -26
- package/dist/npm/utils/FieldsService.js +0 -52
- package/dist/npm/utils/SortedPublicItemIds.d.ts +0 -8
- package/dist/npm/utils/SortedPublicItemIds.js +0 -26
- package/dist/npm/utils/consts.d.ts +0 -40
- package/dist/npm/utils/consts.js +0 -43
- package/dist/npm/utils/getItemIdUponKeyboardNavigation.d.ts +0 -5
- package/dist/npm/utils/getItemIdUponKeyboardNavigation.js +0 -80
- package/dist/npm/utils/itemIdUtils.d.ts +0 -60
- package/dist/npm/utils/itemIdUtils.js +0 -132
- package/dist/npm/utils/itemUtils.d.ts +0 -45
- package/dist/npm/utils/itemUtils.js +0 -205
- package/dist/npm/utils/misc.d.ts +0 -9
- package/dist/npm/utils/misc.js +0 -22
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import * as events from './events';
|
|
2
|
-
/**
|
|
3
|
-
* Represents the props of the [Kendo UI for Vue TreeView component]({% slug overview_treeview %}).
|
|
4
|
-
*/
|
|
5
|
-
export interface TreeViewProps {
|
|
6
|
-
/**
|
|
7
|
-
* Sets the data of the TreeView ([more information and examples]({% slug databinding_treeview %})).
|
|
8
|
-
*/
|
|
9
|
-
dataItems?: any[] | null;
|
|
10
|
-
/**
|
|
11
|
-
* Controls the animation. By default, the expand and collapse animations are enabled.
|
|
12
|
-
*/
|
|
13
|
-
animate?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Sets a tabIndex of the TreeView DOM element.
|
|
16
|
-
*/
|
|
17
|
-
tabIndex?: number;
|
|
18
|
-
/**
|
|
19
|
-
* The TreeView has a built-in implementation of focusing and keyboard navigation. By default, the component uses hierarchical indices to uniquely match the focused item. You can use the `focusIdField` prop for specifying the name of the field which will uniquely describe an item as an alternative to its hierarchical index ([see example]({% slug datareload_treeview %}#toc-using-item-ids)).
|
|
20
|
-
*/
|
|
21
|
-
focusIdField?: string;
|
|
22
|
-
/**
|
|
23
|
-
* When `focusIdField` is set, the TreeView executes a depth-first search on the data to find the currently focused item. The `getFocusHierarchicalIndex` prop specifies the function that will be used as an alternative to the default search algorithm.
|
|
24
|
-
*/
|
|
25
|
-
getFocusHierarchicalIndex?: (itemId: any) => string | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Controls the rendering of the expand (collapse) icons. By default, the icons are not rendered ([see example]({% slug expansion_ways_treeview %})).
|
|
28
|
-
*/
|
|
29
|
-
expandIcons?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Fires when the expanding or collapsing of an item is requested ([see example]({% slug expansion_ways_treeview %})).
|
|
32
|
-
*/
|
|
33
|
-
onExpandChange?: (event: events.TreeViewExpandChangeEvent) => void;
|
|
34
|
-
/**
|
|
35
|
-
* Fires when an item is clicked or when `Enter` is pressed on a focused item ([see example]({% slug selection_ways_treeview %})).
|
|
36
|
-
*/
|
|
37
|
-
onItemClick?: (event: events.TreeViewItemClickEvent) => void;
|
|
38
|
-
/**
|
|
39
|
-
* Specifies the name of the field which will provide a Boolean representation for the expanded state of the item. Defaults to `expanded`.
|
|
40
|
-
*/
|
|
41
|
-
expandField?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Specifies the name of the field which will provide a Boolean representation for the selected state of the item. Defaults to `selected`.
|
|
44
|
-
*/
|
|
45
|
-
selectField?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Specifies the name of the field which indicates to the TreeView that an item has children even if the children are not initially passed. Used for implementing the load-on-demand feature ([see example]({% slug databinding_treeview %}#toc-loading-data-on-demand)). Defaults to `hasChildren`.
|
|
48
|
-
*/
|
|
49
|
-
hasChildrenField?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Specifies the name of the field which will provide an array representation of the item children.
|
|
52
|
-
*/
|
|
53
|
-
childrenField?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Specifies the name of the field which will provide a text representation for the item. Defaults to `text`.
|
|
56
|
-
*/
|
|
57
|
-
textField?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Specifies the name of the field which will provide a Boolean representation for the disabled state of the item. Defaults to `disabled`.
|
|
60
|
-
*/
|
|
61
|
-
disableField?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Defines the component that will be used for rendering each of the TreeView items ([see example]({% slug rendering_treeview %})).
|
|
64
|
-
*/
|
|
65
|
-
item?: any;
|
|
66
|
-
/**
|
|
67
|
-
* Indicates that the user can select more than one TreeView items. If the TreeView is in a multiple selection mode, set the `aria-multiselectable` prop to `true` ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
|
|
68
|
-
*/
|
|
69
|
-
ariaMultiSelectable?: boolean | 'false' | 'true' | string;
|
|
70
|
-
/**
|
|
71
|
-
* Defines a string value that labels the TreeView ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
|
|
72
|
-
*/
|
|
73
|
-
ariaLabel?: string;
|
|
74
|
-
/**
|
|
75
|
-
* Identifies the element or elements which will label the TreeView ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
|
|
76
|
-
*/
|
|
77
|
-
ariaLabelledby?: string;
|
|
78
|
-
/**
|
|
79
|
-
* Controls the rendering of checkboxes. By default, the checkboxes are not rendered ([see example]({% slug check_items_directly_treeview %})).
|
|
80
|
-
*/
|
|
81
|
-
checkboxes?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Specifies the name of the field which will provide a Boolean representation for the checked state of the item. Defaults to `checked`.
|
|
84
|
-
*/
|
|
85
|
-
checkField?: string;
|
|
86
|
-
/**
|
|
87
|
-
* Specifies the name of the field which will provide a Boolean representation for the check indeterminate state of the item. Defaults to `checkIndeterminate`.
|
|
88
|
-
*/
|
|
89
|
-
checkIndeterminateField?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Fires when a checkbox is clicked or when `Space` is pressed on a focused item ([see example]({% slug check_items_directly_treeview %})).
|
|
92
|
-
*/
|
|
93
|
-
onCheckChange?: (event: events.TreeViewCheckChangeEvent) => void;
|
|
94
|
-
/**
|
|
95
|
-
* Controls the unique id of the TreeView component.
|
|
96
|
-
*/
|
|
97
|
-
id?: string;
|
|
98
|
-
/**
|
|
99
|
-
* Controls the dispatching of the `drag` events. By default, the `drag` events are not dispatched ([see example]({% slug dragdrop_treeview %})).
|
|
100
|
-
*/
|
|
101
|
-
draggable?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Fires when the dragging of an item has started.
|
|
104
|
-
*/
|
|
105
|
-
onItemDragStart?: (event: events.TreeViewItemDragStartEvent) => void;
|
|
106
|
-
/**
|
|
107
|
-
* Fires when a dragged item changes its position ([see example]({% slug dragdrop_treeview %})).
|
|
108
|
-
*/
|
|
109
|
-
onItemDragOver?: (event: events.TreeViewItemDragOverEvent) => void;
|
|
110
|
-
/**
|
|
111
|
-
* Fires when a dragged item is dropped ([see example]({% slug dragdrop_treeview %})).
|
|
112
|
-
*/
|
|
113
|
-
onItemDragEnd?: (event: events.TreeViewItemDragEndEvent) => void;
|
|
114
|
-
/**
|
|
115
|
-
* Configures the `size` of the TreeView.
|
|
116
|
-
*
|
|
117
|
-
* The available options are:
|
|
118
|
-
* - small
|
|
119
|
-
* - medium
|
|
120
|
-
* - large
|
|
121
|
-
* - null—Does not set a size `className`.
|
|
122
|
-
*
|
|
123
|
-
* @default `medium`
|
|
124
|
-
*/
|
|
125
|
-
size?: null | 'small' | 'medium' | 'large' | string;
|
|
126
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
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 };
|
package/dist/esm/events.d.ts
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents the object of the `onExpandChange` event ([see example]({% slug overview_treeview %}#toc-basic-usage)).
|
|
3
|
-
*/
|
|
4
|
-
export interface TreeViewExpandChangeEvent {
|
|
5
|
-
/**
|
|
6
|
-
* The ItemClick event.
|
|
7
|
-
*/
|
|
8
|
-
event: any;
|
|
9
|
-
/**
|
|
10
|
-
* The item that is expanded or collapsed.
|
|
11
|
-
*/
|
|
12
|
-
item: any;
|
|
13
|
-
/**
|
|
14
|
-
* The hierarchical index of the item. The indices are zero-based. The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
15
|
-
*/
|
|
16
|
-
itemHierarchicalIndex: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Represents the object of the `onItemClick` event ([see example]({% slug overview_treeview %}#toc-basic-usage)).
|
|
20
|
-
*/
|
|
21
|
-
export interface TreeViewItemClickEvent {
|
|
22
|
-
/**
|
|
23
|
-
* The ItemClick event.
|
|
24
|
-
*/
|
|
25
|
-
event: any;
|
|
26
|
-
/**
|
|
27
|
-
* The item that is clicked.
|
|
28
|
-
*/
|
|
29
|
-
item: any;
|
|
30
|
-
/**
|
|
31
|
-
* The hierarchical index of the item. The indices are zero-based.
|
|
32
|
-
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
33
|
-
*/
|
|
34
|
-
itemHierarchicalIndex: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Represents the object of the `onCheckChange` event ([see example]({% slug check_helper_funcs_treeview %})).
|
|
38
|
-
*/
|
|
39
|
-
export interface TreeViewCheckChangeEvent {
|
|
40
|
-
/**
|
|
41
|
-
* The item that is selected or deselected.
|
|
42
|
-
*/
|
|
43
|
-
item: any;
|
|
44
|
-
/**
|
|
45
|
-
* The hierarchical index of the item. The indices are zero-based.
|
|
46
|
-
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
47
|
-
*/
|
|
48
|
-
itemHierarchicalIndex: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Represents the object of the `onItemDragStart` event.
|
|
52
|
-
*/
|
|
53
|
-
export interface TreeViewItemDragStartEvent {
|
|
54
|
-
/**
|
|
55
|
-
* An event target.
|
|
56
|
-
*/
|
|
57
|
-
target: any;
|
|
58
|
-
/**
|
|
59
|
-
* The item that is dragged.
|
|
60
|
-
*/
|
|
61
|
-
item: any;
|
|
62
|
-
/**
|
|
63
|
-
* The hierarchical index of the dragged item. The indices are zero-based.
|
|
64
|
-
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
65
|
-
*/
|
|
66
|
-
itemHierarchicalIndex: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Represents the object of the `onItemDragOver` event ([see example]({% slug dragdrop_treeview %})).
|
|
70
|
-
*/
|
|
71
|
-
export interface TreeViewItemDragOverEvent {
|
|
72
|
-
/**
|
|
73
|
-
* The target that is associated with the dragged item.
|
|
74
|
-
*/
|
|
75
|
-
target: any;
|
|
76
|
-
/**
|
|
77
|
-
* The item that is dragged.
|
|
78
|
-
*/
|
|
79
|
-
item: any;
|
|
80
|
-
/**
|
|
81
|
-
* The hierarchical index of the dragged item. The indices are zero-based.
|
|
82
|
-
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
83
|
-
*/
|
|
84
|
-
itemHierarchicalIndex: string;
|
|
85
|
-
/**
|
|
86
|
-
* The X (horizontal) coordinate (in pixels) at which the event occurred that is relative to the left edge of the entire document.
|
|
87
|
-
* Includes any portion of the document which is not currently visible.
|
|
88
|
-
*/
|
|
89
|
-
pageX: number;
|
|
90
|
-
/**
|
|
91
|
-
* The Y (vertical) coordinate (in pixels) at which the event occurred that is relative to the whole document.
|
|
92
|
-
* `pageY` observes any vertical scrolling of the page.
|
|
93
|
-
*/
|
|
94
|
-
pageY: number;
|
|
95
|
-
/**
|
|
96
|
-
* Provides the horizontal coordinate within the client area of the application at which the event occurred
|
|
97
|
-
* (as opposed to the coordinate within the page).
|
|
98
|
-
*/
|
|
99
|
-
clientX: number;
|
|
100
|
-
/**
|
|
101
|
-
* Provides the vertical coordinate within the client area of the application at which the event occurred
|
|
102
|
-
* (as opposed to the coordinate within the page).
|
|
103
|
-
*/
|
|
104
|
-
clientY: number;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Represents the object of the `onItemDragEnd` event ([see example]({% slug dragdrop_treeview %})).
|
|
108
|
-
*/
|
|
109
|
-
export interface TreeViewItemDragEndEvent {
|
|
110
|
-
/**
|
|
111
|
-
* The target that is associated with the dragged item.
|
|
112
|
-
*/
|
|
113
|
-
target: any;
|
|
114
|
-
/**
|
|
115
|
-
* The item that is dragged.
|
|
116
|
-
*/
|
|
117
|
-
item: any;
|
|
118
|
-
/**
|
|
119
|
-
* The hierarchical index of the dragged item. The indices are zero-based.
|
|
120
|
-
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
121
|
-
*/
|
|
122
|
-
itemHierarchicalIndex: string;
|
|
123
|
-
/**
|
|
124
|
-
* The X (horizontal) coordinate (in pixels) at which the event occured that is relative to the left edge of the entire document.
|
|
125
|
-
* `pageX` includes any portion of the document that is not currently visible.
|
|
126
|
-
*/
|
|
127
|
-
pageX: number;
|
|
128
|
-
/**
|
|
129
|
-
* The Y (vertical) coordinate (in pixels) at which the event occured that is relative to the whole document.
|
|
130
|
-
* `pageY` observes any vertical scrolling of the page.
|
|
131
|
-
*/
|
|
132
|
-
pageY: number;
|
|
133
|
-
/**
|
|
134
|
-
* Provides the horizontal coordinate within the client area of the application at which the event occurred
|
|
135
|
-
* (as opposed to the coordinate within the page).
|
|
136
|
-
*/
|
|
137
|
-
clientX: number;
|
|
138
|
-
/**
|
|
139
|
-
* Provides the vertical coordinate within the client area of the application at which the event occurred
|
|
140
|
-
* (as opposed to the coordinate within the page).
|
|
141
|
-
*/
|
|
142
|
-
clientY: number;
|
|
143
|
-
}
|
package/dist/esm/events.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { TreeViewCheckChangeEvent } from './events';
|
|
2
|
-
import { TreeViewCheckDescriptor } from './TreeViewOperationDescriptors';
|
|
3
|
-
/**
|
|
4
|
-
* The settings that configure the update of the check descriptor.
|
|
5
|
-
*/
|
|
6
|
-
export interface TreeViewCheckChangeSettings {
|
|
7
|
-
/**
|
|
8
|
-
* Determines a selection of a single node at a time.
|
|
9
|
-
*/
|
|
10
|
-
singleMode?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Determines if the children checkboxes will be selected when the user selects the parent checkbox.
|
|
13
|
-
*/
|
|
14
|
-
checkChildren?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Determines if the parent checkbox will be selected when the user selects all its children checkboxes.
|
|
17
|
-
*/
|
|
18
|
-
checkParents?: boolean;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* A helper function which updates the check descriptor.
|
|
23
|
-
*
|
|
24
|
-
* {% meta height:650 %}
|
|
25
|
-
* {% embed_file checkbox/checkbox-helper/main.vue preview %}
|
|
26
|
-
* {% embed_file checkbox/checkbox-helper/main.js %}
|
|
27
|
-
* {% endmeta %}
|
|
28
|
-
*
|
|
29
|
-
* #### Parameters
|
|
30
|
-
* ##### event <span class='code'>[TreeViewExpandChangeEvent]({% slug api_treeview_treeviewexpandchangeevent %})</span>
|
|
31
|
-
* The event that triggered the change.
|
|
32
|
-
*
|
|
33
|
-
* ##### check <span class='code'>string[] | [TreeViewCheckDescriptor]({% slug api_treeview_treeviewcheckdescriptor %})</span>
|
|
34
|
-
* The check descriptor that will be updated.
|
|
35
|
-
*
|
|
36
|
-
* ##### data? <span class='code'>any[] | null</span>
|
|
37
|
-
* The TreeView items.
|
|
38
|
-
*
|
|
39
|
-
* ##### settings <span class='code'>[TreeViewCheckChangeSettings]({% slug api_treeview_treeviewcheckchangesettings %})</span>
|
|
40
|
-
* The additional settings that configure the update of the check descriptor.
|
|
41
|
-
*
|
|
42
|
-
* ##### childrenField? <span class='code'>string</span>
|
|
43
|
-
* The field that points to the dataItem sub items. Defaults to `items`.
|
|
44
|
-
* The default behavior allows the selection of multiple items.
|
|
45
|
-
*
|
|
46
|
-
* #### Returns
|
|
47
|
-
* <span class='code'>any</span> - The updated copy of the input check descriptor.
|
|
48
|
-
*/
|
|
49
|
-
export declare function handleTreeViewCheckChange(event: TreeViewCheckChangeEvent, check: string[] | TreeViewCheckDescriptor, data?: any[] | null, settings?: TreeViewCheckChangeSettings, childrenField?: string): any;
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
2
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
3
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
4
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
5
|
-
function step(op) {
|
|
6
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
7
|
-
while (_) try {
|
|
8
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
9
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
10
|
-
switch (op[0]) {
|
|
11
|
-
case 0: case 1: t = op; break;
|
|
12
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
13
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
14
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
15
|
-
default:
|
|
16
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
17
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
18
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
19
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
20
|
-
if (t[2]) _.ops.pop();
|
|
21
|
-
_.trys.pop(); continue;
|
|
22
|
-
}
|
|
23
|
-
op = body.call(thisArg, _);
|
|
24
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
25
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
import { getAllDirectIndirectChildrenIds, areAllDirectChildrenChecked, getAllParents } from './utils/itemUtils.js';
|
|
29
|
-
import { getDirectParentId, getItemById } from './utils/itemIdUtils.js';
|
|
30
|
-
import { isArray, getNestedValue } from './utils/misc.js';
|
|
31
|
-
import { CHILDREN_FIELD } from './utils/consts.js';
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* A helper function which updates the check descriptor.
|
|
35
|
-
*
|
|
36
|
-
* {% meta height:650 %}
|
|
37
|
-
* {% embed_file checkbox/checkbox-helper/main.vue preview %}
|
|
38
|
-
* {% embed_file checkbox/checkbox-helper/main.js %}
|
|
39
|
-
* {% endmeta %}
|
|
40
|
-
*
|
|
41
|
-
* #### Parameters
|
|
42
|
-
* ##### event <span class='code'>[TreeViewExpandChangeEvent]({% slug api_treeview_treeviewexpandchangeevent %})</span>
|
|
43
|
-
* The event that triggered the change.
|
|
44
|
-
*
|
|
45
|
-
* ##### check <span class='code'>string[] | [TreeViewCheckDescriptor]({% slug api_treeview_treeviewcheckdescriptor %})</span>
|
|
46
|
-
* The check descriptor that will be updated.
|
|
47
|
-
*
|
|
48
|
-
* ##### data? <span class='code'>any[] | null</span>
|
|
49
|
-
* The TreeView items.
|
|
50
|
-
*
|
|
51
|
-
* ##### settings <span class='code'>[TreeViewCheckChangeSettings]({% slug api_treeview_treeviewcheckchangesettings %})</span>
|
|
52
|
-
* The additional settings that configure the update of the check descriptor.
|
|
53
|
-
*
|
|
54
|
-
* ##### childrenField? <span class='code'>string</span>
|
|
55
|
-
* The field that points to the dataItem sub items. Defaults to `items`.
|
|
56
|
-
* The default behavior allows the selection of multiple items.
|
|
57
|
-
*
|
|
58
|
-
* #### Returns
|
|
59
|
-
* <span class='code'>any</span> - The updated copy of the input check descriptor.
|
|
60
|
-
*/
|
|
61
|
-
export function handleTreeViewCheckChange(event, check, data, settings, childrenField) {
|
|
62
|
-
if (settings === void 0) { settings = {}; }
|
|
63
|
-
if (!data || !data.length) {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
var _a = parseOperation(check), ids = _a.ids, idField = _a.idField;
|
|
67
|
-
var itemId = idField ? getNestedValue(idField, event.item) : event.itemHierarchicalIndex;
|
|
68
|
-
var idIndex = ids.indexOf(itemId);
|
|
69
|
-
var itemJustChecked = idIndex === -1;
|
|
70
|
-
var subItemsField = childrenField || CHILDREN_FIELD;
|
|
71
|
-
var newIds;
|
|
72
|
-
if (settings.singleMode) {
|
|
73
|
-
newIds = itemJustChecked ? [itemId] : [];
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
newIds = ids.slice();
|
|
77
|
-
itemJustChecked ? newIds.push(itemId) : newIds.splice(idIndex, 1);
|
|
78
|
-
if (settings.checkChildren) {
|
|
79
|
-
checkChildren(event.item, event.itemHierarchicalIndex, itemJustChecked, idField, subItemsField, newIds);
|
|
80
|
-
}
|
|
81
|
-
if (settings.checkParents) {
|
|
82
|
-
checkParents(event.itemHierarchicalIndex, itemJustChecked, idField, subItemsField, newIds, data);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return isArray(check) ? newIds : Object.assign({}, check, { ids: newIds });
|
|
86
|
-
}
|
|
87
|
-
function parseOperation(operation) {
|
|
88
|
-
var ids;
|
|
89
|
-
var idField = undefined;
|
|
90
|
-
if (isArray(operation)) {
|
|
91
|
-
ids = operation;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
ids = operation.ids || [];
|
|
95
|
-
idField = operation.idField;
|
|
96
|
-
}
|
|
97
|
-
return { ids: ids, idField: idField };
|
|
98
|
-
}
|
|
99
|
-
function checkChildren(item, itemHierarchicalIndex, itemJustChecked, idField, childrenField, ids) {
|
|
100
|
-
getAllDirectIndirectChildrenIds(item, itemHierarchicalIndex, childrenField, idField).forEach(function (itemId) {
|
|
101
|
-
if (itemJustChecked && ids.indexOf(itemId) === -1) {
|
|
102
|
-
ids.push(itemId);
|
|
103
|
-
}
|
|
104
|
-
else if (!itemJustChecked && ids.indexOf(itemId) > -1) {
|
|
105
|
-
ids.splice(ids.indexOf(itemId), 1);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
function checkParents(itemHierarchicalIndex, itemJustChecked, idField, childrenField, ids, data) {
|
|
110
|
-
var it = makeParentsIterator();
|
|
111
|
-
var result = it.next();
|
|
112
|
-
itemJustChecked ? check() : uncheck();
|
|
113
|
-
function check() {
|
|
114
|
-
// Check all parents which have all their children checked.
|
|
115
|
-
while (!result.done) {
|
|
116
|
-
var _a = result.value, id = _a.id, item = _a.item;
|
|
117
|
-
// The first check is needed. However, it is not sure whether to stop the entire loop.
|
|
118
|
-
if (ids.indexOf(id) === -1 &&
|
|
119
|
-
areAllDirectChildrenChecked(item, id, idField, childrenField, ids)) {
|
|
120
|
-
ids.push(id);
|
|
121
|
-
result = it.next();
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function uncheck() {
|
|
129
|
-
// Uncheck parents until an already unchecked parent is reached.
|
|
130
|
-
while (!result.done) {
|
|
131
|
-
var id = result.value.id;
|
|
132
|
-
var idIndex = ids.indexOf(id);
|
|
133
|
-
if (idIndex > -1) {
|
|
134
|
-
ids.splice(idIndex, 1);
|
|
135
|
-
result = it.next();
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// When called for unchecking, the parent items are not needed.
|
|
143
|
-
// That is why, for optimization, they are not returned.
|
|
144
|
-
function makeParentsIterator() {
|
|
145
|
-
var parents, i, parentId;
|
|
146
|
-
return __generator(this, function (_a) {
|
|
147
|
-
switch (_a.label) {
|
|
148
|
-
case 0:
|
|
149
|
-
if (!idField) return [3 /*break*/, 5];
|
|
150
|
-
parents = getAllParents(itemHierarchicalIndex, childrenField, data);
|
|
151
|
-
i = parents.length - 1;
|
|
152
|
-
_a.label = 1;
|
|
153
|
-
case 1:
|
|
154
|
-
if (!(i > -1)) return [3 /*break*/, 4];
|
|
155
|
-
return [4 /*yield*/, { id: getNestedValue(idField, parents[i]), item: itemJustChecked ? parents[i] : undefined }];
|
|
156
|
-
case 2:
|
|
157
|
-
_a.sent();
|
|
158
|
-
_a.label = 3;
|
|
159
|
-
case 3:
|
|
160
|
-
i--;
|
|
161
|
-
return [3 /*break*/, 1];
|
|
162
|
-
case 4: return [3 /*break*/, 8];
|
|
163
|
-
case 5:
|
|
164
|
-
parentId = getDirectParentId(itemHierarchicalIndex);
|
|
165
|
-
_a.label = 6;
|
|
166
|
-
case 6:
|
|
167
|
-
if (!parentId) return [3 /*break*/, 8];
|
|
168
|
-
return [4 /*yield*/, { id: parentId, item: itemJustChecked ? getItemById(parentId, data, childrenField) : undefined }];
|
|
169
|
-
case 7:
|
|
170
|
-
_a.sent();
|
|
171
|
-
parentId = getDirectParentId(parentId);
|
|
172
|
-
return [3 /*break*/, 6];
|
|
173
|
-
case 8: return [2 /*return*/];
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
package/dist/esm/main.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TreeView } from './TreeView';
|
|
2
|
-
import { TreeViewItemClickEvent, TreeViewExpandChangeEvent, TreeViewCheckChangeEvent, TreeViewItemDragOverEvent, TreeViewItemDragStartEvent, TreeViewItemDragEndEvent } from './events';
|
|
3
|
-
import { processTreeViewItems } from './processTreeViewItems';
|
|
4
|
-
import { moveTreeViewItem } from './moveTreeViewItem';
|
|
5
|
-
import { handleTreeViewCheckChange, TreeViewCheckChangeSettings } from './handleTreeViewCheckChange';
|
|
6
|
-
import { TreeViewOperationDescriptor, TreeViewOperationDescriptors, TreeViewCheckDescriptor } from './TreeViewOperationDescriptors';
|
|
7
|
-
import { ItemRenderProps } from './ItemRenderProps';
|
|
8
|
-
import { TreeViewProps } from './TreeViewProps';
|
|
9
|
-
import { TreeViewDragClue } from './TreeViewDragClue';
|
|
10
|
-
import { TreeViewDragAnalyzer } from './TreeViewDragAnalyzer';
|
|
11
|
-
import { TreeViewItem } from './TreeViewItem';
|
|
12
|
-
export { TreeViewItem, TreeView, processTreeViewItems, handleTreeViewCheckChange, TreeViewCheckChangeSettings, TreeViewItemClickEvent, TreeViewExpandChangeEvent, TreeViewCheckChangeEvent, TreeViewItemDragOverEvent, TreeViewItemDragStartEvent, TreeViewItemDragEndEvent, TreeViewOperationDescriptor, TreeViewOperationDescriptors, TreeViewCheckDescriptor, TreeViewProps, ItemRenderProps, TreeViewDragClue, moveTreeViewItem, TreeViewDragAnalyzer };
|
package/dist/esm/main.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TreeView } from './TreeView.js';
|
|
2
|
-
import { processTreeViewItems } from './processTreeViewItems.js';
|
|
3
|
-
import { moveTreeViewItem } from './moveTreeViewItem.js';
|
|
4
|
-
import { handleTreeViewCheckChange } from './handleTreeViewCheckChange.js';
|
|
5
|
-
import { TreeViewDragClue } from './TreeViewDragClue.js';
|
|
6
|
-
import { TreeViewDragAnalyzer } from './TreeViewDragAnalyzer.js';
|
|
7
|
-
import { TreeViewItem } from './TreeViewItem.js';
|
|
8
|
-
export { TreeViewItem, TreeView, processTreeViewItems, handleTreeViewCheckChange, TreeViewDragClue, moveTreeViewItem, TreeViewDragAnalyzer };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A helper function which moves a TreeView item in an immutable way.
|
|
3
|
-
*
|
|
4
|
-
* {% meta height:400 %}
|
|
5
|
-
* {% embed_file drag/single/main.vue preview %}
|
|
6
|
-
* {% embed_file drag/single/main.js %}
|
|
7
|
-
* {% endmeta %}
|
|
8
|
-
*
|
|
9
|
-
* #### Parameters
|
|
10
|
-
* ##### sourceItemHierarchicalIndex <span class='code'>string</span>
|
|
11
|
-
* The hierarchical index of the item that will be moved.
|
|
12
|
-
*
|
|
13
|
-
* ##### sourceData <span class='code'>any[] | null | undefined</span>
|
|
14
|
-
* The tree which contains the item that will be moved.
|
|
15
|
-
*
|
|
16
|
-
* ##### operation <span class='code'>"before" | "after" | "child"</span>
|
|
17
|
-
* The specific move operation.
|
|
18
|
-
*
|
|
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.
|
|
23
|
-
*
|
|
24
|
-
* ##### targetItemHierarchicalIndex <span class='code'>string</span>
|
|
25
|
-
* The hierarchical index of the item next to which the source item will be moved.
|
|
26
|
-
*
|
|
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.
|
|
31
|
-
*
|
|
32
|
-
* ##### childrenField? <span class='code'>string</span>
|
|
33
|
-
* The field that points to the dataItem sub items. Defaults to `items`.
|
|
34
|
-
*
|
|
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.
|
|
38
|
-
*/
|
|
39
|
-
declare const moveTreeViewItem: (sourceItemHierarchicalIndex: string, sourceData: any[] | null | undefined, operation: 'before' | 'after' | 'child', targetItemHierarchicalIndex: string, targetData?: any[] | null, childrenField?: string) => any[] | {
|
|
40
|
-
sourceData: any[];
|
|
41
|
-
targetData: any[];
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* @hidden
|
|
45
|
-
*/
|
|
46
|
-
export { moveTreeViewItem };
|