@sd-angular/core 1.3.104 → 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 +261 -316
- 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 +158 -188
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.service.js +82 -108
- package/esm2015/setting/src/lib/setting.service.js +22 -26
- package/fesm2015/sd-angular-core-grid-material.js +233 -288
- 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 +28 -28
- package/package.json +1 -1
- package/{sd-angular-core-1.3.104.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 {
|
|
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,7 +1129,7 @@ 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;
|
|
@@ -1146,132 +1147,52 @@ class SdGridFilterService {
|
|
|
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]) {
|
|
1149
|
-
|
|
1150
|
-
prefix: __classPrivateFieldGet(this, _filterConfiguration),
|
|
1151
|
-
key,
|
|
1152
|
-
}, {
|
|
1153
|
-
type: cacheSession ? "session" : undefined,
|
|
1154
|
-
});
|
|
1155
|
-
const defaultConfiguration = __classPrivateFieldGet(this, _loadDefaultConfiguration).call(this, args, t1.get());
|
|
1156
|
-
const t2 = this.settingService.create({
|
|
1157
|
-
prefix: __classPrivateFieldGet(this, _filterValue),
|
|
1158
|
-
key,
|
|
1159
|
-
}, {
|
|
1160
|
-
type: cacheSession ? "session" : undefined,
|
|
1161
|
-
});
|
|
1162
|
-
const defaultValue = __classPrivateFieldGet(this, _loadDefaultValue).call(this, args, t2.get());
|
|
1150
|
+
// Setting của filter configuration
|
|
1163
1151
|
const filterConfiguration = this.settingService.create({
|
|
1164
1152
|
prefix: __classPrivateFieldGet(this, _filterConfiguration),
|
|
1165
1153
|
key,
|
|
1166
1154
|
}, {
|
|
1167
|
-
default:
|
|
1155
|
+
default: __classPrivateFieldGet(this, _defaultConfiguration).call(this, args),
|
|
1168
1156
|
type: cacheSession ? "session" : undefined,
|
|
1169
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
|
|
1170
1161
|
const filterValue = this.settingService.create({
|
|
1171
1162
|
prefix: __classPrivateFieldGet(this, _filterValue),
|
|
1172
1163
|
key,
|
|
1173
1164
|
}, {
|
|
1174
|
-
default:
|
|
1165
|
+
default: __classPrivateFieldGet(this, _defaultValue).call(this, args),
|
|
1175
1166
|
type: cacheSession ? "session" : undefined,
|
|
1176
1167
|
});
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
const { columns, externalFilters, filterDefs } = args;
|
|
1180
|
-
const inlineColumn = {};
|
|
1181
|
-
const inlineExternal = {};
|
|
1182
|
-
const inlineFilterDef = {};
|
|
1183
|
-
// Filter column
|
|
1184
|
-
for (const item of columns || []) {
|
|
1185
|
-
inlineColumn[item.field] = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) === null || _a === void 0 ? void 0 : _a[item.field];
|
|
1186
|
-
}
|
|
1187
|
-
// Filter external
|
|
1188
|
-
for (const item of externalFilters || []) {
|
|
1189
|
-
inlineExternal[item.field] = (_b = configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) === null || _b === void 0 ? void 0 : _b[item.field];
|
|
1190
|
-
}
|
|
1191
|
-
// Filter def
|
|
1192
|
-
for (const item of filterDefs || []) {
|
|
1193
|
-
inlineFilterDef[item.sdMaterialFilterDef] = (_c = configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) === null || _c === void 0 ? void 0 : _c[item.sdMaterialFilterDef];
|
|
1194
|
-
}
|
|
1195
|
-
return {
|
|
1196
|
-
// Filter column
|
|
1197
|
-
inlineColumn,
|
|
1198
|
-
// Filter external
|
|
1199
|
-
inlineExternal,
|
|
1200
|
-
// Filter def
|
|
1201
|
-
inlineFilterDef,
|
|
1202
|
-
};
|
|
1203
|
-
};
|
|
1204
|
-
const valueGet = (value) => {
|
|
1205
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1206
|
-
const columnFilter = {};
|
|
1207
|
-
const externalFilter = {};
|
|
1208
|
-
const filterDef = {};
|
|
1209
|
-
const { columns, externalFilters, filterDefs } = args;
|
|
1210
|
-
// Filter column
|
|
1211
|
-
for (const item of columns || []) {
|
|
1212
|
-
columnFilter[item.field] = (_a = value === null || value === void 0 ? void 0 : value.columnFilter) === null || _a === void 0 ? void 0 : _a[item.field];
|
|
1213
|
-
}
|
|
1214
|
-
// Filter external
|
|
1215
|
-
for (const item of externalFilters || []) {
|
|
1216
|
-
if (item.type === "daterange") {
|
|
1217
|
-
externalFilter[item.field] = {
|
|
1218
|
-
from: (_c = (_b = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _b === void 0 ? void 0 : _b[item.field]) === null || _c === void 0 ? void 0 : _c.from,
|
|
1219
|
-
to: (_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.to,
|
|
1220
|
-
};
|
|
1221
|
-
}
|
|
1222
|
-
else {
|
|
1223
|
-
externalFilter[item.field] = (_f = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _f === void 0 ? void 0 : _f[item.field];
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
// Filter def
|
|
1227
|
-
for (const item of filterDefs || []) {
|
|
1228
|
-
filterDef[item.sdMaterialFilterDef] = (_g = value === null || value === void 0 ? void 0 : value.filterDef) === null || _g === void 0 ? void 0 : _g[item.sdMaterialFilterDef];
|
|
1229
|
-
}
|
|
1230
|
-
return {
|
|
1231
|
-
// Filter column
|
|
1232
|
-
columnFilter,
|
|
1233
|
-
// Filter external
|
|
1234
|
-
externalFilter,
|
|
1235
|
-
// Filter def
|
|
1236
|
-
filterDef,
|
|
1237
|
-
};
|
|
1238
|
-
};
|
|
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()));
|
|
1239
1170
|
__classPrivateFieldGet(this, _cache$2)[key] = {
|
|
1240
1171
|
configuration: {
|
|
1241
1172
|
get: () => {
|
|
1242
|
-
|
|
1243
|
-
return configurationGet(configuration);
|
|
1173
|
+
return filterConfiguration.get();
|
|
1244
1174
|
},
|
|
1245
1175
|
set: (configuration) => {
|
|
1246
|
-
const
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {}
|
|
1257
|
-
: inlineExternal,
|
|
1258
|
-
// Filter def
|
|
1259
|
-
inlineFilterDef: keys.includes("inlineFilterDef")
|
|
1260
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {}
|
|
1261
|
-
: 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,
|
|
1262
1186
|
};
|
|
1263
|
-
filterConfiguration.set(updatedConfiguration);
|
|
1264
|
-
return updatedConfiguration;
|
|
1265
1187
|
},
|
|
1266
1188
|
remove: () => {
|
|
1267
1189
|
filterConfiguration.remove();
|
|
1268
1190
|
},
|
|
1269
|
-
observer: filterConfiguration.observer.pipe(
|
|
1191
|
+
observer: filterConfiguration.observer.pipe(startWith(filterConfiguration.get())),
|
|
1270
1192
|
},
|
|
1271
1193
|
value: {
|
|
1272
1194
|
get: () => {
|
|
1273
|
-
|
|
1274
|
-
return valueGet(configuration);
|
|
1195
|
+
return filterValue.get();
|
|
1275
1196
|
},
|
|
1276
1197
|
set: (configuration) => {
|
|
1277
1198
|
const keys = Object.keys(configuration || {});
|
|
@@ -1297,13 +1218,67 @@ class SdGridFilterService {
|
|
|
1297
1218
|
remove: () => {
|
|
1298
1219
|
filterValue.remove();
|
|
1299
1220
|
},
|
|
1300
|
-
observer: filterValue.observer.pipe(
|
|
1221
|
+
observer: filterValue.observer.pipe(startWith(filterValue.get())),
|
|
1301
1222
|
},
|
|
1302
1223
|
};
|
|
1303
1224
|
}
|
|
1304
1225
|
return __classPrivateFieldGet(this, _cache$2)[key];
|
|
1305
1226
|
};
|
|
1306
|
-
|
|
1227
|
+
_defaultConfiguration.set(this, (args) => {
|
|
1228
|
+
var _a;
|
|
1229
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1230
|
+
const inlineColumn = {};
|
|
1231
|
+
const inlineExternal = {};
|
|
1232
|
+
const inlineFilterDef = {};
|
|
1233
|
+
// Filter column
|
|
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;
|
|
1236
|
+
}
|
|
1237
|
+
// Filter external
|
|
1238
|
+
for (const item of externalFilters || []) {
|
|
1239
|
+
inlineExternal[item.field] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1240
|
+
}
|
|
1241
|
+
// Filter def
|
|
1242
|
+
for (const item of filterDefs || []) {
|
|
1243
|
+
inlineFilterDef[item.sdMaterialFilterDef] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1244
|
+
}
|
|
1245
|
+
return {
|
|
1246
|
+
// Filter column
|
|
1247
|
+
inlineColumn,
|
|
1248
|
+
// Filter external
|
|
1249
|
+
inlineExternal,
|
|
1250
|
+
// Filter def
|
|
1251
|
+
inlineFilterDef,
|
|
1252
|
+
};
|
|
1253
|
+
});
|
|
1254
|
+
_defaultValue.set(this, (args) => {
|
|
1255
|
+
var _a;
|
|
1256
|
+
const columnFilter = {};
|
|
1257
|
+
const externalFilter = {};
|
|
1258
|
+
const filterDef = {};
|
|
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) => {
|
|
1307
1282
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1308
1283
|
const { columns, externalFilters, filterDefs } = args;
|
|
1309
1284
|
const inlineColumn = {};
|
|
@@ -1330,7 +1305,7 @@ class SdGridFilterService {
|
|
|
1330
1305
|
inlineFilterDef,
|
|
1331
1306
|
};
|
|
1332
1307
|
});
|
|
1333
|
-
|
|
1308
|
+
_initValue.set(this, (args, value) => {
|
|
1334
1309
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1335
1310
|
const columnFilter = {};
|
|
1336
1311
|
const externalFilter = {};
|
|
@@ -1367,7 +1342,7 @@ class SdGridFilterService {
|
|
|
1367
1342
|
});
|
|
1368
1343
|
}
|
|
1369
1344
|
}
|
|
1370
|
-
_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();
|
|
1371
1346
|
SdGridFilterService.decorators = [
|
|
1372
1347
|
{ type: Injectable }
|
|
1373
1348
|
];
|
|
@@ -1375,7 +1350,7 @@ SdGridFilterService.ctorParameters = () => [
|
|
|
1375
1350
|
{ type: SdSettingService }
|
|
1376
1351
|
];
|
|
1377
1352
|
|
|
1378
|
-
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;
|
|
1379
1354
|
class SdGridMaterial {
|
|
1380
1355
|
constructor(ref, configuration, gridConfigurationService, exportService, notifyService, columnValuesPipe, gridFilterService, editorHandlerColumnPipe) {
|
|
1381
1356
|
this.ref = ref;
|
|
@@ -1415,7 +1390,7 @@ class SdGridMaterial {
|
|
|
1415
1390
|
_reload.set(this, new Subject());
|
|
1416
1391
|
this.isExporting = false;
|
|
1417
1392
|
this.isSelectAll = false;
|
|
1418
|
-
this.exportTitle =
|
|
1393
|
+
this.exportTitle = 'Export';
|
|
1419
1394
|
_loadCompleted.set(this, false);
|
|
1420
1395
|
_initCellDef.set(this, () => {
|
|
1421
1396
|
this.cellDef = {};
|
|
@@ -1430,9 +1405,6 @@ class SdGridMaterial {
|
|
|
1430
1405
|
for (const filterDef of this.sdFilterDefs) {
|
|
1431
1406
|
this.filterDefs.push(filterDef);
|
|
1432
1407
|
}
|
|
1433
|
-
// if (this.filterDefs?.length) {
|
|
1434
|
-
// this.#loadFilterRegister();
|
|
1435
|
-
// }
|
|
1436
1408
|
});
|
|
1437
1409
|
_initFooterDef.set(this, () => {
|
|
1438
1410
|
this.footerDef = {};
|
|
@@ -1451,14 +1423,14 @@ class SdGridMaterial {
|
|
|
1451
1423
|
rawColumnFilter: columnFilter || {},
|
|
1452
1424
|
rawExternalFilter: externalFilter || {},
|
|
1453
1425
|
rawFilterDef: filterDef || {},
|
|
1454
|
-
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) ||
|
|
1455
|
-
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) ||
|
|
1426
|
+
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
1427
|
+
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1456
1428
|
pageNumber,
|
|
1457
1429
|
pageSize,
|
|
1458
1430
|
isExported: true,
|
|
1459
1431
|
};
|
|
1460
1432
|
});
|
|
1461
|
-
_initConfiguration.set(this, (option) => {
|
|
1433
|
+
_initConfiguration$1.set(this, (option) => {
|
|
1462
1434
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1463
1435
|
// Init pagination
|
|
1464
1436
|
option.paginate = {
|
|
@@ -1481,8 +1453,9 @@ class SdGridMaterial {
|
|
|
1481
1453
|
});
|
|
1482
1454
|
if (!hasRegister) {
|
|
1483
1455
|
__classPrivateFieldGet(this, _subscription$2).add(this.filterRegister.value.observer
|
|
1484
|
-
.pipe(debounceTime(500), map(
|
|
1485
|
-
|
|
1456
|
+
.pipe(debounceTime(500), map(filterValue => {
|
|
1457
|
+
const { columnFilter } = filterValue;
|
|
1458
|
+
this.columnFilter = columnFilter;
|
|
1486
1459
|
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1487
1460
|
__classPrivateFieldGet(this, _reload).next({
|
|
1488
1461
|
force: false,
|
|
@@ -1500,56 +1473,43 @@ class SdGridMaterial {
|
|
|
1500
1473
|
_filterLocal.set(this, (localItems, filterInfo) => {
|
|
1501
1474
|
const { columns } = this.gridOption;
|
|
1502
1475
|
const { rawColumnFilter, orderBy, orderDirection, pageSize, pageNumber } = filterInfo;
|
|
1503
|
-
const items = localItems.filter(
|
|
1476
|
+
const items = localItems.filter(item => {
|
|
1504
1477
|
var _a, _b, _c, _d;
|
|
1505
1478
|
for (const column of columns) {
|
|
1506
1479
|
const { field, type } = column;
|
|
1507
|
-
const filterValue = (rawColumnFilter[field] ||
|
|
1508
|
-
|
|
1509
|
-
.trim()
|
|
1510
|
-
.toLowerCase();
|
|
1511
|
-
const columnValue = (item[field] || "")
|
|
1512
|
-
.toString()
|
|
1513
|
-
.trim()
|
|
1514
|
-
.toLowerCase();
|
|
1480
|
+
const filterValue = (rawColumnFilter[field] || '').toString().trim().toLowerCase();
|
|
1481
|
+
const columnValue = (item[field] || '').toString().trim().toLowerCase();
|
|
1515
1482
|
if (filterValue) {
|
|
1516
|
-
if (!columnValue &&
|
|
1517
|
-
type !== "datetime" &&
|
|
1518
|
-
type !== "date" &&
|
|
1519
|
-
type !== "time") {
|
|
1483
|
+
if (!columnValue && type !== 'datetime' && type !== 'date' && type !== 'time') {
|
|
1520
1484
|
return false;
|
|
1521
1485
|
}
|
|
1522
|
-
if (type ===
|
|
1486
|
+
if (type === 'string') {
|
|
1523
1487
|
if (columnValue.indexOf(filterValue) === -1) {
|
|
1524
1488
|
return false;
|
|
1525
1489
|
}
|
|
1526
1490
|
}
|
|
1527
|
-
else if (type ===
|
|
1491
|
+
else if (type === 'values') {
|
|
1528
1492
|
if (columnValue !== filterValue) {
|
|
1529
1493
|
return false;
|
|
1530
1494
|
}
|
|
1531
1495
|
}
|
|
1532
|
-
else if (type ===
|
|
1533
|
-
const fValue = +filterValue
|
|
1534
|
-
.replace(">=", "")
|
|
1535
|
-
.replace("<=", "")
|
|
1536
|
-
.replace(">", "")
|
|
1537
|
-
.replace("<", "");
|
|
1496
|
+
else if (type === 'number') {
|
|
1497
|
+
const fValue = +filterValue.replace('>=', '').replace('<=', '').replace('>', '').replace('<', '');
|
|
1538
1498
|
const cValue = +columnValue;
|
|
1539
1499
|
if (fValue || fValue === 0) {
|
|
1540
1500
|
if (!cValue && cValue !== 0) {
|
|
1541
1501
|
return false;
|
|
1542
1502
|
}
|
|
1543
|
-
if (filterValue.indexOf(
|
|
1503
|
+
if (filterValue.indexOf('>=') > -1 && cValue < fValue) {
|
|
1544
1504
|
return false;
|
|
1545
1505
|
}
|
|
1546
|
-
else if (filterValue.indexOf(
|
|
1506
|
+
else if (filterValue.indexOf('<=') > -1 && cValue > fValue) {
|
|
1547
1507
|
return false;
|
|
1548
1508
|
}
|
|
1549
|
-
else if (filterValue.indexOf(
|
|
1509
|
+
else if (filterValue.indexOf('<') > -1 && cValue >= fValue) {
|
|
1550
1510
|
return false;
|
|
1551
1511
|
}
|
|
1552
|
-
else if (filterValue.indexOf(
|
|
1512
|
+
else if (filterValue.indexOf('>') > -1 && cValue <= fValue) {
|
|
1553
1513
|
return false;
|
|
1554
1514
|
}
|
|
1555
1515
|
else if (cValue !== fValue) {
|
|
@@ -1557,21 +1517,15 @@ class SdGridMaterial {
|
|
|
1557
1517
|
}
|
|
1558
1518
|
}
|
|
1559
1519
|
}
|
|
1560
|
-
else if (type ===
|
|
1561
|
-
if (filterValue ===
|
|
1562
|
-
columnValue !== "1" &&
|
|
1563
|
-
columnValue !== "true") {
|
|
1520
|
+
else if (type === 'bool') {
|
|
1521
|
+
if (filterValue === '1' && columnValue !== '1' && columnValue !== 'true') {
|
|
1564
1522
|
return false;
|
|
1565
1523
|
}
|
|
1566
|
-
else if (filterValue ===
|
|
1567
|
-
columnValue !== "0" &&
|
|
1568
|
-
columnValue !== "false") {
|
|
1524
|
+
else if (filterValue === '0' && columnValue !== '0' && columnValue !== 'false') {
|
|
1569
1525
|
return false;
|
|
1570
1526
|
}
|
|
1571
1527
|
}
|
|
1572
|
-
else if (type ===
|
|
1573
|
-
type === "date" ||
|
|
1574
|
-
type === "time") {
|
|
1528
|
+
else if (type === 'datetime' || type === 'date' || type === 'time') {
|
|
1575
1529
|
const from = (_b = (_a = rawColumnFilter[field]) === null || _a === void 0 ? void 0 : _a.from) !== null && _b !== void 0 ? _b : rawColumnFilter[field];
|
|
1576
1530
|
const to = (_d = (_c = rawColumnFilter[field]) === null || _c === void 0 ? void 0 : _c.to) !== null && _d !== void 0 ? _d : rawColumnFilter[field];
|
|
1577
1531
|
const fromDate = Date.begin(from);
|
|
@@ -1597,20 +1551,20 @@ class SdGridMaterial {
|
|
|
1597
1551
|
});
|
|
1598
1552
|
// Sort
|
|
1599
1553
|
if (orderBy && orderDirection) {
|
|
1600
|
-
const column = columns.find(
|
|
1554
|
+
const column = columns.find(e => e.field === orderBy);
|
|
1601
1555
|
if (column) {
|
|
1602
1556
|
const { type, field } = column;
|
|
1603
1557
|
items.sort((current, next) => {
|
|
1604
|
-
if (type ===
|
|
1558
|
+
if (type === 'number') {
|
|
1605
1559
|
return (current[field] || 0) - (next[field] || 0);
|
|
1606
1560
|
}
|
|
1607
|
-
if (type ===
|
|
1608
|
-
const d1 = new Date(current[field] ||
|
|
1609
|
-
const d2 = new Date(current[field] ||
|
|
1561
|
+
if (type === 'date' || type === 'datetime' || type === 'time') {
|
|
1562
|
+
const d1 = new Date(current[field] || '').getTime();
|
|
1563
|
+
const d2 = new Date(current[field] || '').getTime();
|
|
1610
1564
|
return d1 - d2;
|
|
1611
1565
|
}
|
|
1612
|
-
const s1 = (current[field] ||
|
|
1613
|
-
const s2 = (next[field] ||
|
|
1566
|
+
const s1 = (current[field] || '').toString();
|
|
1567
|
+
const s2 = (next[field] || '').toString();
|
|
1614
1568
|
if (s1 > s2) {
|
|
1615
1569
|
return 1;
|
|
1616
1570
|
}
|
|
@@ -1619,14 +1573,14 @@ class SdGridMaterial {
|
|
|
1619
1573
|
}
|
|
1620
1574
|
return 0;
|
|
1621
1575
|
});
|
|
1622
|
-
if (orderDirection ===
|
|
1576
|
+
if (orderDirection === 'desc') {
|
|
1623
1577
|
items.reverse();
|
|
1624
1578
|
}
|
|
1625
1579
|
}
|
|
1626
1580
|
}
|
|
1627
1581
|
return {
|
|
1628
1582
|
items: items.filter((item, index) => {
|
|
1629
|
-
return
|
|
1583
|
+
return index >= pageNumber * pageSize && index < (pageNumber + 1) * pageSize;
|
|
1630
1584
|
}),
|
|
1631
1585
|
total: items.length,
|
|
1632
1586
|
};
|
|
@@ -1638,15 +1592,15 @@ class SdGridMaterial {
|
|
|
1638
1592
|
rawColumnFilter: columnFilter || {},
|
|
1639
1593
|
rawExternalFilter: externalFilter || {},
|
|
1640
1594
|
rawFilterDef: filterDef || {},
|
|
1641
|
-
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) ||
|
|
1642
|
-
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) ||
|
|
1595
|
+
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
1596
|
+
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1643
1597
|
pageNumber: ((_c = __classPrivateFieldGet(this, _paginator)) === null || _c === void 0 ? void 0 : _c.pageIndex) || 0,
|
|
1644
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,
|
|
1645
1599
|
};
|
|
1646
1600
|
});
|
|
1647
1601
|
_load$1.set(this, (filterReq, force = true) => __awaiter(this, void 0, void 0, function* () {
|
|
1648
1602
|
this.isLoading = true;
|
|
1649
|
-
if (this.gridOption.type ===
|
|
1603
|
+
if (this.gridOption.type === 'server') {
|
|
1650
1604
|
try {
|
|
1651
1605
|
let result = this.gridOption.items(filterReq);
|
|
1652
1606
|
if (isObservable(result)) {
|
|
@@ -1660,7 +1614,7 @@ class SdGridMaterial {
|
|
|
1660
1614
|
}
|
|
1661
1615
|
catch (error) {
|
|
1662
1616
|
console.error(error);
|
|
1663
|
-
this.notifyService.notify.warning(
|
|
1617
|
+
this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
1664
1618
|
return {
|
|
1665
1619
|
items: [],
|
|
1666
1620
|
total: 0,
|
|
@@ -1682,13 +1636,13 @@ class SdGridMaterial {
|
|
|
1682
1636
|
__classPrivateFieldSet(this, _localItems, results || []);
|
|
1683
1637
|
}
|
|
1684
1638
|
if (!Array.isArray(__classPrivateFieldGet(this, _localItems))) {
|
|
1685
|
-
this.notifyService.notify.warning(
|
|
1639
|
+
this.notifyService.notify.warning('Dữ liệu không phải là một mảng');
|
|
1686
1640
|
__classPrivateFieldSet(this, _localItems, []);
|
|
1687
1641
|
}
|
|
1688
1642
|
}
|
|
1689
1643
|
catch (error) {
|
|
1690
1644
|
console.error(error);
|
|
1691
|
-
this.notifyService.notify.warning(
|
|
1645
|
+
this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
1692
1646
|
__classPrivateFieldSet(this, _localItems, []);
|
|
1693
1647
|
}
|
|
1694
1648
|
finally {
|
|
@@ -1711,7 +1665,7 @@ class SdGridMaterial {
|
|
|
1711
1665
|
item.originItem = Object.assign({}, item);
|
|
1712
1666
|
});
|
|
1713
1667
|
yield ((_d = (_c = (_b = this.gridOption) === null || _b === void 0 ? void 0 : _b.reload) === null || _c === void 0 ? void 0 : _c.onReload) === null || _d === void 0 ? void 0 : _d.call(_c, this.items));
|
|
1714
|
-
this.isSelectAll = this.items.every(
|
|
1668
|
+
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
1715
1669
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1716
1670
|
}));
|
|
1717
1671
|
this.reload = (force = true) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1736,7 +1690,7 @@ class SdGridMaterial {
|
|
|
1736
1690
|
}
|
|
1737
1691
|
else {
|
|
1738
1692
|
const filterInfo = __classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize);
|
|
1739
|
-
if (this.gridOption.type ===
|
|
1693
|
+
if (this.gridOption.type === 'server') {
|
|
1740
1694
|
let result = this.gridOption.items(filterInfo);
|
|
1741
1695
|
if (isObservable(result)) {
|
|
1742
1696
|
result = result.toPromise();
|
|
@@ -1745,7 +1699,7 @@ class SdGridMaterial {
|
|
|
1745
1699
|
}
|
|
1746
1700
|
else {
|
|
1747
1701
|
let exportedItems = [];
|
|
1748
|
-
if (typeof this.gridOption.items ===
|
|
1702
|
+
if (typeof this.gridOption.items === 'function') {
|
|
1749
1703
|
const results = this.gridOption.items();
|
|
1750
1704
|
if (results instanceof Promise) {
|
|
1751
1705
|
exportedItems = yield results;
|
|
@@ -1764,24 +1718,24 @@ class SdGridMaterial {
|
|
|
1764
1718
|
_allColumns.set(this, () => {
|
|
1765
1719
|
const columns = [];
|
|
1766
1720
|
this.gridOption.columns
|
|
1767
|
-
.filter(
|
|
1768
|
-
.forEach(
|
|
1721
|
+
.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })
|
|
1722
|
+
.forEach(column => {
|
|
1769
1723
|
var _a, _b;
|
|
1770
|
-
if (column.type ===
|
|
1724
|
+
if (column.type === 'image') {
|
|
1771
1725
|
return;
|
|
1772
1726
|
}
|
|
1773
|
-
if (column.type ===
|
|
1774
|
-
(_a = column.children) === null || _a === void 0 ? void 0 : _a.filter(
|
|
1775
|
-
if (childColumn.type ===
|
|
1727
|
+
if (column.type === 'children') {
|
|
1728
|
+
(_a = column.children) === null || _a === void 0 ? void 0 : _a.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach(childColumn => {
|
|
1729
|
+
if (childColumn.type === 'image') {
|
|
1776
1730
|
return;
|
|
1777
1731
|
}
|
|
1778
1732
|
columns.push(childColumn);
|
|
1779
1733
|
});
|
|
1780
1734
|
return;
|
|
1781
1735
|
}
|
|
1782
|
-
if (column.type ===
|
|
1783
|
-
(_b = column.children) === null || _b === void 0 ? void 0 : _b.filter(
|
|
1784
|
-
if (childColumn.type ===
|
|
1736
|
+
if (column.type === 'children-col') {
|
|
1737
|
+
(_b = column.children) === null || _b === void 0 ? void 0 : _b.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach(childColumn => {
|
|
1738
|
+
if (childColumn.type === 'image') {
|
|
1785
1739
|
return;
|
|
1786
1740
|
}
|
|
1787
1741
|
columns.push(childColumn);
|
|
@@ -1794,7 +1748,7 @@ class SdGridMaterial {
|
|
|
1794
1748
|
});
|
|
1795
1749
|
_allExportedColumns.set(this, () => {
|
|
1796
1750
|
var _a, _b;
|
|
1797
|
-
return ((
|
|
1751
|
+
return ((_b = (_a = this.gridOption.export) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })) || [];
|
|
1798
1752
|
});
|
|
1799
1753
|
_onExport.set(this, (args) => __awaiter(this, void 0, void 0, function* () {
|
|
1800
1754
|
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
@@ -1815,7 +1769,7 @@ class SdGridMaterial {
|
|
|
1815
1769
|
promises = [];
|
|
1816
1770
|
exportItems = [];
|
|
1817
1771
|
for (const result of results) {
|
|
1818
|
-
if (
|
|
1772
|
+
if ('items' in result) {
|
|
1819
1773
|
exportItems = [...exportItems, ...result.items];
|
|
1820
1774
|
total = result.total;
|
|
1821
1775
|
}
|
|
@@ -1842,8 +1796,8 @@ class SdGridMaterial {
|
|
|
1842
1796
|
const handle = (exportColumn) => __awaiter(this, void 0, void 0, function* () {
|
|
1843
1797
|
var _t, _u, _v;
|
|
1844
1798
|
obj[exportColumn.field] = item[exportColumn.field];
|
|
1845
|
-
const column = allColumns.find(
|
|
1846
|
-
const exportedColumn = allExportedColumns.find(
|
|
1799
|
+
const column = allColumns.find(e => e.field === exportColumn.field);
|
|
1800
|
+
const exportedColumn = allExportedColumns.find(e => e.field === exportColumn.field);
|
|
1847
1801
|
if (exportedColumn === null || exportedColumn === void 0 ? void 0 : exportedColumn.transform) {
|
|
1848
1802
|
obj[exportedColumn.field] = exportedColumn.transform(item[exportedColumn.field], item);
|
|
1849
1803
|
return;
|
|
@@ -1851,11 +1805,11 @@ class SdGridMaterial {
|
|
|
1851
1805
|
if (!column) {
|
|
1852
1806
|
return;
|
|
1853
1807
|
}
|
|
1854
|
-
if (column.type ===
|
|
1855
|
-
column === null || column === void 0 ? void 0 : column.children.forEach(
|
|
1808
|
+
if (column.type === 'children' || column.type === 'children-col') {
|
|
1809
|
+
column === null || column === void 0 ? void 0 : column.children.forEach(childColumn => handle(childColumn));
|
|
1856
1810
|
return;
|
|
1857
1811
|
}
|
|
1858
|
-
if (!columns.some(
|
|
1812
|
+
if (!columns.some(e => e.field === column.field)) {
|
|
1859
1813
|
return;
|
|
1860
1814
|
}
|
|
1861
1815
|
if (column.transform) {
|
|
@@ -1868,55 +1822,52 @@ class SdGridMaterial {
|
|
|
1868
1822
|
else {
|
|
1869
1823
|
obj[column.field] = transform;
|
|
1870
1824
|
}
|
|
1871
|
-
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t :
|
|
1825
|
+
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t : '';
|
|
1872
1826
|
}
|
|
1873
|
-
else if (item[column.field] === undefined ||
|
|
1874
|
-
|
|
1875
|
-
item[column.field] === "") {
|
|
1876
|
-
obj[column.field] = "";
|
|
1827
|
+
else if (item[column.field] === undefined || item[column.field] === null || item[column.field] === '') {
|
|
1828
|
+
obj[column.field] = '';
|
|
1877
1829
|
}
|
|
1878
|
-
else if (column.type ===
|
|
1830
|
+
else if (column.type === 'string' || column.type === 'number') {
|
|
1879
1831
|
// Nếu cell là string hoặc number thì gán bằng chính nó
|
|
1880
1832
|
obj[column.field] = item[column.field];
|
|
1881
1833
|
}
|
|
1882
|
-
else if (column.type ===
|
|
1834
|
+
else if (column.type === 'bool') {
|
|
1883
1835
|
// Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
|
|
1884
1836
|
if (item[column.field]) {
|
|
1885
|
-
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) ||
|
|
1837
|
+
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) || 'True';
|
|
1886
1838
|
}
|
|
1887
|
-
else if (obj[column.field] !== undefined &&
|
|
1888
|
-
obj[column.field]
|
|
1889
|
-
obj[column.field] = ((_v = column.option) === null || _v === void 0 ? void 0 : _v.displayOnFalse) || "False";
|
|
1839
|
+
else if (obj[column.field] !== undefined && obj[column.field] !== null) {
|
|
1840
|
+
obj[column.field] = ((_v = column.option) === null || _v === void 0 ? void 0 : _v.displayOnFalse) || 'False';
|
|
1890
1841
|
}
|
|
1891
1842
|
}
|
|
1892
|
-
else if (column.type ===
|
|
1843
|
+
else if (column.type === 'date') {
|
|
1893
1844
|
let date = item[column.field];
|
|
1894
1845
|
const { transformDate } = column;
|
|
1895
1846
|
if (transformDate) {
|
|
1896
1847
|
date = transformDate(date, item);
|
|
1897
1848
|
}
|
|
1898
1849
|
// Nếu là date thì convert theo đúng format
|
|
1899
|
-
obj[column.field] = Date.toFormat(date,
|
|
1850
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy');
|
|
1900
1851
|
}
|
|
1901
|
-
else if (column.type ===
|
|
1852
|
+
else if (column.type === 'datetime') {
|
|
1902
1853
|
let date = item[column.field];
|
|
1903
1854
|
const { transformDate } = column;
|
|
1904
1855
|
if (transformDate) {
|
|
1905
1856
|
date = transformDate(date, item);
|
|
1906
1857
|
}
|
|
1907
1858
|
// Nếu là datetime thì convert theo đúng format
|
|
1908
|
-
obj[column.field] = Date.toFormat(date,
|
|
1859
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy HH:mm');
|
|
1909
1860
|
}
|
|
1910
|
-
else if (column.type ===
|
|
1861
|
+
else if (column.type === 'time') {
|
|
1911
1862
|
let date = item[column.field];
|
|
1912
1863
|
const { transformDate } = column;
|
|
1913
1864
|
if (transformDate) {
|
|
1914
1865
|
date = transformDate(date, item);
|
|
1915
1866
|
}
|
|
1916
1867
|
// Nếu là time thì convert theo đúng format
|
|
1917
|
-
obj[column.field] = Date.toFormat(date,
|
|
1868
|
+
obj[column.field] = Date.toFormat(date, 'HH:mm');
|
|
1918
1869
|
}
|
|
1919
|
-
else if (column.type ===
|
|
1870
|
+
else if (column.type === 'values') {
|
|
1920
1871
|
// Nếu là values thì lấy giá trị của value được chọn
|
|
1921
1872
|
obj[column.field] = yield this.columnValuesPipe.transform(item[column.field], column);
|
|
1922
1873
|
}
|
|
@@ -1997,8 +1948,17 @@ class SdGridMaterial {
|
|
|
1997
1948
|
__classPrivateFieldGet(this, _onExport).call(this, args);
|
|
1998
1949
|
});
|
|
1999
1950
|
this.onFilterChange = () => {
|
|
2000
|
-
|
|
2001
|
-
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
|
+
}
|
|
2002
1962
|
};
|
|
2003
1963
|
this.onExpand = (rowData) => __awaiter(this, void 0, void 0, function* () {
|
|
2004
1964
|
var _w, _x, _y, _z, _0;
|
|
@@ -2014,12 +1974,12 @@ class SdGridMaterial {
|
|
|
2014
1974
|
}
|
|
2015
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);
|
|
2016
1976
|
if (!((_0 = this.gridOption.subInformation) === null || _0 === void 0 ? void 0 : _0.multiple)) {
|
|
2017
|
-
this.items.forEach(
|
|
1977
|
+
this.items.forEach(item => (item.isExpanding = item.isExpanded = false));
|
|
2018
1978
|
}
|
|
2019
1979
|
if (data instanceof Promise) {
|
|
2020
1980
|
rowData.isExpanding = true;
|
|
2021
1981
|
data
|
|
2022
|
-
.then(
|
|
1982
|
+
.then(res => {
|
|
2023
1983
|
rowData.expandDetail = res;
|
|
2024
1984
|
rowData.isExpanded = true;
|
|
2025
1985
|
})
|
|
@@ -2033,46 +1993,43 @@ class SdGridMaterial {
|
|
|
2033
1993
|
this.onSelect = (rowData) => {
|
|
2034
1994
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2035
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) {
|
|
2036
|
-
(_c = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _c === void 0 ? void 0 : _c.items.forEach(
|
|
2037
|
-
(_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(
|
|
2038
|
-
this.isSelectAll = this.items.every(
|
|
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));
|
|
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));
|
|
1998
|
+
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
2039
1999
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2040
2000
|
}
|
|
2041
2001
|
else {
|
|
2042
2002
|
if ((_f = this.gridOption.selection) === null || _f === void 0 ? void 0 : _f.single) {
|
|
2043
|
-
this.items
|
|
2044
|
-
.filter((e) => e !== rowData)
|
|
2045
|
-
.forEach((e) => (e.isSelected = false));
|
|
2003
|
+
this.items.filter(e => e !== rowData).forEach(e => (e.isSelected = false));
|
|
2046
2004
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2047
2005
|
return;
|
|
2048
2006
|
}
|
|
2049
|
-
(_h = (_g = this.gridOption.selection) === null || _g === void 0 ? void 0 : _g.onSelect) === null || _h === void 0 ? void 0 : _h.call(_g, rowData, this.items.filter(
|
|
2050
|
-
this.isSelectAll = this.items.every(
|
|
2007
|
+
(_h = (_g = this.gridOption.selection) === null || _g === void 0 ? void 0 : _g.onSelect) === null || _h === void 0 ? void 0 : _h.call(_g, rowData, this.items.filter(e => e.isSelected));
|
|
2008
|
+
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
2051
2009
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2052
2010
|
}
|
|
2053
2011
|
};
|
|
2054
2012
|
this.onSelectAll = () => {
|
|
2055
2013
|
var _a, _b, _c;
|
|
2056
|
-
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach(
|
|
2014
|
+
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach(e => {
|
|
2057
2015
|
var _a, _b, _c, _d;
|
|
2058
|
-
if (e.selectable &&
|
|
2059
|
-
(!((_c = (_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.selection) === null || _b === void 0 ? void 0 : _b.actions) === null || _c === void 0 ? void 0 : _c.length) || ((_d = e.actions) === null || _d === void 0 ? void 0 : _d.length))) {
|
|
2016
|
+
if (e.selectable && (!((_c = (_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.selection) === null || _b === void 0 ? void 0 : _b.actions) === null || _c === void 0 ? void 0 : _c.length) || ((_d = e.actions) === null || _d === void 0 ? void 0 : _d.length))) {
|
|
2060
2017
|
e.isSelected = this.isSelectAll;
|
|
2061
2018
|
}
|
|
2062
2019
|
});
|
|
2063
|
-
(_c = (_b = this.gridOption.selection) === null || _b === void 0 ? void 0 : _b.onSelectAll) === null || _c === void 0 ? void 0 : _c.call(_b, this.items.filter(
|
|
2020
|
+
(_c = (_b = this.gridOption.selection) === null || _b === void 0 ? void 0 : _b.onSelectAll) === null || _c === void 0 ? void 0 : _c.call(_b, this.items.filter(e => e.isSelected));
|
|
2064
2021
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2065
2022
|
};
|
|
2066
2023
|
this.onClearSelection = (items) => {
|
|
2067
2024
|
items = items || this.items;
|
|
2068
2025
|
this.isSelectAll = false;
|
|
2069
|
-
items === null || items === void 0 ? void 0 : items.forEach(
|
|
2026
|
+
items === null || items === void 0 ? void 0 : items.forEach(e => (e.isSelected = false));
|
|
2070
2027
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2071
2028
|
};
|
|
2072
2029
|
_updateSelectedItems.set(this, () => {
|
|
2073
2030
|
this.selectedItems = this.items
|
|
2074
|
-
.filter(
|
|
2075
|
-
.map(
|
|
2031
|
+
.filter(item => item.isSelected)
|
|
2032
|
+
.map(item => {
|
|
2076
2033
|
const { isSelected, isExpanded, isExpanding, expandDetail, editorErrorMessage, editorHandlerColumn, editorHandlerRow, editorStatus, originItem, sdId, sdVersion } = item,
|
|
2077
2034
|
// Giữ lại các trường thông tin cho selectable (action, groupedAction, sdGroup, selectable)
|
|
2078
2035
|
result = __rest(item, ["isSelected", "isExpanded", "isExpanding", "expandDetail", "editorErrorMessage", "editorHandlerColumn", "editorHandlerRow", "editorStatus", "originItem", "sdId", "sdVersion"]);
|
|
@@ -2090,10 +2047,6 @@ class SdGridMaterial {
|
|
|
2090
2047
|
externalFilter,
|
|
2091
2048
|
filterDef,
|
|
2092
2049
|
});
|
|
2093
|
-
// if (this.gridOption?.filter?.inlineColumn && args?.columnFilter) {
|
|
2094
|
-
// this.columnFilter = args.columnFilter;
|
|
2095
|
-
// }
|
|
2096
|
-
// this.gridFilter?.setFilter(args);
|
|
2097
2050
|
};
|
|
2098
2051
|
this.onCreate = () => {
|
|
2099
2052
|
var _a, _b;
|
|
@@ -2103,49 +2056,49 @@ class SdGridMaterial {
|
|
|
2103
2056
|
}
|
|
2104
2057
|
const item = {};
|
|
2105
2058
|
// Gán giá trị mặc định
|
|
2106
|
-
columns.forEach(
|
|
2107
|
-
if (column.type ===
|
|
2108
|
-
item[column.field] =
|
|
2059
|
+
columns.forEach(column => {
|
|
2060
|
+
if (column.type === 'values') {
|
|
2061
|
+
item[column.field] = '';
|
|
2109
2062
|
}
|
|
2110
|
-
else if (column.type ===
|
|
2063
|
+
else if (column.type === 'bool') {
|
|
2111
2064
|
item[column.field] = true;
|
|
2112
2065
|
}
|
|
2113
|
-
else if (column.type ===
|
|
2066
|
+
else if (column.type === 'number') {
|
|
2114
2067
|
item[column.field] = null;
|
|
2115
2068
|
}
|
|
2116
2069
|
});
|
|
2117
|
-
if (type ===
|
|
2070
|
+
if (type === 'local') {
|
|
2118
2071
|
(_a = editor.onAdd) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
2119
2072
|
}
|
|
2120
2073
|
else {
|
|
2121
2074
|
(_b = editor.onAdd) === null || _b === void 0 ? void 0 : _b.call(editor, item, this.items);
|
|
2122
2075
|
}
|
|
2123
2076
|
// Đưa item lên dòng đầu tiên nếu type khác popup
|
|
2124
|
-
if (editor.type !==
|
|
2077
|
+
if (editor.type !== 'popup') {
|
|
2125
2078
|
if (editor.addToLast) {
|
|
2126
|
-
if (type ===
|
|
2079
|
+
if (type === 'local') {
|
|
2127
2080
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems), item]);
|
|
2128
2081
|
}
|
|
2129
2082
|
this.items = [...this.items, item];
|
|
2130
2083
|
}
|
|
2131
2084
|
else {
|
|
2132
|
-
if (type ===
|
|
2085
|
+
if (type === 'local') {
|
|
2133
2086
|
__classPrivateFieldSet(this, _localItems, [item, ...__classPrivateFieldGet(this, _localItems)]);
|
|
2134
2087
|
}
|
|
2135
2088
|
this.items = [item, ...this.items];
|
|
2136
2089
|
}
|
|
2137
2090
|
}
|
|
2138
|
-
item.editorStatus =
|
|
2091
|
+
item.editorStatus = 'create';
|
|
2139
2092
|
item.editorHandlerRow = {
|
|
2140
2093
|
temporary: Object.assign({}, item),
|
|
2141
2094
|
};
|
|
2142
2095
|
};
|
|
2143
2096
|
this.onUpdate = (item) => {
|
|
2144
2097
|
const { editor } = this.gridOption;
|
|
2145
|
-
item.editorStatus =
|
|
2098
|
+
item.editorStatus = 'update';
|
|
2146
2099
|
item.editorHandlerRow = Object.assign(Object.assign({}, item.editorHandlerRow), { temporary: Object.assign({}, item) });
|
|
2147
2100
|
// this.generateEditorHanlder(item);
|
|
2148
|
-
if (editor.type ===
|
|
2101
|
+
if (editor.type === 'popup') {
|
|
2149
2102
|
// Xử lý case popup
|
|
2150
2103
|
// this.sdGridPopupEditor.open(item, columns, isModified);
|
|
2151
2104
|
}
|
|
@@ -2178,8 +2131,8 @@ class SdGridMaterial {
|
|
|
2178
2131
|
yield result;
|
|
2179
2132
|
}
|
|
2180
2133
|
}
|
|
2181
|
-
if (item.editorStatus ===
|
|
2182
|
-
if (this.gridOption.type ===
|
|
2134
|
+
if (item.editorStatus === 'create' && editor.type === 'popup') {
|
|
2135
|
+
if (this.gridOption.type === 'local') {
|
|
2183
2136
|
this.items.splice(0, 0, item);
|
|
2184
2137
|
}
|
|
2185
2138
|
// this.viewItems.splice(0, 0, item);
|
|
@@ -2198,8 +2151,8 @@ class SdGridMaterial {
|
|
|
2198
2151
|
this.onCancel = (item) => {
|
|
2199
2152
|
var _a, _b;
|
|
2200
2153
|
const { editor } = this.gridOption;
|
|
2201
|
-
if (editor.type ===
|
|
2202
|
-
if (this.gridOption.type ===
|
|
2154
|
+
if (editor.type === 'inline') {
|
|
2155
|
+
if (this.gridOption.type === 'local') {
|
|
2203
2156
|
const idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
2204
2157
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
2205
2158
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems)]);
|
|
@@ -2207,7 +2160,7 @@ class SdGridMaterial {
|
|
|
2207
2160
|
const idx1 = this.items.indexOf(item);
|
|
2208
2161
|
this.items.splice(idx1, 1);
|
|
2209
2162
|
this.items = [...this.items];
|
|
2210
|
-
if (this.gridOption.type ===
|
|
2163
|
+
if (this.gridOption.type === 'local') {
|
|
2211
2164
|
(_a = editor === null || editor === void 0 ? void 0 : editor.onCancel) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
2212
2165
|
}
|
|
2213
2166
|
else {
|
|
@@ -2216,9 +2169,9 @@ class SdGridMaterial {
|
|
|
2216
2169
|
this.ref.detectChanges();
|
|
2217
2170
|
return;
|
|
2218
2171
|
}
|
|
2219
|
-
if (editor.type ===
|
|
2220
|
-
if (item.editorStatus ===
|
|
2221
|
-
if (this.gridOption.type ===
|
|
2172
|
+
if (editor.type === 'focus') {
|
|
2173
|
+
if (item.editorStatus === 'create') {
|
|
2174
|
+
if (this.gridOption.type === 'local') {
|
|
2222
2175
|
const idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
2223
2176
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
2224
2177
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems)]);
|
|
@@ -2251,8 +2204,8 @@ class SdGridMaterial {
|
|
|
2251
2204
|
}
|
|
2252
2205
|
}
|
|
2253
2206
|
}
|
|
2254
|
-
if (editor.type ===
|
|
2255
|
-
if (this.gridOption.type ===
|
|
2207
|
+
if (editor.type === 'inline') {
|
|
2208
|
+
if (this.gridOption.type === 'local') {
|
|
2256
2209
|
const idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
2257
2210
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
2258
2211
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems)]);
|
|
@@ -2260,7 +2213,7 @@ class SdGridMaterial {
|
|
|
2260
2213
|
const idx1 = this.items.indexOf(item);
|
|
2261
2214
|
this.items.splice(idx1, 1);
|
|
2262
2215
|
this.items = [...this.items];
|
|
2263
|
-
if (this.gridOption.type ===
|
|
2216
|
+
if (this.gridOption.type === 'local') {
|
|
2264
2217
|
(_1 = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _1 === void 0 ? void 0 : _1.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
2265
2218
|
}
|
|
2266
2219
|
else {
|
|
@@ -2315,13 +2268,9 @@ class SdGridMaterial {
|
|
|
2315
2268
|
}
|
|
2316
2269
|
set option(option) {
|
|
2317
2270
|
if (option) {
|
|
2318
|
-
option = __classPrivateFieldGet(this, _initConfiguration).call(this, option);
|
|
2271
|
+
option = __classPrivateFieldGet(this, _initConfiguration$1).call(this, option);
|
|
2319
2272
|
this.gridOption = option;
|
|
2320
|
-
// this.#loadFilterRegister();
|
|
2321
2273
|
__classPrivateFieldSet(this, _loadCompleted, false);
|
|
2322
|
-
// this.#reload.next({
|
|
2323
|
-
// force: true,
|
|
2324
|
-
// });
|
|
2325
2274
|
const configuration = this.gridConfigurationService.init(this.key, this.gridOption);
|
|
2326
2275
|
this.gridConfigurationObserver = configuration.observer;
|
|
2327
2276
|
configuration.load();
|
|
@@ -2364,16 +2313,12 @@ class SdGridMaterial {
|
|
|
2364
2313
|
})))
|
|
2365
2314
|
.subscribe(__classPrivateFieldGet(this, _render)));
|
|
2366
2315
|
__classPrivateFieldGet(this, _subscription$2).add(this.sdCellDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
2367
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.sdFooterDefs.changes
|
|
2368
|
-
|
|
2369
|
-
.subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
2370
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.sdFilterDefs.changes
|
|
2371
|
-
.pipe(startWith([]))
|
|
2372
|
-
.subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
2316
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.sdFooterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
2317
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.sdFilterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
2373
2318
|
__classPrivateFieldGet(this, _subscription$2).add(combineLatest([
|
|
2374
2319
|
__classPrivateFieldGet(this, _optionChanges).pipe(startWith(this.gridOption)),
|
|
2375
2320
|
this.sdFilterDefs.changes.pipe(startWith(this.filterDefs)),
|
|
2376
|
-
]).subscribe((
|
|
2321
|
+
]).subscribe(() => {
|
|
2377
2322
|
__classPrivateFieldGet(this, _loadFilterRegister).call(this);
|
|
2378
2323
|
}));
|
|
2379
2324
|
this.ref.detectChanges();
|
|
@@ -2386,22 +2331,22 @@ class SdGridMaterial {
|
|
|
2386
2331
|
}
|
|
2387
2332
|
get editedItems() {
|
|
2388
2333
|
return this.items
|
|
2389
|
-
.filter(
|
|
2334
|
+
.filter(item => {
|
|
2390
2335
|
if (!item.originItem) {
|
|
2391
2336
|
return true;
|
|
2392
2337
|
}
|
|
2393
|
-
if (Object.keys(item.originItem).some(
|
|
2338
|
+
if (Object.keys(item.originItem).some(key => item.originItem[key] !== item[key])) {
|
|
2394
2339
|
return true;
|
|
2395
2340
|
}
|
|
2396
2341
|
return false;
|
|
2397
2342
|
})
|
|
2398
|
-
.map(
|
|
2343
|
+
.map(item => {
|
|
2399
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"]);
|
|
2400
2345
|
return Object.assign(Object.assign({}, result), { editorErrorMessage });
|
|
2401
2346
|
});
|
|
2402
2347
|
}
|
|
2403
2348
|
get gridItems() {
|
|
2404
|
-
return this.items.map(
|
|
2349
|
+
return this.items.map(item => {
|
|
2405
2350
|
const { editorStatus, editorHandlerRow, editorHandlerColumn, expandDetail, isExpanded, isExpanding, isSelected, originItem, sdId, sdVersion, selectable, actions, groupedActions, sdGroup, temporary } = item, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem", "sdId", "sdVersion", "selectable", "actions", "groupedActions", "sdGroup", "temporary"]);
|
|
2406
2351
|
return result;
|
|
2407
2352
|
});
|
|
@@ -2410,25 +2355,25 @@ class SdGridMaterial {
|
|
|
2410
2355
|
return __classPrivateFieldGet(this, _localItems);
|
|
2411
2356
|
}
|
|
2412
2357
|
get localGridItems() {
|
|
2413
|
-
return __classPrivateFieldGet(this, _localItems).map(
|
|
2358
|
+
return __classPrivateFieldGet(this, _localItems).map(item => {
|
|
2414
2359
|
const { editorStatus, editorHandlerRow, editorHandlerColumn, expandDetail, isExpanded, isExpanding, isSelected, originItem, sdId, sdVersion, selectable, actions, groupedActions, sdGroup, temporary } = item, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem", "sdId", "sdVersion", "selectable", "actions", "groupedActions", "sdGroup", "temporary"]);
|
|
2415
2360
|
return result;
|
|
2416
2361
|
});
|
|
2417
2362
|
}
|
|
2418
2363
|
get isEditing() {
|
|
2419
|
-
return this.items.some(
|
|
2364
|
+
return this.items.some(e => e.editorStatus !== undefined);
|
|
2420
2365
|
}
|
|
2421
2366
|
}
|
|
2422
|
-
_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();
|
|
2423
2368
|
SdGridMaterial.decorators = [
|
|
2424
2369
|
{ type: Component, args: [{
|
|
2425
|
-
selector:
|
|
2370
|
+
selector: 'sd-grid-material',
|
|
2426
2371
|
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>",
|
|
2427
2372
|
animations: [
|
|
2428
|
-
trigger(
|
|
2429
|
-
state(
|
|
2430
|
-
state(
|
|
2431
|
-
transition(
|
|
2373
|
+
trigger('detailExpand', [
|
|
2374
|
+
state('collapsed', style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
2375
|
+
state('expanded', style({ height: '*', visibility: 'visible' })),
|
|
2376
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
2432
2377
|
]),
|
|
2433
2378
|
],
|
|
2434
2379
|
styles: [".text-black400{color:#757575}:host{display:flex;flex-direction:column;height:100%;overflow:auto}:host .c-container{display:flex;flex:1;flex-direction:column;min-height:200px;position:relative}:host .c-container .c-table{flex:1;min-height:300px;position:relative}:host .c-container .c-table table{border-collapse:separate;width:100%}:host .c-container .c-table table tr.c-first-header.mat-header-row,:host .c-container .c-table table tr.c-second-header.mat-header-row{height:40px}:host .c-container .c-table table tr.c-detail-row{height:0}:host .c-container .c-table table tr.c-row.activated{background-color:#e5ecff}:host .c-container .c-table table tr.c-row.selected{background-color:#eef2ff}:host .c-container .c-table table tr.c-row:not(.selected):not(.activated):hover{background-color:#f5f5f5}:host .c-container .c-table table tr.c-row td{border-bottom-width:0}:host .c-container .c-table table tr.c-row.c-expandable{cursor:pointer}:host .c-container .c-table table tr.c-row.c-expandable:hover{background:#f5f5f5}:host .c-container .c-table table th.mat-header-cell{background-color:#f2f3f4;border-bottom:0!important}:host .c-container .c-table table td.mat-cell,:host .c-container .c-table table td.mat-footer-cell,:host .c-container .c-table table th.mat-header-cell{border-bottom-color:#f2f2f2!important}:host .c-container .c-table .c-th{color:#212121;font-size:14px;font-weight:500;line-height:20px;vertical-align:middle}:host .c-container .c-table .c-td:first{padding-left:10px}:host .c-container .c-loading{align-items:center;background:rgba(0,0,0,.15);bottom:56px;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:2}:host .c-container .c-paginator{align-items:center;background-color:#fff;display:flex;flex-direction:row;justify-content:space-between}:host .c-container .c-paginator .c-action{padding:5px}:host .c-container .c-empty{background-color:#fff;border:none!important;text-align:center}:host .c-container .c-empty mat-icon{font-size:150px;height:auto;margin-bottom:30px;margin-top:30px;opacity:.2;width:auto}:host button.c-btn-add{background-color:#fff;box-shadow:0 2px 4px rgba(47,49,54,.16)}:host mat-icon.c-icon{color:rgba(0,0,0,.54)!important}:host mat-icon.c-icon-add{color:#2962ff!important}:host .lds-ring{display:inline-block;height:40px;position:relative;width:40px}:host .lds-ring div{-webkit-animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border:4px solid transparent;border-radius:50%;border-top-color:#cef;box-sizing:border-box;display:block;height:32px;margin:4px;position:absolute;width:32px}:host .lds-ring div:first-child{-webkit-animation-delay:-.45s;animation-delay:-.45s}:host .lds-ring div:nth-child(2){-webkit-animation-delay:-.3s;animation-delay:-.3s}:host .lds-ring div:nth-child(3){-webkit-animation-delay:-.15s;animation-delay:-.15s}:host .style1 .mat-table{border:1px solid #dde0e5}:host .style1 .mat-table tr.mat-header-row{background:#f2f3f4}:host .style1 .mat-table th.mat-header-cell{padding:10px 0}:host .style1 .c-paginator{border:1px solid #dde0e5;border-top:none!important}:host .style1 .mat-form-field-wrapper{background:#fff;padding:0}@-webkit-keyframes lds-ring{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes lds-ring{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}:host ::ng-deep .mat-sort-header-content{display:block;text-align:left;width:100%}:host ::ng-deep .mat-select-arrow{color:#a6a6a6}:host ::ng-deep .mat-sort-header-disabled{background-image:none!important;cursor:default!important;padding-right:0!important}:host ::ng-deep .mat-sort-header-container{align-items:start!important}:host ::ng-deep .mat-sort-header-arrow{margin-top:4px!important}:host ::ng-deep .mat-sort-header{cursor:pointer}:host ::ng-deep .mat-sort-header[aria-sort]{background-position:center right 0;background-repeat:no-repeat;background-size:16px 16px;cursor:pointer;padding-right:24px}:host ::ng-deep .mat-sort-header[aria-sort=none]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z'/%3E%3C/svg%3E\")}:host ::ng-deep .mat-sort-header[aria-sort=ascending]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z'/%3E%3C/svg%3E\")}:host ::ng-deep .mat-sort-header[aria-sort=descending]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z'/%3E%3C/svg%3E\")}"]
|