@sd-angular/core 1.3.9 → 1.3.11

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.
@@ -1837,7 +1837,7 @@
1837
1837
  { type: core.NgZone }
1838
1838
  ]; };
1839
1839
 
1840
- var _paginator, _sort, _subscription$1, _optionChanges, _reload, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
1840
+ var _localItems, _paginator, _sort, _subscription$1, _reload, _loadCompleted, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
1841
1841
  var SdGridMaterial = /** @class */ (function () {
1842
1842
  function SdGridMaterial(ref, configuration, gridConfigurationService, exportService, notifyService, translateService, columnValuesPipe, editorHandlerColumnPipe) {
1843
1843
  var _this = this;
@@ -1850,7 +1850,7 @@
1850
1850
  this.columnValuesPipe = columnValuesPipe;
1851
1851
  this.editorHandlerColumnPipe = editorHandlerColumnPipe;
1852
1852
  this.key = uuid.v4();
1853
- this.localItems = [];
1853
+ _localItems.set(this, []);
1854
1854
  this.items = [];
1855
1855
  this.selectedItems = [];
1856
1856
  // Loading
@@ -1874,11 +1874,11 @@
1874
1874
  this.columnFilter = {};
1875
1875
  // Subcription
1876
1876
  _subscription$1.set(this, new rxjs.Subscription());
1877
- _optionChanges.set(this, new core.EventEmitter());
1878
1877
  _reload.set(this, new rxjs.Subject());
1879
1878
  this.isExporting = false;
1880
1879
  this.isSelectAll = false;
1881
1880
  this.exportTitle = 'Export';
1881
+ _loadCompleted.set(this, false);
1882
1882
  _initCellDef.set(this, function () {
1883
1883
  var e_1, _2;
1884
1884
  _this.cellDef = {};
@@ -2095,37 +2095,38 @@
2095
2095
  _load$1.set(this, function (filterReq, force) {
2096
2096
  if (force === void 0) { force = true; }
2097
2097
  return __awaiter(_this, void 0, void 0, function () {
2098
- var result, results, _2, error_1;
2099
- return __generator(this, function (_3) {
2100
- switch (_3.label) {
2098
+ var result, results, _2, _3, error_1;
2099
+ return __generator(this, function (_4) {
2100
+ switch (_4.label) {
2101
2101
  case 0:
2102
2102
  this.isLoading = true;
2103
- _3.label = 1;
2103
+ _4.label = 1;
2104
2104
  case 1:
2105
- _3.trys.push([1, 8, 9, 10]);
2105
+ _4.trys.push([1, 8, 9, 10]);
2106
2106
  if (!(this.gridOption.type === 'server')) return [3 /*break*/, 3];
2107
2107
  result = this.gridOption.items(filterReq);
2108
2108
  if (rxjs.isObservable(result)) {
2109
2109
  result = result.toPromise();
2110
2110
  }
2111
2111
  return [4 /*yield*/, result];
2112
- case 2: return [2 /*return*/, _3.sent()];
2112
+ case 2: return [2 /*return*/, _4.sent()];
2113
2113
  case 3:
2114
2114
  if (!force) return [3 /*break*/, 6];
2115
2115
  results = this.gridOption.items();
2116
2116
  if (!(results instanceof Promise)) return [3 /*break*/, 5];
2117
- _2 = this;
2117
+ _2 = __classPrivateFieldSet;
2118
+ _3 = [this, _localItems];
2118
2119
  return [4 /*yield*/, results];
2119
2120
  case 4:
2120
- _2.localItems = _3.sent();
2121
+ _2.apply(void 0, _3.concat([_4.sent()]));
2121
2122
  return [3 /*break*/, 6];
2122
2123
  case 5:
2123
- this.localItems = results;
2124
- _3.label = 6;
2125
- case 6: return [2 /*return*/, __classPrivateFieldGet(this, _filterLocal).call(this, this.localItems, filterReq)];
2124
+ __classPrivateFieldSet(this, _localItems, results);
2125
+ _4.label = 6;
2126
+ case 6: return [2 /*return*/, __classPrivateFieldGet(this, _filterLocal).call(this, __classPrivateFieldGet(this, _localItems), filterReq)];
2126
2127
  case 7: return [3 /*break*/, 10];
2127
2128
  case 8:
2128
- error_1 = _3.sent();
2129
+ error_1 = _4.sent();
2129
2130
  this.notifyService.handle.error(error_1);
2130
2131
  return [3 /*break*/, 10];
2131
2132
  case 9:
@@ -2727,7 +2728,7 @@
2727
2728
  }
2728
2729
  });
2729
2730
  if (type === 'local') {
2730
- (_a = editor.onAdd) === null || _a === void 0 ? void 0 : _a.call(editor, item, _this.localItems);
2731
+ (_a = editor.onAdd) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(_this, _localItems));
2731
2732
  }
2732
2733
  else {
2733
2734
  (_b = editor.onAdd) === null || _b === void 0 ? void 0 : _b.call(editor, item, _this.items);
@@ -2736,13 +2737,13 @@
2736
2737
  if (editor.type !== 'popup') {
2737
2738
  if (editor.addToLast) {
2738
2739
  if (type === 'local') {
2739
- _this.localItems = __spread(_this.localItems, [item]);
2740
+ __classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems), [item]));
2740
2741
  }
2741
2742
  _this.items = __spread(_this.items, [item]);
2742
2743
  }
2743
2744
  else {
2744
2745
  if (type === 'local') {
2745
- _this.localItems = __spread([item], _this.localItems);
2746
+ __classPrivateFieldSet(_this, _localItems, __spread([item], __classPrivateFieldGet(_this, _localItems)));
2746
2747
  }
2747
2748
  _this.items = __spread([item], _this.items);
2748
2749
  }
@@ -2825,15 +2826,15 @@
2825
2826
  var editor = _this.gridOption.editor;
2826
2827
  if (editor.type === 'inline') {
2827
2828
  if (_this.gridOption.type === 'local') {
2828
- var idx2 = _this.localItems.indexOf(item);
2829
- _this.localItems.splice(idx2, 1);
2830
- _this.localItems = __spread(_this.localItems);
2829
+ var idx2 = __classPrivateFieldGet(_this, _localItems).indexOf(item);
2830
+ __classPrivateFieldGet(_this, _localItems).splice(idx2, 1);
2831
+ __classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems)));
2831
2832
  }
2832
2833
  var idx1 = _this.items.indexOf(item);
2833
2834
  _this.items.splice(idx1, 1);
2834
2835
  _this.items = __spread(_this.items);
2835
2836
  if (_this.gridOption.type === 'local') {
2836
- (_a = editor === null || editor === void 0 ? void 0 : editor.onCancel) === null || _a === void 0 ? void 0 : _a.call(editor, item, _this.localItems);
2837
+ (_a = editor === null || editor === void 0 ? void 0 : editor.onCancel) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(_this, _localItems));
2837
2838
  }
2838
2839
  else {
2839
2840
  (_b = editor === null || editor === void 0 ? void 0 : editor.onCancel) === null || _b === void 0 ? void 0 : _b.call(editor, item, _this.items);
@@ -2844,9 +2845,9 @@
2844
2845
  if (editor.type === 'focus') {
2845
2846
  if (item.editorStatus === 'create') {
2846
2847
  if (_this.gridOption.type === 'local') {
2847
- var idx2 = _this.localItems.indexOf(item);
2848
- _this.localItems.splice(idx2, 1);
2849
- _this.localItems = __spread(_this.localItems);
2848
+ var idx2 = __classPrivateFieldGet(_this, _localItems).indexOf(item);
2849
+ __classPrivateFieldGet(_this, _localItems).splice(idx2, 1);
2850
+ __classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems)));
2850
2851
  }
2851
2852
  var idx1 = _this.items.indexOf(item);
2852
2853
  _this.items.splice(idx1, 1);
@@ -2864,15 +2865,15 @@
2864
2865
  var editor = _this.gridOption.editor;
2865
2866
  if (editor.type === 'inline') {
2866
2867
  if (_this.gridOption.type === 'local') {
2867
- var idx2 = _this.localItems.indexOf(item);
2868
- _this.localItems.splice(idx2, 1);
2869
- _this.localItems = __spread(_this.localItems);
2868
+ var idx2 = __classPrivateFieldGet(_this, _localItems).indexOf(item);
2869
+ __classPrivateFieldGet(_this, _localItems).splice(idx2, 1);
2870
+ __classPrivateFieldSet(_this, _localItems, __spread(__classPrivateFieldGet(_this, _localItems)));
2870
2871
  }
2871
2872
  var idx1 = _this.items.indexOf(item);
2872
2873
  _this.items.splice(idx1, 1);
2873
2874
  _this.items = __spread(_this.items);
2874
2875
  if (_this.gridOption.type === 'local') {
2875
- (_a = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _a === void 0 ? void 0 : _a.call(editor, item, _this.localItems);
2876
+ (_a = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(_this, _localItems));
2876
2877
  }
2877
2878
  else {
2878
2879
  (_b = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _b === void 0 ? void 0 : _b.call(editor, item, _this.items);
@@ -2913,7 +2914,6 @@
2913
2914
  var _this = this;
2914
2915
  if (gridFilter && this.gridFilter !== gridFilter) {
2915
2916
  this.gridFilter = gridFilter;
2916
- __classPrivateFieldGet(this, _reload).next(false);
2917
2917
  __classPrivateFieldGet(this, _subscription$1).add(gridFilter.filterChange.pipe(operators.map(function () {
2918
2918
  __classPrivateFieldGet(_this, _paginator).pageIndex = 0;
2919
2919
  __classPrivateFieldGet(_this, _reload).next(false);
@@ -2930,6 +2930,7 @@
2930
2930
  if (option) {
2931
2931
  option = __classPrivateFieldGet(this, _initConfiguration).call(this, option);
2932
2932
  this.gridOption = option;
2933
+ __classPrivateFieldSet(this, _loadCompleted, false);
2933
2934
  __classPrivateFieldGet(this, _reload).next(true);
2934
2935
  (_a = option === null || option === void 0 ? void 0 : option.columns) === null || _a === void 0 ? void 0 : _a.forEach(function (col) {
2935
2936
  var _a;
@@ -2976,10 +2977,20 @@
2976
2977
  };
2977
2978
  SdGridMaterial.prototype.ngAfterViewInit = function () {
2978
2979
  var _this = this;
2979
- __classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _reload).pipe(operators.startWith(true), operators.debounceTime(200), operators.switchMap(function (force) {
2980
- var filterInfo = __classPrivateFieldGet(_this, _getFilter).call(_this);
2981
- return __classPrivateFieldGet(_this, _load$1).call(_this, filterInfo, force);
2982
- })).subscribe(__classPrivateFieldGet(this, _render)));
2980
+ __classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _reload).pipe(operators.debounceTime(200), operators.startWith(true), operators.switchMap(function (force) { return __awaiter(_this, void 0, void 0, function () {
2981
+ var filterInfo, result;
2982
+ return __generator(this, function (_2) {
2983
+ switch (_2.label) {
2984
+ case 0:
2985
+ filterInfo = __classPrivateFieldGet(this, _getFilter).call(this);
2986
+ return [4 /*yield*/, __classPrivateFieldGet(this, _load$1).call(this, filterInfo, !__classPrivateFieldGet(this, _loadCompleted) || force)];
2987
+ case 1:
2988
+ result = _2.sent();
2989
+ __classPrivateFieldSet(this, _loadCompleted, true);
2990
+ return [2 /*return*/, result];
2991
+ }
2992
+ });
2993
+ }); })).subscribe(__classPrivateFieldGet(this, _render)));
2983
2994
  __classPrivateFieldGet(this, _subscription$1).add(this.sdCellDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
2984
2995
  __classPrivateFieldGet(this, _subscription$1).add(this.sdFooterDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
2985
2996
  __classPrivateFieldGet(this, _subscription$1).add(this.sdFilterDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
@@ -3034,7 +3045,7 @@
3034
3045
  });
3035
3046
  return SdGridMaterial;
3036
3047
  }());
3037
- _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$1 = new WeakMap(), _optionChanges = new WeakMap(), _reload = 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();
3048
+ _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$1 = new WeakMap(), _reload = new WeakMap(), _loadCompleted = 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();
3038
3049
  SdGridMaterial.decorators = [
3039
3050
  { type: core.Component, args: [{
3040
3051
  selector: 'sd-grid-material',