@sd-angular/core 0.0.945 → 0.0.946

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.
@@ -2375,7 +2375,7 @@
2375
2375
  (_a = _this.gridFilter) === null || _a === void 0 ? void 0 : _a.setFilter(args);
2376
2376
  };
2377
2377
  this.onCreate = function () {
2378
- var _a;
2378
+ var _a, _b;
2379
2379
  var _t = _this.gridOption, type = _t.type, editor = _t.editor, columns = _t.columns;
2380
2380
  if (!(editor === null || editor === void 0 ? void 0 : editor.addable)) {
2381
2381
  return;
@@ -2393,11 +2393,16 @@
2393
2393
  item[column.field] = null;
2394
2394
  }
2395
2395
  });
2396
- (_a = editor.onAdd) === null || _a === void 0 ? void 0 : _a.call(editor, item);
2396
+ if (type === 'local') {
2397
+ (_a = editor.onAdd) === null || _a === void 0 ? void 0 : _a.call(editor, item, _this.localItems);
2398
+ }
2399
+ else {
2400
+ (_b = editor.onAdd) === null || _b === void 0 ? void 0 : _b.call(editor, item, _this.items);
2401
+ }
2397
2402
  // Đưa item lên dòng đầu tiên nếu type khác popup
2398
2403
  if (editor.type !== 'popup') {
2399
2404
  if (type === 'local') {
2400
- _this.localItems = __spread([item], _this.items);
2405
+ _this.localItems = __spread([item], _this.localItems);
2401
2406
  }
2402
2407
  _this.items = __spread([item], _this.items);
2403
2408
  }
@@ -3804,7 +3809,8 @@
3804
3809
  }
3805
3810
  SdEditorValidatePipe.prototype.transform = function (sdId, item, gridOption) {
3806
3811
  return __awaiter(this, void 0, void 0, function () {
3807
- var editor, result, _a;
3812
+ var editor, now, dif, result, _a;
3813
+ var _this = this;
3808
3814
  return __generator(this, function (_b) {
3809
3815
  switch (_b.label) {
3810
3816
  case 0:
@@ -3813,14 +3819,23 @@
3813
3819
  item.editorErrorMessage = null;
3814
3820
  return [2 /*return*/];
3815
3821
  }
3822
+ __classPrivateFieldSet(this, _previous, new Date());
3823
+ return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, __classPrivateFieldGet(_this, _delay)); })];
3824
+ case 1:
3825
+ _b.sent();
3826
+ now = new Date();
3827
+ dif = now.getTime() - __classPrivateFieldGet(this, _previous).getTime();
3828
+ if (dif < __classPrivateFieldGet(this, _delay)) {
3829
+ return [2 /*return*/];
3830
+ }
3816
3831
  result = editor.validate(item);
3817
- if (!(result instanceof Promise)) return [3 /*break*/, 2];
3832
+ if (!(result instanceof Promise)) return [3 /*break*/, 3];
3818
3833
  _a = item;
3819
3834
  return [4 /*yield*/, result];
3820
- case 1:
3835
+ case 2:
3821
3836
  _a.editorErrorMessage = _b.sent();
3822
3837
  return [2 /*return*/];
3823
- case 2:
3838
+ case 3:
3824
3839
  item.editorErrorMessage = result;
3825
3840
  return [2 /*return*/];
3826
3841
  }
@@ -3859,7 +3874,7 @@
3859
3874
  SdDesktopEditorValidation.decorators = [
3860
3875
  { type: core.Component, args: [{
3861
3876
  selector: 'sd-desktop-editor-validation',
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>",
3877
+ template: "<ng-container *sdLet=\"item.sdId | sdEditorValidate:item:gridOption | async\">\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>",
3863
3878
  changeDetection: core.ChangeDetectionStrategy.OnPush,
3864
3879
  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}"]
3865
3880
  },] }