@sd-angular/core 1.3.92 → 1.3.94
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 +424 -362
- 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/sd-angular-core-grid-material.js +6 -6
- package/esm2015/grid-material/src/lib/components/grid-filter/grid-filter.component.js +67 -136
- package/esm2015/grid-material/src/lib/components/popup-filter/popup-filter.component.js +58 -23
- package/esm2015/grid-material/src/lib/grid-material.component.js +76 -65
- package/esm2015/grid-material/src/lib/grid-material.module.js +2 -2
- package/esm2015/grid-material/src/lib/models/grid-export.model.js +1 -1
- package/esm2015/grid-material/src/lib/models/grid-option.model.js +1 -1
- package/esm2015/grid-material/src/lib/pipes/filter-external.pipe.js +1 -1
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.model.js +3 -0
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.service.js +166 -0
- package/esm2015/grid-material/src/public-api.js +1 -1
- package/fesm2015/sd-angular-core-grid-material.js +381 -304
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.d.ts +5 -5
- 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 +5 -25
- package/grid-material/src/lib/components/popup-filter/popup-filter.component.d.ts +7 -31
- package/grid-material/src/lib/grid-material.component.d.ts +6 -6
- package/grid-material/src/lib/models/grid-export.model.d.ts +1 -1
- package/grid-material/src/lib/models/grid-option.model.d.ts +1 -1
- package/grid-material/src/lib/pipes/filter-external.pipe.d.ts +1 -1
- package/grid-material/src/lib/{models → services/grid-filter}/grid-filter.model.d.ts +14 -9
- package/grid-material/src/lib/services/grid-filter/grid-filter.service.d.ts +16 -0
- package/grid-material/src/public-api.d.ts +1 -1
- package/package.json +1 -1
- package/{sd-angular-core-1.3.92.tgz → sd-angular-core-1.3.94.tgz} +0 -0
- package/esm2015/grid-material/src/lib/models/grid-filter.model.js +0 -3
- package/esm2015/grid-material/src/lib/services/grid-filter.service.js +0 -65
- package/grid-material/src/lib/services/grid-filter.service.d.ts +0 -9
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { SdScrollDirective, SdCommonModule } from '@sd-angular/core/common';
|
|
2
|
-
import { Directive, TemplateRef, Input, InjectionToken,
|
|
3
|
-
import { __classPrivateFieldGet, __awaiter, __rest
|
|
2
|
+
import { Directive, TemplateRef, Input, InjectionToken, Component, ChangeDetectionStrategy, ChangeDetectorRef, ViewChild, EventEmitter, Output, Injectable, Inject, Optional, Pipe, NgZone, QueryList, ContentChild, ContentChildren, HostListener, NgModule } from '@angular/core';
|
|
3
|
+
import { __classPrivateFieldSet, __classPrivateFieldGet, __awaiter, __rest } from 'tslib';
|
|
4
4
|
import { MatPaginator, MatPaginatorIntl, MatPaginatorModule } from '@angular/material/paginator';
|
|
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 { Subject, BehaviorSubject,
|
|
8
|
+
import { Subscription, Subject, BehaviorSubject, isObservable } from 'rxjs';
|
|
9
9
|
import { SdNotifyService } from '@sd-angular/core/notify';
|
|
10
10
|
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
11
|
-
import {
|
|
12
|
-
import hash from 'object-hash';
|
|
13
|
-
import { SdSettingService } from '@sd-angular/core/setting';
|
|
11
|
+
import { debounceTime, map, switchMap, startWith } from 'rxjs/operators';
|
|
14
12
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
15
13
|
import { SdLoadingService } from '@sd-angular/core/loading';
|
|
16
14
|
import { SdTranslateService } from '@sd-angular/core/translate';
|
|
15
|
+
import hash from 'object-hash';
|
|
17
16
|
import { SdExportService } from '@sd-angular/core/export';
|
|
18
17
|
import { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
18
|
+
import { SdSettingService } from '@sd-angular/core/setting';
|
|
19
19
|
import { SdQuickAction } from '@sd-angular/core/quick-action';
|
|
20
20
|
import { CommonModule, DatePipe, DecimalPipe } from '@angular/common';
|
|
21
21
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
@@ -132,9 +132,11 @@ const DEFAULT_GRID_MATERIAL_CONFIG = {
|
|
|
132
132
|
};
|
|
133
133
|
const GRID_MATERIAL_CONFIG = new InjectionToken('sd-grid-material.configuration');
|
|
134
134
|
|
|
135
|
+
var _filterRegister, _subscription;
|
|
135
136
|
class SdPopupFilter {
|
|
136
137
|
constructor(cdRef) {
|
|
137
138
|
this.cdRef = cdRef;
|
|
139
|
+
_filterRegister.set(this, void 0);
|
|
138
140
|
this.externalFilters = [];
|
|
139
141
|
this.externalFilter = {};
|
|
140
142
|
this.inlineExternal = {};
|
|
@@ -144,16 +146,8 @@ class SdPopupFilter {
|
|
|
144
146
|
this.filterDefs = [];
|
|
145
147
|
this.filterDef = {};
|
|
146
148
|
this.inlineFilterDef = {};
|
|
147
|
-
this
|
|
148
|
-
this.
|
|
149
|
-
this.open = (args) => {
|
|
150
|
-
const { inlineColumn, columnFilter, inlineExternal, externalFilter, inlineFilterDef, filterDef } = args;
|
|
151
|
-
this.inlineColumn = JSON.parse(JSON.stringify(inlineColumn || {}));
|
|
152
|
-
this.columnFilter = JSON.parse(JSON.stringify(columnFilter || {}));
|
|
153
|
-
this.inlineExternal = JSON.parse(JSON.stringify(inlineExternal || {}));
|
|
154
|
-
this.externalFilter = JSON.parse(JSON.stringify(externalFilter || {}));
|
|
155
|
-
this.inlineFilterDef = JSON.parse(JSON.stringify(inlineFilterDef || {}));
|
|
156
|
-
this.filterDef = JSON.parse(JSON.stringify(filterDef || {}));
|
|
149
|
+
_subscription.set(this, new Subscription());
|
|
150
|
+
this.open = () => {
|
|
157
151
|
this.modal.open();
|
|
158
152
|
this.cdRef.markForCheck();
|
|
159
153
|
};
|
|
@@ -162,24 +156,64 @@ class SdPopupFilter {
|
|
|
162
156
|
this.cdRef.markForCheck();
|
|
163
157
|
};
|
|
164
158
|
this.onApply = () => {
|
|
165
|
-
this.
|
|
166
|
-
inlineColumn: this.inlineColumn
|
|
167
|
-
columnFilter: this.columnFilter
|
|
168
|
-
inlineExternal: this.inlineExternal
|
|
169
|
-
externalFilter: this.externalFilter
|
|
170
|
-
inlineFilterDef: this.inlineFilterDef
|
|
171
|
-
filterDef: this.filterDef
|
|
159
|
+
this.filterRegister.set({
|
|
160
|
+
inlineColumn: this.inlineColumn,
|
|
161
|
+
columnFilter: this.columnFilter,
|
|
162
|
+
inlineExternal: this.inlineExternal,
|
|
163
|
+
externalFilter: this.externalFilter,
|
|
164
|
+
inlineFilterDef: this.inlineFilterDef,
|
|
165
|
+
filterDef: this.filterDef
|
|
172
166
|
});
|
|
167
|
+
// this.changeFilter.emit({
|
|
168
|
+
// inlineColumn: this.inlineColumn || {},
|
|
169
|
+
// columnFilter: this.columnFilter || {},
|
|
170
|
+
// inlineExternal: this.inlineExternal || {},
|
|
171
|
+
// externalFilter: this.externalFilter || {},
|
|
172
|
+
// inlineFilterDef: this.inlineFilterDef || {},
|
|
173
|
+
// filterDef: this.filterDef || {}
|
|
174
|
+
// });
|
|
173
175
|
this.modal.close();
|
|
174
176
|
this.cdRef.markForCheck();
|
|
175
177
|
};
|
|
176
178
|
}
|
|
179
|
+
set filterRegister(value) {
|
|
180
|
+
__classPrivateFieldSet(this, _filterRegister, value);
|
|
181
|
+
}
|
|
182
|
+
;
|
|
183
|
+
ngAfterViewInit() {
|
|
184
|
+
// this.#subscription.add(this.#filterOptionChanges.pipe(startWith(this.filter)).subscribe(() => {
|
|
185
|
+
// if (this.filter?.disabled) {
|
|
186
|
+
// this.filterChange.next(true);
|
|
187
|
+
// return;
|
|
188
|
+
// }
|
|
189
|
+
// this.externalFilters = this.filter?.externalFilters || [];
|
|
190
|
+
// const configuration = this.gridFilterService.get(this.filter?.key);
|
|
191
|
+
// this.inlineColumn = configuration.inlineColumn;
|
|
192
|
+
// this.inlineExternal = configuration.inlineExternal;
|
|
193
|
+
// this.inlineFilterDef = configuration.inlineFilterDef;
|
|
194
|
+
// this.#loadDefault();
|
|
195
|
+
// this.filterChange.next(true);
|
|
196
|
+
// this.ref.markForCheck();
|
|
197
|
+
// }));
|
|
198
|
+
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterRegister).observer.subscribe(configuration => {
|
|
199
|
+
this.inlineColumn = JSON.parse(JSON.stringify(configuration.inlineColumn));
|
|
200
|
+
this.columnFilter = JSON.parse(JSON.stringify(configuration.columnFilter));
|
|
201
|
+
this.inlineExternal = JSON.parse(JSON.stringify(configuration.inlineExternal));
|
|
202
|
+
this.externalFilter = JSON.parse(JSON.stringify(configuration.externalFilter));
|
|
203
|
+
this.inlineFilterDef = JSON.parse(JSON.stringify(configuration.inlineFilterDef));
|
|
204
|
+
this.filterDef = JSON.parse(JSON.stringify(configuration.filterDef));
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
ngOnDestroy() {
|
|
208
|
+
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
209
|
+
}
|
|
177
210
|
onClear() {
|
|
178
|
-
this.
|
|
211
|
+
this.filterRegister.remove();
|
|
179
212
|
this.modal.close();
|
|
180
213
|
this.cdRef.markForCheck();
|
|
181
214
|
}
|
|
182
215
|
}
|
|
216
|
+
_filterRegister = new WeakMap(), _subscription = new WeakMap();
|
|
183
217
|
SdPopupFilter.decorators = [
|
|
184
218
|
{ type: Component, args: [{
|
|
185
219
|
selector: 'sd-popup-filter',
|
|
@@ -193,84 +227,21 @@ SdPopupFilter.ctorParameters = () => [
|
|
|
193
227
|
];
|
|
194
228
|
SdPopupFilter.propDecorators = {
|
|
195
229
|
modal: [{ type: ViewChild, args: ['modal',] }],
|
|
230
|
+
filterRegister: [{ type: Input }],
|
|
196
231
|
externalFilters: [{ type: Input }],
|
|
197
232
|
columns: [{ type: Input }],
|
|
198
|
-
filterDefs: [{ type: Input }]
|
|
199
|
-
changeFilter: [{ type: Output }],
|
|
200
|
-
clearFilter: [{ type: Output }]
|
|
233
|
+
filterDefs: [{ type: Input }]
|
|
201
234
|
};
|
|
202
235
|
|
|
203
|
-
var
|
|
204
|
-
class SdGridFilterService {
|
|
205
|
-
constructor(settingService) {
|
|
206
|
-
this.settingService = settingService;
|
|
207
|
-
_prefix.set(this, '61d22e8e-eee8-4aad-8e1c-044a532fea91');
|
|
208
|
-
this.get = (key) => {
|
|
209
|
-
var _a;
|
|
210
|
-
if (!key) {
|
|
211
|
-
return {
|
|
212
|
-
selectedQuickFilter: null,
|
|
213
|
-
quickFilters: [],
|
|
214
|
-
inlineExternal: {},
|
|
215
|
-
inlineColumn: {},
|
|
216
|
-
inlineFilterDef: {}
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
const { get } = this.settingService.create({
|
|
220
|
-
prefix: __classPrivateFieldGet(this, _prefix),
|
|
221
|
-
key
|
|
222
|
-
});
|
|
223
|
-
const configuration = get();
|
|
224
|
-
return {
|
|
225
|
-
selectedQuickFilter: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) !== null && _a !== void 0 ? _a : null,
|
|
226
|
-
quickFilters: (configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || [],
|
|
227
|
-
inlineExternal: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {},
|
|
228
|
-
inlineColumn: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) || {},
|
|
229
|
-
inlineFilterDef: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {},
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
this.set = (key, configuration) => {
|
|
233
|
-
configuration = {
|
|
234
|
-
selectedQuickFilter: (configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) || null,
|
|
235
|
-
quickFilters: (configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || [],
|
|
236
|
-
inlineExternal: configuration.inlineExternal || {},
|
|
237
|
-
inlineColumn: configuration.inlineColumn || {},
|
|
238
|
-
inlineFilterDef: configuration.inlineFilterDef || {}
|
|
239
|
-
};
|
|
240
|
-
if (!key) {
|
|
241
|
-
return configuration;
|
|
242
|
-
}
|
|
243
|
-
const { set } = this.settingService.create({
|
|
244
|
-
prefix: __classPrivateFieldGet(this, _prefix),
|
|
245
|
-
key
|
|
246
|
-
});
|
|
247
|
-
key = hash({
|
|
248
|
-
prefix: __classPrivateFieldGet(this, _prefix),
|
|
249
|
-
key
|
|
250
|
-
});
|
|
251
|
-
set(configuration);
|
|
252
|
-
return configuration;
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
_prefix = new WeakMap();
|
|
257
|
-
SdGridFilterService.decorators = [
|
|
258
|
-
{ type: Injectable }
|
|
259
|
-
];
|
|
260
|
-
SdGridFilterService.ctorParameters = () => [
|
|
261
|
-
{ type: SdSettingService }
|
|
262
|
-
];
|
|
263
|
-
|
|
264
|
-
var _filterOptionChanges, _subscription, _loadDefault, _clearFilter;
|
|
236
|
+
var _filterOptionChanges, _subscription$1;
|
|
265
237
|
class SdGridFilter {
|
|
266
|
-
constructor(ref, deviceService
|
|
238
|
+
constructor(ref, deviceService) {
|
|
267
239
|
this.ref = ref;
|
|
268
240
|
this.deviceService = deviceService;
|
|
269
|
-
this.gridFilterService = gridFilterService;
|
|
270
241
|
_filterOptionChanges.set(this, new Subject());
|
|
271
242
|
this.columns = [];
|
|
272
243
|
this.filterDefs = [];
|
|
273
|
-
this.
|
|
244
|
+
this.filterRegisterChange = new BehaviorSubject(null);
|
|
274
245
|
this.filterDef = {};
|
|
275
246
|
this.inlineFilterDef = {};
|
|
276
247
|
this.columnFilter = {};
|
|
@@ -278,125 +249,20 @@ class SdGridFilter {
|
|
|
278
249
|
this.externalFilters = [];
|
|
279
250
|
this.externalFilter = {};
|
|
280
251
|
this.inlineExternal = {};
|
|
281
|
-
_subscription.set(this, new Subscription());
|
|
282
|
-
_loadDefault.set(this, () => {
|
|
283
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
284
|
-
for (const column of this.columns) {
|
|
285
|
-
this.inlineColumn[column.field] = (_a = this.inlineColumn[column.field]) !== null && _a !== void 0 ? _a : (_b = column === null || column === void 0 ? void 0 : column.filter) === null || _b === void 0 ? void 0 : _b.defaultShowing;
|
|
286
|
-
this.columnFilter[column.field] = (_c = this.columnFilter[column.field]) !== null && _c !== void 0 ? _c : (_d = column === null || column === void 0 ? void 0 : column.filter) === null || _d === void 0 ? void 0 : _d.default;
|
|
287
|
-
}
|
|
288
|
-
for (const externalFilter of this.externalFilters) {
|
|
289
|
-
this.inlineExternal[externalFilter.field] = (_e = this.inlineExternal[externalFilter.field]) !== null && _e !== void 0 ? _e : externalFilter === null || externalFilter === void 0 ? void 0 : externalFilter.defaultShowing;
|
|
290
|
-
if (externalFilter.type === 'daterange') {
|
|
291
|
-
this.externalFilter[externalFilter.field] = {
|
|
292
|
-
from: (_j = (_g = (_f = this.externalFilter[externalFilter.field]) === null || _f === void 0 ? void 0 : _f.from) !== null && _g !== void 0 ? _g : (_h = externalFilter.default) === null || _h === void 0 ? void 0 : _h.from) !== null && _j !== void 0 ? _j : undefined,
|
|
293
|
-
to: (_o = (_l = (_k = this.externalFilter[externalFilter.field]) === null || _k === void 0 ? void 0 : _k.to) !== null && _l !== void 0 ? _l : (_m = externalFilter.default) === null || _m === void 0 ? void 0 : _m.to) !== null && _o !== void 0 ? _o : undefined
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
this.externalFilter[externalFilter.field] = (_p = this.externalFilter[externalFilter.field]) !== null && _p !== void 0 ? _p : externalFilter.default;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
for (const filterDef of this.filterDefs) {
|
|
301
|
-
this.inlineFilterDef[filterDef.sdMaterialFilterDef] = (_q = this.inlineFilterDef[filterDef.sdMaterialFilterDef]) !== null && _q !== void 0 ? _q : filterDef === null || filterDef === void 0 ? void 0 : filterDef.defaultShowing;
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
_clearFilter.set(this, () => {
|
|
305
|
-
this.columnFilter = {};
|
|
306
|
-
this.externalFilter = {};
|
|
307
|
-
this.filterDef = {};
|
|
308
|
-
for (const externalFilter of this.externalFilters) {
|
|
309
|
-
if (externalFilter.type === 'daterange') {
|
|
310
|
-
this.externalFilter[externalFilter.field] = {
|
|
311
|
-
from: undefined,
|
|
312
|
-
to: undefined
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
this.ref.markForCheck();
|
|
317
|
-
});
|
|
252
|
+
_subscription$1.set(this, new Subscription());
|
|
318
253
|
this.onFilter = (item) => {
|
|
319
|
-
this.
|
|
320
|
-
};
|
|
321
|
-
this.open = () => {
|
|
322
|
-
this.popupFilter.open({
|
|
254
|
+
this.filterRegister.set({
|
|
323
255
|
columnFilter: this.columnFilter,
|
|
324
256
|
externalFilter: this.externalFilter,
|
|
325
|
-
filterDef: this.filterDef
|
|
326
|
-
inlineColumn: this.inlineColumn,
|
|
327
|
-
inlineExternal: this.inlineExternal,
|
|
328
|
-
inlineFilterDef: this.inlineFilterDef
|
|
257
|
+
filterDef: this.filterDef
|
|
329
258
|
});
|
|
259
|
+
// this.filterChange.next(true);
|
|
330
260
|
};
|
|
331
|
-
this.
|
|
332
|
-
|
|
333
|
-
const { inlineColumn, columnFilter, inlineExternal, externalFilter, inlineFilterDef, filterDef } = args;
|
|
334
|
-
this.inlineColumn = inlineColumn;
|
|
335
|
-
this.columnFilter = columnFilter;
|
|
336
|
-
this.inlineExternal = inlineExternal;
|
|
337
|
-
this.externalFilter = externalFilter;
|
|
338
|
-
this.inlineFilterDef = inlineFilterDef;
|
|
339
|
-
this.filterDef = filterDef;
|
|
340
|
-
this.gridFilterService.set((_a = this.filter) === null || _a === void 0 ? void 0 : _a.key, {
|
|
341
|
-
inlineColumn,
|
|
342
|
-
inlineExternal,
|
|
343
|
-
quickFilters: [],
|
|
344
|
-
inlineFilterDef,
|
|
345
|
-
selectedQuickFilter: null
|
|
346
|
-
});
|
|
347
|
-
this.filterChange.next(true);
|
|
261
|
+
this.open = () => {
|
|
262
|
+
this.popupFilter.open();
|
|
348
263
|
};
|
|
349
264
|
this.onReset = () => {
|
|
350
|
-
|
|
351
|
-
this.inlineColumn = {};
|
|
352
|
-
this.columnFilter = {};
|
|
353
|
-
this.inlineExternal = {};
|
|
354
|
-
this.externalFilter = {};
|
|
355
|
-
this.inlineFilterDef = {};
|
|
356
|
-
this.filterDef = {};
|
|
357
|
-
__classPrivateFieldGet(this, _loadDefault).call(this);
|
|
358
|
-
this.gridFilterService.set((_a = this.filter) === null || _a === void 0 ? void 0 : _a.key, {
|
|
359
|
-
inlineColumn: this.inlineColumn,
|
|
360
|
-
inlineExternal: this.columnFilter,
|
|
361
|
-
inlineFilterDef: this.inlineFilterDef,
|
|
362
|
-
quickFilters: [],
|
|
363
|
-
selectedQuickFilter: null
|
|
364
|
-
});
|
|
365
|
-
this.filterChange.next(true);
|
|
366
|
-
this.ref.markForCheck();
|
|
367
|
-
};
|
|
368
|
-
this.onClearFilter = () => {
|
|
369
|
-
var _a;
|
|
370
|
-
__classPrivateFieldGet(this, _clearFilter).call(this);
|
|
371
|
-
this.gridFilterService.set((_a = this.filter) === null || _a === void 0 ? void 0 : _a.key, {
|
|
372
|
-
inlineColumn: this.inlineColumn,
|
|
373
|
-
inlineExternal: this.columnFilter,
|
|
374
|
-
inlineFilterDef: this.inlineFilterDef,
|
|
375
|
-
quickFilters: [],
|
|
376
|
-
selectedQuickFilter: null
|
|
377
|
-
});
|
|
378
|
-
this.filterChange.next(true);
|
|
379
|
-
};
|
|
380
|
-
this.setFilter = (args) => {
|
|
381
|
-
var _a, _b, _c, _d;
|
|
382
|
-
const { columnFilter, externalFilter, filterDef } = args;
|
|
383
|
-
if (columnFilter) {
|
|
384
|
-
this.columnFilter = columnFilter;
|
|
385
|
-
}
|
|
386
|
-
if (externalFilter) {
|
|
387
|
-
this.externalFilter = externalFilter;
|
|
388
|
-
}
|
|
389
|
-
if (filterDef) {
|
|
390
|
-
this.filterDef = filterDef;
|
|
391
|
-
}
|
|
392
|
-
for (const exFilter of this.externalFilters) {
|
|
393
|
-
if (exFilter.type === 'daterange') {
|
|
394
|
-
this.externalFilter[exFilter.field] = {
|
|
395
|
-
from: (_b = (_a = this.externalFilter[exFilter.field]) === null || _a === void 0 ? void 0 : _a.from) !== null && _b !== void 0 ? _b : undefined,
|
|
396
|
-
to: (_d = (_c = this.externalFilter[exFilter.field]) === null || _c === void 0 ? void 0 : _c.to) !== null && _d !== void 0 ? _d : undefined
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
}
|
|
265
|
+
this.filterRegister.remove();
|
|
400
266
|
this.ref.markForCheck();
|
|
401
267
|
};
|
|
402
268
|
this.isMobileOrTablet = !this.deviceService.isDesktop();
|
|
@@ -406,46 +272,85 @@ class SdGridFilter {
|
|
|
406
272
|
this.filter = filter;
|
|
407
273
|
__classPrivateFieldGet(this, _filterOptionChanges).next(this.filter);
|
|
408
274
|
}
|
|
275
|
+
set _filterRegister(value) {
|
|
276
|
+
this.filterRegister = value;
|
|
277
|
+
this.filterRegisterChange.next(this.filterRegister);
|
|
278
|
+
}
|
|
279
|
+
;
|
|
409
280
|
ngAfterViewInit() {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
281
|
+
// this.#subscription.add(this.#filterOptionChanges.pipe(startWith(this.filter)).subscribe(() => {
|
|
282
|
+
// if (this.filter?.disabled) {
|
|
283
|
+
// this.filterChange.next(true);
|
|
284
|
+
// return;
|
|
285
|
+
// }
|
|
286
|
+
// this.externalFilters = this.filter?.externalFilters || [];
|
|
287
|
+
// const configuration = this.gridFilterService.get(this.filter?.key);
|
|
288
|
+
// this.inlineColumn = configuration.inlineColumn;
|
|
289
|
+
// this.inlineExternal = configuration.inlineExternal;
|
|
290
|
+
// this.inlineFilterDef = configuration.inlineFilterDef;
|
|
291
|
+
// this.#loadDefault();
|
|
292
|
+
// this.filterChange.next(true);
|
|
293
|
+
// this.ref.markForCheck();
|
|
294
|
+
// }));
|
|
295
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegisterChange.subscribe(() => {
|
|
296
|
+
if (this.filterRegister) {
|
|
297
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.observer.subscribe(configuration => {
|
|
298
|
+
this.inlineColumn = configuration.inlineColumn;
|
|
299
|
+
this.columnFilter = configuration.columnFilter;
|
|
300
|
+
this.inlineExternal = configuration.inlineExternal;
|
|
301
|
+
this.externalFilter = configuration.externalFilter;
|
|
302
|
+
this.inlineFilterDef = configuration.inlineFilterDef;
|
|
303
|
+
this.filterDef = configuration.filterDef;
|
|
304
|
+
}));
|
|
305
|
+
this.ref.markForCheck();
|
|
306
|
+
}
|
|
307
|
+
;
|
|
424
308
|
}));
|
|
425
309
|
}
|
|
310
|
+
// #loadDefault = () => {
|
|
311
|
+
// for (const column of this.columns) {
|
|
312
|
+
// this.inlineColumn[column.field] = this.inlineColumn[column.field] ?? column?.filter?.defaultShowing;
|
|
313
|
+
// this.columnFilter[column.field] = this.columnFilter[column.field] ?? column?.filter?.default;
|
|
314
|
+
// }
|
|
315
|
+
// for (const externalFilter of this.externalFilters) {
|
|
316
|
+
// this.inlineExternal[externalFilter.field] = this.inlineExternal[externalFilter.field] ?? externalFilter?.defaultShowing;
|
|
317
|
+
// if (externalFilter.type === 'daterange') {
|
|
318
|
+
// this.externalFilter[externalFilter.field] = {
|
|
319
|
+
// from: this.externalFilter[externalFilter.field]?.from ?? externalFilter.default?.from ?? undefined,
|
|
320
|
+
// to: this.externalFilter[externalFilter.field]?.to ?? externalFilter.default?.to ?? undefined
|
|
321
|
+
// };
|
|
322
|
+
// } else {
|
|
323
|
+
// this.externalFilter[externalFilter.field] = this.externalFilter[externalFilter.field] ?? externalFilter.default;
|
|
324
|
+
// }
|
|
325
|
+
// }
|
|
326
|
+
// for (const filterDef of this.filterDefs) {
|
|
327
|
+
// this.inlineFilterDef[filterDef.sdMaterialFilterDef] =
|
|
328
|
+
// this.inlineFilterDef[filterDef.sdMaterialFilterDef] ?? filterDef?.defaultShowing;
|
|
329
|
+
// }
|
|
330
|
+
// }
|
|
426
331
|
ngOnDestroy() {
|
|
427
|
-
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
332
|
+
__classPrivateFieldGet(this, _subscription$1).unsubscribe();
|
|
428
333
|
}
|
|
429
334
|
}
|
|
430
|
-
_filterOptionChanges = new WeakMap(), _subscription = new WeakMap()
|
|
335
|
+
_filterOptionChanges = new WeakMap(), _subscription$1 = new WeakMap();
|
|
431
336
|
SdGridFilter.decorators = [
|
|
432
337
|
{ type: Component, args: [{
|
|
433
338
|
selector: 'sd-grid-filter',
|
|
434
|
-
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 pb-10\">\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 [
|
|
339
|
+
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 pb-10\">\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>",
|
|
435
340
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
436
341
|
styles: [":host{display:block;padding-left:0;padding-right:0}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}"]
|
|
437
342
|
},] }
|
|
438
343
|
];
|
|
439
344
|
SdGridFilter.ctorParameters = () => [
|
|
440
345
|
{ type: ChangeDetectorRef },
|
|
441
|
-
{ type: DeviceDetectorService }
|
|
442
|
-
{ type: SdGridFilterService }
|
|
346
|
+
{ type: DeviceDetectorService }
|
|
443
347
|
];
|
|
444
348
|
SdGridFilter.propDecorators = {
|
|
445
349
|
popupFilter: [{ type: ViewChild, args: [SdPopupFilter,] }],
|
|
446
350
|
_filter: [{ type: Input, args: ['filter',] }],
|
|
447
351
|
columns: [{ type: Input }],
|
|
448
|
-
filterDefs: [{ type: Input }]
|
|
352
|
+
filterDefs: [{ type: Input }],
|
|
353
|
+
_filterRegister: [{ type: Input, args: ['filterRegister',] }]
|
|
449
354
|
};
|
|
450
355
|
|
|
451
356
|
var _getExportableColumns, _getExportableGroups, _getExportColumns, _initTemplate;
|
|
@@ -1161,10 +1066,10 @@ SdGridConfigurationService.ctorParameters = () => [
|
|
|
1161
1066
|
{ type: undefined, decorators: [{ type: Inject, args: [GRID_MATERIAL_CONFIG,] }, { type: Optional }] }
|
|
1162
1067
|
];
|
|
1163
1068
|
|
|
1164
|
-
var _prefix
|
|
1069
|
+
var _prefix, _cache$1;
|
|
1165
1070
|
class SdColumnValuesPipe {
|
|
1166
1071
|
constructor() {
|
|
1167
|
-
_prefix
|
|
1072
|
+
_prefix.set(this, 'a1e67660-8aa2-4c11-b02d-71a32188719f');
|
|
1168
1073
|
_cache$1.set(this, {});
|
|
1169
1074
|
this.transform = (value, column) => __awaiter(this, void 0, void 0, function* () {
|
|
1170
1075
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -1173,7 +1078,7 @@ class SdColumnValuesPipe {
|
|
|
1173
1078
|
}
|
|
1174
1079
|
const _l = column.option, { items, valueField, displayField, selection } = _l, remain = __rest(_l, ["items", "valueField", "displayField", "selection"]);
|
|
1175
1080
|
const key = hash({
|
|
1176
|
-
prefix: __classPrivateFieldGet(this, _prefix
|
|
1081
|
+
prefix: __classPrivateFieldGet(this, _prefix),
|
|
1177
1082
|
valueField,
|
|
1178
1083
|
displayField,
|
|
1179
1084
|
selection,
|
|
@@ -1214,7 +1119,7 @@ class SdColumnValuesPipe {
|
|
|
1214
1119
|
});
|
|
1215
1120
|
}
|
|
1216
1121
|
}
|
|
1217
|
-
_prefix
|
|
1122
|
+
_prefix = new WeakMap(), _cache$1 = new WeakMap();
|
|
1218
1123
|
SdColumnValuesPipe.decorators = [
|
|
1219
1124
|
{ type: Pipe, args: [{
|
|
1220
1125
|
name: 'columnValues'
|
|
@@ -1279,16 +1184,177 @@ SdEditorHandlerColumnPipe.ctorParameters = () => [
|
|
|
1279
1184
|
{ type: NgZone }
|
|
1280
1185
|
];
|
|
1281
1186
|
|
|
1282
|
-
var
|
|
1187
|
+
var _prefix$1, _loadDefault;
|
|
1188
|
+
class SdGridFilterService {
|
|
1189
|
+
constructor(settingService) {
|
|
1190
|
+
this.settingService = settingService;
|
|
1191
|
+
_prefix$1.set(this, '61d22e8e-eee8-4aad-8e1c-044a532fea91');
|
|
1192
|
+
this.register = (key, args) => {
|
|
1193
|
+
let cacheSession = false;
|
|
1194
|
+
if (!key) {
|
|
1195
|
+
key = v4();
|
|
1196
|
+
cacheSession = true; // Nếu không có key thì chỉ lưu theo session
|
|
1197
|
+
}
|
|
1198
|
+
const { get, set, remove, subject, observer } = this.settingService.create({
|
|
1199
|
+
prefix: __classPrivateFieldGet(this, _prefix$1),
|
|
1200
|
+
key
|
|
1201
|
+
}, {
|
|
1202
|
+
default: __classPrivateFieldGet(this, _loadDefault).call(this, args),
|
|
1203
|
+
type: cacheSession ? 'session' : undefined
|
|
1204
|
+
});
|
|
1205
|
+
return {
|
|
1206
|
+
get: () => {
|
|
1207
|
+
var _a;
|
|
1208
|
+
const configuration = get();
|
|
1209
|
+
return {
|
|
1210
|
+
selectedQuickFilter: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) !== null && _a !== void 0 ? _a : null,
|
|
1211
|
+
quickFilters: (configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || [],
|
|
1212
|
+
// Filter column
|
|
1213
|
+
inlineColumn: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) || {},
|
|
1214
|
+
columnFilter: (configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {},
|
|
1215
|
+
// Filter external
|
|
1216
|
+
inlineExternal: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {},
|
|
1217
|
+
externalFilter: (configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {},
|
|
1218
|
+
// Filter def
|
|
1219
|
+
inlineFilterDef: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {},
|
|
1220
|
+
filterDef: (configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}
|
|
1221
|
+
};
|
|
1222
|
+
},
|
|
1223
|
+
set: (configuration) => {
|
|
1224
|
+
const keys = Object.keys(configuration || {});
|
|
1225
|
+
const current = get();
|
|
1226
|
+
const { selectedQuickFilter, quickFilters, inlineColumn, columnFilter, inlineExternal, externalFilter, inlineFilterDef, filterDef } = current;
|
|
1227
|
+
const updatedConfiguration = {
|
|
1228
|
+
selectedQuickFilter: keys.includes('selectedQuickFilter') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) || null) : selectedQuickFilter,
|
|
1229
|
+
quickFilters: keys.includes('quickFilters') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || []) : quickFilters,
|
|
1230
|
+
// Filter column
|
|
1231
|
+
inlineColumn: keys.includes('inlineColumn') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) || {}) : inlineColumn,
|
|
1232
|
+
columnFilter: keys.includes('columnFilter') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {}) : columnFilter,
|
|
1233
|
+
// Filter external
|
|
1234
|
+
inlineExternal: keys.includes('inlineExternal') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {}) : inlineExternal,
|
|
1235
|
+
externalFilter: keys.includes('externalFilter') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {}) : externalFilter,
|
|
1236
|
+
// Filter def
|
|
1237
|
+
inlineFilterDef: keys.includes('inlineFilterDef') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {}) : inlineFilterDef,
|
|
1238
|
+
filterDef: keys.includes('filterDef') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}) : filterDef,
|
|
1239
|
+
};
|
|
1240
|
+
set(updatedConfiguration);
|
|
1241
|
+
return updatedConfiguration;
|
|
1242
|
+
},
|
|
1243
|
+
remove: () => {
|
|
1244
|
+
remove();
|
|
1245
|
+
},
|
|
1246
|
+
subject,
|
|
1247
|
+
observer
|
|
1248
|
+
};
|
|
1249
|
+
};
|
|
1250
|
+
_loadDefault.set(this, (args) => {
|
|
1251
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1252
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1253
|
+
const inlineColumn = {};
|
|
1254
|
+
const columnFilter = {};
|
|
1255
|
+
const inlineExternal = {};
|
|
1256
|
+
const externalFilter = {};
|
|
1257
|
+
const inlineFilterDef = {};
|
|
1258
|
+
const filterDef = {};
|
|
1259
|
+
// Filter column
|
|
1260
|
+
for (const item of (columns || [])) {
|
|
1261
|
+
inlineColumn[item.field] = (_a = inlineColumn[item.field]) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.filter) === null || _b === void 0 ? void 0 : _b.defaultShowing;
|
|
1262
|
+
columnFilter[item.field] = (_c = columnFilter[item.field]) !== null && _c !== void 0 ? _c : (_d = item === null || item === void 0 ? void 0 : item.filter) === null || _d === void 0 ? void 0 : _d.default;
|
|
1263
|
+
}
|
|
1264
|
+
// Filter external
|
|
1265
|
+
for (const item of (externalFilters || [])) {
|
|
1266
|
+
inlineExternal[item.field] = (_e = inlineExternal[item.field]) !== null && _e !== void 0 ? _e : item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1267
|
+
if (item.type === 'daterange') {
|
|
1268
|
+
externalFilter[item.field] = {
|
|
1269
|
+
from: (_j = (_g = (_f = externalFilter[item.field]) === null || _f === void 0 ? void 0 : _f.from) !== null && _g !== void 0 ? _g : (_h = item.default) === null || _h === void 0 ? void 0 : _h.from) !== null && _j !== void 0 ? _j : undefined,
|
|
1270
|
+
to: (_o = (_l = (_k = externalFilter[item.field]) === null || _k === void 0 ? void 0 : _k.to) !== null && _l !== void 0 ? _l : (_m = item.default) === null || _m === void 0 ? void 0 : _m.to) !== null && _o !== void 0 ? _o : undefined
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
else {
|
|
1274
|
+
externalFilter[item.field] = (_p = externalFilter[item.field]) !== null && _p !== void 0 ? _p : item.default;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
// Filter def
|
|
1278
|
+
for (const item of (filterDefs || [])) {
|
|
1279
|
+
inlineFilterDef[item.sdMaterialFilterDef] = (_q = inlineFilterDef[item.sdMaterialFilterDef]) !== null && _q !== void 0 ? _q : item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1280
|
+
}
|
|
1281
|
+
return {
|
|
1282
|
+
quickFilters: [],
|
|
1283
|
+
selectedQuickFilter: null,
|
|
1284
|
+
inlineColumn,
|
|
1285
|
+
columnFilter,
|
|
1286
|
+
inlineExternal,
|
|
1287
|
+
externalFilter,
|
|
1288
|
+
inlineFilterDef,
|
|
1289
|
+
filterDef,
|
|
1290
|
+
};
|
|
1291
|
+
});
|
|
1292
|
+
this.get = (key) => {
|
|
1293
|
+
var _a;
|
|
1294
|
+
if (!key) {
|
|
1295
|
+
return {
|
|
1296
|
+
selectedQuickFilter: null,
|
|
1297
|
+
quickFilters: [],
|
|
1298
|
+
inlineExternal: {},
|
|
1299
|
+
inlineColumn: {},
|
|
1300
|
+
inlineFilterDef: {}
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
const { get } = this.settingService.create({
|
|
1304
|
+
prefix: __classPrivateFieldGet(this, _prefix$1),
|
|
1305
|
+
key
|
|
1306
|
+
});
|
|
1307
|
+
const configuration = get();
|
|
1308
|
+
return {
|
|
1309
|
+
selectedQuickFilter: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) !== null && _a !== void 0 ? _a : null,
|
|
1310
|
+
quickFilters: (configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || [],
|
|
1311
|
+
inlineExternal: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {},
|
|
1312
|
+
inlineColumn: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) || {},
|
|
1313
|
+
inlineFilterDef: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {},
|
|
1314
|
+
};
|
|
1315
|
+
};
|
|
1316
|
+
this.set = (key, configuration) => {
|
|
1317
|
+
configuration = {
|
|
1318
|
+
selectedQuickFilter: (configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) || null,
|
|
1319
|
+
quickFilters: (configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || [],
|
|
1320
|
+
inlineExternal: configuration.inlineExternal || {},
|
|
1321
|
+
inlineColumn: configuration.inlineColumn || {},
|
|
1322
|
+
inlineFilterDef: configuration.inlineFilterDef || {}
|
|
1323
|
+
};
|
|
1324
|
+
if (!key) {
|
|
1325
|
+
return configuration;
|
|
1326
|
+
}
|
|
1327
|
+
const { set } = this.settingService.create({
|
|
1328
|
+
prefix: __classPrivateFieldGet(this, _prefix$1),
|
|
1329
|
+
key
|
|
1330
|
+
});
|
|
1331
|
+
key = hash({
|
|
1332
|
+
prefix: __classPrivateFieldGet(this, _prefix$1),
|
|
1333
|
+
key
|
|
1334
|
+
});
|
|
1335
|
+
set(configuration);
|
|
1336
|
+
return configuration;
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
_prefix$1 = new WeakMap(), _loadDefault = new WeakMap();
|
|
1341
|
+
SdGridFilterService.decorators = [
|
|
1342
|
+
{ type: Injectable }
|
|
1343
|
+
];
|
|
1344
|
+
SdGridFilterService.ctorParameters = () => [
|
|
1345
|
+
{ type: SdSettingService }
|
|
1346
|
+
];
|
|
1347
|
+
|
|
1348
|
+
var _localItems, _paginator, _sort, _subscription$2, _reload, _loadCompleted, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _loadFilterRegister, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
1283
1349
|
class SdGridMaterial {
|
|
1284
|
-
constructor(ref, configuration, gridConfigurationService, exportService, notifyService,
|
|
1350
|
+
constructor(ref, configuration, gridConfigurationService, exportService, notifyService, columnValuesPipe, gridFilterService, editorHandlerColumnPipe) {
|
|
1285
1351
|
this.ref = ref;
|
|
1286
1352
|
this.configuration = configuration;
|
|
1287
1353
|
this.gridConfigurationService = gridConfigurationService;
|
|
1288
1354
|
this.exportService = exportService;
|
|
1289
1355
|
this.notifyService = notifyService;
|
|
1290
|
-
this.translateService = translateService;
|
|
1291
1356
|
this.columnValuesPipe = columnValuesPipe;
|
|
1357
|
+
this.gridFilterService = gridFilterService;
|
|
1292
1358
|
this.editorHandlerColumnPipe = editorHandlerColumnPipe;
|
|
1293
1359
|
this.key = v4();
|
|
1294
1360
|
_localItems.set(this, []);
|
|
@@ -1314,7 +1380,7 @@ class SdGridMaterial {
|
|
|
1314
1380
|
// Filter
|
|
1315
1381
|
this.columnFilter = {};
|
|
1316
1382
|
// Subcription
|
|
1317
|
-
_subscription$
|
|
1383
|
+
_subscription$2.set(this, new Subscription());
|
|
1318
1384
|
_reload.set(this, new BehaviorSubject({
|
|
1319
1385
|
force: true
|
|
1320
1386
|
}));
|
|
@@ -1335,6 +1401,7 @@ class SdGridMaterial {
|
|
|
1335
1401
|
for (const filterDef of this.sdFilterDefs) {
|
|
1336
1402
|
this.filterDefs.push(filterDef);
|
|
1337
1403
|
}
|
|
1404
|
+
__classPrivateFieldGet(this, _loadFilterRegister).call(this);
|
|
1338
1405
|
});
|
|
1339
1406
|
_initFooterDef.set(this, () => {
|
|
1340
1407
|
this.footerDef = {};
|
|
@@ -1347,13 +1414,14 @@ class SdGridMaterial {
|
|
|
1347
1414
|
}
|
|
1348
1415
|
});
|
|
1349
1416
|
_filterExportInfo.set(this, (pageNumber, pageSize) => {
|
|
1350
|
-
var _a, _b
|
|
1417
|
+
var _a, _b;
|
|
1418
|
+
const { columnFilter, externalFilter, filterDef } = this.filterRegister.get();
|
|
1351
1419
|
return {
|
|
1352
|
-
rawColumnFilter:
|
|
1353
|
-
rawExternalFilter:
|
|
1354
|
-
rawFilterDef:
|
|
1355
|
-
orderBy: ((
|
|
1356
|
-
orderDirection: ((
|
|
1420
|
+
rawColumnFilter: columnFilter || {},
|
|
1421
|
+
rawExternalFilter: externalFilter || {},
|
|
1422
|
+
rawFilterDef: filterDef || {},
|
|
1423
|
+
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
1424
|
+
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1357
1425
|
pageNumber,
|
|
1358
1426
|
pageSize,
|
|
1359
1427
|
isExported: true
|
|
@@ -1361,6 +1429,7 @@ class SdGridMaterial {
|
|
|
1361
1429
|
});
|
|
1362
1430
|
_initConfiguration.set(this, (option) => {
|
|
1363
1431
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1432
|
+
// Init pagination
|
|
1364
1433
|
option.paginate = {
|
|
1365
1434
|
hidden: (_a = option === null || option === void 0 ? void 0 : option.paginate) === null || _a === void 0 ? void 0 : _a.hidden,
|
|
1366
1435
|
pageSize: (_f = (_c = (_b = option === null || option === void 0 ? void 0 : option.paginate) === null || _b === void 0 ? void 0 : _b.pageSize) !== null && _c !== void 0 ? _c : (_e = (_d = this.configuration) === null || _d === void 0 ? void 0 : _d.paginate) === null || _e === void 0 ? void 0 : _e.pageSize) !== null && _f !== void 0 ? _f : (_g = DEFAULT_GRID_MATERIAL_CONFIG.paginate) === null || _g === void 0 ? void 0 : _g.pageSize,
|
|
@@ -1369,6 +1438,22 @@ class SdGridMaterial {
|
|
|
1369
1438
|
};
|
|
1370
1439
|
return option;
|
|
1371
1440
|
});
|
|
1441
|
+
_loadFilterRegister.set(this, () => {
|
|
1442
|
+
var _a, _b, _c, _d, _e;
|
|
1443
|
+
// Init filter
|
|
1444
|
+
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, {
|
|
1445
|
+
columns: (_c = this.gridOption) === null || _c === void 0 ? void 0 : _c.columns,
|
|
1446
|
+
externalFilters: (_e = (_d = this.gridOption) === null || _d === void 0 ? void 0 : _d.filter) === null || _e === void 0 ? void 0 : _e.externalFilters,
|
|
1447
|
+
filterDefs: this.filterDefs
|
|
1448
|
+
});
|
|
1449
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.filterRegister.observer.pipe(debounceTime(500), map((configuration) => {
|
|
1450
|
+
this.columnFilter = configuration.columnFilter;
|
|
1451
|
+
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1452
|
+
__classPrivateFieldGet(this, _reload).next({
|
|
1453
|
+
force: false,
|
|
1454
|
+
});
|
|
1455
|
+
})).subscribe());
|
|
1456
|
+
});
|
|
1372
1457
|
_filterLocal.set(this, (localItems, filterInfo) => {
|
|
1373
1458
|
const { columns } = this.gridOption;
|
|
1374
1459
|
const { rawColumnFilter, orderBy, orderDirection, pageSize, pageNumber } = filterInfo;
|
|
@@ -1486,16 +1571,17 @@ class SdGridMaterial {
|
|
|
1486
1571
|
};
|
|
1487
1572
|
});
|
|
1488
1573
|
_getFilter.set(this, () => {
|
|
1489
|
-
var _a, _b, _c, _d, _e, _f
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1574
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1575
|
+
const { columnFilter, externalFilter, filterDef } = this.filterRegister.get();
|
|
1576
|
+
return {
|
|
1577
|
+
rawColumnFilter: columnFilter || {},
|
|
1578
|
+
rawExternalFilter: externalFilter || {},
|
|
1579
|
+
rawFilterDef: filterDef || {},
|
|
1580
|
+
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
1581
|
+
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1582
|
+
pageNumber: ((_c = __classPrivateFieldGet(this, _paginator)) === null || _c === void 0 ? void 0 : _c.pageIndex) || 0,
|
|
1583
|
+
pageSize: ((_d = __classPrivateFieldGet(this, _paginator)) === null || _d === void 0 ? void 0 : _d.pageSize) || ((_f = (_e = this.gridOption) === null || _e === void 0 ? void 0 : _e.paginate) === null || _f === void 0 ? void 0 : _f.pageSize) || 50
|
|
1584
|
+
};
|
|
1499
1585
|
});
|
|
1500
1586
|
_load$1.set(this, (filterReq, force = true) => __awaiter(this, void 0, void 0, function* () {
|
|
1501
1587
|
this.isLoading = true;
|
|
@@ -1923,18 +2009,23 @@ class SdGridMaterial {
|
|
|
1923
2009
|
this.ref.detectChanges();
|
|
1924
2010
|
});
|
|
1925
2011
|
this.clearFilter = () => {
|
|
1926
|
-
|
|
1927
|
-
if (
|
|
1928
|
-
|
|
1929
|
-
}
|
|
1930
|
-
|
|
2012
|
+
this.filterRegister.remove();
|
|
2013
|
+
// if (this.gridOption?.filter?.inlineColumn) {
|
|
2014
|
+
// this.columnFilter = {};
|
|
2015
|
+
// }
|
|
2016
|
+
// this.gridFilter?.onClearFilter();
|
|
1931
2017
|
};
|
|
1932
2018
|
this.setFilter = (args) => {
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
2019
|
+
const { columnFilter, externalFilter, filterDef } = args || {};
|
|
2020
|
+
this.filterRegister.set({
|
|
2021
|
+
columnFilter,
|
|
2022
|
+
externalFilter,
|
|
2023
|
+
filterDef
|
|
2024
|
+
});
|
|
2025
|
+
// if (this.gridOption?.filter?.inlineColumn && args?.columnFilter) {
|
|
2026
|
+
// this.columnFilter = args.columnFilter;
|
|
2027
|
+
// }
|
|
2028
|
+
// this.gridFilter?.setFilter(args);
|
|
1938
2029
|
};
|
|
1939
2030
|
this.onCreate = () => {
|
|
1940
2031
|
var _a, _b;
|
|
@@ -2141,31 +2232,28 @@ class SdGridMaterial {
|
|
|
2141
2232
|
set _gridFilter(gridFilter) {
|
|
2142
2233
|
if (gridFilter && this.gridFilter !== gridFilter) {
|
|
2143
2234
|
this.gridFilter = gridFilter;
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2235
|
+
// this.#subscription.add(gridFilter.filterChange.pipe(
|
|
2236
|
+
// filter(reload => reload),
|
|
2237
|
+
// debounceTime(500),
|
|
2238
|
+
// map(() => {
|
|
2239
|
+
// this.#paginator.pageIndex = 0;
|
|
2240
|
+
// this.#reload.next({
|
|
2241
|
+
// force: false,
|
|
2242
|
+
// source: 'FILTER'
|
|
2243
|
+
// });
|
|
2244
|
+
// }),
|
|
2245
|
+
// ).subscribe());
|
|
2151
2246
|
}
|
|
2152
2247
|
}
|
|
2153
2248
|
set option(option) {
|
|
2154
|
-
var _a;
|
|
2155
2249
|
if (option) {
|
|
2156
2250
|
option = __classPrivateFieldGet(this, _initConfiguration).call(this, option);
|
|
2157
2251
|
this.gridOption = option;
|
|
2252
|
+
__classPrivateFieldGet(this, _loadFilterRegister).call(this);
|
|
2158
2253
|
__classPrivateFieldSet(this, _loadCompleted, false);
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
});
|
|
2163
|
-
(_a = option === null || option === void 0 ? void 0 : option.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
|
|
2164
|
-
var _a;
|
|
2165
|
-
if ((_a = col.filter) === null || _a === void 0 ? void 0 : _a.default) {
|
|
2166
|
-
this.columnFilter[col.field] = col.filter.default;
|
|
2167
|
-
}
|
|
2168
|
-
});
|
|
2254
|
+
// this.#reload.next({
|
|
2255
|
+
// force: true,
|
|
2256
|
+
// });
|
|
2169
2257
|
const configuration = this.gridConfigurationService.init(this.key, this.gridOption);
|
|
2170
2258
|
this.gridConfigurationObserver = configuration.observer;
|
|
2171
2259
|
configuration.load();
|
|
@@ -2174,7 +2262,7 @@ class SdGridMaterial {
|
|
|
2174
2262
|
set paginator(paginator) {
|
|
2175
2263
|
if (paginator && __classPrivateFieldGet(this, _paginator) !== paginator) {
|
|
2176
2264
|
__classPrivateFieldSet(this, _paginator, paginator);
|
|
2177
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2265
|
+
__classPrivateFieldGet(this, _subscription$2).add(paginator.page.pipe(map(() => {
|
|
2178
2266
|
__classPrivateFieldGet(this, _reload).next({
|
|
2179
2267
|
force: false
|
|
2180
2268
|
});
|
|
@@ -2184,7 +2272,7 @@ class SdGridMaterial {
|
|
|
2184
2272
|
set sort(sort) {
|
|
2185
2273
|
if (sort && __classPrivateFieldGet(this, _sort) !== sort) {
|
|
2186
2274
|
__classPrivateFieldSet(this, _sort, sort);
|
|
2187
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2275
|
+
__classPrivateFieldGet(this, _subscription$2).add(sort.sortChange.pipe(map(() => {
|
|
2188
2276
|
__classPrivateFieldGet(this, _reload).next({
|
|
2189
2277
|
force: false
|
|
2190
2278
|
});
|
|
@@ -2195,26 +2283,15 @@ class SdGridMaterial {
|
|
|
2195
2283
|
__classPrivateFieldGet(this, _initCellDef).call(this);
|
|
2196
2284
|
}
|
|
2197
2285
|
ngAfterViewInit() {
|
|
2198
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2199
|
-
// startWith(this.#reload.value),
|
|
2200
|
-
filter(data => {
|
|
2201
|
-
var _a, _b;
|
|
2202
|
-
if (__classPrivateFieldGet(this, _loadCompleted)) {
|
|
2203
|
-
return true;
|
|
2204
|
-
}
|
|
2205
|
-
if (!((_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.disabled)) {
|
|
2206
|
-
return data.source === 'FILTER';
|
|
2207
|
-
}
|
|
2208
|
-
return data.source === 'INITIALIZE';
|
|
2209
|
-
}), switchMap((data) => __awaiter(this, void 0, void 0, function* () {
|
|
2286
|
+
__classPrivateFieldGet(this, _subscription$2).add(__classPrivateFieldGet(this, _reload).pipe(debounceTime(200), switchMap((data) => __awaiter(this, void 0, void 0, function* () {
|
|
2210
2287
|
const filterInfo = __classPrivateFieldGet(this, _getFilter).call(this);
|
|
2211
2288
|
const result = yield __classPrivateFieldGet(this, _load$1).call(this, filterInfo, !__classPrivateFieldGet(this, _loadCompleted) || data.force);
|
|
2212
2289
|
__classPrivateFieldSet(this, _loadCompleted, true);
|
|
2213
2290
|
return result;
|
|
2214
2291
|
}))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
2215
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2216
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2217
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2292
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.sdCellDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
2293
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.sdFooterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
2294
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.sdFilterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
2218
2295
|
// this.#subscription.add(this.#optionChanges.pipe(
|
|
2219
2296
|
// debounceTime(200),
|
|
2220
2297
|
// startWith({}),
|
|
@@ -2224,7 +2301,7 @@ class SdGridMaterial {
|
|
|
2224
2301
|
this.ref.detectChanges();
|
|
2225
2302
|
}
|
|
2226
2303
|
ngOnDestroy() {
|
|
2227
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2304
|
+
__classPrivateFieldGet(this, _subscription$2).unsubscribe();
|
|
2228
2305
|
}
|
|
2229
2306
|
drop(event, columns) {
|
|
2230
2307
|
moveItemInArray(columns, event.previousIndex, event.currentIndex);
|
|
@@ -2262,11 +2339,11 @@ class SdGridMaterial {
|
|
|
2262
2339
|
return this.items.some(e => e.editorStatus !== undefined);
|
|
2263
2340
|
}
|
|
2264
2341
|
}
|
|
2265
|
-
_localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$
|
|
2342
|
+
_localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$2 = new WeakMap(), _reload = new WeakMap(), _loadCompleted = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration = 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();
|
|
2266
2343
|
SdGridMaterial.decorators = [
|
|
2267
2344
|
{ type: Component, args: [{
|
|
2268
2345
|
selector: 'sd-grid-material',
|
|
2269
|
-
template: "<ng-container *ngIf=\"gridConfigurationObserver | async as gridConfiguration\">\r\n <ng-container *ngIf=\"\r\n gridConfiguration\r\n | sdGridConfigurationResult\r\n : gridOption\r\n : sdSubInformation as configuration\r\n \">\r\n <sd-grid-filter *ngIf=\"!gridOption.filter?.disabled\" [filter]=\"gridOption?.filter\"\r\n [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\">\r\n </sd-grid-filter>\r\n <ng-container *ngIf=\"items | sdGroup:gridOption; $implicit as groupedItems\">\r\n <div class=\"c-container {{ gridOption?.style?.grid }}\" [ngClass]=\"{ 'mat-elevation-z2': gridOption?.shadow }\">\r\n <div class=\"c-loading\" *ngIf=\"isLoading\">\r\n <mat-spinner *ngIf=\"isLoading\"></mat-spinner>\r\n </div>\r\n <ng-container>\r\n <div class=\"c-table\" sdScroll [ngStyle]=\"{\r\n 'max-height': gridOption?.maxHeight,\r\n 'min-height': gridOption?.minHeight\r\n }\">\r\n <table *ngIf=\"items?.length; else elseEmpty\" mat-table [dataSource]=\"groupedItems\" matSort\r\n [matSortDisabled]=\"!gridOption.sortable\" cdkDropList cdkDropListOrientation=\"horizontal\"\r\n [cdkDropListDisabled]=\"!gridOption.dropDragColumnEnable\"\r\n (cdkDropListDropped)=\"drop($event, configuration.displayedColumns)\" multiTemplateDataRows>\r\n\r\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdSubInformation?.templateRef\">\r\n <ng-container *ngIf=\"gridOption?.subInformation?.always;else useExpandCollapse\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #useExpandCollapse>\r\n <div [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\r\n <ng-container *ngIf=\"item.isExpanded\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-template>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button *ngIf=\"!element.isExpanding && !gridOption?.subInformation?.always\" mat-icon-button\r\n aria-label=\"Expand & Collapse\" (click)=\"onExpand(element)\">\r\n <mat-icon *ngIf=\"!element.isExpanded\">expand_more</mat-icon>\r\n <mat-icon *ngIf=\"element.isExpanded\">expand_less</mat-icon>\r\n </button>\r\n <div *ngIf=\"element.isExpanding\" class=\"lds-ring\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"text-center px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <ng-container *ngIf=\"items | selectionVisibleSelectAll: gridOption?.selection | async\">\r\n <mat-checkbox *ngIf=\"!gridOption.selection?.single\" class=\"c-selection\" color=\"primary\"\r\n [(ngModel)]=\"isSelectAll\" (change)=\"onSelectAll()\">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </th>\r\n <td class=\"text-center px-15\" mat-cell *matCellDef=\"let item\" style=\"min-width: 50px; max-width: 50px\">\r\n <ng-container *ngIf=\"item | selectionVisible:gridOption?.selection\">\r\n <mat-checkbox class=\"c-selection\" color=\"primary\" [(ngModel)]=\"item.isSelected\"\r\n (change)=\"onSelect(item)\" [disabled]=\"\r\n selectedItems | selectionDisable: item:gridOption?.selection\r\n \">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 2px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0 position-relative\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <sd-desktop-editor-validation [sdId]=\"item.sdId\" [item]=\"item\" [items]=\"items\"\r\n [gridOption]=\"gridOption\">\r\n </sd-desktop-editor-validation>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <ng-container *sdLet=\"item.editorStatus | sdEditorHandlerRow:item:gridOption as editorHandler\">\r\n <div *ngIf=\"editorHandler\" class=\"d-flex align-items-center justify-content-center\">\r\n <button *ngIf=\"editorHandler.editable\" class=\"mx-2\" (click)=\"onUpdate(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">edit</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.removable\" class=\"mx-2\" (click)=\"onRemove(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">delete</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.savable\" class=\"mx-2\" (click)=\"onSave(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">save</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.cancelable\" class=\"mx-2\" (click)=\"onCancel(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">close</mat-icon>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-command [commands]=\"gridOption.commands\" [item]=\"item\"></sd-desktop-command>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"!item?.sdGroup ? 1 : configuration.displayedColumns.length\">\r\n <div [innerHtml]=\"item?.sdGroup?.htmlTemplate | safeHtml\">\r\n </div>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef cdkDrag class=\"px-8 py-8 c-th\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader && column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div aria-hidden=\"false\" role=\"presentation\" mat-sort-header [disabled]=\"\r\n !column.sortable || column.type === 'children-col'\r\n \" [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-0\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell class=\"d-block px-8\" *ngIf=\"!item?.sdGroup\" [sdId]=\"item.sdId\" [key]=\"key\"\r\n [value]=\"item[column.field]\" [column]=\"column\" [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\"\r\n [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns; let i = index\"\r\n [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header class=\"c-th px-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-0\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell class=\"d-block px-8\" [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\"\r\n [column]=\"column\" [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <ng-container *ngIf=\"configuration.secondHeaders?.length\">\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n </ng-container>\r\n <tr mat-row *matRowDef=\"let row; columns: configuration.displayedColumns\" matRipple class=\"c-row\"\r\n [class.selected]=\"row.isSelected\" [style]=\"row | sdStyleRowCss:gridOption\"></tr>\r\n\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']\" class=\"c-detail-row\"></tr>\r\n <ng-container *ngIf=\"hasFooter && configuration.displayedFooters?.length\">\r\n <tr mat-footer-row *matFooterRowDef=\"configuration.displayedFooters; sticky: true\"></tr>\r\n </ng-container>\r\n </table>\r\n <ng-template #elseEmpty>\r\n <table mat-table [dataSource]=\"[{}]\">\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 4px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEmpty\">\r\n <td class=\"c-empty\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdEmptyData?.templateRef; else sdEmptyDataNoRef\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdEmptyData.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #sdEmptyDataNoRef>\r\n <mat-icon fontSet=\"material-icons-outlined\">leaderboard</mat-icon>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.columns\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader &&\r\n column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns\" [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdEmpty']\"></tr>\r\n </table>\r\n </ng-template>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-paginator\">\r\n <div class=\"c-action\">\r\n <sd-button *ngIf=\"\r\n !gridOption.filter?.disabled && !gridOption.filter?.inlineColumn\r\n \" class=\"mr-10\" [title]=\"'Filter' | sdTranslate\" icon=\"filter_alt\" size=\"sm\" (action)=\"gridFilter.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n <sd-button *ngIf=\"gridOption.reload?.visible\" class=\"mr-10\" [title]=\"'Reload' | sdTranslate\" icon=\"refresh\"\r\n size=\"sm\" (action)=\"reload()\" [disabled]=\"!items?.length\" type=\"link\">\r\n </sd-button>\r\n <ng-container *ngIf=\"gridOption.export?.visible && items?.length\">\r\n <ng-container *ngIf=\"isExporting; else unExporting\">\r\n <sd-button class=\"mr-10\" [loading]=\"isExporting\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\"\r\n size=\"sm\" type=\"link\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-template #unExporting>\r\n <sd-button class=\"mr-10\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\" size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\" type=\"link\">\r\n </sd-button>\r\n </ng-template>\r\n\r\n <mat-menu #menu=\"matMenu\">\r\n <button *ngIf=\"gridOption.export?.visibleExcel !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export excel\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.visibleCSV !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportCSV()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export CSV\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.key\" mat-menu-item (click)=\"sdPopupExport.open()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">settings</mat-icon>\r\n <span> {{ \"Configure\" | sdTranslate }}</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button *ngIf=\"gridOption.config?.visible\" class=\"mr-10\" [title]=\"'Configure' | sdTranslate\"\r\n icon=\"settings\" size=\"sm\" (action)=\"popupGridConfiguration.open()\" type=\"link\">\r\n </sd-button>\r\n </div>\r\n <mat-paginator [class.d-none]=\"gridOption.paginate?.hidden\" [length]=\"total\"\r\n [pageSize]=\"gridOption.paginate?.pageSize\" [pageSizeOptions]=\"gridOption.paginate?.pages\"\r\n [showFirstLastButtons]=\"gridOption.paginate?.showFirstLastButtons\"></mat-paginator>\r\n </div>\r\n </div>\r\n <sd-grid-quick-action [gridOption]=\"gridOption\" [selectedItems]=\"selectedItems\"\r\n (clear)=\"onClearSelection(groupedItems)\">\r\n </sd-grid-quick-action>\r\n <sd-popup-export *ngIf=\"gridOption.export?.visible\" [configuration]=\"configuration\" [gridOption]=\"gridOption\"\r\n (export)=\"onExport($event)\" #sdPopupExport>\r\n </sd-popup-export>\r\n <sd-popup-grid-configuration [gridOption]=\"gridOption\" [key]=\"key\" #popupGridConfiguration>\r\n </sd-popup-grid-configuration>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>",
|
|
2346
|
+
template: "<ng-container *ngIf=\"gridConfigurationObserver | async as gridConfiguration\">\r\n <ng-container *ngIf=\"\r\n gridConfiguration\r\n | sdGridConfigurationResult\r\n : gridOption\r\n : sdSubInformation as configuration\r\n \">\r\n <sd-grid-filter *ngIf=\"!gridOption.filter?.disabled && filterRegister\" [filterRegister]=\"filterRegister\" [filter]=\"gridOption?.filter\"\r\n [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\" #gridFilter>\r\n </sd-grid-filter>\r\n <ng-container *ngIf=\"items | sdGroup:gridOption; $implicit as groupedItems\">\r\n <div class=\"c-container {{ gridOption?.style?.grid }}\" [ngClass]=\"{ 'mat-elevation-z2': gridOption?.shadow }\">\r\n <div class=\"c-loading\" *ngIf=\"isLoading\">\r\n <mat-spinner *ngIf=\"isLoading\"></mat-spinner>\r\n </div>\r\n <ng-container>\r\n <div class=\"c-table\" sdScroll [ngStyle]=\"{\r\n 'max-height': gridOption?.maxHeight,\r\n 'min-height': gridOption?.minHeight\r\n }\">\r\n <table *ngIf=\"items?.length; else elseEmpty\" mat-table [dataSource]=\"groupedItems\" matSort\r\n [matSortDisabled]=\"!gridOption.sortable\" cdkDropList cdkDropListOrientation=\"horizontal\"\r\n [cdkDropListDisabled]=\"!gridOption.dropDragColumnEnable\"\r\n (cdkDropListDropped)=\"drop($event, configuration.displayedColumns)\" multiTemplateDataRows>\r\n\r\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdSubInformation?.templateRef\">\r\n <ng-container *ngIf=\"gridOption?.subInformation?.always;else useExpandCollapse\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #useExpandCollapse>\r\n <div [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\r\n <ng-container *ngIf=\"item.isExpanded\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-template>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button *ngIf=\"!element.isExpanding && !gridOption?.subInformation?.always\" mat-icon-button\r\n aria-label=\"Expand & Collapse\" (click)=\"onExpand(element)\">\r\n <mat-icon *ngIf=\"!element.isExpanded\">expand_more</mat-icon>\r\n <mat-icon *ngIf=\"element.isExpanded\">expand_less</mat-icon>\r\n </button>\r\n <div *ngIf=\"element.isExpanding\" class=\"lds-ring\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"text-center px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <ng-container *ngIf=\"items | selectionVisibleSelectAll: gridOption?.selection | async\">\r\n <mat-checkbox *ngIf=\"!gridOption.selection?.single\" class=\"c-selection\" color=\"primary\"\r\n [(ngModel)]=\"isSelectAll\" (change)=\"onSelectAll()\">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </th>\r\n <td class=\"text-center px-15\" mat-cell *matCellDef=\"let item\" style=\"min-width: 50px; max-width: 50px\">\r\n <ng-container *ngIf=\"item | selectionVisible:gridOption?.selection\">\r\n <mat-checkbox class=\"c-selection\" color=\"primary\" [(ngModel)]=\"item.isSelected\"\r\n (change)=\"onSelect(item)\" [disabled]=\"\r\n selectedItems | selectionDisable: item:gridOption?.selection\r\n \">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 2px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0 position-relative\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <sd-desktop-editor-validation [sdId]=\"item.sdId\" [item]=\"item\" [items]=\"items\"\r\n [gridOption]=\"gridOption\">\r\n </sd-desktop-editor-validation>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <ng-container *sdLet=\"item.editorStatus | sdEditorHandlerRow:item:gridOption as editorHandler\">\r\n <div *ngIf=\"editorHandler\" class=\"d-flex align-items-center justify-content-center\">\r\n <button *ngIf=\"editorHandler.editable\" class=\"mx-2\" (click)=\"onUpdate(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">edit</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.removable\" class=\"mx-2\" (click)=\"onRemove(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">delete</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.savable\" class=\"mx-2\" (click)=\"onSave(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">save</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.cancelable\" class=\"mx-2\" (click)=\"onCancel(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">close</mat-icon>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-command [commands]=\"gridOption.commands\" [item]=\"item\"></sd-desktop-command>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"!item?.sdGroup ? 1 : configuration.displayedColumns.length\">\r\n <div [innerHtml]=\"item?.sdGroup?.htmlTemplate | safeHtml\">\r\n </div>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef cdkDrag class=\"px-8 py-8 c-th\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader && column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div aria-hidden=\"false\" role=\"presentation\" mat-sort-header [disabled]=\"\r\n !column.sortable || column.type === 'children-col'\r\n \" [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-0\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell class=\"d-block px-8\" *ngIf=\"!item?.sdGroup\" [sdId]=\"item.sdId\" [key]=\"key\"\r\n [value]=\"item[column.field]\" [column]=\"column\" [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\"\r\n [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns; let i = index\"\r\n [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header class=\"c-th px-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-0\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell class=\"d-block px-8\" [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\"\r\n [column]=\"column\" [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <ng-container *ngIf=\"configuration.secondHeaders?.length\">\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n </ng-container>\r\n <tr mat-row *matRowDef=\"let row; columns: configuration.displayedColumns\" matRipple class=\"c-row\"\r\n [class.selected]=\"row.isSelected\" [style]=\"row | sdStyleRowCss:gridOption\"></tr>\r\n\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']\" class=\"c-detail-row\"></tr>\r\n <ng-container *ngIf=\"hasFooter && configuration.displayedFooters?.length\">\r\n <tr mat-footer-row *matFooterRowDef=\"configuration.displayedFooters; sticky: true\"></tr>\r\n </ng-container>\r\n </table>\r\n <ng-template #elseEmpty>\r\n <table mat-table [dataSource]=\"[{}]\">\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 4px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEmpty\">\r\n <td class=\"c-empty\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdEmptyData?.templateRef; else sdEmptyDataNoRef\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdEmptyData.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #sdEmptyDataNoRef>\r\n <mat-icon fontSet=\"material-icons-outlined\">leaderboard</mat-icon>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.columns\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader &&\r\n column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns\" [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdEmpty']\"></tr>\r\n </table>\r\n </ng-template>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-paginator\">\r\n <div class=\"c-action\">\r\n <sd-button *ngIf=\"gridFilter && !gridOption.filter?.inlineColumn\r\n \" class=\"mr-10\" [title]=\"'Filter' | sdTranslate\" icon=\"filter_alt\" size=\"sm\" (action)=\"gridFilter.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n <sd-button *ngIf=\"gridOption.reload?.visible\" class=\"mr-10\" [title]=\"'Reload' | sdTranslate\" icon=\"refresh\"\r\n size=\"sm\" (action)=\"reload()\" [disabled]=\"!items?.length\" type=\"link\">\r\n </sd-button>\r\n <ng-container *ngIf=\"gridOption.export?.visible && items?.length\">\r\n <ng-container *ngIf=\"isExporting; else unExporting\">\r\n <sd-button class=\"mr-10\" [loading]=\"isExporting\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\"\r\n size=\"sm\" type=\"link\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-template #unExporting>\r\n <sd-button class=\"mr-10\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\" size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\" type=\"link\">\r\n </sd-button>\r\n </ng-template>\r\n\r\n <mat-menu #menu=\"matMenu\">\r\n <button *ngIf=\"gridOption.export?.visibleExcel !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export excel\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.visibleCSV !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportCSV()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export CSV\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.key\" mat-menu-item (click)=\"sdPopupExport.open()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">settings</mat-icon>\r\n <span> {{ \"Configure\" | sdTranslate }}</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button *ngIf=\"gridOption.config?.visible\" class=\"mr-10\" [title]=\"'Configure' | sdTranslate\"\r\n icon=\"settings\" size=\"sm\" (action)=\"popupGridConfiguration.open()\" type=\"link\">\r\n </sd-button>\r\n </div>\r\n <mat-paginator [class.d-none]=\"gridOption.paginate?.hidden\" [length]=\"total\"\r\n [pageSize]=\"gridOption.paginate?.pageSize\" [pageSizeOptions]=\"gridOption.paginate?.pages\"\r\n [showFirstLastButtons]=\"gridOption.paginate?.showFirstLastButtons\"></mat-paginator>\r\n </div>\r\n </div>\r\n <sd-grid-quick-action [gridOption]=\"gridOption\" [selectedItems]=\"selectedItems\"\r\n (clear)=\"onClearSelection(groupedItems)\">\r\n </sd-grid-quick-action>\r\n <sd-popup-export *ngIf=\"gridOption.export?.visible\" [configuration]=\"configuration\" [gridOption]=\"gridOption\"\r\n (export)=\"onExport($event)\" #sdPopupExport>\r\n </sd-popup-export>\r\n <sd-popup-grid-configuration [gridOption]=\"gridOption\" [key]=\"key\" #popupGridConfiguration>\r\n </sd-popup-grid-configuration>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>",
|
|
2270
2347
|
animations: [
|
|
2271
2348
|
trigger('detailExpand', [
|
|
2272
2349
|
state('collapsed', style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
@@ -2283,8 +2360,8 @@ SdGridMaterial.ctorParameters = () => [
|
|
|
2283
2360
|
{ type: SdGridConfigurationService },
|
|
2284
2361
|
{ type: SdExportService },
|
|
2285
2362
|
{ type: SdNotifyService },
|
|
2286
|
-
{ type: SdTranslateService },
|
|
2287
2363
|
{ type: SdColumnValuesPipe },
|
|
2364
|
+
{ type: SdGridFilterService },
|
|
2288
2365
|
{ type: SdEditorHandlerColumnPipe }
|
|
2289
2366
|
];
|
|
2290
2367
|
SdGridMaterial.propDecorators = {
|
|
@@ -3027,7 +3104,7 @@ SdGeneratedColumnService.ctorParameters = () => [
|
|
|
3027
3104
|
{ type: SdSettingService }
|
|
3028
3105
|
];
|
|
3029
3106
|
|
|
3030
|
-
var _subscription$
|
|
3107
|
+
var _subscription$3;
|
|
3031
3108
|
class SdDynamicColumn {
|
|
3032
3109
|
constructor(ref, generatedColumnService, notifyService, translateService, gridConfigurationService) {
|
|
3033
3110
|
this.ref = ref;
|
|
@@ -3035,7 +3112,7 @@ class SdDynamicColumn {
|
|
|
3035
3112
|
this.notifyService = notifyService;
|
|
3036
3113
|
this.translateService = translateService;
|
|
3037
3114
|
this.gridConfigurationService = gridConfigurationService;
|
|
3038
|
-
_subscription$
|
|
3115
|
+
_subscription$3.set(this, new Subscription());
|
|
3039
3116
|
this.columnTypes = ['string', 'number', 'bool', 'date', 'datetime', 'time', 'values', 'children', 'children-col'];
|
|
3040
3117
|
this.form = new FormGroup({});
|
|
3041
3118
|
this.isDetail = false;
|
|
@@ -3079,22 +3156,22 @@ class SdDynamicColumn {
|
|
|
3079
3156
|
const systemSetting = this.generatedColumnService.loadSystem(this.gridOption.config);
|
|
3080
3157
|
const setting = this.generatedColumnService.load((_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.config);
|
|
3081
3158
|
if (systemSetting) {
|
|
3082
|
-
(_b = __classPrivateFieldGet(this, _subscription$
|
|
3159
|
+
(_b = __classPrivateFieldGet(this, _subscription$3)) === null || _b === void 0 ? void 0 : _b.add(systemSetting.observer.subscribe(columns => {
|
|
3083
3160
|
this.systemColumns = columns;
|
|
3084
3161
|
}));
|
|
3085
3162
|
}
|
|
3086
3163
|
if (setting) {
|
|
3087
|
-
(_c = __classPrivateFieldGet(this, _subscription$
|
|
3164
|
+
(_c = __classPrivateFieldGet(this, _subscription$3)) === null || _c === void 0 ? void 0 : _c.add(setting.observer.subscribe(columns => {
|
|
3088
3165
|
this.columns = columns;
|
|
3089
3166
|
}));
|
|
3090
3167
|
}
|
|
3091
3168
|
this.originColumns = this.gridOption.columns.filter(e => e.type !== 'children' && e.type !== 'children-col');
|
|
3092
3169
|
}
|
|
3093
3170
|
ngOnDestroy() {
|
|
3094
|
-
__classPrivateFieldGet(this, _subscription$
|
|
3171
|
+
__classPrivateFieldGet(this, _subscription$3).unsubscribe();
|
|
3095
3172
|
}
|
|
3096
3173
|
}
|
|
3097
|
-
_subscription$
|
|
3174
|
+
_subscription$3 = new WeakMap();
|
|
3098
3175
|
SdDynamicColumn.decorators = [
|
|
3099
3176
|
{ type: Component, args: [{
|
|
3100
3177
|
selector: 'sd-dynamic-column',
|
|
@@ -3846,5 +3923,5 @@ SdGridMaterialModule.decorators = [
|
|
|
3846
3923
|
* Generated bundle index. Do not edit.
|
|
3847
3924
|
*/
|
|
3848
3925
|
|
|
3849
|
-
export { SdGridMaterial, SdGridMaterialModule, SdMaterialCellDefDirective, SdMaterialEmptyDataDefDirective, SdMaterialFilterDefDirective, SdMaterialFooterDefDirective, SdMaterialSubInformationDefDirective, MatPaginatorIntlCro as ɵa, SdGridFilter as ɵb, SdCommandIconPipe as ɵba, SdCommandTitlePipe as ɵbb, SdColumnHtmlTemplatePipe as ɵbc, SdColumnTransformPipe as ɵbd, SdColumnTooltipPipe as ɵbe, SdColumnBadgePipe as ɵbf, SdFilterColumnPipe as ɵbg, SdFilterExternalPipe as ɵbh, SdSelectionActionFilterPipe as ɵbi, SdSelectionVisiblePipe as ɵbj, SdSelectionDisablePipe as ɵbk, SdSelectionVisibleSelectAllPipe as ɵbl, SdEditorHandlerRowPipe as ɵbm, SdEditorValidatePipe as ɵbn, SdStyleRowCss as ɵbo, SdCellViewPipe as ɵbp, SdGroupPipe as ɵbq, SdPopupFilter as ɵc,
|
|
3926
|
+
export { SdGridMaterial, SdGridMaterialModule, SdMaterialCellDefDirective, SdMaterialEmptyDataDefDirective, SdMaterialFilterDefDirective, SdMaterialFooterDefDirective, SdMaterialSubInformationDefDirective, MatPaginatorIntlCro as ɵa, SdGridFilter as ɵb, SdCommandIconPipe as ɵba, SdCommandTitlePipe as ɵbb, SdColumnHtmlTemplatePipe as ɵbc, SdColumnTransformPipe as ɵbd, SdColumnTooltipPipe as ɵbe, SdColumnBadgePipe as ɵbf, SdFilterColumnPipe as ɵbg, SdFilterExternalPipe as ɵbh, SdSelectionActionFilterPipe as ɵbi, SdSelectionVisiblePipe as ɵbj, SdSelectionDisablePipe as ɵbk, SdSelectionVisibleSelectAllPipe as ɵbl, SdEditorHandlerRowPipe as ɵbm, SdEditorValidatePipe as ɵbn, SdStyleRowCss as ɵbo, SdCellViewPipe as ɵbp, SdGroupPipe as ɵbq, SdPopupFilter as ɵc, SdPopupExport as ɵd, GRID_MATERIAL_CONFIG as ɵf, SdGridConfigurationService as ɵg, SdColumnValuesPipe as ɵh, SdGridFilterService as ɵi, SdEditorHandlerColumnPipe as ɵj, SdGridQuickAction as ɵk, SdDesktopCell as ɵl, SdDesktopCellEditor as ɵm, SdDesktopEditorValidation as ɵn, SdDesktopCellView as ɵo, SdDesktopCellChildrenView as ɵp, SdDesktopCommand as ɵq, SdColumnInlineFilter as ɵr, SdPopupGridConfiguration as ɵs, SdDynamicColumn as ɵt, SdGeneratedColumnService as ɵu, SdGridConfigurationResultPipe as ɵv, SdColumnChildrenFilterPipe as ɵw, SdColumnTitlePipe as ɵx, SdCommandFilterPipe as ɵy, SdCommandDisablePipe as ɵz };
|
|
3850
3927
|
//# sourceMappingURL=sd-angular-core-grid-material.js.map
|