tnx-shared 5.1.421 → 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);
@@ -11265,6 +11290,14 @@
11265
11290
  });
11266
11291
  }
11267
11292
  };
11293
+ UserService.prototype.removeUser = function (id) {
11294
+ var url = this.serviceUri + "/RemoveUser/" + id;
11295
+ return this.defaultDelete(url);
11296
+ };
11297
+ UserService.prototype.modifyUserInfo = function (id, userInfo) {
11298
+ var url = this.serviceUri + "/ModifyUserInfo/" + id;
11299
+ return this.defaultPut(url, userInfo);
11300
+ };
11268
11301
  return UserService;
11269
11302
  }(BaseService));
11270
11303
  UserService.ɵprov = i0.ɵɵdefineInjectable({ factory: function UserService_Factory() { return new UserService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService), i0.ɵɵinject(AuthenService), i0.ɵɵinject(i4.OAuthService), i0.ɵɵinject(SignalRService), i0.ɵɵinject(ExceptionHandlerService), i0.ɵɵinject(ApplicationContextService)); }, token: UserService, providedIn: "root" });
@@ -20824,6 +20857,7 @@
20824
20857
  _this.sourceIcon = {};
20825
20858
  _this.stopCalculatingFunctionColumnWidth = false;
20826
20859
  _this.FileUploadMode = exports.FileUploadMode;
20860
+ _this.Operator = exports.Operator;
20827
20861
  _this._unSubscribeAll = new rxjs.Subject();
20828
20862
  _this.handleSelectRow = function (evt, data) {
20829
20863
  if (_this.setting.hasCustomHandleClickRow) {
@@ -21337,7 +21371,7 @@
21337
21371
  if (element.displayField == null) {
21338
21372
  element.displayField = 'ten';
21339
21373
  }
21340
- 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 }));
21341
21375
  var configRefField = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == tmpCol.field; });
21342
21376
  if (configRefField && configRefField.visible != null) {
21343
21377
  tmpCol.visible = configRefField.visible;
@@ -21353,7 +21387,7 @@
21353
21387
  element.controlType = exports.ControlType.dropdown;
21354
21388
  if (!element.rawColumn) {
21355
21389
  this_1.setting.fieldNeedGetRef.push(Object.assign({}, element));
21356
- 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 }));
21357
21391
  var configRefField = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == tmpCol.field; });
21358
21392
  if (configRefField && configRefField.visible != null) {
21359
21393
  tmpCol.visible = configRefField.visible;
@@ -22741,7 +22775,25 @@
22741
22775
  case exports.DataType.intWithoutMask:
22742
22776
  case exports.DataType.decimal:
22743
22777
  case exports.DataType.currency:
22744
- 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
+ }
22745
22797
  break;
22746
22798
  case exports.DataType.date:
22747
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); })));
@@ -24261,6 +24313,13 @@
24261
24313
  _this.customGetData = false;
24262
24314
  _this.readyToTrinhKy = false;
24263
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 = [];
24264
24323
  var moduleConfigService = _injector.get(ModuleConfigService);
24265
24324
  _this.environment = moduleConfigService.getConfig().environment;
24266
24325
  _this._notifierService = _this._injector.get(NotifierService);
@@ -24493,10 +24552,11 @@
24493
24552
  };
24494
24553
  ListBase.prototype.getData = function (gridInfo) {
24495
24554
  return __awaiter(this, void 0, void 0, function () {
24496
- var resultModify;
24555
+ var cols, fields, cols_1, cols_1_1, col, resultModify;
24556
+ var e_1, _a;
24497
24557
  var _this = this;
24498
- return __generator(this, function (_a) {
24499
- switch (_a.label) {
24558
+ return __generator(this, function (_b) {
24559
+ switch (_b.label) {
24500
24560
  case 0:
24501
24561
  if (!(this.setting.baseService && this.model.ready && !this.model.loading)) return [3 /*break*/, 2];
24502
24562
  this._markLoading();
@@ -24528,9 +24588,31 @@
24528
24588
  }
24529
24589
  }
24530
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
+ }
24531
24613
  return [4 /*yield*/, this.modifyGridInfo(gridInfo)];
24532
24614
  case 1:
24533
- resultModify = _a.sent();
24615
+ resultModify = _b.sent();
24534
24616
  if (gridInfo.sorts.length == 0) {
24535
24617
  gridInfo.sorts.unshift(this.newSort('created', -1));
24536
24618
  }
@@ -24726,7 +24808,7 @@
24726
24808
  * @param refFields
24727
24809
  */
24728
24810
  ListBase.prototype.addRefFields = function (refFields) {
24729
- var e_1, _a;
24811
+ var e_2, _a;
24730
24812
  if (this.setting.fieldNeedGetRef == null || this.setting.fieldNeedGetRef.length === 0) {
24731
24813
  this.setting.fieldNeedGetRef = __spread(refFields);
24732
24814
  return;
@@ -24746,12 +24828,12 @@
24746
24828
  _loop_1(refField);
24747
24829
  }
24748
24830
  }
24749
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
24831
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
24750
24832
  finally {
24751
24833
  try {
24752
24834
  if (refFields_1_1 && !refFields_1_1.done && (_a = refFields_1.return)) _a.call(refFields_1);
24753
24835
  }
24754
- finally { if (e_1) throw e_1.error; }
24836
+ finally { if (e_2) throw e_2.error; }
24755
24837
  }
24756
24838
  };
24757
24839
  ListBase.prototype.groupInClient = function (dataSource) {
@@ -25134,8 +25216,8 @@
25134
25216
  };
25135
25217
  ListBase.prototype._copyLinkMultiple = function () {
25136
25218
  return __awaiter(this, void 0, void 0, function () {
25137
- var paths, _a, _b, item, _c, _d, e_2_1;
25138
- var e_2, _e;
25219
+ var paths, _a, _b, item, _c, _d, e_3_1;
25220
+ var e_3, _e;
25139
25221
  return __generator(this, function (_f) {
25140
25222
  switch (_f.label) {
25141
25223
  case 0:
@@ -25158,14 +25240,14 @@
25158
25240
  return [3 /*break*/, 2];
25159
25241
  case 5: return [3 /*break*/, 8];
25160
25242
  case 6:
25161
- e_2_1 = _f.sent();
25162
- e_2 = { error: e_2_1 };
25243
+ e_3_1 = _f.sent();
25244
+ e_3 = { error: e_3_1 };
25163
25245
  return [3 /*break*/, 8];
25164
25246
  case 7:
25165
25247
  try {
25166
25248
  if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
25167
25249
  }
25168
- finally { if (e_2) throw e_2.error; }
25250
+ finally { if (e_3) throw e_3.error; }
25169
25251
  return [7 /*endfinally*/];
25170
25252
  case 8:
25171
25253
  this._commonService.copyByStorage(paths.join('\r\n'));
@@ -31852,6 +31934,7 @@
31852
31934
  // cleanup storage
31853
31935
  _this._authenService.cleanupLocalStorage();
31854
31936
  _this._authenService.cleanupSessionStorage();
31937
+ _this._authenService.clearLocalToken();
31855
31938
  _this._storageUpdatedService.cleanupStorageService();
31856
31939
  _this._oauthService.revokeTokenAndLogout(null, true)
31857
31940
  .then(function (res) {