@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.
@@ -1356,7 +1356,10 @@ class SdGridMaterial {
1356
1356
  this.items = (args === null || args === void 0 ? void 0 : args.items) || [];
1357
1357
  this.total = (args === null || args === void 0 ? void 0 : args.total) || 0;
1358
1358
  // this.isHiddenPaginator = this.filterInfo.pageNumber === 0 && this.total <= this.filterInfo.pageSize;
1359
- this.items.forEach(item => item.originItem = Object.assign({}, item));
1359
+ this.items.forEach((item) => {
1360
+ item.originItem = Object.assign({}, item);
1361
+ item.sdId = hash(item);
1362
+ });
1360
1363
  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));
1361
1364
  this.isSelectAll = this.items.every(e => e.isSelected);
1362
1365
  __classPrivateFieldGet(this, _updateSelectedItems).call(this);
@@ -1883,7 +1886,7 @@ class SdGridMaterial {
1883
1886
  return false;
1884
1887
  }).map(item => {
1885
1888
  const { editorStatus, editorHandlerRow, editorHandlerColumn, expandDetail, isExpanded, isExpanding, isSelected, originItem } = item, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem"]);
1886
- return Object.assign(Object.assign({}, result), { editorErrorMessage: editorHandlerRow === null || editorHandlerRow === void 0 ? void 0 : editorHandlerRow.errorMessage });
1889
+ return Object.assign(Object.assign({}, result), { editorErrorMessage: item.editorErrorMessage });
1887
1890
  });
1888
1891
  }
1889
1892
  get gridItems() {
@@ -2811,13 +2814,10 @@ SdEditorHandlerRowPipe.decorators = [
2811
2814
  },] }
2812
2815
  ];
2813
2816
 
2817
+ var _visible;
2814
2818
  class SdEditorHandlerColumnPipe {
2815
- transform(value, item, column, gridOption) {
2816
- if (column.type === 'children' || column.type === 'children-col') {
2817
- return;
2818
- }
2819
- const { columns } = gridOption;
2820
- const visible = (col) => {
2819
+ constructor() {
2820
+ _visible.set(this, (col, item) => {
2821
2821
  if (col.type === 'children' || col.type === 'children-col') {
2822
2822
  return false;
2823
2823
  }
@@ -2829,53 +2829,63 @@ class SdEditorHandlerColumnPipe {
2829
2829
  }
2830
2830
  }
2831
2831
  return true;
2832
- };
2832
+ });
2833
+ }
2834
+ transform(value, item, column, gridOption) {
2835
+ console.log(value, column.field);
2836
+ if (column.type === 'children' || column.type === 'children-col') {
2837
+ return;
2838
+ }
2839
+ const { columns } = gridOption;
2833
2840
  item.editorHandlerColumn = item.editorHandlerColumn || {};
2834
- item.editorHandlerColumn[column.field] = Object.assign(Object.assign({}, item.editorHandlerColumn[column.field]), { visible: visible(column) });
2841
+ item.editorHandlerColumn[column.field] = Object.assign(Object.assign({}, item.editorHandlerColumn[column.field]), { visible: __classPrivateFieldGet(this, _visible).call(this, column, item) });
2835
2842
  for (const col of columns.filter(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); })) {
2836
- item.editorHandlerColumn[col.field] = Object.assign(Object.assign({}, item.editorHandlerColumn[col.field]), { visible: visible(col) });
2843
+ item.editorHandlerColumn[col.field] = Object.assign(Object.assign({}, item.editorHandlerColumn[col.field]), { visible: __classPrivateFieldGet(this, _visible).call(this, col, item) });
2837
2844
  }
2838
2845
  item.sdId = hash(item);
2839
2846
  return true;
2840
2847
  }
2841
2848
  }
2849
+ _visible = new WeakMap();
2842
2850
  SdEditorHandlerColumnPipe.decorators = [
2843
2851
  { type: Pipe, args: [{
2844
2852
  name: 'sdEditorHandlerColumn'
2845
2853
  },] }
2846
2854
  ];
2847
2855
 
2856
+ var _previous, _delay;
2848
2857
  class SdEditorValidatePipe {
2849
2858
  constructor() {
2850
- 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
2859
+ _previous.set(this, void 0);
2860
+ _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
2851
2861
  }
2852
2862
  transform(sdId, item, gridOption) {
2853
2863
  return __awaiter(this, void 0, void 0, function* () {
2854
2864
  const { editor } = gridOption;
2855
- item.editorHandlerRow = item.editorHandlerRow || {};
2856
2865
  if (!editor.validate) {
2857
- item.editorHandlerRow.errorMessage = null;
2858
- return;
2859
- }
2860
- this.previous = new Date();
2861
- yield new Promise(resolve => setTimeout(resolve, this.delay));
2862
- const now = new Date();
2863
- const dif = now.getTime() - this.previous.getTime();
2864
- if (dif < this.delay) {
2866
+ item.editorErrorMessage = null;
2865
2867
  return;
2866
2868
  }
2869
+ // this.#previous = new Date();
2870
+ // await new Promise(resolve => setTimeout(resolve, this.#delay));
2871
+ // const now = new Date();
2872
+ // const dif = now.getTime() - this.#previous.getTime();
2873
+ // if (dif < this.#delay) {
2874
+ // return;
2875
+ // }
2867
2876
  const result = editor.validate(item);
2868
2877
  if (result instanceof Promise) {
2869
- item.editorHandlerRow.errorMessage = yield result;
2878
+ item.editorErrorMessage = yield result;
2870
2879
  return;
2871
2880
  }
2872
2881
  else {
2873
- item.editorHandlerRow.errorMessage = result;
2882
+ item.editorErrorMessage = result;
2874
2883
  return;
2875
2884
  }
2876
2885
  });
2877
2886
  }
2878
2887
  }
2888
+ _previous = new WeakMap(), _delay = new WeakMap();
2879
2889
  SdEditorValidatePipe.decorators = [
2880
2890
  { type: Pipe, args: [{
2881
2891
  name: 'sdEditorValidate'
@@ -2900,7 +2910,7 @@ class SdDesktopEditorValidation {
2900
2910
  SdDesktopEditorValidation.decorators = [
2901
2911
  { type: Component, args: [{
2902
2912
  selector: 'sd-desktop-editor-validation',
2903
- 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>",
2913
+ 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>",
2904
2914
  changeDetection: ChangeDetectionStrategy.OnPush,
2905
2915
  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}"]
2906
2916
  },] }