@progress/kendo-angular-pivotgrid 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/kendo-angular-pivotgrid.umd.js +1 -1
- package/configurator/configurator.component.d.ts +5 -3
- package/configurator/configurator.service.d.ts +9 -0
- package/configurator/draggable.directive.d.ts +4 -3
- package/configurator/drop-cue.service.d.ts +6 -5
- package/configurator/drop-target.directive.d.ts +6 -0
- package/esm2015/configurator/configurator.component.js +24 -3
- package/esm2015/configurator/draggable.directive.js +56 -37
- package/esm2015/configurator/drop-cue.service.js +24 -16
- package/esm2015/configurator/drop-target.directive.js +125 -30
- package/esm2015/models/drop-section.js +5 -0
- package/esm2015/models/drop-target.js +5 -0
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/util.js +1 -2
- package/fesm2015/kendo-angular-pivotgrid.js +230 -88
- package/main.d.ts +2 -0
- package/models/drop-section.d.ts +8 -0
- package/models/drop-target.d.ts +8 -0
- package/package.json +1 -1
- package/util.d.ts +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
|
|
5
|
+
import { ChangeDetectorRef, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
|
6
6
|
import { AxisDescriptor, PivotGridField, PivotGridConfiguratorState } from '@progress/kendo-pivotgrid-common';
|
|
7
7
|
import { TreeItem } from '@progress/kendo-angular-treeview';
|
|
8
8
|
import { PivotGridDataService } from '../data-binding/pivotgrid-data.service';
|
|
@@ -11,12 +11,13 @@ import { Observable } from 'rxjs';
|
|
|
11
11
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
12
12
|
import { FilterDescriptor, SortDescriptor } from '@progress/kendo-data-query';
|
|
13
13
|
import { PivotGridConfiguratorOrientation } from '../models/configurator-orientation';
|
|
14
|
+
import { DropSectionType } from '../models/drop-section';
|
|
14
15
|
import * as i0 from "@angular/core";
|
|
15
16
|
/**
|
|
16
17
|
* @hidden
|
|
17
18
|
* Represents the Kendo UI PivotGrid Configurator component for Angular.
|
|
18
19
|
*/
|
|
19
|
-
export declare class PivotGridConfiguratorComponent implements OnInit, OnDestroy {
|
|
20
|
+
export declare class PivotGridConfiguratorComponent implements OnInit, OnChanges, OnDestroy {
|
|
20
21
|
private dataService;
|
|
21
22
|
private localization;
|
|
22
23
|
configuratorService: ConfiguratorService;
|
|
@@ -38,6 +39,7 @@ export declare class PivotGridConfiguratorComponent implements OnInit, OnDestroy
|
|
|
38
39
|
constructor(dataService: PivotGridDataService, localization: LocalizationService, configuratorService: ConfiguratorService, cdr: ChangeDetectorRef);
|
|
39
40
|
ngOnInit(): void;
|
|
40
41
|
ngOnDestroy(): void;
|
|
42
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
41
43
|
getName(name: string[]): string;
|
|
42
44
|
setState(state: PivotGridConfiguratorState): void;
|
|
43
45
|
/**
|
|
@@ -60,7 +62,7 @@ export declare class PivotGridConfiguratorComponent implements OnInit, OnDestroy
|
|
|
60
62
|
* Updates the respective axis configuration of the current state
|
|
61
63
|
* when a chip is deleted from the UI
|
|
62
64
|
*/
|
|
63
|
-
onChipRemove(item: AxisDescriptor, section:
|
|
65
|
+
onChipRemove(item: AxisDescriptor, section: DropSectionType): void;
|
|
64
66
|
/**
|
|
65
67
|
* Constructs an array with all selected fields.
|
|
66
68
|
* @param fields - used for when child nodes are loaded on demand.
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
import { EventEmitter } from '@angular/core';
|
|
6
6
|
import { PivotGridConfiguratorState } from '@progress/kendo-pivotgrid-common';
|
|
7
7
|
import { PivotGridDataService } from '../data-binding/pivotgrid-data.service';
|
|
8
|
+
import { PivotGridConfiguratorOrientation } from '../models/configurator-orientation';
|
|
9
|
+
import { DropSectionType } from '../models/drop-section';
|
|
8
10
|
import * as i0 from "@angular/core";
|
|
9
11
|
/**
|
|
10
12
|
* @hidden
|
|
@@ -12,6 +14,13 @@ import * as i0 from "@angular/core";
|
|
|
12
14
|
export declare class ConfiguratorService {
|
|
13
15
|
private dataService;
|
|
14
16
|
state: PivotGridConfiguratorState;
|
|
17
|
+
draggedElement: {
|
|
18
|
+
element: Element;
|
|
19
|
+
fromSection: DropSectionType;
|
|
20
|
+
};
|
|
21
|
+
dropTargetElement: Element;
|
|
22
|
+
cueContainer: Element;
|
|
23
|
+
orientation: PivotGridConfiguratorOrientation;
|
|
15
24
|
configuratorStateChange: EventEmitter<any>;
|
|
16
25
|
constructor(dataService: PivotGridDataService);
|
|
17
26
|
parseConfiguratorState(action: any): void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { ElementRef, OnInit, NgZone, OnDestroy } from '@angular/core';
|
|
5
|
+
import { ElementRef, OnInit, NgZone, OnDestroy, Renderer2 } from '@angular/core';
|
|
6
6
|
import { DraggableDirective } from '@progress/kendo-angular-common';
|
|
7
7
|
import { PivotGridAxis } from '@progress/kendo-pivotgrid-common';
|
|
8
8
|
import { ConfiguratorService } from './configurator.service';
|
|
@@ -17,16 +17,17 @@ export declare class DraggableChipDirective implements OnInit, OnDestroy {
|
|
|
17
17
|
private zone;
|
|
18
18
|
private service;
|
|
19
19
|
private cue;
|
|
20
|
+
private renderer;
|
|
20
21
|
get pointerEvents(): any;
|
|
21
22
|
touchActions: string;
|
|
22
|
-
constructor(draggable: DraggableDirective, element: ElementRef, zone: NgZone, service: ConfiguratorService, cue: DropCueService);
|
|
23
23
|
item: PivotGridAxis;
|
|
24
24
|
initialX: any;
|
|
25
25
|
initialY: any;
|
|
26
26
|
private drag;
|
|
27
27
|
private subs;
|
|
28
|
+
constructor(draggable: DraggableDirective, element: ElementRef, zone: NgZone, service: ConfiguratorService, cue: DropCueService, renderer: Renderer2);
|
|
28
29
|
ngOnInit(): void;
|
|
29
30
|
ngOnDestroy(): void;
|
|
30
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DraggableChipDirective, [{ optional: true; }, null, null, null, null]>;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DraggableChipDirective, [{ optional: true; }, null, null, null, null, null]>;
|
|
31
32
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DraggableChipDirective, "[kendoChipDraggable]", never, { "item": "item"; }, {}, never>;
|
|
32
33
|
}
|
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { PivotGridConfiguratorDropDirection } from '@progress/kendo-pivotgrid-common';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
/**
|
|
7
8
|
* @hidden
|
|
8
9
|
*/
|
|
9
|
-
export declare const append: (element: any) => () => any;
|
|
10
|
+
export declare const append: (element: any, container: any) => () => any;
|
|
10
11
|
/**
|
|
11
12
|
* @hidden
|
|
12
13
|
*/
|
|
13
14
|
export declare class DropCueService {
|
|
14
|
-
|
|
15
|
+
dom: any;
|
|
15
16
|
create(): void;
|
|
16
|
-
attach(): Function;
|
|
17
|
-
remove(): void;
|
|
17
|
+
attach(container: Element): Function;
|
|
18
|
+
remove(container: Element): void;
|
|
18
19
|
hide(): void;
|
|
19
|
-
|
|
20
|
+
show(direction: PivotGridConfiguratorDropDirection, container: Element, target: Element): void;
|
|
20
21
|
static ɵfac: i0.ɵɵFactoryDeclaration<DropCueService, never>;
|
|
21
22
|
static ɵprov: i0.ɵɵInjectableDeclaration<DropCueService>;
|
|
22
23
|
}
|
|
@@ -19,7 +19,9 @@ export declare class DropTargetDirective implements OnInit, OnDestroy {
|
|
|
19
19
|
item: PivotGridAxis;
|
|
20
20
|
axes: PivotGridConfiguratorDropZone;
|
|
21
21
|
private elementType;
|
|
22
|
+
private elementSectionType;
|
|
22
23
|
private targetElement;
|
|
24
|
+
private nextChipOffset;
|
|
23
25
|
private subs;
|
|
24
26
|
constructor(element: ElementRef, configuratorService: ConfiguratorService, cue: DropCueService, renderer: Renderer2, zone: NgZone);
|
|
25
27
|
ngOnInit(): void;
|
|
@@ -27,6 +29,10 @@ export declare class DropTargetDirective implements OnInit, OnDestroy {
|
|
|
27
29
|
private handleMouseEnter;
|
|
28
30
|
private handleMouseMove;
|
|
29
31
|
private handleMouseLeave;
|
|
32
|
+
private isDropAllowed;
|
|
33
|
+
private getElementType;
|
|
34
|
+
private getCueContainer;
|
|
35
|
+
private getNextChip;
|
|
30
36
|
static ɵfac: i0.ɵɵFactoryDeclaration<DropTargetDirective, never>;
|
|
31
37
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DropTargetDirective, "[kendoDropTarget]", never, { "item": "item"; "axes": "axes"; }, {}, never>;
|
|
32
38
|
}
|
|
@@ -69,7 +69,7 @@ export class PivotGridConfiguratorComponent {
|
|
|
69
69
|
this.subs.add(this.configuratorService.configuratorStateChange
|
|
70
70
|
.subscribe(res => {
|
|
71
71
|
this.state = res;
|
|
72
|
-
this.dataService.state =
|
|
72
|
+
this.dataService.state = {
|
|
73
73
|
columnAxes: res.columnAxes,
|
|
74
74
|
rowAxes: res.rowAxes,
|
|
75
75
|
measureAxes: res.measureAxes,
|
|
@@ -82,6 +82,11 @@ export class PivotGridConfiguratorComponent {
|
|
|
82
82
|
ngOnDestroy() {
|
|
83
83
|
this.subs.unsubscribe();
|
|
84
84
|
}
|
|
85
|
+
ngOnChanges(changes) {
|
|
86
|
+
if (changes.orientation) {
|
|
87
|
+
this.configuratorService.orientation = this.orientation;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
85
90
|
getName(name) {
|
|
86
91
|
return name.toString();
|
|
87
92
|
}
|
|
@@ -229,7 +234,7 @@ PivotGridConfiguratorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
|
229
234
|
ConfiguratorService,
|
|
230
235
|
DropCueService,
|
|
231
236
|
SinglePopupService
|
|
232
|
-
], ngImport: i0, template: `
|
|
237
|
+
], usesOnChanges: true, ngImport: i0, template: `
|
|
233
238
|
<div
|
|
234
239
|
class="k-pivotgrid-configurator-panel k-pivotgrid-configurator-push"
|
|
235
240
|
[ngClass]="{
|
|
@@ -383,7 +388,7 @@ PivotGridConfiguratorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
|
383
388
|
<button kendoButton themeColor="primary" type="button" (click)="handleSubmit()">{{messageFor('configuratorApplyButtonText')}}</button>
|
|
384
389
|
</div>
|
|
385
390
|
</div>
|
|
386
|
-
`, isInline: true, styles: ["\n .k-form .k-chip-list {\n width: 100%;\n }\n "], components: [{ type: i4.TreeViewComponent, selector: "kendo-treeview", inputs: ["filterInputPlaceholder", "expandDisabledNodes", "animate", "nodeTemplate", "loadMoreButtonTemplate", "trackBy", "nodes", "textField", "hasChildren", "isChecked", "isDisabled", "isExpanded", "isSelected", "isVisible", "navigable", "children", "loadOnDemand", "filterable", "filter", "size", "disableParentNodesOnly"], outputs: ["childrenLoaded", "blur", "focus", "expand", "collapse", "nodeDragStart", "nodeDrag", "filterStateChange", "nodeDrop", "nodeDragEnd", "addItem", "removeItem", "checkedChange", "selectionChange", "filterChange", "nodeClick", "nodeDblClick"], exportAs: ["kendoTreeView"] }, { type: i5.ChipListComponent, selector: "kendo-chiplist, kendo-chip-list", inputs: ["selection", "size"], outputs: ["selectedChange", "remove"] }, { type: i5.ChipComponent, selector: "kendo-chip", inputs: ["label", "icon", "iconClass", "avatarClass", "selected", "removable", "removeIcon", "disabled", "size", "rounded", "fillMode", "themeColor"], outputs: ["remove", "contentClick"] }, { type: i6.ChipMenuComponent, selector: "kendo-pivot-chip-menu", inputs: ["chip", "tabIndex"] }], directives: [{ type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.ExpandDirective, selector: "[kendoTreeViewExpandable]", inputs: ["isExpanded", "expandBy", "expandOnFilter", "expandedKeys"], outputs: ["expandedKeysChange"] }, { type: i4.NodeTemplateDirective, selector: "[kendoTreeViewNodeTemplate]" }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.CheckBoxDirective, selector: "input[kendoCheckBox]", inputs: ["size", "rounded"] }, { type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i9.DropTargetDirective, selector: "[kendoDropTarget]", inputs: ["item", "axes"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.DraggableChipDirective, selector: "[kendoChipDraggable]", inputs: ["item"] }, { type: i11.DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { type: i5.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
|
|
391
|
+
`, isInline: true, styles: ["\n .k-form .k-chip-list {\n width: 100%;\n }\n\n .k-form .k-form-field,\n .k-form .k-settings-description {\n padding-top: 1em;\n margin-top: 0;\n }\n\n .k-form.k-form-horizontal .k-form-field,\n .k-form.k-form-horizontal .k-chip-list {\n padding-top: 0;\n padding-left: 16px;\n }\n\n .k-form.k-form-horizontal .k-form-field-wrapper {\n padding-left: 0;\n }\n "], components: [{ type: i4.TreeViewComponent, selector: "kendo-treeview", inputs: ["filterInputPlaceholder", "expandDisabledNodes", "animate", "nodeTemplate", "loadMoreButtonTemplate", "trackBy", "nodes", "textField", "hasChildren", "isChecked", "isDisabled", "isExpanded", "isSelected", "isVisible", "navigable", "children", "loadOnDemand", "filterable", "filter", "size", "disableParentNodesOnly"], outputs: ["childrenLoaded", "blur", "focus", "expand", "collapse", "nodeDragStart", "nodeDrag", "filterStateChange", "nodeDrop", "nodeDragEnd", "addItem", "removeItem", "checkedChange", "selectionChange", "filterChange", "nodeClick", "nodeDblClick"], exportAs: ["kendoTreeView"] }, { type: i5.ChipListComponent, selector: "kendo-chiplist, kendo-chip-list", inputs: ["selection", "size"], outputs: ["selectedChange", "remove"] }, { type: i5.ChipComponent, selector: "kendo-chip", inputs: ["label", "icon", "iconClass", "avatarClass", "selected", "removable", "removeIcon", "disabled", "size", "rounded", "fillMode", "themeColor"], outputs: ["remove", "contentClick"] }, { type: i6.ChipMenuComponent, selector: "kendo-pivot-chip-menu", inputs: ["chip", "tabIndex"] }], directives: [{ type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.ExpandDirective, selector: "[kendoTreeViewExpandable]", inputs: ["isExpanded", "expandBy", "expandOnFilter", "expandedKeys"], outputs: ["expandedKeysChange"] }, { type: i4.NodeTemplateDirective, selector: "[kendoTreeViewNodeTemplate]" }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.CheckBoxDirective, selector: "input[kendoCheckBox]", inputs: ["size", "rounded"] }, { type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i9.DropTargetDirective, selector: "[kendoDropTarget]", inputs: ["item", "axes"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10.DraggableChipDirective, selector: "[kendoChipDraggable]", inputs: ["item"] }, { type: i11.DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { type: i5.ButtonDirective, selector: "button[kendoButton], span[kendoButton]", inputs: ["toggleable", "togglable", "selected", "tabIndex", "icon", "iconClass", "imageUrl", "disabled", "size", "rounded", "fillMode", "themeColor", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }] });
|
|
387
392
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PivotGridConfiguratorComponent, decorators: [{
|
|
388
393
|
type: Component,
|
|
389
394
|
args: [{
|
|
@@ -552,6 +557,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
552
557
|
.k-form .k-chip-list {
|
|
553
558
|
width: 100%;
|
|
554
559
|
}
|
|
560
|
+
|
|
561
|
+
.k-form .k-form-field,
|
|
562
|
+
.k-form .k-settings-description {
|
|
563
|
+
padding-top: 1em;
|
|
564
|
+
margin-top: 0;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.k-form.k-form-horizontal .k-form-field,
|
|
568
|
+
.k-form.k-form-horizontal .k-chip-list {
|
|
569
|
+
padding-top: 0;
|
|
570
|
+
padding-left: 16px;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.k-form.k-form-horizontal .k-form-field-wrapper {
|
|
574
|
+
padding-left: 0;
|
|
575
|
+
}
|
|
555
576
|
`]
|
|
556
577
|
}]
|
|
557
578
|
}], ctorParameters: function () { return [{ type: i1.PivotGridDataService }, { type: i2.LocalizationService }, { type: i3.ConfiguratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClass: [{
|
|
@@ -14,12 +14,13 @@ import * as i3 from "./drop-cue.service";
|
|
|
14
14
|
* @hidden
|
|
15
15
|
*/
|
|
16
16
|
export class DraggableChipDirective {
|
|
17
|
-
constructor(draggable, element, zone, service, cue) {
|
|
17
|
+
constructor(draggable, element, zone, service, cue, renderer) {
|
|
18
18
|
this.draggable = draggable;
|
|
19
19
|
this.element = element;
|
|
20
20
|
this.zone = zone;
|
|
21
21
|
this.service = service;
|
|
22
22
|
this.cue = cue;
|
|
23
|
+
this.renderer = renderer;
|
|
23
24
|
this.touchActions = 'none';
|
|
24
25
|
this.initialX = {};
|
|
25
26
|
this.initialY = {};
|
|
@@ -29,52 +30,70 @@ export class DraggableChipDirective {
|
|
|
29
30
|
return this.drag ? 'none' : undefined;
|
|
30
31
|
}
|
|
31
32
|
ngOnInit() {
|
|
32
|
-
this.
|
|
33
|
+
this.subs.add(this.draggable.kendoPress
|
|
33
34
|
.subscribe((event) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Math.abs(this.initialY.current - event.clientY) < 10) {
|
|
46
|
-
return;
|
|
35
|
+
this.zone.runOutsideAngular(() => {
|
|
36
|
+
if (isDocumentAvailable()) {
|
|
37
|
+
this.initialX.current = event.clientX;
|
|
38
|
+
this.initialY.current = event.clientY;
|
|
39
|
+
const element = this.element.nativeElement;
|
|
40
|
+
this.renderer.setStyle(element, 'z-index', 1);
|
|
41
|
+
this.service.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDragItem, payload: this.item });
|
|
42
|
+
this.service.draggedElement = {
|
|
43
|
+
element,
|
|
44
|
+
fromSection: element.closest('.k-chip-list').getAttribute('axes').split('Axes')[0]
|
|
45
|
+
};
|
|
47
46
|
}
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
});
|
|
48
|
+
}));
|
|
49
|
+
this.subs.add(this.draggable.kendoDrag
|
|
50
|
+
.subscribe((event) => {
|
|
51
|
+
this.zone.runOutsideAngular(() => {
|
|
52
|
+
var _a;
|
|
53
|
+
if (isDocumentAvailable()) {
|
|
54
|
+
const isDragging = Math.abs(this.initialX.current - event.clientX) > 5 ||
|
|
55
|
+
Math.abs(this.initialY.current - event.clientY) > 5;
|
|
56
|
+
if (!isDragging) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.drag = true;
|
|
60
|
+
if (!((_a = document.elementFromPoint(event.clientX, event.clientY)) === null || _a === void 0 ? void 0 : _a.closest('.k-pivotgrid-configurator [kendodroptarget]'))) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.renderer.setStyle(this.element.nativeElement, 'transform', `translate(${event.clientX - this.initialX.current}px, ${event.clientY - this.initialY.current}px)`);
|
|
50
64
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
})));
|
|
55
|
-
this.zone.runOutsideAngular(() => this.subs.add(this.draggable.kendoRelease
|
|
65
|
+
});
|
|
66
|
+
}));
|
|
67
|
+
this.subs.add(this.draggable.kendoRelease
|
|
56
68
|
.subscribe(() => {
|
|
57
|
-
this.
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
this.zone.runOutsideAngular(() => {
|
|
70
|
+
this.drag = false;
|
|
71
|
+
if (this.service.state.dragItem) {
|
|
72
|
+
const element = this.element.nativeElement;
|
|
73
|
+
if (isDocumentAvailable()) {
|
|
74
|
+
this.renderer.removeStyle(element, 'transform');
|
|
75
|
+
this.cue.remove(this.service.cueContainer);
|
|
76
|
+
}
|
|
77
|
+
this.service.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.drop, payload: this.item });
|
|
78
|
+
this.service.state.dragItem = null;
|
|
79
|
+
this.service.state.dropDirection = null;
|
|
80
|
+
this.service.state.dropTarget = null;
|
|
81
|
+
this.service.state.dropZone = null;
|
|
82
|
+
this.renderer.removeStyle(element, 'z-index');
|
|
83
|
+
this.service.draggedElement = null;
|
|
84
|
+
if (this.service.dropTargetElement) {
|
|
85
|
+
this.renderer.removeStyle(this.service.dropTargetElement, 'cursor');
|
|
86
|
+
this.service.dropTargetElement = null;
|
|
62
87
|
}
|
|
63
|
-
this.cue.remove();
|
|
64
88
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.service.state.dropDirection = null;
|
|
68
|
-
this.service.state.dropTarget = null;
|
|
69
|
-
this.service.state.dropZone = null;
|
|
70
|
-
}
|
|
71
|
-
})));
|
|
89
|
+
});
|
|
90
|
+
}));
|
|
72
91
|
}
|
|
73
92
|
ngOnDestroy() {
|
|
74
93
|
this.subs.unsubscribe();
|
|
75
94
|
}
|
|
76
95
|
}
|
|
77
|
-
DraggableChipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DraggableChipDirective, deps: [{ token: i1.DraggableDirective, optional: true }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i2.ConfiguratorService }, { token: i3.DropCueService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
96
|
+
DraggableChipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DraggableChipDirective, deps: [{ token: i1.DraggableDirective, optional: true }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i2.ConfiguratorService }, { token: i3.DropCueService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
78
97
|
DraggableChipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DraggableChipDirective, selector: "[kendoChipDraggable]", inputs: { item: "item" }, host: { properties: { "style.pointerEvents": "this.pointerEvents", "style.touch-action": "this.touchActions" } }, ngImport: i0 });
|
|
79
98
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DraggableChipDirective, decorators: [{
|
|
80
99
|
type: Directive,
|
|
@@ -83,7 +102,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
83
102
|
}]
|
|
84
103
|
}], ctorParameters: function () { return [{ type: i1.DraggableDirective, decorators: [{
|
|
85
104
|
type: Optional
|
|
86
|
-
}] }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i2.ConfiguratorService }, { type: i3.DropCueService }]; }, propDecorators: { pointerEvents: [{
|
|
105
|
+
}] }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i2.ConfiguratorService }, { type: i3.DropCueService }, { type: i0.Renderer2 }]; }, propDecorators: { pointerEvents: [{
|
|
87
106
|
type: HostBinding,
|
|
88
107
|
args: ['style.pointerEvents']
|
|
89
108
|
}], touchActions: [{
|
|
@@ -7,11 +7,11 @@ import * as i0 from "@angular/core";
|
|
|
7
7
|
/**
|
|
8
8
|
* @hidden
|
|
9
9
|
*/
|
|
10
|
-
export const append = (element) => {
|
|
10
|
+
export const append = (element, container) => {
|
|
11
11
|
let appended = false;
|
|
12
12
|
return () => {
|
|
13
13
|
if (!appended) {
|
|
14
|
-
|
|
14
|
+
container.appendChild(element);
|
|
15
15
|
appended = true;
|
|
16
16
|
}
|
|
17
17
|
return element;
|
|
@@ -23,7 +23,6 @@ export const append = (element) => {
|
|
|
23
23
|
export class DropCueService {
|
|
24
24
|
create() {
|
|
25
25
|
this.dom = document.createElement('span');
|
|
26
|
-
this.dom.style.position = 'absolute';
|
|
27
26
|
const wrapper = document.createElement('div');
|
|
28
27
|
wrapper.classList.add('k-drop-hint', 'k-drop-hint-v');
|
|
29
28
|
const hintStart = document.createElement('div');
|
|
@@ -36,25 +35,34 @@ export class DropCueService {
|
|
|
36
35
|
this.dom.append(wrapper);
|
|
37
36
|
this.hide();
|
|
38
37
|
}
|
|
39
|
-
attach() {
|
|
40
|
-
return append(this.dom)();
|
|
38
|
+
attach(container) {
|
|
39
|
+
return append(this.dom, container)();
|
|
41
40
|
}
|
|
42
|
-
remove() {
|
|
43
|
-
if (this.dom && this.dom.parentElement) {
|
|
44
|
-
|
|
41
|
+
remove(container) {
|
|
42
|
+
if (this.dom && this.dom.parentElement && container.contains(this.dom)) {
|
|
43
|
+
container.removeChild(this.dom);
|
|
45
44
|
this.dom = null;
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
hide() {
|
|
49
|
-
this.dom.style.display =
|
|
48
|
+
this.dom.style.display = 'none';
|
|
50
49
|
}
|
|
51
|
-
|
|
52
|
-
this.dom
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
show(direction, container, target) {
|
|
51
|
+
if (!this.dom) {
|
|
52
|
+
this.create();
|
|
53
|
+
}
|
|
54
|
+
if (direction === 'before') {
|
|
55
|
+
container.insertBefore(this.dom, target);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
if (target.classList.contains('k-chip') && target.matches(':last-child')) {
|
|
59
|
+
container.insertBefore(this.dom, target);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// eslint-disable-next-line no-unused-expressions
|
|
63
|
+
target.classList.contains('k-chip') ? target.after(this.dom) : container.appendChild(this.dom);
|
|
64
|
+
}
|
|
65
|
+
this.dom.style.display = '';
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
68
|
DropCueService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropCueService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Directive, Input } from "@angular/core";
|
|
6
6
|
import { PIVOT_CONFIGURATOR_ACTION } from "@progress/kendo-pivotgrid-common";
|
|
7
7
|
import { Subscription } from "rxjs";
|
|
8
|
-
import {
|
|
8
|
+
import { isPresent } from "../util";
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
10
|
import * as i1 from "./configurator.service";
|
|
11
11
|
import * as i2 from "./drop-cue.service";
|
|
@@ -22,49 +22,144 @@ export class DropTargetDirective {
|
|
|
22
22
|
this.subs = new Subscription();
|
|
23
23
|
}
|
|
24
24
|
ngOnInit() {
|
|
25
|
+
var _a;
|
|
25
26
|
const element = this.element.nativeElement;
|
|
26
|
-
this.elementType = element
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
27
|
+
this.elementType = this.getElementType(element);
|
|
28
|
+
this.elementSectionType = (_a = element.getAttribute('axes')) === null || _a === void 0 ? void 0 : _a.split('Axes')[0];
|
|
29
|
+
this.subs.add(this.renderer.listen(element, 'mouseenter', this.handleMouseEnter.bind(this)));
|
|
30
|
+
this.subs.add(this.renderer.listen(element, 'mousemove', this.handleMouseMove.bind(this)));
|
|
31
|
+
this.subs.add(this.renderer.listen(element, 'mouseleave', this.handleMouseLeave.bind(this)));
|
|
32
32
|
}
|
|
33
33
|
ngOnDestroy() {
|
|
34
34
|
this.subs.unsubscribe();
|
|
35
35
|
}
|
|
36
36
|
handleMouseEnter(event) {
|
|
37
|
-
|
|
38
|
-
if (this.
|
|
37
|
+
this.zone.runOutsideAngular(() => {
|
|
38
|
+
if (this.configuratorService.state.dragItem) {
|
|
39
|
+
this.configuratorService.dropTargetElement = this.element.nativeElement;
|
|
40
|
+
if (this.configuratorService.draggedElement && !this.isDropAllowed(this.configuratorService.draggedElement.fromSection)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
39
43
|
this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropTarget, payload: this.item });
|
|
40
|
-
this.targetElement = event.target;
|
|
41
|
-
|
|
44
|
+
this.targetElement = this.elementType === 'header' ? event.target.nextElementSibling : event.target;
|
|
45
|
+
// eslint-disable-next-line no-unused-expressions
|
|
46
|
+
this.cue.dom && this.cue.remove(this.getCueContainer());
|
|
47
|
+
this.cue.create();
|
|
48
|
+
this.cue.attach(this.getCueContainer());
|
|
49
|
+
this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropZone, payload: this.axes });
|
|
42
50
|
}
|
|
43
|
-
|
|
44
|
-
}
|
|
51
|
+
});
|
|
45
52
|
}
|
|
46
|
-
handleMouseMove(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
handleMouseMove(event) {
|
|
54
|
+
this.zone.runOutsideAngular(() => {
|
|
55
|
+
var _a;
|
|
56
|
+
event.stopImmediatePropagation();
|
|
57
|
+
if (this.configuratorService.state.dragItem) {
|
|
58
|
+
if (this.configuratorService.draggedElement && !this.isDropAllowed(this.configuratorService.draggedElement.fromSection)) {
|
|
59
|
+
this.renderer.setStyle(this.element.nativeElement, 'cursor', 'not-allowed');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.renderer.setStyle(this.element.nativeElement, 'cursor', 'pointer');
|
|
63
|
+
const singleOrNoChip = ((_a = this.targetElement) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.k-chip').length) < 2;
|
|
64
|
+
const isInOwnContainer = this.elementSectionType === this.configuratorService.draggedElement.fromSection;
|
|
65
|
+
if (!this.targetElement) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
switch (this.elementType) {
|
|
69
|
+
case 'chip':
|
|
70
|
+
const rect = this.element.nativeElement.getBoundingClientRect();
|
|
71
|
+
const x = event.clientX - rect.left;
|
|
72
|
+
const direction = x < rect.width / 2 ? 'before' : 'after';
|
|
73
|
+
this.cue.show(direction, this.configuratorService.cueContainer, this.targetElement);
|
|
74
|
+
if (direction !== this.configuratorService.state.dropDirection) {
|
|
75
|
+
this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropDirection, payload: direction });
|
|
76
|
+
}
|
|
77
|
+
break;
|
|
78
|
+
case 'container':
|
|
79
|
+
case 'header':
|
|
80
|
+
if (singleOrNoChip && isInOwnContainer) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (isInOwnContainer) {
|
|
84
|
+
const draggedElement = this.configuratorService.draggedElement.element;
|
|
85
|
+
const nextChip = this.getNextChip(draggedElement);
|
|
86
|
+
if (!nextChip) {
|
|
87
|
+
this.cue.show('before', this.configuratorService.cueContainer, draggedElement);
|
|
88
|
+
if (this.configuratorService.state.dropDirection !== 'before') {
|
|
89
|
+
this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropDirection, payload: 'before' });
|
|
90
|
+
}
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const isVertical = this.configuratorService.orientation === 'vertical';
|
|
94
|
+
if (!isPresent(this.nextChipOffset)) {
|
|
95
|
+
this.nextChipOffset = isVertical ? nextChip.getBoundingClientRect().left : nextChip.getBoundingClientRect().top;
|
|
96
|
+
}
|
|
97
|
+
const isBefore = isVertical ? event.clientX < this.nextChipOffset : event.clientY < this.nextChipOffset;
|
|
98
|
+
if (isBefore) {
|
|
99
|
+
this.cue.show('after', this.configuratorService.cueContainer, draggedElement);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (this.configuratorService.state.dropDirection !== 'after') {
|
|
104
|
+
this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropDirection, payload: 'after' });
|
|
105
|
+
}
|
|
106
|
+
this.cue.show('after', this.configuratorService.cueContainer, this.targetElement);
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
57
109
|
}
|
|
58
|
-
this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropDirection, payload: direction });
|
|
59
110
|
}
|
|
60
|
-
}
|
|
111
|
+
});
|
|
61
112
|
}
|
|
62
|
-
handleMouseLeave() {
|
|
63
|
-
|
|
113
|
+
handleMouseLeave(event) {
|
|
114
|
+
this.renderer.removeStyle(this.element.nativeElement, 'cursor');
|
|
115
|
+
if (!this.configuratorService.draggedElement) {
|
|
64
116
|
return;
|
|
65
117
|
}
|
|
66
|
-
|
|
67
|
-
|
|
118
|
+
this.zone.runOutsideAngular(() => {
|
|
119
|
+
event.stopImmediatePropagation();
|
|
120
|
+
this.configuratorService.dropTargetElement = null;
|
|
121
|
+
this.cue.remove(this.getCueContainer());
|
|
122
|
+
if (this.elementType === 'chip') {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (this.configuratorService.state.dragItem) {
|
|
126
|
+
this.configuratorService.parseConfiguratorState({ type: PIVOT_CONFIGURATOR_ACTION.setDropZone, payload: null });
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
isDropAllowed(fromSection) {
|
|
131
|
+
const element = this.element.nativeElement;
|
|
132
|
+
const fromRowsOrColsToMeasures = (fromSection === 'row' || fromSection === 'column') && element.closest('[axes=measureAxes]');
|
|
133
|
+
const fromMeasuresToRowsOrCols = fromSection === 'measure' && (element.closest('[axes=rowAxes]') || element.closest('[axes=columnAxes]'));
|
|
134
|
+
return !(fromRowsOrColsToMeasures || fromMeasuresToRowsOrCols);
|
|
135
|
+
}
|
|
136
|
+
getElementType(element) {
|
|
137
|
+
return {
|
|
138
|
+
'KENDO-CHIP': 'chip',
|
|
139
|
+
'KENDO-CHIPLIST': 'container',
|
|
140
|
+
'DIV': 'header'
|
|
141
|
+
}[element.tagName];
|
|
142
|
+
}
|
|
143
|
+
getCueContainer() {
|
|
144
|
+
const element = this.element.nativeElement;
|
|
145
|
+
const cueContainer = {
|
|
146
|
+
chip: element.parentElement,
|
|
147
|
+
container: element,
|
|
148
|
+
header: element.classList.contains('k-settings-description') ? element : element.nextElementSibling
|
|
149
|
+
}[this.elementType];
|
|
150
|
+
this.configuratorService.cueContainer = cueContainer;
|
|
151
|
+
return cueContainer;
|
|
152
|
+
}
|
|
153
|
+
getNextChip(draggedElement) {
|
|
154
|
+
let nextChip = draggedElement.nextElementSibling;
|
|
155
|
+
if (nextChip && nextChip.matches('.k-chip')) {
|
|
156
|
+
return nextChip;
|
|
157
|
+
}
|
|
158
|
+
while (nextChip) {
|
|
159
|
+
nextChip = nextChip.nextElementSibling;
|
|
160
|
+
if (nextChip === null || nextChip.matches('.k-chip')) {
|
|
161
|
+
return nextChip;
|
|
162
|
+
}
|
|
68
163
|
}
|
|
69
164
|
}
|
|
70
165
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export {};
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-pivotgrid',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1664197863,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
package/esm2015/util.js
CHANGED
|
@@ -124,8 +124,7 @@ export const position = (target, before) => {
|
|
|
124
124
|
const { offsetWidth, offsetHeight } = target;
|
|
125
125
|
const left = targetRect.left + (before ? 0 : offsetWidth);
|
|
126
126
|
const top = targetRect.top + offsetHeight / 2;
|
|
127
|
-
|
|
128
|
-
return { left, top, height };
|
|
127
|
+
return { left, top };
|
|
129
128
|
};
|
|
130
129
|
/**
|
|
131
130
|
* @hidden
|