@progress/kendo-common-tasks 8.0.7-dev.0 → 8.0.7-dev.18
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/README.md +2 -3
- package/index.js +5 -50
- package/package.json +13 -52
- package/docs-layout.hbs +0 -51
- package/docs-public/bootstrap.css +0 -6759
- package/docs-public/bootstrap.min.js +0 -7
- package/docs-public/codemirror/clike.min.js +0 -1
- package/docs-public/codemirror/codemirror.min.js +0 -5
- package/docs-public/codemirror/css.min.js +0 -1
- package/docs-public/codemirror/htmlmixed.min.js +0 -1
- package/docs-public/codemirror/javascript.min.js +0 -1
- package/docs-public/codemirror/jsx.min.js +0 -1
- package/docs-public/codemirror/php.min.js +0 -1
- package/docs-public/codemirror/runmode.min.js +0 -1
- package/docs-public/codemirror/xml.min.js +0 -1
- package/docs-public/docs.css +0 -208
- package/docs-public/docs.scss +0 -253
- package/docs-public/editor/angular/app/app.component.ts +0 -3
- package/docs-public/editor/angular/app/app.module.ts +0 -14
- package/docs-public/editor/angular/index.html +0 -32
- package/docs-public/editor/angular/main.ts +0 -15
- package/docs-public/editor/angular/polyfills.ts +0 -73
- package/docs-public/editor/angular/styles.css +0 -13
- package/docs-public/editor/builder/app/app.component.html +0 -1
- package/docs-public/editor/builder/app/app.component.ts +0 -17
- package/docs-public/editor/builder/app/app.css +0 -449
- package/docs-public/editor/builder/app/app.module.ts +0 -53
- package/docs-public/editor/builder/app/core/core.module.ts +0 -19
- package/docs-public/editor/builder/app/core/data/data-services.exports.ts +0 -71
- package/docs-public/editor/builder/app/core/data/data.service.ts +0 -183
- package/docs-public/editor/builder/app/core/data/odata-service-factory.ts +0 -23
- package/docs-public/editor/builder/app/core/data/odata.service.ts +0 -88
- package/docs-public/editor/builder/app/core/module.config.ts +0 -19
- package/docs-public/editor/builder/app/data/odata-provider/customer.config.ts +0 -17
- package/docs-public/editor/builder/app/data/odata-provider/customer.model.ts +0 -17
- package/docs-public/editor/builder/app/grid-demo.base.component.ts +0 -107
- package/docs-public/editor/builder/app/grid-demo.component.html +0 -37
- package/docs-public/editor/builder/app/grid-demo.component.ts +0 -1
- package/docs-public/editor/builder/app/shared/components/grid/grid.component.html +0 -5
- package/docs-public/editor/builder/app/shared/components/grid/grid.component.ts +0 -243
- package/docs-public/editor/builder/app/shared/services/grid-incell-editing.service.ts +0 -120
- package/docs-public/editor/builder/app/topSection.html +0 -12
- package/docs-public/editor/builder/app/topSection.ts +0 -25
- package/docs-public/editor/builder/assets/themes/metro.css +0 -18877
- package/docs-public/editor/builder/index.html +0 -14
- package/docs-public/editor/builder/main.ts +0 -14
- package/docs-public/editor/builder/polyfills.ts +0 -67
- package/docs-public/editor/builder/styles.css +0 -1
- package/docs-public/editor/builder/tsconfig.app.json +0 -13
- package/docs-public/editor/builder/typings.d.ts +0 -5
- package/docs-public/editor/react/app/main.jsx +0 -6
- package/docs-public/editor/react/index.html +0 -32
- package/docs-public/editor/vue/app/main.js +0 -5
- package/docs-public/editor/vue/index.html +0 -29
- package/docs-public/example-runner.js +0 -802
- package/docs-public/github.css +0 -99
- package/docs-public/snippets.js +0 -1722
- package/docs-public/tomorrow-night.css +0 -75
- package/docs-server.js +0 -152
- package/lint-slugs.js +0 -25
- package/markdown-serve/index.js +0 -10
- package/markdown-serve/parser.js +0 -234
- package/markdown-serve/resolver.js +0 -86
- package/markdown-serve/server.js +0 -370
- package/test/jest-setup.js +0 -2
- package/test/snippets.test.js +0 -373
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
///////////////////
|
|
2
|
-
// Auto-generated
|
|
3
|
-
// Do not edit!!!
|
|
4
|
-
///////////////////
|
|
5
|
-
import { Component, ContentChild, Input, Output, OnInit, EventEmitter } from '@angular/core';
|
|
6
|
-
import { GridComponent, GridDataResult, DataStateChangeEvent, SelectionEvent } from '@progress/kendo-angular-grid';
|
|
7
|
-
import { Observable } from 'rxjs/Observable';
|
|
8
|
-
import { FormGroup } from '@angular/forms';
|
|
9
|
-
import { State } from '@progress/kendo-data-query';
|
|
10
|
-
|
|
11
|
-
import { DataServiceInterface, ModelDataResult } from '../../../core/data/data-services.exports';
|
|
12
|
-
import { GridIncellEditingService } from '../../services/grid-incell-editing.service';
|
|
13
|
-
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
|
14
|
-
|
|
15
|
-
const EDIT_MODE_READ_ONLY = 'ReadOnly';
|
|
16
|
-
const EDIT_MODE_INCELL = 'Incell';
|
|
17
|
-
const EDIT_MODE_INLINE = 'Inline';
|
|
18
|
-
const EDIT_MODE_POPUP = 'Popup';
|
|
19
|
-
|
|
20
|
-
@Component({
|
|
21
|
-
selector: 'kb-grid',
|
|
22
|
-
templateUrl: './grid.component.html'
|
|
23
|
-
})
|
|
24
|
-
export class KbGridComponent implements OnInit {
|
|
25
|
-
@ContentChild(GridComponent) public kendoGrid: GridComponent;
|
|
26
|
-
|
|
27
|
-
@Input() public config: any;
|
|
28
|
-
@Input() public state: State = {};
|
|
29
|
-
@Input() public dataService: DataServiceInterface<any>;
|
|
30
|
-
@Input() public view: Observable<GridDataResult>;
|
|
31
|
-
@Input() get model(): any {
|
|
32
|
-
return this._model;
|
|
33
|
-
}
|
|
34
|
-
set model(value: any) {
|
|
35
|
-
this._model = value;
|
|
36
|
-
this.modelChange.emit(value);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@Output() public add: EventEmitter<any> = new EventEmitter();
|
|
40
|
-
@Output() public edit: EventEmitter<any> = new EventEmitter();
|
|
41
|
-
@Output() public remove: EventEmitter<any> = new EventEmitter();
|
|
42
|
-
@Output() public cellClick: EventEmitter<any> = new EventEmitter();
|
|
43
|
-
@Output() public cellClose: EventEmitter<any> = new EventEmitter();
|
|
44
|
-
@Output() public modelChange: EventEmitter<any> = new EventEmitter();
|
|
45
|
-
|
|
46
|
-
public formGroup: FormGroup = new FormGroup({});
|
|
47
|
-
public isNew: boolean;
|
|
48
|
-
public popupActive = false;
|
|
49
|
-
public editDataModel: any;
|
|
50
|
-
public selectedKeys: number[] = [];
|
|
51
|
-
|
|
52
|
-
private editedRowIndex: number;
|
|
53
|
-
private incellEditingService: GridIncellEditingService;
|
|
54
|
-
private data: BehaviorSubject<ModelDataResult<any>>;
|
|
55
|
-
private _model: any;
|
|
56
|
-
|
|
57
|
-
public ngOnInit(): void {
|
|
58
|
-
if (this.config.editing.mode === EDIT_MODE_INCELL) {
|
|
59
|
-
this.incellEditingService = new GridIncellEditingService(this.dataService, this.state);
|
|
60
|
-
this.data = this.incellEditingService.dataChanges();
|
|
61
|
-
this.view = this.data;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public selectionChange(e: SelectionEvent): void {
|
|
66
|
-
if (e.selectedRows.length) {
|
|
67
|
-
this.model = e.selectedRows[0].dataItem;
|
|
68
|
-
} else {
|
|
69
|
-
this.model = {};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (this.config.events && this.config.events.onRowSelect) {
|
|
73
|
-
this.config.events.onRowSelect(e);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public dataStateChange(gridState: DataStateChangeEvent): void {
|
|
78
|
-
this.state = gridState;
|
|
79
|
-
if (this.config.serverOperations || this.config.editing.mode !== 'Incell') {
|
|
80
|
-
this.dataService.read(this.state);
|
|
81
|
-
} else {
|
|
82
|
-
this.incellEditingService.read(this.state);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public addHandler(e) {
|
|
87
|
-
const { sender } = e;
|
|
88
|
-
this.isNew = true;
|
|
89
|
-
this.editDataModel = this.config.createModel();
|
|
90
|
-
this.add.emit();
|
|
91
|
-
if (this.config.events && this.config.events.onRowCreate) {
|
|
92
|
-
this.config.events.onRowCreate(e);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
switch (this.config.editing.mode) {
|
|
96
|
-
case EDIT_MODE_INLINE:
|
|
97
|
-
case EDIT_MODE_INCELL:
|
|
98
|
-
this.closeEditor(sender);
|
|
99
|
-
sender.addRow(this.formGroup);
|
|
100
|
-
break;
|
|
101
|
-
|
|
102
|
-
case EDIT_MODE_POPUP:
|
|
103
|
-
this.popupActive = true;
|
|
104
|
-
break;
|
|
105
|
-
|
|
106
|
-
default:
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
public editHandler(e) {
|
|
112
|
-
const { sender, rowIndex, dataItem } = e;
|
|
113
|
-
this.editDataModel = dataItem;
|
|
114
|
-
this.isNew = false;
|
|
115
|
-
this.edit.emit();
|
|
116
|
-
if (this.config.events && this.config.events.onRowUpdate) {
|
|
117
|
-
this.config.events.onRowUpdate(e);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
switch (this.config.editing.mode) {
|
|
121
|
-
case EDIT_MODE_INLINE:
|
|
122
|
-
this.closeEditor(sender);
|
|
123
|
-
this.editedRowIndex = rowIndex;
|
|
124
|
-
sender.editRow(rowIndex, this.formGroup);
|
|
125
|
-
break;
|
|
126
|
-
|
|
127
|
-
case EDIT_MODE_POPUP:
|
|
128
|
-
this.popupActive = true;
|
|
129
|
-
break;
|
|
130
|
-
|
|
131
|
-
default:
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
public cancelHandler({ sender, rowIndex }) {
|
|
137
|
-
this.closeEditor(sender, rowIndex);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
public saveHandler({ sender, rowIndex, formGroup, isNew }) {
|
|
141
|
-
switch (this.config.editing.mode) {
|
|
142
|
-
case EDIT_MODE_INCELL:
|
|
143
|
-
if (formGroup.valid) {
|
|
144
|
-
this.incellEditingService.create(this.editDataModel);
|
|
145
|
-
sender.closeRow(rowIndex);
|
|
146
|
-
}
|
|
147
|
-
break;
|
|
148
|
-
case EDIT_MODE_INLINE:
|
|
149
|
-
const item: any = this.editDataModel;
|
|
150
|
-
|
|
151
|
-
if (isNew) {
|
|
152
|
-
this.dataService.create(item);
|
|
153
|
-
} else {
|
|
154
|
-
this.dataService.update(item);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
sender.closeRow(rowIndex);
|
|
158
|
-
|
|
159
|
-
break;
|
|
160
|
-
|
|
161
|
-
case EDIT_MODE_POPUP:
|
|
162
|
-
if (this.isNew) {
|
|
163
|
-
this.dataService.create(this.editDataModel);
|
|
164
|
-
} else {
|
|
165
|
-
this.dataService.update(this.editDataModel);
|
|
166
|
-
}
|
|
167
|
-
this.popupActive = false;
|
|
168
|
-
break;
|
|
169
|
-
|
|
170
|
-
default:
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
public removeHandler(e) {
|
|
177
|
-
const { sender, dataItem } = e;
|
|
178
|
-
if (this.config.events && this.config.events.onRowDelete) {
|
|
179
|
-
this.config.events.onRowDelete(e);
|
|
180
|
-
}
|
|
181
|
-
if (this.config.editing.mode === EDIT_MODE_INCELL) {
|
|
182
|
-
this.incellEditingService.remove(dataItem);
|
|
183
|
-
sender.cancelCell();
|
|
184
|
-
} else {
|
|
185
|
-
this.remove.emit();
|
|
186
|
-
this.dataService.remove(dataItem);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Used in InCell mode
|
|
191
|
-
public saveChanges(): void {
|
|
192
|
-
this.kendoGrid.closeCell();
|
|
193
|
-
this.kendoGrid.cancelCell();
|
|
194
|
-
|
|
195
|
-
this.incellEditingService.saveChanges();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Used in InCell mode
|
|
199
|
-
public cancelChanges(): void {
|
|
200
|
-
this.kendoGrid.cancelCell();
|
|
201
|
-
|
|
202
|
-
this.incellEditingService.cancelChanges();
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Used in InCell mode
|
|
206
|
-
public cellClickHandler({ sender, rowIndex, columnIndex, dataItem, isEdited }) {
|
|
207
|
-
if (!isEdited) {
|
|
208
|
-
this.editDataModel = dataItem;
|
|
209
|
-
this.cellClick.emit();
|
|
210
|
-
sender.editCell(rowIndex, columnIndex, this.formGroup);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Used in InCell mode
|
|
215
|
-
public cellCloseHandler(args: any) {
|
|
216
|
-
const { formGroup } = args;
|
|
217
|
-
|
|
218
|
-
this.cellClose.emit();
|
|
219
|
-
if (!formGroup.valid) {
|
|
220
|
-
// prevent closing the edited cell if there are invalid values.
|
|
221
|
-
args.preventDefault();
|
|
222
|
-
} else if (formGroup.dirty) {
|
|
223
|
-
this.incellEditingService.update(this.editDataModel);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
private closeEditor(grid, rowIndex = this.editedRowIndex) {
|
|
228
|
-
switch (this.config.editing.mode) {
|
|
229
|
-
case EDIT_MODE_INLINE:
|
|
230
|
-
case EDIT_MODE_INCELL:
|
|
231
|
-
grid.closeRow(rowIndex);
|
|
232
|
-
this.editedRowIndex = undefined;
|
|
233
|
-
break;
|
|
234
|
-
|
|
235
|
-
case EDIT_MODE_POPUP:
|
|
236
|
-
this.popupActive = false;
|
|
237
|
-
break;
|
|
238
|
-
|
|
239
|
-
default:
|
|
240
|
-
break;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
///////////////////
|
|
2
|
-
// Auto-generated
|
|
3
|
-
// Do not edit!!!
|
|
4
|
-
///////////////////
|
|
5
|
-
import { Injectable } from '@angular/core';
|
|
6
|
-
|
|
7
|
-
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
|
8
|
-
import { ModelDataResult, DataServiceInterface} from '../../core/data/data-services.exports';
|
|
9
|
-
import { process, State } from '@progress/kendo-data-query';
|
|
10
|
-
|
|
11
|
-
export class GridIncellEditingService {
|
|
12
|
-
private data: any[] = [];
|
|
13
|
-
private originalData: any[] = [];
|
|
14
|
-
private createdItems: any[] = [];
|
|
15
|
-
private updatedItems: any[] = [];
|
|
16
|
-
private deletedItems: any[] = [];
|
|
17
|
-
private dataStream: BehaviorSubject<ModelDataResult<any>> = new BehaviorSubject<ModelDataResult<any>>(null);
|
|
18
|
-
|
|
19
|
-
constructor(public dataService: DataServiceInterface<any>, private state: State) {
|
|
20
|
-
dataService.dataChanges().subscribe(data => {
|
|
21
|
-
if (data) {
|
|
22
|
-
this.data = dataService.fetchedData().data;
|
|
23
|
-
this.originalData = this.cloneData(this.data);
|
|
24
|
-
this.read(this.state);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public dataChanges(): BehaviorSubject<ModelDataResult<any>> {
|
|
30
|
-
return this.dataStream;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public read(state: State): void {
|
|
34
|
-
this.state = state;
|
|
35
|
-
const currentData: ModelDataResult<any> = process(this.data, state);
|
|
36
|
-
return this.dataStream.next(currentData);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public create(item: any): void {
|
|
40
|
-
this.createdItems.push(item);
|
|
41
|
-
this.data.unshift(item);
|
|
42
|
-
this.read(this.state);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public update(item: any): void {
|
|
46
|
-
if (!this.isNew(item)) {
|
|
47
|
-
const index = this.itemIndex(item, this.updatedItems);
|
|
48
|
-
if (index !== -1) {
|
|
49
|
-
this.updatedItems.splice(index, 1, item);
|
|
50
|
-
} else {
|
|
51
|
-
this.updatedItems.push(item);
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
const index = this.itemIndex(item, this.createdItems);
|
|
55
|
-
this.createdItems.splice(index, 1, item);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public remove(item: any): void {
|
|
60
|
-
const dataItemIndex = this.itemIndex(item, this.data);
|
|
61
|
-
this.data.splice(dataItemIndex, 1);
|
|
62
|
-
|
|
63
|
-
const createdItemIndex = this.itemIndex(item, this.createdItems);
|
|
64
|
-
if (createdItemIndex >= 0) {
|
|
65
|
-
this.createdItems.splice(createdItemIndex, 1);
|
|
66
|
-
} else {
|
|
67
|
-
this.deletedItems.push(item);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const updatedItemIndex = this.itemIndex(item, this.updatedItems);
|
|
71
|
-
if (updatedItemIndex >= 0) {
|
|
72
|
-
this.updatedItems.splice(updatedItemIndex, 1);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
this.read(this.state);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public hasChanges(): boolean {
|
|
79
|
-
return Boolean(this.deletedItems.length || this.updatedItems.length || this.createdItems.length);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public isNew(item: any): boolean {
|
|
83
|
-
return this.itemIndex(item, this.createdItems) !== -1;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public saveChanges(): void {
|
|
87
|
-
this.dataService.batch(this.deletedItems, this.createdItems, this.updatedItems);
|
|
88
|
-
this.reset();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
public cancelChanges(): void {
|
|
92
|
-
this.reset();
|
|
93
|
-
|
|
94
|
-
this.data = this.originalData;
|
|
95
|
-
this.originalData = this.cloneData(this.originalData);
|
|
96
|
-
this.read(this.state);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
private reset() {
|
|
100
|
-
this.data = [];
|
|
101
|
-
this.deletedItems = [];
|
|
102
|
-
this.updatedItems = [];
|
|
103
|
-
this.createdItems = [];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private cloneData(data: any[]) {
|
|
107
|
-
return data.map(item => Object.assign({}, item));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
private itemIndex(item: any, data: any[]): number {
|
|
111
|
-
const itemStringified = JSON.stringify(item);
|
|
112
|
-
for (let idx = 0; idx < data.length; idx++) {
|
|
113
|
-
if (JSON.stringify(data[idx]) === itemStringified) {
|
|
114
|
-
return idx;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return -1;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Add your custom code here.
|
|
3
|
-
This file and any changes you make to it are preserved every time the app is generated.
|
|
4
|
-
-->
|
|
5
|
-
<fieldset>
|
|
6
|
-
<legend>Settings</legend>
|
|
7
|
-
<label>Allow paging</label>
|
|
8
|
-
<input #togglePagingChBox type="checkbox" checked="true" (change)="togglePaging(togglePagingChBox.checked)" />
|
|
9
|
-
<br>
|
|
10
|
-
<label>Hide Columns</label>
|
|
11
|
-
<kendo-multiselect [data]="columns" (valueChange)="toggleColumnsVisibility($event)"></kendo-multiselect>
|
|
12
|
-
</fieldset>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/////////////////////////////////////////////////////
|
|
2
|
-
// Add your custom code here.
|
|
3
|
-
// This file and any changes you make to it are preserved every time the app is generated.
|
|
4
|
-
/////////////////////////////////////////////////////
|
|
5
|
-
import { Component, Optional } from '@angular/core';
|
|
6
|
-
import { GridDemoComponent } from './grid-demo.component';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'kb-top-section',
|
|
10
|
-
templateUrl: './topSection.html'
|
|
11
|
-
})
|
|
12
|
-
export class TopSectionComponent {
|
|
13
|
-
public columns: Array<string> = ['CompanyName', 'ContactName', 'ContactTitle', 'Address'];
|
|
14
|
-
|
|
15
|
-
constructor(@Optional() public parent: GridDemoComponent) {
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public togglePaging(checked: boolean): void {
|
|
19
|
-
this.parent.togglePaging(checked);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public toggleColumnsVisibility(value: Array<string>): void {
|
|
23
|
-
this.parent.toggleColumnsVisibility(value);
|
|
24
|
-
}
|
|
25
|
-
}
|