@sd-angular/core 0.0.904 → 0.0.908
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 +176 -23
- 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-tab-router.umd.js +33 -18
- package/bundles/sd-angular-core-tab-router.umd.js.map +1 -1
- package/bundles/sd-angular-core-tab-router.umd.min.js +2 -2
- package/bundles/sd-angular-core-tab-router.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.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/tab-router/src/lib/components/tab-router-outlet/tab-router-outlet.component.js +30 -24
- package/fesm2015/sd-angular-core-grid-material.js +151 -4
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-tab-router.js +20 -14
- package/fesm2015/sd-angular-core-tab-router.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 -0
- 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.908.tgz} +0 -0
- package/tab-router/src/lib/components/tab-router-outlet/tab-router-outlet.component.d.ts +7 -7
|
@@ -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';
|
|
@@ -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) {
|
|
@@ -1933,7 +1934,7 @@ class SdDesktopCellView {
|
|
|
1933
1934
|
SdDesktopCellView.decorators = [
|
|
1934
1935
|
{ type: Component, args: [{
|
|
1935
1936
|
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
|
|
1937
|
+
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
1938
|
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
1939
|
},] }
|
|
1939
1940
|
];
|
|
@@ -2111,6 +2112,9 @@ class SdColumnBadgePipe {
|
|
|
2111
2112
|
if (column.type === 'string' && (column === null || column === void 0 ? void 0 : column.badge)) {
|
|
2112
2113
|
return column.badge(value, rowData);
|
|
2113
2114
|
}
|
|
2115
|
+
if (column.type === 'bool' && (column === null || column === void 0 ? void 0 : column.badge)) {
|
|
2116
|
+
return column.badge(value, rowData);
|
|
2117
|
+
}
|
|
2114
2118
|
return null;
|
|
2115
2119
|
}
|
|
2116
2120
|
}
|
|
@@ -2239,7 +2243,7 @@ _cache$2 = new WeakMap();
|
|
|
2239
2243
|
SdPopupGridConfiguration.decorators = [
|
|
2240
2244
|
{ type: Component, args: [{
|
|
2241
2245
|
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
|
|
2246
|
+
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
2247
|
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
2248
|
},] }
|
|
2245
2249
|
];
|
|
@@ -2406,6 +2410,147 @@ SdSelectionDisableSelectAllPipe.decorators = [
|
|
|
2406
2410
|
},] }
|
|
2407
2411
|
];
|
|
2408
2412
|
|
|
2413
|
+
var _cache$3;
|
|
2414
|
+
class SdGeneratedColumnService {
|
|
2415
|
+
constructor(settingService) {
|
|
2416
|
+
this.settingService = settingService;
|
|
2417
|
+
_cache$3.set(this, {});
|
|
2418
|
+
this.load = (configuration) => {
|
|
2419
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.key)) {
|
|
2420
|
+
return null;
|
|
2421
|
+
}
|
|
2422
|
+
const key = hash({
|
|
2423
|
+
prefix: '260f5e94-5865-4425-8ced-b9c083c390dd',
|
|
2424
|
+
key: configuration.key
|
|
2425
|
+
});
|
|
2426
|
+
if (!__classPrivateFieldGet(this, _cache$3)[key]) {
|
|
2427
|
+
__classPrivateFieldGet(this, _cache$3)[key] = this.settingService.create(key, {
|
|
2428
|
+
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
2429
|
+
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
2430
|
+
default: []
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2433
|
+
return __classPrivateFieldGet(this, _cache$3)[key];
|
|
2434
|
+
};
|
|
2435
|
+
this.loadSystem = (configuration) => {
|
|
2436
|
+
var _a;
|
|
2437
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.key)) {
|
|
2438
|
+
return null;
|
|
2439
|
+
}
|
|
2440
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn)) {
|
|
2441
|
+
return null;
|
|
2442
|
+
}
|
|
2443
|
+
const key = hash({
|
|
2444
|
+
prefix: '8b8050ca-1f44-4860-bad3-20e646c0d68f',
|
|
2445
|
+
key: configuration.key
|
|
2446
|
+
});
|
|
2447
|
+
if (!__classPrivateFieldGet(this, _cache$3)[key]) {
|
|
2448
|
+
__classPrivateFieldGet(this, _cache$3)[key] = this.settingService.create(key, {
|
|
2449
|
+
type: 'server',
|
|
2450
|
+
args: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _a === void 0 ? void 0 : _a.args,
|
|
2451
|
+
default: []
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
return __classPrivateFieldGet(this, _cache$3)[key];
|
|
2455
|
+
};
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
_cache$3 = new WeakMap();
|
|
2459
|
+
SdGeneratedColumnService.decorators = [
|
|
2460
|
+
{ type: Injectable }
|
|
2461
|
+
];
|
|
2462
|
+
SdGeneratedColumnService.ctorParameters = () => [
|
|
2463
|
+
{ type: SdSettingService }
|
|
2464
|
+
];
|
|
2465
|
+
|
|
2466
|
+
var _subscription$2;
|
|
2467
|
+
class SdDynamicColumn {
|
|
2468
|
+
constructor(ref, generatedColumnService, notifyService, translateService, gridConfigurationService) {
|
|
2469
|
+
this.ref = ref;
|
|
2470
|
+
this.generatedColumnService = generatedColumnService;
|
|
2471
|
+
this.notifyService = notifyService;
|
|
2472
|
+
this.translateService = translateService;
|
|
2473
|
+
this.gridConfigurationService = gridConfigurationService;
|
|
2474
|
+
_subscription$2.set(this, new Subscription());
|
|
2475
|
+
this.columnTypes = ['string', 'number', 'bool', 'date', 'datetime', 'time', 'values', 'children', 'children-col'];
|
|
2476
|
+
this.form = new FormGroup({});
|
|
2477
|
+
this.isDetail = false;
|
|
2478
|
+
this.originColumns = [];
|
|
2479
|
+
this.onDetail = (column) => {
|
|
2480
|
+
this.detail = column || {
|
|
2481
|
+
field: v4(),
|
|
2482
|
+
title: '',
|
|
2483
|
+
type: 'string',
|
|
2484
|
+
isSystem: false,
|
|
2485
|
+
useTemplate: false
|
|
2486
|
+
};
|
|
2487
|
+
this.form.markAsUntouched();
|
|
2488
|
+
this.form.markAsPristine();
|
|
2489
|
+
this.isDetail = true;
|
|
2490
|
+
};
|
|
2491
|
+
this.onSave = () => {
|
|
2492
|
+
var _a;
|
|
2493
|
+
const systemSetting = this.generatedColumnService.loadSystem(this.gridOption.config);
|
|
2494
|
+
const setting = this.generatedColumnService.load((_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.config);
|
|
2495
|
+
if (this.detail.isSystem) {
|
|
2496
|
+
if (!this.detail.id) {
|
|
2497
|
+
systemSetting.set([...this.systemColumns, Object.assign(Object.assign({}, this.detail), { id: v4() })]);
|
|
2498
|
+
}
|
|
2499
|
+
else {
|
|
2500
|
+
systemSetting.set([...this.systemColumns]);
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
else {
|
|
2504
|
+
if (!this.detail.id) {
|
|
2505
|
+
setting.set([...this.columns, Object.assign(Object.assign({}, this.detail), { id: v4() })]);
|
|
2506
|
+
}
|
|
2507
|
+
else {
|
|
2508
|
+
setting.set([...this.columns]);
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
};
|
|
2512
|
+
}
|
|
2513
|
+
ngOnInit() {
|
|
2514
|
+
var _a, _b, _c;
|
|
2515
|
+
const systemSetting = this.generatedColumnService.loadSystem(this.gridOption.config);
|
|
2516
|
+
const setting = this.generatedColumnService.load((_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.config);
|
|
2517
|
+
if (systemSetting) {
|
|
2518
|
+
(_b = __classPrivateFieldGet(this, _subscription$2)) === null || _b === void 0 ? void 0 : _b.add(systemSetting.observer.subscribe(columns => {
|
|
2519
|
+
this.systemColumns = columns;
|
|
2520
|
+
}));
|
|
2521
|
+
}
|
|
2522
|
+
if (setting) {
|
|
2523
|
+
(_c = __classPrivateFieldGet(this, _subscription$2)) === null || _c === void 0 ? void 0 : _c.add(setting.observer.subscribe(columns => {
|
|
2524
|
+
this.columns = columns;
|
|
2525
|
+
}));
|
|
2526
|
+
}
|
|
2527
|
+
this.originColumns = this.gridOption.columns.filter(e => e.type !== 'children' && e.type !== 'children-col');
|
|
2528
|
+
}
|
|
2529
|
+
ngOnDestroy() {
|
|
2530
|
+
__classPrivateFieldGet(this, _subscription$2).unsubscribe();
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
_subscription$2 = new WeakMap();
|
|
2534
|
+
SdDynamicColumn.decorators = [
|
|
2535
|
+
{ type: Component, args: [{
|
|
2536
|
+
selector: 'sd-dynamic-column',
|
|
2537
|
+
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>",
|
|
2538
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2539
|
+
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}"]
|
|
2540
|
+
},] }
|
|
2541
|
+
];
|
|
2542
|
+
SdDynamicColumn.ctorParameters = () => [
|
|
2543
|
+
{ type: ChangeDetectorRef },
|
|
2544
|
+
{ type: SdGeneratedColumnService },
|
|
2545
|
+
{ type: SdNotifyService },
|
|
2546
|
+
{ type: SdTranslateService },
|
|
2547
|
+
{ type: SdGridConfigurationService }
|
|
2548
|
+
];
|
|
2549
|
+
SdDynamicColumn.propDecorators = {
|
|
2550
|
+
sideDrawer: [{ type: ViewChild, args: [SdSideDrawer,] }],
|
|
2551
|
+
gridOption: [{ type: Input }]
|
|
2552
|
+
};
|
|
2553
|
+
|
|
2409
2554
|
class MatPaginatorIntlCro extends MatPaginatorIntl {
|
|
2410
2555
|
constructor() {
|
|
2411
2556
|
super(...arguments);
|
|
@@ -2472,6 +2617,7 @@ SdGridMaterialModule.decorators = [
|
|
|
2472
2617
|
SdPopupGridConfiguration,
|
|
2473
2618
|
SdGridFilter,
|
|
2474
2619
|
SdPopupFilter,
|
|
2620
|
+
SdDynamicColumn,
|
|
2475
2621
|
// Pipes
|
|
2476
2622
|
SdGridConfigurationResultPipe,
|
|
2477
2623
|
SdColumnChildrenFilterPipe,
|
|
@@ -2506,6 +2652,7 @@ SdGridMaterialModule.decorators = [
|
|
|
2506
2652
|
SdGridService,
|
|
2507
2653
|
SdGridFilterService,
|
|
2508
2654
|
SdGridConfigurationService,
|
|
2655
|
+
SdGeneratedColumnService,
|
|
2509
2656
|
{
|
|
2510
2657
|
provide: MatPaginatorIntl, useClass: MatPaginatorIntlCro
|
|
2511
2658
|
}
|
|
@@ -2521,5 +2668,5 @@ SdGridMaterialModule.decorators = [
|
|
|
2521
2668
|
* Generated bundle index. Do not edit.
|
|
2522
2669
|
*/
|
|
2523
2670
|
|
|
2524
|
-
export { SdGridMaterial, SdGridMaterialModule, SdMaterialCellDefDirective, SdMaterialEmptyDataDefDirective, SdMaterialFilterDefDirective, SdMaterialFooterDefDirective, SdMaterialSubInformationDefDirective, MatPaginatorIntlCro as ɵa, SdGridFilter as ɵb,
|
|
2671
|
+
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
2672
|
//# sourceMappingURL=sd-angular-core-grid-material.js.map
|