@progress/kendo-angular-treelist 12.2.0-develop.7 → 13.0.0-develop.10

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 (185) hide show
  1. package/binding-directives/base-binding.directive.d.ts +5 -1
  2. package/binding-directives/data-bound-tree-component.d.ts +9 -0
  3. package/binding-directives/flat-binding.directive.d.ts +14 -3
  4. package/binding-directives/hierarchy-binding.directive.d.ts +12 -3
  5. package/column-menu/column-chooser.component.d.ts +10 -6
  6. package/column-menu/column-menu-chooser.component.d.ts +6 -10
  7. package/column-menu/column-menu-filter.component.d.ts +6 -10
  8. package/column-menu/column-menu-item-content-template.directive.d.ts +1 -1
  9. package/column-menu/column-menu-item.component.d.ts +8 -6
  10. package/column-menu/column-menu-lock.component.d.ts +5 -11
  11. package/column-menu/column-menu-settings.interface.d.ts +7 -10
  12. package/column-menu/column-menu-sort.component.d.ts +5 -11
  13. package/column-menu/column-menu.component.d.ts +1 -1
  14. package/column-menu/column-menu.service.d.ts +1 -1
  15. package/column-resizing/column-resize.interface.d.ts +1 -1
  16. package/columns/checkbox-column.component.d.ts +1 -1
  17. package/columns/column-base.d.ts +4 -0
  18. package/columns/column-group.component.d.ts +9 -6
  19. package/columns/column.component.d.ts +16 -66
  20. package/columns/command-column.component.d.ts +13 -15
  21. package/columns/rowreorder-column.component.d.ts +19 -0
  22. package/columns/span-column.component.d.ts +10 -81
  23. package/data/change-event-args.interface.d.ts +2 -2
  24. package/data/data.collection.d.ts +6 -0
  25. package/dragdrop/column-reorder-config.d.ts +1 -1
  26. package/editing/add-command.directive.d.ts +1 -1
  27. package/editing/cancel-command.directive.d.ts +1 -1
  28. package/editing/edit-command.directive.d.ts +1 -1
  29. package/editing/edit-event-args.interface.d.ts +1 -1
  30. package/editing/edit-template.directive.d.ts +11 -0
  31. package/editing/remove-command.directive.d.ts +1 -1
  32. package/editing/remove-event-args.interface.d.ts +1 -1
  33. package/editing/save-command.directive.d.ts +1 -1
  34. package/editing/save-event-args.interface.d.ts +1 -1
  35. package/esm2020/binding-directives/base-binding.directive.mjs +9 -3
  36. package/esm2020/binding-directives/flat-binding.directive.mjs +56 -6
  37. package/esm2020/binding-directives/hierarchy-binding.directive.mjs +46 -6
  38. package/esm2020/column-menu/column-chooser.component.mjs +10 -6
  39. package/esm2020/column-menu/column-menu-chooser.component.mjs +8 -12
  40. package/esm2020/column-menu/column-menu-filter.component.mjs +6 -10
  41. package/esm2020/column-menu/column-menu-item-content-template.directive.mjs +1 -1
  42. package/esm2020/column-menu/column-menu-item.component.mjs +9 -7
  43. package/esm2020/column-menu/column-menu-lock.component.mjs +5 -11
  44. package/esm2020/column-menu/column-menu-sort.component.mjs +5 -11
  45. package/esm2020/column-menu/column-menu.component.mjs +2 -2
  46. package/esm2020/column-menu/column-menu.service.mjs +1 -1
  47. package/esm2020/columns/checkbox-column.component.mjs +1 -1
  48. package/esm2020/columns/column-base.mjs +4 -0
  49. package/esm2020/columns/column-group.component.mjs +9 -6
  50. package/esm2020/columns/column.component.mjs +16 -39
  51. package/esm2020/columns/command-column.component.mjs +13 -15
  52. package/esm2020/columns/rowreorder-column.component.mjs +47 -0
  53. package/esm2020/columns/span-column.component.mjs +10 -81
  54. package/esm2020/data/data.collection.mjs +41 -28
  55. package/esm2020/editing/add-command.directive.mjs +2 -2
  56. package/esm2020/editing/base-command.directive.mjs +1 -1
  57. package/esm2020/editing/cancel-command.directive.mjs +2 -2
  58. package/esm2020/editing/edit-command.directive.mjs +2 -2
  59. package/esm2020/editing/edit-template.directive.mjs +11 -0
  60. package/esm2020/editing/remove-command.directive.mjs +2 -2
  61. package/esm2020/editing/save-command.directive.mjs +2 -2
  62. package/esm2020/excel/excel-command.directive.mjs +2 -2
  63. package/esm2020/filtering/cell/boolean-filter-cell.component.mjs +11 -11
  64. package/esm2020/filtering/cell/date-filter-cell.component.mjs +11 -11
  65. package/esm2020/filtering/cell/filter-cell-operators.component.mjs +15 -0
  66. package/esm2020/filtering/cell/numeric-filter-cell.component.mjs +13 -12
  67. package/esm2020/filtering/cell/string-filter-cell.component.mjs +14 -13
  68. package/esm2020/filtering/date-filter.component.mjs +6 -1
  69. package/esm2020/filtering/menu/boolean-filter-menu.component.mjs +11 -12
  70. package/esm2020/filtering/menu/date-filter-menu.component.mjs +12 -12
  71. package/esm2020/filtering/menu/filter-menu.component.mjs +1 -1
  72. package/esm2020/filtering/menu/numeric-filter-menu.component.mjs +12 -12
  73. package/esm2020/filtering/menu/string-filter-menu.component.mjs +15 -0
  74. package/esm2020/filtering/numeric-filter.component.mjs +4 -1
  75. package/esm2020/filtering/operators/after-eq-filter-operator.component.mjs +2 -5
  76. package/esm2020/filtering/operators/after-filter-operator.component.mjs +2 -5
  77. package/esm2020/filtering/operators/before-eq-filter-operator.component.mjs +2 -5
  78. package/esm2020/filtering/operators/before-filter-operator.component.mjs +3 -6
  79. package/esm2020/filtering/operators/contains-filter-operator.component.mjs +1 -4
  80. package/esm2020/filtering/operators/ends-with-filter-operator.component.mjs +1 -4
  81. package/esm2020/filtering/operators/eq-filter-operator.component.mjs +1 -4
  82. package/esm2020/filtering/operators/gt-filter-operator.component.mjs +1 -4
  83. package/esm2020/filtering/operators/gte-filter-operator.component.mjs +1 -4
  84. package/esm2020/filtering/operators/is-empty-filter-operator.component.mjs +1 -4
  85. package/esm2020/filtering/operators/is-not-empty-filter-operator.component.mjs +1 -4
  86. package/esm2020/filtering/operators/is-not-null-filter-operator.component.mjs +1 -4
  87. package/esm2020/filtering/operators/isnull-filter-operator.component.mjs +1 -4
  88. package/esm2020/filtering/operators/lt-filter-operator.component.mjs +2 -5
  89. package/esm2020/filtering/operators/lte-filter-operator.component.mjs +1 -4
  90. package/esm2020/filtering/operators/neq-filter-operator.component.mjs +1 -4
  91. package/esm2020/filtering/operators/not-contains-filter-operator.component.mjs +1 -4
  92. package/esm2020/filtering/operators/starts-with-filter-operator.component.mjs +1 -4
  93. package/esm2020/filtering/string-filter.component.mjs +2 -1
  94. package/esm2020/index.mjs +2 -0
  95. package/esm2020/localization/custom-messages.component.mjs +1 -1
  96. package/esm2020/localization/messages.mjs +3 -1
  97. package/esm2020/package-metadata.mjs +2 -2
  98. package/esm2020/pager/pager-element.component.mjs +17 -0
  99. package/esm2020/pager/pager-next-buttons.component.mjs +8 -11
  100. package/esm2020/pager/pager-numeric-buttons.component.mjs +1 -1
  101. package/esm2020/pager/pager-page-sizes.component.mjs +1 -1
  102. package/esm2020/pager/pager-prev-buttons.component.mjs +8 -11
  103. package/esm2020/pager/pager-template.directive.mjs +1 -1
  104. package/esm2020/pdf/pdf-command.directive.mjs +2 -2
  105. package/esm2020/pdf/pdf-margin.component.mjs +9 -0
  106. package/esm2020/rendering/cell-template.directive.mjs +1 -1
  107. package/esm2020/rendering/cell.component.mjs +68 -20
  108. package/esm2020/rendering/common/spacer.component.mjs +1 -1
  109. package/esm2020/rendering/constants.mjs +4 -0
  110. package/esm2020/rendering/header/header.component.mjs +1 -1
  111. package/esm2020/rendering/table-body.component.mjs +5 -3
  112. package/esm2020/row-reordering/flat-reorder.service.mjs +48 -0
  113. package/esm2020/row-reordering/hierarchical-reorder.service.mjs +55 -0
  114. package/esm2020/row-reordering/row-reorder.service.mjs +220 -0
  115. package/esm2020/row-reordering/types.mjs +5 -0
  116. package/esm2020/row-reordering/utils.mjs +129 -0
  117. package/esm2020/shared.module.mjs +8 -3
  118. package/esm2020/treelist.component.mjs +185 -311
  119. package/esm2020/treelist.module.mjs +71 -66
  120. package/excel/excel-command.directive.d.ts +1 -1
  121. package/excel/excel-export-data.interface.d.ts +1 -1
  122. package/excel/excel.component.d.ts +9 -8
  123. package/fesm2015/progress-kendo-angular-treelist.mjs +1215 -792
  124. package/fesm2020/progress-kendo-angular-treelist.mjs +1205 -791
  125. package/filtering/cell/boolean-filter-cell.component.d.ts +11 -11
  126. package/filtering/cell/date-filter-cell.component.d.ts +11 -11
  127. package/filtering/cell/filter-cell-operators.component.d.ts +15 -0
  128. package/filtering/cell/numeric-filter-cell.component.d.ts +13 -12
  129. package/filtering/cell/string-filter-cell.component.d.ts +12 -11
  130. package/filtering/date-filter.component.d.ts +7 -11
  131. package/filtering/menu/boolean-filter-menu.component.d.ts +11 -12
  132. package/filtering/menu/date-filter-menu.component.d.ts +12 -12
  133. package/filtering/menu/numeric-filter-menu.component.d.ts +12 -12
  134. package/filtering/menu/string-filter-menu.component.d.ts +15 -0
  135. package/filtering/numeric-filter.component.d.ts +4 -1
  136. package/filtering/operators/after-eq-filter-operator.component.d.ts +4 -0
  137. package/filtering/operators/after-filter-operator.component.d.ts +4 -0
  138. package/filtering/operators/before-eq-filter-operator.component.d.ts +4 -0
  139. package/filtering/operators/before-filter-operator.component.d.ts +4 -0
  140. package/filtering/operators/contains-filter-operator.component.d.ts +1 -4
  141. package/filtering/operators/ends-with-filter-operator.component.d.ts +1 -4
  142. package/filtering/operators/eq-filter-operator.component.d.ts +1 -4
  143. package/filtering/operators/gte-filter-operator.component.d.ts +1 -4
  144. package/filtering/operators/is-empty-filter-operator.component.d.ts +1 -4
  145. package/filtering/operators/is-not-empty-filter-operator.component.d.ts +1 -4
  146. package/filtering/operators/is-not-null-filter-operator.component.d.ts +1 -4
  147. package/filtering/operators/isnull-filter-operator.component.d.ts +1 -4
  148. package/filtering/operators/lt-filter-operator.component.d.ts +4 -0
  149. package/filtering/operators/neq-filter-operator.component.d.ts +1 -4
  150. package/filtering/operators/not-contains-filter-operator.component.d.ts +1 -4
  151. package/filtering/operators/starts-with-filter-operator.component.d.ts +1 -4
  152. package/filtering/string-filter.component.d.ts +2 -1
  153. package/index.d.ts +2 -0
  154. package/localization/custom-messages.component.d.ts +1 -1
  155. package/localization/messages.d.ts +6 -2
  156. package/navigation/navigation-cell.interface.d.ts +1 -4
  157. package/navigation/navigation-row.interface.d.ts +1 -4
  158. package/package.json +16 -15
  159. package/pager/pager-element.component.d.ts +9 -0
  160. package/pager/pager-next-buttons.component.d.ts +0 -3
  161. package/pager/pager-numeric-buttons.component.d.ts +1 -1
  162. package/pager/pager-prev-buttons.component.d.ts +0 -3
  163. package/pager/pager-settings.d.ts +1 -15
  164. package/pager/pager-template.directive.d.ts +1 -1
  165. package/pdf/pdf-command.directive.d.ts +1 -1
  166. package/pdf/pdf-margin.component.d.ts +9 -0
  167. package/rendering/cell-template.directive.d.ts +1 -1
  168. package/rendering/cell.component.d.ts +9 -1
  169. package/rendering/common/spacer.component.d.ts +1 -1
  170. package/rendering/constants.d.ts +4 -0
  171. package/row-reordering/flat-reorder.service.d.ts +16 -0
  172. package/row-reordering/hierarchical-reorder.service.d.ts +16 -0
  173. package/row-reordering/row-reorder.service.d.ts +61 -0
  174. package/row-reordering/types.d.ts +39 -0
  175. package/row-reordering/utils.d.ts +85 -0
  176. package/schematics/ngAdd/index.js +3 -3
  177. package/scrolling/content-scroll-event.d.ts +1 -1
  178. package/scrolling/scroll-bottom-event.d.ts +1 -1
  179. package/scrolling/scroll-request.service.d.ts +6 -0
  180. package/selection/selectable-settings.d.ts +5 -15
  181. package/selection/selectable.directive.d.ts +1 -1
  182. package/selection/selection-change-event.d.ts +1 -1
  183. package/shared.module.d.ts +5 -4
  184. package/treelist.component.d.ts +66 -289
  185. package/treelist.module.d.ts +68 -66
