@sd-angular/core 0.0.935 → 0.0.936

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.
@@ -1658,7 +1658,7 @@
1658
1658
  { type: utility.SdUtilityService }
1659
1659
  ]; };
1660
1660
 
1661
- var _paginator, _sort, _subscription$1, _optionChanges, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems, _generateEditorHanlder;
1661
+ var _paginator, _sort, _subscription$1, _optionChanges, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
1662
1662
  var SdGridMaterial = /** @class */ (function () {
1663
1663
  function SdGridMaterial(ref, configuration, gridConfigurationService, exportService, notifyService, translateService, gridService) {
1664
1664
  var _this = this;
@@ -2365,10 +2365,6 @@
2365
2365
  var _a;
2366
2366
  (_a = _this.gridFilter) === null || _a === void 0 ? void 0 : _a.setFilter(args);
2367
2367
  };
2368
- _generateEditorHanlder.set(this, function (item) {
2369
- // item.editorHandler = item.editorHandler || {};
2370
- // this.editorVisiblePipe.transform(null, item, this.gridOption);
2371
- });
2372
2368
  this.onCreate = function () {
2373
2369
  var _a;
2374
2370
  var _t = _this.gridOption, type = _t.type, editor = _t.editor, columns = _t.columns;
@@ -2417,6 +2413,9 @@
2417
2413
  return __generator(this, function (_t) {
2418
2414
  switch (_t.label) {
2419
2415
  case 0:
2416
+ if (item.editorHandlerRow.saving) {
2417
+ return [2 /*return*/];
2418
+ }
2420
2419
  editor = this.gridOption.editor;
2421
2420
  _t.label = 1;
2422
2421
  case 1:
@@ -2586,9 +2585,37 @@
2586
2585
  SdGridMaterial.prototype.drop = function (event, columns) {
2587
2586
  dragDrop.moveItemInArray(columns, event.previousIndex, event.currentIndex);
2588
2587
  };
2588
+ Object.defineProperty(SdGridMaterial.prototype, "editedItems", {
2589
+ get: function () {
2590
+ return this.items.filter(function (item) {
2591
+ if (!item.originItem) {
2592
+ return true;
2593
+ }
2594
+ if (Object.keys(item.originItem).some(function (key) { return item.originItem[key] !== item[key]; })) {
2595
+ return true;
2596
+ }
2597
+ return false;
2598
+ }).map(function (item) {
2599
+ var editorStatus = item.editorStatus, editorHandlerRow = item.editorHandlerRow, editorHandlerColumn = item.editorHandlerColumn, expandDetail = item.expandDetail, isExpanded = item.isExpanded, isExpanding = item.isExpanding, isSelected = item.isSelected, originItem = item.originItem, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem"]);
2600
+ return Object.assign(Object.assign({}, result), { editorErrorMessage: editorHandlerRow === null || editorHandlerRow === void 0 ? void 0 : editorHandlerRow.errorMessage });
2601
+ });
2602
+ },
2603
+ enumerable: false,
2604
+ configurable: true
2605
+ });
2606
+ Object.defineProperty(SdGridMaterial.prototype, "gridItems", {
2607
+ get: function () {
2608
+ return this.items.map(function (item) {
2609
+ var editorStatus = item.editorStatus, editorHandlerRow = item.editorHandlerRow, editorHandlerColumn = item.editorHandlerColumn, expandDetail = item.expandDetail, isExpanded = item.isExpanded, isExpanding = item.isExpanding, isSelected = item.isSelected, originItem = item.originItem, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem"]);
2610
+ return result;
2611
+ });
2612
+ },
2613
+ enumerable: false,
2614
+ configurable: true
2615
+ });
2589
2616
  return SdGridMaterial;
2590
2617
  }());
2591
- _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(), _generateEditorHanlder = new WeakMap();
2618
+ _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();
2592
2619
  SdGridMaterial.decorators = [
2593
2620
  { type: core.Component, args: [{
2594
2621
  selector: 'sd-grid-material',
@@ -3620,7 +3647,7 @@
3620
3647
  SdDesktopCell.decorators = [
3621
3648
  { type: core.Component, args: [{
3622
3649
  selector: 'sd-desktop-cell',
3623
- 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 useDisabledView\">\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, editorStatus: 'edited' }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <sd-desktop-cell-editor *ngIf=\"!cellDef[column.field]\" [column]=\"column\" [item]=\"item\"></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\"></sd-desktop-cell-view>\r\n </ng-template>\r\n <ng-template #useDisabledView>\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, editorStatus: 'disabled' }\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\"></sd-desktop-cell-view>\r\n </ng-template>\r\n</ng-container>",
3650
+ 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 *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-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>",
3624
3651
  changeDetection: core.ChangeDetectionStrategy.OnPush,
3625
3652
  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}"]
3626
3653
  },] }
@@ -3754,35 +3781,37 @@
3754
3781
  function SdEditorValidatePipe() {
3755
3782
  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
3756
3783
  }
3757
- SdEditorValidatePipe.prototype.transform = function (value, item, validate) {
3784
+ SdEditorValidatePipe.prototype.transform = function (value, item, column, gridOption) {
3785
+ var _a;
3758
3786
  return __awaiter(this, void 0, void 0, function () {
3759
- var now, dif, result, _a;
3787
+ var editor, now, dif, result, _b;
3760
3788
  var _this = this;
3761
- return __generator(this, function (_b) {
3762
- switch (_b.label) {
3789
+ return __generator(this, function (_c) {
3790
+ switch (_c.label) {
3763
3791
  case 0:
3764
- if (!item.editorHandlerRow) {
3792
+ editor = gridOption.editor;
3793
+ if (!((_a = item.editorHandlerRow) === null || _a === void 0 ? void 0 : _a.visible)) {
3794
+ return [2 /*return*/, true];
3795
+ }
3796
+ if (!editor.validate) {
3797
+ item.editorHandlerRow.errorMessage = null;
3765
3798
  return [2 /*return*/, true];
3766
3799
  }
3767
3800
  this.previous = new Date();
3768
3801
  return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, _this.delay); })];
3769
3802
  case 1:
3770
- _b.sent();
3803
+ _c.sent();
3771
3804
  now = new Date();
3772
3805
  dif = now.getTime() - this.previous.getTime();
3773
3806
  if (dif < this.delay) {
3774
3807
  return [2 /*return*/, true];
3775
3808
  }
3776
- if (!validate) {
3777
- item.editorHandlerRow.errorMessage = null;
3778
- return [2 /*return*/, true];
3779
- }
3780
- result = validate(item);
3809
+ result = editor.validate(item);
3781
3810
  if (!(result instanceof Promise)) return [3 /*break*/, 3];
3782
- _a = item.editorHandlerRow;
3811
+ _b = item.editorHandlerRow;
3783
3812
  return [4 /*yield*/, result];
3784
3813
  case 2:
3785
- _a.errorMessage = _b.sent();
3814
+ _b.errorMessage = _c.sent();
3786
3815
  return [2 /*return*/, true];
3787
3816
  case 3:
3788
3817
  item.editorHandlerRow.errorMessage = result;