@progress/kendo-angular-grid 19.0.0-develop.10 → 19.0.0-develop.12
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-chooser-tool.directive.d.ts +6 -6
- package/columns/column-base.d.ts +5 -0
- package/columns/span-column.component.d.ts +2 -2
- package/common/toolbar-tool-base.directive.d.ts +26 -0
- package/directives.d.ts +11 -4
- package/editing/add-command-tool.directive.d.ts +7 -6
- package/editing/cancel-command-tool.directive.d.ts +38 -0
- package/editing/edit-command-tool.directive.d.ts +38 -0
- package/editing/edit.service.d.ts +1 -1
- package/editing/remove-command-tool.directive.d.ts +39 -0
- package/editing/save-command-tool.directive.d.ts +38 -0
- package/editing/toolbar-editing-tool-base.directive.d.ts +29 -0
- package/esm2022/column-menu/column-chooser-tool.directive.mjs +17 -30
- package/esm2022/column-resizing/column-handle.directive.mjs +2 -2
- package/esm2022/columns/column-base.mjs +9 -0
- package/esm2022/columns/columns-container.mjs +1 -1
- package/esm2022/columns/span-column.component.mjs +9 -9
- package/esm2022/common/toolbar-tool-base.directive.mjs +81 -0
- package/esm2022/directives.mjs +17 -2
- package/esm2022/editing/add-command-tool.directive.mjs +12 -15
- package/esm2022/editing/cancel-command-tool.directive.mjs +64 -0
- package/esm2022/editing/edit-command-tool.directive.mjs +59 -0
- package/esm2022/editing/remove-command-tool.directive.mjs +60 -0
- package/esm2022/editing/remove-command.directive.mjs +1 -0
- package/esm2022/editing/save-command-tool.directive.mjs +64 -0
- package/esm2022/editing/toolbar-editing-tool-base.directive.mjs +91 -0
- package/esm2022/excel/excel-command-tool.directive.mjs +12 -17
- package/esm2022/grid.component.mjs +155 -40
- package/esm2022/grid.module.mjs +114 -101
- package/esm2022/index.mjs +9 -0
- package/esm2022/localization/messages.mjs +43 -1
- package/esm2022/navigation/toolbar-tool-name.mjs +17 -0
- package/esm2022/package-metadata.mjs +2 -2
- package/esm2022/pdf/pdf-command-tool.directive.mjs +12 -15
- package/esm2022/rendering/cell.component.mjs +3 -3
- package/esm2022/rendering/header/header.component.mjs +1 -1
- package/esm2022/rendering/list.component.mjs +1 -1
- package/esm2022/rendering/table-body.component.mjs +1 -1
- package/esm2022/selection/selection.service.mjs +11 -0
- package/esm2022/state-management/grid-state.models.mjs +26 -0
- package/esm2022/state-management/redo-command-tool.mjs +66 -0
- package/esm2022/state-management/undo-command-tool.mjs +66 -0
- package/esm2022/state-management/undo-redo.directive.mjs +178 -0
- package/esm2022/state-management/undo-redo.service.mjs +22 -0
- package/esm2022/state-management/undo-redo.stack.mjs +232 -0
- package/esm2022/utils.mjs +13 -0
- package/excel/excel-command-tool.directive.d.ts +5 -5
- package/fesm2022/progress-kendo-angular-grid.mjs +1213 -162
- package/grid.component.d.ts +42 -19
- package/grid.module.d.ts +107 -100
- package/index.d.ts +8 -0
- package/localization/messages.d.ts +29 -1
- package/navigation/toolbar-tool-name.d.ts +17 -0
- package/package.json +20 -20
- package/pdf/pdf-command-tool.directive.d.ts +6 -5
- package/rendering/cell.component.d.ts +1 -1
- package/schematics/ngAdd/index.js +4 -4
- package/selection/selection.service.d.ts +1 -0
- package/state-management/grid-state.models.d.ts +58 -0
- package/state-management/redo-command-tool.d.ts +38 -0
- package/state-management/undo-command-tool.d.ts +38 -0
- package/state-management/undo-redo.directive.d.ts +51 -0
- package/state-management/undo-redo.service.d.ts +19 -0
- package/state-management/undo-redo.stack.d.ts +104 -0
- package/utils.d.ts +11 -1
|
@@ -48,7 +48,7 @@ export class SpanColumnComponent extends ColumnBase {
|
|
|
48
48
|
/**
|
|
49
49
|
* @hidden
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
children = new QueryList();
|
|
52
52
|
/**
|
|
53
53
|
* @hidden
|
|
54
54
|
*/
|
|
@@ -91,13 +91,13 @@ export class SpanColumnComponent extends ColumnBase {
|
|
|
91
91
|
set width(_value) {
|
|
92
92
|
}
|
|
93
93
|
get width() {
|
|
94
|
-
return this.
|
|
94
|
+
return this.children.reduce((total, column) => total + column.width, 0);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* @hidden
|
|
98
98
|
*/
|
|
99
99
|
get leafIndex() {
|
|
100
|
-
return this.
|
|
100
|
+
return this.children.first.leafIndex;
|
|
101
101
|
}
|
|
102
102
|
_editable = true;
|
|
103
103
|
constructor(parent, idService) {
|
|
@@ -124,7 +124,7 @@ export class SpanColumnComponent extends ColumnBase {
|
|
|
124
124
|
* @hidden
|
|
125
125
|
*/
|
|
126
126
|
get colspan() {
|
|
127
|
-
return this.
|
|
127
|
+
return this.children.filter(c => c.isVisible).length;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* Toggles the locked (frozen) state of the columns ([see example](slug:locked_columns_grid)).
|
|
@@ -134,13 +134,13 @@ export class SpanColumnComponent extends ColumnBase {
|
|
|
134
134
|
this._locked = value;
|
|
135
135
|
}
|
|
136
136
|
get locked() {
|
|
137
|
-
return this._locked || this.
|
|
137
|
+
return this._locked || this.children.some(c => c.locked);
|
|
138
138
|
}
|
|
139
139
|
get childrenArray() {
|
|
140
|
-
return this.
|
|
140
|
+
return this.children.toArray();
|
|
141
141
|
}
|
|
142
142
|
get hasChildren() {
|
|
143
|
-
return this.
|
|
143
|
+
return this.children.length > 0;
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* @hidden
|
|
@@ -156,7 +156,7 @@ export class SpanColumnComponent extends ColumnBase {
|
|
|
156
156
|
provide: ColumnBase,
|
|
157
157
|
useExisting: forwardRef(() => SpanColumnComponent)
|
|
158
158
|
}
|
|
159
|
-
], queries: [{ propertyName: "template", predicate: CellTemplateDirective }, { propertyName: "editTemplate", predicate: EditTemplateDirective }, { propertyName: "
|
|
159
|
+
], queries: [{ propertyName: "template", predicate: CellTemplateDirective }, { propertyName: "editTemplate", predicate: EditTemplateDirective }, { propertyName: "children", predicate: ColumnComponent }], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
160
160
|
}
|
|
161
161
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SpanColumnComponent, decorators: [{
|
|
162
162
|
type: Component,
|
|
@@ -185,7 +185,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
185
185
|
}], editTemplate: [{
|
|
186
186
|
type: ContentChildren,
|
|
187
187
|
args: [EditTemplateDirective, { descendants: false }]
|
|
188
|
-
}],
|
|
188
|
+
}], children: [{
|
|
189
189
|
type: ContentChildren,
|
|
190
190
|
args: [ColumnComponent]
|
|
191
191
|
}], editable: [{
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ChangeDetectorRef, Directive, Inject, NgZone } from '@angular/core';
|
|
6
|
+
import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
|
|
7
|
+
import { Subscription } from 'rxjs';
|
|
8
|
+
import { cancelIcon, columnsIcon, fileExcelIcon, filePdfIcon, pencilIcon, plusIcon, saveIcon, trashIcon } from '@progress/kendo-svg-icons';
|
|
9
|
+
import { isPresent } from '@progress/kendo-angular-common';
|
|
10
|
+
import { ContextService } from './provider.service';
|
|
11
|
+
import { ToolbarToolName } from '../navigation/toolbar-tool-name';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "@progress/kendo-angular-toolbar";
|
|
14
|
+
import * as i2 from "./provider.service";
|
|
15
|
+
const ICONS_MAP = {
|
|
16
|
+
edit: { svgIcon: pencilIcon, icon: 'pencil' },
|
|
17
|
+
save: { svgIcon: saveIcon, icon: 'save' },
|
|
18
|
+
cancel: { svgIcon: cancelIcon, icon: 'cancel' },
|
|
19
|
+
remove: { svgIcon: trashIcon, icon: 'trash' },
|
|
20
|
+
add: { svgIcon: plusIcon, icon: 'plus' },
|
|
21
|
+
excelExport: { svgIcon: fileExcelIcon, icon: 'file-excel' },
|
|
22
|
+
pdfExport: { svgIcon: filePdfIcon, icon: 'file-pdf' },
|
|
23
|
+
columns: { svgIcon: columnsIcon, icon: 'columns' }
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export class ToolbarToolBase {
|
|
29
|
+
host;
|
|
30
|
+
commandName;
|
|
31
|
+
ctx;
|
|
32
|
+
zone;
|
|
33
|
+
cdr;
|
|
34
|
+
clickSub = new Subscription();
|
|
35
|
+
constructor(host, commandName, ctx, zone, cdr) {
|
|
36
|
+
this.host = host;
|
|
37
|
+
this.commandName = commandName;
|
|
38
|
+
this.ctx = ctx;
|
|
39
|
+
this.zone = zone;
|
|
40
|
+
this.cdr = cdr;
|
|
41
|
+
}
|
|
42
|
+
ngOnInit() {
|
|
43
|
+
this.clickSub = this.host.click.subscribe(e => this.onClick(e));
|
|
44
|
+
const hasIcon = (isPresent(this.host.toolbarOptions.icon) && this.host.toolbarOptions.icon !== '') &&
|
|
45
|
+
(isPresent(this.host.overflowOptions.icon) && this.host.overflowOptions.icon !== '');
|
|
46
|
+
const hasSvgIcon = isPresent(this.host.toolbarOptions.svgIcon) && isPresent(this.host.overflowOptions.svgIcon);
|
|
47
|
+
if (!hasIcon) {
|
|
48
|
+
this.host.icon = ICONS_MAP[this.commandName].icon;
|
|
49
|
+
}
|
|
50
|
+
if (!hasSvgIcon) {
|
|
51
|
+
this.host.svgIcon = ICONS_MAP[this.commandName].svgIcon;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
ngAfterViewInit() {
|
|
55
|
+
const hasText = isPresent(this.host.text);
|
|
56
|
+
if (!hasText) {
|
|
57
|
+
this.zone.runOutsideAngular(() => {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
const messageKey = this.commandName === ToolbarToolName.columns ? 'columns' : `${this.commandName}ToolbarToolText`;
|
|
60
|
+
this.host.text = this.ctx.localization.get(messageKey);
|
|
61
|
+
this.zone.run(() => {
|
|
62
|
+
this.cdr.markForCheck();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
ngOnDestroy() {
|
|
69
|
+
this.clickSub.unsubscribe();
|
|
70
|
+
}
|
|
71
|
+
onClick(_e) { }
|
|
72
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolbarToolBase, deps: [{ token: i1.ToolBarButtonComponent }, { token: 'command' }, { token: i2.ContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
73
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ToolbarToolBase, ngImport: i0 });
|
|
74
|
+
}
|
|
75
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolbarToolBase, decorators: [{
|
|
76
|
+
type: Directive,
|
|
77
|
+
args: [{}]
|
|
78
|
+
}], ctorParameters: function () { return [{ type: i1.ToolBarButtonComponent }, { type: undefined, decorators: [{
|
|
79
|
+
type: Inject,
|
|
80
|
+
args: ['command']
|
|
81
|
+
}] }, { type: i2.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
|
package/esm2022/directives.mjs
CHANGED
|
@@ -148,8 +148,15 @@ import { AddCommandToolbarDirective } from "./editing/add-command-tool.directive
|
|
|
148
148
|
import { RowDragHandleTemplateDirective } from "./row-reordering/drag-handle-template.directive";
|
|
149
149
|
import { RowDragHintTemplateDirective } from "./row-reordering/drag-hint-template.directive";
|
|
150
150
|
import { DialogFormComponent, FormComponent, FormFormFieldComponent } from "./editing/form";
|
|
151
|
+
import { UndoRedoDirective } from "./state-management/undo-redo.directive";
|
|
152
|
+
import { UndoCommandToolbarDirective } from "./state-management/undo-command-tool";
|
|
153
|
+
import { RedoCommandToolbarDirective } from "./state-management/redo-command-tool";
|
|
151
154
|
import { SortCommandToolbarDirective } from "./rendering/toolbar/tools/sort-command-tool.directive";
|
|
152
155
|
import { FilterCommandToolbarDirective } from "./rendering/toolbar/tools/filter-command-tool.directive";
|
|
156
|
+
import { EditCommandToolbarDirective } from "./editing/edit-command-tool.directive";
|
|
157
|
+
import { SaveCommandToolbarDirective } from "./editing/save-command-tool.directive";
|
|
158
|
+
import { RemoveCommandToolbarDirective } from "./editing/remove-command-tool.directive";
|
|
159
|
+
import { CancelCommandToolbarDirective } from "./editing/cancel-command-tool.directive";
|
|
153
160
|
/**
|
|
154
161
|
* @hidden
|
|
155
162
|
*
|
|
@@ -369,6 +376,10 @@ export const KENDO_GRID_BODY_EXPORTS = [
|
|
|
369
376
|
RemoveCommandDirective,
|
|
370
377
|
AddCommandDirective,
|
|
371
378
|
AddCommandToolbarDirective,
|
|
379
|
+
EditCommandToolbarDirective,
|
|
380
|
+
SaveCommandToolbarDirective,
|
|
381
|
+
RemoveCommandToolbarDirective,
|
|
382
|
+
CancelCommandToolbarDirective,
|
|
372
383
|
CellLoadingTemplateDirective,
|
|
373
384
|
LoadingTemplateDirective,
|
|
374
385
|
RowReorderColumnComponent,
|
|
@@ -404,7 +415,8 @@ export const KENDO_GRID_DECLARATIONS = [
|
|
|
404
415
|
GridClipboardDirective,
|
|
405
416
|
FormComponent,
|
|
406
417
|
DialogFormComponent,
|
|
407
|
-
FormFormFieldComponent
|
|
418
|
+
FormFormFieldComponent,
|
|
419
|
+
UndoRedoDirective,
|
|
408
420
|
];
|
|
409
421
|
/**
|
|
410
422
|
* @hidden
|
|
@@ -436,7 +448,10 @@ export const KENDO_GRID_EXPORTS = [
|
|
|
436
448
|
...KENDO_GRID_FILTER_OPERATORS,
|
|
437
449
|
...KENDO_GRID_FILTER_MENU_EXPORTS,
|
|
438
450
|
...KENDO_GRID_COLUMN_MENU_EXPORTS,
|
|
439
|
-
GridClipboardDirective
|
|
451
|
+
GridClipboardDirective,
|
|
452
|
+
UndoRedoDirective,
|
|
453
|
+
UndoCommandToolbarDirective,
|
|
454
|
+
RedoCommandToolbarDirective,
|
|
440
455
|
];
|
|
441
456
|
/**
|
|
442
457
|
* @hidden
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
* Copyright © 2025 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 { Directive } from '@angular/core';
|
|
5
|
+
import { ChangeDetectorRef, Directive, NgZone } from '@angular/core';
|
|
6
6
|
import { EditService } from './edit.service';
|
|
7
7
|
import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { ContextService } from '../common/provider.service';
|
|
9
|
+
import { ToolbarEditingToolBase } from './toolbar-editing-tool-base.directive';
|
|
10
|
+
import { ToolbarToolName } from '../navigation/toolbar-tool-name';
|
|
10
11
|
import * as i0 from "@angular/core";
|
|
11
12
|
import * as i1 from "./edit.service";
|
|
12
13
|
import * as i2 from "@progress/kendo-angular-toolbar";
|
|
14
|
+
import * as i3 from "../common/provider.service";
|
|
13
15
|
/**
|
|
14
16
|
* Represents the command for adding a new item to the Grid.
|
|
15
17
|
* You can apply this directive to any `kendo-toolbar-button` element inside a
|
|
@@ -28,22 +30,17 @@ import * as i2 from "@progress/kendo-angular-toolbar";
|
|
|
28
30
|
* </kendo-grid>
|
|
29
31
|
* ```
|
|
30
32
|
*/
|
|
31
|
-
export class AddCommandToolbarDirective {
|
|
33
|
+
export class AddCommandToolbarDirective extends ToolbarEditingToolBase {
|
|
32
34
|
editService;
|
|
33
35
|
host;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
constructor(editService, host, ctx, zone, cdr) {
|
|
37
|
+
super(host, ToolbarToolName.add, ctx, zone, cdr, editService);
|
|
36
38
|
this.editService = editService;
|
|
37
39
|
this.host = host;
|
|
38
40
|
}
|
|
39
41
|
ngOnInit() {
|
|
40
|
-
|
|
42
|
+
super.ngOnInit();
|
|
41
43
|
this.host.className = 'k-grid-add-command';
|
|
42
|
-
this.host.svgIcon = plusIcon;
|
|
43
|
-
this.host.icon = 'plus';
|
|
44
|
-
}
|
|
45
|
-
ngOnDestroy() {
|
|
46
|
-
this.clickSub.unsubscribe();
|
|
47
44
|
}
|
|
48
45
|
/**
|
|
49
46
|
* @hidden
|
|
@@ -52,8 +49,8 @@ export class AddCommandToolbarDirective {
|
|
|
52
49
|
e.preventDefault();
|
|
53
50
|
this.editService.beginAdd();
|
|
54
51
|
}
|
|
55
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AddCommandToolbarDirective, deps: [{ token: i1.EditService }, { token: i2.ToolBarButtonComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
|
56
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AddCommandToolbarDirective, isStandalone: true, selector: "[kendoGridAddTool]", ngImport: i0 });
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AddCommandToolbarDirective, deps: [{ token: i1.EditService }, { token: i2.ToolBarButtonComponent }, { token: i3.ContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
53
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: AddCommandToolbarDirective, isStandalone: true, selector: "[kendoGridAddTool]", usesInheritance: true, ngImport: i0 });
|
|
57
54
|
}
|
|
58
55
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AddCommandToolbarDirective, decorators: [{
|
|
59
56
|
type: Directive,
|
|
@@ -61,4 +58,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
61
58
|
selector: '[kendoGridAddTool]',
|
|
62
59
|
standalone: true
|
|
63
60
|
}]
|
|
64
|
-
}], ctorParameters: function () { return [{ type: i1.EditService }, { type: i2.ToolBarButtonComponent }]; } });
|
|
61
|
+
}], ctorParameters: function () { return [{ type: i1.EditService }, { type: i2.ToolBarButtonComponent }, { type: i3.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ChangeDetectorRef, Directive, NgZone } from '@angular/core';
|
|
6
|
+
import { EditService } from './edit.service';
|
|
7
|
+
import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
|
|
8
|
+
import { SelectionService } from '../selection/selection.service';
|
|
9
|
+
import { ContextService } from '../common/provider.service';
|
|
10
|
+
import { ToolbarEditingToolBase } from './toolbar-editing-tool-base.directive';
|
|
11
|
+
import { ToolbarToolName } from '../navigation/toolbar-tool-name';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "./edit.service";
|
|
14
|
+
import * as i2 from "@progress/kendo-angular-toolbar";
|
|
15
|
+
import * as i3 from "../selection/selection.service";
|
|
16
|
+
import * as i4 from "../common/provider.service";
|
|
17
|
+
/**
|
|
18
|
+
* Represents the `cancel` command in the Grid.
|
|
19
|
+
* You can apply this directive to any `kendo-toolbar-button` element inside a
|
|
20
|
+
* ToolbarComponent used in the Grid.
|
|
21
|
+
*
|
|
22
|
+
* When the user clicks the toolbar button that is associated with the directive, the
|
|
23
|
+
* [cancel]({% slug api_grid_gridcomponent %}#toc-cancel) event is triggered.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```html-no-run
|
|
27
|
+
* <kendo-grid>
|
|
28
|
+
* <kendo-toolbar>
|
|
29
|
+
* <kendo-toolbar-button text="Cancel" kendoGridCancelTool></kendo-toolbar-button>
|
|
30
|
+
* </kendo-toolbar>
|
|
31
|
+
* </kendo-grid>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class CancelCommandToolbarDirective extends ToolbarEditingToolBase {
|
|
35
|
+
editService;
|
|
36
|
+
constructor(editService, host, selection, ctx, zone, cdr) {
|
|
37
|
+
super(host, ToolbarToolName.cancel, ctx, zone, cdr, editService, selection);
|
|
38
|
+
this.editService = editService;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
onClick(e) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
if (this.editService.hasNewItem) {
|
|
46
|
+
this.editService.endEdit();
|
|
47
|
+
}
|
|
48
|
+
else if (this.isSelectionPresent && this.editService.isEdited(this.lastSelectionIndex)) {
|
|
49
|
+
this.editService.endEdit(this.lastSelectionIndex);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.editService.editedIndices.forEach(i => this.editService.endEdit(i.index));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CancelCommandToolbarDirective, deps: [{ token: i1.EditService }, { token: i2.ToolBarButtonComponent }, { token: i3.SelectionService }, { token: i4.ContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
56
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: CancelCommandToolbarDirective, isStandalone: true, selector: "[kendoGridCancelTool]", usesInheritance: true, ngImport: i0 });
|
|
57
|
+
}
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CancelCommandToolbarDirective, decorators: [{
|
|
59
|
+
type: Directive,
|
|
60
|
+
args: [{
|
|
61
|
+
selector: '[kendoGridCancelTool]',
|
|
62
|
+
standalone: true
|
|
63
|
+
}]
|
|
64
|
+
}], ctorParameters: function () { return [{ type: i1.EditService }, { type: i2.ToolBarButtonComponent }, { type: i3.SelectionService }, { type: i4.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ChangeDetectorRef, Directive, NgZone } from '@angular/core';
|
|
6
|
+
import { EditService } from './edit.service';
|
|
7
|
+
import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
|
|
8
|
+
import { SelectionService } from '../selection/selection.service';
|
|
9
|
+
import { ContextService } from '../common/provider.service';
|
|
10
|
+
import { ToolbarEditingToolBase } from './toolbar-editing-tool-base.directive';
|
|
11
|
+
import { ToolbarToolName } from '../navigation/toolbar-tool-name';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "./edit.service";
|
|
14
|
+
import * as i2 from "@progress/kendo-angular-toolbar";
|
|
15
|
+
import * as i3 from "../selection/selection.service";
|
|
16
|
+
import * as i4 from "../common/provider.service";
|
|
17
|
+
/**
|
|
18
|
+
* Represents the `edit` command in the Grid.
|
|
19
|
+
* You can apply this directive to any `kendo-toolbar-button` element inside a
|
|
20
|
+
* ToolbarComponent used in the Grid.
|
|
21
|
+
*
|
|
22
|
+
* When the user clicks the toolbar button that is associated with the directive, the
|
|
23
|
+
* [edit]({% slug api_grid_gridcomponent %}#toc-edit) event is triggered.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```html-no-run
|
|
27
|
+
* <kendo-grid>
|
|
28
|
+
* <kendo-toolbar>
|
|
29
|
+
* <kendo-toolbar-button text="Edit" kendoGridEditTool></kendo-toolbar-button>
|
|
30
|
+
* </kendo-toolbar>
|
|
31
|
+
* </kendo-grid>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class EditCommandToolbarDirective extends ToolbarEditingToolBase {
|
|
35
|
+
editService;
|
|
36
|
+
constructor(editService, host, selection, ctx, zone, cdr) {
|
|
37
|
+
super(host, ToolbarToolName.edit, ctx, zone, cdr, editService, selection);
|
|
38
|
+
this.editService = editService;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
onClick(e) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
if (!this.isSelectionPresent) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.editService.beginEdit(this.lastSelectionIndex);
|
|
49
|
+
}
|
|
50
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditCommandToolbarDirective, deps: [{ token: i1.EditService }, { token: i2.ToolBarButtonComponent }, { token: i3.SelectionService }, { token: i4.ContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
51
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: EditCommandToolbarDirective, isStandalone: true, selector: "[kendoGridEditTool]", usesInheritance: true, ngImport: i0 });
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditCommandToolbarDirective, decorators: [{
|
|
54
|
+
type: Directive,
|
|
55
|
+
args: [{
|
|
56
|
+
selector: '[kendoGridEditTool]',
|
|
57
|
+
standalone: true
|
|
58
|
+
}]
|
|
59
|
+
}], ctorParameters: function () { return [{ type: i1.EditService }, { type: i2.ToolBarButtonComponent }, { type: i3.SelectionService }, { type: i4.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ChangeDetectorRef, Directive, NgZone } from '@angular/core';
|
|
6
|
+
import { EditService } from './edit.service';
|
|
7
|
+
import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
|
|
8
|
+
import { SelectionService } from '../selection/selection.service';
|
|
9
|
+
import { ContextService } from '../common/provider.service';
|
|
10
|
+
import { ToolbarEditingToolBase } from './toolbar-editing-tool-base.directive';
|
|
11
|
+
import { ToolbarToolName } from '../navigation/toolbar-tool-name';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "./edit.service";
|
|
14
|
+
import * as i2 from "@progress/kendo-angular-toolbar";
|
|
15
|
+
import * as i3 from "../selection/selection.service";
|
|
16
|
+
import * as i4 from "../common/provider.service";
|
|
17
|
+
/**
|
|
18
|
+
* Represents the `remove` command in the Grid.
|
|
19
|
+
* You can apply this directive to any `kendo-toolbar-button` element inside a
|
|
20
|
+
* ToolbarComponent used in the Grid.
|
|
21
|
+
*
|
|
22
|
+
* When the user clicks the toolbar button that is associated with the directive, the
|
|
23
|
+
* [remove]({% slug api_grid_gridcomponent %}#toc-remove) event is triggered.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```html-no-run
|
|
27
|
+
* <kendo-grid>
|
|
28
|
+
* <kendo-toolbar>
|
|
29
|
+
* <kendo-toolbar-button text="Remove row" kendoGridRemoveTool></kendo-toolbar-button>
|
|
30
|
+
* </kendo-toolbar>
|
|
31
|
+
* </kendo-grid>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class RemoveCommandToolbarDirective extends ToolbarEditingToolBase {
|
|
35
|
+
editService;
|
|
36
|
+
selection;
|
|
37
|
+
constructor(editService, host, selection, ctx, zone, cdr) {
|
|
38
|
+
super(host, ToolbarToolName.remove, ctx, zone, cdr, editService, selection);
|
|
39
|
+
this.editService = editService;
|
|
40
|
+
this.selection = selection;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @hidden
|
|
44
|
+
*/
|
|
45
|
+
onClick(e) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
if (this.isSelectionPresent) {
|
|
48
|
+
this.editService.remove(this.lastSelectionIndex);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RemoveCommandToolbarDirective, deps: [{ token: i1.EditService }, { token: i2.ToolBarButtonComponent }, { token: i3.SelectionService }, { token: i4.ContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
52
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: RemoveCommandToolbarDirective, isStandalone: true, selector: "[kendoGridRemoveTool]", usesInheritance: true, ngImport: i0 });
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RemoveCommandToolbarDirective, decorators: [{
|
|
55
|
+
type: Directive,
|
|
56
|
+
args: [{
|
|
57
|
+
selector: '[kendoGridRemoveTool]',
|
|
58
|
+
standalone: true
|
|
59
|
+
}]
|
|
60
|
+
}], ctorParameters: function () { return [{ type: i1.EditService }, { type: i2.ToolBarButtonComponent }, { type: i3.SelectionService }, { type: i4.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ChangeDetectorRef, Directive, NgZone } from '@angular/core';
|
|
6
|
+
import { EditService } from './edit.service';
|
|
7
|
+
import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
|
|
8
|
+
import { SelectionService } from '../selection/selection.service';
|
|
9
|
+
import { ContextService } from '../common/provider.service';
|
|
10
|
+
import { ToolbarEditingToolBase } from './toolbar-editing-tool-base.directive';
|
|
11
|
+
import { ToolbarToolName } from '../navigation/toolbar-tool-name';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "./edit.service";
|
|
14
|
+
import * as i2 from "@progress/kendo-angular-toolbar";
|
|
15
|
+
import * as i3 from "../selection/selection.service";
|
|
16
|
+
import * as i4 from "../common/provider.service";
|
|
17
|
+
/**
|
|
18
|
+
* Represents the `save` command in the Grid.
|
|
19
|
+
* You can apply this directive to any `kendo-toolbar-button` element inside a
|
|
20
|
+
* ToolbarComponent used in the Grid.
|
|
21
|
+
*
|
|
22
|
+
* When the user clicks the toolbar button that is associated with the directive, the
|
|
23
|
+
* [save]({% slug api_grid_gridcomponent %}#toc-save) event is triggered.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```html-no-run
|
|
27
|
+
* <kendo-grid>
|
|
28
|
+
* <kendo-toolbar>
|
|
29
|
+
* <kendo-toolbar-button text="Save" kendoGridSaveTool></kendo-toolbar-button>
|
|
30
|
+
* </kendo-toolbar>
|
|
31
|
+
* </kendo-grid>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class SaveCommandToolbarDirective extends ToolbarEditingToolBase {
|
|
35
|
+
editService;
|
|
36
|
+
constructor(editService, host, selection, ctx, zone, cdr) {
|
|
37
|
+
super(host, ToolbarToolName.save, ctx, zone, cdr, editService, selection);
|
|
38
|
+
this.editService = editService;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
onClick(e) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
if (this.editService.hasNewItem) {
|
|
46
|
+
this.editService.save();
|
|
47
|
+
}
|
|
48
|
+
else if (this.isSelectionPresent && this.editService.isEdited(this.lastSelectionIndex)) {
|
|
49
|
+
this.editService.save(this.lastSelectionIndex);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.editService.editedIndices.forEach(i => this.editService.save(i.index));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SaveCommandToolbarDirective, deps: [{ token: i1.EditService }, { token: i2.ToolBarButtonComponent }, { token: i3.SelectionService }, { token: i4.ContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
56
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: SaveCommandToolbarDirective, isStandalone: true, selector: "[kendoGridSaveTool]", usesInheritance: true, ngImport: i0 });
|
|
57
|
+
}
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SaveCommandToolbarDirective, decorators: [{
|
|
59
|
+
type: Directive,
|
|
60
|
+
args: [{
|
|
61
|
+
selector: '[kendoGridSaveTool]',
|
|
62
|
+
standalone: true
|
|
63
|
+
}]
|
|
64
|
+
}], ctorParameters: function () { return [{ type: i1.EditService }, { type: i2.ToolBarButtonComponent }, { type: i3.SelectionService }, { type: i4.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ChangeDetectorRef, Directive, Inject, NgZone } from '@angular/core';
|
|
6
|
+
import { take } from 'rxjs/operators';
|
|
7
|
+
import { ToolBarButtonComponent } from '@progress/kendo-angular-toolbar';
|
|
8
|
+
import { isPresent } from '@progress/kendo-angular-common';
|
|
9
|
+
import { SelectionService } from '../selection/selection.service';
|
|
10
|
+
import { EditService } from '../editing/edit.service';
|
|
11
|
+
import { ContextService } from '../common/provider.service';
|
|
12
|
+
import { ToolbarToolBase } from '../common/toolbar-tool-base.directive';
|
|
13
|
+
import { ToolbarToolName } from '../navigation/toolbar-tool-name';
|
|
14
|
+
import * as i0 from "@angular/core";
|
|
15
|
+
import * as i1 from "@progress/kendo-angular-toolbar";
|
|
16
|
+
import * as i2 from "../common/provider.service";
|
|
17
|
+
import * as i3 from "../editing/edit.service";
|
|
18
|
+
import * as i4 from "../selection/selection.service";
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export class ToolbarEditingToolBase extends ToolbarToolBase {
|
|
23
|
+
host;
|
|
24
|
+
commandName;
|
|
25
|
+
ctx;
|
|
26
|
+
editService;
|
|
27
|
+
selection;
|
|
28
|
+
isEdited = false;
|
|
29
|
+
lastToolState = null;
|
|
30
|
+
constructor(host, commandName, ctx, zone, cdr, editService, selection) {
|
|
31
|
+
super(host, commandName, ctx, zone, cdr);
|
|
32
|
+
this.host = host;
|
|
33
|
+
this.commandName = commandName;
|
|
34
|
+
this.ctx = ctx;
|
|
35
|
+
this.editService = editService;
|
|
36
|
+
this.selection = selection;
|
|
37
|
+
}
|
|
38
|
+
ngDoCheck() {
|
|
39
|
+
if (!isPresent(this.editService)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.isEdited = this.editService.isEditing();
|
|
43
|
+
let isToolInactive = false;
|
|
44
|
+
const selectionPresent = isPresent(this.lastSelectionIndex);
|
|
45
|
+
switch (this.commandName) {
|
|
46
|
+
case ToolbarToolName.edit:
|
|
47
|
+
isToolInactive = this.isEdited || !selectionPresent;
|
|
48
|
+
break;
|
|
49
|
+
case ToolbarToolName.save:
|
|
50
|
+
isToolInactive = !(this.isEdited || this.editService.hasNewItem);
|
|
51
|
+
break;
|
|
52
|
+
case ToolbarToolName.remove:
|
|
53
|
+
isToolInactive = this.isEdited || !selectionPresent;
|
|
54
|
+
break;
|
|
55
|
+
case ToolbarToolName.cancel:
|
|
56
|
+
isToolInactive = !(this.isEdited || this.editService.hasNewItem);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
if (this.lastToolState !== isToolInactive) {
|
|
60
|
+
this.lastToolState = isToolInactive;
|
|
61
|
+
if (this.ctx.grid.showInactiveTools) {
|
|
62
|
+
this.host.disabled = isToolInactive;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this.host.isHidden = isToolInactive;
|
|
66
|
+
const toolbar = this.host.host;
|
|
67
|
+
toolbar.refreshService.refresh(this.host);
|
|
68
|
+
if (toolbar.resizable) {
|
|
69
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
70
|
+
toolbar.onResize();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
get lastSelectionIndex() {
|
|
77
|
+
return this.selection?.selected[this.selection?.selected.length - 1];
|
|
78
|
+
}
|
|
79
|
+
get isSelectionPresent() {
|
|
80
|
+
return isPresent(this.lastSelectionIndex) && this.lastSelectionIndex > -1;
|
|
81
|
+
}
|
|
82
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolbarEditingToolBase, deps: [{ token: i1.ToolBarButtonComponent }, { token: 'command' }, { token: i2.ContextService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i3.EditService }, { token: i4.SelectionService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
83
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ToolbarEditingToolBase, usesInheritance: true, ngImport: i0 });
|
|
84
|
+
}
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolbarEditingToolBase, decorators: [{
|
|
86
|
+
type: Directive,
|
|
87
|
+
args: [{}]
|
|
88
|
+
}], ctorParameters: function () { return [{ type: i1.ToolBarButtonComponent }, { type: undefined, decorators: [{
|
|
89
|
+
type: Inject,
|
|
90
|
+
args: ['command']
|
|
91
|
+
}] }, { type: i2.ContextService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i3.EditService }, { type: i4.SelectionService }]; } });
|