@sd-angular/core 1.3.103 → 1.3.105
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 +296 -149
- 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/bundles/sd-angular-core-setting.umd.js +21 -25
- package/bundles/sd-angular-core-setting.umd.js.map +1 -1
- package/bundles/sd-angular-core-setting.umd.min.js +1 -1
- package/bundles/sd-angular-core-setting.umd.min.js.map +1 -1
- package/esm2015/grid-material/src/lib/components/grid-filter/grid-filter.component.js +20 -19
- package/esm2015/grid-material/src/lib/grid-material.component.js +73 -56
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.service.js +126 -68
- package/esm2015/setting/src/lib/setting.service.js +22 -26
- package/fesm2015/sd-angular-core-grid-material.js +212 -137
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-setting.js +21 -25
- package/fesm2015/sd-angular-core-setting.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/components/grid-filter/grid-filter.component.d.ts +7 -7
- package/grid-material/src/lib/grid-material.component.d.ts +3 -3
- package/grid-material/src/lib/services/grid-filter/grid-filter.service.d.ts +4 -4
- package/package.json +1 -1
- package/{sd-angular-core-1.3.103.tgz → sd-angular-core-1.3.105.tgz} +0 -0
- package/setting/sd-angular-core-setting.metadata.json +1 -1
|
@@ -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 { debounceTime, map, switchMap
|
|
11
|
+
import { startWith, debounceTime, map, switchMap } 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';
|
|
@@ -237,7 +237,7 @@ class SdGridFilter {
|
|
|
237
237
|
this.filterRegister.value.set({
|
|
238
238
|
columnFilter: this.columnFilter,
|
|
239
239
|
externalFilter: this.externalFilter,
|
|
240
|
-
filterDef: this.filterDef
|
|
240
|
+
filterDef: this.filterDef,
|
|
241
241
|
});
|
|
242
242
|
};
|
|
243
243
|
this.open = () => {
|
|
@@ -256,18 +256,19 @@ class SdGridFilter {
|
|
|
256
256
|
this.filterRegister = value;
|
|
257
257
|
this.filterRegisterChange.next(this.filterRegister);
|
|
258
258
|
}
|
|
259
|
-
;
|
|
260
259
|
ngAfterViewInit() {
|
|
261
|
-
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.configuration.observer.subscribe(configuration => {
|
|
262
|
-
|
|
263
|
-
this.
|
|
264
|
-
this.
|
|
260
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.configuration.observer.subscribe((configuration) => {
|
|
261
|
+
const { inlineColumn, inlineExternal, inlineFilterDef } = configuration;
|
|
262
|
+
this.inlineColumn = inlineColumn;
|
|
263
|
+
this.inlineExternal = inlineExternal;
|
|
264
|
+
this.inlineFilterDef = inlineFilterDef;
|
|
265
265
|
this.ref.markForCheck();
|
|
266
266
|
}));
|
|
267
|
-
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.value.observer.subscribe(value => {
|
|
268
|
-
|
|
269
|
-
this.
|
|
270
|
-
this.
|
|
267
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.value.observer.subscribe((value) => {
|
|
268
|
+
const { columnFilter, externalFilter, filterDef } = value;
|
|
269
|
+
this.columnFilter = columnFilter;
|
|
270
|
+
this.externalFilter = externalFilter;
|
|
271
|
+
this.filterDef = filterDef;
|
|
271
272
|
this.ref.markForCheck();
|
|
272
273
|
}));
|
|
273
274
|
}
|
|
@@ -278,7 +279,7 @@ class SdGridFilter {
|
|
|
278
279
|
_subscription$1 = new WeakMap();
|
|
279
280
|
SdGridFilter.decorators = [
|
|
280
281
|
{ type: Component, args: [{
|
|
281
|
-
selector:
|
|
282
|
+
selector: "sd-grid-filter",
|
|
282
283
|
template: "<ng-container *ngIf=\"!filter?.disabled\">\r\n <ng-container *ngIf=\"filter?.enableCollapse;else noCollapse\">\r\n <sd-group class=\"p-12\" [isExpanded]=\"false\" title=\"T\u00ECm ki\u1EBFm\" expandable>\r\n <div sdGroupBody>\r\n <ng-container *ngTemplateOutlet=\"noCollapse\"></ng-container>\r\n </div>\r\n </sd-group>\r\n </ng-container>\r\n <ng-template #noCollapse>\r\n <div\r\n *ngIf=\"!isMobileOrTablet && ((columns?.length && !filter?.inlineColumn) || externalFilters?.length || filterDefs?.length)\"\r\n class=\"row mx-0\">\r\n <ng-container *ngIf=\"filter?.sorts?.length\">\r\n <ng-container *ngFor=\"let field of filter?.sorts\">\r\n <ng-container *ngIf=\"columns?.length && !filter?.inlineColumn\">\r\n <ng-container *ngFor=\"let item of columns | sdFilterColumn:field\">\r\n <ng-container *ngTemplateOutlet=\"filterColumn; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"externalFilters?.length\">\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal:field\">\r\n <ng-container *ngTemplateOutlet=\"filterExternal; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of filterDefs\">\r\n <div *ngIf=\"inlineFilterDef[item.sdMaterialFilterDef] && item.sdMaterialFilterDef === field\"\r\n class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <ng-container *ngTemplateOutlet=\"item.templateRef;context:{filterDef:filterDef, isInline: true}\">\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!filter?.sorts?.length\">\r\n <ng-container *ngIf=\"columns?.length && !filter?.inlineColumn\">\r\n <ng-container *ngFor=\"let item of columns | sdFilterColumn\">\r\n <ng-container *ngTemplateOutlet=\"filterColumn; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"externalFilters?.length\">\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal\">\r\n <ng-container *ngTemplateOutlet=\"filterExternal; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of filterDefs\">\r\n <div *ngIf=\"inlineFilterDef[item.sdMaterialFilterDef]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <ng-container *ngTemplateOutlet=\"item.templateRef;context:{filterDef:filterDef, isInline: true}\">\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <ng-template #filterColumn let-item=\"item\">\r\n <div *ngIf=\"inlineColumn[item.field]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <sd-input [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\" [(model)]=\"columnFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"columnFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.option?.displayOnTrue || 'True' },\r\n {value:'0',display:item.option?.displayOnFalse || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n <sd-select *ngIf=\"item.type === 'values' && item?.option?.selection !== 'AUTOCOMPLETE'\"\r\n [items]=\"item.option?.items\" [valueField]=\"item.option?.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" [disabled]=\"item.filter?.disabled\"\r\n [multiple]=\"item?.option?.selection === 'MULTIPLE' || item?.item?.selection === 'MULTIPLEAUTOCOMPLETE'\"\r\n [filtered]=\"item?.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" appearance=\"outline\">\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"item.type === 'values' && item?.option?.selection === 'AUTOCOMPLETE'\"\r\n [items]=\"item.option?.items\" [valueField]=\"item.option?.valueField\" [displayField]=\"item.option?.displayField\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" [disabled]=\"item.filter?.disabled\"\r\n appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-date-time *ngIf=\"item.type === 'date' || item.type === 'datetime' || item.type === 'time'\"\r\n [label]=\"item.title\" [(model)]=\"columnFilter[item.field]\" [type]=\"item.type\" (sdChange)=\"onFilter(item)\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n </div>\r\n </ng-template>\r\n <ng-template #filterExternal let-item=\"item\">\r\n <div *ngIf=\"inlineExternal[item.field]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <sd-input [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\" [(model)]=\"externalFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"externalFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.option?.displayOnTrue || 'True' },\r\n {value:'0',display:item.option?.displayOnFalse || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n <ng-container *ngIf=\"item.type === 'values' && item.option\">\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLE'\" [label]=\"item.title\" [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" [selectAll]=\"item.option.selectAll\"\r\n appearance=\"outline\" multiple>\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"item.option?.selection === 'AUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item.option.items\" [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item.option.items\" [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" filtered=\"true\" appearance=\"outline\"\r\n multiple>\r\n </sd-select>\r\n <sd-select *ngIf=\"!item.option?.selection\" [label]=\"item.title\" [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n </ng-container>\r\n <sd-date-time [label]=\"item.title\" *ngIf=\"item.type ==='date' || item.type ==='datetime'\"\r\n [(model)]=\"externalFilter[item.field]\" [type]=\"item.type\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-date-time>\r\n <sd-date-range [label]=\"item.title\" *ngIf=\"item.type ==='daterange' && externalFilter[item.field]\"\r\n [(from)]=\"externalFilter[item.field].from\" [(to)]=\"externalFilter[item.field].to\" [min]=\"item.minDate\"\r\n [max]=\"item.maxDate\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-date-range>\r\n </div>\r\n </ng-template>\r\n <sd-popup-filter [filterRegister]=\"filterRegister\" [columns]=\"columns\"\r\n [externalFilters]=\"externalFilters\" [filterDefs]=\"filterDefs\">\r\n </sd-popup-filter>\r\n </ng-template>\r\n</ng-container>",
|
|
283
284
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
284
285
|
styles: [":host{display:block;padding-bottom:10px;padding-left:0;padding-right:0}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}"]
|
|
@@ -290,11 +291,11 @@ SdGridFilter.ctorParameters = () => [
|
|
|
290
291
|
];
|
|
291
292
|
SdGridFilter.propDecorators = {
|
|
292
293
|
popupFilter: [{ type: ViewChild, args: [SdPopupFilter,] }],
|
|
293
|
-
_filter: [{ type: Input, args: [
|
|
294
|
+
_filter: [{ type: Input, args: ["filter",] }],
|
|
294
295
|
columns: [{ type: Input }],
|
|
295
|
-
_externalFilters: [{ type: Input, args: [
|
|
296
|
+
_externalFilters: [{ type: Input, args: ["externalFilters",] }],
|
|
296
297
|
filterDefs: [{ type: Input }],
|
|
297
|
-
_filterRegister: [{ type: Input, args: [
|
|
298
|
+
_filterRegister: [{ type: Input, args: ["filterRegister",] }]
|
|
298
299
|
};
|
|
299
300
|
|
|
300
301
|
var _getExportableColumns, _getExportableGroups, _getExportColumns, _initTemplate;
|
|
@@ -1128,12 +1129,12 @@ SdEditorHandlerColumnPipe.ctorParameters = () => [
|
|
|
1128
1129
|
{ type: NgZone }
|
|
1129
1130
|
];
|
|
1130
1131
|
|
|
1131
|
-
var _filterConfiguration, _filterValue, _cache$2,
|
|
1132
|
+
var _filterConfiguration, _filterValue, _cache$2, _defaultConfiguration, _defaultValue, _initConfiguration, _initValue;
|
|
1132
1133
|
class SdGridFilterService {
|
|
1133
1134
|
constructor(settingService) {
|
|
1134
1135
|
this.settingService = settingService;
|
|
1135
|
-
_filterConfiguration.set(this,
|
|
1136
|
-
_filterValue.set(this,
|
|
1136
|
+
_filterConfiguration.set(this, "GRID-FILTER-CONFIGURATION");
|
|
1137
|
+
_filterValue.set(this, "GRID-FILTER-VALUE");
|
|
1137
1138
|
_cache$2.set(this, {});
|
|
1138
1139
|
this.register = (key, args) => {
|
|
1139
1140
|
let cacheSession = false;
|
|
@@ -1141,69 +1142,57 @@ class SdGridFilterService {
|
|
|
1141
1142
|
const { columns, externalFilters } = args;
|
|
1142
1143
|
key = hash({
|
|
1143
1144
|
columns,
|
|
1144
|
-
externalFilters
|
|
1145
|
+
externalFilters,
|
|
1145
1146
|
});
|
|
1146
1147
|
cacheSession = true; // Nếu không có key thì chỉ lưu theo session
|
|
1147
1148
|
}
|
|
1148
1149
|
if (!__classPrivateFieldGet(this, _cache$2)[key]) {
|
|
1150
|
+
// Setting của filter configuration
|
|
1149
1151
|
const filterConfiguration = this.settingService.create({
|
|
1150
1152
|
prefix: __classPrivateFieldGet(this, _filterConfiguration),
|
|
1151
|
-
key
|
|
1153
|
+
key,
|
|
1152
1154
|
}, {
|
|
1153
|
-
default: __classPrivateFieldGet(this,
|
|
1154
|
-
type: cacheSession ?
|
|
1155
|
+
default: __classPrivateFieldGet(this, _defaultConfiguration).call(this, args),
|
|
1156
|
+
type: cacheSession ? "session" : undefined,
|
|
1155
1157
|
});
|
|
1158
|
+
// Lấy giá trị configuration merge với giá trị defaultShowing của args nếu như args có thay đổi
|
|
1159
|
+
filterConfiguration.set(__classPrivateFieldGet(this, _initConfiguration).call(this, args, filterConfiguration.get()));
|
|
1160
|
+
// Setting của filter value
|
|
1156
1161
|
const filterValue = this.settingService.create({
|
|
1157
1162
|
prefix: __classPrivateFieldGet(this, _filterValue),
|
|
1158
|
-
key
|
|
1163
|
+
key,
|
|
1159
1164
|
}, {
|
|
1160
|
-
default: __classPrivateFieldGet(this,
|
|
1161
|
-
type: cacheSession ?
|
|
1165
|
+
default: __classPrivateFieldGet(this, _defaultValue).call(this, args),
|
|
1166
|
+
type: cacheSession ? "session" : undefined,
|
|
1162
1167
|
});
|
|
1168
|
+
// Lấy giá trị value merge với giá trị default của args nếu như args có thay đổi
|
|
1169
|
+
filterValue.set(__classPrivateFieldGet(this, _initValue).call(this, args, filterValue.get()));
|
|
1163
1170
|
__classPrivateFieldGet(this, _cache$2)[key] = {
|
|
1164
1171
|
configuration: {
|
|
1165
1172
|
get: () => {
|
|
1166
|
-
|
|
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
|
-
};
|
|
1173
|
+
return filterConfiguration.get();
|
|
1175
1174
|
},
|
|
1176
1175
|
set: (configuration) => {
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
inlineFilterDef
|
|
1176
|
+
const { inlineColumn, inlineExternal, inlineFilterDef } = configuration;
|
|
1177
|
+
filterConfiguration.set({
|
|
1178
|
+
inlineColumn,
|
|
1179
|
+
inlineExternal,
|
|
1180
|
+
inlineFilterDef,
|
|
1181
|
+
});
|
|
1182
|
+
return {
|
|
1183
|
+
inlineColumn,
|
|
1184
|
+
inlineExternal,
|
|
1185
|
+
inlineFilterDef,
|
|
1187
1186
|
};
|
|
1188
|
-
filterConfiguration.set(updatedConfiguration);
|
|
1189
|
-
return updatedConfiguration;
|
|
1190
1187
|
},
|
|
1191
1188
|
remove: () => {
|
|
1192
1189
|
filterConfiguration.remove();
|
|
1193
1190
|
},
|
|
1194
|
-
observer: filterConfiguration.observer
|
|
1191
|
+
observer: filterConfiguration.observer.pipe(startWith(filterConfiguration.get())),
|
|
1195
1192
|
},
|
|
1196
1193
|
value: {
|
|
1197
1194
|
get: () => {
|
|
1198
|
-
|
|
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
|
-
};
|
|
1195
|
+
return filterValue.get();
|
|
1207
1196
|
},
|
|
1208
1197
|
set: (configuration) => {
|
|
1209
1198
|
const keys = Object.keys(configuration || {});
|
|
@@ -1211,11 +1200,17 @@ class SdGridFilterService {
|
|
|
1211
1200
|
const { columnFilter, externalFilter, filterDef } = current;
|
|
1212
1201
|
const updatedConfiguration = {
|
|
1213
1202
|
// Filter column
|
|
1214
|
-
columnFilter: keys.includes(
|
|
1203
|
+
columnFilter: keys.includes("columnFilter")
|
|
1204
|
+
? (configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {}
|
|
1205
|
+
: columnFilter,
|
|
1215
1206
|
// Filter external
|
|
1216
|
-
externalFilter: keys.includes(
|
|
1207
|
+
externalFilter: keys.includes("externalFilter")
|
|
1208
|
+
? (configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {}
|
|
1209
|
+
: externalFilter,
|
|
1217
1210
|
// Filter def
|
|
1218
|
-
filterDef: keys.includes(
|
|
1211
|
+
filterDef: keys.includes("filterDef")
|
|
1212
|
+
? (configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}
|
|
1213
|
+
: filterDef,
|
|
1219
1214
|
};
|
|
1220
1215
|
filterValue.set(updatedConfiguration);
|
|
1221
1216
|
return updatedConfiguration;
|
|
@@ -1223,68 +1218,131 @@ class SdGridFilterService {
|
|
|
1223
1218
|
remove: () => {
|
|
1224
1219
|
filterValue.remove();
|
|
1225
1220
|
},
|
|
1226
|
-
observer: filterValue.observer
|
|
1227
|
-
}
|
|
1221
|
+
observer: filterValue.observer.pipe(startWith(filterValue.get())),
|
|
1222
|
+
},
|
|
1228
1223
|
};
|
|
1229
1224
|
}
|
|
1230
1225
|
return __classPrivateFieldGet(this, _cache$2)[key];
|
|
1231
1226
|
};
|
|
1232
|
-
|
|
1233
|
-
var _a
|
|
1227
|
+
_defaultConfiguration.set(this, (args) => {
|
|
1228
|
+
var _a;
|
|
1234
1229
|
const { columns, externalFilters, filterDefs } = args;
|
|
1235
1230
|
const inlineColumn = {};
|
|
1236
1231
|
const inlineExternal = {};
|
|
1237
1232
|
const inlineFilterDef = {};
|
|
1238
1233
|
// Filter column
|
|
1239
|
-
for (const item of
|
|
1240
|
-
inlineColumn[item.field] = (_a =
|
|
1234
|
+
for (const item of columns || []) {
|
|
1235
|
+
inlineColumn[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.defaultShowing;
|
|
1241
1236
|
}
|
|
1242
1237
|
// Filter external
|
|
1243
|
-
for (const item of
|
|
1244
|
-
inlineExternal[item.field] =
|
|
1238
|
+
for (const item of externalFilters || []) {
|
|
1239
|
+
inlineExternal[item.field] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1245
1240
|
}
|
|
1246
1241
|
// Filter def
|
|
1247
|
-
for (const item of
|
|
1248
|
-
inlineFilterDef[item.sdMaterialFilterDef] =
|
|
1242
|
+
for (const item of filterDefs || []) {
|
|
1243
|
+
inlineFilterDef[item.sdMaterialFilterDef] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1249
1244
|
}
|
|
1250
1245
|
return {
|
|
1246
|
+
// Filter column
|
|
1251
1247
|
inlineColumn,
|
|
1248
|
+
// Filter external
|
|
1252
1249
|
inlineExternal,
|
|
1250
|
+
// Filter def
|
|
1253
1251
|
inlineFilterDef,
|
|
1254
1252
|
};
|
|
1255
1253
|
});
|
|
1256
|
-
|
|
1257
|
-
var _a
|
|
1254
|
+
_defaultValue.set(this, (args) => {
|
|
1255
|
+
var _a;
|
|
1256
|
+
const columnFilter = {};
|
|
1257
|
+
const externalFilter = {};
|
|
1258
|
+
const filterDef = {};
|
|
1258
1259
|
const { columns, externalFilters, filterDefs } = args;
|
|
1260
|
+
// Filter column
|
|
1261
|
+
for (const item of columns || []) {
|
|
1262
|
+
columnFilter[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.default;
|
|
1263
|
+
}
|
|
1264
|
+
// Filter external
|
|
1265
|
+
for (const item of externalFilters || []) {
|
|
1266
|
+
externalFilter[item.field] = item === null || item === void 0 ? void 0 : item.default;
|
|
1267
|
+
}
|
|
1268
|
+
// Filter def
|
|
1269
|
+
for (const item of filterDefs || []) {
|
|
1270
|
+
filterDef[item.sdMaterialFilterDef] = undefined;
|
|
1271
|
+
}
|
|
1272
|
+
return {
|
|
1273
|
+
// Filter column
|
|
1274
|
+
columnFilter,
|
|
1275
|
+
// Filter external
|
|
1276
|
+
externalFilter,
|
|
1277
|
+
// Filter def
|
|
1278
|
+
filterDef,
|
|
1279
|
+
};
|
|
1280
|
+
});
|
|
1281
|
+
_initConfiguration.set(this, (args, configuration) => {
|
|
1282
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1283
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1284
|
+
const inlineColumn = {};
|
|
1285
|
+
const inlineExternal = {};
|
|
1286
|
+
const inlineFilterDef = {};
|
|
1287
|
+
// Filter column
|
|
1288
|
+
for (const item of columns || []) {
|
|
1289
|
+
inlineColumn[item.field] = (_b = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) === null || _a === void 0 ? void 0 : _a[item.field]) !== null && _b !== void 0 ? _b : (_c = item === null || item === void 0 ? void 0 : item.filter) === null || _c === void 0 ? void 0 : _c.defaultShowing;
|
|
1290
|
+
}
|
|
1291
|
+
// Filter external
|
|
1292
|
+
for (const item of externalFilters || []) {
|
|
1293
|
+
inlineExternal[item.field] = (_e = (_d = configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) === null || _d === void 0 ? void 0 : _d[item.field]) !== null && _e !== void 0 ? _e : item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1294
|
+
}
|
|
1295
|
+
// Filter def
|
|
1296
|
+
for (const item of filterDefs || []) {
|
|
1297
|
+
inlineFilterDef[item.sdMaterialFilterDef] = (_g = (_f = configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) === null || _f === void 0 ? void 0 : _f[item.sdMaterialFilterDef]) !== null && _g !== void 0 ? _g : item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1298
|
+
}
|
|
1299
|
+
return {
|
|
1300
|
+
// Filter column
|
|
1301
|
+
inlineColumn,
|
|
1302
|
+
// Filter external
|
|
1303
|
+
inlineExternal,
|
|
1304
|
+
// Filter def
|
|
1305
|
+
inlineFilterDef,
|
|
1306
|
+
};
|
|
1307
|
+
});
|
|
1308
|
+
_initValue.set(this, (args, value) => {
|
|
1309
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1259
1310
|
const columnFilter = {};
|
|
1260
1311
|
const externalFilter = {};
|
|
1261
1312
|
const filterDef = {};
|
|
1313
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1262
1314
|
// Filter column
|
|
1263
|
-
for (const item of
|
|
1264
|
-
columnFilter[item.field] = (_a = columnFilter[item.field]) !== null &&
|
|
1315
|
+
for (const item of columns || []) {
|
|
1316
|
+
columnFilter[item.field] = (_b = (_a = value === null || value === void 0 ? void 0 : value.columnFilter) === null || _a === void 0 ? void 0 : _a[item.field]) !== null && _b !== void 0 ? _b : (_c = item === null || item === void 0 ? void 0 : item.filter) === null || _c === void 0 ? void 0 : _c.default;
|
|
1265
1317
|
}
|
|
1266
1318
|
// Filter external
|
|
1267
|
-
for (const item of
|
|
1268
|
-
if (item.type ===
|
|
1319
|
+
for (const item of externalFilters || []) {
|
|
1320
|
+
if (item.type === "daterange") {
|
|
1269
1321
|
externalFilter[item.field] = {
|
|
1270
|
-
from: (_f = (
|
|
1271
|
-
to: (_k = (
|
|
1322
|
+
from: (_f = (_e = (_d = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _d === void 0 ? void 0 : _d[item.field]) === null || _e === void 0 ? void 0 : _e.from) !== null && _f !== void 0 ? _f : (_g = item.default) === null || _g === void 0 ? void 0 : _g.from,
|
|
1323
|
+
to: (_k = (_j = (_h = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _h === void 0 ? void 0 : _h[item.field]) === null || _j === void 0 ? void 0 : _j.to) !== null && _k !== void 0 ? _k : (_l = item.default) === null || _l === void 0 ? void 0 : _l.to,
|
|
1272
1324
|
};
|
|
1273
1325
|
}
|
|
1274
1326
|
else {
|
|
1275
|
-
externalFilter[item.field] = (
|
|
1327
|
+
externalFilter[item.field] = (_o = (_m = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _m === void 0 ? void 0 : _m[item.field]) !== null && _o !== void 0 ? _o : item === null || item === void 0 ? void 0 : item.default;
|
|
1276
1328
|
}
|
|
1277
1329
|
}
|
|
1278
1330
|
// Filter def
|
|
1331
|
+
for (const item of filterDefs || []) {
|
|
1332
|
+
filterDef[item.sdMaterialFilterDef] = (_q = (_p = value === null || value === void 0 ? void 0 : value.filterDef) === null || _p === void 0 ? void 0 : _p[item.sdMaterialFilterDef]) !== null && _q !== void 0 ? _q : undefined;
|
|
1333
|
+
}
|
|
1279
1334
|
return {
|
|
1335
|
+
// Filter column
|
|
1280
1336
|
columnFilter,
|
|
1337
|
+
// Filter external
|
|
1281
1338
|
externalFilter,
|
|
1339
|
+
// Filter def
|
|
1282
1340
|
filterDef,
|
|
1283
1341
|
};
|
|
1284
1342
|
});
|
|
1285
1343
|
}
|
|
1286
1344
|
}
|
|
1287
|
-
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(),
|
|
1345
|
+
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(), _defaultConfiguration = new WeakMap(), _defaultValue = new WeakMap(), _initConfiguration = new WeakMap(), _initValue = new WeakMap();
|
|
1288
1346
|
SdGridFilterService.decorators = [
|
|
1289
1347
|
{ type: Injectable }
|
|
1290
1348
|
];
|
|
@@ -1292,7 +1350,7 @@ SdGridFilterService.ctorParameters = () => [
|
|
|
1292
1350
|
{ type: SdSettingService }
|
|
1293
1351
|
];
|
|
1294
1352
|
|
|
1295
|
-
var _optionChanges, _localItems, _paginator, _sort, _subscription$2, _reload, _loadCompleted, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _loadFilterRegister, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
1353
|
+
var _optionChanges, _localItems, _paginator, _sort, _subscription$2, _reload, _loadCompleted, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration$1, _loadFilterRegister, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
1296
1354
|
class SdGridMaterial {
|
|
1297
1355
|
constructor(ref, configuration, gridConfigurationService, exportService, notifyService, columnValuesPipe, gridFilterService, editorHandlerColumnPipe) {
|
|
1298
1356
|
this.ref = ref;
|
|
@@ -1347,9 +1405,6 @@ class SdGridMaterial {
|
|
|
1347
1405
|
for (const filterDef of this.sdFilterDefs) {
|
|
1348
1406
|
this.filterDefs.push(filterDef);
|
|
1349
1407
|
}
|
|
1350
|
-
// if (this.filterDefs?.length) {
|
|
1351
|
-
// this.#loadFilterRegister();
|
|
1352
|
-
// }
|
|
1353
1408
|
});
|
|
1354
1409
|
_initFooterDef.set(this, () => {
|
|
1355
1410
|
this.footerDef = {};
|
|
@@ -1372,17 +1427,17 @@ class SdGridMaterial {
|
|
|
1372
1427
|
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1373
1428
|
pageNumber,
|
|
1374
1429
|
pageSize,
|
|
1375
|
-
isExported: true
|
|
1430
|
+
isExported: true,
|
|
1376
1431
|
};
|
|
1377
1432
|
});
|
|
1378
|
-
_initConfiguration.set(this, (option) => {
|
|
1433
|
+
_initConfiguration$1.set(this, (option) => {
|
|
1379
1434
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1380
1435
|
// Init pagination
|
|
1381
1436
|
option.paginate = {
|
|
1382
1437
|
hidden: (_a = option === null || option === void 0 ? void 0 : option.paginate) === null || _a === void 0 ? void 0 : _a.hidden,
|
|
1383
1438
|
pageSize: (_f = (_c = (_b = option === null || option === void 0 ? void 0 : option.paginate) === null || _b === void 0 ? void 0 : _b.pageSize) !== null && _c !== void 0 ? _c : (_e = (_d = this.configuration) === null || _d === void 0 ? void 0 : _d.paginate) === null || _e === void 0 ? void 0 : _e.pageSize) !== null && _f !== void 0 ? _f : (_g = DEFAULT_GRID_MATERIAL_CONFIG.paginate) === null || _g === void 0 ? void 0 : _g.pageSize,
|
|
1384
1439
|
pages: (_m = (_j = (_h = option === null || option === void 0 ? void 0 : option.paginate) === null || _h === void 0 ? void 0 : _h.pages) !== null && _j !== void 0 ? _j : (_l = (_k = this.configuration) === null || _k === void 0 ? void 0 : _k.paginate) === null || _l === void 0 ? void 0 : _l.pages) !== null && _m !== void 0 ? _m : (_o = DEFAULT_GRID_MATERIAL_CONFIG.paginate) === null || _o === void 0 ? void 0 : _o.pages,
|
|
1385
|
-
showFirstLastButtons: (_q = (_p = option === null || option === void 0 ? void 0 : option.paginate) === null || _p === void 0 ? void 0 : _p.showFirstLastButtons) !== null && _q !== void 0 ? _q : false
|
|
1440
|
+
showFirstLastButtons: (_q = (_p = option === null || option === void 0 ? void 0 : option.paginate) === null || _p === void 0 ? void 0 : _p.showFirstLastButtons) !== null && _q !== void 0 ? _q : false,
|
|
1386
1441
|
};
|
|
1387
1442
|
return option;
|
|
1388
1443
|
});
|
|
@@ -1394,16 +1449,24 @@ class SdGridMaterial {
|
|
|
1394
1449
|
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, {
|
|
1395
1450
|
columns: (_c = this.gridOption) === null || _c === void 0 ? void 0 : _c.columns,
|
|
1396
1451
|
externalFilters: (_e = (_d = this.gridOption) === null || _d === void 0 ? void 0 : _d.filter) === null || _e === void 0 ? void 0 : _e.externalFilters,
|
|
1397
|
-
filterDefs: this.filterDefs
|
|
1452
|
+
filterDefs: this.filterDefs,
|
|
1398
1453
|
});
|
|
1399
1454
|
if (!hasRegister) {
|
|
1400
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.filterRegister.value.observer
|
|
1401
|
-
|
|
1455
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.filterRegister.value.observer
|
|
1456
|
+
.pipe(debounceTime(500), map(filterValue => {
|
|
1457
|
+
const { columnFilter } = filterValue;
|
|
1458
|
+
this.columnFilter = columnFilter;
|
|
1402
1459
|
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1403
1460
|
__classPrivateFieldGet(this, _reload).next({
|
|
1404
1461
|
force: false,
|
|
1405
1462
|
});
|
|
1406
|
-
}))
|
|
1463
|
+
}))
|
|
1464
|
+
.subscribe());
|
|
1465
|
+
}
|
|
1466
|
+
else {
|
|
1467
|
+
__classPrivateFieldGet(this, _reload).next({
|
|
1468
|
+
force: true,
|
|
1469
|
+
});
|
|
1407
1470
|
}
|
|
1408
1471
|
}
|
|
1409
1472
|
});
|
|
@@ -1517,10 +1580,9 @@ class SdGridMaterial {
|
|
|
1517
1580
|
}
|
|
1518
1581
|
return {
|
|
1519
1582
|
items: items.filter((item, index) => {
|
|
1520
|
-
return index >= pageNumber * pageSize
|
|
1521
|
-
&& index < (pageNumber + 1) * pageSize;
|
|
1583
|
+
return index >= pageNumber * pageSize && index < (pageNumber + 1) * pageSize;
|
|
1522
1584
|
}),
|
|
1523
|
-
total: items.length
|
|
1585
|
+
total: items.length,
|
|
1524
1586
|
};
|
|
1525
1587
|
});
|
|
1526
1588
|
_getFilter.set(this, () => {
|
|
@@ -1533,7 +1595,7 @@ class SdGridMaterial {
|
|
|
1533
1595
|
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
1534
1596
|
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1535
1597
|
pageNumber: ((_c = __classPrivateFieldGet(this, _paginator)) === null || _c === void 0 ? void 0 : _c.pageIndex) || 0,
|
|
1536
|
-
pageSize: ((_d = __classPrivateFieldGet(this, _paginator)) === null || _d === void 0 ? void 0 : _d.pageSize) || ((_f = (_e = this.gridOption) === null || _e === void 0 ? void 0 : _e.paginate) === null || _f === void 0 ? void 0 : _f.pageSize) || 50
|
|
1598
|
+
pageSize: ((_d = __classPrivateFieldGet(this, _paginator)) === null || _d === void 0 ? void 0 : _d.pageSize) || ((_f = (_e = this.gridOption) === null || _e === void 0 ? void 0 : _e.paginate) === null || _f === void 0 ? void 0 : _f.pageSize) || 50,
|
|
1537
1599
|
};
|
|
1538
1600
|
});
|
|
1539
1601
|
_load$1.set(this, (filterReq, force = true) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1547,7 +1609,7 @@ class SdGridMaterial {
|
|
|
1547
1609
|
const data = yield result;
|
|
1548
1610
|
return {
|
|
1549
1611
|
items: (data === null || data === void 0 ? void 0 : data.items) || [],
|
|
1550
|
-
total: (data === null || data === void 0 ? void 0 : data.total) || 0
|
|
1612
|
+
total: (data === null || data === void 0 ? void 0 : data.total) || 0,
|
|
1551
1613
|
};
|
|
1552
1614
|
}
|
|
1553
1615
|
catch (error) {
|
|
@@ -1555,7 +1617,7 @@ class SdGridMaterial {
|
|
|
1555
1617
|
this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
1556
1618
|
return {
|
|
1557
1619
|
items: [],
|
|
1558
|
-
total: 0
|
|
1620
|
+
total: 0,
|
|
1559
1621
|
};
|
|
1560
1622
|
}
|
|
1561
1623
|
finally {
|
|
@@ -1637,7 +1699,7 @@ class SdGridMaterial {
|
|
|
1637
1699
|
}
|
|
1638
1700
|
else {
|
|
1639
1701
|
let exportedItems = [];
|
|
1640
|
-
if (typeof
|
|
1702
|
+
if (typeof this.gridOption.items === 'function') {
|
|
1641
1703
|
const results = this.gridOption.items();
|
|
1642
1704
|
if (results instanceof Promise) {
|
|
1643
1705
|
exportedItems = yield results;
|
|
@@ -1655,7 +1717,9 @@ class SdGridMaterial {
|
|
|
1655
1717
|
}));
|
|
1656
1718
|
_allColumns.set(this, () => {
|
|
1657
1719
|
const columns = [];
|
|
1658
|
-
this.gridOption.columns
|
|
1720
|
+
this.gridOption.columns
|
|
1721
|
+
.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })
|
|
1722
|
+
.forEach(column => {
|
|
1659
1723
|
var _a, _b;
|
|
1660
1724
|
if (column.type === 'image') {
|
|
1661
1725
|
return;
|
|
@@ -1723,7 +1787,7 @@ class SdGridMaterial {
|
|
|
1723
1787
|
}
|
|
1724
1788
|
}
|
|
1725
1789
|
const totalPage = total / pageSize;
|
|
1726
|
-
const percent = Math.round((pageNumber - 1) * 100.0 / totalPage);
|
|
1790
|
+
const percent = Math.round(((pageNumber - 1) * 100.0) / totalPage);
|
|
1727
1791
|
this.exportTitle = `Exporting...${percent}%`;
|
|
1728
1792
|
const allColumns = __classPrivateFieldGet(this, _allColumns).call(this);
|
|
1729
1793
|
const allExportedColumns = __classPrivateFieldGet(this, _allExportedColumns).call(this);
|
|
@@ -1750,7 +1814,7 @@ class SdGridMaterial {
|
|
|
1750
1814
|
}
|
|
1751
1815
|
if (column.transform) {
|
|
1752
1816
|
const transform = column.transform(item[column.field], item, {
|
|
1753
|
-
isExport: true
|
|
1817
|
+
isExport: true,
|
|
1754
1818
|
});
|
|
1755
1819
|
if (transform instanceof Promise) {
|
|
1756
1820
|
obj[column.field] = yield transform;
|
|
@@ -1834,7 +1898,7 @@ class SdGridMaterial {
|
|
|
1834
1898
|
yield this.exportService.exportCSV({
|
|
1835
1899
|
columns,
|
|
1836
1900
|
items,
|
|
1837
|
-
fileName: (_m = (_l = this.gridOption) === null || _l === void 0 ? void 0 : _l.export) === null || _m === void 0 ? void 0 : _m.fileName
|
|
1901
|
+
fileName: (_m = (_l = this.gridOption) === null || _l === void 0 ? void 0 : _l.export) === null || _m === void 0 ? void 0 : _m.fileName,
|
|
1838
1902
|
});
|
|
1839
1903
|
return;
|
|
1840
1904
|
}
|
|
@@ -1846,14 +1910,14 @@ class SdGridMaterial {
|
|
|
1846
1910
|
sheets.push({
|
|
1847
1911
|
name: sheet.name,
|
|
1848
1912
|
items: sheet.items,
|
|
1849
|
-
fields: sheet.fields
|
|
1913
|
+
fields: sheet.fields,
|
|
1850
1914
|
});
|
|
1851
1915
|
}
|
|
1852
1916
|
else {
|
|
1853
1917
|
sheets.push({
|
|
1854
1918
|
name: sheet.name,
|
|
1855
1919
|
items: yield sheet.items(),
|
|
1856
|
-
fields: sheet.fields
|
|
1920
|
+
fields: sheet.fields,
|
|
1857
1921
|
});
|
|
1858
1922
|
}
|
|
1859
1923
|
}
|
|
@@ -1863,7 +1927,7 @@ class SdGridMaterial {
|
|
|
1863
1927
|
columns,
|
|
1864
1928
|
items,
|
|
1865
1929
|
fileName: (_r = (_q = this.gridOption) === null || _q === void 0 ? void 0 : _q.export) === null || _r === void 0 ? void 0 : _r.fileName,
|
|
1866
|
-
sheets
|
|
1930
|
+
sheets,
|
|
1867
1931
|
});
|
|
1868
1932
|
return;
|
|
1869
1933
|
}
|
|
@@ -1871,7 +1935,7 @@ class SdGridMaterial {
|
|
|
1871
1935
|
filePath: file.filePath,
|
|
1872
1936
|
fileName: file.fileName,
|
|
1873
1937
|
columns,
|
|
1874
|
-
items
|
|
1938
|
+
items,
|
|
1875
1939
|
});
|
|
1876
1940
|
}
|
|
1877
1941
|
finally {
|
|
@@ -1884,8 +1948,17 @@ class SdGridMaterial {
|
|
|
1884
1948
|
__classPrivateFieldGet(this, _onExport).call(this, args);
|
|
1885
1949
|
});
|
|
1886
1950
|
this.onFilterChange = () => {
|
|
1887
|
-
|
|
1888
|
-
this.
|
|
1951
|
+
var _a, _b;
|
|
1952
|
+
// this.#paginator.pageIndex = 0;
|
|
1953
|
+
// this.reload(false);
|
|
1954
|
+
if ((_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.inlineColumn) {
|
|
1955
|
+
this.filterRegister.value.set({
|
|
1956
|
+
columnFilter: this.columnFilter,
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
else {
|
|
1960
|
+
this.filterRegister.value.set({});
|
|
1961
|
+
}
|
|
1889
1962
|
};
|
|
1890
1963
|
this.onExpand = (rowData) => __awaiter(this, void 0, void 0, function* () {
|
|
1891
1964
|
var _w, _x, _y, _z, _0;
|
|
@@ -1901,14 +1974,16 @@ class SdGridMaterial {
|
|
|
1901
1974
|
}
|
|
1902
1975
|
const data = (_z = (_y = (_x = this.gridOption) === null || _x === void 0 ? void 0 : _x.subInformation) === null || _y === void 0 ? void 0 : _y.onExpand) === null || _z === void 0 ? void 0 : _z.call(_y, rowData);
|
|
1903
1976
|
if (!((_0 = this.gridOption.subInformation) === null || _0 === void 0 ? void 0 : _0.multiple)) {
|
|
1904
|
-
this.items.forEach(item => item.isExpanding = item.isExpanded = false);
|
|
1977
|
+
this.items.forEach(item => (item.isExpanding = item.isExpanded = false));
|
|
1905
1978
|
}
|
|
1906
1979
|
if (data instanceof Promise) {
|
|
1907
1980
|
rowData.isExpanding = true;
|
|
1908
|
-
data
|
|
1981
|
+
data
|
|
1982
|
+
.then(res => {
|
|
1909
1983
|
rowData.expandDetail = res;
|
|
1910
1984
|
rowData.isExpanded = true;
|
|
1911
|
-
})
|
|
1985
|
+
})
|
|
1986
|
+
.finally(() => (rowData.isExpanding = false));
|
|
1912
1987
|
}
|
|
1913
1988
|
else {
|
|
1914
1989
|
rowData.expandDetail = data;
|
|
@@ -1918,14 +1993,14 @@ class SdGridMaterial {
|
|
|
1918
1993
|
this.onSelect = (rowData) => {
|
|
1919
1994
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1920
1995
|
if ((_b = (_a = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1921
|
-
(_c = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _c === void 0 ? void 0 : _c.items.forEach(e => e.isSelected = rowData.isSelected);
|
|
1996
|
+
(_c = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _c === void 0 ? void 0 : _c.items.forEach(e => (e.isSelected = rowData.isSelected));
|
|
1922
1997
|
(_e = (_d = this.gridOption.selection) === null || _d === void 0 ? void 0 : _d.onSelect) === null || _e === void 0 ? void 0 : _e.call(_d, rowData, this.items.filter(e => e.isSelected));
|
|
1923
1998
|
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
1924
1999
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1925
2000
|
}
|
|
1926
2001
|
else {
|
|
1927
2002
|
if ((_f = this.gridOption.selection) === null || _f === void 0 ? void 0 : _f.single) {
|
|
1928
|
-
this.items.filter(e => e !== rowData).forEach(e => e.isSelected = false);
|
|
2003
|
+
this.items.filter(e => e !== rowData).forEach(e => (e.isSelected = false));
|
|
1929
2004
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1930
2005
|
return;
|
|
1931
2006
|
}
|
|
@@ -1948,11 +2023,12 @@ class SdGridMaterial {
|
|
|
1948
2023
|
this.onClearSelection = (items) => {
|
|
1949
2024
|
items = items || this.items;
|
|
1950
2025
|
this.isSelectAll = false;
|
|
1951
|
-
items === null || items === void 0 ? void 0 : items.forEach(e => e.isSelected = false);
|
|
2026
|
+
items === null || items === void 0 ? void 0 : items.forEach(e => (e.isSelected = false));
|
|
1952
2027
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1953
2028
|
};
|
|
1954
2029
|
_updateSelectedItems.set(this, () => {
|
|
1955
|
-
this.selectedItems = this.items
|
|
2030
|
+
this.selectedItems = this.items
|
|
2031
|
+
.filter(item => item.isSelected)
|
|
1956
2032
|
.map(item => {
|
|
1957
2033
|
const { isSelected, isExpanded, isExpanding, expandDetail, editorErrorMessage, editorHandlerColumn, editorHandlerRow, editorStatus, originItem, sdId, sdVersion } = item,
|
|
1958
2034
|
// Giữ lại các trường thông tin cho selectable (action, groupedAction, sdGroup, selectable)
|
|
@@ -1969,12 +2045,8 @@ class SdGridMaterial {
|
|
|
1969
2045
|
this.filterRegister.value.set({
|
|
1970
2046
|
columnFilter,
|
|
1971
2047
|
externalFilter,
|
|
1972
|
-
filterDef
|
|
2048
|
+
filterDef,
|
|
1973
2049
|
});
|
|
1974
|
-
// if (this.gridOption?.filter?.inlineColumn && args?.columnFilter) {
|
|
1975
|
-
// this.columnFilter = args.columnFilter;
|
|
1976
|
-
// }
|
|
1977
|
-
// this.gridFilter?.setFilter(args);
|
|
1978
2050
|
};
|
|
1979
2051
|
this.onCreate = () => {
|
|
1980
2052
|
var _a, _b;
|
|
@@ -2018,7 +2090,7 @@ class SdGridMaterial {
|
|
|
2018
2090
|
}
|
|
2019
2091
|
item.editorStatus = 'create';
|
|
2020
2092
|
item.editorHandlerRow = {
|
|
2021
|
-
temporary: Object.assign({}, item)
|
|
2093
|
+
temporary: Object.assign({}, item),
|
|
2022
2094
|
};
|
|
2023
2095
|
};
|
|
2024
2096
|
this.onUpdate = (item) => {
|
|
@@ -2196,13 +2268,9 @@ class SdGridMaterial {
|
|
|
2196
2268
|
}
|
|
2197
2269
|
set option(option) {
|
|
2198
2270
|
if (option) {
|
|
2199
|
-
option = __classPrivateFieldGet(this, _initConfiguration).call(this, option);
|
|
2271
|
+
option = __classPrivateFieldGet(this, _initConfiguration$1).call(this, option);
|
|
2200
2272
|
this.gridOption = option;
|
|
2201
|
-
// this.#loadFilterRegister();
|
|
2202
2273
|
__classPrivateFieldSet(this, _loadCompleted, false);
|
|
2203
|
-
// this.#reload.next({
|
|
2204
|
-
// force: true,
|
|
2205
|
-
// });
|
|
2206
2274
|
const configuration = this.gridConfigurationService.init(this.key, this.gridOption);
|
|
2207
2275
|
this.gridConfigurationObserver = configuration.observer;
|
|
2208
2276
|
configuration.load();
|
|
@@ -2212,21 +2280,25 @@ class SdGridMaterial {
|
|
|
2212
2280
|
set paginator(paginator) {
|
|
2213
2281
|
if (paginator && __classPrivateFieldGet(this, _paginator) !== paginator) {
|
|
2214
2282
|
__classPrivateFieldSet(this, _paginator, paginator);
|
|
2215
|
-
__classPrivateFieldGet(this, _subscription$2).add(paginator.page
|
|
2283
|
+
__classPrivateFieldGet(this, _subscription$2).add(paginator.page
|
|
2284
|
+
.pipe(map(() => {
|
|
2216
2285
|
__classPrivateFieldGet(this, _reload).next({
|
|
2217
|
-
force: false
|
|
2286
|
+
force: false,
|
|
2218
2287
|
});
|
|
2219
|
-
}))
|
|
2288
|
+
}))
|
|
2289
|
+
.subscribe());
|
|
2220
2290
|
}
|
|
2221
2291
|
}
|
|
2222
2292
|
set sort(sort) {
|
|
2223
2293
|
if (sort && __classPrivateFieldGet(this, _sort) !== sort) {
|
|
2224
2294
|
__classPrivateFieldSet(this, _sort, sort);
|
|
2225
|
-
__classPrivateFieldGet(this, _subscription$2).add(sort.sortChange
|
|
2295
|
+
__classPrivateFieldGet(this, _subscription$2).add(sort.sortChange
|
|
2296
|
+
.pipe(map(() => {
|
|
2226
2297
|
__classPrivateFieldGet(this, _reload).next({
|
|
2227
|
-
force: false
|
|
2298
|
+
force: false,
|
|
2228
2299
|
});
|
|
2229
|
-
}))
|
|
2300
|
+
}))
|
|
2301
|
+
.subscribe());
|
|
2230
2302
|
}
|
|
2231
2303
|
}
|
|
2232
2304
|
ngOnInit() {
|
|
@@ -2238,14 +2310,15 @@ class SdGridMaterial {
|
|
|
2238
2310
|
const result = yield __classPrivateFieldGet(this, _load$1).call(this, filterInfo, !__classPrivateFieldGet(this, _loadCompleted) || data.force);
|
|
2239
2311
|
__classPrivateFieldSet(this, _loadCompleted, true);
|
|
2240
2312
|
return result;
|
|
2241
|
-
})))
|
|
2313
|
+
})))
|
|
2314
|
+
.subscribe(__classPrivateFieldGet(this, _render)));
|
|
2242
2315
|
__classPrivateFieldGet(this, _subscription$2).add(this.sdCellDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
2243
2316
|
__classPrivateFieldGet(this, _subscription$2).add(this.sdFooterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
2244
2317
|
__classPrivateFieldGet(this, _subscription$2).add(this.sdFilterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
2245
2318
|
__classPrivateFieldGet(this, _subscription$2).add(combineLatest([
|
|
2246
2319
|
__classPrivateFieldGet(this, _optionChanges).pipe(startWith(this.gridOption)),
|
|
2247
|
-
this.sdFilterDefs.changes.pipe(startWith(this.filterDefs))
|
|
2248
|
-
]).subscribe((
|
|
2320
|
+
this.sdFilterDefs.changes.pipe(startWith(this.filterDefs)),
|
|
2321
|
+
]).subscribe(() => {
|
|
2249
2322
|
__classPrivateFieldGet(this, _loadFilterRegister).call(this);
|
|
2250
2323
|
}));
|
|
2251
2324
|
this.ref.detectChanges();
|
|
@@ -2257,7 +2330,8 @@ class SdGridMaterial {
|
|
|
2257
2330
|
moveItemInArray(columns, event.previousIndex, event.currentIndex);
|
|
2258
2331
|
}
|
|
2259
2332
|
get editedItems() {
|
|
2260
|
-
return this.items
|
|
2333
|
+
return this.items
|
|
2334
|
+
.filter(item => {
|
|
2261
2335
|
if (!item.originItem) {
|
|
2262
2336
|
return true;
|
|
2263
2337
|
}
|
|
@@ -2265,7 +2339,8 @@ class SdGridMaterial {
|
|
|
2265
2339
|
return true;
|
|
2266
2340
|
}
|
|
2267
2341
|
return false;
|
|
2268
|
-
})
|
|
2342
|
+
})
|
|
2343
|
+
.map(item => {
|
|
2269
2344
|
const { editorStatus, editorHandlerRow, editorHandlerColumn, editorErrorMessage, expandDetail, isExpanded, isExpanding, isSelected, originItem, sdId, sdVersion, selectable, actions, groupedActions, sdGroup, temporary } = item, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "editorErrorMessage", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem", "sdId", "sdVersion", "selectable", "actions", "groupedActions", "sdGroup", "temporary"]);
|
|
2270
2345
|
return Object.assign(Object.assign({}, result), { editorErrorMessage });
|
|
2271
2346
|
});
|
|
@@ -2289,7 +2364,7 @@ class SdGridMaterial {
|
|
|
2289
2364
|
return this.items.some(e => e.editorStatus !== undefined);
|
|
2290
2365
|
}
|
|
2291
2366
|
}
|
|
2292
|
-
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$2 = new WeakMap(), _reload = new WeakMap(), _loadCompleted = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration = new WeakMap(), _loadFilterRegister = new WeakMap(), _filterLocal = new WeakMap(), _getFilter = new WeakMap(), _load$1 = new WeakMap(), _render = new WeakMap(), _exportedItems = new WeakMap(), _allColumns = new WeakMap(), _allExportedColumns = new WeakMap(), _onExport = new WeakMap(), _updateSelectedItems = new WeakMap();
|
|
2367
|
+
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$2 = new WeakMap(), _reload = new WeakMap(), _loadCompleted = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration$1 = new WeakMap(), _loadFilterRegister = new WeakMap(), _filterLocal = new WeakMap(), _getFilter = new WeakMap(), _load$1 = new WeakMap(), _render = new WeakMap(), _exportedItems = new WeakMap(), _allColumns = new WeakMap(), _allExportedColumns = new WeakMap(), _onExport = new WeakMap(), _updateSelectedItems = new WeakMap();
|
|
2293
2368
|
SdGridMaterial.decorators = [
|
|
2294
2369
|
{ type: Component, args: [{
|
|
2295
2370
|
selector: 'sd-grid-material',
|