@@ -4,34 +4,39 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Component, HostBinding, Input } from '@angular/core';
6
6
  import { EditService } from '../editing/edit.service';
7
- import { isSpanColumn, isCheckboxColumn } from '../columns/column-base';
7
+ import { isSpanColumn, isCheckboxColumn, isRowReorderColumn } from '../columns/column-base';
8
8
  import { isColumnComponent } from '../columns/column.component';
9
9
  import { columnsToRender } from "../columns/column-common";
10
10
  import { isNullOrEmptyString, extractFormat, isColumnEditable } from '../utils';
11
11
  import { FocusGroup } from '../navigation/focus-group';
12
- import { caretAltDownIcon, caretAltRightIcon } from '@progress/kendo-svg-icons';
12
+ import { caretAltDownIcon, caretAltLeftIcon, caretAltRightIcon, reorderIcon } from '@progress/kendo-svg-icons';
13
+ import { LocalizationService } from "@progress/kendo-angular-l10n";
13
14
  import * as i0 from "@angular/core";
14
15
  import * as i1 from "../editing/edit.service";
15
- import * as i2 from "../navigation/focus-group";
16
- import * as i3 from "@progress/kendo-angular-icons";
17
- import * as i4 from "@progress/kendo-angular-inputs";
18
- import * as i5 from "@progress/kendo-angular-dateinputs";
19
- import * as i6 from "@angular/common";
20
- import * as i7 from "../navigation/focusable.directive";
21
- import * as i8 from "@angular/forms";
22
- import * as i9 from "./common/level-items.pipe";
23
- import * as i10 from "./common/field-accessor.pipe";
16
+ import * as i2 from "@progress/kendo-angular-l10n";
17
+ import * as i3 from "../navigation/focus-group";
18
+ import * as i4 from "@progress/kendo-angular-icons";
19
+ import * as i5 from "@progress/kendo-angular-inputs";
20
+ import * as i6 from "@progress/kendo-angular-dateinputs";
21
+ import * as i7 from "@angular/common";
22
+ import * as i8 from "../navigation/focusable.directive";
23
+ import * as i9 from "@angular/forms";
24
+ import * as i10 from "./common/level-items.pipe";
25
+ import * as i11 from "./common/field-accessor.pipe";
24
26
  /**
25
27
  * @hidden
26
28
  */
