@progress/kendo-angular-treeview 21.4.1 → 22.0.0-develop.1
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/fesm2022/progress-kendo-angular-treeview.mjs +115 -115
- package/filtering-base.d.ts +1 -1
- package/localization/messages.d.ts +1 -1
- package/package.json +11 -19
- package/schematics/ngAdd/index.js +4 -4
- package/esm2022/check-mode.mjs +0 -5
- package/esm2022/check.directive.mjs +0 -334
- package/esm2022/checkable-settings.mjs +0 -5
- package/esm2022/checkbox/checked-state.mjs +0 -5
- package/esm2022/data-bound-component.mjs +0 -19
- package/esm2022/data-change-notification.service.mjs +0 -14
- package/esm2022/default-callbacks.mjs +0 -36
- package/esm2022/directives.mjs +0 -53
- package/esm2022/disable.directive.mjs +0 -83
- package/esm2022/drag-and-drop/drag-and-drop-editing.directive.mjs +0 -76
- package/esm2022/drag-and-drop/drag-and-drop-utils.mjs +0 -270
- package/esm2022/drag-and-drop/drag-and-drop.directive.mjs +0 -348
- package/esm2022/drag-and-drop/drag-clue/drag-clue-template.directive.mjs +0 -44
- package/esm2022/drag-and-drop/drag-clue/drag-clue.component.mjs +0 -132
- package/esm2022/drag-and-drop/drag-clue/drag-clue.service.mjs +0 -123
- package/esm2022/drag-and-drop/drop-hint/drop-hint-template.directive.mjs +0 -43
- package/esm2022/drag-and-drop/drop-hint/drop-hint.component.mjs +0 -102
- package/esm2022/drag-and-drop/drop-hint/drop-hint.service.mjs +0 -41
- package/esm2022/drag-and-drop/editing-services/drag-and-drop-asset.service.mjs +0 -48
- package/esm2022/drag-and-drop/editing-services/flat-editing.service.mjs +0 -141
- package/esm2022/drag-and-drop/editing-services/hierarchy-editing.service.mjs +0 -88
- package/esm2022/drag-and-drop/models/drop-action.mjs +0 -32
- package/esm2022/drag-and-drop/models/drop-position.mjs +0 -22
- package/esm2022/drag-and-drop/models/editing-service.mjs +0 -5
- package/esm2022/drag-and-drop/models/preventable-event.mjs +0 -25
- package/esm2022/drag-and-drop/models/scroll-direction.mjs +0 -12
- package/esm2022/drag-and-drop/models/scroll-settings.mjs +0 -5
- package/esm2022/drag-and-drop/models/tree-item-filter-state.mjs +0 -5
- package/esm2022/drag-and-drop/models/treeitem-add-remove-args.mjs +0 -5
- package/esm2022/drag-and-drop/models/treeitem-drag-event.mjs +0 -24
- package/esm2022/drag-and-drop/models/treeitem-drag-start-event.mjs +0 -25
- package/esm2022/drag-and-drop/models/treeitem-drop-event.mjs +0 -54
- package/esm2022/drag-and-drop/models.mjs +0 -14
- package/esm2022/expand-state.service.mjs +0 -24
- package/esm2022/expand.directive.mjs +0 -226
- package/esm2022/expandable-component.mjs +0 -19
- package/esm2022/filter-expand-settings.interface.mjs +0 -5
- package/esm2022/filter-state.interface.mjs +0 -5
- package/esm2022/filtering-base.mjs +0 -92
- package/esm2022/flat-binding.directive.mjs +0 -165
- package/esm2022/funcs.mjs +0 -9
- package/esm2022/hierarchy-binding.directive.mjs +0 -164
- package/esm2022/index-builder.service.mjs +0 -33
- package/esm2022/index.mjs +0 -31
- package/esm2022/load-more/load-more-button-template.directive.mjs +0 -41
- package/esm2022/load-more/load-more-request-args.mjs +0 -5
- package/esm2022/load-more/load-more-utils.mjs +0 -35
- package/esm2022/load-more/load-more.directive.mjs +0 -137
- package/esm2022/load-more/load-more.service.mjs +0 -5
- package/esm2022/loading-indicator.directive.mjs +0 -69
- package/esm2022/loading-notification.service.mjs +0 -21
- package/esm2022/localization/custom-messages.component.mjs +0 -54
- package/esm2022/localization/localized-messages.directive.mjs +0 -39
- package/esm2022/localization/messages.mjs +0 -27
- package/esm2022/navigation/navigation-item.interface.mjs +0 -5
- package/esm2022/navigation/navigation-model.mjs +0 -152
- package/esm2022/navigation/navigation-state.interface.mjs +0 -5
- package/esm2022/navigation/navigation.service.mjs +0 -248
- package/esm2022/node-children.service.mjs +0 -21
- package/esm2022/node-click-event.interface.mjs +0 -5
- package/esm2022/node-template.directive.mjs +0 -45
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-treeview.mjs +0 -8
- package/esm2022/selection/select.directive.mjs +0 -174
- package/esm2022/selection/selectable-settings.mjs +0 -5
- package/esm2022/selection/selection-mode.mjs +0 -5
- package/esm2022/selection/selection.service.mjs +0 -33
- package/esm2022/size.mjs +0 -5
- package/esm2022/treeitem-lookup.interface.mjs +0 -5
- package/esm2022/treeitem.interface.mjs +0 -5
- package/esm2022/treeview-filter-settings.mjs +0 -12
- package/esm2022/treeview-group.component.mjs +0 -759
- package/esm2022/treeview-item-content.directive.mjs +0 -82
- package/esm2022/treeview-item.directive.mjs +0 -245
- package/esm2022/treeview-lookup.service.mjs +0 -89
- package/esm2022/treeview.component.mjs +0 -874
- package/esm2022/treeview.module.mjs +0 -74
- package/esm2022/utils.mjs +0 -301
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { NgModule } from '@angular/core';
|
|
6
|
-
import { KENDO_TREEVIEW } from './directives';
|
|
7
|
-
import { ResizeBatchService } from '@progress/kendo-angular-common';
|
|
8
|
-
import { DialogContainerService, DialogService, WindowContainerService, WindowService } from '@progress/kendo-angular-dialog';
|
|
9
|
-
import { IconsService } from '@progress/kendo-angular-icons';
|
|
10
|
-
import { PopupService } from '@progress/kendo-angular-popup';
|
|
11
|
-
import * as i0 from "@angular/core";
|
|
12
|
-
import * as i1 from "./treeview.component";
|
|
13
|
-
import * as i2 from "./node-template.directive";
|
|
14
|
-
import * as i3 from "./check.directive";
|
|
15
|
-
import * as i4 from "./disable.directive";
|
|
16
|
-
import * as i5 from "./expand.directive";
|
|
17
|
-
import * as i6 from "./selection/select.directive";
|
|
18
|
-
import * as i7 from "./hierarchy-binding.directive";
|
|
19
|
-
import * as i8 from "./flat-binding.directive";
|
|
20
|
-
import * as i9 from "./drag-and-drop/drag-and-drop.directive";
|
|
21
|
-
import * as i10 from "./drag-and-drop/drag-clue/drag-clue-template.directive";
|
|
22
|
-
import * as i11 from "./drag-and-drop/drop-hint/drop-hint-template.directive";
|
|
23
|
-
import * as i12 from "./drag-and-drop/drag-and-drop-editing.directive";
|
|
24
|
-
import * as i13 from "./load-more/load-more.directive";
|
|
25
|
-
import * as i14 from "./load-more/load-more-button-template.directive";
|
|
26
|
-
import * as i15 from "./localization/custom-messages.component";
|
|
27
|
-
//IMPORTANT: NgModule export kept for backwards compatibility
|
|
28
|
-
/**
|
|
29
|
-
* Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi']) definition for the TreeView component.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* import { NgModule } from '@angular/core';
|
|
34
|
-
* import { BrowserModule } from '@angular/platform-browser';
|
|
35
|
-
* import { TreeViewModule } from '@progress/kendo-angular-treeview';
|
|
36
|
-
* import { AppComponent } from './app.component';
|
|
37
|
-
*
|
|
38
|
-
* @NgModule({
|
|
39
|
-
* imports: [BrowserModule, TreeViewModule],
|
|
40
|
-
* declarations: [AppComponent],
|
|
41
|
-
* bootstrap: [AppComponent]
|
|
42
|
-
* })
|
|
43
|
-
* export class AppModule {}
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export class TreeViewModule {
|
|
47
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
48
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: TreeViewModule, imports: [i1.TreeViewComponent, i2.NodeTemplateDirective, i3.CheckDirective, i4.DisableDirective, i5.ExpandDirective, i6.SelectDirective, i7.HierarchyBindingDirective, i8.FlatDataBindingDirective, i9.DragAndDropDirective, i10.DragClueTemplateDirective, i11.DropHintTemplateDirective, i12.DragAndDropEditingDirective, i13.LoadMoreDirective, i14.LoadMoreButtonTemplateDirective, i15.CustomMessagesComponent], exports: [i1.TreeViewComponent, i2.NodeTemplateDirective, i3.CheckDirective, i4.DisableDirective, i5.ExpandDirective, i6.SelectDirective, i7.HierarchyBindingDirective, i8.FlatDataBindingDirective, i9.DragAndDropDirective, i10.DragClueTemplateDirective, i11.DropHintTemplateDirective, i12.DragAndDropEditingDirective, i13.LoadMoreDirective, i14.LoadMoreButtonTemplateDirective, i15.CustomMessagesComponent] });
|
|
49
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewModule, providers: [
|
|
50
|
-
IconsService,
|
|
51
|
-
PopupService,
|
|
52
|
-
ResizeBatchService,
|
|
53
|
-
DialogContainerService,
|
|
54
|
-
DialogService,
|
|
55
|
-
WindowService,
|
|
56
|
-
WindowContainerService
|
|
57
|
-
], imports: [i1.TreeViewComponent] });
|
|
58
|
-
}
|
|
59
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: TreeViewModule, decorators: [{
|
|
60
|
-
type: NgModule,
|
|
61
|
-
args: [{
|
|
62
|
-
imports: [...KENDO_TREEVIEW],
|
|
63
|
-
exports: [...KENDO_TREEVIEW],
|
|
64
|
-
providers: [
|
|
65
|
-
IconsService,
|
|
66
|
-
PopupService,
|
|
67
|
-
ResizeBatchService,
|
|
68
|
-
DialogContainerService,
|
|
69
|
-
DialogService,
|
|
70
|
-
WindowService,
|
|
71
|
-
WindowContainerService
|
|
72
|
-
]
|
|
73
|
-
}]
|
|
74
|
-
}] });
|
package/esm2022/utils.mjs
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
6
|
-
import { getter } from '@progress/kendo-common';
|
|
7
|
-
const focusableRegex = /^(?:a|input|select|option|textarea|button|object)$/i;
|
|
8
|
-
/**
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
export const match = (element, selector) => {
|
|
12
|
-
const matcher = element.matches || element.msMatchesSelector || element.webkitMatchesSelector;
|
|
13
|
-
if (!matcher) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
return matcher.call(element, selector.toLowerCase());
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* @hidden
|
|
20
|
-
*/
|
|
21
|
-
export const closestWithMatch = (element, selector) => {
|
|
22
|
-
if (!document.documentElement.contains(element)) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
let parent = element;
|
|
26
|
-
while (parent !== null && parent.nodeType === 1) {
|
|
27
|
-
if (match(parent, selector)) {
|
|
28
|
-
return parent;
|
|
29
|
-
}
|
|
30
|
-
parent = parent.parentElement || parent.parentNode;
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* @hidden
|
|
36
|
-
*/
|
|
37
|
-
export const noop = () => { };
|
|
38
|
-
/**
|
|
39
|
-
* @hidden
|
|
40
|
-
*/
|
|
41
|
-
export const isPresent = (value) => value !== null && value !== undefined;
|
|
42
|
-
/**
|
|
43
|
-
* @hidden
|
|
44
|
-
*/
|
|
45
|
-
export const isBlank = (value) => value === null || value === undefined;
|
|
46
|
-
/**
|
|
47
|
-
* @hidden
|
|
48
|
-
*/
|
|
49
|
-
export const isArray = (value) => Array.isArray(value);
|
|
50
|
-
/**
|
|
51
|
-
* @hidden
|
|
52
|
-
*/
|
|
53
|
-
export const isNullOrEmptyString = (value) => isBlank(value) || value.trim().length === 0;
|
|
54
|
-
/**
|
|
55
|
-
* @hidden
|
|
56
|
-
*/
|
|
57
|
-
export const isBoolean = (value) => typeof value === 'boolean';
|
|
58
|
-
/**
|
|
59
|
-
* @hidden
|
|
60
|
-
*/
|
|
61
|
-
export const closestNode = (element) => {
|
|
62
|
-
const selector = 'li.k-treeview-item';
|
|
63
|
-
if (!isDocumentAvailable()) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
if (element.closest) {
|
|
67
|
-
return element.closest(selector);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return closestWithMatch(element, selector);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* @hidden
|
|
75
|
-
*/
|
|
76
|
-
export const isFocusable = (element) => {
|
|
77
|
-
if (element.tagName) {
|
|
78
|
-
const tagName = element.tagName.toLowerCase();
|
|
79
|
-
const tabIndex = element.getAttribute('tabIndex');
|
|
80
|
-
const skipTab = tabIndex === '-1';
|
|
81
|
-
let focusable = tabIndex !== null && !skipTab;
|
|
82
|
-
if (focusableRegex.test(tagName)) {
|
|
83
|
-
focusable = !element.disabled && !skipTab;
|
|
84
|
-
}
|
|
85
|
-
return focusable;
|
|
86
|
-
}
|
|
87
|
-
return false;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* @hidden
|
|
91
|
-
*/
|
|
92
|
-
export const isContent = (element) => {
|
|
93
|
-
const scopeSelector = '.k-treeview-leaf:not(.k-treeview-load-more-button),.k-treeview-item,.k-treeview';
|
|
94
|
-
if (!isDocumentAvailable()) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
let node = element;
|
|
98
|
-
while (node && !match(node, scopeSelector)) {
|
|
99
|
-
node = node.parentNode;
|
|
100
|
-
}
|
|
101
|
-
if (node) {
|
|
102
|
-
return match(node, '.k-treeview-leaf:not(.k-treeview-load-more-button)');
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* @hidden
|
|
107
|
-
*
|
|
108
|
-
* Returns the nested .k-treeview-leaf:not(.k-treeview-load-more-button) element.
|
|
109
|
-
* If the passed parent item is itself a content node, it is returned.
|
|
110
|
-
*/
|
|
111
|
-
export const getContentElement = (parent) => {
|
|
112
|
-
if (!isPresent(parent)) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
const selector = '.k-treeview-leaf:not(.k-treeview-load-more-button)';
|
|
116
|
-
if (match(parent, selector)) {
|
|
117
|
-
return parent;
|
|
118
|
-
}
|
|
119
|
-
return parent.querySelector(selector);
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* @hidden
|
|
123
|
-
*/
|
|
124
|
-
export const isLoadMoreButton = (element) => {
|
|
125
|
-
return isPresent(closestWithMatch(element, '.k-treeview-leaf.k-treeview-load-more-button'));
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* @hidden
|
|
129
|
-
*/
|
|
130
|
-
export const closest = (node, predicate) => {
|
|
131
|
-
while (node && !predicate(node)) {
|
|
132
|
-
node = node.parentNode;
|
|
133
|
-
}
|
|
134
|
-
return node;
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* @hidden
|
|
138
|
-
*/
|
|
139
|
-
export const hasParent = (element, container) => {
|
|
140
|
-
return Boolean(closest(element, (node) => node === container));
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* @hidden
|
|
144
|
-
*/
|
|
145
|
-
export const focusableNode = (element) => element.nativeElement.querySelector('li[tabindex="0"]');
|
|
146
|
-
/**
|
|
147
|
-
* @hidden
|
|
148
|
-
*/
|
|
149
|
-
export const hasActiveNode = (target, node) => {
|
|
150
|
-
const closestItem = node || closestNode(target);
|
|
151
|
-
return closestItem && (closestItem === target || target.tabIndex < 0);
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* @hidden
|
|
155
|
-
*/
|
|
156
|
-
export const nodeId = (node) => node ? node.getAttribute('data-treeindex') : '';
|
|
157
|
-
/**
|
|
158
|
-
* @hidden
|
|
159
|
-
*/
|
|
160
|
-
export const nodeIndex = (item) => (item || {}).index;
|
|
161
|
-
/**
|
|
162
|
-
* @hidden
|
|
163
|
-
*/
|
|
164
|
-
export const dataItemsEqual = (first, second) => {
|
|
165
|
-
if (!isPresent(first) && !isPresent(second)) {
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
return isPresent(first) && isPresent(second) && first.item.dataItem === second.item.dataItem;
|
|
169
|
-
};
|
|
170
|
-
/**
|
|
171
|
-
* @hidden
|
|
172
|
-
*/
|
|
173
|
-
export const getDataItem = (lookup) => {
|
|
174
|
-
if (!isPresent(lookup)) {
|
|
175
|
-
return lookup;
|
|
176
|
-
}
|
|
177
|
-
return lookup.item.dataItem;
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* @hidden
|
|
181
|
-
*/
|
|
182
|
-
export const isArrayWithAtLeastOneItem = v => v && Array.isArray(v) && v.length !== 0;
|
|
183
|
-
/**
|
|
184
|
-
* @hidden
|
|
185
|
-
* A recursive tree-filtering algorithm that returns:
|
|
186
|
-
* - all child nodes of matching nodes
|
|
187
|
-
* - a chain parent nodes from the match to the root node
|
|
188
|
-
*/
|
|
189
|
-
export const filterTree = (items, term, { operator, ignoreCase, mode }, textField, depth = 0) => {
|
|
190
|
-
const field = typeof textField === "string" ? textField : textField[depth];
|
|
191
|
-
items.forEach((wrapper) => {
|
|
192
|
-
const matcher = typeof operator === "string" ? matchByFieldAndCase(field, operator, ignoreCase) : operator;
|
|
193
|
-
const isMatch = matcher(wrapper.dataItem, term);
|
|
194
|
-
wrapper.isMatch = isMatch;
|
|
195
|
-
wrapper.visible = isMatch;
|
|
196
|
-
wrapper.containsMatches = false;
|
|
197
|
-
if (isMatch) {
|
|
198
|
-
setParentChain(wrapper.parent);
|
|
199
|
-
}
|
|
200
|
-
if (wrapper.children && wrapper.children.length > 0) {
|
|
201
|
-
if (mode === "strict" || !isMatch) {
|
|
202
|
-
filterTree(wrapper.children, term, { operator, ignoreCase, mode }, textField, depth + 1);
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
makeAllVisible(wrapper.children);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
const setParentChain = (node) => {
|
|
211
|
-
if (!isPresent(node)) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
node.containsMatches = true;
|
|
215
|
-
node.visible = true;
|
|
216
|
-
if (isPresent(node.parent) && !node.parent.containsMatches) {
|
|
217
|
-
setParentChain(node.parent);
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
const makeAllVisible = (nodes) => {
|
|
221
|
-
nodes.forEach(node => {
|
|
222
|
-
node.visible = true;
|
|
223
|
-
if (node.children) {
|
|
224
|
-
makeAllVisible(node.children);
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
};
|
|
228
|
-
const operators = {
|
|
229
|
-
contains: (a, b) => a.indexOf(b) >= 0,
|
|
230
|
-
doesnotcontain: (a, b) => a.indexOf(b) === -1,
|
|
231
|
-
startswith: (a, b) => a.lastIndexOf(b, 0) === 0,
|
|
232
|
-
doesnotstartwith: (a, b) => a.lastIndexOf(b, 0) === -1,
|
|
233
|
-
endswith: (a, b) => a.indexOf(b, a.length - b.length) >= 0,
|
|
234
|
-
doesnotendwith: (a, b) => a.indexOf(b, a.length - b.length) < 0
|
|
235
|
-
};
|
|
236
|
-
const matchByCase = (matcher, ignoreCase) => (a, b) => {
|
|
237
|
-
if (ignoreCase) {
|
|
238
|
-
return matcher(a.toLowerCase(), b.toLowerCase());
|
|
239
|
-
}
|
|
240
|
-
return matcher(a, b);
|
|
241
|
-
};
|
|
242
|
-
const matchByFieldAndCase = (field, operator, ignoreCase) => (dataItem, term) => matchByCase(operators[operator], ignoreCase)(getter(field)(dataItem), term);
|
|
243
|
-
/**
|
|
244
|
-
* @hidden
|
|
245
|
-
*/
|
|
246
|
-
export const buildTreeIndex = (parentIndex, itemIndex) => {
|
|
247
|
-
return [parentIndex, itemIndex].filter(part => isPresent(part)).join('_');
|
|
248
|
-
};
|
|
249
|
-
/**
|
|
250
|
-
* @hidden
|
|
251
|
-
*/
|
|
252
|
-
export const buildTreeItem = (dataItem, currentLevelIndex, parentIndex) => {
|
|
253
|
-
if (!isPresent(dataItem)) {
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
return {
|
|
257
|
-
dataItem,
|
|
258
|
-
index: buildTreeIndex(parentIndex, currentLevelIndex)
|
|
259
|
-
};
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* @hidden
|
|
263
|
-
*
|
|
264
|
-
* Retrieves all descendant nodes' lookups which are currently registered in the provided lookup item as a flat array.
|
|
265
|
-
*/
|
|
266
|
-
export const fetchLoadedDescendants = (lookup, filterExpression) => {
|
|
267
|
-
if (!isPresent(lookup) || lookup.children.length === 0) {
|
|
268
|
-
return [];
|
|
269
|
-
}
|
|
270
|
-
let descendants = lookup.children;
|
|
271
|
-
if (isPresent(filterExpression)) {
|
|
272
|
-
descendants = descendants.filter(filterExpression);
|
|
273
|
-
}
|
|
274
|
-
descendants.forEach(child => descendants = descendants.concat(fetchLoadedDescendants(child, filterExpression)));
|
|
275
|
-
return descendants;
|
|
276
|
-
};
|
|
277
|
-
/**
|
|
278
|
-
* @hidden
|
|
279
|
-
*
|
|
280
|
-
* Compares two Seets to determine whether all unique elements in one, are present in the other.
|
|
281
|
-
* Important:
|
|
282
|
-
* - it disregards the element order
|
|
283
|
-
*/
|
|
284
|
-
export const sameValues = (as, bs) => {
|
|
285
|
-
if (as.size !== bs.size) {
|
|
286
|
-
return false;
|
|
287
|
-
}
|
|
288
|
-
return Array.from(as).every(v => bs.has(v));
|
|
289
|
-
};
|
|
290
|
-
/**
|
|
291
|
-
* @hidden
|
|
292
|
-
* Returns the size class based on the component and size input.
|
|
293
|
-
*/
|
|
294
|
-
export const getSizeClass = (component, size) => {
|
|
295
|
-
const SIZE_CLASSES = {
|
|
296
|
-
'small': `k-${component}-sm`,
|
|
297
|
-
'medium': `k-${component}-md`,
|
|
298
|
-
'large': `k-${component}-lg`
|
|
299
|
-
};
|
|
300
|
-
return SIZE_CLASSES[size];
|
|
301
|
-
};
|