@den4ik92/ng2-smart-table 1.0.0
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/den4ik92-ng2-smart-table.mjs +5 -0
- package/esm2020/lib/components/cell/cell-edit-mode/custom-edit.component.mjs +50 -0
- package/esm2020/lib/components/cell/cell-edit-mode/default-edit.component.mjs +84 -0
- package/esm2020/lib/components/cell/cell-edit-mode/edit-cell-default.mjs +35 -0
- package/esm2020/lib/components/cell/cell-edit-mode/edit-cell.component.mjs +75 -0
- package/esm2020/lib/components/cell/cell-editors/checkbox-editor.component.mjs +37 -0
- package/esm2020/lib/components/cell/cell-editors/completer-editor.component.mjs +38 -0
- package/esm2020/lib/components/cell/cell-editors/default-editor.mjs +29 -0
- package/esm2020/lib/components/cell/cell-editors/input-editor.component.mjs +33 -0
- package/esm2020/lib/components/cell/cell-editors/select-editor.component.mjs +55 -0
- package/esm2020/lib/components/cell/cell-editors/textarea-editor.component.mjs +35 -0
- package/esm2020/lib/components/cell/cell-view-mode/custom-view.component.mjs +63 -0
- package/esm2020/lib/components/cell/cell-view-mode/view-cell.component.mjs +59 -0
- package/esm2020/lib/components/cell/cell-view-mode/view-cell.mjs +2 -0
- package/esm2020/lib/components/cell/cell.component.mjs +82 -0
- package/esm2020/lib/components/cell/cell.module.mjs +80 -0
- package/esm2020/lib/components/filter/custom-filter.component.mjs +53 -0
- package/esm2020/lib/components/filter/default-filter.component.mjs +100 -0
- package/esm2020/lib/components/filter/filter-default.mjs +35 -0
- package/esm2020/lib/components/filter/filter-types/checkbox-filter.component.mjs +65 -0
- package/esm2020/lib/components/filter/filter-types/completer-filter.component.mjs +52 -0
- package/esm2020/lib/components/filter/filter-types/default-filter.mjs +34 -0
- package/esm2020/lib/components/filter/filter-types/input-filter.component.mjs +51 -0
- package/esm2020/lib/components/filter/filter-types/select-filter.component.mjs +71 -0
- package/esm2020/lib/components/filter/filter.component.mjs +91 -0
- package/esm2020/lib/components/filter/filter.module.mjs +67 -0
- package/esm2020/lib/components/pager/pager.component.mjs +284 -0
- package/esm2020/lib/components/pager/pager.module.mjs +29 -0
- package/esm2020/lib/components/tbody/cells/create-cancel.component.mjs +52 -0
- package/esm2020/lib/components/tbody/cells/custom.component.mjs +56 -0
- package/esm2020/lib/components/tbody/cells/edit-delete.component.mjs +103 -0
- package/esm2020/lib/components/tbody/tbody.component.mjs +206 -0
- package/esm2020/lib/components/tbody/tbody.module.mjs +48 -0
- package/esm2020/lib/components/thead/cells/actions-title.component.mjs +36 -0
- package/esm2020/lib/components/thead/cells/actions.component.mjs +44 -0
- package/esm2020/lib/components/thead/cells/add-button.component.mjs +63 -0
- package/esm2020/lib/components/thead/cells/checkbox-select-all.component.mjs +28 -0
- package/esm2020/lib/components/thead/cells/column-title.component.mjs +37 -0
- package/esm2020/lib/components/thead/cells/title/title.component.mjs +100 -0
- package/esm2020/lib/components/thead/rows/thead-filters-row.component.mjs +105 -0
- package/esm2020/lib/components/thead/rows/thead-form-row.component.mjs +108 -0
- package/esm2020/lib/components/thead/rows/thead-titles-row.component.mjs +103 -0
- package/esm2020/lib/components/thead/thead.component.mjs +76 -0
- package/esm2020/lib/components/thead/thead.module.mjs +76 -0
- package/esm2020/lib/lib/data-set/cell.mjs +41 -0
- package/esm2020/lib/lib/data-set/column.mjs +75 -0
- package/esm2020/lib/lib/data-set/data-set.mjs +98 -0
- package/esm2020/lib/lib/data-set/row.mjs +46 -0
- package/esm2020/lib/lib/data-source/data-source.mjs +101 -0
- package/esm2020/lib/lib/data-source/local/local.data-source.mjs +228 -0
- package/esm2020/lib/lib/data-source/local/local.filter.mjs +13 -0
- package/esm2020/lib/lib/data-source/local/local.pager.mjs +6 -0
- package/esm2020/lib/lib/data-source/local/local.sorter.mjs +19 -0
- package/esm2020/lib/lib/data-source/server/server-source.conf.mjs +20 -0
- package/esm2020/lib/lib/data-source/server/server.data-source.mjs +93 -0
- package/esm2020/lib/lib/grid.mjs +220 -0
- package/esm2020/lib/lib/helpers.mjs +84 -0
- package/esm2020/lib/lib/interfaces/smart-table.models.mjs +2 -0
- package/esm2020/lib/ng2-smart-table.component.mjs +203 -0
- package/esm2020/lib/ng2-smart-table.module.mjs +52 -0
- package/esm2020/public-api.mjs +8 -0
- package/fesm2015/den4ik92-ng2-smart-table.mjs +4329 -0
- package/fesm2015/den4ik92-ng2-smart-table.mjs.map +1 -0
- package/fesm2020/den4ik92-ng2-smart-table.mjs +3949 -0
- package/fesm2020/den4ik92-ng2-smart-table.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/cell/cell-edit-mode/custom-edit.component.d.ts +13 -0
- package/lib/components/cell/cell-edit-mode/default-edit.component.d.ts +8 -0
- package/lib/components/cell/cell-edit-mode/edit-cell-default.d.ts +13 -0
- package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +12 -0
- package/lib/components/cell/cell-editors/checkbox-editor.component.d.ts +8 -0
- package/lib/components/cell/cell-editors/completer-editor.component.d.ts +13 -0
- package/lib/components/cell/cell-editors/default-editor.d.ts +19 -0
- package/lib/components/cell/cell-editors/input-editor.component.d.ts +7 -0
- package/lib/components/cell/cell-editors/select-editor.component.d.ts +7 -0
- package/lib/components/cell/cell-editors/textarea-editor.component.d.ts +7 -0
- package/lib/components/cell/cell-view-mode/custom-view.component.d.ts +19 -0
- package/lib/components/cell/cell-view-mode/view-cell.component.d.ts +7 -0
- package/lib/components/cell/cell-view-mode/view-cell.d.ts +4 -0
- package/lib/components/cell/cell.component.d.ts +20 -0
- package/lib/components/cell/cell.module.d.ts +21 -0
- package/lib/components/filter/custom-filter.component.d.ts +14 -0
- package/lib/components/filter/default-filter.component.d.ts +7 -0
- package/lib/components/filter/filter-default.d.ts +14 -0
- package/lib/components/filter/filter-types/checkbox-filter.component.d.ts +13 -0
- package/lib/components/filter/filter-types/completer-filter.component.d.ts +12 -0
- package/lib/components/filter/filter-types/default-filter.d.ts +24 -0
- package/lib/components/filter/filter-types/input-filter.component.d.ts +12 -0
- package/lib/components/filter/filter-types/select-filter.component.d.ts +11 -0
- package/lib/components/filter/filter.component.d.ts +11 -0
- package/lib/components/filter/filter.module.d.ts +17 -0
- package/lib/components/pager/pager.component.d.ts +35 -0
- package/lib/components/pager/pager.module.d.ts +9 -0
- package/lib/components/tbody/cells/create-cancel.component.d.ts +16 -0
- package/lib/components/tbody/cells/custom.component.d.ts +13 -0
- package/lib/components/tbody/cells/edit-delete.component.d.ts +24 -0
- package/lib/components/tbody/tbody.component.d.ts +37 -0
- package/lib/components/tbody/tbody.module.d.ts +13 -0
- package/lib/components/thead/cells/actions-title.component.d.ts +13 -0
- package/lib/components/thead/cells/actions.component.d.ts +12 -0
- package/lib/components/thead/cells/add-button.component.d.ts +18 -0
- package/lib/components/thead/cells/checkbox-select-all.component.d.ts +9 -0
- package/lib/components/thead/cells/column-title.component.d.ts +11 -0
- package/lib/components/thead/cells/title/title.component.d.ts +17 -0
- package/lib/components/thead/rows/thead-filters-row.component.d.ts +19 -0
- package/lib/components/thead/rows/thead-form-row.component.d.ts +20 -0
- package/lib/components/thead/rows/thead-titles-row.component.d.ts +18 -0
- package/lib/components/thead/thead.component.d.ts +18 -0
- package/lib/components/thead/thead.module.d.ts +20 -0
- package/lib/lib/data-set/cell.d.ts +20 -0
- package/lib/lib/data-set/column.d.ts +44 -0
- package/lib/lib/data-set/data-set.d.ts +37 -0
- package/lib/lib/data-set/row.d.ts +20 -0
- package/lib/lib/data-source/data-source.d.ts +35 -0
- package/lib/lib/data-source/local/local.data-source.d.ts +55 -0
- package/lib/lib/data-source/local/local.filter.d.ts +4 -0
- package/lib/lib/data-source/local/local.pager.d.ts +3 -0
- package/lib/lib/data-source/local/local.sorter.d.ts +4 -0
- package/lib/lib/data-source/server/server-source.conf.d.ts +27 -0
- package/lib/lib/data-source/server/server.data-source.d.ts +30 -0
- package/lib/lib/grid.d.ts +49 -0
- package/lib/lib/helpers.d.ts +18 -0
- package/lib/lib/interfaces/smart-table.models.d.ts +148 -0
- package/lib/ng2-smart-table.component.d.ts +43 -0
- package/lib/ng2-smart-table.module.d.ts +14 -0
- package/package.json +35 -0
- package/public-api.d.ts +8 -0
|
@@ -0,0 +1,4329 @@
|
|
|
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, map } from 'rxjs/operators';
|
|
8
|
+
import { Subject } from 'rxjs';
|
|
9
|
+
import { HttpParams } from '@angular/common/http';
|
|
10
|
+
|
|
11
|
+
class EditCellDefault {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.inputClass = '';
|
|
14
|
+
this.edited = new EventEmitter();
|
|
15
|
+
}
|
|
16
|
+
onEdited(event) {
|
|
17
|
+
this.edited.next(event);
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
onStopEditing() {
|
|
21
|
+
this.cell.getRow().isInEditing = false;
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
onClick(event) {
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
EditCellDefault.ɵfac = function EditCellDefault_Factory(t) { return new (t || EditCellDefault)(); };
|
|
29
|
+
EditCellDefault.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EditCellDefault, selectors: [["ng-component"]], inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, decls: 0, vars: 0, template: function EditCellDefault_Template(rf, ctx) { }, encapsulation: 2 });
|
|
30
|
+
(function () {
|
|
31
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EditCellDefault, [{
|
|
32
|
+
type: Component,
|
|
33
|
+
args: [{
|
|
34
|
+
template: ''
|
|
35
|
+
}]
|
|
36
|
+
}], null, { cell: [{
|
|
37
|
+
type: Input
|
|
38
|
+
}], inputClass: [{
|
|
39
|
+
type: Input
|
|
40
|
+
}], edited: [{
|
|
41
|
+
type: Output
|
|
42
|
+
}] });
|
|
43
|
+
})();
|
|
44
|
+
|
|
45
|
+
const _c0$c = ["dynamicTarget"];
|
|
46
|
+
function CustomEditComponent_ng_template_0_Template(rf, ctx) { }
|
|
47
|
+
class CustomEditComponent extends EditCellDefault {
|
|
48
|
+
constructor(resolver) {
|
|
49
|
+
super();
|
|
50
|
+
this.resolver = resolver;
|
|
51
|
+
}
|
|
52
|
+
ngOnChanges(changes) {
|
|
53
|
+
if (this.cell && !this.customComponent) {
|
|
54
|
+
const componentFactory = this.resolver.resolveComponentFactory(this.cell.getColumn().editor.component);
|
|
55
|
+
this.customComponent = this.dynamicTarget.createComponent(componentFactory);
|
|
56
|
+
// set @Inputs and @Outputs of custom component
|
|
57
|
+
this.customComponent.instance.cell = this.cell;
|
|
58
|
+
this.customComponent.instance.inputClass = this.inputClass;
|
|
59
|
+
this.customComponent.instance.onStopEditing.subscribe(() => this.onStopEditing());
|
|
60
|
+
this.customComponent.instance.onEdited.subscribe((event) => this.onEdited(event));
|
|
61
|
+
this.customComponent.instance.onClick.subscribe((event) => this.onClick(event));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
ngOnDestroy() {
|
|
65
|
+
if (this.customComponent) {
|
|
66
|
+
this.customComponent.destroy();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
CustomEditComponent.ɵfac = function CustomEditComponent_Factory(t) { return new (t || CustomEditComponent)(i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver)); };
|
|
71
|
+
CustomEditComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CustomEditComponent, selectors: [["table-cell-custom-editor"]], viewQuery: function CustomEditComponent_Query(rf, ctx) {
|
|
72
|
+
if (rf & 1) {
|
|
73
|
+
i0.ɵɵviewQuery(_c0$c, 7, ViewContainerRef);
|
|
74
|
+
}
|
|
75
|
+
if (rf & 2) {
|
|
76
|
+
let _t;
|
|
77
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dynamicTarget = _t.first);
|
|
78
|
+
}
|
|
79
|
+
}, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 2, vars: 0, consts: [["dynamicTarget", ""]], template: function CustomEditComponent_Template(rf, ctx) {
|
|
80
|
+
if (rf & 1) {
|
|
81
|
+
i0.ɵɵtemplate(0, CustomEditComponent_ng_template_0_Template, 0, 0, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
|
|
82
|
+
}
|
|
83
|
+
}, encapsulation: 2 });
|
|
84
|
+
(function () {
|
|
85
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CustomEditComponent, [{
|
|
86
|
+
type: Component,
|
|
87
|
+
args: [{
|
|
88
|
+
selector: 'table-cell-custom-editor',
|
|
89
|
+
template: `
|
|
90
|
+
<ng-template #dynamicTarget></ng-template>
|
|
91
|
+
`,
|
|
92
|
+
}]
|
|
93
|
+
}], function () { return [{ type: i0.ComponentFactoryResolver }]; }, { dynamicTarget: [{
|
|
94
|
+
type: ViewChild,
|
|
95
|
+
args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
|
|
96
|
+
}] });
|
|
97
|
+
})();
|
|
98
|
+
|
|
99
|
+
class DefaultEditor {
|
|
100
|
+
constructor() {
|
|
101
|
+
this.onStopEditing = new EventEmitter();
|
|
102
|
+
this.onEdited = new EventEmitter();
|
|
103
|
+
this.onClick = new EventEmitter();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
DefaultEditor.ɵfac = function DefaultEditor_Factory(t) { return new (t || DefaultEditor)(); };
|
|
107
|
+
DefaultEditor.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DefaultEditor, selectors: [["ng-component"]], inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { onStopEditing: "onStopEditing", onEdited: "onEdited", onClick: "onClick" }, decls: 0, vars: 0, template: function DefaultEditor_Template(rf, ctx) { }, encapsulation: 2 });
|
|
108
|
+
(function () {
|
|
109
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DefaultEditor, [{
|
|
110
|
+
type: Component,
|
|
111
|
+
args: [{
|
|
112
|
+
template: '',
|
|
113
|
+
}]
|
|
114
|
+
}], null, { cell: [{
|
|
115
|
+
type: Input
|
|
116
|
+
}], inputClass: [{
|
|
117
|
+
type: Input
|
|
118
|
+
}], onStopEditing: [{
|
|
119
|
+
type: Output
|
|
120
|
+
}], onEdited: [{
|
|
121
|
+
type: Output
|
|
122
|
+
}], onClick: [{
|
|
123
|
+
type: Output
|
|
124
|
+
}] });
|
|
125
|
+
})();
|
|
126
|
+
|
|
127
|
+
class CheckboxEditorComponent extends DefaultEditor {
|
|
128
|
+
constructor() {
|
|
129
|
+
super();
|
|
130
|
+
}
|
|
131
|
+
onChange(event) {
|
|
132
|
+
const trueVal = (this.cell.getColumn().getConfig() && this.cell.getColumn().getConfig().true) || true;
|
|
133
|
+
const falseVal = (this.cell.getColumn().getConfig() && this.cell.getColumn().getConfig().false) || false;
|
|
134
|
+
this.cell.newValue = event.target.checked ? trueVal : falseVal;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
CheckboxEditorComponent.ɵfac = function CheckboxEditorComponent_Factory(t) { return new (t || CheckboxEditorComponent)(); };
|
|
138
|
+
CheckboxEditorComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CheckboxEditorComponent, selectors: [["checkbox-editor"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 4, consts: [["type", "checkbox", 1, "form-control", 3, "ngClass", "name", "disabled", "checked", "click", "change"]], template: function CheckboxEditorComponent_Template(rf, ctx) {
|
|
139
|
+
if (rf & 1) {
|
|
140
|
+
i0.ɵɵelementStart(0, "input", 0);
|
|
141
|
+
i0.ɵɵlistener("click", function CheckboxEditorComponent_Template_input_click_0_listener($event) { return ctx.onClick.emit($event); })("change", function CheckboxEditorComponent_Template_input_change_0_listener($event) { return ctx.onChange($event); });
|
|
142
|
+
i0.ɵɵelementEnd();
|
|
143
|
+
}
|
|
144
|
+
if (rf & 2) {
|
|
145
|
+
let tmp_3_0;
|
|
146
|
+
i0.ɵɵproperty("ngClass", ctx.inputClass)("name", ctx.cell.getId())("disabled", !ctx.cell.isEditable())("checked", ctx.cell.getValue() == (((tmp_3_0 = ctx.cell.getColumn().getConfig()) == null ? null : tmp_3_0.true) || true));
|
|
147
|
+
}
|
|
148
|
+
}, dependencies: [i1.NgClass], styles: ["[_nghost-%COMP%] input[_ngcontent-%COMP%], [_nghost-%COMP%] textarea[_ngcontent-%COMP%]{width:100%;line-height:normal;padding:.375em .75em}"] });
|
|
149
|
+
(function () {
|
|
150
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxEditorComponent, [{
|
|
151
|
+
type: Component,
|
|
152
|
+
args: [{ selector: 'checkbox-editor', template: `
|
|
153
|
+
<input [ngClass]="inputClass"
|
|
154
|
+
type="checkbox"
|
|
155
|
+
class="form-control"
|
|
156
|
+
[name]="cell.getId()"
|
|
157
|
+
[disabled]="!cell.isEditable()"
|
|
158
|
+
[checked]="cell.getValue() == (cell.getColumn().getConfig()?.true || true)"
|
|
159
|
+
(click)="onClick.emit($event)"
|
|
160
|
+
(change)="onChange($event)">
|
|
161
|
+
`, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
|
|
162
|
+
}], function () { return []; }, null);
|
|
163
|
+
})();
|
|
164
|
+
|
|
165
|
+
class CompleterEditorComponent extends DefaultEditor {
|
|
166
|
+
constructor() {
|
|
167
|
+
super();
|
|
168
|
+
this.completerStr = '';
|
|
169
|
+
}
|
|
170
|
+
ngOnInit() {
|
|
171
|
+
// if (this.cell.getColumn().editor && this.cell.getColumn().editor.type === 'completer') {
|
|
172
|
+
// const config = this.cell.getColumn().getConfig().completer;
|
|
173
|
+
// config.dataService = this.completerService.local(config.data, config.searchFields, config.titleField);
|
|
174
|
+
// config.dataService.descriptionField(config.descriptionField);
|
|
175
|
+
// }
|
|
176
|
+
}
|
|
177
|
+
onEditedCompleter(event) {
|
|
178
|
+
this.cell.newValue = event.title;
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
CompleterEditorComponent.ɵfac = function CompleterEditorComponent_Factory(t) { return new (t || CompleterEditorComponent)(); };
|
|
183
|
+
CompleterEditorComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CompleterEditorComponent, selectors: [["completer-editor"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 0, vars: 0, template: function CompleterEditorComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
|
184
|
+
(function () {
|
|
185
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CompleterEditorComponent, [{
|
|
186
|
+
type: Component,
|
|
187
|
+
args: [{
|
|
188
|
+
selector: 'completer-editor',
|
|
189
|
+
template: `
|
|
190
|
+
<!-- <ng2-completer [(ngModel)]="completerStr"
|
|
191
|
+
[dataService]="cell.getColumn().getConfig().completer.dataService"
|
|
192
|
+
[minSearchLength]="cell.getColumn().getConfig().completer.minSearchLength || 0"
|
|
193
|
+
[pause]="cell.getColumn().getConfig().completer.pause || 0"
|
|
194
|
+
[placeholder]="cell.getColumn().getConfig().completer.placeholder || 'Start typing...'"
|
|
195
|
+
(selected)="onEditedCompleter($event)">
|
|
196
|
+
</ng2-completer> -->
|
|
197
|
+
`,
|
|
198
|
+
}]
|
|
199
|
+
}], function () { return []; }, null);
|
|
200
|
+
})();
|
|
201
|
+
|
|
202
|
+
class InputEditorComponent extends DefaultEditor {
|
|
203
|
+
constructor() {
|
|
204
|
+
super();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
InputEditorComponent.ɵfac = function InputEditorComponent_Factory(t) { return new (t || InputEditorComponent)(); };
|
|
208
|
+
InputEditorComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: InputEditorComponent, selectors: [["input-editor"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 5, consts: [[1, "form-control", 3, "ngClass", "ngModel", "name", "placeholder", "disabled", "ngModelChange", "click", "keydown.enter", "keydown.esc"]], template: function InputEditorComponent_Template(rf, ctx) {
|
|
209
|
+
if (rf & 1) {
|
|
210
|
+
i0.ɵɵelementStart(0, "input", 0);
|
|
211
|
+
i0.ɵɵlistener("ngModelChange", function InputEditorComponent_Template_input_ngModelChange_0_listener($event) { return ctx.cell.newValue = $event; })("click", function InputEditorComponent_Template_input_click_0_listener($event) { return ctx.onClick.emit($event); })("keydown.enter", function InputEditorComponent_Template_input_keydown_enter_0_listener($event) { return ctx.onEdited.emit($event); })("keydown.esc", function InputEditorComponent_Template_input_keydown_esc_0_listener() { return ctx.onStopEditing.emit(); });
|
|
212
|
+
i0.ɵɵelementEnd();
|
|
213
|
+
}
|
|
214
|
+
if (rf & 2) {
|
|
215
|
+
i0.ɵɵproperty("ngClass", ctx.inputClass)("ngModel", ctx.cell.newValue)("name", ctx.cell.getId())("placeholder", ctx.cell.getTitle())("disabled", !ctx.cell.isEditable());
|
|
216
|
+
}
|
|
217
|
+
}, dependencies: [i1.NgClass, i2.DefaultValueAccessor, i2.NgControlStatus, i2.NgModel], styles: ["[_nghost-%COMP%] input[_ngcontent-%COMP%], [_nghost-%COMP%] textarea[_ngcontent-%COMP%]{width:100%;line-height:normal;padding:.375em .75em}"] });
|
|
218
|
+
(function () {
|
|
219
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(InputEditorComponent, [{
|
|
220
|
+
type: Component,
|
|
221
|
+
args: [{ selector: 'input-editor', template: `
|
|
222
|
+
<input [ngClass]="inputClass"
|
|
223
|
+
class="form-control"
|
|
224
|
+
[(ngModel)]="cell.newValue"
|
|
225
|
+
[name]="cell.getId()"
|
|
226
|
+
[placeholder]="cell.getTitle()"
|
|
227
|
+
[disabled]="!cell.isEditable()"
|
|
228
|
+
(click)="onClick.emit($event)"
|
|
229
|
+
(keydown.enter)="onEdited.emit($event)"
|
|
230
|
+
(keydown.esc)="onStopEditing.emit()">
|
|
231
|
+
`, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
|
|
232
|
+
}], function () { return []; }, null);
|
|
233
|
+
})();
|
|
234
|
+
|
|
235
|
+
function SelectEditorComponent_option_1_Template(rf, ctx) {
|
|
236
|
+
if (rf & 1) {
|
|
237
|
+
i0.ɵɵelementStart(0, "option", 2);
|
|
238
|
+
i0.ɵɵtext(1);
|
|
239
|
+
i0.ɵɵelementEnd();
|
|
240
|
+
}
|
|
241
|
+
if (rf & 2) {
|
|
242
|
+
const option_r1 = ctx.$implicit;
|
|
243
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
244
|
+
i0.ɵɵproperty("value", option_r1.value)("selected", option_r1.value === ctx_r0.cell.getValue());
|
|
245
|
+
i0.ɵɵadvance(1);
|
|
246
|
+
i0.ɵɵtextInterpolate1("", option_r1.title, " ");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
class SelectEditorComponent extends DefaultEditor {
|
|
250
|
+
constructor() {
|
|
251
|
+
super();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
SelectEditorComponent.ɵfac = function SelectEditorComponent_Factory(t) { return new (t || SelectEditorComponent)(); };
|
|
255
|
+
SelectEditorComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SelectEditorComponent, selectors: [["select-editor"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 2, vars: 5, consts: [[1, "form-control", 3, "ngClass", "ngModel", "name", "disabled", "ngModelChange", "click", "keydown.enter", "keydown.esc"], [3, "value", "selected", 4, "ngFor", "ngForOf"], [3, "value", "selected"]], template: function SelectEditorComponent_Template(rf, ctx) {
|
|
256
|
+
if (rf & 1) {
|
|
257
|
+
i0.ɵɵelementStart(0, "select", 0);
|
|
258
|
+
i0.ɵɵlistener("ngModelChange", function SelectEditorComponent_Template_select_ngModelChange_0_listener($event) { return ctx.cell.newValue = $event; })("click", function SelectEditorComponent_Template_select_click_0_listener($event) { return ctx.onClick.emit($event); })("keydown.enter", function SelectEditorComponent_Template_select_keydown_enter_0_listener($event) { return ctx.onEdited.emit($event); })("keydown.esc", function SelectEditorComponent_Template_select_keydown_esc_0_listener() { return ctx.onStopEditing.emit(); });
|
|
259
|
+
i0.ɵɵtemplate(1, SelectEditorComponent_option_1_Template, 2, 3, "option", 1);
|
|
260
|
+
i0.ɵɵelementEnd();
|
|
261
|
+
}
|
|
262
|
+
if (rf & 2) {
|
|
263
|
+
let tmp_4_0;
|
|
264
|
+
i0.ɵɵproperty("ngClass", ctx.inputClass)("ngModel", ctx.cell.newValue)("name", ctx.cell.getId())("disabled", !ctx.cell.isEditable());
|
|
265
|
+
i0.ɵɵadvance(1);
|
|
266
|
+
i0.ɵɵproperty("ngForOf", (tmp_4_0 = ctx.cell.getColumn().getConfig()) == null ? null : tmp_4_0.list);
|
|
267
|
+
}
|
|
268
|
+
}, dependencies: [i1.NgClass, i1.NgForOf, i2.NgSelectOption, i2.ɵNgSelectMultipleOption, i2.SelectControlValueAccessor, i2.NgControlStatus, i2.NgModel], encapsulation: 2 });
|
|
269
|
+
(function () {
|
|
270
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SelectEditorComponent, [{
|
|
271
|
+
type: Component,
|
|
272
|
+
args: [{
|
|
273
|
+
selector: 'select-editor',
|
|
274
|
+
template: `
|
|
275
|
+
<select [ngClass]="inputClass"
|
|
276
|
+
class="form-control"
|
|
277
|
+
[(ngModel)]="cell.newValue"
|
|
278
|
+
[name]="cell.getId()"
|
|
279
|
+
[disabled]="!cell.isEditable()"
|
|
280
|
+
(click)="onClick.emit($event)"
|
|
281
|
+
(keydown.enter)="onEdited.emit($event)"
|
|
282
|
+
(keydown.esc)="onStopEditing.emit()">
|
|
283
|
+
|
|
284
|
+
<option *ngFor="let option of cell.getColumn().getConfig()?.list" [value]="option.value"
|
|
285
|
+
[selected]="option.value === cell.getValue()">{{ option.title }}
|
|
286
|
+
</option>
|
|
287
|
+
</select>
|
|
288
|
+
`,
|
|
289
|
+
}]
|
|
290
|
+
}], function () { return []; }, null);
|
|
291
|
+
})();
|
|
292
|
+
|
|
293
|
+
class TextareaEditorComponent extends DefaultEditor {
|
|
294
|
+
constructor() {
|
|
295
|
+
super();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
TextareaEditorComponent.ɵfac = function TextareaEditorComponent_Factory(t) { return new (t || TextareaEditorComponent)(); };
|
|
299
|
+
TextareaEditorComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TextareaEditorComponent, selectors: [["textarea-editor"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 2, vars: 5, consts: [[1, "form-control", 3, "ngClass", "ngModel", "name", "disabled", "placeholder", "ngModelChange", "click", "keydown.enter", "keydown.esc"]], template: function TextareaEditorComponent_Template(rf, ctx) {
|
|
300
|
+
if (rf & 1) {
|
|
301
|
+
i0.ɵɵelementStart(0, "textarea", 0);
|
|
302
|
+
i0.ɵɵlistener("ngModelChange", function TextareaEditorComponent_Template_textarea_ngModelChange_0_listener($event) { return ctx.cell.newValue = $event; })("click", function TextareaEditorComponent_Template_textarea_click_0_listener($event) { return ctx.onClick.emit($event); })("keydown.enter", function TextareaEditorComponent_Template_textarea_keydown_enter_0_listener($event) { return ctx.onEdited.emit($event); })("keydown.esc", function TextareaEditorComponent_Template_textarea_keydown_esc_0_listener() { return ctx.onStopEditing.emit(); });
|
|
303
|
+
i0.ɵɵtext(1, " ");
|
|
304
|
+
i0.ɵɵelementEnd();
|
|
305
|
+
}
|
|
306
|
+
if (rf & 2) {
|
|
307
|
+
i0.ɵɵproperty("ngClass", ctx.inputClass)("ngModel", ctx.cell.newValue)("name", ctx.cell.getId())("disabled", !ctx.cell.isEditable())("placeholder", ctx.cell.getTitle());
|
|
308
|
+
}
|
|
309
|
+
}, dependencies: [i1.NgClass, i2.DefaultValueAccessor, i2.NgControlStatus, i2.NgModel], styles: ["[_nghost-%COMP%] input[_ngcontent-%COMP%], [_nghost-%COMP%] textarea[_ngcontent-%COMP%]{width:100%;line-height:normal;padding:.375em .75em}"] });
|
|
310
|
+
(function () {
|
|
311
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TextareaEditorComponent, [{
|
|
312
|
+
type: Component,
|
|
313
|
+
args: [{ selector: 'textarea-editor', template: `
|
|
314
|
+
<textarea [ngClass]="inputClass"
|
|
315
|
+
class="form-control"
|
|
316
|
+
[(ngModel)]="cell.newValue"
|
|
317
|
+
[name]="cell.getId()"
|
|
318
|
+
[disabled]="!cell.isEditable()"
|
|
319
|
+
[placeholder]="cell.getTitle()"
|
|
320
|
+
(click)="onClick.emit($event)"
|
|
321
|
+
(keydown.enter)="onEdited.emit($event)"
|
|
322
|
+
(keydown.esc)="onStopEditing.emit()">
|
|
323
|
+
</textarea>
|
|
324
|
+
`, styles: [":host input,:host textarea{width:100%;line-height:normal;padding:.375em .75em}\n"] }]
|
|
325
|
+
}], function () { return []; }, null);
|
|
326
|
+
})();
|
|
327
|
+
|
|
328
|
+
function DefaultEditComponent_select_editor_1_Template(rf, ctx) {
|
|
329
|
+
if (rf & 1) {
|
|
330
|
+
const _r6 = i0.ɵɵgetCurrentView();
|
|
331
|
+
i0.ɵɵelementStart(0, "select-editor", 5);
|
|
332
|
+
i0.ɵɵlistener("onClick", function DefaultEditComponent_select_editor_1_Template_select_editor_onClick_0_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r5 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r5.onClick($event)); })("onEdited", function DefaultEditComponent_select_editor_1_Template_select_editor_onEdited_0_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r7 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r7.onEdited($event)); })("onStopEditing", function DefaultEditComponent_select_editor_1_Template_select_editor_onStopEditing_0_listener() { i0.ɵɵrestoreView(_r6); const ctx_r8 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r8.onStopEditing()); });
|
|
333
|
+
i0.ɵɵelementEnd();
|
|
334
|
+
}
|
|
335
|
+
if (rf & 2) {
|
|
336
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
337
|
+
i0.ɵɵproperty("cell", ctx_r0.cell)("inputClass", ctx_r0.inputClass);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function DefaultEditComponent_textarea_editor_2_Template(rf, ctx) {
|
|
341
|
+
if (rf & 1) {
|
|
342
|
+
const _r10 = i0.ɵɵgetCurrentView();
|
|
343
|
+
i0.ɵɵelementStart(0, "textarea-editor", 5);
|
|
344
|
+
i0.ɵɵlistener("onClick", function DefaultEditComponent_textarea_editor_2_Template_textarea_editor_onClick_0_listener($event) { i0.ɵɵrestoreView(_r10); const ctx_r9 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r9.onClick($event)); })("onEdited", function DefaultEditComponent_textarea_editor_2_Template_textarea_editor_onEdited_0_listener($event) { i0.ɵɵrestoreView(_r10); const ctx_r11 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r11.onEdited($event)); })("onStopEditing", function DefaultEditComponent_textarea_editor_2_Template_textarea_editor_onStopEditing_0_listener() { i0.ɵɵrestoreView(_r10); const ctx_r12 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r12.onStopEditing()); });
|
|
345
|
+
i0.ɵɵelementEnd();
|
|
346
|
+
}
|
|
347
|
+
if (rf & 2) {
|
|
348
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
349
|
+
i0.ɵɵproperty("cell", ctx_r1.cell)("inputClass", ctx_r1.inputClass);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function DefaultEditComponent_checkbox_editor_3_Template(rf, ctx) {
|
|
353
|
+
if (rf & 1) {
|
|
354
|
+
const _r14 = i0.ɵɵgetCurrentView();
|
|
355
|
+
i0.ɵɵelementStart(0, "checkbox-editor", 6);
|
|
356
|
+
i0.ɵɵlistener("onClick", function DefaultEditComponent_checkbox_editor_3_Template_checkbox_editor_onClick_0_listener($event) { i0.ɵɵrestoreView(_r14); const ctx_r13 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r13.onClick($event)); });
|
|
357
|
+
i0.ɵɵelementEnd();
|
|
358
|
+
}
|
|
359
|
+
if (rf & 2) {
|
|
360
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
361
|
+
i0.ɵɵproperty("cell", ctx_r2.cell)("inputClass", ctx_r2.inputClass);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
function DefaultEditComponent_completer_editor_4_Template(rf, ctx) {
|
|
365
|
+
if (rf & 1) {
|
|
366
|
+
i0.ɵɵelement(0, "completer-editor", 7);
|
|
367
|
+
}
|
|
368
|
+
if (rf & 2) {
|
|
369
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
370
|
+
i0.ɵɵproperty("cell", ctx_r3.cell);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function DefaultEditComponent_input_editor_5_Template(rf, ctx) {
|
|
374
|
+
if (rf & 1) {
|
|
375
|
+
const _r16 = i0.ɵɵgetCurrentView();
|
|
376
|
+
i0.ɵɵelementStart(0, "input-editor", 5);
|
|
377
|
+
i0.ɵɵlistener("onClick", function DefaultEditComponent_input_editor_5_Template_input_editor_onClick_0_listener($event) { i0.ɵɵrestoreView(_r16); const ctx_r15 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r15.onClick($event)); })("onEdited", function DefaultEditComponent_input_editor_5_Template_input_editor_onEdited_0_listener($event) { i0.ɵɵrestoreView(_r16); const ctx_r17 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r17.onEdited($event)); })("onStopEditing", function DefaultEditComponent_input_editor_5_Template_input_editor_onStopEditing_0_listener() { i0.ɵɵrestoreView(_r16); const ctx_r18 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r18.onStopEditing()); });
|
|
378
|
+
i0.ɵɵelementEnd();
|
|
379
|
+
}
|
|
380
|
+
if (rf & 2) {
|
|
381
|
+
const ctx_r4 = i0.ɵɵnextContext();
|
|
382
|
+
i0.ɵɵproperty("cell", ctx_r4.cell)("inputClass", ctx_r4.inputClass);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
class DefaultEditComponent extends EditCellDefault {
|
|
386
|
+
constructor() {
|
|
387
|
+
super();
|
|
388
|
+
}
|
|
389
|
+
getEditorType() {
|
|
390
|
+
return this.cell.getColumn().editor && this.cell.getColumn().editor.type;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
DefaultEditComponent.ɵfac = function DefaultEditComponent_Factory(t) { return new (t || DefaultEditComponent)(); };
|
|
394
|
+
DefaultEditComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DefaultEditComponent, selectors: [["table-cell-default-editor"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 6, vars: 5, consts: [[3, "ngSwitch"], [3, "cell", "inputClass", "onClick", "onEdited", "onStopEditing", 4, "ngSwitchCase"], [3, "cell", "inputClass", "onClick", 4, "ngSwitchCase"], [3, "cell", 4, "ngSwitchCase"], [3, "cell", "inputClass", "onClick", "onEdited", "onStopEditing", 4, "ngSwitchDefault"], [3, "cell", "inputClass", "onClick", "onEdited", "onStopEditing"], [3, "cell", "inputClass", "onClick"], [3, "cell"]], template: function DefaultEditComponent_Template(rf, ctx) {
|
|
395
|
+
if (rf & 1) {
|
|
396
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
397
|
+
i0.ɵɵtemplate(1, DefaultEditComponent_select_editor_1_Template, 1, 2, "select-editor", 1);
|
|
398
|
+
i0.ɵɵtemplate(2, DefaultEditComponent_textarea_editor_2_Template, 1, 2, "textarea-editor", 1);
|
|
399
|
+
i0.ɵɵtemplate(3, DefaultEditComponent_checkbox_editor_3_Template, 1, 2, "checkbox-editor", 2);
|
|
400
|
+
i0.ɵɵtemplate(4, DefaultEditComponent_completer_editor_4_Template, 1, 1, "completer-editor", 3);
|
|
401
|
+
i0.ɵɵtemplate(5, DefaultEditComponent_input_editor_5_Template, 1, 2, "input-editor", 4);
|
|
402
|
+
i0.ɵɵelementEnd();
|
|
403
|
+
}
|
|
404
|
+
if (rf & 2) {
|
|
405
|
+
i0.ɵɵproperty("ngSwitch", ctx.getEditorType());
|
|
406
|
+
i0.ɵɵadvance(1);
|
|
407
|
+
i0.ɵɵproperty("ngSwitchCase", "list");
|
|
408
|
+
i0.ɵɵadvance(1);
|
|
409
|
+
i0.ɵɵproperty("ngSwitchCase", "textarea");
|
|
410
|
+
i0.ɵɵadvance(1);
|
|
411
|
+
i0.ɵɵproperty("ngSwitchCase", "checkbox");
|
|
412
|
+
i0.ɵɵadvance(1);
|
|
413
|
+
i0.ɵɵproperty("ngSwitchCase", "completer");
|
|
414
|
+
}
|
|
415
|
+
}, dependencies: [i1.NgSwitch, i1.NgSwitchCase, i1.NgSwitchDefault, CheckboxEditorComponent, CompleterEditorComponent, InputEditorComponent, SelectEditorComponent, TextareaEditorComponent], encapsulation: 2 });
|
|
416
|
+
(function () {
|
|
417
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DefaultEditComponent, [{
|
|
418
|
+
type: Component,
|
|
419
|
+
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 <completer-editor *ngSwitchCase=\"'completer'\"\n [cell]=\"cell\">\n </completer-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>" }]
|
|
420
|
+
}], function () { return []; }, null);
|
|
421
|
+
})();
|
|
422
|
+
|
|
423
|
+
function EditCellComponent_table_cell_custom_editor_1_Template(rf, ctx) {
|
|
424
|
+
if (rf & 1) {
|
|
425
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
426
|
+
i0.ɵɵelementStart(0, "table-cell-custom-editor", 3);
|
|
427
|
+
i0.ɵɵlistener("edited", function EditCellComponent_table_cell_custom_editor_1_Template_table_cell_custom_editor_edited_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.onEdited($event)); });
|
|
428
|
+
i0.ɵɵelementEnd();
|
|
429
|
+
}
|
|
430
|
+
if (rf & 2) {
|
|
431
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
432
|
+
i0.ɵɵproperty("cell", ctx_r0.cell)("inputClass", ctx_r0.inputClass);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function EditCellComponent_table_cell_default_editor_2_Template(rf, ctx) {
|
|
436
|
+
if (rf & 1) {
|
|
437
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
438
|
+
i0.ɵɵelementStart(0, "table-cell-default-editor", 3);
|
|
439
|
+
i0.ɵɵlistener("edited", function EditCellComponent_table_cell_default_editor_2_Template_table_cell_default_editor_edited_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.onEdited($event)); });
|
|
440
|
+
i0.ɵɵelementEnd();
|
|
441
|
+
}
|
|
442
|
+
if (rf & 2) {
|
|
443
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
444
|
+
i0.ɵɵproperty("cell", ctx_r1.cell)("inputClass", ctx_r1.inputClass);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
class EditCellComponent {
|
|
448
|
+
constructor() {
|
|
449
|
+
this.inputClass = '';
|
|
450
|
+
this.edited = new EventEmitter();
|
|
451
|
+
}
|
|
452
|
+
onEdited(event) {
|
|
453
|
+
this.edited.next(event);
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
getEditorType() {
|
|
457
|
+
return this.cell.getColumn().editor && this.cell.getColumn().editor.type;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
EditCellComponent.ɵfac = function EditCellComponent_Factory(t) { return new (t || EditCellComponent)(); };
|
|
461
|
+
EditCellComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: EditCellComponent, selectors: [["table-cell-edit-mode"]], inputs: { cell: "cell", inputClass: "inputClass" }, outputs: { edited: "edited" }, decls: 3, vars: 2, consts: [[3, "ngSwitch"], [3, "cell", "inputClass", "edited", 4, "ngSwitchCase"], [3, "cell", "inputClass", "edited", 4, "ngSwitchDefault"], [3, "cell", "inputClass", "edited"]], template: function EditCellComponent_Template(rf, ctx) {
|
|
462
|
+
if (rf & 1) {
|
|
463
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
464
|
+
i0.ɵɵtemplate(1, EditCellComponent_table_cell_custom_editor_1_Template, 1, 2, "table-cell-custom-editor", 1);
|
|
465
|
+
i0.ɵɵtemplate(2, EditCellComponent_table_cell_default_editor_2_Template, 1, 2, "table-cell-default-editor", 2);
|
|
466
|
+
i0.ɵɵelementEnd();
|
|
467
|
+
}
|
|
468
|
+
if (rf & 2) {
|
|
469
|
+
i0.ɵɵproperty("ngSwitch", ctx.getEditorType());
|
|
470
|
+
i0.ɵɵadvance(1);
|
|
471
|
+
i0.ɵɵproperty("ngSwitchCase", "custom");
|
|
472
|
+
}
|
|
473
|
+
}, dependencies: [i1.NgSwitch, i1.NgSwitchCase, i1.NgSwitchDefault, CustomEditComponent, DefaultEditComponent], encapsulation: 2 });
|
|
474
|
+
(function () {
|
|
475
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EditCellComponent, [{
|
|
476
|
+
type: Component,
|
|
477
|
+
args: [{
|
|
478
|
+
selector: 'table-cell-edit-mode',
|
|
479
|
+
template: `
|
|
480
|
+
<div [ngSwitch]="getEditorType()">
|
|
481
|
+
<table-cell-custom-editor *ngSwitchCase="'custom'"
|
|
482
|
+
[cell]="cell"
|
|
483
|
+
[inputClass]="inputClass"
|
|
484
|
+
(edited)="onEdited($event)">
|
|
485
|
+
</table-cell-custom-editor>
|
|
486
|
+
<table-cell-default-editor *ngSwitchDefault
|
|
487
|
+
[cell]="cell"
|
|
488
|
+
[inputClass]="inputClass"
|
|
489
|
+
(edited)="onEdited($event)">
|
|
490
|
+
</table-cell-default-editor>
|
|
491
|
+
</div>
|
|
492
|
+
`,
|
|
493
|
+
}]
|
|
494
|
+
}], null, { cell: [{
|
|
495
|
+
type: Input
|
|
496
|
+
}], inputClass: [{
|
|
497
|
+
type: Input
|
|
498
|
+
}], edited: [{
|
|
499
|
+
type: Output
|
|
500
|
+
}] });
|
|
501
|
+
})();
|
|
502
|
+
|
|
503
|
+
const _c0$b = ["dynamicTarget"];
|
|
504
|
+
function CustomViewComponent_ng_template_0_Template(rf, ctx) { }
|
|
505
|
+
class CustomViewComponent {
|
|
506
|
+
constructor(resolver) {
|
|
507
|
+
this.resolver = resolver;
|
|
508
|
+
}
|
|
509
|
+
ngOnInit() {
|
|
510
|
+
if (this.cell && !this.customComponent) {
|
|
511
|
+
this.createCustomComponent();
|
|
512
|
+
this.callOnComponentInit();
|
|
513
|
+
this.patchInstance();
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
ngOnDestroy() {
|
|
517
|
+
if (this.customComponent) {
|
|
518
|
+
this.customComponent.destroy();
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
createCustomComponent() {
|
|
522
|
+
const componentFactory = this.resolver.resolveComponentFactory(this.cell.getColumn().renderComponent);
|
|
523
|
+
this.customComponent = this.dynamicTarget.createComponent(componentFactory);
|
|
524
|
+
}
|
|
525
|
+
callOnComponentInit() {
|
|
526
|
+
const onComponentInitFunction = this.cell.getColumn().getOnComponentInitFunction();
|
|
527
|
+
onComponentInitFunction && onComponentInitFunction(this.customComponent.instance);
|
|
528
|
+
}
|
|
529
|
+
patchInstance() {
|
|
530
|
+
Object.assign(this.customComponent.instance, this.getPatch());
|
|
531
|
+
}
|
|
532
|
+
getPatch() {
|
|
533
|
+
return {
|
|
534
|
+
value: this.cell.getValue(),
|
|
535
|
+
rowData: this.cell.getRow().getData()
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
CustomViewComponent.ɵfac = function CustomViewComponent_Factory(t) { return new (t || CustomViewComponent)(i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver)); };
|
|
540
|
+
CustomViewComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CustomViewComponent, selectors: [["custom-view-component"]], viewQuery: function CustomViewComponent_Query(rf, ctx) {
|
|
541
|
+
if (rf & 1) {
|
|
542
|
+
i0.ɵɵviewQuery(_c0$b, 7, ViewContainerRef);
|
|
543
|
+
}
|
|
544
|
+
if (rf & 2) {
|
|
545
|
+
let _t;
|
|
546
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dynamicTarget = _t.first);
|
|
547
|
+
}
|
|
548
|
+
}, inputs: { cell: "cell" }, decls: 2, vars: 0, consts: [["dynamicTarget", ""]], template: function CustomViewComponent_Template(rf, ctx) {
|
|
549
|
+
if (rf & 1) {
|
|
550
|
+
i0.ɵɵtemplate(0, CustomViewComponent_ng_template_0_Template, 0, 0, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
|
|
551
|
+
}
|
|
552
|
+
}, encapsulation: 2 });
|
|
553
|
+
(function () {
|
|
554
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CustomViewComponent, [{
|
|
555
|
+
type: Component,
|
|
556
|
+
args: [{
|
|
557
|
+
selector: 'custom-view-component',
|
|
558
|
+
template: `
|
|
559
|
+
<ng-template #dynamicTarget></ng-template>
|
|
560
|
+
`,
|
|
561
|
+
}]
|
|
562
|
+
}], function () { return [{ type: i0.ComponentFactoryResolver }]; }, { cell: [{
|
|
563
|
+
type: Input
|
|
564
|
+
}], dynamicTarget: [{
|
|
565
|
+
type: ViewChild,
|
|
566
|
+
args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
|
|
567
|
+
}] });
|
|
568
|
+
})();
|
|
569
|
+
|
|
570
|
+
function ViewCellComponent_custom_view_component_1_Template(rf, ctx) {
|
|
571
|
+
if (rf & 1) {
|
|
572
|
+
i0.ɵɵelement(0, "custom-view-component", 4);
|
|
573
|
+
}
|
|
574
|
+
if (rf & 2) {
|
|
575
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
576
|
+
i0.ɵɵproperty("cell", ctx_r0.cell);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function ViewCellComponent_div_2_Template(rf, ctx) {
|
|
580
|
+
if (rf & 1) {
|
|
581
|
+
i0.ɵɵelement(0, "div", 5);
|
|
582
|
+
}
|
|
583
|
+
if (rf & 2) {
|
|
584
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
585
|
+
i0.ɵɵproperty("innerHTML", ctx_r1.cell.getValue(), i0.ɵɵsanitizeHtml);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
function ViewCellComponent_div_3_Template(rf, ctx) {
|
|
589
|
+
if (rf & 1) {
|
|
590
|
+
i0.ɵɵelementStart(0, "div");
|
|
591
|
+
i0.ɵɵtext(1);
|
|
592
|
+
i0.ɵɵelementEnd();
|
|
593
|
+
}
|
|
594
|
+
if (rf & 2) {
|
|
595
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
596
|
+
i0.ɵɵadvance(1);
|
|
597
|
+
i0.ɵɵtextInterpolate(ctx_r2.cell.getValue());
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
class ViewCellComponent {
|
|
601
|
+
}
|
|
602
|
+
ViewCellComponent.ɵfac = function ViewCellComponent_Factory(t) { return new (t || ViewCellComponent)(); };
|
|
603
|
+
ViewCellComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ViewCellComponent, selectors: [["table-cell-view-mode"]], inputs: { cell: "cell" }, decls: 4, vars: 3, consts: [[3, "ngSwitch"], [3, "cell", 4, "ngSwitchCase"], [3, "innerHTML", 4, "ngSwitchCase"], [4, "ngSwitchDefault"], [3, "cell"], [3, "innerHTML"]], template: function ViewCellComponent_Template(rf, ctx) {
|
|
604
|
+
if (rf & 1) {
|
|
605
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
606
|
+
i0.ɵɵtemplate(1, ViewCellComponent_custom_view_component_1_Template, 1, 1, "custom-view-component", 1);
|
|
607
|
+
i0.ɵɵtemplate(2, ViewCellComponent_div_2_Template, 1, 1, "div", 2);
|
|
608
|
+
i0.ɵɵtemplate(3, ViewCellComponent_div_3_Template, 2, 1, "div", 3);
|
|
609
|
+
i0.ɵɵelementEnd();
|
|
610
|
+
}
|
|
611
|
+
if (rf & 2) {
|
|
612
|
+
i0.ɵɵproperty("ngSwitch", ctx.cell.getColumn().type);
|
|
613
|
+
i0.ɵɵadvance(1);
|
|
614
|
+
i0.ɵɵproperty("ngSwitchCase", "custom");
|
|
615
|
+
i0.ɵɵadvance(1);
|
|
616
|
+
i0.ɵɵproperty("ngSwitchCase", "html");
|
|
617
|
+
}
|
|
618
|
+
}, dependencies: [i1.NgSwitch, i1.NgSwitchCase, i1.NgSwitchDefault, CustomViewComponent], encapsulation: 2, changeDetection: 0 });
|
|
619
|
+
(function () {
|
|
620
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ViewCellComponent, [{
|
|
621
|
+
type: Component,
|
|
622
|
+
args: [{
|
|
623
|
+
selector: 'table-cell-view-mode',
|
|
624
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
625
|
+
template: `
|
|
626
|
+
<div [ngSwitch]="cell.getColumn().type">
|
|
627
|
+
<custom-view-component *ngSwitchCase="'custom'" [cell]="cell"></custom-view-component>
|
|
628
|
+
<div *ngSwitchCase="'html'" [innerHTML]="cell.getValue()"></div>
|
|
629
|
+
<div *ngSwitchDefault>{{ cell.getValue() }}</div>
|
|
630
|
+
</div>
|
|
631
|
+
`,
|
|
632
|
+
}]
|
|
633
|
+
}], null, { cell: [{
|
|
634
|
+
type: Input
|
|
635
|
+
}] });
|
|
636
|
+
})();
|
|
637
|
+
|
|
638
|
+
function CellComponent_table_cell_view_mode_0_Template(rf, ctx) {
|
|
639
|
+
if (rf & 1) {
|
|
640
|
+
i0.ɵɵelement(0, "table-cell-view-mode", 2);
|
|
641
|
+
}
|
|
642
|
+
if (rf & 2) {
|
|
643
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
644
|
+
i0.ɵɵproperty("cell", ctx_r0.cell);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
function CellComponent_table_cell_edit_mode_1_Template(rf, ctx) {
|
|
648
|
+
if (rf & 1) {
|
|
649
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
650
|
+
i0.ɵɵelementStart(0, "table-cell-edit-mode", 3);
|
|
651
|
+
i0.ɵɵlistener("edited", function CellComponent_table_cell_edit_mode_1_Template_table_cell_edit_mode_edited_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.onEdited($event)); });
|
|
652
|
+
i0.ɵɵelementEnd();
|
|
653
|
+
}
|
|
654
|
+
if (rf & 2) {
|
|
655
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
656
|
+
i0.ɵɵproperty("cell", ctx_r1.cell)("inputClass", ctx_r1.inputClass);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
class CellComponent {
|
|
660
|
+
constructor() {
|
|
661
|
+
this.inputClass = '';
|
|
662
|
+
this.mode = 'inline';
|
|
663
|
+
this.isInEditing = false;
|
|
664
|
+
this.edited = new EventEmitter();
|
|
665
|
+
}
|
|
666
|
+
onEdited(event) {
|
|
667
|
+
if (this.isNew) {
|
|
668
|
+
this.grid.create(this.grid.getNewRow(), this.createConfirm);
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
this.grid.save(this.row, this.editConfirm);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
CellComponent.ɵfac = function CellComponent_Factory(t) { return new (t || CellComponent)(); };
|
|
676
|
+
CellComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CellComponent, selectors: [["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" }, decls: 2, vars: 2, consts: [[3, "cell", 4, "ngIf"], [3, "cell", "inputClass", "edited", 4, "ngIf"], [3, "cell"], [3, "cell", "inputClass", "edited"]], template: function CellComponent_Template(rf, ctx) {
|
|
677
|
+
if (rf & 1) {
|
|
678
|
+
i0.ɵɵtemplate(0, CellComponent_table_cell_view_mode_0_Template, 1, 1, "table-cell-view-mode", 0);
|
|
679
|
+
i0.ɵɵtemplate(1, CellComponent_table_cell_edit_mode_1_Template, 1, 2, "table-cell-edit-mode", 1);
|
|
680
|
+
}
|
|
681
|
+
if (rf & 2) {
|
|
682
|
+
i0.ɵɵproperty("ngIf", !ctx.isInEditing);
|
|
683
|
+
i0.ɵɵadvance(1);
|
|
684
|
+
i0.ɵɵproperty("ngIf", ctx.isInEditing);
|
|
685
|
+
}
|
|
686
|
+
}, dependencies: [i1.NgIf, EditCellComponent, ViewCellComponent], encapsulation: 2 });
|
|
687
|
+
(function () {
|
|
688
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CellComponent, [{
|
|
689
|
+
type: Component,
|
|
690
|
+
args: [{
|
|
691
|
+
selector: 'ng2-smart-table-cell',
|
|
692
|
+
template: `
|
|
693
|
+
<table-cell-view-mode *ngIf="!isInEditing" [cell]="cell"></table-cell-view-mode>
|
|
694
|
+
<table-cell-edit-mode *ngIf="isInEditing" [cell]="cell"
|
|
695
|
+
[inputClass]="inputClass"
|
|
696
|
+
(edited)="onEdited($event)">
|
|
697
|
+
</table-cell-edit-mode>
|
|
698
|
+
`,
|
|
699
|
+
}]
|
|
700
|
+
}], null, { grid: [{
|
|
701
|
+
type: Input
|
|
702
|
+
}], row: [{
|
|
703
|
+
type: Input
|
|
704
|
+
}], editConfirm: [{
|
|
705
|
+
type: Input
|
|
706
|
+
}], createConfirm: [{
|
|
707
|
+
type: Input
|
|
708
|
+
}], isNew: [{
|
|
709
|
+
type: Input
|
|
710
|
+
}], cell: [{
|
|
711
|
+
type: Input
|
|
712
|
+
}], inputClass: [{
|
|
713
|
+
type: Input
|
|
714
|
+
}], mode: [{
|
|
715
|
+
type: Input
|
|
716
|
+
}], isInEditing: [{
|
|
717
|
+
type: Input
|
|
718
|
+
}], edited: [{
|
|
719
|
+
type: Output
|
|
720
|
+
}] });
|
|
721
|
+
})();
|
|
722
|
+
|
|
723
|
+
const CELL_COMPONENTS = [
|
|
724
|
+
CellComponent,
|
|
725
|
+
EditCellDefault,
|
|
726
|
+
DefaultEditor,
|
|
727
|
+
CustomEditComponent,
|
|
728
|
+
DefaultEditComponent,
|
|
729
|
+
EditCellComponent,
|
|
730
|
+
CheckboxEditorComponent,
|
|
731
|
+
CompleterEditorComponent,
|
|
732
|
+
InputEditorComponent,
|
|
733
|
+
SelectEditorComponent,
|
|
734
|
+
TextareaEditorComponent,
|
|
735
|
+
CustomViewComponent,
|
|
736
|
+
ViewCellComponent,
|
|
737
|
+
];
|
|
738
|
+
class CellModule {
|
|
739
|
+
}
|
|
740
|
+
CellModule.ɵfac = function CellModule_Factory(t) { return new (t || CellModule)(); };
|
|
741
|
+
CellModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: CellModule });
|
|
742
|
+
CellModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
743
|
+
FormsModule] });
|
|
744
|
+
(function () {
|
|
745
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CellModule, [{
|
|
746
|
+
type: NgModule,
|
|
747
|
+
args: [{
|
|
748
|
+
imports: [
|
|
749
|
+
CommonModule,
|
|
750
|
+
FormsModule,
|
|
751
|
+
],
|
|
752
|
+
declarations: [
|
|
753
|
+
...CELL_COMPONENTS,
|
|
754
|
+
],
|
|
755
|
+
exports: [
|
|
756
|
+
...CELL_COMPONENTS,
|
|
757
|
+
],
|
|
758
|
+
}]
|
|
759
|
+
}], null, null);
|
|
760
|
+
})();
|
|
761
|
+
(function () {
|
|
762
|
+
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(CellModule, { declarations: [CellComponent,
|
|
763
|
+
EditCellDefault,
|
|
764
|
+
DefaultEditor,
|
|
765
|
+
CustomEditComponent,
|
|
766
|
+
DefaultEditComponent,
|
|
767
|
+
EditCellComponent,
|
|
768
|
+
CheckboxEditorComponent,
|
|
769
|
+
CompleterEditorComponent,
|
|
770
|
+
InputEditorComponent,
|
|
771
|
+
SelectEditorComponent,
|
|
772
|
+
TextareaEditorComponent,
|
|
773
|
+
CustomViewComponent,
|
|
774
|
+
ViewCellComponent], imports: [CommonModule,
|
|
775
|
+
FormsModule], exports: [CellComponent,
|
|
776
|
+
EditCellDefault,
|
|
777
|
+
DefaultEditor,
|
|
778
|
+
CustomEditComponent,
|
|
779
|
+
DefaultEditComponent,
|
|
780
|
+
EditCellComponent,
|
|
781
|
+
CheckboxEditorComponent,
|
|
782
|
+
CompleterEditorComponent,
|
|
783
|
+
InputEditorComponent,
|
|
784
|
+
SelectEditorComponent,
|
|
785
|
+
TextareaEditorComponent,
|
|
786
|
+
CustomViewComponent,
|
|
787
|
+
ViewCellComponent] });
|
|
788
|
+
})();
|
|
789
|
+
|
|
790
|
+
class FilterDefault {
|
|
791
|
+
constructor() {
|
|
792
|
+
this.inputClass = '';
|
|
793
|
+
this.filter = new EventEmitter();
|
|
794
|
+
this.query = '';
|
|
795
|
+
}
|
|
796
|
+
onFilter(query) {
|
|
797
|
+
this.source.addFilter({
|
|
798
|
+
field: this.column.id,
|
|
799
|
+
search: query,
|
|
800
|
+
filter: this.column.getFilterFunction(),
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
FilterDefault.ɵfac = function FilterDefault_Factory(t) { return new (t || FilterDefault)(); };
|
|
805
|
+
FilterDefault.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FilterDefault, selectors: [["ng-component"]], inputs: { column: "column", source: "source", inputClass: "inputClass" }, outputs: { filter: "filter" }, decls: 0, vars: 0, template: function FilterDefault_Template(rf, ctx) { }, encapsulation: 2 });
|
|
806
|
+
(function () {
|
|
807
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FilterDefault, [{
|
|
808
|
+
type: Component,
|
|
809
|
+
args: [{
|
|
810
|
+
template: '',
|
|
811
|
+
}]
|
|
812
|
+
}], null, { column: [{
|
|
813
|
+
type: Input
|
|
814
|
+
}], source: [{
|
|
815
|
+
type: Input
|
|
816
|
+
}], inputClass: [{
|
|
817
|
+
type: Input
|
|
818
|
+
}], filter: [{
|
|
819
|
+
type: Output
|
|
820
|
+
}] });
|
|
821
|
+
})();
|
|
822
|
+
|
|
823
|
+
class DefaultFilter {
|
|
824
|
+
constructor() {
|
|
825
|
+
this.delay = 300;
|
|
826
|
+
this.filter = new EventEmitter();
|
|
827
|
+
}
|
|
828
|
+
ngOnDestroy() {
|
|
829
|
+
if (this.changesSubscription) {
|
|
830
|
+
this.changesSubscription.unsubscribe();
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
setFilter() {
|
|
834
|
+
this.filter.emit(this.query);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
DefaultFilter.ɵfac = function DefaultFilter_Factory(t) { return new (t || DefaultFilter)(); };
|
|
838
|
+
DefaultFilter.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DefaultFilter, selectors: [["ng-component"]], inputs: { query: "query", inputClass: "inputClass", column: "column" }, outputs: { filter: "filter" }, decls: 0, vars: 0, template: function DefaultFilter_Template(rf, ctx) { }, encapsulation: 2 });
|
|
839
|
+
(function () {
|
|
840
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DefaultFilter, [{
|
|
841
|
+
type: Component,
|
|
842
|
+
args: [{
|
|
843
|
+
template: '',
|
|
844
|
+
}]
|
|
845
|
+
}], null, { query: [{
|
|
846
|
+
type: Input
|
|
847
|
+
}], inputClass: [{
|
|
848
|
+
type: Input
|
|
849
|
+
}], column: [{
|
|
850
|
+
type: Input
|
|
851
|
+
}], filter: [{
|
|
852
|
+
type: Output
|
|
853
|
+
}] });
|
|
854
|
+
})();
|
|
855
|
+
|
|
856
|
+
function CheckboxFilterComponent_a_1_Template(rf, ctx) {
|
|
857
|
+
if (rf & 1) {
|
|
858
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
859
|
+
i0.ɵɵelementStart(0, "a", 2);
|
|
860
|
+
i0.ɵɵlistener("click", function CheckboxFilterComponent_a_1_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.resetFilter($event)); });
|
|
861
|
+
i0.ɵɵtext(1);
|
|
862
|
+
i0.ɵɵelementEnd();
|
|
863
|
+
}
|
|
864
|
+
if (rf & 2) {
|
|
865
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
866
|
+
let tmp_0_0;
|
|
867
|
+
i0.ɵɵadvance(1);
|
|
868
|
+
i0.ɵɵtextInterpolate(((tmp_0_0 = ctx_r0.column.getFilterConfig()) == null ? null : tmp_0_0.resetText) || "reset");
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
class CheckboxFilterComponent extends DefaultFilter {
|
|
872
|
+
constructor() {
|
|
873
|
+
super();
|
|
874
|
+
this.filterActive = false;
|
|
875
|
+
this.inputControl = new UntypedFormControl();
|
|
876
|
+
}
|
|
877
|
+
ngOnInit() {
|
|
878
|
+
this.changesSubscription = this.inputControl.valueChanges
|
|
879
|
+
.pipe(debounceTime(this.delay))
|
|
880
|
+
.subscribe((checked) => {
|
|
881
|
+
this.filterActive = true;
|
|
882
|
+
const trueVal = (this.column.getFilterConfig() && this.column.getFilterConfig().true) || true;
|
|
883
|
+
const falseVal = (this.column.getFilterConfig() && this.column.getFilterConfig().false) || false;
|
|
884
|
+
this.query = checked ? trueVal : falseVal;
|
|
885
|
+
this.setFilter();
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
resetFilter(event) {
|
|
889
|
+
event.preventDefault();
|
|
890
|
+
this.query = '';
|
|
891
|
+
this.inputControl.setValue(false, { emitEvent: false });
|
|
892
|
+
this.filterActive = false;
|
|
893
|
+
this.setFilter();
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
CheckboxFilterComponent.ɵfac = function CheckboxFilterComponent_Factory(t) { return new (t || CheckboxFilterComponent)(); };
|
|
897
|
+
CheckboxFilterComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CheckboxFilterComponent, selectors: [["checkbox-filter"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 2, vars: 3, consts: [["type", "checkbox", 1, "form-control", 3, "formControl", "ngClass"], ["href", "#", 3, "click", 4, "ngIf"], ["href", "#", 3, "click"]], template: function CheckboxFilterComponent_Template(rf, ctx) {
|
|
898
|
+
if (rf & 1) {
|
|
899
|
+
i0.ɵɵelement(0, "input", 0);
|
|
900
|
+
i0.ɵɵtemplate(1, CheckboxFilterComponent_a_1_Template, 2, 1, "a", 1);
|
|
901
|
+
}
|
|
902
|
+
if (rf & 2) {
|
|
903
|
+
i0.ɵɵproperty("formControl", ctx.inputControl)("ngClass", ctx.inputClass);
|
|
904
|
+
i0.ɵɵadvance(1);
|
|
905
|
+
i0.ɵɵproperty("ngIf", ctx.filterActive);
|
|
906
|
+
}
|
|
907
|
+
}, dependencies: [i1.NgClass, i1.NgIf, i2.CheckboxControlValueAccessor, i2.NgControlStatus, i2.FormControlDirective], encapsulation: 2 });
|
|
908
|
+
(function () {
|
|
909
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxFilterComponent, [{
|
|
910
|
+
type: Component,
|
|
911
|
+
args: [{
|
|
912
|
+
selector: 'checkbox-filter',
|
|
913
|
+
template: `
|
|
914
|
+
<input type="checkbox" [formControl]="inputControl" [ngClass]="inputClass" class="form-control">
|
|
915
|
+
<a href="#" *ngIf="filterActive"
|
|
916
|
+
(click)="resetFilter($event)">{{column.getFilterConfig()?.resetText || 'reset'}}</a>
|
|
917
|
+
`,
|
|
918
|
+
}]
|
|
919
|
+
}], function () { return []; }, null);
|
|
920
|
+
})();
|
|
921
|
+
|
|
922
|
+
class CompleterFilterComponent extends DefaultFilter {
|
|
923
|
+
constructor() {
|
|
924
|
+
super();
|
|
925
|
+
this.completerContent = new Subject();
|
|
926
|
+
}
|
|
927
|
+
ngOnInit() {
|
|
928
|
+
// const config = this.column.getFilterConfig().completer;
|
|
929
|
+
// config.dataService = this.completerService.local(config.data, config.searchFields, config.titleField);
|
|
930
|
+
// config.dataService.descriptionField(config.descriptionField);
|
|
931
|
+
// this.changesSubscription = this.completerContent
|
|
932
|
+
// .pipe(
|
|
933
|
+
// map((ev: any) => (ev && ev.title) || ev || ''),
|
|
934
|
+
// distinctUntilChanged(),
|
|
935
|
+
// debounceTime(this.delay)
|
|
936
|
+
// )
|
|
937
|
+
// .subscribe((search: string) => {
|
|
938
|
+
// this.query = search;
|
|
939
|
+
// this.setFilter();
|
|
940
|
+
// });
|
|
941
|
+
}
|
|
942
|
+
inputTextChanged(event) {
|
|
943
|
+
// workaround to trigger the search event when the home/end buttons are clicked
|
|
944
|
+
// when this happens the [(ngModel)]="query" is set to "" but the (selected) method is not called
|
|
945
|
+
// so here it gets called manually
|
|
946
|
+
if (event === '') {
|
|
947
|
+
this.completerContent.next(event);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
CompleterFilterComponent.ɵfac = function CompleterFilterComponent_Factory(t) { return new (t || CompleterFilterComponent)(); };
|
|
952
|
+
CompleterFilterComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CompleterFilterComponent, selectors: [["completer-filter"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 0, vars: 0, template: function CompleterFilterComponent_Template(rf, ctx) { }, encapsulation: 2 });
|
|
953
|
+
(function () {
|
|
954
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CompleterFilterComponent, [{
|
|
955
|
+
type: Component,
|
|
956
|
+
args: [{
|
|
957
|
+
selector: 'completer-filter',
|
|
958
|
+
template: `
|
|
959
|
+
<!-- <ng2-completer [(ngModel)]="query"
|
|
960
|
+
(ngModelChange)="inputTextChanged($event)"
|
|
961
|
+
[dataService]="column.getFilterConfig().completer.dataService"
|
|
962
|
+
[minSearchLength]="column.getFilterConfig().completer.minSearchLength || 0"
|
|
963
|
+
[pause]="column.getFilterConfig().completer.pause || 0"
|
|
964
|
+
[placeholder]="column.getFilterConfig().completer.placeholder || 'Start typing...'"
|
|
965
|
+
(selected)="completerContent.next($event)">
|
|
966
|
+
</ng2-completer> -->
|
|
967
|
+
`,
|
|
968
|
+
}]
|
|
969
|
+
}], function () { return []; }, null);
|
|
970
|
+
})();
|
|
971
|
+
|
|
972
|
+
class InputFilterComponent extends DefaultFilter {
|
|
973
|
+
constructor() {
|
|
974
|
+
super();
|
|
975
|
+
this.inputControl = new UntypedFormControl();
|
|
976
|
+
}
|
|
977
|
+
ngOnInit() {
|
|
978
|
+
if (this.query) {
|
|
979
|
+
this.inputControl.setValue(this.query);
|
|
980
|
+
}
|
|
981
|
+
this.inputControl.valueChanges
|
|
982
|
+
.pipe(distinctUntilChanged(), debounceTime(this.delay))
|
|
983
|
+
.subscribe((value) => {
|
|
984
|
+
this.query = this.inputControl.value;
|
|
985
|
+
this.setFilter();
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
ngOnChanges(changes) {
|
|
989
|
+
if (changes.query) {
|
|
990
|
+
this.inputControl.setValue(this.query);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
InputFilterComponent.ɵfac = function InputFilterComponent_Factory(t) { return new (t || InputFilterComponent)(); };
|
|
995
|
+
InputFilterComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: InputFilterComponent, selectors: [["input-filter"]], features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 1, vars: 3, consts: [["type", "text", 1, "form-control", 3, "ngClass", "formControl", "placeholder"]], template: function InputFilterComponent_Template(rf, ctx) {
|
|
996
|
+
if (rf & 1) {
|
|
997
|
+
i0.ɵɵelement(0, "input", 0);
|
|
998
|
+
}
|
|
999
|
+
if (rf & 2) {
|
|
1000
|
+
i0.ɵɵpropertyInterpolate("placeholder", ctx.column.title);
|
|
1001
|
+
i0.ɵɵproperty("ngClass", ctx.inputClass)("formControl", ctx.inputControl);
|
|
1002
|
+
}
|
|
1003
|
+
}, dependencies: [i1.NgClass, i2.DefaultValueAccessor, i2.NgControlStatus, i2.FormControlDirective], encapsulation: 2 });
|
|
1004
|
+
(function () {
|
|
1005
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(InputFilterComponent, [{
|
|
1006
|
+
type: Component,
|
|
1007
|
+
args: [{
|
|
1008
|
+
selector: 'input-filter',
|
|
1009
|
+
template: `
|
|
1010
|
+
<input
|
|
1011
|
+
[ngClass]="inputClass"
|
|
1012
|
+
[formControl]="inputControl"
|
|
1013
|
+
class="form-control"
|
|
1014
|
+
type="text"
|
|
1015
|
+
placeholder="{{ column.title }}"/>
|
|
1016
|
+
`,
|
|
1017
|
+
}]
|
|
1018
|
+
}], function () { return []; }, null);
|
|
1019
|
+
})();
|
|
1020
|
+
|
|
1021
|
+
const _c0$a = ["inputControl"];
|
|
1022
|
+
function SelectFilterComponent_option_4_Template(rf, ctx) {
|
|
1023
|
+
if (rf & 1) {
|
|
1024
|
+
i0.ɵɵelementStart(0, "option", 4);
|
|
1025
|
+
i0.ɵɵtext(1);
|
|
1026
|
+
i0.ɵɵelementEnd();
|
|
1027
|
+
}
|
|
1028
|
+
if (rf & 2) {
|
|
1029
|
+
const option_r2 = ctx.$implicit;
|
|
1030
|
+
i0.ɵɵproperty("value", option_r2.value);
|
|
1031
|
+
i0.ɵɵadvance(1);
|
|
1032
|
+
i0.ɵɵtextInterpolate1(" ", option_r2.title, " ");
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
class SelectFilterComponent extends DefaultFilter {
|
|
1036
|
+
constructor() {
|
|
1037
|
+
super();
|
|
1038
|
+
}
|
|
1039
|
+
ngOnInit() {
|
|
1040
|
+
this.inputControl.valueChanges
|
|
1041
|
+
.pipe(skip(1), distinctUntilChanged(), debounceTime(this.delay))
|
|
1042
|
+
.subscribe((value) => this.setFilter());
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
SelectFilterComponent.ɵfac = function SelectFilterComponent_Factory(t) { return new (t || SelectFilterComponent)(); };
|
|
1046
|
+
SelectFilterComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SelectFilterComponent, selectors: [["select-filter"]], viewQuery: function SelectFilterComponent_Query(rf, ctx) {
|
|
1047
|
+
if (rf & 1) {
|
|
1048
|
+
i0.ɵɵviewQuery(_c0$a, 7, NgControl);
|
|
1049
|
+
}
|
|
1050
|
+
if (rf & 2) {
|
|
1051
|
+
let _t;
|
|
1052
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.inputControl = _t.first);
|
|
1053
|
+
}
|
|
1054
|
+
}, features: [i0.ɵɵInheritDefinitionFeature], decls: 5, vars: 4, consts: [[1, "form-control", 3, "ngClass", "ngModel", "ngModelChange"], ["inputControl", ""], ["value", ""], [3, "value", 4, "ngFor", "ngForOf"], [3, "value"]], template: function SelectFilterComponent_Template(rf, ctx) {
|
|
1055
|
+
if (rf & 1) {
|
|
1056
|
+
i0.ɵɵelementStart(0, "select", 0, 1);
|
|
1057
|
+
i0.ɵɵlistener("ngModelChange", function SelectFilterComponent_Template_select_ngModelChange_0_listener($event) { return ctx.query = $event; });
|
|
1058
|
+
i0.ɵɵelementStart(2, "option", 2);
|
|
1059
|
+
i0.ɵɵtext(3);
|
|
1060
|
+
i0.ɵɵelementEnd();
|
|
1061
|
+
i0.ɵɵtemplate(4, SelectFilterComponent_option_4_Template, 2, 2, "option", 3);
|
|
1062
|
+
i0.ɵɵelementEnd();
|
|
1063
|
+
}
|
|
1064
|
+
if (rf & 2) {
|
|
1065
|
+
i0.ɵɵproperty("ngClass", ctx.inputClass)("ngModel", ctx.query);
|
|
1066
|
+
i0.ɵɵadvance(3);
|
|
1067
|
+
i0.ɵɵtextInterpolate(ctx.column.getFilterConfig().selectText);
|
|
1068
|
+
i0.ɵɵadvance(1);
|
|
1069
|
+
i0.ɵɵproperty("ngForOf", ctx.column.getFilterConfig().list);
|
|
1070
|
+
}
|
|
1071
|
+
}, dependencies: [i1.NgClass, i1.NgForOf, i2.NgSelectOption, i2.ɵNgSelectMultipleOption, i2.SelectControlValueAccessor, i2.NgControlStatus, i2.NgModel], encapsulation: 2 });
|
|
1072
|
+
(function () {
|
|
1073
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SelectFilterComponent, [{
|
|
1074
|
+
type: Component,
|
|
1075
|
+
args: [{
|
|
1076
|
+
selector: 'select-filter',
|
|
1077
|
+
template: `
|
|
1078
|
+
<select [ngClass]="inputClass"
|
|
1079
|
+
class="form-control"
|
|
1080
|
+
#inputControl
|
|
1081
|
+
[(ngModel)]="query">
|
|
1082
|
+
|
|
1083
|
+
<option value="">{{ column.getFilterConfig().selectText }}</option>
|
|
1084
|
+
<option *ngFor="let option of column.getFilterConfig().list" [value]="option.value">
|
|
1085
|
+
{{ option.title }}
|
|
1086
|
+
</option>
|
|
1087
|
+
</select>
|
|
1088
|
+
`,
|
|
1089
|
+
}]
|
|
1090
|
+
}], function () { return []; }, { inputControl: [{
|
|
1091
|
+
type: ViewChild,
|
|
1092
|
+
args: ['inputControl', { read: NgControl, static: true }]
|
|
1093
|
+
}] });
|
|
1094
|
+
})();
|
|
1095
|
+
|
|
1096
|
+
function DefaultFilterComponent_select_filter_1_Template(rf, ctx) {
|
|
1097
|
+
if (rf & 1) {
|
|
1098
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
1099
|
+
i0.ɵɵelementStart(0, "select-filter", 3);
|
|
1100
|
+
i0.ɵɵlistener("filter", function DefaultFilterComponent_select_filter_1_Template_select_filter_filter_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.onFilter($event)); });
|
|
1101
|
+
i0.ɵɵelementEnd();
|
|
1102
|
+
}
|
|
1103
|
+
if (rf & 2) {
|
|
1104
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
1105
|
+
i0.ɵɵproperty("query", ctx_r0.query)("ngClass", ctx_r0.inputClass)("column", ctx_r0.column);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
function DefaultFilterComponent_checkbox_filter_2_Template(rf, ctx) {
|
|
1109
|
+
if (rf & 1) {
|
|
1110
|
+
const _r7 = i0.ɵɵgetCurrentView();
|
|
1111
|
+
i0.ɵɵelementStart(0, "checkbox-filter", 3);
|
|
1112
|
+
i0.ɵɵlistener("filter", function DefaultFilterComponent_checkbox_filter_2_Template_checkbox_filter_filter_0_listener($event) { i0.ɵɵrestoreView(_r7); const ctx_r6 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r6.onFilter($event)); });
|
|
1113
|
+
i0.ɵɵelementEnd();
|
|
1114
|
+
}
|
|
1115
|
+
if (rf & 2) {
|
|
1116
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
1117
|
+
i0.ɵɵproperty("query", ctx_r1.query)("ngClass", ctx_r1.inputClass)("column", ctx_r1.column);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
function DefaultFilterComponent_completer_filter_3_Template(rf, ctx) {
|
|
1121
|
+
if (rf & 1) {
|
|
1122
|
+
const _r9 = i0.ɵɵgetCurrentView();
|
|
1123
|
+
i0.ɵɵelementStart(0, "completer-filter", 3);
|
|
1124
|
+
i0.ɵɵlistener("filter", function DefaultFilterComponent_completer_filter_3_Template_completer_filter_filter_0_listener($event) { i0.ɵɵrestoreView(_r9); const ctx_r8 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r8.onFilter($event)); });
|
|
1125
|
+
i0.ɵɵelementEnd();
|
|
1126
|
+
}
|
|
1127
|
+
if (rf & 2) {
|
|
1128
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
1129
|
+
i0.ɵɵproperty("query", ctx_r2.query)("ngClass", ctx_r2.inputClass)("column", ctx_r2.column);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
function DefaultFilterComponent_input_filter_4_Template(rf, ctx) {
|
|
1133
|
+
if (rf & 1) {
|
|
1134
|
+
const _r11 = i0.ɵɵgetCurrentView();
|
|
1135
|
+
i0.ɵɵelementStart(0, "input-filter", 3);
|
|
1136
|
+
i0.ɵɵlistener("filter", function DefaultFilterComponent_input_filter_4_Template_input_filter_filter_0_listener($event) { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r10.onFilter($event)); });
|
|
1137
|
+
i0.ɵɵelementEnd();
|
|
1138
|
+
}
|
|
1139
|
+
if (rf & 2) {
|
|
1140
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
1141
|
+
i0.ɵɵproperty("query", ctx_r3.query)("ngClass", ctx_r3.inputClass)("column", ctx_r3.column);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
class DefaultFilterComponent extends FilterDefault {
|
|
1145
|
+
}
|
|
1146
|
+
DefaultFilterComponent.ɵfac = /*@__PURE__*/ function () { let ɵDefaultFilterComponent_BaseFactory; return function DefaultFilterComponent_Factory(t) { return (ɵDefaultFilterComponent_BaseFactory || (ɵDefaultFilterComponent_BaseFactory = i0.ɵɵgetInheritedFactory(DefaultFilterComponent)))(t || DefaultFilterComponent); }; }();
|
|
1147
|
+
DefaultFilterComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: DefaultFilterComponent, selectors: [["default-table-filter"]], inputs: { query: "query" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 5, vars: 4, consts: [[3, "ngSwitch"], [3, "query", "ngClass", "column", "filter", 4, "ngSwitchCase"], [3, "query", "ngClass", "column", "filter", 4, "ngSwitchDefault"], [3, "query", "ngClass", "column", "filter"]], template: function DefaultFilterComponent_Template(rf, ctx) {
|
|
1148
|
+
if (rf & 1) {
|
|
1149
|
+
i0.ɵɵelementContainerStart(0, 0);
|
|
1150
|
+
i0.ɵɵtemplate(1, DefaultFilterComponent_select_filter_1_Template, 1, 3, "select-filter", 1);
|
|
1151
|
+
i0.ɵɵtemplate(2, DefaultFilterComponent_checkbox_filter_2_Template, 1, 3, "checkbox-filter", 1);
|
|
1152
|
+
i0.ɵɵtemplate(3, DefaultFilterComponent_completer_filter_3_Template, 1, 3, "completer-filter", 1);
|
|
1153
|
+
i0.ɵɵtemplate(4, DefaultFilterComponent_input_filter_4_Template, 1, 3, "input-filter", 2);
|
|
1154
|
+
i0.ɵɵelementContainerEnd();
|
|
1155
|
+
}
|
|
1156
|
+
if (rf & 2) {
|
|
1157
|
+
i0.ɵɵproperty("ngSwitch", ctx.column.getFilterType());
|
|
1158
|
+
i0.ɵɵadvance(1);
|
|
1159
|
+
i0.ɵɵproperty("ngSwitchCase", "list");
|
|
1160
|
+
i0.ɵɵadvance(1);
|
|
1161
|
+
i0.ɵɵproperty("ngSwitchCase", "checkbox");
|
|
1162
|
+
i0.ɵɵadvance(1);
|
|
1163
|
+
i0.ɵɵproperty("ngSwitchCase", "completer");
|
|
1164
|
+
}
|
|
1165
|
+
}, dependencies: [i1.NgClass, i1.NgSwitch, i1.NgSwitchCase, i1.NgSwitchDefault, CheckboxFilterComponent, CompleterFilterComponent, InputFilterComponent, SelectFilterComponent], encapsulation: 2 });
|
|
1166
|
+
(function () {
|
|
1167
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DefaultFilterComponent, [{
|
|
1168
|
+
type: Component,
|
|
1169
|
+
args: [{
|
|
1170
|
+
selector: 'default-table-filter',
|
|
1171
|
+
template: `
|
|
1172
|
+
<ng-container [ngSwitch]="column.getFilterType()">
|
|
1173
|
+
<select-filter *ngSwitchCase="'list'"
|
|
1174
|
+
[query]="query"
|
|
1175
|
+
[ngClass]="inputClass"
|
|
1176
|
+
[column]="column"
|
|
1177
|
+
(filter)="onFilter($event)">
|
|
1178
|
+
</select-filter>
|
|
1179
|
+
<checkbox-filter *ngSwitchCase="'checkbox'"
|
|
1180
|
+
[query]="query"
|
|
1181
|
+
[ngClass]="inputClass"
|
|
1182
|
+
[column]="column"
|
|
1183
|
+
(filter)="onFilter($event)">
|
|
1184
|
+
</checkbox-filter>
|
|
1185
|
+
<completer-filter *ngSwitchCase="'completer'"
|
|
1186
|
+
[query]="query"
|
|
1187
|
+
[ngClass]="inputClass"
|
|
1188
|
+
[column]="column"
|
|
1189
|
+
(filter)="onFilter($event)">
|
|
1190
|
+
</completer-filter>
|
|
1191
|
+
<input-filter *ngSwitchDefault
|
|
1192
|
+
[query]="query"
|
|
1193
|
+
[ngClass]="inputClass"
|
|
1194
|
+
[column]="column"
|
|
1195
|
+
(filter)="onFilter($event)">
|
|
1196
|
+
</input-filter>
|
|
1197
|
+
</ng-container>
|
|
1198
|
+
`,
|
|
1199
|
+
}]
|
|
1200
|
+
}], null, { query: [{
|
|
1201
|
+
type: Input
|
|
1202
|
+
}] });
|
|
1203
|
+
})();
|
|
1204
|
+
|
|
1205
|
+
const _c0$9 = ["dynamicTarget"];
|
|
1206
|
+
function CustomFilterComponent_ng_template_0_Template(rf, ctx) { }
|
|
1207
|
+
class CustomFilterComponent extends FilterDefault {
|
|
1208
|
+
constructor(resolver) {
|
|
1209
|
+
super();
|
|
1210
|
+
this.resolver = resolver;
|
|
1211
|
+
}
|
|
1212
|
+
ngOnChanges(changes) {
|
|
1213
|
+
if (this.column && !this.customComponent) {
|
|
1214
|
+
const componentFactory = this.resolver.resolveComponentFactory(this.column.filter.component);
|
|
1215
|
+
this.customComponent = this.dynamicTarget.createComponent(componentFactory);
|
|
1216
|
+
// set @Inputs and @Outputs of custom component
|
|
1217
|
+
this.customComponent.instance.query = this.query;
|
|
1218
|
+
this.customComponent.instance.column = this.column;
|
|
1219
|
+
this.customComponent.instance.source = this.source;
|
|
1220
|
+
this.customComponent.instance.inputClass = this.inputClass;
|
|
1221
|
+
this.customComponent.instance.filter.subscribe((event) => this.onFilter(event));
|
|
1222
|
+
}
|
|
1223
|
+
if (this.customComponent) {
|
|
1224
|
+
this.customComponent.instance.ngOnChanges(changes);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
ngOnDestroy() {
|
|
1228
|
+
if (this.customComponent) {
|
|
1229
|
+
this.customComponent.destroy();
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
CustomFilterComponent.ɵfac = function CustomFilterComponent_Factory(t) { return new (t || CustomFilterComponent)(i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver)); };
|
|
1234
|
+
CustomFilterComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CustomFilterComponent, selectors: [["custom-table-filter"]], viewQuery: function CustomFilterComponent_Query(rf, ctx) {
|
|
1235
|
+
if (rf & 1) {
|
|
1236
|
+
i0.ɵɵviewQuery(_c0$9, 7, ViewContainerRef);
|
|
1237
|
+
}
|
|
1238
|
+
if (rf & 2) {
|
|
1239
|
+
let _t;
|
|
1240
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dynamicTarget = _t.first);
|
|
1241
|
+
}
|
|
1242
|
+
}, inputs: { query: "query" }, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 2, vars: 0, consts: [["dynamicTarget", ""]], template: function CustomFilterComponent_Template(rf, ctx) {
|
|
1243
|
+
if (rf & 1) {
|
|
1244
|
+
i0.ɵɵtemplate(0, CustomFilterComponent_ng_template_0_Template, 0, 0, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
|
|
1245
|
+
}
|
|
1246
|
+
}, encapsulation: 2 });
|
|
1247
|
+
(function () {
|
|
1248
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CustomFilterComponent, [{
|
|
1249
|
+
type: Component,
|
|
1250
|
+
args: [{
|
|
1251
|
+
selector: 'custom-table-filter',
|
|
1252
|
+
template: `<ng-template #dynamicTarget></ng-template>`,
|
|
1253
|
+
}]
|
|
1254
|
+
}], function () { return [{ type: i0.ComponentFactoryResolver }]; }, { query: [{
|
|
1255
|
+
type: Input
|
|
1256
|
+
}], dynamicTarget: [{
|
|
1257
|
+
type: ViewChild,
|
|
1258
|
+
args: ['dynamicTarget', { read: ViewContainerRef, static: true }]
|
|
1259
|
+
}] });
|
|
1260
|
+
})();
|
|
1261
|
+
|
|
1262
|
+
function FilterComponent_div_0_custom_table_filter_1_Template(rf, ctx) {
|
|
1263
|
+
if (rf & 1) {
|
|
1264
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
1265
|
+
i0.ɵɵelementStart(0, "custom-table-filter", 4);
|
|
1266
|
+
i0.ɵɵlistener("filter", function FilterComponent_div_0_custom_table_filter_1_Template_custom_table_filter_filter_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r3 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r3.onFilter($event)); });
|
|
1267
|
+
i0.ɵɵelementEnd();
|
|
1268
|
+
}
|
|
1269
|
+
if (rf & 2) {
|
|
1270
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
1271
|
+
i0.ɵɵproperty("query", ctx_r1.query)("column", ctx_r1.column)("source", ctx_r1.source)("inputClass", ctx_r1.inputClass);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
function FilterComponent_div_0_default_table_filter_2_Template(rf, ctx) {
|
|
1275
|
+
if (rf & 1) {
|
|
1276
|
+
const _r6 = i0.ɵɵgetCurrentView();
|
|
1277
|
+
i0.ɵɵelementStart(0, "default-table-filter", 4);
|
|
1278
|
+
i0.ɵɵlistener("filter", function FilterComponent_div_0_default_table_filter_2_Template_default_table_filter_filter_0_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r5 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r5.onFilter($event)); });
|
|
1279
|
+
i0.ɵɵelementEnd();
|
|
1280
|
+
}
|
|
1281
|
+
if (rf & 2) {
|
|
1282
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
1283
|
+
i0.ɵɵproperty("query", ctx_r2.query)("column", ctx_r2.column)("source", ctx_r2.source)("inputClass", ctx_r2.inputClass);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
function FilterComponent_div_0_Template(rf, ctx) {
|
|
1287
|
+
if (rf & 1) {
|
|
1288
|
+
i0.ɵɵelementStart(0, "div", 1);
|
|
1289
|
+
i0.ɵɵtemplate(1, FilterComponent_div_0_custom_table_filter_1_Template, 1, 4, "custom-table-filter", 2);
|
|
1290
|
+
i0.ɵɵtemplate(2, FilterComponent_div_0_default_table_filter_2_Template, 1, 4, "default-table-filter", 3);
|
|
1291
|
+
i0.ɵɵelementEnd();
|
|
1292
|
+
}
|
|
1293
|
+
if (rf & 2) {
|
|
1294
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
1295
|
+
i0.ɵɵproperty("ngSwitch", ctx_r0.column.getFilterType());
|
|
1296
|
+
i0.ɵɵadvance(1);
|
|
1297
|
+
i0.ɵɵproperty("ngSwitchCase", "custom");
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
class FilterComponent extends FilterDefault {
|
|
1301
|
+
constructor() {
|
|
1302
|
+
super(...arguments);
|
|
1303
|
+
this.query = '';
|
|
1304
|
+
}
|
|
1305
|
+
ngOnChanges(changes) {
|
|
1306
|
+
if (changes.source) {
|
|
1307
|
+
if (!changes.source.firstChange) {
|
|
1308
|
+
this.dataChangedSub.unsubscribe();
|
|
1309
|
+
}
|
|
1310
|
+
this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
|
|
1311
|
+
const filterConf = this.source.getFilter();
|
|
1312
|
+
if (filterConf && filterConf.filters && filterConf.filters.length === 0) {
|
|
1313
|
+
this.query = '';
|
|
1314
|
+
// add a check for existing filters an set the query if one exists for this column
|
|
1315
|
+
// this covers instances where the filter is set by user code while maintaining existing functionality
|
|
1316
|
+
}
|
|
1317
|
+
else if (filterConf && filterConf.filters && filterConf.filters.length > 0) {
|
|
1318
|
+
filterConf.filters.forEach((k, v) => {
|
|
1319
|
+
if (k.field == this.column.id) {
|
|
1320
|
+
this.query = k.search;
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
FilterComponent.ɵfac = /*@__PURE__*/ function () { let ɵFilterComponent_BaseFactory; return function FilterComponent_Factory(t) { return (ɵFilterComponent_BaseFactory || (ɵFilterComponent_BaseFactory = i0.ɵɵgetInheritedFactory(FilterComponent)))(t || FilterComponent); }; }();
|
|
1329
|
+
FilterComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FilterComponent, selectors: [["ng2-smart-table-filter"]], features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [["class", "ng2-smart-filter", 3, "ngSwitch", 4, "ngIf"], [1, "ng2-smart-filter", 3, "ngSwitch"], [3, "query", "column", "source", "inputClass", "filter", 4, "ngSwitchCase"], [3, "query", "column", "source", "inputClass", "filter", 4, "ngSwitchDefault"], [3, "query", "column", "source", "inputClass", "filter"]], template: function FilterComponent_Template(rf, ctx) {
|
|
1330
|
+
if (rf & 1) {
|
|
1331
|
+
i0.ɵɵtemplate(0, FilterComponent_div_0_Template, 3, 2, "div", 0);
|
|
1332
|
+
}
|
|
1333
|
+
if (rf & 2) {
|
|
1334
|
+
i0.ɵɵproperty("ngIf", ctx.column.isFilterable);
|
|
1335
|
+
}
|
|
1336
|
+
}, dependencies: [i1.NgIf, i1.NgSwitch, i1.NgSwitchCase, i1.NgSwitchDefault, DefaultFilterComponent, CustomFilterComponent], styles: ["[_nghost-%COMP%] .ng2-smart-filter[_ngcontent-%COMP%] input, [_nghost-%COMP%] .ng2-smart-filter[_ngcontent-%COMP%] select{width:100%;line-height:normal;padding:.375em .75em;font-weight:400}[_nghost-%COMP%] .ng2-smart-filter[_ngcontent-%COMP%] input[type=search]{box-sizing:inherit}[_nghost-%COMP%] .ng2-smart-filter[_ngcontent-%COMP%] .completer-dropdown-holder{font-weight:400}[_nghost-%COMP%] .ng2-smart-filter[_ngcontent-%COMP%] a{font-weight:400}"] });
|
|
1337
|
+
(function () {
|
|
1338
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FilterComponent, [{
|
|
1339
|
+
type: Component,
|
|
1340
|
+
args: [{ selector: 'ng2-smart-table-filter', template: `
|
|
1341
|
+
<div class="ng2-smart-filter" *ngIf="column.isFilterable" [ngSwitch]="column.getFilterType()">
|
|
1342
|
+
<custom-table-filter *ngSwitchCase="'custom'"
|
|
1343
|
+
[query]="query"
|
|
1344
|
+
[column]="column"
|
|
1345
|
+
[source]="source"
|
|
1346
|
+
[inputClass]="inputClass"
|
|
1347
|
+
(filter)="onFilter($event)">
|
|
1348
|
+
</custom-table-filter>
|
|
1349
|
+
<default-table-filter *ngSwitchDefault
|
|
1350
|
+
[query]="query"
|
|
1351
|
+
[column]="column"
|
|
1352
|
+
[source]="source"
|
|
1353
|
+
[inputClass]="inputClass"
|
|
1354
|
+
(filter)="onFilter($event)">
|
|
1355
|
+
</default-table-filter>
|
|
1356
|
+
</div>
|
|
1357
|
+
`, 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"] }]
|
|
1358
|
+
}], null, null);
|
|
1359
|
+
})();
|
|
1360
|
+
|
|
1361
|
+
const FILTER_COMPONENTS = [
|
|
1362
|
+
FilterDefault,
|
|
1363
|
+
DefaultFilter,
|
|
1364
|
+
FilterComponent,
|
|
1365
|
+
DefaultFilterComponent,
|
|
1366
|
+
CustomFilterComponent,
|
|
1367
|
+
CheckboxFilterComponent,
|
|
1368
|
+
CompleterFilterComponent,
|
|
1369
|
+
InputFilterComponent,
|
|
1370
|
+
SelectFilterComponent,
|
|
1371
|
+
];
|
|
1372
|
+
class FilterModule {
|
|
1373
|
+
}
|
|
1374
|
+
FilterModule.ɵfac = function FilterModule_Factory(t) { return new (t || FilterModule)(); };
|
|
1375
|
+
FilterModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: FilterModule });
|
|
1376
|
+
FilterModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
1377
|
+
FormsModule,
|
|
1378
|
+
ReactiveFormsModule] });
|
|
1379
|
+
(function () {
|
|
1380
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FilterModule, [{
|
|
1381
|
+
type: NgModule,
|
|
1382
|
+
args: [{
|
|
1383
|
+
imports: [
|
|
1384
|
+
CommonModule,
|
|
1385
|
+
FormsModule,
|
|
1386
|
+
ReactiveFormsModule,
|
|
1387
|
+
],
|
|
1388
|
+
declarations: [
|
|
1389
|
+
...FILTER_COMPONENTS,
|
|
1390
|
+
],
|
|
1391
|
+
exports: [
|
|
1392
|
+
...FILTER_COMPONENTS,
|
|
1393
|
+
],
|
|
1394
|
+
}]
|
|
1395
|
+
}], null, null);
|
|
1396
|
+
})();
|
|
1397
|
+
(function () {
|
|
1398
|
+
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(FilterModule, { declarations: [FilterDefault,
|
|
1399
|
+
DefaultFilter,
|
|
1400
|
+
FilterComponent,
|
|
1401
|
+
DefaultFilterComponent,
|
|
1402
|
+
CustomFilterComponent,
|
|
1403
|
+
CheckboxFilterComponent,
|
|
1404
|
+
CompleterFilterComponent,
|
|
1405
|
+
InputFilterComponent,
|
|
1406
|
+
SelectFilterComponent], imports: [CommonModule,
|
|
1407
|
+
FormsModule,
|
|
1408
|
+
ReactiveFormsModule], exports: [FilterDefault,
|
|
1409
|
+
DefaultFilter,
|
|
1410
|
+
FilterComponent,
|
|
1411
|
+
DefaultFilterComponent,
|
|
1412
|
+
CustomFilterComponent,
|
|
1413
|
+
CheckboxFilterComponent,
|
|
1414
|
+
CompleterFilterComponent,
|
|
1415
|
+
InputFilterComponent,
|
|
1416
|
+
SelectFilterComponent] });
|
|
1417
|
+
})();
|
|
1418
|
+
|
|
1419
|
+
function PagerComponent_nav_0_li_14_span_1_Template(rf, ctx) {
|
|
1420
|
+
if (rf & 1) {
|
|
1421
|
+
i0.ɵɵelementStart(0, "span", 14);
|
|
1422
|
+
i0.ɵɵtext(1);
|
|
1423
|
+
i0.ɵɵelementStart(2, "span", 7);
|
|
1424
|
+
i0.ɵɵtext(3, "(current)");
|
|
1425
|
+
i0.ɵɵelementEnd()();
|
|
1426
|
+
}
|
|
1427
|
+
if (rf & 2) {
|
|
1428
|
+
const page_r3 = i0.ɵɵnextContext().$implicit;
|
|
1429
|
+
i0.ɵɵadvance(1);
|
|
1430
|
+
i0.ɵɵtextInterpolate1("", page_r3, " ");
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
function PagerComponent_nav_0_li_14_a_2_Template(rf, ctx) {
|
|
1434
|
+
if (rf & 1) {
|
|
1435
|
+
const _r9 = i0.ɵɵgetCurrentView();
|
|
1436
|
+
i0.ɵɵelementStart(0, "a", 15);
|
|
1437
|
+
i0.ɵɵlistener("click", function PagerComponent_nav_0_li_14_a_2_Template_a_click_0_listener() { i0.ɵɵrestoreView(_r9); const page_r3 = i0.ɵɵnextContext().$implicit; const ctx_r7 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r7.paginate(page_r3)); });
|
|
1438
|
+
i0.ɵɵtext(1);
|
|
1439
|
+
i0.ɵɵelementEnd();
|
|
1440
|
+
}
|
|
1441
|
+
if (rf & 2) {
|
|
1442
|
+
const page_r3 = i0.ɵɵnextContext().$implicit;
|
|
1443
|
+
i0.ɵɵadvance(1);
|
|
1444
|
+
i0.ɵɵtextInterpolate(page_r3);
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
const _c0$8 = function (a0) { return { active: a0 }; };
|
|
1448
|
+
function PagerComponent_nav_0_li_14_Template(rf, ctx) {
|
|
1449
|
+
if (rf & 1) {
|
|
1450
|
+
i0.ɵɵelementStart(0, "li", 4);
|
|
1451
|
+
i0.ɵɵtemplate(1, PagerComponent_nav_0_li_14_span_1_Template, 4, 1, "span", 12);
|
|
1452
|
+
i0.ɵɵtemplate(2, PagerComponent_nav_0_li_14_a_2_Template, 2, 1, "a", 13);
|
|
1453
|
+
i0.ɵɵelementEnd();
|
|
1454
|
+
}
|
|
1455
|
+
if (rf & 2) {
|
|
1456
|
+
const page_r3 = ctx.$implicit;
|
|
1457
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
1458
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(3, _c0$8, ctx_r2.getPage() == page_r3));
|
|
1459
|
+
i0.ɵɵadvance(1);
|
|
1460
|
+
i0.ɵɵproperty("ngIf", ctx_r2.getPage() == page_r3);
|
|
1461
|
+
i0.ɵɵadvance(1);
|
|
1462
|
+
i0.ɵɵproperty("ngIf", ctx_r2.getPage() != page_r3);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
const _c1$1 = function (a0) { return { disabled: a0 }; };
|
|
1466
|
+
function PagerComponent_nav_0_Template(rf, ctx) {
|
|
1467
|
+
if (rf & 1) {
|
|
1468
|
+
const _r12 = i0.ɵɵgetCurrentView();
|
|
1469
|
+
i0.ɵɵelementStart(0, "nav", 2)(1, "ul", 3)(2, "li", 4)(3, "a", 5);
|
|
1470
|
+
i0.ɵɵlistener("click", function PagerComponent_nav_0_Template_a_click_3_listener() { i0.ɵɵrestoreView(_r12); const ctx_r11 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r11.getPage() == 1 ? false : ctx_r11.paginate(1)); });
|
|
1471
|
+
i0.ɵɵelementStart(4, "span", 6);
|
|
1472
|
+
i0.ɵɵtext(5, "\u00AB");
|
|
1473
|
+
i0.ɵɵelementEnd();
|
|
1474
|
+
i0.ɵɵelementStart(6, "span", 7);
|
|
1475
|
+
i0.ɵɵtext(7, "First");
|
|
1476
|
+
i0.ɵɵelementEnd()()();
|
|
1477
|
+
i0.ɵɵelementStart(8, "li", 4)(9, "a", 8);
|
|
1478
|
+
i0.ɵɵlistener("click", function PagerComponent_nav_0_Template_a_click_9_listener() { i0.ɵɵrestoreView(_r12); const ctx_r13 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r13.getPage() == 1 ? false : ctx_r13.prev()); });
|
|
1479
|
+
i0.ɵɵelementStart(10, "span", 6);
|
|
1480
|
+
i0.ɵɵtext(11, "<");
|
|
1481
|
+
i0.ɵɵelementEnd();
|
|
1482
|
+
i0.ɵɵelementStart(12, "span", 7);
|
|
1483
|
+
i0.ɵɵtext(13, "Prev");
|
|
1484
|
+
i0.ɵɵelementEnd()()();
|
|
1485
|
+
i0.ɵɵtemplate(14, PagerComponent_nav_0_li_14_Template, 3, 5, "li", 9);
|
|
1486
|
+
i0.ɵɵelementStart(15, "li", 4)(16, "a", 10);
|
|
1487
|
+
i0.ɵɵlistener("click", function PagerComponent_nav_0_Template_a_click_16_listener() { i0.ɵɵrestoreView(_r12); const ctx_r14 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r14.getPage() == ctx_r14.getLast() ? false : ctx_r14.next()); });
|
|
1488
|
+
i0.ɵɵelementStart(17, "span", 6);
|
|
1489
|
+
i0.ɵɵtext(18, ">");
|
|
1490
|
+
i0.ɵɵelementEnd();
|
|
1491
|
+
i0.ɵɵelementStart(19, "span", 7);
|
|
1492
|
+
i0.ɵɵtext(20, "Next");
|
|
1493
|
+
i0.ɵɵelementEnd()()();
|
|
1494
|
+
i0.ɵɵelementStart(21, "li", 4)(22, "a", 11);
|
|
1495
|
+
i0.ɵɵlistener("click", function PagerComponent_nav_0_Template_a_click_22_listener() { i0.ɵɵrestoreView(_r12); const ctx_r15 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r15.getPage() == ctx_r15.getLast() ? false : ctx_r15.paginate(ctx_r15.getLast())); });
|
|
1496
|
+
i0.ɵɵelementStart(23, "span", 6);
|
|
1497
|
+
i0.ɵɵtext(24, "\u00BB");
|
|
1498
|
+
i0.ɵɵelementEnd();
|
|
1499
|
+
i0.ɵɵelementStart(25, "span", 7);
|
|
1500
|
+
i0.ɵɵtext(26, "Last");
|
|
1501
|
+
i0.ɵɵelementEnd()()()()();
|
|
1502
|
+
}
|
|
1503
|
+
if (rf & 2) {
|
|
1504
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
1505
|
+
i0.ɵɵadvance(2);
|
|
1506
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(5, _c1$1, ctx_r0.getPage() == 1));
|
|
1507
|
+
i0.ɵɵadvance(6);
|
|
1508
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(7, _c1$1, ctx_r0.getPage() == 1));
|
|
1509
|
+
i0.ɵɵadvance(6);
|
|
1510
|
+
i0.ɵɵproperty("ngForOf", ctx_r0.getPages());
|
|
1511
|
+
i0.ɵɵadvance(1);
|
|
1512
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(9, _c1$1, ctx_r0.getPage() == ctx_r0.getLast()));
|
|
1513
|
+
i0.ɵɵadvance(6);
|
|
1514
|
+
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(11, _c1$1, ctx_r0.getPage() == ctx_r0.getLast()));
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
function PagerComponent_nav_1_option_4_Template(rf, ctx) {
|
|
1518
|
+
if (rf & 1) {
|
|
1519
|
+
i0.ɵɵelementStart(0, "option", 20);
|
|
1520
|
+
i0.ɵɵtext(1);
|
|
1521
|
+
i0.ɵɵelementEnd();
|
|
1522
|
+
}
|
|
1523
|
+
if (rf & 2) {
|
|
1524
|
+
const item_r17 = ctx.$implicit;
|
|
1525
|
+
i0.ɵɵproperty("value", item_r17);
|
|
1526
|
+
i0.ɵɵadvance(1);
|
|
1527
|
+
i0.ɵɵtextInterpolate(item_r17);
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
function PagerComponent_nav_1_Template(rf, ctx) {
|
|
1531
|
+
if (rf & 1) {
|
|
1532
|
+
const _r19 = i0.ɵɵgetCurrentView();
|
|
1533
|
+
i0.ɵɵelementStart(0, "nav", 16)(1, "label", 17);
|
|
1534
|
+
i0.ɵɵtext(2, " Per Page: ");
|
|
1535
|
+
i0.ɵɵelementEnd();
|
|
1536
|
+
i0.ɵɵelementStart(3, "select", 18);
|
|
1537
|
+
i0.ɵɵlistener("change", function PagerComponent_nav_1_Template_select_change_3_listener($event) { i0.ɵɵrestoreView(_r19); const ctx_r18 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r18.onChangePerPage($event)); })("ngModelChange", function PagerComponent_nav_1_Template_select_ngModelChange_3_listener($event) { i0.ɵɵrestoreView(_r19); const ctx_r20 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r20.currentPerPage = $event); });
|
|
1538
|
+
i0.ɵɵtemplate(4, PagerComponent_nav_1_option_4_Template, 2, 2, "option", 19);
|
|
1539
|
+
i0.ɵɵelementEnd()();
|
|
1540
|
+
}
|
|
1541
|
+
if (rf & 2) {
|
|
1542
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
1543
|
+
i0.ɵɵadvance(3);
|
|
1544
|
+
i0.ɵɵproperty("ngModel", ctx_r1.currentPerPage);
|
|
1545
|
+
i0.ɵɵadvance(1);
|
|
1546
|
+
i0.ɵɵproperty("ngForOf", ctx_r1.perPageSelect);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
class PagerComponent {
|
|
1550
|
+
constructor() {
|
|
1551
|
+
this.perPageSelect = [];
|
|
1552
|
+
this.changePage = new EventEmitter();
|
|
1553
|
+
this.count = 0;
|
|
1554
|
+
}
|
|
1555
|
+
ngOnChanges(changes) {
|
|
1556
|
+
if (changes.source) {
|
|
1557
|
+
if (!changes.source.firstChange) {
|
|
1558
|
+
this.dataChangedSub.unsubscribe();
|
|
1559
|
+
}
|
|
1560
|
+
this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
|
|
1561
|
+
this.page = this.source.getPaging().page;
|
|
1562
|
+
this.perPage = this.source.getPaging().perPage;
|
|
1563
|
+
this.currentPerPage = this.perPage;
|
|
1564
|
+
this.count = this.source.count();
|
|
1565
|
+
if (this.isPageOutOfBounce()) {
|
|
1566
|
+
this.source.setPage(--this.page);
|
|
1567
|
+
}
|
|
1568
|
+
this.processPageChange(dataChanges);
|
|
1569
|
+
this.initPages();
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* We change the page here depending on the action performed against data source
|
|
1575
|
+
* if a new element was added to the end of the table - then change the page to the last
|
|
1576
|
+
* if a new element was added to the beginning of the table - then to the first page
|
|
1577
|
+
* @param changes
|
|
1578
|
+
*/
|
|
1579
|
+
processPageChange(changes) {
|
|
1580
|
+
if (changes['action'] === 'prepend') {
|
|
1581
|
+
this.source.setPage(1);
|
|
1582
|
+
}
|
|
1583
|
+
if (changes['action'] === 'append') {
|
|
1584
|
+
this.source.setPage(this.getLast());
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
shouldShow() {
|
|
1588
|
+
return this.source.count() > this.perPage;
|
|
1589
|
+
}
|
|
1590
|
+
paginate(page) {
|
|
1591
|
+
this.source.setPage(page);
|
|
1592
|
+
this.page = page;
|
|
1593
|
+
this.changePage.emit({ page });
|
|
1594
|
+
return false;
|
|
1595
|
+
}
|
|
1596
|
+
next() {
|
|
1597
|
+
return this.paginate(this.getPage() + 1);
|
|
1598
|
+
}
|
|
1599
|
+
prev() {
|
|
1600
|
+
return this.paginate(this.getPage() - 1);
|
|
1601
|
+
}
|
|
1602
|
+
getPage() {
|
|
1603
|
+
return this.page;
|
|
1604
|
+
}
|
|
1605
|
+
getPages() {
|
|
1606
|
+
return this.pages;
|
|
1607
|
+
}
|
|
1608
|
+
getLast() {
|
|
1609
|
+
return Math.ceil(this.count / this.perPage);
|
|
1610
|
+
}
|
|
1611
|
+
isPageOutOfBounce() {
|
|
1612
|
+
return (this.page * this.perPage) >= (this.count + this.perPage) && this.page > 1;
|
|
1613
|
+
}
|
|
1614
|
+
initPages() {
|
|
1615
|
+
const pagesCount = this.getLast();
|
|
1616
|
+
let showPagesCount = 4;
|
|
1617
|
+
showPagesCount = pagesCount < showPagesCount ? pagesCount : showPagesCount;
|
|
1618
|
+
this.pages = [];
|
|
1619
|
+
if (this.shouldShow()) {
|
|
1620
|
+
let middleOne = Math.ceil(showPagesCount / 2);
|
|
1621
|
+
middleOne = this.page >= middleOne ? this.page : middleOne;
|
|
1622
|
+
let lastOne = middleOne + Math.floor(showPagesCount / 2);
|
|
1623
|
+
lastOne = lastOne >= pagesCount ? pagesCount : lastOne;
|
|
1624
|
+
const firstOne = lastOne - showPagesCount + 1;
|
|
1625
|
+
for (let i = firstOne; i <= lastOne; i++) {
|
|
1626
|
+
this.pages.push(i);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
onChangePerPage(event) {
|
|
1631
|
+
if (this.currentPerPage) {
|
|
1632
|
+
if (typeof this.currentPerPage === 'string' && this.currentPerPage.toLowerCase() === 'all') {
|
|
1633
|
+
this.source.getPaging().perPage = null;
|
|
1634
|
+
}
|
|
1635
|
+
else {
|
|
1636
|
+
this.source.getPaging().perPage = this.currentPerPage * 1;
|
|
1637
|
+
this.source.refresh();
|
|
1638
|
+
}
|
|
1639
|
+
this.initPages();
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
PagerComponent.ɵfac = function PagerComponent_Factory(t) { return new (t || PagerComponent)(); };
|
|
1644
|
+
PagerComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PagerComponent, selectors: [["ng2-smart-table-pager"]], inputs: { source: "source", perPageSelect: "perPageSelect" }, outputs: { changePage: "changePage" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 2, consts: [["class", "ng2-smart-pagination-nav", 4, "ngIf"], ["class", "ng2-smart-pagination-per-page", 4, "ngIf"], [1, "ng2-smart-pagination-nav"], [1, "ng2-smart-pagination", "pagination"], [1, "ng2-smart-page-item", "page-item", 3, "ngClass"], ["href", "#", "aria-label", "First", 1, "ng2-smart-page-link", "page-link", 3, "click"], ["aria-hidden", "true"], [1, "sr-only"], ["href", "#", "aria-label", "Prev", 1, "ng2-smart-page-link", "page-link", "page-link-prev", 3, "click"], ["class", "ng2-smart-page-item page-item", 3, "ngClass", 4, "ngFor", "ngForOf"], ["href", "#", "aria-label", "Next", 1, "ng2-smart-page-link", "page-link", "page-link-next", 3, "click"], ["href", "#", "aria-label", "Last", 1, "ng2-smart-page-link", "page-link", 3, "click"], ["class", "ng2-smart-page-link page-link", 4, "ngIf"], ["class", "ng2-smart-page-link page-link", "href", "#", 3, "click", 4, "ngIf"], [1, "ng2-smart-page-link", "page-link"], ["href", "#", 1, "ng2-smart-page-link", "page-link", 3, "click"], [1, "ng2-smart-pagination-per-page"], ["for", "per-page"], ["id", "per-page", 3, "ngModel", "change", "ngModelChange"], [3, "value", 4, "ngFor", "ngForOf"], [3, "value"]], template: function PagerComponent_Template(rf, ctx) {
|
|
1645
|
+
if (rf & 1) {
|
|
1646
|
+
i0.ɵɵtemplate(0, PagerComponent_nav_0_Template, 27, 13, "nav", 0);
|
|
1647
|
+
i0.ɵɵtemplate(1, PagerComponent_nav_1_Template, 5, 2, "nav", 1);
|
|
1648
|
+
}
|
|
1649
|
+
if (rf & 2) {
|
|
1650
|
+
i0.ɵɵproperty("ngIf", ctx.shouldShow());
|
|
1651
|
+
i0.ɵɵadvance(1);
|
|
1652
|
+
i0.ɵɵproperty("ngIf", ctx.perPageSelect && ctx.perPageSelect.length > 0);
|
|
1653
|
+
}
|
|
1654
|
+
}, dependencies: [i1.NgClass, i1.NgForOf, i1.NgIf, i2.NgSelectOption, i2.ɵNgSelectMultipleOption, i2.SelectControlValueAccessor, i2.NgControlStatus, i2.NgModel], styles: [".ng2-smart-pagination[_ngcontent-%COMP%]{display:inline-flex;font-size:.875em;padding:0}.ng2-smart-pagination[_ngcontent-%COMP%] .sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.ng2-smart-pagination[_ngcontent-%COMP%] .ng2-smart-page-item[_ngcontent-%COMP%]{display:inline}.ng2-smart-pagination[_ngcontent-%COMP%] .page-link-next[_ngcontent-%COMP%], .ng2-smart-pagination[_ngcontent-%COMP%] .page-link-prev[_ngcontent-%COMP%]{font-size:10px}[_nghost-%COMP%]{display:flex;justify-content:space-between}[_nghost-%COMP%] select[_ngcontent-%COMP%]{margin:1rem 0 1rem 1rem}[_nghost-%COMP%] label[_ngcontent-%COMP%]{margin:1rem 0 1rem 1rem;line-height:2.5rem}"] });
|
|
1655
|
+
(function () {
|
|
1656
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PagerComponent, [{
|
|
1657
|
+
type: Component,
|
|
1658
|
+
args: [{ selector: 'ng2-smart-table-pager', template: `
|
|
1659
|
+
<nav *ngIf="shouldShow()" class="ng2-smart-pagination-nav">
|
|
1660
|
+
<ul class="ng2-smart-pagination pagination">
|
|
1661
|
+
<li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
|
|
1662
|
+
<a class="ng2-smart-page-link page-link" href="#"
|
|
1663
|
+
(click)="getPage() == 1 ? false : paginate(1)" aria-label="First">
|
|
1664
|
+
<span aria-hidden="true">«</span>
|
|
1665
|
+
<span class="sr-only">First</span>
|
|
1666
|
+
</a>
|
|
1667
|
+
</li>
|
|
1668
|
+
<li class="ng2-smart-page-item page-item" [ngClass]="{disabled: getPage() == 1}">
|
|
1669
|
+
<a class="ng2-smart-page-link page-link page-link-prev" href="#"
|
|
1670
|
+
(click)="getPage() == 1 ? false : prev()" aria-label="Prev">
|
|
1671
|
+
<span aria-hidden="true"><</span>
|
|
1672
|
+
<span class="sr-only">Prev</span>
|
|
1673
|
+
</a>
|
|
1674
|
+
</li>
|
|
1675
|
+
<li class="ng2-smart-page-item page-item"
|
|
1676
|
+
[ngClass]="{active: getPage() == page}" *ngFor="let page of getPages()">
|
|
1677
|
+
<span class="ng2-smart-page-link page-link"
|
|
1678
|
+
*ngIf="getPage() == page">{{ page }} <span class="sr-only">(current)</span></span>
|
|
1679
|
+
<a class="ng2-smart-page-link page-link" href="#"
|
|
1680
|
+
(click)="paginate(page)" *ngIf="getPage() != page">{{ page }}</a>
|
|
1681
|
+
</li>
|
|
1682
|
+
|
|
1683
|
+
<li class="ng2-smart-page-item page-item"
|
|
1684
|
+
[ngClass]="{disabled: getPage() == getLast()}">
|
|
1685
|
+
<a class="ng2-smart-page-link page-link page-link-next" href="#"
|
|
1686
|
+
(click)="getPage() == getLast() ? false : next()" aria-label="Next">
|
|
1687
|
+
<span aria-hidden="true">></span>
|
|
1688
|
+
<span class="sr-only">Next</span>
|
|
1689
|
+
</a>
|
|
1690
|
+
</li>
|
|
1691
|
+
|
|
1692
|
+
<li class="ng2-smart-page-item page-item"
|
|
1693
|
+
[ngClass]="{disabled: getPage() == getLast()}">
|
|
1694
|
+
<a class="ng2-smart-page-link page-link" href="#"
|
|
1695
|
+
(click)="getPage() == getLast() ? false : paginate(getLast())" aria-label="Last">
|
|
1696
|
+
<span aria-hidden="true">»</span>
|
|
1697
|
+
<span class="sr-only">Last</span>
|
|
1698
|
+
</a>
|
|
1699
|
+
</li>
|
|
1700
|
+
</ul>
|
|
1701
|
+
</nav>
|
|
1702
|
+
|
|
1703
|
+
<nav *ngIf="perPageSelect && perPageSelect.length > 0" class="ng2-smart-pagination-per-page">
|
|
1704
|
+
<label for="per-page">
|
|
1705
|
+
Per Page:
|
|
1706
|
+
</label>
|
|
1707
|
+
<select (change)="onChangePerPage($event)" [(ngModel)]="currentPerPage" id="per-page">
|
|
1708
|
+
<option *ngFor="let item of perPageSelect" [value]="item">{{ item }}</option>
|
|
1709
|
+
</select>
|
|
1710
|
+
</nav>
|
|
1711
|
+
`, 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"] }]
|
|
1712
|
+
}], null, { source: [{
|
|
1713
|
+
type: Input
|
|
1714
|
+
}], perPageSelect: [{
|
|
1715
|
+
type: Input
|
|
1716
|
+
}], changePage: [{
|
|
1717
|
+
type: Output
|
|
1718
|
+
}] });
|
|
1719
|
+
})();
|
|
1720
|
+
|
|
1721
|
+
class PagerModule {
|
|
1722
|
+
}
|
|
1723
|
+
PagerModule.ɵfac = function PagerModule_Factory(t) { return new (t || PagerModule)(); };
|
|
1724
|
+
PagerModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: PagerModule });
|
|
1725
|
+
PagerModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
1726
|
+
FormsModule] });
|
|
1727
|
+
(function () {
|
|
1728
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PagerModule, [{
|
|
1729
|
+
type: NgModule,
|
|
1730
|
+
args: [{
|
|
1731
|
+
imports: [
|
|
1732
|
+
CommonModule,
|
|
1733
|
+
FormsModule,
|
|
1734
|
+
],
|
|
1735
|
+
declarations: [
|
|
1736
|
+
PagerComponent,
|
|
1737
|
+
],
|
|
1738
|
+
exports: [
|
|
1739
|
+
PagerComponent,
|
|
1740
|
+
],
|
|
1741
|
+
}]
|
|
1742
|
+
}], null, null);
|
|
1743
|
+
})();
|
|
1744
|
+
(function () {
|
|
1745
|
+
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(PagerModule, { declarations: [PagerComponent], imports: [CommonModule,
|
|
1746
|
+
FormsModule], exports: [PagerComponent] });
|
|
1747
|
+
})();
|
|
1748
|
+
|
|
1749
|
+
class TbodyCreateCancelComponent {
|
|
1750
|
+
onSave(event) {
|
|
1751
|
+
event.preventDefault();
|
|
1752
|
+
event.stopPropagation();
|
|
1753
|
+
this.grid.save(this.row, this.editConfirm);
|
|
1754
|
+
}
|
|
1755
|
+
onCancelEdit(event) {
|
|
1756
|
+
event.preventDefault();
|
|
1757
|
+
event.stopPropagation();
|
|
1758
|
+
this.row.isInEditing = false;
|
|
1759
|
+
}
|
|
1760
|
+
ngOnChanges() {
|
|
1761
|
+
this.saveButtonContent = this.grid.getSetting('edit.saveButtonContent');
|
|
1762
|
+
this.cancelButtonContent = this.grid.getSetting('edit.cancelButtonContent');
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
TbodyCreateCancelComponent.ɵfac = function TbodyCreateCancelComponent_Factory(t) { return new (t || TbodyCreateCancelComponent)(); };
|
|
1766
|
+
TbodyCreateCancelComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TbodyCreateCancelComponent, selectors: [["ng2-st-tbody-create-cancel"]], inputs: { grid: "grid", row: "row", editConfirm: "editConfirm" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 2, consts: [["href", "#", 1, "ng2-smart-action", "ng2-smart-action-edit-save", 3, "innerHTML", "click"], ["href", "#", 1, "ng2-smart-action", "ng2-smart-action-edit-cancel", 3, "innerHTML", "click"]], template: function TbodyCreateCancelComponent_Template(rf, ctx) {
|
|
1767
|
+
if (rf & 1) {
|
|
1768
|
+
i0.ɵɵelementStart(0, "a", 0);
|
|
1769
|
+
i0.ɵɵlistener("click", function TbodyCreateCancelComponent_Template_a_click_0_listener($event) { return ctx.onSave($event); });
|
|
1770
|
+
i0.ɵɵelementEnd();
|
|
1771
|
+
i0.ɵɵelementStart(1, "a", 1);
|
|
1772
|
+
i0.ɵɵlistener("click", function TbodyCreateCancelComponent_Template_a_click_1_listener($event) { return ctx.onCancelEdit($event); });
|
|
1773
|
+
i0.ɵɵelementEnd();
|
|
1774
|
+
}
|
|
1775
|
+
if (rf & 2) {
|
|
1776
|
+
i0.ɵɵproperty("innerHTML", ctx.saveButtonContent, i0.ɵɵsanitizeHtml);
|
|
1777
|
+
i0.ɵɵadvance(1);
|
|
1778
|
+
i0.ɵɵproperty("innerHTML", ctx.cancelButtonContent, i0.ɵɵsanitizeHtml);
|
|
1779
|
+
}
|
|
1780
|
+
}, encapsulation: 2 });
|
|
1781
|
+
(function () {
|
|
1782
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TbodyCreateCancelComponent, [{
|
|
1783
|
+
type: Component,
|
|
1784
|
+
args: [{
|
|
1785
|
+
selector: 'ng2-st-tbody-create-cancel',
|
|
1786
|
+
template: `
|
|
1787
|
+
<a href="#" class="ng2-smart-action ng2-smart-action-edit-save"
|
|
1788
|
+
[innerHTML]="saveButtonContent" (click)="onSave($event)"></a>
|
|
1789
|
+
<a href="#" class="ng2-smart-action ng2-smart-action-edit-cancel"
|
|
1790
|
+
[innerHTML]="cancelButtonContent" (click)="onCancelEdit($event)"></a>
|
|
1791
|
+
`,
|
|
1792
|
+
}]
|
|
1793
|
+
}], null, { grid: [{
|
|
1794
|
+
type: Input
|
|
1795
|
+
}], row: [{
|
|
1796
|
+
type: Input
|
|
1797
|
+
}], editConfirm: [{
|
|
1798
|
+
type: Input
|
|
1799
|
+
}] });
|
|
1800
|
+
})();
|
|
1801
|
+
|
|
1802
|
+
function TbodyEditDeleteComponent_a_0_Template(rf, ctx) {
|
|
1803
|
+
if (rf & 1) {
|
|
1804
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
1805
|
+
i0.ɵɵelementStart(0, "a", 2);
|
|
1806
|
+
i0.ɵɵlistener("click", function TbodyEditDeleteComponent_a_0_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.onEdit($event)); });
|
|
1807
|
+
i0.ɵɵelementEnd();
|
|
1808
|
+
}
|
|
1809
|
+
if (rf & 2) {
|
|
1810
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
1811
|
+
i0.ɵɵproperty("innerHTML", ctx_r0.editRowButtonContent, i0.ɵɵsanitizeHtml);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
function TbodyEditDeleteComponent_a_1_Template(rf, ctx) {
|
|
1815
|
+
if (rf & 1) {
|
|
1816
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
1817
|
+
i0.ɵɵelementStart(0, "a", 3);
|
|
1818
|
+
i0.ɵɵlistener("click", function TbodyEditDeleteComponent_a_1_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.onDelete($event)); });
|
|
1819
|
+
i0.ɵɵelementEnd();
|
|
1820
|
+
}
|
|
1821
|
+
if (rf & 2) {
|
|
1822
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
1823
|
+
i0.ɵɵproperty("innerHTML", ctx_r1.deleteRowButtonContent, i0.ɵɵsanitizeHtml);
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
class TbodyEditDeleteComponent {
|
|
1827
|
+
constructor() {
|
|
1828
|
+
this.edit = new EventEmitter();
|
|
1829
|
+
this.delete = new EventEmitter();
|
|
1830
|
+
this.editRowSelect = new EventEmitter();
|
|
1831
|
+
}
|
|
1832
|
+
onEdit(event) {
|
|
1833
|
+
event.preventDefault();
|
|
1834
|
+
event.stopPropagation();
|
|
1835
|
+
this.editRowSelect.emit(this.row);
|
|
1836
|
+
if (this.grid.getSetting('mode') === 'external') {
|
|
1837
|
+
this.edit.emit({
|
|
1838
|
+
data: this.row.getData(),
|
|
1839
|
+
source: this.source,
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
else {
|
|
1843
|
+
this.grid.edit(this.row);
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
onDelete(event) {
|
|
1847
|
+
event.preventDefault();
|
|
1848
|
+
event.stopPropagation();
|
|
1849
|
+
if (this.grid.getSetting('mode') === 'external') {
|
|
1850
|
+
this.delete.emit({
|
|
1851
|
+
data: this.row.getData(),
|
|
1852
|
+
source: this.source,
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
else {
|
|
1856
|
+
this.grid.delete(this.row, this.deleteConfirm);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
ngOnChanges() {
|
|
1860
|
+
this.isActionEdit = this.grid.getSetting('actions.edit');
|
|
1861
|
+
this.isActionDelete = this.grid.getSetting('actions.delete');
|
|
1862
|
+
this.editRowButtonContent = this.grid.getSetting('edit.editButtonContent');
|
|
1863
|
+
this.deleteRowButtonContent = this.grid.getSetting('delete.deleteButtonContent');
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
TbodyEditDeleteComponent.ɵfac = function TbodyEditDeleteComponent_Factory(t) { return new (t || TbodyEditDeleteComponent)(); };
|
|
1867
|
+
TbodyEditDeleteComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TbodyEditDeleteComponent, selectors: [["ng2-st-tbody-edit-delete"]], inputs: { grid: "grid", row: "row", source: "source", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm" }, outputs: { edit: "edit", delete: "delete", editRowSelect: "editRowSelect" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 2, consts: [["href", "#", "class", "ng2-smart-action ng2-smart-action-edit-edit", 3, "innerHTML", "click", 4, "ngIf"], ["href", "#", "class", "ng2-smart-action ng2-smart-action-delete-delete", 3, "innerHTML", "click", 4, "ngIf"], ["href", "#", 1, "ng2-smart-action", "ng2-smart-action-edit-edit", 3, "innerHTML", "click"], ["href", "#", 1, "ng2-smart-action", "ng2-smart-action-delete-delete", 3, "innerHTML", "click"]], template: function TbodyEditDeleteComponent_Template(rf, ctx) {
|
|
1868
|
+
if (rf & 1) {
|
|
1869
|
+
i0.ɵɵtemplate(0, TbodyEditDeleteComponent_a_0_Template, 1, 1, "a", 0);
|
|
1870
|
+
i0.ɵɵtemplate(1, TbodyEditDeleteComponent_a_1_Template, 1, 1, "a", 1);
|
|
1871
|
+
}
|
|
1872
|
+
if (rf & 2) {
|
|
1873
|
+
i0.ɵɵproperty("ngIf", ctx.isActionEdit);
|
|
1874
|
+
i0.ɵɵadvance(1);
|
|
1875
|
+
i0.ɵɵproperty("ngIf", ctx.isActionDelete);
|
|
1876
|
+
}
|
|
1877
|
+
}, dependencies: [i1.NgIf], encapsulation: 2, changeDetection: 0 });
|
|
1878
|
+
(function () {
|
|
1879
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TbodyEditDeleteComponent, [{
|
|
1880
|
+
type: Component,
|
|
1881
|
+
args: [{
|
|
1882
|
+
selector: 'ng2-st-tbody-edit-delete',
|
|
1883
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1884
|
+
template: `
|
|
1885
|
+
<a href="#" *ngIf="isActionEdit" class="ng2-smart-action ng2-smart-action-edit-edit"
|
|
1886
|
+
[innerHTML]="editRowButtonContent" (click)="onEdit($event)"></a>
|
|
1887
|
+
<a href="#" *ngIf="isActionDelete" class="ng2-smart-action ng2-smart-action-delete-delete"
|
|
1888
|
+
[innerHTML]="deleteRowButtonContent" (click)="onDelete($event)"></a>
|
|
1889
|
+
`,
|
|
1890
|
+
}]
|
|
1891
|
+
}], null, { grid: [{
|
|
1892
|
+
type: Input
|
|
1893
|
+
}], row: [{
|
|
1894
|
+
type: Input
|
|
1895
|
+
}], source: [{
|
|
1896
|
+
type: Input
|
|
1897
|
+
}], deleteConfirm: [{
|
|
1898
|
+
type: Input
|
|
1899
|
+
}], editConfirm: [{
|
|
1900
|
+
type: Input
|
|
1901
|
+
}], edit: [{
|
|
1902
|
+
type: Output
|
|
1903
|
+
}], delete: [{
|
|
1904
|
+
type: Output
|
|
1905
|
+
}], editRowSelect: [{
|
|
1906
|
+
type: Output
|
|
1907
|
+
}] });
|
|
1908
|
+
})();
|
|
1909
|
+
|
|
1910
|
+
function TbodyCustomComponent_a_0_Template(rf, ctx) {
|
|
1911
|
+
if (rf & 1) {
|
|
1912
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
1913
|
+
i0.ɵɵelementStart(0, "a", 1);
|
|
1914
|
+
i0.ɵɵlistener("click", function TbodyCustomComponent_a_0_Template_a_click_0_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r3); const action_r1 = restoredCtx.$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.onCustom(action_r1, $event)); });
|
|
1915
|
+
i0.ɵɵelementEnd();
|
|
1916
|
+
}
|
|
1917
|
+
if (rf & 2) {
|
|
1918
|
+
const action_r1 = ctx.$implicit;
|
|
1919
|
+
i0.ɵɵproperty("innerHTML", action_r1.title, i0.ɵɵsanitizeHtml);
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
class TbodyCustomComponent {
|
|
1923
|
+
constructor() {
|
|
1924
|
+
this.custom = new EventEmitter();
|
|
1925
|
+
}
|
|
1926
|
+
onCustom(action, event) {
|
|
1927
|
+
event.preventDefault();
|
|
1928
|
+
event.stopPropagation();
|
|
1929
|
+
this.custom.emit({
|
|
1930
|
+
action: action.name,
|
|
1931
|
+
data: this.row.getData(),
|
|
1932
|
+
source: this.source
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
TbodyCustomComponent.ɵfac = function TbodyCustomComponent_Factory(t) { return new (t || TbodyCustomComponent)(); };
|
|
1937
|
+
TbodyCustomComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TbodyCustomComponent, selectors: [["ng2-st-tbody-custom"]], inputs: { grid: "grid", row: "row", source: "source" }, outputs: { custom: "custom" }, decls: 1, vars: 1, consts: [["href", "#", "class", "ng2-smart-action ng2-smart-action-custom-custom", 3, "innerHTML", "click", 4, "ngFor", "ngForOf"], ["href", "#", 1, "ng2-smart-action", "ng2-smart-action-custom-custom", 3, "innerHTML", "click"]], template: function TbodyCustomComponent_Template(rf, ctx) {
|
|
1938
|
+
if (rf & 1) {
|
|
1939
|
+
i0.ɵɵtemplate(0, TbodyCustomComponent_a_0_Template, 1, 1, "a", 0);
|
|
1940
|
+
}
|
|
1941
|
+
if (rf & 2) {
|
|
1942
|
+
i0.ɵɵproperty("ngForOf", ctx.grid.getSetting("actions.custom"));
|
|
1943
|
+
}
|
|
1944
|
+
}, dependencies: [i1.NgForOf], encapsulation: 2, changeDetection: 0 });
|
|
1945
|
+
(function () {
|
|
1946
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TbodyCustomComponent, [{
|
|
1947
|
+
type: Component,
|
|
1948
|
+
args: [{
|
|
1949
|
+
selector: 'ng2-st-tbody-custom',
|
|
1950
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1951
|
+
template: `
|
|
1952
|
+
<a *ngFor="let action of grid.getSetting('actions.custom')" href="#"
|
|
1953
|
+
class="ng2-smart-action ng2-smart-action-custom-custom"
|
|
1954
|
+
[innerHTML]="action.title"
|
|
1955
|
+
(click)="onCustom(action, $event)"></a>
|
|
1956
|
+
`
|
|
1957
|
+
}]
|
|
1958
|
+
}], null, { grid: [{
|
|
1959
|
+
type: Input
|
|
1960
|
+
}], row: [{
|
|
1961
|
+
type: Input
|
|
1962
|
+
}], source: [{
|
|
1963
|
+
type: Input
|
|
1964
|
+
}], custom: [{
|
|
1965
|
+
type: Output
|
|
1966
|
+
}] });
|
|
1967
|
+
})();
|
|
1968
|
+
|
|
1969
|
+
const _c0$7 = ["ng2-st-tbody", ""];
|
|
1970
|
+
function Ng2SmartTableTbodyComponent_tr_0_td_1_Template(rf, ctx) {
|
|
1971
|
+
if (rf & 1) {
|
|
1972
|
+
const _r11 = i0.ɵɵgetCurrentView();
|
|
1973
|
+
i0.ɵɵelementStart(0, "td", 7);
|
|
1974
|
+
i0.ɵɵlistener("click", function Ng2SmartTableTbodyComponent_tr_0_td_1_Template_td_click_0_listener($event) { i0.ɵɵrestoreView(_r11); const row_r2 = i0.ɵɵnextContext().$implicit; const ctx_r9 = i0.ɵɵnextContext(); ctx_r9.multipleSelectRow.emit(row_r2); return i0.ɵɵresetView($event.stopPropagation()); });
|
|
1975
|
+
i0.ɵɵelement(1, "input", 8);
|
|
1976
|
+
i0.ɵɵelementEnd();
|
|
1977
|
+
}
|
|
1978
|
+
if (rf & 2) {
|
|
1979
|
+
const row_r2 = i0.ɵɵnextContext().$implicit;
|
|
1980
|
+
i0.ɵɵadvance(1);
|
|
1981
|
+
i0.ɵɵproperty("ngModel", row_r2.isSelected);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
function Ng2SmartTableTbodyComponent_tr_0_td_2_Template(rf, ctx) {
|
|
1985
|
+
if (rf & 1) {
|
|
1986
|
+
const _r15 = i0.ɵɵgetCurrentView();
|
|
1987
|
+
i0.ɵɵelementStart(0, "td", 9);
|
|
1988
|
+
i0.ɵɵlistener("click", function Ng2SmartTableTbodyComponent_tr_0_td_2_Template_td_click_0_listener($event) { return $event.stopPropagation(); });
|
|
1989
|
+
i0.ɵɵelementStart(1, "ng2-st-tbody-custom", 10);
|
|
1990
|
+
i0.ɵɵlistener("custom", function Ng2SmartTableTbodyComponent_tr_0_td_2_Template_ng2_st_tbody_custom_custom_1_listener($event) { i0.ɵɵrestoreView(_r15); const ctx_r14 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r14.custom.emit($event)); });
|
|
1991
|
+
i0.ɵɵelementEnd();
|
|
1992
|
+
i0.ɵɵelementStart(2, "ng2-st-tbody-edit-delete", 11);
|
|
1993
|
+
i0.ɵɵlistener("edit", function Ng2SmartTableTbodyComponent_tr_0_td_2_Template_ng2_st_tbody_edit_delete_edit_2_listener() { i0.ɵɵrestoreView(_r15); const row_r2 = i0.ɵɵnextContext().$implicit; const ctx_r16 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r16.edit.emit(row_r2)); })("delete", function Ng2SmartTableTbodyComponent_tr_0_td_2_Template_ng2_st_tbody_edit_delete_delete_2_listener() { i0.ɵɵrestoreView(_r15); const row_r2 = i0.ɵɵnextContext().$implicit; const ctx_r18 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r18.delete.emit(row_r2)); })("editRowSelect", function Ng2SmartTableTbodyComponent_tr_0_td_2_Template_ng2_st_tbody_edit_delete_editRowSelect_2_listener($event) { i0.ɵɵrestoreView(_r15); const ctx_r20 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r20.editRowSelect.emit($event)); });
|
|
1994
|
+
i0.ɵɵelementEnd()();
|
|
1995
|
+
}
|
|
1996
|
+
if (rf & 2) {
|
|
1997
|
+
const row_r2 = i0.ɵɵnextContext().$implicit;
|
|
1998
|
+
const ctx_r4 = i0.ɵɵnextContext();
|
|
1999
|
+
i0.ɵɵadvance(1);
|
|
2000
|
+
i0.ɵɵproperty("grid", ctx_r4.grid)("row", row_r2)("source", ctx_r4.source);
|
|
2001
|
+
i0.ɵɵadvance(1);
|
|
2002
|
+
i0.ɵɵproperty("grid", ctx_r4.grid)("deleteConfirm", ctx_r4.deleteConfirm)("editConfirm", ctx_r4.editConfirm)("row", row_r2)("source", ctx_r4.source);
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
function Ng2SmartTableTbodyComponent_tr_0_td_3_Template(rf, ctx) {
|
|
2006
|
+
if (rf & 1) {
|
|
2007
|
+
i0.ɵɵelementStart(0, "td", 12);
|
|
2008
|
+
i0.ɵɵelement(1, "ng2-st-tbody-create-cancel", 13);
|
|
2009
|
+
i0.ɵɵelementEnd();
|
|
2010
|
+
}
|
|
2011
|
+
if (rf & 2) {
|
|
2012
|
+
const row_r2 = i0.ɵɵnextContext().$implicit;
|
|
2013
|
+
const ctx_r5 = i0.ɵɵnextContext();
|
|
2014
|
+
i0.ɵɵadvance(1);
|
|
2015
|
+
i0.ɵɵproperty("grid", ctx_r5.grid)("row", row_r2)("editConfirm", ctx_r5.editConfirm);
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
function Ng2SmartTableTbodyComponent_tr_0_td_4_Template(rf, ctx) {
|
|
2019
|
+
if (rf & 1) {
|
|
2020
|
+
i0.ɵɵelementStart(0, "td");
|
|
2021
|
+
i0.ɵɵelement(1, "ng2-smart-table-cell", 14);
|
|
2022
|
+
i0.ɵɵelementEnd();
|
|
2023
|
+
}
|
|
2024
|
+
if (rf & 2) {
|
|
2025
|
+
const cell_r23 = ctx.$implicit;
|
|
2026
|
+
const row_r2 = i0.ɵɵnextContext().$implicit;
|
|
2027
|
+
const ctx_r6 = i0.ɵɵnextContext();
|
|
2028
|
+
i0.ɵɵadvance(1);
|
|
2029
|
+
i0.ɵɵproperty("cell", cell_r23)("grid", ctx_r6.grid)("row", row_r2)("isNew", false)("mode", ctx_r6.mode)("editConfirm", ctx_r6.editConfirm)("inputClass", ctx_r6.editInputClass)("isInEditing", row_r2.isInEditing);
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
function Ng2SmartTableTbodyComponent_tr_0_td_5_Template(rf, ctx) {
|
|
2033
|
+
if (rf & 1) {
|
|
2034
|
+
i0.ɵɵelementStart(0, "td", 12);
|
|
2035
|
+
i0.ɵɵelement(1, "ng2-st-tbody-create-cancel", 13);
|
|
2036
|
+
i0.ɵɵelementEnd();
|
|
2037
|
+
}
|
|
2038
|
+
if (rf & 2) {
|
|
2039
|
+
const row_r2 = i0.ɵɵnextContext().$implicit;
|
|
2040
|
+
const ctx_r7 = i0.ɵɵnextContext();
|
|
2041
|
+
i0.ɵɵadvance(1);
|
|
2042
|
+
i0.ɵɵproperty("grid", ctx_r7.grid)("row", row_r2)("editConfirm", ctx_r7.editConfirm);
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
function Ng2SmartTableTbodyComponent_tr_0_td_6_Template(rf, ctx) {
|
|
2046
|
+
if (rf & 1) {
|
|
2047
|
+
const _r27 = i0.ɵɵgetCurrentView();
|
|
2048
|
+
i0.ɵɵelementStart(0, "td", 12)(1, "ng2-st-tbody-custom", 10);
|
|
2049
|
+
i0.ɵɵlistener("custom", function Ng2SmartTableTbodyComponent_tr_0_td_6_Template_ng2_st_tbody_custom_custom_1_listener($event) { i0.ɵɵrestoreView(_r27); const ctx_r26 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r26.custom.emit($event)); });
|
|
2050
|
+
i0.ɵɵelementEnd();
|
|
2051
|
+
i0.ɵɵelementStart(2, "ng2-st-tbody-edit-delete", 11);
|
|
2052
|
+
i0.ɵɵlistener("edit", function Ng2SmartTableTbodyComponent_tr_0_td_6_Template_ng2_st_tbody_edit_delete_edit_2_listener() { i0.ɵɵrestoreView(_r27); const row_r2 = i0.ɵɵnextContext().$implicit; const ctx_r28 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r28.edit.emit(row_r2)); })("delete", function Ng2SmartTableTbodyComponent_tr_0_td_6_Template_ng2_st_tbody_edit_delete_delete_2_listener() { i0.ɵɵrestoreView(_r27); const row_r2 = i0.ɵɵnextContext().$implicit; const ctx_r30 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r30.delete.emit(row_r2)); })("editRowSelect", function Ng2SmartTableTbodyComponent_tr_0_td_6_Template_ng2_st_tbody_edit_delete_editRowSelect_2_listener($event) { i0.ɵɵrestoreView(_r27); const ctx_r32 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r32.editRowSelect.emit($event)); });
|
|
2053
|
+
i0.ɵɵelementEnd()();
|
|
2054
|
+
}
|
|
2055
|
+
if (rf & 2) {
|
|
2056
|
+
const row_r2 = i0.ɵɵnextContext().$implicit;
|
|
2057
|
+
const ctx_r8 = i0.ɵɵnextContext();
|
|
2058
|
+
i0.ɵɵadvance(1);
|
|
2059
|
+
i0.ɵɵproperty("grid", ctx_r8.grid)("row", row_r2)("source", ctx_r8.source);
|
|
2060
|
+
i0.ɵɵadvance(1);
|
|
2061
|
+
i0.ɵɵproperty("grid", ctx_r8.grid)("deleteConfirm", ctx_r8.deleteConfirm)("editConfirm", ctx_r8.editConfirm)("row", row_r2)("source", ctx_r8.source);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
const _c1 = function (a0) { return { selected: a0 }; };
|
|
2065
|
+
function Ng2SmartTableTbodyComponent_tr_0_Template(rf, ctx) {
|
|
2066
|
+
if (rf & 1) {
|
|
2067
|
+
const _r35 = i0.ɵɵgetCurrentView();
|
|
2068
|
+
i0.ɵɵelementStart(0, "tr", 2);
|
|
2069
|
+
i0.ɵɵlistener("click", function Ng2SmartTableTbodyComponent_tr_0_Template_tr_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r35); const row_r2 = restoredCtx.$implicit; const ctx_r34 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r34.userClickedRow.emit(row_r2)); })("mouseover", function Ng2SmartTableTbodyComponent_tr_0_Template_tr_mouseover_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r35); const row_r2 = restoredCtx.$implicit; const ctx_r36 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r36.rowHover.emit(row_r2)); });
|
|
2070
|
+
i0.ɵɵtemplate(1, Ng2SmartTableTbodyComponent_tr_0_td_1_Template, 2, 1, "td", 3);
|
|
2071
|
+
i0.ɵɵtemplate(2, Ng2SmartTableTbodyComponent_tr_0_td_2_Template, 3, 8, "td", 4);
|
|
2072
|
+
i0.ɵɵtemplate(3, Ng2SmartTableTbodyComponent_tr_0_td_3_Template, 2, 3, "td", 5);
|
|
2073
|
+
i0.ɵɵtemplate(4, Ng2SmartTableTbodyComponent_tr_0_td_4_Template, 2, 8, "td", 6);
|
|
2074
|
+
i0.ɵɵtemplate(5, Ng2SmartTableTbodyComponent_tr_0_td_5_Template, 2, 3, "td", 5);
|
|
2075
|
+
i0.ɵɵtemplate(6, Ng2SmartTableTbodyComponent_tr_0_td_6_Template, 3, 8, "td", 5);
|
|
2076
|
+
i0.ɵɵelementEnd();
|
|
2077
|
+
}
|
|
2078
|
+
if (rf & 2) {
|
|
2079
|
+
const row_r2 = ctx.$implicit;
|
|
2080
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
2081
|
+
i0.ɵɵproperty("className", ctx_r0.rowClassFunction(row_r2))("ngClass", i0.ɵɵpureFunction1(8, _c1, row_r2.isSelected));
|
|
2082
|
+
i0.ɵɵadvance(1);
|
|
2083
|
+
i0.ɵɵproperty("ngIf", ctx_r0.isMultiSelectVisible);
|
|
2084
|
+
i0.ɵɵadvance(1);
|
|
2085
|
+
i0.ɵɵproperty("ngIf", !row_r2.isInEditing && ctx_r0.showActionColumnLeft);
|
|
2086
|
+
i0.ɵɵadvance(1);
|
|
2087
|
+
i0.ɵɵproperty("ngIf", row_r2.isInEditing && ctx_r0.showActionColumnLeft);
|
|
2088
|
+
i0.ɵɵadvance(1);
|
|
2089
|
+
i0.ɵɵproperty("ngForOf", ctx_r0.getVisibleCells(row_r2.cells));
|
|
2090
|
+
i0.ɵɵadvance(1);
|
|
2091
|
+
i0.ɵɵproperty("ngIf", row_r2.isInEditing && ctx_r0.showActionColumnRight);
|
|
2092
|
+
i0.ɵɵadvance(1);
|
|
2093
|
+
i0.ɵɵproperty("ngIf", !row_r2.isInEditing && ctx_r0.showActionColumnRight);
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
function Ng2SmartTableTbodyComponent_tr_1_Template(rf, ctx) {
|
|
2097
|
+
if (rf & 1) {
|
|
2098
|
+
i0.ɵɵelementStart(0, "tr")(1, "td");
|
|
2099
|
+
i0.ɵɵtext(2);
|
|
2100
|
+
i0.ɵɵelementEnd()();
|
|
2101
|
+
}
|
|
2102
|
+
if (rf & 2) {
|
|
2103
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
2104
|
+
i0.ɵɵadvance(1);
|
|
2105
|
+
i0.ɵɵattribute("colspan", ctx_r1.tableColumnsCount);
|
|
2106
|
+
i0.ɵɵadvance(1);
|
|
2107
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r1.noDataMessage, " ");
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
class Ng2SmartTableTbodyComponent {
|
|
2111
|
+
constructor() {
|
|
2112
|
+
this.save = new EventEmitter();
|
|
2113
|
+
this.cancel = new EventEmitter();
|
|
2114
|
+
this.edit = new EventEmitter();
|
|
2115
|
+
this.delete = new EventEmitter();
|
|
2116
|
+
this.custom = new EventEmitter();
|
|
2117
|
+
this.edited = new EventEmitter();
|
|
2118
|
+
this.userSelectRow = new EventEmitter();
|
|
2119
|
+
this.userClickedRow = new EventEmitter();
|
|
2120
|
+
this.editRowSelect = new EventEmitter();
|
|
2121
|
+
this.multipleSelectRow = new EventEmitter();
|
|
2122
|
+
this.rowHover = new EventEmitter();
|
|
2123
|
+
}
|
|
2124
|
+
get tableColumnsCount() {
|
|
2125
|
+
const actionColumns = this.isActionAdd || this.isActionEdit || this.isActionDelete ? 1 : 0;
|
|
2126
|
+
return this.grid.getColumns().length + actionColumns;
|
|
2127
|
+
}
|
|
2128
|
+
ngOnChanges() {
|
|
2129
|
+
this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
|
|
2130
|
+
this.showActionColumnLeft = this.grid.showActionColumn('left');
|
|
2131
|
+
this.mode = this.grid.getSetting('mode');
|
|
2132
|
+
this.editInputClass = this.grid.getSetting('edit.inputClass');
|
|
2133
|
+
this.showActionColumnRight = this.grid.showActionColumn('right');
|
|
2134
|
+
this.isActionAdd = this.grid.getSetting('actions.add');
|
|
2135
|
+
this.isActionEdit = this.grid.getSetting('actions.edit');
|
|
2136
|
+
this.isActionDelete = this.grid.getSetting('actions.delete');
|
|
2137
|
+
this.noDataMessage = this.grid.getSetting('noDataMessage');
|
|
2138
|
+
}
|
|
2139
|
+
getVisibleCells(cells) {
|
|
2140
|
+
return (cells || []).filter((cell) => !cell.getColumn().hide);
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
Ng2SmartTableTbodyComponent.ɵfac = function Ng2SmartTableTbodyComponent_Factory(t) { return new (t || Ng2SmartTableTbodyComponent)(); };
|
|
2144
|
+
Ng2SmartTableTbodyComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Ng2SmartTableTbodyComponent, selectors: [["", "ng2-st-tbody", ""]], inputs: { grid: "grid", source: "source", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", rowClassFunction: "rowClassFunction" }, outputs: { save: "save", cancel: "cancel", edit: "edit", delete: "delete", custom: "custom", edited: "edited", userSelectRow: "userSelectRow", userClickedRow: "userClickedRow", editRowSelect: "editRowSelect", multipleSelectRow: "multipleSelectRow", rowHover: "rowHover" }, features: [i0.ɵɵNgOnChangesFeature], attrs: _c0$7, decls: 2, vars: 2, consts: [["class", "ng2-smart-row", 3, "className", "ngClass", "click", "mouseover", 4, "ngFor", "ngForOf"], [4, "ngIf"], [1, "ng2-smart-row", 3, "className", "ngClass", "click", "mouseover"], ["class", "ng2-smart-actions ng2-smart-action-multiple-select", 3, "click", 4, "ngIf"], ["class", "ng2-smart-actions", 3, "click", 4, "ngIf"], ["class", "ng2-smart-actions", 4, "ngIf"], [4, "ngFor", "ngForOf"], [1, "ng2-smart-actions", "ng2-smart-action-multiple-select", 3, "click"], ["type", "checkbox", 1, "form-control", 3, "ngModel"], [1, "ng2-smart-actions", 3, "click"], [3, "grid", "row", "source", "custom"], [3, "grid", "deleteConfirm", "editConfirm", "row", "source", "edit", "delete", "editRowSelect"], [1, "ng2-smart-actions"], [3, "grid", "row", "editConfirm"], [3, "cell", "grid", "row", "isNew", "mode", "editConfirm", "inputClass", "isInEditing"]], template: function Ng2SmartTableTbodyComponent_Template(rf, ctx) {
|
|
2145
|
+
if (rf & 1) {
|
|
2146
|
+
i0.ɵɵtemplate(0, Ng2SmartTableTbodyComponent_tr_0_Template, 7, 10, "tr", 0);
|
|
2147
|
+
i0.ɵɵtemplate(1, Ng2SmartTableTbodyComponent_tr_1_Template, 3, 2, "tr", 1);
|
|
2148
|
+
}
|
|
2149
|
+
if (rf & 2) {
|
|
2150
|
+
i0.ɵɵproperty("ngForOf", ctx.grid.getRows());
|
|
2151
|
+
i0.ɵɵadvance(1);
|
|
2152
|
+
i0.ɵɵproperty("ngIf", ctx.grid.getRows().length == 0);
|
|
2153
|
+
}
|
|
2154
|
+
}, dependencies: [i1.NgClass, i1.NgForOf, i1.NgIf, i2.CheckboxControlValueAccessor, i2.NgControlStatus, i2.NgModel, CellComponent, TbodyCreateCancelComponent, TbodyEditDeleteComponent, TbodyCustomComponent], styles: ["[_nghost-%COMP%] .ng2-smart-row.selected[_ngcontent-%COMP%]{background:rgba(0,0,0,.05)}[_nghost-%COMP%] .ng2-smart-row[_ngcontent-%COMP%] .ng2-smart-actions.ng2-smart-action-multiple-select[_ngcontent-%COMP%]{text-align:center}[_nghost-%COMP%] ng2-st-tbody-edit-delete a:first-child, [_nghost-%COMP%] ng2-st-tbody-create-cancel a:first-child{margin-right:.25rem}"] });
|
|
2155
|
+
(function () {
|
|
2156
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Ng2SmartTableTbodyComponent, [{
|
|
2157
|
+
type: Component,
|
|
2158
|
+
args: [{ selector: '[ng2-st-tbody]', template: "<tr *ngFor=\"let row of grid.getRows()\" (click)=\"userClickedRow.emit(row)\" (mouseover)=\"rowHover.emit(row)\" class=\"ng2-smart-row\" [className]=\"rowClassFunction(row)\" [ngClass]=\"{selected: row.isSelected}\">\n <td *ngIf=\"isMultiSelectVisible\" class=\"ng2-smart-actions ng2-smart-action-multiple-select\" (click)=\"multipleSelectRow.emit(row); $event.stopPropagation();\">\n <input type=\"checkbox\" class=\"form-control\" [ngModel]=\"row.isSelected\">\n </td>\n <td *ngIf=\"!row.isInEditing && showActionColumnLeft\" class=\"ng2-smart-actions\" (click)=\"$event.stopPropagation()\">\n <ng2-st-tbody-custom [grid]=\"grid\" (custom)=\"custom.emit($event)\" [row]=\"row\" [source]=\"source\"></ng2-st-tbody-custom>\n\n <ng2-st-tbody-edit-delete [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 </ng2-st-tbody-edit-delete>\n </td>\n <td *ngIf=\"row.isInEditing && showActionColumnLeft\" class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel [grid]=\"grid\" [row]=\"row\" [editConfirm]=\"editConfirm\"></ng2-st-tbody-create-cancel>\n </td>\n <td *ngFor=\"let cell of getVisibleCells(row.cells)\">\n <ng2-smart-table-cell [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 </ng2-smart-table-cell>\n </td>\n\n <td *ngIf=\"row.isInEditing && showActionColumnRight\" class=\"ng2-smart-actions\">\n <ng2-st-tbody-create-cancel [grid]=\"grid\" [row]=\"row\" [editConfirm]=\"editConfirm\"></ng2-st-tbody-create-cancel>\n </td>\n\n <td *ngIf=\"!row.isInEditing && showActionColumnRight\" class=\"ng2-smart-actions\">\n <ng2-st-tbody-custom [grid]=\"grid\" (custom)=\"custom.emit($event)\" [row]=\"row\" [source]=\"source\"></ng2-st-tbody-custom>\n\n <ng2-st-tbody-edit-delete [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 </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"] }]
|
|
2159
|
+
}], null, { grid: [{
|
|
2160
|
+
type: Input
|
|
2161
|
+
}], source: [{
|
|
2162
|
+
type: Input
|
|
2163
|
+
}], deleteConfirm: [{
|
|
2164
|
+
type: Input
|
|
2165
|
+
}], editConfirm: [{
|
|
2166
|
+
type: Input
|
|
2167
|
+
}], rowClassFunction: [{
|
|
2168
|
+
type: Input
|
|
2169
|
+
}], save: [{
|
|
2170
|
+
type: Output
|
|
2171
|
+
}], cancel: [{
|
|
2172
|
+
type: Output
|
|
2173
|
+
}], edit: [{
|
|
2174
|
+
type: Output
|
|
2175
|
+
}], delete: [{
|
|
2176
|
+
type: Output
|
|
2177
|
+
}], custom: [{
|
|
2178
|
+
type: Output
|
|
2179
|
+
}], edited: [{
|
|
2180
|
+
type: Output
|
|
2181
|
+
}], userSelectRow: [{
|
|
2182
|
+
type: Output
|
|
2183
|
+
}], userClickedRow: [{
|
|
2184
|
+
type: Output
|
|
2185
|
+
}], editRowSelect: [{
|
|
2186
|
+
type: Output
|
|
2187
|
+
}], multipleSelectRow: [{
|
|
2188
|
+
type: Output
|
|
2189
|
+
}], rowHover: [{
|
|
2190
|
+
type: Output
|
|
2191
|
+
}] });
|
|
2192
|
+
})();
|
|
2193
|
+
|
|
2194
|
+
const TBODY_COMPONENTS = [
|
|
2195
|
+
TbodyCreateCancelComponent,
|
|
2196
|
+
TbodyEditDeleteComponent,
|
|
2197
|
+
TbodyCustomComponent,
|
|
2198
|
+
Ng2SmartTableTbodyComponent
|
|
2199
|
+
];
|
|
2200
|
+
class TBodyModule {
|
|
2201
|
+
}
|
|
2202
|
+
TBodyModule.ɵfac = function TBodyModule_Factory(t) { return new (t || TBodyModule)(); };
|
|
2203
|
+
TBodyModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TBodyModule });
|
|
2204
|
+
TBodyModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
2205
|
+
FormsModule,
|
|
2206
|
+
CellModule] });
|
|
2207
|
+
(function () {
|
|
2208
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TBodyModule, [{
|
|
2209
|
+
type: NgModule,
|
|
2210
|
+
args: [{
|
|
2211
|
+
imports: [
|
|
2212
|
+
CommonModule,
|
|
2213
|
+
FormsModule,
|
|
2214
|
+
CellModule,
|
|
2215
|
+
],
|
|
2216
|
+
declarations: [
|
|
2217
|
+
...TBODY_COMPONENTS,
|
|
2218
|
+
],
|
|
2219
|
+
exports: [
|
|
2220
|
+
...TBODY_COMPONENTS,
|
|
2221
|
+
],
|
|
2222
|
+
}]
|
|
2223
|
+
}], null, null);
|
|
2224
|
+
})();
|
|
2225
|
+
(function () {
|
|
2226
|
+
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(TBodyModule, { declarations: [TbodyCreateCancelComponent,
|
|
2227
|
+
TbodyEditDeleteComponent,
|
|
2228
|
+
TbodyCustomComponent,
|
|
2229
|
+
Ng2SmartTableTbodyComponent], imports: [CommonModule,
|
|
2230
|
+
FormsModule,
|
|
2231
|
+
CellModule], exports: [TbodyCreateCancelComponent,
|
|
2232
|
+
TbodyEditDeleteComponent,
|
|
2233
|
+
TbodyCustomComponent,
|
|
2234
|
+
Ng2SmartTableTbodyComponent] });
|
|
2235
|
+
})();
|
|
2236
|
+
|
|
2237
|
+
const _c0$6 = ["ng2-st-add-button", ""];
|
|
2238
|
+
function AddButtonComponent_a_0_Template(rf, ctx) {
|
|
2239
|
+
if (rf & 1) {
|
|
2240
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
2241
|
+
i0.ɵɵelementStart(0, "a", 1);
|
|
2242
|
+
i0.ɵɵlistener("click", function AddButtonComponent_a_0_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onAdd($event)); });
|
|
2243
|
+
i0.ɵɵelementEnd();
|
|
2244
|
+
}
|
|
2245
|
+
if (rf & 2) {
|
|
2246
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
2247
|
+
i0.ɵɵproperty("innerHTML", ctx_r0.addNewButtonContent, i0.ɵɵsanitizeHtml);
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
class AddButtonComponent {
|
|
2251
|
+
constructor(ref) {
|
|
2252
|
+
this.ref = ref;
|
|
2253
|
+
this.create = new EventEmitter();
|
|
2254
|
+
}
|
|
2255
|
+
ngAfterViewInit() {
|
|
2256
|
+
this.ref.nativeElement.classList.add('ng2-smart-actions-title', 'ng2-smart-actions-title-add');
|
|
2257
|
+
}
|
|
2258
|
+
ngOnChanges() {
|
|
2259
|
+
this.isActionAdd = this.grid.getSetting('actions.add');
|
|
2260
|
+
this.addNewButtonContent = this.grid.getSetting('add.addButtonContent');
|
|
2261
|
+
}
|
|
2262
|
+
onAdd(event) {
|
|
2263
|
+
event.preventDefault();
|
|
2264
|
+
event.stopPropagation();
|
|
2265
|
+
if (this.grid.getSetting('mode') === 'external') {
|
|
2266
|
+
this.create.emit({
|
|
2267
|
+
source: this.source,
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
else {
|
|
2271
|
+
this.grid.createFormShown = true;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
AddButtonComponent.ɵfac = function AddButtonComponent_Factory(t) { return new (t || AddButtonComponent)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
|
|
2276
|
+
AddButtonComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AddButtonComponent, selectors: [["", "ng2-st-add-button", ""]], inputs: { grid: "grid", source: "source" }, outputs: { create: "create" }, features: [i0.ɵɵNgOnChangesFeature], attrs: _c0$6, decls: 1, vars: 1, consts: [["href", "#", "class", "ng2-smart-action ng2-smart-action-add-add", 3, "innerHTML", "click", 4, "ngIf"], ["href", "#", 1, "ng2-smart-action", "ng2-smart-action-add-add", 3, "innerHTML", "click"]], template: function AddButtonComponent_Template(rf, ctx) {
|
|
2277
|
+
if (rf & 1) {
|
|
2278
|
+
i0.ɵɵtemplate(0, AddButtonComponent_a_0_Template, 1, 1, "a", 0);
|
|
2279
|
+
}
|
|
2280
|
+
if (rf & 2) {
|
|
2281
|
+
i0.ɵɵproperty("ngIf", ctx.isActionAdd);
|
|
2282
|
+
}
|
|
2283
|
+
}, dependencies: [i1.NgIf], encapsulation: 2 });
|
|
2284
|
+
(function () {
|
|
2285
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AddButtonComponent, [{
|
|
2286
|
+
type: Component,
|
|
2287
|
+
args: [{
|
|
2288
|
+
selector: '[ng2-st-add-button]',
|
|
2289
|
+
template: `
|
|
2290
|
+
<a *ngIf="isActionAdd" href="#" class="ng2-smart-action ng2-smart-action-add-add"
|
|
2291
|
+
[innerHTML]="addNewButtonContent" (click)="onAdd($event)"></a>
|
|
2292
|
+
`,
|
|
2293
|
+
}]
|
|
2294
|
+
}], function () { return [{ type: i0.ElementRef }]; }, { grid: [{
|
|
2295
|
+
type: Input
|
|
2296
|
+
}], source: [{
|
|
2297
|
+
type: Input
|
|
2298
|
+
}], create: [{
|
|
2299
|
+
type: Output
|
|
2300
|
+
}] });
|
|
2301
|
+
})();
|
|
2302
|
+
|
|
2303
|
+
const _c0$5 = ["ng2-st-thead-filters-row", ""];
|
|
2304
|
+
function TheadFitlersRowComponent_th_0_Template(rf, ctx) {
|
|
2305
|
+
if (rf & 1) {
|
|
2306
|
+
i0.ɵɵelement(0, "th");
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
function TheadFitlersRowComponent_th_1_Template(rf, ctx) {
|
|
2310
|
+
if (rf & 1) {
|
|
2311
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
2312
|
+
i0.ɵɵelementStart(0, "th", 4);
|
|
2313
|
+
i0.ɵɵlistener("create", function TheadFitlersRowComponent_th_1_Template_th_create_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.create.emit($event)); });
|
|
2314
|
+
i0.ɵɵelementEnd();
|
|
2315
|
+
}
|
|
2316
|
+
if (rf & 2) {
|
|
2317
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
2318
|
+
i0.ɵɵproperty("grid", ctx_r1.grid);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
function TheadFitlersRowComponent_th_2_Template(rf, ctx) {
|
|
2322
|
+
if (rf & 1) {
|
|
2323
|
+
const _r8 = i0.ɵɵgetCurrentView();
|
|
2324
|
+
i0.ɵɵelementStart(0, "th")(1, "ng2-smart-table-filter", 5);
|
|
2325
|
+
i0.ɵɵlistener("filter", function TheadFitlersRowComponent_th_2_Template_ng2_smart_table_filter_filter_1_listener($event) { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r7.filter.emit($event)); });
|
|
2326
|
+
i0.ɵɵelementEnd()();
|
|
2327
|
+
}
|
|
2328
|
+
if (rf & 2) {
|
|
2329
|
+
const column_r6 = ctx.$implicit;
|
|
2330
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
2331
|
+
i0.ɵɵclassMapInterpolate1("ng2-smart-th ", column_r6.id, "");
|
|
2332
|
+
i0.ɵɵadvance(1);
|
|
2333
|
+
i0.ɵɵproperty("source", ctx_r2.source)("column", column_r6)("inputClass", ctx_r2.filterInputClass);
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
function TheadFitlersRowComponent_th_3_Template(rf, ctx) {
|
|
2337
|
+
if (rf & 1) {
|
|
2338
|
+
const _r10 = i0.ɵɵgetCurrentView();
|
|
2339
|
+
i0.ɵɵelementStart(0, "th", 6);
|
|
2340
|
+
i0.ɵɵlistener("create", function TheadFitlersRowComponent_th_3_Template_th_create_0_listener($event) { i0.ɵɵrestoreView(_r10); const ctx_r9 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r9.create.emit($event)); });
|
|
2341
|
+
i0.ɵɵelementEnd();
|
|
2342
|
+
}
|
|
2343
|
+
if (rf & 2) {
|
|
2344
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
2345
|
+
i0.ɵɵproperty("grid", ctx_r3.grid)("source", ctx_r3.source);
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
class TheadFitlersRowComponent {
|
|
2349
|
+
constructor() {
|
|
2350
|
+
this.create = new EventEmitter();
|
|
2351
|
+
this.filter = new EventEmitter();
|
|
2352
|
+
}
|
|
2353
|
+
ngOnChanges() {
|
|
2354
|
+
this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
|
|
2355
|
+
this.showActionColumnLeft = this.grid.showActionColumn('left');
|
|
2356
|
+
this.showActionColumnRight = this.grid.showActionColumn('right');
|
|
2357
|
+
this.filterInputClass = this.grid.getSetting('filter.inputClass');
|
|
2358
|
+
}
|
|
2359
|
+
getVisibleColumns(columns) {
|
|
2360
|
+
return (columns || []).filter((column) => !column.hide);
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
TheadFitlersRowComponent.ɵfac = function TheadFitlersRowComponent_Factory(t) { return new (t || TheadFitlersRowComponent)(); };
|
|
2364
|
+
TheadFitlersRowComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TheadFitlersRowComponent, selectors: [["", "ng2-st-thead-filters-row", ""]], inputs: { grid: "grid", source: "source" }, outputs: { create: "create", filter: "filter" }, features: [i0.ɵɵNgOnChangesFeature], attrs: _c0$5, decls: 4, vars: 4, consts: [[4, "ngIf"], ["ng2-st-add-button", "", 3, "grid", "create", 4, "ngIf"], [3, "class", 4, "ngFor", "ngForOf"], ["ng2-st-add-button", "", 3, "grid", "source", "create", 4, "ngIf"], ["ng2-st-add-button", "", 3, "grid", "create"], [3, "source", "column", "inputClass", "filter"], ["ng2-st-add-button", "", 3, "grid", "source", "create"]], template: function TheadFitlersRowComponent_Template(rf, ctx) {
|
|
2365
|
+
if (rf & 1) {
|
|
2366
|
+
i0.ɵɵtemplate(0, TheadFitlersRowComponent_th_0_Template, 1, 0, "th", 0);
|
|
2367
|
+
i0.ɵɵtemplate(1, TheadFitlersRowComponent_th_1_Template, 1, 1, "th", 1);
|
|
2368
|
+
i0.ɵɵtemplate(2, TheadFitlersRowComponent_th_2_Template, 2, 6, "th", 2);
|
|
2369
|
+
i0.ɵɵtemplate(3, TheadFitlersRowComponent_th_3_Template, 1, 2, "th", 3);
|
|
2370
|
+
}
|
|
2371
|
+
if (rf & 2) {
|
|
2372
|
+
i0.ɵɵproperty("ngIf", ctx.isMultiSelectVisible);
|
|
2373
|
+
i0.ɵɵadvance(1);
|
|
2374
|
+
i0.ɵɵproperty("ngIf", ctx.showActionColumnLeft);
|
|
2375
|
+
i0.ɵɵadvance(1);
|
|
2376
|
+
i0.ɵɵproperty("ngForOf", ctx.getVisibleColumns(ctx.grid.getColumns()));
|
|
2377
|
+
i0.ɵɵadvance(1);
|
|
2378
|
+
i0.ɵɵproperty("ngIf", ctx.showActionColumnRight);
|
|
2379
|
+
}
|
|
2380
|
+
}, dependencies: [i1.NgForOf, i1.NgIf, FilterComponent, AddButtonComponent], encapsulation: 2 });
|
|
2381
|
+
(function () {
|
|
2382
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TheadFitlersRowComponent, [{
|
|
2383
|
+
type: Component,
|
|
2384
|
+
args: [{
|
|
2385
|
+
selector: '[ng2-st-thead-filters-row]',
|
|
2386
|
+
template: `
|
|
2387
|
+
<th *ngIf="isMultiSelectVisible"></th>
|
|
2388
|
+
<th ng2-st-add-button *ngIf="showActionColumnLeft"
|
|
2389
|
+
[grid]="grid"
|
|
2390
|
+
(create)="create.emit($event)">
|
|
2391
|
+
</th>
|
|
2392
|
+
<th *ngFor="let column of getVisibleColumns(grid.getColumns())" class="ng2-smart-th {{ column.id }}">
|
|
2393
|
+
<ng2-smart-table-filter [source]="source"
|
|
2394
|
+
[column]="column"
|
|
2395
|
+
[inputClass]="filterInputClass"
|
|
2396
|
+
(filter)="filter.emit($event)">
|
|
2397
|
+
</ng2-smart-table-filter>
|
|
2398
|
+
</th>
|
|
2399
|
+
<th ng2-st-add-button *ngIf="showActionColumnRight"
|
|
2400
|
+
[grid]="grid"
|
|
2401
|
+
[source]="source"
|
|
2402
|
+
(create)="create.emit($event)">
|
|
2403
|
+
</th>
|
|
2404
|
+
`,
|
|
2405
|
+
}]
|
|
2406
|
+
}], null, { grid: [{
|
|
2407
|
+
type: Input
|
|
2408
|
+
}], source: [{
|
|
2409
|
+
type: Input
|
|
2410
|
+
}], create: [{
|
|
2411
|
+
type: Output
|
|
2412
|
+
}], filter: [{
|
|
2413
|
+
type: Output
|
|
2414
|
+
}] });
|
|
2415
|
+
})();
|
|
2416
|
+
|
|
2417
|
+
class ActionsComponent {
|
|
2418
|
+
constructor() {
|
|
2419
|
+
this.create = new EventEmitter();
|
|
2420
|
+
}
|
|
2421
|
+
ngOnChanges() {
|
|
2422
|
+
this.createButtonContent = this.grid.getSetting('add.createButtonContent');
|
|
2423
|
+
this.cancelButtonContent = this.grid.getSetting('add.cancelButtonContent');
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
ActionsComponent.ɵfac = function ActionsComponent_Factory(t) { return new (t || ActionsComponent)(); };
|
|
2427
|
+
ActionsComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ActionsComponent, selectors: [["ng2-st-actions"]], inputs: { grid: "grid" }, outputs: { create: "create" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 2, consts: [["href", "#", 1, "ng2-smart-action", "ng2-smart-action-add-create", 3, "innerHTML", "click"], ["href", "#", 1, "ng2-smart-action", "ng2-smart-action-add-cancel", 3, "innerHTML", "click"]], template: function ActionsComponent_Template(rf, ctx) {
|
|
2428
|
+
if (rf & 1) {
|
|
2429
|
+
i0.ɵɵelementStart(0, "a", 0);
|
|
2430
|
+
i0.ɵɵlistener("click", function ActionsComponent_Template_a_click_0_listener($event) { $event.preventDefault(); return ctx.create.emit($event); });
|
|
2431
|
+
i0.ɵɵelementEnd();
|
|
2432
|
+
i0.ɵɵelementStart(1, "a", 1);
|
|
2433
|
+
i0.ɵɵlistener("click", function ActionsComponent_Template_a_click_1_listener($event) { $event.preventDefault(); return ctx.grid.createFormShown = false; });
|
|
2434
|
+
i0.ɵɵelementEnd();
|
|
2435
|
+
}
|
|
2436
|
+
if (rf & 2) {
|
|
2437
|
+
i0.ɵɵproperty("innerHTML", ctx.createButtonContent, i0.ɵɵsanitizeHtml);
|
|
2438
|
+
i0.ɵɵadvance(1);
|
|
2439
|
+
i0.ɵɵproperty("innerHTML", ctx.cancelButtonContent, i0.ɵɵsanitizeHtml);
|
|
2440
|
+
}
|
|
2441
|
+
}, encapsulation: 2 });
|
|
2442
|
+
(function () {
|
|
2443
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActionsComponent, [{
|
|
2444
|
+
type: Component,
|
|
2445
|
+
args: [{
|
|
2446
|
+
selector: 'ng2-st-actions',
|
|
2447
|
+
template: `
|
|
2448
|
+
<a href="#" class="ng2-smart-action ng2-smart-action-add-create"
|
|
2449
|
+
[innerHTML]="createButtonContent"
|
|
2450
|
+
(click)="$event.preventDefault();create.emit($event)"></a>
|
|
2451
|
+
<a href="#" class="ng2-smart-action ng2-smart-action-add-cancel"
|
|
2452
|
+
[innerHTML]="cancelButtonContent"
|
|
2453
|
+
(click)="$event.preventDefault();grid.createFormShown = false;"></a>
|
|
2454
|
+
`,
|
|
2455
|
+
}]
|
|
2456
|
+
}], null, { grid: [{
|
|
2457
|
+
type: Input
|
|
2458
|
+
}], create: [{
|
|
2459
|
+
type: Output
|
|
2460
|
+
}] });
|
|
2461
|
+
})();
|
|
2462
|
+
|
|
2463
|
+
const _c0$4 = ["ng2-st-thead-form-row", ""];
|
|
2464
|
+
function TheadFormRowComponent_td_0_Template(rf, ctx) {
|
|
2465
|
+
if (rf & 1) {
|
|
2466
|
+
i0.ɵɵelement(0, "td");
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
function TheadFormRowComponent_td_1_Template(rf, ctx) {
|
|
2470
|
+
if (rf & 1) {
|
|
2471
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
2472
|
+
i0.ɵɵelementStart(0, "td", 3)(1, "ng2-st-actions", 4);
|
|
2473
|
+
i0.ɵɵlistener("create", function TheadFormRowComponent_td_1_Template_ng2_st_actions_create_1_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.onCreate($event)); });
|
|
2474
|
+
i0.ɵɵelementEnd()();
|
|
2475
|
+
}
|
|
2476
|
+
if (rf & 2) {
|
|
2477
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
2478
|
+
i0.ɵɵadvance(1);
|
|
2479
|
+
i0.ɵɵproperty("grid", ctx_r1.grid);
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
function TheadFormRowComponent_td_2_Template(rf, ctx) {
|
|
2483
|
+
if (rf & 1) {
|
|
2484
|
+
const _r8 = i0.ɵɵgetCurrentView();
|
|
2485
|
+
i0.ɵɵelementStart(0, "td")(1, "ng2-smart-table-cell", 5);
|
|
2486
|
+
i0.ɵɵlistener("edited", function TheadFormRowComponent_td_2_Template_ng2_smart_table_cell_edited_1_listener($event) { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r7.onCreate($event)); });
|
|
2487
|
+
i0.ɵɵelementEnd()();
|
|
2488
|
+
}
|
|
2489
|
+
if (rf & 2) {
|
|
2490
|
+
const cell_r6 = ctx.$implicit;
|
|
2491
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
2492
|
+
i0.ɵɵadvance(1);
|
|
2493
|
+
i0.ɵɵproperty("cell", cell_r6)("grid", ctx_r2.grid)("isNew", true)("createConfirm", ctx_r2.createConfirm)("inputClass", ctx_r2.addInputClass)("isInEditing", ctx_r2.grid.getNewRow().isInEditing);
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
function TheadFormRowComponent_td_3_Template(rf, ctx) {
|
|
2497
|
+
if (rf & 1) {
|
|
2498
|
+
const _r10 = i0.ɵɵgetCurrentView();
|
|
2499
|
+
i0.ɵɵelementStart(0, "td", 3)(1, "ng2-st-actions", 4);
|
|
2500
|
+
i0.ɵɵlistener("create", function TheadFormRowComponent_td_3_Template_ng2_st_actions_create_1_listener($event) { i0.ɵɵrestoreView(_r10); const ctx_r9 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r9.onCreate($event)); });
|
|
2501
|
+
i0.ɵɵelementEnd()();
|
|
2502
|
+
}
|
|
2503
|
+
if (rf & 2) {
|
|
2504
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
2505
|
+
i0.ɵɵadvance(1);
|
|
2506
|
+
i0.ɵɵproperty("grid", ctx_r3.grid);
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
class TheadFormRowComponent {
|
|
2510
|
+
constructor() {
|
|
2511
|
+
this.create = new EventEmitter();
|
|
2512
|
+
}
|
|
2513
|
+
onCreate(event) {
|
|
2514
|
+
event.stopPropagation();
|
|
2515
|
+
this.grid.create(this.grid.getNewRow(), this.createConfirm);
|
|
2516
|
+
}
|
|
2517
|
+
ngOnChanges() {
|
|
2518
|
+
this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
|
|
2519
|
+
this.showActionColumnLeft = this.grid.showActionColumn('left');
|
|
2520
|
+
this.showActionColumnRight = this.grid.showActionColumn('right');
|
|
2521
|
+
this.addInputClass = this.grid.getSetting('add.inputClass');
|
|
2522
|
+
}
|
|
2523
|
+
getVisibleCells(cells) {
|
|
2524
|
+
return (cells || []).filter((cell) => !cell.getColumn().hide);
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
TheadFormRowComponent.ɵfac = function TheadFormRowComponent_Factory(t) { return new (t || TheadFormRowComponent)(); };
|
|
2528
|
+
TheadFormRowComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TheadFormRowComponent, selectors: [["", "ng2-st-thead-form-row", ""]], inputs: { grid: "grid", row: "row", createConfirm: "createConfirm" }, outputs: { create: "create" }, features: [i0.ɵɵNgOnChangesFeature], attrs: _c0$4, decls: 4, vars: 3, consts: [[4, "ngIf"], ["class", "ng2-smart-actions", 4, "ngIf"], [4, "ngFor", "ngForOf"], [1, "ng2-smart-actions"], [3, "grid", "create"], [3, "cell", "grid", "isNew", "createConfirm", "inputClass", "isInEditing", "edited"]], template: function TheadFormRowComponent_Template(rf, ctx) {
|
|
2529
|
+
if (rf & 1) {
|
|
2530
|
+
i0.ɵɵtemplate(0, TheadFormRowComponent_td_0_Template, 1, 0, "td", 0);
|
|
2531
|
+
i0.ɵɵtemplate(1, TheadFormRowComponent_td_1_Template, 2, 1, "td", 1);
|
|
2532
|
+
i0.ɵɵtemplate(2, TheadFormRowComponent_td_2_Template, 2, 6, "td", 2);
|
|
2533
|
+
i0.ɵɵtemplate(3, TheadFormRowComponent_td_3_Template, 2, 1, "td", 1);
|
|
2534
|
+
}
|
|
2535
|
+
if (rf & 2) {
|
|
2536
|
+
i0.ɵɵadvance(1);
|
|
2537
|
+
i0.ɵɵproperty("ngIf", ctx.showActionColumnLeft);
|
|
2538
|
+
i0.ɵɵadvance(1);
|
|
2539
|
+
i0.ɵɵproperty("ngForOf", ctx.getVisibleCells(ctx.grid.getNewRow().getCells()));
|
|
2540
|
+
i0.ɵɵadvance(1);
|
|
2541
|
+
i0.ɵɵproperty("ngIf", ctx.showActionColumnRight);
|
|
2542
|
+
}
|
|
2543
|
+
}, dependencies: [i1.NgForOf, i1.NgIf, CellComponent, ActionsComponent], encapsulation: 2 });
|
|
2544
|
+
(function () {
|
|
2545
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TheadFormRowComponent, [{
|
|
2546
|
+
type: Component,
|
|
2547
|
+
args: [{
|
|
2548
|
+
selector: '[ng2-st-thead-form-row]',
|
|
2549
|
+
template: `
|
|
2550
|
+
<td *ngIf=""></td>
|
|
2551
|
+
<td *ngIf="showActionColumnLeft" class="ng2-smart-actions">
|
|
2552
|
+
<ng2-st-actions [grid]="grid" (create)="onCreate($event)"></ng2-st-actions>
|
|
2553
|
+
</td>
|
|
2554
|
+
<td *ngFor="let cell of getVisibleCells(grid.getNewRow().getCells())">
|
|
2555
|
+
<ng2-smart-table-cell [cell]="cell"
|
|
2556
|
+
[grid]="grid"
|
|
2557
|
+
[isNew]="true"
|
|
2558
|
+
[createConfirm]="createConfirm"
|
|
2559
|
+
[inputClass]="addInputClass"
|
|
2560
|
+
[isInEditing]="grid.getNewRow().isInEditing"
|
|
2561
|
+
(edited)="onCreate($event)">
|
|
2562
|
+
</ng2-smart-table-cell>
|
|
2563
|
+
</td>
|
|
2564
|
+
<td *ngIf="showActionColumnRight" class="ng2-smart-actions">
|
|
2565
|
+
<ng2-st-actions [grid]="grid" (create)="onCreate($event)"></ng2-st-actions>
|
|
2566
|
+
</td>
|
|
2567
|
+
`,
|
|
2568
|
+
}]
|
|
2569
|
+
}], null, { grid: [{
|
|
2570
|
+
type: Input
|
|
2571
|
+
}], row: [{
|
|
2572
|
+
type: Input
|
|
2573
|
+
}], createConfirm: [{
|
|
2574
|
+
type: Input
|
|
2575
|
+
}], create: [{
|
|
2576
|
+
type: Output
|
|
2577
|
+
}] });
|
|
2578
|
+
})();
|
|
2579
|
+
|
|
2580
|
+
const _c0$3 = ["ng2-st-actions-title", ""];
|
|
2581
|
+
class ActionsTitleComponent {
|
|
2582
|
+
constructor(ref) {
|
|
2583
|
+
this.ref = ref;
|
|
2584
|
+
}
|
|
2585
|
+
ngAfterViewInit() {
|
|
2586
|
+
this.ref.nativeElement.classList.add('ng2-smart-actions');
|
|
2587
|
+
}
|
|
2588
|
+
ngOnChanges() {
|
|
2589
|
+
this.actionsColumnTitle = this.grid.getSetting('actions.columnTitle');
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
ActionsTitleComponent.ɵfac = function ActionsTitleComponent_Factory(t) { return new (t || ActionsTitleComponent)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
|
|
2593
|
+
ActionsTitleComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ActionsTitleComponent, selectors: [["", "ng2-st-actions-title", ""]], inputs: { grid: "grid" }, features: [i0.ɵɵNgOnChangesFeature], attrs: _c0$3, decls: 2, vars: 1, consts: [[1, "ng2-smart-title"]], template: function ActionsTitleComponent_Template(rf, ctx) {
|
|
2594
|
+
if (rf & 1) {
|
|
2595
|
+
i0.ɵɵelementStart(0, "div", 0);
|
|
2596
|
+
i0.ɵɵtext(1);
|
|
2597
|
+
i0.ɵɵelementEnd();
|
|
2598
|
+
}
|
|
2599
|
+
if (rf & 2) {
|
|
2600
|
+
i0.ɵɵadvance(1);
|
|
2601
|
+
i0.ɵɵtextInterpolate(ctx.actionsColumnTitle);
|
|
2602
|
+
}
|
|
2603
|
+
}, encapsulation: 2 });
|
|
2604
|
+
(function () {
|
|
2605
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActionsTitleComponent, [{
|
|
2606
|
+
type: Component,
|
|
2607
|
+
args: [{
|
|
2608
|
+
selector: '[ng2-st-actions-title]',
|
|
2609
|
+
template: `
|
|
2610
|
+
<div class="ng2-smart-title">{{ actionsColumnTitle }}</div>
|
|
2611
|
+
`,
|
|
2612
|
+
}]
|
|
2613
|
+
}], function () { return [{ type: i0.ElementRef }]; }, { grid: [{
|
|
2614
|
+
type: Input
|
|
2615
|
+
}] });
|
|
2616
|
+
})();
|
|
2617
|
+
|
|
2618
|
+
const _c0$2 = ["ng2-st-checkbox-select-all", ""];
|
|
2619
|
+
class CheckboxSelectAllComponent {
|
|
2620
|
+
}
|
|
2621
|
+
CheckboxSelectAllComponent.ɵfac = function CheckboxSelectAllComponent_Factory(t) { return new (t || CheckboxSelectAllComponent)(); };
|
|
2622
|
+
CheckboxSelectAllComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CheckboxSelectAllComponent, selectors: [["", "ng2-st-checkbox-select-all", ""]], inputs: { grid: "grid", source: "source" }, attrs: _c0$2, decls: 1, vars: 1, consts: [["type", "checkbox", 3, "ngModel"]], template: function CheckboxSelectAllComponent_Template(rf, ctx) {
|
|
2623
|
+
if (rf & 1) {
|
|
2624
|
+
i0.ɵɵelement(0, "input", 0);
|
|
2625
|
+
}
|
|
2626
|
+
if (rf & 2) {
|
|
2627
|
+
i0.ɵɵproperty("ngModel", ctx.grid.dataSet.isAllSelected);
|
|
2628
|
+
}
|
|
2629
|
+
}, dependencies: [i2.CheckboxControlValueAccessor, i2.NgControlStatus, i2.NgModel], encapsulation: 2 });
|
|
2630
|
+
(function () {
|
|
2631
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckboxSelectAllComponent, [{
|
|
2632
|
+
type: Component,
|
|
2633
|
+
args: [{
|
|
2634
|
+
selector: '[ng2-st-checkbox-select-all]',
|
|
2635
|
+
template: `
|
|
2636
|
+
<input type="checkbox" [ngModel]="this.grid.dataSet.isAllSelected">
|
|
2637
|
+
`,
|
|
2638
|
+
}]
|
|
2639
|
+
}], null, { grid: [{
|
|
2640
|
+
type: Input
|
|
2641
|
+
}], source: [{
|
|
2642
|
+
type: Input
|
|
2643
|
+
}] });
|
|
2644
|
+
})();
|
|
2645
|
+
|
|
2646
|
+
function TitleComponent_a_0_Template(rf, ctx) {
|
|
2647
|
+
if (rf & 1) {
|
|
2648
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
2649
|
+
i0.ɵɵelementStart(0, "a", 2);
|
|
2650
|
+
i0.ɵɵlistener("click", function TitleComponent_a_0_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2._sort($event)); });
|
|
2651
|
+
i0.ɵɵtext(1);
|
|
2652
|
+
i0.ɵɵelementEnd();
|
|
2653
|
+
}
|
|
2654
|
+
if (rf & 2) {
|
|
2655
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
2656
|
+
i0.ɵɵproperty("ngClass", ctx_r0.currentDirection);
|
|
2657
|
+
i0.ɵɵadvance(1);
|
|
2658
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.column.title, " ");
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
function TitleComponent_span_1_Template(rf, ctx) {
|
|
2662
|
+
if (rf & 1) {
|
|
2663
|
+
i0.ɵɵelementStart(0, "span", 3);
|
|
2664
|
+
i0.ɵɵtext(1);
|
|
2665
|
+
i0.ɵɵelementEnd();
|
|
2666
|
+
}
|
|
2667
|
+
if (rf & 2) {
|
|
2668
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
2669
|
+
i0.ɵɵadvance(1);
|
|
2670
|
+
i0.ɵɵtextInterpolate(ctx_r1.column.title);
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
class TitleComponent {
|
|
2674
|
+
constructor() {
|
|
2675
|
+
this.currentDirection = '';
|
|
2676
|
+
this.sort = new EventEmitter();
|
|
2677
|
+
}
|
|
2678
|
+
ngOnChanges(changes) {
|
|
2679
|
+
if (changes.source) {
|
|
2680
|
+
if (!changes.source.firstChange) {
|
|
2681
|
+
this.dataChangedSub.unsubscribe();
|
|
2682
|
+
}
|
|
2683
|
+
this.dataChangedSub = this.source.onChanged().subscribe((dataChanges) => {
|
|
2684
|
+
const sortConf = this.source.getSort();
|
|
2685
|
+
if (sortConf.length > 0 && sortConf[0]['field'] === this.column.id) {
|
|
2686
|
+
this.currentDirection = sortConf[0]['direction'];
|
|
2687
|
+
}
|
|
2688
|
+
else {
|
|
2689
|
+
this.currentDirection = '';
|
|
2690
|
+
}
|
|
2691
|
+
sortConf.forEach((fieldConf) => {
|
|
2692
|
+
});
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
_sort(event) {
|
|
2697
|
+
event.preventDefault();
|
|
2698
|
+
this.changeSortDirection();
|
|
2699
|
+
this.source.setSort([
|
|
2700
|
+
{
|
|
2701
|
+
field: this.column.id,
|
|
2702
|
+
direction: this.currentDirection,
|
|
2703
|
+
compare: this.column.getCompareFunction(),
|
|
2704
|
+
},
|
|
2705
|
+
]);
|
|
2706
|
+
this.sort.emit(null);
|
|
2707
|
+
}
|
|
2708
|
+
changeSortDirection() {
|
|
2709
|
+
if (this.currentDirection) {
|
|
2710
|
+
const newDirection = this.currentDirection === 'asc' ? 'desc' : 'asc';
|
|
2711
|
+
this.currentDirection = newDirection;
|
|
2712
|
+
}
|
|
2713
|
+
else {
|
|
2714
|
+
this.currentDirection = this.column.sortDirection;
|
|
2715
|
+
}
|
|
2716
|
+
return this.currentDirection;
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
TitleComponent.ɵfac = function TitleComponent_Factory(t) { return new (t || TitleComponent)(); };
|
|
2720
|
+
TitleComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TitleComponent, selectors: [["ng2-smart-table-title"]], inputs: { column: "column", source: "source" }, outputs: { sort: "sort" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 2, consts: [["href", "#", "class", "ng2-smart-sort-link sort", 3, "ngClass", "click", 4, "ngIf"], ["class", "ng2-smart-sort", 4, "ngIf"], ["href", "#", 1, "ng2-smart-sort-link", "sort", 3, "ngClass", "click"], [1, "ng2-smart-sort"]], template: function TitleComponent_Template(rf, ctx) {
|
|
2721
|
+
if (rf & 1) {
|
|
2722
|
+
i0.ɵɵtemplate(0, TitleComponent_a_0_Template, 2, 2, "a", 0);
|
|
2723
|
+
i0.ɵɵtemplate(1, TitleComponent_span_1_Template, 2, 1, "span", 1);
|
|
2724
|
+
}
|
|
2725
|
+
if (rf & 2) {
|
|
2726
|
+
i0.ɵɵproperty("ngIf", ctx.column.isSortable);
|
|
2727
|
+
i0.ɵɵadvance(1);
|
|
2728
|
+
i0.ɵɵproperty("ngIf", !ctx.column.isSortable);
|
|
2729
|
+
}
|
|
2730
|
+
}, dependencies: [i1.NgClass, i1.NgIf], styles: ["a.sort.asc[_ngcontent-%COMP%], a.sort.desc[_ngcontent-%COMP%]{font-weight:700}a.sort.asc[_ngcontent-%COMP%]:after, a.sort.desc[_ngcontent-%COMP%]: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[_ngcontent-%COMP%]:after{transform:rotate(-180deg);margin-bottom:-2px}"] });
|
|
2731
|
+
(function () {
|
|
2732
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TitleComponent, [{
|
|
2733
|
+
type: Component,
|
|
2734
|
+
args: [{ selector: 'ng2-smart-table-title', template: `
|
|
2735
|
+
<a href="#" *ngIf="column.isSortable"
|
|
2736
|
+
(click)="_sort($event)"
|
|
2737
|
+
class="ng2-smart-sort-link sort"
|
|
2738
|
+
[ngClass]="currentDirection">
|
|
2739
|
+
{{ column.title }}
|
|
2740
|
+
</a>
|
|
2741
|
+
<span class="ng2-smart-sort" *ngIf="!column.isSortable">{{ column.title }}</span>
|
|
2742
|
+
`, 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"] }]
|
|
2743
|
+
}], null, { column: [{
|
|
2744
|
+
type: Input
|
|
2745
|
+
}], source: [{
|
|
2746
|
+
type: Input
|
|
2747
|
+
}], sort: [{
|
|
2748
|
+
type: Output
|
|
2749
|
+
}] });
|
|
2750
|
+
})();
|
|
2751
|
+
|
|
2752
|
+
class ColumnTitleComponent {
|
|
2753
|
+
constructor() {
|
|
2754
|
+
this.sort = new EventEmitter();
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
ColumnTitleComponent.ɵfac = function ColumnTitleComponent_Factory(t) { return new (t || ColumnTitleComponent)(); };
|
|
2758
|
+
ColumnTitleComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ColumnTitleComponent, selectors: [["ng2-st-column-title"]], inputs: { column: "column", source: "source" }, outputs: { sort: "sort" }, decls: 2, vars: 2, consts: [[1, "ng2-smart-title"], [3, "source", "column", "sort"]], template: function ColumnTitleComponent_Template(rf, ctx) {
|
|
2759
|
+
if (rf & 1) {
|
|
2760
|
+
i0.ɵɵelementStart(0, "div", 0)(1, "ng2-smart-table-title", 1);
|
|
2761
|
+
i0.ɵɵlistener("sort", function ColumnTitleComponent_Template_ng2_smart_table_title_sort_1_listener($event) { return ctx.sort.emit($event); });
|
|
2762
|
+
i0.ɵɵelementEnd()();
|
|
2763
|
+
}
|
|
2764
|
+
if (rf & 2) {
|
|
2765
|
+
i0.ɵɵadvance(1);
|
|
2766
|
+
i0.ɵɵproperty("source", ctx.source)("column", ctx.column);
|
|
2767
|
+
}
|
|
2768
|
+
}, dependencies: [TitleComponent], encapsulation: 2 });
|
|
2769
|
+
(function () {
|
|
2770
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ColumnTitleComponent, [{
|
|
2771
|
+
type: Component,
|
|
2772
|
+
args: [{
|
|
2773
|
+
selector: 'ng2-st-column-title',
|
|
2774
|
+
template: `
|
|
2775
|
+
<div class="ng2-smart-title">
|
|
2776
|
+
<ng2-smart-table-title [source]="source" [column]="column" (sort)="sort.emit($event)"></ng2-smart-table-title>
|
|
2777
|
+
</div>
|
|
2778
|
+
`,
|
|
2779
|
+
}]
|
|
2780
|
+
}], null, { column: [{
|
|
2781
|
+
type: Input
|
|
2782
|
+
}], source: [{
|
|
2783
|
+
type: Input
|
|
2784
|
+
}], sort: [{
|
|
2785
|
+
type: Output
|
|
2786
|
+
}] });
|
|
2787
|
+
})();
|
|
2788
|
+
|
|
2789
|
+
const _c0$1 = ["ng2-st-thead-titles-row", ""];
|
|
2790
|
+
function TheadTitlesRowComponent_th_0_Template(rf, ctx) {
|
|
2791
|
+
if (rf & 1) {
|
|
2792
|
+
const _r5 = i0.ɵɵgetCurrentView();
|
|
2793
|
+
i0.ɵɵelementStart(0, "th", 3);
|
|
2794
|
+
i0.ɵɵlistener("click", function TheadTitlesRowComponent_th_0_Template_th_click_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.selectAllRows.emit($event)); });
|
|
2795
|
+
i0.ɵɵelementEnd();
|
|
2796
|
+
}
|
|
2797
|
+
if (rf & 2) {
|
|
2798
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
2799
|
+
i0.ɵɵproperty("grid", ctx_r0.grid)("source", ctx_r0.source);
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
function TheadTitlesRowComponent_th_1_Template(rf, ctx) {
|
|
2803
|
+
if (rf & 1) {
|
|
2804
|
+
i0.ɵɵelement(0, "th", 4);
|
|
2805
|
+
}
|
|
2806
|
+
if (rf & 2) {
|
|
2807
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
2808
|
+
i0.ɵɵproperty("grid", ctx_r1.grid);
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
function TheadTitlesRowComponent_th_2_Template(rf, ctx) {
|
|
2812
|
+
if (rf & 1) {
|
|
2813
|
+
const _r8 = i0.ɵɵgetCurrentView();
|
|
2814
|
+
i0.ɵɵelementStart(0, "th", 5)(1, "ng2-st-column-title", 6);
|
|
2815
|
+
i0.ɵɵlistener("sort", function TheadTitlesRowComponent_th_2_Template_ng2_st_column_title_sort_1_listener($event) { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r7.sort.emit($event)); });
|
|
2816
|
+
i0.ɵɵelementEnd()();
|
|
2817
|
+
}
|
|
2818
|
+
if (rf & 2) {
|
|
2819
|
+
const column_r6 = ctx.$implicit;
|
|
2820
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
2821
|
+
i0.ɵɵclassMapInterpolate1("ng2-smart-th ", column_r6.id, "");
|
|
2822
|
+
i0.ɵɵstyleProp("width", column_r6.width);
|
|
2823
|
+
i0.ɵɵproperty("ngClass", column_r6.class);
|
|
2824
|
+
i0.ɵɵadvance(1);
|
|
2825
|
+
i0.ɵɵproperty("source", ctx_r2.source)("column", column_r6);
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
function TheadTitlesRowComponent_th_3_Template(rf, ctx) {
|
|
2829
|
+
if (rf & 1) {
|
|
2830
|
+
i0.ɵɵelement(0, "th", 4);
|
|
2831
|
+
}
|
|
2832
|
+
if (rf & 2) {
|
|
2833
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
2834
|
+
i0.ɵɵproperty("grid", ctx_r3.grid);
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
class TheadTitlesRowComponent {
|
|
2838
|
+
constructor() {
|
|
2839
|
+
this.sort = new EventEmitter();
|
|
2840
|
+
this.selectAllRows = new EventEmitter();
|
|
2841
|
+
}
|
|
2842
|
+
ngOnChanges() {
|
|
2843
|
+
this.isMultiSelectVisible = this.grid.isMultiSelectVisible();
|
|
2844
|
+
this.showActionColumnLeft = this.grid.showActionColumn('left');
|
|
2845
|
+
this.showActionColumnRight = this.grid.showActionColumn('right');
|
|
2846
|
+
}
|
|
2847
|
+
getVisibleColumns(columns) {
|
|
2848
|
+
return (columns || []).filter((column) => !column.hide);
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
TheadTitlesRowComponent.ɵfac = function TheadTitlesRowComponent_Factory(t) { return new (t || TheadTitlesRowComponent)(); };
|
|
2852
|
+
TheadTitlesRowComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TheadTitlesRowComponent, selectors: [["", "ng2-st-thead-titles-row", ""]], inputs: { grid: "grid", source: "source" }, outputs: { sort: "sort", selectAllRows: "selectAllRows" }, features: [i0.ɵɵNgOnChangesFeature], attrs: _c0$1, decls: 4, vars: 4, consts: [["ng2-st-checkbox-select-all", "", 3, "grid", "source", "click", 4, "ngIf"], ["ng2-st-actions-title", "", 3, "grid", 4, "ngIf"], [3, "class", "ngClass", "width", 4, "ngFor", "ngForOf"], ["ng2-st-checkbox-select-all", "", 3, "grid", "source", "click"], ["ng2-st-actions-title", "", 3, "grid"], [3, "ngClass"], [3, "source", "column", "sort"]], template: function TheadTitlesRowComponent_Template(rf, ctx) {
|
|
2853
|
+
if (rf & 1) {
|
|
2854
|
+
i0.ɵɵtemplate(0, TheadTitlesRowComponent_th_0_Template, 1, 2, "th", 0);
|
|
2855
|
+
i0.ɵɵtemplate(1, TheadTitlesRowComponent_th_1_Template, 1, 1, "th", 1);
|
|
2856
|
+
i0.ɵɵtemplate(2, TheadTitlesRowComponent_th_2_Template, 2, 8, "th", 2);
|
|
2857
|
+
i0.ɵɵtemplate(3, TheadTitlesRowComponent_th_3_Template, 1, 1, "th", 1);
|
|
2858
|
+
}
|
|
2859
|
+
if (rf & 2) {
|
|
2860
|
+
i0.ɵɵproperty("ngIf", ctx.isMultiSelectVisible);
|
|
2861
|
+
i0.ɵɵadvance(1);
|
|
2862
|
+
i0.ɵɵproperty("ngIf", ctx.showActionColumnLeft);
|
|
2863
|
+
i0.ɵɵadvance(1);
|
|
2864
|
+
i0.ɵɵproperty("ngForOf", ctx.getVisibleColumns(ctx.grid.getColumns()));
|
|
2865
|
+
i0.ɵɵadvance(1);
|
|
2866
|
+
i0.ɵɵproperty("ngIf", ctx.showActionColumnRight);
|
|
2867
|
+
}
|
|
2868
|
+
}, dependencies: [i1.NgClass, i1.NgForOf, i1.NgIf, ActionsTitleComponent, CheckboxSelectAllComponent, ColumnTitleComponent], encapsulation: 2 });
|
|
2869
|
+
(function () {
|
|
2870
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TheadTitlesRowComponent, [{
|
|
2871
|
+
type: Component,
|
|
2872
|
+
args: [{
|
|
2873
|
+
selector: '[ng2-st-thead-titles-row]',
|
|
2874
|
+
template: `
|
|
2875
|
+
<th ng2-st-checkbox-select-all *ngIf="isMultiSelectVisible"
|
|
2876
|
+
[grid]="grid"
|
|
2877
|
+
[source]="source"
|
|
2878
|
+
(click)="selectAllRows.emit($event)">
|
|
2879
|
+
</th>
|
|
2880
|
+
<th ng2-st-actions-title *ngIf="showActionColumnLeft" [grid]="grid"></th>
|
|
2881
|
+
<th *ngFor="let column of getVisibleColumns(grid.getColumns())"
|
|
2882
|
+
class="ng2-smart-th {{ column.id }}"
|
|
2883
|
+
[ngClass]="column.class"
|
|
2884
|
+
[style.width]="column.width">
|
|
2885
|
+
<ng2-st-column-title [source]="source" [column]="column" (sort)="sort.emit($event)"></ng2-st-column-title>
|
|
2886
|
+
</th>
|
|
2887
|
+
<th ng2-st-actions-title *ngIf="showActionColumnRight" [grid]="grid"></th>
|
|
2888
|
+
`,
|
|
2889
|
+
}]
|
|
2890
|
+
}], null, { grid: [{
|
|
2891
|
+
type: Input
|
|
2892
|
+
}], source: [{
|
|
2893
|
+
type: Input
|
|
2894
|
+
}], sort: [{
|
|
2895
|
+
type: Output
|
|
2896
|
+
}], selectAllRows: [{
|
|
2897
|
+
type: Output
|
|
2898
|
+
}] });
|
|
2899
|
+
})();
|
|
2900
|
+
|
|
2901
|
+
const _c0 = ["ng2-st-thead", ""];
|
|
2902
|
+
function Ng2SmartTableTheadComponent_tr_0_Template(rf, ctx) {
|
|
2903
|
+
if (rf & 1) {
|
|
2904
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
2905
|
+
i0.ɵɵelementStart(0, "tr", 3);
|
|
2906
|
+
i0.ɵɵlistener("sort", function Ng2SmartTableTheadComponent_tr_0_Template_tr_sort_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.sort.emit($event)); })("selectAllRows", function Ng2SmartTableTheadComponent_tr_0_Template_tr_selectAllRows_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r5 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r5.selectAllRows.emit($event)); });
|
|
2907
|
+
i0.ɵɵelementEnd();
|
|
2908
|
+
}
|
|
2909
|
+
if (rf & 2) {
|
|
2910
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
2911
|
+
i0.ɵɵproperty("grid", ctx_r0.grid)("source", ctx_r0.source);
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
function Ng2SmartTableTheadComponent_tr_1_Template(rf, ctx) {
|
|
2915
|
+
if (rf & 1) {
|
|
2916
|
+
const _r7 = i0.ɵɵgetCurrentView();
|
|
2917
|
+
i0.ɵɵelementStart(0, "tr", 4);
|
|
2918
|
+
i0.ɵɵlistener("create", function Ng2SmartTableTheadComponent_tr_1_Template_tr_create_0_listener($event) { i0.ɵɵrestoreView(_r7); const ctx_r6 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r6.create.emit($event)); })("filter", function Ng2SmartTableTheadComponent_tr_1_Template_tr_filter_0_listener($event) { i0.ɵɵrestoreView(_r7); const ctx_r8 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r8.filter.emit($event)); });
|
|
2919
|
+
i0.ɵɵelementEnd();
|
|
2920
|
+
}
|
|
2921
|
+
if (rf & 2) {
|
|
2922
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
2923
|
+
i0.ɵɵproperty("grid", ctx_r1.grid)("source", ctx_r1.source);
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
function Ng2SmartTableTheadComponent_tr_2_Template(rf, ctx) {
|
|
2927
|
+
if (rf & 1) {
|
|
2928
|
+
i0.ɵɵelement(0, "tr", 5);
|
|
2929
|
+
}
|
|
2930
|
+
if (rf & 2) {
|
|
2931
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
2932
|
+
i0.ɵɵproperty("grid", ctx_r2.grid)("createConfirm", ctx_r2.createConfirm);
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
class Ng2SmartTableTheadComponent {
|
|
2936
|
+
constructor() {
|
|
2937
|
+
this.sort = new EventEmitter();
|
|
2938
|
+
this.selectAllRows = new EventEmitter();
|
|
2939
|
+
this.create = new EventEmitter();
|
|
2940
|
+
this.filter = new EventEmitter();
|
|
2941
|
+
}
|
|
2942
|
+
ngOnChanges() {
|
|
2943
|
+
this.isHideHeader = this.grid.getSetting('hideHeader');
|
|
2944
|
+
this.isHideSubHeader = this.grid.getSetting('hideSubHeader');
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
Ng2SmartTableTheadComponent.ɵfac = function Ng2SmartTableTheadComponent_Factory(t) { return new (t || Ng2SmartTableTheadComponent)(); };
|
|
2948
|
+
Ng2SmartTableTheadComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Ng2SmartTableTheadComponent, selectors: [["", "ng2-st-thead", ""]], inputs: { grid: "grid", source: "source", createConfirm: "createConfirm" }, outputs: { sort: "sort", selectAllRows: "selectAllRows", create: "create", filter: "filter" }, features: [i0.ɵɵNgOnChangesFeature], attrs: _c0, decls: 3, vars: 3, consts: [["ng2-st-thead-titles-row", "", "class", "ng2-smart-titles", 3, "grid", "source", "sort", "selectAllRows", 4, "ngIf"], ["ng2-st-thead-filters-row", "", "class", "ng2-smart-filters", 3, "grid", "source", "create", "filter", 4, "ngIf"], ["ng2-st-thead-form-row", "", 3, "grid", "createConfirm", 4, "ngIf"], ["ng2-st-thead-titles-row", "", 1, "ng2-smart-titles", 3, "grid", "source", "sort", "selectAllRows"], ["ng2-st-thead-filters-row", "", 1, "ng2-smart-filters", 3, "grid", "source", "create", "filter"], ["ng2-st-thead-form-row", "", 3, "grid", "createConfirm"]], template: function Ng2SmartTableTheadComponent_Template(rf, ctx) {
|
|
2949
|
+
if (rf & 1) {
|
|
2950
|
+
i0.ɵɵtemplate(0, Ng2SmartTableTheadComponent_tr_0_Template, 1, 2, "tr", 0);
|
|
2951
|
+
i0.ɵɵtemplate(1, Ng2SmartTableTheadComponent_tr_1_Template, 1, 2, "tr", 1);
|
|
2952
|
+
i0.ɵɵtemplate(2, Ng2SmartTableTheadComponent_tr_2_Template, 1, 2, "tr", 2);
|
|
2953
|
+
}
|
|
2954
|
+
if (rf & 2) {
|
|
2955
|
+
i0.ɵɵproperty("ngIf", !ctx.isHideHeader);
|
|
2956
|
+
i0.ɵɵadvance(1);
|
|
2957
|
+
i0.ɵɵproperty("ngIf", !ctx.isHideSubHeader);
|
|
2958
|
+
i0.ɵɵadvance(1);
|
|
2959
|
+
i0.ɵɵproperty("ngIf", ctx.grid.createFormShown);
|
|
2960
|
+
}
|
|
2961
|
+
}, dependencies: [i1.NgIf, TheadFitlersRowComponent, TheadFormRowComponent, TheadTitlesRowComponent], encapsulation: 2 });
|
|
2962
|
+
(function () {
|
|
2963
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Ng2SmartTableTheadComponent, [{
|
|
2964
|
+
type: Component,
|
|
2965
|
+
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" }]
|
|
2966
|
+
}], null, { grid: [{
|
|
2967
|
+
type: Input
|
|
2968
|
+
}], source: [{
|
|
2969
|
+
type: Input
|
|
2970
|
+
}], createConfirm: [{
|
|
2971
|
+
type: Input
|
|
2972
|
+
}], sort: [{
|
|
2973
|
+
type: Output
|
|
2974
|
+
}], selectAllRows: [{
|
|
2975
|
+
type: Output
|
|
2976
|
+
}], create: [{
|
|
2977
|
+
type: Output
|
|
2978
|
+
}], filter: [{
|
|
2979
|
+
type: Output
|
|
2980
|
+
}] });
|
|
2981
|
+
})();
|
|
2982
|
+
|
|
2983
|
+
const THEAD_COMPONENTS = [
|
|
2984
|
+
ActionsComponent,
|
|
2985
|
+
ActionsTitleComponent,
|
|
2986
|
+
AddButtonComponent,
|
|
2987
|
+
CheckboxSelectAllComponent,
|
|
2988
|
+
ColumnTitleComponent,
|
|
2989
|
+
TitleComponent,
|
|
2990
|
+
TheadFitlersRowComponent,
|
|
2991
|
+
TheadFormRowComponent,
|
|
2992
|
+
TheadTitlesRowComponent,
|
|
2993
|
+
Ng2SmartTableTheadComponent,
|
|
2994
|
+
];
|
|
2995
|
+
class THeadModule {
|
|
2996
|
+
}
|
|
2997
|
+
THeadModule.ɵfac = function THeadModule_Factory(t) { return new (t || THeadModule)(); };
|
|
2998
|
+
THeadModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: THeadModule });
|
|
2999
|
+
THeadModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
3000
|
+
FormsModule,
|
|
3001
|
+
FilterModule,
|
|
3002
|
+
CellModule] });
|
|
3003
|
+
(function () {
|
|
3004
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(THeadModule, [{
|
|
3005
|
+
type: NgModule,
|
|
3006
|
+
args: [{
|
|
3007
|
+
imports: [
|
|
3008
|
+
CommonModule,
|
|
3009
|
+
FormsModule,
|
|
3010
|
+
FilterModule,
|
|
3011
|
+
CellModule,
|
|
3012
|
+
],
|
|
3013
|
+
declarations: [
|
|
3014
|
+
...THEAD_COMPONENTS,
|
|
3015
|
+
],
|
|
3016
|
+
exports: [
|
|
3017
|
+
...THEAD_COMPONENTS,
|
|
3018
|
+
],
|
|
3019
|
+
}]
|
|
3020
|
+
}], null, null);
|
|
3021
|
+
})();
|
|
3022
|
+
(function () {
|
|
3023
|
+
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(THeadModule, { declarations: [ActionsComponent,
|
|
3024
|
+
ActionsTitleComponent,
|
|
3025
|
+
AddButtonComponent,
|
|
3026
|
+
CheckboxSelectAllComponent,
|
|
3027
|
+
ColumnTitleComponent,
|
|
3028
|
+
TitleComponent,
|
|
3029
|
+
TheadFitlersRowComponent,
|
|
3030
|
+
TheadFormRowComponent,
|
|
3031
|
+
TheadTitlesRowComponent,
|
|
3032
|
+
Ng2SmartTableTheadComponent], imports: [CommonModule,
|
|
3033
|
+
FormsModule,
|
|
3034
|
+
FilterModule,
|
|
3035
|
+
CellModule], exports: [ActionsComponent,
|
|
3036
|
+
ActionsTitleComponent,
|
|
3037
|
+
AddButtonComponent,
|
|
3038
|
+
CheckboxSelectAllComponent,
|
|
3039
|
+
ColumnTitleComponent,
|
|
3040
|
+
TitleComponent,
|
|
3041
|
+
TheadFitlersRowComponent,
|
|
3042
|
+
TheadFormRowComponent,
|
|
3043
|
+
TheadTitlesRowComponent,
|
|
3044
|
+
Ng2SmartTableTheadComponent] });
|
|
3045
|
+
})();
|
|
3046
|
+
|
|
3047
|
+
/**
|
|
3048
|
+
* Extending object that entered in first argument.
|
|
3049
|
+
*
|
|
3050
|
+
* Returns extended object or false if have no target object or incorrect type.
|
|
3051
|
+
*
|
|
3052
|
+
* If you wish to clone source object (without modify it), just use empty new
|
|
3053
|
+
* object as first argument, like this:
|
|
3054
|
+
* deepExtend({}, yourObj_1, [yourObj_N]);
|
|
3055
|
+
*/
|
|
3056
|
+
const deepExtend = function (...objects) {
|
|
3057
|
+
if (arguments.length < 1 || typeof arguments[0] !== 'object') {
|
|
3058
|
+
return false;
|
|
3059
|
+
}
|
|
3060
|
+
if (arguments.length < 2) {
|
|
3061
|
+
return arguments[0];
|
|
3062
|
+
}
|
|
3063
|
+
const target = arguments[0];
|
|
3064
|
+
// convert arguments to array and cut off target object
|
|
3065
|
+
const args = Array.prototype.slice.call(arguments, 1);
|
|
3066
|
+
let val, src;
|
|
3067
|
+
args.forEach((obj) => {
|
|
3068
|
+
// skip argument if it is array or isn't object
|
|
3069
|
+
if (typeof obj !== 'object' || Array.isArray(obj)) {
|
|
3070
|
+
return;
|
|
3071
|
+
}
|
|
3072
|
+
Object.keys(obj).forEach(function (key) {
|
|
3073
|
+
src = target[key]; // source value
|
|
3074
|
+
val = obj[key]; // new value
|
|
3075
|
+
// recursion prevention
|
|
3076
|
+
if (val === target) {
|
|
3077
|
+
return;
|
|
3078
|
+
/**
|
|
3079
|
+
* if new value isn't object then just overwrite by new value
|
|
3080
|
+
* instead of extending.
|
|
3081
|
+
*/
|
|
3082
|
+
}
|
|
3083
|
+
else if (typeof val !== 'object' || val === null) {
|
|
3084
|
+
target[key] = val;
|
|
3085
|
+
return;
|
|
3086
|
+
// just clone arrays (and recursive clone objects inside)
|
|
3087
|
+
}
|
|
3088
|
+
else if (Array.isArray(val)) {
|
|
3089
|
+
target[key] = [...val];
|
|
3090
|
+
return;
|
|
3091
|
+
// overwrite by new value if source isn't object or array
|
|
3092
|
+
}
|
|
3093
|
+
else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
|
|
3094
|
+
target[key] = deepExtend({}, val);
|
|
3095
|
+
return;
|
|
3096
|
+
// source value and new value is objects both, extending...
|
|
3097
|
+
}
|
|
3098
|
+
else {
|
|
3099
|
+
target[key] = deepExtend(src, val);
|
|
3100
|
+
return;
|
|
3101
|
+
}
|
|
3102
|
+
});
|
|
3103
|
+
});
|
|
3104
|
+
return target;
|
|
3105
|
+
};
|
|
3106
|
+
class Deferred {
|
|
3107
|
+
constructor() {
|
|
3108
|
+
this.promise = new Promise((resolve, reject) => {
|
|
3109
|
+
this.resolve = resolve;
|
|
3110
|
+
this.reject = reject;
|
|
3111
|
+
});
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
// getDeepFromObject({result: {data: 1}}, 'result.data', 2); // returns 1
|
|
3115
|
+
function getDeepFromObject(object = {}, name, defaultValue) {
|
|
3116
|
+
const keys = name.split('.');
|
|
3117
|
+
// clone the object
|
|
3118
|
+
let level = deepExtend({}, object);
|
|
3119
|
+
keys.forEach((k) => {
|
|
3120
|
+
if (level && typeof level[k] !== 'undefined') {
|
|
3121
|
+
level = level[k];
|
|
3122
|
+
}
|
|
3123
|
+
});
|
|
3124
|
+
return typeof level === 'undefined' ? defaultValue : level;
|
|
3125
|
+
}
|
|
3126
|
+
function getPageForRowIndex(index, perPage) {
|
|
3127
|
+
// we need to add 1 to convert 0-based index to 1-based page number.
|
|
3128
|
+
return Math.floor(index / perPage) + 1;
|
|
3129
|
+
}
|
|
3130
|
+
|
|
3131
|
+
function prepareValue(value) { return value; }
|
|
3132
|
+
class Cell {
|
|
3133
|
+
constructor(value, row, column, dataSet) {
|
|
3134
|
+
this.value = value;
|
|
3135
|
+
this.row = row;
|
|
3136
|
+
this.column = column;
|
|
3137
|
+
this.dataSet = dataSet;
|
|
3138
|
+
this.newValue = '';
|
|
3139
|
+
this.newValue = value;
|
|
3140
|
+
}
|
|
3141
|
+
getColumn() {
|
|
3142
|
+
return this.column;
|
|
3143
|
+
}
|
|
3144
|
+
getRow() {
|
|
3145
|
+
return this.row;
|
|
3146
|
+
}
|
|
3147
|
+
getValue() {
|
|
3148
|
+
const valid = this.column.getValuePrepareFunction() instanceof Function;
|
|
3149
|
+
const prepare = valid ? this.column.getValuePrepareFunction() : Cell.PREPARE;
|
|
3150
|
+
return prepare.call(null, this.value, this.row.getData(), this);
|
|
3151
|
+
}
|
|
3152
|
+
setValue(value) {
|
|
3153
|
+
this.newValue = value;
|
|
3154
|
+
}
|
|
3155
|
+
getId() {
|
|
3156
|
+
return this.getColumn().id;
|
|
3157
|
+
}
|
|
3158
|
+
getTitle() {
|
|
3159
|
+
return this.getColumn().title;
|
|
3160
|
+
}
|
|
3161
|
+
isEditable() {
|
|
3162
|
+
if (this.getRow().index === -1) {
|
|
3163
|
+
return this.getColumn().isAddable;
|
|
3164
|
+
}
|
|
3165
|
+
else {
|
|
3166
|
+
return this.getColumn().isEditable;
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
Cell.PREPARE = prepareValue;
|
|
3171
|
+
|
|
3172
|
+
class Row {
|
|
3173
|
+
constructor(index, data, _dataSet) {
|
|
3174
|
+
this.index = index;
|
|
3175
|
+
this.data = data;
|
|
3176
|
+
this._dataSet = _dataSet;
|
|
3177
|
+
this.isSelected = false;
|
|
3178
|
+
this.isInEditing = false;
|
|
3179
|
+
this.cells = [];
|
|
3180
|
+
this.process();
|
|
3181
|
+
}
|
|
3182
|
+
getCell(column) {
|
|
3183
|
+
return this.cells.find(el => el.getColumn() === column);
|
|
3184
|
+
}
|
|
3185
|
+
getCells() {
|
|
3186
|
+
return this.cells;
|
|
3187
|
+
}
|
|
3188
|
+
getData() {
|
|
3189
|
+
return this.data;
|
|
3190
|
+
}
|
|
3191
|
+
getIsSelected() {
|
|
3192
|
+
return this.isSelected;
|
|
3193
|
+
}
|
|
3194
|
+
getNewData() {
|
|
3195
|
+
const values = Object.assign({}, this.data);
|
|
3196
|
+
this.getCells().forEach((cell) => values[cell.getColumn().id] = cell.newValue);
|
|
3197
|
+
return values;
|
|
3198
|
+
}
|
|
3199
|
+
setData(data) {
|
|
3200
|
+
this.data = data;
|
|
3201
|
+
this.process();
|
|
3202
|
+
}
|
|
3203
|
+
process() {
|
|
3204
|
+
this.cells = [];
|
|
3205
|
+
this._dataSet.getColumns().forEach((column) => {
|
|
3206
|
+
const cell = this.createCell(column);
|
|
3207
|
+
this.cells.push(cell);
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
createCell(column) {
|
|
3211
|
+
const defValue = column.settings.defaultValue ? column.settings.defaultValue : '';
|
|
3212
|
+
const value = typeof this.data[column.id] === 'undefined' ? defValue : this.data[column.id];
|
|
3213
|
+
return new Cell(value, this, column, this._dataSet);
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
class Column {
|
|
3218
|
+
constructor(id, settings, dataSet) {
|
|
3219
|
+
this.id = id;
|
|
3220
|
+
this.settings = settings;
|
|
3221
|
+
this.dataSet = dataSet;
|
|
3222
|
+
this.title = '';
|
|
3223
|
+
this.type = '';
|
|
3224
|
+
this.class = '';
|
|
3225
|
+
this.width = '';
|
|
3226
|
+
this.hide = false;
|
|
3227
|
+
this.isSortable = false;
|
|
3228
|
+
this.isEditable = true;
|
|
3229
|
+
this.isAddable = true;
|
|
3230
|
+
this.isFilterable = false;
|
|
3231
|
+
this.sortDirection = '';
|
|
3232
|
+
this.defaultSortDirection = '';
|
|
3233
|
+
this.editor = { type: '', config: {}, component: null };
|
|
3234
|
+
this.filter = { type: '', config: {}, component: null };
|
|
3235
|
+
this.renderComponent = null;
|
|
3236
|
+
this.process();
|
|
3237
|
+
}
|
|
3238
|
+
getOnComponentInitFunction() {
|
|
3239
|
+
return this.onComponentInitFunction;
|
|
3240
|
+
}
|
|
3241
|
+
getCompareFunction() {
|
|
3242
|
+
return this.compareFunction;
|
|
3243
|
+
}
|
|
3244
|
+
getValuePrepareFunction() {
|
|
3245
|
+
return this.valuePrepareFunction;
|
|
3246
|
+
}
|
|
3247
|
+
getFilterFunction() {
|
|
3248
|
+
return this.filterFunction;
|
|
3249
|
+
}
|
|
3250
|
+
getConfig() {
|
|
3251
|
+
return this.editor && this.editor.config;
|
|
3252
|
+
}
|
|
3253
|
+
getFilterType() {
|
|
3254
|
+
return this.filter && this.filter.type;
|
|
3255
|
+
}
|
|
3256
|
+
getFilterConfig() {
|
|
3257
|
+
return this.filter && this.filter.config;
|
|
3258
|
+
}
|
|
3259
|
+
process() {
|
|
3260
|
+
this.title = this.settings['title'];
|
|
3261
|
+
this.class = this.settings['class'];
|
|
3262
|
+
this.width = this.settings['width'];
|
|
3263
|
+
this.hide = !!this.settings['hide'];
|
|
3264
|
+
this.type = this.prepareType();
|
|
3265
|
+
this.editor = this.settings['editor'];
|
|
3266
|
+
this.filter = this.settings['filter'];
|
|
3267
|
+
this.renderComponent = this.settings['renderComponent'];
|
|
3268
|
+
this.isFilterable = typeof this.settings['filter'] === 'undefined' ? true : !!this.settings['filter'];
|
|
3269
|
+
this.defaultSortDirection = ['asc', 'desc']
|
|
3270
|
+
.indexOf(this.settings['sortDirection']) !== -1 ? this.settings['sortDirection'] : '';
|
|
3271
|
+
this.isSortable = typeof this.settings['sort'] === 'undefined' ? true : !!this.settings['sort'];
|
|
3272
|
+
this.isEditable = typeof this.settings['editable'] === 'undefined' ? true : !!this.settings['editable'];
|
|
3273
|
+
this.isAddable = typeof this.settings['addable'] === 'undefined' ? true : !!this.settings['addable'];
|
|
3274
|
+
this.sortDirection = this.prepareSortDirection();
|
|
3275
|
+
this.compareFunction = this.settings['compareFunction'];
|
|
3276
|
+
this.valuePrepareFunction = this.settings['valuePrepareFunction'];
|
|
3277
|
+
this.filterFunction = this.settings['filterFunction'];
|
|
3278
|
+
this.onComponentInitFunction = this.settings['onComponentInitFunction'];
|
|
3279
|
+
}
|
|
3280
|
+
prepareType() {
|
|
3281
|
+
return this.settings['type'] || this.determineType();
|
|
3282
|
+
}
|
|
3283
|
+
prepareSortDirection() {
|
|
3284
|
+
return this.settings['sort'] === 'desc' ? 'desc' : 'asc';
|
|
3285
|
+
}
|
|
3286
|
+
determineType() {
|
|
3287
|
+
// TODO: determine type by data
|
|
3288
|
+
return 'text';
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
class DataSet {
|
|
3293
|
+
constructor(data = [], columnSettings) {
|
|
3294
|
+
this.columnSettings = columnSettings;
|
|
3295
|
+
this.data = [];
|
|
3296
|
+
this.columns = [];
|
|
3297
|
+
this.rows = [];
|
|
3298
|
+
this.selectedRows = new Set();
|
|
3299
|
+
this.createColumns(columnSettings);
|
|
3300
|
+
this.setData(data);
|
|
3301
|
+
this.createNewRow();
|
|
3302
|
+
}
|
|
3303
|
+
setData(data) {
|
|
3304
|
+
this.data = data;
|
|
3305
|
+
this.createRows();
|
|
3306
|
+
}
|
|
3307
|
+
getColumns() {
|
|
3308
|
+
return this.columns;
|
|
3309
|
+
}
|
|
3310
|
+
getRows() {
|
|
3311
|
+
return this.rows;
|
|
3312
|
+
}
|
|
3313
|
+
getFirstRow() {
|
|
3314
|
+
return this.rows[0];
|
|
3315
|
+
}
|
|
3316
|
+
getLastRow() {
|
|
3317
|
+
return this.rows[this.rows.length - 1];
|
|
3318
|
+
}
|
|
3319
|
+
findRowByData(data) {
|
|
3320
|
+
return this.rows.find((row) => row.getData() === data);
|
|
3321
|
+
}
|
|
3322
|
+
setSelectAll(state) {
|
|
3323
|
+
this.rows.forEach((row) => {
|
|
3324
|
+
row.isSelected = state;
|
|
3325
|
+
this.storeSelectedRow(row);
|
|
3326
|
+
});
|
|
3327
|
+
}
|
|
3328
|
+
deselectAll() {
|
|
3329
|
+
this.rows.forEach((row) => {
|
|
3330
|
+
row.isSelected = false;
|
|
3331
|
+
});
|
|
3332
|
+
// we need to clear selectedRow field because no one row selected
|
|
3333
|
+
this.selectedRows.clear();
|
|
3334
|
+
}
|
|
3335
|
+
selectRow(row, state) {
|
|
3336
|
+
row.isSelected = state;
|
|
3337
|
+
this.storeSelectedRow(row);
|
|
3338
|
+
}
|
|
3339
|
+
multipleSelectRow(row) {
|
|
3340
|
+
row.isSelected = !row.isSelected;
|
|
3341
|
+
this.storeSelectedRow(row);
|
|
3342
|
+
return row;
|
|
3343
|
+
}
|
|
3344
|
+
getSelectedRowsData() {
|
|
3345
|
+
return [...this.selectedRows];
|
|
3346
|
+
}
|
|
3347
|
+
createNewRow() {
|
|
3348
|
+
this.newRow = new Row(-1, {}, this);
|
|
3349
|
+
this.newRow.isInEditing = true;
|
|
3350
|
+
}
|
|
3351
|
+
/**
|
|
3352
|
+
* Create columns by mapping from the settings
|
|
3353
|
+
* @param settings
|
|
3354
|
+
* @private
|
|
3355
|
+
*/
|
|
3356
|
+
createColumns(settings) {
|
|
3357
|
+
for (const id in settings) {
|
|
3358
|
+
if (settings.hasOwnProperty(id)) {
|
|
3359
|
+
this.columns.push(new Column(id, settings[id], this));
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
/**
|
|
3364
|
+
* Create rows based on current data prepared in data source
|
|
3365
|
+
* @private
|
|
3366
|
+
*/
|
|
3367
|
+
createRows() {
|
|
3368
|
+
this.rows = [];
|
|
3369
|
+
this.data.forEach((el, index) => {
|
|
3370
|
+
const row = new Row(index, el, this);
|
|
3371
|
+
row.isSelected = this.selectedRows.has(row.getData());
|
|
3372
|
+
this.rows.push(row);
|
|
3373
|
+
});
|
|
3374
|
+
}
|
|
3375
|
+
get isAllSelected() {
|
|
3376
|
+
return this.rows.every((row) => row.isSelected);
|
|
3377
|
+
}
|
|
3378
|
+
storeSelectedRow(row) {
|
|
3379
|
+
if (row.isSelected) {
|
|
3380
|
+
this.selectedRows.add(row.getData());
|
|
3381
|
+
}
|
|
3382
|
+
else {
|
|
3383
|
+
this.selectedRows.delete(row.getData());
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
|
|
3388
|
+
class Grid {
|
|
3389
|
+
constructor(source, settings) {
|
|
3390
|
+
this.createFormShown = false;
|
|
3391
|
+
this.onSelectRowSource = new Subject();
|
|
3392
|
+
this.onDeselectRowSource = new Subject();
|
|
3393
|
+
this.setSettings(settings);
|
|
3394
|
+
this.setSource(source);
|
|
3395
|
+
}
|
|
3396
|
+
detach() {
|
|
3397
|
+
if (this.sourceOnChangedSubscription) {
|
|
3398
|
+
this.sourceOnChangedSubscription.unsubscribe();
|
|
3399
|
+
}
|
|
3400
|
+
if (this.sourceOnUpdatedSubscription) {
|
|
3401
|
+
this.sourceOnUpdatedSubscription.unsubscribe();
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
showActionColumn(position) {
|
|
3405
|
+
return this.isCurrentActionsPosition(position) && this.isActionsVisible();
|
|
3406
|
+
}
|
|
3407
|
+
isCurrentActionsPosition(position) {
|
|
3408
|
+
return position == this.getSetting('actions.position');
|
|
3409
|
+
}
|
|
3410
|
+
isActionsVisible() {
|
|
3411
|
+
return this.getSetting('actions.add') || this.getSetting('actions.edit') || this.getSetting('actions.delete') || this.getSetting('actions.custom').length;
|
|
3412
|
+
}
|
|
3413
|
+
isMultiSelectVisible() {
|
|
3414
|
+
return this.getSetting('selectMode') === 'multi';
|
|
3415
|
+
}
|
|
3416
|
+
getNewRow() {
|
|
3417
|
+
return this.dataSet.newRow;
|
|
3418
|
+
}
|
|
3419
|
+
setSettings(settings) {
|
|
3420
|
+
this.settings = settings;
|
|
3421
|
+
this.dataSet = new DataSet([], this.getSetting('columns'));
|
|
3422
|
+
if (this.source) {
|
|
3423
|
+
this.source.refresh();
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
getDataSet() {
|
|
3427
|
+
return this.dataSet;
|
|
3428
|
+
}
|
|
3429
|
+
setSource(source) {
|
|
3430
|
+
this.source = this.prepareSource(source);
|
|
3431
|
+
this.detach();
|
|
3432
|
+
this.sourceOnChangedSubscription = this.source.onChanged().subscribe((changes) => this.processDataChange(changes));
|
|
3433
|
+
this.sourceOnUpdatedSubscription = this.source.onUpdated().subscribe((data) => {
|
|
3434
|
+
const changedRow = this.dataSet.findRowByData(data);
|
|
3435
|
+
changedRow.setData(data);
|
|
3436
|
+
});
|
|
3437
|
+
}
|
|
3438
|
+
getSetting(name, defaultValue) {
|
|
3439
|
+
return getDeepFromObject(this.settings, name, defaultValue);
|
|
3440
|
+
}
|
|
3441
|
+
getColumns() {
|
|
3442
|
+
return this.dataSet.getColumns();
|
|
3443
|
+
}
|
|
3444
|
+
getRows() {
|
|
3445
|
+
return this.dataSet.getRows();
|
|
3446
|
+
}
|
|
3447
|
+
selectRow(row, state) {
|
|
3448
|
+
this.dataSet.selectRow(row, state);
|
|
3449
|
+
}
|
|
3450
|
+
multipleSelectRow(row) {
|
|
3451
|
+
this.dataSet.multipleSelectRow(row);
|
|
3452
|
+
}
|
|
3453
|
+
onSelectRow() {
|
|
3454
|
+
return this.onSelectRowSource.asObservable();
|
|
3455
|
+
}
|
|
3456
|
+
onDeselectRow() {
|
|
3457
|
+
return this.onDeselectRowSource.asObservable();
|
|
3458
|
+
}
|
|
3459
|
+
edit(row) {
|
|
3460
|
+
row.isInEditing = true;
|
|
3461
|
+
}
|
|
3462
|
+
create(row, confirmEmitter) {
|
|
3463
|
+
const deferred = new Deferred();
|
|
3464
|
+
deferred.promise.then((newData) => {
|
|
3465
|
+
newData = newData ? newData : row.getNewData();
|
|
3466
|
+
if (deferred.resolve.skipAdd) {
|
|
3467
|
+
this.createFormShown = false;
|
|
3468
|
+
}
|
|
3469
|
+
else {
|
|
3470
|
+
this.source.prepend(newData).then(() => {
|
|
3471
|
+
this.createFormShown = false;
|
|
3472
|
+
this.dataSet.createNewRow();
|
|
3473
|
+
});
|
|
3474
|
+
}
|
|
3475
|
+
}).catch((err) => {
|
|
3476
|
+
// doing nothing
|
|
3477
|
+
});
|
|
3478
|
+
if (this.getSetting('add.confirmCreate')) {
|
|
3479
|
+
confirmEmitter.emit({
|
|
3480
|
+
newData: row.getNewData(),
|
|
3481
|
+
source: this.source,
|
|
3482
|
+
confirm: deferred,
|
|
3483
|
+
});
|
|
3484
|
+
}
|
|
3485
|
+
else {
|
|
3486
|
+
deferred.resolve();
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
save(row, confirmEmitter) {
|
|
3490
|
+
const deferred = new Deferred();
|
|
3491
|
+
deferred.promise.then((newData) => {
|
|
3492
|
+
newData = newData ? newData : row.getNewData();
|
|
3493
|
+
if (deferred.resolve.skipEdit) {
|
|
3494
|
+
row.isInEditing = false;
|
|
3495
|
+
}
|
|
3496
|
+
else {
|
|
3497
|
+
this.source.update(row.getData(), newData).then(() => {
|
|
3498
|
+
row.isInEditing = false;
|
|
3499
|
+
});
|
|
3500
|
+
}
|
|
3501
|
+
}).catch((err) => {
|
|
3502
|
+
// doing nothing
|
|
3503
|
+
});
|
|
3504
|
+
if (this.getSetting('edit.confirmSave')) {
|
|
3505
|
+
confirmEmitter.emit({
|
|
3506
|
+
data: row.getData(),
|
|
3507
|
+
newData: row.getNewData(),
|
|
3508
|
+
source: this.source,
|
|
3509
|
+
confirm: deferred,
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3512
|
+
else {
|
|
3513
|
+
deferred.resolve();
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
delete(row, confirmEmitter) {
|
|
3517
|
+
const deferred = new Deferred();
|
|
3518
|
+
deferred.promise.then(() => {
|
|
3519
|
+
this.source.remove(row.getData());
|
|
3520
|
+
}).catch((err) => {
|
|
3521
|
+
// doing nothing
|
|
3522
|
+
});
|
|
3523
|
+
if (this.getSetting('delete.confirmDelete')) {
|
|
3524
|
+
confirmEmitter.emit({
|
|
3525
|
+
data: row.getData(),
|
|
3526
|
+
source: this.source,
|
|
3527
|
+
confirm: deferred,
|
|
3528
|
+
});
|
|
3529
|
+
}
|
|
3530
|
+
else {
|
|
3531
|
+
deferred.resolve();
|
|
3532
|
+
}
|
|
3533
|
+
if (row.isSelected) {
|
|
3534
|
+
this.dataSet.selectRow(row, false);
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
processDataChange(changes) {
|
|
3538
|
+
if (this.shouldProcessChange(changes)) {
|
|
3539
|
+
if (changes['action'] === 'load') {
|
|
3540
|
+
this.dataSet.deselectAll();
|
|
3541
|
+
}
|
|
3542
|
+
this.dataSet.setData(changes['elements']);
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
shouldProcessChange(changes) {
|
|
3546
|
+
if (['filter', 'sort', 'page', 'remove', 'refresh', 'load', 'paging'].indexOf(changes['action']) !== -1) {
|
|
3547
|
+
return true;
|
|
3548
|
+
}
|
|
3549
|
+
else if (['prepend', 'append'].indexOf(changes['action']) !== -1 && !this.getSetting('pager.display')) {
|
|
3550
|
+
return true;
|
|
3551
|
+
}
|
|
3552
|
+
return false;
|
|
3553
|
+
}
|
|
3554
|
+
prepareSource(source) {
|
|
3555
|
+
const initialSource = this.getInitialSort();
|
|
3556
|
+
if (initialSource && initialSource['field'] && initialSource['direction']) {
|
|
3557
|
+
source.setSort([initialSource], false);
|
|
3558
|
+
}
|
|
3559
|
+
if (this.getSetting('pager.display') === true) {
|
|
3560
|
+
source.setPaging(this.getPageToSelect(source), this.getSetting('pager.perPage'), false);
|
|
3561
|
+
}
|
|
3562
|
+
source.refresh();
|
|
3563
|
+
return source;
|
|
3564
|
+
}
|
|
3565
|
+
getInitialSort() {
|
|
3566
|
+
const sortConf = {};
|
|
3567
|
+
this.getColumns().forEach((column) => {
|
|
3568
|
+
if (column.isSortable && column.defaultSortDirection) {
|
|
3569
|
+
sortConf['field'] = column.id;
|
|
3570
|
+
sortConf['direction'] = column.defaultSortDirection;
|
|
3571
|
+
sortConf['compare'] = column.getCompareFunction();
|
|
3572
|
+
}
|
|
3573
|
+
});
|
|
3574
|
+
return sortConf;
|
|
3575
|
+
}
|
|
3576
|
+
getSelectedRowsData() {
|
|
3577
|
+
return this.dataSet.getRows();
|
|
3578
|
+
}
|
|
3579
|
+
selectAllRows(status) {
|
|
3580
|
+
this.dataSet.setSelectAll(status);
|
|
3581
|
+
}
|
|
3582
|
+
getFirstRow() {
|
|
3583
|
+
return this.dataSet.getFirstRow();
|
|
3584
|
+
}
|
|
3585
|
+
getLastRow() {
|
|
3586
|
+
return this.dataSet.getLastRow();
|
|
3587
|
+
}
|
|
3588
|
+
getSelectionInfo() {
|
|
3589
|
+
const switchPageToSelectedRowPage = this.getSetting('switchPageToSelectedRowPage');
|
|
3590
|
+
const selectedRowIndex = Number(this.getSetting('selectedRowIndex', 0)) || 0;
|
|
3591
|
+
const { perPage, page } = this.getSetting('pager');
|
|
3592
|
+
return { perPage, page, selectedRowIndex, switchPageToSelectedRowPage };
|
|
3593
|
+
}
|
|
3594
|
+
getPageToSelect(source) {
|
|
3595
|
+
const { switchPageToSelectedRowPage, selectedRowIndex, perPage, page } = this.getSelectionInfo();
|
|
3596
|
+
let pageToSelect = Math.max(1, page);
|
|
3597
|
+
if (switchPageToSelectedRowPage && selectedRowIndex >= 0) {
|
|
3598
|
+
pageToSelect = getPageForRowIndex(selectedRowIndex, perPage);
|
|
3599
|
+
}
|
|
3600
|
+
const maxPageAmount = Math.ceil(source.count() / perPage);
|
|
3601
|
+
return maxPageAmount ? Math.min(pageToSelect, maxPageAmount) : pageToSelect;
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
|
|
3605
|
+
class DataSource {
|
|
3606
|
+
constructor() {
|
|
3607
|
+
this.onChangedSource = new Subject();
|
|
3608
|
+
this.onAddedSource = new Subject();
|
|
3609
|
+
this.onUpdatedSource = new Subject();
|
|
3610
|
+
this.onRemovedSource = new Subject();
|
|
3611
|
+
}
|
|
3612
|
+
refresh() {
|
|
3613
|
+
this.emitOnChanged('refresh');
|
|
3614
|
+
}
|
|
3615
|
+
load(data) {
|
|
3616
|
+
this.emitOnChanged('load');
|
|
3617
|
+
return Promise.resolve();
|
|
3618
|
+
}
|
|
3619
|
+
onChanged() {
|
|
3620
|
+
return this.onChangedSource.asObservable();
|
|
3621
|
+
}
|
|
3622
|
+
onAdded() {
|
|
3623
|
+
return this.onAddedSource.asObservable();
|
|
3624
|
+
}
|
|
3625
|
+
onUpdated() {
|
|
3626
|
+
return this.onUpdatedSource.asObservable();
|
|
3627
|
+
}
|
|
3628
|
+
onRemoved() {
|
|
3629
|
+
return this.onRemovedSource.asObservable();
|
|
3630
|
+
}
|
|
3631
|
+
prepend(element) {
|
|
3632
|
+
this.emitOnAdded(element);
|
|
3633
|
+
this.emitOnChanged('prepend');
|
|
3634
|
+
return Promise.resolve();
|
|
3635
|
+
}
|
|
3636
|
+
append(element) {
|
|
3637
|
+
this.emitOnAdded(element);
|
|
3638
|
+
this.emitOnChanged('append');
|
|
3639
|
+
return Promise.resolve();
|
|
3640
|
+
}
|
|
3641
|
+
add(element) {
|
|
3642
|
+
this.emitOnAdded(element);
|
|
3643
|
+
this.emitOnChanged('add');
|
|
3644
|
+
return Promise.resolve();
|
|
3645
|
+
}
|
|
3646
|
+
remove(element) {
|
|
3647
|
+
this.emitOnRemoved(element);
|
|
3648
|
+
this.emitOnChanged('remove');
|
|
3649
|
+
return Promise.resolve();
|
|
3650
|
+
}
|
|
3651
|
+
update(element, values) {
|
|
3652
|
+
this.emitOnUpdated(element);
|
|
3653
|
+
this.emitOnChanged('update');
|
|
3654
|
+
return Promise.resolve();
|
|
3655
|
+
}
|
|
3656
|
+
empty() {
|
|
3657
|
+
this.emitOnChanged('empty');
|
|
3658
|
+
return Promise.resolve();
|
|
3659
|
+
}
|
|
3660
|
+
setSort(conf, doEmit) {
|
|
3661
|
+
if (doEmit) {
|
|
3662
|
+
this.emitOnChanged('sort');
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
setFilter(conf, andOperator, doEmit) {
|
|
3666
|
+
if (doEmit) {
|
|
3667
|
+
this.emitOnChanged('filter');
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
addFilter(fieldConf, andOperator, doEmit) {
|
|
3671
|
+
if (doEmit) {
|
|
3672
|
+
this.emitOnChanged('filter');
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3675
|
+
setPaging(page, perPage, doEmit) {
|
|
3676
|
+
if (doEmit) {
|
|
3677
|
+
this.emitOnChanged('paging');
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
setPage(page, doEmit) {
|
|
3681
|
+
if (doEmit) {
|
|
3682
|
+
this.emitOnChanged('page');
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
emitOnRemoved(element) {
|
|
3686
|
+
this.onRemovedSource.next(element);
|
|
3687
|
+
}
|
|
3688
|
+
emitOnUpdated(element) {
|
|
3689
|
+
this.onUpdatedSource.next(element);
|
|
3690
|
+
}
|
|
3691
|
+
emitOnAdded(element) {
|
|
3692
|
+
this.onAddedSource.next(element);
|
|
3693
|
+
}
|
|
3694
|
+
emitOnChanged(action) {
|
|
3695
|
+
this.getElements().then((elements) => this.onChangedSource.next({
|
|
3696
|
+
action: action,
|
|
3697
|
+
elements: elements,
|
|
3698
|
+
paging: this.getPaging(),
|
|
3699
|
+
filter: this.getFilter(),
|
|
3700
|
+
sort: this.getSort(),
|
|
3701
|
+
}));
|
|
3702
|
+
}
|
|
3703
|
+
}
|
|
3704
|
+
|
|
3705
|
+
function compareValues(direction, a, b) {
|
|
3706
|
+
if (a < b) {
|
|
3707
|
+
return -1 * direction;
|
|
3708
|
+
}
|
|
3709
|
+
if (a > b) {
|
|
3710
|
+
return direction;
|
|
3711
|
+
}
|
|
3712
|
+
return 0;
|
|
3713
|
+
}
|
|
3714
|
+
class LocalSorter {
|
|
3715
|
+
static sort(data, field, direction, customCompare) {
|
|
3716
|
+
const dir = (direction === 'asc') ? 1 : -1;
|
|
3717
|
+
const compare = customCompare ? customCompare : compareValues;
|
|
3718
|
+
return data.sort((a, b) => {
|
|
3719
|
+
return compare.call(null, dir, a[field], b[field]);
|
|
3720
|
+
});
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
|
|
3724
|
+
function filterValues(value, search) {
|
|
3725
|
+
return value.toString().toLowerCase().includes(search.toString().toLowerCase());
|
|
3726
|
+
}
|
|
3727
|
+
class LocalFilter {
|
|
3728
|
+
static filter(data, field, search, customFilter) {
|
|
3729
|
+
const filter = customFilter ? customFilter : filterValues;
|
|
3730
|
+
return data.filter((el) => {
|
|
3731
|
+
const value = typeof el[field] === 'undefined' || el[field] === null ? '' : el[field];
|
|
3732
|
+
return filter.call(null, value, search);
|
|
3733
|
+
});
|
|
3734
|
+
}
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
class LocalPager {
|
|
3738
|
+
static paginate(data, page, perPage) {
|
|
3739
|
+
return data.slice(perPage * (page - 1), perPage * page);
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3743
|
+
class LocalDataSource extends DataSource {
|
|
3744
|
+
constructor(data = []) {
|
|
3745
|
+
super();
|
|
3746
|
+
this.data = [];
|
|
3747
|
+
this.filteredAndSorted = [];
|
|
3748
|
+
this.sortConf = [];
|
|
3749
|
+
this.filterConf = {
|
|
3750
|
+
filters: [],
|
|
3751
|
+
andOperator: true,
|
|
3752
|
+
};
|
|
3753
|
+
this.pagingConf = {};
|
|
3754
|
+
this.data = data;
|
|
3755
|
+
}
|
|
3756
|
+
load(data) {
|
|
3757
|
+
this.data = data;
|
|
3758
|
+
return super.load(data);
|
|
3759
|
+
}
|
|
3760
|
+
prepend(element) {
|
|
3761
|
+
this.reset(true);
|
|
3762
|
+
this.data.unshift(element);
|
|
3763
|
+
return super.prepend(element);
|
|
3764
|
+
}
|
|
3765
|
+
append(element) {
|
|
3766
|
+
this.reset(true);
|
|
3767
|
+
this.data.push(element);
|
|
3768
|
+
return super.append(element);
|
|
3769
|
+
}
|
|
3770
|
+
add(element) {
|
|
3771
|
+
this.data.push(element);
|
|
3772
|
+
return super.add(element);
|
|
3773
|
+
}
|
|
3774
|
+
remove(element) {
|
|
3775
|
+
this.data = this.data.filter(el => el !== element);
|
|
3776
|
+
return super.remove(element);
|
|
3777
|
+
}
|
|
3778
|
+
update(element, values) {
|
|
3779
|
+
return new Promise((resolve, reject) => {
|
|
3780
|
+
this.find(element).then((found) => {
|
|
3781
|
+
found = deepExtend(found, values);
|
|
3782
|
+
super.update(found, values).then(resolve).catch(reject);
|
|
3783
|
+
}).catch(reject);
|
|
3784
|
+
});
|
|
3785
|
+
}
|
|
3786
|
+
find(element) {
|
|
3787
|
+
const found = this.data.find(el => el === element);
|
|
3788
|
+
if (found) {
|
|
3789
|
+
return Promise.resolve(found);
|
|
3790
|
+
}
|
|
3791
|
+
return Promise.reject(new Error('Element was not found in the dataset'));
|
|
3792
|
+
}
|
|
3793
|
+
getElements() {
|
|
3794
|
+
const data = this.data.slice(0);
|
|
3795
|
+
return Promise.resolve(this.prepareData(data));
|
|
3796
|
+
}
|
|
3797
|
+
getFilteredAndSorted() {
|
|
3798
|
+
let data = this.data.slice(0);
|
|
3799
|
+
this.prepareData(data);
|
|
3800
|
+
return Promise.resolve(this.filteredAndSorted);
|
|
3801
|
+
}
|
|
3802
|
+
getAll() {
|
|
3803
|
+
const data = this.data.slice(0);
|
|
3804
|
+
return Promise.resolve(data);
|
|
3805
|
+
}
|
|
3806
|
+
reset(silent = false) {
|
|
3807
|
+
if (silent) {
|
|
3808
|
+
this.filterConf = {
|
|
3809
|
+
filters: [],
|
|
3810
|
+
andOperator: true,
|
|
3811
|
+
};
|
|
3812
|
+
this.sortConf = [];
|
|
3813
|
+
this.pagingConf['page'] = 1;
|
|
3814
|
+
}
|
|
3815
|
+
else {
|
|
3816
|
+
this.setFilter([], true, false);
|
|
3817
|
+
this.setSort([], false);
|
|
3818
|
+
this.setPage(1);
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
empty() {
|
|
3822
|
+
this.data = [];
|
|
3823
|
+
return super.empty();
|
|
3824
|
+
}
|
|
3825
|
+
count() {
|
|
3826
|
+
return this.filteredAndSorted.length;
|
|
3827
|
+
}
|
|
3828
|
+
/**
|
|
3829
|
+
*
|
|
3830
|
+
* Array of conf objects
|
|
3831
|
+
* [
|
|
3832
|
+
* {field: string, direction: asc|desc|null, compare: Function|null},
|
|
3833
|
+
* ]
|
|
3834
|
+
* @param conf
|
|
3835
|
+
* @param doEmit
|
|
3836
|
+
* @returns {LocalDataSource}
|
|
3837
|
+
*/
|
|
3838
|
+
setSort(conf, doEmit = true) {
|
|
3839
|
+
if (conf !== null) {
|
|
3840
|
+
conf.forEach((fieldConf) => {
|
|
3841
|
+
if (!fieldConf['field'] || typeof fieldConf['direction'] === 'undefined') {
|
|
3842
|
+
throw new Error('Sort configuration object is not valid');
|
|
3843
|
+
}
|
|
3844
|
+
});
|
|
3845
|
+
this.sortConf = conf;
|
|
3846
|
+
}
|
|
3847
|
+
super.setSort(conf, doEmit);
|
|
3848
|
+
return this;
|
|
3849
|
+
}
|
|
3850
|
+
/**
|
|
3851
|
+
*
|
|
3852
|
+
* Array of conf objects
|
|
3853
|
+
* [
|
|
3854
|
+
* {field: string, search: string, filter: Function|null},
|
|
3855
|
+
* ]
|
|
3856
|
+
* @param conf
|
|
3857
|
+
* @param andOperator
|
|
3858
|
+
* @param doEmit
|
|
3859
|
+
* @returns {LocalDataSource}
|
|
3860
|
+
*/
|
|
3861
|
+
setFilter(conf, andOperator = true, doEmit = true) {
|
|
3862
|
+
if (conf && conf.length > 0) {
|
|
3863
|
+
conf.forEach((fieldConf) => {
|
|
3864
|
+
this.addFilter(fieldConf, andOperator, false);
|
|
3865
|
+
});
|
|
3866
|
+
}
|
|
3867
|
+
else {
|
|
3868
|
+
this.filterConf = {
|
|
3869
|
+
filters: [],
|
|
3870
|
+
andOperator: true,
|
|
3871
|
+
};
|
|
3872
|
+
}
|
|
3873
|
+
this.filterConf.andOperator = andOperator;
|
|
3874
|
+
this.pagingConf['page'] = 1;
|
|
3875
|
+
super.setFilter(conf, andOperator, doEmit);
|
|
3876
|
+
return this;
|
|
3877
|
+
}
|
|
3878
|
+
addFilter(fieldConf, andOperator = true, doEmit = true) {
|
|
3879
|
+
if (!fieldConf['field'] || typeof fieldConf['search'] === 'undefined') {
|
|
3880
|
+
throw new Error('Filter configuration object is not valid');
|
|
3881
|
+
}
|
|
3882
|
+
let found = false;
|
|
3883
|
+
this.filterConf.filters.forEach((currentFieldConf, index) => {
|
|
3884
|
+
if (currentFieldConf['field'] === fieldConf['field']) {
|
|
3885
|
+
this.filterConf.filters[index] = fieldConf;
|
|
3886
|
+
found = true;
|
|
3887
|
+
}
|
|
3888
|
+
});
|
|
3889
|
+
if (!found) {
|
|
3890
|
+
this.filterConf.filters.push(fieldConf);
|
|
3891
|
+
}
|
|
3892
|
+
this.filterConf.andOperator = andOperator;
|
|
3893
|
+
super.addFilter(fieldConf, andOperator, doEmit);
|
|
3894
|
+
return this;
|
|
3895
|
+
}
|
|
3896
|
+
setPaging(page, perPage, doEmit = true) {
|
|
3897
|
+
this.pagingConf['page'] = page;
|
|
3898
|
+
this.pagingConf['perPage'] = perPage;
|
|
3899
|
+
super.setPaging(page, perPage, doEmit);
|
|
3900
|
+
return this;
|
|
3901
|
+
}
|
|
3902
|
+
setPage(page, doEmit = true) {
|
|
3903
|
+
this.pagingConf['page'] = page;
|
|
3904
|
+
super.setPage(page, doEmit);
|
|
3905
|
+
return this;
|
|
3906
|
+
}
|
|
3907
|
+
getSort() {
|
|
3908
|
+
return this.sortConf;
|
|
3909
|
+
}
|
|
3910
|
+
getFilter() {
|
|
3911
|
+
return this.filterConf;
|
|
3912
|
+
}
|
|
3913
|
+
getPaging() {
|
|
3914
|
+
return this.pagingConf;
|
|
3915
|
+
}
|
|
3916
|
+
prepareData(data) {
|
|
3917
|
+
data = this.filter(data);
|
|
3918
|
+
data = this.sort(data);
|
|
3919
|
+
this.filteredAndSorted = data.slice(0);
|
|
3920
|
+
return this.paginate(data);
|
|
3921
|
+
}
|
|
3922
|
+
sort(data) {
|
|
3923
|
+
if (this.sortConf) {
|
|
3924
|
+
this.sortConf.forEach((fieldConf) => {
|
|
3925
|
+
data = LocalSorter
|
|
3926
|
+
.sort(data, fieldConf['field'], fieldConf['direction'], fieldConf['compare']);
|
|
3927
|
+
});
|
|
3928
|
+
}
|
|
3929
|
+
return data;
|
|
3930
|
+
}
|
|
3931
|
+
// TODO: refactor?
|
|
3932
|
+
filter(data) {
|
|
3933
|
+
if (this.filterConf.filters) {
|
|
3934
|
+
if (this.filterConf.andOperator) {
|
|
3935
|
+
this.filterConf.filters.forEach((fieldConf) => {
|
|
3936
|
+
if (fieldConf['search'].length > 0) {
|
|
3937
|
+
data = LocalFilter
|
|
3938
|
+
.filter(data, fieldConf['field'], fieldConf['search'], fieldConf['filter']);
|
|
3939
|
+
}
|
|
3940
|
+
});
|
|
3941
|
+
}
|
|
3942
|
+
else {
|
|
3943
|
+
let mergedData = [];
|
|
3944
|
+
this.filterConf.filters.forEach((fieldConf) => {
|
|
3945
|
+
if (fieldConf['search'].length > 0) {
|
|
3946
|
+
mergedData = mergedData.concat(LocalFilter
|
|
3947
|
+
.filter(data, fieldConf['field'], fieldConf['search'], fieldConf['filter']));
|
|
3948
|
+
}
|
|
3949
|
+
});
|
|
3950
|
+
// remove non unique items
|
|
3951
|
+
data = mergedData.filter((elem, pos, arr) => {
|
|
3952
|
+
return arr.indexOf(elem) === pos;
|
|
3953
|
+
});
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
return data;
|
|
3957
|
+
}
|
|
3958
|
+
paginate(data) {
|
|
3959
|
+
if (this.pagingConf && this.pagingConf['page'] && this.pagingConf['perPage']) {
|
|
3960
|
+
data = LocalPager.paginate(data, this.pagingConf['page'], this.pagingConf['perPage']);
|
|
3961
|
+
}
|
|
3962
|
+
return data;
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
|
|
3966
|
+
function Ng2SmartTableComponent_thead_1_Template(rf, ctx) {
|
|
3967
|
+
if (rf & 1) {
|
|
3968
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
3969
|
+
i0.ɵɵelementStart(0, "thead", 4);
|
|
3970
|
+
i0.ɵɵlistener("create", function Ng2SmartTableComponent_thead_1_Template_thead_create_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.create.emit($event)); })("selectAllRows", function Ng2SmartTableComponent_thead_1_Template_thead_selectAllRows_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r4 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r4.onSelectAllRows()); });
|
|
3971
|
+
i0.ɵɵelementEnd();
|
|
3972
|
+
}
|
|
3973
|
+
if (rf & 2) {
|
|
3974
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
3975
|
+
i0.ɵɵproperty("grid", ctx_r0.grid)("source", ctx_r0.source)("createConfirm", ctx_r0.createConfirm);
|
|
3976
|
+
}
|
|
3977
|
+
}
|
|
3978
|
+
function Ng2SmartTableComponent_ng2_smart_table_pager_3_Template(rf, ctx) {
|
|
3979
|
+
if (rf & 1) {
|
|
3980
|
+
i0.ɵɵelement(0, "ng2-smart-table-pager", 5);
|
|
3981
|
+
}
|
|
3982
|
+
if (rf & 2) {
|
|
3983
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
3984
|
+
i0.ɵɵproperty("source", ctx_r1.source)("perPageSelect", ctx_r1.perPageSelect);
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
class Ng2SmartTableComponent {
|
|
3988
|
+
constructor() {
|
|
3989
|
+
this.multiRowSelect = new EventEmitter();
|
|
3990
|
+
this.rowClicked = new EventEmitter();
|
|
3991
|
+
this.delete = new EventEmitter();
|
|
3992
|
+
this.edit = new EventEmitter();
|
|
3993
|
+
this.create = new EventEmitter();
|
|
3994
|
+
this.custom = new EventEmitter();
|
|
3995
|
+
this.deleteConfirm = new EventEmitter();
|
|
3996
|
+
this.editConfirm = new EventEmitter();
|
|
3997
|
+
this.createConfirm = new EventEmitter();
|
|
3998
|
+
this.rowHover = new EventEmitter();
|
|
3999
|
+
this.defaultSettings = {
|
|
4000
|
+
mode: 'inline',
|
|
4001
|
+
selectMode: 'single',
|
|
4002
|
+
/**
|
|
4003
|
+
* Points to an element in all data
|
|
4004
|
+
*
|
|
4005
|
+
* when < 0 all lines must be deselected
|
|
4006
|
+
*/
|
|
4007
|
+
selectedRowIndex: 0,
|
|
4008
|
+
switchPageToSelectedRowPage: false,
|
|
4009
|
+
hideHeader: false,
|
|
4010
|
+
hideSubHeader: false,
|
|
4011
|
+
actions: {
|
|
4012
|
+
columnTitle: 'Actions',
|
|
4013
|
+
add: true,
|
|
4014
|
+
edit: true,
|
|
4015
|
+
delete: true,
|
|
4016
|
+
custom: [],
|
|
4017
|
+
position: 'left', // left|right
|
|
4018
|
+
},
|
|
4019
|
+
filter: {
|
|
4020
|
+
inputClass: '',
|
|
4021
|
+
},
|
|
4022
|
+
edit: {
|
|
4023
|
+
inputClass: '',
|
|
4024
|
+
editButtonContent: 'Edit',
|
|
4025
|
+
saveButtonContent: 'Update',
|
|
4026
|
+
cancelButtonContent: 'Cancel',
|
|
4027
|
+
confirmSave: false,
|
|
4028
|
+
},
|
|
4029
|
+
add: {
|
|
4030
|
+
inputClass: '',
|
|
4031
|
+
addButtonContent: 'Add New',
|
|
4032
|
+
createButtonContent: 'Create',
|
|
4033
|
+
cancelButtonContent: 'Cancel',
|
|
4034
|
+
confirmCreate: false,
|
|
4035
|
+
},
|
|
4036
|
+
delete: {
|
|
4037
|
+
deleteButtonContent: 'Delete',
|
|
4038
|
+
confirmDelete: false,
|
|
4039
|
+
},
|
|
4040
|
+
attr: {
|
|
4041
|
+
id: '',
|
|
4042
|
+
class: '',
|
|
4043
|
+
},
|
|
4044
|
+
noDataMessage: 'No data found',
|
|
4045
|
+
columns: {},
|
|
4046
|
+
pager: {
|
|
4047
|
+
display: true,
|
|
4048
|
+
page: 1,
|
|
4049
|
+
perPage: 10,
|
|
4050
|
+
},
|
|
4051
|
+
rowClassFunction: () => '',
|
|
4052
|
+
};
|
|
4053
|
+
}
|
|
4054
|
+
ngOnChanges(changes) {
|
|
4055
|
+
if (this.grid) {
|
|
4056
|
+
if (changes['settings']) {
|
|
4057
|
+
this.grid.setSettings(this.prepareSettings());
|
|
4058
|
+
}
|
|
4059
|
+
if (changes['source']) {
|
|
4060
|
+
this.source = this.prepareSource();
|
|
4061
|
+
this.grid.setSource(this.source);
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
else {
|
|
4065
|
+
this.initGrid();
|
|
4066
|
+
}
|
|
4067
|
+
this.tableId = this.grid.getSetting('attr.id');
|
|
4068
|
+
this.tableClass = this.grid.getSetting('attr.class');
|
|
4069
|
+
this.isHideHeader = this.grid.getSetting('hideHeader');
|
|
4070
|
+
this.isHideSubHeader = this.grid.getSetting('hideSubHeader');
|
|
4071
|
+
this.isPagerDisplay = this.grid.getSetting('pager.display');
|
|
4072
|
+
this.isPagerDisplay = this.grid.getSetting('pager.display');
|
|
4073
|
+
this.perPageSelect = this.grid.getSetting('pager.perPageSelect');
|
|
4074
|
+
this.rowClassFunction = this.grid.getSetting('rowClassFunction');
|
|
4075
|
+
}
|
|
4076
|
+
onRowHover(row) {
|
|
4077
|
+
this.rowHover.emit(row);
|
|
4078
|
+
}
|
|
4079
|
+
multipleSelectRow(row) {
|
|
4080
|
+
this.grid.multipleSelectRow(row);
|
|
4081
|
+
this.emitUserSelectRow(row);
|
|
4082
|
+
}
|
|
4083
|
+
onSelectAllRows() {
|
|
4084
|
+
this.grid.dataSet.isAllSelected;
|
|
4085
|
+
this.grid.selectAllRows(!this.grid.dataSet.isAllSelected);
|
|
4086
|
+
this.emitUserSelectRow(null);
|
|
4087
|
+
}
|
|
4088
|
+
onSelectRow(row, state) {
|
|
4089
|
+
this.grid.selectRow(row, state);
|
|
4090
|
+
}
|
|
4091
|
+
initGrid() {
|
|
4092
|
+
this.source = this.prepareSource();
|
|
4093
|
+
this.grid = new Grid(this.source, this.prepareSettings());
|
|
4094
|
+
}
|
|
4095
|
+
prepareSource() {
|
|
4096
|
+
if (this.source instanceof DataSource) {
|
|
4097
|
+
return this.source;
|
|
4098
|
+
}
|
|
4099
|
+
return new LocalDataSource();
|
|
4100
|
+
}
|
|
4101
|
+
prepareSettings() {
|
|
4102
|
+
return deepExtend({}, this.defaultSettings, this.settings);
|
|
4103
|
+
}
|
|
4104
|
+
emitUserSelectRow(row) {
|
|
4105
|
+
this.multiRowSelect.emit({
|
|
4106
|
+
data: row ? row.getData() : null,
|
|
4107
|
+
isSelected: row ? row.getIsSelected() : null,
|
|
4108
|
+
source: this.source,
|
|
4109
|
+
selected: this.grid.dataSet.getSelectedRowsData(),
|
|
4110
|
+
});
|
|
4111
|
+
}
|
|
4112
|
+
emitUserRowClicked(row) {
|
|
4113
|
+
this.rowClicked.emit({
|
|
4114
|
+
data: row ? row.getData() : null,
|
|
4115
|
+
source: this.source,
|
|
4116
|
+
});
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
Ng2SmartTableComponent.ɵfac = function Ng2SmartTableComponent_Factory(t) { return new (t || Ng2SmartTableComponent)(); };
|
|
4120
|
+
Ng2SmartTableComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Ng2SmartTableComponent, selectors: [["ng2-smart-table"]], inputs: { source: "source", settings: "settings" }, outputs: { multiRowSelect: "multiRowSelect", rowClicked: "rowClicked", delete: "delete", edit: "edit", create: "create", custom: "custom", deleteConfirm: "deleteConfirm", editConfirm: "editConfirm", createConfirm: "createConfirm", rowHover: "rowHover" }, features: [i0.ɵɵNgOnChangesFeature], decls: 4, vars: 9, consts: [[3, "id", "ngClass"], ["ng2-st-thead", "", 3, "grid", "source", "createConfirm", "create", "selectAllRows", 4, "ngIf"], ["ng2-st-tbody", "", 3, "grid", "source", "deleteConfirm", "editConfirm", "rowClassFunction", "edit", "delete", "custom", "userClickedRow", "multipleSelectRow", "rowHover"], [3, "source", "perPageSelect", 4, "ngIf"], ["ng2-st-thead", "", 3, "grid", "source", "createConfirm", "create", "selectAllRows"], [3, "source", "perPageSelect"]], template: function Ng2SmartTableComponent_Template(rf, ctx) {
|
|
4121
|
+
if (rf & 1) {
|
|
4122
|
+
i0.ɵɵelementStart(0, "table", 0);
|
|
4123
|
+
i0.ɵɵtemplate(1, Ng2SmartTableComponent_thead_1_Template, 1, 3, "thead", 1);
|
|
4124
|
+
i0.ɵɵelementStart(2, "tbody", 2);
|
|
4125
|
+
i0.ɵɵlistener("edit", function Ng2SmartTableComponent_Template_tbody_edit_2_listener($event) { return ctx.edit.emit($event); })("delete", function Ng2SmartTableComponent_Template_tbody_delete_2_listener($event) { return ctx.delete.emit($event); })("custom", function Ng2SmartTableComponent_Template_tbody_custom_2_listener($event) { return ctx.custom.emit($event); })("userClickedRow", function Ng2SmartTableComponent_Template_tbody_userClickedRow_2_listener($event) { return ctx.emitUserRowClicked($event); })("multipleSelectRow", function Ng2SmartTableComponent_Template_tbody_multipleSelectRow_2_listener($event) { return ctx.multipleSelectRow($event); })("rowHover", function Ng2SmartTableComponent_Template_tbody_rowHover_2_listener($event) { return ctx.onRowHover($event); });
|
|
4126
|
+
i0.ɵɵelementEnd()();
|
|
4127
|
+
i0.ɵɵtemplate(3, Ng2SmartTableComponent_ng2_smart_table_pager_3_Template, 1, 2, "ng2-smart-table-pager", 3);
|
|
4128
|
+
}
|
|
4129
|
+
if (rf & 2) {
|
|
4130
|
+
i0.ɵɵproperty("id", ctx.tableId)("ngClass", ctx.tableClass);
|
|
4131
|
+
i0.ɵɵadvance(1);
|
|
4132
|
+
i0.ɵɵproperty("ngIf", !ctx.isHideHeader || !ctx.isHideSubHeader);
|
|
4133
|
+
i0.ɵɵadvance(1);
|
|
4134
|
+
i0.ɵɵproperty("grid", ctx.grid)("source", ctx.source)("deleteConfirm", ctx.deleteConfirm)("editConfirm", ctx.editConfirm)("rowClassFunction", ctx.rowClassFunction);
|
|
4135
|
+
i0.ɵɵadvance(1);
|
|
4136
|
+
i0.ɵɵproperty("ngIf", ctx.isPagerDisplay);
|
|
4137
|
+
}
|
|
4138
|
+
}, dependencies: [i1.NgClass, i1.NgIf, PagerComponent, Ng2SmartTableTbodyComponent, Ng2SmartTableTheadComponent], styles: ["[_nghost-%COMP%]{font-size:1rem}[_nghost-%COMP%] *{box-sizing:border-box}[_nghost-%COMP%] button, [_nghost-%COMP%] input, [_nghost-%COMP%] optgroup, [_nghost-%COMP%] select, [_nghost-%COMP%] textarea{color:inherit;font:inherit;margin:0}[_nghost-%COMP%] table{line-height:1.5em;border-collapse:collapse;border-spacing:0;display:table;width:100%;max-width:100%;overflow:auto;word-break:normal;word-break:keep-all}[_nghost-%COMP%] table tr th{font-weight:700}[_nghost-%COMP%] table tr section{font-size:.75em;font-weight:700}[_nghost-%COMP%] table tr td, [_nghost-%COMP%] table tr th{font-size:.875em;margin:0;padding:.5em 1em}[_nghost-%COMP%] a{color:#1e6bb8;text-decoration:none}[_nghost-%COMP%] a:hover{text-decoration:underline}"] });
|
|
4139
|
+
(function () {
|
|
4140
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Ng2SmartTableComponent, [{
|
|
4141
|
+
type: Component,
|
|
4142
|
+
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 (delete)=\"delete.emit($event)\"\n (custom)=\"custom.emit($event)\"\n (userClickedRow)=\"emitUserRowClicked($event)\"\n (multipleSelectRow)=\"multipleSelectRow($event)\"\n (rowHover)=\"onRowHover($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%;overflow:auto;word-break:normal;word-break:keep-all}: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"] }]
|
|
4143
|
+
}], null, { source: [{
|
|
4144
|
+
type: Input
|
|
4145
|
+
}], settings: [{
|
|
4146
|
+
type: Input
|
|
4147
|
+
}], multiRowSelect: [{
|
|
4148
|
+
type: Output
|
|
4149
|
+
}], rowClicked: [{
|
|
4150
|
+
type: Output
|
|
4151
|
+
}], delete: [{
|
|
4152
|
+
type: Output
|
|
4153
|
+
}], edit: [{
|
|
4154
|
+
type: Output
|
|
4155
|
+
}], create: [{
|
|
4156
|
+
type: Output
|
|
4157
|
+
}], custom: [{
|
|
4158
|
+
type: Output
|
|
4159
|
+
}], deleteConfirm: [{
|
|
4160
|
+
type: Output
|
|
4161
|
+
}], editConfirm: [{
|
|
4162
|
+
type: Output
|
|
4163
|
+
}], createConfirm: [{
|
|
4164
|
+
type: Output
|
|
4165
|
+
}], rowHover: [{
|
|
4166
|
+
type: Output
|
|
4167
|
+
}] });
|
|
4168
|
+
})();
|
|
4169
|
+
|
|
4170
|
+
class Ng2SmartTableModule {
|
|
4171
|
+
}
|
|
4172
|
+
Ng2SmartTableModule.ɵfac = function Ng2SmartTableModule_Factory(t) { return new (t || Ng2SmartTableModule)(); };
|
|
4173
|
+
Ng2SmartTableModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: Ng2SmartTableModule });
|
|
4174
|
+
Ng2SmartTableModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
4175
|
+
FormsModule,
|
|
4176
|
+
ReactiveFormsModule,
|
|
4177
|
+
CellModule,
|
|
4178
|
+
FilterModule,
|
|
4179
|
+
PagerModule,
|
|
4180
|
+
TBodyModule,
|
|
4181
|
+
THeadModule] });
|
|
4182
|
+
(function () {
|
|
4183
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Ng2SmartTableModule, [{
|
|
4184
|
+
type: NgModule,
|
|
4185
|
+
args: [{
|
|
4186
|
+
imports: [
|
|
4187
|
+
CommonModule,
|
|
4188
|
+
FormsModule,
|
|
4189
|
+
ReactiveFormsModule,
|
|
4190
|
+
CellModule,
|
|
4191
|
+
FilterModule,
|
|
4192
|
+
PagerModule,
|
|
4193
|
+
TBodyModule,
|
|
4194
|
+
THeadModule,
|
|
4195
|
+
],
|
|
4196
|
+
declarations: [
|
|
4197
|
+
Ng2SmartTableComponent,
|
|
4198
|
+
],
|
|
4199
|
+
exports: [
|
|
4200
|
+
Ng2SmartTableComponent,
|
|
4201
|
+
],
|
|
4202
|
+
}]
|
|
4203
|
+
}], null, null);
|
|
4204
|
+
})();
|
|
4205
|
+
(function () {
|
|
4206
|
+
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(Ng2SmartTableModule, { declarations: [Ng2SmartTableComponent], imports: [CommonModule,
|
|
4207
|
+
FormsModule,
|
|
4208
|
+
ReactiveFormsModule,
|
|
4209
|
+
CellModule,
|
|
4210
|
+
FilterModule,
|
|
4211
|
+
PagerModule,
|
|
4212
|
+
TBodyModule,
|
|
4213
|
+
THeadModule], exports: [Ng2SmartTableComponent] });
|
|
4214
|
+
})();
|
|
4215
|
+
|
|
4216
|
+
class ServerSourceConf {
|
|
4217
|
+
constructor({ endPoint = '', sortFieldKey = '', sortDirKey = '', pagerPageKey = '', pagerLimitKey = '', filterFieldKey = '', totalKey = '', dataKey = '' } = {}) {
|
|
4218
|
+
this.endPoint = endPoint ? endPoint : '';
|
|
4219
|
+
this.sortFieldKey = sortFieldKey ? sortFieldKey : ServerSourceConf.SORT_FIELD_KEY;
|
|
4220
|
+
this.sortDirKey = sortDirKey ? sortDirKey : ServerSourceConf.SORT_DIR_KEY;
|
|
4221
|
+
this.pagerPageKey = pagerPageKey ? pagerPageKey : ServerSourceConf.PAGER_PAGE_KEY;
|
|
4222
|
+
this.pagerLimitKey = pagerLimitKey ? pagerLimitKey : ServerSourceConf.PAGER_LIMIT_KEY;
|
|
4223
|
+
this.filterFieldKey = filterFieldKey ? filterFieldKey : ServerSourceConf.FILTER_FIELD_KEY;
|
|
4224
|
+
this.totalKey = totalKey ? totalKey : ServerSourceConf.TOTAL_KEY;
|
|
4225
|
+
this.dataKey = dataKey ? dataKey : ServerSourceConf.DATA_KEY;
|
|
4226
|
+
}
|
|
4227
|
+
}
|
|
4228
|
+
ServerSourceConf.SORT_FIELD_KEY = '_sort';
|
|
4229
|
+
ServerSourceConf.SORT_DIR_KEY = '_order';
|
|
4230
|
+
ServerSourceConf.PAGER_PAGE_KEY = '_page';
|
|
4231
|
+
ServerSourceConf.PAGER_LIMIT_KEY = '_limit';
|
|
4232
|
+
ServerSourceConf.FILTER_FIELD_KEY = '#field#_like';
|
|
4233
|
+
ServerSourceConf.TOTAL_KEY = 'x-total-count';
|
|
4234
|
+
ServerSourceConf.DATA_KEY = '';
|
|
4235
|
+
|
|
4236
|
+
class ServerDataSource extends LocalDataSource {
|
|
4237
|
+
constructor(http, conf = {}) {
|
|
4238
|
+
super();
|
|
4239
|
+
this.http = http;
|
|
4240
|
+
this.lastRequestCount = 0;
|
|
4241
|
+
this.conf = new ServerSourceConf(conf);
|
|
4242
|
+
if (!this.conf.endPoint) {
|
|
4243
|
+
throw new Error('At least endPoint must be specified as a configuration of the server data source.');
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
count() {
|
|
4247
|
+
return this.lastRequestCount;
|
|
4248
|
+
}
|
|
4249
|
+
getElements() {
|
|
4250
|
+
return this.requestElements()
|
|
4251
|
+
.pipe(map(res => {
|
|
4252
|
+
this.lastRequestCount = this.extractTotalFromResponse(res);
|
|
4253
|
+
this.data = this.extractDataFromResponse(res);
|
|
4254
|
+
return this.data;
|
|
4255
|
+
})).toPromise();
|
|
4256
|
+
}
|
|
4257
|
+
/**
|
|
4258
|
+
* Extracts array of data from server response
|
|
4259
|
+
* @param res
|
|
4260
|
+
* @returns {any}
|
|
4261
|
+
*/
|
|
4262
|
+
extractDataFromResponse(res) {
|
|
4263
|
+
const rawData = res.body;
|
|
4264
|
+
const data = !!this.conf.dataKey ? getDeepFromObject(rawData, this.conf.dataKey, []) : rawData;
|
|
4265
|
+
if (data instanceof Array) {
|
|
4266
|
+
return data;
|
|
4267
|
+
}
|
|
4268
|
+
throw new Error(`Data must be an array.
|
|
4269
|
+
Please check that data extracted from the server response by the key '${this.conf.dataKey}' exists and is array.`);
|
|
4270
|
+
}
|
|
4271
|
+
/**
|
|
4272
|
+
* Extracts total rows count from the server response
|
|
4273
|
+
* Looks for the count in the heders first, then in the response body
|
|
4274
|
+
* @param res
|
|
4275
|
+
* @returns {any}
|
|
4276
|
+
*/
|
|
4277
|
+
extractTotalFromResponse(res) {
|
|
4278
|
+
if (res.headers.has(this.conf.totalKey)) {
|
|
4279
|
+
return +res.headers.get(this.conf.totalKey);
|
|
4280
|
+
}
|
|
4281
|
+
else {
|
|
4282
|
+
const rawData = res.body;
|
|
4283
|
+
return getDeepFromObject(rawData, this.conf.totalKey, 0);
|
|
4284
|
+
}
|
|
4285
|
+
}
|
|
4286
|
+
requestElements() {
|
|
4287
|
+
let httpParams = this.createRequesParams();
|
|
4288
|
+
return this.http.get(this.conf.endPoint, { params: httpParams, observe: 'response' });
|
|
4289
|
+
}
|
|
4290
|
+
createRequesParams() {
|
|
4291
|
+
let httpParams = new HttpParams();
|
|
4292
|
+
httpParams = this.addSortRequestParams(httpParams);
|
|
4293
|
+
httpParams = this.addFilterRequestParams(httpParams);
|
|
4294
|
+
return this.addPagerRequestParams(httpParams);
|
|
4295
|
+
}
|
|
4296
|
+
addSortRequestParams(httpParams) {
|
|
4297
|
+
if (this.sortConf) {
|
|
4298
|
+
this.sortConf.forEach((fieldConf) => {
|
|
4299
|
+
httpParams = httpParams.set(this.conf.sortFieldKey, fieldConf.field);
|
|
4300
|
+
httpParams = httpParams.set(this.conf.sortDirKey, fieldConf.direction.toUpperCase());
|
|
4301
|
+
});
|
|
4302
|
+
}
|
|
4303
|
+
return httpParams;
|
|
4304
|
+
}
|
|
4305
|
+
addFilterRequestParams(httpParams) {
|
|
4306
|
+
if (this.filterConf.filters) {
|
|
4307
|
+
this.filterConf.filters.forEach((fieldConf) => {
|
|
4308
|
+
if (fieldConf['search']) {
|
|
4309
|
+
httpParams = httpParams.set(this.conf.filterFieldKey.replace('#field#', fieldConf['field']), fieldConf['search']);
|
|
4310
|
+
}
|
|
4311
|
+
});
|
|
4312
|
+
}
|
|
4313
|
+
return httpParams;
|
|
4314
|
+
}
|
|
4315
|
+
addPagerRequestParams(httpParams) {
|
|
4316
|
+
if (this.pagingConf && this.pagingConf['page'] && this.pagingConf['perPage']) {
|
|
4317
|
+
httpParams = httpParams.set(this.conf.pagerPageKey, this.pagingConf['page']);
|
|
4318
|
+
httpParams = httpParams.set(this.conf.pagerLimitKey, this.pagingConf['perPage']);
|
|
4319
|
+
}
|
|
4320
|
+
return httpParams;
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
|
|
4324
|
+
/**
|
|
4325
|
+
* Generated bundle index. Do not edit.
|
|
4326
|
+
*/
|
|
4327
|
+
|
|
4328
|
+
export { Cell, DefaultEditor, DefaultFilter, LocalDataSource, Ng2SmartTableComponent, Ng2SmartTableModule, ServerDataSource };
|
|
4329
|
+
//# sourceMappingURL=den4ik92-ng2-smart-table.mjs.map
|