@sd-angular/core 1.3.104 → 1.3.106
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 +332 -393
- 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 +21 -15
- package/esm2015/grid-material/src/lib/components/popup-filter/popup-filter.component.js +17 -26
- package/esm2015/grid-material/src/lib/grid-material.component.js +175 -203
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.service.js +99 -127
- package/esm2015/setting/src/lib/setting.service.js +22 -26
- package/fesm2015/sd-angular-core-grid-material.js +299 -358
- 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/popup-filter/popup-filter.component.d.ts +6 -12
- package/grid-material/src/lib/grid-material.component.d.ts +28 -28
- 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.104.tgz → sd-angular-core-1.3.106.tgz} +0 -0
- package/setting/sd-angular-core-setting.metadata.json +1 -1
|
@@ -5,10 +5,11 @@ import { MatPaginator, MatPaginatorIntl, MatPaginatorModule } from '@angular/mat
|
|
|
5
5
|
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
6
6
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
7
7
|
import { v4 } from 'uuid';
|
|
8
|
-
import {
|
|
8
|
+
import { BehaviorSubject, Subscription, 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 { map, debounceTime, switchMap
|
|
11
|
+
import { startWith, map, debounceTime, switchMap } from 'rxjs/operators';
|
|
12
|
+
import { SdModal } from '@sd-angular/core/modal';
|
|
12
13
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
13
14
|
import { SdLoadingService } from '@sd-angular/core/loading';
|
|
14
15
|
import { SdTranslateService } from '@sd-angular/core/translate';
|
|
@@ -132,7 +133,7 @@ const DEFAULT_GRID_MATERIAL_CONFIG = {
|
|
|
132
133
|
};
|
|
133
134
|
const GRID_MATERIAL_CONFIG = new InjectionToken('sd-grid-material.configuration');
|
|
134
135
|
|
|
135
|
-
var _filterRegister
|
|
136
|
+
var _filterRegister;
|
|
136
137
|
class SdPopupFilter {
|
|
137
138
|
constructor(cdRef) {
|
|
138
139
|
this.cdRef = cdRef;
|
|
@@ -146,8 +147,15 @@ class SdPopupFilter {
|
|
|
146
147
|
this.filterDefs = [];
|
|
147
148
|
this.filterDef = {};
|
|
148
149
|
this.inlineFilterDef = {};
|
|
149
|
-
_subscription.set(this, new Subscription());
|
|
150
150
|
this.open = () => {
|
|
151
|
+
const configuration = __classPrivateFieldGet(this, _filterRegister).configuration.get();
|
|
152
|
+
this.inlineColumn = JSON.parse(JSON.stringify(configuration.inlineColumn));
|
|
153
|
+
this.inlineExternal = JSON.parse(JSON.stringify(configuration.inlineExternal));
|
|
154
|
+
this.inlineFilterDef = JSON.parse(JSON.stringify(configuration.inlineFilterDef));
|
|
155
|
+
const filterValue = __classPrivateFieldGet(this, _filterRegister).value.get();
|
|
156
|
+
this.columnFilter = JSON.parse(JSON.stringify(filterValue.columnFilter));
|
|
157
|
+
this.externalFilter = JSON.parse(JSON.stringify(filterValue.externalFilter));
|
|
158
|
+
this.filterDef = JSON.parse(JSON.stringify(filterValue.filterDef));
|
|
151
159
|
this.modal.open();
|
|
152
160
|
this.cdRef.markForCheck();
|
|
153
161
|
};
|
|
@@ -164,7 +172,7 @@ class SdPopupFilter {
|
|
|
164
172
|
__classPrivateFieldGet(this, _filterRegister).value.set({
|
|
165
173
|
columnFilter: this.columnFilter,
|
|
166
174
|
externalFilter: this.externalFilter,
|
|
167
|
-
filterDef: this.filterDef
|
|
175
|
+
filterDef: this.filterDef,
|
|
168
176
|
});
|
|
169
177
|
this.modal.close();
|
|
170
178
|
this.cdRef.markForCheck();
|
|
@@ -173,35 +181,19 @@ class SdPopupFilter {
|
|
|
173
181
|
set filterRegister(value) {
|
|
174
182
|
__classPrivateFieldSet(this, _filterRegister, value);
|
|
175
183
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterRegister).configuration.observer.subscribe(configuration => {
|
|
179
|
-
this.inlineColumn = JSON.parse(JSON.stringify(configuration.inlineColumn));
|
|
180
|
-
this.inlineExternal = JSON.parse(JSON.stringify(configuration.inlineExternal));
|
|
181
|
-
this.inlineFilterDef = JSON.parse(JSON.stringify(configuration.inlineFilterDef));
|
|
182
|
-
this.cdRef.markForCheck();
|
|
183
|
-
}));
|
|
184
|
-
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterRegister).value.observer.subscribe(filterValue => {
|
|
185
|
-
this.columnFilter = JSON.parse(JSON.stringify(filterValue.columnFilter));
|
|
186
|
-
this.externalFilter = JSON.parse(JSON.stringify(filterValue.externalFilter));
|
|
187
|
-
this.filterDef = JSON.parse(JSON.stringify(filterValue.filterDef));
|
|
188
|
-
this.cdRef.markForCheck();
|
|
189
|
-
}));
|
|
190
|
-
}
|
|
191
|
-
ngOnDestroy() {
|
|
192
|
-
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
193
|
-
}
|
|
184
|
+
ngAfterViewInit() { }
|
|
185
|
+
ngOnDestroy() { }
|
|
194
186
|
onClear() {
|
|
195
187
|
__classPrivateFieldGet(this, _filterRegister).value.remove();
|
|
196
188
|
this.modal.close();
|
|
197
189
|
this.cdRef.markForCheck();
|
|
198
190
|
}
|
|
199
191
|
}
|
|
200
|
-
_filterRegister = new WeakMap()
|
|
192
|
+
_filterRegister = new WeakMap();
|
|
201
193
|
SdPopupFilter.decorators = [
|
|
202
194
|
{ type: Component, args: [{
|
|
203
195
|
selector: 'sd-popup-filter',
|
|
204
|
-
template: "<sd-modal width=\"500px\" [title]=\"'Filter' | sdTranslate\"
|
|
196
|
+
template: "<sd-modal width=\"500px\" [title]=\"'Filter' | sdTranslate\">\r\n <sd-modal-body class=\"c-popup-filter\">\r\n <ng-container *ngFor=\"let column of columns | sdFilterColumn\">\r\n <div class=\"d-flex align-items-baseline\">\r\n <ng-container>\r\n <div *sdDesktop class=\"c-checkable\">\r\n <mat-slide-toggle [(ngModel)]=\"inlineColumn[column.field]\" color=\"primary\"></mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-filterable\">\r\n <sd-input\r\n *ngIf=\"column.type === 'string'\"\r\n [label]=\"column.title\"\r\n type=\"text\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-input>\r\n <sd-input\r\n *ngIf=\"column.type === 'number'\"\r\n [label]=\"column.title\"\r\n type=\" number\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-input>\r\n <sd-select\r\n *ngIf=\"column.type === 'bool'\"\r\n [label]=\"column.title\"\r\n [items]=\"[\r\n { value: '1', display: column.trueValue || 'True' },\r\n { value: '0', display: column.falseValue || 'False' }\r\n ]\"\r\n valueField=\"value\"\r\n displayField=\"display\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-select>\r\n <sd-select\r\n *ngIf=\"column.type === 'values' && !column?.editor?.autocomplete\"\r\n [label]=\"column.title\"\r\n [items]=\"column.option.items\"\r\n [valueField]=\"column.option.valueField\"\r\n [displayField]=\"column.option.displayField\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-select>\r\n <sd-autocomplete\r\n *ngIf=\"column.type === 'values' && column?.editor?.autocomplete\"\r\n [label]=\"column.title\"\r\n [items]=\"column.option.items\"\r\n [valueField]=\"column.option.valueField\"\r\n [displayField]=\"column.option.displayField\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-date-time\r\n *ngIf=\"column.type === 'date' || column.type === 'datetime' || column.type === 'time'\"\r\n [label]=\"column.title\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n type=\"date\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal\">\r\n <div class=\"d-flex align-items-baseline\">\r\n <ng-container>\r\n <div *sdDesktop class=\"c-checkable\">\r\n <mat-slide-toggle [(ngModel)]=\"inlineExternal[item.field]\" color=\"primary\"></mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-filterable\">\r\n <sd-input\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'string'\"\r\n type=\"text\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"externalFilter[item.field]\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'bool'\"\r\n [items]=\"[\r\n { value: '1', display: item.option?.displayOnTrue || 'True' },\r\n { value: '0', display: item.option?.displayOnFalse || 'False' }\r\n ]\"\r\n valueField=\"value\"\r\n displayField=\"display\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n appearance=\"outline\">\r\n </sd-select>\r\n <ng-container *ngIf=\"item.type === 'values'\">\r\n <sd-select\r\n *ngIf=\"item.option?.selection === 'MULTIPLE'\"\r\n [label]=\"item.title\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n appearance=\"outline\"\r\n multiple>\r\n </sd-select>\r\n <sd-autocomplete\r\n *ngIf=\"item.option?.selection === 'AUTOCOMPLETE'\"\r\n [label]=\"item.title\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n appearance=\"outline\"\r\n [(model)]=\"externalFilter[item.field]\">\r\n </sd-autocomplete>\r\n <sd-select\r\n *ngIf=\"item.option?.selection === 'MULTIPLEAUTOCOMPLETE'\"\r\n [label]=\"item.title\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n appearance=\"outline\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n filtered=\"true\"\r\n multiple>\r\n </sd-select>\r\n <sd-select\r\n *ngIf=\"!item.option?.selection\"\r\n [label]=\"item.title\"\r\n [items]=\"item.values\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n appearance=\"outline\"\r\n [(model)]=\"externalFilter[item.field]\">\r\n </sd-select>\r\n </ng-container>\r\n <sd-date-time\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'date' || item.type === 'datetime'\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n [type]=\"item.type\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n <sd-date-range\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'daterange' && externalFilter[item.field]\"\r\n [(from)]=\"externalFilter[item.field].from\"\r\n [(to)]=\"externalFilter[item.field].to\"\r\n [min]=\"item.minDate\"\r\n [max]=\"item.maxDate\"\r\n appearance=\"outline\">\r\n </sd-date-range>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngFor=\"let filter of filterDefs\">\r\n <div class=\"d-flex align-items-baseline\">\r\n <ng-container>\r\n <div *sdDesktop class=\"c-checkable\">\r\n <mat-slide-toggle [(ngModel)]=\"inlineFilterDef[filter.sdMaterialFilterDef]\" color=\"primary\"> </mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-filterable\">\r\n <ng-container *ngTemplateOutlet=\"filter.templateRef; context: { filterDef: filterDef }\"> </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </sd-modal-body>\r\n <sd-modal-footer *sdDesktop>\r\n <sd-button class=\"mr-auto\" (action)=\"onClear()\" title=\"M\u1EB7c \u0111\u1ECBnh\" size=\"sm\" type=\"link\"> </sd-button>\r\n <sd-button (action)=\"onApply()\" title=\"\u0110\u1ED3ng \u00FD\" color=\"primary\" size=\"sm\" type=\"fill\"></sd-button>\r\n </sd-modal-footer>\r\n <sd-modal-footer *sdMobileTablet>\r\n <sd-button style=\"flex: 1; padding-right: 5px\" (action)=\"onClear()\" title=\"M\u1EB7c \u0111\u1ECBnh\" width=\"100%\" size=\"sm\" type=\"link\"></sd-button>\r\n <sd-button\r\n style=\"flex: 1; padding-left: 5px\"\r\n (action)=\"onApply()\"\r\n title=\"\u0110\u1ED3ng \u00FD\"\r\n color=\"primary\"\r\n width=\"100%\"\r\n size=\"sm\"\r\n type=\"fill\"></sd-button>\r\n </sd-modal-footer>\r\n</sd-modal>\r\n",
|
|
205
197
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
206
198
|
styles: [".c-checkable{width:50px}.c-filterable{flex:1}::ng-deep sd-modal-body.c-popup-filter .mat-form-field-wrapper{padding-bottom:0}"]
|
|
207
199
|
},] }
|
|
@@ -210,14 +202,14 @@ SdPopupFilter.ctorParameters = () => [
|
|
|
210
202
|
{ type: ChangeDetectorRef }
|
|
211
203
|
];
|
|
212
204
|
SdPopupFilter.propDecorators = {
|
|
213
|
-
modal: [{ type: ViewChild, args: [
|
|
205
|
+
modal: [{ type: ViewChild, args: [SdModal,] }],
|
|
214
206
|
filterRegister: [{ type: Input }],
|
|
215
207
|
externalFilters: [{ type: Input }],
|
|
216
208
|
columns: [{ type: Input }],
|
|
217
209
|
filterDefs: [{ type: Input }]
|
|
218
210
|
};
|
|
219
211
|
|
|
220
|
-
var _subscription
|
|
212
|
+
var _subscription;
|
|
221
213
|
class SdGridFilter {
|
|
222
214
|
constructor(ref, deviceService) {
|
|
223
215
|
this.ref = ref;
|
|
@@ -232,12 +224,12 @@ class SdGridFilter {
|
|
|
232
224
|
this.inlineColumn = {};
|
|
233
225
|
this.externalFilter = {};
|
|
234
226
|
this.inlineExternal = {};
|
|
235
|
-
_subscription
|
|
227
|
+
_subscription.set(this, new Subscription());
|
|
236
228
|
this.onFilter = (item) => {
|
|
237
229
|
this.filterRegister.value.set({
|
|
238
230
|
columnFilter: this.columnFilter,
|
|
239
231
|
externalFilter: this.externalFilter,
|
|
240
|
-
filterDef: this.filterDef
|
|
232
|
+
filterDef: this.filterDef,
|
|
241
233
|
});
|
|
242
234
|
};
|
|
243
235
|
this.open = () => {
|
|
@@ -256,26 +248,31 @@ class SdGridFilter {
|
|
|
256
248
|
this.filterRegister = value;
|
|
257
249
|
this.filterRegisterChange.next(this.filterRegister);
|
|
258
250
|
}
|
|
259
|
-
;
|
|
260
251
|
ngAfterViewInit() {
|
|
261
|
-
__classPrivateFieldGet(this, _subscription
|
|
262
|
-
this.
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
252
|
+
__classPrivateFieldGet(this, _subscription).add(this.filterRegisterChange.pipe(startWith(this.filterRegister)).subscribe(filterRegister => {
|
|
253
|
+
if (this.filterRegister) {
|
|
254
|
+
__classPrivateFieldGet(this, _subscription).add(this.filterRegister.configuration.observer.subscribe(configuration => {
|
|
255
|
+
const { inlineColumn, inlineExternal, inlineFilterDef } = configuration;
|
|
256
|
+
this.inlineColumn = inlineColumn;
|
|
257
|
+
this.inlineExternal = inlineExternal;
|
|
258
|
+
this.inlineFilterDef = inlineFilterDef;
|
|
259
|
+
this.ref.markForCheck();
|
|
260
|
+
}));
|
|
261
|
+
__classPrivateFieldGet(this, _subscription).add(this.filterRegister.value.observer.subscribe(value => {
|
|
262
|
+
const { columnFilter, externalFilter, filterDef } = value;
|
|
263
|
+
this.columnFilter = columnFilter;
|
|
264
|
+
this.externalFilter = externalFilter;
|
|
265
|
+
this.filterDef = filterDef;
|
|
266
|
+
this.ref.markForCheck();
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
272
269
|
}));
|
|
273
270
|
}
|
|
274
271
|
ngOnDestroy() {
|
|
275
|
-
__classPrivateFieldGet(this, _subscription
|
|
272
|
+
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
276
273
|
}
|
|
277
274
|
}
|
|
278
|
-
_subscription
|
|
275
|
+
_subscription = new WeakMap();
|
|
279
276
|
SdGridFilter.decorators = [
|
|
280
277
|
{ type: Component, args: [{
|
|
281
278
|
selector: 'sd-grid-filter',
|
|
@@ -1128,12 +1125,12 @@ SdEditorHandlerColumnPipe.ctorParameters = () => [
|
|
|
1128
1125
|
{ type: NgZone }
|
|
1129
1126
|
];
|
|
1130
1127
|
|
|
1131
|
-
var _filterConfiguration, _filterValue, _cache$2,
|
|
1128
|
+
var _filterConfiguration, _filterValue, _cache$2, _defaultConfiguration, _defaultValue, _initConfiguration, _initValue;
|
|
1132
1129
|
class SdGridFilterService {
|
|
1133
1130
|
constructor(settingService) {
|
|
1134
1131
|
this.settingService = settingService;
|
|
1135
|
-
_filterConfiguration.set(this,
|
|
1136
|
-
_filterValue.set(this,
|
|
1132
|
+
_filterConfiguration.set(this, 'GRID-FILTER-CONFIGURATION');
|
|
1133
|
+
_filterValue.set(this, 'GRID-FILTER-VALUE');
|
|
1137
1134
|
_cache$2.set(this, {});
|
|
1138
1135
|
this.register = (key, args) => {
|
|
1139
1136
|
let cacheSession = false;
|
|
@@ -1146,150 +1143,66 @@ class SdGridFilterService {
|
|
|
1146
1143
|
cacheSession = true; // Nếu không có key thì chỉ lưu theo session
|
|
1147
1144
|
}
|
|
1148
1145
|
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());
|
|
1146
|
+
// Setting của filter configuration
|
|
1163
1147
|
const filterConfiguration = this.settingService.create({
|
|
1164
1148
|
prefix: __classPrivateFieldGet(this, _filterConfiguration),
|
|
1165
1149
|
key,
|
|
1166
1150
|
}, {
|
|
1167
|
-
default:
|
|
1168
|
-
type: cacheSession ?
|
|
1151
|
+
default: __classPrivateFieldGet(this, _defaultConfiguration).call(this, args),
|
|
1152
|
+
type: cacheSession ? 'session' : undefined,
|
|
1169
1153
|
});
|
|
1154
|
+
// Lấy giá trị configuration merge với giá trị defaultShowing của args nếu như args có thay đổi
|
|
1155
|
+
filterConfiguration.set(__classPrivateFieldGet(this, _initConfiguration).call(this, args, filterConfiguration.get()));
|
|
1156
|
+
// Setting của filter value
|
|
1170
1157
|
const filterValue = this.settingService.create({
|
|
1171
1158
|
prefix: __classPrivateFieldGet(this, _filterValue),
|
|
1172
1159
|
key,
|
|
1173
1160
|
}, {
|
|
1174
|
-
default:
|
|
1175
|
-
type: cacheSession ?
|
|
1161
|
+
default: __classPrivateFieldGet(this, _defaultValue).call(this, args),
|
|
1162
|
+
type: cacheSession ? 'session' : undefined,
|
|
1176
1163
|
});
|
|
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
|
-
};
|
|
1164
|
+
// Lấy giá trị value merge với giá trị default của args nếu như args có thay đổi
|
|
1165
|
+
filterValue.set(__classPrivateFieldGet(this, _initValue).call(this, args, filterValue.get()));
|
|
1239
1166
|
__classPrivateFieldGet(this, _cache$2)[key] = {
|
|
1240
1167
|
configuration: {
|
|
1241
1168
|
get: () => {
|
|
1242
|
-
|
|
1243
|
-
return configurationGet(configuration);
|
|
1169
|
+
return filterConfiguration.get();
|
|
1244
1170
|
},
|
|
1245
1171
|
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,
|
|
1172
|
+
const { inlineColumn, inlineExternal, inlineFilterDef } = configuration;
|
|
1173
|
+
filterConfiguration.set({
|
|
1174
|
+
inlineColumn,
|
|
1175
|
+
inlineExternal,
|
|
1176
|
+
inlineFilterDef,
|
|
1177
|
+
});
|
|
1178
|
+
return {
|
|
1179
|
+
inlineColumn,
|
|
1180
|
+
inlineExternal,
|
|
1181
|
+
inlineFilterDef,
|
|
1262
1182
|
};
|
|
1263
|
-
filterConfiguration.set(updatedConfiguration);
|
|
1264
|
-
return updatedConfiguration;
|
|
1265
1183
|
},
|
|
1266
1184
|
remove: () => {
|
|
1267
1185
|
filterConfiguration.remove();
|
|
1268
1186
|
},
|
|
1269
|
-
observer: filterConfiguration.observer.pipe(
|
|
1187
|
+
observer: filterConfiguration.observer.pipe(startWith(filterConfiguration.get()),
|
|
1188
|
+
// Sử dụng mặc định nếu bị reset
|
|
1189
|
+
map(configuration => configuration || __classPrivateFieldGet(this, _defaultConfiguration).call(this, args))),
|
|
1270
1190
|
},
|
|
1271
1191
|
value: {
|
|
1272
1192
|
get: () => {
|
|
1273
|
-
|
|
1274
|
-
return valueGet(configuration);
|
|
1193
|
+
return filterValue.get();
|
|
1275
1194
|
},
|
|
1276
|
-
set: (
|
|
1277
|
-
const keys = Object.keys(
|
|
1195
|
+
set: (value) => {
|
|
1196
|
+
const keys = Object.keys(value || {});
|
|
1278
1197
|
const current = filterValue.get();
|
|
1279
1198
|
const { columnFilter, externalFilter, filterDef } = current;
|
|
1280
1199
|
const updatedConfiguration = {
|
|
1281
1200
|
// Filter column
|
|
1282
|
-
columnFilter: keys.includes(
|
|
1283
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {}
|
|
1284
|
-
: columnFilter,
|
|
1201
|
+
columnFilter: keys.includes('columnFilter') ? (value === null || value === void 0 ? void 0 : value.columnFilter) || {} : columnFilter,
|
|
1285
1202
|
// Filter external
|
|
1286
|
-
externalFilter: keys.includes(
|
|
1287
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {}
|
|
1288
|
-
: externalFilter,
|
|
1203
|
+
externalFilter: keys.includes('externalFilter') ? (value === null || value === void 0 ? void 0 : value.externalFilter) || {} : externalFilter,
|
|
1289
1204
|
// Filter def
|
|
1290
|
-
filterDef: keys.includes(
|
|
1291
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}
|
|
1292
|
-
: filterDef,
|
|
1205
|
+
filterDef: keys.includes('filterDef') ? (value === null || value === void 0 ? void 0 : value.filterDef) || {} : filterDef,
|
|
1293
1206
|
};
|
|
1294
1207
|
filterValue.set(updatedConfiguration);
|
|
1295
1208
|
return updatedConfiguration;
|
|
@@ -1297,13 +1210,69 @@ class SdGridFilterService {
|
|
|
1297
1210
|
remove: () => {
|
|
1298
1211
|
filterValue.remove();
|
|
1299
1212
|
},
|
|
1300
|
-
observer: filterValue.observer.pipe(
|
|
1213
|
+
observer: filterValue.observer.pipe(debounceTime(200), startWith(filterValue.get()),
|
|
1214
|
+
// Sử dụng mặc định nếu bị reset
|
|
1215
|
+
map(value => value || __classPrivateFieldGet(this, _defaultValue).call(this, args))),
|
|
1301
1216
|
},
|
|
1302
1217
|
};
|
|
1303
1218
|
}
|
|
1304
1219
|
return __classPrivateFieldGet(this, _cache$2)[key];
|
|
1305
1220
|
};
|
|
1306
|
-
|
|
1221
|
+
_defaultConfiguration.set(this, (args) => {
|
|
1222
|
+
var _a;
|
|
1223
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1224
|
+
const inlineColumn = {};
|
|
1225
|
+
const inlineExternal = {};
|
|
1226
|
+
const inlineFilterDef = {};
|
|
1227
|
+
// Filter column
|
|
1228
|
+
for (const item of columns || []) {
|
|
1229
|
+
inlineColumn[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.defaultShowing;
|
|
1230
|
+
}
|
|
1231
|
+
// Filter external
|
|
1232
|
+
for (const item of externalFilters || []) {
|
|
1233
|
+
inlineExternal[item.field] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1234
|
+
}
|
|
1235
|
+
// Filter def
|
|
1236
|
+
for (const item of filterDefs || []) {
|
|
1237
|
+
inlineFilterDef[item.sdMaterialFilterDef] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1238
|
+
}
|
|
1239
|
+
return {
|
|
1240
|
+
// Filter column
|
|
1241
|
+
inlineColumn,
|
|
1242
|
+
// Filter external
|
|
1243
|
+
inlineExternal,
|
|
1244
|
+
// Filter def
|
|
1245
|
+
inlineFilterDef,
|
|
1246
|
+
};
|
|
1247
|
+
});
|
|
1248
|
+
_defaultValue.set(this, (args) => {
|
|
1249
|
+
var _a;
|
|
1250
|
+
const columnFilter = {};
|
|
1251
|
+
const externalFilter = {};
|
|
1252
|
+
const filterDef = {};
|
|
1253
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1254
|
+
// Filter column
|
|
1255
|
+
for (const item of columns || []) {
|
|
1256
|
+
columnFilter[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.default;
|
|
1257
|
+
}
|
|
1258
|
+
// Filter external
|
|
1259
|
+
for (const item of externalFilters || []) {
|
|
1260
|
+
externalFilter[item.field] = item === null || item === void 0 ? void 0 : item.default;
|
|
1261
|
+
}
|
|
1262
|
+
// Filter def
|
|
1263
|
+
for (const item of filterDefs || []) {
|
|
1264
|
+
filterDef[item.sdMaterialFilterDef] = undefined;
|
|
1265
|
+
}
|
|
1266
|
+
return {
|
|
1267
|
+
// Filter column
|
|
1268
|
+
columnFilter,
|
|
1269
|
+
// Filter external
|
|
1270
|
+
externalFilter,
|
|
1271
|
+
// Filter def
|
|
1272
|
+
filterDef,
|
|
1273
|
+
};
|
|
1274
|
+
});
|
|
1275
|
+
_initConfiguration.set(this, (args, configuration) => {
|
|
1307
1276
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1308
1277
|
const { columns, externalFilters, filterDefs } = args;
|
|
1309
1278
|
const inlineColumn = {};
|
|
@@ -1330,7 +1299,7 @@ class SdGridFilterService {
|
|
|
1330
1299
|
inlineFilterDef,
|
|
1331
1300
|
};
|
|
1332
1301
|
});
|
|
1333
|
-
|
|
1302
|
+
_initValue.set(this, (args, value) => {
|
|
1334
1303
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1335
1304
|
const columnFilter = {};
|
|
1336
1305
|
const externalFilter = {};
|
|
@@ -1342,7 +1311,7 @@ class SdGridFilterService {
|
|
|
1342
1311
|
}
|
|
1343
1312
|
// Filter external
|
|
1344
1313
|
for (const item of externalFilters || []) {
|
|
1345
|
-
if (item.type ===
|
|
1314
|
+
if (item.type === 'daterange') {
|
|
1346
1315
|
externalFilter[item.field] = {
|
|
1347
1316
|
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,
|
|
1348
1317
|
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,
|
|
@@ -1367,7 +1336,7 @@ class SdGridFilterService {
|
|
|
1367
1336
|
});
|
|
1368
1337
|
}
|
|
1369
1338
|
}
|
|
1370
|
-
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(),
|
|
1339
|
+
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(), _defaultConfiguration = new WeakMap(), _defaultValue = new WeakMap(), _initConfiguration = new WeakMap(), _initValue = new WeakMap();
|
|
1371
1340
|
SdGridFilterService.decorators = [
|
|
1372
1341
|
{ type: Injectable }
|
|
1373
1342
|
];
|
|
@@ -1375,7 +1344,7 @@ SdGridFilterService.ctorParameters = () => [
|
|
|
1375
1344
|
{ type: SdSettingService }
|
|
1376
1345
|
];
|
|
1377
1346
|
|
|
1378
|
-
var _optionChanges, _localItems, _paginator, _sort, _subscription$
|
|
1347
|
+
var _optionChanges, _localItems, _paginator, _sort, _subscription$1, _subcriptionFilterRegister, _reload, _loadCompleted, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration$1, _loadFilterRegister, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
1379
1348
|
class SdGridMaterial {
|
|
1380
1349
|
constructor(ref, configuration, gridConfigurationService, exportService, notifyService, columnValuesPipe, gridFilterService, editorHandlerColumnPipe) {
|
|
1381
1350
|
this.ref = ref;
|
|
@@ -1411,11 +1380,12 @@ class SdGridMaterial {
|
|
|
1411
1380
|
// Filter
|
|
1412
1381
|
this.columnFilter = {};
|
|
1413
1382
|
// Subcription
|
|
1414
|
-
_subscription$
|
|
1383
|
+
_subscription$1.set(this, new Subscription());
|
|
1384
|
+
_subcriptionFilterRegister.set(this, new Subscription());
|
|
1415
1385
|
_reload.set(this, new Subject());
|
|
1416
1386
|
this.isExporting = false;
|
|
1417
1387
|
this.isSelectAll = false;
|
|
1418
|
-
this.exportTitle =
|
|
1388
|
+
this.exportTitle = 'Export';
|
|
1419
1389
|
_loadCompleted.set(this, false);
|
|
1420
1390
|
_initCellDef.set(this, () => {
|
|
1421
1391
|
this.cellDef = {};
|
|
@@ -1430,9 +1400,6 @@ class SdGridMaterial {
|
|
|
1430
1400
|
for (const filterDef of this.sdFilterDefs) {
|
|
1431
1401
|
this.filterDefs.push(filterDef);
|
|
1432
1402
|
}
|
|
1433
|
-
// if (this.filterDefs?.length) {
|
|
1434
|
-
// this.#loadFilterRegister();
|
|
1435
|
-
// }
|
|
1436
1403
|
});
|
|
1437
1404
|
_initFooterDef.set(this, () => {
|
|
1438
1405
|
this.footerDef = {};
|
|
@@ -1451,14 +1418,14 @@ class SdGridMaterial {
|
|
|
1451
1418
|
rawColumnFilter: columnFilter || {},
|
|
1452
1419
|
rawExternalFilter: externalFilter || {},
|
|
1453
1420
|
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) ||
|
|
1421
|
+
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
1422
|
+
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1456
1423
|
pageNumber,
|
|
1457
1424
|
pageSize,
|
|
1458
1425
|
isExported: true,
|
|
1459
1426
|
};
|
|
1460
1427
|
});
|
|
1461
|
-
_initConfiguration.set(this, (option) => {
|
|
1428
|
+
_initConfiguration$1.set(this, (option) => {
|
|
1462
1429
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1463
1430
|
// Init pagination
|
|
1464
1431
|
option.paginate = {
|
|
@@ -1473,83 +1440,65 @@ class SdGridMaterial {
|
|
|
1473
1440
|
var _a, _b, _c, _d, _e;
|
|
1474
1441
|
// Init filter
|
|
1475
1442
|
if (this.gridOption) {
|
|
1476
|
-
const hasRegister = !!this.filterRegister;
|
|
1477
1443
|
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, {
|
|
1478
1444
|
columns: (_c = this.gridOption) === null || _c === void 0 ? void 0 : _c.columns,
|
|
1479
1445
|
externalFilters: (_e = (_d = this.gridOption) === null || _d === void 0 ? void 0 : _d.filter) === null || _e === void 0 ? void 0 : _e.externalFilters,
|
|
1480
1446
|
filterDefs: this.filterDefs,
|
|
1481
1447
|
});
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
force: false,
|
|
1489
|
-
});
|
|
1490
|
-
}))
|
|
1491
|
-
.subscribe());
|
|
1492
|
-
}
|
|
1493
|
-
else {
|
|
1448
|
+
__classPrivateFieldGet(this, _subcriptionFilterRegister).unsubscribe();
|
|
1449
|
+
__classPrivateFieldSet(this, _subcriptionFilterRegister, this.filterRegister.value.observer
|
|
1450
|
+
.pipe(debounceTime(500), map(filterValue => {
|
|
1451
|
+
const { columnFilter } = filterValue;
|
|
1452
|
+
this.columnFilter = columnFilter;
|
|
1453
|
+
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1494
1454
|
__classPrivateFieldGet(this, _reload).next({
|
|
1495
|
-
force:
|
|
1455
|
+
force: false,
|
|
1496
1456
|
});
|
|
1497
|
-
}
|
|
1457
|
+
}))
|
|
1458
|
+
.subscribe());
|
|
1459
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _subcriptionFilterRegister));
|
|
1498
1460
|
}
|
|
1499
1461
|
});
|
|
1500
1462
|
_filterLocal.set(this, (localItems, filterInfo) => {
|
|
1501
1463
|
const { columns } = this.gridOption;
|
|
1502
1464
|
const { rawColumnFilter, orderBy, orderDirection, pageSize, pageNumber } = filterInfo;
|
|
1503
|
-
const items = localItems.filter(
|
|
1465
|
+
const items = localItems.filter(item => {
|
|
1504
1466
|
var _a, _b, _c, _d;
|
|
1505
1467
|
for (const column of columns) {
|
|
1506
1468
|
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();
|
|
1469
|
+
const filterValue = (rawColumnFilter[field] || '').toString().trim().toLowerCase();
|
|
1470
|
+
const columnValue = (item[field] || '').toString().trim().toLowerCase();
|
|
1515
1471
|
if (filterValue) {
|
|
1516
|
-
if (!columnValue &&
|
|
1517
|
-
type !== "datetime" &&
|
|
1518
|
-
type !== "date" &&
|
|
1519
|
-
type !== "time") {
|
|
1472
|
+
if (!columnValue && type !== 'datetime' && type !== 'date' && type !== 'time') {
|
|
1520
1473
|
return false;
|
|
1521
1474
|
}
|
|
1522
|
-
if (type ===
|
|
1475
|
+
if (type === 'string') {
|
|
1523
1476
|
if (columnValue.indexOf(filterValue) === -1) {
|
|
1524
1477
|
return false;
|
|
1525
1478
|
}
|
|
1526
1479
|
}
|
|
1527
|
-
else if (type ===
|
|
1480
|
+
else if (type === 'values') {
|
|
1528
1481
|
if (columnValue !== filterValue) {
|
|
1529
1482
|
return false;
|
|
1530
1483
|
}
|
|
1531
1484
|
}
|
|
1532
|
-
else if (type ===
|
|
1533
|
-
const fValue = +filterValue
|
|
1534
|
-
.replace(">=", "")
|
|
1535
|
-
.replace("<=", "")
|
|
1536
|
-
.replace(">", "")
|
|
1537
|
-
.replace("<", "");
|
|
1485
|
+
else if (type === 'number') {
|
|
1486
|
+
const fValue = +filterValue.replace('>=', '').replace('<=', '').replace('>', '').replace('<', '');
|
|
1538
1487
|
const cValue = +columnValue;
|
|
1539
1488
|
if (fValue || fValue === 0) {
|
|
1540
1489
|
if (!cValue && cValue !== 0) {
|
|
1541
1490
|
return false;
|
|
1542
1491
|
}
|
|
1543
|
-
if (filterValue.indexOf(
|
|
1492
|
+
if (filterValue.indexOf('>=') > -1 && cValue < fValue) {
|
|
1544
1493
|
return false;
|
|
1545
1494
|
}
|
|
1546
|
-
else if (filterValue.indexOf(
|
|
1495
|
+
else if (filterValue.indexOf('<=') > -1 && cValue > fValue) {
|
|
1547
1496
|
return false;
|
|
1548
1497
|
}
|
|
1549
|
-
else if (filterValue.indexOf(
|
|
1498
|
+
else if (filterValue.indexOf('<') > -1 && cValue >= fValue) {
|
|
1550
1499
|
return false;
|
|
1551
1500
|
}
|
|
1552
|
-
else if (filterValue.indexOf(
|
|
1501
|
+
else if (filterValue.indexOf('>') > -1 && cValue <= fValue) {
|
|
1553
1502
|
return false;
|
|
1554
1503
|
}
|
|
1555
1504
|
else if (cValue !== fValue) {
|
|
@@ -1557,21 +1506,15 @@ class SdGridMaterial {
|
|
|
1557
1506
|
}
|
|
1558
1507
|
}
|
|
1559
1508
|
}
|
|
1560
|
-
else if (type ===
|
|
1561
|
-
if (filterValue ===
|
|
1562
|
-
columnValue !== "1" &&
|
|
1563
|
-
columnValue !== "true") {
|
|
1509
|
+
else if (type === 'bool') {
|
|
1510
|
+
if (filterValue === '1' && columnValue !== '1' && columnValue !== 'true') {
|
|
1564
1511
|
return false;
|
|
1565
1512
|
}
|
|
1566
|
-
else if (filterValue ===
|
|
1567
|
-
columnValue !== "0" &&
|
|
1568
|
-
columnValue !== "false") {
|
|
1513
|
+
else if (filterValue === '0' && columnValue !== '0' && columnValue !== 'false') {
|
|
1569
1514
|
return false;
|
|
1570
1515
|
}
|
|
1571
1516
|
}
|
|
1572
|
-
else if (type ===
|
|
1573
|
-
type === "date" ||
|
|
1574
|
-
type === "time") {
|
|
1517
|
+
else if (type === 'datetime' || type === 'date' || type === 'time') {
|
|
1575
1518
|
const from = (_b = (_a = rawColumnFilter[field]) === null || _a === void 0 ? void 0 : _a.from) !== null && _b !== void 0 ? _b : rawColumnFilter[field];
|
|
1576
1519
|
const to = (_d = (_c = rawColumnFilter[field]) === null || _c === void 0 ? void 0 : _c.to) !== null && _d !== void 0 ? _d : rawColumnFilter[field];
|
|
1577
1520
|
const fromDate = Date.begin(from);
|
|
@@ -1597,20 +1540,20 @@ class SdGridMaterial {
|
|
|
1597
1540
|
});
|
|
1598
1541
|
// Sort
|
|
1599
1542
|
if (orderBy && orderDirection) {
|
|
1600
|
-
const column = columns.find(
|
|
1543
|
+
const column = columns.find(e => e.field === orderBy);
|
|
1601
1544
|
if (column) {
|
|
1602
1545
|
const { type, field } = column;
|
|
1603
1546
|
items.sort((current, next) => {
|
|
1604
|
-
if (type ===
|
|
1547
|
+
if (type === 'number') {
|
|
1605
1548
|
return (current[field] || 0) - (next[field] || 0);
|
|
1606
1549
|
}
|
|
1607
|
-
if (type ===
|
|
1608
|
-
const d1 = new Date(current[field] ||
|
|
1609
|
-
const d2 = new Date(current[field] ||
|
|
1550
|
+
if (type === 'date' || type === 'datetime' || type === 'time') {
|
|
1551
|
+
const d1 = new Date(current[field] || '').getTime();
|
|
1552
|
+
const d2 = new Date(current[field] || '').getTime();
|
|
1610
1553
|
return d1 - d2;
|
|
1611
1554
|
}
|
|
1612
|
-
const s1 = (current[field] ||
|
|
1613
|
-
const s2 = (next[field] ||
|
|
1555
|
+
const s1 = (current[field] || '').toString();
|
|
1556
|
+
const s2 = (next[field] || '').toString();
|
|
1614
1557
|
if (s1 > s2) {
|
|
1615
1558
|
return 1;
|
|
1616
1559
|
}
|
|
@@ -1619,14 +1562,14 @@ class SdGridMaterial {
|
|
|
1619
1562
|
}
|
|
1620
1563
|
return 0;
|
|
1621
1564
|
});
|
|
1622
|
-
if (orderDirection ===
|
|
1565
|
+
if (orderDirection === 'desc') {
|
|
1623
1566
|
items.reverse();
|
|
1624
1567
|
}
|
|
1625
1568
|
}
|
|
1626
1569
|
}
|
|
1627
1570
|
return {
|
|
1628
1571
|
items: items.filter((item, index) => {
|
|
1629
|
-
return
|
|
1572
|
+
return index >= pageNumber * pageSize && index < (pageNumber + 1) * pageSize;
|
|
1630
1573
|
}),
|
|
1631
1574
|
total: items.length,
|
|
1632
1575
|
};
|
|
@@ -1638,15 +1581,15 @@ class SdGridMaterial {
|
|
|
1638
1581
|
rawColumnFilter: columnFilter || {},
|
|
1639
1582
|
rawExternalFilter: externalFilter || {},
|
|
1640
1583
|
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) ||
|
|
1584
|
+
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
1585
|
+
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1643
1586
|
pageNumber: ((_c = __classPrivateFieldGet(this, _paginator)) === null || _c === void 0 ? void 0 : _c.pageIndex) || 0,
|
|
1644
1587
|
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
1588
|
};
|
|
1646
1589
|
});
|
|
1647
1590
|
_load$1.set(this, (filterReq, force = true) => __awaiter(this, void 0, void 0, function* () {
|
|
1648
1591
|
this.isLoading = true;
|
|
1649
|
-
if (this.gridOption.type ===
|
|
1592
|
+
if (this.gridOption.type === 'server') {
|
|
1650
1593
|
try {
|
|
1651
1594
|
let result = this.gridOption.items(filterReq);
|
|
1652
1595
|
if (isObservable(result)) {
|
|
@@ -1660,7 +1603,7 @@ class SdGridMaterial {
|
|
|
1660
1603
|
}
|
|
1661
1604
|
catch (error) {
|
|
1662
1605
|
console.error(error);
|
|
1663
|
-
this.notifyService.notify.warning(
|
|
1606
|
+
this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
1664
1607
|
return {
|
|
1665
1608
|
items: [],
|
|
1666
1609
|
total: 0,
|
|
@@ -1682,13 +1625,13 @@ class SdGridMaterial {
|
|
|
1682
1625
|
__classPrivateFieldSet(this, _localItems, results || []);
|
|
1683
1626
|
}
|
|
1684
1627
|
if (!Array.isArray(__classPrivateFieldGet(this, _localItems))) {
|
|
1685
|
-
this.notifyService.notify.warning(
|
|
1628
|
+
this.notifyService.notify.warning('Dữ liệu không phải là một mảng');
|
|
1686
1629
|
__classPrivateFieldSet(this, _localItems, []);
|
|
1687
1630
|
}
|
|
1688
1631
|
}
|
|
1689
1632
|
catch (error) {
|
|
1690
1633
|
console.error(error);
|
|
1691
|
-
this.notifyService.notify.warning(
|
|
1634
|
+
this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
1692
1635
|
__classPrivateFieldSet(this, _localItems, []);
|
|
1693
1636
|
}
|
|
1694
1637
|
finally {
|
|
@@ -1711,7 +1654,7 @@ class SdGridMaterial {
|
|
|
1711
1654
|
item.originItem = Object.assign({}, item);
|
|
1712
1655
|
});
|
|
1713
1656
|
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(
|
|
1657
|
+
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
1715
1658
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1716
1659
|
}));
|
|
1717
1660
|
this.reload = (force = true) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1736,7 +1679,7 @@ class SdGridMaterial {
|
|
|
1736
1679
|
}
|
|
1737
1680
|
else {
|
|
1738
1681
|
const filterInfo = __classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize);
|
|
1739
|
-
if (this.gridOption.type ===
|
|
1682
|
+
if (this.gridOption.type === 'server') {
|
|
1740
1683
|
let result = this.gridOption.items(filterInfo);
|
|
1741
1684
|
if (isObservable(result)) {
|
|
1742
1685
|
result = result.toPromise();
|
|
@@ -1745,7 +1688,7 @@ class SdGridMaterial {
|
|
|
1745
1688
|
}
|
|
1746
1689
|
else {
|
|
1747
1690
|
let exportedItems = [];
|
|
1748
|
-
if (typeof this.gridOption.items ===
|
|
1691
|
+
if (typeof this.gridOption.items === 'function') {
|
|
1749
1692
|
const results = this.gridOption.items();
|
|
1750
1693
|
if (results instanceof Promise) {
|
|
1751
1694
|
exportedItems = yield results;
|
|
@@ -1764,24 +1707,24 @@ class SdGridMaterial {
|
|
|
1764
1707
|
_allColumns.set(this, () => {
|
|
1765
1708
|
const columns = [];
|
|
1766
1709
|
this.gridOption.columns
|
|
1767
|
-
.filter(
|
|
1768
|
-
.forEach(
|
|
1710
|
+
.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })
|
|
1711
|
+
.forEach(column => {
|
|
1769
1712
|
var _a, _b;
|
|
1770
|
-
if (column.type ===
|
|
1713
|
+
if (column.type === 'image') {
|
|
1771
1714
|
return;
|
|
1772
1715
|
}
|
|
1773
|
-
if (column.type ===
|
|
1774
|
-
(_a = column.children) === null || _a === void 0 ? void 0 : _a.filter(
|
|
1775
|
-
if (childColumn.type ===
|
|
1716
|
+
if (column.type === 'children') {
|
|
1717
|
+
(_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 => {
|
|
1718
|
+
if (childColumn.type === 'image') {
|
|
1776
1719
|
return;
|
|
1777
1720
|
}
|
|
1778
1721
|
columns.push(childColumn);
|
|
1779
1722
|
});
|
|
1780
1723
|
return;
|
|
1781
1724
|
}
|
|
1782
|
-
if (column.type ===
|
|
1783
|
-
(_b = column.children) === null || _b === void 0 ? void 0 : _b.filter(
|
|
1784
|
-
if (childColumn.type ===
|
|
1725
|
+
if (column.type === 'children-col') {
|
|
1726
|
+
(_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 => {
|
|
1727
|
+
if (childColumn.type === 'image') {
|
|
1785
1728
|
return;
|
|
1786
1729
|
}
|
|
1787
1730
|
columns.push(childColumn);
|
|
@@ -1794,7 +1737,7 @@ class SdGridMaterial {
|
|
|
1794
1737
|
});
|
|
1795
1738
|
_allExportedColumns.set(this, () => {
|
|
1796
1739
|
var _a, _b;
|
|
1797
|
-
return ((
|
|
1740
|
+
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
1741
|
});
|
|
1799
1742
|
_onExport.set(this, (args) => __awaiter(this, void 0, void 0, function* () {
|
|
1800
1743
|
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
@@ -1815,7 +1758,7 @@ class SdGridMaterial {
|
|
|
1815
1758
|
promises = [];
|
|
1816
1759
|
exportItems = [];
|
|
1817
1760
|
for (const result of results) {
|
|
1818
|
-
if (
|
|
1761
|
+
if ('items' in result) {
|
|
1819
1762
|
exportItems = [...exportItems, ...result.items];
|
|
1820
1763
|
total = result.total;
|
|
1821
1764
|
}
|
|
@@ -1842,8 +1785,8 @@ class SdGridMaterial {
|
|
|
1842
1785
|
const handle = (exportColumn) => __awaiter(this, void 0, void 0, function* () {
|
|
1843
1786
|
var _t, _u, _v;
|
|
1844
1787
|
obj[exportColumn.field] = item[exportColumn.field];
|
|
1845
|
-
const column = allColumns.find(
|
|
1846
|
-
const exportedColumn = allExportedColumns.find(
|
|
1788
|
+
const column = allColumns.find(e => e.field === exportColumn.field);
|
|
1789
|
+
const exportedColumn = allExportedColumns.find(e => e.field === exportColumn.field);
|
|
1847
1790
|
if (exportedColumn === null || exportedColumn === void 0 ? void 0 : exportedColumn.transform) {
|
|
1848
1791
|
obj[exportedColumn.field] = exportedColumn.transform(item[exportedColumn.field], item);
|
|
1849
1792
|
return;
|
|
@@ -1851,11 +1794,11 @@ class SdGridMaterial {
|
|
|
1851
1794
|
if (!column) {
|
|
1852
1795
|
return;
|
|
1853
1796
|
}
|
|
1854
|
-
if (column.type ===
|
|
1855
|
-
column === null || column === void 0 ? void 0 : column.children.forEach(
|
|
1797
|
+
if (column.type === 'children' || column.type === 'children-col') {
|
|
1798
|
+
column === null || column === void 0 ? void 0 : column.children.forEach(childColumn => handle(childColumn));
|
|
1856
1799
|
return;
|
|
1857
1800
|
}
|
|
1858
|
-
if (!columns.some(
|
|
1801
|
+
if (!columns.some(e => e.field === column.field)) {
|
|
1859
1802
|
return;
|
|
1860
1803
|
}
|
|
1861
1804
|
if (column.transform) {
|
|
@@ -1868,55 +1811,52 @@ class SdGridMaterial {
|
|
|
1868
1811
|
else {
|
|
1869
1812
|
obj[column.field] = transform;
|
|
1870
1813
|
}
|
|
1871
|
-
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t :
|
|
1814
|
+
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t : '';
|
|
1872
1815
|
}
|
|
1873
|
-
else if (item[column.field] === undefined ||
|
|
1874
|
-
|
|
1875
|
-
item[column.field] === "") {
|
|
1876
|
-
obj[column.field] = "";
|
|
1816
|
+
else if (item[column.field] === undefined || item[column.field] === null || item[column.field] === '') {
|
|
1817
|
+
obj[column.field] = '';
|
|
1877
1818
|
}
|
|
1878
|
-
else if (column.type ===
|
|
1819
|
+
else if (column.type === 'string' || column.type === 'number') {
|
|
1879
1820
|
// Nếu cell là string hoặc number thì gán bằng chính nó
|
|
1880
1821
|
obj[column.field] = item[column.field];
|
|
1881
1822
|
}
|
|
1882
|
-
else if (column.type ===
|
|
1823
|
+
else if (column.type === 'bool') {
|
|
1883
1824
|
// Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
|
|
1884
1825
|
if (item[column.field]) {
|
|
1885
|
-
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) ||
|
|
1826
|
+
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) || 'True';
|
|
1886
1827
|
}
|
|
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";
|
|
1828
|
+
else if (obj[column.field] !== undefined && obj[column.field] !== null) {
|
|
1829
|
+
obj[column.field] = ((_v = column.option) === null || _v === void 0 ? void 0 : _v.displayOnFalse) || 'False';
|
|
1890
1830
|
}
|
|
1891
1831
|
}
|
|
1892
|
-
else if (column.type ===
|
|
1832
|
+
else if (column.type === 'date') {
|
|
1893
1833
|
let date = item[column.field];
|
|
1894
1834
|
const { transformDate } = column;
|
|
1895
1835
|
if (transformDate) {
|
|
1896
1836
|
date = transformDate(date, item);
|
|
1897
1837
|
}
|
|
1898
1838
|
// Nếu là date thì convert theo đúng format
|
|
1899
|
-
obj[column.field] = Date.toFormat(date,
|
|
1839
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy');
|
|
1900
1840
|
}
|
|
1901
|
-
else if (column.type ===
|
|
1841
|
+
else if (column.type === 'datetime') {
|
|
1902
1842
|
let date = item[column.field];
|
|
1903
1843
|
const { transformDate } = column;
|
|
1904
1844
|
if (transformDate) {
|
|
1905
1845
|
date = transformDate(date, item);
|
|
1906
1846
|
}
|
|
1907
1847
|
// Nếu là datetime thì convert theo đúng format
|
|
1908
|
-
obj[column.field] = Date.toFormat(date,
|
|
1848
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy HH:mm');
|
|
1909
1849
|
}
|
|
1910
|
-
else if (column.type ===
|
|
1850
|
+
else if (column.type === 'time') {
|
|
1911
1851
|
let date = item[column.field];
|
|
1912
1852
|
const { transformDate } = column;
|
|
1913
1853
|
if (transformDate) {
|
|
1914
1854
|
date = transformDate(date, item);
|
|
1915
1855
|
}
|
|
1916
1856
|
// Nếu là time thì convert theo đúng format
|
|
1917
|
-
obj[column.field] = Date.toFormat(date,
|
|
1857
|
+
obj[column.field] = Date.toFormat(date, 'HH:mm');
|
|
1918
1858
|
}
|
|
1919
|
-
else if (column.type ===
|
|
1859
|
+
else if (column.type === 'values') {
|
|
1920
1860
|
// Nếu là values thì lấy giá trị của value được chọn
|
|
1921
1861
|
obj[column.field] = yield this.columnValuesPipe.transform(item[column.field], column);
|
|
1922
1862
|
}
|
|
@@ -1997,8 +1937,17 @@ class SdGridMaterial {
|
|
|
1997
1937
|
__classPrivateFieldGet(this, _onExport).call(this, args);
|
|
1998
1938
|
});
|
|
1999
1939
|
this.onFilterChange = () => {
|
|
2000
|
-
|
|
2001
|
-
this.
|
|
1940
|
+
var _a, _b;
|
|
1941
|
+
// this.#paginator.pageIndex = 0;
|
|
1942
|
+
// this.reload(false);
|
|
1943
|
+
if ((_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.inlineColumn) {
|
|
1944
|
+
this.filterRegister.value.set({
|
|
1945
|
+
columnFilter: this.columnFilter,
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
else {
|
|
1949
|
+
this.filterRegister.value.set({});
|
|
1950
|
+
}
|
|
2002
1951
|
};
|
|
2003
1952
|
this.onExpand = (rowData) => __awaiter(this, void 0, void 0, function* () {
|
|
2004
1953
|
var _w, _x, _y, _z, _0;
|
|
@@ -2014,12 +1963,12 @@ class SdGridMaterial {
|
|
|
2014
1963
|
}
|
|
2015
1964
|
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
1965
|
if (!((_0 = this.gridOption.subInformation) === null || _0 === void 0 ? void 0 : _0.multiple)) {
|
|
2017
|
-
this.items.forEach(
|
|
1966
|
+
this.items.forEach(item => (item.isExpanding = item.isExpanded = false));
|
|
2018
1967
|
}
|
|
2019
1968
|
if (data instanceof Promise) {
|
|
2020
1969
|
rowData.isExpanding = true;
|
|
2021
1970
|
data
|
|
2022
|
-
.then(
|
|
1971
|
+
.then(res => {
|
|
2023
1972
|
rowData.expandDetail = res;
|
|
2024
1973
|
rowData.isExpanded = true;
|
|
2025
1974
|
})
|
|
@@ -2033,46 +1982,43 @@ class SdGridMaterial {
|
|
|
2033
1982
|
this.onSelect = (rowData) => {
|
|
2034
1983
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2035
1984
|
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(
|
|
1985
|
+
(_c = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _c === void 0 ? void 0 : _c.items.forEach(e => (e.isSelected = rowData.isSelected));
|
|
1986
|
+
(_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));
|
|
1987
|
+
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
2039
1988
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2040
1989
|
}
|
|
2041
1990
|
else {
|
|
2042
1991
|
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));
|
|
1992
|
+
this.items.filter(e => e !== rowData).forEach(e => (e.isSelected = false));
|
|
2046
1993
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2047
1994
|
return;
|
|
2048
1995
|
}
|
|
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(
|
|
1996
|
+
(_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));
|
|
1997
|
+
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
2051
1998
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2052
1999
|
}
|
|
2053
2000
|
};
|
|
2054
2001
|
this.onSelectAll = () => {
|
|
2055
2002
|
var _a, _b, _c;
|
|
2056
|
-
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach(
|
|
2003
|
+
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach(e => {
|
|
2057
2004
|
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))) {
|
|
2005
|
+
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
2006
|
e.isSelected = this.isSelectAll;
|
|
2061
2007
|
}
|
|
2062
2008
|
});
|
|
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(
|
|
2009
|
+
(_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
2010
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2065
2011
|
};
|
|
2066
2012
|
this.onClearSelection = (items) => {
|
|
2067
2013
|
items = items || this.items;
|
|
2068
2014
|
this.isSelectAll = false;
|
|
2069
|
-
items === null || items === void 0 ? void 0 : items.forEach(
|
|
2015
|
+
items === null || items === void 0 ? void 0 : items.forEach(e => (e.isSelected = false));
|
|
2070
2016
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2071
2017
|
};
|
|
2072
2018
|
_updateSelectedItems.set(this, () => {
|
|
2073
2019
|
this.selectedItems = this.items
|
|
2074
|
-
.filter(
|
|
2075
|
-
.map(
|
|
2020
|
+
.filter(item => item.isSelected)
|
|
2021
|
+
.map(item => {
|
|
2076
2022
|
const { isSelected, isExpanded, isExpanding, expandDetail, editorErrorMessage, editorHandlerColumn, editorHandlerRow, editorStatus, originItem, sdId, sdVersion } = item,
|
|
2077
2023
|
// Giữ lại các trường thông tin cho selectable (action, groupedAction, sdGroup, selectable)
|
|
2078
2024
|
result = __rest(item, ["isSelected", "isExpanded", "isExpanding", "expandDetail", "editorErrorMessage", "editorHandlerColumn", "editorHandlerRow", "editorStatus", "originItem", "sdId", "sdVersion"]);
|
|
@@ -2090,10 +2036,6 @@ class SdGridMaterial {
|
|
|
2090
2036
|
externalFilter,
|
|
2091
2037
|
filterDef,
|
|
2092
2038
|
});
|
|
2093
|
-
// if (this.gridOption?.filter?.inlineColumn && args?.columnFilter) {
|
|
2094
|
-
// this.columnFilter = args.columnFilter;
|
|
2095
|
-
// }
|
|
2096
|
-
// this.gridFilter?.setFilter(args);
|
|
2097
2039
|
};
|
|
2098
2040
|
this.onCreate = () => {
|
|
2099
2041
|
var _a, _b;
|
|
@@ -2103,49 +2045,49 @@ class SdGridMaterial {
|
|
|
2103
2045
|
}
|
|
2104
2046
|
const item = {};
|
|
2105
2047
|
// Gán giá trị mặc định
|
|
2106
|
-
columns.forEach(
|
|
2107
|
-
if (column.type ===
|
|
2108
|
-
item[column.field] =
|
|
2048
|
+
columns.forEach(column => {
|
|
2049
|
+
if (column.type === 'values') {
|
|
2050
|
+
item[column.field] = '';
|
|
2109
2051
|
}
|
|
2110
|
-
else if (column.type ===
|
|
2052
|
+
else if (column.type === 'bool') {
|
|
2111
2053
|
item[column.field] = true;
|
|
2112
2054
|
}
|
|
2113
|
-
else if (column.type ===
|
|
2055
|
+
else if (column.type === 'number') {
|
|
2114
2056
|
item[column.field] = null;
|
|
2115
2057
|
}
|
|
2116
2058
|
});
|
|
2117
|
-
if (type ===
|
|
2059
|
+
if (type === 'local') {
|
|
2118
2060
|
(_a = editor.onAdd) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
2119
2061
|
}
|
|
2120
2062
|
else {
|
|
2121
2063
|
(_b = editor.onAdd) === null || _b === void 0 ? void 0 : _b.call(editor, item, this.items);
|
|
2122
2064
|
}
|
|
2123
2065
|
// Đưa item lên dòng đầu tiên nếu type khác popup
|
|
2124
|
-
if (editor.type !==
|
|
2066
|
+
if (editor.type !== 'popup') {
|
|
2125
2067
|
if (editor.addToLast) {
|
|
2126
|
-
if (type ===
|
|
2068
|
+
if (type === 'local') {
|
|
2127
2069
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems), item]);
|
|
2128
2070
|
}
|
|
2129
2071
|
this.items = [...this.items, item];
|
|
2130
2072
|
}
|
|
2131
2073
|
else {
|
|
2132
|
-
if (type ===
|
|
2074
|
+
if (type === 'local') {
|
|
2133
2075
|
__classPrivateFieldSet(this, _localItems, [item, ...__classPrivateFieldGet(this, _localItems)]);
|
|
2134
2076
|
}
|
|
2135
2077
|
this.items = [item, ...this.items];
|
|
2136
2078
|
}
|
|
2137
2079
|
}
|
|
2138
|
-
item.editorStatus =
|
|
2080
|
+
item.editorStatus = 'create';
|
|
2139
2081
|
item.editorHandlerRow = {
|
|
2140
2082
|
temporary: Object.assign({}, item),
|
|
2141
2083
|
};
|
|
2142
2084
|
};
|
|
2143
2085
|
this.onUpdate = (item) => {
|
|
2144
2086
|
const { editor } = this.gridOption;
|
|
2145
|
-
item.editorStatus =
|
|
2087
|
+
item.editorStatus = 'update';
|
|
2146
2088
|
item.editorHandlerRow = Object.assign(Object.assign({}, item.editorHandlerRow), { temporary: Object.assign({}, item) });
|
|
2147
2089
|
// this.generateEditorHanlder(item);
|
|
2148
|
-
if (editor.type ===
|
|
2090
|
+
if (editor.type === 'popup') {
|
|
2149
2091
|
// Xử lý case popup
|
|
2150
2092
|
// this.sdGridPopupEditor.open(item, columns, isModified);
|
|
2151
2093
|
}
|
|
@@ -2178,8 +2120,8 @@ class SdGridMaterial {
|
|
|
2178
2120
|
yield result;
|
|
2179
2121
|
}
|
|
2180
2122
|
}
|
|
2181
|
-
if (item.editorStatus ===
|
|
2182
|
-
if (this.gridOption.type ===
|
|
2123
|
+
if (item.editorStatus === 'create' && editor.type === 'popup') {
|
|
2124
|
+
if (this.gridOption.type === 'local') {
|
|
2183
2125
|
this.items.splice(0, 0, item);
|
|
2184
2126
|
}
|
|
2185
2127
|
// this.viewItems.splice(0, 0, item);
|
|
@@ -2198,8 +2140,8 @@ class SdGridMaterial {
|
|
|
2198
2140
|
this.onCancel = (item) => {
|
|
2199
2141
|
var _a, _b;
|
|
2200
2142
|
const { editor } = this.gridOption;
|
|
2201
|
-
if (editor.type ===
|
|
2202
|
-
if (this.gridOption.type ===
|
|
2143
|
+
if (editor.type === 'inline') {
|
|
2144
|
+
if (this.gridOption.type === 'local') {
|
|
2203
2145
|
const idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
2204
2146
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
2205
2147
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems)]);
|
|
@@ -2207,7 +2149,7 @@ class SdGridMaterial {
|
|
|
2207
2149
|
const idx1 = this.items.indexOf(item);
|
|
2208
2150
|
this.items.splice(idx1, 1);
|
|
2209
2151
|
this.items = [...this.items];
|
|
2210
|
-
if (this.gridOption.type ===
|
|
2152
|
+
if (this.gridOption.type === 'local') {
|
|
2211
2153
|
(_a = editor === null || editor === void 0 ? void 0 : editor.onCancel) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
2212
2154
|
}
|
|
2213
2155
|
else {
|
|
@@ -2216,9 +2158,9 @@ class SdGridMaterial {
|
|
|
2216
2158
|
this.ref.detectChanges();
|
|
2217
2159
|
return;
|
|
2218
2160
|
}
|
|
2219
|
-
if (editor.type ===
|
|
2220
|
-
if (item.editorStatus ===
|
|
2221
|
-
if (this.gridOption.type ===
|
|
2161
|
+
if (editor.type === 'focus') {
|
|
2162
|
+
if (item.editorStatus === 'create') {
|
|
2163
|
+
if (this.gridOption.type === 'local') {
|
|
2222
2164
|
const idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
2223
2165
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
2224
2166
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems)]);
|
|
@@ -2251,8 +2193,8 @@ class SdGridMaterial {
|
|
|
2251
2193
|
}
|
|
2252
2194
|
}
|
|
2253
2195
|
}
|
|
2254
|
-
if (editor.type ===
|
|
2255
|
-
if (this.gridOption.type ===
|
|
2196
|
+
if (editor.type === 'inline') {
|
|
2197
|
+
if (this.gridOption.type === 'local') {
|
|
2256
2198
|
const idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
2257
2199
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
2258
2200
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems)]);
|
|
@@ -2260,7 +2202,7 @@ class SdGridMaterial {
|
|
|
2260
2202
|
const idx1 = this.items.indexOf(item);
|
|
2261
2203
|
this.items.splice(idx1, 1);
|
|
2262
2204
|
this.items = [...this.items];
|
|
2263
|
-
if (this.gridOption.type ===
|
|
2205
|
+
if (this.gridOption.type === 'local') {
|
|
2264
2206
|
(_1 = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _1 === void 0 ? void 0 : _1.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
2265
2207
|
}
|
|
2266
2208
|
else {
|
|
@@ -2315,13 +2257,9 @@ class SdGridMaterial {
|
|
|
2315
2257
|
}
|
|
2316
2258
|
set option(option) {
|
|
2317
2259
|
if (option) {
|
|
2318
|
-
option = __classPrivateFieldGet(this, _initConfiguration).call(this, option);
|
|
2260
|
+
option = __classPrivateFieldGet(this, _initConfiguration$1).call(this, option);
|
|
2319
2261
|
this.gridOption = option;
|
|
2320
|
-
// this.#loadFilterRegister();
|
|
2321
2262
|
__classPrivateFieldSet(this, _loadCompleted, false);
|
|
2322
|
-
// this.#reload.next({
|
|
2323
|
-
// force: true,
|
|
2324
|
-
// });
|
|
2325
2263
|
const configuration = this.gridConfigurationService.init(this.key, this.gridOption);
|
|
2326
2264
|
this.gridConfigurationObserver = configuration.observer;
|
|
2327
2265
|
configuration.load();
|
|
@@ -2331,7 +2269,7 @@ class SdGridMaterial {
|
|
|
2331
2269
|
set paginator(paginator) {
|
|
2332
2270
|
if (paginator && __classPrivateFieldGet(this, _paginator) !== paginator) {
|
|
2333
2271
|
__classPrivateFieldSet(this, _paginator, paginator);
|
|
2334
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2272
|
+
__classPrivateFieldGet(this, _subscription$1).add(paginator.page
|
|
2335
2273
|
.pipe(map(() => {
|
|
2336
2274
|
__classPrivateFieldGet(this, _reload).next({
|
|
2337
2275
|
force: false,
|
|
@@ -2343,7 +2281,7 @@ class SdGridMaterial {
|
|
|
2343
2281
|
set sort(sort) {
|
|
2344
2282
|
if (sort && __classPrivateFieldGet(this, _sort) !== sort) {
|
|
2345
2283
|
__classPrivateFieldSet(this, _sort, sort);
|
|
2346
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2284
|
+
__classPrivateFieldGet(this, _subscription$1).add(sort.sortChange
|
|
2347
2285
|
.pipe(map(() => {
|
|
2348
2286
|
__classPrivateFieldGet(this, _reload).next({
|
|
2349
2287
|
force: false,
|
|
@@ -2356,52 +2294,55 @@ class SdGridMaterial {
|
|
|
2356
2294
|
__classPrivateFieldGet(this, _initCellDef).call(this);
|
|
2357
2295
|
}
|
|
2358
2296
|
ngAfterViewInit() {
|
|
2359
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2297
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _reload).pipe(debounceTime(200), switchMap((data) => __awaiter(this, void 0, void 0, function* () {
|
|
2360
2298
|
const filterInfo = __classPrivateFieldGet(this, _getFilter).call(this);
|
|
2361
2299
|
const result = yield __classPrivateFieldGet(this, _load$1).call(this, filterInfo, !__classPrivateFieldGet(this, _loadCompleted) || data.force);
|
|
2362
2300
|
__classPrivateFieldSet(this, _loadCompleted, true);
|
|
2363
2301
|
return result;
|
|
2364
2302
|
})))
|
|
2365
2303
|
.subscribe(__classPrivateFieldGet(this, _render)));
|
|
2366
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2367
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.sdFilterDefs.changes
|
|
2371
|
-
.pipe(startWith([]))
|
|
2372
|
-
.subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
2373
|
-
__classPrivateFieldGet(this, _subscription$2).add(combineLatest([
|
|
2304
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdCellDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
2305
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdFooterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
2306
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdFilterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
2307
|
+
__classPrivateFieldGet(this, _subscription$1).add(combineLatest([
|
|
2374
2308
|
__classPrivateFieldGet(this, _optionChanges).pipe(startWith(this.gridOption)),
|
|
2375
2309
|
this.sdFilterDefs.changes.pipe(startWith(this.filterDefs)),
|
|
2376
|
-
]).subscribe((
|
|
2310
|
+
]).subscribe(() => {
|
|
2377
2311
|
__classPrivateFieldGet(this, _loadFilterRegister).call(this);
|
|
2378
2312
|
}));
|
|
2313
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _optionChanges).subscribe(() => {
|
|
2314
|
+
if (this.filterRegister) {
|
|
2315
|
+
__classPrivateFieldGet(this, _reload).next({
|
|
2316
|
+
force: true,
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
}));
|
|
2379
2320
|
this.ref.detectChanges();
|
|
2380
2321
|
}
|
|
2381
2322
|
ngOnDestroy() {
|
|
2382
|
-
__classPrivateFieldGet(this, _subscription$
|
|
2323
|
+
__classPrivateFieldGet(this, _subscription$1).unsubscribe();
|
|
2383
2324
|
}
|
|
2384
2325
|
drop(event, columns) {
|
|
2385
2326
|
moveItemInArray(columns, event.previousIndex, event.currentIndex);
|
|
2386
2327
|
}
|
|
2387
2328
|
get editedItems() {
|
|
2388
2329
|
return this.items
|
|
2389
|
-
.filter(
|
|
2330
|
+
.filter(item => {
|
|
2390
2331
|
if (!item.originItem) {
|
|
2391
2332
|
return true;
|
|
2392
2333
|
}
|
|
2393
|
-
if (Object.keys(item.originItem).some(
|
|
2334
|
+
if (Object.keys(item.originItem).some(key => item.originItem[key] !== item[key])) {
|
|
2394
2335
|
return true;
|
|
2395
2336
|
}
|
|
2396
2337
|
return false;
|
|
2397
2338
|
})
|
|
2398
|
-
.map(
|
|
2339
|
+
.map(item => {
|
|
2399
2340
|
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
2341
|
return Object.assign(Object.assign({}, result), { editorErrorMessage });
|
|
2401
2342
|
});
|
|
2402
2343
|
}
|
|
2403
2344
|
get gridItems() {
|
|
2404
|
-
return this.items.map(
|
|
2345
|
+
return this.items.map(item => {
|
|
2405
2346
|
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
2347
|
return result;
|
|
2407
2348
|
});
|
|
@@ -2410,25 +2351,25 @@ class SdGridMaterial {
|
|
|
2410
2351
|
return __classPrivateFieldGet(this, _localItems);
|
|
2411
2352
|
}
|
|
2412
2353
|
get localGridItems() {
|
|
2413
|
-
return __classPrivateFieldGet(this, _localItems).map(
|
|
2354
|
+
return __classPrivateFieldGet(this, _localItems).map(item => {
|
|
2414
2355
|
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
2356
|
return result;
|
|
2416
2357
|
});
|
|
2417
2358
|
}
|
|
2418
2359
|
get isEditing() {
|
|
2419
|
-
return this.items.some(
|
|
2360
|
+
return this.items.some(e => e.editorStatus !== undefined);
|
|
2420
2361
|
}
|
|
2421
2362
|
}
|
|
2422
|
-
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$
|
|
2363
|
+
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$1 = new WeakMap(), _subcriptionFilterRegister = 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
2364
|
SdGridMaterial.decorators = [
|
|
2424
2365
|
{ type: Component, args: [{
|
|
2425
|
-
selector:
|
|
2366
|
+
selector: 'sd-grid-material',
|
|
2426
2367
|
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
2368
|
animations: [
|
|
2428
|
-
trigger(
|
|
2429
|
-
state(
|
|
2430
|
-
state(
|
|
2431
|
-
transition(
|
|
2369
|
+
trigger('detailExpand', [
|
|
2370
|
+
state('collapsed', style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
2371
|
+
state('expanded', style({ height: '*', visibility: 'visible' })),
|
|
2372
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
2432
2373
|
]),
|
|
2433
2374
|
],
|
|
2434
2375
|
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\")}"]
|
|
@@ -3184,7 +3125,7 @@ SdGeneratedColumnService.ctorParameters = () => [
|
|
|
3184
3125
|
{ type: SdSettingService }
|
|
3185
3126
|
];
|
|
3186
3127
|
|
|
3187
|
-
var _subscription$
|
|
3128
|
+
var _subscription$2;
|
|
3188
3129
|
class SdDynamicColumn {
|
|
3189
3130
|
constructor(ref, generatedColumnService, notifyService, translateService, gridConfigurationService) {
|
|
3190
3131
|
this.ref = ref;
|
|
@@ -3192,7 +3133,7 @@ class SdDynamicColumn {
|
|
|
3192
3133
|
this.notifyService = notifyService;
|
|
3193
3134
|
this.translateService = translateService;
|
|
3194
3135
|
this.gridConfigurationService = gridConfigurationService;
|
|
3195
|
-
_subscription$
|
|
3136
|
+
_subscription$2.set(this, new Subscription());
|
|
3196
3137
|
this.columnTypes = ['string', 'number', 'bool', 'date', 'datetime', 'time', 'values', 'children', 'children-col'];
|
|
3197
3138
|
this.form = new FormGroup({});
|
|
3198
3139
|
this.isDetail = false;
|
|
@@ -3236,22 +3177,22 @@ class SdDynamicColumn {
|
|
|
3236
3177
|
const systemSetting = this.generatedColumnService.loadSystem(this.gridOption.config);
|
|
3237
3178
|
const setting = this.generatedColumnService.load((_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.config);
|
|
3238
3179
|
if (systemSetting) {
|
|
3239
|
-
(_b = __classPrivateFieldGet(this, _subscription$
|
|
3180
|
+
(_b = __classPrivateFieldGet(this, _subscription$2)) === null || _b === void 0 ? void 0 : _b.add(systemSetting.observer.subscribe(columns => {
|
|
3240
3181
|
this.systemColumns = columns;
|
|
3241
3182
|
}));
|
|
3242
3183
|
}
|
|
3243
3184
|
if (setting) {
|
|
3244
|
-
(_c = __classPrivateFieldGet(this, _subscription$
|
|
3185
|
+
(_c = __classPrivateFieldGet(this, _subscription$2)) === null || _c === void 0 ? void 0 : _c.add(setting.observer.subscribe(columns => {
|
|
3245
3186
|
this.columns = columns;
|
|
3246
3187
|
}));
|
|
3247
3188
|
}
|
|
3248
3189
|
this.originColumns = this.gridOption.columns.filter(e => e.type !== 'children' && e.type !== 'children-col');
|
|
3249
3190
|
}
|
|
3250
3191
|
ngOnDestroy() {
|
|
3251
|
-
__classPrivateFieldGet(this, _subscription$
|
|
3192
|
+
__classPrivateFieldGet(this, _subscription$2).unsubscribe();
|
|
3252
3193
|
}
|
|
3253
3194
|
}
|
|
3254
|
-
_subscription$
|
|
3195
|
+
_subscription$2 = new WeakMap();
|
|
3255
3196
|
SdDynamicColumn.decorators = [
|
|
3256
3197
|
{ type: Component, args: [{
|
|
3257
3198
|
selector: 'sd-dynamic-column',
|