@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.
@@ -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:
@@ -2513,6 +2512,7 @@
2513
2512
  return;
2514
2513
  }
2515
2514
  };
2515
+ this.detectChanges = function () { return _this.ref.detectChanges(); };
2516
2516
  }
2517
2517
  Object.defineProperty(SdGridMaterial.prototype, "_gridFilter", {
2518
2518
  set: function (gridFilter) {
@@ -2586,9 +2586,37 @@
2586
2586
  SdGridMaterial.prototype.drop = function (event, columns) {
2587
2587
  dragDrop.moveItemInArray(columns, event.previousIndex, event.currentIndex);
2588
2588
  };
2589
+ Object.defineProperty(SdGridMaterial.prototype, "editedItems", {
2590
+ get: function () {
2591
+ return this.items.filter(function (item) {
2592
+ if (!item.originItem) {
2593
+ return true;
2594
+ }
2595
+ if (Object.keys(item.originItem).some(function (key) { return item.originItem[key] !== item[key]; })) {
2596
+ return true;
2597
+ }
2598
+ return false;
2599
+ }).map(function (item) {
2600
+ 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"]);
2601
+ return Object.assign(Object.assign({}, result), { editorErrorMessage: editorHandlerRow === null || editorHandlerRow === void 0 ? void 0 : editorHandlerRow.errorMessage });
2602
+ });
2603
+ },
2604
+ enumerable: false,
2605
+ configurable: true
2606
+ });
2607
+ Object.defineProperty(SdGridMaterial.prototype, "gridItems", {
2608
+ get: function () {
2609
+ return this.items.map(function (item) {
2610
+ 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"]);
2611
+ return result;
2612
+ });
2613
+ },
2614
+ enumerable: false,
2615
+ configurable: true
2616
+ });
2589
2617
  return SdGridMaterial;
2590
2618
  }());
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();
2619
+ _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
2620
  SdGridMaterial.decorators = [
2593
2621
  { type: core.Component, args: [{
2594
2622
  selector: 'sd-grid-material',
@@ -3620,7 +3648,7 @@
3620
3648
  SdDesktopCell.decorators = [
3621
3649
  { type: core.Component, args: [{
3622
3650
  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>",
3651
+ 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>",
3624
3652
  changeDetection: core.ChangeDetectionStrategy.OnPush,
3625
3653
  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
3654
  },] }
@@ -3754,35 +3782,37 @@
3754
3782
  function SdEditorValidatePipe() {
3755
3783
  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
3784
  }
3757
- SdEditorValidatePipe.prototype.transform = function (value, item, validate) {
3785
+ SdEditorValidatePipe.prototype.transform = function (value, item, column, gridOption) {
3786
+ var _a;
3758
3787
  return __awaiter(this, void 0, void 0, function () {
3759
- var now, dif, result, _a;
3788
+ var editor, now, dif, result, _b;
3760
3789
  var _this = this;
3761
- return __generator(this, function (_b) {
3762
- switch (_b.label) {
3790
+ return __generator(this, function (_c) {
3791
+ switch (_c.label) {
3763
3792
  case 0:
3764
- if (!item.editorHandlerRow) {
3793
+ editor = gridOption.editor;
3794
+ if (!((_a = item.editorHandlerRow) === null || _a === void 0 ? void 0 : _a.visible)) {
3795
+ return [2 /*return*/, true];
3796
+ }
3797
+ if (!editor.validate) {
3798
+ item.editorHandlerRow.errorMessage = null;
3765
3799
  return [2 /*return*/, true];
3766
3800
  }
3767
3801
  this.previous = new Date();
3768
3802
  return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, _this.delay); })];
3769
3803
  case 1:
3770
- _b.sent();
3804
+ _c.sent();
3771
3805
  now = new Date();
3772
3806
  dif = now.getTime() - this.previous.getTime();
3773
3807
  if (dif < this.delay) {
3774
3808
  return [2 /*return*/, true];
3775
3809
  }
3776
- if (!validate) {
3777
- item.editorHandlerRow.errorMessage = null;
3778
- return [2 /*return*/, true];
3779
- }
3780
- result = validate(item);
3810
+ result = editor.validate(item);
3781
3811
  if (!(result instanceof Promise)) return [3 /*break*/, 3];
3782
- _a = item.editorHandlerRow;
3812
+ _b = item.editorHandlerRow;
3783
3813
  return [4 /*yield*/, result];
3784
3814
  case 2:
3785
- _a.errorMessage = _b.sent();
3815
+ _b.errorMessage = _c.sent();
3786
3816
  return [2 /*return*/, true];
3787
3817
  case 3:
3788
3818
  item.editorHandlerRow.errorMessage = result;