tnx-shared 5.3.182 → 5.3.184

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.
@@ -1116,6 +1116,7 @@
1116
1116
  this.disableViewWorkflowAttach = false;
1117
1117
  this.hiddenWorkflowCoreStatus = true;
1118
1118
  this.requiredVanBanDiAfterTrinhKy = false;
1119
+ this.disableLazyLoadCommonSearch = false;
1119
1120
  this.showExportAll = false;
1120
1121
  this.showExportSelectedItems = true;
1121
1122
  this.showExportWordSelectedItems = false;
@@ -1364,6 +1365,7 @@
1364
1365
  _this.isHtmlLabel = false;
1365
1366
  _this.isHorizontallyLabel = false;
1366
1367
  _this.order = 0;
1368
+ _this.isLazyLoad = false;
1367
1369
  for (var key in init) {
1368
1370
  _this[key] = init[key];
1369
1371
  }
@@ -2047,7 +2049,6 @@
2047
2049
  _this.searchMultiple = true;
2048
2050
  _this.disableDisplayFieldServerSearch = false;
2049
2051
  _this.loadOnInit = false;
2050
- _this.isLazyLoad = false;
2051
2052
  _this.allowLoadDataWhenParentNull = false;
2052
2053
  _this.disabledParentItem = true;
2053
2054
  for (var key in init) {
@@ -19067,6 +19068,9 @@
19067
19068
  DataFormBase.prototype.showMessageAfterInsert = function (isSuccess, error) {
19068
19069
  if (isSuccess === void 0) { isSuccess = false; }
19069
19070
  if (isSuccess) {
19071
+ if (!this.messageInsertSuccess) {
19072
+ this.messageInsertSuccess = this._translateService.instant('MESSAGE.INSERT_DATA_SUCCESS');
19073
+ }
19070
19074
  if (this.messageInsertSuccess) {
19071
19075
  this._notifierService.showSuccess(this.messageInsertSuccess);
19072
19076
  }
@@ -19078,6 +19082,8 @@
19078
19082
  DataFormBase.prototype.showMessageAfterUpdate = function (isSuccess, error) {
19079
19083
  if (isSuccess === void 0) { isSuccess = false; }
19080
19084
  if (isSuccess) {
19085
+ if (!this.messageUpdateSuccess)
19086
+ this.messageUpdateSuccess = this._translateService.instant('MESSAGE.UPDATE_DATA_SUCCESS');
19081
19087
  if (this.messageUpdateSuccess) {
19082
19088
  this._notifierService.showSuccess(this.messageUpdateSuccess);
19083
19089
  }
@@ -31640,6 +31646,7 @@
31640
31646
  _this.lstBoolControl = [];
31641
31647
  _this.lstControlNotIn = [];
31642
31648
  _this.lstControlAddToGridInfo = [];
31649
+ _this.lstControlLazyLoad = [];
31643
31650
  _this.defaultValues = {};
31644
31651
  _this.isAddDefaultValues = false;
31645
31652
  _this.mapControlBindingFilter = new Map();
@@ -31669,7 +31676,6 @@
31669
31676
  this.searchBoxTooltip += "" + (lstTextSearchControl.map(function (x) { return x.label; })).join(', ');
31670
31677
  }
31671
31678
  if (this.isCustomGenerateSearch) {
31672
- this.lstControlAddToGridInfo = this.parentSetting.commonSchemas.filter(function (p) { return p.addToGridInfo; }).map(function (p) { return p.field; });
31673
31679
  this.parentSetting.commonSchemas.forEach(function (column) {
31674
31680
  column.showLabel = false;
31675
31681
  column.mdWidth = _this.mdWidth;
@@ -31682,28 +31688,36 @@
31682
31688
  if (column instanceof NumberRangeControlSchema) {
31683
31689
  _this.lstNumberRangeControl.push(column.field);
31684
31690
  }
31691
+ if (column.hasOwnProperty('defaultValue') && (column instanceof DropdownControlSchema || column instanceof DateTimeControlSchema)) {
31692
+ _this.defaultValues[column.field] = column.defaultValue;
31693
+ }
31694
+ if (column.addToGridInfo) {
31695
+ _this.lstControlAddToGridInfo.push(column.field);
31696
+ }
31685
31697
  });
31686
- this.setting.schema = this.addSearchBox(this.parentSetting.commonSchemas.sort(function (prev, next) { return prev.order - next.order; }));
31687
- this.genFormSchema(this.parentSetting.commonSchemas);
31698
+ this.setting.schema = this.genFormSchema(this.parentSetting.commonSchemas);
31688
31699
  }
31689
31700
  else {
31690
31701
  this.setting.schema = this.genFormSchema(columnFilters);
31691
31702
  }
31692
31703
  this.isDisableOpenFull = this.setting.schema.length <= 4 && !this._commonService.isMobile();
31693
31704
  _super.prototype.ngOnInit.call(this);
31694
- var controlSetDefaultValue = this.setting.schema.filter(function (p) { return p.hasOwnProperty('defaultValue') && (p instanceof DropdownControlSchema || p instanceof DateTimeControlSchema); });
31695
- if (controlSetDefaultValue.length) {
31696
- controlSetDefaultValue.forEach(function (item) {
31697
- _this.defaultValues[item.field] = item.defaultValue;
31698
- });
31705
+ if (Object.keys(this.defaultValues).length) {
31699
31706
  this.handleSearch();
31700
31707
  }
31701
31708
  };
31702
31709
  CommonSearchFormComponent.prototype.genFormSchema = function (columns) {
31703
31710
  var _this = this;
31704
31711
  var result = [];
31712
+ var totalControlPerRow = 12 / this.mdWidth;
31713
+ var i = 1;
31705
31714
  columns.forEach(function (column) {
31706
31715
  var _a;
31716
+ var isLazyLoad = !_this.parentSetting.disableLazyLoadCommonSearch && i > totalControlPerRow
31717
+ && column instanceof DropdownControlSchema && !!column.baseService && column.baseService instanceof BaseService;
31718
+ if (isLazyLoad) {
31719
+ _this.lstControlLazyLoad.push(column.field);
31720
+ }
31707
31721
  if (!column.isInTable || !column.includeSelect) {
31708
31722
  _this.lstControlNotIn.push(column.field);
31709
31723
  }
@@ -31721,7 +31735,7 @@
31721
31735
  });
31722
31736
  }
31723
31737
  if (column.baseService || (dataSource && dataSource.length > 0)) {
31724
- result.push(new DropdownControlSchema(Object.assign(Object.assign({}, column), { placeholder: (_a = column.placeholder) !== null && _a !== void 0 ? _a : "Ch\u1ECDn " + column.label, multiple: !column.single, dataSource: dataSource, mdWidth: _this.mdWidth, showLabel: false, loadOnInit: true, showClear: true, onChanged: function (evt) {
31738
+ result.push(new DropdownControlSchema(Object.assign(Object.assign({}, column), { placeholder: (_a = column.placeholder) !== null && _a !== void 0 ? _a : "Ch\u1ECDn " + column.label, multiple: !column.single, dataSource: dataSource, mdWidth: _this.mdWidth, showLabel: false, isLazyLoad: isLazyLoad, showClear: true, onChanged: function (evt) {
31725
31739
  var _a;
31726
31740
  if (column.dataType == exports.DataType.boolean) {
31727
31741
  evt.parentModel[column.field] = column.single ? (_a = evt.value.id) !== null && _a !== void 0 ? _a : evt.value : evt.value.map(function (p) { return p.id; });
@@ -31770,6 +31784,7 @@
31770
31784
  break;
31771
31785
  }
31772
31786
  }
31787
+ i++;
31773
31788
  });
31774
31789
  return this.addSearchBox(result.sort(function (prev, next) { return prev.order - next.order; }));
31775
31790
  };
@@ -31782,7 +31797,7 @@
31782
31797
  label: 'Từ khóa',
31783
31798
  fullLabel: 'Từ khóa',
31784
31799
  showLabel: false,
31785
- mdWidth: this.mdWidth
31800
+ mdWidth: this.mdWidth,
31786
31801
  });
31787
31802
  var index = Number(12 / this.mdWidth) - 1;
31788
31803
  if (this._commonService.isMobile()) {
@@ -31879,8 +31894,29 @@
31879
31894
  };
31880
31895
  CommonSearchFormComponent.prototype.toggleMenuSearch = function () {
31881
31896
  this.isOpenFull = !this.isOpenFull;
31897
+ if (this.lstControlLazyLoad.length) {
31898
+ this.triggerLazyLoadDropdown();
31899
+ }
31882
31900
  this.onAfterToggleMenuSearch.emit(true);
31883
31901
  };
31902
+ CommonSearchFormComponent.prototype.triggerLazyLoadDropdown = function () {
31903
+ return __awaiter(this, void 0, void 0, function () {
31904
+ var promises;
31905
+ var _this = this;
31906
+ return __generator(this, function (_b) {
31907
+ switch (_b.label) {
31908
+ case 0:
31909
+ promises = [];
31910
+ this.lstControlLazyLoad.forEach(function (control) { return promises.push(_this.formControls[control]._component._getDataSource()); });
31911
+ return [4 /*yield*/, Promise.all(promises)];
31912
+ case 1:
31913
+ _b.sent();
31914
+ this.lstControlLazyLoad = [];
31915
+ return [2 /*return*/];
31916
+ }
31917
+ });
31918
+ });
31919
+ };
31884
31920
  CommonSearchFormComponent.prototype.onFormInitialized = function (formEvent) {
31885
31921
  return __awaiter(this, void 0, void 0, function () {
31886
31922
  return __generator(this, function (_b) {
@@ -32134,7 +32170,7 @@
32134
32170
  this.createFilterFunction();
32135
32171
  this.createSearchSubscription();
32136
32172
  }
32137
- if (this.control.loadOnInit) {
32173
+ if (this.control.loadOnInit && !this.control.isLazyLoad) {
32138
32174
  this._getData();
32139
32175
  }
32140
32176
  }