@progress/kendo-angular-treelist 21.4.1-develop.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.
Files changed (272) hide show
  1. package/binding-directives/base-binding.directive.d.ts +1 -1
  2. package/column-menu/column-menu-item-base.d.ts +1 -1
  3. package/columns/column-base.d.ts +1 -1
  4. package/editing-directives/editing-directive-base.d.ts +1 -1
  5. package/editing-directives/row-editing-directive-base.d.ts +1 -1
  6. package/fesm2022/progress-kendo-angular-treelist.mjs +519 -519
  7. package/filtering/base-filter-cell.component.d.ts +1 -1
  8. package/filtering/boolean-filter.component.d.ts +1 -1
  9. package/filtering/date-filter.component.d.ts +1 -1
  10. package/filtering/filter-host.directive.d.ts +1 -1
  11. package/filtering/filter-input-wrapper.component.d.ts +1 -1
  12. package/filtering/numeric-filter.component.d.ts +1 -1
  13. package/filtering/operators/filter-operator.base.d.ts +1 -1
  14. package/filtering/string-filter.component.d.ts +1 -1
  15. package/localization/messages.d.ts +1 -1
  16. package/package.json +23 -31
  17. package/schematics/ngAdd/index.js +3 -3
  18. package/esm2022/binding-directives/base-binding.directive.mjs +0 -180
  19. package/esm2022/binding-directives/data-bound-tree-component.mjs +0 -18
  20. package/esm2022/binding-directives/flat-binding.directive.mjs +0 -130
  21. package/esm2022/binding-directives/hierarchy-binding.directive.mjs +0 -109
  22. package/esm2022/column-menu/column-chooser-item-checked.directive.mjs +0 -45
  23. package/esm2022/column-menu/column-chooser.component.mjs +0 -221
  24. package/esm2022/column-menu/column-list-kb-nav.service.mjs +0 -40
  25. package/esm2022/column-menu/column-list.component.mjs +0 -380
  26. package/esm2022/column-menu/column-locked-change-event.mjs +0 -21
  27. package/esm2022/column-menu/column-menu-autosize-all.component.mjs +0 -78
  28. package/esm2022/column-menu/column-menu-autosize.component.mjs +0 -86
  29. package/esm2022/column-menu/column-menu-chooser.component.mjs +0 -164
  30. package/esm2022/column-menu/column-menu-container.component.mjs +0 -58
  31. package/esm2022/column-menu/column-menu-expandable-item.interface.mjs +0 -5
  32. package/esm2022/column-menu/column-menu-filter.component.mjs +0 -141
  33. package/esm2022/column-menu/column-menu-item-base.mjs +0 -41
  34. package/esm2022/column-menu/column-menu-item-content-template.directive.mjs +0 -43
  35. package/esm2022/column-menu/column-menu-item.component.mjs +0 -329
  36. package/esm2022/column-menu/column-menu-item.directive.mjs +0 -147
  37. package/esm2022/column-menu/column-menu-lock.component.mjs +0 -112
  38. package/esm2022/column-menu/column-menu-settings.interface.mjs +0 -5
  39. package/esm2022/column-menu/column-menu-sort.component.mjs +0 -115
  40. package/esm2022/column-menu/column-menu-template.directive.mjs +0 -47
  41. package/esm2022/column-menu/column-menu.component.mjs +0 -470
  42. package/esm2022/column-menu/column-menu.service.mjs +0 -70
  43. package/esm2022/column-menu/column-visibility-change-event.mjs +0 -19
  44. package/esm2022/column-menu/utils.mjs +0 -44
  45. package/esm2022/column-resizing/column-handle.directive.mjs +0 -226
  46. package/esm2022/column-resizing/column-resize.interface.mjs +0 -5
  47. package/esm2022/column-resizing/column-resizing.service.mjs +0 -143
  48. package/esm2022/column-resizing/table.directive.mjs +0 -130
  49. package/esm2022/columns/checkbox-column.component.mjs +0 -88
  50. package/esm2022/columns/column-base.mjs +0 -319
  51. package/esm2022/columns/column-common.mjs +0 -73
  52. package/esm2022/columns/column-group.component.mjs +0 -115
  53. package/esm2022/columns/column-list.mjs +0 -94
  54. package/esm2022/columns/column.component.mjs +0 -165
  55. package/esm2022/columns/columns-container.mjs +0 -90
  56. package/esm2022/columns/command-column.component.mjs +0 -77
  57. package/esm2022/columns/rowreorder-column.component.mjs +0 -57
  58. package/esm2022/columns/sort-settings.mjs +0 -17
  59. package/esm2022/columns/span-column.component.mjs +0 -201
  60. package/esm2022/common/cell-click-event-args.interface.mjs +0 -5
  61. package/esm2022/common/column-info.service.mjs +0 -54
  62. package/esm2022/common/create-form-group.mjs +0 -5
  63. package/esm2022/common/default-track-by.mjs +0 -13
  64. package/esm2022/common/dom-events.service.mjs +0 -24
  65. package/esm2022/common/error-messages.mjs +0 -15
  66. package/esm2022/common/filter-descriptor-differ.mjs +0 -69
  67. package/esm2022/common/filter-operator.interface.mjs +0 -5
  68. package/esm2022/common/id.service.mjs +0 -34
  69. package/esm2022/common/option-changes.service.mjs +0 -24
  70. package/esm2022/common/pager-settings.mjs +0 -19
  71. package/esm2022/common/preventable-event.mjs +0 -28
  72. package/esm2022/common/provider.service.mjs +0 -34
  73. package/esm2022/common/remove-confirmation.mjs +0 -5
  74. package/esm2022/common/single-popup.service.mjs +0 -132
  75. package/esm2022/common/sort.service.mjs +0 -14
  76. package/esm2022/data/change-event-args.interface.mjs +0 -5
  77. package/esm2022/data/change-notification.service.mjs +0 -30
  78. package/esm2022/data/data-item.interface.mjs +0 -5
  79. package/esm2022/data/data.collection.mjs +0 -503
  80. package/esm2022/data/treelist-item.interface.mjs +0 -5
  81. package/esm2022/directives.mjs +0 -291
  82. package/esm2022/dragdrop/column-reorder-config.mjs +0 -5
  83. package/esm2022/dragdrop/column-reorder-event.mjs +0 -31
  84. package/esm2022/dragdrop/column-reorder.service.mjs +0 -20
  85. package/esm2022/dragdrop/common.mjs +0 -69
  86. package/esm2022/dragdrop/context-types.mjs +0 -5
  87. package/esm2022/dragdrop/drag-and-drop.service.mjs +0 -65
  88. package/esm2022/dragdrop/drag-hint.service.mjs +0 -137
  89. package/esm2022/dragdrop/draggable-column.directive.mjs +0 -141
  90. package/esm2022/dragdrop/drop-cue.service.mjs +0 -46
  91. package/esm2022/dragdrop/drop-target.directive.mjs +0 -71
  92. package/esm2022/editing/add-command-tool.directive.mjs +0 -60
  93. package/esm2022/editing/add-command.directive.mjs +0 -96
  94. package/esm2022/editing/add-event-args.interface.mjs +0 -5
  95. package/esm2022/editing/base-command.directive.mjs +0 -95
  96. package/esm2022/editing/cancel-command.directive.mjs +0 -97
  97. package/esm2022/editing/cancel-event-args.interface.mjs +0 -5
  98. package/esm2022/editing/cell-close-event.mjs +0 -34
  99. package/esm2022/editing/edit-command.directive.mjs +0 -96
  100. package/esm2022/editing/edit-event-args.interface.mjs +0 -5
  101. package/esm2022/editing/edit-template.directive.mjs +0 -45
  102. package/esm2022/editing/edit.service.mjs +0 -174
  103. package/esm2022/editing/remove-command.directive.mjs +0 -96
  104. package/esm2022/editing/remove-event-args.interface.mjs +0 -5
  105. package/esm2022/editing/save-command.directive.mjs +0 -96
  106. package/esm2022/editing/save-event-args.interface.mjs +0 -5
  107. package/esm2022/editing-directives/create-form-group-args.interface.mjs +0 -5
  108. package/esm2022/editing-directives/edit-service.interface.mjs +0 -5
  109. package/esm2022/editing-directives/editing-directive-base.mjs +0 -137
  110. package/esm2022/editing-directives/flat-edit.service.mjs +0 -52
  111. package/esm2022/editing-directives/hierarchy-edit.service.mjs +0 -48
  112. package/esm2022/editing-directives/in-cell-editing.directive.mjs +0 -89
  113. package/esm2022/editing-directives/local-edit.service.mjs +0 -28
  114. package/esm2022/editing-directives/reactive-editing.directive.mjs +0 -61
  115. package/esm2022/editing-directives/row-editing-directive-base.mjs +0 -39
  116. package/esm2022/editing-directives/template-editing.directive.mjs +0 -68
  117. package/esm2022/editing-directives/utils.mjs +0 -41
  118. package/esm2022/excel/excel-command-tool.directive.mjs +0 -64
  119. package/esm2022/excel/excel-command.directive.mjs +0 -97
  120. package/esm2022/excel/excel-export-data.interface.mjs +0 -5
  121. package/esm2022/excel/excel-export-event.mjs +0 -15
  122. package/esm2022/excel/excel.component.mjs +0 -277
  123. package/esm2022/excel/excel.module.mjs +0 -45
  124. package/esm2022/excel/excel.service.mjs +0 -34
  125. package/esm2022/expand-state/expand-event.mjs +0 -30
  126. package/esm2022/expand-state/expand-state.service.mjs +0 -38
  127. package/esm2022/expand-state/expandable-tree-component.mjs +0 -18
  128. package/esm2022/expand-state/expandable.directive.mjs +0 -119
  129. package/esm2022/filtering/base-filter-cell.component.mjs +0 -172
  130. package/esm2022/filtering/boolean-filter.component.mjs +0 -91
  131. package/esm2022/filtering/cell/autocomplete-filter-cell.component.mjs +0 -113
  132. package/esm2022/filtering/cell/boolean-filter-cell.component.mjs +0 -107
  133. package/esm2022/filtering/cell/date-filter-cell.component.mjs +0 -132
  134. package/esm2022/filtering/cell/filter-cell-component.factory.mjs +0 -19
  135. package/esm2022/filtering/cell/filter-cell-host.directive.mjs +0 -33
  136. package/esm2022/filtering/cell/filter-cell-operators.component.mjs +0 -235
  137. package/esm2022/filtering/cell/filter-cell-template.directive.mjs +0 -46
  138. package/esm2022/filtering/cell/filter-cell-wrapper.component.mjs +0 -74
  139. package/esm2022/filtering/cell/filter-cell.component.mjs +0 -91
  140. package/esm2022/filtering/cell/numeric-filter-cell.component.mjs +0 -143
  141. package/esm2022/filtering/cell/string-filter-cell.component.mjs +0 -115
  142. package/esm2022/filtering/date-filter.component.mjs +0 -176
  143. package/esm2022/filtering/filter-component.interface.mjs +0 -5
  144. package/esm2022/filtering/filter-host.directive.mjs +0 -56
  145. package/esm2022/filtering/filter-input-wrapper.component.mjs +0 -119
  146. package/esm2022/filtering/filter-input.directive.mjs +0 -114
  147. package/esm2022/filtering/filter-row.component.mjs +0 -79
  148. package/esm2022/filtering/filter.service.mjs +0 -42
  149. package/esm2022/filtering/filterable.mjs +0 -16
  150. package/esm2022/filtering/menu/boolean-filter-menu.component.mjs +0 -168
  151. package/esm2022/filtering/menu/date-filter-menu-input.component.mjs +0 -174
  152. package/esm2022/filtering/menu/date-filter-menu.component.mjs +0 -207
  153. package/esm2022/filtering/menu/filter-menu-component.factory.mjs +0 -19
  154. package/esm2022/filtering/menu/filter-menu-container.component.mjs +0 -299
  155. package/esm2022/filtering/menu/filter-menu-dropdownlist.directive.mjs +0 -44
  156. package/esm2022/filtering/menu/filter-menu-host.directive.mjs +0 -46
  157. package/esm2022/filtering/menu/filter-menu-input-wrapper.component.mjs +0 -136
  158. package/esm2022/filtering/menu/filter-menu-template.directive.mjs +0 -43
  159. package/esm2022/filtering/menu/filter-menu.component.mjs +0 -202
  160. package/esm2022/filtering/menu/filter-radio-button.directive.mjs +0 -34
  161. package/esm2022/filtering/menu/menu-tabbing.service.mjs +0 -22
  162. package/esm2022/filtering/menu/numeric-filter-menu-input.component.mjs +0 -152
  163. package/esm2022/filtering/menu/numeric-filter-menu.component.mjs +0 -224
  164. package/esm2022/filtering/menu/string-filter-menu-input.component.mjs +0 -105
  165. package/esm2022/filtering/menu/string-filter-menu.component.mjs +0 -183
  166. package/esm2022/filtering/numeric-filter.component.mjs +0 -144
  167. package/esm2022/filtering/operators/after-eq-filter-operator.component.mjs +0 -72
  168. package/esm2022/filtering/operators/after-filter-operator.component.mjs +0 -72
  169. package/esm2022/filtering/operators/before-eq-filter-operator.component.mjs +0 -72
  170. package/esm2022/filtering/operators/before-filter-operator.component.mjs +0 -72
  171. package/esm2022/filtering/operators/contains-filter-operator.component.mjs +0 -64
  172. package/esm2022/filtering/operators/ends-with-filter-operator.component.mjs +0 -64
  173. package/esm2022/filtering/operators/eq-filter-operator.component.mjs +0 -112
  174. package/esm2022/filtering/operators/filter-operator.base.mjs +0 -98
  175. package/esm2022/filtering/operators/gt-filter-operator.component.mjs +0 -63
  176. package/esm2022/filtering/operators/gte-filter-operator.component.mjs +0 -63
  177. package/esm2022/filtering/operators/is-empty-filter-operator.component.mjs +0 -64
  178. package/esm2022/filtering/operators/is-not-empty-filter-operator.component.mjs +0 -64
  179. package/esm2022/filtering/operators/is-not-null-filter-operator.component.mjs +0 -112
  180. package/esm2022/filtering/operators/isnull-filter-operator.component.mjs +0 -112
  181. package/esm2022/filtering/operators/lt-filter-operator.component.mjs +0 -63
  182. package/esm2022/filtering/operators/lte-filter-operator.component.mjs +0 -63
  183. package/esm2022/filtering/operators/neq-filter-operator.component.mjs +0 -112
  184. package/esm2022/filtering/operators/not-contains-filter-operator.component.mjs +0 -64
  185. package/esm2022/filtering/operators/starts-with-filter-operator.component.mjs +0 -64
  186. package/esm2022/filtering/string-filter.component.mjs +0 -89
  187. package/esm2022/index.mjs +0 -146
  188. package/esm2022/layout/browser-support.service.mjs +0 -85
  189. package/esm2022/layout/resizable.directive.mjs +0 -83
  190. package/esm2022/layout/resize.service.mjs +0 -29
  191. package/esm2022/layout/responsive.service.mjs +0 -34
  192. package/esm2022/layout/row-sync.mjs +0 -47
  193. package/esm2022/localization/custom-messages.component.mjs +0 -53
  194. package/esm2022/localization/localized-messages.directive.mjs +0 -39
  195. package/esm2022/localization/messages.mjs +0 -510
  196. package/esm2022/navigation/default-focusable-element.mjs +0 -47
  197. package/esm2022/navigation/focus-group.mjs +0 -105
  198. package/esm2022/navigation/focus-root.mjs +0 -50
  199. package/esm2022/navigation/focusable-element.interface.mjs +0 -5
  200. package/esm2022/navigation/focusable.directive.mjs +0 -174
  201. package/esm2022/navigation/item-map.mjs +0 -59
  202. package/esm2022/navigation/logical-cell.directive.mjs +0 -187
  203. package/esm2022/navigation/logical-cell.interface.mjs +0 -5
  204. package/esm2022/navigation/logical-row.directive.mjs +0 -135
  205. package/esm2022/navigation/logical-row.interface.mjs +0 -5
  206. package/esm2022/navigation/model-cell.mjs +0 -37
  207. package/esm2022/navigation/navigation-cell.interface.mjs +0 -5
  208. package/esm2022/navigation/navigation-change.interface.mjs +0 -5
  209. package/esm2022/navigation/navigation-cursor.mjs +0 -176
  210. package/esm2022/navigation/navigation-metadata.mjs +0 -31
  211. package/esm2022/navigation/navigation-mode.mjs +0 -5
  212. package/esm2022/navigation/navigation-model.mjs +0 -126
  213. package/esm2022/navigation/navigation-row.interface.mjs +0 -5
  214. package/esm2022/navigation/navigation.service.mjs +0 -695
  215. package/esm2022/navigation/treelist-focusable-element.mjs +0 -28
  216. package/esm2022/package-metadata.mjs +0 -16
  217. package/esm2022/pdf/export-element.mjs +0 -129
  218. package/esm2022/pdf/pdf-command-tool.directive.mjs +0 -68
  219. package/esm2022/pdf/pdf-command.directive.mjs +0 -101
  220. package/esm2022/pdf/pdf-export-event.mjs +0 -18
  221. package/esm2022/pdf/pdf-margin.component.mjs +0 -33
  222. package/esm2022/pdf/pdf-margin.interface.mjs +0 -5
  223. package/esm2022/pdf/pdf-template.directive.mjs +0 -45
  224. package/esm2022/pdf/pdf.component.mjs +0 -269
  225. package/esm2022/pdf/pdf.module.mjs +0 -48
  226. package/esm2022/pdf/pdf.service.mjs +0 -40
  227. package/esm2022/pdf/treelist-query.mjs +0 -45
  228. package/esm2022/progress-kendo-angular-treelist.mjs +0 -8
  229. package/esm2022/rendering/cell-template.directive.mjs +0 -49
  230. package/esm2022/rendering/cell.component.mjs +0 -383
  231. package/esm2022/rendering/common/col-group.component.mjs +0 -39
  232. package/esm2022/rendering/common/dom-queries.mjs +0 -158
  233. package/esm2022/rendering/common/field-accessor.pipe.mjs +0 -48
  234. package/esm2022/rendering/common/level-items.pipe.mjs +0 -30
  235. package/esm2022/rendering/common/loading.component.mjs +0 -42
  236. package/esm2022/rendering/common/row-class.mjs +0 -5
  237. package/esm2022/rendering/common/spacer.component.mjs +0 -61
  238. package/esm2022/rendering/constants.mjs +0 -28
  239. package/esm2022/rendering/footer-template.directive.mjs +0 -45
  240. package/esm2022/rendering/header/header-template.directive.mjs +0 -45
  241. package/esm2022/rendering/header/header.component.mjs +0 -978
  242. package/esm2022/rendering/header/select-all-checkbox.directive.mjs +0 -90
  243. package/esm2022/rendering/list.component.mjs +0 -850
  244. package/esm2022/rendering/no-records-template.directive.mjs +0 -40
  245. package/esm2022/rendering/table-body.component.mjs +0 -665
  246. package/esm2022/rendering/toolbar/toolbar-focusable.directive.mjs +0 -77
  247. package/esm2022/rendering/toolbar/toolbar-navigation.service.mjs +0 -54
  248. package/esm2022/rendering/toolbar/toolbar-template.directive.mjs +0 -58
  249. package/esm2022/rendering/toolbar/toolbar.component.mjs +0 -110
  250. package/esm2022/row-reordering/flat-reorder.service.mjs +0 -48
  251. package/esm2022/row-reordering/hierarchical-reorder.service.mjs +0 -55
  252. package/esm2022/row-reordering/row-reorder.service.mjs +0 -273
  253. package/esm2022/row-reordering/types.mjs +0 -5
  254. package/esm2022/row-reordering/utils.mjs +0 -128
  255. package/esm2022/scrolling/content-scroll-event.mjs +0 -5
  256. package/esm2022/scrolling/row-height.service.mjs +0 -30
  257. package/esm2022/scrolling/scroll-bottom-event.mjs +0 -5
  258. package/esm2022/scrolling/scroll-request.service.mjs +0 -21
  259. package/esm2022/scrolling/scroll-sync.service.mjs +0 -80
  260. package/esm2022/scrolling/scroller.service.mjs +0 -112
  261. package/esm2022/scrolling/scrollmode.mjs +0 -5
  262. package/esm2022/scrolling/suspend.service.mjs +0 -17
  263. package/esm2022/selection/is-selected.mjs +0 -5
  264. package/esm2022/selection/marquee.directive.mjs +0 -196
  265. package/esm2022/selection/selectable-settings.mjs +0 -5
  266. package/esm2022/selection/selectable.directive.mjs +0 -223
  267. package/esm2022/selection/selection-change-event.mjs +0 -28
  268. package/esm2022/selection/selection-state.mjs +0 -104
  269. package/esm2022/selection/selection.service.mjs +0 -264
  270. package/esm2022/treelist.component.mjs +0 -3111
  271. package/esm2022/treelist.module.mjs +0 -183
  272. package/esm2022/utils.mjs +0 -113
