@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@sd-angular/core/common'), require('@angular/core'), require('@angular/material/paginator'), require('@angular/material/sort'), require('@angular/animations'), require('uuid'), require('rxjs'), require('@sd-angular/core/notify'), require('@angular/cdk/drag-drop'), require('rxjs/operators'), require('ngx-device-detector'), require('@sd-angular/core/loading'), require('@sd-angular/core/translate'), require('object-hash'), require('@sd-angular/core/export'), require('@angular/forms'), require('@sd-angular/core/setting'), require('@sd-angular/core/quick-action'), require('@angular/common'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/input'), require('@angular/material/table'), require('@angular/material/progress-spinner'), require('@angular/cdk/table'), require('@angular/cdk/scrolling'), require('@angular/material/menu'), require('@angular/material/slider'), require('@angular/material/button'), require('@sd-angular/core/service'), require('@angular/material/tooltip'), require('@angular/material/chips'), require('@angular/material/radio'), require('@angular/material/slide-toggle'), require('@sd-angular/core/form'), require('@angular/material/checkbox'), require('@angular/material/list'), require('@angular/material/divider'), require('@sd-angular/core/side-drawer'), require('@sd-angular/core/utility'), require('@sd-angular/core/group')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@sd-angular/core/grid-material', ['exports', '@sd-angular/core/common', '@angular/core', '@angular/material/paginator', '@angular/material/sort', '@angular/animations', 'uuid', 'rxjs', '@sd-angular/core/notify', '@angular/cdk/drag-drop', 'rxjs/operators', 'ngx-device-detector', '@sd-angular/core/loading', '@sd-angular/core/translate', 'object-hash', '@sd-angular/core/export', '@angular/forms', '@sd-angular/core/setting', '@sd-angular/core/quick-action', '@angular/common', '@angular/material/form-field', '@angular/material/icon', '@angular/material/input', '@angular/material/table', '@angular/material/progress-spinner', '@angular/cdk/table', '@angular/cdk/scrolling', '@angular/material/menu', '@angular/material/slider', '@angular/material/button', '@sd-angular/core/service', '@angular/material/tooltip', '@angular/material/chips', '@angular/material/radio', '@angular/material/slide-toggle', '@sd-angular/core/form', '@angular/material/checkbox', '@angular/material/list', '@angular/material/divider', '@sd-angular/core/side-drawer', '@sd-angular/core/utility', '@sd-angular/core/group'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sd-angular'] = global['sd-angular'] || {}, global['sd-angular'].core = global['sd-angular'].core || {}, global['sd-angular'].core['grid-material'] = {}), global['sd-angular'].core.common, global.ng.core, global.ng.material.paginator, global.ng.material.sort, global.ng.animations, global.uuid, global.rxjs, global['sd-angular'].core.notify, global.ng.cdk.dragDrop, global.rxjs.operators, global['ngx-device-detector'], global['sd-angular'].core.loading, global['sd-angular'].core.translate, global['object-hash'], global['sd-angular'].core.export, global.ng.forms, global['sd-angular'].core.setting, global['sd-angular'].core['quick-action'], global.ng.common, global.ng.material.formField, global.ng.material.icon, global.ng.material.input, global.ng.material.table, global.ng.material.progressSpinner, global.ng.cdk.table, global.ng.cdk.scrolling, global.ng.material.menu, global.ng.material.slider, global.ng.material.button, global['sd-angular'].core.service, global.ng.material.tooltip, global.ng.material.chips, global.ng.material.radio, global.ng.material.slideToggle, global['sd-angular'].core.form, global.ng.material.checkbox, global.ng.material.list, global.ng.material.divider, global['sd-angular'].core['side-drawer'], global['sd-angular'].core.utility, global['sd-angular'].core.group));
|
|
5
|
-
}(this, (function (exports, common, core, paginator, sort, animations, uuid, rxjs, notify, dragDrop, operators, ngxDeviceDetector, loading, translate, hash, _export, forms, setting, quickAction, common$1, formField, icon, input, table, progressSpinner, table$1, scrolling, menu, slider, button, service, tooltip, chips, radio, slideToggle, form, checkbox, list, divider, sideDrawer, utility, group) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@sd-angular/core/common'), require('@angular/core'), require('@angular/material/paginator'), require('@angular/material/sort'), require('@angular/animations'), require('uuid'), require('rxjs'), require('@sd-angular/core/notify'), require('@angular/cdk/drag-drop'), require('rxjs/operators'), require('@sd-angular/core/modal'), require('ngx-device-detector'), require('@sd-angular/core/loading'), require('@sd-angular/core/translate'), require('object-hash'), require('@sd-angular/core/export'), require('@angular/forms'), require('@sd-angular/core/setting'), require('@sd-angular/core/quick-action'), require('@angular/common'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/input'), require('@angular/material/table'), require('@angular/material/progress-spinner'), require('@angular/cdk/table'), require('@angular/cdk/scrolling'), require('@angular/material/menu'), require('@angular/material/slider'), require('@angular/material/button'), require('@sd-angular/core/service'), require('@angular/material/tooltip'), require('@angular/material/chips'), require('@angular/material/radio'), require('@angular/material/slide-toggle'), require('@sd-angular/core/form'), require('@angular/material/checkbox'), require('@angular/material/list'), require('@angular/material/divider'), require('@sd-angular/core/side-drawer'), require('@sd-angular/core/utility'), require('@sd-angular/core/group')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@sd-angular/core/grid-material', ['exports', '@sd-angular/core/common', '@angular/core', '@angular/material/paginator', '@angular/material/sort', '@angular/animations', 'uuid', 'rxjs', '@sd-angular/core/notify', '@angular/cdk/drag-drop', 'rxjs/operators', '@sd-angular/core/modal', 'ngx-device-detector', '@sd-angular/core/loading', '@sd-angular/core/translate', 'object-hash', '@sd-angular/core/export', '@angular/forms', '@sd-angular/core/setting', '@sd-angular/core/quick-action', '@angular/common', '@angular/material/form-field', '@angular/material/icon', '@angular/material/input', '@angular/material/table', '@angular/material/progress-spinner', '@angular/cdk/table', '@angular/cdk/scrolling', '@angular/material/menu', '@angular/material/slider', '@angular/material/button', '@sd-angular/core/service', '@angular/material/tooltip', '@angular/material/chips', '@angular/material/radio', '@angular/material/slide-toggle', '@sd-angular/core/form', '@angular/material/checkbox', '@angular/material/list', '@angular/material/divider', '@sd-angular/core/side-drawer', '@sd-angular/core/utility', '@sd-angular/core/group'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sd-angular'] = global['sd-angular'] || {}, global['sd-angular'].core = global['sd-angular'].core || {}, global['sd-angular'].core['grid-material'] = {}), global['sd-angular'].core.common, global.ng.core, global.ng.material.paginator, global.ng.material.sort, global.ng.animations, global.uuid, global.rxjs, global['sd-angular'].core.notify, global.ng.cdk.dragDrop, global.rxjs.operators, global['sd-angular'].core.modal, global['ngx-device-detector'], global['sd-angular'].core.loading, global['sd-angular'].core.translate, global['object-hash'], global['sd-angular'].core.export, global.ng.forms, global['sd-angular'].core.setting, global['sd-angular'].core['quick-action'], global.ng.common, global.ng.material.formField, global.ng.material.icon, global.ng.material.input, global.ng.material.table, global.ng.material.progressSpinner, global.ng.cdk.table, global.ng.cdk.scrolling, global.ng.material.menu, global.ng.material.slider, global.ng.material.button, global['sd-angular'].core.service, global.ng.material.tooltip, global.ng.material.chips, global.ng.material.radio, global.ng.material.slideToggle, global['sd-angular'].core.form, global.ng.material.checkbox, global.ng.material.list, global.ng.material.divider, global['sd-angular'].core['side-drawer'], global['sd-angular'].core.utility, global['sd-angular'].core.group));
|
|
5
|
+
}(this, (function (exports, common, core, paginator, sort, animations, uuid, rxjs, notify, dragDrop, operators, modal, ngxDeviceDetector, loading, translate, hash, _export, forms, setting, quickAction, common$1, formField, icon, input, table, progressSpinner, table$1, scrolling, menu, slider, button, service, tooltip, chips, radio, slideToggle, form, checkbox, list, divider, sideDrawer, utility, group) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -426,7 +426,7 @@
|
|
|
426
426
|
};
|
|
427
427
|
var GRID_MATERIAL_CONFIG = new core.InjectionToken('sd-grid-material.configuration');
|
|
428
428
|
|
|
429
|
-
var _filterRegister
|
|
429
|
+
var _filterRegister;
|
|
430
430
|
var SdPopupFilter = /** @class */ (function () {
|
|
431
431
|
function SdPopupFilter(cdRef) {
|
|
432
432
|
var _this = this;
|
|
@@ -441,8 +441,15 @@
|
|
|
441
441
|
this.filterDefs = [];
|
|
442
442
|
this.filterDef = {};
|
|
443
443
|
this.inlineFilterDef = {};
|
|
444
|
-
_subscription.set(this, new rxjs.Subscription());
|
|
445
444
|
this.open = function () {
|
|
445
|
+
var configuration = __classPrivateFieldGet(_this, _filterRegister).configuration.get();
|
|
446
|
+
_this.inlineColumn = JSON.parse(JSON.stringify(configuration.inlineColumn));
|
|
447
|
+
_this.inlineExternal = JSON.parse(JSON.stringify(configuration.inlineExternal));
|
|
448
|
+
_this.inlineFilterDef = JSON.parse(JSON.stringify(configuration.inlineFilterDef));
|
|
449
|
+
var filterValue = __classPrivateFieldGet(_this, _filterRegister).value.get();
|
|
450
|
+
_this.columnFilter = JSON.parse(JSON.stringify(filterValue.columnFilter));
|
|
451
|
+
_this.externalFilter = JSON.parse(JSON.stringify(filterValue.externalFilter));
|
|
452
|
+
_this.filterDef = JSON.parse(JSON.stringify(filterValue.filterDef));
|
|
446
453
|
_this.modal.open();
|
|
447
454
|
_this.cdRef.markForCheck();
|
|
448
455
|
};
|
|
@@ -459,7 +466,7 @@
|
|
|
459
466
|
__classPrivateFieldGet(_this, _filterRegister).value.set({
|
|
460
467
|
columnFilter: _this.columnFilter,
|
|
461
468
|
externalFilter: _this.externalFilter,
|
|
462
|
-
filterDef: _this.filterDef
|
|
469
|
+
filterDef: _this.filterDef,
|
|
463
470
|
});
|
|
464
471
|
_this.modal.close();
|
|
465
472
|
_this.cdRef.markForCheck();
|
|
@@ -472,25 +479,8 @@
|
|
|
472
479
|
enumerable: false,
|
|
473
480
|
configurable: true
|
|
474
481
|
});
|
|
475
|
-
;
|
|
476
|
-
SdPopupFilter.prototype.
|
|
477
|
-
var _this = this;
|
|
478
|
-
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterRegister).configuration.observer.subscribe(function (configuration) {
|
|
479
|
-
_this.inlineColumn = JSON.parse(JSON.stringify(configuration.inlineColumn));
|
|
480
|
-
_this.inlineExternal = JSON.parse(JSON.stringify(configuration.inlineExternal));
|
|
481
|
-
_this.inlineFilterDef = JSON.parse(JSON.stringify(configuration.inlineFilterDef));
|
|
482
|
-
_this.cdRef.markForCheck();
|
|
483
|
-
}));
|
|
484
|
-
__classPrivateFieldGet(this, _subscription).add(__classPrivateFieldGet(this, _filterRegister).value.observer.subscribe(function (filterValue) {
|
|
485
|
-
_this.columnFilter = JSON.parse(JSON.stringify(filterValue.columnFilter));
|
|
486
|
-
_this.externalFilter = JSON.parse(JSON.stringify(filterValue.externalFilter));
|
|
487
|
-
_this.filterDef = JSON.parse(JSON.stringify(filterValue.filterDef));
|
|
488
|
-
_this.cdRef.markForCheck();
|
|
489
|
-
}));
|
|
490
|
-
};
|
|
491
|
-
SdPopupFilter.prototype.ngOnDestroy = function () {
|
|
492
|
-
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
493
|
-
};
|
|
482
|
+
SdPopupFilter.prototype.ngAfterViewInit = function () { };
|
|
483
|
+
SdPopupFilter.prototype.ngOnDestroy = function () { };
|
|
494
484
|
SdPopupFilter.prototype.onClear = function () {
|
|
495
485
|
__classPrivateFieldGet(this, _filterRegister).value.remove();
|
|
496
486
|
this.modal.close();
|
|
@@ -498,11 +488,11 @@
|
|
|
498
488
|
};
|
|
499
489
|
return SdPopupFilter;
|
|
500
490
|
}());
|
|
501
|
-
_filterRegister = new WeakMap()
|
|
491
|
+
_filterRegister = new WeakMap();
|
|
502
492
|
SdPopupFilter.decorators = [
|
|
503
493
|
{ type: core.Component, args: [{
|
|
504
494
|
selector: 'sd-popup-filter',
|
|
505
|
-
template: "<sd-modal width=\"500px\" [title]=\"'Filter' | sdTranslate\"
|
|
495
|
+
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",
|
|
506
496
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
507
497
|
styles: [".c-checkable{width:50px}.c-filterable{flex:1}::ng-deep sd-modal-body.c-popup-filter .mat-form-field-wrapper{padding-bottom:0}"]
|
|
508
498
|
},] }
|
|
@@ -511,14 +501,14 @@
|
|
|
511
501
|
{ type: core.ChangeDetectorRef }
|
|
512
502
|
]; };
|
|
513
503
|
SdPopupFilter.propDecorators = {
|
|
514
|
-
modal: [{ type: core.ViewChild, args: [
|
|
504
|
+
modal: [{ type: core.ViewChild, args: [modal.SdModal,] }],
|
|
515
505
|
filterRegister: [{ type: core.Input }],
|
|
516
506
|
externalFilters: [{ type: core.Input }],
|
|
517
507
|
columns: [{ type: core.Input }],
|
|
518
508
|
filterDefs: [{ type: core.Input }]
|
|
519
509
|
};
|
|
520
510
|
|
|
521
|
-
var _subscription
|
|
511
|
+
var _subscription;
|
|
522
512
|
var SdGridFilter = /** @class */ (function () {
|
|
523
513
|
function SdGridFilter(ref, deviceService) {
|
|
524
514
|
var _this = this;
|
|
@@ -534,12 +524,12 @@
|
|
|
534
524
|
this.inlineColumn = {};
|
|
535
525
|
this.externalFilter = {};
|
|
536
526
|
this.inlineExternal = {};
|
|
537
|
-
_subscription
|
|
527
|
+
_subscription.set(this, new rxjs.Subscription());
|
|
538
528
|
this.onFilter = function (item) {
|
|
539
529
|
_this.filterRegister.value.set({
|
|
540
530
|
columnFilter: _this.columnFilter,
|
|
541
531
|
externalFilter: _this.externalFilter,
|
|
542
|
-
filterDef: _this.filterDef
|
|
532
|
+
filterDef: _this.filterDef,
|
|
543
533
|
});
|
|
544
534
|
};
|
|
545
535
|
this.open = function () {
|
|
@@ -570,28 +560,33 @@
|
|
|
570
560
|
enumerable: false,
|
|
571
561
|
configurable: true
|
|
572
562
|
});
|
|
573
|
-
;
|
|
574
563
|
SdGridFilter.prototype.ngAfterViewInit = function () {
|
|
575
564
|
var _this = this;
|
|
576
|
-
__classPrivateFieldGet(this, _subscription
|
|
577
|
-
_this.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
565
|
+
__classPrivateFieldGet(this, _subscription).add(this.filterRegisterChange.pipe(operators.startWith(this.filterRegister)).subscribe(function (filterRegister) {
|
|
566
|
+
if (_this.filterRegister) {
|
|
567
|
+
__classPrivateFieldGet(_this, _subscription).add(_this.filterRegister.configuration.observer.subscribe(function (configuration) {
|
|
568
|
+
var inlineColumn = configuration.inlineColumn, inlineExternal = configuration.inlineExternal, inlineFilterDef = configuration.inlineFilterDef;
|
|
569
|
+
_this.inlineColumn = inlineColumn;
|
|
570
|
+
_this.inlineExternal = inlineExternal;
|
|
571
|
+
_this.inlineFilterDef = inlineFilterDef;
|
|
572
|
+
_this.ref.markForCheck();
|
|
573
|
+
}));
|
|
574
|
+
__classPrivateFieldGet(_this, _subscription).add(_this.filterRegister.value.observer.subscribe(function (value) {
|
|
575
|
+
var columnFilter = value.columnFilter, externalFilter = value.externalFilter, filterDef = value.filterDef;
|
|
576
|
+
_this.columnFilter = columnFilter;
|
|
577
|
+
_this.externalFilter = externalFilter;
|
|
578
|
+
_this.filterDef = filterDef;
|
|
579
|
+
_this.ref.markForCheck();
|
|
580
|
+
}));
|
|
581
|
+
}
|
|
587
582
|
}));
|
|
588
583
|
};
|
|
589
584
|
SdGridFilter.prototype.ngOnDestroy = function () {
|
|
590
|
-
__classPrivateFieldGet(this, _subscription
|
|
585
|
+
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
591
586
|
};
|
|
592
587
|
return SdGridFilter;
|
|
593
588
|
}());
|
|
594
|
-
_subscription
|
|
589
|
+
_subscription = new WeakMap();
|
|
595
590
|
SdGridFilter.decorators = [
|
|
596
591
|
{ type: core.Component, args: [{
|
|
597
592
|
selector: 'sd-grid-filter',
|
|
@@ -1634,13 +1629,13 @@
|
|
|
1634
1629
|
{ type: core.NgZone }
|
|
1635
1630
|
]; };
|
|
1636
1631
|
|
|
1637
|
-
var _filterConfiguration, _filterValue, _cache$2,
|
|
1632
|
+
var _filterConfiguration, _filterValue, _cache$2, _defaultConfiguration, _defaultValue, _initConfiguration, _initValue;
|
|
1638
1633
|
var SdGridFilterService = /** @class */ (function () {
|
|
1639
1634
|
function SdGridFilterService(settingService) {
|
|
1640
1635
|
var _this = this;
|
|
1641
1636
|
this.settingService = settingService;
|
|
1642
|
-
_filterConfiguration.set(this,
|
|
1643
|
-
_filterValue.set(this,
|
|
1637
|
+
_filterConfiguration.set(this, 'GRID-FILTER-CONFIGURATION');
|
|
1638
|
+
_filterValue.set(this, 'GRID-FILTER-VALUE');
|
|
1644
1639
|
_cache$2.set(this, {});
|
|
1645
1640
|
this.register = function (key, args) {
|
|
1646
1641
|
var cacheSession = false;
|
|
@@ -1653,212 +1648,66 @@
|
|
|
1653
1648
|
cacheSession = true; // Nếu không có key thì chỉ lưu theo session
|
|
1654
1649
|
}
|
|
1655
1650
|
if (!__classPrivateFieldGet(_this, _cache$2)[key]) {
|
|
1656
|
-
|
|
1657
|
-
prefix: __classPrivateFieldGet(_this, _filterConfiguration),
|
|
1658
|
-
key: key,
|
|
1659
|
-
}, {
|
|
1660
|
-
type: cacheSession ? "session" : undefined,
|
|
1661
|
-
});
|
|
1662
|
-
var defaultConfiguration = __classPrivateFieldGet(_this, _loadDefaultConfiguration).call(_this, args, t1.get());
|
|
1663
|
-
var t2 = _this.settingService.create({
|
|
1664
|
-
prefix: __classPrivateFieldGet(_this, _filterValue),
|
|
1665
|
-
key: key,
|
|
1666
|
-
}, {
|
|
1667
|
-
type: cacheSession ? "session" : undefined,
|
|
1668
|
-
});
|
|
1669
|
-
var defaultValue = __classPrivateFieldGet(_this, _loadDefaultValue).call(_this, args, t2.get());
|
|
1651
|
+
// Setting của filter configuration
|
|
1670
1652
|
var filterConfiguration_1 = _this.settingService.create({
|
|
1671
1653
|
prefix: __classPrivateFieldGet(_this, _filterConfiguration),
|
|
1672
1654
|
key: key,
|
|
1673
1655
|
}, {
|
|
1674
|
-
default:
|
|
1675
|
-
type: cacheSession ?
|
|
1656
|
+
default: __classPrivateFieldGet(_this, _defaultConfiguration).call(_this, args),
|
|
1657
|
+
type: cacheSession ? 'session' : undefined,
|
|
1676
1658
|
});
|
|
1659
|
+
// Lấy giá trị configuration merge với giá trị defaultShowing của args nếu như args có thay đổi
|
|
1660
|
+
filterConfiguration_1.set(__classPrivateFieldGet(_this, _initConfiguration).call(_this, args, filterConfiguration_1.get()));
|
|
1661
|
+
// Setting của filter value
|
|
1677
1662
|
var filterValue_1 = _this.settingService.create({
|
|
1678
1663
|
prefix: __classPrivateFieldGet(_this, _filterValue),
|
|
1679
1664
|
key: key,
|
|
1680
1665
|
}, {
|
|
1681
|
-
default:
|
|
1682
|
-
type: cacheSession ?
|
|
1666
|
+
default: __classPrivateFieldGet(_this, _defaultValue).call(_this, args),
|
|
1667
|
+
type: cacheSession ? 'session' : undefined,
|
|
1683
1668
|
});
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
var _a, _b, _c;
|
|
1687
|
-
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1688
|
-
var inlineColumn = {};
|
|
1689
|
-
var inlineExternal = {};
|
|
1690
|
-
var inlineFilterDef = {};
|
|
1691
|
-
try {
|
|
1692
|
-
// Filter column
|
|
1693
|
-
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1694
|
-
var item = _v.value;
|
|
1695
|
-
inlineColumn[item.field] = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) === null || _a === void 0 ? void 0 : _a[item.field];
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1699
|
-
finally {
|
|
1700
|
-
try {
|
|
1701
|
-
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1702
|
-
}
|
|
1703
|
-
finally { if (e_1) throw e_1.error; }
|
|
1704
|
-
}
|
|
1705
|
-
try {
|
|
1706
|
-
// Filter external
|
|
1707
|
-
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1708
|
-
var item = _x.value;
|
|
1709
|
-
inlineExternal[item.field] = (_b = configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) === null || _b === void 0 ? void 0 : _b[item.field];
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1713
|
-
finally {
|
|
1714
|
-
try {
|
|
1715
|
-
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1716
|
-
}
|
|
1717
|
-
finally { if (e_2) throw e_2.error; }
|
|
1718
|
-
}
|
|
1719
|
-
try {
|
|
1720
|
-
// Filter def
|
|
1721
|
-
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1722
|
-
var item = _z.value;
|
|
1723
|
-
inlineFilterDef[item.sdMaterialFilterDef] = (_c = configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) === null || _c === void 0 ? void 0 : _c[item.sdMaterialFilterDef];
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1727
|
-
finally {
|
|
1728
|
-
try {
|
|
1729
|
-
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1730
|
-
}
|
|
1731
|
-
finally { if (e_3) throw e_3.error; }
|
|
1732
|
-
}
|
|
1733
|
-
return {
|
|
1734
|
-
// Filter column
|
|
1735
|
-
inlineColumn: inlineColumn,
|
|
1736
|
-
// Filter external
|
|
1737
|
-
inlineExternal: inlineExternal,
|
|
1738
|
-
// Filter def
|
|
1739
|
-
inlineFilterDef: inlineFilterDef,
|
|
1740
|
-
};
|
|
1741
|
-
};
|
|
1742
|
-
var valueGet_1 = function (value) {
|
|
1743
|
-
var e_4, _r, e_5, _s, e_6, _t;
|
|
1744
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1745
|
-
var columnFilter = {};
|
|
1746
|
-
var externalFilter = {};
|
|
1747
|
-
var filterDef = {};
|
|
1748
|
-
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1749
|
-
try {
|
|
1750
|
-
// Filter column
|
|
1751
|
-
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1752
|
-
var item = _v.value;
|
|
1753
|
-
columnFilter[item.field] = (_a = value === null || value === void 0 ? void 0 : value.columnFilter) === null || _a === void 0 ? void 0 : _a[item.field];
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1757
|
-
finally {
|
|
1758
|
-
try {
|
|
1759
|
-
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1760
|
-
}
|
|
1761
|
-
finally { if (e_4) throw e_4.error; }
|
|
1762
|
-
}
|
|
1763
|
-
try {
|
|
1764
|
-
// Filter external
|
|
1765
|
-
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1766
|
-
var item = _x.value;
|
|
1767
|
-
if (item.type === "daterange") {
|
|
1768
|
-
externalFilter[item.field] = {
|
|
1769
|
-
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,
|
|
1770
|
-
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,
|
|
1771
|
-
};
|
|
1772
|
-
}
|
|
1773
|
-
else {
|
|
1774
|
-
externalFilter[item.field] = (_f = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _f === void 0 ? void 0 : _f[item.field];
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1779
|
-
finally {
|
|
1780
|
-
try {
|
|
1781
|
-
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1782
|
-
}
|
|
1783
|
-
finally { if (e_5) throw e_5.error; }
|
|
1784
|
-
}
|
|
1785
|
-
try {
|
|
1786
|
-
// Filter def
|
|
1787
|
-
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1788
|
-
var item = _z.value;
|
|
1789
|
-
filterDef[item.sdMaterialFilterDef] = (_g = value === null || value === void 0 ? void 0 : value.filterDef) === null || _g === void 0 ? void 0 : _g[item.sdMaterialFilterDef];
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1793
|
-
finally {
|
|
1794
|
-
try {
|
|
1795
|
-
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1796
|
-
}
|
|
1797
|
-
finally { if (e_6) throw e_6.error; }
|
|
1798
|
-
}
|
|
1799
|
-
return {
|
|
1800
|
-
// Filter column
|
|
1801
|
-
columnFilter: columnFilter,
|
|
1802
|
-
// Filter external
|
|
1803
|
-
externalFilter: externalFilter,
|
|
1804
|
-
// Filter def
|
|
1805
|
-
filterDef: filterDef,
|
|
1806
|
-
};
|
|
1807
|
-
};
|
|
1669
|
+
// Lấy giá trị value merge với giá trị default của args nếu như args có thay đổi
|
|
1670
|
+
filterValue_1.set(__classPrivateFieldGet(_this, _initValue).call(_this, args, filterValue_1.get()));
|
|
1808
1671
|
__classPrivateFieldGet(_this, _cache$2)[key] = {
|
|
1809
1672
|
configuration: {
|
|
1810
1673
|
get: function () {
|
|
1811
|
-
|
|
1812
|
-
return configurationGet_1(configuration);
|
|
1674
|
+
return filterConfiguration_1.get();
|
|
1813
1675
|
},
|
|
1814
1676
|
set: function (configuration) {
|
|
1815
|
-
var
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {}
|
|
1826
|
-
: inlineExternal,
|
|
1827
|
-
// Filter def
|
|
1828
|
-
inlineFilterDef: keys.includes("inlineFilterDef")
|
|
1829
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {}
|
|
1830
|
-
: inlineFilterDef,
|
|
1677
|
+
var inlineColumn = configuration.inlineColumn, inlineExternal = configuration.inlineExternal, inlineFilterDef = configuration.inlineFilterDef;
|
|
1678
|
+
filterConfiguration_1.set({
|
|
1679
|
+
inlineColumn: inlineColumn,
|
|
1680
|
+
inlineExternal: inlineExternal,
|
|
1681
|
+
inlineFilterDef: inlineFilterDef,
|
|
1682
|
+
});
|
|
1683
|
+
return {
|
|
1684
|
+
inlineColumn: inlineColumn,
|
|
1685
|
+
inlineExternal: inlineExternal,
|
|
1686
|
+
inlineFilterDef: inlineFilterDef,
|
|
1831
1687
|
};
|
|
1832
|
-
filterConfiguration_1.set(updatedConfiguration);
|
|
1833
|
-
return updatedConfiguration;
|
|
1834
1688
|
},
|
|
1835
1689
|
remove: function () {
|
|
1836
1690
|
filterConfiguration_1.remove();
|
|
1837
1691
|
},
|
|
1838
|
-
observer: filterConfiguration_1.observer.pipe(operators.
|
|
1692
|
+
observer: filterConfiguration_1.observer.pipe(operators.startWith(filterConfiguration_1.get()),
|
|
1693
|
+
// Sử dụng mặc định nếu bị reset
|
|
1694
|
+
operators.map(function (configuration) { return configuration || __classPrivateFieldGet(_this, _defaultConfiguration).call(_this, args); })),
|
|
1839
1695
|
},
|
|
1840
1696
|
value: {
|
|
1841
1697
|
get: function () {
|
|
1842
|
-
|
|
1843
|
-
return valueGet_1(configuration);
|
|
1698
|
+
return filterValue_1.get();
|
|
1844
1699
|
},
|
|
1845
|
-
set: function (
|
|
1846
|
-
var keys = Object.keys(
|
|
1700
|
+
set: function (value) {
|
|
1701
|
+
var keys = Object.keys(value || {});
|
|
1847
1702
|
var current = filterValue_1.get();
|
|
1848
1703
|
var columnFilter = current.columnFilter, externalFilter = current.externalFilter, filterDef = current.filterDef;
|
|
1849
1704
|
var updatedConfiguration = {
|
|
1850
1705
|
// Filter column
|
|
1851
|
-
columnFilter: keys.includes(
|
|
1852
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {}
|
|
1853
|
-
: columnFilter,
|
|
1706
|
+
columnFilter: keys.includes('columnFilter') ? (value === null || value === void 0 ? void 0 : value.columnFilter) || {} : columnFilter,
|
|
1854
1707
|
// Filter external
|
|
1855
|
-
externalFilter: keys.includes(
|
|
1856
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {}
|
|
1857
|
-
: externalFilter,
|
|
1708
|
+
externalFilter: keys.includes('externalFilter') ? (value === null || value === void 0 ? void 0 : value.externalFilter) || {} : externalFilter,
|
|
1858
1709
|
// Filter def
|
|
1859
|
-
filterDef: keys.includes(
|
|
1860
|
-
? (configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}
|
|
1861
|
-
: filterDef,
|
|
1710
|
+
filterDef: keys.includes('filterDef') ? (value === null || value === void 0 ? void 0 : value.filterDef) || {} : filterDef,
|
|
1862
1711
|
};
|
|
1863
1712
|
filterValue_1.set(updatedConfiguration);
|
|
1864
1713
|
return updatedConfiguration;
|
|
@@ -1866,13 +1715,131 @@
|
|
|
1866
1715
|
remove: function () {
|
|
1867
1716
|
filterValue_1.remove();
|
|
1868
1717
|
},
|
|
1869
|
-
observer: filterValue_1.observer.pipe(operators.
|
|
1718
|
+
observer: filterValue_1.observer.pipe(operators.debounceTime(200), operators.startWith(filterValue_1.get()),
|
|
1719
|
+
// Sử dụng mặc định nếu bị reset
|
|
1720
|
+
operators.map(function (value) { return value || __classPrivateFieldGet(_this, _defaultValue).call(_this, args); })),
|
|
1870
1721
|
},
|
|
1871
1722
|
};
|
|
1872
1723
|
}
|
|
1873
1724
|
return __classPrivateFieldGet(_this, _cache$2)[key];
|
|
1874
1725
|
};
|
|
1875
|
-
|
|
1726
|
+
_defaultConfiguration.set(this, function (args) {
|
|
1727
|
+
var e_1, _r, e_2, _s, e_3, _t;
|
|
1728
|
+
var _a;
|
|
1729
|
+
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1730
|
+
var inlineColumn = {};
|
|
1731
|
+
var inlineExternal = {};
|
|
1732
|
+
var inlineFilterDef = {};
|
|
1733
|
+
try {
|
|
1734
|
+
// Filter column
|
|
1735
|
+
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1736
|
+
var item = _v.value;
|
|
1737
|
+
inlineColumn[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.defaultShowing;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1741
|
+
finally {
|
|
1742
|
+
try {
|
|
1743
|
+
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1744
|
+
}
|
|
1745
|
+
finally { if (e_1) throw e_1.error; }
|
|
1746
|
+
}
|
|
1747
|
+
try {
|
|
1748
|
+
// Filter external
|
|
1749
|
+
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1750
|
+
var item = _x.value;
|
|
1751
|
+
inlineExternal[item.field] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1755
|
+
finally {
|
|
1756
|
+
try {
|
|
1757
|
+
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1758
|
+
}
|
|
1759
|
+
finally { if (e_2) throw e_2.error; }
|
|
1760
|
+
}
|
|
1761
|
+
try {
|
|
1762
|
+
// Filter def
|
|
1763
|
+
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1764
|
+
var item = _z.value;
|
|
1765
|
+
inlineFilterDef[item.sdMaterialFilterDef] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1769
|
+
finally {
|
|
1770
|
+
try {
|
|
1771
|
+
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1772
|
+
}
|
|
1773
|
+
finally { if (e_3) throw e_3.error; }
|
|
1774
|
+
}
|
|
1775
|
+
return {
|
|
1776
|
+
// Filter column
|
|
1777
|
+
inlineColumn: inlineColumn,
|
|
1778
|
+
// Filter external
|
|
1779
|
+
inlineExternal: inlineExternal,
|
|
1780
|
+
// Filter def
|
|
1781
|
+
inlineFilterDef: inlineFilterDef,
|
|
1782
|
+
};
|
|
1783
|
+
});
|
|
1784
|
+
_defaultValue.set(this, function (args) {
|
|
1785
|
+
var e_4, _r, e_5, _s, e_6, _t;
|
|
1786
|
+
var _a;
|
|
1787
|
+
var columnFilter = {};
|
|
1788
|
+
var externalFilter = {};
|
|
1789
|
+
var filterDef = {};
|
|
1790
|
+
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1791
|
+
try {
|
|
1792
|
+
// Filter column
|
|
1793
|
+
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1794
|
+
var item = _v.value;
|
|
1795
|
+
columnFilter[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.default;
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1799
|
+
finally {
|
|
1800
|
+
try {
|
|
1801
|
+
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1802
|
+
}
|
|
1803
|
+
finally { if (e_4) throw e_4.error; }
|
|
1804
|
+
}
|
|
1805
|
+
try {
|
|
1806
|
+
// Filter external
|
|
1807
|
+
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1808
|
+
var item = _x.value;
|
|
1809
|
+
externalFilter[item.field] = item === null || item === void 0 ? void 0 : item.default;
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1813
|
+
finally {
|
|
1814
|
+
try {
|
|
1815
|
+
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1816
|
+
}
|
|
1817
|
+
finally { if (e_5) throw e_5.error; }
|
|
1818
|
+
}
|
|
1819
|
+
try {
|
|
1820
|
+
// Filter def
|
|
1821
|
+
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1822
|
+
var item = _z.value;
|
|
1823
|
+
filterDef[item.sdMaterialFilterDef] = undefined;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1827
|
+
finally {
|
|
1828
|
+
try {
|
|
1829
|
+
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1830
|
+
}
|
|
1831
|
+
finally { if (e_6) throw e_6.error; }
|
|
1832
|
+
}
|
|
1833
|
+
return {
|
|
1834
|
+
// Filter column
|
|
1835
|
+
columnFilter: columnFilter,
|
|
1836
|
+
// Filter external
|
|
1837
|
+
externalFilter: externalFilter,
|
|
1838
|
+
// Filter def
|
|
1839
|
+
filterDef: filterDef,
|
|
1840
|
+
};
|
|
1841
|
+
});
|
|
1842
|
+
_initConfiguration.set(this, function (args, configuration) {
|
|
1876
1843
|
var e_7, _r, e_8, _s, e_9, _t;
|
|
1877
1844
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1878
1845
|
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
@@ -1930,7 +1897,7 @@
|
|
|
1930
1897
|
inlineFilterDef: inlineFilterDef,
|
|
1931
1898
|
};
|
|
1932
1899
|
});
|
|
1933
|
-
|
|
1900
|
+
_initValue.set(this, function (args, value) {
|
|
1934
1901
|
var e_10, _r, e_11, _s, e_12, _t;
|
|
1935
1902
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1936
1903
|
var columnFilter = {};
|
|
@@ -1955,7 +1922,7 @@
|
|
|
1955
1922
|
// Filter external
|
|
1956
1923
|
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1957
1924
|
var item = _x.value;
|
|
1958
|
-
if (item.type ===
|
|
1925
|
+
if (item.type === 'daterange') {
|
|
1959
1926
|
externalFilter[item.field] = {
|
|
1960
1927
|
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,
|
|
1961
1928
|
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,
|
|
@@ -1999,7 +1966,7 @@
|
|
|
1999
1966
|
}
|
|
2000
1967
|
return SdGridFilterService;
|
|
2001
1968
|
}());
|
|
2002
|
-
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(),
|
|
1969
|
+
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(), _defaultConfiguration = new WeakMap(), _defaultValue = new WeakMap(), _initConfiguration = new WeakMap(), _initValue = new WeakMap();
|
|
2003
1970
|
SdGridFilterService.decorators = [
|
|
2004
1971
|
{ type: core.Injectable }
|
|
2005
1972
|
];
|
|
@@ -2007,7 +1974,7 @@
|
|
|
2007
1974
|
{ type: setting.SdSettingService }
|
|
2008
1975
|
]; };
|
|
2009
1976
|
|
|
2010
|
-
var _optionChanges, _localItems, _paginator, _sort, _subscription$
|
|
1977
|
+
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;
|
|
2011
1978
|
var SdGridMaterial = /** @class */ (function () {
|
|
2012
1979
|
function SdGridMaterial(ref, configuration, gridConfigurationService, exportService, notifyService, columnValuesPipe, gridFilterService, editorHandlerColumnPipe) {
|
|
2013
1980
|
var _this = this;
|
|
@@ -2044,11 +2011,12 @@
|
|
|
2044
2011
|
// Filter
|
|
2045
2012
|
this.columnFilter = {};
|
|
2046
2013
|
// Subcription
|
|
2047
|
-
_subscription$
|
|
2014
|
+
_subscription$1.set(this, new rxjs.Subscription());
|
|
2015
|
+
_subcriptionFilterRegister.set(this, new rxjs.Subscription());
|
|
2048
2016
|
_reload.set(this, new rxjs.Subject());
|
|
2049
2017
|
this.isExporting = false;
|
|
2050
2018
|
this.isSelectAll = false;
|
|
2051
|
-
this.exportTitle =
|
|
2019
|
+
this.exportTitle = 'Export';
|
|
2052
2020
|
_loadCompleted.set(this, false);
|
|
2053
2021
|
_initCellDef.set(this, function () {
|
|
2054
2022
|
var e_1, _3;
|
|
@@ -2085,9 +2053,6 @@
|
|
|
2085
2053
|
}
|
|
2086
2054
|
finally { if (e_2) throw e_2.error; }
|
|
2087
2055
|
}
|
|
2088
|
-
// if (this.filterDefs?.length) {
|
|
2089
|
-
// this.#loadFilterRegister();
|
|
2090
|
-
// }
|
|
2091
2056
|
});
|
|
2092
2057
|
_initFooterDef.set(this, function () {
|
|
2093
2058
|
var e_3, _3;
|
|
@@ -2117,14 +2082,14 @@
|
|
|
2117
2082
|
rawColumnFilter: columnFilter || {},
|
|
2118
2083
|
rawExternalFilter: externalFilter || {},
|
|
2119
2084
|
rawFilterDef: filterDef || {},
|
|
2120
|
-
orderBy: ((_a = __classPrivateFieldGet(_this, _sort)) === null || _a === void 0 ? void 0 : _a.active) ||
|
|
2121
|
-
orderDirection: ((_b = __classPrivateFieldGet(_this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) ||
|
|
2085
|
+
orderBy: ((_a = __classPrivateFieldGet(_this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
2086
|
+
orderDirection: ((_b = __classPrivateFieldGet(_this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
2122
2087
|
pageNumber: pageNumber,
|
|
2123
2088
|
pageSize: pageSize,
|
|
2124
2089
|
isExported: true,
|
|
2125
2090
|
};
|
|
2126
2091
|
});
|
|
2127
|
-
_initConfiguration.set(this, function (option) {
|
|
2092
|
+
_initConfiguration$1.set(this, function (option) {
|
|
2128
2093
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
2129
2094
|
// Init pagination
|
|
2130
2095
|
option.paginate = {
|
|
@@ -2139,28 +2104,23 @@
|
|
|
2139
2104
|
var _a, _b, _c, _d, _e;
|
|
2140
2105
|
// Init filter
|
|
2141
2106
|
if (_this.gridOption) {
|
|
2142
|
-
var hasRegister = !!_this.filterRegister;
|
|
2143
2107
|
_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, {
|
|
2144
2108
|
columns: (_c = _this.gridOption) === null || _c === void 0 ? void 0 : _c.columns,
|
|
2145
2109
|
externalFilters: (_e = (_d = _this.gridOption) === null || _d === void 0 ? void 0 : _d.filter) === null || _e === void 0 ? void 0 : _e.externalFilters,
|
|
2146
2110
|
filterDefs: _this.filterDefs,
|
|
2147
2111
|
});
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
force: false,
|
|
2155
|
-
});
|
|
2156
|
-
}))
|
|
2157
|
-
.subscribe());
|
|
2158
|
-
}
|
|
2159
|
-
else {
|
|
2112
|
+
__classPrivateFieldGet(_this, _subcriptionFilterRegister).unsubscribe();
|
|
2113
|
+
__classPrivateFieldSet(_this, _subcriptionFilterRegister, _this.filterRegister.value.observer
|
|
2114
|
+
.pipe(operators.debounceTime(500), operators.map(function (filterValue) {
|
|
2115
|
+
var columnFilter = filterValue.columnFilter;
|
|
2116
|
+
_this.columnFilter = columnFilter;
|
|
2117
|
+
__classPrivateFieldGet(_this, _paginator).pageIndex = 0;
|
|
2160
2118
|
__classPrivateFieldGet(_this, _reload).next({
|
|
2161
|
-
force:
|
|
2119
|
+
force: false,
|
|
2162
2120
|
});
|
|
2163
|
-
}
|
|
2121
|
+
}))
|
|
2122
|
+
.subscribe());
|
|
2123
|
+
__classPrivateFieldGet(_this, _subscription$1).add(__classPrivateFieldGet(_this, _subcriptionFilterRegister));
|
|
2164
2124
|
}
|
|
2165
2125
|
});
|
|
2166
2126
|
_filterLocal.set(this, function (localItems, filterInfo) {
|
|
@@ -2173,52 +2133,39 @@
|
|
|
2173
2133
|
for (var columns_1 = __values(columns), columns_1_1 = columns_1.next(); !columns_1_1.done; columns_1_1 = columns_1.next()) {
|
|
2174
2134
|
var column = columns_1_1.value;
|
|
2175
2135
|
var field = column.field, type = column.type;
|
|
2176
|
-
var filterValue = (rawColumnFilter[field] ||
|
|
2177
|
-
|
|
2178
|
-
.trim()
|
|
2179
|
-
.toLowerCase();
|
|
2180
|
-
var columnValue = (item[field] || "")
|
|
2181
|
-
.toString()
|
|
2182
|
-
.trim()
|
|
2183
|
-
.toLowerCase();
|
|
2136
|
+
var filterValue = (rawColumnFilter[field] || '').toString().trim().toLowerCase();
|
|
2137
|
+
var columnValue = (item[field] || '').toString().trim().toLowerCase();
|
|
2184
2138
|
if (filterValue) {
|
|
2185
|
-
if (!columnValue &&
|
|
2186
|
-
type !== "datetime" &&
|
|
2187
|
-
type !== "date" &&
|
|
2188
|
-
type !== "time") {
|
|
2139
|
+
if (!columnValue && type !== 'datetime' && type !== 'date' && type !== 'time') {
|
|
2189
2140
|
return false;
|
|
2190
2141
|
}
|
|
2191
|
-
if (type ===
|
|
2142
|
+
if (type === 'string') {
|
|
2192
2143
|
if (columnValue.indexOf(filterValue) === -1) {
|
|
2193
2144
|
return false;
|
|
2194
2145
|
}
|
|
2195
2146
|
}
|
|
2196
|
-
else if (type ===
|
|
2147
|
+
else if (type === 'values') {
|
|
2197
2148
|
if (columnValue !== filterValue) {
|
|
2198
2149
|
return false;
|
|
2199
2150
|
}
|
|
2200
2151
|
}
|
|
2201
|
-
else if (type ===
|
|
2202
|
-
var fValue = +filterValue
|
|
2203
|
-
.replace(">=", "")
|
|
2204
|
-
.replace("<=", "")
|
|
2205
|
-
.replace(">", "")
|
|
2206
|
-
.replace("<", "");
|
|
2152
|
+
else if (type === 'number') {
|
|
2153
|
+
var fValue = +filterValue.replace('>=', '').replace('<=', '').replace('>', '').replace('<', '');
|
|
2207
2154
|
var cValue = +columnValue;
|
|
2208
2155
|
if (fValue || fValue === 0) {
|
|
2209
2156
|
if (!cValue && cValue !== 0) {
|
|
2210
2157
|
return false;
|
|
2211
2158
|
}
|
|
2212
|
-
if (filterValue.indexOf(
|
|
2159
|
+
if (filterValue.indexOf('>=') > -1 && cValue < fValue) {
|
|
2213
2160
|
return false;
|
|
2214
2161
|
}
|
|
2215
|
-
else if (filterValue.indexOf(
|
|
2162
|
+
else if (filterValue.indexOf('<=') > -1 && cValue > fValue) {
|
|
2216
2163
|
return false;
|
|
2217
2164
|
}
|
|
2218
|
-
else if (filterValue.indexOf(
|
|
2165
|
+
else if (filterValue.indexOf('<') > -1 && cValue >= fValue) {
|
|
2219
2166
|
return false;
|
|
2220
2167
|
}
|
|
2221
|
-
else if (filterValue.indexOf(
|
|
2168
|
+
else if (filterValue.indexOf('>') > -1 && cValue <= fValue) {
|
|
2222
2169
|
return false;
|
|
2223
2170
|
}
|
|
2224
2171
|
else if (cValue !== fValue) {
|
|
@@ -2226,21 +2173,15 @@
|
|
|
2226
2173
|
}
|
|
2227
2174
|
}
|
|
2228
2175
|
}
|
|
2229
|
-
else if (type ===
|
|
2230
|
-
if (filterValue ===
|
|
2231
|
-
columnValue !== "1" &&
|
|
2232
|
-
columnValue !== "true") {
|
|
2176
|
+
else if (type === 'bool') {
|
|
2177
|
+
if (filterValue === '1' && columnValue !== '1' && columnValue !== 'true') {
|
|
2233
2178
|
return false;
|
|
2234
2179
|
}
|
|
2235
|
-
else if (filterValue ===
|
|
2236
|
-
columnValue !== "0" &&
|
|
2237
|
-
columnValue !== "false") {
|
|
2180
|
+
else if (filterValue === '0' && columnValue !== '0' && columnValue !== 'false') {
|
|
2238
2181
|
return false;
|
|
2239
2182
|
}
|
|
2240
2183
|
}
|
|
2241
|
-
else if (type ===
|
|
2242
|
-
type === "date" ||
|
|
2243
|
-
type === "time") {
|
|
2184
|
+
else if (type === 'datetime' || type === 'date' || type === 'time') {
|
|
2244
2185
|
var from = (_b = (_a = rawColumnFilter[field]) === null || _a === void 0 ? void 0 : _a.from) !== null && _b !== void 0 ? _b : rawColumnFilter[field];
|
|
2245
2186
|
var to = (_d = (_c = rawColumnFilter[field]) === null || _c === void 0 ? void 0 : _c.to) !== null && _d !== void 0 ? _d : rawColumnFilter[field];
|
|
2246
2187
|
var fromDate = Date.begin(from);
|
|
@@ -2278,16 +2219,16 @@
|
|
|
2278
2219
|
if (column) {
|
|
2279
2220
|
var type_1 = column.type, field_1 = column.field;
|
|
2280
2221
|
items.sort(function (current, next) {
|
|
2281
|
-
if (type_1 ===
|
|
2222
|
+
if (type_1 === 'number') {
|
|
2282
2223
|
return (current[field_1] || 0) - (next[field_1] || 0);
|
|
2283
2224
|
}
|
|
2284
|
-
if (type_1 ===
|
|
2285
|
-
var d1 = new Date(current[field_1] ||
|
|
2286
|
-
var d2 = new Date(current[field_1] ||
|
|
2225
|
+
if (type_1 === 'date' || type_1 === 'datetime' || type_1 === 'time') {
|
|
2226
|
+
var d1 = new Date(current[field_1] || '').getTime();
|
|
2227
|
+
var d2 = new Date(current[field_1] || '').getTime();
|
|
2287
2228
|
return d1 - d2;
|
|
2288
2229
|
}
|
|
2289
|
-
var s1 = (current[field_1] ||
|
|
2290
|
-
var s2 = (next[field_1] ||
|
|
2230
|
+
var s1 = (current[field_1] || '').toString();
|
|
2231
|
+
var s2 = (next[field_1] || '').toString();
|
|
2291
2232
|
if (s1 > s2) {
|
|
2292
2233
|
return 1;
|
|
2293
2234
|
}
|
|
@@ -2296,14 +2237,14 @@
|
|
|
2296
2237
|
}
|
|
2297
2238
|
return 0;
|
|
2298
2239
|
});
|
|
2299
|
-
if (orderDirection ===
|
|
2240
|
+
if (orderDirection === 'desc') {
|
|
2300
2241
|
items.reverse();
|
|
2301
2242
|
}
|
|
2302
2243
|
}
|
|
2303
2244
|
}
|
|
2304
2245
|
return {
|
|
2305
2246
|
items: items.filter(function (item, index) {
|
|
2306
|
-
return
|
|
2247
|
+
return index >= pageNumber * pageSize && index < (pageNumber + 1) * pageSize;
|
|
2307
2248
|
}),
|
|
2308
2249
|
total: items.length,
|
|
2309
2250
|
};
|
|
@@ -2315,8 +2256,8 @@
|
|
|
2315
2256
|
rawColumnFilter: columnFilter || {},
|
|
2316
2257
|
rawExternalFilter: externalFilter || {},
|
|
2317
2258
|
rawFilterDef: filterDef || {},
|
|
2318
|
-
orderBy: ((_a = __classPrivateFieldGet(_this, _sort)) === null || _a === void 0 ? void 0 : _a.active) ||
|
|
2319
|
-
orderDirection: ((_b = __classPrivateFieldGet(_this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) ||
|
|
2259
|
+
orderBy: ((_a = __classPrivateFieldGet(_this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
2260
|
+
orderDirection: ((_b = __classPrivateFieldGet(_this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
2320
2261
|
pageNumber: ((_c = __classPrivateFieldGet(_this, _paginator)) === null || _c === void 0 ? void 0 : _c.pageIndex) || 0,
|
|
2321
2262
|
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,
|
|
2322
2263
|
};
|
|
@@ -2329,7 +2270,7 @@
|
|
|
2329
2270
|
switch (_5.label) {
|
|
2330
2271
|
case 0:
|
|
2331
2272
|
this.isLoading = true;
|
|
2332
|
-
if (!(this.gridOption.type ===
|
|
2273
|
+
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 6];
|
|
2333
2274
|
_5.label = 1;
|
|
2334
2275
|
case 1:
|
|
2335
2276
|
_5.trys.push([1, 3, 4, 5]);
|
|
@@ -2347,7 +2288,7 @@
|
|
|
2347
2288
|
case 3:
|
|
2348
2289
|
error_1 = _5.sent();
|
|
2349
2290
|
console.error(error_1);
|
|
2350
|
-
this.notifyService.notify.warning(
|
|
2291
|
+
this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
2351
2292
|
return [2 /*return*/, {
|
|
2352
2293
|
items: [],
|
|
2353
2294
|
total: 0,
|
|
@@ -2375,14 +2316,14 @@
|
|
|
2375
2316
|
_5.label = 10;
|
|
2376
2317
|
case 10:
|
|
2377
2318
|
if (!Array.isArray(__classPrivateFieldGet(this, _localItems))) {
|
|
2378
|
-
this.notifyService.notify.warning(
|
|
2319
|
+
this.notifyService.notify.warning('Dữ liệu không phải là một mảng');
|
|
2379
2320
|
__classPrivateFieldSet(this, _localItems, []);
|
|
2380
2321
|
}
|
|
2381
2322
|
return [3 /*break*/, 13];
|
|
2382
2323
|
case 11:
|
|
2383
2324
|
error_2 = _5.sent();
|
|
2384
2325
|
console.error(error_2);
|
|
2385
|
-
this.notifyService.notify.warning(
|
|
2326
|
+
this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
2386
2327
|
__classPrivateFieldSet(this, _localItems, []);
|
|
2387
2328
|
return [3 /*break*/, 13];
|
|
2388
2329
|
case 12:
|
|
@@ -2457,7 +2398,7 @@
|
|
|
2457
2398
|
case 1: return [2 /*return*/, _3.sent()];
|
|
2458
2399
|
case 2:
|
|
2459
2400
|
filterInfo = __classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize);
|
|
2460
|
-
if (!(this.gridOption.type ===
|
|
2401
|
+
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 4];
|
|
2461
2402
|
result = this.gridOption.items(filterInfo);
|
|
2462
2403
|
if (rxjs.isObservable(result)) {
|
|
2463
2404
|
result = result.toPromise();
|
|
@@ -2466,7 +2407,7 @@
|
|
|
2466
2407
|
case 3: return [2 /*return*/, _3.sent()];
|
|
2467
2408
|
case 4:
|
|
2468
2409
|
exportedItems = [];
|
|
2469
|
-
if (!(typeof this.gridOption.items ===
|
|
2410
|
+
if (!(typeof this.gridOption.items === 'function')) return [3 /*break*/, 8];
|
|
2470
2411
|
results = this.gridOption.items();
|
|
2471
2412
|
if (!(results instanceof Promise)) return [3 /*break*/, 6];
|
|
2472
2413
|
return [4 /*yield*/, results];
|
|
@@ -2491,21 +2432,21 @@
|
|
|
2491
2432
|
.filter(function (e) { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })
|
|
2492
2433
|
.forEach(function (column) {
|
|
2493
2434
|
var _a, _b;
|
|
2494
|
-
if (column.type ===
|
|
2435
|
+
if (column.type === 'image') {
|
|
2495
2436
|
return;
|
|
2496
2437
|
}
|
|
2497
|
-
if (column.type ===
|
|
2438
|
+
if (column.type === 'children') {
|
|
2498
2439
|
(_a = column.children) === null || _a === void 0 ? void 0 : _a.filter(function (e) { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach(function (childColumn) {
|
|
2499
|
-
if (childColumn.type ===
|
|
2440
|
+
if (childColumn.type === 'image') {
|
|
2500
2441
|
return;
|
|
2501
2442
|
}
|
|
2502
2443
|
columns.push(childColumn);
|
|
2503
2444
|
});
|
|
2504
2445
|
return;
|
|
2505
2446
|
}
|
|
2506
|
-
if (column.type ===
|
|
2447
|
+
if (column.type === 'children-col') {
|
|
2507
2448
|
(_b = column.children) === null || _b === void 0 ? void 0 : _b.filter(function (e) { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach(function (childColumn) {
|
|
2508
|
-
if (childColumn.type ===
|
|
2449
|
+
if (childColumn.type === 'image') {
|
|
2509
2450
|
return;
|
|
2510
2451
|
}
|
|
2511
2452
|
columns.push(childColumn);
|
|
@@ -2518,7 +2459,7 @@
|
|
|
2518
2459
|
});
|
|
2519
2460
|
_allExportedColumns.set(this, function () {
|
|
2520
2461
|
var _a, _b;
|
|
2521
|
-
return ((
|
|
2462
|
+
return ((_b = (_a = _this.gridOption.export) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.filter(function (e) { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })) || [];
|
|
2522
2463
|
});
|
|
2523
2464
|
_onExport.set(this, function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
2524
2465
|
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, file, isCSV, columns_2, pageSize_1, batch, total_1, pageNumber_1, exportItems_1, items_1, promises_1, handleData, sheets, _3, _4, sheet, _5, _6, _7, e_5_1;
|
|
@@ -2552,7 +2493,7 @@
|
|
|
2552
2493
|
try {
|
|
2553
2494
|
for (results_1 = __values(results), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
|
2554
2495
|
result = results_1_1.value;
|
|
2555
|
-
if (
|
|
2496
|
+
if ('items' in result) {
|
|
2556
2497
|
exportItems_1 = __spread(exportItems_1, result.items);
|
|
2557
2498
|
total_1 = result.total;
|
|
2558
2499
|
}
|
|
@@ -2606,7 +2547,7 @@
|
|
|
2606
2547
|
if (!column) {
|
|
2607
2548
|
return [2 /*return*/];
|
|
2608
2549
|
}
|
|
2609
|
-
if (column.type ===
|
|
2550
|
+
if (column.type === 'children' || column.type === 'children-col') {
|
|
2610
2551
|
column === null || column === void 0 ? void 0 : column.children.forEach(function (childColumn) { return handle(childColumn); });
|
|
2611
2552
|
return [2 /*return*/];
|
|
2612
2553
|
}
|
|
@@ -2628,62 +2569,59 @@
|
|
|
2628
2569
|
obj[column.field] = transform;
|
|
2629
2570
|
_7.label = 3;
|
|
2630
2571
|
case 3:
|
|
2631
|
-
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t :
|
|
2572
|
+
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t : '';
|
|
2632
2573
|
return [3 /*break*/, 13];
|
|
2633
2574
|
case 4:
|
|
2634
|
-
if (!(item[column.field] === undefined ||
|
|
2635
|
-
|
|
2636
|
-
item[column.field] === "")) return [3 /*break*/, 5];
|
|
2637
|
-
obj[column.field] = "";
|
|
2575
|
+
if (!(item[column.field] === undefined || item[column.field] === null || item[column.field] === '')) return [3 /*break*/, 5];
|
|
2576
|
+
obj[column.field] = '';
|
|
2638
2577
|
return [3 /*break*/, 13];
|
|
2639
2578
|
case 5:
|
|
2640
|
-
if (!(column.type ===
|
|
2579
|
+
if (!(column.type === 'string' || column.type === 'number')) return [3 /*break*/, 6];
|
|
2641
2580
|
// Nếu cell là string hoặc number thì gán bằng chính nó
|
|
2642
2581
|
obj[column.field] = item[column.field];
|
|
2643
2582
|
return [3 /*break*/, 13];
|
|
2644
2583
|
case 6:
|
|
2645
|
-
if (!(column.type ===
|
|
2584
|
+
if (!(column.type === 'bool')) return [3 /*break*/, 7];
|
|
2646
2585
|
// Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
|
|
2647
2586
|
if (item[column.field]) {
|
|
2648
|
-
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) ||
|
|
2587
|
+
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) || 'True';
|
|
2649
2588
|
}
|
|
2650
|
-
else if (obj[column.field] !== undefined &&
|
|
2651
|
-
obj[column.field]
|
|
2652
|
-
obj[column.field] = ((_v = column.option) === null || _v === void 0 ? void 0 : _v.displayOnFalse) || "False";
|
|
2589
|
+
else if (obj[column.field] !== undefined && obj[column.field] !== null) {
|
|
2590
|
+
obj[column.field] = ((_v = column.option) === null || _v === void 0 ? void 0 : _v.displayOnFalse) || 'False';
|
|
2653
2591
|
}
|
|
2654
2592
|
return [3 /*break*/, 13];
|
|
2655
2593
|
case 7:
|
|
2656
|
-
if (!(column.type ===
|
|
2594
|
+
if (!(column.type === 'date')) return [3 /*break*/, 8];
|
|
2657
2595
|
date = item[column.field];
|
|
2658
2596
|
transformDate = column.transformDate;
|
|
2659
2597
|
if (transformDate) {
|
|
2660
2598
|
date = transformDate(date, item);
|
|
2661
2599
|
}
|
|
2662
2600
|
// Nếu là date thì convert theo đúng format
|
|
2663
|
-
obj[column.field] = Date.toFormat(date,
|
|
2601
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy');
|
|
2664
2602
|
return [3 /*break*/, 13];
|
|
2665
2603
|
case 8:
|
|
2666
|
-
if (!(column.type ===
|
|
2604
|
+
if (!(column.type === 'datetime')) return [3 /*break*/, 9];
|
|
2667
2605
|
date = item[column.field];
|
|
2668
2606
|
transformDate = column.transformDate;
|
|
2669
2607
|
if (transformDate) {
|
|
2670
2608
|
date = transformDate(date, item);
|
|
2671
2609
|
}
|
|
2672
2610
|
// Nếu là datetime thì convert theo đúng format
|
|
2673
|
-
obj[column.field] = Date.toFormat(date,
|
|
2611
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy HH:mm');
|
|
2674
2612
|
return [3 /*break*/, 13];
|
|
2675
2613
|
case 9:
|
|
2676
|
-
if (!(column.type ===
|
|
2614
|
+
if (!(column.type === 'time')) return [3 /*break*/, 10];
|
|
2677
2615
|
date = item[column.field];
|
|
2678
2616
|
transformDate = column.transformDate;
|
|
2679
2617
|
if (transformDate) {
|
|
2680
2618
|
date = transformDate(date, item);
|
|
2681
2619
|
}
|
|
2682
2620
|
// Nếu là time thì convert theo đúng format
|
|
2683
|
-
obj[column.field] = Date.toFormat(date,
|
|
2621
|
+
obj[column.field] = Date.toFormat(date, 'HH:mm');
|
|
2684
2622
|
return [3 /*break*/, 13];
|
|
2685
2623
|
case 10:
|
|
2686
|
-
if (!(column.type ===
|
|
2624
|
+
if (!(column.type === 'values')) return [3 /*break*/, 12];
|
|
2687
2625
|
// Nếu là values thì lấy giá trị của value được chọn
|
|
2688
2626
|
_5 = obj;
|
|
2689
2627
|
_6 = column.field;
|
|
@@ -2868,8 +2806,17 @@
|
|
|
2868
2806
|
});
|
|
2869
2807
|
}); };
|
|
2870
2808
|
this.onFilterChange = function () {
|
|
2871
|
-
|
|
2872
|
-
|
|
2809
|
+
var _a, _b;
|
|
2810
|
+
// this.#paginator.pageIndex = 0;
|
|
2811
|
+
// this.reload(false);
|
|
2812
|
+
if ((_b = (_a = _this.gridOption) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.inlineColumn) {
|
|
2813
|
+
_this.filterRegister.value.set({
|
|
2814
|
+
columnFilter: _this.columnFilter,
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
else {
|
|
2818
|
+
_this.filterRegister.value.set({});
|
|
2819
|
+
}
|
|
2873
2820
|
};
|
|
2874
2821
|
this.onExpand = function (rowData) { return __awaiter(_this, void 0, void 0, function () {
|
|
2875
2822
|
var _w, _x, _y, _z, _0, data;
|
|
@@ -2914,9 +2861,7 @@
|
|
|
2914
2861
|
}
|
|
2915
2862
|
else {
|
|
2916
2863
|
if ((_f = _this.gridOption.selection) === null || _f === void 0 ? void 0 : _f.single) {
|
|
2917
|
-
_this.items
|
|
2918
|
-
.filter(function (e) { return e !== rowData; })
|
|
2919
|
-
.forEach(function (e) { return (e.isSelected = false); });
|
|
2864
|
+
_this.items.filter(function (e) { return e !== rowData; }).forEach(function (e) { return (e.isSelected = false); });
|
|
2920
2865
|
__classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
|
|
2921
2866
|
return;
|
|
2922
2867
|
}
|
|
@@ -2929,8 +2874,7 @@
|
|
|
2929
2874
|
var _a, _b, _c;
|
|
2930
2875
|
(_a = _this.items) === null || _a === void 0 ? void 0 : _a.forEach(function (e) {
|
|
2931
2876
|
var _a, _b, _c, _d;
|
|
2932
|
-
if (e.selectable &&
|
|
2933
|
-
(!((_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))) {
|
|
2877
|
+
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))) {
|
|
2934
2878
|
e.isSelected = _this.isSelectAll;
|
|
2935
2879
|
}
|
|
2936
2880
|
});
|
|
@@ -2964,10 +2908,6 @@
|
|
|
2964
2908
|
externalFilter: externalFilter,
|
|
2965
2909
|
filterDef: filterDef,
|
|
2966
2910
|
});
|
|
2967
|
-
// if (this.gridOption?.filter?.inlineColumn && args?.columnFilter) {
|
|
2968
|
-
// this.columnFilter = args.columnFilter;
|
|
2969
|
-
// }
|
|
2970
|
-
// this.gridFilter?.setFilter(args);
|
|
2971
2911
|
};
|
|
2972
2912
|
this.onCreate = function () {
|
|
2973
2913
|
var _a, _b;
|
|
@@ -2978,48 +2918,48 @@
|
|
|
2978
2918
|
var item = {};
|
|
2979
2919
|
// Gán giá trị mặc định
|
|
2980
2920
|
columns.forEach(function (column) {
|
|
2981
|
-
if (column.type ===
|
|
2982
|
-
item[column.field] =
|
|
2921
|
+
if (column.type === 'values') {
|
|
2922
|
+
item[column.field] = '';
|
|
2983
2923
|
}
|
|
2984
|
-
else if (column.type ===
|
|
2924
|
+
else if (column.type === 'bool') {
|
|
2985
2925
|
item[column.field] = true;
|
|
2986
2926
|
}
|
|
2987
|
-
else if (column.type ===
|
|
2927
|
+
else if (column.type === 'number') {
|
|
2988
2928
|
item[column.field] = null;
|
|
2989
2929
|
}
|
|
2990
2930
|
});
|
|
2991
|
-
if (type ===
|
|
2931
|
+
if (type === 'local') {
|
|
2992
2932
|
(_a = editor.onAdd) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(_this, _localItems));
|
|
2993
2933
|
}
|
|
2994
2934
|
else {
|
|
2995
2935
|
(_b = editor.onAdd) === null || _b === void 0 ? void 0 : _b.call(editor, item, _this.items);
|
|
2996
2936
|
}
|
|
2997
2937
|
// Đưa item lên dòng đầu tiên nếu type khác popup
|
|
2998
|
-
if (editor.type !==
|
|
2938
|
+
if (editor.type !== 'popup') {
|
|
2999
2939
|
if (editor.addToLast) {
|
|
3000
|
-
if (type ===
|
|
2940
|
+
if (type === 'local') {
|
|
3001
2941
|
__classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems), [item]));
|
|
3002
2942
|
}
|
|
3003
2943
|
_this.items = __spread(_this.items, [item]);
|
|
3004
2944
|
}
|
|
3005
2945
|
else {
|
|
3006
|
-
if (type ===
|
|
2946
|
+
if (type === 'local') {
|
|
3007
2947
|
__classPrivateFieldSet(_this, _localItems, __spread([item], __classPrivateFieldGet(_this, _localItems)));
|
|
3008
2948
|
}
|
|
3009
2949
|
_this.items = __spread([item], _this.items);
|
|
3010
2950
|
}
|
|
3011
2951
|
}
|
|
3012
|
-
item.editorStatus =
|
|
2952
|
+
item.editorStatus = 'create';
|
|
3013
2953
|
item.editorHandlerRow = {
|
|
3014
2954
|
temporary: Object.assign({}, item),
|
|
3015
2955
|
};
|
|
3016
2956
|
};
|
|
3017
2957
|
this.onUpdate = function (item) {
|
|
3018
2958
|
var editor = _this.gridOption.editor;
|
|
3019
|
-
item.editorStatus =
|
|
2959
|
+
item.editorStatus = 'update';
|
|
3020
2960
|
item.editorHandlerRow = Object.assign(Object.assign({}, item.editorHandlerRow), { temporary: Object.assign({}, item) });
|
|
3021
2961
|
// this.generateEditorHanlder(item);
|
|
3022
|
-
if (editor.type ===
|
|
2962
|
+
if (editor.type === 'popup') {
|
|
3023
2963
|
// Xử lý case popup
|
|
3024
2964
|
// this.sdGridPopupEditor.open(item, columns, isModified);
|
|
3025
2965
|
}
|
|
@@ -3062,8 +3002,8 @@
|
|
|
3062
3002
|
_3.sent();
|
|
3063
3003
|
_3.label = 6;
|
|
3064
3004
|
case 6:
|
|
3065
|
-
if (item.editorStatus ===
|
|
3066
|
-
if (this.gridOption.type ===
|
|
3005
|
+
if (item.editorStatus === 'create' && editor.type === 'popup') {
|
|
3006
|
+
if (this.gridOption.type === 'local') {
|
|
3067
3007
|
this.items.splice(0, 0, item);
|
|
3068
3008
|
}
|
|
3069
3009
|
// this.viewItems.splice(0, 0, item);
|
|
@@ -3085,8 +3025,8 @@
|
|
|
3085
3025
|
this.onCancel = function (item) {
|
|
3086
3026
|
var _a, _b;
|
|
3087
3027
|
var editor = _this.gridOption.editor;
|
|
3088
|
-
if (editor.type ===
|
|
3089
|
-
if (_this.gridOption.type ===
|
|
3028
|
+
if (editor.type === 'inline') {
|
|
3029
|
+
if (_this.gridOption.type === 'local') {
|
|
3090
3030
|
var idx2 = __classPrivateFieldGet(_this, _localItems).indexOf(item);
|
|
3091
3031
|
__classPrivateFieldGet(_this, _localItems).splice(idx2, 1);
|
|
3092
3032
|
__classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems)));
|
|
@@ -3094,7 +3034,7 @@
|
|
|
3094
3034
|
var idx1 = _this.items.indexOf(item);
|
|
3095
3035
|
_this.items.splice(idx1, 1);
|
|
3096
3036
|
_this.items = __spread(_this.items);
|
|
3097
|
-
if (_this.gridOption.type ===
|
|
3037
|
+
if (_this.gridOption.type === 'local') {
|
|
3098
3038
|
(_a = editor === null || editor === void 0 ? void 0 : editor.onCancel) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(_this, _localItems));
|
|
3099
3039
|
}
|
|
3100
3040
|
else {
|
|
@@ -3103,9 +3043,9 @@
|
|
|
3103
3043
|
_this.ref.detectChanges();
|
|
3104
3044
|
return;
|
|
3105
3045
|
}
|
|
3106
|
-
if (editor.type ===
|
|
3107
|
-
if (item.editorStatus ===
|
|
3108
|
-
if (_this.gridOption.type ===
|
|
3046
|
+
if (editor.type === 'focus') {
|
|
3047
|
+
if (item.editorStatus === 'create') {
|
|
3048
|
+
if (_this.gridOption.type === 'local') {
|
|
3109
3049
|
var idx2 = __classPrivateFieldGet(_this, _localItems).indexOf(item);
|
|
3110
3050
|
__classPrivateFieldGet(_this, _localItems).splice(idx2, 1);
|
|
3111
3051
|
__classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems)));
|
|
@@ -3143,8 +3083,8 @@
|
|
|
3143
3083
|
}
|
|
3144
3084
|
_3.label = 3;
|
|
3145
3085
|
case 3:
|
|
3146
|
-
if (editor.type ===
|
|
3147
|
-
if (this.gridOption.type ===
|
|
3086
|
+
if (editor.type === 'inline') {
|
|
3087
|
+
if (this.gridOption.type === 'local') {
|
|
3148
3088
|
idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
3149
3089
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
3150
3090
|
__classPrivateFieldSet(this, _localItems, __spread(__classPrivateFieldGet(this, _localItems)));
|
|
@@ -3152,7 +3092,7 @@
|
|
|
3152
3092
|
idx1 = this.items.indexOf(item);
|
|
3153
3093
|
this.items.splice(idx1, 1);
|
|
3154
3094
|
this.items = __spread(this.items);
|
|
3155
|
-
if (this.gridOption.type ===
|
|
3095
|
+
if (this.gridOption.type === 'local') {
|
|
3156
3096
|
(_1 = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _1 === void 0 ? void 0 : _1.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
3157
3097
|
}
|
|
3158
3098
|
else {
|
|
@@ -3215,13 +3155,9 @@
|
|
|
3215
3155
|
Object.defineProperty(SdGridMaterial.prototype, "option", {
|
|
3216
3156
|
set: function (option) {
|
|
3217
3157
|
if (option) {
|
|
3218
|
-
option = __classPrivateFieldGet(this, _initConfiguration).call(this, option);
|
|
3158
|
+
option = __classPrivateFieldGet(this, _initConfiguration$1).call(this, option);
|
|
3219
3159
|
this.gridOption = option;
|
|
3220
|
-
// this.#loadFilterRegister();
|
|
3221
3160
|
__classPrivateFieldSet(this, _loadCompleted, false);
|
|
3222
|
-
// this.#reload.next({
|
|
3223
|
-
// force: true,
|
|
3224
|
-
// });
|
|
3225
3161
|
var configuration = this.gridConfigurationService.init(this.key, this.gridOption);
|
|
3226
3162
|
this.gridConfigurationObserver = configuration.observer;
|
|
3227
3163
|
configuration.load();
|
|
@@ -3236,7 +3172,7 @@
|
|
|
3236
3172
|
var _this = this;
|
|
3237
3173
|
if (paginator && __classPrivateFieldGet(this, _paginator) !== paginator) {
|
|
3238
3174
|
__classPrivateFieldSet(this, _paginator, paginator);
|
|
3239
|
-
__classPrivateFieldGet(this, _subscription$
|
|
3175
|
+
__classPrivateFieldGet(this, _subscription$1).add(paginator.page
|
|
3240
3176
|
.pipe(operators.map(function () {
|
|
3241
3177
|
__classPrivateFieldGet(_this, _reload).next({
|
|
3242
3178
|
force: false,
|
|
@@ -3253,7 +3189,7 @@
|
|
|
3253
3189
|
var _this = this;
|
|
3254
3190
|
if (sort && __classPrivateFieldGet(this, _sort) !== sort) {
|
|
3255
3191
|
__classPrivateFieldSet(this, _sort, sort);
|
|
3256
|
-
__classPrivateFieldGet(this, _subscription$
|
|
3192
|
+
__classPrivateFieldGet(this, _subscription$1).add(sort.sortChange
|
|
3257
3193
|
.pipe(operators.map(function () {
|
|
3258
3194
|
__classPrivateFieldGet(_this, _reload).next({
|
|
3259
3195
|
force: false,
|
|
@@ -3270,7 +3206,7 @@
|
|
|
3270
3206
|
};
|
|
3271
3207
|
SdGridMaterial.prototype.ngAfterViewInit = function () {
|
|
3272
3208
|
var _this = this;
|
|
3273
|
-
__classPrivateFieldGet(this, _subscription$
|
|
3209
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _reload).pipe(operators.debounceTime(200), operators.switchMap(function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
3274
3210
|
var filterInfo, result;
|
|
3275
3211
|
return __generator(this, function (_3) {
|
|
3276
3212
|
switch (_3.label) {
|
|
@@ -3285,23 +3221,26 @@
|
|
|
3285
3221
|
});
|
|
3286
3222
|
}); }))
|
|
3287
3223
|
.subscribe(__classPrivateFieldGet(this, _render)));
|
|
3288
|
-
__classPrivateFieldGet(this, _subscription$
|
|
3289
|
-
__classPrivateFieldGet(this, _subscription$
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.sdFilterDefs.changes
|
|
3293
|
-
.pipe(operators.startWith([]))
|
|
3294
|
-
.subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
3295
|
-
__classPrivateFieldGet(this, _subscription$2).add(rxjs.combineLatest([
|
|
3224
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdCellDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
3225
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdFooterDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
3226
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdFilterDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
3227
|
+
__classPrivateFieldGet(this, _subscription$1).add(rxjs.combineLatest([
|
|
3296
3228
|
__classPrivateFieldGet(this, _optionChanges).pipe(operators.startWith(this.gridOption)),
|
|
3297
3229
|
this.sdFilterDefs.changes.pipe(operators.startWith(this.filterDefs)),
|
|
3298
|
-
]).subscribe(function (
|
|
3230
|
+
]).subscribe(function () {
|
|
3299
3231
|
__classPrivateFieldGet(_this, _loadFilterRegister).call(_this);
|
|
3300
3232
|
}));
|
|
3233
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _optionChanges).subscribe(function () {
|
|
3234
|
+
if (_this.filterRegister) {
|
|
3235
|
+
__classPrivateFieldGet(_this, _reload).next({
|
|
3236
|
+
force: true,
|
|
3237
|
+
});
|
|
3238
|
+
}
|
|
3239
|
+
}));
|
|
3301
3240
|
this.ref.detectChanges();
|
|
3302
3241
|
};
|
|
3303
3242
|
SdGridMaterial.prototype.ngOnDestroy = function () {
|
|
3304
|
-
__classPrivateFieldGet(this, _subscription$
|
|
3243
|
+
__classPrivateFieldGet(this, _subscription$1).unsubscribe();
|
|
3305
3244
|
};
|
|
3306
3245
|
SdGridMaterial.prototype.drop = function (event, columns) {
|
|
3307
3246
|
dragDrop.moveItemInArray(columns, event.previousIndex, event.currentIndex);
|
|
@@ -3362,16 +3301,16 @@
|
|
|
3362
3301
|
});
|
|
3363
3302
|
return SdGridMaterial;
|
|
3364
3303
|
}());
|
|
3365
|
-
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$
|
|
3304
|
+
_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();
|
|
3366
3305
|
SdGridMaterial.decorators = [
|
|
3367
3306
|
{ type: core.Component, args: [{
|
|
3368
|
-
selector:
|
|
3307
|
+
selector: 'sd-grid-material',
|
|
3369
3308
|
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>",
|
|
3370
3309
|
animations: [
|
|
3371
|
-
animations.trigger(
|
|
3372
|
-
animations.state(
|
|
3373
|
-
animations.state(
|
|
3374
|
-
animations.transition(
|
|
3310
|
+
animations.trigger('detailExpand', [
|
|
3311
|
+
animations.state('collapsed', animations.style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
3312
|
+
animations.state('expanded', animations.style({ height: '*', visibility: 'visible' })),
|
|
3313
|
+
animations.transition('expanded <=> collapsed', animations.animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
3375
3314
|
]),
|
|
3376
3315
|
],
|
|
3377
3316
|
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\")}"]
|
|
@@ -4379,7 +4318,7 @@
|
|
|
4379
4318
|
{ type: setting.SdSettingService }
|
|
4380
4319
|
]; };
|
|
4381
4320
|
|
|
4382
|
-
var _subscription$
|
|
4321
|
+
var _subscription$2;
|
|
4383
4322
|
var SdDynamicColumn = /** @class */ (function () {
|
|
4384
4323
|
function SdDynamicColumn(ref, generatedColumnService, notifyService, translateService, gridConfigurationService) {
|
|
4385
4324
|
var _this = this;
|
|
@@ -4388,7 +4327,7 @@
|
|
|
4388
4327
|
this.notifyService = notifyService;
|
|
4389
4328
|
this.translateService = translateService;
|
|
4390
4329
|
this.gridConfigurationService = gridConfigurationService;
|
|
4391
|
-
_subscription$
|
|
4330
|
+
_subscription$2.set(this, new rxjs.Subscription());
|
|
4392
4331
|
this.columnTypes = ['string', 'number', 'bool', 'date', 'datetime', 'time', 'values', 'children', 'children-col'];
|
|
4393
4332
|
this.form = new forms.FormGroup({});
|
|
4394
4333
|
this.isDetail = false;
|
|
@@ -4433,23 +4372,23 @@
|
|
|
4433
4372
|
var systemSetting = this.generatedColumnService.loadSystem(this.gridOption.config);
|
|
4434
4373
|
var setting = this.generatedColumnService.load((_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.config);
|
|
4435
4374
|
if (systemSetting) {
|
|
4436
|
-
(_b = __classPrivateFieldGet(this, _subscription$
|
|
4375
|
+
(_b = __classPrivateFieldGet(this, _subscription$2)) === null || _b === void 0 ? void 0 : _b.add(systemSetting.observer.subscribe(function (columns) {
|
|
4437
4376
|
_this.systemColumns = columns;
|
|
4438
4377
|
}));
|
|
4439
4378
|
}
|
|
4440
4379
|
if (setting) {
|
|
4441
|
-
(_c = __classPrivateFieldGet(this, _subscription$
|
|
4380
|
+
(_c = __classPrivateFieldGet(this, _subscription$2)) === null || _c === void 0 ? void 0 : _c.add(setting.observer.subscribe(function (columns) {
|
|
4442
4381
|
_this.columns = columns;
|
|
4443
4382
|
}));
|
|
4444
4383
|
}
|
|
4445
4384
|
this.originColumns = this.gridOption.columns.filter(function (e) { return e.type !== 'children' && e.type !== 'children-col'; });
|
|
4446
4385
|
};
|
|
4447
4386
|
SdDynamicColumn.prototype.ngOnDestroy = function () {
|
|
4448
|
-
__classPrivateFieldGet(this, _subscription$
|
|
4387
|
+
__classPrivateFieldGet(this, _subscription$2).unsubscribe();
|
|
4449
4388
|
};
|
|
4450
4389
|
return SdDynamicColumn;
|
|
4451
4390
|
}());
|
|
4452
|
-
_subscription$
|
|
4391
|
+
_subscription$2 = new WeakMap();
|
|
4453
4392
|
SdDynamicColumn.decorators = [
|
|
4454
4393
|
{ type: core.Component, args: [{
|
|
4455
4394
|
selector: 'sd-dynamic-column',
|