@sd-angular/core 0.0.935 → 0.0.939
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 +50 -20
- 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/esm2015/grid-material/src/lib/components/desktop-cell/desktop-cell.component.js +2 -2
- package/esm2015/grid-material/src/lib/grid-material.component.js +27 -7
- package/esm2015/grid-material/src/lib/models/grid-option.model.js +1 -1
- package/esm2015/grid-material/src/lib/models/grid.model.js +1 -1
- package/esm2015/grid-material/src/lib/pipes/editor-validate.pipe.js +10 -8
- package/fesm2015/sd-angular-core-grid-material.js +36 -14
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/grid-material.component.d.ts +10 -5
- package/grid-material/src/lib/models/grid-option.model.d.ts +0 -7
- package/grid-material/src/lib/models/grid.model.d.ts +1 -0
- package/grid-material/src/lib/pipes/editor-validate.pipe.d.ts +4 -2
- package/package.json +1 -1
- package/{sd-angular-core-0.0.935.tgz → sd-angular-core-0.0.939.tgz} +0 -0
|
@@ -1117,7 +1117,7 @@ SdGridService.ctorParameters = () => [
|
|
|
1117
1117
|
{ type: SdUtilityService }
|
|
1118
1118
|
];
|
|
1119
1119
|
|
|
1120
|
-
var _paginator, _sort, _subscription$1, _optionChanges, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems
|
|
1120
|
+
var _paginator, _sort, _subscription$1, _optionChanges, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
1121
1121
|
class SdGridMaterial {
|
|
1122
1122
|
constructor(ref, configuration, gridConfigurationService, exportService, notifyService, translateService, gridService) {
|
|
1123
1123
|
this.ref = ref;
|
|
@@ -1672,10 +1672,6 @@ class SdGridMaterial {
|
|
|
1672
1672
|
var _a;
|
|
1673
1673
|
(_a = this.gridFilter) === null || _a === void 0 ? void 0 : _a.setFilter(args);
|
|
1674
1674
|
};
|
|
1675
|
-
_generateEditorHanlder.set(this, (item) => {
|
|
1676
|
-
// item.editorHandler = item.editorHandler || {};
|
|
1677
|
-
// this.editorVisiblePipe.transform(null, item, this.gridOption);
|
|
1678
|
-
});
|
|
1679
1675
|
this.onCreate = () => {
|
|
1680
1676
|
var _a;
|
|
1681
1677
|
const { type, editor, columns } = this.gridOption;
|
|
@@ -1720,6 +1716,9 @@ class SdGridMaterial {
|
|
|
1720
1716
|
this.ref.detectChanges();
|
|
1721
1717
|
};
|
|
1722
1718
|
this.onSave = (item) => __awaiter(this, void 0, void 0, function* () {
|
|
1719
|
+
if (item.editorHandlerRow.saving) {
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1723
1722
|
const { editor } = this.gridOption;
|
|
1724
1723
|
try {
|
|
1725
1724
|
item.editorHandlerRow.saving = true;
|
|
@@ -1807,6 +1806,7 @@ class SdGridMaterial {
|
|
|
1807
1806
|
return;
|
|
1808
1807
|
}
|
|
1809
1808
|
};
|
|
1809
|
+
this.detectChanges = () => this.ref.detectChanges();
|
|
1810
1810
|
}
|
|
1811
1811
|
set _gridFilter(gridFilter) {
|
|
1812
1812
|
if (gridFilter && this.gridFilter !== gridFilter) {
|
|
@@ -1862,8 +1862,28 @@ class SdGridMaterial {
|
|
|
1862
1862
|
drop(event, columns) {
|
|
1863
1863
|
moveItemInArray(columns, event.previousIndex, event.currentIndex);
|
|
1864
1864
|
}
|
|
1865
|
+
get editedItems() {
|
|
1866
|
+
return this.items.filter(item => {
|
|
1867
|
+
if (!item.originItem) {
|
|
1868
|
+
return true;
|
|
1869
|
+
}
|
|
1870
|
+
if (Object.keys(item.originItem).some(key => item.originItem[key] !== item[key])) {
|
|
1871
|
+
return true;
|
|
1872
|
+
}
|
|
1873
|
+
return false;
|
|
1874
|
+
}).map(item => {
|
|
1875
|
+
const { editorStatus, editorHandlerRow, editorHandlerColumn, expandDetail, isExpanded, isExpanding, isSelected, originItem } = item, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem"]);
|
|
1876
|
+
return Object.assign(Object.assign({}, result), { editorErrorMessage: editorHandlerRow === null || editorHandlerRow === void 0 ? void 0 : editorHandlerRow.errorMessage });
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
get gridItems() {
|
|
1880
|
+
return this.items.map(item => {
|
|
1881
|
+
const { editorStatus, editorHandlerRow, editorHandlerColumn, expandDetail, isExpanded, isExpanding, isSelected, originItem } = item, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem"]);
|
|
1882
|
+
return result;
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1865
1885
|
}
|
|
1866
|
-
_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$1 = new WeakMap(), _render = new WeakMap(), _exportedItems = new WeakMap(), _allColumns = new WeakMap(), _allExportedColumns = new WeakMap(), _onExport = new WeakMap(), _updateSelectedItems = new WeakMap()
|
|
1886
|
+
_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$1 = new WeakMap(), _render = new WeakMap(), _exportedItems = new WeakMap(), _allColumns = new WeakMap(), _allExportedColumns = new WeakMap(), _onExport = new WeakMap(), _updateSelectedItems = new WeakMap();
|
|
1867
1887
|
SdGridMaterial.decorators = [
|
|
1868
1888
|
{ type: Component, args: [{
|
|
1869
1889
|
selector: 'sd-grid-material',
|
|
@@ -2701,7 +2721,7 @@ class SdDesktopCell {
|
|
|
2701
2721
|
SdDesktopCell.decorators = [
|
|
2702
2722
|
{ type: Component, args: [{
|
|
2703
2723
|
selector: 'sd-desktop-cell',
|
|
2704
|
-
template: "<ng-container *ngIf=\"column && item\">\r\n <ng-container *ngIf=\"item.editorHandlerRow;else useView\">\r\n <ng-container *sdLet=\"item[column.field] | sdEditorHandlerColumn:item:column:gridOption\">\r\n <ng-container *ngIf=\"item.editorHandlerColumn[column.field]?.visible;else
|
|
2724
|
+
template: "<ng-container *ngIf=\"column && item\">\r\n <ng-container *ngIf=\"item.editorHandlerRow;else useView\">\r\n <ng-container *sdLet=\"item[column.field] | sdEditorHandlerColumn:item:column:gridOption\">\r\n <ng-container *ngIf=\"item.editorHandlerColumn[column.field]?.visible;else useView\">\r\n <ng-container *sdLet=\"item[column.field] | sdEditorValidate:item:column:gridOption\">\r\n </ng-container>\r\n <ng-container *ngIf=\"cellDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n cellDef[column.field].templateRef;\r\n context: { item: item, column: column, idx: idx, isEdited: true }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <sd-desktop-cell-editor *ngIf=\"!cellDef[column.field]\" [column]=\"column\" [item]=\"item\">\r\n </sd-desktop-cell-editor>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #useView>\r\n <ng-container *ngIf=\"cellDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n cellDef[column.field].templateRef;\r\n context: { item: item, column: column, idx: idx }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <sd-desktop-cell-view *ngIf=\"!cellDef[column.field]\" [key]=\"key\" [column]=\"column\" [item]=\"item\">\r\n </sd-desktop-cell-view>\r\n </ng-template>\r\n</ng-container>",
|
|
2705
2725
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2706
2726
|
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}"]
|
|
2707
2727
|
},] }
|
|
@@ -2816,9 +2836,15 @@ class SdEditorValidatePipe {
|
|
|
2816
2836
|
constructor() {
|
|
2817
2837
|
this.delay = 1000; // Sau khoảng thời gian delay nếu không có thay đổi thì thì mới bắt đầu thực hiện validate
|
|
2818
2838
|
}
|
|
2819
|
-
transform(value, item,
|
|
2839
|
+
transform(value, item, column, gridOption) {
|
|
2840
|
+
var _a;
|
|
2820
2841
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2821
|
-
|
|
2842
|
+
const { editor } = gridOption;
|
|
2843
|
+
if (!((_a = item.editorHandlerRow) === null || _a === void 0 ? void 0 : _a.visible)) {
|
|
2844
|
+
return true;
|
|
2845
|
+
}
|
|
2846
|
+
if (!editor.validate) {
|
|
2847
|
+
item.editorHandlerRow.errorMessage = null;
|
|
2822
2848
|
return true;
|
|
2823
2849
|
}
|
|
2824
2850
|
this.previous = new Date();
|
|
@@ -2828,11 +2854,7 @@ class SdEditorValidatePipe {
|
|
|
2828
2854
|
if (dif < this.delay) {
|
|
2829
2855
|
return true;
|
|
2830
2856
|
}
|
|
2831
|
-
|
|
2832
|
-
item.editorHandlerRow.errorMessage = null;
|
|
2833
|
-
return true;
|
|
2834
|
-
}
|
|
2835
|
-
const result = validate(item);
|
|
2857
|
+
const result = editor.validate(item);
|
|
2836
2858
|
if (result instanceof Promise) {
|
|
2837
2859
|
item.editorHandlerRow.errorMessage = yield result;
|
|
2838
2860
|
return true;
|