@sd-angular/core 1.3.99 → 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 +215 -249
- 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 +13 -53
- 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 +18 -20
- 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 +184 -239
- 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 +0 -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.99.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,20 +234,15 @@ 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
|
}
|
|
@@ -280,53 +258,19 @@ class SdGridFilter {
|
|
|
280
258
|
}
|
|
281
259
|
;
|
|
282
260
|
ngAfterViewInit() {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
// this.filterChange.next(true);
|
|
295
|
-
// this.ref.markForCheck();
|
|
296
|
-
// }));
|
|
297
|
-
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegisterChange.pipe(startWith(this.filterRegister)).subscribe(() => {
|
|
298
|
-
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.observer.subscribe(configuration => {
|
|
299
|
-
this.inlineColumn = configuration.inlineColumn;
|
|
300
|
-
this.columnFilter = configuration.columnFilter;
|
|
301
|
-
this.inlineExternal = configuration.inlineExternal;
|
|
302
|
-
this.externalFilter = configuration.externalFilter;
|
|
303
|
-
this.inlineFilterDef = configuration.inlineFilterDef;
|
|
304
|
-
this.filterDef = configuration.filterDef;
|
|
305
|
-
this.ref.markForCheck();
|
|
306
|
-
}));
|
|
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();
|
|
307
272
|
}));
|
|
308
273
|
}
|
|
309
|
-
// #loadDefault = () => {
|
|
310
|
-
// for (const column of this.columns) {
|
|
311
|
-
// this.inlineColumn[column.field] = this.inlineColumn[column.field] ?? column?.filter?.defaultShowing;
|
|
312
|
-
// this.columnFilter[column.field] = this.columnFilter[column.field] ?? column?.filter?.default;
|
|
313
|
-
// }
|
|
314
|
-
// for (const externalFilter of this.externalFilters) {
|
|
315
|
-
// this.inlineExternal[externalFilter.field] = this.inlineExternal[externalFilter.field] ?? externalFilter?.defaultShowing;
|
|
316
|
-
// if (externalFilter.type === 'daterange') {
|
|
317
|
-
// this.externalFilter[externalFilter.field] = {
|
|
318
|
-
// from: this.externalFilter[externalFilter.field]?.from ?? externalFilter.default?.from ?? undefined,
|
|
319
|
-
// to: this.externalFilter[externalFilter.field]?.to ?? externalFilter.default?.to ?? undefined
|
|
320
|
-
// };
|
|
321
|
-
// } else {
|
|
322
|
-
// this.externalFilter[externalFilter.field] = this.externalFilter[externalFilter.field] ?? externalFilter.default;
|
|
323
|
-
// }
|
|
324
|
-
// }
|
|
325
|
-
// for (const filterDef of this.filterDefs) {
|
|
326
|
-
// this.inlineFilterDef[filterDef.sdMaterialFilterDef] =
|
|
327
|
-
// this.inlineFilterDef[filterDef.sdMaterialFilterDef] ?? filterDef?.defaultShowing;
|
|
328
|
-
// }
|
|
329
|
-
// }
|
|
330
274
|
ngOnDestroy() {
|
|
331
275
|
__classPrivateFieldGet(this, _subscription$1).unsubscribe();
|
|
332
276
|
}
|
|
@@ -1184,160 +1128,163 @@ SdEditorHandlerColumnPipe.ctorParameters = () => [
|
|
|
1184
1128
|
{ type: NgZone }
|
|
1185
1129
|
];
|
|
1186
1130
|
|
|
1187
|
-
var
|
|
1131
|
+
var _filterConfiguration, _filterValue, _cache$2, _loadDefaultConfiguration, _loadDefaultValue;
|
|
1188
1132
|
class SdGridFilterService {
|
|
1189
1133
|
constructor(settingService) {
|
|
1190
1134
|
this.settingService = settingService;
|
|
1191
|
-
|
|
1135
|
+
_filterConfiguration.set(this, 'GRID-FILTER-CONFIGURATION');
|
|
1136
|
+
_filterValue.set(this, 'GRID-FILTER-VALUE');
|
|
1137
|
+
_cache$2.set(this, {});
|
|
1192
1138
|
this.register = (key, args) => {
|
|
1193
1139
|
let cacheSession = false;
|
|
1194
1140
|
if (!key) {
|
|
1195
|
-
|
|
1141
|
+
const { columns, externalFilters } = args;
|
|
1142
|
+
key = hash({
|
|
1143
|
+
columns,
|
|
1144
|
+
externalFilters
|
|
1145
|
+
});
|
|
1196
1146
|
cacheSession = true; // Nếu không có key thì chỉ lưu theo session
|
|
1197
1147
|
}
|
|
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
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
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];
|
|
1249
1231
|
};
|
|
1250
|
-
|
|
1251
|
-
var _a, _b, _c, _d
|
|
1232
|
+
_loadDefaultConfiguration.set(this, (args) => {
|
|
1233
|
+
var _a, _b, _c, _d;
|
|
1252
1234
|
const { columns, externalFilters, filterDefs } = args;
|
|
1253
1235
|
const inlineColumn = {};
|
|
1254
|
-
const columnFilter = {};
|
|
1255
1236
|
const inlineExternal = {};
|
|
1256
|
-
const externalFilter = {};
|
|
1257
1237
|
const inlineFilterDef = {};
|
|
1258
|
-
const filterDef = {};
|
|
1259
1238
|
// Filter column
|
|
1260
1239
|
for (const item of (columns || [])) {
|
|
1261
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;
|
|
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
1241
|
}
|
|
1264
1242
|
// Filter external
|
|
1265
1243
|
for (const item of (externalFilters || [])) {
|
|
1266
|
-
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 || [])) {
|
|
1267
1268
|
if (item.type === 'daterange') {
|
|
1268
1269
|
externalFilter[item.field] = {
|
|
1269
|
-
from: (
|
|
1270
|
-
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
|
|
1271
1272
|
};
|
|
1272
1273
|
}
|
|
1273
1274
|
else {
|
|
1274
|
-
externalFilter[item.field] = (
|
|
1275
|
+
externalFilter[item.field] = (_l = externalFilter[item.field]) !== null && _l !== void 0 ? _l : item.default;
|
|
1275
1276
|
}
|
|
1276
1277
|
}
|
|
1277
1278
|
// 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
1279
|
return {
|
|
1282
|
-
quickFilters: [],
|
|
1283
|
-
selectedQuickFilter: null,
|
|
1284
|
-
inlineColumn,
|
|
1285
1280
|
columnFilter,
|
|
1286
|
-
inlineExternal,
|
|
1287
1281
|
externalFilter,
|
|
1288
|
-
inlineFilterDef,
|
|
1289
1282
|
filterDef,
|
|
1290
1283
|
};
|
|
1291
1284
|
});
|
|
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
1285
|
}
|
|
1339
1286
|
}
|
|
1340
|
-
|
|
1287
|
+
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(), _loadDefaultConfiguration = new WeakMap(), _loadDefaultValue = new WeakMap();
|
|
1341
1288
|
SdGridFilterService.decorators = [
|
|
1342
1289
|
{ type: Injectable }
|
|
1343
1290
|
];
|
|
@@ -1416,7 +1363,7 @@ class SdGridMaterial {
|
|
|
1416
1363
|
});
|
|
1417
1364
|
_filterExportInfo.set(this, (pageNumber, pageSize) => {
|
|
1418
1365
|
var _a, _b;
|
|
1419
|
-
const { columnFilter, externalFilter, filterDef } = this.filterRegister.get();
|
|
1366
|
+
const { columnFilter, externalFilter, filterDef } = this.filterRegister.value.get();
|
|
1420
1367
|
return {
|
|
1421
1368
|
rawColumnFilter: columnFilter || {},
|
|
1422
1369
|
rawExternalFilter: externalFilter || {},
|
|
@@ -1442,18 +1389,20 @@ class SdGridMaterial {
|
|
|
1442
1389
|
_loadFilterRegister.set(this, () => {
|
|
1443
1390
|
var _a, _b, _c, _d, _e;
|
|
1444
1391
|
// Init filter
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.filterRegister.observer.pipe(debounceTime(500), map((configuration) => {
|
|
1451
|
-
this.columnFilter = configuration.columnFilter;
|
|
1452
|
-
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1453
|
-
__classPrivateFieldGet(this, _reload).next({
|
|
1454
|
-
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
|
|
1455
1397
|
});
|
|
1456
|
-
|
|
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
|
+
}
|
|
1457
1406
|
});
|
|
1458
1407
|
_filterLocal.set(this, (localItems, filterInfo) => {
|
|
1459
1408
|
const { columns } = this.gridOption;
|
|
@@ -1573,7 +1522,7 @@ class SdGridMaterial {
|
|
|
1573
1522
|
});
|
|
1574
1523
|
_getFilter.set(this, () => {
|
|
1575
1524
|
var _a, _b, _c, _d, _e, _f;
|
|
1576
|
-
const { columnFilter, externalFilter, filterDef } = this.filterRegister.get();
|
|
1525
|
+
const { columnFilter, externalFilter, filterDef } = this.filterRegister.value.get();
|
|
1577
1526
|
return {
|
|
1578
1527
|
rawColumnFilter: columnFilter || {},
|
|
1579
1528
|
rawExternalFilter: externalFilter || {},
|
|
@@ -2010,15 +1959,11 @@ class SdGridMaterial {
|
|
|
2010
1959
|
this.ref.detectChanges();
|
|
2011
1960
|
});
|
|
2012
1961
|
this.clearFilter = () => {
|
|
2013
|
-
this.filterRegister.remove();
|
|
2014
|
-
// if (this.gridOption?.filter?.inlineColumn) {
|
|
2015
|
-
// this.columnFilter = {};
|
|
2016
|
-
// }
|
|
2017
|
-
// this.gridFilter?.onClearFilter();
|
|
1962
|
+
this.filterRegister.value.remove();
|
|
2018
1963
|
};
|
|
2019
1964
|
this.setFilter = (args) => {
|
|
2020
1965
|
const { columnFilter, externalFilter, filterDef } = args || {};
|
|
2021
|
-
this.filterRegister.set({
|
|
1966
|
+
this.filterRegister.value.set({
|
|
2022
1967
|
columnFilter,
|
|
2023
1968
|
externalFilter,
|
|
2024
1969
|
filterDef
|
|
@@ -2776,7 +2721,7 @@ SdGridConfigurationResultPipe.ctorParameters = () => [
|
|
|
2776
2721
|
{ type: SdGridConfigurationService }
|
|
2777
2722
|
];
|
|
2778
2723
|
|
|
2779
|
-
var _cache$
|
|
2724
|
+
var _cache$3;
|
|
2780
2725
|
class SdPopupGridConfiguration {
|
|
2781
2726
|
constructor(ref, notifyService, translateService, gridConfigurationService) {
|
|
2782
2727
|
this.ref = ref;
|
|
@@ -2784,24 +2729,24 @@ class SdPopupGridConfiguration {
|
|
|
2784
2729
|
this.translateService = translateService;
|
|
2785
2730
|
this.gridConfigurationService = gridConfigurationService;
|
|
2786
2731
|
this.changes = new EventEmitter();
|
|
2787
|
-
_cache$
|
|
2732
|
+
_cache$3.set(this, void 0);
|
|
2788
2733
|
this.isCreatingColumn = false;
|
|
2789
2734
|
this.selected = {};
|
|
2790
2735
|
this.disabledDrag = true;
|
|
2791
2736
|
this.open = () => __awaiter(this, void 0, void 0, function* () {
|
|
2792
|
-
__classPrivateFieldSet(this, _cache$
|
|
2793
|
-
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();
|
|
2794
2739
|
this.modal.open();
|
|
2795
2740
|
});
|
|
2796
2741
|
this.onSave = () => {
|
|
2797
|
-
__classPrivateFieldGet(this, _cache$
|
|
2742
|
+
__classPrivateFieldGet(this, _cache$3).set(this.configuration);
|
|
2798
2743
|
this.modal.close();
|
|
2799
2744
|
this.ref.detectChanges();
|
|
2800
2745
|
};
|
|
2801
2746
|
this.onReset = () => __awaiter(this, void 0, void 0, function* () {
|
|
2802
2747
|
const { translate } = this.translateService;
|
|
2803
2748
|
this.notifyService.confirm(translate('Reset grid configuration to default')).then(() => {
|
|
2804
|
-
__classPrivateFieldGet(this, _cache$
|
|
2749
|
+
__classPrivateFieldGet(this, _cache$3).remove();
|
|
2805
2750
|
this.modal.close();
|
|
2806
2751
|
this.ref.detectChanges();
|
|
2807
2752
|
});
|
|
@@ -2825,7 +2770,7 @@ class SdPopupGridConfiguration {
|
|
|
2825
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; })
|
|
2826
2771
|
};
|
|
2827
2772
|
this.configuration.columns.push(generatedColumn);
|
|
2828
|
-
this.configuration = __classPrivateFieldGet(this, _cache$
|
|
2773
|
+
this.configuration = __classPrivateFieldGet(this, _cache$3).set(this.configuration);
|
|
2829
2774
|
this.isCreatingColumn = false;
|
|
2830
2775
|
});
|
|
2831
2776
|
}
|
|
@@ -2845,7 +2790,7 @@ class SdPopupGridConfiguration {
|
|
|
2845
2790
|
this.disabledDrag = true;
|
|
2846
2791
|
}
|
|
2847
2792
|
}
|
|
2848
|
-
_cache$
|
|
2793
|
+
_cache$3 = new WeakMap();
|
|
2849
2794
|
SdPopupGridConfiguration.decorators = [
|
|
2850
2795
|
{ type: Component, args: [{
|
|
2851
2796
|
selector: 'sd-popup-grid-configuration',
|
|
@@ -3037,11 +2982,11 @@ SdSelectionVisibleSelectAllPipe.decorators = [
|
|
|
3037
2982
|
},] }
|
|
3038
2983
|
];
|
|
3039
2984
|
|
|
3040
|
-
var _cache$
|
|
2985
|
+
var _cache$4;
|
|
3041
2986
|
class SdGeneratedColumnService {
|
|
3042
2987
|
constructor(settingService) {
|
|
3043
2988
|
this.settingService = settingService;
|
|
3044
|
-
_cache$
|
|
2989
|
+
_cache$4.set(this, {});
|
|
3045
2990
|
this.load = (configuration) => {
|
|
3046
2991
|
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.key)) {
|
|
3047
2992
|
return null;
|
|
@@ -3050,22 +2995,22 @@ class SdGeneratedColumnService {
|
|
|
3050
2995
|
prefix: '260f5e94-5865-4425-8ced-b9c083c390dd',
|
|
3051
2996
|
key: configuration.key
|
|
3052
2997
|
});
|
|
3053
|
-
if (!__classPrivateFieldGet(this, _cache$
|
|
2998
|
+
if (!__classPrivateFieldGet(this, _cache$4)[key]) {
|
|
3054
2999
|
if ((configuration === null || configuration === void 0 ? void 0 : configuration.storage) === 'server') {
|
|
3055
|
-
__classPrivateFieldGet(this, _cache$
|
|
3000
|
+
__classPrivateFieldGet(this, _cache$4)[key] = this.settingService.createServer(key, {
|
|
3056
3001
|
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
3057
3002
|
default: []
|
|
3058
3003
|
});
|
|
3059
3004
|
}
|
|
3060
3005
|
else {
|
|
3061
|
-
__classPrivateFieldGet(this, _cache$
|
|
3006
|
+
__classPrivateFieldGet(this, _cache$4)[key] = this.settingService.create(key, {
|
|
3062
3007
|
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
3063
3008
|
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
3064
3009
|
default: []
|
|
3065
3010
|
});
|
|
3066
3011
|
}
|
|
3067
3012
|
}
|
|
3068
|
-
return __classPrivateFieldGet(this, _cache$
|
|
3013
|
+
return __classPrivateFieldGet(this, _cache$4)[key];
|
|
3069
3014
|
};
|
|
3070
3015
|
this.loadSystem = (configuration) => {
|
|
3071
3016
|
var _a, _b;
|
|
@@ -3079,26 +3024,26 @@ class SdGeneratedColumnService {
|
|
|
3079
3024
|
prefix: '8b8050ca-1f44-4860-bad3-20e646c0d68f',
|
|
3080
3025
|
key: configuration.key
|
|
3081
3026
|
});
|
|
3082
|
-
if (!__classPrivateFieldGet(this, _cache$
|
|
3027
|
+
if (!__classPrivateFieldGet(this, _cache$4)[key]) {
|
|
3083
3028
|
if ((configuration === null || configuration === void 0 ? void 0 : configuration.storage) === 'server') {
|
|
3084
|
-
__classPrivateFieldGet(this, _cache$
|
|
3029
|
+
__classPrivateFieldGet(this, _cache$4)[key] = this.settingService.createServer(key, {
|
|
3085
3030
|
args: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _a === void 0 ? void 0 : _a.args,
|
|
3086
3031
|
default: []
|
|
3087
3032
|
});
|
|
3088
3033
|
}
|
|
3089
3034
|
else {
|
|
3090
|
-
__classPrivateFieldGet(this, _cache$
|
|
3035
|
+
__classPrivateFieldGet(this, _cache$4)[key] = this.settingService.create(key, {
|
|
3091
3036
|
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
3092
3037
|
args: (_b = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _b === void 0 ? void 0 : _b.args,
|
|
3093
3038
|
default: []
|
|
3094
3039
|
});
|
|
3095
3040
|
}
|
|
3096
3041
|
}
|
|
3097
|
-
return __classPrivateFieldGet(this, _cache$
|
|
3042
|
+
return __classPrivateFieldGet(this, _cache$4)[key];
|
|
3098
3043
|
};
|
|
3099
3044
|
}
|
|
3100
3045
|
}
|
|
3101
|
-
_cache$
|
|
3046
|
+
_cache$4 = new WeakMap();
|
|
3102
3047
|
SdGeneratedColumnService.decorators = [
|
|
3103
3048
|
{ type: Injectable }
|
|
3104
3049
|
];
|