@sd-angular/core 0.0.904 → 0.0.905
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 +195 -58
- 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 +2 -2
- 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/sd-angular-core-grid-material.js +20 -18
- package/esm2015/grid-material/src/lib/components/desktop-cell-view/desktop-cell-view.component.js +2 -2
- package/esm2015/grid-material/src/lib/components/dynamic-column/dynamic-column.component.js +98 -0
- package/esm2015/grid-material/src/lib/components/popup-grid-configuration/popup-grid-configuration.component.js +2 -2
- package/esm2015/grid-material/src/lib/grid-material.component.js +1 -2
- package/esm2015/grid-material/src/lib/grid-material.module.js +5 -1
- package/esm2015/grid-material/src/lib/models/grid-config.model.js +1 -1
- package/esm2015/grid-material/src/lib/pipes/column-badge.pipe.js +4 -1
- package/esm2015/grid-material/src/lib/pipes/column-transform.pipe.js +1 -1
- package/esm2015/grid-material/src/lib/services/generated-column/generated-column.model.js +2 -0
- package/esm2015/grid-material/src/lib/services/generated-column/generated-column.service.js +57 -0
- package/esm2015/grid-material/src/lib/services/grid-configuration.service.js +13 -18
- package/esm2015/setting/src/lib/setting.model.js +1 -1
- package/esm2015/setting/src/lib/setting.service.js +5 -5
- package/fesm2015/sd-angular-core-grid-material.js +171 -31
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-setting.js +4 -4
- package/fesm2015/sd-angular-core-setting.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.d.ts +19 -17
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/components/dynamic-column/dynamic-column.component.d.ts +32 -0
- package/grid-material/src/lib/models/grid-config.model.d.ts +11 -1
- package/grid-material/src/lib/services/generated-column/generated-column.model.d.ts +8 -0
- package/grid-material/src/lib/services/generated-column/generated-column.service.d.ts +10 -0
- package/package.json +1 -1
- package/{sd-angular-core-0.0.904.tgz → sd-angular-core-0.0.905.tgz} +0 -0
- package/setting/src/lib/setting.model.d.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Directive, TemplateRef, Input, InjectionToken, EventEmitter, Component, ViewChild, Output, Injectable, ChangeDetectorRef, Inject, Optional, QueryList, ContentChild, ContentChildren, Pipe, ViewContainerRef, HostListener, NgModule } from '@angular/core';
|
|
1
|
+
import { Directive, TemplateRef, Input, InjectionToken, EventEmitter, Component, ViewChild, Output, Injectable, ChangeDetectorRef, Inject, Optional, QueryList, ContentChild, ContentChildren, Pipe, ViewContainerRef, HostListener, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
2
2
|
import { __awaiter, __classPrivateFieldGet, __rest, __classPrivateFieldSet } from 'tslib';
|
|
3
3
|
import { MatPaginator, MatPaginatorIntl, MatPaginatorModule } from '@angular/material/paginator';
|
|
4
4
|
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
@@ -8,7 +8,7 @@ import { v4 } from 'uuid';
|
|
|
8
8
|
import { Subject, Subscription, isObservable } from 'rxjs';
|
|
9
9
|
import { SdNotifyService } from '@sd-angular/core/notify';
|
|
10
10
|
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
11
|
-
import { startWith, debounceTime, map
|
|
11
|
+
import { startWith, switchMap, debounceTime, map } from 'rxjs/operators';
|
|
12
12
|
import hash from 'object-hash';
|
|
13
13
|
import { SdSettingService } from '@sd-angular/core/setting';
|
|
14
14
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
@@ -38,6 +38,7 @@ import { SdFormModule } from '@sd-angular/core/form';
|
|
|
38
38
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
39
39
|
import { MatListModule } from '@angular/material/list';
|
|
40
40
|
import { MatDividerModule } from '@angular/material/divider';
|
|
41
|
+
import { SdSideDrawer } from '@sd-angular/core/side-drawer';
|
|
41
42
|
|
|
42
43
|
class SdMaterialCellDefDirective {
|
|
43
44
|
constructor(templateRef) {
|
|
@@ -722,7 +723,7 @@ SdPopupExport.propDecorators = {
|
|
|
722
723
|
_gridOption: [{ type: Input, args: ['gridOption',] }]
|
|
723
724
|
};
|
|
724
725
|
|
|
725
|
-
var _COLUMNS, _cache, _getKey, _default,
|
|
726
|
+
var _COLUMNS, _cache, _getKey, _default, _get, _set, _remove;
|
|
726
727
|
class SdGridConfigurationService {
|
|
727
728
|
constructor(settingService, gridMaterialConfiguration) {
|
|
728
729
|
this.settingService = settingService;
|
|
@@ -736,19 +737,20 @@ class SdGridConfigurationService {
|
|
|
736
737
|
this.init = (key, gridOption) => {
|
|
737
738
|
if (!__classPrivateFieldGet(this, _cache)[key]) {
|
|
738
739
|
const subject = new Subject();
|
|
740
|
+
const get = __classPrivateFieldGet(this, _get).call(this, gridOption);
|
|
741
|
+
const set = (configuration) => {
|
|
742
|
+
configuration = __classPrivateFieldGet(this, _set).call(this, gridOption, configuration);
|
|
743
|
+
subject.next(Object.assign({}, configuration));
|
|
744
|
+
return configuration;
|
|
745
|
+
};
|
|
739
746
|
__classPrivateFieldGet(this, _cache)[key] = {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
set: (configuration) => {
|
|
743
|
-
configuration = __classPrivateFieldGet(this, _set).call(this, gridOption, configuration);
|
|
744
|
-
subject.next(Object.assign({}, configuration));
|
|
745
|
-
return configuration;
|
|
746
|
-
},
|
|
747
|
+
get,
|
|
748
|
+
set,
|
|
747
749
|
remove: () => {
|
|
748
750
|
__classPrivateFieldGet(this, _remove).call(this, gridOption);
|
|
749
751
|
subject.next(__classPrivateFieldGet(this, _default).call(this, gridOption));
|
|
750
752
|
},
|
|
751
|
-
observer: subject
|
|
753
|
+
observer: subject.pipe(switchMap(__classPrivateFieldGet(this, _get).call(this, gridOption)))
|
|
752
754
|
};
|
|
753
755
|
}
|
|
754
756
|
return __classPrivateFieldGet(this, _cache)[key];
|
|
@@ -780,13 +782,6 @@ class SdGridConfigurationService {
|
|
|
780
782
|
columns
|
|
781
783
|
};
|
|
782
784
|
});
|
|
783
|
-
_load.set(this, (gridOption, subject) => {
|
|
784
|
-
return () => __awaiter(this, void 0, void 0, function* () {
|
|
785
|
-
const get = __classPrivateFieldGet(this, _get).call(this, gridOption);
|
|
786
|
-
const configuration = yield get();
|
|
787
|
-
subject.next(Object.assign({}, configuration));
|
|
788
|
-
});
|
|
789
|
-
});
|
|
790
785
|
_get.set(this, (gridOption) => {
|
|
791
786
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
792
787
|
const key = __classPrivateFieldGet(this, _getKey).call(this, gridOption);
|
|
@@ -1046,7 +1041,7 @@ class SdGridConfigurationService {
|
|
|
1046
1041
|
};
|
|
1047
1042
|
}
|
|
1048
1043
|
}
|
|
1049
|
-
_COLUMNS = new WeakMap(), _cache = new WeakMap(), _getKey = new WeakMap(), _default = new WeakMap(),
|
|
1044
|
+
_COLUMNS = new WeakMap(), _cache = new WeakMap(), _getKey = new WeakMap(), _default = new WeakMap(), _get = new WeakMap(), _set = new WeakMap(), _remove = new WeakMap();
|
|
1050
1045
|
SdGridConfigurationService.decorators = [
|
|
1051
1046
|
{ type: Injectable }
|
|
1052
1047
|
];
|
|
@@ -1110,7 +1105,7 @@ SdGridService.ctorParameters = () => [
|
|
|
1110
1105
|
{ type: SdUtilityService }
|
|
1111
1106
|
];
|
|
1112
1107
|
|
|
1113
|
-
var _paginator, _sort, _subscription$1, _optionChanges, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _filterLocal, _getFilter, _load
|
|
1108
|
+
var _paginator, _sort, _subscription$1, _optionChanges, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _filterLocal, _getFilter, _load, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
1114
1109
|
class SdGridMaterial {
|
|
1115
1110
|
constructor(ref, configuration, gridConfigurationService, exportService, notifyService, translateService, gridService) {
|
|
1116
1111
|
this.ref = ref;
|
|
@@ -1308,7 +1303,7 @@ class SdGridMaterial {
|
|
|
1308
1303
|
pageSize: ((_j = __classPrivateFieldGet(this, _paginator)) === null || _j === void 0 ? void 0 : _j.pageSize) || ((_l = (_k = this.gridOption) === null || _k === void 0 ? void 0 : _k.paginate) === null || _l === void 0 ? void 0 : _l.pageSize) || 50
|
|
1309
1304
|
});
|
|
1310
1305
|
});
|
|
1311
|
-
_load
|
|
1306
|
+
_load.set(this, (filterReq) => __awaiter(this, void 0, void 0, function* () {
|
|
1312
1307
|
this.isLoading = true;
|
|
1313
1308
|
try {
|
|
1314
1309
|
if (this.gridOption.type === 'server') {
|
|
@@ -1348,7 +1343,7 @@ class SdGridMaterial {
|
|
|
1348
1343
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1349
1344
|
}));
|
|
1350
1345
|
this.reload = () => __awaiter(this, void 0, void 0, function* () {
|
|
1351
|
-
const data = yield __classPrivateFieldGet(this, _load
|
|
1346
|
+
const data = yield __classPrivateFieldGet(this, _load).call(this, __classPrivateFieldGet(this, _getFilter).call(this));
|
|
1352
1347
|
__classPrivateFieldGet(this, _render).call(this, data);
|
|
1353
1348
|
});
|
|
1354
1349
|
_exportedItems.set(this, (pageNumber = 0, pageSize = 10000) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1672,7 +1667,7 @@ class SdGridMaterial {
|
|
|
1672
1667
|
__classPrivateFieldGet(this, _subscription$1).add(gridFilter.filterChange.pipe(debounceTime(200), map(() => {
|
|
1673
1668
|
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1674
1669
|
return __classPrivateFieldGet(this, _getFilter).call(this);
|
|
1675
|
-
}), switchMap(__classPrivateFieldGet(this, _load
|
|
1670
|
+
}), switchMap(__classPrivateFieldGet(this, _load))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1676
1671
|
}
|
|
1677
1672
|
}
|
|
1678
1673
|
set option(option) {
|
|
@@ -1689,19 +1684,18 @@ class SdGridMaterial {
|
|
|
1689
1684
|
});
|
|
1690
1685
|
const configuration = this.gridConfigurationService.init(this.key, this.gridOption);
|
|
1691
1686
|
this.gridConfigurationObserver = configuration.observer;
|
|
1692
|
-
configuration.load();
|
|
1693
1687
|
}
|
|
1694
1688
|
}
|
|
1695
1689
|
set paginator(paginator) {
|
|
1696
1690
|
if (paginator && __classPrivateFieldGet(this, _paginator) !== paginator) {
|
|
1697
1691
|
__classPrivateFieldSet(this, _paginator, paginator);
|
|
1698
|
-
__classPrivateFieldGet(this, _subscription$1).add(paginator.page.pipe(debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(__classPrivateFieldGet(this, _load
|
|
1692
|
+
__classPrivateFieldGet(this, _subscription$1).add(paginator.page.pipe(debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(__classPrivateFieldGet(this, _load))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1699
1693
|
}
|
|
1700
1694
|
}
|
|
1701
1695
|
set sort(sort) {
|
|
1702
1696
|
if (sort && __classPrivateFieldGet(this, _sort) !== sort) {
|
|
1703
1697
|
__classPrivateFieldSet(this, _sort, sort);
|
|
1704
|
-
__classPrivateFieldGet(this, _subscription$1).add(sort.sortChange.pipe(debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(__classPrivateFieldGet(this, _load
|
|
1698
|
+
__classPrivateFieldGet(this, _subscription$1).add(sort.sortChange.pipe(debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(__classPrivateFieldGet(this, _load))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1705
1699
|
}
|
|
1706
1700
|
}
|
|
1707
1701
|
ngOnInit() {
|
|
@@ -1711,7 +1705,7 @@ class SdGridMaterial {
|
|
|
1711
1705
|
__classPrivateFieldGet(this, _subscription$1).add(this.sdCellDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
1712
1706
|
__classPrivateFieldGet(this, _subscription$1).add(this.sdFooterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
1713
1707
|
__classPrivateFieldGet(this, _subscription$1).add(this.sdFilterDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
1714
|
-
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _optionChanges).pipe(startWith({}), debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(__classPrivateFieldGet(this, _load
|
|
1708
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _optionChanges).pipe(startWith({}), debounceTime(200), map(__classPrivateFieldGet(this, _getFilter)), switchMap(__classPrivateFieldGet(this, _load))).subscribe(__classPrivateFieldGet(this, _render)));
|
|
1715
1709
|
this.ref.detectChanges();
|
|
1716
1710
|
}
|
|
1717
1711
|
ngOnDestroy() {
|
|
@@ -1721,7 +1715,7 @@ class SdGridMaterial {
|
|
|
1721
1715
|
moveItemInArray(columns, event.previousIndex, event.currentIndex);
|
|
1722
1716
|
}
|
|
1723
1717
|
}
|
|
1724
|
-
_paginator = new WeakMap(), _sort = new WeakMap(), _subscription$1 = new WeakMap(), _optionChanges = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration = new WeakMap(), _filterLocal = new WeakMap(), _getFilter = new WeakMap(), _load
|
|
1718
|
+
_paginator = new WeakMap(), _sort = new WeakMap(), _subscription$1 = new WeakMap(), _optionChanges = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration = new WeakMap(), _filterLocal = new WeakMap(), _getFilter = new WeakMap(), _load = new WeakMap(), _render = new WeakMap(), _exportedItems = new WeakMap(), _allColumns = new WeakMap(), _allExportedColumns = new WeakMap(), _onExport = new WeakMap(), _updateSelectedItems = new WeakMap();
|
|
1725
1719
|
SdGridMaterial.decorators = [
|
|
1726
1720
|
{ type: Component, args: [{
|
|
1727
1721
|
selector: 'sd-grid-material',
|
|
@@ -1933,7 +1927,7 @@ class SdDesktopCellView {
|
|
|
1933
1927
|
SdDesktopCellView.decorators = [
|
|
1934
1928
|
{ type: Component, args: [{
|
|
1935
1929
|
selector: 'sd-desktop-cell-view',
|
|
1936
|
-
template: "<ng-container *ngIf=\"column && item\">\r\n <ng-container *ngIf=\"column.htmlTemplate;else useDefaultView\">\r\n <div (click)=\"column.click && column.click(item[column.field], item)\" style=\"overflow-wrap: break-word;\"\r\n [ngClass]=\"{'cursor-pointer':column.click}\"\r\n [innerHTML]=\"(item[column.field] | columnHtmlTemplate:item:column) | safeHtml\">\r\n </div>\r\n </ng-container>\r\n <ng-template #useDefaultView>\r\n <ng-container *sdLet=\"item[column.field] | columnBadge:item:column as badge\">\r\n <ng-container *ngIf=\"column.type === 'string'\">\r\n <ng-container *ngIf=\"!!badge\">\r\n <div *ngIf=\"!column.badgeType\" class=\"c-badge\" style=\"overflow-wrap: break-word;\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[column.field] | columnTooltip:item:column\"\r\n [class]=\"{'c-secondary': badge === 'normal', 'c-info': badge === 'info', 'c-success': badge === 'success', 'c-danger': badge === 'danger', 'c-warning': badge === 'warning'}\">\r\n <span *ngIf=\"column.click\" class=\"pointer\"\r\n (click)=\"column.click(item[column.field], item)\">{{item[column.field] |\r\n columnTransform:item:column}}</span>\r\n <ng-container *ngIf=\"!column.click\">{{item[column.field] | columnTransform:item:column}}</ng-container>\r\n </div>\r\n <div *ngIf=\"column.badgeType === 'circle'\" style=\"min-width: 150px\"\r\n class=\"c-badge-circle d-flex align-items-center\"\r\n [class]=\"{'c-unknown': !badge, 'c-secondary': badge === 'normal', 'c-info': badge === 'info', 'c-success': badge === 'success', 'c-danger': badge === 'danger', 'c-warning': badge === 'warning'}\">\r\n <span *ngIf=\"badge\" class=\"material-icons-round c-material-icon mr-4\">\r\n fiber_manual_record\r\n </span>\r\n <span *ngIf=\"!badge\" class=\"material-icons-outlined c-material-icon mr-4\">\r\n fiber_manual_record\r\n </span>\r\n {{item[column.field] | columnTransform:item:column}}\r\n </div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!badge\">\r\n <div style=\"overflow-wrap: break-word;\" [matTooltip]=\"item[column.field] | columnTooltip:item:column\">\r\n <a *ngIf=\"column.click\" href=\"javascript:;\"\r\n (click)=\"column.click(item[column.field], item)\">{{item[column.field] | columnTransform:item:column}}</a>\r\n <ng-container *ngIf=\"!column.click\">{{item[column.field] | columnTransform:item:column}}</ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n
|
|
1930
|
+
template: "<ng-container *ngIf=\"column && item\">\r\n <ng-container *ngIf=\"column.htmlTemplate;else useDefaultView\">\r\n <div (click)=\"column.click && column.click(item[column.field], item)\" style=\"overflow-wrap: break-word;\"\r\n [ngClass]=\"{'cursor-pointer':column.click}\"\r\n [innerHTML]=\"(item[column.field] | columnHtmlTemplate:item:column) | safeHtml\">\r\n </div>\r\n </ng-container>\r\n <ng-template #useDefaultView>\r\n <ng-container *sdLet=\"item[column.field] | columnBadge:item:column as badge\">\r\n <ng-container *ngIf=\"column.type === 'string'\">\r\n <ng-container *ngIf=\"!!badge\">\r\n <div *ngIf=\"!column.badgeType\" class=\"c-badge\" style=\"overflow-wrap: break-word;\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[column.field] | columnTooltip:item:column\"\r\n [class]=\"{'c-secondary': badge === 'normal', 'c-info': badge === 'info', 'c-success': badge === 'success', 'c-danger': badge === 'danger', 'c-warning': badge === 'warning'}\">\r\n <span *ngIf=\"column.click\" class=\"pointer\"\r\n (click)=\"column.click(item[column.field], item)\">{{item[column.field] |\r\n columnTransform:item:column}}</span>\r\n <ng-container *ngIf=\"!column.click\">{{item[column.field] | columnTransform:item:column}}</ng-container>\r\n </div>\r\n <div *ngIf=\"column.badgeType === 'circle'\" style=\"min-width: 150px\"\r\n class=\"c-badge-circle d-flex align-items-center\"\r\n [class]=\"{'c-unknown': !badge, 'c-secondary': badge === 'normal', 'c-info': badge === 'info', 'c-success': badge === 'success', 'c-danger': badge === 'danger', 'c-warning': badge === 'warning'}\">\r\n <span *ngIf=\"badge\" class=\"material-icons-round c-material-icon mr-4\">\r\n fiber_manual_record\r\n </span>\r\n <span *ngIf=\"!badge\" class=\"material-icons-outlined c-material-icon mr-4\">\r\n fiber_manual_record\r\n </span>\r\n {{item[column.field] | columnTransform:item:column}}\r\n </div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!badge\">\r\n <div style=\"overflow-wrap: break-word;\" [matTooltip]=\"item[column.field] | columnTooltip:item:column\">\r\n <a *ngIf=\"column.click\" href=\"javascript:;\"\r\n (click)=\"column.click(item[column.field], item)\">{{item[column.field] | columnTransform:item:column}}</a>\r\n <ng-container *ngIf=\"!column.click\">{{item[column.field] | columnTransform:item:column}}</ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n <div *ngIf=\"column.type === 'number'\">\r\n <a *ngIf=\"column.click\" href=\"javascript:;\"\r\n (click)=\"column.click(item[column.field], item)\">{{item[column.field] | columnTransform:item:column}}</a>\r\n <ng-container *ngIf=\"!column.click\">\r\n {{item[column.field] | columnTransform:item:column}}</ng-container>\r\n </div>\r\n <div *ngIf=\"column.type === 'date'\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[column.field] | date:'dd/MM/yyyy'\">\r\n {{item[column.field] | sdTimeDifferent:'dd/MM/yyyy':column.option?.timeDifferent | async}}\r\n </div>\r\n <div *ngIf=\"column.type === 'datetime'\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[column.field] | date:'dd/MM/yyyy HH:mm'\">\r\n {{item[column.field] | sdTimeDifferent:'dd/MM/yyyy HH:mm':column.option?.timeDifferent | async}}\r\n </div>\r\n <div *ngIf=\"column.type === 'time'\">\r\n {{item[column.field] | date:'HH:mm'}}\r\n </div>\r\n <div *ngIf=\"column.type === 'bool'\" class=\"align-middle text-center\">\r\n <ng-container *ngIf=\"!!badge\">\r\n <div *ngIf=\"!column.badgeType\" class=\"c-badge\" style=\"overflow-wrap: break-word;\" matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[column.field] | columnTooltip:item:column\"\r\n [class]=\"{'c-secondary': badge === 'normal', 'c-info': badge === 'info', 'c-success': badge === 'success', 'c-danger': badge === 'danger', 'c-warning': badge === 'warning'}\">\r\n <span *ngIf=\"column.click\" class=\"pointer\"\r\n (click)=\"column.click(item[column.field], item)\">{{item[column.field] | columnTransform:item:column}}</span>\r\n <ng-container *ngIf=\"!column.click\">{{item[column.field] | columnTransform:item:column}}</ng-container>\r\n </div>\r\n <div *ngIf=\"column.badgeType === 'circle'\" style=\"min-width: 150px\"\r\n class=\"c-badge-circle d-flex align-items-center\"\r\n [class]=\"{'c-unknown': !badge, 'c-secondary': badge === 'normal', 'c-info': badge === 'info', 'c-success': badge === 'success', 'c-danger': badge === 'danger', 'c-warning': badge === 'warning'}\">\r\n <span *ngIf=\"badge\" class=\"material-icons-round c-material-icon mr-4\">\r\n fiber_manual_record\r\n </span>\r\n <span *ngIf=\"!badge\" class=\"material-icons-outlined c-material-icon mr-4\">\r\n fiber_manual_record\r\n </span>\r\n {{item[column.field] | columnTransform:item:column}}\r\n </div>\r\n </ng-container>\r\n <ng-container *ngIf=\"!badge\">\r\n <span *ngIf=\"item[column.field]\" class=\"font-weight-bold c-color-success\">{{item[column.field] | columnTransform:item:column}}</span>\r\n <span *ngIf=\"!item[column.field]\" class=\"font-weight-bold c-color-danger\">{{item[column.field] | columnTransform:item:column}}</span>\r\n </ng-container>\r\n </div>\r\n <div *ngIf=\"column.type === 'values'\">\r\n <ng-container *ngIf=\"item[column.field] | columnValues:column:key | async; $implicit as valueData\">\r\n <div\r\n *ngIf=\"valueData[column.option?.colorField] || valueData[column.option?.backgroundColorField]; else elseNoStatus\"\r\n class=\"c-badge\"\r\n [ngStyle]=\"{'color':valueData[column.option?.colorField], 'background-color': valueData[column.option?.backgroundColorField]}\">\r\n {{valueData[column.option?.displayField]}}\r\n </div>\r\n <ng-template #elseNoStatus>\r\n <div class=\"text-left\">\r\n {{valueData[column.option?.displayField]}}\r\n </div>\r\n </ng-template>\r\n </ng-container>\r\n </div>\r\n <div *ngIf=\"column.type === 'image'\" class=\"align-middle text-center\">\r\n <img *ngIf=\"item[column.field]\" [src]=\"item[column.field] | columnTransform:item:column\"\r\n [width]=\"column.option?.width\" [height]=\"column.option?.height\" style=\"margin: 5px 0;object-fit: contain;\"\r\n (click)=\"column.click && column.click(item[column.field], item)\" [ngClass]=\"{'pointer':column.click}\">\r\n <mat-icon *ngIf=\"!item[column.field]\" class=\"c-img\" [ngClass]=\"{'pointer':column.click}\"\r\n (click)=\"column.click && column.click(item[column.field], item)\">image</mat-icon>\r\n </div>\r\n </ng-container>\r\n <sd-desktop-cell-children-view *ngIf=\"column.type === 'children'\" [key]=\"key\" [item]=\"item\" [column]=\"column\">\r\n </sd-desktop-cell-children-view>\r\n </ng-template>\r\n</ng-container>",
|
|
1937
1931
|
styles: [".c-color-success{color:#4caf50}.c-color-danger{color:#f82c13}.c-img{font-size:30px;opacity:.5}.c-img.pointer:hover{opacity:.9}.c-badge{border-radius:20px;display:inline-block;margin-bottom:4px;padding:2px 12px;text-align:center}.c-badge.c-warning{background:#fff3e0;color:#ff9600}.c-badge.c-info{background:#e7e9ff;color:#2962ff}.c-badge.c-success{background:#e8f5e9;color:#4caf50}.c-badge.c-danger{background:#fee8e7;color:#f82c13}.c-badge.c-normal{background:rgba(0,0,0,.12);color:#000}.wes-status .c-material-icon{font-size:12px;height:12px;width:12px}.wes-status.text-secondary .c-material-icon{color:rgba(0,0,0,.5)}.c-badge-circle .c-material-icon{font-size:12px;height:12px;width:12px}.c-badge-circle.c-unknown{color:#212121}.c-badge-circle.c-unknown .c-material-icon{color:rgba(0,0,0,.5)}.c-badge-circle.c-secondary{color:#212121}.c-badge-circle.c-info{color:#2962ff}.c-badge-circle.c-success{color:#4caf50}.c-badge-circle.c-danger{color:#f82c13}.c-badge-circle.c-warning{color:#ff9600}"]
|
|
1938
1932
|
},] }
|
|
1939
1933
|
];
|
|
@@ -2111,6 +2105,9 @@ class SdColumnBadgePipe {
|
|
|
2111
2105
|
if (column.type === 'string' && (column === null || column === void 0 ? void 0 : column.badge)) {
|
|
2112
2106
|
return column.badge(value, rowData);
|
|
2113
2107
|
}
|
|
2108
|
+
if (column.type === 'bool' && (column === null || column === void 0 ? void 0 : column.badge)) {
|
|
2109
|
+
return column.badge(value, rowData);
|
|
2110
|
+
}
|
|
2114
2111
|
return null;
|
|
2115
2112
|
}
|
|
2116
2113
|
}
|
|
@@ -2239,7 +2236,7 @@ _cache$2 = new WeakMap();
|
|
|
2239
2236
|
SdPopupGridConfiguration.decorators = [
|
|
2240
2237
|
{ type: Component, args: [{
|
|
2241
2238
|
selector: 'sd-popup-grid-configuration',
|
|
2242
|
-
template: "<sd-modal width=\"sm\" [title]=\"'Configuration' | sdTranslate\" #modal>\r\n <sd-modal-body *ngIf=\"configuration\">\r\n <div *ngIf=\"!isCreatingColumn\" class=\"c-container\">\r\n <div class=\"c-table\" style=\"max-height:70vh\">\r\n <table #table mat-table [dataSource]=\"configuration.columns\"\r\n cdkDropList\r\n [cdkDropListData]=\"configuration.columns\"\r\n (cdkDropListDropped)=\"dropTable($event)\">\r\n >\r\n <ng-container matColumnDef=\"stt\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:50px\">#\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item; let idx = index\">\r\n <div class=\"c-handle\" (mousedown) = \"handleMouseDown()\" (mouseup)=\"handleMouseUp()\">\r\n <svg width=\"24px\" fill=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path d=\"M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z\"></path>\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\r\n </svg>\r\n </div>\r\n\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"title\">\r\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef>{{'Title' | sdTranslate}}\r\n </th>\r\n <td class=\"px-5\" mat-cell *matCellDef=\"let item;\">\r\n <sd-input [placeholder]=\"item?.origin?.title\" [(model)]=\"item.title\" disableErrorMessage></sd-input>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"width\">\r\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef style=\"width:80px\">{{'Width' | sdTranslate}}\r\n </th>\r\n <td class=\"px-5\" mat-cell *matCellDef=\"let item;\">\r\n <!-- <span>{{item.width}}</span>\r\n <mat-slider\r\n step=\"1\"\r\n min=\"0\"\r\n [max]=\"+item?.origin?.width*3\"\r\n [(ngModel)]=\"+item.width\"\r\n aria-label=\"units\">\r\n </mat-slider> -->\r\n <sd-input [placeholder]=\"item?.origin?.width\" [(model)]=\"item.width\" disableErrorMessage></sd-input>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"invisible\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:80px\">{{'Hidden' |\r\n sdTranslate}}\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item;\">\r\n <mat-slide-toggle [(ngModel)]=\"item.invisible\" color=\"primary\">\r\n </mat-slide-toggle>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"fixed\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:80px\">{{'Freeze' |\r\n sdTranslate}}\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item;\">\r\n <mat-slide-toggle [(ngModel)]=\"item.fixed\" color=\"primary\"></mat-slide-toggle>\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"['stt', 'title', 'width', 'invisible', 'fixed']; sticky: true\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['stt', 'title', 'width', 'invisible', 'fixed'];\" cdkDrag [cdkDragData]=\"row\" cdkDragLockAxis=\"y\" [cdkDragDisabled] = \"disabledDrag\"></tr>\r\n </table>\r\n </div>\r\n </div>\r\n <div *ngIf=\"isCreatingColumn\">\r\n <div class=\"c-table\" style=\"max-height:50vh\">\r\n <table mat-table [dataSource]=\"configuration.columns\">\r\n <ng-container matColumnDef=\"stt\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:50px\">#\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item; let idx = index\">\r\n <sd-checkbox *ngIf=\"isCreatingColumn\" [(model)]=\"selected[item.origin?.field]\"></sd-checkbox>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"title\">\r\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef>{{'Title' | sdTranslate}}\r\n </th>\r\n <td class=\"px-5\" mat-cell *matCellDef=\"let item;\">\r\n <span *ngIf=\"isCreatingColumn\">{{item.title || item?.origin?.title}}</span>\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"['stt', 'title']; sticky: true\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['stt', 'title'];\"></tr>\r\n </table>\r\n </div>\r\n </div>\r\n </sd-modal-body>\r\n <sd-modal-footer>\r\n <ng-container *ngIf=\"!isCreatingColumn\">\r\n <sd-button class=\"mr-auto\" (action)=\"createColumn()\" [title]=\"'Create column' | sdTranslate\" color=\"info\"\r\n size=\"sm\">\r\n </sd-button
|
|
2239
|
+
template: "<sd-modal width=\"sm\" [title]=\"'Configuration' | sdTranslate\" #modal>\r\n <sd-modal-body *ngIf=\"configuration\">\r\n <div *ngIf=\"!isCreatingColumn\" class=\"c-container\">\r\n <div class=\"c-table\" style=\"max-height:70vh\">\r\n <table #table mat-table [dataSource]=\"configuration.columns\"\r\n cdkDropList\r\n [cdkDropListData]=\"configuration.columns\"\r\n (cdkDropListDropped)=\"dropTable($event)\">\r\n >\r\n <ng-container matColumnDef=\"stt\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:50px\">#\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item; let idx = index\">\r\n <div class=\"c-handle\" (mousedown) = \"handleMouseDown()\" (mouseup)=\"handleMouseUp()\">\r\n <svg width=\"24px\" fill=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path d=\"M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z\"></path>\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\r\n </svg>\r\n </div>\r\n\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"title\">\r\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef>{{'Title' | sdTranslate}}\r\n </th>\r\n <td class=\"px-5\" mat-cell *matCellDef=\"let item;\">\r\n <sd-input [placeholder]=\"item?.origin?.title\" [(model)]=\"item.title\" disableErrorMessage></sd-input>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"width\">\r\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef style=\"width:80px\">{{'Width' | sdTranslate}}\r\n </th>\r\n <td class=\"px-5\" mat-cell *matCellDef=\"let item;\">\r\n <!-- <span>{{item.width}}</span>\r\n <mat-slider\r\n step=\"1\"\r\n min=\"0\"\r\n [max]=\"+item?.origin?.width*3\"\r\n [(ngModel)]=\"+item.width\"\r\n aria-label=\"units\">\r\n </mat-slider> -->\r\n <sd-input [placeholder]=\"item?.origin?.width\" [(model)]=\"item.width\" disableErrorMessage></sd-input>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"invisible\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:80px\">{{'Hidden' |\r\n sdTranslate}}\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item;\">\r\n <mat-slide-toggle [(ngModel)]=\"item.invisible\" color=\"primary\">\r\n </mat-slide-toggle>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"fixed\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:80px\">{{'Freeze' |\r\n sdTranslate}}\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item;\">\r\n <mat-slide-toggle [(ngModel)]=\"item.fixed\" color=\"primary\"></mat-slide-toggle>\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"['stt', 'title', 'width', 'invisible', 'fixed']; sticky: true\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['stt', 'title', 'width', 'invisible', 'fixed'];\" cdkDrag [cdkDragData]=\"row\" cdkDragLockAxis=\"y\" [cdkDragDisabled] = \"disabledDrag\"></tr>\r\n </table>\r\n </div>\r\n </div>\r\n <div *ngIf=\"isCreatingColumn\">\r\n <div class=\"c-table\" style=\"max-height:50vh\">\r\n <table mat-table [dataSource]=\"configuration.columns\">\r\n <ng-container matColumnDef=\"stt\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:50px\">#\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item; let idx = index\">\r\n <sd-checkbox *ngIf=\"isCreatingColumn\" [(model)]=\"selected[item.origin?.field]\"></sd-checkbox>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"title\">\r\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef>{{'Title' | sdTranslate}}\r\n </th>\r\n <td class=\"px-5\" mat-cell *matCellDef=\"let item;\">\r\n <span *ngIf=\"isCreatingColumn\">{{item.title || item?.origin?.title}}</span>\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"['stt', 'title']; sticky: true\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['stt', 'title'];\"></tr>\r\n </table>\r\n </div>\r\n </div>\r\n </sd-modal-body>\r\n <sd-modal-footer>\r\n <ng-container *ngIf=\"!isCreatingColumn\">\r\n <!-- <sd-button class=\"mr-auto\" (action)=\"createColumn()\" [title]=\"'Create column' | sdTranslate\" color=\"info\"\r\n size=\"sm\">\r\n </sd-button> -->\r\n <sd-button class=\"mr-5\" (action)=\"onReset()\" [title]=\"'Default' | sdTranslate\" color=\"info\" size=\"sm\">\r\n </sd-button>\r\n <sd-button (action)=\"onSave()\" [title]=\"'Save' | sdTranslate\" type=\"fill\" color=\"info\" size=\"sm\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-container *ngIf=\"isCreatingColumn\">\r\n <sd-button class=\"mr-auto\" (action)=\"isCreatingColumn = false\" [title]=\"'Cancel' | sdTranslate\" color=\"info\"\r\n size=\"sm\">\r\n </sd-button>\r\n <sd-button (action)=\"confirm()\" [title]=\"'Confirm' | sdTranslate\" type=\"fill\" color=\"info\" size=\"sm\">\r\n </sd-button>\r\n </ng-container>\r\n </sd-modal-footer>\r\n</sd-modal>",
|
|
2243
2240
|
styles: [".c-table{overflow:auto;position:relative}.c-table table{width:100%}.c-table .c-th{color:#000;font-size:14px;font-weight:500;line-height:20px}.c-container{min-height:200px;position:relative}.c-handle{color:#ccc;cursor:move}"]
|
|
2244
2241
|
},] }
|
|
2245
2242
|
];
|
|
@@ -2406,6 +2403,147 @@ SdSelectionDisableSelectAllPipe.decorators = [
|
|
|
2406
2403
|
},] }
|
|
2407
2404
|
];
|
|
2408
2405
|
|
|
2406
|
+
var _cache$3;
|
|
2407
|
+
class SdGeneratedColumnService {
|
|
2408
|
+
constructor(settingService) {
|
|
2409
|
+
this.settingService = settingService;
|
|
2410
|
+
_cache$3.set(this, {});
|
|
2411
|
+
this.load = (configuration) => {
|
|
2412
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.key)) {
|
|
2413
|
+
return null;
|
|
2414
|
+
}
|
|
2415
|
+
const key = hash({
|
|
2416
|
+
prefix: '260f5e94-5865-4425-8ced-b9c083c390dd',
|
|
2417
|
+
key: configuration.key
|
|
2418
|
+
});
|
|
2419
|
+
if (!__classPrivateFieldGet(this, _cache$3)[key]) {
|
|
2420
|
+
__classPrivateFieldGet(this, _cache$3)[key] = this.settingService.create(key, {
|
|
2421
|
+
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
2422
|
+
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
2423
|
+
default: []
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
return __classPrivateFieldGet(this, _cache$3)[key];
|
|
2427
|
+
};
|
|
2428
|
+
this.loadSystem = (configuration) => {
|
|
2429
|
+
var _a;
|
|
2430
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.key)) {
|
|
2431
|
+
return null;
|
|
2432
|
+
}
|
|
2433
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn)) {
|
|
2434
|
+
return null;
|
|
2435
|
+
}
|
|
2436
|
+
const key = hash({
|
|
2437
|
+
prefix: '8b8050ca-1f44-4860-bad3-20e646c0d68f',
|
|
2438
|
+
key: configuration.key
|
|
2439
|
+
});
|
|
2440
|
+
if (!__classPrivateFieldGet(this, _cache$3)[key]) {
|
|
2441
|
+
__classPrivateFieldGet(this, _cache$3)[key] = this.settingService.create(key, {
|
|
2442
|
+
type: 'server',
|
|
2443
|
+
args: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _a === void 0 ? void 0 : _a.args,
|
|
2444
|
+
default: []
|
|
2445
|
+
});
|
|
2446
|
+
}
|
|
2447
|
+
return __classPrivateFieldGet(this, _cache$3)[key];
|
|
2448
|
+
};
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
_cache$3 = new WeakMap();
|
|
2452
|
+
SdGeneratedColumnService.decorators = [
|
|
2453
|
+
{ type: Injectable }
|
|
2454
|
+
];
|
|
2455
|
+
SdGeneratedColumnService.ctorParameters = () => [
|
|
2456
|
+
{ type: SdSettingService }
|
|
2457
|
+
];
|
|
2458
|
+
|
|
2459
|
+
var _subscription$2;
|
|
2460
|
+
class SdDynamicColumn {
|
|
2461
|
+
constructor(ref, generatedColumnService, notifyService, translateService, gridConfigurationService) {
|
|
2462
|
+
this.ref = ref;
|
|
2463
|
+
this.generatedColumnService = generatedColumnService;
|
|
2464
|
+
this.notifyService = notifyService;
|
|
2465
|
+
this.translateService = translateService;
|
|
2466
|
+
this.gridConfigurationService = gridConfigurationService;
|
|
2467
|
+
_subscription$2.set(this, new Subscription());
|
|
2468
|
+
this.columnTypes = ['string', 'number', 'bool', 'date', 'datetime', 'time', 'values', 'children', 'children-col'];
|
|
2469
|
+
this.form = new FormGroup({});
|
|
2470
|
+
this.isDetail = false;
|
|
2471
|
+
this.originColumns = [];
|
|
2472
|
+
this.onDetail = (column) => {
|
|
2473
|
+
this.detail = column || {
|
|
2474
|
+
field: v4(),
|
|
2475
|
+
title: '',
|
|
2476
|
+
type: 'string',
|
|
2477
|
+
isSystem: false,
|
|
2478
|
+
useTemplate: false
|
|
2479
|
+
};
|
|
2480
|
+
this.form.markAsUntouched();
|
|
2481
|
+
this.form.markAsPristine();
|
|
2482
|
+
this.isDetail = true;
|
|
2483
|
+
};
|
|
2484
|
+
this.onSave = () => {
|
|
2485
|
+
var _a;
|
|
2486
|
+
const systemSetting = this.generatedColumnService.loadSystem(this.gridOption.config);
|
|
2487
|
+
const setting = this.generatedColumnService.load((_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.config);
|
|
2488
|
+
if (this.detail.isSystem) {
|
|
2489
|
+
if (!this.detail.id) {
|
|
2490
|
+
systemSetting.set([...this.systemColumns, Object.assign(Object.assign({}, this.detail), { id: v4() })]);
|
|
2491
|
+
}
|
|
2492
|
+
else {
|
|
2493
|
+
systemSetting.set([...this.systemColumns]);
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
else {
|
|
2497
|
+
if (!this.detail.id) {
|
|
2498
|
+
setting.set([...this.columns, Object.assign(Object.assign({}, this.detail), { id: v4() })]);
|
|
2499
|
+
}
|
|
2500
|
+
else {
|
|
2501
|
+
setting.set([...this.columns]);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
};
|
|
2505
|
+
}
|
|
2506
|
+
ngOnInit() {
|
|
2507
|
+
var _a, _b, _c;
|
|
2508
|
+
const systemSetting = this.generatedColumnService.loadSystem(this.gridOption.config);
|
|
2509
|
+
const setting = this.generatedColumnService.load((_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.config);
|
|
2510
|
+
if (systemSetting) {
|
|
2511
|
+
(_b = __classPrivateFieldGet(this, _subscription$2)) === null || _b === void 0 ? void 0 : _b.add(systemSetting.observer.subscribe(columns => {
|
|
2512
|
+
this.systemColumns = columns;
|
|
2513
|
+
}));
|
|
2514
|
+
}
|
|
2515
|
+
if (setting) {
|
|
2516
|
+
(_c = __classPrivateFieldGet(this, _subscription$2)) === null || _c === void 0 ? void 0 : _c.add(setting.observer.subscribe(columns => {
|
|
2517
|
+
this.columns = columns;
|
|
2518
|
+
}));
|
|
2519
|
+
}
|
|
2520
|
+
this.originColumns = this.gridOption.columns.filter(e => e.type !== 'children' && e.type !== 'children-col');
|
|
2521
|
+
}
|
|
2522
|
+
ngOnDestroy() {
|
|
2523
|
+
__classPrivateFieldGet(this, _subscription$2).unsubscribe();
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
_subscription$2 = new WeakMap();
|
|
2527
|
+
SdDynamicColumn.decorators = [
|
|
2528
|
+
{ type: Component, args: [{
|
|
2529
|
+
selector: 'sd-dynamic-column',
|
|
2530
|
+
template: "<sd-side-drawer width=\"400px\">\r\n <div sdTitle>{{'Manage dynamic column' | sdTranslate}}</div>\r\n <ng-container sdBody>\r\n <ng-container *ngIf=\"!isDetail\">\r\n <ng-container *ngIf=\"systemColumns\">\r\n <div *ngFor=\"let column of systemColumns\" (click)=\"onDetail(column)\">\r\n {{column.title}}\r\n </div>\r\n </ng-container>\r\n <ng-container *ngIf=\"columns\">\r\n <div *ngFor=\"let column of columns\" (click)=\"onDetail(column)\">\r\n {{column.title}}\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"isDetail\">\r\n <sd-select [form]=\"form\" [label]=\"'Apply for' | sdTranslate\" [(model)]=\"detail.isSystem\"\r\n [items]=\"[{code: true, name: 'All users'},{code: false, name: 'Only me'}]\" [disabled]=\"!!detail.id\" required></sd-select>\r\n <sd-input [form]=\"form\" [label]=\"'Column field' | sdTranslate\" [(model)]=\"detail.field\" [disabled]=\"!!detail.id\"\r\n required></sd-input>\r\n <sd-input [form]=\"form\" [label]=\"'Column title' | sdTranslate\" [(model)]=\"detail.title\" required></sd-input>\r\n <sd-input [form]=\"form\" [label]=\"'Column width' | sdTranslate\" [(model)]=\"detail.width\" type=\"number\" required>\r\n <ng-template sdInputSuffix>px</ng-template>\r\n </sd-input>\r\n <sd-select [form]=\"form\" [label]=\"'Column type' | sdTranslate\" [(model)]=\"detail.type\" [items]=\"columnTypes\"\r\n [disabled]=\"!!detail.id\" required></sd-select>\r\n <sd-select *ngIf=\"detail.type === 'children' || detail.type === 'children-col'\" [form]=\"form\"\r\n [label]=\"'Column fields' | sdTranslate\" [(model)]=\"detail.fields\" [items]=\"originColumns\" valueField=\"field\"\r\n displayField=\"title\" multiple></sd-select>\r\n <sd-select [form]=\"form\" [label]=\"'Use template' | sdTranslate\" [(model)]=\"detail.useTemplate\"\r\n [items]=\"[{code: true, name: 'Yes'},{code: false, name: 'No'}]\" required></sd-select>\r\n <sd-editor *ngIf=\"detail.useTemplate\" [form]=\"form\" [label]=\"'Html template' | sdTranslate\" [(model)]=\"detail.template\">\r\n </sd-editor>\r\n </ng-container>\r\n </ng-container>\r\n <div class=\"d-flex align-items-center justify-content-end\" sdFooter>\r\n <sd-button [title]=\"'Close' | sdTranslate\" (action)=\"sideDrawer.close()\"> </sd-button>\r\n <sd-button *ngIf=\"!isDetail\" [title]=\"'Create column' | sdTranslate\" color=\"primary\" class=\"mx-8\"\r\n (action)=\"onDetail()\">\r\n </sd-button>\r\n <sd-button *ngIf=\"isDetail\" [title]=\"'Save' | sdTranslate\" color=\"success\" class=\"mx-8\" (action)=\"onSave()\">\r\n </sd-button>\r\n </div>\r\n</sd-side-drawer>",
|
|
2531
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2532
|
+
styles: [".c-table{overflow:auto;position:relative}.c-table table{width:100%}.c-table .c-th{color:#000;font-size:14px;font-weight:500;line-height:20px}.c-container{min-height:200px;position:relative}.c-handle{color:#ccc;cursor:move}"]
|
|
2533
|
+
},] }
|
|
2534
|
+
];
|
|
2535
|
+
SdDynamicColumn.ctorParameters = () => [
|
|
2536
|
+
{ type: ChangeDetectorRef },
|
|
2537
|
+
{ type: SdGeneratedColumnService },
|
|
2538
|
+
{ type: SdNotifyService },
|
|
2539
|
+
{ type: SdTranslateService },
|
|
2540
|
+
{ type: SdGridConfigurationService }
|
|
2541
|
+
];
|
|
2542
|
+
SdDynamicColumn.propDecorators = {
|
|
2543
|
+
sideDrawer: [{ type: ViewChild, args: [SdSideDrawer,] }],
|
|
2544
|
+
gridOption: [{ type: Input }]
|
|
2545
|
+
};
|
|
2546
|
+
|
|
2409
2547
|
class MatPaginatorIntlCro extends MatPaginatorIntl {
|
|
2410
2548
|
constructor() {
|
|
2411
2549
|
super(...arguments);
|
|
@@ -2472,6 +2610,7 @@ SdGridMaterialModule.decorators = [
|
|
|
2472
2610
|
SdPopupGridConfiguration,
|
|
2473
2611
|
SdGridFilter,
|
|
2474
2612
|
SdPopupFilter,
|
|
2613
|
+
SdDynamicColumn,
|
|
2475
2614
|
// Pipes
|
|
2476
2615
|
SdGridConfigurationResultPipe,
|
|
2477
2616
|
SdColumnChildrenFilterPipe,
|
|
@@ -2506,6 +2645,7 @@ SdGridMaterialModule.decorators = [
|
|
|
2506
2645
|
SdGridService,
|
|
2507
2646
|
SdGridFilterService,
|
|
2508
2647
|
SdGridConfigurationService,
|
|
2648
|
+
SdGeneratedColumnService,
|
|
2509
2649
|
{
|
|
2510
2650
|
provide: MatPaginatorIntl, useClass: MatPaginatorIntlCro
|
|
2511
2651
|
}
|
|
@@ -2521,5 +2661,5 @@ SdGridMaterialModule.decorators = [
|
|
|
2521
2661
|
* Generated bundle index. Do not edit.
|
|
2522
2662
|
*/
|
|
2523
2663
|
|
|
2524
|
-
export { SdGridMaterial, SdGridMaterialModule, SdMaterialCellDefDirective, SdMaterialEmptyDataDefDirective, SdMaterialFilterDefDirective, SdMaterialFooterDefDirective, SdMaterialSubInformationDefDirective, MatPaginatorIntlCro as ɵa, SdGridFilter as ɵb,
|
|
2664
|
+
export { SdGridMaterial, SdGridMaterialModule, SdMaterialCellDefDirective, SdMaterialEmptyDataDefDirective, SdMaterialFilterDefDirective, SdMaterialFooterDefDirective, SdMaterialSubInformationDefDirective, MatPaginatorIntlCro as ɵa, SdGridFilter as ɵb, SdColumnTooltipPipe as ɵba, SdColumnBadgePipe as ɵbb, SdFilterColumnPipe as ɵbc, SdFilterExternalPipe as ɵbd, SdSelectionActionFilterPipe as ɵbe, SdSelectionDisablePipe as ɵbf, SdSelectionDisableSelectAllPipe as ɵbg, SdPopupFilter as ɵc, SdGridFilterService as ɵd, SdPopupExport as ɵe, GRID_MATERIAL_CONFIG as ɵg, SdGridConfigurationService as ɵh, SdGridService as ɵi, SdDesktopCellView as ɵj, SdDesktopCellChildrenView as ɵk, SdDesktopCommand as ɵl, SdLetDirective as ɵm, SdPopupGridConfiguration as ɵn, SdDynamicColumn as ɵo, SdGeneratedColumnService as ɵp, SdGridConfigurationResultPipe as ɵq, SdColumnChildrenFilterPipe as ɵr, SdColumnTitlePipe as ɵs, SdCommandFilterPipe as ɵt, SdCommandDisablePipe as ɵu, SdCommandIconPipe as ɵv, SdCommandTitlePipe as ɵw, SdColumnValuesPipe as ɵx, SdColumnHtmlTemplatePipe as ɵy, SdColumnTransformPipe as ɵz };
|
|
2525
2665
|
//# sourceMappingURL=sd-angular-core-grid-material.js.map
|