@sd-angular/core 1.3.98 → 1.3.100
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 +224 -251
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +2 -2
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/esm2015/grid-material/src/lib/components/grid-filter/grid-filter.component.js +17 -54
- package/esm2015/grid-material/src/lib/components/popup-filter/popup-filter.component.js +14 -31
- package/esm2015/grid-material/src/lib/grid-material.component.js +19 -21
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.model.js +1 -1
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.service.js +123 -121
- package/fesm2015/sd-angular-core-grid-material.js +189 -241
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/components/grid-filter/grid-filter.component.d.ts +1 -1
- package/grid-material/src/lib/services/grid-filter/grid-filter.model.d.ts +17 -10
- package/grid-material/src/lib/services/grid-filter/grid-filter.service.d.ts +1 -3
- package/package.json +1 -1
- package/{sd-angular-core-1.3.98.tgz → sd-angular-core-1.3.100.tgz} +0 -0
|
@@ -8,7 +8,7 @@ import { v4 } from 'uuid';
|
|
|
8
8
|
import { Subscription, BehaviorSubject, Subject, isObservable, combineLatest } from 'rxjs';
|
|
9
9
|
import { SdNotifyService } from '@sd-angular/core/notify';
|
|
10
10
|
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
11
|
-
import {
|
|
11
|
+
import { debounceTime, map, switchMap, startWith } from 'rxjs/operators';
|
|
12
12
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
13
13
|
import { SdLoadingService } from '@sd-angular/core/loading';
|
|
14
14
|
import { SdTranslateService } from '@sd-angular/core/translate';
|
|
@@ -156,22 +156,16 @@ class SdPopupFilter {
|
|
|
156
156
|
this.cdRef.markForCheck();
|
|
157
157
|
};
|
|
158
158
|
this.onApply = () => {
|
|
159
|
-
__classPrivateFieldGet(this, _filterRegister).set({
|
|
159
|
+
__classPrivateFieldGet(this, _filterRegister).configuration.set({
|
|
160
160
|
inlineColumn: this.inlineColumn,
|
|
161
|
-
columnFilter: this.columnFilter,
|
|
162
161
|
inlineExternal: this.inlineExternal,
|
|
163
|
-
externalFilter: this.externalFilter,
|
|
164
162
|
inlineFilterDef: this.inlineFilterDef,
|
|
163
|
+
});
|
|
164
|
+
__classPrivateFieldGet(this, _filterRegister).value.set({
|
|
165
|
+
columnFilter: this.columnFilter,
|
|
166
|
+
externalFilter: this.externalFilter,
|
|
165
167
|
filterDef: this.filterDef
|
|
166
168
|
});
|
|
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
|
-
// });
|
|
175
169
|
this.modal.close();
|
|
176
170
|
this.cdRef.markForCheck();
|
|
177
171
|
};
|
|
@@ -181,27 +175,16 @@ class SdPopupFilter {
|
|
|
181
175
|
}
|
|
182
176
|
;
|
|
183
177
|
ngAfterViewInit() {
|
|
184
|
-
|
|
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 => {
|
|
178
|
+
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterRegister).configuration.observer.subscribe(configuration => {
|
|
199
179
|
this.inlineColumn = JSON.parse(JSON.stringify(configuration.inlineColumn));
|
|
200
|
-
this.columnFilter = JSON.parse(JSON.stringify(configuration.columnFilter));
|
|
201
180
|
this.inlineExternal = JSON.parse(JSON.stringify(configuration.inlineExternal));
|
|
202
|
-
this.externalFilter = JSON.parse(JSON.stringify(configuration.externalFilter));
|
|
203
181
|
this.inlineFilterDef = JSON.parse(JSON.stringify(configuration.inlineFilterDef));
|
|
204
|
-
this.
|
|
182
|
+
this.cdRef.markForCheck();
|
|
183
|
+
}));
|
|
184
|
+
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterRegister).value.observer.subscribe(filterValue => {
|
|
185
|
+
this.columnFilter = JSON.parse(JSON.stringify(filterValue.columnFilter));
|
|
186
|
+
this.externalFilter = JSON.parse(JSON.stringify(filterValue.externalFilter));
|
|
187
|
+
this.filterDef = JSON.parse(JSON.stringify(filterValue.filterDef));
|
|
205
188
|
this.cdRef.markForCheck();
|
|
206
189
|
}));
|
|
207
190
|
}
|
|
@@ -209,7 +192,7 @@ class SdPopupFilter {
|
|
|
209
192
|
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
210
193
|
}
|
|
211
194
|
onClear() {
|
|
212
|
-
__classPrivateFieldGet(this, _filterRegister).remove();
|
|
195
|
+
__classPrivateFieldGet(this, _filterRegister).value.remove();
|
|
213
196
|
this.modal.close();
|
|
214
197
|
this.cdRef.markForCheck();
|
|
215
198
|
}
|
|
@@ -251,79 +234,43 @@ class SdGridFilter {
|
|
|
251
234
|
this.inlineExternal = {};
|
|
252
235
|
_subscription$1.set(this, new Subscription());
|
|
253
236
|
this.onFilter = (item) => {
|
|
254
|
-
this.filterRegister.set({
|
|
237
|
+
this.filterRegister.value.set({
|
|
255
238
|
columnFilter: this.columnFilter,
|
|
256
239
|
externalFilter: this.externalFilter,
|
|
257
240
|
filterDef: this.filterDef
|
|
258
241
|
});
|
|
259
|
-
// this.filterChange.next(true);
|
|
260
242
|
};
|
|
261
243
|
this.open = () => {
|
|
262
244
|
this.popupFilter.open();
|
|
263
245
|
};
|
|
264
|
-
this.onReset = () => {
|
|
265
|
-
this.filterRegister.remove();
|
|
266
|
-
this.ref.markForCheck();
|
|
267
|
-
};
|
|
268
246
|
this.isMobileOrTablet = !this.deviceService.isDesktop();
|
|
269
247
|
this.ref.markForCheck();
|
|
270
248
|
}
|
|
271
249
|
set _filter(filter) {
|
|
272
250
|
this.filter = filter;
|
|
273
251
|
}
|
|
252
|
+
set _externalFilters(value) {
|
|
253
|
+
this.externalFilters = value || [];
|
|
254
|
+
}
|
|
274
255
|
set _filterRegister(value) {
|
|
275
256
|
this.filterRegister = value;
|
|
276
257
|
this.filterRegisterChange.next(this.filterRegister);
|
|
277
258
|
}
|
|
278
259
|
;
|
|
279
260
|
ngAfterViewInit() {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
// this.filterChange.next(true);
|
|
292
|
-
// this.ref.markForCheck();
|
|
293
|
-
// }));
|
|
294
|
-
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegisterChange.pipe(startWith(this.filterRegister)).subscribe(() => {
|
|
295
|
-
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.observer.subscribe(configuration => {
|
|
296
|
-
this.inlineColumn = configuration.inlineColumn;
|
|
297
|
-
this.columnFilter = configuration.columnFilter;
|
|
298
|
-
this.inlineExternal = configuration.inlineExternal;
|
|
299
|
-
this.externalFilter = configuration.externalFilter;
|
|
300
|
-
this.inlineFilterDef = configuration.inlineFilterDef;
|
|
301
|
-
this.filterDef = configuration.filterDef;
|
|
302
|
-
this.ref.markForCheck();
|
|
303
|
-
}));
|
|
261
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.configuration.observer.subscribe(configuration => {
|
|
262
|
+
this.inlineColumn = configuration.inlineColumn;
|
|
263
|
+
this.inlineExternal = configuration.inlineExternal;
|
|
264
|
+
this.inlineFilterDef = configuration.inlineFilterDef;
|
|
265
|
+
this.ref.markForCheck();
|
|
266
|
+
}));
|
|
267
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.value.observer.subscribe(value => {
|
|
268
|
+
this.columnFilter = value.columnFilter;
|
|
269
|
+
this.externalFilter = value.externalFilter;
|
|
270
|
+
this.filterDef = value.filterDef;
|
|
271
|
+
this.ref.markForCheck();
|
|
304
272
|
}));
|
|
305
273
|
}
|
|
306
|
-
// #loadDefault = () => {
|
|
307
|
-
// for (const column of this.columns) {
|
|
308
|
-
// this.inlineColumn[column.field] = this.inlineColumn[column.field] ?? column?.filter?.defaultShowing;
|
|
309
|
-
// this.columnFilter[column.field] = this.columnFilter[column.field] ?? column?.filter?.default;
|
|
310
|
-
// }
|
|
311
|
-
// for (const externalFilter of this.externalFilters) {
|
|
312
|
-
// this.inlineExternal[externalFilter.field] = this.inlineExternal[externalFilter.field] ?? externalFilter?.defaultShowing;
|
|
313
|
-
// if (externalFilter.type === 'daterange') {
|
|
314
|
-
// this.externalFilter[externalFilter.field] = {
|
|
315
|
-
// from: this.externalFilter[externalFilter.field]?.from ?? externalFilter.default?.from ?? undefined,
|
|
316
|
-
// to: this.externalFilter[externalFilter.field]?.to ?? externalFilter.default?.to ?? undefined
|
|
317
|
-
// };
|
|
318
|
-
// } else {
|
|
319
|
-
// this.externalFilter[externalFilter.field] = this.externalFilter[externalFilter.field] ?? externalFilter.default;
|
|
320
|
-
// }
|
|
321
|
-
// }
|
|
322
|
-
// for (const filterDef of this.filterDefs) {
|
|
323
|
-
// this.inlineFilterDef[filterDef.sdMaterialFilterDef] =
|
|
324
|
-
// this.inlineFilterDef[filterDef.sdMaterialFilterDef] ?? filterDef?.defaultShowing;
|
|
325
|
-
// }
|
|
326
|
-
// }
|
|
327
274
|
ngOnDestroy() {
|
|
328
275
|
__classPrivateFieldGet(this, _subscription$1).unsubscribe();
|
|
329
276
|
}
|
|
@@ -345,7 +292,7 @@ SdGridFilter.propDecorators = {
|
|
|
345
292
|
popupFilter: [{ type: ViewChild, args: [SdPopupFilter,] }],
|
|
346
293
|
_filter: [{ type: Input, args: ['filter',] }],
|
|
347
294
|
columns: [{ type: Input }],
|
|
348
|
-
|
|
295
|
+
_externalFilters: [{ type: Input, args: ['externalFilters',] }],
|
|
349
296
|
filterDefs: [{ type: Input }],
|
|
350
297
|
_filterRegister: [{ type: Input, args: ['filterRegister',] }]
|
|
351
298
|
};
|
|
@@ -1181,160 +1128,163 @@ SdEditorHandlerColumnPipe.ctorParameters = () => [
|
|
|
1181
1128
|
{ type: NgZone }
|
|
1182
1129
|
];
|
|
1183
1130
|
|
|
1184
|
-
var
|
|
1131
|
+
var _filterConfiguration, _filterValue, _cache$2, _loadDefaultConfiguration, _loadDefaultValue;
|
|
1185
1132
|
class SdGridFilterService {
|
|
1186
1133
|
constructor(settingService) {
|
|
1187
1134
|
this.settingService = settingService;
|
|
1188
|
-
|
|
1135
|
+
_filterConfiguration.set(this, 'GRID-FILTER-CONFIGURATION');
|
|
1136
|
+
_filterValue.set(this, 'GRID-FILTER-VALUE');
|
|
1137
|
+
_cache$2.set(this, {});
|
|
1189
1138
|
this.register = (key, args) => {
|
|
1190
1139
|
let cacheSession = false;
|
|
1191
1140
|
if (!key) {
|
|
1192
|
-
|
|
1141
|
+
const { columns, externalFilters } = args;
|
|
1142
|
+
key = hash({
|
|
1143
|
+
columns,
|
|
1144
|
+
externalFilters
|
|
1145
|
+
});
|
|
1193
1146
|
cacheSession = true; // Nếu không có key thì chỉ lưu theo session
|
|
1194
1147
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1148
|
+
if (!__classPrivateFieldGet(this, _cache$2)[key]) {
|
|
1149
|
+
const filterConfiguration = this.settingService.create({
|
|
1150
|
+
prefix: __classPrivateFieldGet(this, _filterConfiguration),
|
|
1151
|
+
key
|
|
1152
|
+
}, {
|
|
1153
|
+
default: __classPrivateFieldGet(this, _loadDefaultConfiguration).call(this, args),
|
|
1154
|
+
type: cacheSession ? 'session' : undefined
|
|
1155
|
+
});
|
|
1156
|
+
const filterValue = this.settingService.create({
|
|
1157
|
+
prefix: __classPrivateFieldGet(this, _filterValue),
|
|
1158
|
+
key
|
|
1159
|
+
}, {
|
|
1160
|
+
default: __classPrivateFieldGet(this, _loadDefaultValue).call(this, args),
|
|
1161
|
+
type: cacheSession ? 'session' : undefined
|
|
1162
|
+
});
|
|
1163
|
+
__classPrivateFieldGet(this, _cache$2)[key] = {
|
|
1164
|
+
configuration: {
|
|
1165
|
+
get: () => {
|
|
1166
|
+
const configuration = filterConfiguration.get();
|
|
1167
|
+
return {
|
|
1168
|
+
// Filter column
|
|
1169
|
+
inlineColumn: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) || {},
|
|
1170
|
+
// Filter external
|
|
1171
|
+
inlineExternal: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {},
|
|
1172
|
+
// Filter def
|
|
1173
|
+
inlineFilterDef: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {},
|
|
1174
|
+
};
|
|
1175
|
+
},
|
|
1176
|
+
set: (configuration) => {
|
|
1177
|
+
const keys = Object.keys(configuration || {});
|
|
1178
|
+
const current = filterConfiguration.get();
|
|
1179
|
+
const { inlineColumn, inlineExternal, inlineFilterDef } = current;
|
|
1180
|
+
const updatedConfiguration = {
|
|
1181
|
+
// Filter column
|
|
1182
|
+
inlineColumn: keys.includes('inlineColumn') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) || {}) : inlineColumn,
|
|
1183
|
+
// Filter external
|
|
1184
|
+
inlineExternal: keys.includes('inlineExternal') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {}) : inlineExternal,
|
|
1185
|
+
// Filter def
|
|
1186
|
+
inlineFilterDef: keys.includes('inlineFilterDef') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {}) : inlineFilterDef,
|
|
1187
|
+
};
|
|
1188
|
+
filterConfiguration.set(updatedConfiguration);
|
|
1189
|
+
return updatedConfiguration;
|
|
1190
|
+
},
|
|
1191
|
+
remove: () => {
|
|
1192
|
+
filterConfiguration.remove();
|
|
1193
|
+
},
|
|
1194
|
+
observer: filterConfiguration.observer
|
|
1195
|
+
},
|
|
1196
|
+
value: {
|
|
1197
|
+
get: () => {
|
|
1198
|
+
const configuration = filterValue.get();
|
|
1199
|
+
return {
|
|
1200
|
+
// Filter column
|
|
1201
|
+
columnFilter: (configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {},
|
|
1202
|
+
// Filter external
|
|
1203
|
+
externalFilter: (configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {},
|
|
1204
|
+
// Filter def
|
|
1205
|
+
filterDef: (configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}
|
|
1206
|
+
};
|
|
1207
|
+
},
|
|
1208
|
+
set: (configuration) => {
|
|
1209
|
+
const keys = Object.keys(configuration || {});
|
|
1210
|
+
const current = filterValue.get();
|
|
1211
|
+
const { columnFilter, externalFilter, filterDef } = current;
|
|
1212
|
+
const updatedConfiguration = {
|
|
1213
|
+
// Filter column
|
|
1214
|
+
columnFilter: keys.includes('columnFilter') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {}) : columnFilter,
|
|
1215
|
+
// Filter external
|
|
1216
|
+
externalFilter: keys.includes('externalFilter') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {}) : externalFilter,
|
|
1217
|
+
// Filter def
|
|
1218
|
+
filterDef: keys.includes('filterDef') ? ((configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}) : filterDef,
|
|
1219
|
+
};
|
|
1220
|
+
filterValue.set(updatedConfiguration);
|
|
1221
|
+
return updatedConfiguration;
|
|
1222
|
+
},
|
|
1223
|
+
remove: () => {
|
|
1224
|
+
filterValue.remove();
|
|
1225
|
+
},
|
|
1226
|
+
observer: filterValue.observer
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
return __classPrivateFieldGet(this, _cache$2)[key];
|
|
1246
1231
|
};
|
|
1247
|
-
|
|
1248
|
-
var _a, _b, _c, _d
|
|
1232
|
+
_loadDefaultConfiguration.set(this, (args) => {
|
|
1233
|
+
var _a, _b, _c, _d;
|
|
1249
1234
|
const { columns, externalFilters, filterDefs } = args;
|
|
1250
1235
|
const inlineColumn = {};
|
|
1251
|
-
const columnFilter = {};
|
|
1252
1236
|
const inlineExternal = {};
|
|
1253
|
-
const externalFilter = {};
|
|
1254
1237
|
const inlineFilterDef = {};
|
|
1255
|
-
const filterDef = {};
|
|
1256
1238
|
// Filter column
|
|
1257
1239
|
for (const item of (columns || [])) {
|
|
1258
1240
|
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;
|
|
1259
|
-
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;
|
|
1260
1241
|
}
|
|
1261
1242
|
// Filter external
|
|
1262
1243
|
for (const item of (externalFilters || [])) {
|
|
1263
|
-
inlineExternal[item.field] = (
|
|
1244
|
+
inlineExternal[item.field] = (_c = inlineExternal[item.field]) !== null && _c !== void 0 ? _c : item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1245
|
+
}
|
|
1246
|
+
// Filter def
|
|
1247
|
+
for (const item of (filterDefs || [])) {
|
|
1248
|
+
inlineFilterDef[item.sdMaterialFilterDef] = (_d = inlineFilterDef[item.sdMaterialFilterDef]) !== null && _d !== void 0 ? _d : item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1249
|
+
}
|
|
1250
|
+
return {
|
|
1251
|
+
inlineColumn,
|
|
1252
|
+
inlineExternal,
|
|
1253
|
+
inlineFilterDef,
|
|
1254
|
+
};
|
|
1255
|
+
});
|
|
1256
|
+
_loadDefaultValue.set(this, (args) => {
|
|
1257
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1258
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1259
|
+
const columnFilter = {};
|
|
1260
|
+
const externalFilter = {};
|
|
1261
|
+
const filterDef = {};
|
|
1262
|
+
// Filter column
|
|
1263
|
+
for (const item of (columns || [])) {
|
|
1264
|
+
columnFilter[item.field] = (_a = columnFilter[item.field]) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.filter) === null || _b === void 0 ? void 0 : _b.default;
|
|
1265
|
+
}
|
|
1266
|
+
// Filter external
|
|
1267
|
+
for (const item of (externalFilters || [])) {
|
|
1264
1268
|
if (item.type === 'daterange') {
|
|
1265
1269
|
externalFilter[item.field] = {
|
|
1266
|
-
from: (
|
|
1267
|
-
to: (
|
|
1270
|
+
from: (_f = (_d = (_c = externalFilter[item.field]) === null || _c === void 0 ? void 0 : _c.from) !== null && _d !== void 0 ? _d : (_e = item.default) === null || _e === void 0 ? void 0 : _e.from) !== null && _f !== void 0 ? _f : undefined,
|
|
1271
|
+
to: (_k = (_h = (_g = externalFilter[item.field]) === null || _g === void 0 ? void 0 : _g.to) !== null && _h !== void 0 ? _h : (_j = item.default) === null || _j === void 0 ? void 0 : _j.to) !== null && _k !== void 0 ? _k : undefined
|
|
1268
1272
|
};
|
|
1269
1273
|
}
|
|
1270
1274
|
else {
|
|
1271
|
-
externalFilter[item.field] = (
|
|
1275
|
+
externalFilter[item.field] = (_l = externalFilter[item.field]) !== null && _l !== void 0 ? _l : item.default;
|
|
1272
1276
|
}
|
|
1273
1277
|
}
|
|
1274
1278
|
// Filter def
|
|
1275
|
-
for (const item of (filterDefs || [])) {
|
|
1276
|
-
inlineFilterDef[item.sdMaterialFilterDef] = (_q = inlineFilterDef[item.sdMaterialFilterDef]) !== null && _q !== void 0 ? _q : item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1277
|
-
}
|
|
1278
1279
|
return {
|
|
1279
|
-
quickFilters: [],
|
|
1280
|
-
selectedQuickFilter: null,
|
|
1281
|
-
inlineColumn,
|
|
1282
1280
|
columnFilter,
|
|
1283
|
-
inlineExternal,
|
|
1284
1281
|
externalFilter,
|
|
1285
|
-
inlineFilterDef,
|
|
1286
1282
|
filterDef,
|
|
1287
1283
|
};
|
|
1288
1284
|
});
|
|
1289
|
-
this.get = (key) => {
|
|
1290
|
-
var _a;
|
|
1291
|
-
if (!key) {
|
|
1292
|
-
return {
|
|
1293
|
-
selectedQuickFilter: null,
|
|
1294
|
-
quickFilters: [],
|
|
1295
|
-
inlineExternal: {},
|
|
1296
|
-
inlineColumn: {},
|
|
1297
|
-
inlineFilterDef: {}
|
|
1298
|
-
};
|
|
1299
|
-
}
|
|
1300
|
-
const { get } = this.settingService.create({
|
|
1301
|
-
prefix: __classPrivateFieldGet(this, _prefix$1),
|
|
1302
|
-
key
|
|
1303
|
-
});
|
|
1304
|
-
const configuration = get();
|
|
1305
|
-
return {
|
|
1306
|
-
selectedQuickFilter: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) !== null && _a !== void 0 ? _a : null,
|
|
1307
|
-
quickFilters: (configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || [],
|
|
1308
|
-
inlineExternal: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {},
|
|
1309
|
-
inlineColumn: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) || {},
|
|
1310
|
-
inlineFilterDef: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {},
|
|
1311
|
-
};
|
|
1312
|
-
};
|
|
1313
|
-
this.set = (key, configuration) => {
|
|
1314
|
-
configuration = {
|
|
1315
|
-
selectedQuickFilter: (configuration === null || configuration === void 0 ? void 0 : configuration.selectedQuickFilter) || null,
|
|
1316
|
-
quickFilters: (configuration === null || configuration === void 0 ? void 0 : configuration.quickFilters) || [],
|
|
1317
|
-
inlineExternal: configuration.inlineExternal || {},
|
|
1318
|
-
inlineColumn: configuration.inlineColumn || {},
|
|
1319
|
-
inlineFilterDef: configuration.inlineFilterDef || {}
|
|
1320
|
-
};
|
|
1321
|
-
if (!key) {
|
|
1322
|
-
return configuration;
|
|
1323
|
-
}
|
|
1324
|
-
const { set } = this.settingService.create({
|
|
1325
|
-
prefix: __classPrivateFieldGet(this, _prefix$1),
|
|
1326
|
-
key
|
|
1327
|
-
});
|
|
1328
|
-
key = hash({
|
|
1329
|
-
prefix: __classPrivateFieldGet(this, _prefix$1),
|
|
1330
|
-
key
|
|
1331
|
-
});
|
|
1332
|
-
set(configuration);
|
|
1333
|
-
return configuration;
|
|
1334
|
-
};
|
|
1335
1285
|
}
|
|
1336
1286
|
}
|
|
1337
|
-
|
|
1287
|
+
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(), _loadDefaultConfiguration = new WeakMap(), _loadDefaultValue = new WeakMap();
|
|
1338
1288
|
SdGridFilterService.decorators = [
|
|
1339
1289
|
{ type: Injectable }
|
|
1340
1290
|
];
|
|
@@ -1413,7 +1363,7 @@ class SdGridMaterial {
|
|
|
1413
1363
|
});
|
|
1414
1364
|
_filterExportInfo.set(this, (pageNumber, pageSize) => {
|
|
1415
1365
|
var _a, _b;
|
|
1416
|
-
const { columnFilter, externalFilter, filterDef } = this.filterRegister.get();
|
|
1366
|
+
const { columnFilter, externalFilter, filterDef } = this.filterRegister.value.get();
|
|
1417
1367
|
return {
|
|
1418
1368
|
rawColumnFilter: columnFilter || {},
|
|
1419
1369
|
rawExternalFilter: externalFilter || {},
|
|
@@ -1439,18 +1389,20 @@ class SdGridMaterial {
|
|
|
1439
1389
|
_loadFilterRegister.set(this, () => {
|
|
1440
1390
|
var _a, _b, _c, _d, _e;
|
|
1441
1391
|
// Init filter
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.filterRegister.observer.pipe(debounceTime(500), map((configuration) => {
|
|
1448
|
-
this.columnFilter = configuration.columnFilter;
|
|
1449
|
-
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1450
|
-
__classPrivateFieldGet(this, _reload).next({
|
|
1451
|
-
force: false,
|
|
1392
|
+
if (this.gridOption) {
|
|
1393
|
+
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, {
|
|
1394
|
+
columns: (_c = this.gridOption) === null || _c === void 0 ? void 0 : _c.columns,
|
|
1395
|
+
externalFilters: (_e = (_d = this.gridOption) === null || _d === void 0 ? void 0 : _d.filter) === null || _e === void 0 ? void 0 : _e.externalFilters,
|
|
1396
|
+
filterDefs: this.filterDefs
|
|
1452
1397
|
});
|
|
1453
|
-
|
|
1398
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.filterRegister.value.observer.pipe(debounceTime(500), map((filterValue) => {
|
|
1399
|
+
this.columnFilter = filterValue.columnFilter;
|
|
1400
|
+
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1401
|
+
__classPrivateFieldGet(this, _reload).next({
|
|
1402
|
+
force: false,
|
|
1403
|
+
});
|
|
1404
|
+
})).subscribe());
|
|
1405
|
+
}
|
|
1454
1406
|
});
|
|
1455
1407
|
_filterLocal.set(this, (localItems, filterInfo) => {
|
|
1456
1408
|
const { columns } = this.gridOption;
|
|
@@ -1570,7 +1522,7 @@ class SdGridMaterial {
|
|
|
1570
1522
|
});
|
|
1571
1523
|
_getFilter.set(this, () => {
|
|
1572
1524
|
var _a, _b, _c, _d, _e, _f;
|
|
1573
|
-
const { columnFilter, externalFilter, filterDef } = this.filterRegister.get();
|
|
1525
|
+
const { columnFilter, externalFilter, filterDef } = this.filterRegister.value.get();
|
|
1574
1526
|
return {
|
|
1575
1527
|
rawColumnFilter: columnFilter || {},
|
|
1576
1528
|
rawExternalFilter: externalFilter || {},
|
|
@@ -2007,15 +1959,11 @@ class SdGridMaterial {
|
|
|
2007
1959
|
this.ref.detectChanges();
|
|
2008
1960
|
});
|
|
2009
1961
|
this.clearFilter = () => {
|
|
2010
|
-
this.filterRegister.remove();
|
|
2011
|
-
// if (this.gridOption?.filter?.inlineColumn) {
|
|
2012
|
-
// this.columnFilter = {};
|
|
2013
|
-
// }
|
|
2014
|
-
// this.gridFilter?.onClearFilter();
|
|
1962
|
+
this.filterRegister.value.remove();
|
|
2015
1963
|
};
|
|
2016
1964
|
this.setFilter = (args) => {
|
|
2017
1965
|
const { columnFilter, externalFilter, filterDef } = args || {};
|
|
2018
|
-
this.filterRegister.set({
|
|
1966
|
+
this.filterRegister.value.set({
|
|
2019
1967
|
columnFilter,
|
|
2020
1968
|
externalFilter,
|
|
2021
1969
|
filterDef
|
|
@@ -2342,7 +2290,7 @@ _optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new We
|
|
|
2342
2290
|
SdGridMaterial.decorators = [
|
|
2343
2291
|
{ type: Component, args: [{
|
|
2344
2292
|
selector: 'sd-grid-material',
|
|
2345
|
-
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>",
|
|
2293
|
+
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\" [externalFilters]=\"gridOption?.filter?.externalFilters\" [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>",
|
|
2346
2294
|
animations: [
|
|
2347
2295
|
trigger('detailExpand', [
|
|
2348
2296
|
state('collapsed', style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
@@ -2773,7 +2721,7 @@ SdGridConfigurationResultPipe.ctorParameters = () => [
|
|
|
2773
2721
|
{ type: SdGridConfigurationService }
|
|
2774
2722
|
];
|
|
2775
2723
|
|
|
2776
|
-
var _cache$
|
|
2724
|
+
var _cache$3;
|
|
2777
2725
|
class SdPopupGridConfiguration {
|
|
2778
2726
|
constructor(ref, notifyService, translateService, gridConfigurationService) {
|
|
2779
2727
|
this.ref = ref;
|
|
@@ -2781,24 +2729,24 @@ class SdPopupGridConfiguration {
|
|
|
2781
2729
|
this.translateService = translateService;
|
|
2782
2730
|
this.gridConfigurationService = gridConfigurationService;
|
|
2783
2731
|
this.changes = new EventEmitter();
|
|
2784
|
-
_cache$
|
|
2732
|
+
_cache$3.set(this, void 0);
|
|
2785
2733
|
this.isCreatingColumn = false;
|
|
2786
2734
|
this.selected = {};
|
|
2787
2735
|
this.disabledDrag = true;
|
|
2788
2736
|
this.open = () => __awaiter(this, void 0, void 0, function* () {
|
|
2789
|
-
__classPrivateFieldSet(this, _cache$
|
|
2790
|
-
this.configuration = yield __classPrivateFieldGet(this, _cache$
|
|
2737
|
+
__classPrivateFieldSet(this, _cache$3, this.gridConfigurationService.init(this.key, this.gridOption));
|
|
2738
|
+
this.configuration = yield __classPrivateFieldGet(this, _cache$3).get();
|
|
2791
2739
|
this.modal.open();
|
|
2792
2740
|
});
|
|
2793
2741
|
this.onSave = () => {
|
|
2794
|
-
__classPrivateFieldGet(this, _cache$
|
|
2742
|
+
__classPrivateFieldGet(this, _cache$3).set(this.configuration);
|
|
2795
2743
|
this.modal.close();
|
|
2796
2744
|
this.ref.detectChanges();
|
|
2797
2745
|
};
|
|
2798
2746
|
this.onReset = () => __awaiter(this, void 0, void 0, function* () {
|
|
2799
2747
|
const { translate } = this.translateService;
|
|
2800
2748
|
this.notifyService.confirm(translate('Reset grid configuration to default')).then(() => {
|
|
2801
|
-
__classPrivateFieldGet(this, _cache$
|
|
2749
|
+
__classPrivateFieldGet(this, _cache$3).remove();
|
|
2802
2750
|
this.modal.close();
|
|
2803
2751
|
this.ref.detectChanges();
|
|
2804
2752
|
});
|
|
@@ -2822,7 +2770,7 @@ class SdPopupGridConfiguration {
|
|
|
2822
2770
|
generatedColumns: this.configuration.columns.filter(e => { var _a; return this.selected[(_a = e.origin) === null || _a === void 0 ? void 0 : _a.field]; }).map(e => { var _a; return (_a = e.origin) === null || _a === void 0 ? void 0 : _a.field; })
|
|
2823
2771
|
};
|
|
2824
2772
|
this.configuration.columns.push(generatedColumn);
|
|
2825
|
-
this.configuration = __classPrivateFieldGet(this, _cache$
|
|
2773
|
+
this.configuration = __classPrivateFieldGet(this, _cache$3).set(this.configuration);
|
|
2826
2774
|
this.isCreatingColumn = false;
|
|
2827
2775
|
});
|
|
2828
2776
|
}
|
|
@@ -2842,7 +2790,7 @@ class SdPopupGridConfiguration {
|
|
|
2842
2790
|
this.disabledDrag = true;
|
|
2843
2791
|
}
|
|
2844
2792
|
}
|
|
2845
|
-
_cache$
|
|
2793
|
+
_cache$3 = new WeakMap();
|
|
2846
2794
|
SdPopupGridConfiguration.decorators = [
|
|
2847
2795
|
{ type: Component, args: [{
|
|
2848
2796
|
selector: 'sd-popup-grid-configuration',
|
|
@@ -3034,11 +2982,11 @@ SdSelectionVisibleSelectAllPipe.decorators = [
|
|
|
3034
2982
|
},] }
|
|
3035
2983
|
];
|
|
3036
2984
|
|
|
3037
|
-
var _cache$
|
|
2985
|
+
var _cache$4;
|
|
3038
2986
|
class SdGeneratedColumnService {
|
|
3039
2987
|
constructor(settingService) {
|
|
3040
2988
|
this.settingService = settingService;
|
|
3041
|
-
_cache$
|
|
2989
|
+
_cache$4.set(this, {});
|
|
3042
2990
|
this.load = (configuration) => {
|
|
3043
2991
|
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.key)) {
|
|
3044
2992
|
return null;
|
|
@@ -3047,22 +2995,22 @@ class SdGeneratedColumnService {
|
|
|
3047
2995
|
prefix: '260f5e94-5865-4425-8ced-b9c083c390dd',
|
|
3048
2996
|
key: configuration.key
|
|
3049
2997
|
});
|
|
3050
|
-
if (!__classPrivateFieldGet(this, _cache$
|
|
2998
|
+
if (!__classPrivateFieldGet(this, _cache$4)[key]) {
|
|
3051
2999
|
if ((configuration === null || configuration === void 0 ? void 0 : configuration.storage) === 'server') {
|
|
3052
|
-
__classPrivateFieldGet(this, _cache$
|
|
3000
|
+
__classPrivateFieldGet(this, _cache$4)[key] = this.settingService.createServer(key, {
|
|
3053
3001
|
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
3054
3002
|
default: []
|
|
3055
3003
|
});
|
|
3056
3004
|
}
|
|
3057
3005
|
else {
|
|
3058
|
-
__classPrivateFieldGet(this, _cache$
|
|
3006
|
+
__classPrivateFieldGet(this, _cache$4)[key] = this.settingService.create(key, {
|
|
3059
3007
|
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
3060
3008
|
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
3061
3009
|
default: []
|
|
3062
3010
|
});
|
|
3063
3011
|
}
|
|
3064
3012
|
}
|
|
3065
|
-
return __classPrivateFieldGet(this, _cache$
|
|
3013
|
+
return __classPrivateFieldGet(this, _cache$4)[key];
|
|
3066
3014
|
};
|
|
3067
3015
|
this.loadSystem = (configuration) => {
|
|
3068
3016
|
var _a, _b;
|
|
@@ -3076,26 +3024,26 @@ class SdGeneratedColumnService {
|
|
|
3076
3024
|
prefix: '8b8050ca-1f44-4860-bad3-20e646c0d68f',
|
|
3077
3025
|
key: configuration.key
|
|
3078
3026
|
});
|
|
3079
|
-
if (!__classPrivateFieldGet(this, _cache$
|
|
3027
|
+
if (!__classPrivateFieldGet(this, _cache$4)[key]) {
|
|
3080
3028
|
if ((configuration === null || configuration === void 0 ? void 0 : configuration.storage) === 'server') {
|
|
3081
|
-
__classPrivateFieldGet(this, _cache$
|
|
3029
|
+
__classPrivateFieldGet(this, _cache$4)[key] = this.settingService.createServer(key, {
|
|
3082
3030
|
args: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _a === void 0 ? void 0 : _a.args,
|
|
3083
3031
|
default: []
|
|
3084
3032
|
});
|
|
3085
3033
|
}
|
|
3086
3034
|
else {
|
|
3087
|
-
__classPrivateFieldGet(this, _cache$
|
|
3035
|
+
__classPrivateFieldGet(this, _cache$4)[key] = this.settingService.create(key, {
|
|
3088
3036
|
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
3089
3037
|
args: (_b = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _b === void 0 ? void 0 : _b.args,
|
|
3090
3038
|
default: []
|
|
3091
3039
|
});
|
|
3092
3040
|
}
|
|
3093
3041
|
}
|
|
3094
|
-
return __classPrivateFieldGet(this, _cache$
|
|
3042
|
+
return __classPrivateFieldGet(this, _cache$4)[key];
|
|
3095
3043
|
};
|
|
3096
3044
|
}
|
|
3097
3045
|
}
|
|
3098
|
-
_cache$
|
|
3046
|
+
_cache$4 = new WeakMap();
|
|
3099
3047
|
SdGeneratedColumnService.decorators = [
|
|
3100
3048
|
{ type: Injectable }
|
|
3101
3049
|
];
|