@sd-angular/core 1.3.105 → 1.3.107
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/bundles/sd-angular-core-grid-material.umd.js +97 -103
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +2 -2
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/esm2015/grid-material/src/lib/components/grid-filter/grid-filter.component.js +27 -22
- package/esm2015/grid-material/src/lib/components/popup-filter/popup-filter.component.js +17 -26
- package/esm2015/grid-material/src/lib/grid-material.component.js +21 -19
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.service.js +23 -25
- package/fesm2015/sd-angular-core-grid-material.js +96 -100
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/components/grid-filter/grid-filter.component.d.ts +7 -7
- package/grid-material/src/lib/components/popup-filter/popup-filter.component.d.ts +6 -12
- package/grid-material/src/lib/services/grid-filter/grid-filter.service.d.ts +4 -4
- package/package.json +1 -1
- package/{sd-angular-core-1.3.105.tgz → sd-angular-core-1.3.107.tgz} +0 -0
|
@@ -5,10 +5,11 @@ import { MatPaginator, MatPaginatorIntl, MatPaginatorModule } from '@angular/mat
|
|
|
5
5
|
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
6
6
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
7
7
|
import { v4 } from 'uuid';
|
|
8
|
-
import {
|
|
8
|
+
import { BehaviorSubject, Subscription, Subject, isObservable, combineLatest } from 'rxjs';
|
|
9
9
|
import { SdNotifyService } from '@sd-angular/core/notify';
|
|
10
10
|
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
11
|
-
import { startWith,
|
|
11
|
+
import { startWith, map, debounceTime, switchMap } from 'rxjs/operators';
|
|
12
|
+
import { SdModal } from '@sd-angular/core/modal';
|
|
12
13
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
13
14
|
import { SdLoadingService } from '@sd-angular/core/loading';
|
|
14
15
|
import { SdTranslateService } from '@sd-angular/core/translate';
|
|
@@ -132,7 +133,7 @@ const DEFAULT_GRID_MATERIAL_CONFIG = {
|
|
|
132
133
|
};
|
|
133
134
|
const GRID_MATERIAL_CONFIG = new InjectionToken('sd-grid-material.configuration');
|
|
134
135
|
|
|
135
|
-
var _filterRegister
|
|
136
|
+
var _filterRegister;
|
|
136
137
|
class SdPopupFilter {
|
|
137
138
|
constructor(cdRef) {
|
|
138
139
|
this.cdRef = cdRef;
|
|
@@ -146,8 +147,15 @@ class SdPopupFilter {
|
|
|
146
147
|
this.filterDefs = [];
|
|
147
148
|
this.filterDef = {};
|
|
148
149
|
this.inlineFilterDef = {};
|
|
149
|
-
_subscription.set(this, new Subscription());
|
|
150
150
|
this.open = () => {
|
|
151
|
+
const configuration = __classPrivateFieldGet(this, _filterRegister).configuration.get();
|
|
152
|
+
this.inlineColumn = JSON.parse(JSON.stringify(configuration.inlineColumn));
|
|
153
|
+
this.inlineExternal = JSON.parse(JSON.stringify(configuration.inlineExternal));
|
|
154
|
+
this.inlineFilterDef = JSON.parse(JSON.stringify(configuration.inlineFilterDef));
|
|
155
|
+
const filterValue = __classPrivateFieldGet(this, _filterRegister).value.get();
|
|
156
|
+
this.columnFilter = JSON.parse(JSON.stringify(filterValue.columnFilter));
|
|
157
|
+
this.externalFilter = JSON.parse(JSON.stringify(filterValue.externalFilter));
|
|
158
|
+
this.filterDef = JSON.parse(JSON.stringify(filterValue.filterDef));
|
|
151
159
|
this.modal.open();
|
|
152
160
|
this.cdRef.markForCheck();
|
|
153
161
|
};
|
|
@@ -164,7 +172,7 @@ class SdPopupFilter {
|
|
|
164
172
|
__classPrivateFieldGet(this, _filterRegister).value.set({
|
|
165
173
|
columnFilter: this.columnFilter,
|
|
166
174
|
externalFilter: this.externalFilter,
|
|
167
|
-
filterDef: this.filterDef
|
|
175
|
+
filterDef: this.filterDef,
|
|
168
176
|
});
|
|
169
177
|
this.modal.close();
|
|
170
178
|
this.cdRef.markForCheck();
|
|
@@ -173,35 +181,19 @@ class SdPopupFilter {
|
|
|
173
181
|
set filterRegister(value) {
|
|
174
182
|
__classPrivateFieldSet(this, _filterRegister, value);
|
|
175
183
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterRegister).configuration.observer.subscribe(configuration => {
|
|
179
|
-
this.inlineColumn = JSON.parse(JSON.stringify(configuration.inlineColumn));
|
|
180
|
-
this.inlineExternal = JSON.parse(JSON.stringify(configuration.inlineExternal));
|
|
181
|
-
this.inlineFilterDef = JSON.parse(JSON.stringify(configuration.inlineFilterDef));
|
|
182
|
-
this.cdRef.markForCheck();
|
|
183
|
-
}));
|
|
184
|
-
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterRegister).value.observer.subscribe(filterValue => {
|
|
185
|
-
this.columnFilter = JSON.parse(JSON.stringify(filterValue.columnFilter));
|
|
186
|
-
this.externalFilter = JSON.parse(JSON.stringify(filterValue.externalFilter));
|
|
187
|
-
this.filterDef = JSON.parse(JSON.stringify(filterValue.filterDef));
|
|
188
|
-
this.cdRef.markForCheck();
|
|
189
|
-
}));
|
|
190
|
-
}
|
|
191
|
-
ngOnDestroy() {
|
|
192
|
-
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
193
|
-
}
|
|
184
|
+
ngAfterViewInit() { }
|
|
185
|
+
ngOnDestroy() { }
|
|
194
186
|
onClear() {
|
|
195
187
|
__classPrivateFieldGet(this, _filterRegister).value.remove();
|
|
196
188
|
this.modal.close();
|
|
197
189
|
this.cdRef.markForCheck();
|
|
198
190
|
}
|
|
199
191
|
}
|
|
200
|
-
_filterRegister = new WeakMap()
|
|
192
|
+
_filterRegister = new WeakMap();
|
|
201
193
|
SdPopupFilter.decorators = [
|
|
202
194
|
{ type: Component, args: [{
|
|
203
195
|
selector: 'sd-popup-filter',
|
|
204
|
-
template: "<sd-modal width=\"500px\" [title]=\"'Filter' | sdTranslate\"
|
|
196
|
+
template: "<sd-modal width=\"500px\" [title]=\"'Filter' | sdTranslate\">\r\n <sd-modal-body class=\"c-popup-filter\">\r\n <ng-container *ngFor=\"let column of columns | sdFilterColumn\">\r\n <div class=\"d-flex align-items-baseline\">\r\n <ng-container>\r\n <div *sdDesktop class=\"c-checkable\">\r\n <mat-slide-toggle [(ngModel)]=\"inlineColumn[column.field]\" color=\"primary\"></mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-filterable\">\r\n <sd-input\r\n *ngIf=\"column.type === 'string'\"\r\n [label]=\"column.title\"\r\n type=\"text\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-input>\r\n <sd-input\r\n *ngIf=\"column.type === 'number'\"\r\n [label]=\"column.title\"\r\n type=\" number\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-input>\r\n <sd-select\r\n *ngIf=\"column.type === 'bool'\"\r\n [label]=\"column.title\"\r\n [items]=\"[\r\n { value: '1', display: column.trueValue || 'True' },\r\n { value: '0', display: column.falseValue || 'False' }\r\n ]\"\r\n valueField=\"value\"\r\n displayField=\"display\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-select>\r\n <sd-select\r\n *ngIf=\"column.type === 'values' && !column?.editor?.autocomplete\"\r\n [label]=\"column.title\"\r\n [items]=\"column.option.items\"\r\n [valueField]=\"column.option.valueField\"\r\n [displayField]=\"column.option.displayField\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-select>\r\n <sd-autocomplete\r\n *ngIf=\"column.type === 'values' && column?.editor?.autocomplete\"\r\n [label]=\"column.title\"\r\n [items]=\"column.option.items\"\r\n [valueField]=\"column.option.valueField\"\r\n [displayField]=\"column.option.displayField\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-date-time\r\n *ngIf=\"column.type === 'date' || column.type === 'datetime' || column.type === 'time'\"\r\n [label]=\"column.title\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n type=\"date\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal\">\r\n <div class=\"d-flex align-items-baseline\">\r\n <ng-container>\r\n <div *sdDesktop class=\"c-checkable\">\r\n <mat-slide-toggle [(ngModel)]=\"inlineExternal[item.field]\" color=\"primary\"></mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-filterable\">\r\n <sd-input\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'string'\"\r\n type=\"text\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"externalFilter[item.field]\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'bool'\"\r\n [items]=\"[\r\n { value: '1', display: item.option?.displayOnTrue || 'True' },\r\n { value: '0', display: item.option?.displayOnFalse || 'False' }\r\n ]\"\r\n valueField=\"value\"\r\n displayField=\"display\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n appearance=\"outline\">\r\n </sd-select>\r\n <ng-container *ngIf=\"item.type === 'values'\">\r\n <sd-select\r\n *ngIf=\"item.option?.selection === 'MULTIPLE'\"\r\n [label]=\"item.title\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n appearance=\"outline\"\r\n multiple>\r\n </sd-select>\r\n <sd-autocomplete\r\n *ngIf=\"item.option?.selection === 'AUTOCOMPLETE'\"\r\n [label]=\"item.title\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n appearance=\"outline\"\r\n [(model)]=\"externalFilter[item.field]\">\r\n </sd-autocomplete>\r\n <sd-select\r\n *ngIf=\"item.option?.selection === 'MULTIPLEAUTOCOMPLETE'\"\r\n [label]=\"item.title\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n appearance=\"outline\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n filtered=\"true\"\r\n multiple>\r\n </sd-select>\r\n <sd-select\r\n *ngIf=\"!item.option?.selection\"\r\n [label]=\"item.title\"\r\n [items]=\"item.values\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n appearance=\"outline\"\r\n [(model)]=\"externalFilter[item.field]\">\r\n </sd-select>\r\n </ng-container>\r\n <sd-date-time\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'date' || item.type === 'datetime'\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n [type]=\"item.type\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n <sd-date-range\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'daterange' && externalFilter[item.field]\"\r\n [(from)]=\"externalFilter[item.field].from\"\r\n [(to)]=\"externalFilter[item.field].to\"\r\n [min]=\"item.minDate\"\r\n [max]=\"item.maxDate\"\r\n appearance=\"outline\">\r\n </sd-date-range>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngFor=\"let filter of filterDefs\">\r\n <div class=\"d-flex align-items-baseline\">\r\n <ng-container>\r\n <div *sdDesktop class=\"c-checkable\">\r\n <mat-slide-toggle [(ngModel)]=\"inlineFilterDef[filter.sdMaterialFilterDef]\" color=\"primary\"> </mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-filterable\">\r\n <ng-container *ngTemplateOutlet=\"filter.templateRef; context: { filterDef: filterDef }\"> </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </sd-modal-body>\r\n <sd-modal-footer *sdDesktop>\r\n <sd-button class=\"mr-auto\" (action)=\"onClear()\" title=\"M\u1EB7c \u0111\u1ECBnh\" size=\"sm\" type=\"link\"> </sd-button>\r\n <sd-button (action)=\"onApply()\" title=\"\u0110\u1ED3ng \u00FD\" color=\"primary\" size=\"sm\" type=\"fill\"></sd-button>\r\n </sd-modal-footer>\r\n <sd-modal-footer *sdMobileTablet>\r\n <sd-button style=\"flex: 1; padding-right: 5px\" (action)=\"onClear()\" title=\"M\u1EB7c \u0111\u1ECBnh\" width=\"100%\" size=\"sm\" type=\"link\"></sd-button>\r\n <sd-button\r\n style=\"flex: 1; padding-left: 5px\"\r\n (action)=\"onApply()\"\r\n title=\"\u0110\u1ED3ng \u00FD\"\r\n color=\"primary\"\r\n width=\"100%\"\r\n size=\"sm\"\r\n type=\"fill\"></sd-button>\r\n </sd-modal-footer>\r\n</sd-modal>\r\n",
|
|
205
197
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
206
198
|
styles: [".c-checkable{width:50px}.c-filterable{flex:1}::ng-deep sd-modal-body.c-popup-filter .mat-form-field-wrapper{padding-bottom:0}"]
|
|
207
199
|
},] }
|
|
@@ -210,14 +202,14 @@ SdPopupFilter.ctorParameters = () => [
|
|
|
210
202
|
{ type: ChangeDetectorRef }
|
|
211
203
|
];
|
|
212
204
|
SdPopupFilter.propDecorators = {
|
|
213
|
-
modal: [{ type: ViewChild, args: [
|
|
205
|
+
modal: [{ type: ViewChild, args: [SdModal,] }],
|
|
214
206
|
filterRegister: [{ type: Input }],
|
|
215
207
|
externalFilters: [{ type: Input }],
|
|
216
208
|
columns: [{ type: Input }],
|
|
217
209
|
filterDefs: [{ type: Input }]
|
|
218
210
|
};
|
|
219
211
|
|
|
220
|
-
var _subscription
|
|
212
|
+
var _subscription;
|
|
221
213
|
class SdGridFilter {
|
|
222
214
|
constructor(ref, deviceService) {
|
|
223
215
|
this.ref = ref;
|
|
@@ -232,7 +224,7 @@ class SdGridFilter {
|
|
|
232
224
|
this.inlineColumn = {};
|
|
233
225
|
this.externalFilter = {};
|
|
234
226
|
this.inlineExternal = {};
|
|
235
|
-
_subscription
|
|
227
|
+
_subscription.set(this, new Subscription());
|
|
236
228
|
this.onFilter = (item) => {
|
|
237
229
|
this.filterRegister.value.set({
|
|
238
230
|
columnFilter: this.columnFilter,
|
|
@@ -257,29 +249,33 @@ class SdGridFilter {
|
|
|
257
249
|
this.filterRegisterChange.next(this.filterRegister);
|
|
258
250
|
}
|
|
259
251
|
ngAfterViewInit() {
|
|
260
|
-
__classPrivateFieldGet(this, _subscription
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
252
|
+
__classPrivateFieldGet(this, _subscription).add(this.filterRegisterChange.pipe(startWith(this.filterRegister)).subscribe(filterRegister => {
|
|
253
|
+
if (this.filterRegister) {
|
|
254
|
+
__classPrivateFieldGet(this, _subscription).add(this.filterRegister.configuration.observer.subscribe(configuration => {
|
|
255
|
+
const { inlineColumn, inlineExternal, inlineFilterDef } = configuration;
|
|
256
|
+
this.inlineColumn = inlineColumn;
|
|
257
|
+
this.inlineExternal = inlineExternal;
|
|
258
|
+
this.inlineFilterDef = inlineFilterDef;
|
|
259
|
+
this.ref.markForCheck();
|
|
260
|
+
}));
|
|
261
|
+
__classPrivateFieldGet(this, _subscription).add(this.filterRegister.value.observer.subscribe(value => {
|
|
262
|
+
const { columnFilter, externalFilter, filterDef } = value;
|
|
263
|
+
this.columnFilter = columnFilter;
|
|
264
|
+
this.externalFilter = externalFilter;
|
|
265
|
+
this.filterDef = filterDef;
|
|
266
|
+
this.ref.markForCheck();
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
273
269
|
}));
|
|
274
270
|
}
|
|
275
271
|
ngOnDestroy() {
|
|
276
|
-
__classPrivateFieldGet(this, _subscription
|
|
272
|
+
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
277
273
|
}
|
|
278
274
|
}
|
|
279
|
-
_subscription
|
|
275
|
+
_subscription = new WeakMap();
|
|
280
276
|
SdGridFilter.decorators = [
|
|
281
277
|
{ type: Component, args: [{
|
|
282
|
-
selector:
|
|
278
|
+
selector: 'sd-grid-filter',
|
|
283
279
|
template: "<ng-container *ngIf=\"!filter?.disabled\">\r\n <ng-container *ngIf=\"filter?.enableCollapse;else noCollapse\">\r\n <sd-group class=\"p-12\" [isExpanded]=\"false\" title=\"T\u00ECm ki\u1EBFm\" expandable>\r\n <div sdGroupBody>\r\n <ng-container *ngTemplateOutlet=\"noCollapse\"></ng-container>\r\n </div>\r\n </sd-group>\r\n </ng-container>\r\n <ng-template #noCollapse>\r\n <div\r\n *ngIf=\"!isMobileOrTablet && ((columns?.length && !filter?.inlineColumn) || externalFilters?.length || filterDefs?.length)\"\r\n class=\"row mx-0\">\r\n <ng-container *ngIf=\"filter?.sorts?.length\">\r\n <ng-container *ngFor=\"let field of filter?.sorts\">\r\n <ng-container *ngIf=\"columns?.length && !filter?.inlineColumn\">\r\n <ng-container *ngFor=\"let item of columns | sdFilterColumn:field\">\r\n <ng-container *ngTemplateOutlet=\"filterColumn; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"externalFilters?.length\">\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal:field\">\r\n <ng-container *ngTemplateOutlet=\"filterExternal; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of filterDefs\">\r\n <div *ngIf=\"inlineFilterDef[item.sdMaterialFilterDef] && item.sdMaterialFilterDef === field\"\r\n class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <ng-container *ngTemplateOutlet=\"item.templateRef;context:{filterDef:filterDef, isInline: true}\">\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!filter?.sorts?.length\">\r\n <ng-container *ngIf=\"columns?.length && !filter?.inlineColumn\">\r\n <ng-container *ngFor=\"let item of columns | sdFilterColumn\">\r\n <ng-container *ngTemplateOutlet=\"filterColumn; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"externalFilters?.length\">\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal\">\r\n <ng-container *ngTemplateOutlet=\"filterExternal; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of filterDefs\">\r\n <div *ngIf=\"inlineFilterDef[item.sdMaterialFilterDef]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <ng-container *ngTemplateOutlet=\"item.templateRef;context:{filterDef:filterDef, isInline: true}\">\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <ng-template #filterColumn let-item=\"item\">\r\n <div *ngIf=\"inlineColumn[item.field]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <sd-input [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\" [(model)]=\"columnFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"columnFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.option?.displayOnTrue || 'True' },\r\n {value:'0',display:item.option?.displayOnFalse || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n <sd-select *ngIf=\"item.type === 'values' && item?.option?.selection !== 'AUTOCOMPLETE'\"\r\n [items]=\"item.option?.items\" [valueField]=\"item.option?.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" [disabled]=\"item.filter?.disabled\"\r\n [multiple]=\"item?.option?.selection === 'MULTIPLE' || item?.item?.selection === 'MULTIPLEAUTOCOMPLETE'\"\r\n [filtered]=\"item?.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" appearance=\"outline\">\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"item.type === 'values' && item?.option?.selection === 'AUTOCOMPLETE'\"\r\n [items]=\"item.option?.items\" [valueField]=\"item.option?.valueField\" [displayField]=\"item.option?.displayField\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" [disabled]=\"item.filter?.disabled\"\r\n appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-date-time *ngIf=\"item.type === 'date' || item.type === 'datetime' || item.type === 'time'\"\r\n [label]=\"item.title\" [(model)]=\"columnFilter[item.field]\" [type]=\"item.type\" (sdChange)=\"onFilter(item)\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n </div>\r\n </ng-template>\r\n <ng-template #filterExternal let-item=\"item\">\r\n <div *ngIf=\"inlineExternal[item.field]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <sd-input [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\" [(model)]=\"externalFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"externalFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.option?.displayOnTrue || 'True' },\r\n {value:'0',display:item.option?.displayOnFalse || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n <ng-container *ngIf=\"item.type === 'values' && item.option\">\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLE'\" [label]=\"item.title\" [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" [selectAll]=\"item.option.selectAll\"\r\n appearance=\"outline\" multiple>\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"item.option?.selection === 'AUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item.option.items\" [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item.option.items\" [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" filtered=\"true\" appearance=\"outline\"\r\n multiple>\r\n </sd-select>\r\n <sd-select *ngIf=\"!item.option?.selection\" [label]=\"item.title\" [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n </ng-container>\r\n <sd-date-time [label]=\"item.title\" *ngIf=\"item.type ==='date' || item.type ==='datetime'\"\r\n [(model)]=\"externalFilter[item.field]\" [type]=\"item.type\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-date-time>\r\n <sd-date-range [label]=\"item.title\" *ngIf=\"item.type ==='daterange' && externalFilter[item.field]\"\r\n [(from)]=\"externalFilter[item.field].from\" [(to)]=\"externalFilter[item.field].to\" [min]=\"item.minDate\"\r\n [max]=\"item.maxDate\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-date-range>\r\n </div>\r\n </ng-template>\r\n <sd-popup-filter [filterRegister]=\"filterRegister\" [columns]=\"columns\"\r\n [externalFilters]=\"externalFilters\" [filterDefs]=\"filterDefs\">\r\n </sd-popup-filter>\r\n </ng-template>\r\n</ng-container>",
|
|
284
280
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
285
281
|
styles: [":host{display:block;padding-bottom:10px;padding-left:0;padding-right:0}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}"]
|
|
@@ -291,11 +287,11 @@ SdGridFilter.ctorParameters = () => [
|
|
|
291
287
|
];
|
|
292
288
|
SdGridFilter.propDecorators = {
|
|
293
289
|
popupFilter: [{ type: ViewChild, args: [SdPopupFilter,] }],
|
|
294
|
-
_filter: [{ type: Input, args: [
|
|
290
|
+
_filter: [{ type: Input, args: ['filter',] }],
|
|
295
291
|
columns: [{ type: Input }],
|
|
296
|
-
_externalFilters: [{ type: Input, args: [
|
|
292
|
+
_externalFilters: [{ type: Input, args: ['externalFilters',] }],
|
|
297
293
|
filterDefs: [{ type: Input }],
|
|
298
|
-
_filterRegister: [{ type: Input, args: [
|
|
294
|
+
_filterRegister: [{ type: Input, args: ['filterRegister',] }]
|
|
299
295
|
};
|
|
300
296
|
|
|
301
297
|
var _getExportableColumns, _getExportableGroups, _getExportColumns, _initTemplate;
|
|
@@ -1133,8 +1129,8 @@ var _filterConfiguration, _filterValue, _cache$2, _defaultConfiguration, _defaul
|
|
|
1133
1129
|
class SdGridFilterService {
|
|
1134
1130
|
constructor(settingService) {
|
|
1135
1131
|
this.settingService = settingService;
|
|
1136
|
-
_filterConfiguration.set(this,
|
|
1137
|
-
_filterValue.set(this,
|
|
1132
|
+
_filterConfiguration.set(this, 'GRID-FILTER-CONFIGURATION');
|
|
1133
|
+
_filterValue.set(this, 'GRID-FILTER-VALUE');
|
|
1138
1134
|
_cache$2.set(this, {});
|
|
1139
1135
|
this.register = (key, args) => {
|
|
1140
1136
|
let cacheSession = false;
|
|
@@ -1153,7 +1149,7 @@ class SdGridFilterService {
|
|
|
1153
1149
|
key,
|
|
1154
1150
|
}, {
|
|
1155
1151
|
default: __classPrivateFieldGet(this, _defaultConfiguration).call(this, args),
|
|
1156
|
-
type: cacheSession ?
|
|
1152
|
+
type: cacheSession ? 'session' : undefined,
|
|
1157
1153
|
});
|
|
1158
1154
|
// Lấy giá trị configuration merge với giá trị defaultShowing của args nếu như args có thay đổi
|
|
1159
1155
|
filterConfiguration.set(__classPrivateFieldGet(this, _initConfiguration).call(this, args, filterConfiguration.get()));
|
|
@@ -1163,7 +1159,7 @@ class SdGridFilterService {
|
|
|
1163
1159
|
key,
|
|
1164
1160
|
}, {
|
|
1165
1161
|
default: __classPrivateFieldGet(this, _defaultValue).call(this, args),
|
|
1166
|
-
type: cacheSession ?
|
|
1162
|
+
type: cacheSession ? 'session' : undefined,
|
|
1167
1163
|
});
|
|
1168
1164
|
// Lấy giá trị value merge với giá trị default của args nếu như args có thay đổi
|
|
1169
1165
|
filterValue.set(__classPrivateFieldGet(this, _initValue).call(this, args, filterValue.get()));
|
|
@@ -1186,39 +1182,37 @@ class SdGridFilterService {
|
|
|
1186
1182
|
};
|
|
1187
1183
|
},
|
|
1188
1184
|
remove: () => {
|
|
1189
|
-
filterConfiguration.
|
|
1185
|
+
filterConfiguration.set(__classPrivateFieldGet(this, _defaultConfiguration).call(this, args));
|
|
1190
1186
|
},
|
|
1191
|
-
observer: filterConfiguration.observer.pipe(startWith(filterConfiguration.get())
|
|
1187
|
+
observer: filterConfiguration.observer.pipe(startWith(filterConfiguration.get()),
|
|
1188
|
+
// Sử dụng mặc định nếu bị reset
|
|
1189
|
+
map(configuration => configuration || __classPrivateFieldGet(this, _defaultConfiguration).call(this, args))),
|
|
1192
1190
|
},
|
|
1193
1191
|
value: {
|
|
1194
1192
|
get: () => {
|
|
1195
1193
|
return filterValue.get();
|
|
1196
1194
|
},
|
|
1197
|
-
set: (
|
|
1198
|
-
const keys = Object.keys(
|
|
1195
|
+
set: (value) => {
|
|
1196
|
+
const keys = Object.keys(value || {});
|
|
1199
1197
|
const current = filterValue.get();
|
|
1200
1198
|
const { columnFilter, externalFilter, filterDef } = current;
|
|
1201
1199
|
const updatedConfiguration = {
|
|
1202
1200
|
// Filter column
|
|
1203
|
-
columnFilter: keys.includes(
|
|
1204
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {}
|
|
1205
|
-
: columnFilter,
|
|
1201
|
+
columnFilter: keys.includes('columnFilter') ? (value === null || value === void 0 ? void 0 : value.columnFilter) || {} : columnFilter,
|
|
1206
1202
|
// Filter external
|
|
1207
|
-
externalFilter: keys.includes(
|
|
1208
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {}
|
|
1209
|
-
: externalFilter,
|
|
1203
|
+
externalFilter: keys.includes('externalFilter') ? (value === null || value === void 0 ? void 0 : value.externalFilter) || {} : externalFilter,
|
|
1210
1204
|
// Filter def
|
|
1211
|
-
filterDef: keys.includes(
|
|
1212
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}
|
|
1213
|
-
: filterDef,
|
|
1205
|
+
filterDef: keys.includes('filterDef') ? (value === null || value === void 0 ? void 0 : value.filterDef) || {} : filterDef,
|
|
1214
1206
|
};
|
|
1215
1207
|
filterValue.set(updatedConfiguration);
|
|
1216
1208
|
return updatedConfiguration;
|
|
1217
1209
|
},
|
|
1218
1210
|
remove: () => {
|
|
1219
|
-
filterValue.
|
|
1211
|
+
filterValue.set(__classPrivateFieldGet(this, _defaultValue).call(this, args));
|
|
1220
1212
|
},
|
|
1221
|
-
observer: filterValue.observer.pipe(startWith(filterValue.get())
|
|
1213
|
+
observer: filterValue.observer.pipe(debounceTime(200), startWith(filterValue.get()),
|
|
1214
|
+
// Sử dụng mặc định nếu bị reset
|
|
1215
|
+
map(value => value || __classPrivateFieldGet(this, _defaultValue).call(this, args))),
|
|
1222
1216
|
},
|
|
1223
1217
|
};
|
|
1224
1218
|
}
|
|
@@ -1317,7 +1311,7 @@ class SdGridFilterService {
|
|
|
1317
1311
|
}
|
|
1318
1312
|
// Filter external
|
|
1319
1313
|
for (const item of externalFilters || []) {
|
|
1320
|
-
if (item.type ===
|
|
1314
|
+
if (item.type === 'daterange') {
|
|
1321
1315
|
externalFilter[item.field] = {
|
|
1322
1316
|
from: (_f = (_e = (_d = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _d === void 0 ? void 0 : _d[item.field]) === null || _e === void 0 ? void 0 : _e.from) !== null && _f !== void 0 ? _f : (_g = item.default) === null || _g === void 0 ? void 0 : _g.from,
|
|
1323
1317
|
to: (_k = (_j = (_h = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _h === void 0 ? void 0 : _h[item.field]) === null || _j === void 0 ? void 0 : _j.to) !== null && _k !== void 0 ? _k : (_l = item.default) === null || _l === void 0 ? void 0 : _l.to,
|
|
@@ -1350,7 +1344,7 @@ SdGridFilterService.ctorParameters = () => [
|
|
|
1350
1344
|
{ type: SdSettingService }
|
|
1351
1345
|
];
|
|
1352
1346
|
|
|
1353
|
-
var _optionChanges, _localItems, _paginator, _sort, _subscription$
|
|
1347
|
+
var _optionChanges, _localItems, _paginator, _sort, _subscription$1, _subcriptionFilterRegister, _reload, _loadCompleted, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration$1, _loadFilterRegister, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
1354
1348
|
class SdGridMaterial {
|
|
1355
1349
|
constructor(ref, configuration, gridConfigurationService, exportService, notifyService, columnValuesPipe, gridFilterService, editorHandlerColumnPipe) {
|
|
1356
1350
|
this.ref = ref;
|
|
@@ -1386,7 +1380,8 @@ class SdGridMaterial {
|
|
|
1386
1380
|
// Filter
|
|
1387
1381
|
this.columnFilter = {};
|
|
1388
1382
|
// Subcription
|
|
1389
|
-
_subscription$
|
|
1383
|
+
_subscription$1.set(this, new Subscription());
|
|
1384
|
+
_subcriptionFilterRegister.set(this, new Subscription());
|
|
1390
1385
|
_reload.set(this, new Subject());
|
|
1391
1386
|
this.isExporting = false;
|
|
1392
1387
|
this.isSelectAll = false;
|
|
@@ -1445,29 +1440,23 @@ class SdGridMaterial {
|
|
|
1445
1440
|
var _a, _b, _c, _d, _e;
|
|
1446
1441
|
// Init filter
|
|
1447
1442
|
if (this.gridOption) {
|
|
1448
|
-
const hasRegister = !!this.filterRegister;
|
|
1449
1443
|
this.filterRegister = this.gridFilterService.register((_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.key, {
|
|
1450
1444
|
columns: (_c = this.gridOption) === null || _c === void 0 ? void 0 : _c.columns,
|
|
1451
1445
|
externalFilters: (_e = (_d = this.gridOption) === null || _d === void 0 ? void 0 : _d.filter) === null || _e === void 0 ? void 0 : _e.externalFilters,
|
|
1452
1446
|
filterDefs: this.filterDefs,
|
|
1453
1447
|
});
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
__classPrivateFieldGet(this, _reload).next({
|
|
1461
|
-
force: false,
|
|
1462
|
-
});
|
|
1463
|
-
}))
|
|
1464
|
-
.subscribe());
|
|
1465
|
-
}
|
|
1466
|
-
else {
|
|
1448
|
+
__classPrivateFieldGet(this, _subcriptionFilterRegister).unsubscribe();
|
|
1449
|
+
__classPrivateFieldSet(this, _subcriptionFilterRegister, this.filterRegister.value.observer
|
|
1450
|
+
.pipe(debounceTime(500), map(filterValue => {
|
|
1451
|
+
const { columnFilter } = filterValue;
|
|
1452
|
+
this.columnFilter = columnFilter;
|
|
1453
|
+
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1467
1454
|
__classPrivateFieldGet(this, _reload).next({
|
|
1468
|
-
force:
|
|
1455
|
+
force: false,
|
|
1469
1456
|
});
|
|
1470
|
-
}
|
|
1457
|
+
}))
|
|
1458
|
+
.subscribe());
|
|
1459
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _subcriptionFilterRegister));
|
|
1471
1460
|
}
|
|
1472
1461
|
});
|
|
1473
1462
|
_filterLocal.set(this, (localItems, filterInfo) => {
|
|
@@ -2280,7 +2269,7 @@ class SdGridMaterial {
|
|
|
2280
2269
|
set paginator(paginator) {
|
|
2281
2270
|
if (paginator && __classPrivateFieldGet(this, _paginator) !== paginator) {
|
|
2282
2271
|
__classPrivateFieldSet(this, _paginator, paginator);
|
|
2283
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2272
|
+
__classPrivateFieldGet(this, _subscription$1).add(paginator.page
|
|
2284
2273
|
.pipe(map(() => {
|
|
2285
2274
|
__classPrivateFieldGet(this, _reload).next({
|
|
2286
2275
|
force: false,
|
|
@@ -2292,7 +2281,7 @@ class SdGridMaterial {
|
|
|
2292
2281
|
set sort(sort) {
|
|
2293
2282
|
if (sort && __classPrivateFieldGet(this, _sort) !== sort) {
|
|
2294
2283
|
__classPrivateFieldSet(this, _sort, sort);
|
|
2295
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2284
|
+
__classPrivateFieldGet(this, _subscription$1).add(sort.sortChange
|
|
2296
2285
|
.pipe(map(() => {
|
|
2297
2286
|
__classPrivateFieldGet(this, _reload).next({
|
|
2298
2287
|
force: false,
|
|
@@ -2305,26 +2294,33 @@ class SdGridMaterial {
|
|
|
2305
2294
|
__classPrivateFieldGet(this, _initCellDef).call(this);
|
|
2306
2295
|
}
|
|
2307
2296
|
ngAfterViewInit() {
|
|
2308
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2297
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _reload).pipe(debounceTime(200), switchMap((data) => __awaiter(this, void 0, void 0, function* () {
|
|
2309
2298
|
const filterInfo = __classPrivateFieldGet(this, _getFilter).call(this);
|
|
2310
2299
|
const result = yield __classPrivateFieldGet(this, _load$1).call(this, filterInfo, !__classPrivateFieldGet(this, _loadCompleted) || data.force);
|
|
2311
2300
|
__classPrivateFieldSet(this, _loadCompleted, true);
|
|
2312
2301
|
return result;
|
|
2313
2302
|
})))
|
|
2314
2303
|
.subscribe(__classPrivateFieldGet(this, _render)));
|
|
2315
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2316
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2317
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2318
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2304
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdCellDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
2305
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdFooterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
2306
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdFilterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
2307
|
+
__classPrivateFieldGet(this, _subscription$1).add(combineLatest([
|
|
2319
2308
|
__classPrivateFieldGet(this, _optionChanges).pipe(startWith(this.gridOption)),
|
|
2320
2309
|
this.sdFilterDefs.changes.pipe(startWith(this.filterDefs)),
|
|
2321
2310
|
]).subscribe(() => {
|
|
2322
2311
|
__classPrivateFieldGet(this, _loadFilterRegister).call(this);
|
|
2323
2312
|
}));
|
|
2313
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _optionChanges).subscribe(() => {
|
|
2314
|
+
if (this.filterRegister) {
|
|
2315
|
+
__classPrivateFieldGet(this, _reload).next({
|
|
2316
|
+
force: true,
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
}));
|
|
2324
2320
|
this.ref.detectChanges();
|
|
2325
2321
|
}
|
|
2326
2322
|
ngOnDestroy() {
|
|
2327
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2323
|
+
__classPrivateFieldGet(this, _subscription$1).unsubscribe();
|
|
2328
2324
|
}
|
|
2329
2325
|
drop(event, columns) {
|
|
2330
2326
|
moveItemInArray(columns, event.previousIndex, event.currentIndex);
|
|
@@ -2364,7 +2360,7 @@ class SdGridMaterial {
|
|
|
2364
2360
|
return this.items.some(e => e.editorStatus !== undefined);
|
|
2365
2361
|
}
|
|
2366
2362
|
}
|
|
2367
|
-
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$
|
|
2363
|
+
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$1 = new WeakMap(), _subcriptionFilterRegister = new WeakMap(), _reload = new WeakMap(), _loadCompleted = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration$1 = new WeakMap(), _loadFilterRegister = new WeakMap(), _filterLocal = new WeakMap(), _getFilter = new WeakMap(), _load$1 = new WeakMap(), _render = new WeakMap(), _exportedItems = new WeakMap(), _allColumns = new WeakMap(), _allExportedColumns = new WeakMap(), _onExport = new WeakMap(), _updateSelectedItems = new WeakMap();
|
|
2368
2364
|
SdGridMaterial.decorators = [
|
|
2369
2365
|
{ type: Component, args: [{
|
|
2370
2366
|
selector: 'sd-grid-material',
|
|
@@ -3129,7 +3125,7 @@ SdGeneratedColumnService.ctorParameters = () => [
|
|
|
3129
3125
|
{ type: SdSettingService }
|
|
3130
3126
|
];
|
|
3131
3127
|
|
|
3132
|
-
var _subscription$
|
|
3128
|
+
var _subscription$2;
|
|
3133
3129
|
class SdDynamicColumn {
|
|
3134
3130
|
constructor(ref, generatedColumnService, notifyService, translateService, gridConfigurationService) {
|
|
3135
3131
|
this.ref = ref;
|
|
@@ -3137,7 +3133,7 @@ class SdDynamicColumn {
|
|
|
3137
3133
|
this.notifyService = notifyService;
|
|
3138
3134
|
this.translateService = translateService;
|
|
3139
3135
|
this.gridConfigurationService = gridConfigurationService;
|
|
3140
|
-
_subscription$
|
|
3136
|
+
_subscription$2.set(this, new Subscription());
|
|
3141
3137
|
this.columnTypes = ['string', 'number', 'bool', 'date', 'datetime', 'time', 'values', 'children', 'children-col'];
|
|
3142
3138
|
this.form = new FormGroup({});
|
|
3143
3139
|
this.isDetail = false;
|
|
@@ -3181,22 +3177,22 @@ class SdDynamicColumn {
|
|
|
3181
3177
|
const systemSetting = this.generatedColumnService.loadSystem(this.gridOption.config);
|
|
3182
3178
|
const setting = this.generatedColumnService.load((_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.config);
|
|
3183
3179
|
if (systemSetting) {
|
|
3184
|
-
(_b = __classPrivateFieldGet(this, _subscription$
|
|
3180
|
+
(_b = __classPrivateFieldGet(this, _subscription$2)) === null || _b === void 0 ? void 0 : _b.add(systemSetting.observer.subscribe(columns => {
|
|
3185
3181
|
this.systemColumns = columns;
|
|
3186
3182
|
}));
|
|
3187
3183
|
}
|
|
3188
3184
|
if (setting) {
|
|
3189
|
-
(_c = __classPrivateFieldGet(this, _subscription$
|
|
3185
|
+
(_c = __classPrivateFieldGet(this, _subscription$2)) === null || _c === void 0 ? void 0 : _c.add(setting.observer.subscribe(columns => {
|
|
3190
3186
|
this.columns = columns;
|
|
3191
3187
|
}));
|
|
3192
3188
|
}
|
|
3193
3189
|
this.originColumns = this.gridOption.columns.filter(e => e.type !== 'children' && e.type !== 'children-col');
|
|
3194
3190
|
}
|
|
3195
3191
|
ngOnDestroy() {
|
|
3196
|
-
__classPrivateFieldGet(this, _subscription$
|
|
3192
|
+
__classPrivateFieldGet(this, _subscription$2).unsubscribe();
|
|
3197
3193
|
}
|
|
3198
3194
|
}
|
|
3199
|
-
_subscription$
|
|
3195
|
+
_subscription$2 = new WeakMap();
|
|
3200
3196
|
SdDynamicColumn.decorators = [
|
|
3201
3197
|
{ type: Component, args: [{
|
|
3202
3198
|
selector: 'sd-dynamic-column',
|