@sd-angular/core 0.0.944 → 0.0.945

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.
@@ -1956,7 +1956,10 @@
1956
1956
  this.items = (args === null || args === void 0 ? void 0 : args.items) || [];
1957
1957
  this.total = (args === null || args === void 0 ? void 0 : args.total) || 0;
1958
1958
  // this.isHiddenPaginator = this.filterInfo.pageNumber === 0 && this.total <= this.filterInfo.pageSize;
1959
- this.items.forEach(function (item) { return item.originItem = Object.assign({}, item); });
1959
+ this.items.forEach(function (item) {
1960
+ item.originItem = Object.assign({}, item);
1961
+ item.sdId = hash__namespace(item);
1962
+ });
1960
1963
  return [4 /*yield*/, ((_c = (_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.reload) === null || _b === void 0 ? void 0 : _b.onReload) === null || _c === void 0 ? void 0 : _c.call(_b, this.items))];
1961
1964
  case 1:
1962
1965
  _t.sent();
@@ -2607,7 +2610,7 @@
2607
2610
  return false;
2608
2611
  }).map(function (item) {
2609
2612
  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 Object.assign(Object.assign({}, result), { editorErrorMessage: editorHandlerRow === null || editorHandlerRow === void 0 ? void 0 : editorHandlerRow.errorMessage });
2613
+ return Object.assign(Object.assign({}, result), { editorErrorMessage: item.editorErrorMessage });
2611
2614
  });
2612
2615
  },
2613
2616
  enumerable: false,
@@ -3742,16 +3745,10 @@
3742
3745
  },] }
3743
3746
  ];
3744
3747
 
3748
+ var _visible;
3745
3749
  var SdEditorHandlerColumnPipe = /** @class */ (function () {
3746
3750
  function SdEditorHandlerColumnPipe() {
3747
- }
3748
- SdEditorHandlerColumnPipe.prototype.transform = function (value, item, column, gridOption) {
3749
- var e_1, _c;
3750
- if (column.type === 'children' || column.type === 'children-col') {
3751
- return;
3752
- }
3753
- var columns = gridOption.columns;
3754
- var visible = function (col) {
3751
+ _visible.set(this, function (col, item) {
3755
3752
  if (col.type === 'children' || col.type === 'children-col') {
3756
3753
  return false;
3757
3754
  }
@@ -3763,13 +3760,21 @@
3763
3760
  }
3764
3761
  }
3765
3762
  return true;
3766
- };
3763
+ });
3764
+ }
3765
+ SdEditorHandlerColumnPipe.prototype.transform = function (value, item, column, gridOption) {
3766
+ var e_1, _c;
3767
+ console.log(value, column.field);
3768
+ if (column.type === 'children' || column.type === 'children-col') {
3769
+ return;
3770
+ }
3771
+ var columns = gridOption.columns;
3767
3772
  item.editorHandlerColumn = item.editorHandlerColumn || {};
3768
- item.editorHandlerColumn[column.field] = Object.assign(Object.assign({}, item.editorHandlerColumn[column.field]), { visible: visible(column) });
3773
+ item.editorHandlerColumn[column.field] = Object.assign(Object.assign({}, item.editorHandlerColumn[column.field]), { visible: __classPrivateFieldGet(this, _visible).call(this, column, item) });
3769
3774
  try {
3770
3775
  for (var _d = __values(columns.filter(function (e) { var _a, _b; return (_b = (_a = column.editor) === null || _a === void 0 ? void 0 : _a.relatedColumns) === null || _b === void 0 ? void 0 : _b.includes(e.field); })), _e = _d.next(); !_e.done; _e = _d.next()) {
3771
3776
  var col = _e.value;
3772
- item.editorHandlerColumn[col.field] = Object.assign(Object.assign({}, item.editorHandlerColumn[col.field]), { visible: visible(col) });
3777
+ item.editorHandlerColumn[col.field] = Object.assign(Object.assign({}, item.editorHandlerColumn[col.field]), { visible: __classPrivateFieldGet(this, _visible).call(this, col, item) });
3773
3778
  }
3774
3779
  }
3775
3780
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -3784,47 +3789,39 @@
3784
3789
  };
3785
3790
  return SdEditorHandlerColumnPipe;
