tnx-shared 5.1.422 → 5.1.423

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.
@@ -829,6 +829,13 @@
829
829
  this.function = new CrudListCustomFunction();
830
830
  this.popupHeader = '';
831
831
  this.popupSize = new PopupSize();
832
+ /**
833
+ * Auto generate gridInfo.fields using setting.cols + dataList.addtionalFields
834
+ * @date 11/4/2022 - 2:04:31 PM
835
+ *
836
+ * @type {?boolean}
837
+ */
838
+ this.autoGenerateSelectFields = false;
832
839
  this.modifyRowDataForTask = function (rowData) { return ({}); };
833
840
  this.modifyItemTask = function (modelTask, rowData) { return ({}); };
834
841
  this.getCustomDataTrinhKy = function (rowData) { return ({}); };
@@ -1914,6 +1921,20 @@
1914
1921
  _this.asyncPipe = true;
1915
1922
  _this.sort = true;
1916
1923
  _this.extendData = {};
1924
+ /**
1925
+ * Is this column ref a ref column generated by base
1926
+ * @date 11/4/2022 - 2:05:55 PM
1927
+ *
1928
+ * @type {?boolean}
1929
+ */
1930
+ _this.isRefField = false;
1931
+ /**
1932
+ * should include this col in the gridInfo.fields
1933
+ * @date 11/4/2022 - 2:06:16 PM
1934
+ *
1935
+ * @type {?boolean}
1936
+ */
1937
+ _this.includeSelect = true;
1917
1938
  _this.hasOperatorCanBo = false;
1918
1939
  _this.minimizeFilter = false;