27
29
  export class CellComponent {
28
- constructor(editService, focusGroup) {
30
+ constructor(editService, localization, focusGroup) {
29
31
  this.editService = editService;
32
+ this.localization = localization;
30
33
  this.focusGroup = focusGroup;
31
34
  this.isNew = false;
32
35
  this.level = 0;
33
36
  this.caretAltDownIcon = caretAltDownIcon;
34
37
  this.caretAltRightIcon = caretAltRightIcon;
38
+ this.caretAltLeftIcon = caretAltLeftIcon;
39
+ this.reorderIcon = reorderIcon;
35
40
  this.cellContext = {};
36
41
  this._templateContext = {};
37
42
  this._editTemplateContext = {};
@@ -47,6 +52,12 @@ export class CellComponent {
47
52
  get textNoWrapClass() {
48
53
  return this.column.expandable;
49
54
  }
55
+ get dragHandleCellClass() {
56
+ return isRowReorderColumn(this.column);
57
+ }
58
+ get dragRowHandleLabel() {
59
+ return isRowReorderColumn(this.column) ? this.localization.get('dragRowHandleLabel') : undefined;
60
+ }
50
61
  set viewItem(value) {
51
62
  this._viewItem = value;
52
63
  this.cellContext.viewItem = this.viewItem;
@@ -113,9 +124,25 @@ export class CellComponent {
113
124
  context.loading = this.loading;
114
125
  context.rowIndex = this.viewItem.rowIndex;
115
126
  }
127
+ get arrowIcon() {
128
+ const icon = !this.isExpanded ?
129
+ !this.localization.rtl ?
130
+ 'caret-alt-right' :
131
+ 'caret-alt-left' :
132
+ 'caret-alt-down';
133
+ return icon;
134
+ }
135
+ get arrowSVGIcon() {
136
+ const icon = !this.isExpanded ?
137
+ !this.localization.rtl ?
138
+ this.caretAltRightIcon :
139
+ this.caretAltLeftIcon :
140
+ this.caretAltDownIcon;
141
+ return icon;
142
+ }
116
143
  }
117
- CellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CellComponent, deps: [{ token: i1.EditService }, { token: i2.FocusGroup }], target: i0.ɵɵFactoryTarget.Component });
118
- CellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: CellComponent, selector: "[kendoTreeListCell]", inputs: { column: "column", columnIndex: "columnIndex", isNew: "isNew", level: "level", hasChildren: "hasChildren", isExpanded: "isExpanded", loading: "loading", expandIcons: "expandIcons", selected: "selected", dataItem: "dataItem", viewItem: "viewItem" }, host: { properties: { "class.k-command-cell": "this.commandCellClass", "class.k-checkbox-cell": "this.isCheckboxColumn", "class.k-text-nowrap": "this.textNoWrapClass" } }, ngImport: i0, template: `
144
+ CellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CellComponent, deps: [{ token: i1.EditService }, { token: i2.LocalizationService }, { token: i3.FocusGroup }], target: i0.ɵɵFactoryTarget.Component });
145
+ CellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: CellComponent, selector: "[kendoTreeListCell]", inputs: { column: "column", columnIndex: "columnIndex", isNew: "isNew", level: "level", hasChildren: "hasChildren", isExpanded: "isExpanded", loading: "loading", expandIcons: "expandIcons", selected: "selected", dataItem: "dataItem", viewItem: "viewItem" }, host: { properties: { "class.k-command-cell": "this.commandCellClass", "class.k-checkbox-cell": "this.isCheckboxColumn", "class.k-text-nowrap": "this.textNoWrapClass", "class.k-drag-cell": "this.dragHandleCellClass", "class.k-touch-action-none": "this.dragHandleCellClass", "attr.aria-label": "this.dragRowHandleLabel" } }, ngImport: i0, template: `
119
146
  <ng-container [ngSwitch]="isEdited">
120
147
  <ng-container *ngSwitchCase="false">
121
148
  <ng-container *ngIf="column.expandable">
@@ -123,8 +150,8 @@ CellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version:
123
150
  <kendo-icon-wrapper
124
151
  aria-hidden="true"
125
152
  *ngIf="hasChildren && expandIcons && !loading"
126
- [name]="isExpanded ? 'caret-alt-down' : 'caret-alt-right'"
127
- [svgIcon]="isExpanded ? caretAltDownIcon : caretAltRightIcon"></kendo-icon-wrapper>
153
+ [name]="arrowIcon"
154
+ [svgIcon]="arrowSVGIcon"></kendo-icon-wrapper>
128
155
  <span class="k-icon k-i-loading" *ngIf="hasChildren && expandIcons && loading"></span>
129
156
  </ng-container>
130
157
  <ng-container *ngIf="column.templateRef"
@@ -144,6 +171,12 @@ CellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version:
144
171
  class="k-checkbox k-checkbox-md k-rounded-md"
145
172
  [checked]="selected" />
146
173
  </ng-template>
174
+ <ng-container *ngIf="column.isRowReorderColumn && !isNew">
175
+ <kendo-icon-wrapper
176
+ name="reorder"
177
+ [svgIcon]="reorderIcon">
178
+ </kendo-icon-wrapper>
179
+ </ng-container>
147
180
  </ng-container>
148
181
  <ng-container *ngSwitchCase="true">
149
182
  <ng-container
@@ -184,7 +217,7 @@ CellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version:
184
217
  </ng-container>
185
218
  </ng-container>
186
219
  </ng-container>
187
- `, isInline: true, components: [{ type: i3.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }, { type: i4.NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode"], outputs: ["valueChange", "focus", "blur"], exportAs: ["kendoNumericTextBox"] }, { type: i5.DatePickerComponent, selector: "kendo-datepicker", inputs: ["focusableId", "cellTemplate", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "headerTitleTemplate", "navigationItemTemplate", "activeView", "bottomView", "topView", "calendarType", "animateCalendarNavigation", "disabled", "readonly", "readOnlyInput", "popupSettings", "navigation", "min", "max", "incompleteDateValidation", "focusedDate", "value", "format", "twoDigitYearMax", "formatPlaceholder", "placeholder", "tabindex", "tabIndex", "disabledDates", "title", "subtitle", "rangeValidation", "disabledDatesValidation", "weekNumber", "size", "rounded", "fillMode", "adaptiveMode"], outputs: ["valueChange", "focus", "blur", "open", "close"], exportAs: ["kendo-datepicker"] }], directives: [{ type: i6.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i6.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i7.FocusableDirective, selector: "[kendoTreeListFocusable],\n [kendoTreeListAddCommand],\n [kendoTreeListEditCommand],\n [kendoTreeListRemoveCommand],\n [kendoTreeListSaveCommand],\n [kendoTreeListCancelCommand]\n ", inputs: ["kendoTreeListFocusable", "enabled", "kendoTreeListAddCommand", "kendoTreeListEditCommand", "kendoTreeListRemoveCommand", "kendoTreeListSaveCommand", "kendoTreeListCancelCommand"] }, { type: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i8.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i8.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i6.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i8.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }], pipes: { "levelItems": i9.LevelItemsPipe, "valueOf": i10.FieldAccessorPipe } });
220
+ `, isInline: true, components: [{ type: i4.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { type: i5.NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode"], outputs: ["valueChange", "focus", "blur"], exportAs: ["kendoNumericTextBox"] }, { type: i6.DatePickerComponent, selector: "kendo-datepicker", inputs: ["focusableId", "cellTemplate", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "headerTitleTemplate", "navigationItemTemplate", "activeView", "bottomView", "topView", "calendarType", "animateCalendarNavigation", "disabled", "readonly", "readOnlyInput", "popupSettings", "navigation", "min", "max", "incompleteDateValidation", "focusedDate", "value", "format", "twoDigitYearMax", "formatPlaceholder", "placeholder", "tabindex", "tabIndex", "disabledDates", "title", "subtitle", "rangeValidation", "disabledDatesValidation", "weekNumber", "size", "rounded", "fillMode", "adaptiveMode"], outputs: ["valueChange", "focus", "blur", "open", "close"], exportAs: ["kendo-datepicker"] }], directives: [{ type: i7.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i8.FocusableDirective, selector: "[kendoTreeListFocusable],\n [kendoTreeListAddCommand],\n [kendoTreeListEditCommand],\n [kendoTreeListRemoveCommand],\n [kendoTreeListSaveCommand],\n [kendoTreeListCancelCommand]\n ", inputs: ["kendoTreeListFocusable", "enabled", "kendoTreeListAddCommand", "kendoTreeListEditCommand", "kendoTreeListRemoveCommand", "kendoTreeListSaveCommand", "kendoTreeListCancelCommand"] }, { type: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i9.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i9.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { type: i7.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i9.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }], pipes: { "levelItems": i10.LevelItemsPipe, "valueOf": i11.FieldAccessorPipe } });
188
221
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CellComponent, decorators: [{
189
222
  type: Component,
190
223
  args: [{
@@ -197,8 +230,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
197
230
  <kendo-icon-wrapper
198
231
  aria-hidden="true"
199
232
  *ngIf="hasChildren && expandIcons && !loading"
200
- [name]="isExpanded ? 'caret-alt-down' : 'caret-alt-right'"
201
- [svgIcon]="isExpanded ? caretAltDownIcon : caretAltRightIcon"></kendo-icon-wrapper>
233
+ [name]="arrowIcon"
234
+ [svgIcon]="arrowSVGIcon"></kendo-icon-wrapper>
202
235
  <span class="k-icon k-i-loading" *ngIf="hasChildren && expandIcons && loading"></span>
203
236
  </ng-container>
204
237
  <ng-container *ngIf="column.templateRef"
@@ -218,6 +251,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
218
251
  class="k-checkbox k-checkbox-md k-rounded-md"
219
252
  [checked]="selected" />
220
253
  </ng-template>
254
+ <ng-container *ngIf="column.isRowReorderColumn && !isNew">
255
+ <kendo-icon-wrapper
256
+ name="reorder"
257
+ [svgIcon]="reorderIcon">
258
+ </kendo-icon-wrapper>
259
+ </ng-container>
221
260
  </ng-container>
222
261
  <ng-container *ngSwitchCase="true">
223
262
  <ng-container
@@ -260,7 +299,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
260
299
  </ng-container>
261
300
  `
262
301
  }]
263
- }], ctorParameters: function () { return [{ type: i1.EditService }, { type: i2.FocusGroup }]; }, propDecorators: { commandCellClass: [{
302
+ }], ctorParameters: function () { return [{ type: i1.EditService }, { type: i2.LocalizationService }, { type: i3.FocusGroup }]; }, propDecorators: { commandCellClass: [{
264
303
  type: HostBinding,
265
304
  args: ['class.k-command-cell']
266
305
  }], isCheckboxColumn: [{
@@ -269,6 +308,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
269
308
  }], textNoWrapClass: [{
270
309
  type: HostBinding,
271
310
  args: ['class.k-text-nowrap']
311
+ }], dragHandleCellClass: [{
312
+ type: HostBinding,
313
+ args: ['class.k-drag-cell']
314
+ }, {
315
+ type: HostBinding,
316
+ args: ['class.k-touch-action-none']
317
+ }], dragRowHandleLabel: [{
318
+ type: HostBinding,
319
+ args: ['attr.aria-label']
272
320
  }], column: [{
273
321
  type: Input
274
322
  }], columnIndex: [{
@@ -9,7 +9,7 @@ import * as i0 from "@angular/core";
9
9
  * Represents the Kendo UI TreeListSpacer component for Angular.
10
10
  * Used to give additional white space between the Pager inner elements,
11
11
  * and provides a way for customizing the spacer width.
12
- * It can also be used in any flex container within the TreeList.
12
+ * It can also be used in any flex container within the TreeList. [See example](slug:toolbartemplate_treelist#toc-define-spacing-between-the-toolbar-elements).
13
13
  */
14
14
  export class TreeListSpacerComponent {
15
15
  constructor() {
@@ -22,3 +22,7 @@ export const ICON_CLASS = 'k-icon k-svg-icon';
22
22
  * @hidden
23
23
  */
24
24
  export const IGNORE_CONTAINER_CLASSES = 'k-treelist-ignore-click';
25
+ /**
26
+ * @hidden
27
+ */
28
+ export const DRAG_HANDLE_CLASS = 'k-drag-cell';
@@ -540,7 +540,7 @@ HeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
540
540
  [logicalSlaveCellsCount]="unlockedColumnsCount"
541
541
  >
542
542
  </tr>
543
- `, isInline: true, components: [{ type: i8.FilterMenuComponent, selector: "kendo-treelist-filter-menu", inputs: ["column", "filter"] }, { type: i9.ColumnMenuComponent, selector: "kendo-treelist-column-menu", inputs: ["standalone", "column", "settings", "sort", "filter", "sortable", "columnMenuTemplate"] }, { type: i10.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }, { type: i11.FilterRowComponent, selector: "[kendoTreeListFilterRow]", inputs: ["columns", "filter", "logicalRowIndex", "lockedColumnsCount"] }], directives: [{ type: i12.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13.LogicalRowDirective, selector: "[kendoTreeListLogicalRow]", inputs: ["logicalRowIndex", "logicalSlaveRow", "logicalCellsCount", "logicalSlaveCellsCount", "dataRowIndex", "dataItem", "isNew"] }, { type: i12.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i14.LogicalCellDirective, selector: "[kendoTreeListLogicalCell]", inputs: ["logicalColIndex", "logicalRowIndex", "logicalSlaveCell", "column", "colIndex", "colSpan", "rowSpan", "dataRowIndex", "dataItem", "expandable"] }, { type: i15.DropTargetDirective, selector: "[kendoDropTarget]", inputs: ["context"], outputs: ["enter", "leave", "drop"] }, { type: i16.DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { type: i17.DraggableColumnDirective, selector: "[kendoDraggableColumn]", inputs: ["context", "enableDrag"], outputs: ["drag"] }, { type: i12.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i12.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i18.TemplateContextDirective, selector: "[templateContext]", inputs: ["templateContext"] }, { type: i19.FocusableDirective, selector: "[kendoTreeListFocusable],\n [kendoTreeListAddCommand],\n [kendoTreeListEditCommand],\n [kendoTreeListRemoveCommand],\n [kendoTreeListSaveCommand],\n [kendoTreeListCancelCommand]\n ", inputs: ["kendoTreeListFocusable", "enabled", "kendoTreeListAddCommand", "kendoTreeListEditCommand", "kendoTreeListRemoveCommand", "kendoTreeListSaveCommand", "kendoTreeListCancelCommand"] }, { type: i20.ColumnHandleDirective, selector: "[kendoTreeListColumnHandle]", inputs: ["columns", "column"] }] });
543
+ `, isInline: true, components: [{ type: i8.FilterMenuComponent, selector: "kendo-treelist-filter-menu", inputs: ["column", "filter"] }, { type: i9.ColumnMenuComponent, selector: "kendo-treelist-column-menu", inputs: ["standalone", "column", "settings", "sort", "filter", "sortable", "columnMenuTemplate"] }, { type: i10.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { type: i11.FilterRowComponent, selector: "[kendoTreeListFilterRow]", inputs: ["columns", "filter", "logicalRowIndex", "lockedColumnsCount"] }], directives: [{ type: i12.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i13.LogicalRowDirective, selector: "[kendoTreeListLogicalRow]", inputs: ["logicalRowIndex", "logicalSlaveRow", "logicalCellsCount", "logicalSlaveCellsCount", "dataRowIndex", "dataItem", "isNew"] }, { type: i12.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i14.LogicalCellDirective, selector: "[kendoTreeListLogicalCell]", inputs: ["logicalColIndex", "logicalRowIndex", "logicalSlaveCell", "column", "colIndex", "colSpan", "rowSpan", "dataRowIndex", "dataItem", "expandable"] }, { type: i15.DropTargetDirective, selector: "[kendoDropTarget]", inputs: ["context"], outputs: ["enter", "leave", "drop"] }, { type: i16.DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { type: i17.DraggableColumnDirective, selector: "[kendoDraggableColumn]", inputs: ["context", "enableDrag"], outputs: ["drag"] }, { type: i12.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i12.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i18.TemplateContextDirective, selector: "[templateContext]", inputs: ["templateContext"] }, { type: i19.FocusableDirective, selector: "[kendoTreeListFocusable],\n [kendoTreeListAddCommand],\n [kendoTreeListEditCommand],\n [kendoTreeListRemoveCommand],\n [kendoTreeListSaveCommand],\n [kendoTreeListCancelCommand]\n ", inputs: ["kendoTreeListFocusable", "enabled", "kendoTreeListAddCommand", "kendoTreeListEditCommand", "kendoTreeListRemoveCommand", "kendoTreeListSaveCommand", "kendoTreeListCancelCommand"] }, { type: i20.ColumnHandleDirective, selector: "[kendoTreeListColumnHandle]", inputs: ["columns", "column"] }] });
544
544
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HeaderComponent, decorators: [{
545
545
  type: Component,
546
546
  args: [{
@@ -18,7 +18,7 @@ import { Keys } from '@progress/kendo-angular-common';
18
18
  import { defaultTrackBy } from '../common/default-track-by';
19
19
  import { ExpandStateService } from '../expand-state/expand-state.service';
20
20
  import { SelectionService } from '../selection/selection.service';
21
- import { NON_DATA_CELL_CLASSES, NON_DATA_ROW_CLASSES, IGNORE_CONTAINER_CLASSES, ICON_CLASS, EMPTY_ICON_CLASS } from './constants';
21
+ import { NON_DATA_CELL_CLASSES, NON_DATA_ROW_CLASSES, IGNORE_CONTAINER_CLASSES, ICON_CLASS, EMPTY_ICON_CLASS, DRAG_HANDLE_CLASS } from './constants';
22
22
  import * as i0 from "@angular/core";
23
23
  import * as i1 from "../data/change-notification.service";
24
24
  import * as i2 from "../editing/edit.service";
@@ -213,8 +213,10 @@ export class TableBodyComponent {
213
213
  clickHandler(eventArg) {
214
214
  const target = eventArg.target;
215
215
  const { cell, row } = this.targetElements(target);
216
- if (cell && !hasClasses(cell, NON_DATA_CELL_CLASSES) &&
217
- !hasClasses(row, NON_DATA_ROW_CLASSES)) {
216
+ const forbiddenCellClasses = NON_DATA_CELL_CLASSES.concat(` ${DRAG_HANDLE_CLASS}`);
217
+ const isValidCell = cell ? !hasClasses(cell, forbiddenCellClasses) : false;
218
+ const isValidRow = row ? !hasClasses(row, NON_DATA_ROW_CLASSES) : false;
219
+ if (isValidRow && isValidCell) {
218
220
  if (this.expandClick(eventArg, row) || this.checkboxClick(cell, row, eventArg)) {
219
221
  return;
220
222
  }
@@ -0,0 +1,48 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Injectable } from "@angular/core";
6
+ import { RowReorderService } from './row-reorder.service';
7
+ import { isPresent } from "../utils";
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * @hidden
11
+ */
12
+ export class FlatRowReorderService extends RowReorderService {
13
+ isOverChild(targetItem) {
14
+ const { draggedRows } = this.rowReorderArgs(this.dragTarget, this.dropTarget, this.view);
15
+ const draggedItem = draggedRows[0].dataItem;
16
+ const hasParent = isPresent(targetItem[this.parentIdField]);
17
+ const sameParents = draggedItem[this.parentIdField] === targetItem[this.parentIdField];
18
+ if (!hasParent || sameParents) {
19
+ return false;
20
+ }
21
+ if (targetItem && targetItem.hasOwnProperty(this.parentIdField)) {
22
+ if (draggedItem[this.idField] === targetItem[this.parentIdField]) {
23
+ return true;
24
+ }
25
+ const parent = this.data.find(i => i[this.idField] === targetItem[this.parentIdField]);
26
+ if (parent) {
27
+ return this.isOverChild(parent);
28
+ }
29
+ }
30
+ }
31
+ reorderRows(ev, collection) {
32
+ const { draggedRows, dropTargetRow } = ev;
33
+ const draggedDataItem = draggedRows[0].dataItem;
34
+ const dropTargetDataItem = dropTargetRow.dataItem;
35
+ let dropTargetIdx = collection.indexOf(dropTargetDataItem);
36
+ const draggedItemIdx = collection.indexOf(draggedDataItem);
37
+ collection.splice(draggedItemIdx, 1);
38
+ if (ev.dropPosition === 'after' && dropTargetIdx < draggedItemIdx) {
39
+ dropTargetIdx++;
40
+ }
41
+ collection.splice(dropTargetIdx, 0, draggedDataItem);
42
+ }
43
+ }
44
+ FlatRowReorderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FlatRowReorderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
45
+ FlatRowReorderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FlatRowReorderService });
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FlatRowReorderService, decorators: [{
47
+ type: Injectable
48
+ }] });
@@ -0,0 +1,55 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Injectable } from "@angular/core";
6
+ import { RowReorderService } from './row-reorder.service';
7
+ import { isPresent } from "../utils";
8
+ import { dropPosition, findParent } from "./utils";
9
+ import * as i0 from "@angular/core";
10
+ /**
11
+ * @hidden
12
+ */
13
+ export class HierarchicalRowReorderService extends RowReorderService {
14
+ isOverChild(targetItem) {
15
+ const { draggedRows } = this.rowReorderArgs(this.dragTarget, this.dropTarget, this.view);
16
+ const draggedItem = draggedRows[0].dataItem;
17
+ const hasChildren = isPresent(draggedItem[this.childrenField]) && draggedItem[this.childrenField].length > 0;
18
+ if (!hasChildren) {
19
+ return false;
20
+ }
21
+ if (targetItem && draggedItem.hasOwnProperty(this.childrenField)) {
22
+ if (draggedItem[this.childrenField].includes(targetItem)) {
23
+ return true;
24
+ }
25
+ const parent = findParent(this.data, targetItem, this.childrenField);
26
+ if (parent) {
27
+ return this.isOverChild(parent);
28
+ }
29
+ }
30
+ return false;
31
+ }
32
+ reorderRows(ev, collection, field) {
33
+ const draggedItem = ev.draggedRows[0].dataItem;
34
+ const dropTargetItem = ev.dropTargetRow.dataItem;
35
+ const draggedItemParent = findParent(collection, draggedItem, field);
36
+ const dropTargetParent = findParent(collection, dropTargetItem, field);
37
+ const draggedItemIdx = draggedItemParent ? draggedItemParent[field].indexOf(draggedItem) : collection.indexOf(draggedItem);
38
+ let dropTargetItemIdx = dropTargetParent ? dropTargetParent[field].indexOf(dropTargetItem) : collection.indexOf(dropTargetItem);
39
+ if (ev.dropPosition === dropPosition.after && dropTargetItemIdx < draggedItemIdx) {
40
+ dropTargetItemIdx++;
41
+ }
42
+ draggedItemParent ? draggedItemParent[field].splice(draggedItemIdx, 1) : collection.splice(draggedItemIdx, 1);
43
+ if (ev.dropPosition !== dropPosition.over) {
44
+ dropTargetParent ? dropTargetParent[field].splice(dropTargetItemIdx, 0, draggedItem) : collection.splice(dropTargetItemIdx, 0, draggedItem);
45
+ }
46
+ else {
47
+ dropTargetItem[field].unshift(draggedItem);
48
+ }
49
+ }
50
+ }
51
+ HierarchicalRowReorderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HierarchicalRowReorderService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
52
+ HierarchicalRowReorderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HierarchicalRowReorderService });
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HierarchicalRowReorderService, decorators: [{
54
+ type: Injectable
55
+ }] });
@@ -0,0 +1,220 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { EventEmitter, Injectable, Output, Renderer2 } from '@angular/core';
6
+ import { isDocumentAvailable, isPresent } from '@progress/kendo-angular-common';
7
+ import { getOffset, isNextSibling, isPreviousSibling, dropPosition, hintIcons, hintSVGIcons, hintClasses, hintStyles, dropIndicatorClasses, dropIndicatorStyles, defaultSelectors, rowIndexAttr } from './utils';
8
+ import * as i0 from "@angular/core";
9
+ /**
10
+ * @hidden
11
+ */
12
+ export class RowReorderService {
13
+ constructor(renderer) {
14
+ this.renderer = renderer;
15
+ this.defaultSelectors = defaultSelectors;
16
+ this.dragTarget = null;
17
+ this.dropTarget = null;
18
+ this.lastDropPosition = dropPosition.forbidden;
19
+ this.hintElement = null;
20
+ this.rowReorder = new EventEmitter();
21
+ }
22
+ press(ev) {
23
+ this.dragTarget = ev.dragTarget;
24
+ this.offsetY = ev.dragEvent.offsetY;
25
+ }
26
+ dragStart() {
27
+ this.createDropIndicator();
28
+ }
29
+ drag(ev) {
30
+ if (isPresent(ev.hintElement) && !isPresent(this.hintElement)) {
31
+ this.hintElement = ev.hintElement;
32
+ this.decorateHint();
33
+ }
34
+ const position = {
35
+ x: ev.dragEvent.clientX,
36
+ y: ev.dragEvent.clientY - this.offsetY
37
+ };
38
+ if (isPresent(this.hintElement)) {
39
+ this.renderer.setStyle(this.hintElement, 'left', `${position.x}px`);
40
+ this.renderer.setStyle(this.hintElement, 'top', `${position.y}px`);
41
+ }
42
+ this.positionDropIndicator(ev);
43
+ }
44
+ dragEnter(ev) {
45
+ this.dropTarget = ev.dropTarget;
46
+ this.view = ev.dragData;
47
+ }
48
+ dragLeave() {
49
+ this.dropTarget = null;
50
+ this.lastDropPosition === dropPosition.forbidden && this.hide();
51
+ }
52
+ dragEnd() {
53
+ this.destroyDropIndicator();
54
+ this.dragTarget = null;
55
+ this.dropTarget = null;
56
+ this.hintElement = null;
57
+ }
58
+ drop() {
59
+ this.destroyDropIndicator();
60
+ const rowReorderArgs = this.rowReorderArgs(this.dragTarget, this.dropTarget, this.view);
61
+ this.rowReorder.emit(rowReorderArgs);
62
+ }
63
+ get hintIcon() {
64
+ return hintIcons[this.lastDropPosition];
65
+ }
66
+ get hintSVGIcon() {
67
+ return hintSVGIcons[this.lastDropPosition];
68
+ }
69
+ getDefaultHintText(columns, data) {
70
+ let hintText = '';
71
+ const columnFieldsArray = columns
72
+ .toArray()
73
+ .filter(column => !column.hidden && isPresent(column.field))
74
+ .map(column => column.field);
75
+ const draggedDragRow = this.getDragRowPerElement(this.dragTarget, data);
76
+ const draggedDataItem = draggedDragRow?.dataItem;
77
+ isPresent(draggedDataItem) && columnFieldsArray.forEach(column => {
78
+ const columnValue = draggedDataItem[column];
79
+ isPresent(columnValue) ? hintText += `${columnValue} ` : null;
80
+ });
81
+ return hintText.trim();
82
+ }
83
+ rowReorderArgs(dragRow, dropRow, data) {
84
+ const dragRowData = this.getDragRowPerElement(dragRow, data);
85
+ const dropRowData = this.getDragRowPerElement(dropRow, data);
86
+ return {
87
+ draggedRows: [dragRowData],
88
+ dropTargetRow: dropRowData,
89
+ dropPosition: this.lastDropPosition
90
+ };
91
+ }
92
+ isOverChild(_item) { return false; }
93
+ reorderRows(_ev, _collection, _field) { }
94
+ get parentIdField() {
95
+ return this.bindingDirective.parentIdField;
96
+ }
97
+ get idField() {
98
+ return this.bindingDirective.idField;
99
+ }
100
+ get childrenField() {
101
+ return this.bindingDirective.childrenField;
102
+ }
103
+ get data() {
104
+ return this.bindingDirective.data;
105
+ }
106
+ getDragRowPerElement(row, data) {
107
+ let rowIndex = row?.getAttribute(rowIndexAttr);
108
+ rowIndex = rowIndex ? parseInt(rowIndex, 10) : -1;
109
+ const dataItem = rowIndex === -1 ? null : data?.at(rowIndex)?.data;
110
+ return {
111
+ dataItem,
112
+ rowIndex,
113
+ element: row
114
+ };
115
+ }
116
+ createDropIndicator() {
117
+ if (!isDocumentAvailable()) {
118
+ return;
119
+ }
120
+ this.dropIndicator = document.createElement('div');
121
+ this.decorateDropIndicator();
122
+ this.dropIndicator.innerHTML = `
123
+ <div class="k-drop-hint-start"></div>
124
+ <div class="k-drop-hint-line"></div>
125
+ `;
126
+ document.body.appendChild(this.dropIndicator);
127
+ this.hide();
128
+ }
129
+ destroyDropIndicator() {
130
+ if (!isDocumentAvailable()) {
131
+ return;
132
+ }
133
+ ;
134
+ if (this.dropIndicator && this.dropIndicator.parentElement) {
135
+ document.body.removeChild(this.dropIndicator);
136
+ this.dropIndicator = null;
137
+ }
138
+ }
139
+ decorateHint() {
140
+ hintClasses.forEach(className => this.renderer.addClass(this.hintElement, className));
141
+ Object.keys(hintStyles)
142
+ .forEach(style => this.renderer.setStyle(this.hintElement, style, hintStyles[style]));
143
+ }
144
+ positionDropIndicator(ev) {
145
+ this.lastDropPosition = this.getDropPosition(ev.dragEvent);
146
+ this.updateDropIndicatorPosition();
147
+ }
148
+ decorateDropIndicator() {
149
+ dropIndicatorClasses.forEach(className => this.renderer.addClass(this.dropIndicator, className));
150
+ Object.keys(dropIndicatorStyles)
151
+ .forEach(style => this.renderer.setStyle(this.dropIndicator, style, dropIndicatorStyles[style]));
152
+ }
153
+ getDropPosition(e) {
154
+ if (this.dropTarget === this.dragTarget || !isPresent(this.dropTarget)) {
155
+ return dropPosition.forbidden;
156
+ }
157
+ ;
158
+ const itemViewPortCoords = this.dropTarget.getBoundingClientRect();
159
+ const itemDivisionsCount = 3;
160
+ const itemDivisionHeight = itemViewPortCoords.height / itemDivisionsCount;
161
+ const { dropTargetRow } = this.rowReorderArgs(this.dragTarget, this.dropTarget, this.view);
162
+ const pointerPosition = e.clientY;
163
+ const itemTop = itemViewPortCoords.top;
164
+ let currentDropPosition = null;
165
+ if (pointerPosition <= itemTop + itemDivisionHeight) {
166
+ currentDropPosition = dropPosition.before;
167
+ }
168
+ else if (pointerPosition >= itemTop + itemViewPortCoords.height - itemDivisionHeight) {
169
+ currentDropPosition = dropPosition.after;
170
+ }
171
+ else {
172
+ currentDropPosition = dropPosition.over;
173
+ }
174
+ if (currentDropPosition === dropPosition.before && isNextSibling(this.dropTarget, this.dragTarget)) {
175
+ currentDropPosition = dropPosition.forbidden;
176
+ }
177
+ else if (currentDropPosition === dropPosition.after && isPreviousSibling(this.dropTarget, this.dragTarget)) {
178
+ currentDropPosition = dropPosition.forbidden;
179
+ }
180
+ if (this.isOverChild(dropTargetRow.dataItem)) {
181
+ currentDropPosition = dropPosition.forbidden;
182
+ }
183
+ return currentDropPosition;
184
+ }
185
+ updateDropIndicatorPosition() {
186
+ if (this.shouldHideDropIndicator() || !this.dropTarget) {
187
+ this.hide();
188
+ return;
189
+ }
190
+ this.show();
191
+ const destinationItemOffset = getOffset(this.dropTarget);
192
+ let indicatorOffsetTop = destinationItemOffset.top;
193
+ const indicatorOffsetLeft = destinationItemOffset.left + this.dropIndicator.offsetWidth / 2;
194
+ if (this.lastDropPosition === dropPosition.after) {
195
+ indicatorOffsetTop += this.dropTarget.offsetHeight;
196
+ }
197
+ this.renderer.setStyle(this.dropIndicator, 'left', `${indicatorOffsetLeft}px`);
198
+ this.renderer.setStyle(this.dropIndicator, 'top', `${indicatorOffsetTop}px`);
199
+ }
200
+ shouldHideDropIndicator() {
201
+ return this.lastDropPosition === dropPosition.forbidden || this.lastDropPosition === dropPosition.over;
202
+ }
203
+ hide() {
204
+ if (isPresent(this.dropIndicator)) {
205
+ this.renderer.setStyle(this.dropIndicator, 'display', 'none');
206
+ }
207
+ }
208
+ show() {
209
+ if (isPresent(this.dropIndicator)) {
210
+ this.renderer.removeStyle(this.dropIndicator, 'display');
211
+ }
212
+ }
213
+ }
214
+ RowReorderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RowReorderService, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Injectable });
215
+ RowReorderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RowReorderService });
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RowReorderService, decorators: [{
217
+ type: Injectable
218
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { rowReorder: [{
219
+ type: Output
220
+ }] } });
@@ -0,0 +1,5 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ export {};