@@ -1,503 +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 { isObservable, Subscription, BehaviorSubject } from 'rxjs';
6
- import { take } from 'rxjs/operators';
7
- import { EventEmitter } from '@angular/core';
8
- import { isArray } from '../utils';
9
- /**
10
- * @hidden
11
- */
12
- export const EXPANDED_STATE = {
13
- isExpanded: () => true,
14
- };
15
- /**
16
- * @hidden
17
- */
18
- export const UNSELECTED_STATE = {
19
- isRowSelected: () => false,
20
- };
21
- /**
22
- * @hidden
23
- */
24
- export const NOT_EDITED_STATE = {
25
- hasNew: () => false,
26
- context: () => null,
27
- };
28
- const identity = (item) => item;
29
- function loadView(view, subject) {
30
- view.loadData();
31
- if (view.loading) {
32
- // Wait for view to load and fetch children.
33
- view.dataLoaded.pipe(take(1)).subscribe(() => {
34
- loadView(view, subject);
35
- });
36
- }
37
- else if (!view._data) {
38
- // Fetch children if root items are resolved immediately.
39
- loadView(view, subject);
40
- }
41
- else {
42
- // Data loaded.
43
- subject.next(view);
44
- }
45
- }
46
- const LOADING = 'loading';
47
- class ViewRange {
48
- skip;
49
- pageSize;
50
- pageable;
51
- expandAll;
52
- static create(options) {
53
- const { skip, pageSize, pageable, isVirtual } = options;
54
- let rangeType = ViewRange;
55
- if (pageSize) {
56
- if (pageable) {
57
- rangeType = PagerRange;
58
- }
59
- else if (isVirtual) {
60
- rangeType = VirtualRange;
61
- }
62
- }
63
- return new rangeType(skip, pageSize, pageable);
64
- }
65
- constructor(skip, pageSize, pageable) {
66
- this.skip = skip;
67
- this.pageSize = pageSize;
68
- this.pageable = pageable;
69
- }
70
- inRange(_index, _rowIndex) {
71
- return true;
72
- }
73
- levelInRange(_parent, _items, _rowIndex) {
74
- return true;
75
- }
76
- includeParents(_children) {
77
- // eslint-disable-next-line no-empty
78
- }
79
- }
80
- function isPagerSettings(pageable) {
81
- return typeof pageable === 'object';
82
- }
83
- class PagerRange extends ViewRange {
84
- expandAll = true;
85
- constructor(skip, pageSize, pageable) {
86
- super(skip, pageSize, pageable);
87
- if (isPagerSettings(pageable)) {
88
- this.expandAll = pageable.countChildren !== false;
89
- }
90
- }
91
- inRange(index, _rowIndex) {
92
- return this.skip <= index && index < this.skip + this.pageSize;
93
- }
94
- levelInRange(parent, items, _rowIndex) {
95
- return (parent.level === -1 ||
96
- (this.skip <= parent.index + items.length && parent.index + 1 < this.skip + this.pageSize));
97
- }
98
- includeParents(children) {
99
- let parentLevel = children.parentLevel;
100
- while (parentLevel && !parentLevel.inRange) {
101
- parentLevel.inRange = true;
102
- parentLevel = parentLevel.parentLevel;
103
- }
104
- }
105
- }
106
- class VirtualRange extends ViewRange {
107
- inRange(_index, rowIndex) {
108
- return this.skip <= rowIndex && rowIndex < this.skip + this.pageSize;
109
- }
110
- levelInRange(parent, _items, rowIndex) {
111
- return this.inRange(parent.index, rowIndex);
112
- }
113
- }
114
- /**
115
- * @hidden
116
- */
117
- export class ViewItemFactory {
118
- expandState;
119
- editState;
120
- selectionState;
121
- loaded;
122
- fieldAccessor;
123
- observables = [];
124
- rowIndex = 0;
125
- rootLevel;
126
- fetchChildren;
127
- hasChildren;
128
- idGetter;
129
- hasFooter;
130
- viewRange;
131
- offsetFirst;
132
- constructor(expandState, editState, selectionState, loaded, fieldAccessor, rootItem) {
133
- this.expandState = expandState;
134
- this.editState = editState;
135
- this.selectionState = selectionState;
136
- this.loaded = loaded;
137
- this.fieldAccessor = fieldAccessor;
138
- const options = this.fieldAccessor();
139
- this.fetchChildren = options.fetchChildren;
140
- this.hasChildren = options.hasChildren;
141
- this.idGetter = options.idGetter;
142
- this.hasFooter = options.hasFooter;
143
- this.viewRange = ViewRange.create(options);
144
- if (rootItem) {
145
- this.rootLevel = this.loadChildren(rootItem);
146
- }
147
- else {
148
- this.rootLevel = this.dataLevel({
149
- level: -1,
150
- id: null,
151
- expanded: true,
152
- }, options.data);
153
- }
154
- }
155
- // try to stop iteration if cached total and viewRange ends
156
- generate() {
157
- const result = [];
158
- const dataLevels = [this.rootLevel];
159
- let itemIndex = 0;
160
- let itemCount = 0;
161
- this.addNew(result);
162
- while (dataLevels.length) {
163
- while (dataLevels[0] && dataLevels[0].idx >= dataLevels[0].items.length) {
164
- const dataLevel = dataLevels.shift();
165
- if (this.hasFooter && dataLevel.expanded && dataLevel.items.length) {
166
- if (dataLevel.inRange ||
167
- this.viewRange.levelInRange(dataLevel.parent, dataLevel.items, this.rowIndex)) {
168
- result.push({
169
- type: 'footer',
170
- items: dataLevel.items,
171
- aggregates: dataLevel.aggregates,
172
- level: dataLevel.level,
173
- parentItem: dataLevel.parent.data,
174
- parentIndex: dataLevel.parentIndex,
175
- rowIndex: this.rowIndex,
176
- });
177
- this.viewRange.includeParents(dataLevel);
178
- }
179
- this.rowIndex++;
180
- }
181
- }
182
- if (!dataLevels.length) {
183
- break;
184
- }
185
- const currentLevel = dataLevels[0];
186
- const dataItem = currentLevel.items[currentLevel.idx++];
187
- const viewItem = {
188
- type: 'data',
189
- data: dataItem,
190
- id: this.idGetter(dataItem),
191
- rowIndex: this.rowIndex,
192
- index: itemIndex,
193
- level: currentLevel.level,
194
- hasChildren: this.hasChildren(dataItem),
195
- parent: currentLevel.parent,
196
- };
197
- if (currentLevel.expanded) {
198
- this.rowIndex++;
199
- if (this.viewRange.inRange(itemIndex, viewItem.rowIndex)) {
200
- if (this.offsetFirst) {
201
- viewItem.rowIndex++;
202
- this.rowIndex++;
203
- this.offsetFirst = false;
204
- }
205
- result.push(viewItem);
206
- viewItem.editContext = this.editState.context(viewItem.data);
207
- viewItem.selected = this.selectionState.isRowSelected(dataItem);
208
- this.addNew(result, dataItem);
209
- }
210
- itemIndex++;
211
- }
212
- itemCount++;
213
- const expanded = viewItem.hasChildren && this.expandState.isExpanded(viewItem.data);
214
- if (viewItem.hasChildren && (expanded || this.viewRange.expandAll)) {
215
- viewItem.expanded = expanded && currentLevel.expanded;
216
- const children = this.loadChildren(viewItem);
217
- if (children) {
218
- dataLevels.unshift(children);
219
- children.parentLevel = currentLevel;
220
- }
221
- }
222
- }
223
- return {
224
- items: result,
225
- observables: this.observables,
226
- total: itemCount,
227
- totalVisible: itemIndex,
228
- totalRows: this.rowIndex,
229
- };
230
- }
231
- loadChildren(parent) {
232
- const parentId = parent.id;
233
- if (this.loaded.has(parentId)) {
234
- const children = this.loaded.get(parentId);
235
- if (children === LOADING) {
236
- parent.loading = true;
237
- }
238
- else {
239
- return this.dataLevel(parent, children);
240
- }
241
- }
242
- else {
243
- const children = this.fetchChildren(parent.data);
244
- if (isObservable(children)) {
245
- this.observables.push({
246
- observable: children,
247
- parentId: parentId,
248
- });
249
- parent.loading = true;
250
- }
251
- else if (children) {
252
- this.loaded.set(parentId, children);
253
- return this.dataLevel(parent, children);
254
- }
255
- }
256
- }
257
- dataLevel(parent, children) {
258
- children = children || {};
259
- const data = children.data || children;
260
- const items = data && data.length ? data : [];
261
- return {
262
- idx: 0,
263
- level: parent.level + 1,
264
- items: items,
265
- aggregates: children.aggregates,
266
- expanded: parent.expanded,
267
- parentIndex: parent.index,
268
- parent: parent,
269
- };
270
- }
271
- addNew(result, parent) {
272
- if (this.editState.hasNew(parent)) {
273
- const inRange = this.viewRange.inRange(0, this.rowIndex);
274
- const rowIndex = parent || inRange ? this.rowIndex : this.viewRange.skip;
275
- result.push({
276
- parent: parent,
277
- isNew: true,
278
- type: 'data',
279
- data: this.editState.newItem.dataItem,
280
- editContext: this.editState.newItem,
281
- rowIndex: rowIndex,
282
- });
283
- if (parent || inRange) {
284
- this.rowIndex++;
285
- }
286
- else {
287
- this.offsetFirst = true;
288
- }
289
- }
290
- }
291
- }
292
- /**
293
- * @hidden
294
- */
295
- export class ViewCollection {
296
- fieldAccessor;
297
- expandState;
298
- editState;
299
- selectionState;
300
- childrenLoaded = new EventEmitter();
301
- dataLoaded = new EventEmitter();
302
- resetPage = new EventEmitter();
303
- total = 0;
304
- totalVisible = 0;
305
- loaded = new Map();
306
- loading = false;
307
- _totalRows = 0;
308
- loadingCount = 0;
309
- childrenSubscription;
310
- _data;
311
- static loadView(options) {
312
- const subject = new BehaviorSubject(null);
313
- const viewFields = () => Object.assign({
314
- idGetter: identity,
315
- pageable: false,
316
- isVirtual: false,
317
- skip: 0,
318
- }, options.fields);
319
- const childrenView = new ViewCollection(viewFields, options.expandState || EXPANDED_STATE, options.editState || NOT_EDITED_STATE, options.selectionState || UNSELECTED_STATE);
320
- if (options.loaded) {
321
- childrenView.loaded = options.loaded;
322
- }
323
- loadView(childrenView, subject);
324
- return subject;
325
- }
326
- get totalRows() {
327
- if (!this._data) {
328
- this.loadData();
329
- }
330
- return this._totalRows;
331
- }
332
- get data() {
333
- if (!this._data) {
334
- this.loadData();
335
- }
336
- return this._data;
337
- }
338
- constructor(fieldAccessor, expandState, editState, selectionState) {
339
- this.fieldAccessor = fieldAccessor;
340
- this.expandState = expandState;
341
- this.editState = editState;
342
- this.selectionState = selectionState;
343
- }
344
- get length() {
345
- return this.data.length;
346
- }
347
- get first() {
348
- return this.data[0];
349
- }
350
- get firstItem() {
351
- return this.find((item) => item.type === 'data');
352
- }
353
- get last() {
354
- return this.data[this.data.length - 1];
355
- }
356
- at(index) {
357
- return this.data[index];
358
- }
359
- itemIndex(item) {
360
- const idGetter = this.fieldAccessor().idGetter;
361
- return this.data.findIndex((i) => i.id === idGetter(item));
362
- }
363
- map(fn) {
364
- return this.data.map(fn);
365
- }
366
- filter(fn) {
367
- return this.data.filter(fn);
368
- }
369
- findIndex(fn) {
370
- return this.data.findIndex(fn);
371
- }
372
- reduce(fn, init) {
373
- return this.data.reduce(fn, init);
374
- }
375
- forEach(fn) {
376
- this.data.forEach(fn);
377
- }
378
- some(fn) {
379
- return this.data.some(fn);
380
- }
381
- find(fn) {
382
- return this.data.find(fn);
383
- }
384
- toString() {
385
- return this.data.toString();
386
- }
387
- updateSelectedState() {
388
- this.forEach((item) => {
389
- if (item.type === 'data') {
390
- item.selected = this.selectionState.isRowSelected(item.data);
391
- }
392
- });
393
- }
394
- updateEditedState() {
395
- this.forEach((item) => {
396
- if (item.type === 'data') {
397
- item.editContext = this.editState.context(item.data);
398
- }
399
- });
400
- }
401
- reset() {
402
- this.loaded.clear();
403
- this.clear();
404
- this.unsubscribeChildren();
405
- }
406
- resetItem(item, resetChildren) {
407
- const idGetter = this.fieldAccessor().idGetter;
408
- const toReset = [item];
409
- while (toReset.length) {
410
- const current = toReset.shift();
411
- const id = idGetter(current);
412
- if (this.loaded.has(id)) {
413
- const children = this.loaded.get(id);
414
- this.loaded.delete(id);
415
- if (resetChildren) {
416
- toReset.push(...(children.data || children));
417
- }
418
- }
419
- }
420
- this.clear();
421
- }
422
- clear() {
423
- this._data = null;
424
- }
425
- loadData() {
426
- const itemFactory = new ViewItemFactory(this.expandState, this.editState, this.selectionState, this.loaded, this.fieldAccessor);
427
- let result = itemFactory.generate();
428
- if (!result.loading && result.total && (!result.items.length || !result.items.some((i) => i.type === 'data'))) {
429
- this.resetPage.emit();
430
- result = new ViewItemFactory(this.expandState, this.editState, this.selectionState, this.loaded, this.fieldAccessor).generate();
431
- }
432
- this._data = result.items;
433
- this.total = result.total;
434
- this.totalVisible = result.totalVisible;
435
- this._totalRows = result.totalRows;
436
- if (result.observables && result.observables.length) {
437
- this.loading = true;
438
- this.loadingCount += result.observables.length;
439
- if (!this.childrenSubscription) {
440
- this.childrenSubscription = new Subscription();
441
- }
442
- result.observables.forEach((o) => {
443
- this.loaded.set(o.parentId, LOADING);
444
- this.childrenSubscription.add(o.observable.subscribe((children) => {
445
- // handle error, might show reload icon
446
- this.clear();
447
- this.loaded.set(o.parentId, children);
448
- this.childrenLoaded.emit();
449
- this.loadingCount--;
450
- if (this.loadingCount === 0) {
451
- this.loading = false;
452
- this.unsubscribeChildren();
453
- this.dataLoaded.emit();
454
- }
455
- }));
456
- });
457
- }
458
- else {
459
- this.dataLoaded.emit();
460
- }
461
- }
462
- /**
463
- * @hidden
464
- * Returns all data nodes from the TreeList, recursively collecting items from all hierarchy levels.
465
- */
466
- get flatData() {
467
- const result = [];
468
- const options = this.fieldAccessor();
469
- const fetchChildren = options.fetchChildren;
470
- const toProcess = [...(isArray(options.data) ? options.data : options.data?.data || [])];
471
- while (toProcess.length) {
472
- const current = toProcess.shift();
473
- result.push(current);
474
- const id = options.idGetter(current);
475
- if (this.loaded.has(id)) {
476
- const children = this.loaded.get(id);
477
- if (children !== LOADING) {
478
- const childData = children?.data || children;
479
- if (childData?.length) {
480
- toProcess.unshift(...childData);
481
- }
482
- }
483
- }
484
- else if (fetchChildren) {
485
- const children = fetchChildren(current);
486
- if (children && !isObservable(children)) {
487
- const childData = children?.data || children;
488
- if (childData?.length) {
489
- toProcess.unshift(...childData);
490
- }
491
- }
492
- }
493
- }
494
- return result;
495
- }
496
- unsubscribeChildren() {
497
- if (this.childrenSubscription) {
498
- this.childrenSubscription.unsubscribe();
499
- this.childrenSubscription = null;
500
- this.loadingCount = 0;
501
- }
502
- }
503
- }
@@ -1,5 +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
- export {};