@progress/kendo-angular-grid 12.0.0-develop.1 → 12.0.0-develop.11
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/column-menu/column-menu-item-content-template.directive.d.ts +13 -24
- package/column-menu/column-menu-template.directive.d.ts +14 -28
- package/column-menu/column-menu.service.d.ts +9 -21
- package/columns/column-base.d.ts +18 -369
- package/columns/reorder-column.component.d.ts +31 -0
- package/columns/sort-settings.d.ts +20 -4
- package/common/fetch-data-callback.d.ts +1 -1
- package/common/preventable-event.d.ts +1 -1
- package/common/single-popup.service.d.ts +1 -1
- package/common/size-options.d.ts +1 -2
- package/data/grid-item.interface.d.ts +6 -3
- package/databinding.directive.d.ts +15 -1
- package/editing/add-command.directive.d.ts +1 -1
- package/editing/cancel-command.directive.d.ts +4 -16
- package/editing/edit-template.directive.d.ts +2 -3
- package/editing/remove-command.directive.d.ts +6 -6
- package/editing/save-command.directive.d.ts +3 -15
- package/editing-directives/in-cell-editing.directive.d.ts +1 -1
- package/editing-directives/template-editing.directive.d.ts +1 -1
- package/esm2020/column-menu/column-menu-item-content-template.directive.mjs +13 -24
- package/esm2020/column-menu/column-menu-template.directive.mjs +14 -28
- package/esm2020/column-menu/column-menu.service.mjs +9 -21
- package/esm2020/columns/column-base.mjs +10 -40
- package/esm2020/columns/reorder-column.component.mjs +55 -0
- package/esm2020/common/preventable-event.mjs +1 -1
- package/esm2020/common/single-popup.service.mjs +1 -1
- package/esm2020/databinding.directive.mjs +30 -3
- package/esm2020/editing/add-command.directive.mjs +1 -1
- package/esm2020/editing/cancel-command.directive.mjs +4 -16
- package/esm2020/editing/edit-template.directive.mjs +2 -3
- package/esm2020/editing/remove-command.directive.mjs +6 -6
- package/esm2020/editing/save-command.directive.mjs +3 -15
- package/esm2020/editing-directives/in-cell-editing.directive.mjs +1 -1
- package/esm2020/editing-directives/template-editing.directive.mjs +1 -1
- package/esm2020/excel/excel-command.directive.mjs +2 -2
- package/esm2020/excel/excel.module.mjs +5 -15
- package/esm2020/filtering/cell/autocomplete-filter-cell.component.mjs +1 -1
- package/esm2020/filtering/cell/boolean-filter-cell.component.mjs +1 -1
- package/esm2020/filtering/cell/filter-cell-operators.component.mjs +1 -1
- package/esm2020/filtering/menu/date-filter-menu.component.mjs +1 -1
- package/esm2020/filtering/menu/filter-menu-input-wrapper.component.mjs +1 -1
- package/esm2020/filtering/menu/numeric-filter-menu.component.mjs +1 -1
- package/esm2020/filtering/menu/string-filter-menu.component.mjs +1 -1
- package/esm2020/grid.component.mjs +195 -38
- package/esm2020/grid.module.mjs +76 -81
- package/esm2020/grouping/group-footer-template.directive.mjs +9 -35
- package/esm2020/grouping/group-header-column-template.directive.mjs +2 -2
- package/esm2020/grouping/group-header-template.directive.mjs +9 -37
- package/esm2020/index.mjs +1 -0
- package/esm2020/layout/sizing-options.service.mjs +3 -0
- package/esm2020/localization/messages.mjs +3 -1
- package/esm2020/navigation/focusable.directive.mjs +10 -41
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/pager/pager-page-sizes.component.mjs +1 -1
- package/esm2020/pager/pager-template.directive.mjs +13 -46
- package/esm2020/pdf/pdf-template.directive.mjs +10 -38
- package/esm2020/pdf/pdf.module.mjs +7 -16
- package/esm2020/rendering/body.module.mjs +9 -4
- package/esm2020/rendering/cell-loading.template.directive.mjs +11 -8
- package/esm2020/rendering/cell-template.directive.mjs +11 -35
- package/esm2020/rendering/cell.component.mjs +43 -10
- package/esm2020/rendering/details/detail-template.directive.mjs +10 -58
- package/esm2020/rendering/details-expand.directive.mjs +1 -1
- package/esm2020/rendering/footer/footer-template.directive.mjs +8 -35
- package/esm2020/rendering/header/header-template.directive.mjs +9 -36
- package/esm2020/rendering/loading-template.directive.mjs +1 -1
- package/esm2020/rendering/no-records-template.directive.mjs +11 -58
- package/esm2020/rendering/toolbar/toolbar-position.mjs +17 -0
- package/esm2020/rendering/toolbar/toolbar-template.directive.mjs +10 -56
- package/esm2020/row-reordering/row-reorder.service.mjs +232 -0
- package/esm2020/row-reordering/types.mjs +5 -0
- package/esm2020/row-reordering/utils.mjs +87 -0
- package/esm2020/selection/selectall-checkbox.directive.mjs +12 -1
- package/esm2020/selection/selection-checkbox.directive.mjs +11 -44
- package/esm2020/selection/selection-default.mjs +1 -0
- package/esm2020/selection/selection.directive.mjs +1 -1
- package/excel/excel-command.directive.d.ts +2 -2
- package/excel/excel.module.d.ts +5 -15
- package/fesm2015/progress-kendo-angular-grid.mjs +876 -800
- package/fesm2020/progress-kendo-angular-grid.mjs +876 -804
- package/filtering/filterable.d.ts +10 -0
- package/grid.component.d.ts +46 -4
- package/grid.module.d.ts +93 -101
- package/grouping/group-footer-template.directive.d.ts +9 -35
- package/grouping/group-header-column-template.directive.d.ts +2 -2
- package/grouping/group-header-template.directive.d.ts +9 -37
- package/index.d.ts +2 -0
- package/layout/sizing-options.service.d.ts +3 -0
- package/localization/messages.d.ts +5 -1
- package/navigation/focusable.directive.d.ts +10 -41
- package/navigation/navigable-settings.d.ts +15 -1
- package/package.json +15 -14
- package/pager/pager-settings.d.ts +8 -12
- package/pager/pager-template.directive.d.ts +13 -46
- package/pdf/pdf-template.directive.d.ts +10 -38
- package/pdf/pdf.module.d.ts +7 -16
- package/rendering/body.module.d.ts +9 -8
- package/rendering/cell-loading.template.directive.d.ts +11 -8
- package/rendering/cell-template.directive.d.ts +11 -35
- package/rendering/cell.component.d.ts +5 -0
- package/rendering/common/row-class.d.ts +4 -4
- package/rendering/details/detail-template.directive.d.ts +10 -58
- package/rendering/details-expand.directive.d.ts +1 -1
- package/rendering/footer/footer-template.directive.d.ts +8 -35
- package/rendering/header/header-template.directive.d.ts +9 -36
- package/rendering/loading-template.directive.d.ts +1 -1
- package/rendering/no-records-template.directive.d.ts +11 -58
- package/rendering/toolbar/toolbar-position.d.ts +18 -1
- package/rendering/toolbar/toolbar-template.directive.d.ts +10 -56
- package/row-reordering/row-reorder.service.d.ts +56 -0
- package/row-reordering/types.d.ts +40 -0
- package/row-reordering/utils.d.ts +78 -0
- package/schematics/ngAdd/index.js +2 -2
- package/scrolling/scrollmode.d.ts +4 -4
- package/selection/selectall-checkbox.directive.d.ts +12 -1
- package/selection/selection-checkbox.directive.d.ts +11 -44
- package/selection/selection-default.d.ts +1 -0
- package/selection/selection.directive.d.ts +1 -1
- package/selection/types.d.ts +24 -2
|
@@ -6,66 +6,19 @@ import { Directive, TemplateRef, Optional } from '@angular/core';
|
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/**
|
|
8
8
|
* Represents the no-records template of the Grid. Provides an option to customize the
|
|
9
|
-
* appearance of the item that is displayed when no data is present.
|
|
10
|
-
* nest an `<ng-template>` tag with the `kendoGridNoRecordsTemplate`
|
|
11
|
-
*
|
|
12
|
-
* > When the locked columns of the Grid are in use, the template is displayed in the non-locked part of the content.
|
|
9
|
+
* appearance of the item that is displayed when no data is present.
|
|
10
|
+
* To define the no-records template, nest an `<ng-template>` tag with the `kendoGridNoRecordsTemplate`
|
|
11
|
+
* directive inside `<kendo-grid>` [see example](slug:norecordtemplate_grid).
|
|
13
12
|
*
|
|
14
13
|
* @example
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* template
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* <kendo-grid-column field="UnitPrice"></kendo-grid-column>
|
|
24
|
-
* <ng-template kendoGridNoRecordsTemplate>
|
|
25
|
-
* There are not products. <a href="#" (click)="refresh()">Click here to refresh</a>.
|
|
26
|
-
* </ng-template>
|
|
27
|
-
* </kendo-grid>
|
|
28
|
-
* `
|
|
29
|
-
* })
|
|
30
|
-
*
|
|
31
|
-
* class AppComponent {
|
|
32
|
-
* public data = [];
|
|
33
|
-
* public refresh() {
|
|
34
|
-
* this.data = [{
|
|
35
|
-
* "ProductID": 1,
|
|
36
|
-
* "ProductName": "Chai",
|
|
37
|
-
* "UnitPrice": 18.0000,
|
|
38
|
-
* "Discontinued": false,
|
|
39
|
-
* "Category": {
|
|
40
|
-
* "CategoryID": 1,
|
|
41
|
-
* "CategoryName": "Beverages",
|
|
42
|
-
* "Description": "Soft drinks, coffees, teas, beers, and ales"
|
|
43
|
-
* }
|
|
44
|
-
* }, {
|
|
45
|
-
* "ProductID": 2,
|
|
46
|
-
* "ProductName": "Chang",
|
|
47
|
-
* "UnitPrice": 19.0000,
|
|
48
|
-
* "Discontinued": false,
|
|
49
|
-
* "Category": {
|
|
50
|
-
* "CategoryID": 1,
|
|
51
|
-
* "CategoryName": "Beverages",
|
|
52
|
-
* "Description": "Soft drinks, coffees, teas, beers, and ales"
|
|
53
|
-
* }
|
|
54
|
-
* }, {
|
|
55
|
-
* "ProductID": 3,
|
|
56
|
-
* "ProductName": "Aniseed Syrup",
|
|
57
|
-
* "UnitPrice": 10.0000,
|
|
58
|
-
* "Discontinued": false,
|
|
59
|
-
* "Category": {
|
|
60
|
-
* "CategoryID": 2,
|
|
61
|
-
* "CategoryName": "Condiments",
|
|
62
|
-
* "Description": "Sweet and savory sauces, relishes, spreads, and seasonings"
|
|
63
|
-
* }
|
|
64
|
-
* }];
|
|
65
|
-
*
|
|
66
|
-
* }
|
|
67
|
-
* }
|
|
68
|
-
*
|
|
14
|
+
* ```html
|
|
15
|
+
* <kendo-grid [data]="data">
|
|
16
|
+
* <ng-template kendoGridNoRecordsTemplate>
|
|
17
|
+
* There are not products. <a href="#" (click)="refresh()">Click here to refresh</a>.
|
|
18
|
+
* </ng-template>
|
|
19
|
+
* <kendo-grid-column field="ProductID"></kendo-grid-column>
|
|
20
|
+
* <kendo-grid-column field="ProductName"></kendo-grid-column>
|
|
21
|
+
* </kendo-grid>
|
|
69
22
|
* ```
|
|
70
23
|
*/
|
|
71
24
|
export class NoRecordsTemplateDirective {
|
|
@@ -2,4 +2,21 @@
|
|
|
2
2
|
* Copyright © 2023 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
|
+
/**
|
|
6
|
+
* Defines the settings for `position` property of the the Grid Toolbar Template. [See example](slug:toolbartemplate_grid#toc-setting-the-toolbar-position)
|
|
7
|
+
*
|
|
8
|
+
* The possible values are:
|
|
9
|
+
* * `top`—Displays the Toolbar a the top of the Grid.
|
|
10
|
+
* * `bottom`—Displays the Toolbar at the bottom of the Grid.
|
|
11
|
+
* * `both`—Displays the Toolbar at the top and bottom of the Grid.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <kendo-grid >
|
|
16
|
+
* <ng-template kendoGridToolbarTemplate position="bottom" let-position="position">
|
|
17
|
+
* <button (click)="onClick()">Custom action</button>
|
|
18
|
+
* </ng-template>
|
|
19
|
+
* </kendo-grid>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
5
22
|
export {};
|
|
@@ -11,56 +11,14 @@ import * as i0 from "@angular/core";
|
|
|
11
11
|
* - `position`—The position at which the toolbar template is rendered. The possible values are "top" and "bottom".
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* <input type="radio" id="bottom" name="position" value="bottom" (click)="positionChange($event)"/>
|
|
23
|
-
* <label class="k-radio-label" for="bottom">Bottom</label><br/>
|
|
24
|
-
* <input type="radio" id="both" name="position" value="both" (click)="positionChange($event)"/>
|
|
25
|
-
* <label class="k-radio-label" for="both">Both</label><br/>
|
|
26
|
-
* </div>
|
|
27
|
-
* <kendo-grid [data]="gridData" style="height: 200px">
|
|
28
|
-
* <ng-template kendoGridToolbarTemplate [position]="position" let-position="position">
|
|
29
|
-
* <button (click)="onClick()">Custom action</button>
|
|
30
|
-
* </ng-template>
|
|
31
|
-
* <kendo-grid-column field="ProductName">
|
|
32
|
-
* </kendo-grid-column>
|
|
33
|
-
* <kendo-grid-column field="UnitPrice">
|
|
34
|
-
* </kendo-grid-column>
|
|
35
|
-
* </kendo-grid>
|
|
36
|
-
* `
|
|
37
|
-
* })
|
|
38
|
-
*
|
|
39
|
-
* class AppComponent {
|
|
40
|
-
* public position: 'top' | 'bottom' | 'both' = 'top';
|
|
41
|
-
*
|
|
42
|
-
* public gridData = [{
|
|
43
|
-
* "ProductID": 1,
|
|
44
|
-
* "ProductName": "Chai",
|
|
45
|
-
* "UnitPrice": 18.0000,
|
|
46
|
-
* "Discontinued": false
|
|
47
|
-
* }, {
|
|
48
|
-
* "ProductID": 2,
|
|
49
|
-
* "ProductName": "Chang",
|
|
50
|
-
* "UnitPrice": 19.0000,
|
|
51
|
-
* "Discontinued": true
|
|
52
|
-
* }
|
|
53
|
-
* ];
|
|
54
|
-
*
|
|
55
|
-
* public onClick(): void {
|
|
56
|
-
* console.log("button was clicked");
|
|
57
|
-
* }
|
|
58
|
-
*
|
|
59
|
-
* public positionChange({ target }): void {
|
|
60
|
-
* this.position = target.value;
|
|
61
|
-
* }
|
|
62
|
-
* }
|
|
63
|
-
*
|
|
14
|
+
* ```html
|
|
15
|
+
* <kendo-grid [data]="gridData" style="height: 200px">
|
|
16
|
+
* <ng-template kendoGridToolbarTemplate [position]="position" let-position="position">
|
|
17
|
+
* <button (click)="onClick()">Custom action</button>
|
|
18
|
+
* </ng-template>
|
|
19
|
+
* <kendo-grid-column field="ProductName">
|
|
20
|
+
* </kendo-grid-column>
|
|
21
|
+
* </kendo-grid>
|
|
64
22
|
* ```
|
|
65
23
|
*/
|
|
66
24
|
export class ToolbarTemplateDirective {
|
|
@@ -69,13 +27,9 @@ export class ToolbarTemplateDirective {
|
|
|
69
27
|
this._position = 'top';
|
|
70
28
|
}
|
|
71
29
|
/**
|
|
72
|
-
* The position of the toolbar ([see example]({% slug toolbartemplate_grid %})).
|
|
30
|
+
* The position of the toolbar ([see example]({% slug toolbartemplate_grid %}#toc-setting-the-toolbar-position)).
|
|
73
31
|
*
|
|
74
|
-
*
|
|
75
|
-
* - `top`—Positions the toolbar above the group panel or header.
|
|
76
|
-
* - `bottom`—Positions the toolbar below the pager.
|
|
77
|
-
* - `both`—Displays two toolbar instances. Positions the first one above
|
|
78
|
-
* the group panel or header and the second one below the pager.
|
|
32
|
+
* @default 'top'
|
|
79
33
|
*/
|
|
80
34
|
set position(position) {
|
|
81
35
|
this._position = position;
|
|
@@ -0,0 +1,232 @@
|
|
|
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, isDifferentParent, defaultSelectors } 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.hintElement = null;
|
|
16
|
+
this.defaultSelectors = defaultSelectors;
|
|
17
|
+
this.hintText = '';
|
|
18
|
+
this.lastDropPosition = dropPosition.forbidden;
|
|
19
|
+
this.dragTarget = null;
|
|
20
|
+
this.dropTarget = null;
|
|
21
|
+
this.rowReorder = new EventEmitter();
|
|
22
|
+
}
|
|
23
|
+
press(ev) {
|
|
24
|
+
this.dragTarget = ev.dragTarget;
|
|
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
|
|
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
|
+
}
|
|
47
|
+
dragLeave() {
|
|
48
|
+
this.dropTarget = null;
|
|
49
|
+
this.hide();
|
|
50
|
+
}
|
|
51
|
+
dragEnd() {
|
|
52
|
+
this.destroyDropIndicator();
|
|
53
|
+
this.dragTarget = null;
|
|
54
|
+
this.dropTarget = null;
|
|
55
|
+
this.hintElement = null;
|
|
56
|
+
}
|
|
57
|
+
drop(ev) {
|
|
58
|
+
this.destroyDropIndicator();
|
|
59
|
+
const rowReorderArgs = this.rowReorderArgs(this.dragTarget, this.dropTarget, ev.dragData);
|
|
60
|
+
this.rowReorder.emit(rowReorderArgs);
|
|
61
|
+
}
|
|
62
|
+
reorderRows(ev, collection) {
|
|
63
|
+
if (this.lastDropPosition === dropPosition.forbidden) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
;
|
|
67
|
+
const { draggedRows, dropTargetRow } = ev;
|
|
68
|
+
const draggedDataItem = draggedRows[0].dataItem;
|
|
69
|
+
const dropTargetDataItem = dropTargetRow.dataItem;
|
|
70
|
+
const draggedItemIndex = collection.indexOf(draggedDataItem);
|
|
71
|
+
const dropTargetIndex = collection.indexOf(dropTargetDataItem);
|
|
72
|
+
const idxToAdd = this.calculateIndexToAdd(draggedItemIndex, dropTargetIndex);
|
|
73
|
+
collection.splice(draggedItemIndex, 1);
|
|
74
|
+
collection.splice(idxToAdd, 0, draggedDataItem);
|
|
75
|
+
}
|
|
76
|
+
get hintIcon() {
|
|
77
|
+
return hintIcons[this.lastDropPosition];
|
|
78
|
+
}
|
|
79
|
+
get hintSVGIcon() {
|
|
80
|
+
return hintSVGIcons[this.lastDropPosition];
|
|
81
|
+
}
|
|
82
|
+
getDefaultHintText(columns, data) {
|
|
83
|
+
let hintText = '';
|
|
84
|
+
const columnFieldsArray = columns
|
|
85
|
+
.toArray()
|
|
86
|
+
.filter(column => !column.hidden && isPresent(column.field))
|
|
87
|
+
.map(column => column.field);
|
|
88
|
+
const draggedDragRow = this.getDragRowPerElement(this.dragTarget, data);
|
|
89
|
+
const draggedDataItem = draggedDragRow?.dataItem;
|
|
90
|
+
isPresent(draggedDataItem) && columnFieldsArray.forEach(column => {
|
|
91
|
+
const columnValue = draggedDataItem[column];
|
|
92
|
+
isPresent(columnValue) ? hintText += `${columnValue} ` : null;
|
|
93
|
+
});
|
|
94
|
+
return hintText.trim();
|
|
95
|
+
}
|
|
96
|
+
rowReorderArgs(dragRow, dropRow, data) {
|
|
97
|
+
const dragRowData = this.getDragRowPerElement(dragRow, data);
|
|
98
|
+
const dropRowData = this.getDragRowPerElement(dropRow, data);
|
|
99
|
+
return {
|
|
100
|
+
draggedRows: [dragRowData],
|
|
101
|
+
dropTargetRow: dropRowData,
|
|
102
|
+
dropPosition: this.lastDropPosition
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
getDragRowPerElement(row, data) {
|
|
106
|
+
let rowIndex = row?.getAttribute('data-kendo-grid-item-index');
|
|
107
|
+
rowIndex = rowIndex ? parseInt(rowIndex, 10) : -1;
|
|
108
|
+
const skip = this.skip || 0;
|
|
109
|
+
const dataItem = rowIndex === -1 ? null : data[rowIndex - skip];
|
|
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
|
+
calculateIndexToAdd(dragIndex, dropIndex) {
|
|
149
|
+
if (dragIndex > dropIndex && this.lastDropPosition === dropPosition.after) {
|
|
150
|
+
return dropIndex + 1;
|
|
151
|
+
}
|
|
152
|
+
else if (dragIndex > dropIndex && this.lastDropPosition === dropPosition.before) {
|
|
153
|
+
return dropIndex;
|
|
154
|
+
}
|
|
155
|
+
else if (dragIndex < dropIndex && this.lastDropPosition === dropPosition.after) {
|
|
156
|
+
return dropIndex;
|
|
157
|
+
}
|
|
158
|
+
else if (dragIndex < dropIndex && this.lastDropPosition === dropPosition.before) {
|
|
159
|
+
return dropIndex - 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
decorateDropIndicator() {
|
|
163
|
+
dropIndicatorClasses.forEach(className => this.renderer.addClass(this.dropIndicator, className));
|
|
164
|
+
Object.keys(dropIndicatorStyles)
|
|
165
|
+
.forEach(style => this.renderer.setStyle(this.dropIndicator, style, dropIndicatorStyles[style]));
|
|
166
|
+
}
|
|
167
|
+
;
|
|
168
|
+
getDropPosition(e) {
|
|
169
|
+
if (this.dropTarget === this.dragTarget || !isPresent(this.dropTarget)) {
|
|
170
|
+
return dropPosition.forbidden;
|
|
171
|
+
}
|
|
172
|
+
;
|
|
173
|
+
if (isDifferentParent(this.dropTarget, this.dragTarget)) {
|
|
174
|
+
return dropPosition.forbidden;
|
|
175
|
+
}
|
|
176
|
+
;
|
|
177
|
+
const itemViewPortCoords = this.dropTarget.getBoundingClientRect();
|
|
178
|
+
const itemDivisionsCount = 2;
|
|
179
|
+
const itemDivisionHeight = itemViewPortCoords.height / itemDivisionsCount;
|
|
180
|
+
const pointerPosition = e.clientY;
|
|
181
|
+
const itemTop = itemViewPortCoords.top;
|
|
182
|
+
let currentDropPosition = null;
|
|
183
|
+
if (pointerPosition < itemTop + itemDivisionHeight) {
|
|
184
|
+
currentDropPosition = dropPosition.before;
|
|
185
|
+
}
|
|
186
|
+
else if (pointerPosition >= itemTop + itemViewPortCoords.height - itemDivisionHeight) {
|
|
187
|
+
currentDropPosition = dropPosition.after;
|
|
188
|
+
}
|
|
189
|
+
if (currentDropPosition === dropPosition.before && isNextSibling(this.dropTarget, this.dragTarget)) {
|
|
190
|
+
currentDropPosition = dropPosition.forbidden;
|
|
191
|
+
}
|
|
192
|
+
else if (currentDropPosition === dropPosition.after && isPreviousSibling(this.dropTarget, this.dragTarget)) {
|
|
193
|
+
currentDropPosition = dropPosition.forbidden;
|
|
194
|
+
}
|
|
195
|
+
return currentDropPosition;
|
|
196
|
+
}
|
|
197
|
+
updateDropIndicatorPosition() {
|
|
198
|
+
if (this.shouldHideDropIndicator() || !this.dropTarget) {
|
|
199
|
+
this.hide();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
this.show();
|
|
203
|
+
const destinationItemOffset = getOffset(this.dropTarget);
|
|
204
|
+
let indicatorOffsetTop = destinationItemOffset.top;
|
|
205
|
+
const indicatorOffsetLeft = destinationItemOffset.left + this.dropIndicator.offsetWidth / 2;
|
|
206
|
+
if (this.lastDropPosition === dropPosition.after) {
|
|
207
|
+
indicatorOffsetTop += this.dropTarget.offsetHeight;
|
|
208
|
+
}
|
|
209
|
+
this.renderer.setStyle(this.dropIndicator, 'left', `${indicatorOffsetLeft}px`);
|
|
210
|
+
this.renderer.setStyle(this.dropIndicator, 'top', `${indicatorOffsetTop}px`);
|
|
211
|
+
}
|
|
212
|
+
shouldHideDropIndicator() {
|
|
213
|
+
return this.lastDropPosition === dropPosition.forbidden;
|
|
214
|
+
}
|
|
215
|
+
hide() {
|
|
216
|
+
if (isPresent(this.dropIndicator)) {
|
|
217
|
+
this.dropIndicator.style.display = 'none';
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
show() {
|
|
221
|
+
if (isPresent(this.dropIndicator)) {
|
|
222
|
+
this.dropIndicator.style.display = '';
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
RowReorderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RowReorderService, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
227
|
+
RowReorderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RowReorderService });
|
|
228
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RowReorderService, decorators: [{
|
|
229
|
+
type: Injectable
|
|
230
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }]; }, propDecorators: { rowReorder: [{
|
|
231
|
+
type: Output
|
|
232
|
+
}] } });
|
|
@@ -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 {};
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { cancelIcon, insertMiddleIcon } from '@progress/kendo-svg-icons';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export const isNextSibling = (dropTarget, dragTarget) => dropTarget === dragTarget.nextElementSibling;
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export const isPreviousSibling = (dropTarget, dragTarget) => dropTarget === dragTarget.previousElementSibling;
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export const isDifferentParent = (dropTarget, dragTarget) => dropTarget?.parentElement !== dragTarget?.parentElement;
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export function getOffset(element) {
|
|
22
|
+
const { clientTop, clientLeft } = getDocument(element);
|
|
23
|
+
const { pageYOffset, pageXOffset } = getWindow(element);
|
|
24
|
+
const { top, left } = element.getBoundingClientRect();
|
|
25
|
+
return {
|
|
26
|
+
top: top + pageYOffset - clientTop,
|
|
27
|
+
left: left + pageXOffset - clientLeft
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
;
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
export const hintIcons = {
|
|
35
|
+
forbidden: 'cancel',
|
|
36
|
+
before: 'insert-middle',
|
|
37
|
+
after: 'insert-middle'
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
export const hintSVGIcons = {
|
|
43
|
+
forbidden: cancelIcon,
|
|
44
|
+
before: insertMiddleIcon,
|
|
45
|
+
after: insertMiddleIcon
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
50
|
+
export const dropPosition = {
|
|
51
|
+
forbidden: 'forbidden',
|
|
52
|
+
before: 'before',
|
|
53
|
+
after: 'after'
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* @hidden
|
|
57
|
+
*/
|
|
58
|
+
export const hintStyles = {
|
|
59
|
+
zIndex: '20000',
|
|
60
|
+
display: 'flex',
|
|
61
|
+
position: 'fixed'
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* @hidden
|
|
65
|
+
*/
|
|
66
|
+
export const hintClasses = ['k-drag-clue', 'k-reorder-clue'];
|
|
67
|
+
/**
|
|
68
|
+
* @hidden
|
|
69
|
+
*/
|
|
70
|
+
export const dropIndicatorStyles = {
|
|
71
|
+
zIndex: '19000',
|
|
72
|
+
position: 'absolute'
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* @hidden
|
|
76
|
+
*/
|
|
77
|
+
export const dropIndicatorClasses = ['k-drop-hint', 'k-drop-hint-h'];
|
|
78
|
+
/**
|
|
79
|
+
* @hidden
|
|
80
|
+
*/
|
|
81
|
+
export const defaultSelectors = {
|
|
82
|
+
handle: '.k-table-td.k-drag-cell',
|
|
83
|
+
dragTarget: '.k-master-row',
|
|
84
|
+
dropTarget: '.k-master-row'
|
|
85
|
+
};
|
|
86
|
+
const getDocument = element => element?.ownerDocument.documentElement;
|
|
87
|
+
const getWindow = element => element?.ownerDocument.defaultView;
|
|
@@ -10,7 +10,18 @@ import { hasObservers } from '@progress/kendo-angular-common';
|
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
11
11
|
import * as i1 from "./selection.service";
|
|
12
12
|
/**
|
|
13
|
-
* Represents the select-all checkbox feature of the Grid ([see example](
|
|
13
|
+
* Represents the select-all checkbox feature of the Grid ([see example](slug:grid_selection_persistence#toc-selecting-all-items)).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <input
|
|
18
|
+
* type="checkbox"
|
|
19
|
+
* kendoCheckBox
|
|
20
|
+
* kendoGridSelectAllCheckbox
|
|
21
|
+
* [state]="selectAllState"
|
|
22
|
+
* (selectAllChange)="onSelectAllChange($event)"
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
14
25
|
*/
|
|
15
26
|
export class SelectAllCheckboxDirective {
|
|
16
27
|
constructor(selectionService, el, renderer, ngZone) {
|
|
@@ -9,53 +9,20 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
import * as i1 from "./selection.service";
|
|
10
10
|
/**
|
|
11
11
|
* Represents the row-selection checkbox of the Grid. The directive expects the
|
|
12
|
-
* index of the current row as an input parameter. Inside the
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* with the directive, a [selectionChange]({% slug api_grid_gridcomponent %}#toc-selectionChange)
|
|
12
|
+
* index of the current row as an input parameter. Inside the [`CellTemplateDirective`](slug:api_grid_celltemplatedirective), apply the
|
|
13
|
+
* `kendoGridSelectionCheckbox` to an `<input type="checkbox"/>` element. When the user clicks the checkbox that is associated
|
|
14
|
+
* with the directive, a [selectionChange](slug:api_grid_gridcomponent#toc-selectionChange)
|
|
16
15
|
* event is triggered.
|
|
17
16
|
*
|
|
18
17
|
* @example
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* Select row <input [kendoGridSelectionCheckbox]="idx" />
|
|
28
|
-
* </ng-template>
|
|
29
|
-
* </kendo-grid-checkbox-column>
|
|
30
|
-
* <kendo-grid-column field="ProductID" title="Product ID" [width]="120">
|
|
31
|
-
* </kendo-grid-column>
|
|
32
|
-
* <kendo-grid-column field="ProductName" title="Product Name">
|
|
33
|
-
* </kendo-grid-column>
|
|
34
|
-
* </kendo-grid>
|
|
35
|
-
* `
|
|
36
|
-
* })
|
|
37
|
-
*
|
|
38
|
-
* class AppComponent {
|
|
39
|
-
* public gridData: any[];
|
|
40
|
-
*
|
|
41
|
-
* constructor() {
|
|
42
|
-
* this.gridData = products;
|
|
43
|
-
* }
|
|
44
|
-
* }
|
|
45
|
-
*
|
|
46
|
-
* const products = [{
|
|
47
|
-
* "ProductID": 1,
|
|
48
|
-
* "ProductName": "Chai",
|
|
49
|
-
* "UnitPrice": 18.0000,
|
|
50
|
-
* "Discontinued": true
|
|
51
|
-
* }, {
|
|
52
|
-
* "ProductID": 2,
|
|
53
|
-
* "ProductName": "Chang",
|
|
54
|
-
* "UnitPrice": 19.0000,
|
|
55
|
-
* "Discontinued": false
|
|
56
|
-
* }
|
|
57
|
-
* ];
|
|
58
|
-
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <kendo-grid ... >
|
|
20
|
+
* <kendo-grid-column>
|
|
21
|
+
* <ng-template kendoGridCellTemplate let-rowIndex="rowIndex">
|
|
22
|
+
* <input ... [kendoGridSelectionCheckbox]="rowIndex"/>
|
|
23
|
+
* </ng-template>
|
|
24
|
+
* </kendo-grid-column>
|
|
25
|
+
* </kendo-grid>
|
|
59
26
|
* ```
|
|
60
27
|
*/
|
|
61
28
|
export class SelectionCheckboxDirective {
|
|
@@ -9,7 +9,7 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
import * as i1 from "../common/provider.service";
|
|
10
10
|
/**
|
|
11
11
|
* A directive which stores the row selection state of the Grid in memory
|
|
12
|
-
* ([see example]({% slug selection_grid %}#toc-
|
|
12
|
+
* ([see example]({% slug selection_grid %}#toc-toggling-the-selection-functionality)).
|
|
13
13
|
*/
|
|
14
14
|
export class SelectionDirective extends Selection {
|
|
15
15
|
constructor(ctx, cd) {
|
|
@@ -10,13 +10,13 @@ import * as i0 from "@angular/core";
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents the `export-to-Excel` command of the Grid. You can apply this
|
|
12
12
|
* directive to any `button` element inside a
|
|
13
|
-
* [ToolbarTemplate]({% slug
|
|
13
|
+
* [ToolbarTemplate]({% slug api_grid_toolbartemplatedirective %}).
|
|
14
14
|
* When the user clicks a button associated with the directive, the
|
|
15
15
|
* [excelExport]({% slug api_grid_gridcomponent %}#toc-excelexport) event
|
|
16
16
|
* fires ([see example]({% slug excelexport_grid %})).
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
|
-
* ```html
|
|
19
|
+
* ```html
|
|
20
20
|
* <kendo-grid>
|
|
21
21
|
* <ng-template kendoGridToolbarTemplate>
|
|
22
22
|
* <button kendoGridExcelCommand>Export to PDF</button>
|
package/excel/excel.module.d.ts
CHANGED
|
@@ -13,29 +13,19 @@ import * as i4 from "@progress/kendo-angular-excel-export";
|
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* // Import the Grid and Excel modules
|
|
18
|
-
* import { GridModule, ExcelModule } from '@progress/kendo-angular-grid';
|
|
19
|
-
*
|
|
20
|
-
* // The browser platform with a compiler
|
|
21
|
-
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
22
|
-
*
|
|
16
|
+
* ```ts
|
|
23
17
|
* import { NgModule } from '@angular/core';
|
|
24
|
-
*
|
|
25
|
-
*
|
|
18
|
+
* import { BrowserModule } from "@angular/platform-browser";
|
|
19
|
+
* import { GridModule, ExcelModule } from '@progress/kendo-angular-grid';
|
|
26
20
|
* import { AppComponent } from './app.component';
|
|
27
21
|
*
|
|
28
|
-
* // Define the app module
|
|
29
22
|
* _@NgModule({
|
|
30
|
-
* declarations: [AppComponent],
|
|
31
|
-
* imports: [BrowserModule, GridModule, ExcelModule],
|
|
23
|
+
* declarations: [AppComponent],
|
|
24
|
+
* imports: [BrowserModule, GridModule, ExcelModule],
|
|
32
25
|
* bootstrap: [AppComponent]
|
|
33
26
|
* })
|
|
34
27
|
* export class AppModule {}
|
|
35
28
|
*
|
|
36
|
-
* // Compile and launch the module
|
|
37
|
-
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
38
|
-
*
|
|
39
29
|
* ```
|
|
40
30
|
*/
|
|
41
31
|
export declare class ExcelModule {
|