@den4ik92/ng2-smart-table 2.0.6 → 2.1.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/{esm2020 → esm2022}/lib/components/cell/cell-edit-mode/custom-edit.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/cell/cell-edit-mode/default-edit.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/cell/cell-edit-mode/edit-cell-default.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/cell/cell-edit-mode/edit-cell.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/cell/cell-editors/checkbox-editor.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/cell/cell-editors/default-editor.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/cell/cell-editors/input-editor.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/cell/cell-editors/select-editor.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/cell/cell-editors/textarea-editor.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/cell/cell-view-mode/custom-view.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/cell/cell-view-mode/view-cell.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/cell/cell.component.mjs +8 -8
- package/{esm2020 → esm2022}/lib/components/cell/cell.module.mjs +29 -29
- package/{esm2020 → esm2022}/lib/components/filter/custom-filter.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/filter/default-filter.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/filter/filter-default.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/filter/filter-types/checkbox-filter.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/filter/filter-types/default-filter.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/filter/filter-types/input-filter.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/filter/filter-types/select-filter.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/filter/filter.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/filter/filter.module.mjs +23 -23
- package/{esm2020 → esm2022}/lib/components/pager/pager.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/pager/pager.module.mjs +7 -7
- package/esm2022/lib/components/tbody/cells/create-cancel.component.mjs +198 -0
- package/esm2022/lib/components/tbody/cells/custom.component.mjs +58 -0
- package/esm2022/lib/components/tbody/cells/edit-delete.component.mjs +236 -0
- package/esm2022/lib/components/tbody/tbody.component.mjs +95 -0
- package/{esm2020 → esm2022}/lib/components/tbody/tbody.module.mjs +15 -15
- package/{esm2020 → esm2022}/lib/components/thead/cells/actions-title.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/thead/cells/actions.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/thead/cells/add-button.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/thead/cells/checkbox-select-all.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/thead/cells/column-title.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/thead/cells/title/title.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/thead/rows/thead-filters-row.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/thead/rows/thead-form-row.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/thead/rows/thead-titles-row.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/components/thead/thead.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/components/thead/thead.module.mjs +29 -29
- package/esm2022/lib/lib/data-set/cell.mjs +43 -0
- package/esm2022/lib/lib/data-set/column.mjs +74 -0
- package/esm2022/lib/lib/data-set/row.mjs +47 -0
- package/{esm2020 → esm2022}/lib/lib/data-source/local/local.data-source.mjs +1 -1
- package/esm2022/lib/lib/grid.mjs +218 -0
- package/{esm2020 → esm2022}/lib/lib/helpers.mjs +1 -1
- package/{esm2020 → esm2022}/lib/lib/interfaces/smart-table.models.mjs +1 -1
- package/{esm2020 → esm2022}/lib/ng2-smart-table.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/ng2-smart-table.module.mjs +19 -19
- package/{fesm2020 → fesm2022}/den4ik92-ng2-smart-table.mjs +752 -438
- package/fesm2022/den4ik92-ng2-smart-table.mjs.map +1 -0
- package/lib/components/cell/cell-edit-mode/edit-cell-default.d.ts +1 -1
- package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +1 -1
- package/lib/components/cell/cell-editors/default-editor.d.ts +1 -1
- package/lib/components/cell/cell-view-mode/custom-view.component.d.ts +1 -1
- package/lib/components/cell/cell-view-mode/view-cell.component.d.ts +1 -1
- package/lib/components/cell/cell.component.d.ts +2 -2
- package/lib/components/filter/filter-default.d.ts +1 -1
- package/lib/components/filter/filter-types/default-filter.d.ts +1 -1
- package/lib/components/pager/pager.component.d.ts +1 -1
- package/lib/components/tbody/cells/create-cancel.component.d.ts +4 -4
- package/lib/components/tbody/cells/custom.component.d.ts +8 -6
- package/lib/components/tbody/cells/edit-delete.component.d.ts +5 -5
- package/lib/components/tbody/tbody.component.d.ts +1 -1
- package/lib/components/thead/cells/actions-title.component.d.ts +1 -1
- package/lib/components/thead/cells/actions.component.d.ts +1 -1
- package/lib/components/thead/cells/add-button.component.d.ts +1 -1
- package/lib/components/thead/cells/checkbox-select-all.component.d.ts +1 -1
- package/lib/components/thead/cells/column-title.component.d.ts +1 -1
- package/lib/components/thead/cells/title/title.component.d.ts +1 -1
- package/lib/components/thead/rows/thead-filters-row.component.d.ts +1 -1
- package/lib/components/thead/rows/thead-form-row.component.d.ts +1 -1
- package/lib/components/thead/rows/thead-titles-row.component.d.ts +1 -1
- package/lib/components/thead/thead.component.d.ts +1 -1
- package/lib/lib/data-set/cell.d.ts +3 -2
- package/lib/lib/data-set/column.d.ts +3 -3
- package/lib/lib/data-set/row.d.ts +1 -0
- package/lib/lib/helpers.d.ts +4 -4
- package/lib/lib/interfaces/smart-table.models.d.ts +1 -1
- package/lib/ng2-smart-table.component.d.ts +1 -1
- package/package.json +8 -14
- package/esm2020/lib/components/tbody/cells/create-cancel.component.mjs +0 -53
- package/esm2020/lib/components/tbody/cells/custom.component.mjs +0 -49
- package/esm2020/lib/components/tbody/cells/edit-delete.component.mjs +0 -85
- package/esm2020/lib/components/tbody/tbody.component.mjs +0 -95
- package/esm2020/lib/lib/data-set/cell.mjs +0 -41
- package/esm2020/lib/lib/data-set/column.mjs +0 -74
- package/esm2020/lib/lib/data-set/row.mjs +0 -46
- package/esm2020/lib/lib/grid.mjs +0 -211
- package/fesm2015/den4ik92-ng2-smart-table.mjs +0 -3175
- package/fesm2015/den4ik92-ng2-smart-table.mjs.map +0 -1
- package/fesm2020/den4ik92-ng2-smart-table.mjs.map +0 -1
- /package/{esm2020 → esm2022}/den4ik92-ng2-smart-table.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/cell/cell-view-mode/view-cell.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/lib/data-set/data-set.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/lib/data-source/data-source.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/lib/data-source/local/local.filter.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/lib/data-source/local/local.pager.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/lib/data-source/local/local.sorter.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
|
@@ -1,3175 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Component, Input, Output, ViewContainerRef, ViewChild, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
3
|
-
import * as i1 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as i2 from '@angular/forms';
|
|
6
|
-
import { FormsModule, UntypedFormControl, NgControl, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
-
import { debounceTime, distinctUntilChanged, skip } from 'rxjs/operators';
|
|
8
|
-
import { Subject } from 'rxjs';
|
|
9
|
-
|
|
10
|
-
class EditCellDefault {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.inputClass = '';
|
|
13
|
-
this.edited = new EventEmitter();
|
|
14
|
-
}
|
|
15
|
-
onEdited(event) {
|
|
16
|
-
this.edited.next(event);
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
onStopEditing() {
|
|
20
|
-
this.cell.getRow().isInEditing = false;
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
onClick(event) {
|
|
24
|
-
event.stopPropagation();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
EditCellDefault.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EditCellDefault, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
28
|
-
EditCellDefault.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EditCellDefault, selector: "ng-component", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, ngImport: i0, template: '', isInline: true });
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EditCellDefault, decorators: [{
|
|
30
|
-
type: Component,
|
|
31
|
-
args: [{
|
|
32
|
-
template: ''
|
|
33
|
-
}]
|
|
34
|
-
}], propDecorators: { cell: [{
|
|
35
|
-
type: Input
|
|
36
|
-
}], inputClass: [{
|
|
37
|
-
type: Input
|
|
38
|
-
}], edited: [{
|
|
39
|
-
type: Output
|
|
40
|
-
}] } });
|
|
41
|
-
|
|
42
|
-
class CustomEditComponent extends EditCellDefault {
|
|
43
|
-
constructor(resolver) {
|
|
44
|
-
super();
|
|
45
|
-
this.resolver = resolver;
|
|
46
|
-
}
|
|
47
|
-
ngOnChanges(changes) {
|
|
48
|
-
const editor = this.cell.getColumn().editor;
|
|
49
|
-
if (this.cell && !this.customComponent && editor && editor.type == 'custom') {
|
|
50
|
-
const componentFactory = this.resolver.resolveComponentFactory(editor.component);
|
|
51
|
-
this.customComponent = this.dynamicTarget.createComponent(componentFactory);
|
|
52
|
-
// set @Inputs and @Outputs of custom component
|
|
53
|
-
this.customComponent.instance.cell = this.cell;
|
|
54
|
-
this.customComponent.instance.inputClass = this.inputClass;
|
|
55
|
-
this.customComponent.instance.onStopEditing.subscribe(() => this.onStopEditing());
|
|
56
|
-
this.customComponent.instance.onEdited.subscribe((event) => this.onEdited(event));
|
|
57
|
-
this.customComponent.instance.onClick.subscribe((event) => this.onClick(event));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
ngOnDestroy() {
|
|
61
|
-
if (this.customComponent) {
|
|
62
|
-
this.customComponent.destroy();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
CustomEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CustomEditComponent, deps: [{ token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
|
|
67
|
-
CustomEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CustomEditComponent, selector: "table-cell-custom-editor", viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
|
|
68
|
-
<ng-template #dynamicTarget></ng-template>
|
|
69
|
-
`, isInline: true });
|
|
70
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CustomEditComponent, decorators: [{
|
|
71
|
-
type: Component,
|
|
72
|
-
args: [{
|
|
73
|
-
selector: 'table-cell-custom-editor',
|
|
74
|
-
template: `
|
|
75
|
-
<ng-template #dynamicTarget></ng-template>
|
|
76
|
-
`,
|
|
77
|
-
}]
|
|
78
|
-
}], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }]; }, propDecorators: { dynamicTarget: [{
|
|
79
|
-
type: ViewChild,
|
|
80
|
-
args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
|
|
81
|
-
}] } });
|
|
82
|
-
|
|
83
|
-
class DefaultEditor {
|
|
84
|
-
constructor() {
|
|
85
|
-
this.inputClass = '';
|
|
86
|
-
this.onStopEditing = new EventEmitter();
|
|
87
|
-
this.onEdited = new EventEmitter();
|
|
88
|
-
this.onClick = new EventEmitter();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
DefaultEditor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DefaultEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
92
|
-
DefaultEditor.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: DefaultEditor, selector: "ng-component", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { onStopEditing: "onStopEditing", onEdited: "onEdited", onClick: "onClick" }, ngImport: i0, template: '', isInline: true });
|
|
93
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DefaultEditor, decorators: [{
|
|
94
|
-
type: Component,
|
|
95
|
-
args: [{
|
|
96
|
-
template: '',
|
|
97
|
-
}]
|
|
98
|
-
}], propDecorators: { cell: [{
|
|
99
|
-
type: Input
|
|
100
|
-
}], inputClass: [{
|
|
101
|
-
type: Input
|
|
102
|
-
}], onStopEditing: [{
|
|
103
|
-
type: Output
|
|
104
|
-
}], onEdited: [{
|
|
105
|
-
type: Output
|
|
106
|
-
}], onClick: [{
|
|
107
|
-
type: Output
|
|
108
|
-
}] } });
|
|
109
|
-
|
|
110
|
-
class CheckboxEditorComponent extends DefaultEditor {
|
|
111
|
-
constructor() {
|
|
112
|
-
super();
|
|
113
|
-
}
|
|
114
|
-
onChange(event) {
|
|
115
|
-
const config = this.cell.getColumn().getConfig();
|
|
116
|
-
const trueVal = (config && (config === null || config === void 0 ? void 0 : config.true)) || true;
|
|
117
|
-
const falseVal = (config && (config === null || config === void 0 ? void 0 : config.false)) || false;
|
|
118
|
-
this.cell.newValue = event.target.checked ? trueVal : falseVal;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
CheckboxEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CheckboxEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
122
|
-
CheckboxEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CheckboxEditorComponent, selector: "checkbox-editor", usesInheritance: true, ngImport: i0, template: `
|
|
123
|
-
<input [ngClass]="inputClass"
|
|
124
|
-
type="checkbox"
|
|
125
|
-
class="form-control"
|
|
126
|
-
[name]="cell.getId()"
|
|
127
|
-
[disabled]="!cell.isEditable()"
|
|
128
|
-
[checked]="cell.getValue() === (cell.getColumn().getConfig()?.true || true)"
|
|
129
|
-
(click)="onClick.emit($event)"
|
|
130
|
-
(change)="onChange($event)">
|
|
131
|
-
`, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
132
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CheckboxEditorComponent, decorators: [{
|
|
133
|
-
type: Component,
|
|
134
|
-
args: [{ selector: 'checkbox-editor', template: `
|
|
135
|
-
<input [ngClass]="inputClass"
|
|
136
|
-
type="checkbox"
|
|
137
|
-
class="form-control"
|
|
138
|
-
[name]="cell.getId()"
|
|
139
|
-
[disabled]="!cell.isEditable()"
|
|
140
|
-
[checked]="cell.getValue() === (cell.getColumn().getConfig()?.true || true)"
|
|
141
|
-
(click)="onClick.emit($event)"
|
|
142
|
-
(change)="onChange($event)">
|
|
143
|
-
`, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
|
|
144
|
-
}], ctorParameters: function () { return []; } });
|
|
145
|
-
|
|
146
|
-
class InputEditorComponent extends DefaultEditor {
|
|
147
|
-
constructor() {
|
|
148
|
-
super();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
InputEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: InputEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
152
|
-
InputEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: InputEditorComponent, selector: "input-editor", usesInheritance: true, ngImport: i0, template: `
|
|
153
|
-
<input [ngClass]="inputClass"
|
|
154
|
-
class="form-control"
|
|
155
|
-
[(ngModel)]="cell.newValue"
|
|
156
|
-
[name]="cell.getId()"
|
|
157
|
-
[placeholder]="cell.getTitle()"
|
|
158
|
-
[disabled]="!cell.isEditable()"
|
|
159
|
-
(click)="onClick.emit($event)"
|
|
160
|
-
(keydown.enter)="onEdited.emit($event)"
|
|
161
|
-
(keydown.esc)="onStopEditing.emit()">
|
|
162
|
-
`, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
163
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: InputEditorComponent, decorators: [{
|
|
164
|
-
type: Component,
|
|
165
|
-
args: [{ selector: 'input-editor', template: `
|
|
166
|
-
<input [ngClass]="inputClass"
|
|
167
|
-
class="form-control"
|
|
168
|
-
[(ngModel)]="cell.newValue"
|
|
169
|
-
[name]="cell.getId()"
|
|
170
|
-
[placeholder]="cell.getTitle()"
|
|
171
|
-
[disabled]="!cell.isEditable()"
|
|
172
|
-
(click)="onClick.emit($event)"
|
|
173
|
-
(keydown.enter)="onEdited.emit($event)"
|
|
174
|
-
(keydown.esc)="onStopEditing.emit()">
|
|
175
|
-
`, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
|
|
176
|
-
}], ctorParameters: function () { return []; } });
|
|
177
|
-
|
|
178
|
-
class SelectEditorComponent extends DefaultEditor {
|
|
179
|
-
constructor() {
|
|
180
|
-
super();
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
SelectEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
184
|
-
SelectEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SelectEditorComponent, selector: "select-editor", usesInheritance: true, ngImport: i0, template: `
|
|
185
|
-
<select [ngClass]="inputClass"
|
|
186
|
-
class="form-control"
|
|
187
|
-
[(ngModel)]="cell.newValue"
|
|
188
|
-
[name]="cell.getId()"
|
|
189
|
-
[disabled]="!cell.isEditable()"
|
|
190
|
-
(click)="onClick.emit($event)"
|
|
191
|
-
(keydown.enter)="onEdited.emit($event)"
|
|
192
|
-
(keydown.esc)="onStopEditing.emit()">
|
|
193
|
-
|
|
194
|
-
<option *ngFor="let option of cell.getColumn().getConfig()?.list" [value]="option.value"
|
|
195
|
-
[selected]="option.value === cell.getValue()">{{ option.title }}
|
|
196
|
-
</option>
|
|
197
|
-
</select>
|
|
198
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
199
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectEditorComponent, decorators: [{
|
|
200
|
-
type: Component,
|
|
201
|
-
args: [{
|
|
202
|
-
selector: 'select-editor',
|
|
203
|
-
template: `
|
|
204
|
-
<select [ngClass]="inputClass"
|
|
205
|
-
class="form-control"
|
|
206
|
-
[(ngModel)]="cell.newValue"
|
|
207
|
-
[name]="cell.getId()"
|
|
208
|
-
[disabled]="!cell.isEditable()"
|
|
209
|
-
(click)="onClick.emit($event)"
|
|
210
|
-
(keydown.enter)="onEdited.emit($event)"
|
|
211
|
-
(keydown.esc)="onStopEditing.emit()">
|
|
212
|
-
|
|
213
|
-
<option *ngFor="let option of cell.getColumn().getConfig()?.list" [value]="option.value"
|
|
214
|
-
[selected]="option.value === cell.getValue()">{{ option.title }}
|
|
215
|
-
</option>
|
|
216
|
-
</select>
|
|
217
|
-
`,
|
|
218
|
-
}]
|
|
219
|
-
}], ctorParameters: function () { return []; } });
|
|
220
|
-
|
|
221
|
-
class TextareaEditorComponent extends DefaultEditor {
|
|
222
|
-
constructor() {
|
|
223
|
-
super();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
TextareaEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TextareaEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
227
|
-
TextareaEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TextareaEditorComponent, selector: "textarea-editor", usesInheritance: true, ngImport: i0, template: `
|
|
228
|
-
<textarea [ngClass]="inputClass"
|
|
229
|
-
class="form-control"
|
|
230
|
-
[(ngModel)]="cell.newValue"
|
|
231
|
-
[name]="cell.getId()"
|
|
232
|
-
[disabled]="!cell.isEditable()"
|
|
233
|
-
[placeholder]="cell.getTitle()"
|
|
234
|
-
(click)="onClick.emit($event)"
|
|
235
|
-
(keydown.enter)="onEdited.emit($event)"
|
|
236
|
-
(keydown.esc)="onStopEditing.emit()">
|
|
237
|
-
</textarea>
|
|
238
|
-
`, isInline: true, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
239
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TextareaEditorComponent, decorators: [{
|
|
240
|
-
type: Component,
|
|
241
|
-
args: [{ selector: 'textarea-editor', template: `
|
|
242
|
-
<textarea [ngClass]="inputClass"
|
|
243
|
-
class="form-control"
|
|
244
|
-
[(ngModel)]="cell.newValue"
|
|
245
|
-
[name]="cell.getId()"
|
|
246
|
-
[disabled]="!cell.isEditable()"
|
|
247
|
-
[placeholder]="cell.getTitle()"
|
|
248
|
-
(click)="onClick.emit($event)"
|
|
249
|
-
(keydown.enter)="onEdited.emit($event)"
|
|
250
|
-
(keydown.esc)="onStopEditing.emit()">
|
|
251
|
-
</textarea>
|
|
252
|
-
`, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
|
|
253
|
-
}], ctorParameters: function () { return []; } });
|
|
254
|
-
|
|
255
|
-
class DefaultEditComponent extends EditCellDefault {
|
|
256
|
-
constructor() {
|
|
257
|
-
super();
|
|
258
|
-
}
|
|
259
|
-
getEditorType() {
|
|
260
|
-
const editor = this.cell.getColumn().editor;
|
|
261
|
-
if (editor) {
|
|
262
|
-
return editor.type;
|
|
263
|
-
}
|
|
264
|
-
return 'text';
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
DefaultEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DefaultEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
268
|
-
DefaultEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: DefaultEditComponent, selector: "table-cell-default-editor", usesInheritance: true, ngImport: i0, template: "<div [ngSwitch]=\"getEditorType()\">\n <select-editor *ngSwitchCase=\"'list'\"\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </select-editor>\n\n <textarea-editor *ngSwitchCase=\"'textarea'\"\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </textarea-editor>\n\n <checkbox-editor *ngSwitchCase=\"'checkbox'\"\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\">\n </checkbox-editor>\n\n <input-editor *ngSwitchDefault\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </input-editor>\n</div>", dependencies: [{ kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: CheckboxEditorComponent, selector: "checkbox-editor" }, { kind: "component", type: InputEditorComponent, selector: "input-editor" }, { kind: "component", type: SelectEditorComponent, selector: "select-editor" }, { kind: "component", type: TextareaEditorComponent, selector: "textarea-editor" }] });
|
|
269
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DefaultEditComponent, decorators: [{
|
|
270
|
-
type: Component,
|
|
271
|
-
args: [{ selector: 'table-cell-default-editor', template: "<div [ngSwitch]=\"getEditorType()\">\n <select-editor *ngSwitchCase=\"'list'\"\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </select-editor>\n\n <textarea-editor *ngSwitchCase=\"'textarea'\"\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </textarea-editor>\n\n <checkbox-editor *ngSwitchCase=\"'checkbox'\"\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\">\n </checkbox-editor>\n\n <input-editor *ngSwitchDefault\n [cell]=\"cell\"\n [inputClass]=\"inputClass\"\n (onClick)=\"onClick($event)\"\n (onEdited)=\"onEdited($event)\"\n (onStopEditing)=\"onStopEditing()\">\n </input-editor>\n</div>" }]
|
|
272
|
-
}], ctorParameters: function () { return []; } });
|
|
273
|
-
|
|
274
|
-
class EditCellComponent {
|
|
275
|
-
constructor() {
|
|
276
|
-
this.inputClass = '';
|
|
277
|
-
this.edited = new EventEmitter();
|
|
278
|
-
}
|
|
279
|
-
onEdited(event) {
|
|
280
|
-
this.edited.next(event);
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
getEditorType() {
|
|
284
|
-
const editor = this.cell.getColumn().editor;
|
|
285
|
-
if (editor) {
|
|
286
|
-
return editor.type;
|
|
287
|
-
}
|
|
288
|
-
return 'text';
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
EditCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EditCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
292
|
-
EditCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EditCellComponent, selector: "table-cell-edit-mode", inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, ngImport: i0, template: `
|
|
293
|
-
<div [ngSwitch]="getEditorType()">
|
|
294
|
-
<table-cell-custom-editor *ngSwitchCase="'custom'"
|
|
295
|
-
[cell]="cell"
|
|
296
|
-
[inputClass]="inputClass"
|
|
297
|
-
(edited)="onEdited($event)">
|
|
298
|
-
</table-cell-custom-editor>
|
|
299
|
-
<table-cell-default-editor *ngSwitchDefault
|
|
300
|
-
[cell]="cell"
|
|
301
|
-
[inputClass]="inputClass"
|
|
302
|
-
(edited)="onEdited($event)">
|
|
303
|
-
</table-cell-default-editor>
|
|
304
|
-
</div>
|
|
305
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: CustomEditComponent, selector: "table-cell-custom-editor" }, { kind: "component", type: DefaultEditComponent, selector: "table-cell-default-editor" }] });
|
|
306
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EditCellComponent, decorators: [{
|
|
307
|
-
type: Component,
|
|
308
|
-
args: [{
|
|
309
|
-
selector: 'table-cell-edit-mode',
|
|
310
|
-
template: `
|
|
311
|
-
<div [ngSwitch]="getEditorType()">
|
|
312
|
-
<table-cell-custom-editor *ngSwitchCase="'custom'"
|
|
313
|
-
[cell]="cell"
|
|
314
|
-
[inputClass]="inputClass"
|
|
315
|
-
(edited)="onEdited($event)">
|
|
316
|
-
</table-cell-custom-editor>
|
|
317
|
-
<table-cell-default-editor *ngSwitchDefault
|
|
318
|
-
[cell]="cell"
|
|
319
|
-
[inputClass]="inputClass"
|
|
320
|
-
(edited)="onEdited($event)">
|
|
321
|
-
</table-cell-default-editor>
|
|
322
|
-
</div>
|
|
323
|
-
`,
|
|
324
|
-
}]
|
|
325
|
-
}], propDecorators: { cell: [{
|
|
326
|
-
type: Input
|
|
327
|
-
}], inputClass: [{
|
|
328
|
-
type: Input
|
|
329
|
-
}], edited: [{
|
|
330
|
-
type: Output
|
|
331
|
-
}] } });
|
|
332
|
-
|
|
333
|
-
class CustomViewComponent {
|
|
334
|
-
constructor(resolver) {
|
|
335
|
-
this.resolver = resolver;
|
|
336
|
-
}
|
|
337
|
-
ngOnInit() {
|
|
338
|
-
if (this.cell && !this.customComponent) {
|
|
339
|
-
this.createCustomComponent();
|
|
340
|
-
this.patchInstance();
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
ngOnDestroy() {
|
|
344
|
-
if (this.customComponent) {
|
|
345
|
-
this.customComponent.destroy();
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
createCustomComponent() {
|
|
349
|
-
const componentFactory = this.resolver.resolveComponentFactory(this.cell.getColumn().renderComponent);
|
|
350
|
-
this.customComponent = this.dynamicTarget.createComponent(componentFactory);
|
|
351
|
-
}
|
|
352
|
-
patchInstance() {
|
|
353
|
-
Object.assign(this.customComponent.instance, this.getPatch());
|
|
354
|
-
}
|
|
355
|
-
getPatch() {
|
|
356
|
-
return {
|
|
357
|
-
value: this.cell.getValue(),
|
|
358
|
-
rowData: this.cell.getRow().getData()
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
CustomViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CustomViewComponent, deps: [{ token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
|
|
363
|
-
CustomViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CustomViewComponent, selector: "custom-view-component", inputs: { cell: "cell" }, viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
|
|
364
|
-
<ng-template #dynamicTarget></ng-template>
|
|
365
|
-
`, isInline: true });
|
|
366
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CustomViewComponent, decorators: [{
|
|
367
|
-
type: Component,
|
|
368
|
-
args: [{
|
|
369
|
-
selector: 'custom-view-component',
|
|
370
|
-
template: `
|
|
371
|
-
<ng-template #dynamicTarget></ng-template>
|
|
372
|
-
`,
|
|
373
|
-
}]
|
|
374
|
-
}], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }]; }, propDecorators: { cell: [{
|
|
375
|
-
type: Input
|
|
376
|
-
}], dynamicTarget: [{
|
|
377
|
-
type: ViewChild,
|
|
378
|
-
args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
|
|
379
|
-
}] } });
|
|
380
|
-
|
|
381
|
-
class ViewCellComponent {
|
|
382
|
-
}
|
|
383
|
-
ViewCellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ViewCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
384
|
-
ViewCellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ViewCellComponent, selector: "table-cell-view-mode", inputs: { cell: "cell" }, ngImport: i0, template: `
|
|
385
|
-
<div [ngSwitch]="cell.getColumn().type">
|
|
386
|
-
<custom-view-component *ngSwitchCase="'custom'" [cell]="cell"></custom-view-component>
|
|
387
|
-
<div *ngSwitchCase="'html'" [innerHTML]="cell.getValue()"></div>
|
|
388
|
-
<div *ngSwitchDefault>{{ cell.getValue() }}</div>
|
|
389
|
-
</div>
|
|
390
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: CustomViewComponent, selector: "custom-view-component", inputs: ["cell"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
391
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ViewCellComponent, decorators: [{
|
|
392
|
-
type: Component,
|
|
393
|
-
args: [{
|
|
394
|
-
selector: 'table-cell-view-mode',
|
|
395
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
396
|
-
template: `
|
|
397
|
-
<div [ngSwitch]="cell.getColumn().type">
|
|
398
|
-
<custom-view-component *ngSwitchCase="'custom'" [cell]="cell"></custom-view-component>
|
|
399
|
-
<div *ngSwitchCase="'html'" [innerHTML]="cell.getValue()"></div>
|
|
400
|
-
<div *ngSwitchDefault>{{ cell.getValue() }}</div>
|
|
401
|
-
</div>
|
|
402
|
-
`,
|
|
403
|
-
}]
|
|
404
|
-
}], propDecorators: { cell: [{
|
|
405
|
-
type: Input
|
|
406
|
-
}] } });
|
|
407
|
-
|
|
408
|
-
class CellComponent {
|
|
409
|
-
constructor() {
|
|
410
|
-
this.inputClass = '';
|
|
411
|
-
this.mode = 'inline';
|
|
412
|
-
this.isInEditing = false;
|
|
413
|
-
this.edited = new EventEmitter();
|
|
414
|
-
}
|
|
415
|
-
onEdited(event) {
|
|
416
|
-
if (this.isNew) {
|
|
417
|
-
this.grid.create(this.grid.getNewRow(), this.createConfirm);
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
this.grid.save(this.row, this.editConfirm);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
CellComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
425
|
-
CellComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CellComponent, selector: "ng2-smart-table-cell", inputs: { grid: "grid", row: "row", editConfirm: "editConfirm", createConfirm: "createConfirm", isNew: "isNew", cell: "cell", inputClass: "inputClass", mode: "mode", isInEditing: "isInEditing" }, outputs: { edited: "edited" }, ngImport: i0, template: `
|
|
426
|
-
<table-cell-view-mode *ngIf="!isInEditing" [cell]="cell"></table-cell-view-mode>
|
|
427
|
-
<table-cell-edit-mode *ngIf="isInEditing" [cell]="cell"
|
|
428
|
-
[inputClass]="inputClass"
|
|
429
|
-
(edited)="onEdited($event)">
|
|
430
|
-
</table-cell-edit-mode>
|
|
431
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: EditCellComponent, selector: "table-cell-edit-mode", inputs: ["cell", "inputClass"], outputs: ["edited"] }, { kind: "component", type: ViewCellComponent, selector: "table-cell-view-mode", inputs: ["cell"] }] });
|
|
432
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CellComponent, decorators: [{
|
|
433
|
-
type: Component,
|
|
434
|
-
args: [{
|
|
435
|
-
selector: 'ng2-smart-table-cell',
|
|
436
|
-
template: `
|
|
437
|
-
<table-cell-view-mode *ngIf="!isInEditing" [cell]="cell"></table-cell-view-mode>
|
|
438
|
-
<table-cell-edit-mode *ngIf="isInEditing" [cell]="cell"
|
|
439
|
-
[inputClass]="inputClass"
|
|
440
|
-
(edited)="onEdited($event)">
|
|
441
|
-
</table-cell-edit-mode>
|
|
442
|
-
`,
|
|
443
|
-
}]
|
|
444
|
-
}], propDecorators: { grid: [{
|
|
445
|
-
type: Input
|
|
446
|
-
}], row: [{
|
|
447
|
-
type: Input
|
|
448
|
-
}], editConfirm: [{
|
|
449
|
-
type: Input
|
|
450
|
-
}], createConfirm: [{
|
|
451
|
-
type: Input
|
|
452
|
-
}], isNew: [{
|
|
453
|
-
type: Input
|
|
454
|
-
}], cell: [{
|
|
455
|
-
type: Input
|
|
456
|
-
}], inputClass: [{
|
|
457
|
-
type: Input
|
|
458
|
-
}], mode: [{
|
|
459
|
-
type: Input
|
|
460
|
-
}], isInEditing: [{
|
|
461
|
-
type: Input
|
|
462
|
-
}], edited: [{
|
|
463
|
-
type: Output
|
|
464
|
-
}] } });
|
|
465
|
-
|
|
466
|
-
const CELL_COMPONENTS = [
|
|
467
|
-
CellComponent,
|
|
468
|
-
EditCellDefault,
|
|
469
|
-
DefaultEditor,
|
|
470
|
-
CustomEditComponent,
|
|
471
|
-
DefaultEditComponent,
|
|
472
|
-
EditCellComponent,
|
|
473
|
-
CheckboxEditorComponent,
|
|
474
|
-
InputEditorComponent,
|
|
475
|
-
SelectEditorComponent,
|
|
476
|
-
TextareaEditorComponent,
|
|
477
|
-
CustomViewComponent,
|
|
478
|
-
ViewCellComponent,
|
|
479
|
-
];
|
|
480
|
-
class CellModule {
|
|
481
|
-
}
|
|
482
|
-
CellModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CellModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
483
|
-
CellModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: CellModule, declarations: [CellComponent,
|
|
484
|
-
EditCellDefault,
|
|
485
|
-
DefaultEditor,
|
|
486
|
-
CustomEditComponent,
|
|
487
|
-
DefaultEditComponent,
|
|
488
|
-
EditCellComponent,
|
|
489
|
-
CheckboxEditorComponent,
|
|
490
|
-
InputEditorComponent,
|
|
491
|
-
SelectEditorComponent,
|
|
492
|
-
TextareaEditorComponent,
|
|
493
|
-
CustomViewComponent,
|
|
494
|
-
ViewCellComponent], imports: [CommonModule,
|
|
495
|
-
FormsModule], exports: [CellComponent,
|
|
496
|
-
EditCellDefault,
|
|
497
|
-
DefaultEditor,
|
|
498
|
-
CustomEditComponent,
|
|
499
|
-
DefaultEditComponent,
|
|
500
|
-
EditCellComponent,
|
|
501
|
-
CheckboxEditorComponent,
|
|
502
|
-
InputEditorComponent,
|
|
503
|
-
SelectEditorComponent,
|
|
504
|
-
TextareaEditorComponent,
|
|
505
|
-
CustomViewComponent,
|
|
506
|
-
ViewCellComponent] });
|
|
507
|
-
CellModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CellModule, imports: [CommonModule,
|
|
508
|
-
FormsModule] });
|
|
509
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CellModule, decorators: [{
|
|
510
|
-
type: NgModule,
|
|
511
|
-
args: [{
|
|
512
|
-
imports: [
|
|
513
|
-
CommonModule,
|
|
514
|
-
FormsModule,
|
|
515
|
-
],
|
|
516
|
-
declarations: [
|
|
517
|
-
...CELL_COMPONENTS,
|
|
518
|
-
],
|
|
519
|
-
exports: [
|
|
520
|
-
...CELL_COMPONENTS,
|
|
521
|
-
],
|
|
522
|
-
}]
|
|
523
|
-
}] });
|
|
524
|
-
|
|
525
|
-
class FilterDefault {
|
|
526
|
-
constructor() {
|
|
527
|
-
this.inputClass = '';
|
|
528
|
-
this.query = '';
|
|
529
|
-
this.filter = new EventEmitter();
|
|
530
|
-
}
|
|
531
|
-
onFilter(query) {
|
|
532
|
-
this.source.addFilter({
|
|
533
|
-
field: this.column.id,
|
|
534
|
-
search: query,
|
|
535
|
-
filter: this.column.getFilterFunction(),
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
FilterDefault.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FilterDefault, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
540
|
-
FilterDefault.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FilterDefault, selector: "ng-component", inputs: { column: "column", source: "source", inputClass: "inputClass", query: "query" }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true });
|
|
541
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FilterDefault, decorators: [{
|
|
542
|
-
type: Component,
|
|
543
|
-
args: [{
|
|
544
|
-
template: '',
|
|
545
|
-
}]
|
|
546
|
-
}], propDecorators: { column: [{
|
|
547
|
-
type: Input
|
|
548
|
-
}], source: [{
|
|
549
|
-
type: Input
|
|
550
|
-
}], inputClass: [{
|
|
551
|
-
type: Input
|
|
552
|
-
}], query: [{
|
|
553
|
-
type: Input
|
|
554
|
-
}], filter: [{
|
|
555
|
-
type: Output
|
|
556
|
-
}] } });
|
|
557
|
-
|
|
558
|
-
class DefaultFilter {
|
|
559
|
-
constructor() {
|
|
560
|
-
this.delay = 300;
|
|
561
|
-
this.query = '';
|
|
562
|
-
this.inputClass = '';
|
|
563
|
-
this.filter = new EventEmitter();
|
|
564
|
-
}
|
|
565
|
-
ngOnDestroy() {
|
|
566
|
-
if (this.changesSubscription) {
|
|
567
|
-
this.changesSubscription.unsubscribe();
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
setFilter() {
|
|
571
|
-
this.filter.emit(this.query);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
DefaultFilter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DefaultFilter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
575
|
-
DefaultFilter.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: DefaultFilter, selector: "ng-component", inputs: { query: "query", inputClass: "inputClass", column: "column" }, outputs: { filter: "filter" }, ngImport: i0, template: '', isInline: true });
|
|
576
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DefaultFilter, decorators: [{
|
|
577
|
-
type: Component,
|
|
578
|
-
args: [{
|
|
579
|
-
template: '',
|
|
580
|
-
}]
|
|
581
|
-
}], propDecorators: { query: [{
|
|
582
|
-
type: Input
|
|
583
|
-
}], inputClass: [{
|
|
584
|
-
type: Input
|
|
585
|
-
}], column: [{
|
|
586
|
-
type: Input
|
|
587
|
-
}], filter: [{
|
|
588
|
-
type: Output
|
|
589
|
-
}] } });
|
|
590
|
-
|
|
591
|
-
class CheckboxFilterComponent extends DefaultFilter {
|
|
592
|
-
constructor() {
|
|
593
|
-
super();
|
|
594
|
-
this.filterActive = false;
|
|
595
|
-
this.inputControl = new UntypedFormControl();
|
|
596
|
-
}
|
|
597
|
-
ngOnInit() {
|
|
598
|
-
this.changesSubscription = this.inputControl.valueChanges
|
|
599
|
-
.pipe(debounceTime(this.delay))
|
|
600
|
-
.subscribe((checked) => {
|
|
601
|
-
this.filterActive = true;
|
|
602
|
-
const trueVal = (this.column.getFilterConfig() && this.column.getFilterConfig().true) || true;
|
|
603
|
-
const falseVal = (this.column.getFilterConfig() && this.column.getFilterConfig().false) || false;
|
|
604
|
-
this.query = checked ? trueVal : falseVal;
|
|
605
|
-
this.setFilter();
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
resetFilter(event) {
|
|
609
|
-
event.preventDefault();
|
|
610
|
-
this.query = '';
|
|
611
|
-
this.inputControl.setValue(false, { emitEvent: false });
|
|
612
|
-
this.filterActive = false;
|
|
613
|
-
this.setFilter();
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
CheckboxFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CheckboxFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
617
|
-
CheckboxFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CheckboxFilterComponent, selector: "checkbox-filter", usesInheritance: true, ngImport: i0, template: `
|
|
618
|
-
<input type="checkbox" [formControl]="inputControl" [ngClass]="inputClass" class="form-control">
|
|
619
|
-
<a href="#" *ngIf="filterActive"
|
|
620
|
-
(click)="resetFilter($event)">{{column.getFilterConfig()?.resetText || 'reset'}}</a>
|
|
621
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
622
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CheckboxFilterComponent, decorators: [{
|
|
623
|
-
type: Component,
|
|
624
|
-
args: [{
|
|
625
|
-
selector: 'checkbox-filter',
|
|
626
|
-
template: `
|
|
627
|
-
<input type="checkbox" [formControl]="inputControl" [ngClass]="inputClass" class="form-control">
|
|
628
|
-
<a href="#" *ngIf="filterActive"
|
|
629
|
-
(click)="resetFilter($event)">{{column.getFilterConfig()?.resetText || 'reset'}}</a>
|
|
630
|
-
`,
|
|
631
|
-
}]
|
|
632
|
-
}], ctorParameters: function () { return []; } });
|
|
633
|
-
|
|
634
|
-
class InputFilterComponent extends DefaultFilter {
|
|
635
|
-
constructor() {
|
|
636
|
-
super();
|
|
637
|
-
this.inputControl = new UntypedFormControl();
|
|
638
|
-
}
|
|
639
|
-
ngOnInit() {
|
|
640
|
-
if (this.query) {
|
|
641
|
-
this.inputControl.setValue(this.query);
|
|
642
|
-
}
|
|
643
|
-
this.inputControl.valueChanges
|
|
644
|
-
.pipe(distinctUntilChanged(), debounceTime(this.delay))
|
|
645
|
-
.subscribe((value) => {
|
|
646
|
-
this.query = this.inputControl.value;
|
|
647
|
-
this.setFilter();
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
ngOnChanges(changes) {
|
|
651
|
-
if (changes === null || changes === void 0 ? void 0 : changes['query']) {
|
|
652
|
-
this.inputControl.setValue(this.query);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
InputFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: InputFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
657
|
-
InputFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: InputFilterComponent, selector: "input-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
|
|
658
|
-
<input
|
|
659
|
-
[ngClass]="inputClass"
|
|
660
|
-
[formControl]="inputControl"
|
|
661
|
-
class="form-control"
|
|
662
|
-
type="text"
|
|
663
|
-
placeholder="{{ column.title }}"/>
|
|
664
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
665
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: InputFilterComponent, decorators: [{
|
|
666
|
-
type: Component,
|
|
667
|
-
args: [{
|
|
668
|
-
selector: 'input-filter',
|
|
669
|
-
template: `
|
|
670
|
-
<input
|
|
671
|
-
[ngClass]="inputClass"
|
|
672
|
-
[formControl]="inputControl"
|
|
673
|
-
class="form-control"
|
|
674
|
-
type="text"
|
|
675
|
-
placeholder="{{ column.title }}"/>
|
|
676
|
-
`,
|
|
677
|
-
}]
|
|
678
|
-
}], ctorParameters: function () { return []; } });
|
|
679
|
-
|
|
680
|
-
class SelectFilterComponent extends DefaultFilter {
|
|
681
|
-
constructor() {
|
|
682
|
-
super();
|
|
683
|
-
}
|
|
684
|
-
ngOnInit() {
|
|
685
|
-
if (this.inputControl.valueChanges) {
|
|
686
|
-
this.inputControl.valueChanges
|
|
687
|
-
.pipe(skip(1), distinctUntilChanged(), debounceTime(this.delay))
|
|
688
|
-
.subscribe((value) => this.setFilter());
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
SelectFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
693
|
-
SelectFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: SelectFilterComponent, selector: "select-filter", viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true, read: NgControl, static: true }], usesInheritance: true, ngImport: i0, template: `
|
|
694
|
-
<select [ngClass]="inputClass"
|
|
695
|
-
class="form-control"
|
|
696
|
-
#inputControl
|
|
697
|
-
[(ngModel)]="query">
|
|
698
|
-
|
|
699
|
-
<option value="">{{ column.getFilterConfig().selectText }}</option>
|
|
700
|
-
<option *ngFor="let option of column.getFilterConfig().list" [value]="option.value">
|
|
701
|
-
{{ option.title }}
|
|
702
|
-
</option>
|
|
703
|
-
</select>
|
|
704
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
705
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SelectFilterComponent, decorators: [{
|
|
706
|
-
type: Component,
|
|
707
|
-
args: [{
|
|
708
|
-
selector: 'select-filter',
|
|
709
|
-
template: `
|
|
710
|
-
<select [ngClass]="inputClass"
|
|
711
|
-
class="form-control"
|
|
712
|
-
#inputControl
|
|
713
|
-
[(ngModel)]="query">
|
|
714
|
-
|
|
715
|
-
<option value="">{{ column.getFilterConfig().selectText }}</option>
|
|
716
|
-
<option *ngFor="let option of column.getFilterConfig().list" [value]="option.value">
|
|
717
|
-
{{ option.title }}
|
|
718
|
-
</option>
|
|
719
|
-
</select>
|
|
720
|
-
`,
|
|
721
|
-
}]
|
|
722
|
-
}], ctorParameters: function () { return []; }, propDecorators: { inputControl: [{
|
|
723
|
-
type: ViewChild,
|
|
724
|
-
args: ['inputControl', { read: NgControl, static: true }]
|
|
725
|
-
}] } });
|
|
726
|
-
|
|
727
|
-
class DefaultFilterComponent extends FilterDefault {
|
|
728
|
-
}
|
|
729
|
-
DefaultFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DefaultFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
730
|
-
DefaultFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: DefaultFilterComponent, selector: "default-table-filter", usesInheritance: true, ngImport: i0, template: `
|
|
731
|
-
<ng-container [ngSwitch]="column.getFilterType()">
|
|
732
|
-
<select-filter *ngSwitchCase="'list'"
|
|
733
|
-
[query]="query"
|
|
734
|
-
[ngClass]="inputClass"
|
|
735
|
-
[column]="column"
|
|
736
|
-
(filter)="onFilter($event)">
|
|
737
|
-
</select-filter>
|
|
738
|
-
<checkbox-filter *ngSwitchCase="'checkbox'"
|
|
739
|
-
[query]="query"
|
|
740
|
-
[ngClass]="inputClass"
|
|
741
|
-
[column]="column"
|
|
742
|
-
(filter)="onFilter($event)">
|
|
743
|
-
</checkbox-filter>
|
|
744
|
-
<input-filter *ngSwitchDefault
|
|
745
|
-
[query]="query"
|
|
746
|
-
[ngClass]="inputClass"
|
|
747
|
-
[column]="column"
|
|
748
|
-
(filter)="onFilter($event)">
|
|
749
|
-
</input-filter>
|
|
750
|
-
</ng-container>
|
|
751
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: CheckboxFilterComponent, selector: "checkbox-filter" }, { kind: "component", type: InputFilterComponent, selector: "input-filter" }, { kind: "component", type: SelectFilterComponent, selector: "select-filter" }] });
|
|
752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DefaultFilterComponent, decorators: [{
|
|
753
|
-
type: Component,
|
|
754
|
-
args: [{
|
|
755
|
-
selector: 'default-table-filter',
|
|
756
|
-
template: `
|
|
757
|
-
<ng-container [ngSwitch]="column.getFilterType()">
|
|
758
|
-
<select-filter *ngSwitchCase="'list'"
|
|
759
|
-
[query]="query"
|
|
760
|
-
[ngClass]="inputClass"
|
|
761
|
-
[column]="column"
|
|
762
|
-
(filter)="onFilter($event)">
|
|
763
|
-
</select-filter>
|
|
764
|
-
<checkbox-filter *ngSwitchCase="'checkbox'"
|
|
765
|
-
[query]="query"
|
|
766
|
-
[ngClass]="inputClass"
|
|
767
|
-
[column]="column"
|
|
768
|
-
(filter)="onFilter($event)">
|
|
769
|
-
</checkbox-filter>
|
|
770
|
-
<input-filter *ngSwitchDefault
|
|
771
|
-
[query]="query"
|
|
772
|
-
[ngClass]="inputClass"
|
|
773
|
-
[column]="column"
|
|
774
|
-
(filter)="onFilter($event)">
|
|
775
|
-
</input-filter>
|
|
776
|
-
</ng-container>
|
|
777
|
-
`,
|
|
778
|
-
}]
|
|
779
|
-
}] });
|
|
780
|
-
|
|
781
|
-
class CustomFilterComponent extends FilterDefault {
|
|
782
|
-
constructor(resolver) {
|
|
783
|
-
super();
|
|
784
|
-
this.resolver = resolver;
|
|
785
|
-
}
|
|
786
|
-
ngOnChanges(changes) {
|
|
787
|
-
var _a;
|
|
788
|
-
if (this.customComponent) {
|
|
789
|
-
this.customComponent.instance.ngOnChanges(changes);
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
if (this.column.filter && this.column.filter.type === 'custom') {
|
|
793
|
-
const componentFactory = this.resolver.resolveComponentFactory((_a = this.column.filter) === null || _a === void 0 ? void 0 : _a.component);
|
|
794
|
-
this.customComponent = this.dynamicTarget.createComponent(componentFactory);
|
|
795
|
-
}
|
|
796
|
-
// set @Inputs and @Outputs of custom component
|
|
797
|
-
this.customComponent.instance.query = this.query;
|
|
798
|
-
this.customComponent.instance.column = this.column;
|
|
799
|
-
this.customComponent.instance.source = this.source;
|
|
800
|
-
this.customComponent.instance.inputClass = this.inputClass;
|
|
801
|
-
this.customComponent.instance.filter.subscribe((event) => this.onFilter(event));
|
|
802
|
-
}
|
|
803
|
-
ngOnDestroy() {
|
|
804
|
-
if (this.customComponent) {
|
|
805
|
-
this.customComponent.destroy();
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
CustomFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CustomFilterComponent, deps: [{ token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
|
|
810
|
-
CustomFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CustomFilterComponent, selector: "custom-table-filter", viewQueries: [{ propertyName: "dynamicTarget", first: true, predicate: ["dynamicTarget"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `<ng-template #dynamicTarget></ng-template>`, isInline: true });
|
|
811
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CustomFilterComponent, decorators: [{
|
|
812
|
-
type: Component,
|
|
813
|
-
args: [{
|
|
814
|
-
selector: 'custom-table-filter',
|
|
815
|
-
template: `<ng-template #dynamicTarget></ng-template>`,
|
|
816
|
-
}]
|
|
817
|
-
}], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }]; }, propDecorators: { dynamicTarget: [{
|
|
818
|
-
type: ViewChild,
|
|
819
|
-
args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
|
|
820
|
-
}] } });
|
|
821
|
-
|
|
822
|
-
class FilterComponent extends FilterDefault {
|
|
823
|
-
ngOnChanges(changes) {
|
|
824
|
-
if (changes['source']) {
|
|
825
|
-
if (!changes['source'].firstChange && this.dataChangedSub) {
|
|
826
|
-
this.dataChangedSub.unsubscribe();
|
|
827
|
-
}
|
|
828
|
-
this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
|
|
829
|
-
const filterConf = this.source.getFilter();
|
|
830
|
-
if (filterConf && filterConf.filters && filterConf.filters.length === 0) {
|
|
831
|
-
this.query = '';
|
|
832
|
-
// add a check for existing filters an set the query if one exists for this column
|
|
833
|
-
// this covers instances where the filter is set by user code while maintaining existing functionality
|
|
834
|
-
}
|
|
835
|
-
else if (filterConf && filterConf.filters && filterConf.filters.length > 0) {
|
|
836
|
-
filterConf.filters.forEach((k, v) => {
|
|
837
|
-
if (k.field == this.column.id) {
|
|
838
|
-
this.query = k.search;
|
|
839
|
-
}
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
847
|
-
FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FilterComponent, selector: "ng2-smart-table-filter", usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
|
|
848
|
-
<div class="ng2-smart-filter" *ngIf="column.isFilterable" [ngSwitch]="column.getFilterType()">
|
|
849
|
-
<custom-table-filter *ngSwitchCase="'custom'"
|
|
850
|
-
[query]="query"
|
|
851
|
-
[column]="column"
|
|
852
|
-
[source]="source"
|
|
853
|
-
[inputClass]="inputClass"
|
|
854
|
-
(filter)="onFilter($event)">
|
|
855
|
-
</custom-table-filter>
|
|
856
|
-
<default-table-filter *ngSwitchDefault
|
|
857
|
-
[query]="query"
|
|
858
|
-
[column]="column"
|
|
859
|
-
[source]="source"
|
|
860
|
-
[inputClass]="inputClass"
|
|
861
|
-
(filter)="onFilter($event)">
|
|
862
|
-
</default-table-filter>
|
|
863
|
-
</div>
|
|
864
|
-
`, isInline: true, styles: [":host .ng2-smart-filter ::ng-deep input,:host .ng2-smart-filter ::ng-deep select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}:host .ng2-smart-filter ::ng-deep input[type=search]{box-sizing:inherit}:host .ng2-smart-filter ::ng-deep .completer-dropdown-holder{font-weight:400}:host .ng2-smart-filter ::ng-deep a{font-weight:400}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: DefaultFilterComponent, selector: "default-table-filter" }, { kind: "component", type: CustomFilterComponent, selector: "custom-table-filter" }] });
|
|
865
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FilterComponent, decorators: [{
|
|
866
|
-
type: Component,
|
|
867
|
-
args: [{ selector: 'ng2-smart-table-filter', template: `
|
|
868
|
-
<div class="ng2-smart-filter" *ngIf="column.isFilterable" [ngSwitch]="column.getFilterType()">
|
|
869
|
-
<custom-table-filter *ngSwitchCase="'custom'"
|
|
870
|
-
[query]="query"
|
|
871
|
-
[column]="column"
|
|
872
|
-
[source]="source"
|
|
873
|
-
[inputClass]="inputClass"
|
|
874
|
-
(filter)="onFilter($event)">
|
|
875
|
-
</custom-table-filter>
|
|
876
|
-
<default-table-filter *ngSwitchDefault
|
|
877
|
-
[query]="query"
|
|
878
|
-
[column]="column"
|
|
879
|
-
[source]="source"
|
|
880
|
-
[inputClass]="inputClass"
|
|
881
|
-
(filter)="onFilter($event)">
|
|
882
|
-
</default-table-filter>
|
|
883
|
-
</div>
|
|
884
|
-
`, styles: [":host .ng2-smart-filter ::ng-deep input,:host .ng2-smart-filter ::ng-deep select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}:host .ng2-smart-filter ::ng-deep input[type=search]{box-sizing:inherit}:host .ng2-smart-filter ::ng-deep .completer-dropdown-holder{font-weight:400}:host .ng2-smart-filter ::ng-deep a{font-weight:400}\n"] }]
|
|
885
|
-
}] });
|
|
886
|
-
|
|
887
|
-
const FILTER_COMPONENTS = [
|
|
888
|
-
FilterDefault,
|
|
889
|
-
DefaultFilter,
|
|
890
|
-
FilterComponent,
|
|
891
|
-
DefaultFilterComponent,
|
|
892
|
-
CustomFilterComponent,
|
|
893
|
-
CheckboxFilterComponent,
|
|
894
|
-
InputFilterComponent,
|
|
895
|
-
SelectFilterComponent,
|
|
896
|
-
];
|
|
897
|
-
class FilterModule {
|
|
898
|
-
}
|
|
899
|
-
FilterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FilterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
900
|
-
FilterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FilterModule, declarations: [FilterDefault,
|
|
901
|
-
DefaultFilter,
|
|
902
|
-
FilterComponent,
|
|
903
|
-
DefaultFilterComponent,
|
|
904
|
-
CustomFilterComponent,
|
|
905
|
-
CheckboxFilterComponent,
|
|
906
|
-
InputFilterComponent,
|
|
907
|
-
SelectFilterComponent], imports: [CommonModule,
|
|
908
|
-
FormsModule,
|
|
909
|
-
ReactiveFormsModule], exports: [FilterDefault,
|
|
910
|
-
DefaultFilter,
|
|
911
|
-
FilterComponent,
|
|
912
|
-
DefaultFilterComponent,
|
|
913
|
-
CustomFilterComponent,
|
|
914
|
-
CheckboxFilterComponent,
|
|
915
|
-
InputFilterComponent,
|
|
916
|
-
SelectFilterComponent] });
|
|
917
|
-
FilterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FilterModule, imports: [CommonModule,
|
|
918
|
-
FormsModule,
|
|
919
|
-
ReactiveFormsModule] });
|
|
920
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FilterModule, decorators: [{
|
|
921
|
-
type: NgModule,
|
|
922
|
-
args: [{
|
|
923
|
-
imports: [
|
|
924
|
-
CommonModule,
|
|
925
|
-
FormsModule,
|
|
926
|
-
ReactiveFormsModule,
|
|
927
|
-
],
|
|
928
|
-
declarations: [
|
|
929
|
-
...FILTER_COMPONENTS,
|
|
930
|
-
],
|
|
931
|
-
exports: [
|
|
932
|
-
...FILTER_COMPONENTS,
|
|
933
|
-
],
|
|
934
|
-
}]
|
|
935
|
-
}] });
|
|
936
|
-
|
|
937
|
-
class PagerComponent {
|
|
938
|
-
constructor() {
|
|
939
|
-
this.perPageSelect = [];
|
|
940
|
-
this.changePage = new EventEmitter();
|
|
941
|
-
this.currentPerPage = 0;
|
|
942
|
-
this.pages = [];
|
|
943
|
-
this.page = 1;
|
|
944
|
-
this.count = 0;
|
|
945
|
-
this.perPage = 0;
|
|
946
|
-
}
|
|
947
|
-
ngOnChanges(changes) {
|
|
948
|
-
if (changes['source']) {
|
|
949
|
-
if (!changes['source'].firstChange && this.dataChangedSub) {
|
|
950
|
-
this.dataChangedSub.unsubscribe();
|
|
951
|
-
}
|
|
952
|
-
this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
|
|
953
|
-
const paging = this.source.getPaging();
|
|
954
|
-
if (paging) {
|
|
955
|
-
this.page = paging.page;
|
|
956
|
-
this.perPage = paging.perPage;
|
|
957
|
-
}
|
|
958
|
-
this.currentPerPage = this.perPage;
|
|
959
|
-
this.count = this.source.count();
|
|
960
|
-
if (this.isPageOutOfBounce()) {
|
|
961
|
-
this.source.setPage(--this.page);
|
|
962
|
-
}
|
|
963
|
-
this.processPageChange(dataChanges);
|
|
964
|
-
this.initPages();
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
/**
|
|
969
|
-
* We change the page here depending on the action performed against data source
|
|
970
|
-
* if a new element was added to the end of the table - then change the page to the last
|
|
971
|
-
* if a new element was added to the beginning of the table - then to the first page
|
|
972
|
-
* @param changes
|
|
973
|
-
*/
|
|
974
|
-
processPageChange(changes) {
|
|
975
|
-
if (changes['action'] === 'prepend') {
|
|
976
|
-
this.source.setPage(1);
|
|
977
|
-
}
|
|
978
|
-
if (changes['action'] === 'append') {
|
|
979
|
-
this.source.setPage(this.getLast());
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
shouldShow() {
|
|
983
|
-
return this.source.count() > this.perPage;
|
|
984
|
-
}
|
|
985
|
-
paginate(page) {
|
|
986
|
-
this.source.setPage(page);
|
|
987
|
-
this.page = page;
|
|
988
|
-
this.changePage.emit({ page });
|
|
989
|
-
return false;
|
|
990
|
-
}
|
|
991
|
-
next() {
|
|
992
|
-
return this.paginate(this.getPage() + 1);
|
|
993
|
-
}
|
|
994
|
-
prev() {
|
|
995
|
-
return this.paginate(this.getPage() - 1);
|
|
996
|
-
}
|
|
997
|
-
getPage() {
|
|
998
|
-
return this.page;
|
|
999
|
-
}
|
|
1000
|
-
getPages() {
|
|
1001
|
-
return this.pages;
|
|
1002
|
-
}
|
|
1003
|
-
getLast() {
|
|
1004
|
-
return Math.ceil(this.count / this.perPage);
|
|
1005
|
-
}
|
|
1006
|
-
isPageOutOfBounce() {
|
|
1007
|
-
return (this.page * this.perPage) >= (this.count + this.perPage) && this.page > 1;
|
|
1008
|
-
}
|
|
1009
|
-
initPages() {
|
|
1010
|
-
const pagesCount = this.getLast();
|
|
1011
|
-
let showPagesCount = 4;
|
|
1012
|
-
showPagesCount = pagesCount < showPagesCount ? pagesCount : showPagesCount;
|
|
1013
|
-
this.pages = [];
|
|
1014
|
-
if (this.shouldShow()) {
|
|
1015
|
-
let middleOne = Math.ceil(showPagesCount / 2);
|
|
1016
|
-
middleOne = this.page >= middleOne ? this.page : middleOne;
|
|
1017
|
-
let lastOne = middleOne + Math.floor(showPagesCount / 2);
|
|
1018
|
-
lastOne = lastOne >= pagesCount ? pagesCount : lastOne;
|
|
1019
|
-
const firstOne = lastOne - showPagesCount + 1;
|
|
1020
|
-
for (let i = firstOne; i <= lastOne; i++) {
|
|
1021
|
-
this.pages.push(i);
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
onChangePerPage() {
|
|
1026
|
-
const paging = this.source.getPaging();
|
|
1027
|
-
if (paging) {
|
|
1028
|
-
paging.perPage = this.currentPerPage * 1;
|
|
1029
|
-
}
|
|
1030
|
-
this.source.refresh();
|
|
1031
|
-
this.initPages();
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
PagerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1035
|
-
PagerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: PagerComponent, selector: "ng2-smart-table-pager", inputs: { source: "source", perPageSelect: "perPageSelect" }, outputs: { changePage: "changePage" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1036
|
-
<nav *ngIf="shouldShow()" class="ng2-smart-pagination-nav">
|
|
1037
|
-
<ul class="ng2-smart-pagination pagination">
|
|
1038
|
-
<li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
|
|
1039
|
-
<a class="ng2-smart-page-link page-link" href="#"
|
|
1040
|
-
(click)="getPage() == 1 ? false : paginate(1)" aria-label="First">
|
|
1041
|
-
<span aria-hidden="true">«</span>
|
|
1042
|
-
<span class="sr-only">First</span>
|
|
1043
|
-
</a>
|
|
1044
|
-
</li>
|
|
1045
|
-
<li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
|
|
1046
|
-
<a class="ng2-smart-page-link page-link page-link-prev" href="#"
|
|
1047
|
-
(click)="getPage() == 1 ? false : prev()" aria-label="Prev">
|
|
1048
|
-
<span aria-hidden="true"><</span>
|
|
1049
|
-
<span class="sr-only">Prev</span>
|
|
1050
|
-
</a>
|
|
1051
|
-
</li>
|
|
1052
|
-
<li class="ng2-smart-page-item page-item"
|
|
1053
|
-
[ngClass]="{active: getPage() == page}" *ngFor="let page of getPages()">
|
|
1054
|
-
<span class="ng2-smart-page-link page-link"
|
|
1055
|
-
*ngIf="getPage() == page">{{ page }} <span class="sr-only">(current)</span></span>
|
|
1056
|
-
<a class="ng2-smart-page-link page-link" href="#"
|
|
1057
|
-
(click)="paginate(page)" *ngIf="getPage() != page">{{ page }}</a>
|
|
1058
|
-
</li>
|
|
1059
|
-
|
|
1060
|
-
<li class="ng2-smart-page-item page-item"
|
|
1061
|
-
[ngClass]="{disabled: getPage() == getLast()}">
|
|
1062
|
-
<a class="ng2-smart-page-link page-link page-link-next" href="#"
|
|
1063
|
-
(click)="getPage() == getLast() ? false : next()" aria-label="Next">
|
|
1064
|
-
<span aria-hidden="true">></span>
|
|
1065
|
-
<span class="sr-only">Next</span>
|
|
1066
|
-
</a>
|
|
1067
|
-
</li>
|
|
1068
|
-
|
|
1069
|
-
<li class="ng2-smart-page-item page-item"
|
|
1070
|
-
[ngClass]="{disabled: getPage() == getLast()}">
|
|
1071
|
-
<a class="ng2-smart-page-link page-link" href="#"
|
|
1072
|
-
(click)="getPage() == getLast() ? false : paginate(getLast())" aria-label="Last">
|
|
1073
|
-
<span aria-hidden="true">»</span>
|
|
1074
|
-
<span class="sr-only">Last</span>
|
|
1075
|
-
</a>
|
|
1076
|
-
</li>
|
|
1077
|
-
</ul>
|
|
1078
|
-
</nav>
|
|
1079
|
-
|
|
1080
|
-
<nav *ngIf="perPageSelect && perPageSelect.length > 0" class="ng2-smart-pagination-per-page">
|
|
1081
|
-
<label for="per-page">
|
|
1082
|
-
Per Page:
|
|
1083
|
-
</label>
|
|
1084
|
-
<select (change)="onChangePerPage()" [(ngModel)]="currentPerPage" id="per-page">
|
|
1085
|
-
<option *ngFor="let item of perPageSelect" [value]="item">{{ item }}</option>
|
|
1086
|
-
</select>
|
|
1087
|
-
</nav>
|
|
1088
|
-
`, isInline: true, styles: [".ng2-smart-pagination{display:inline-flex;font-size:.875em;padding:0}.ng2-smart-pagination .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}:host{display:flex;justify-content:space-between}:host select{margin:1rem 0 1rem 1rem}:host label{margin:1rem 0 1rem 1rem;line-height:2.5rem}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1089
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PagerComponent, decorators: [{
|
|
1090
|
-
type: Component,
|
|
1091
|
-
args: [{ selector: 'ng2-smart-table-pager', template: `
|
|
1092
|
-
<nav *ngIf="shouldShow()" class="ng2-smart-pagination-nav">
|
|
1093
|
-
<ul class="ng2-smart-pagination pagination">
|
|
1094
|
-
<li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
|
|
1095
|
-
<a class="ng2-smart-page-link page-link" href="#"
|
|
1096
|
-
(click)="getPage() == 1 ? false : paginate(1)" aria-label="First">
|
|
1097
|
-
<span aria-hidden="true">«</span>
|
|
1098
|
-
<span class="sr-only">First</span>
|
|
1099
|
-
</a>
|
|
1100
|
-
</li>
|
|
1101
|
-
<li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
|
|
1102
|
-
<a class="ng2-smart-page-link page-link page-link-prev" href="#"
|
|
1103
|
-
(click)="getPage() == 1 ? false : prev()" aria-label="Prev">
|
|
1104
|
-
<span aria-hidden="true"><</span>
|
|
1105
|
-
<span class="sr-only">Prev</span>
|
|
1106
|
-
</a>
|
|
1107
|
-
</li>
|
|
1108
|
-
<li class="ng2-smart-page-item page-item"
|
|
1109
|
-
[ngClass]="{active: getPage() == page}" *ngFor="let page of getPages()">
|
|
1110
|
-
<span class="ng2-smart-page-link page-link"
|
|
1111
|
-
*ngIf="getPage() == page">{{ page }} <span class="sr-only">(current)</span></span>
|
|
1112
|
-
<a class="ng2-smart-page-link page-link" href="#"
|
|
1113
|
-
(click)="paginate(page)" *ngIf="getPage() != page">{{ page }}</a>
|
|
1114
|
-
</li>
|
|
1115
|
-
|
|
1116
|
-
<li class="ng2-smart-page-item page-item"
|
|
1117
|
-
[ngClass]="{disabled: getPage() == getLast()}">
|
|
1118
|
-
<a class="ng2-smart-page-link page-link page-link-next" href="#"
|
|
1119
|
-
(click)="getPage() == getLast() ? false : next()" aria-label="Next">
|
|
1120
|
-
<span aria-hidden="true">></span>
|
|
1121
|
-
<span class="sr-only">Next</span>
|
|
1122
|
-
</a>
|
|
1123
|
-
</li>
|
|
1124
|
-
|
|
1125
|
-
<li class="ng2-smart-page-item page-item"
|
|
1126
|
-
[ngClass]="{disabled: getPage() == getLast()}">
|
|
1127
|
-
<a class="ng2-smart-page-link page-link" href="#"
|
|
1128
|
-
(click)="getPage() == getLast() ? false : paginate(getLast())" aria-label="Last">
|
|
1129
|
-
<span aria-hidden="true">»</span>
|
|
1130
|
-
<span class="sr-only">Last</span>
|
|
1131
|
-
</a>
|
|
1132
|
-
</li>
|
|
1133
|
-
</ul>
|
|
1134
|
-
</nav>
|
|
1135
|
-
|
|
1136
|
-
<nav *ngIf="perPageSelect && perPageSelect.length > 0" class="ng2-smart-pagination-per-page">
|
|
1137
|
-
<label for="per-page">
|
|
1138
|
-
Per Page:
|
|
1139
|
-
</label>
|
|
1140
|
-
<select (change)="onChangePerPage()" [(ngModel)]="currentPerPage" id="per-page">
|
|
1141
|
-
<option *ngFor="let item of perPageSelect" [value]="item">{{ item }}</option>
|
|
1142
|
-
</select>
|
|
1143
|
-
</nav>
|
|
1144
|
-
`, styles: [".ng2-smart-pagination{display:inline-flex;font-size:.875em;padding:0}.ng2-smart-pagination .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.ng2-smart-pagination .ng2-smart-page-item{display:inline}.ng2-smart-pagination .page-link-next,.ng2-smart-pagination .page-link-prev{font-size:10px}:host{display:flex;justify-content:space-between}:host select{margin:1rem 0 1rem 1rem}:host label{margin:1rem 0 1rem 1rem;line-height:2.5rem}\n"] }]
|
|
1145
|
-
}], propDecorators: { source: [{
|
|
1146
|
-
type: Input
|
|
1147
|
-
}], perPageSelect: [{
|
|
1148
|
-
type: Input
|
|
1149
|
-
}], changePage: [{
|
|
1150
|
-
type: Output
|
|
1151
|
-
}] } });
|
|
1152
|
-
|
|
1153
|
-
class PagerModule {
|
|
1154
|
-
}
|
|
1155
|
-
PagerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1156
|
-
PagerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: PagerModule, declarations: [PagerComponent], imports: [CommonModule,
|
|
1157
|
-
FormsModule], exports: [PagerComponent] });
|
|
1158
|
-
PagerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PagerModule, imports: [CommonModule,
|
|
1159
|
-
FormsModule] });
|
|
1160
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PagerModule, decorators: [{
|
|
1161
|
-
type: NgModule,
|
|
1162
|
-
args: [{
|
|
1163
|
-
imports: [
|
|
1164
|
-
CommonModule,
|
|
1165
|
-
FormsModule,
|
|
1166
|
-
],
|
|
1167
|
-
declarations: [
|
|
1168
|
-
PagerComponent,
|
|
1169
|
-
],
|
|
1170
|
-
exports: [
|
|
1171
|
-
PagerComponent,
|
|
1172
|
-
],
|
|
1173
|
-
}]
|
|
1174
|
-
}] });
|
|
1175
|
-
|
|
1176
|
-
class TbodyCreateCancelComponent {
|
|
1177
|
-
constructor() {
|
|
1178
|
-
this.cancelButtonContent = '';
|
|
1179
|
-
this.saveButtonContent = '';
|
|
1180
|
-
}
|
|
1181
|
-
onSave(event) {
|
|
1182
|
-
event.preventDefault();
|
|
1183
|
-
event.stopPropagation();
|
|
1184
|
-
this.grid.save(this.row, this.editConfirm);
|
|
1185
|
-
}
|
|
1186
|
-
onCancelEdit(event) {
|
|
1187
|
-
event.preventDefault();
|
|
1188
|
-
event.stopPropagation();
|
|
1189
|
-
this.editCancel.emit(true);
|
|
1190
|
-
this.row.isInEditing = false;
|
|
1191
|
-
}
|
|
1192
|
-
ngOnChanges() {
|
|
1193
|
-
this.saveButtonContent = this.grid.getSetting('edit.saveButtonContent', 'save');
|
|
1194
|
-
this.cancelButtonContent = this.grid.getSetting('edit.cancelButtonContent', 'cancel');
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
TbodyCreateCancelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TbodyCreateCancelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1198
|
-
TbodyCreateCancelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TbodyCreateCancelComponent, selector: "ng2-st-tbody-create-cancel", inputs: { grid: "grid", row: "row", editConfirm: "editConfirm", editCancel: "editCancel" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1199
|
-
<a href="#" class="ng2-smart-action ng2-smart-action-edit-save"
|
|
1200
|
-
[innerHTML]="saveButtonContent" (click)="onSave($event)"></a>
|
|
1201
|
-
<a href="#" class="ng2-smart-action ng2-smart-action-edit-cancel"
|
|
1202
|
-
[innerHTML]="cancelButtonContent" (click)="onCancelEdit($event)"></a>
|
|
1203
|
-
`, isInline: true });
|
|
1204
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TbodyCreateCancelComponent, decorators: [{
|
|
1205
|
-
type: Component,
|
|
1206
|
-
args: [{
|
|
1207
|
-
selector: 'ng2-st-tbody-create-cancel',
|
|
1208
|
-
template: `
|
|
1209
|
-
<a href="#" class="ng2-smart-action ng2-smart-action-edit-save"
|
|
1210
|
-
[innerHTML]="saveButtonContent" (click)="onSave($event)"></a>
|
|
1211
|
-
<a href="#" class="ng2-smart-action ng2-smart-action-edit-cancel"
|
|
1212
|
-
[innerHTML]="cancelButtonContent" (click)="onCancelEdit($event)"></a>
|
|
1213
|
-
`,
|
|
1214
|
-
}]
|
|
1215
|
-
}], propDecorators: { grid: [{
|
|
1216
|
-
type: Input
|
|
1217
|
-
}], row: [{
|
|
1218
|
-
type: Input
|
|
1219
|
-
}], editConfirm: [{
|
|
1220
|
-
type: Input
|
|
1221
|
-
}], editCancel: [{
|
|
1222
|
-
type: Input
|
|
1223
|
-
}] } });
|
|
1224
|
-
|
|
1225
|
-
class TbodyEditDeleteComponent {
|
|
1226
|
-
constructor() {
|
|
1227
|
-
this.edit = new EventEmitter();
|
|
1228
|
-
this.delete = new EventEmitter();
|
|
1229
|
-
this.editRowSelect = new EventEmitter();
|
|
1230
|
-
this.isActionEdit = false;
|
|
1231
|
-
this.isActionDelete = false;
|
|
1232
|
-
this.editRowButtonContent = '';
|
|
1233
|
-
this.deleteRowButtonContent = '';
|
|
1234
|
-
}
|
|
1235
|
-
onEdit(event) {
|
|
1236
|
-
event.preventDefault();
|
|
1237
|
-
event.stopPropagation();
|
|
1238
|
-
this.editRowSelect.emit(this.row);
|
|
1239
|
-
this.edit.emit({
|
|
1240
|
-
data: this.row.getData(),
|
|
1241
|
-
source: this.source,
|
|
1242
|
-
});
|
|
1243
|
-
if (this.grid.getSetting('mode') !== 'external') {
|
|
1244
|
-
this.grid.edit(this.row);
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
onDelete(event) {
|
|
1248
|
-
event.preventDefault();
|
|
1249
|
-
event.stopPropagation();
|
|
1250
|
-
if (this.grid.getSetting('mode') === 'external') {
|
|
1251
|
-
this.delete.emit({
|
|
1252
|
-
data: this.row.getData(),
|
|
1253
|
-
source: this.source,
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
else {
|
|
1257
|
-
this.grid.delete(this.row, this.deleteConfirm);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
ngOnChanges() {
|
|
1261
|
-
this.isActionEdit = this.grid.getSetting('actions.edit');
|
|
1262
|
-
this.isActionDelete = this.grid.getSetting('actions.delete');
|
|
1263
|
-
this.editRowButtonContent = this.grid.getSetting('edit.editButtonContent');
|
|
1264
|
-
this.deleteRowButtonContent = this.grid.getSetting('delete.deleteButtonContent');
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
TbodyEditDeleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TbodyEditDeleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1268
|
-
TbodyEditDeleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TbodyEditDeleteComponent, selector: "ng2-st-tbody-edit-delete", inputs: { grid: "grid", row: "row", source: "source", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm" }, outputs: { edit: "edit", delete: "delete", editRowSelect: "editRowSelect" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1269
|
-
<a href="#" *ngIf="isActionEdit" class="ng2-smart-action ng2-smart-action-edit-edit"
|
|
1270
|
-
[innerHTML]="editRowButtonContent" (click)="onEdit($event)"></a>
|
|
1271
|
-
<a href="#" *ngIf="isActionDelete" class="ng2-smart-action ng2-smart-action-delete-delete"
|
|
1272
|
-
[innerHTML]="deleteRowButtonContent" (click)="onDelete($event)"></a>
|
|
1273
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1274
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TbodyEditDeleteComponent, decorators: [{
|
|
1275
|
-
type: Component,
|
|
1276
|
-
args: [{
|
|
1277
|
-
selector: 'ng2-st-tbody-edit-delete',
|
|
1278
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1279
|
-
template: `
|
|
1280
|
-
<a href="#" *ngIf="isActionEdit" class="ng2-smart-action ng2-smart-action-edit-edit"
|
|
1281
|
-
[innerHTML]="editRowButtonContent" (click)="onEdit($event)"></a>
|
|
1282
|
-
<a href="#" *ngIf="isActionDelete" class="ng2-smart-action ng2-smart-action-delete-delete"
|
|
1283
|
-
[innerHTML]="deleteRowButtonContent" (click)="onDelete($event)"></a>
|
|
1284
|
-
`,
|
|
1285
|
-
}]
|
|
1286
|
-
}], propDecorators: { grid: [{
|
|
1287
|
-
type: Input
|
|
1288
|
-
}], row: [{
|
|
1289
|
-
type: Input
|
|
1290
|
-
}], source: [{
|
|
1291
|
-
type: Input
|
|
1292
|
-
}], deleteConfirm: [{
|
|
1293
|
-
type: Input
|
|
1294
|
-
}], editConfirm: [{
|
|
1295
|
-
type: Input
|
|
1296
|
-
}], edit: [{
|
|
1297
|
-
type: Output
|
|
1298
|
-
}], delete: [{
|
|
1299
|
-
type: Output
|
|
1300
|
-
}], editRowSelect: [{
|
|
1301
|
-
type: Output
|
|
1302
|
-
}] } });
|
|
1303
|
-
|
|
1304
|
-
class TbodyCustomComponent {
|
|
1305
|
-
constructor() {
|
|
1306
|
-
this.custom = new EventEmitter();
|
|
1307
|
-
}
|
|
1308
|
-
onCustom(action, event) {
|
|
1309
|
-
event.preventDefault();
|
|
1310
|
-
event.stopPropagation();
|
|
1311
|
-
this.custom.emit({
|
|
1312
|
-
action: action.name,
|
|
1313
|
-
data: this.row.getData(),
|
|
1314
|
-
source: this.source
|
|
1315
|
-
});
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
TbodyCustomComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TbodyCustomComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1319
|
-
TbodyCustomComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: { grid: "grid", row: "row", source: "source" }, outputs: { custom: "custom" }, ngImport: i0, template: `
|
|
1320
|
-
<a *ngFor="let action of grid.getSetting('actions.custom')" href="#"
|
|
1321
|
-
class="ng2-smart-action ng2-smart-action-custom-custom"
|
|
1322
|
-
[innerHTML]="action.title"
|
|
1323
|
-
(click)="onCustom(action, $event)"></a>
|
|
1324
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1325
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TbodyCustomComponent, decorators: [{
|
|
1326
|
-
type: Component,
|
|
1327
|
-
args: [{
|
|
1328
|
-
selector: 'ng2-st-tbody-custom',
|
|
1329
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1330
|
-
template: `
|
|
1331
|
-
<a *ngFor="let action of grid.getSetting('actions.custom')" href="#"
|
|
1332
|
-
class="ng2-smart-action ng2-smart-action-custom-custom"
|
|
1333
|
-
[innerHTML]="action.title"
|
|
1334
|
-
(click)="onCustom(action, $event)"></a>
|
|
1335
|
-
`
|
|
1336
|
-
}]
|
|
1337
|
-
}], propDecorators: { grid: [{
|
|
1338
|
-
type: Input
|
|
1339
|
-
}], row: [{
|
|
1340
|
-
type: Input
|
|
1341
|
-
}], source: [{
|
|
1342
|
-
type: Input
|
|
1343
|
-
}], custom: [{
|
|
1344
|
-
type: Output
|
|
1345
|
-
}] } });
|
|
1346
|
-
|
|
1347
|
-
class Ng2SmartTableTbodyComponent {
|
|
1348
|
-
constructor() {
|
|
1349
|
-
this.rowClassFunction = () => '';
|
|
1350
|
-
this.save = new EventEmitter();
|
|
1351
|
-
this.cancel = new EventEmitter();
|
|
1352
|
-
this.edit = new EventEmitter();
|
|
1353
|
-
this.editCancel = new EventEmitter();
|
|
1354
|
-
this.delete = new EventEmitter();
|
|
1355
|
-
this.custom = new EventEmitter();
|
|
1356
|
-
this.edited = new EventEmitter();
|
|
1357
|
-
this.userSelectRow = new EventEmitter();
|
|
1358
|
-
this.userClickedRow = new EventEmitter();
|
|
1359
|
-
this.editRowSelect = new EventEmitter();
|
|
1360
|
-
this.multipleSelectRow = new EventEmitter();
|
|
1361
|
-
this.isMultiSelectVisible = false;
|
|
1362
|
-
this.showActionColumnLeft = false;
|
|
1363
|
-
this.showActionColumnRight = false;
|
|
1364
|
-
this.mode = 'inline';
|
|
1365
|
-
this.editInputClass = '';
|
|
1366
|
-
this.isActionAdd = false;
|
|
1367
|
-
this.isActionEdit = false;
|
|
1368
|
-
this.isActionDelete = false;
|
|
1369
|
-
this.noDataMessage = false;
|
|
1370
|
-
}
|
|
1371
|
-
get tableColumnsCount() {
|
|
1372
|
-
const actionColumns = this.isActionAdd || this.isActionEdit || this.isActionDelete ? 1 : 0;
|
|
1373
|
-
return this.grid.getColumns().length + actionColumns;
|
|
1374
|
-
}
|
|
1375
|
-
ngOnChanges() {
|
|
1376
|
-
this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
|
|
1377
|
-
this.showActionColumnLeft = this.grid.showActionColumn('left');
|
|
1378
|
-
this.mode = this.grid.getSetting('mode', 'inline');
|
|
1379
|
-
this.editInputClass = this.grid.getSetting('edit.inputClass', '');
|
|
1380
|
-
this.showActionColumnRight = this.grid.showActionColumn('right');
|
|
1381
|
-
this.isActionAdd = this.grid.getSetting('actions.add', false);
|
|
1382
|
-
this.isActionEdit = this.grid.getSetting('actions.edit', false);
|
|
1383
|
-
this.isActionDelete = this.grid.getSetting('actions.delete', false);
|
|
1384
|
-
this.noDataMessage = this.grid.getSetting('noDataMessage');
|
|
1385
|
-
}
|
|
1386
|
-
getVisibleCells(cells) {
|
|
1387
|
-
return (cells || []).filter((cell) => !cell.getColumn().hide);
|
|
1388
|
-
}
|
|
1389
|
-
trackByIdOrIndex(index, item) {
|
|
1390
|
-
return (item === null || item === void 0 ? void 0 : item.id) || index;
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
Ng2SmartTableTbodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableTbodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1394
|
-
Ng2SmartTableTbodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: Ng2SmartTableTbodyComponent, selector: "[ng2-st-tbody]", inputs: { grid: "grid", source: "source", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", rowClassFunction: "rowClassFunction" }, outputs: { save: "save", cancel: "cancel", edit: "edit", editCancel: "editCancel", delete: "delete", custom: "custom", edited: "edited", userSelectRow: "userSelectRow", userClickedRow: "userClickedRow", editRowSelect: "editRowSelect", multipleSelectRow: "multipleSelectRow" }, usesOnChanges: true, ngImport: i0, template: "<tr\n *ngFor=\"let row of grid.getRows(); trackBy: trackByIdOrIndex\"\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [className]=\"rowClassFunction(row)\"\n [ngClass]=\"{ selected: row.isSelected }\"\n>\n <td\n *ngIf=\"isMultiSelectVisible\"\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"multipleSelectRow.emit(row); $event.stopPropagation()\"\n >\n <input type=\"checkbox\" class=\"form-control\" [ngModel]=\"row.isSelected\" />\n </td>\n <td\n *ngIf=\"!row.isInEditing && showActionColumnLeft\"\n class=\"ng2-smart-actions\"\n (click)=\"$event.stopPropagation()\"\n >\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n <td *ngIf=\"row.isInEditing && showActionColumnLeft\" class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n <td *ngFor=\"let cell of getVisibleCells(row.cells)\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [grid]=\"grid\"\n [row]=\"row\"\n [isNew]=\"false\"\n [mode]=\"mode\"\n [editConfirm]=\"editConfirm\"\n [inputClass]=\"editInputClass\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n\n <td\n *ngIf=\"row.isInEditing && showActionColumnRight\"\n class=\"ng2-smart-actions\"\n >\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n ></ng2-st-tbody-create-cancel>\n </td>\n\n <td\n *ngIf=\"!row.isInEditing && showActionColumnRight\"\n class=\"ng2-smart-actions\"\n >\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [row]=\"row\"\n [source]=\"source\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n</tr>\n\n<tr *ngIf=\"grid.getRows().length == 0\">\n <td [attr.colspan]=\"tableColumnsCount\">\n {{ noDataMessage }}\n </td>\n</tr>\n", styles: [":host .ng2-smart-row.selected{background:rgba(0,0,0,.05)}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["grid", "row", "editConfirm", "createConfirm", "isNew", "cell", "inputClass", "mode", "isInEditing"], outputs: ["edited"] }, { kind: "component", type: TbodyCreateCancelComponent, selector: "ng2-st-tbody-create-cancel", inputs: ["grid", "row", "editConfirm", "editCancel"] }, { kind: "component", type: TbodyEditDeleteComponent, selector: "ng2-st-tbody-edit-delete", inputs: ["grid", "row", "source", "deleteConfirm", "editConfirm"], outputs: ["edit", "delete", "editRowSelect"] }, { kind: "component", type: TbodyCustomComponent, selector: "ng2-st-tbody-custom", inputs: ["grid", "row", "source"], outputs: ["custom"] }] });
|
|
1395
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableTbodyComponent, decorators: [{
|
|
1396
|
-
type: Component,
|
|
1397
|
-
args: [{ selector: '[ng2-st-tbody]', template: "<tr\n *ngFor=\"let row of grid.getRows(); trackBy: trackByIdOrIndex\"\n (click)=\"userClickedRow.emit(row)\"\n class=\"ng2-smart-row\"\n [className]=\"rowClassFunction(row)\"\n [ngClass]=\"{ selected: row.isSelected }\"\n>\n <td\n *ngIf=\"isMultiSelectVisible\"\n class=\"ng2-smart-actions ng2-smart-action-multiple-select\"\n (click)=\"multipleSelectRow.emit(row); $event.stopPropagation()\"\n >\n <input type=\"checkbox\" class=\"form-control\" [ngModel]=\"row.isSelected\" />\n </td>\n <td\n *ngIf=\"!row.isInEditing && showActionColumnLeft\"\n class=\"ng2-smart-actions\"\n (click)=\"$event.stopPropagation()\"\n >\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n <td *ngIf=\"row.isInEditing && showActionColumnLeft\" class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n [editCancel]=\"editCancel\"\n ></ng2-st-tbody-create-cancel>\n </td>\n <td *ngFor=\"let cell of getVisibleCells(row.cells)\">\n <ng2-smart-table-cell\n [cell]=\"cell\"\n [grid]=\"grid\"\n [row]=\"row\"\n [isNew]=\"false\"\n [mode]=\"mode\"\n [editConfirm]=\"editConfirm\"\n [inputClass]=\"editInputClass\"\n [isInEditing]=\"row.isInEditing\"\n >\n </ng2-smart-table-cell>\n </td>\n\n <td\n *ngIf=\"row.isInEditing && showActionColumnRight\"\n class=\"ng2-smart-actions\"\n >\n <ng2-st-tbody-create-cancel\n [grid]=\"grid\"\n [row]=\"row\"\n [editConfirm]=\"editConfirm\"\n ></ng2-st-tbody-create-cancel>\n </td>\n\n <td\n *ngIf=\"!row.isInEditing && showActionColumnRight\"\n class=\"ng2-smart-actions\"\n >\n <ng2-st-tbody-custom\n [grid]=\"grid\"\n (custom)=\"custom.emit($event)\"\n [row]=\"row\"\n [source]=\"source\"\n ></ng2-st-tbody-custom>\n\n <ng2-st-tbody-edit-delete\n [grid]=\"grid\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [row]=\"row\"\n [source]=\"source\"\n (edit)=\"edit.emit(row)\"\n (delete)=\"delete.emit(row)\"\n (editRowSelect)=\"editRowSelect.emit($event)\"\n >\n </ng2-st-tbody-edit-delete>\n </td>\n</tr>\n\n<tr *ngIf=\"grid.getRows().length == 0\">\n <td [attr.colspan]=\"tableColumnsCount\">\n {{ noDataMessage }}\n </td>\n</tr>\n", styles: [":host .ng2-smart-row.selected{background:rgba(0,0,0,.05)}:host .ng2-smart-row .ng2-smart-actions.ng2-smart-action-multiple-select{text-align:center}:host ::ng-deep ng2-st-tbody-edit-delete a:first-child,:host ::ng-deep ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}\n"] }]
|
|
1398
|
-
}], propDecorators: { grid: [{
|
|
1399
|
-
type: Input
|
|
1400
|
-
}], source: [{
|
|
1401
|
-
type: Input
|
|
1402
|
-
}], deleteConfirm: [{
|
|
1403
|
-
type: Input
|
|
1404
|
-
}], editConfirm: [{
|
|
1405
|
-
type: Input
|
|
1406
|
-
}], rowClassFunction: [{
|
|
1407
|
-
type: Input
|
|
1408
|
-
}], save: [{
|
|
1409
|
-
type: Output
|
|
1410
|
-
}], cancel: [{
|
|
1411
|
-
type: Output
|
|
1412
|
-
}], edit: [{
|
|
1413
|
-
type: Output
|
|
1414
|
-
}], editCancel: [{
|
|
1415
|
-
type: Output
|
|
1416
|
-
}], delete: [{
|
|
1417
|
-
type: Output
|
|
1418
|
-
}], custom: [{
|
|
1419
|
-
type: Output
|
|
1420
|
-
}], edited: [{
|
|
1421
|
-
type: Output
|
|
1422
|
-
}], userSelectRow: [{
|
|
1423
|
-
type: Output
|
|
1424
|
-
}], userClickedRow: [{
|
|
1425
|
-
type: Output
|
|
1426
|
-
}], editRowSelect: [{
|
|
1427
|
-
type: Output
|
|
1428
|
-
}], multipleSelectRow: [{
|
|
1429
|
-
type: Output
|
|
1430
|
-
}] } });
|
|
1431
|
-
|
|
1432
|
-
const TBODY_COMPONENTS = [
|
|
1433
|
-
TbodyCreateCancelComponent,
|
|
1434
|
-
TbodyEditDeleteComponent,
|
|
1435
|
-
TbodyCustomComponent,
|
|
1436
|
-
Ng2SmartTableTbodyComponent
|
|
1437
|
-
];
|
|
1438
|
-
class TBodyModule {
|
|
1439
|
-
}
|
|
1440
|
-
TBodyModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TBodyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1441
|
-
TBodyModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: TBodyModule, declarations: [TbodyCreateCancelComponent,
|
|
1442
|
-
TbodyEditDeleteComponent,
|
|
1443
|
-
TbodyCustomComponent,
|
|
1444
|
-
Ng2SmartTableTbodyComponent], imports: [CommonModule,
|
|
1445
|
-
FormsModule,
|
|
1446
|
-
CellModule], exports: [TbodyCreateCancelComponent,
|
|
1447
|
-
TbodyEditDeleteComponent,
|
|
1448
|
-
TbodyCustomComponent,
|
|
1449
|
-
Ng2SmartTableTbodyComponent] });
|
|
1450
|
-
TBodyModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TBodyModule, imports: [CommonModule,
|
|
1451
|
-
FormsModule,
|
|
1452
|
-
CellModule] });
|
|
1453
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TBodyModule, decorators: [{
|
|
1454
|
-
type: NgModule,
|
|
1455
|
-
args: [{
|
|
1456
|
-
imports: [
|
|
1457
|
-
CommonModule,
|
|
1458
|
-
FormsModule,
|
|
1459
|
-
CellModule,
|
|
1460
|
-
],
|
|
1461
|
-
declarations: [
|
|
1462
|
-
...TBODY_COMPONENTS,
|
|
1463
|
-
],
|
|
1464
|
-
exports: [
|
|
1465
|
-
...TBODY_COMPONENTS,
|
|
1466
|
-
],
|
|
1467
|
-
}]
|
|
1468
|
-
}] });
|
|
1469
|
-
|
|
1470
|
-
class AddButtonComponent {
|
|
1471
|
-
constructor(ref) {
|
|
1472
|
-
this.ref = ref;
|
|
1473
|
-
this.create = new EventEmitter();
|
|
1474
|
-
this.isActionAdd = false;
|
|
1475
|
-
this.addNewButtonContent = '';
|
|
1476
|
-
}
|
|
1477
|
-
ngAfterViewInit() {
|
|
1478
|
-
this.ref.nativeElement.classList.add('ng2-smart-actions-title', 'ng2-smart-actions-title-add');
|
|
1479
|
-
}
|
|
1480
|
-
ngOnChanges() {
|
|
1481
|
-
this.isActionAdd = this.grid.getSetting('actions.add');
|
|
1482
|
-
this.addNewButtonContent = this.grid.getSetting('add.addButtonContent');
|
|
1483
|
-
}
|
|
1484
|
-
onAdd(event) {
|
|
1485
|
-
event.preventDefault();
|
|
1486
|
-
event.stopPropagation();
|
|
1487
|
-
if (this.grid.getSetting('mode') === 'external') {
|
|
1488
|
-
this.create.emit({
|
|
1489
|
-
source: this.source,
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1492
|
-
else {
|
|
1493
|
-
this.grid.createFormShown = true;
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
AddButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AddButtonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1498
|
-
AddButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AddButtonComponent, selector: "[ng2-st-add-button]", inputs: { grid: "grid", source: "source" }, outputs: { create: "create" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1499
|
-
<a *ngIf="isActionAdd" href="#" class="ng2-smart-action ng2-smart-action-add-add"
|
|
1500
|
-
[innerHTML]="addNewButtonContent" (click)="onAdd($event)"></a>
|
|
1501
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
1502
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AddButtonComponent, decorators: [{
|
|
1503
|
-
type: Component,
|
|
1504
|
-
args: [{
|
|
1505
|
-
selector: '[ng2-st-add-button]',
|
|
1506
|
-
template: `
|
|
1507
|
-
<a *ngIf="isActionAdd" href="#" class="ng2-smart-action ng2-smart-action-add-add"
|
|
1508
|
-
[innerHTML]="addNewButtonContent" (click)="onAdd($event)"></a>
|
|
1509
|
-
`,
|
|
1510
|
-
}]
|
|
1511
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { grid: [{
|
|
1512
|
-
type: Input
|
|
1513
|
-
}], source: [{
|
|
1514
|
-
type: Input
|
|
1515
|
-
}], create: [{
|
|
1516
|
-
type: Output
|
|
1517
|
-
}] } });
|
|
1518
|
-
|
|
1519
|
-
class TheadFitlersRowComponent {
|
|
1520
|
-
constructor() {
|
|
1521
|
-
this.create = new EventEmitter();
|
|
1522
|
-
this.filter = new EventEmitter();
|
|
1523
|
-
this.isMultiSelectVisible = false;
|
|
1524
|
-
this.showActionColumnLeft = false;
|
|
1525
|
-
this.showActionColumnRight = false;
|
|
1526
|
-
this.filterInputClass = '';
|
|
1527
|
-
}
|
|
1528
|
-
ngOnChanges() {
|
|
1529
|
-
this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
|
|
1530
|
-
this.showActionColumnLeft = this.grid.showActionColumn('left');
|
|
1531
|
-
this.showActionColumnRight = this.grid.showActionColumn('right');
|
|
1532
|
-
this.filterInputClass = this.grid.getSetting('filter.inputClass', '');
|
|
1533
|
-
}
|
|
1534
|
-
getVisibleColumns(columns) {
|
|
1535
|
-
return (columns || []).filter((column) => !column.hide);
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
TheadFitlersRowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TheadFitlersRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1539
|
-
TheadFitlersRowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TheadFitlersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: { grid: "grid", source: "source" }, outputs: { create: "create", filter: "filter" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1540
|
-
<th *ngIf="isMultiSelectVisible"></th>
|
|
1541
|
-
<th ng2-st-add-button *ngIf="showActionColumnLeft"
|
|
1542
|
-
[grid]="grid"
|
|
1543
|
-
(create)="create.emit($event)">
|
|
1544
|
-
</th>
|
|
1545
|
-
<th *ngFor="let column of getVisibleColumns(grid.getColumns())" class="ng2-smart-th {{ column.id }}">
|
|
1546
|
-
<ng2-smart-table-filter [source]="source"
|
|
1547
|
-
[column]="column"
|
|
1548
|
-
[inputClass]="filterInputClass"
|
|
1549
|
-
(filter)="filter.emit($event)">
|
|
1550
|
-
</ng2-smart-table-filter>
|
|
1551
|
-
</th>
|
|
1552
|
-
<th ng2-st-add-button *ngIf="showActionColumnRight"
|
|
1553
|
-
[grid]="grid"
|
|
1554
|
-
[source]="source"
|
|
1555
|
-
(create)="create.emit($event)">
|
|
1556
|
-
</th>
|
|
1557
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FilterComponent, selector: "ng2-smart-table-filter" }, { kind: "component", type: AddButtonComponent, selector: "[ng2-st-add-button]", inputs: ["grid", "source"], outputs: ["create"] }] });
|
|
1558
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TheadFitlersRowComponent, decorators: [{
|
|
1559
|
-
type: Component,
|
|
1560
|
-
args: [{
|
|
1561
|
-
selector: '[ng2-st-thead-filters-row]',
|
|
1562
|
-
template: `
|
|
1563
|
-
<th *ngIf="isMultiSelectVisible"></th>
|
|
1564
|
-
<th ng2-st-add-button *ngIf="showActionColumnLeft"
|
|
1565
|
-
[grid]="grid"
|
|
1566
|
-
(create)="create.emit($event)">
|
|
1567
|
-
</th>
|
|
1568
|
-
<th *ngFor="let column of getVisibleColumns(grid.getColumns())" class="ng2-smart-th {{ column.id }}">
|
|
1569
|
-
<ng2-smart-table-filter [source]="source"
|
|
1570
|
-
[column]="column"
|
|
1571
|
-
[inputClass]="filterInputClass"
|
|
1572
|
-
(filter)="filter.emit($event)">
|
|
1573
|
-
</ng2-smart-table-filter>
|
|
1574
|
-
</th>
|
|
1575
|
-
<th ng2-st-add-button *ngIf="showActionColumnRight"
|
|
1576
|
-
[grid]="grid"
|
|
1577
|
-
[source]="source"
|
|
1578
|
-
(create)="create.emit($event)">
|
|
1579
|
-
</th>
|
|
1580
|
-
`,
|
|
1581
|
-
}]
|
|
1582
|
-
}], propDecorators: { grid: [{
|
|
1583
|
-
type: Input
|
|
1584
|
-
}], source: [{
|
|
1585
|
-
type: Input
|
|
1586
|
-
}], create: [{
|
|
1587
|
-
type: Output
|
|
1588
|
-
}], filter: [{
|
|
1589
|
-
type: Output
|
|
1590
|
-
}] } });
|
|
1591
|
-
|
|
1592
|
-
class ActionsComponent {
|
|
1593
|
-
constructor() {
|
|
1594
|
-
this.create = new EventEmitter();
|
|
1595
|
-
this.createButtonContent = '';
|
|
1596
|
-
this.cancelButtonContent = '';
|
|
1597
|
-
}
|
|
1598
|
-
ngOnChanges() {
|
|
1599
|
-
this.createButtonContent = this.grid.getSetting('add.createButtonContent');
|
|
1600
|
-
this.cancelButtonContent = this.grid.getSetting('add.cancelButtonContent');
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
ActionsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1604
|
-
ActionsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ActionsComponent, selector: "ng2-st-actions", inputs: { grid: "grid" }, outputs: { create: "create" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1605
|
-
<a href="#" class="ng2-smart-action ng2-smart-action-add-create"
|
|
1606
|
-
[innerHTML]="createButtonContent"
|
|
1607
|
-
(click)="$event.preventDefault();create.emit($event)"></a>
|
|
1608
|
-
<a href="#" class="ng2-smart-action ng2-smart-action-add-cancel"
|
|
1609
|
-
[innerHTML]="cancelButtonContent"
|
|
1610
|
-
(click)="$event.preventDefault();grid.createFormShown = false;"></a>
|
|
1611
|
-
`, isInline: true });
|
|
1612
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ActionsComponent, decorators: [{
|
|
1613
|
-
type: Component,
|
|
1614
|
-
args: [{
|
|
1615
|
-
selector: 'ng2-st-actions',
|
|
1616
|
-
template: `
|
|
1617
|
-
<a href="#" class="ng2-smart-action ng2-smart-action-add-create"
|
|
1618
|
-
[innerHTML]="createButtonContent"
|
|
1619
|
-
(click)="$event.preventDefault();create.emit($event)"></a>
|
|
1620
|
-
<a href="#" class="ng2-smart-action ng2-smart-action-add-cancel"
|
|
1621
|
-
[innerHTML]="cancelButtonContent"
|
|
1622
|
-
(click)="$event.preventDefault();grid.createFormShown = false;"></a>
|
|
1623
|
-
`,
|
|
1624
|
-
}]
|
|
1625
|
-
}], propDecorators: { grid: [{
|
|
1626
|
-
type: Input
|
|
1627
|
-
}], create: [{
|
|
1628
|
-
type: Output
|
|
1629
|
-
}] } });
|
|
1630
|
-
|
|
1631
|
-
class TheadFormRowComponent {
|
|
1632
|
-
constructor() {
|
|
1633
|
-
this.create = new EventEmitter();
|
|
1634
|
-
this.isMultiSelectVisible = false;
|
|
1635
|
-
this.showActionColumnLeft = false;
|
|
1636
|
-
this.showActionColumnRight = false;
|
|
1637
|
-
this.addInputClass = '';
|
|
1638
|
-
}
|
|
1639
|
-
onCreate(event) {
|
|
1640
|
-
event.stopPropagation();
|
|
1641
|
-
this.grid.create(this.grid.getNewRow(), this.createConfirm);
|
|
1642
|
-
}
|
|
1643
|
-
ngOnChanges() {
|
|
1644
|
-
this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
|
|
1645
|
-
this.showActionColumnLeft = this.grid.showActionColumn('left');
|
|
1646
|
-
this.showActionColumnRight = this.grid.showActionColumn('right');
|
|
1647
|
-
this.addInputClass = this.grid.getSetting('add.inputClass', '');
|
|
1648
|
-
}
|
|
1649
|
-
getVisibleCells(cells) {
|
|
1650
|
-
return (cells || []).filter((cell) => !cell.getColumn().hide);
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
TheadFormRowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TheadFormRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1654
|
-
TheadFormRowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TheadFormRowComponent, selector: "[ng2-st-thead-form-row]", inputs: { grid: "grid", row: "row", createConfirm: "createConfirm" }, outputs: { create: "create" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1655
|
-
<td *ngIf="grid.isMultiSelectVisible"></td>
|
|
1656
|
-
<td *ngIf="showActionColumnLeft" class="ng2-smart-actions">
|
|
1657
|
-
<ng2-st-actions [grid]="grid" (create)="onCreate($event)"></ng2-st-actions>
|
|
1658
|
-
</td>
|
|
1659
|
-
<td *ngFor="let cell of getVisibleCells(grid.getNewRow().getCells())">
|
|
1660
|
-
<ng2-smart-table-cell [cell]="cell"
|
|
1661
|
-
[grid]="grid"
|
|
1662
|
-
[isNew]="true"
|
|
1663
|
-
[createConfirm]="createConfirm"
|
|
1664
|
-
[inputClass]="addInputClass"
|
|
1665
|
-
[isInEditing]="grid.getNewRow().isInEditing"
|
|
1666
|
-
(edited)="onCreate($event)">
|
|
1667
|
-
</ng2-smart-table-cell>
|
|
1668
|
-
</td>
|
|
1669
|
-
<td *ngIf="showActionColumnRight" class="ng2-smart-actions">
|
|
1670
|
-
<ng2-st-actions [grid]="grid" (create)="onCreate($event)"></ng2-st-actions>
|
|
1671
|
-
</td>
|
|
1672
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CellComponent, selector: "ng2-smart-table-cell", inputs: ["grid", "row", "editConfirm", "createConfirm", "isNew", "cell", "inputClass", "mode", "isInEditing"], outputs: ["edited"] }, { kind: "component", type: ActionsComponent, selector: "ng2-st-actions", inputs: ["grid"], outputs: ["create"] }] });
|
|
1673
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TheadFormRowComponent, decorators: [{
|
|
1674
|
-
type: Component,
|
|
1675
|
-
args: [{
|
|
1676
|
-
selector: '[ng2-st-thead-form-row]',
|
|
1677
|
-
template: `
|
|
1678
|
-
<td *ngIf="grid.isMultiSelectVisible"></td>
|
|
1679
|
-
<td *ngIf="showActionColumnLeft" class="ng2-smart-actions">
|
|
1680
|
-
<ng2-st-actions [grid]="grid" (create)="onCreate($event)"></ng2-st-actions>
|
|
1681
|
-
</td>
|
|
1682
|
-
<td *ngFor="let cell of getVisibleCells(grid.getNewRow().getCells())">
|
|
1683
|
-
<ng2-smart-table-cell [cell]="cell"
|
|
1684
|
-
[grid]="grid"
|
|
1685
|
-
[isNew]="true"
|
|
1686
|
-
[createConfirm]="createConfirm"
|
|
1687
|
-
[inputClass]="addInputClass"
|
|
1688
|
-
[isInEditing]="grid.getNewRow().isInEditing"
|
|
1689
|
-
(edited)="onCreate($event)">
|
|
1690
|
-
</ng2-smart-table-cell>
|
|
1691
|
-
</td>
|
|
1692
|
-
<td *ngIf="showActionColumnRight" class="ng2-smart-actions">
|
|
1693
|
-
<ng2-st-actions [grid]="grid" (create)="onCreate($event)"></ng2-st-actions>
|
|
1694
|
-
</td>
|
|
1695
|
-
`,
|
|
1696
|
-
}]
|
|
1697
|
-
}], propDecorators: { grid: [{
|
|
1698
|
-
type: Input
|
|
1699
|
-
}], row: [{
|
|
1700
|
-
type: Input
|
|
1701
|
-
}], createConfirm: [{
|
|
1702
|
-
type: Input
|
|
1703
|
-
}], create: [{
|
|
1704
|
-
type: Output
|
|
1705
|
-
}] } });
|
|
1706
|
-
|
|
1707
|
-
class ActionsTitleComponent {
|
|
1708
|
-
constructor(ref) {
|
|
1709
|
-
this.ref = ref;
|
|
1710
|
-
this.actionsColumnTitle = '';
|
|
1711
|
-
}
|
|
1712
|
-
ngAfterViewInit() {
|
|
1713
|
-
this.ref.nativeElement.classList.add('ng2-smart-actions');
|
|
1714
|
-
}
|
|
1715
|
-
ngOnChanges() {
|
|
1716
|
-
this.actionsColumnTitle = this.grid.getSetting('actions.columnTitle');
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
ActionsTitleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ActionsTitleComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1720
|
-
ActionsTitleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ActionsTitleComponent, selector: "[ng2-st-actions-title]", inputs: { grid: "grid" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1721
|
-
<div class="ng2-smart-title">{{ actionsColumnTitle }}</div>
|
|
1722
|
-
`, isInline: true });
|
|
1723
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ActionsTitleComponent, decorators: [{
|
|
1724
|
-
type: Component,
|
|
1725
|
-
args: [{
|
|
1726
|
-
selector: '[ng2-st-actions-title]',
|
|
1727
|
-
template: `
|
|
1728
|
-
<div class="ng2-smart-title">{{ actionsColumnTitle }}</div>
|
|
1729
|
-
`,
|
|
1730
|
-
}]
|
|
1731
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { grid: [{
|
|
1732
|
-
type: Input
|
|
1733
|
-
}] } });
|
|
1734
|
-
|
|
1735
|
-
class CheckboxSelectAllComponent {
|
|
1736
|
-
}
|
|
1737
|
-
CheckboxSelectAllComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CheckboxSelectAllComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1738
|
-
CheckboxSelectAllComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CheckboxSelectAllComponent, selector: "[ng2-st-checkbox-select-all]", inputs: { grid: "grid", source: "source" }, ngImport: i0, template: `
|
|
1739
|
-
<input type="checkbox" [ngModel]="this.grid.dataSet.isAllSelected">
|
|
1740
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1741
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CheckboxSelectAllComponent, decorators: [{
|
|
1742
|
-
type: Component,
|
|
1743
|
-
args: [{
|
|
1744
|
-
selector: '[ng2-st-checkbox-select-all]',
|
|
1745
|
-
template: `
|
|
1746
|
-
<input type="checkbox" [ngModel]="this.grid.dataSet.isAllSelected">
|
|
1747
|
-
`,
|
|
1748
|
-
}]
|
|
1749
|
-
}], propDecorators: { grid: [{
|
|
1750
|
-
type: Input
|
|
1751
|
-
}], source: [{
|
|
1752
|
-
type: Input
|
|
1753
|
-
}] } });
|
|
1754
|
-
|
|
1755
|
-
class TitleComponent {
|
|
1756
|
-
constructor() {
|
|
1757
|
-
this.currentDirection = '';
|
|
1758
|
-
this.sort = new EventEmitter();
|
|
1759
|
-
this.dataChangedSub = false;
|
|
1760
|
-
}
|
|
1761
|
-
ngOnChanges(changes) {
|
|
1762
|
-
if (changes['source']) {
|
|
1763
|
-
if (!changes['source'].firstChange && this.dataChangedSub) {
|
|
1764
|
-
this.dataChangedSub.unsubscribe();
|
|
1765
|
-
}
|
|
1766
|
-
this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
|
|
1767
|
-
const sortConf = this.source.getSort();
|
|
1768
|
-
if (sortConf.length > 0 && sortConf[0]['field'] === this.column.id) {
|
|
1769
|
-
this.currentDirection = sortConf[0]['direction'];
|
|
1770
|
-
}
|
|
1771
|
-
else {
|
|
1772
|
-
this.currentDirection = '';
|
|
1773
|
-
}
|
|
1774
|
-
});
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
_sort(event) {
|
|
1778
|
-
event.preventDefault();
|
|
1779
|
-
this.changeSortDirection();
|
|
1780
|
-
this.source.setSort([
|
|
1781
|
-
{
|
|
1782
|
-
field: this.column.id,
|
|
1783
|
-
direction: this.currentDirection === 'desc' ? 'desc' : 'asc',
|
|
1784
|
-
compare: this.column.getCompareFunction(),
|
|
1785
|
-
},
|
|
1786
|
-
]);
|
|
1787
|
-
this.sort.emit(null);
|
|
1788
|
-
}
|
|
1789
|
-
changeSortDirection() {
|
|
1790
|
-
if (this.currentDirection) {
|
|
1791
|
-
const newDirection = this.currentDirection === 'asc' ? 'desc' : 'asc';
|
|
1792
|
-
this.currentDirection = newDirection;
|
|
1793
|
-
}
|
|
1794
|
-
else {
|
|
1795
|
-
this.currentDirection = this.column.sortDirection;
|
|
1796
|
-
}
|
|
1797
|
-
return this.currentDirection;
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
TitleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1801
|
-
TitleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TitleComponent, selector: "ng2-smart-table-title", inputs: { column: "column", source: "source" }, outputs: { sort: "sort" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1802
|
-
<a href="#" *ngIf="column.isSortable"
|
|
1803
|
-
(click)="_sort($event)"
|
|
1804
|
-
class="ng2-smart-sort-link sort"
|
|
1805
|
-
[ngClass]="currentDirection">
|
|
1806
|
-
{{ column.title }}
|
|
1807
|
-
</a>
|
|
1808
|
-
<span class="ng2-smart-sort" *ngIf="!column.isSortable">{{ column.title }}</span>
|
|
1809
|
-
`, isInline: true, styles: ["a.sort.asc,a.sort.desc{font-weight:700}a.sort.asc:after,a.sort.desc:after{content:\"\";display:inline-block;width:0;height:0;border-bottom:4px solid rgba(0,0,0,.3);border-top:4px solid transparent;border-left:4px solid transparent;border-right:4px solid transparent;margin-bottom:2px}a.sort.desc:after{transform:rotate(-180deg);margin-bottom:-2px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
1810
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TitleComponent, decorators: [{
|
|
1811
|
-
type: Component,
|
|
1812
|
-
args: [{ selector: 'ng2-smart-table-title', template: `
|
|
1813
|
-
<a href="#" *ngIf="column.isSortable"
|
|
1814
|
-
(click)="_sort($event)"
|
|
1815
|
-
class="ng2-smart-sort-link sort"
|
|
1816
|
-
[ngClass]="currentDirection">
|
|
1817
|
-
{{ column.title }}
|
|
1818
|
-
</a>
|
|
1819
|
-
<span class="ng2-smart-sort" *ngIf="!column.isSortable">{{ column.title }}</span>
|
|
1820
|
-
`, styles: ["a.sort.asc,a.sort.desc{font-weight:700}a.sort.asc:after,a.sort.desc:after{content:\"\";display:inline-block;width:0;height:0;border-bottom:4px solid rgba(0,0,0,.3);border-top:4px solid transparent;border-left:4px solid transparent;border-right:4px solid transparent;margin-bottom:2px}a.sort.desc:after{transform:rotate(-180deg);margin-bottom:-2px}\n"] }]
|
|
1821
|
-
}], propDecorators: { column: [{
|
|
1822
|
-
type: Input
|
|
1823
|
-
}], source: [{
|
|
1824
|
-
type: Input
|
|
1825
|
-
}], sort: [{
|
|
1826
|
-
type: Output
|
|
1827
|
-
}] } });
|
|
1828
|
-
|
|
1829
|
-
class ColumnTitleComponent {
|
|
1830
|
-
constructor() {
|
|
1831
|
-
this.sort = new EventEmitter();
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
ColumnTitleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ColumnTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1835
|
-
ColumnTitleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ColumnTitleComponent, selector: "ng2-st-column-title", inputs: { column: "column", source: "source" }, outputs: { sort: "sort" }, ngImport: i0, template: `
|
|
1836
|
-
<div class="ng2-smart-title">
|
|
1837
|
-
<ng2-smart-table-title [source]="source" [column]="column" (sort)="sort.emit($event)"></ng2-smart-table-title>
|
|
1838
|
-
</div>
|
|
1839
|
-
`, isInline: true, dependencies: [{ kind: "component", type: TitleComponent, selector: "ng2-smart-table-title", inputs: ["column", "source"], outputs: ["sort"] }] });
|
|
1840
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ColumnTitleComponent, decorators: [{
|
|
1841
|
-
type: Component,
|
|
1842
|
-
args: [{
|
|
1843
|
-
selector: 'ng2-st-column-title',
|
|
1844
|
-
template: `
|
|
1845
|
-
<div class="ng2-smart-title">
|
|
1846
|
-
<ng2-smart-table-title [source]="source" [column]="column" (sort)="sort.emit($event)"></ng2-smart-table-title>
|
|
1847
|
-
</div>
|
|
1848
|
-
`,
|
|
1849
|
-
}]
|
|
1850
|
-
}], propDecorators: { column: [{
|
|
1851
|
-
type: Input
|
|
1852
|
-
}], source: [{
|
|
1853
|
-
type: Input
|
|
1854
|
-
}], sort: [{
|
|
1855
|
-
type: Output
|
|
1856
|
-
}] } });
|
|
1857
|
-
|
|
1858
|
-
class TheadTitlesRowComponent {
|
|
1859
|
-
constructor() {
|
|
1860
|
-
this.sort = new EventEmitter();
|
|
1861
|
-
this.selectAllRows = new EventEmitter();
|
|
1862
|
-
this.isMultiSelectVisible = false;
|
|
1863
|
-
this.showActionColumnLeft = false;
|
|
1864
|
-
this.showActionColumnRight = false;
|
|
1865
|
-
}
|
|
1866
|
-
ngOnChanges() {
|
|
1867
|
-
this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
|
|
1868
|
-
this.showActionColumnLeft = this.grid.showActionColumn('left');
|
|
1869
|
-
this.showActionColumnRight = this.grid.showActionColumn('right');
|
|
1870
|
-
}
|
|
1871
|
-
getVisibleColumns(columns) {
|
|
1872
|
-
return (columns || []).filter((column) => !column.hide);
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
TheadTitlesRowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TheadTitlesRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1876
|
-
TheadTitlesRowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TheadTitlesRowComponent, selector: "[ng2-st-thead-titles-row]", inputs: { grid: "grid", source: "source" }, outputs: { sort: "sort", selectAllRows: "selectAllRows" }, usesOnChanges: true, ngImport: i0, template: `
|
|
1877
|
-
<th ng2-st-checkbox-select-all *ngIf="isMultiSelectVisible"
|
|
1878
|
-
[grid]="grid"
|
|
1879
|
-
[source]="source"
|
|
1880
|
-
(click)="selectAllRows.emit($event)">
|
|
1881
|
-
</th>
|
|
1882
|
-
<th ng2-st-actions-title *ngIf="showActionColumnLeft" [grid]="grid"></th>
|
|
1883
|
-
<th *ngFor="let column of getVisibleColumns(grid.getColumns())"
|
|
1884
|
-
class="ng2-smart-th {{ column.id }}"
|
|
1885
|
-
[ngClass]="column.class"
|
|
1886
|
-
[style.width]="column.width">
|
|
1887
|
-
<ng2-st-column-title [source]="source" [column]="column" (sort)="sort.emit($event)"></ng2-st-column-title>
|
|
1888
|
-
</th>
|
|
1889
|
-
<th ng2-st-actions-title *ngIf="showActionColumnRight" [grid]="grid"></th>
|
|
1890
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ActionsTitleComponent, selector: "[ng2-st-actions-title]", inputs: ["grid"] }, { kind: "component", type: CheckboxSelectAllComponent, selector: "[ng2-st-checkbox-select-all]", inputs: ["grid", "source"] }, { kind: "component", type: ColumnTitleComponent, selector: "ng2-st-column-title", inputs: ["column", "source"], outputs: ["sort"] }] });
|
|
1891
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TheadTitlesRowComponent, decorators: [{
|
|
1892
|
-
type: Component,
|
|
1893
|
-
args: [{
|
|
1894
|
-
selector: '[ng2-st-thead-titles-row]',
|
|
1895
|
-
template: `
|
|
1896
|
-
<th ng2-st-checkbox-select-all *ngIf="isMultiSelectVisible"
|
|
1897
|
-
[grid]="grid"
|
|
1898
|
-
[source]="source"
|
|
1899
|
-
(click)="selectAllRows.emit($event)">
|
|
1900
|
-
</th>
|
|
1901
|
-
<th ng2-st-actions-title *ngIf="showActionColumnLeft" [grid]="grid"></th>
|
|
1902
|
-
<th *ngFor="let column of getVisibleColumns(grid.getColumns())"
|
|
1903
|
-
class="ng2-smart-th {{ column.id }}"
|
|
1904
|
-
[ngClass]="column.class"
|
|
1905
|
-
[style.width]="column.width">
|
|
1906
|
-
<ng2-st-column-title [source]="source" [column]="column" (sort)="sort.emit($event)"></ng2-st-column-title>
|
|
1907
|
-
</th>
|
|
1908
|
-
<th ng2-st-actions-title *ngIf="showActionColumnRight" [grid]="grid"></th>
|
|
1909
|
-
`,
|
|
1910
|
-
}]
|
|
1911
|
-
}], propDecorators: { grid: [{
|
|
1912
|
-
type: Input
|
|
1913
|
-
}], source: [{
|
|
1914
|
-
type: Input
|
|
1915
|
-
}], sort: [{
|
|
1916
|
-
type: Output
|
|
1917
|
-
}], selectAllRows: [{
|
|
1918
|
-
type: Output
|
|
1919
|
-
}] } });
|
|
1920
|
-
|
|
1921
|
-
class Ng2SmartTableTheadComponent {
|
|
1922
|
-
constructor() {
|
|
1923
|
-
this.sort = new EventEmitter();
|
|
1924
|
-
this.selectAllRows = new EventEmitter();
|
|
1925
|
-
this.create = new EventEmitter();
|
|
1926
|
-
this.filter = new EventEmitter();
|
|
1927
|
-
this.isHideHeader = false;
|
|
1928
|
-
this.isHideSubHeader = false;
|
|
1929
|
-
}
|
|
1930
|
-
ngOnChanges() {
|
|
1931
|
-
this.isHideHeader = this.grid.getSetting('hideHeader', false);
|
|
1932
|
-
this.isHideSubHeader = this.grid.getSetting('hideSubHeader', false);
|
|
1933
|
-
}
|
|
1934
|
-
}
|
|
1935
|
-
Ng2SmartTableTheadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableTheadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1936
|
-
Ng2SmartTableTheadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: Ng2SmartTableTheadComponent, selector: "[ng2-st-thead]", inputs: { grid: "grid", source: "source", createConfirm: "createConfirm" }, outputs: { sort: "sort", selectAllRows: "selectAllRows", create: "create", filter: "filter" }, usesOnChanges: true, ngImport: i0, template: "<tr ng2-st-thead-titles-row *ngIf=\"!isHideHeader\"\n class=\"ng2-smart-titles\"\n [grid]=\"grid\"\n [source]=\"source\"\n (sort)=\"sort.emit($event)\"\n (selectAllRows)=\"selectAllRows.emit($event)\">\n</tr>\n\n<tr ng2-st-thead-filters-row *ngIf=\"!isHideSubHeader\"\n class=\"ng2-smart-filters\"\n [grid]=\"grid\"\n [source]=\"source\"\n (create)=\"create.emit($event)\"\n (filter)=\"filter.emit($event)\">\n</tr>\n\n<tr ng2-st-thead-form-row *ngIf=\"grid.createFormShown\"\n [grid]=\"grid\"\n [createConfirm]=\"createConfirm\">\n</tr>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TheadFitlersRowComponent, selector: "[ng2-st-thead-filters-row]", inputs: ["grid", "source"], outputs: ["create", "filter"] }, { kind: "component", type: TheadFormRowComponent, selector: "[ng2-st-thead-form-row]", inputs: ["grid", "row", "createConfirm"], outputs: ["create"] }, { kind: "component", type: TheadTitlesRowComponent, selector: "[ng2-st-thead-titles-row]", inputs: ["grid", "source"], outputs: ["sort", "selectAllRows"] }] });
|
|
1937
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableTheadComponent, decorators: [{
|
|
1938
|
-
type: Component,
|
|
1939
|
-
args: [{ selector: '[ng2-st-thead]', template: "<tr ng2-st-thead-titles-row *ngIf=\"!isHideHeader\"\n class=\"ng2-smart-titles\"\n [grid]=\"grid\"\n [source]=\"source\"\n (sort)=\"sort.emit($event)\"\n (selectAllRows)=\"selectAllRows.emit($event)\">\n</tr>\n\n<tr ng2-st-thead-filters-row *ngIf=\"!isHideSubHeader\"\n class=\"ng2-smart-filters\"\n [grid]=\"grid\"\n [source]=\"source\"\n (create)=\"create.emit($event)\"\n (filter)=\"filter.emit($event)\">\n</tr>\n\n<tr ng2-st-thead-form-row *ngIf=\"grid.createFormShown\"\n [grid]=\"grid\"\n [createConfirm]=\"createConfirm\">\n</tr>\n" }]
|
|
1940
|
-
}], propDecorators: { grid: [{
|
|
1941
|
-
type: Input
|
|
1942
|
-
}], source: [{
|
|
1943
|
-
type: Input
|
|
1944
|
-
}], createConfirm: [{
|
|
1945
|
-
type: Input
|
|
1946
|
-
}], sort: [{
|
|
1947
|
-
type: Output
|
|
1948
|
-
}], selectAllRows: [{
|
|
1949
|
-
type: Output
|
|
1950
|
-
}], create: [{
|
|
1951
|
-
type: Output
|
|
1952
|
-
}], filter: [{
|
|
1953
|
-
type: Output
|
|
1954
|
-
}] } });
|
|
1955
|
-
|
|
1956
|
-
const THEAD_COMPONENTS = [
|
|
1957
|
-
ActionsComponent,
|
|
1958
|
-
ActionsTitleComponent,
|
|
1959
|
-
AddButtonComponent,
|
|
1960
|
-
CheckboxSelectAllComponent,
|
|
1961
|
-
ColumnTitleComponent,
|
|
1962
|
-
TitleComponent,
|
|
1963
|
-
TheadFitlersRowComponent,
|
|
1964
|
-
TheadFormRowComponent,
|
|
1965
|
-
TheadTitlesRowComponent,
|
|
1966
|
-
Ng2SmartTableTheadComponent,
|
|
1967
|
-
];
|
|
1968
|
-
class THeadModule {
|
|
1969
|
-
}
|
|
1970
|
-
THeadModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: THeadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1971
|
-
THeadModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: THeadModule, declarations: [ActionsComponent,
|
|
1972
|
-
ActionsTitleComponent,
|
|
1973
|
-
AddButtonComponent,
|
|
1974
|
-
CheckboxSelectAllComponent,
|
|
1975
|
-
ColumnTitleComponent,
|
|
1976
|
-
TitleComponent,
|
|
1977
|
-
TheadFitlersRowComponent,
|
|
1978
|
-
TheadFormRowComponent,
|
|
1979
|
-
TheadTitlesRowComponent,
|
|
1980
|
-
Ng2SmartTableTheadComponent], imports: [CommonModule,
|
|
1981
|
-
FormsModule,
|
|
1982
|
-
FilterModule,
|
|
1983
|
-
CellModule], exports: [ActionsComponent,
|
|
1984
|
-
ActionsTitleComponent,
|
|
1985
|
-
AddButtonComponent,
|
|
1986
|
-
CheckboxSelectAllComponent,
|
|
1987
|
-
ColumnTitleComponent,
|
|
1988
|
-
TitleComponent,
|
|
1989
|
-
TheadFitlersRowComponent,
|
|
1990
|
-
TheadFormRowComponent,
|
|
1991
|
-
TheadTitlesRowComponent,
|
|
1992
|
-
Ng2SmartTableTheadComponent] });
|
|
1993
|
-
THeadModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: THeadModule, imports: [CommonModule,
|
|
1994
|
-
FormsModule,
|
|
1995
|
-
FilterModule,
|
|
1996
|
-
CellModule] });
|
|
1997
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: THeadModule, decorators: [{
|
|
1998
|
-
type: NgModule,
|
|
1999
|
-
args: [{
|
|
2000
|
-
imports: [
|
|
2001
|
-
CommonModule,
|
|
2002
|
-
FormsModule,
|
|
2003
|
-
FilterModule,
|
|
2004
|
-
CellModule,
|
|
2005
|
-
],
|
|
2006
|
-
declarations: [
|
|
2007
|
-
...THEAD_COMPONENTS,
|
|
2008
|
-
],
|
|
2009
|
-
exports: [
|
|
2010
|
-
...THEAD_COMPONENTS,
|
|
2011
|
-
],
|
|
2012
|
-
}]
|
|
2013
|
-
}] });
|
|
2014
|
-
|
|
2015
|
-
/**
|
|
2016
|
-
* Extending object that entered in first argument.
|
|
2017
|
-
*
|
|
2018
|
-
* Returns extended object or false if have no target object or incorrect type.
|
|
2019
|
-
*
|
|
2020
|
-
* If you wish to clone source object (without modify it), just use empty new
|
|
2021
|
-
* object as first argument, like this:
|
|
2022
|
-
* deepExtend({}, yourObj_1, [yourObj_N]);
|
|
2023
|
-
*/
|
|
2024
|
-
const deepExtend = function (...objects) {
|
|
2025
|
-
if (arguments.length < 1 || typeof arguments[0] !== 'object') {
|
|
2026
|
-
return false;
|
|
2027
|
-
}
|
|
2028
|
-
if (arguments.length < 2) {
|
|
2029
|
-
return arguments[0];
|
|
2030
|
-
}
|
|
2031
|
-
const target = arguments[0];
|
|
2032
|
-
// convert arguments to array and cut off target object
|
|
2033
|
-
const args = Array.prototype.slice.call(arguments, 1);
|
|
2034
|
-
let val, src;
|
|
2035
|
-
args.forEach((obj) => {
|
|
2036
|
-
// skip argument if it is array or isn't object
|
|
2037
|
-
if (typeof obj !== 'object' || Array.isArray(obj)) {
|
|
2038
|
-
return;
|
|
2039
|
-
}
|
|
2040
|
-
Object.keys(obj).forEach(function (key) {
|
|
2041
|
-
src = target[key]; // source value
|
|
2042
|
-
val = obj[key]; // new value
|
|
2043
|
-
// recursion prevention
|
|
2044
|
-
if (val === target) {
|
|
2045
|
-
return;
|
|
2046
|
-
/**
|
|
2047
|
-
* if new value isn't object then just overwrite by new value
|
|
2048
|
-
* instead of extending.
|
|
2049
|
-
*/
|
|
2050
|
-
}
|
|
2051
|
-
else if (typeof val !== 'object' || val === null) {
|
|
2052
|
-
target[key] = val;
|
|
2053
|
-
return;
|
|
2054
|
-
// just clone arrays (and recursive clone objects inside)
|
|
2055
|
-
}
|
|
2056
|
-
else if (Array.isArray(val)) {
|
|
2057
|
-
target[key] = [...val];
|
|
2058
|
-
return;
|
|
2059
|
-
// overwrite by new value if source isn't object or array
|
|
2060
|
-
}
|
|
2061
|
-
else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
|
|
2062
|
-
target[key] = deepExtend({}, val);
|
|
2063
|
-
return;
|
|
2064
|
-
// source value and new value is objects both, extending...
|
|
2065
|
-
}
|
|
2066
|
-
else {
|
|
2067
|
-
target[key] = deepExtend(src, val);
|
|
2068
|
-
return;
|
|
2069
|
-
}
|
|
2070
|
-
});
|
|
2071
|
-
});
|
|
2072
|
-
return target;
|
|
2073
|
-
};
|
|
2074
|
-
class Deferred {
|
|
2075
|
-
constructor() {
|
|
2076
|
-
this.promise = new Promise((resolve, reject) => {
|
|
2077
|
-
this.resolve = resolve;
|
|
2078
|
-
this.reject = reject;
|
|
2079
|
-
});
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
// getDeepFromObject({result: {data: 1}}, 'result.data', 2); // returns 1
|
|
2083
|
-
function getDeepFromObject(object = {}, name, defaultValue = null) {
|
|
2084
|
-
const keys = name.split('.');
|
|
2085
|
-
// clone the object
|
|
2086
|
-
let level = deepExtend({}, object);
|
|
2087
|
-
keys.forEach((k) => {
|
|
2088
|
-
if (level && typeof level[k] !== 'undefined') {
|
|
2089
|
-
level = level[k];
|
|
2090
|
-
}
|
|
2091
|
-
});
|
|
2092
|
-
return typeof level === 'undefined' ? defaultValue : level;
|
|
2093
|
-
}
|
|
2094
|
-
function getPageForRowIndex(index, perPage) {
|
|
2095
|
-
// we need to add 1 to convert 0-based index to 1-based page number.
|
|
2096
|
-
return Math.floor(index / perPage) + 1;
|
|
2097
|
-
}
|
|
2098
|
-
|
|
2099
|
-
function prepareValue(value) { return value; }
|
|
2100
|
-
class Cell {
|
|
2101
|
-
constructor(value, row, column, dataSet) {
|
|
2102
|
-
this.value = value;
|
|
2103
|
-
this.row = row;
|
|
2104
|
-
this.column = column;
|
|
2105
|
-
this.dataSet = dataSet;
|
|
2106
|
-
this.newValue = '';
|
|
2107
|
-
this.newValue = value;
|
|
2108
|
-
}
|
|
2109
|
-
getColumn() {
|
|
2110
|
-
return this.column;
|
|
2111
|
-
}
|
|
2112
|
-
getRow() {
|
|
2113
|
-
return this.row;
|
|
2114
|
-
}
|
|
2115
|
-
getValue() {
|
|
2116
|
-
const valid = this.column.getValuePrepareFunction() instanceof Function;
|
|
2117
|
-
const prepare = valid ? this.column.getValuePrepareFunction() : Cell.PREPARE;
|
|
2118
|
-
return prepare.call(null, this.value, this.row.getData(), this);
|
|
2119
|
-
}
|
|
2120
|
-
setValue(value) {
|
|
2121
|
-
this.newValue = value;
|
|
2122
|
-
}
|
|
2123
|
-
getId() {
|
|
2124
|
-
return this.getColumn().id;
|
|
2125
|
-
}
|
|
2126
|
-
getTitle() {
|
|
2127
|
-
return this.getColumn().title;
|
|
2128
|
-
}
|
|
2129
|
-
isEditable() {
|
|
2130
|
-
if (this.getRow().index === -1) {
|
|
2131
|
-
return this.getColumn().isAddable;
|
|
2132
|
-
}
|
|
2133
|
-
else {
|
|
2134
|
-
return this.getColumn().isEditable;
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
Cell.PREPARE = prepareValue;
|
|
2139
|
-
|
|
2140
|
-
class Row {
|
|
2141
|
-
constructor(index, data, _dataSet) {
|
|
2142
|
-
this.index = index;
|
|
2143
|
-
this.data = data;
|
|
2144
|
-
this._dataSet = _dataSet;
|
|
2145
|
-
this.isSelected = false;
|
|
2146
|
-
this.isInEditing = false;
|
|
2147
|
-
this.cells = [];
|
|
2148
|
-
this.process();
|
|
2149
|
-
}
|
|
2150
|
-
getCell(column) {
|
|
2151
|
-
return this.cells.find(el => el.getColumn() === column);
|
|
2152
|
-
}
|
|
2153
|
-
getCells() {
|
|
2154
|
-
return this.cells;
|
|
2155
|
-
}
|
|
2156
|
-
getData() {
|
|
2157
|
-
return this.data;
|
|
2158
|
-
}
|
|
2159
|
-
getIsSelected() {
|
|
2160
|
-
return this.isSelected;
|
|
2161
|
-
}
|
|
2162
|
-
getNewData() {
|
|
2163
|
-
const values = Object.assign({}, this.data);
|
|
2164
|
-
this.getCells().forEach((cell) => values[cell.getColumn().id] = cell.newValue);
|
|
2165
|
-
return values;
|
|
2166
|
-
}
|
|
2167
|
-
setData(data) {
|
|
2168
|
-
this.data = data;
|
|
2169
|
-
this.process();
|
|
2170
|
-
}
|
|
2171
|
-
process() {
|
|
2172
|
-
this.cells = [];
|
|
2173
|
-
this._dataSet.getColumns().forEach((column) => {
|
|
2174
|
-
const cell = this.createCell(column);
|
|
2175
|
-
this.cells.push(cell);
|
|
2176
|
-
});
|
|
2177
|
-
}
|
|
2178
|
-
createCell(column) {
|
|
2179
|
-
const defValue = column.settings.defaultValue ? column.settings.defaultValue : '';
|
|
2180
|
-
const value = typeof this.data[column.id] === 'undefined' ? defValue : this.data[column.id];
|
|
2181
|
-
return new Cell(value, this, column, this._dataSet);
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
class Column {
|
|
2186
|
-
constructor(id, settings, dataSet) {
|
|
2187
|
-
this.id = id;
|
|
2188
|
-
this.settings = settings;
|
|
2189
|
-
this.dataSet = dataSet;
|
|
2190
|
-
this.title = '';
|
|
2191
|
-
this.type = 'text';
|
|
2192
|
-
this.class = '';
|
|
2193
|
-
this.width = '';
|
|
2194
|
-
this.hide = false;
|
|
2195
|
-
this.isSortable = false;
|
|
2196
|
-
this.isEditable = true;
|
|
2197
|
-
this.isAddable = true;
|
|
2198
|
-
this.isFilterable = false;
|
|
2199
|
-
this.sortDirection = 'asc';
|
|
2200
|
-
this.defaultSortDirection = false;
|
|
2201
|
-
this.editor = false;
|
|
2202
|
-
this.filter = false;
|
|
2203
|
-
this.process();
|
|
2204
|
-
}
|
|
2205
|
-
getCompareFunction() {
|
|
2206
|
-
return this.compareFunction;
|
|
2207
|
-
}
|
|
2208
|
-
getValuePrepareFunction() {
|
|
2209
|
-
return this.valuePrepareFunction;
|
|
2210
|
-
}
|
|
2211
|
-
getFilterFunction() {
|
|
2212
|
-
return this.filterFunction;
|
|
2213
|
-
}
|
|
2214
|
-
getConfig() {
|
|
2215
|
-
var _a;
|
|
2216
|
-
if (this.editor && (this.editor.type === 'checkbox' || this.editor.type === 'custom' || this.editor.type === 'list')) {
|
|
2217
|
-
return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.config;
|
|
2218
|
-
}
|
|
2219
|
-
return false;
|
|
2220
|
-
}
|
|
2221
|
-
getFilterType() {
|
|
2222
|
-
return this.filter && this.filter.type;
|
|
2223
|
-
}
|
|
2224
|
-
getFilterConfig() {
|
|
2225
|
-
var _a;
|
|
2226
|
-
if (this.filter && (this.filter.type === 'checkbox' || this.filter.type === 'custom' || this.filter.type === 'list')) {
|
|
2227
|
-
return (_a = this.filter) === null || _a === void 0 ? void 0 : _a.config;
|
|
2228
|
-
}
|
|
2229
|
-
return false;
|
|
2230
|
-
}
|
|
2231
|
-
process() {
|
|
2232
|
-
var _a, _b, _c;
|
|
2233
|
-
this.title = this.settings.title;
|
|
2234
|
-
this.class = this.settings.class || '';
|
|
2235
|
-
this.width = this.settings.width || '';
|
|
2236
|
-
this.hide = !!this.settings.hide;
|
|
2237
|
-
this.type = this.settings.type;
|
|
2238
|
-
if ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.editor) {
|
|
2239
|
-
this.editor = this.settings.editor;
|
|
2240
|
-
}
|
|
2241
|
-
if ((_b = this.settings) === null || _b === void 0 ? void 0 : _b.filter) {
|
|
2242
|
-
this.filter = this.settings.filter;
|
|
2243
|
-
}
|
|
2244
|
-
if (this.settings.type === 'custom' && this.settings.renderComponent) {
|
|
2245
|
-
this.renderComponent = this.settings.renderComponent;
|
|
2246
|
-
}
|
|
2247
|
-
this.isFilterable = typeof this.settings.filter === 'undefined' ? true : !!this.settings['filter'];
|
|
2248
|
-
this.defaultSortDirection = ((_c = this.settings) === null || _c === void 0 ? void 0 : _c.sortDirection) || false;
|
|
2249
|
-
this.isSortable = typeof this.settings.sort === 'undefined' ? true : this.settings.sort;
|
|
2250
|
-
this.isEditable = typeof this.settings.editable === 'undefined' ? true : this.settings.editable;
|
|
2251
|
-
this.isAddable = typeof this.settings.addable === 'undefined' ? true : this.settings.addable;
|
|
2252
|
-
this.sortDirection = this.prepareSortDirection();
|
|
2253
|
-
this.compareFunction = this.settings.compareFunction;
|
|
2254
|
-
this.valuePrepareFunction = this.settings.valuePrepareFunction;
|
|
2255
|
-
this.filterFunction = this.settings.filterFunction;
|
|
2256
|
-
}
|
|
2257
|
-
prepareSortDirection() {
|
|
2258
|
-
return this.defaultSortDirection === 'desc' ? 'desc' : 'asc';
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
|
-
class DataSet {
|
|
2263
|
-
constructor(data = [], columnSettings) {
|
|
2264
|
-
this.columnSettings = columnSettings;
|
|
2265
|
-
this.data = [];
|
|
2266
|
-
this.columns = [];
|
|
2267
|
-
this.rows = [];
|
|
2268
|
-
this.selectedRows = new Set();
|
|
2269
|
-
this.createColumns(columnSettings);
|
|
2270
|
-
this.setData(data);
|
|
2271
|
-
this.createNewRow();
|
|
2272
|
-
}
|
|
2273
|
-
setData(data) {
|
|
2274
|
-
this.data = data;
|
|
2275
|
-
this.createRows();
|
|
2276
|
-
}
|
|
2277
|
-
getColumns() {
|
|
2278
|
-
return this.columns;
|
|
2279
|
-
}
|
|
2280
|
-
getRows() {
|
|
2281
|
-
return this.rows;
|
|
2282
|
-
}
|
|
2283
|
-
getFirstRow() {
|
|
2284
|
-
return this.rows[0];
|
|
2285
|
-
}
|
|
2286
|
-
getLastRow() {
|
|
2287
|
-
return this.rows[this.rows.length - 1];
|
|
2288
|
-
}
|
|
2289
|
-
findRowByData(data) {
|
|
2290
|
-
return this.rows.find((row) => row.getData() === data);
|
|
2291
|
-
}
|
|
2292
|
-
setSelectAll(state) {
|
|
2293
|
-
this.rows.forEach((row) => {
|
|
2294
|
-
row.isSelected = state;
|
|
2295
|
-
this.storeSelectedRow(row);
|
|
2296
|
-
});
|
|
2297
|
-
}
|
|
2298
|
-
deselectAll() {
|
|
2299
|
-
this.rows.forEach((row) => {
|
|
2300
|
-
row.isSelected = false;
|
|
2301
|
-
});
|
|
2302
|
-
// we need to clear selectedRow field because no one row selected
|
|
2303
|
-
this.selectedRows.clear();
|
|
2304
|
-
}
|
|
2305
|
-
selectRow(row, state) {
|
|
2306
|
-
row.isSelected = state;
|
|
2307
|
-
this.storeSelectedRow(row);
|
|
2308
|
-
}
|
|
2309
|
-
multipleSelectRow(row) {
|
|
2310
|
-
row.isSelected = !row.isSelected;
|
|
2311
|
-
this.storeSelectedRow(row);
|
|
2312
|
-
return row;
|
|
2313
|
-
}
|
|
2314
|
-
getSelectedRowsData() {
|
|
2315
|
-
return [...this.selectedRows];
|
|
2316
|
-
}
|
|
2317
|
-
createNewRow() {
|
|
2318
|
-
this.newRow = new Row(-1, {}, this);
|
|
2319
|
-
this.newRow.isInEditing = true;
|
|
2320
|
-
}
|
|
2321
|
-
/**
|
|
2322
|
-
* Create columns by mapping from the settings
|
|
2323
|
-
* @param settings
|
|
2324
|
-
* @private
|
|
2325
|
-
*/
|
|
2326
|
-
createColumns(settings) {
|
|
2327
|
-
settings.forEach((columnSettings) => {
|
|
2328
|
-
this.columns.push(new Column(columnSettings.key, columnSettings, this));
|
|
2329
|
-
});
|
|
2330
|
-
}
|
|
2331
|
-
/**
|
|
2332
|
-
* Create rows based on current data prepared in data source
|
|
2333
|
-
* @private
|
|
2334
|
-
*/
|
|
2335
|
-
createRows() {
|
|
2336
|
-
this.rows = [];
|
|
2337
|
-
this.data.forEach((el, index) => {
|
|
2338
|
-
const row = new Row(index, el, this);
|
|
2339
|
-
row.isSelected = this.selectedRows.has(row.getData());
|
|
2340
|
-
this.rows.push(row);
|
|
2341
|
-
});
|
|
2342
|
-
}
|
|
2343
|
-
get isAllSelected() {
|
|
2344
|
-
return this.rows.every((row) => row.isSelected);
|
|
2345
|
-
}
|
|
2346
|
-
storeSelectedRow(row) {
|
|
2347
|
-
if (row.isSelected) {
|
|
2348
|
-
this.selectedRows.add(row.getData());
|
|
2349
|
-
}
|
|
2350
|
-
else {
|
|
2351
|
-
this.selectedRows.delete(row.getData());
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
|
|
2356
|
-
class Grid {
|
|
2357
|
-
constructor(source, settings) {
|
|
2358
|
-
this.createFormShown = false;
|
|
2359
|
-
this.onSelectRowSource = new Subject();
|
|
2360
|
-
this.onDeselectRowSource = new Subject();
|
|
2361
|
-
this.setSettings(settings);
|
|
2362
|
-
this.setSource(source);
|
|
2363
|
-
}
|
|
2364
|
-
detach() {
|
|
2365
|
-
if (this.sourceOnChangedSubscription) {
|
|
2366
|
-
this.sourceOnChangedSubscription.unsubscribe();
|
|
2367
|
-
}
|
|
2368
|
-
if (this.sourceOnUpdatedSubscription) {
|
|
2369
|
-
this.sourceOnUpdatedSubscription.unsubscribe();
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
showActionColumn(position) {
|
|
2373
|
-
return this.isCurrentActionsPosition(position) && this.isActionsVisible();
|
|
2374
|
-
}
|
|
2375
|
-
isCurrentActionsPosition(position) {
|
|
2376
|
-
return position == this.getSetting("actions.position");
|
|
2377
|
-
}
|
|
2378
|
-
isActionsVisible() {
|
|
2379
|
-
var _a;
|
|
2380
|
-
return (this.getSetting("actions.add", false) ||
|
|
2381
|
-
this.getSetting("actions.edit", false) ||
|
|
2382
|
-
this.getSetting("actions.delete", false) ||
|
|
2383
|
-
!!((_a = this.getSetting("actions.custom", [])) === null || _a === void 0 ? void 0 : _a.length));
|
|
2384
|
-
}
|
|
2385
|
-
isMultiSelectVisible() {
|
|
2386
|
-
return this.getSetting("selectMode") === "multi";
|
|
2387
|
-
}
|
|
2388
|
-
getNewRow() {
|
|
2389
|
-
return this.dataSet.newRow;
|
|
2390
|
-
}
|
|
2391
|
-
setSettings(settings) {
|
|
2392
|
-
this.settings = settings;
|
|
2393
|
-
this.dataSet = new DataSet([], this.getSetting("columns"));
|
|
2394
|
-
if (this.source) {
|
|
2395
|
-
this.source.refresh();
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
getDataSet() {
|
|
2399
|
-
return this.dataSet;
|
|
2400
|
-
}
|
|
2401
|
-
setSource(source) {
|
|
2402
|
-
this.source = this.prepareSource(source);
|
|
2403
|
-
this.detach();
|
|
2404
|
-
this.sourceOnChangedSubscription = this.source
|
|
2405
|
-
.onChanged()
|
|
2406
|
-
.subscribe((changes) => this.processDataChange(changes));
|
|
2407
|
-
this.sourceOnUpdatedSubscription = this.source
|
|
2408
|
-
.onUpdated()
|
|
2409
|
-
.subscribe((data) => {
|
|
2410
|
-
const changedRow = this.dataSet.findRowByData(data);
|
|
2411
|
-
if (changedRow) {
|
|
2412
|
-
changedRow.setData(data);
|
|
2413
|
-
}
|
|
2414
|
-
});
|
|
2415
|
-
}
|
|
2416
|
-
getSetting(name, defaultValue) {
|
|
2417
|
-
return getDeepFromObject(this.settings, name, defaultValue);
|
|
2418
|
-
}
|
|
2419
|
-
getColumns() {
|
|
2420
|
-
return this.dataSet.getColumns();
|
|
2421
|
-
}
|
|
2422
|
-
getRows() {
|
|
2423
|
-
return this.dataSet.getRows();
|
|
2424
|
-
}
|
|
2425
|
-
selectRow(row, state) {
|
|
2426
|
-
this.dataSet.selectRow(row, state);
|
|
2427
|
-
}
|
|
2428
|
-
multipleSelectRow(row) {
|
|
2429
|
-
this.dataSet.multipleSelectRow(row);
|
|
2430
|
-
}
|
|
2431
|
-
onSelectRow() {
|
|
2432
|
-
return this.onSelectRowSource.asObservable();
|
|
2433
|
-
}
|
|
2434
|
-
onDeselectRow() {
|
|
2435
|
-
return this.onDeselectRowSource.asObservable();
|
|
2436
|
-
}
|
|
2437
|
-
edit(row) {
|
|
2438
|
-
row.isInEditing = true;
|
|
2439
|
-
}
|
|
2440
|
-
create(row, confirmEmitter) {
|
|
2441
|
-
const deferred = new Deferred();
|
|
2442
|
-
deferred.promise
|
|
2443
|
-
.then((newData) => {
|
|
2444
|
-
newData = newData ? newData : row.getNewData();
|
|
2445
|
-
this.source.prepend(newData).then(() => {
|
|
2446
|
-
this.createFormShown = false;
|
|
2447
|
-
this.dataSet.createNewRow();
|
|
2448
|
-
});
|
|
2449
|
-
})
|
|
2450
|
-
.catch((err) => {
|
|
2451
|
-
// doing nothing
|
|
2452
|
-
});
|
|
2453
|
-
if (this.getSetting("add.confirmCreate")) {
|
|
2454
|
-
confirmEmitter.emit({
|
|
2455
|
-
newData: row.getNewData(),
|
|
2456
|
-
source: this.source,
|
|
2457
|
-
confirm: deferred,
|
|
2458
|
-
});
|
|
2459
|
-
}
|
|
2460
|
-
else {
|
|
2461
|
-
deferred.resolve();
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2464
|
-
save(row, confirmEmitter) {
|
|
2465
|
-
const deferred = new Deferred();
|
|
2466
|
-
deferred.promise
|
|
2467
|
-
.then((newData) => {
|
|
2468
|
-
newData = newData ? newData : row.getNewData();
|
|
2469
|
-
this.source.update(row.getData(), newData).then(() => {
|
|
2470
|
-
row.isInEditing = false;
|
|
2471
|
-
});
|
|
2472
|
-
})
|
|
2473
|
-
.catch((err) => {
|
|
2474
|
-
// doing nothing
|
|
2475
|
-
});
|
|
2476
|
-
if (this.getSetting("edit.confirmSave")) {
|
|
2477
|
-
confirmEmitter.emit({
|
|
2478
|
-
data: row.getData(),
|
|
2479
|
-
newData: row.getNewData(),
|
|
2480
|
-
source: this.source,
|
|
2481
|
-
confirm: deferred,
|
|
2482
|
-
});
|
|
2483
|
-
}
|
|
2484
|
-
else {
|
|
2485
|
-
deferred.resolve();
|
|
2486
|
-
}
|
|
2487
|
-
}
|
|
2488
|
-
delete(row, confirmEmitter) {
|
|
2489
|
-
const deferred = new Deferred();
|
|
2490
|
-
deferred.promise
|
|
2491
|
-
.then(() => {
|
|
2492
|
-
this.source.remove(row.getData());
|
|
2493
|
-
})
|
|
2494
|
-
.catch((err) => {
|
|
2495
|
-
// doing nothing
|
|
2496
|
-
});
|
|
2497
|
-
if (this.getSetting("delete.confirmDelete")) {
|
|
2498
|
-
confirmEmitter.emit({
|
|
2499
|
-
data: row.getData(),
|
|
2500
|
-
source: this.source,
|
|
2501
|
-
confirm: deferred,
|
|
2502
|
-
});
|
|
2503
|
-
}
|
|
2504
|
-
else {
|
|
2505
|
-
deferred.resolve();
|
|
2506
|
-
}
|
|
2507
|
-
if (row.isSelected) {
|
|
2508
|
-
this.dataSet.selectRow(row, false);
|
|
2509
|
-
}
|
|
2510
|
-
}
|
|
2511
|
-
processDataChange(changes) {
|
|
2512
|
-
if (this.shouldProcessChange(changes)) {
|
|
2513
|
-
if (changes["action"] === "load") {
|
|
2514
|
-
this.dataSet.deselectAll();
|
|
2515
|
-
}
|
|
2516
|
-
this.dataSet.setData(changes["elements"]);
|
|
2517
|
-
}
|
|
2518
|
-
}
|
|
2519
|
-
shouldProcessChange(changes) {
|
|
2520
|
-
if (["filter", "sort", "page", "remove", "refresh", "load", "paging"].indexOf(changes["action"]) !== -1) {
|
|
2521
|
-
return true;
|
|
2522
|
-
}
|
|
2523
|
-
else if (["prepend", "append"].indexOf(changes["action"]) !== -1 &&
|
|
2524
|
-
!this.getSetting("pager.display")) {
|
|
2525
|
-
return true;
|
|
2526
|
-
}
|
|
2527
|
-
return false;
|
|
2528
|
-
}
|
|
2529
|
-
prepareSource(source) {
|
|
2530
|
-
const initialSort = this.getInitialSort();
|
|
2531
|
-
if (initialSort) {
|
|
2532
|
-
source.setSort([initialSort], false);
|
|
2533
|
-
}
|
|
2534
|
-
if (this.getSetting("pager.display") === true) {
|
|
2535
|
-
source.setPaging(1, this.getSetting("pager.perPage"), false);
|
|
2536
|
-
}
|
|
2537
|
-
source.refresh();
|
|
2538
|
-
return source;
|
|
2539
|
-
}
|
|
2540
|
-
getInitialSort() {
|
|
2541
|
-
const defaultSortColumn = this.getColumns().find((column) => column.isSortable && column.defaultSortDirection);
|
|
2542
|
-
if (!defaultSortColumn) {
|
|
2543
|
-
return false;
|
|
2544
|
-
}
|
|
2545
|
-
return {
|
|
2546
|
-
field: defaultSortColumn.id,
|
|
2547
|
-
direction: defaultSortColumn.defaultSortDirection || "asc",
|
|
2548
|
-
compare: defaultSortColumn.getCompareFunction(),
|
|
2549
|
-
};
|
|
2550
|
-
}
|
|
2551
|
-
getSelectedRowsData() {
|
|
2552
|
-
return this.dataSet.getRows();
|
|
2553
|
-
}
|
|
2554
|
-
selectAllRows(status) {
|
|
2555
|
-
this.dataSet.setSelectAll(status);
|
|
2556
|
-
}
|
|
2557
|
-
getFirstRow() {
|
|
2558
|
-
return this.dataSet.getFirstRow();
|
|
2559
|
-
}
|
|
2560
|
-
getLastRow() {
|
|
2561
|
-
return this.dataSet.getLastRow();
|
|
2562
|
-
}
|
|
2563
|
-
}
|
|
2564
|
-
|
|
2565
|
-
function compareValues(direction, a, b) {
|
|
2566
|
-
if (a < b) {
|
|
2567
|
-
return -1 * direction;
|
|
2568
|
-
}
|
|
2569
|
-
if (a > b) {
|
|
2570
|
-
return direction;
|
|
2571
|
-
}
|
|
2572
|
-
return 0;
|
|
2573
|
-
}
|
|
2574
|
-
class LocalSorter {
|
|
2575
|
-
static sort(data, field, direction, customCompare) {
|
|
2576
|
-
const dir = (direction === 'asc') ? 1 : -1;
|
|
2577
|
-
const compare = customCompare ? customCompare : compareValues;
|
|
2578
|
-
return data.sort((a, b) => {
|
|
2579
|
-
return compare.call(null, dir, a[field], b[field]);
|
|
2580
|
-
});
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
|
|
2584
|
-
function filterValues(value, search) {
|
|
2585
|
-
return value.toString().toLowerCase().includes(search.toString().toLowerCase());
|
|
2586
|
-
}
|
|
2587
|
-
class LocalFilter {
|
|
2588
|
-
static filter(data, field, search, customFilter) {
|
|
2589
|
-
const filter = customFilter ? customFilter : filterValues;
|
|
2590
|
-
return data.filter((el) => {
|
|
2591
|
-
const value = typeof el[field] === 'undefined' || el[field] === null ? '' : el[field];
|
|
2592
|
-
return filter.call(null, value, search);
|
|
2593
|
-
});
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
class LocalPager {
|
|
2598
|
-
static paginate(data, page, perPage) {
|
|
2599
|
-
return data.slice(perPage * (page - 1), perPage * page);
|
|
2600
|
-
}
|
|
2601
|
-
}
|
|
2602
|
-
|
|
2603
|
-
var SmartTableOnChangedEventName;
|
|
2604
|
-
(function (SmartTableOnChangedEventName) {
|
|
2605
|
-
SmartTableOnChangedEventName["load"] = "load";
|
|
2606
|
-
SmartTableOnChangedEventName["paging"] = "paging";
|
|
2607
|
-
SmartTableOnChangedEventName["update"] = "update";
|
|
2608
|
-
SmartTableOnChangedEventName["page"] = "page";
|
|
2609
|
-
SmartTableOnChangedEventName["filter"] = "filter";
|
|
2610
|
-
SmartTableOnChangedEventName["empty"] = "empty";
|
|
2611
|
-
SmartTableOnChangedEventName["sort"] = "sort";
|
|
2612
|
-
SmartTableOnChangedEventName["add"] = "add";
|
|
2613
|
-
SmartTableOnChangedEventName["remove"] = "remove";
|
|
2614
|
-
SmartTableOnChangedEventName["append"] = "append";
|
|
2615
|
-
SmartTableOnChangedEventName["prepend"] = "prepend";
|
|
2616
|
-
SmartTableOnChangedEventName["refresh"] = "refresh";
|
|
2617
|
-
})(SmartTableOnChangedEventName || (SmartTableOnChangedEventName = {}));
|
|
2618
|
-
|
|
2619
|
-
class DataSource {
|
|
2620
|
-
constructor() {
|
|
2621
|
-
this.onChangedSource = new Subject();
|
|
2622
|
-
this.onAddedSource = new Subject();
|
|
2623
|
-
this.onUpdatedSource = new Subject();
|
|
2624
|
-
this.onRemovedSource = new Subject();
|
|
2625
|
-
}
|
|
2626
|
-
refresh() {
|
|
2627
|
-
this.emitOnChanged(SmartTableOnChangedEventName.refresh);
|
|
2628
|
-
}
|
|
2629
|
-
loadEmit() {
|
|
2630
|
-
this.emitOnChanged(SmartTableOnChangedEventName.load);
|
|
2631
|
-
return Promise.resolve(true);
|
|
2632
|
-
}
|
|
2633
|
-
onChanged() {
|
|
2634
|
-
return this.onChangedSource.asObservable();
|
|
2635
|
-
}
|
|
2636
|
-
onAdded() {
|
|
2637
|
-
return this.onAddedSource.asObservable();
|
|
2638
|
-
}
|
|
2639
|
-
onUpdated() {
|
|
2640
|
-
return this.onUpdatedSource.asObservable();
|
|
2641
|
-
}
|
|
2642
|
-
onRemoved() {
|
|
2643
|
-
return this.onRemovedSource.asObservable();
|
|
2644
|
-
}
|
|
2645
|
-
prependEmit(element) {
|
|
2646
|
-
this.emitOnAdded(element);
|
|
2647
|
-
this.emitOnChanged(SmartTableOnChangedEventName.prepend);
|
|
2648
|
-
return Promise.resolve(true);
|
|
2649
|
-
}
|
|
2650
|
-
appendEmit(element) {
|
|
2651
|
-
this.emitOnAdded(element);
|
|
2652
|
-
this.emitOnChanged(SmartTableOnChangedEventName.append);
|
|
2653
|
-
return Promise.resolve(true);
|
|
2654
|
-
}
|
|
2655
|
-
addEmit(element) {
|
|
2656
|
-
this.emitOnAdded(element);
|
|
2657
|
-
this.emitOnChanged(SmartTableOnChangedEventName.add);
|
|
2658
|
-
return Promise.resolve(true);
|
|
2659
|
-
}
|
|
2660
|
-
removeEmit(element) {
|
|
2661
|
-
this.emitOnRemoved(element);
|
|
2662
|
-
this.emitOnChanged(SmartTableOnChangedEventName.remove);
|
|
2663
|
-
return Promise.resolve(true);
|
|
2664
|
-
}
|
|
2665
|
-
updateEmit(element) {
|
|
2666
|
-
this.emitOnUpdated(element);
|
|
2667
|
-
this.emitOnChanged(SmartTableOnChangedEventName.update);
|
|
2668
|
-
return Promise.resolve(true);
|
|
2669
|
-
}
|
|
2670
|
-
emptyEmit() {
|
|
2671
|
-
this.emitOnChanged(SmartTableOnChangedEventName.empty);
|
|
2672
|
-
return Promise.resolve(true);
|
|
2673
|
-
}
|
|
2674
|
-
setSortEmit() {
|
|
2675
|
-
this.emitOnChanged(SmartTableOnChangedEventName.sort);
|
|
2676
|
-
}
|
|
2677
|
-
setFilterEmit() {
|
|
2678
|
-
this.emitOnChanged(SmartTableOnChangedEventName.filter);
|
|
2679
|
-
}
|
|
2680
|
-
addFilterEmit() {
|
|
2681
|
-
this.emitOnChanged(SmartTableOnChangedEventName.filter);
|
|
2682
|
-
}
|
|
2683
|
-
setPagingEmit() {
|
|
2684
|
-
this.emitOnChanged(SmartTableOnChangedEventName.paging);
|
|
2685
|
-
}
|
|
2686
|
-
setPageEmit() {
|
|
2687
|
-
this.emitOnChanged(SmartTableOnChangedEventName.page);
|
|
2688
|
-
}
|
|
2689
|
-
emitOnRemoved(element) {
|
|
2690
|
-
this.onRemovedSource.next(element);
|
|
2691
|
-
}
|
|
2692
|
-
emitOnUpdated(element) {
|
|
2693
|
-
this.onUpdatedSource.next(element);
|
|
2694
|
-
}
|
|
2695
|
-
emitOnAdded(element) {
|
|
2696
|
-
this.onAddedSource.next(element);
|
|
2697
|
-
}
|
|
2698
|
-
emitOnChanged(action) {
|
|
2699
|
-
this.getElements().then((elements) => this.onChangedSource.next({
|
|
2700
|
-
action: action,
|
|
2701
|
-
elements: elements,
|
|
2702
|
-
paging: this.getPaging(),
|
|
2703
|
-
filter: this.getFilter(),
|
|
2704
|
-
sort: this.getSort(),
|
|
2705
|
-
}));
|
|
2706
|
-
}
|
|
2707
|
-
}
|
|
2708
|
-
|
|
2709
|
-
class LocalDataSource extends DataSource {
|
|
2710
|
-
constructor(data = []) {
|
|
2711
|
-
super();
|
|
2712
|
-
this.data = [];
|
|
2713
|
-
this.filteredAndSorted = [];
|
|
2714
|
-
this.sortConf = [];
|
|
2715
|
-
this.filterConf = {
|
|
2716
|
-
filters: [],
|
|
2717
|
-
andOperator: true,
|
|
2718
|
-
};
|
|
2719
|
-
this.pagingConf = false;
|
|
2720
|
-
this.data = data;
|
|
2721
|
-
}
|
|
2722
|
-
load(data) {
|
|
2723
|
-
this.data = data;
|
|
2724
|
-
return super.loadEmit();
|
|
2725
|
-
}
|
|
2726
|
-
prepend(element) {
|
|
2727
|
-
this.reset(true);
|
|
2728
|
-
this.data.unshift(element);
|
|
2729
|
-
return super.prependEmit(element);
|
|
2730
|
-
}
|
|
2731
|
-
appendMany(elements) {
|
|
2732
|
-
this.reset(true);
|
|
2733
|
-
this.data = [...this.data, ...elements];
|
|
2734
|
-
return super.loadEmit();
|
|
2735
|
-
}
|
|
2736
|
-
append(element) {
|
|
2737
|
-
this.reset(true);
|
|
2738
|
-
this.data.push(element);
|
|
2739
|
-
return super.appendEmit(element);
|
|
2740
|
-
}
|
|
2741
|
-
add(element) {
|
|
2742
|
-
this.data.push(element);
|
|
2743
|
-
return super.addEmit(element);
|
|
2744
|
-
}
|
|
2745
|
-
remove(element) {
|
|
2746
|
-
this.data = this.data.filter(el => el !== element);
|
|
2747
|
-
return super.removeEmit(element);
|
|
2748
|
-
}
|
|
2749
|
-
update(element, values) {
|
|
2750
|
-
return new Promise((resolve, reject) => {
|
|
2751
|
-
this.find(element).then((found) => {
|
|
2752
|
-
found = deepExtend(found, values);
|
|
2753
|
-
super.updateEmit(found).then(resolve).catch(reject);
|
|
2754
|
-
}).catch(reject);
|
|
2755
|
-
});
|
|
2756
|
-
}
|
|
2757
|
-
find(element) {
|
|
2758
|
-
const found = this.data.find(el => el === element);
|
|
2759
|
-
if (found) {
|
|
2760
|
-
return Promise.resolve(found);
|
|
2761
|
-
}
|
|
2762
|
-
return Promise.reject(new Error('Element was not found in the dataset'));
|
|
2763
|
-
}
|
|
2764
|
-
getElements() {
|
|
2765
|
-
const data = this.data.slice(0);
|
|
2766
|
-
return Promise.resolve(this.prepareData(data));
|
|
2767
|
-
}
|
|
2768
|
-
getFilteredAndSorted() {
|
|
2769
|
-
let data = this.data.slice(0);
|
|
2770
|
-
this.prepareData(data);
|
|
2771
|
-
return Promise.resolve(this.filteredAndSorted);
|
|
2772
|
-
}
|
|
2773
|
-
getAll() {
|
|
2774
|
-
const data = this.data.slice(0);
|
|
2775
|
-
return Promise.resolve(data);
|
|
2776
|
-
}
|
|
2777
|
-
reset(silent = false) {
|
|
2778
|
-
if (silent) {
|
|
2779
|
-
this.filterConf = {
|
|
2780
|
-
filters: [],
|
|
2781
|
-
andOperator: true,
|
|
2782
|
-
};
|
|
2783
|
-
this.sortConf = [];
|
|
2784
|
-
if (this.pagingConf) {
|
|
2785
|
-
this.pagingConf.page = 1;
|
|
2786
|
-
}
|
|
2787
|
-
}
|
|
2788
|
-
else {
|
|
2789
|
-
this.setFilter([], true, false);
|
|
2790
|
-
this.setSort([], false);
|
|
2791
|
-
if (this.pagingConf) {
|
|
2792
|
-
this.setPage(1);
|
|
2793
|
-
}
|
|
2794
|
-
}
|
|
2795
|
-
}
|
|
2796
|
-
empty() {
|
|
2797
|
-
this.data = [];
|
|
2798
|
-
return super.emptyEmit();
|
|
2799
|
-
}
|
|
2800
|
-
count() {
|
|
2801
|
-
return this.filteredAndSorted.length;
|
|
2802
|
-
}
|
|
2803
|
-
/**
|
|
2804
|
-
*
|
|
2805
|
-
* Array of conf objects
|
|
2806
|
-
* [
|
|
2807
|
-
* {field: string, direction: asc|desc|null, compare: Function|null},
|
|
2808
|
-
* ]
|
|
2809
|
-
* @param conf
|
|
2810
|
-
* @param doEmit
|
|
2811
|
-
* @returns {LocalDataSource}
|
|
2812
|
-
*/
|
|
2813
|
-
setSort(conf, doEmit = true) {
|
|
2814
|
-
if (conf !== null) {
|
|
2815
|
-
conf.forEach((fieldConf) => {
|
|
2816
|
-
if (!fieldConf.field || typeof fieldConf.direction === 'undefined') {
|
|
2817
|
-
throw new Error('Sort configuration object is not valid');
|
|
2818
|
-
}
|
|
2819
|
-
});
|
|
2820
|
-
this.sortConf = conf;
|
|
2821
|
-
}
|
|
2822
|
-
if (doEmit) {
|
|
2823
|
-
super.setSortEmit();
|
|
2824
|
-
}
|
|
2825
|
-
return this;
|
|
2826
|
-
}
|
|
2827
|
-
/**
|
|
2828
|
-
*
|
|
2829
|
-
* Array of conf objects
|
|
2830
|
-
* [
|
|
2831
|
-
* {field: string, search: string, filter: Function|null},
|
|
2832
|
-
* ]
|
|
2833
|
-
* @param conf
|
|
2834
|
-
* @param andOperator
|
|
2835
|
-
* @param doEmit
|
|
2836
|
-
* @returns {LocalDataSource}
|
|
2837
|
-
*/
|
|
2838
|
-
setFilter(conf, andOperator = true, doEmit = true) {
|
|
2839
|
-
if (conf && conf.length > 0) {
|
|
2840
|
-
conf.forEach((fieldConf) => {
|
|
2841
|
-
this.addFilter(fieldConf, andOperator, false);
|
|
2842
|
-
});
|
|
2843
|
-
}
|
|
2844
|
-
else {
|
|
2845
|
-
this.filterConf = {
|
|
2846
|
-
filters: [],
|
|
2847
|
-
andOperator: true,
|
|
2848
|
-
};
|
|
2849
|
-
}
|
|
2850
|
-
this.filterConf.andOperator = andOperator;
|
|
2851
|
-
if (this.pagingConf) {
|
|
2852
|
-
this.pagingConf.page = 1;
|
|
2853
|
-
}
|
|
2854
|
-
if (doEmit) {
|
|
2855
|
-
super.setFilterEmit();
|
|
2856
|
-
}
|
|
2857
|
-
return this;
|
|
2858
|
-
}
|
|
2859
|
-
addFilter(fieldConf, andOperator = true, doEmit = true) {
|
|
2860
|
-
if (!fieldConf.field || typeof fieldConf.search === 'undefined') {
|
|
2861
|
-
throw new Error('Filter configuration object is not valid');
|
|
2862
|
-
}
|
|
2863
|
-
let found = false;
|
|
2864
|
-
this.filterConf.filters.forEach((currentFieldConf, index) => {
|
|
2865
|
-
if (currentFieldConf.field === fieldConf.field) {
|
|
2866
|
-
this.filterConf.filters[index] = fieldConf;
|
|
2867
|
-
found = true;
|
|
2868
|
-
}
|
|
2869
|
-
});
|
|
2870
|
-
if (!found) {
|
|
2871
|
-
this.filterConf.filters.push(fieldConf);
|
|
2872
|
-
}
|
|
2873
|
-
this.filterConf.andOperator = andOperator;
|
|
2874
|
-
if (doEmit) {
|
|
2875
|
-
super.addFilterEmit();
|
|
2876
|
-
}
|
|
2877
|
-
return this;
|
|
2878
|
-
}
|
|
2879
|
-
setPaging(page = 1, perPage, doEmit = true) {
|
|
2880
|
-
if (this.pagingConf) {
|
|
2881
|
-
this.pagingConf.page = page;
|
|
2882
|
-
this.pagingConf.perPage = perPage;
|
|
2883
|
-
}
|
|
2884
|
-
else {
|
|
2885
|
-
this.pagingConf = {
|
|
2886
|
-
page, perPage
|
|
2887
|
-
};
|
|
2888
|
-
}
|
|
2889
|
-
if (doEmit) {
|
|
2890
|
-
super.setPagingEmit();
|
|
2891
|
-
}
|
|
2892
|
-
return;
|
|
2893
|
-
}
|
|
2894
|
-
setPage(page, doEmit = true) {
|
|
2895
|
-
if (!this.pagingConf) {
|
|
2896
|
-
return;
|
|
2897
|
-
}
|
|
2898
|
-
this.pagingConf.page = page;
|
|
2899
|
-
if (doEmit) {
|
|
2900
|
-
super.setPageEmit();
|
|
2901
|
-
}
|
|
2902
|
-
return;
|
|
2903
|
-
}
|
|
2904
|
-
getSort() {
|
|
2905
|
-
return this.sortConf;
|
|
2906
|
-
}
|
|
2907
|
-
getFilter() {
|
|
2908
|
-
return this.filterConf;
|
|
2909
|
-
}
|
|
2910
|
-
getPaging() {
|
|
2911
|
-
return this.pagingConf;
|
|
2912
|
-
}
|
|
2913
|
-
prepareData(data) {
|
|
2914
|
-
data = this.filter(data);
|
|
2915
|
-
data = this.sort(data);
|
|
2916
|
-
this.filteredAndSorted = data.slice(0);
|
|
2917
|
-
if (this.pagingConf) {
|
|
2918
|
-
return this.paginate(data);
|
|
2919
|
-
}
|
|
2920
|
-
else
|
|
2921
|
-
return data;
|
|
2922
|
-
}
|
|
2923
|
-
sort(data) {
|
|
2924
|
-
if (this.sortConf) {
|
|
2925
|
-
this.sortConf.forEach((fieldConf) => {
|
|
2926
|
-
data = LocalSorter
|
|
2927
|
-
.sort(data, fieldConf.field, fieldConf.direction, fieldConf.compare);
|
|
2928
|
-
});
|
|
2929
|
-
}
|
|
2930
|
-
return data;
|
|
2931
|
-
}
|
|
2932
|
-
// TODO: refactor?
|
|
2933
|
-
filter(data) {
|
|
2934
|
-
if (this.filterConf.filters) {
|
|
2935
|
-
if (this.filterConf.andOperator) {
|
|
2936
|
-
this.filterConf.filters.forEach((fieldConf) => {
|
|
2937
|
-
var _a;
|
|
2938
|
-
if (((_a = fieldConf.search) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
2939
|
-
data = LocalFilter
|
|
2940
|
-
.filter(data, fieldConf.field, fieldConf.search, fieldConf.filter);
|
|
2941
|
-
}
|
|
2942
|
-
});
|
|
2943
|
-
}
|
|
2944
|
-
else {
|
|
2945
|
-
let mergedData = [];
|
|
2946
|
-
this.filterConf.filters.forEach((fieldConf) => {
|
|
2947
|
-
var _a;
|
|
2948
|
-
if (((_a = fieldConf.search) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
2949
|
-
mergedData = mergedData.concat(LocalFilter
|
|
2950
|
-
.filter(data, fieldConf.field, fieldConf.search, fieldConf.filter));
|
|
2951
|
-
}
|
|
2952
|
-
});
|
|
2953
|
-
// remove non unique items
|
|
2954
|
-
data = mergedData.filter((elem, pos, arr) => {
|
|
2955
|
-
return arr.indexOf(elem) === pos;
|
|
2956
|
-
});
|
|
2957
|
-
}
|
|
2958
|
-
}
|
|
2959
|
-
return data;
|
|
2960
|
-
}
|
|
2961
|
-
paginate(data) {
|
|
2962
|
-
if (this.pagingConf && this.pagingConf.page && this.pagingConf.perPage) {
|
|
2963
|
-
data = LocalPager.paginate(data, this.pagingConf.page, this.pagingConf.perPage);
|
|
2964
|
-
}
|
|
2965
|
-
return data;
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
|
|
2969
|
-
class Ng2SmartTableComponent {
|
|
2970
|
-
constructor() {
|
|
2971
|
-
this.multiRowSelect = new EventEmitter();
|
|
2972
|
-
this.rowClicked = new EventEmitter();
|
|
2973
|
-
this.delete = new EventEmitter();
|
|
2974
|
-
this.edit = new EventEmitter();
|
|
2975
|
-
this.editCancel = new EventEmitter();
|
|
2976
|
-
this.create = new EventEmitter();
|
|
2977
|
-
this.custom = new EventEmitter();
|
|
2978
|
-
this.deleteConfirm = new EventEmitter();
|
|
2979
|
-
this.editConfirm = new EventEmitter();
|
|
2980
|
-
this.createConfirm = new EventEmitter();
|
|
2981
|
-
this.rowHover = new EventEmitter();
|
|
2982
|
-
this.tableClass = '';
|
|
2983
|
-
this.tableId = '';
|
|
2984
|
-
this.perPageSelect = [];
|
|
2985
|
-
this.isHideHeader = false;
|
|
2986
|
-
this.isHideSubHeader = false;
|
|
2987
|
-
this.isPagerDisplay = false;
|
|
2988
|
-
this.rowClassFunction = () => '';
|
|
2989
|
-
this.defaultSettings = {
|
|
2990
|
-
mode: 'inline',
|
|
2991
|
-
selectMode: 'single',
|
|
2992
|
-
selectedRowIndex: -1,
|
|
2993
|
-
switchPageToSelectedRowPage: false,
|
|
2994
|
-
hideHeader: false,
|
|
2995
|
-
hideSubHeader: false,
|
|
2996
|
-
actions: {
|
|
2997
|
-
columnTitle: 'Actions',
|
|
2998
|
-
add: true,
|
|
2999
|
-
edit: true,
|
|
3000
|
-
delete: true,
|
|
3001
|
-
custom: [],
|
|
3002
|
-
position: 'left', // left|right
|
|
3003
|
-
},
|
|
3004
|
-
filter: {
|
|
3005
|
-
inputClass: '',
|
|
3006
|
-
},
|
|
3007
|
-
edit: {
|
|
3008
|
-
inputClass: '',
|
|
3009
|
-
editButtonContent: 'Edit',
|
|
3010
|
-
saveButtonContent: 'Update',
|
|
3011
|
-
cancelButtonContent: 'Cancel',
|
|
3012
|
-
confirmSave: false,
|
|
3013
|
-
},
|
|
3014
|
-
add: {
|
|
3015
|
-
inputClass: '',
|
|
3016
|
-
addButtonContent: 'Add New',
|
|
3017
|
-
createButtonContent: 'Create',
|
|
3018
|
-
cancelButtonContent: 'Cancel',
|
|
3019
|
-
confirmCreate: false,
|
|
3020
|
-
},
|
|
3021
|
-
delete: {
|
|
3022
|
-
deleteButtonContent: 'Delete',
|
|
3023
|
-
confirmDelete: false,
|
|
3024
|
-
},
|
|
3025
|
-
attr: {
|
|
3026
|
-
id: '',
|
|
3027
|
-
class: '',
|
|
3028
|
-
},
|
|
3029
|
-
noDataMessage: 'No data found',
|
|
3030
|
-
columns: [],
|
|
3031
|
-
pager: false,
|
|
3032
|
-
rowClassFunction: () => '',
|
|
3033
|
-
};
|
|
3034
|
-
}
|
|
3035
|
-
ngOnChanges(changes) {
|
|
3036
|
-
if (this.grid) {
|
|
3037
|
-
if (changes['settings']) {
|
|
3038
|
-
this.grid.setSettings(this.prepareSettings());
|
|
3039
|
-
}
|
|
3040
|
-
if (changes['source']) {
|
|
3041
|
-
this.source = this.prepareSource();
|
|
3042
|
-
this.grid.setSource(this.source);
|
|
3043
|
-
}
|
|
3044
|
-
}
|
|
3045
|
-
else {
|
|
3046
|
-
this.initGrid();
|
|
3047
|
-
}
|
|
3048
|
-
this.tableId = this.grid.getSetting('attr.id');
|
|
3049
|
-
this.tableClass = this.grid.getSetting('attr.class');
|
|
3050
|
-
this.isHideHeader = this.grid.getSetting('hideHeader');
|
|
3051
|
-
this.isHideSubHeader = this.grid.getSetting('hideSubHeader');
|
|
3052
|
-
this.isPagerDisplay = this.grid.getSetting('pager.display', false);
|
|
3053
|
-
this.perPageSelect = this.grid.getSetting('pager.perPageSelect');
|
|
3054
|
-
this.rowClassFunction = this.grid.getSetting('rowClassFunction', () => '');
|
|
3055
|
-
}
|
|
3056
|
-
multipleSelectRow(row) {
|
|
3057
|
-
this.grid.multipleSelectRow(row);
|
|
3058
|
-
this.emitUserSelectRow(row);
|
|
3059
|
-
}
|
|
3060
|
-
onSelectAllRows() {
|
|
3061
|
-
this.grid.dataSet.isAllSelected;
|
|
3062
|
-
this.grid.selectAllRows(!this.grid.dataSet.isAllSelected);
|
|
3063
|
-
this.emitUserSelectRow(null);
|
|
3064
|
-
}
|
|
3065
|
-
onSelectRow(row, state) {
|
|
3066
|
-
this.grid.selectRow(row, state);
|
|
3067
|
-
}
|
|
3068
|
-
emitUserRowClicked(row) {
|
|
3069
|
-
this.rowClicked.emit({
|
|
3070
|
-
data: row ? row.getData() : null,
|
|
3071
|
-
source: this.source,
|
|
3072
|
-
});
|
|
3073
|
-
}
|
|
3074
|
-
initGrid() {
|
|
3075
|
-
this.source = this.prepareSource();
|
|
3076
|
-
this.grid = new Grid(this.source, this.prepareSettings());
|
|
3077
|
-
}
|
|
3078
|
-
prepareSource() {
|
|
3079
|
-
if (this.source instanceof LocalDataSource) {
|
|
3080
|
-
return this.source;
|
|
3081
|
-
}
|
|
3082
|
-
return new LocalDataSource();
|
|
3083
|
-
}
|
|
3084
|
-
prepareSettings() {
|
|
3085
|
-
return deepExtend({}, this.defaultSettings, this.settings);
|
|
3086
|
-
}
|
|
3087
|
-
emitUserSelectRow(row) {
|
|
3088
|
-
this.multiRowSelect.emit({
|
|
3089
|
-
data: row ? row.getData() : null,
|
|
3090
|
-
isSelected: row ? row.getIsSelected() : false,
|
|
3091
|
-
source: this.source,
|
|
3092
|
-
selected: this.grid.dataSet.getSelectedRowsData(),
|
|
3093
|
-
});
|
|
3094
|
-
}
|
|
3095
|
-
}
|
|
3096
|
-
Ng2SmartTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3097
|
-
Ng2SmartTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: Ng2SmartTableComponent, selector: "ng2-smart-table", inputs: { source: "source", settings: "settings" }, outputs: { multiRowSelect: "multiRowSelect", rowClicked: "rowClicked", delete: "delete", edit: "edit", editCancel: "editCancel", create: "create", custom: "custom", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", createConfirm: "createConfirm", rowHover: "rowHover" }, usesOnChanges: true, ngImport: i0, template: "<table [id]=\"tableId\" [ngClass]=\"tableClass\">\n\n <thead ng2-st-thead *ngIf=\"!isHideHeader || !isHideSubHeader\"\n [grid]=\"grid\"\n [source]=\"source\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\">\n </thead>\n\n <tbody ng2-st-tbody [grid]=\"grid\"\n [source]=\"source\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [rowClassFunction]=\"rowClassFunction\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\">\n </tbody>\n\n</table>\n\n<ng2-smart-table-pager *ngIf=\"isPagerDisplay\"\n [source]=\"source\"\n [perPageSelect]=\"perPageSelect\">\n</ng2-smart-table-pager>\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: PagerComponent, selector: "ng2-smart-table-pager", inputs: ["source", "perPageSelect"], outputs: ["changePage"] }, { kind: "component", type: Ng2SmartTableTbodyComponent, selector: "[ng2-st-tbody]", inputs: ["grid", "source", "deleteConfirm", "editConfirm", "rowClassFunction"], outputs: ["save", "cancel", "edit", "editCancel", "delete", "custom", "edited", "userSelectRow", "userClickedRow", "editRowSelect", "multipleSelectRow"] }, { kind: "component", type: Ng2SmartTableTheadComponent, selector: "[ng2-st-thead]", inputs: ["grid", "source", "createConfirm"], outputs: ["sort", "selectAllRows", "create", "filter"] }] });
|
|
3098
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableComponent, decorators: [{
|
|
3099
|
-
type: Component,
|
|
3100
|
-
args: [{ selector: 'ng2-smart-table', template: "<table [id]=\"tableId\" [ngClass]=\"tableClass\">\n\n <thead ng2-st-thead *ngIf=\"!isHideHeader || !isHideSubHeader\"\n [grid]=\"grid\"\n [source]=\"source\"\n [createConfirm]=\"createConfirm\"\n (create)=\"create.emit($event)\"\n (selectAllRows)=\"onSelectAllRows()\">\n </thead>\n\n <tbody ng2-st-tbody [grid]=\"grid\"\n [source]=\"source\"\n [deleteConfirm]=\"deleteConfirm\"\n [editConfirm]=\"editConfirm\"\n [rowClassFunction]=\"rowClassFunction\"\n (edit)=\"edit.emit($event)\"\n (editCancel)=\"editCancel.emit($event)\"\n (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\">\n </tbody>\n\n</table>\n\n<ng2-smart-table-pager *ngIf=\"isPagerDisplay\"\n [source]=\"source\"\n [perPageSelect]=\"perPageSelect\">\n</ng2-smart-table-pager>\n", styles: [":host{font-size:1rem}:host ::ng-deep *{box-sizing:border-box}:host ::ng-deep button,:host ::ng-deep input,:host ::ng-deep optgroup,:host ::ng-deep select,:host ::ng-deep textarea{color:inherit;font:inherit;margin:0}:host ::ng-deep table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;word-break:normal;word-break:keep-all;overflow:auto}:host ::ng-deep table tr th{font-weight:700}:host ::ng-deep table tr section{font-size:.75em;font-weight:700}:host ::ng-deep table tr td,:host ::ng-deep table tr th{font-size:.875em;margin:0;padding:.5em 1em}:host ::ng-deep a{color:#1e6bb8;text-decoration:none}:host ::ng-deep a:hover{text-decoration:underline}\n"] }]
|
|
3101
|
-
}], propDecorators: { source: [{
|
|
3102
|
-
type: Input
|
|
3103
|
-
}], settings: [{
|
|
3104
|
-
type: Input
|
|
3105
|
-
}], multiRowSelect: [{
|
|
3106
|
-
type: Output
|
|
3107
|
-
}], rowClicked: [{
|
|
3108
|
-
type: Output
|
|
3109
|
-
}], delete: [{
|
|
3110
|
-
type: Output
|
|
3111
|
-
}], edit: [{
|
|
3112
|
-
type: Output
|
|
3113
|
-
}], editCancel: [{
|
|
3114
|
-
type: Output
|
|
3115
|
-
}], create: [{
|
|
3116
|
-
type: Output
|
|
3117
|
-
}], custom: [{
|
|
3118
|
-
type: Output
|
|
3119
|
-
}], deleteConfirm: [{
|
|
3120
|
-
type: Output
|
|
3121
|
-
}], editConfirm: [{
|
|
3122
|
-
type: Output
|
|
3123
|
-
}], createConfirm: [{
|
|
3124
|
-
type: Output
|
|
3125
|
-
}], rowHover: [{
|
|
3126
|
-
type: Output
|
|
3127
|
-
}] } });
|
|
3128
|
-
|
|
3129
|
-
class Ng2SmartTableModule {
|
|
3130
|
-
}
|
|
3131
|
-
Ng2SmartTableModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3132
|
-
Ng2SmartTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableModule, declarations: [Ng2SmartTableComponent], imports: [CommonModule,
|
|
3133
|
-
FormsModule,
|
|
3134
|
-
ReactiveFormsModule,
|
|
3135
|
-
CellModule,
|
|
3136
|
-
FilterModule,
|
|
3137
|
-
PagerModule,
|
|
3138
|
-
TBodyModule,
|
|
3139
|
-
THeadModule], exports: [Ng2SmartTableComponent] });
|
|
3140
|
-
Ng2SmartTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableModule, imports: [CommonModule,
|
|
3141
|
-
FormsModule,
|
|
3142
|
-
ReactiveFormsModule,
|
|
3143
|
-
CellModule,
|
|
3144
|
-
FilterModule,
|
|
3145
|
-
PagerModule,
|
|
3146
|
-
TBodyModule,
|
|
3147
|
-
THeadModule] });
|
|
3148
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Ng2SmartTableModule, decorators: [{
|
|
3149
|
-
type: NgModule,
|
|
3150
|
-
args: [{
|
|
3151
|
-
imports: [
|
|
3152
|
-
CommonModule,
|
|
3153
|
-
FormsModule,
|
|
3154
|
-
ReactiveFormsModule,
|
|
3155
|
-
CellModule,
|
|
3156
|
-
FilterModule,
|
|
3157
|
-
PagerModule,
|
|
3158
|
-
TBodyModule,
|
|
3159
|
-
THeadModule,
|
|
3160
|
-
],
|
|
3161
|
-
declarations: [
|
|
3162
|
-
Ng2SmartTableComponent,
|
|
3163
|
-
],
|
|
3164
|
-
exports: [
|
|
3165
|
-
Ng2SmartTableComponent,
|
|
3166
|
-
],
|
|
3167
|
-
}]
|
|
3168
|
-
}] });
|
|
3169
|
-
|
|
3170
|
-
/**
|
|
3171
|
-
* Generated bundle index. Do not edit.
|
|
3172
|
-
*/
|
|
3173
|
-
|
|
3174
|
-
export { Cell, DefaultEditor, DefaultFilter, LocalDataSource, Ng2SmartTableComponent, Ng2SmartTableModule };
|
|
3175
|
-
//# sourceMappingURL=den4ik92-ng2-smart-table.mjs.map
|