@sd-angular/core 1.3.104 → 1.3.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/sd-angular-core-grid-material.umd.js +261 -316
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +2 -2
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-setting.umd.js +21 -25
- package/bundles/sd-angular-core-setting.umd.js.map +1 -1
- package/bundles/sd-angular-core-setting.umd.min.js +1 -1
- package/bundles/sd-angular-core-setting.umd.min.js.map +1 -1
- package/esm2015/grid-material/src/lib/components/grid-filter/grid-filter.component.js +20 -19
- package/esm2015/grid-material/src/lib/grid-material.component.js +158 -188
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.service.js +82 -108
- package/esm2015/setting/src/lib/setting.service.js +22 -26
- package/fesm2015/sd-angular-core-grid-material.js +233 -288
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-setting.js +21 -25
- package/fesm2015/sd-angular-core-setting.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/components/grid-filter/grid-filter.component.d.ts +7 -7
- package/grid-material/src/lib/grid-material.component.d.ts +28 -28
- package/package.json +1 -1
- package/{sd-angular-core-1.3.104.tgz → sd-angular-core-1.3.105.tgz} +0 -0
- package/setting/sd-angular-core-setting.metadata.json +1 -1
|
@@ -539,7 +539,7 @@
|
|
|
539
539
|
_this.filterRegister.value.set({
|
|
540
540
|
columnFilter: _this.columnFilter,
|
|
541
541
|
externalFilter: _this.externalFilter,
|
|
542
|
-
filterDef: _this.filterDef
|
|
542
|
+
filterDef: _this.filterDef,
|
|
543
543
|
});
|
|
544
544
|
};
|
|
545
545
|
this.open = function () {
|
|
@@ -570,19 +570,20 @@
|
|
|
570
570
|
enumerable: false,
|
|
571
571
|
configurable: true
|
|
572
572
|
});
|
|
573
|
-
;
|
|
574
573
|
SdGridFilter.prototype.ngAfterViewInit = function () {
|
|
575
574
|
var _this = this;
|
|
576
575
|
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.configuration.observer.subscribe(function (configuration) {
|
|
577
|
-
|
|
578
|
-
_this.
|
|
579
|
-
_this.
|
|
576
|
+
var inlineColumn = configuration.inlineColumn, inlineExternal = configuration.inlineExternal, inlineFilterDef = configuration.inlineFilterDef;
|
|
577
|
+
_this.inlineColumn = inlineColumn;
|
|
578
|
+
_this.inlineExternal = inlineExternal;
|
|
579
|
+
_this.inlineFilterDef = inlineFilterDef;
|
|
580
580
|
_this.ref.markForCheck();
|
|
581
581
|
}));
|
|
582
582
|
__classPrivateFieldGet(this, _subscription$1).add(this.filterRegister.value.observer.subscribe(function (value) {
|
|
583
|
-
|
|
584
|
-
_this.
|
|
585
|
-
_this.
|
|
583
|
+
var columnFilter = value.columnFilter, externalFilter = value.externalFilter, filterDef = value.filterDef;
|
|
584
|
+
_this.columnFilter = columnFilter;
|
|
585
|
+
_this.externalFilter = externalFilter;
|
|
586
|
+
_this.filterDef = filterDef;
|
|
586
587
|
_this.ref.markForCheck();
|
|
587
588
|
}));
|
|
588
589
|
};
|
|
@@ -594,7 +595,7 @@
|
|
|
594
595
|
_subscription$1 = new WeakMap();
|
|
595
596
|
SdGridFilter.decorators = [
|
|
596
597
|
{ type: core.Component, args: [{
|
|
597
|
-
selector:
|
|
598
|
+
selector: "sd-grid-filter",
|
|
598
599
|
template: "<ng-container *ngIf=\"!filter?.disabled\">\r\n <ng-container *ngIf=\"filter?.enableCollapse;else noCollapse\">\r\n <sd-group class=\"p-12\" [isExpanded]=\"false\" title=\"T\u00ECm ki\u1EBFm\" expandable>\r\n <div sdGroupBody>\r\n <ng-container *ngTemplateOutlet=\"noCollapse\"></ng-container>\r\n </div>\r\n </sd-group>\r\n </ng-container>\r\n <ng-template #noCollapse>\r\n <div\r\n *ngIf=\"!isMobileOrTablet && ((columns?.length && !filter?.inlineColumn) || externalFilters?.length || filterDefs?.length)\"\r\n class=\"row mx-0\">\r\n <ng-container *ngIf=\"filter?.sorts?.length\">\r\n <ng-container *ngFor=\"let field of filter?.sorts\">\r\n <ng-container *ngIf=\"columns?.length && !filter?.inlineColumn\">\r\n <ng-container *ngFor=\"let item of columns | sdFilterColumn:field\">\r\n <ng-container *ngTemplateOutlet=\"filterColumn; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"externalFilters?.length\">\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal:field\">\r\n <ng-container *ngTemplateOutlet=\"filterExternal; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of filterDefs\">\r\n <div *ngIf=\"inlineFilterDef[item.sdMaterialFilterDef] && item.sdMaterialFilterDef === field\"\r\n class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <ng-container *ngTemplateOutlet=\"item.templateRef;context:{filterDef:filterDef, isInline: true}\">\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!filter?.sorts?.length\">\r\n <ng-container *ngIf=\"columns?.length && !filter?.inlineColumn\">\r\n <ng-container *ngFor=\"let item of columns | sdFilterColumn\">\r\n <ng-container *ngTemplateOutlet=\"filterColumn; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"externalFilters?.length\">\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal\">\r\n <ng-container *ngTemplateOutlet=\"filterExternal; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of filterDefs\">\r\n <div *ngIf=\"inlineFilterDef[item.sdMaterialFilterDef]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <ng-container *ngTemplateOutlet=\"item.templateRef;context:{filterDef:filterDef, isInline: true}\">\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <ng-template #filterColumn let-item=\"item\">\r\n <div *ngIf=\"inlineColumn[item.field]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <sd-input [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\" [(model)]=\"columnFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"columnFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.option?.displayOnTrue || 'True' },\r\n {value:'0',display:item.option?.displayOnFalse || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n <sd-select *ngIf=\"item.type === 'values' && item?.option?.selection !== 'AUTOCOMPLETE'\"\r\n [items]=\"item.option?.items\" [valueField]=\"item.option?.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" [disabled]=\"item.filter?.disabled\"\r\n [multiple]=\"item?.option?.selection === 'MULTIPLE' || item?.item?.selection === 'MULTIPLEAUTOCOMPLETE'\"\r\n [filtered]=\"item?.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" appearance=\"outline\">\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"item.type === 'values' && item?.option?.selection === 'AUTOCOMPLETE'\"\r\n [items]=\"item.option?.items\" [valueField]=\"item.option?.valueField\" [displayField]=\"item.option?.displayField\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" [disabled]=\"item.filter?.disabled\"\r\n appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-date-time *ngIf=\"item.type === 'date' || item.type === 'datetime' || item.type === 'time'\"\r\n [label]=\"item.title\" [(model)]=\"columnFilter[item.field]\" [type]=\"item.type\" (sdChange)=\"onFilter(item)\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n </div>\r\n </ng-template>\r\n <ng-template #filterExternal let-item=\"item\">\r\n <div *ngIf=\"inlineExternal[item.field]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <sd-input [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\" [(model)]=\"externalFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"externalFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.option?.displayOnTrue || 'True' },\r\n {value:'0',display:item.option?.displayOnFalse || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n <ng-container *ngIf=\"item.type === 'values' && item.option\">\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLE'\" [label]=\"item.title\" [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" [selectAll]=\"item.option.selectAll\"\r\n appearance=\"outline\" multiple>\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"item.option?.selection === 'AUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item.option.items\" [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item.option.items\" [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" filtered=\"true\" appearance=\"outline\"\r\n multiple>\r\n </sd-select>\r\n <sd-select *ngIf=\"!item.option?.selection\" [label]=\"item.title\" [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n </ng-container>\r\n <sd-date-time [label]=\"item.title\" *ngIf=\"item.type ==='date' || item.type ==='datetime'\"\r\n [(model)]=\"externalFilter[item.field]\" [type]=\"item.type\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-date-time>\r\n <sd-date-range [label]=\"item.title\" *ngIf=\"item.type ==='daterange' && externalFilter[item.field]\"\r\n [(from)]=\"externalFilter[item.field].from\" [(to)]=\"externalFilter[item.field].to\" [min]=\"item.minDate\"\r\n [max]=\"item.maxDate\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-date-range>\r\n </div>\r\n </ng-template>\r\n <sd-popup-filter [filterRegister]=\"filterRegister\" [columns]=\"columns\"\r\n [externalFilters]=\"externalFilters\" [filterDefs]=\"filterDefs\">\r\n </sd-popup-filter>\r\n </ng-template>\r\n</ng-container>",
|
|
599
600
|
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
600
601
|
styles: [":host{display:block;padding-bottom:10px;padding-left:0;padding-right:0}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}"]
|
|
@@ -606,11 +607,11 @@
|
|
|
606
607
|
]; };
|
|
607
608
|
SdGridFilter.propDecorators = {
|
|
608
609
|
popupFilter: [{ type: core.ViewChild, args: [SdPopupFilter,] }],
|
|
609
|
-
_filter: [{ type: core.Input, args: [
|
|
610
|
+
_filter: [{ type: core.Input, args: ["filter",] }],
|
|
610
611
|
columns: [{ type: core.Input }],
|
|
611
|
-
_externalFilters: [{ type: core.Input, args: [
|
|
612
|
+
_externalFilters: [{ type: core.Input, args: ["externalFilters",] }],
|
|
612
613
|
filterDefs: [{ type: core.Input }],
|
|
613
|
-
_filterRegister: [{ type: core.Input, args: [
|
|
614
|
+
_filterRegister: [{ type: core.Input, args: ["filterRegister",] }]
|
|
614
615
|
};
|
|
615
616
|
|
|
616
617
|
var _getExportableColumns, _getExportableGroups, _getExportColumns, _initTemplate;
|
|
@@ -1634,7 +1635,7 @@
|
|
|
1634
1635
|
{ type: core.NgZone }
|
|
1635
1636
|
]; };
|
|
1636
1637
|
|
|
1637
|
-
var _filterConfiguration, _filterValue, _cache$2,
|
|
1638
|
+
var _filterConfiguration, _filterValue, _cache$2, _defaultConfiguration, _defaultValue, _initConfiguration, _initValue;
|
|
1638
1639
|
var SdGridFilterService = /** @class */ (function () {
|
|
1639
1640
|
function SdGridFilterService(settingService) {
|
|
1640
1641
|
var _this = this;
|
|
@@ -1653,194 +1654,52 @@
|
|
|
1653
1654
|
cacheSession = true; // Nếu không có key thì chỉ lưu theo session
|
|
1654
1655
|
}
|
|
1655
1656
|
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());
|
|
1657
|
+
// Setting của filter configuration
|
|
1670
1658
|
var filterConfiguration_1 = _this.settingService.create({
|
|
1671
1659
|
prefix: __classPrivateFieldGet(_this, _filterConfiguration),
|
|
1672
1660
|
key: key,
|
|
1673
1661
|
}, {
|
|
1674
|
-
default:
|
|
1662
|
+
default: __classPrivateFieldGet(_this, _defaultConfiguration).call(_this, args),
|
|
1675
1663
|
type: cacheSession ? "session" : undefined,
|
|
1676
1664
|
});
|
|
1665
|
+
// Lấy giá trị configuration merge với giá trị defaultShowing của args nếu như args có thay đổi
|
|
1666
|
+
filterConfiguration_1.set(__classPrivateFieldGet(_this, _initConfiguration).call(_this, args, filterConfiguration_1.get()));
|
|
1667
|
+
// Setting của filter value
|
|
1677
1668
|
var filterValue_1 = _this.settingService.create({
|
|
1678
1669
|
prefix: __classPrivateFieldGet(_this, _filterValue),
|
|
1679
1670
|
key: key,
|
|
1680
1671
|
}, {
|
|
1681
|
-
default:
|
|
1672
|
+
default: __classPrivateFieldGet(_this, _defaultValue).call(_this, args),
|
|
1682
1673
|
type: cacheSession ? "session" : undefined,
|
|
1683
1674
|
});
|
|
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
|
-
};
|
|
1675
|
+
// Lấy giá trị value merge với giá trị default của args nếu như args có thay đổi
|
|
1676
|
+
filterValue_1.set(__classPrivateFieldGet(_this, _initValue).call(_this, args, filterValue_1.get()));
|
|
1808
1677
|
__classPrivateFieldGet(_this, _cache$2)[key] = {
|
|
1809
1678
|
configuration: {
|
|
1810
1679
|
get: function () {
|
|
1811
|
-
|
|
1812
|
-
return configurationGet_1(configuration);
|
|
1680
|
+
return filterConfiguration_1.get();
|
|
1813
1681
|
},
|
|
1814
1682
|
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,
|
|
1683
|
+
var inlineColumn = configuration.inlineColumn, inlineExternal = configuration.inlineExternal, inlineFilterDef = configuration.inlineFilterDef;
|
|
1684
|
+
filterConfiguration_1.set({
|
|
1685
|
+
inlineColumn: inlineColumn,
|
|
1686
|
+
inlineExternal: inlineExternal,
|
|
1687
|
+
inlineFilterDef: inlineFilterDef,
|
|
1688
|
+
});
|
|
1689
|
+
return {
|
|
1690
|
+
inlineColumn: inlineColumn,
|
|
1691
|
+
inlineExternal: inlineExternal,
|
|
1692
|
+
inlineFilterDef: inlineFilterDef,
|
|
1831
1693
|
};
|
|
1832
|
-
filterConfiguration_1.set(updatedConfiguration);
|
|
1833
|
-
return updatedConfiguration;
|
|
1834
1694
|
},
|
|
1835
1695
|
remove: function () {
|
|
1836
1696
|
filterConfiguration_1.remove();
|
|
1837
1697
|
},
|
|
1838
|
-
observer: filterConfiguration_1.observer.pipe(operators.
|
|
1698
|
+
observer: filterConfiguration_1.observer.pipe(operators.startWith(filterConfiguration_1.get())),
|
|
1839
1699
|
},
|
|
1840
1700
|
value: {
|
|
1841
1701
|
get: function () {
|
|
1842
|
-
|
|
1843
|
-
return valueGet_1(configuration);
|
|
1702
|
+
return filterValue_1.get();
|
|
1844
1703
|
},
|
|
1845
1704
|
set: function (configuration) {
|
|
1846
1705
|
var keys = Object.keys(configuration || {});
|
|
@@ -1866,13 +1725,129 @@
|
|
|
1866
1725
|
remove: function () {
|
|
1867
1726
|
filterValue_1.remove();
|
|
1868
1727
|
},
|
|
1869
|
-
observer: filterValue_1.observer.pipe(operators.
|
|
1728
|
+
observer: filterValue_1.observer.pipe(operators.startWith(filterValue_1.get())),
|
|
1870
1729
|
},
|
|
1871
1730
|
};
|
|
1872
1731
|
}
|
|
1873
1732
|
return __classPrivateFieldGet(_this, _cache$2)[key];
|
|
1874
1733
|
};
|
|
1875
|
-
|
|
1734
|
+
_defaultConfiguration.set(this, function (args) {
|
|
1735
|
+
var e_1, _r, e_2, _s, e_3, _t;
|
|
1736
|
+
var _a;
|
|
1737
|
+
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1738
|
+
var inlineColumn = {};
|
|
1739
|
+
var inlineExternal = {};
|
|
1740
|
+
var inlineFilterDef = {};
|
|
1741
|
+
try {
|
|
1742
|
+
// Filter column
|
|
1743
|
+
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1744
|
+
var item = _v.value;
|
|
1745
|
+
inlineColumn[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.defaultShowing;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1749
|
+
finally {
|
|
1750
|
+
try {
|
|
1751
|
+
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1752
|
+
}
|
|
1753
|
+
finally { if (e_1) throw e_1.error; }
|
|
1754
|
+
}
|
|
1755
|
+
try {
|
|
1756
|
+
// Filter external
|
|
1757
|
+
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1758
|
+
var item = _x.value;
|
|
1759
|
+
inlineExternal[item.field] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1763
|
+
finally {
|
|
1764
|
+
try {
|
|
1765
|
+
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1766
|
+
}
|
|
1767
|
+
finally { if (e_2) throw e_2.error; }
|
|
1768
|
+
}
|
|
1769
|
+
try {
|
|
1770
|
+
// Filter def
|
|
1771
|
+
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1772
|
+
var item = _z.value;
|
|
1773
|
+
inlineFilterDef[item.sdMaterialFilterDef] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1777
|
+
finally {
|
|
1778
|
+
try {
|
|
1779
|
+
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1780
|
+
}
|
|
1781
|
+
finally { if (e_3) throw e_3.error; }
|
|
1782
|
+
}
|
|
1783
|
+
return {
|
|
1784
|
+
// Filter column
|
|
1785
|
+
inlineColumn: inlineColumn,
|
|
1786
|
+
// Filter external
|
|
1787
|
+
inlineExternal: inlineExternal,
|
|
1788
|
+
// Filter def
|
|
1789
|
+
inlineFilterDef: inlineFilterDef,
|
|
1790
|
+
};
|
|
1791
|
+
});
|
|
1792
|
+
_defaultValue.set(this, function (args) {
|
|
1793
|
+
var e_4, _r, e_5, _s, e_6, _t;
|
|
1794
|
+
var _a;
|
|
1795
|
+
var columnFilter = {};
|
|
1796
|
+
var externalFilter = {};
|
|
1797
|
+
var filterDef = {};
|
|
1798
|
+
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1799
|
+
try {
|
|
1800
|
+
// Filter column
|
|
1801
|
+
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1802
|
+
var item = _v.value;
|
|
1803
|
+
columnFilter[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.default;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1807
|
+
finally {
|
|
1808
|
+
try {
|
|
1809
|
+
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1810
|
+
}
|
|
1811
|
+
finally { if (e_4) throw e_4.error; }
|
|
1812
|
+
}
|
|
1813
|
+
try {
|
|
1814
|
+
// Filter external
|
|
1815
|
+
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1816
|
+
var item = _x.value;
|
|
1817
|
+
externalFilter[item.field] = item === null || item === void 0 ? void 0 : item.default;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1821
|
+
finally {
|
|
1822
|
+
try {
|
|
1823
|
+
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1824
|
+
}
|
|
1825
|
+
finally { if (e_5) throw e_5.error; }
|
|
1826
|
+
}
|
|
1827
|
+
try {
|
|
1828
|
+
// Filter def
|
|
1829
|
+
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1830
|
+
var item = _z.value;
|
|
1831
|
+
filterDef[item.sdMaterialFilterDef] = undefined;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1835
|
+
finally {
|
|
1836
|
+
try {
|
|
1837
|
+
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1838
|
+
}
|
|
1839
|
+
finally { if (e_6) throw e_6.error; }
|
|
1840
|
+
}
|
|
1841
|
+
return {
|
|
1842
|
+
// Filter column
|
|
1843
|
+
columnFilter: columnFilter,
|
|
1844
|
+
// Filter external
|
|
1845
|
+
externalFilter: externalFilter,
|
|
1846
|
+
// Filter def
|
|
1847
|
+
filterDef: filterDef,
|
|
1848
|
+
};
|
|
1849
|
+
});
|
|
1850
|
+
_initConfiguration.set(this, function (args, configuration) {
|
|
1876
1851
|
var e_7, _r, e_8, _s, e_9, _t;
|
|
1877
1852
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1878
1853
|
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
@@ -1930,7 +1905,7 @@
|
|
|
1930
1905
|
inlineFilterDef: inlineFilterDef,
|
|
1931
1906
|
};
|
|
1932
1907
|
});
|
|
1933
|
-
|
|
1908
|
+
_initValue.set(this, function (args, value) {
|
|
1934
1909
|
var e_10, _r, e_11, _s, e_12, _t;
|
|
1935
1910
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1936
1911
|
var columnFilter = {};
|
|
@@ -1999,7 +1974,7 @@
|
|
|
1999
1974
|
}
|
|
2000
1975
|
return SdGridFilterService;
|
|
2001
1976
|
}());
|
|
2002
|
-
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(),
|
|
1977
|
+
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(), _defaultConfiguration = new WeakMap(), _defaultValue = new WeakMap(), _initConfiguration = new WeakMap(), _initValue = new WeakMap();
|
|
2003
1978
|
SdGridFilterService.decorators = [
|
|
2004
1979
|
{ type: core.Injectable }
|
|
2005
1980
|
];
|
|
@@ -2007,7 +1982,7 @@
|
|
|
2007
1982
|
{ type: setting.SdSettingService }
|
|
2008
1983
|
]; };
|
|
2009
1984
|
|
|
2010
|
-
var _optionChanges, _localItems, _paginator, _sort, _subscription$2, _reload, _loadCompleted, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _loadFilterRegister, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
1985
|
+
var _optionChanges, _localItems, _paginator, _sort, _subscription$2, _reload, _loadCompleted, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration$1, _loadFilterRegister, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
2011
1986
|
var SdGridMaterial = /** @class */ (function () {
|
|
2012
1987
|
function SdGridMaterial(ref, configuration, gridConfigurationService, exportService, notifyService, columnValuesPipe, gridFilterService, editorHandlerColumnPipe) {
|
|
2013
1988
|
var _this = this;
|
|
@@ -2048,7 +2023,7 @@
|
|
|
2048
2023
|
_reload.set(this, new rxjs.Subject());
|
|
2049
2024
|
this.isExporting = false;
|
|
2050
2025
|
this.isSelectAll = false;
|
|
2051
|
-
this.exportTitle =
|
|
2026
|
+
this.exportTitle = 'Export';
|
|
2052
2027
|
_loadCompleted.set(this, false);
|
|
2053
2028
|
_initCellDef.set(this, function () {
|
|
2054
2029
|
var e_1, _3;
|
|
@@ -2085,9 +2060,6 @@
|
|
|
2085
2060
|
}
|
|
2086
2061
|
finally { if (e_2) throw e_2.error; }
|
|
2087
2062
|
}
|
|
2088
|
-
// if (this.filterDefs?.length) {
|
|
2089
|
-
// this.#loadFilterRegister();
|
|
2090
|
-
// }
|
|
2091
2063
|
});
|
|
2092
2064
|
_initFooterDef.set(this, function () {
|
|
2093
2065
|
var e_3, _3;
|
|
@@ -2117,14 +2089,14 @@
|
|
|
2117
2089
|
rawColumnFilter: columnFilter || {},
|
|
2118
2090
|
rawExternalFilter: externalFilter || {},
|
|
2119
2091
|
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) ||
|
|
2092
|
+
orderBy: ((_a = __classPrivateFieldGet(_this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
2093
|
+
orderDirection: ((_b = __classPrivateFieldGet(_this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
2122
2094
|
pageNumber: pageNumber,
|
|
2123
2095
|
pageSize: pageSize,
|
|
2124
2096
|
isExported: true,
|
|
2125
2097
|
};
|
|
2126
2098
|
});
|
|
2127
|
-
_initConfiguration.set(this, function (option) {
|
|
2099
|
+
_initConfiguration$1.set(this, function (option) {
|
|
2128
2100
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
2129
2101
|
// Init pagination
|
|
2130
2102
|
option.paginate = {
|
|
@@ -2148,7 +2120,8 @@
|
|
|
2148
2120
|
if (!hasRegister) {
|
|
2149
2121
|
__classPrivateFieldGet(_this, _subscription$2).add(_this.filterRegister.value.observer
|
|
2150
2122
|
.pipe(operators.debounceTime(500), operators.map(function (filterValue) {
|
|
2151
|
-
|
|
2123
|
+
var columnFilter = filterValue.columnFilter;
|
|
2124
|
+
_this.columnFilter = columnFilter;
|
|
2152
2125
|
__classPrivateFieldGet(_this, _paginator).pageIndex = 0;
|
|
2153
2126
|
__classPrivateFieldGet(_this, _reload).next({
|
|
2154
2127
|
force: false,
|
|
@@ -2173,52 +2146,39 @@
|
|
|
2173
2146
|
for (var columns_1 = __values(columns), columns_1_1 = columns_1.next(); !columns_1_1.done; columns_1_1 = columns_1.next()) {
|
|
2174
2147
|
var column = columns_1_1.value;
|
|
2175
2148
|
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();
|
|
2149
|
+
var filterValue = (rawColumnFilter[field] || '').toString().trim().toLowerCase();
|
|
2150
|
+
var columnValue = (item[field] || '').toString().trim().toLowerCase();
|
|
2184
2151
|
if (filterValue) {
|
|
2185
|
-
if (!columnValue &&
|
|
2186
|
-
type !== "datetime" &&
|
|
2187
|
-
type !== "date" &&
|
|
2188
|
-
type !== "time") {
|
|
2152
|
+
if (!columnValue && type !== 'datetime' && type !== 'date' && type !== 'time') {
|
|
2189
2153
|
return false;
|
|
2190
2154
|
}
|
|
2191
|
-
if (type ===
|
|
2155
|
+
if (type === 'string') {
|
|
2192
2156
|
if (columnValue.indexOf(filterValue) === -1) {
|
|
2193
2157
|
return false;
|
|
2194
2158
|
}
|
|
2195
2159
|
}
|
|
2196
|
-
else if (type ===
|
|
2160
|
+
else if (type === 'values') {
|
|
2197
2161
|
if (columnValue !== filterValue) {
|
|
2198
2162
|
return false;
|
|
2199
2163
|
}
|
|
2200
2164
|
}
|
|
2201
|
-
else if (type ===
|
|
2202
|
-
var fValue = +filterValue
|
|
2203
|
-
.replace(">=", "")
|
|
2204
|
-
.replace("<=", "")
|
|
2205
|
-
.replace(">", "")
|
|
2206
|
-
.replace("<", "");
|
|
2165
|
+
else if (type === 'number') {
|
|
2166
|
+
var fValue = +filterValue.replace('>=', '').replace('<=', '').replace('>', '').replace('<', '');
|
|
2207
2167
|
var cValue = +columnValue;
|
|
2208
2168
|
if (fValue || fValue === 0) {
|
|
2209
2169
|
if (!cValue && cValue !== 0) {
|
|
2210
2170
|
return false;
|
|
2211
2171
|
}
|
|
2212
|
-
if (filterValue.indexOf(
|
|
2172
|
+
if (filterValue.indexOf('>=') > -1 && cValue < fValue) {
|
|
2213
2173
|
return false;
|
|
2214
2174
|
}
|
|
2215
|
-
else if (filterValue.indexOf(
|
|
2175
|
+
else if (filterValue.indexOf('<=') > -1 && cValue > fValue) {
|
|
2216
2176
|
return false;
|
|
2217
2177
|
}
|
|
2218
|
-
else if (filterValue.indexOf(
|
|
2178
|
+
else if (filterValue.indexOf('<') > -1 && cValue >= fValue) {
|
|
2219
2179
|
return false;
|
|
2220
2180
|
}
|
|
2221
|
-
else if (filterValue.indexOf(
|
|
2181
|
+
else if (filterValue.indexOf('>') > -1 && cValue <= fValue) {
|
|
2222
2182
|
return false;
|
|
2223
2183
|
}
|
|
2224
2184
|
else if (cValue !== fValue) {
|
|
@@ -2226,21 +2186,15 @@
|
|
|
2226
2186
|
}
|
|
2227
2187
|
}
|
|
2228
2188
|
}
|
|
2229
|
-
else if (type ===
|
|
2230
|
-
if (filterValue ===
|
|
2231
|
-
columnValue !== "1" &&
|
|
2232
|
-
columnValue !== "true") {
|
|
2189
|
+
else if (type === 'bool') {
|
|
2190
|
+
if (filterValue === '1' && columnValue !== '1' && columnValue !== 'true') {
|
|
2233
2191
|
return false;
|
|
2234
2192
|
}
|
|
2235
|
-
else if (filterValue ===
|
|
2236
|
-
columnValue !== "0" &&
|
|
2237
|
-
columnValue !== "false") {
|
|
2193
|
+
else if (filterValue === '0' && columnValue !== '0' && columnValue !== 'false') {
|
|
2238
2194
|
return false;
|
|
2239
2195
|
}
|
|
2240
2196
|
}
|
|
2241
|
-
else if (type ===
|
|
2242
|
-
type === "date" ||
|
|
2243
|
-
type === "time") {
|
|
2197
|
+
else if (type === 'datetime' || type === 'date' || type === 'time') {
|
|
2244
2198
|
var from = (_b = (_a = rawColumnFilter[field]) === null || _a === void 0 ? void 0 : _a.from) !== null && _b !== void 0 ? _b : rawColumnFilter[field];
|
|
2245
2199
|
var to = (_d = (_c = rawColumnFilter[field]) === null || _c === void 0 ? void 0 : _c.to) !== null && _d !== void 0 ? _d : rawColumnFilter[field];
|
|
2246
2200
|
var fromDate = Date.begin(from);
|
|
@@ -2278,16 +2232,16 @@
|
|
|
2278
2232
|
if (column) {
|
|
2279
2233
|
var type_1 = column.type, field_1 = column.field;
|
|
2280
2234
|
items.sort(function (current, next) {
|
|
2281
|
-
if (type_1 ===
|
|
2235
|
+
if (type_1 === 'number') {
|
|
2282
2236
|
return (current[field_1] || 0) - (next[field_1] || 0);
|
|
2283
2237
|
}
|
|
2284
|
-
if (type_1 ===
|
|
2285
|
-
var d1 = new Date(current[field_1] ||
|
|
2286
|
-
var d2 = new Date(current[field_1] ||
|
|
2238
|
+
if (type_1 === 'date' || type_1 === 'datetime' || type_1 === 'time') {
|
|
2239
|
+
var d1 = new Date(current[field_1] || '').getTime();
|
|
2240
|
+
var d2 = new Date(current[field_1] || '').getTime();
|
|
2287
2241
|
return d1 - d2;
|
|
2288
2242
|
}
|
|
2289
|
-
var s1 = (current[field_1] ||
|
|
2290
|
-
var s2 = (next[field_1] ||
|
|
2243
|
+
var s1 = (current[field_1] || '').toString();
|
|
2244
|
+
var s2 = (next[field_1] || '').toString();
|
|
2291
2245
|
if (s1 > s2) {
|
|
2292
2246
|
return 1;
|
|
2293
2247
|
}
|
|
@@ -2296,14 +2250,14 @@
|
|
|
2296
2250
|
}
|
|
2297
2251
|
return 0;
|
|
2298
2252
|
});
|
|
2299
|
-
if (orderDirection ===
|
|
2253
|
+
if (orderDirection === 'desc') {
|
|
2300
2254
|
items.reverse();
|
|
2301
2255
|
}
|
|
2302
2256
|
}
|
|
2303
2257
|
}
|
|
2304
2258
|
return {
|
|
2305
2259
|
items: items.filter(function (item, index) {
|
|
2306
|
-
return
|
|
2260
|
+
return index >= pageNumber * pageSize && index < (pageNumber + 1) * pageSize;
|
|
2307
2261
|
}),
|
|
2308
2262
|
total: items.length,
|
|
2309
2263
|
};
|
|
@@ -2315,8 +2269,8 @@
|
|
|
2315
2269
|
rawColumnFilter: columnFilter || {},
|
|
2316
2270
|
rawExternalFilter: externalFilter || {},
|
|
2317
2271
|
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) ||
|
|
2272
|
+
orderBy: ((_a = __classPrivateFieldGet(_this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
2273
|
+
orderDirection: ((_b = __classPrivateFieldGet(_this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
2320
2274
|
pageNumber: ((_c = __classPrivateFieldGet(_this, _paginator)) === null || _c === void 0 ? void 0 : _c.pageIndex) || 0,
|
|
2321
2275
|
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
2276
|
};
|
|
@@ -2329,7 +2283,7 @@
|
|
|
2329
2283
|
switch (_5.label) {
|
|
2330
2284
|
case 0:
|
|
2331
2285
|
this.isLoading = true;
|
|
2332
|
-
if (!(this.gridOption.type ===
|
|
2286
|
+
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 6];
|
|
2333
2287
|
_5.label = 1;
|
|
2334
2288
|
case 1:
|
|
2335
2289
|
_5.trys.push([1, 3, 4, 5]);
|
|
@@ -2347,7 +2301,7 @@
|
|
|
2347
2301
|
case 3:
|
|
2348
2302
|
error_1 = _5.sent();
|
|
2349
2303
|
console.error(error_1);
|
|
2350
|
-
this.notifyService.notify.warning(
|
|
2304
|
+
this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
2351
2305
|
return [2 /*return*/, {
|
|
2352
2306
|
items: [],
|
|
2353
2307
|
total: 0,
|
|
@@ -2375,14 +2329,14 @@
|
|
|
2375
2329
|
_5.label = 10;
|
|
2376
2330
|
case 10:
|
|
2377
2331
|
if (!Array.isArray(__classPrivateFieldGet(this, _localItems))) {
|
|
2378
|
-
this.notifyService.notify.warning(
|
|
2332
|
+
this.notifyService.notify.warning('Dữ liệu không phải là một mảng');
|
|
2379
2333
|
__classPrivateFieldSet(this, _localItems, []);
|
|
2380
2334
|
}
|
|
2381
2335
|
return [3 /*break*/, 13];
|
|
2382
2336
|
case 11:
|
|
2383
2337
|
error_2 = _5.sent();
|
|
2384
2338
|
console.error(error_2);
|
|
2385
|
-
this.notifyService.notify.warning(
|
|
2339
|
+
this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
2386
2340
|
__classPrivateFieldSet(this, _localItems, []);
|
|
2387
2341
|
return [3 /*break*/, 13];
|
|
2388
2342
|
case 12:
|
|
@@ -2457,7 +2411,7 @@
|
|
|
2457
2411
|
case 1: return [2 /*return*/, _3.sent()];
|
|
2458
2412
|
case 2:
|
|
2459
2413
|
filterInfo = __classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize);
|
|
2460
|
-
if (!(this.gridOption.type ===
|
|
2414
|
+
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 4];
|
|
2461
2415
|
result = this.gridOption.items(filterInfo);
|
|
2462
2416
|
if (rxjs.isObservable(result)) {
|
|
2463
2417
|
result = result.toPromise();
|
|
@@ -2466,7 +2420,7 @@
|
|
|
2466
2420
|
case 3: return [2 /*return*/, _3.sent()];
|
|
2467
2421
|
case 4:
|
|
2468
2422
|
exportedItems = [];
|
|
2469
|
-
if (!(typeof this.gridOption.items ===
|
|
2423
|
+
if (!(typeof this.gridOption.items === 'function')) return [3 /*break*/, 8];
|
|
2470
2424
|
results = this.gridOption.items();
|
|
2471
2425
|
if (!(results instanceof Promise)) return [3 /*break*/, 6];
|
|
2472
2426
|
return [4 /*yield*/, results];
|
|
@@ -2491,21 +2445,21 @@
|
|
|
2491
2445
|
.filter(function (e) { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })
|
|
2492
2446
|
.forEach(function (column) {
|
|
2493
2447
|
var _a, _b;
|
|
2494
|
-
if (column.type ===
|
|
2448
|
+
if (column.type === 'image') {
|
|
2495
2449
|
return;
|
|
2496
2450
|
}
|
|
2497
|
-
if (column.type ===
|
|
2451
|
+
if (column.type === 'children') {
|
|
2498
2452
|
(_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 ===
|
|
2453
|
+
if (childColumn.type === 'image') {
|
|
2500
2454
|
return;
|
|
2501
2455
|
}
|
|
2502
2456
|
columns.push(childColumn);
|
|
2503
2457
|
});
|
|
2504
2458
|
return;
|
|
2505
2459
|
}
|
|
2506
|
-
if (column.type ===
|
|
2460
|
+
if (column.type === 'children-col') {
|
|
2507
2461
|
(_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 ===
|
|
2462
|
+
if (childColumn.type === 'image') {
|
|
2509
2463
|
return;
|
|
2510
2464
|
}
|
|
2511
2465
|
columns.push(childColumn);
|
|
@@ -2518,7 +2472,7 @@
|
|
|
2518
2472
|
});
|
|
2519
2473
|
_allExportedColumns.set(this, function () {
|
|
2520
2474
|
var _a, _b;
|
|
2521
|
-
return ((
|
|
2475
|
+
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
2476
|
});
|
|
2523
2477
|
_onExport.set(this, function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
2524
2478
|
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 +2506,7 @@
|
|
|
2552
2506
|
try {
|
|
2553
2507
|
for (results_1 = __values(results), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
|
2554
2508
|
result = results_1_1.value;
|
|
2555
|
-
if (
|
|
2509
|
+
if ('items' in result) {
|
|
2556
2510
|
exportItems_1 = __spread(exportItems_1, result.items);
|
|
2557
2511
|
total_1 = result.total;
|
|
2558
2512
|
}
|
|
@@ -2606,7 +2560,7 @@
|
|
|
2606
2560
|
if (!column) {
|
|
2607
2561
|
return [2 /*return*/];
|
|
2608
2562
|
}
|
|
2609
|
-
if (column.type ===
|
|
2563
|
+
if (column.type === 'children' || column.type === 'children-col') {
|
|
2610
2564
|
column === null || column === void 0 ? void 0 : column.children.forEach(function (childColumn) { return handle(childColumn); });
|
|
2611
2565
|
return [2 /*return*/];
|
|
2612
2566
|
}
|
|
@@ -2628,62 +2582,59 @@
|
|
|
2628
2582
|
obj[column.field] = transform;
|
|
2629
2583
|
_7.label = 3;
|
|
2630
2584
|
case 3:
|
|
2631
|
-
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t :
|
|
2585
|
+
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t : '';
|
|
2632
2586
|
return [3 /*break*/, 13];
|
|
2633
2587
|
case 4:
|
|
2634
|
-
if (!(item[column.field] === undefined ||
|
|
2635
|
-
|
|
2636
|
-
item[column.field] === "")) return [3 /*break*/, 5];
|
|
2637
|
-
obj[column.field] = "";
|
|
2588
|
+
if (!(item[column.field] === undefined || item[column.field] === null || item[column.field] === '')) return [3 /*break*/, 5];
|
|
2589
|
+
obj[column.field] = '';
|
|
2638
2590
|
return [3 /*break*/, 13];
|
|
2639
2591
|
case 5:
|
|
2640
|
-
if (!(column.type ===
|
|
2592
|
+
if (!(column.type === 'string' || column.type === 'number')) return [3 /*break*/, 6];
|
|
2641
2593
|
// Nếu cell là string hoặc number thì gán bằng chính nó
|
|
2642
2594
|
obj[column.field] = item[column.field];
|
|
2643
2595
|
return [3 /*break*/, 13];
|
|
2644
2596
|
case 6:
|
|
2645
|
-
if (!(column.type ===
|
|
2597
|
+
if (!(column.type === 'bool')) return [3 /*break*/, 7];
|
|
2646
2598
|
// Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
|
|
2647
2599
|
if (item[column.field]) {
|
|
2648
|
-
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) ||
|
|
2600
|
+
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) || 'True';
|
|
2649
2601
|
}
|
|
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";
|
|
2602
|
+
else if (obj[column.field] !== undefined && obj[column.field] !== null) {
|
|
2603
|
+
obj[column.field] = ((_v = column.option) === null || _v === void 0 ? void 0 : _v.displayOnFalse) || 'False';
|
|
2653
2604
|
}
|
|
2654
2605
|
return [3 /*break*/, 13];
|
|
2655
2606
|
case 7:
|
|
2656
|
-
if (!(column.type ===
|
|
2607
|
+
if (!(column.type === 'date')) return [3 /*break*/, 8];
|
|
2657
2608
|
date = item[column.field];
|
|
2658
2609
|
transformDate = column.transformDate;
|
|
2659
2610
|
if (transformDate) {
|
|
2660
2611
|
date = transformDate(date, item);
|
|
2661
2612
|
}
|
|
2662
2613
|
// Nếu là date thì convert theo đúng format
|
|
2663
|
-
obj[column.field] = Date.toFormat(date,
|
|
2614
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy');
|
|
2664
2615
|
return [3 /*break*/, 13];
|
|
2665
2616
|
case 8:
|
|
2666
|
-
if (!(column.type ===
|
|
2617
|
+
if (!(column.type === 'datetime')) return [3 /*break*/, 9];
|
|
2667
2618
|
date = item[column.field];
|
|
2668
2619
|
transformDate = column.transformDate;
|
|
2669
2620
|
if (transformDate) {
|
|
2670
2621
|
date = transformDate(date, item);
|
|
2671
2622
|
}
|
|
2672
2623
|
// Nếu là datetime thì convert theo đúng format
|
|
2673
|
-
obj[column.field] = Date.toFormat(date,
|
|
2624
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy HH:mm');
|
|
2674
2625
|
return [3 /*break*/, 13];
|
|
2675
2626
|
case 9:
|
|
2676
|
-
if (!(column.type ===
|
|
2627
|
+
if (!(column.type === 'time')) return [3 /*break*/, 10];
|
|
2677
2628
|
date = item[column.field];
|
|
2678
2629
|
transformDate = column.transformDate;
|
|
2679
2630
|
if (transformDate) {
|
|
2680
2631
|
date = transformDate(date, item);
|
|
2681
2632
|
}
|
|
2682
2633
|
// Nếu là time thì convert theo đúng format
|
|
2683
|
-
obj[column.field] = Date.toFormat(date,
|
|
2634
|
+
obj[column.field] = Date.toFormat(date, 'HH:mm');
|
|
2684
2635
|
return [3 /*break*/, 13];
|
|
2685
2636
|
case 10:
|
|
2686
|
-
if (!(column.type ===
|
|
2637
|
+
if (!(column.type === 'values')) return [3 /*break*/, 12];
|
|
2687
2638
|
// Nếu là values thì lấy giá trị của value được chọn
|
|
2688
2639
|
_5 = obj;
|
|
2689
2640
|
_6 = column.field;
|
|
@@ -2868,8 +2819,17 @@
|
|
|
2868
2819
|
});
|
|
2869
2820
|
}); };
|
|
2870
2821
|
this.onFilterChange = function () {
|
|
2871
|
-
|
|
2872
|
-
|
|
2822
|
+
var _a, _b;
|
|
2823
|
+
// this.#paginator.pageIndex = 0;
|
|
2824
|
+
// this.reload(false);
|
|
2825
|
+
if ((_b = (_a = _this.gridOption) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.inlineColumn) {
|
|
2826
|
+
_this.filterRegister.value.set({
|
|
2827
|
+
columnFilter: _this.columnFilter,
|
|
2828
|
+
});
|
|
2829
|
+
}
|
|
2830
|
+
else {
|
|
2831
|
+
_this.filterRegister.value.set({});
|
|
2832
|
+
}
|
|
2873
2833
|
};
|
|
2874
2834
|
this.onExpand = function (rowData) { return __awaiter(_this, void 0, void 0, function () {
|
|
2875
2835
|
var _w, _x, _y, _z, _0, data;
|
|
@@ -2914,9 +2874,7 @@
|
|
|
2914
2874
|
}
|
|
2915
2875
|
else {
|
|
2916
2876
|
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); });
|
|
2877
|
+
_this.items.filter(function (e) { return e !== rowData; }).forEach(function (e) { return (e.isSelected = false); });
|
|
2920
2878
|
__classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
|
|
2921
2879
|
return;
|
|
2922
2880
|
}
|
|
@@ -2929,8 +2887,7 @@
|
|
|
2929
2887
|
var _a, _b, _c;
|
|
2930
2888
|
(_a = _this.items) === null || _a === void 0 ? void 0 : _a.forEach(function (e) {
|
|
2931
2889
|
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))) {
|
|
2890
|
+
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
2891
|
e.isSelected = _this.isSelectAll;
|
|
2935
2892
|
}
|
|
2936
2893
|
});
|
|
@@ -2964,10 +2921,6 @@
|
|
|
2964
2921
|
externalFilter: externalFilter,
|
|
2965
2922
|
filterDef: filterDef,
|
|
2966
2923
|
});
|
|
2967
|
-
// if (this.gridOption?.filter?.inlineColumn && args?.columnFilter) {
|
|
2968
|
-
// this.columnFilter = args.columnFilter;
|
|
2969
|
-
// }
|
|
2970
|
-
// this.gridFilter?.setFilter(args);
|
|
2971
2924
|
};
|
|
2972
2925
|
this.onCreate = function () {
|
|
2973
2926
|
var _a, _b;
|
|
@@ -2978,48 +2931,48 @@
|
|
|
2978
2931
|
var item = {};
|
|
2979
2932
|
// Gán giá trị mặc định
|
|
2980
2933
|
columns.forEach(function (column) {
|
|
2981
|
-
if (column.type ===
|
|
2982
|
-
item[column.field] =
|
|
2934
|
+
if (column.type === 'values') {
|
|
2935
|
+
item[column.field] = '';
|
|
2983
2936
|
}
|
|
2984
|
-
else if (column.type ===
|
|
2937
|
+
else if (column.type === 'bool') {
|
|
2985
2938
|
item[column.field] = true;
|
|
2986
2939
|
}
|
|
2987
|
-
else if (column.type ===
|
|
2940
|
+
else if (column.type === 'number') {
|
|
2988
2941
|
item[column.field] = null;
|
|
2989
2942
|
}
|
|
2990
2943
|
});
|
|
2991
|
-
if (type ===
|
|
2944
|
+
if (type === 'local') {
|
|
2992
2945
|
(_a = editor.onAdd) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(_this, _localItems));
|
|
2993
2946
|
}
|
|
2994
2947
|
else {
|
|
2995
2948
|
(_b = editor.onAdd) === null || _b === void 0 ? void 0 : _b.call(editor, item, _this.items);
|
|
2996
2949
|
}
|
|
2997
2950
|
// Đưa item lên dòng đầu tiên nếu type khác popup
|
|
2998
|
-
if (editor.type !==
|
|
2951
|
+
if (editor.type !== 'popup') {
|
|
2999
2952
|
if (editor.addToLast) {
|
|
3000
|
-
if (type ===
|
|
2953
|
+
if (type === 'local') {
|
|
3001
2954
|
__classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems), [item]));
|
|
3002
2955
|
}
|
|
3003
2956
|
_this.items = __spread(_this.items, [item]);
|
|
3004
2957
|
}
|
|
3005
2958
|
else {
|
|
3006
|
-
if (type ===
|
|
2959
|
+
if (type === 'local') {
|
|
3007
2960
|
__classPrivateFieldSet(_this, _localItems, __spread([item], __classPrivateFieldGet(_this, _localItems)));
|
|
3008
2961
|
}
|
|
3009
2962
|
_this.items = __spread([item], _this.items);
|
|
3010
2963
|
}
|
|
3011
2964
|
}
|
|
3012
|
-
item.editorStatus =
|
|
2965
|
+
item.editorStatus = 'create';
|
|
3013
2966
|
item.editorHandlerRow = {
|
|
3014
2967
|
temporary: Object.assign({}, item),
|
|
3015
2968
|
};
|
|
3016
2969
|
};
|
|
3017
2970
|
this.onUpdate = function (item) {
|
|
3018
2971
|
var editor = _this.gridOption.editor;
|
|
3019
|
-
item.editorStatus =
|
|
2972
|
+
item.editorStatus = 'update';
|
|
3020
2973
|
item.editorHandlerRow = Object.assign(Object.assign({}, item.editorHandlerRow), { temporary: Object.assign({}, item) });
|
|
3021
2974
|
// this.generateEditorHanlder(item);
|
|
3022
|
-
if (editor.type ===
|
|
2975
|
+
if (editor.type === 'popup') {
|
|
3023
2976
|
// Xử lý case popup
|
|
3024
2977
|
// this.sdGridPopupEditor.open(item, columns, isModified);
|
|
3025
2978
|
}
|
|
@@ -3062,8 +3015,8 @@
|
|
|
3062
3015
|
_3.sent();
|
|
3063
3016
|
_3.label = 6;
|
|
3064
3017
|
case 6:
|
|
3065
|
-
if (item.editorStatus ===
|
|
3066
|
-
if (this.gridOption.type ===
|
|
3018
|
+
if (item.editorStatus === 'create' && editor.type === 'popup') {
|
|
3019
|
+
if (this.gridOption.type === 'local') {
|
|
3067
3020
|
this.items.splice(0, 0, item);
|
|
3068
3021
|
}
|
|
3069
3022
|
// this.viewItems.splice(0, 0, item);
|
|
@@ -3085,8 +3038,8 @@
|
|
|
3085
3038
|
this.onCancel = function (item) {
|
|
3086
3039
|
var _a, _b;
|
|
3087
3040
|
var editor = _this.gridOption.editor;
|
|
3088
|
-
if (editor.type ===
|
|
3089
|
-
if (_this.gridOption.type ===
|
|
3041
|
+
if (editor.type === 'inline') {
|
|
3042
|
+
if (_this.gridOption.type === 'local') {
|
|
3090
3043
|
var idx2 = __classPrivateFieldGet(_this, _localItems).indexOf(item);
|
|
3091
3044
|
__classPrivateFieldGet(_this, _localItems).splice(idx2, 1);
|
|
3092
3045
|
__classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems)));
|
|
@@ -3094,7 +3047,7 @@
|
|
|
3094
3047
|
var idx1 = _this.items.indexOf(item);
|
|
3095
3048
|
_this.items.splice(idx1, 1);
|
|
3096
3049
|
_this.items = __spread(_this.items);
|
|
3097
|
-
if (_this.gridOption.type ===
|
|
3050
|
+
if (_this.gridOption.type === 'local') {
|
|
3098
3051
|
(_a = editor === null || editor === void 0 ? void 0 : editor.onCancel) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(_this, _localItems));
|
|
3099
3052
|
}
|
|
3100
3053
|
else {
|
|
@@ -3103,9 +3056,9 @@
|
|
|
3103
3056
|
_this.ref.detectChanges();
|
|
3104
3057
|
return;
|
|
3105
3058
|
}
|
|
3106
|
-
if (editor.type ===
|
|
3107
|
-
if (item.editorStatus ===
|
|
3108
|
-
if (_this.gridOption.type ===
|
|
3059
|
+
if (editor.type === 'focus') {
|
|
3060
|
+
if (item.editorStatus === 'create') {
|
|
3061
|
+
if (_this.gridOption.type === 'local') {
|
|
3109
3062
|
var idx2 = __classPrivateFieldGet(_this, _localItems).indexOf(item);
|
|
3110
3063
|
__classPrivateFieldGet(_this, _localItems).splice(idx2, 1);
|
|
3111
3064
|
__classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems)));
|
|
@@ -3143,8 +3096,8 @@
|
|
|
3143
3096
|
}
|
|
3144
3097
|
_3.label = 3;
|
|
3145
3098
|
case 3:
|
|
3146
|
-
if (editor.type ===
|
|
3147
|
-
if (this.gridOption.type ===
|
|
3099
|
+
if (editor.type === 'inline') {
|
|
3100
|
+
if (this.gridOption.type === 'local') {
|
|
3148
3101
|
idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
3149
3102
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
3150
3103
|
__classPrivateFieldSet(this, _localItems, __spread(__classPrivateFieldGet(this, _localItems)));
|
|
@@ -3152,7 +3105,7 @@
|
|
|
3152
3105
|
idx1 = this.items.indexOf(item);
|
|
3153
3106
|
this.items.splice(idx1, 1);
|
|
3154
3107
|
this.items = __spread(this.items);
|
|
3155
|
-
if (this.gridOption.type ===
|
|
3108
|
+
if (this.gridOption.type === 'local') {
|
|
3156
3109
|
(_1 = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _1 === void 0 ? void 0 : _1.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
3157
3110
|
}
|
|
3158
3111
|
else {
|
|
@@ -3215,13 +3168,9 @@
|
|
|
3215
3168
|
Object.defineProperty(SdGridMaterial.prototype, "option", {
|
|
3216
3169
|
set: function (option) {
|
|
3217
3170
|
if (option) {
|
|
3218
|
-
option = __classPrivateFieldGet(this, _initConfiguration).call(this, option);
|
|
3171
|
+
option = __classPrivateFieldGet(this, _initConfiguration$1).call(this, option);
|
|
3219
3172
|
this.gridOption = option;
|
|
3220
|
-
// this.#loadFilterRegister();
|
|
3221
3173
|
__classPrivateFieldSet(this, _loadCompleted, false);
|
|
3222
|
-
// this.#reload.next({
|
|
3223
|
-
// force: true,
|
|
3224
|
-
// });
|
|
3225
3174
|
var configuration = this.gridConfigurationService.init(this.key, this.gridOption);
|
|
3226
3175
|
this.gridConfigurationObserver = configuration.observer;
|
|
3227
3176
|
configuration.load();
|
|
@@ -3286,16 +3235,12 @@
|
|
|
3286
3235
|
}); }))
|
|
3287
3236
|
.subscribe(__classPrivateFieldGet(this, _render)));
|
|
3288
3237
|
__classPrivateFieldGet(this, _subscription$2).add(this.sdCellDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
3289
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.sdFooterDefs.changes
|
|
3290
|
-
|
|
3291
|
-
.subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
3292
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.sdFilterDefs.changes
|
|
3293
|
-
.pipe(operators.startWith([]))
|
|
3294
|
-
.subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
3238
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.sdFooterDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
3239
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.sdFilterDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
3295
3240
|
__classPrivateFieldGet(this, _subscription$2).add(rxjs.combineLatest([
|
|
3296
3241
|
__classPrivateFieldGet(this, _optionChanges).pipe(operators.startWith(this.gridOption)),
|
|
3297
3242
|
this.sdFilterDefs.changes.pipe(operators.startWith(this.filterDefs)),
|
|
3298
|
-
]).subscribe(function (
|
|
3243
|
+
]).subscribe(function () {
|
|
3299
3244
|
__classPrivateFieldGet(_this, _loadFilterRegister).call(_this);
|
|
3300
3245
|
}));
|
|
3301
3246
|
this.ref.detectChanges();
|
|
@@ -3362,16 +3307,16 @@
|
|
|
3362
3307
|
});
|
|
3363
3308
|
return SdGridMaterial;
|
|
3364
3309
|
}());
|
|
3365
|
-
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$2 = new WeakMap(), _reload = new WeakMap(), _loadCompleted = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration = new WeakMap(), _loadFilterRegister = new WeakMap(), _filterLocal = new WeakMap(), _getFilter = new WeakMap(), _load$1 = new WeakMap(), _render = new WeakMap(), _exportedItems = new WeakMap(), _allColumns = new WeakMap(), _allExportedColumns = new WeakMap(), _onExport = new WeakMap(), _updateSelectedItems = new WeakMap();
|
|
3310
|
+
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$2 = new WeakMap(), _reload = new WeakMap(), _loadCompleted = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration$1 = new WeakMap(), _loadFilterRegister = new WeakMap(), _filterLocal = new WeakMap(), _getFilter = new WeakMap(), _load$1 = new WeakMap(), _render = new WeakMap(), _exportedItems = new WeakMap(), _allColumns = new WeakMap(), _allExportedColumns = new WeakMap(), _onExport = new WeakMap(), _updateSelectedItems = new WeakMap();
|
|
3366
3311
|
SdGridMaterial.decorators = [
|
|
3367
3312
|
{ type: core.Component, args: [{
|
|
3368
|
-
selector:
|
|
3313
|
+
selector: 'sd-grid-material',
|
|
3369
3314
|
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
3315
|
animations: [
|
|
3371
|
-
animations.trigger(
|
|
3372
|
-
animations.state(
|
|
3373
|
-
animations.state(
|
|
3374
|
-
animations.transition(
|
|
3316
|
+
animations.trigger('detailExpand', [
|
|
3317
|
+
animations.state('collapsed', animations.style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
3318
|
+
animations.state('expanded', animations.style({ height: '*', visibility: 'visible' })),
|
|
3319
|
+
animations.transition('expanded <=> collapsed', animations.animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
3375
3320
|
]),
|
|
3376
3321
|
],
|
|
3377
3322
|
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\")}"]
|