1919
1940
  for (var key in init) {
@@ -2450,6 +2471,7 @@
2450
2471
  var _this = this;
2451
2472
  this.cleanupSessionStorage();
2452
2473
  this.cleanupLocalStorage();
2474
+ // this.clearLocalToken();
2453
2475
  // save the current page before redirect to issuer
2454
2476
  if (!localStorage.getItem('currentUrl')) {
2455
2477
  localStorage.setItem('currentUrl', top.location.href);
@@ -2493,6 +2515,9 @@
2493
2515
  AuthenService.prototype.getAccessToken = function () {
2494
2516
  return this._oauthService.getAccessToken();
2495
2517
  };
2518
+ AuthenService.prototype.clearLocalToken = function () {
2519
+ localStorage.removeItem('access_token');
2520
+ };
2496
2521
  AuthenService.prototype.cleanupSessionStorage = function () {
2497
2522
  Object.keys(sessionStorage).filter(function (item) { return /^AUTHORIZATION/.test(item) || /^V4_AUTHORIZATION/.test(item); }).forEach(function (item) {
2498
2523
  sessionStorage.removeItem(item);
@@ -20832,6 +20857,7 @@
20832
20857
  _this.sourceIcon = {};
20833
20858
  _this.stopCalculatingFunctionColumnWidth = false;
20834
20859
  _this.FileUploadMode = exports.FileUploadMode;
20860
+ _this.Operator = exports.Operator;
20835
20861
  _this._unSubscribeAll = new rxjs.Subject();
20836
20862
  _this.handleSelectRow = function (evt, data) {
20837
20863
  if (_this.setting.hasCustomHandleClickRow) {
@@ -21345,7 +21371,7 @@
21345
21371
  if (element.displayField == null) {
21346
21372
  element.displayField = 'ten';
21347
21373
  }
21348
- tmpCol = new ColumnSchemaBase(Object.assign(Object.assign({}, element), { rawColumn: element, controlType: exports.ControlType.dropdown, dataType: element.dataTypeRefField, field: 'str' + element.field, allowFilter: element.allowFilter, sort: false, visible: true }));
21374
+ tmpCol = new ColumnSchemaBase(Object.assign(Object.assign({}, element), { isRefField: true, rawColumn: element, controlType: exports.ControlType.dropdown, dataType: element.dataTypeRefField, field: 'str' + element.field, allowFilter: element.allowFilter, sort: false, visible: true }));
21349
21375
  var configRefField = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == tmpCol.field; });
21350
21376
  if (configRefField && configRefField.visible != null) {
21351
21377
  tmpCol.visible = configRefField.visible;
@@ -21361,7 +21387,7 @@
21361
21387
  element.controlType = exports.ControlType.dropdown;
21362
21388
  if (!element.rawColumn) {
21363
21389
  this_1.setting.fieldNeedGetRef.push(Object.assign({}, element));
21364
- tmpCol = new ColumnSchemaBase(Object.assign(Object.assign({}, element), { rawColumn: element, controlType: exports.ControlType.dropdown, dataType: element.dataTypeRefField, baseService: null, field: 'str' + element.field, allowFilter: element.allowFilter, sort: false, visible: true }));
21390
+ tmpCol = new ColumnSchemaBase(Object.assign(Object.assign({}, element), { isRefField: true, rawColumn: element, controlType: exports.ControlType.dropdown, dataType: element.dataTypeRefField, baseService: null, field: 'str' + element.field, allowFilter: element.allowFilter, sort: false, visible: true }));
21365
21391
  var configRefField = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == tmpCol.field; });
21366
21392
  if (configRefField && configRefField.visible != null) {
21367
21393
  tmpCol.visible = configRefField.visible;
@@ -22749,7 +22775,25 @@
22749
22775
  case exports.DataType.intWithoutMask:
22750
22776
  case exports.DataType.decimal:
22751
22777
  case exports.DataType.currency:
22752
- templateFilter.push.apply(templateFilter, __spread(_this.getRangeFilter(col)));
22778
+ if (col.operator === exports.Operator.equal) {
22779
+ templateFilter.push(new Filter({
22780
+ field: _this.getFieldFilter(col),
22781
+ operator: exports.Operator.equal,
22782
+ sourceField: col.field,
22783
+ funcGetValue: function (item) {
22784
+ if (col.max && item > col.max) {
22785
+ return col.max;
22786
+ }
22787
+ if (col.min && item < col.min) {
22788
+ return col.min;
22789
+ }
22790
+ return item;
22791
+ }
22792
+ }));
22793
+ }
22794
+ else {
22795
+ templateFilter.push.apply(templateFilter, __spread(_this.getRangeFilter(col)));
22796
+ }
22753
22797
  break;
22754
22798
  case exports.DataType.date:
22755
22799
  templateFilter.push.apply(templateFilter, __spread(_this.getDateRangeFilter(col, function (date) { return new Date(date.getFullYear(), date.getMonth(), date.getDate()); }, function (date) { return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1, 0, 0, -1); })));
@@ -24269,6 +24313,13 @@
24269
24313
  _this.customGetData = false;
24270
24314
  _this.readyToTrinhKy = false;
24271
24315
  _this.plusUrl = '';
24316
+ /**
24317
+ * Addtional fields to add to gridInfo.fields when using setting.autoGenerateSelectFields
24318
+ * @date 11/4/2022 - 2:03:19 PM
24319
+ *
24320
+ * @type {string[]}
24321
+ */
24322
+ _this.additionalFields = [];
24272
24323
  var moduleConfigService = _injector.get(ModuleConfigService);
24273
24324
  _this.environment = moduleConfigService.getConfig().environment;
24274
24325
  _this._notifierService = _this._injector.get(NotifierService);
@@ -24501,10 +24552,11 @@
24501
24552
  };
24502
24553
  ListBase.prototype.getData = function (gridInfo) {
24503
24554
  return __awaiter(this, void 0, void 0, function () {
24504
- var resultModify;
24555
+ var cols, fields, cols_1, cols_1_1, col, resultModify;
24556
+ var e_1, _a;
24505
24557
  var _this = this;
24506
- return __generator(this, function (_a) {
24507
- switch (_a.label) {
24558
+ return __generator(this, function (_b) {
24559
+ switch (_b.label) {
24508
24560
  case 0:
24509
24561
  if (!(this.setting.baseService && this.model.ready && !this.model.loading)) return [3 /*break*/, 2];
24510
24562
  this._markLoading();
@@ -24536,9 +24588,31 @@
24536
24588
  }
24537
24589
  }
24538
24590
  });
24591
+ if (this.setting.autoGenerateSelectFields === true && this.setting.cols && this.setting.cols.length > 0) {
24592
+ cols = this.setting.cols;
24593
+ fields = ['id'];
24594
+ try {
24595
+ for (cols_1 = __values(cols), cols_1_1 = cols_1.next(); !cols_1_1.done; cols_1_1 = cols_1.next()) {
24596
+ col = cols_1_1.value;
24597
+ if (col.isRefField || col.includeSelect === false || col.field == null || col.field == '') {
24598
+ continue;
24599
+ }
24600
+ fields.push(col.field);
24601
+ }
24602
+ }
24603
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
24604
+ finally {
24605
+ try {
24606
+ if (cols_1_1 && !cols_1_1.done && (_a = cols_1.return)) _a.call(cols_1);
24607
+ }
24608
+ finally { if (e_1) throw e_1.error; }
24609
+ }
24610
+ fields.push.apply(fields, __spread(this.additionalFields));
24611
+ gridInfo.fields = fields.join(',');
24612
+ }
24539
24613
  return [4 /*yield*/, this.modifyGridInfo(gridInfo)];
24540
24614
  case 1:
24541
- resultModify = _a.sent();
24615
+ resultModify = _b.sent();
24542
24616
  if (gridInfo.sorts.length == 0) {
24543
24617
  gridInfo.sorts.unshift(this.newSort('created', -1));
24544
24618
  }
@@ -24734,7 +24808,7 @@
24734
24808
  * @param refFields
24735
24809
  */
24736
24810
  ListBase.prototype.addRefFields = function (refFields) {
24737
- var e_1, _a;
24811
+ var e_2, _a;
24738
24812
  if (this.setting.fieldNeedGetRef == null || this.setting.fieldNeedGetRef.length === 0) {
24739
24813
  this.setting.fieldNeedGetRef = __spread(refFields);
24740
24814
  return;
@@ -24754,12 +24828,12 @@
24754
24828
  _loop_1(refField);
24755
24829
  }
24756
24830
  }
24757
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
24831
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
24758
24832
  finally {
24759
24833
  try {
24760
24834
  if (refFields_1_1 && !refFields_1_1.done && (_a = refFields_1.return)) _a.call(refFields_1);
24761
24835
  }
24762
- finally { if (e_1) throw e_1.error; }
24836
+ finally { if (e_2) throw e_2.error; }
24763
24837
  }
24764
24838
  };
24765
24839
  ListBase.prototype.groupInClient = function (dataSource) {
@@ -25142,8 +25216,8 @@
25142
25216
  };
25143
25217
  ListBase.prototype._copyLinkMultiple = function () {
25144
25218
  return __awaiter(this, void 0, void 0, function () {
25145
- var paths, _a, _b, item, _c, _d, e_2_1;
25146
- var e_2, _e;
25219
+ var paths, _a, _b, item, _c, _d, e_3_1;
25220
+ var e_3, _e;
25147
25221
  return __generator(this, function (_f) {
25148
25222
  switch (_f.label) {
25149
25223
  case 0:
@@ -25166,14 +25240,14 @@
25166
25240
  return [3 /*break*/, 2];
25167
25241
  case 5: return [3 /*break*/, 8];
25168
25242
  case 6:
25169
- e_2_1 = _f.sent();
25170
- e_2 = { error: e_2_1 };
25243
+ e_3_1 = _f.sent();
25244
+ e_3 = { error: e_3_1 };
25171
25245
  return [3 /*break*/, 8];
25172
25246
  case 7:
25173
25247
  try {
25174
25248
  if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
25175
25249
  }
25176
- finally { if (e_2) throw e_2.error; }
25250
+ finally { if (e_3) throw e_3.error; }
25177
25251
  return [7 /*endfinally*/];
25178
25252
  case 8:
25179
25253
  this._commonService.copyByStorage(paths.join('\r\n'));
@@ -31860,6 +31934,7 @@
31860
31934
  // cleanup storage
31861
31935
  _this._authenService.cleanupLocalStorage();
31862
31936
  _this._authenService.cleanupSessionStorage();
31937
+ _this._authenService.clearLocalToken();
31863
31938
  _this._storageUpdatedService.cleanupStorageService();
31864
31939
  _this._oauthService.revokeTokenAndLogout(null, true)
31865
31940
  .then(function (res) {