@progress/kendo-angular-sortable 11.2.0-develop.9 → 11.2.0
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/esm2020/binding.directive.mjs +3 -3
- package/esm2020/draggable.directive.mjs +3 -3
- package/esm2020/item-template.directive.mjs +6 -6
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/sortable-container.mjs +3 -3
- package/esm2020/sortable.component.mjs +171 -55
- package/esm2020/sortable.module.mjs +4 -4
- package/esm2020/sortable.service.mjs +3 -3
- package/esm2020/util.mjs +33 -1
- package/fesm2015/progress-kendo-angular-sortable.mjs +226 -78
- package/fesm2020/progress-kendo-angular-sortable.mjs +226 -78
- package/package.json +4 -4
- package/sortable.component.d.ts +38 -4
- package/util.d.ts +12 -0
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { Injectable, Directive, Input, HostBinding, EventEmitter, forwardRef, TemplateRef, Component, ContentChildren, ViewChildren, ViewChild, Output, NgModule } from '@angular/core';
|
|
6
|
+
import { Injectable, Directive, Input, HostBinding, QueryList, EventEmitter, forwardRef, TemplateRef, Component, ContentChildren, ViewChildren, ViewChild, Output, NgModule } from '@angular/core';
|
|
7
7
|
import { Subject, merge } from 'rxjs';
|
|
8
|
-
import { isDocumentAvailable, isChanged } from '@progress/kendo-angular-common';
|
|
8
|
+
import { isDocumentAvailable, focusableSelector, isChanged, Keys } from '@progress/kendo-angular-common';
|
|
9
9
|
import { filter, tap, take, switchMap } from 'rxjs/operators';
|
|
10
10
|
import * as i1 from '@progress/kendo-angular-l10n';
|
|
11
11
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
@@ -85,6 +85,38 @@ const draggableFromEvent = (event, sortable) => {
|
|
|
85
85
|
// TODO: refactor sortable. Add draggable getter
|
|
86
86
|
return sortable.draggables.toArray()[target ? target.index : -1];
|
|
87
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* @hidden
|
|
90
|
+
*/
|
|
91
|
+
const getAllFocusableChildren = (parent) => {
|
|
92
|
+
return Array.from(parent.querySelectorAll(focusableSelector)).filter((element) => element.offsetParent !== null);
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* @hidden
|
|
96
|
+
*/
|
|
97
|
+
const getFirstAndLastFocusable = (parent) => {
|
|
98
|
+
const all = getAllFocusableChildren(parent);
|
|
99
|
+
const firstFocusable = all.length > 0 ? all[0] : parent;
|
|
100
|
+
const lastFocusable = all.length > 0 ? all[all.length - 1] : parent;
|
|
101
|
+
return [firstFocusable, lastFocusable];
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* @hidden
|
|
105
|
+
*/
|
|
106
|
+
const keepFocusWithinComponent = (event, wrapper) => {
|
|
107
|
+
const [firstFocusable, lastFocusable] = getFirstAndLastFocusable(wrapper);
|
|
108
|
+
const tabAfterLastFocusable = !event.shiftKey && event.target === lastFocusable;
|
|
109
|
+
const shiftTabAfterFirstFocusable = event.shiftKey && event.target === firstFocusable;
|
|
110
|
+
if (tabAfterLastFocusable) {
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
firstFocusable.focus();
|
|
113
|
+
wrapper.blur();
|
|
114
|
+
}
|
|
115
|
+
if (shiftTabAfterFirstFocusable) {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
lastFocusable.focus();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
88
120
|
/**
|
|
89
121
|
* @hidden
|
|
90
122
|
*/
|
|
@@ -157,8 +189,8 @@ const packageMetadata = {
|
|
|
157
189
|
name: '@progress/kendo-angular-sortable',
|
|
158
190
|
productName: 'Kendo UI for Angular',
|
|
159
191
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
160
|
-
publishDate:
|
|
161
|
-
version: '11.2.0
|
|
192
|
+
publishDate: 1676453551,
|
|
193
|
+
version: '11.2.0',
|
|
162
194
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
163
195
|
};
|
|
164
196
|
|
|
@@ -167,9 +199,9 @@ const packageMetadata = {
|
|
|
167
199
|
*/
|
|
168
200
|
class SortableContainer {
|
|
169
201
|
}
|
|
170
|
-
SortableContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
171
|
-
SortableContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
172
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
202
|
+
SortableContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
203
|
+
SortableContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableContainer });
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableContainer, decorators: [{
|
|
173
205
|
type: Injectable
|
|
174
206
|
}] });
|
|
175
207
|
|
|
@@ -217,9 +249,9 @@ class DraggableDirective {
|
|
|
217
249
|
this.renderer.setStyle(this.el.nativeElement, 'display', this.display);
|
|
218
250
|
}
|
|
219
251
|
}
|
|
220
|
-
DraggableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
221
|
-
DraggableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.
|
|
222
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
252
|
+
DraggableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DraggableDirective, deps: [{ token: SortableContainer }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
253
|
+
DraggableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: DraggableDirective, selector: "[kendoDraggable]", inputs: { index: "index", disabled: "disabled", hidden: "hidden" }, host: { properties: { "class.k-focus": "this._focused", "attr.aria-disabled": "this._disabled" } }, ngImport: i0 });
|
|
254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DraggableDirective, decorators: [{
|
|
223
255
|
type: Directive,
|
|
224
256
|
args: [{
|
|
225
257
|
selector: '[kendoDraggable]'
|
|
@@ -247,9 +279,9 @@ class ItemTemplateDirective {
|
|
|
247
279
|
this.templateRef = templateRef;
|
|
248
280
|
}
|
|
249
281
|
}
|
|
250
|
-
ItemTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
251
|
-
ItemTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.
|
|
252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
282
|
+
ItemTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ItemTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
283
|
+
ItemTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: ItemTemplateDirective, selector: "[kendoSortableItemTemplate]", ngImport: i0 });
|
|
284
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ItemTemplateDirective, decorators: [{
|
|
253
285
|
type: Directive,
|
|
254
286
|
args: [{
|
|
255
287
|
selector: '[kendoSortableItemTemplate]'
|
|
@@ -263,9 +295,9 @@ class PlaceholderTemplateDirective {
|
|
|
263
295
|
this.templateRef = templateRef;
|
|
264
296
|
}
|
|
265
297
|
}
|
|
266
|
-
PlaceholderTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
267
|
-
PlaceholderTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.
|
|
268
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
298
|
+
PlaceholderTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: PlaceholderTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
299
|
+
PlaceholderTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: PlaceholderTemplateDirective, selector: "[kendoSortablePlaceholderTemplate]", ngImport: i0 });
|
|
300
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: PlaceholderTemplateDirective, decorators: [{
|
|
269
301
|
type: Directive,
|
|
270
302
|
args: [{
|
|
271
303
|
selector: '[kendoSortablePlaceholderTemplate]'
|
|
@@ -574,12 +606,14 @@ class SortableService {
|
|
|
574
606
|
});
|
|
575
607
|
}
|
|
576
608
|
}
|
|
577
|
-
SortableService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
578
|
-
SortableService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
579
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
609
|
+
SortableService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
610
|
+
SortableService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableService });
|
|
611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableService, decorators: [{
|
|
580
612
|
type: Injectable
|
|
581
613
|
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
|
582
614
|
|
|
615
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
616
|
+
const KEY_SHORTCUTS = 'Control+ArrowLeft Control+ArrowRight Meta+ArrowLeft Meta+ArrowRight';
|
|
583
617
|
/**
|
|
584
618
|
* Represents the [Kendo UI Sortable component for Angular]({% slug overview_sortable %}).
|
|
585
619
|
*
|
|
@@ -593,10 +627,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
593
627
|
* Represents the Kendo UI Sortable component for Angular.
|
|
594
628
|
*/
|
|
595
629
|
class SortableComponent {
|
|
596
|
-
constructor(ngZone,
|
|
630
|
+
constructor(ngZone, renderer, changeDetector, localization, wrapper, sortableService) {
|
|
597
631
|
this.ngZone = ngZone;
|
|
598
|
-
this.
|
|
632
|
+
this.renderer = renderer;
|
|
599
633
|
this.changeDetector = changeDetector;
|
|
634
|
+
this.localization = localization;
|
|
600
635
|
/**
|
|
601
636
|
* Specifies the tab index of the Sortable component.
|
|
602
637
|
*/
|
|
@@ -722,7 +757,7 @@ class SortableComponent {
|
|
|
722
757
|
* @hidden
|
|
723
758
|
*/
|
|
724
759
|
this.placeholderTemplateDirectiveRef = null;
|
|
725
|
-
this.itemWrappers =
|
|
760
|
+
this.itemWrappers = new QueryList();
|
|
726
761
|
/**
|
|
727
762
|
* Fires when the dragging of an item is started.
|
|
728
763
|
*/
|
|
@@ -760,6 +795,7 @@ class SortableComponent {
|
|
|
760
795
|
* If no item is focused, set to `-1`.
|
|
761
796
|
*/
|
|
762
797
|
this.activeIndex = -1;
|
|
798
|
+
this.hostRole = 'list';
|
|
763
799
|
/**
|
|
764
800
|
* Flag indicating if the component is currently playing animations.
|
|
765
801
|
* @hidden
|
|
@@ -782,10 +818,16 @@ class SortableComponent {
|
|
|
782
818
|
*/
|
|
783
819
|
this.hintLocation = null;
|
|
784
820
|
this._localData = [];
|
|
821
|
+
/**
|
|
822
|
+
* @hidden
|
|
823
|
+
*/
|
|
824
|
+
this.ariaKeyShortcuts = KEY_SHORTCUTS;
|
|
825
|
+
this.focusableItems = [];
|
|
785
826
|
this.animationDuration = 300;
|
|
786
827
|
this.afterKeyPress = false;
|
|
787
828
|
this.sortableService = null;
|
|
788
829
|
this._hideActiveItem = false;
|
|
830
|
+
this.prevActiveIndex = 0;
|
|
789
831
|
validatePackage(packageMetadata);
|
|
790
832
|
this.wrapper = wrapper.nativeElement;
|
|
791
833
|
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
@@ -866,6 +908,18 @@ class SortableComponent {
|
|
|
866
908
|
});
|
|
867
909
|
}
|
|
868
910
|
}
|
|
911
|
+
ngAfterViewInit() {
|
|
912
|
+
if (this.navigable) {
|
|
913
|
+
this.setInitialItemTabindex();
|
|
914
|
+
this.setFocusableChildren();
|
|
915
|
+
}
|
|
916
|
+
this.childrenTabindexSubscription = this.itemWrappers.changes.subscribe(() => {
|
|
917
|
+
if (this.navigable) {
|
|
918
|
+
this.setInitialItemTabindex();
|
|
919
|
+
this.setFocusableChildren();
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
}
|
|
869
923
|
ngOnChanges(changes) {
|
|
870
924
|
if (this.data && isChanged('disabledIndexes', changes, false)) {
|
|
871
925
|
this.cacheData();
|
|
@@ -883,16 +937,35 @@ class SortableComponent {
|
|
|
883
937
|
this.placeholderTemplateRef = this.placeholderTemplateDirectiveRef.first || this.defaultTemplateRef.first;
|
|
884
938
|
}
|
|
885
939
|
ngAfterViewChecked() {
|
|
886
|
-
if (this.
|
|
887
|
-
if (this.
|
|
940
|
+
if (this.navigable) {
|
|
941
|
+
if (this.afterKeyPress) {
|
|
888
942
|
const elems = this.itemWrappers.toArray();
|
|
889
943
|
if (elems && elems.length > 0 && this.activeIndex > -1) {
|
|
890
|
-
elems[this.activeIndex].nativeElement
|
|
944
|
+
const currentItem = elems[this.activeIndex].nativeElement;
|
|
945
|
+
const prevItem = elems[this.prevActiveIndex].nativeElement;
|
|
946
|
+
this.renderer.setAttribute(prevItem, 'tabindex', '-1');
|
|
947
|
+
this.renderer.setAttribute(currentItem, 'tabindex', '0');
|
|
948
|
+
currentItem.focus();
|
|
891
949
|
}
|
|
892
950
|
}
|
|
893
951
|
this.afterKeyPress = false;
|
|
894
952
|
}
|
|
895
953
|
}
|
|
954
|
+
/**
|
|
955
|
+
* @hidden
|
|
956
|
+
*/
|
|
957
|
+
setFocusableChildren() {
|
|
958
|
+
this.itemWrappers.toArray().forEach((item) => {
|
|
959
|
+
const itemEl = item.nativeElement;
|
|
960
|
+
const focusableChildren = getAllFocusableChildren(itemEl);
|
|
961
|
+
if (focusableChildren.length > 0) {
|
|
962
|
+
this.focusableItems.push(focusableChildren);
|
|
963
|
+
focusableChildren.forEach(focusableChild => {
|
|
964
|
+
this.renderer.setAttribute(focusableChild, 'tabindex', '-1');
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
}
|
|
896
969
|
/**
|
|
897
970
|
* @hidden
|
|
898
971
|
*/
|
|
@@ -922,6 +995,21 @@ class SortableComponent {
|
|
|
922
995
|
}
|
|
923
996
|
return prevented;
|
|
924
997
|
}
|
|
998
|
+
/**
|
|
999
|
+
* @hidden
|
|
1000
|
+
*/
|
|
1001
|
+
setInitialItemTabindex() {
|
|
1002
|
+
this.itemWrappers.toArray().forEach((item, index) => {
|
|
1003
|
+
if (this.itemEnabled(index)) {
|
|
1004
|
+
const isFirstItem = index === 0 ? 0 : -1;
|
|
1005
|
+
const tabIndexValue = `${this.navigable ? this.tabIndex || isFirstItem : this.tabIndex}`;
|
|
1006
|
+
const hasItemTabindex = item.nativeElement.getAttribute('tabindex');
|
|
1007
|
+
if (!hasItemTabindex) {
|
|
1008
|
+
this.renderer.setAttribute(item.nativeElement, 'tabindex', tabIndexValue);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
925
1013
|
/**
|
|
926
1014
|
* @hidden
|
|
927
1015
|
*/
|
|
@@ -1037,44 +1125,85 @@ class SortableComponent {
|
|
|
1037
1125
|
*/
|
|
1038
1126
|
blurHandler() {
|
|
1039
1127
|
if (this.navigable && !this.afterKeyPress) {
|
|
1128
|
+
this.prevActiveIndex = this.activeIndex;
|
|
1040
1129
|
this.activeIndex = -1;
|
|
1041
1130
|
}
|
|
1042
1131
|
}
|
|
1043
1132
|
/**
|
|
1044
1133
|
* @hidden
|
|
1045
1134
|
*/
|
|
1046
|
-
|
|
1047
|
-
const
|
|
1048
|
-
const
|
|
1049
|
-
const hasFocus = this.activeIndex !== -1;
|
|
1050
|
-
if (!navigate || !hasFocus) {
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
const leftKey = this.direction === 'rtl' ? 39 : 37;
|
|
1054
|
-
const dir = code === 38 || code === leftKey ? -1 : 1;
|
|
1135
|
+
onArrowHandler(event, keyCode) {
|
|
1136
|
+
const leftKey = this.direction === 'rtl' ? Keys.ArrowRight : Keys.ArrowLeft;
|
|
1137
|
+
const dir = keyCode === Keys.ArrowUp || keyCode === leftKey ? -1 : 1;
|
|
1055
1138
|
const limit = this.data.length - 1;
|
|
1056
1139
|
let targetIndex = this.activeIndex + dir;
|
|
1057
1140
|
while (!this.itemEnabled(targetIndex) && targetIndex <= limit) {
|
|
1058
1141
|
targetIndex += dir;
|
|
1059
1142
|
}
|
|
1060
1143
|
targetIndex = Math.min(Math.max(targetIndex, 0), limit);
|
|
1144
|
+
this.prevActiveIndex = this.activeIndex;
|
|
1061
1145
|
if (!this.itemEnabled(targetIndex)) {
|
|
1062
1146
|
return;
|
|
1063
1147
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
this.activeIndex = targetIndex;
|
|
1070
|
-
}
|
|
1071
|
-
this.dragIndex = -1;
|
|
1072
|
-
this.dragOverIndex = -1;
|
|
1148
|
+
const ctrl = event.ctrlKey || event.metaKey;
|
|
1149
|
+
const navigateEvent = new NavigateEvent({ index: targetIndex, oldIndex: this.activeIndex, ctrlKey: ctrl });
|
|
1150
|
+
this.navigate.emit(navigateEvent);
|
|
1151
|
+
if (!navigateEvent.isDefaultPrevented()) {
|
|
1152
|
+
this.activeIndex = targetIndex;
|
|
1073
1153
|
}
|
|
1154
|
+
this.dragIndex = -1;
|
|
1155
|
+
this.dragOverIndex = -1;
|
|
1074
1156
|
event.stopPropagation();
|
|
1075
1157
|
event.preventDefault();
|
|
1076
1158
|
this.afterKeyPress = true;
|
|
1077
1159
|
}
|
|
1160
|
+
/**
|
|
1161
|
+
* @hidden
|
|
1162
|
+
*/
|
|
1163
|
+
onEnterHandler(item) {
|
|
1164
|
+
const focusableItems = this.focusableItems[this.activeIndex];
|
|
1165
|
+
focusableItems.forEach(focusableItem => {
|
|
1166
|
+
this.renderer.setAttribute(focusableItem, 'tabindex', '0');
|
|
1167
|
+
});
|
|
1168
|
+
this.renderer.setAttribute(item, 'tabindex', '-1');
|
|
1169
|
+
focusableItems[0].focus();
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* @hidden
|
|
1173
|
+
*/
|
|
1174
|
+
onEscapeHandler() {
|
|
1175
|
+
const focusableItems = this.focusableItems[this.prevActiveIndex];
|
|
1176
|
+
const item = this.itemWrappers.toArray()[this.prevActiveIndex].nativeElement;
|
|
1177
|
+
focusableItems.forEach(focusableItem => {
|
|
1178
|
+
this.renderer.setAttribute(focusableItem, 'tabindex', '-1');
|
|
1179
|
+
});
|
|
1180
|
+
this.renderer.setAttribute(item, 'tabindex', '0');
|
|
1181
|
+
item.focus();
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* @hidden
|
|
1185
|
+
*/
|
|
1186
|
+
keydownHandler(event) {
|
|
1187
|
+
const index = this.activeIndex === -1 ? this.prevActiveIndex : this.activeIndex;
|
|
1188
|
+
const item = this.itemWrappers.toArray()[index].nativeElement;
|
|
1189
|
+
const isItemFocused = document.activeElement === item;
|
|
1190
|
+
const hasFocus = this.activeIndex !== -1;
|
|
1191
|
+
const keyCode = event.keyCode;
|
|
1192
|
+
if (this.navigable && hasFocus) {
|
|
1193
|
+
if (keyCode >= Keys.ArrowLeft && keyCode <= Keys.ArrowDown) {
|
|
1194
|
+
this.onArrowHandler(event, keyCode);
|
|
1195
|
+
}
|
|
1196
|
+
if (keyCode === Keys.Enter && isItemFocused && this.focusableItems.length > 0) {
|
|
1197
|
+
this.onEnterHandler(item);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
if (keyCode === Keys.Tab && !isItemFocused) {
|
|
1201
|
+
keepFocusWithinComponent(event, item);
|
|
1202
|
+
}
|
|
1203
|
+
if (keyCode === Keys.Escape && this.focusableItems.length > 0 && this.activeIndex === -1) {
|
|
1204
|
+
this.onEscapeHandler();
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1078
1207
|
/**
|
|
1079
1208
|
* Removes the currently active item from the Data collection that the Sortable uses.
|
|
1080
1209
|
*/
|
|
@@ -1192,6 +1321,9 @@ class SortableComponent {
|
|
|
1192
1321
|
this.dragIndex = dragIndex;
|
|
1193
1322
|
this.dragOverIndex = dragIndex;
|
|
1194
1323
|
this.activeIndex = dragIndex;
|
|
1324
|
+
if (this.focusableItems.length > 0) {
|
|
1325
|
+
this.swapFocusableChildren(fromIndex, toIndex);
|
|
1326
|
+
}
|
|
1195
1327
|
if (this.animation) {
|
|
1196
1328
|
setTimeout(() => {
|
|
1197
1329
|
toAnimate.push({ next: originalIndexAnimate, prev: dragIndex });
|
|
@@ -1276,6 +1408,12 @@ class SortableComponent {
|
|
|
1276
1408
|
reflow(element) {
|
|
1277
1409
|
return element.offsetWidth;
|
|
1278
1410
|
}
|
|
1411
|
+
/**
|
|
1412
|
+
* @hidden
|
|
1413
|
+
*/
|
|
1414
|
+
swapFocusableChildren(firstItemIndex, secondItemIndex) {
|
|
1415
|
+
[this.focusableItems[firstItemIndex], this.focusableItems[secondItemIndex]] = [this.focusableItems[secondItemIndex], this.focusableItems[firstItemIndex]];
|
|
1416
|
+
}
|
|
1279
1417
|
/**
|
|
1280
1418
|
* @hidden
|
|
1281
1419
|
*/
|
|
@@ -1390,6 +1528,9 @@ class SortableComponent {
|
|
|
1390
1528
|
if (this.localizationChangeSubscription) {
|
|
1391
1529
|
this.localizationChangeSubscription.unsubscribe();
|
|
1392
1530
|
}
|
|
1531
|
+
if (this.childrenTabindexSubscription) {
|
|
1532
|
+
this.childrenTabindexSubscription.unsubscribe();
|
|
1533
|
+
}
|
|
1393
1534
|
this.dragStartSubscription.unsubscribe();
|
|
1394
1535
|
this.dragOverSubscription.unsubscribe();
|
|
1395
1536
|
this.dragEndSubscription.unsubscribe();
|
|
@@ -1429,8 +1570,8 @@ class SortableComponent {
|
|
|
1429
1570
|
}
|
|
1430
1571
|
}
|
|
1431
1572
|
}
|
|
1432
|
-
SortableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1433
|
-
SortableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.
|
|
1573
|
+
SortableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }, { token: i0.ElementRef }, { token: SortableService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1574
|
+
SortableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SortableComponent, selector: "kendo-sortable", inputs: { tabIndex: "tabIndex", data: "data", navigable: "navigable", navigatable: "navigatable", animation: "animation", disabledIndexes: "disabledIndexes", zone: "zone", acceptZones: "acceptZones", itemStyle: "itemStyle", emptyItemStyle: "emptyItemStyle", activeItemStyle: "activeItemStyle", disabledItemStyle: "disabledItemStyle", itemClass: "itemClass", activeItemClass: "activeItemClass", emptyItemClass: "emptyItemClass", disabledItemClass: "disabledItemClass", emptyText: "emptyText", activeIndex: "activeIndex" }, outputs: { dragStart: "dragStart", dragEnd: "dragEnd", dragOver: "dragOver", dragLeave: "dragLeave", dataMove: "dataMove", dataAdd: "dataAdd", dataRemove: "dataRemove", navigate: "navigate" }, host: { properties: { "style.touch-action": "this.touchAction", "attr.dir": "this.dir", "attr.role": "this.hostRole" } }, providers: [
|
|
1434
1575
|
LocalizationService,
|
|
1435
1576
|
{
|
|
1436
1577
|
provide: L10N_PREFIX,
|
|
@@ -1443,8 +1584,10 @@ SortableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
|
|
|
1443
1584
|
], queries: [{ propertyName: "defaultTemplateRef", predicate: TemplateRef }, { propertyName: "itemTemplateDirectiveRef", predicate: ItemTemplateDirective, read: TemplateRef }, { propertyName: "placeholderTemplateDirectiveRef", predicate: PlaceholderTemplateDirective, read: TemplateRef }], viewQueries: [{ propertyName: "noDataContainer", first: true, predicate: ["noDataRef"], descendants: true }, { propertyName: "hint", first: true, predicate: ["hint"], descendants: true }, { propertyName: "itemWrappers", predicate: ["itemWrapper"], descendants: true }, { propertyName: "draggables", predicate: DraggableDirective, descendants: true }], exportAs: ["kendoSortable"], usesOnChanges: true, ngImport: i0, template: `
|
|
1444
1585
|
<div #itemWrapper *ngFor="let item of _localData;let i=index"
|
|
1445
1586
|
kendoDraggable
|
|
1446
|
-
|
|
1587
|
+
role="listitem"
|
|
1447
1588
|
[attr.aria-grabbed]="i===dragIndex"
|
|
1589
|
+
[attr.aria-disabled]="!itemEnabled(i)"
|
|
1590
|
+
[attr.aria-keyshortcuts]="navigable ? ariaKeyShortcuts : ''"
|
|
1448
1591
|
[attr.aria-dropeffect]="ariaDropEffect(i)"
|
|
1449
1592
|
[attr.data-sortable-item] = "true"
|
|
1450
1593
|
[attr.data-sortable-index]="i"
|
|
@@ -1459,11 +1602,11 @@ SortableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
|
|
|
1459
1602
|
(blur)="blurHandler()"
|
|
1460
1603
|
(keydown)="keydownHandler($event)"
|
|
1461
1604
|
>
|
|
1462
|
-
|
|
1605
|
+
<ng-container *ngIf="itemTemplateRef"
|
|
1463
1606
|
[ngTemplateOutlet]="itemTemplate(i)"
|
|
1464
1607
|
[ngTemplateOutletContext]="item">
|
|
1465
|
-
|
|
1466
|
-
|
|
1608
|
+
</ng-container>
|
|
1609
|
+
<ng-container *ngIf="!itemTemplateRef">{{item.item}}</ng-container>
|
|
1467
1610
|
</div>
|
|
1468
1611
|
|
|
1469
1612
|
<ng-container #noDataRef *ngIf="!_data.length || _localData.length === 1 && _localData[0].hidden">
|
|
@@ -1477,15 +1620,15 @@ SortableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
|
|
|
1477
1620
|
[ngClass]="currentItemClass(-1)"
|
|
1478
1621
|
>{{emptyText}}</div>
|
|
1479
1622
|
</ng-container>
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1623
|
+
<div *ngIf="hintVisible()" [ngStyle]="hintStyle()" [ngClass]="currentItemClass(dragIndex)">
|
|
1624
|
+
<ng-container *ngIf="itemTemplateRef"
|
|
1625
|
+
[ngTemplateOutlet]="itemTemplateRef"
|
|
1626
|
+
[ngTemplateOutletContext]="{item: _localData[dragIndex].item}">
|
|
1627
|
+
</ng-container>
|
|
1628
|
+
<ng-container *ngIf="!itemTemplateRef">{{_localData[dragIndex].item}}</ng-container>
|
|
1629
|
+
</div>
|
|
1487
1630
|
`, isInline: true, directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: DraggableDirective, selector: "[kendoDraggable]", inputs: ["index", "disabled", "hidden"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
1488
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
1631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableComponent, decorators: [{
|
|
1489
1632
|
type: Component,
|
|
1490
1633
|
args: [{
|
|
1491
1634
|
exportAs: 'kendoSortable',
|
|
@@ -1504,8 +1647,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1504
1647
|
template: `
|
|
1505
1648
|
<div #itemWrapper *ngFor="let item of _localData;let i=index"
|
|
1506
1649
|
kendoDraggable
|
|
1507
|
-
|
|
1650
|
+
role="listitem"
|
|
1508
1651
|
[attr.aria-grabbed]="i===dragIndex"
|
|
1652
|
+
[attr.aria-disabled]="!itemEnabled(i)"
|
|
1653
|
+
[attr.aria-keyshortcuts]="navigable ? ariaKeyShortcuts : ''"
|
|
1509
1654
|
[attr.aria-dropeffect]="ariaDropEffect(i)"
|
|
1510
1655
|
[attr.data-sortable-item] = "true"
|
|
1511
1656
|
[attr.data-sortable-index]="i"
|
|
@@ -1520,11 +1665,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1520
1665
|
(blur)="blurHandler()"
|
|
1521
1666
|
(keydown)="keydownHandler($event)"
|
|
1522
1667
|
>
|
|
1523
|
-
|
|
1668
|
+
<ng-container *ngIf="itemTemplateRef"
|
|
1524
1669
|
[ngTemplateOutlet]="itemTemplate(i)"
|
|
1525
1670
|
[ngTemplateOutletContext]="item">
|
|
1526
|
-
|
|
1527
|
-
|
|
1671
|
+
</ng-container>
|
|
1672
|
+
<ng-container *ngIf="!itemTemplateRef">{{item.item}}</ng-container>
|
|
1528
1673
|
</div>
|
|
1529
1674
|
|
|
1530
1675
|
<ng-container #noDataRef *ngIf="!_data.length || _localData.length === 1 && _localData[0].hidden">
|
|
@@ -1538,16 +1683,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1538
1683
|
[ngClass]="currentItemClass(-1)"
|
|
1539
1684
|
>{{emptyText}}</div>
|
|
1540
1685
|
</ng-container>
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1686
|
+
<div *ngIf="hintVisible()" [ngStyle]="hintStyle()" [ngClass]="currentItemClass(dragIndex)">
|
|
1687
|
+
<ng-container *ngIf="itemTemplateRef"
|
|
1688
|
+
[ngTemplateOutlet]="itemTemplateRef"
|
|
1689
|
+
[ngTemplateOutletContext]="{item: _localData[dragIndex].item}">
|
|
1690
|
+
</ng-container>
|
|
1691
|
+
<ng-container *ngIf="!itemTemplateRef">{{_localData[dragIndex].item}}</ng-container>
|
|
1692
|
+
</div>
|
|
1548
1693
|
`
|
|
1549
1694
|
}]
|
|
1550
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type:
|
|
1695
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i0.ElementRef }, { type: SortableService }]; }, propDecorators: { tabIndex: [{
|
|
1551
1696
|
type: Input
|
|
1552
1697
|
}], data: [{
|
|
1553
1698
|
type: Input
|
|
@@ -1598,10 +1743,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1598
1743
|
args: [DraggableDirective]
|
|
1599
1744
|
}], noDataContainer: [{
|
|
1600
1745
|
type: ViewChild,
|
|
1601
|
-
args: ['noDataRef'
|
|
1746
|
+
args: ['noDataRef']
|
|
1602
1747
|
}], hint: [{
|
|
1603
1748
|
type: ViewChild,
|
|
1604
|
-
args: ['hint'
|
|
1749
|
+
args: ['hint']
|
|
1605
1750
|
}], dragStart: [{
|
|
1606
1751
|
type: Output
|
|
1607
1752
|
}], dragEnd: [{
|
|
@@ -1626,6 +1771,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
1626
1771
|
}], dir: [{
|
|
1627
1772
|
type: HostBinding,
|
|
1628
1773
|
args: ['attr.dir']
|
|
1774
|
+
}], hostRole: [{
|
|
1775
|
+
type: HostBinding,
|
|
1776
|
+
args: ['attr.role']
|
|
1629
1777
|
}] } });
|
|
1630
1778
|
|
|
1631
1779
|
/**
|
|
@@ -1816,9 +1964,9 @@ class SortableBindingDirective {
|
|
|
1816
1964
|
}
|
|
1817
1965
|
}
|
|
1818
1966
|
}
|
|
1819
|
-
SortableBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1820
|
-
SortableBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.
|
|
1821
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
1967
|
+
SortableBindingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableBindingDirective, deps: [{ token: SortableComponent }, { token: SortableService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1968
|
+
SortableBindingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: SortableBindingDirective, selector: "[kendoSortableBinding]", inputs: { data: ["kendoSortableBinding", "data"] }, ngImport: i0 });
|
|
1969
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableBindingDirective, decorators: [{
|
|
1822
1970
|
type: Directive,
|
|
1823
1971
|
args: [{
|
|
1824
1972
|
selector: '[kendoSortableBinding]'
|
|
@@ -1867,8 +2015,8 @@ const COMPONENT_DIRECTIVES = [
|
|
|
1867
2015
|
*/
|
|
1868
2016
|
class SortableModule {
|
|
1869
2017
|
}
|
|
1870
|
-
SortableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1871
|
-
SortableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.
|
|
2018
|
+
SortableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2019
|
+
SortableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableModule, declarations: [SortableComponent,
|
|
1872
2020
|
DraggableDirective,
|
|
1873
2021
|
PlaceholderTemplateDirective,
|
|
1874
2022
|
ItemTemplateDirective,
|
|
@@ -1877,8 +2025,8 @@ SortableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
|
|
|
1877
2025
|
PlaceholderTemplateDirective,
|
|
1878
2026
|
ItemTemplateDirective,
|
|
1879
2027
|
SortableBindingDirective] });
|
|
1880
|
-
SortableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.
|
|
1881
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
2028
|
+
SortableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableModule, providers: [SortableService], imports: [[CommonModule]] });
|
|
2029
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SortableModule, decorators: [{
|
|
1882
2030
|
type: NgModule,
|
|
1883
2031
|
args: [{
|
|
1884
2032
|
declarations: [COMPONENT_DIRECTIVES],
|