3786
3791
  }());
3792
+ _visible = new WeakMap();
3787
3793
  SdEditorHandlerColumnPipe.decorators = [
3788
3794
  { type: core.Pipe, args: [{
3789
3795
  name: 'sdEditorHandlerColumn'
3790
3796
  },] }
3791
3797
  ];
3792
3798
 
3799
+ var _previous, _delay;
3793
3800
  var SdEditorValidatePipe = /** @class */ (function () {
3794
3801
  function SdEditorValidatePipe() {
3795
- 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
3802
+ _previous.set(this, void 0);
3803
+ _delay.set(this, 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
3796
3804
  }
3797
3805
  SdEditorValidatePipe.prototype.transform = function (sdId, item, gridOption) {
3798
3806
  return __awaiter(this, void 0, void 0, function () {
3799
- var editor, now, dif, result, _a;
3800
- var _this = this;
3807
+ var editor, result, _a;
3801
3808
  return __generator(this, function (_b) {
3802
3809
  switch (_b.label) {
3803
3810
  case 0:
3804
3811
  editor = gridOption.editor;
3805
- item.editorHandlerRow = item.editorHandlerRow || {};
3806
3812
  if (!editor.validate) {
3807
- item.editorHandlerRow.errorMessage = null;
3808
- return [2 /*return*/];
3809
- }
3810
- this.previous = new Date();
3811
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, _this.delay); })];
3812
- case 1:
3813
- _b.sent();
3814
- now = new Date();
3815
- dif = now.getTime() - this.previous.getTime();
3816
- if (dif < this.delay) {
3813
+ item.editorErrorMessage = null;
3817
3814
  return [2 /*return*/];
3818
3815
  }
3819
3816
  result = editor.validate(item);
3820
- if (!(result instanceof Promise)) return [3 /*break*/, 3];
3821
- _a = item.editorHandlerRow;
3817
+ if (!(result instanceof Promise)) return [3 /*break*/, 2];
3818
+ _a = item;
3822
3819
  return [4 /*yield*/, result];
3823
- case 2:
3824
- _a.errorMessage = _b.sent();
3820
+ case 1:
3821
+ _a.editorErrorMessage = _b.sent();
3825
3822
  return [2 /*return*/];
3826
- case 3:
3827
- item.editorHandlerRow.errorMessage = result;
3823
+ case 2:
3824
+ item.editorErrorMessage = result;
3828
3825
  return [2 /*return*/];
3829
3826
  }
3830
3827
  });
@@ -3832,6 +3829,7 @@
3832
3829
  };
3833
3830
  return SdEditorValidatePipe;
3834
3831
  }());
3832
+ _previous = new WeakMap(), _delay = new WeakMap();
3835
3833
  SdEditorValidatePipe.decorators = [
3836
3834
  { type: core.Pipe, args: [{
3837
3835
  name: 'sdEditorValidate'
@@ -3861,7 +3859,7 @@
3861
3859
  SdDesktopEditorValidation.decorators = [
3862
3860
  { type: core.Component, args: [{
3863
3861
  selector: 'sd-desktop-editor-validation',
3864
- template: "<ng-container *sdLet=\"item.sdId | sdEditorValidate:item:gridOption\">\r\n <div class=\"c-editor-validation\" [class.c-danger]=\"!!item.editorHandlerRow?.errorMessage\" matTooltipPosition=\"after\"\r\n [matTooltip]=\"item.editorHandlerRow?.errorMessage\">\r\n </div>\r\n</ng-container>",
3862
+ template: "<ng-container *sdLet=\"item.sdId | sdEditorValidate:item:gridOption\">\r\n <div class=\"c-editor-validation\" [class.c-danger]=\"!!item.editorErrorMessage\" matTooltipPosition=\"after\"\r\n [matTooltip]=\"item.editorErrorMessage\">\r\n </div>\r\n</ng-container>",
3865
3863
  changeDetection: core.ChangeDetectionStrategy.OnPush,
3866
3864
  styles: [":host{height:100%;left:0;position:absolute;top:0}:host .c-editor-validation{height:100%;max-width:4px;min-width:4px;width:4px}:host .c-danger{background-color:#f82c13}"]
3867
3865
  },] }