tnx-shared 5.1.211 → 5.1.215

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.
@@ -6948,12 +6948,16 @@
6948
6948
  var url = this.serviceUri + "/" + id;
6949
6949
  return this.defaultGet(url);
6950
6950
  };
6951
- BaseService.prototype.getDetailWithPermission = function (id, pid) {
6951
+ BaseService.prototype.getDetailWithPermission = function (id, pid, plusUrl) {
6952
6952
  if (pid === void 0) { pid = null; }
6953
+ if (plusUrl === void 0) { plusUrl = ''; }
6953
6954
  if (pid == null) {
6954
6955
  pid = this._commonService.guidEmpty();
6955
6956
  }
6956
6957
  var url = this.serviceUri + "/DetailWithPermission/" + id + "?pid=" + pid;
6958
+ if (plusUrl) {
6959
+ url = this.serviceUri + "/DetailWithPermission/" + plusUrl + "/" + id + "?pid=" + pid;
6960
+ }
6957
6961
  return this.defaultGet(url);
6958
6962
  };
6959
6963
  BaseService.prototype.getDetailByPid = function (pid) {
@@ -7032,14 +7036,14 @@
7032
7036
  BaseService.prototype.post = function (item, plusUrl) {
7033
7037
  var _this = this;
7034
7038
  if (plusUrl === void 0) { plusUrl = ''; }
7035
- var uri = plusUrl ? "" + this.serviceUri + plusUrl : this.serviceUri;
7039
+ var uri = plusUrl ? this.serviceUri + "/" + plusUrl : this.serviceUri;
7036
7040
  return this._http
7037
7041
  .post(uri, item)
7038
7042
  .pipe(operators.catchError(function (err) { return _this.handleError(err, _this._injector); })).toPromise();
7039
7043
  };
7040
7044
  BaseService.prototype.put = function (id, item, plusUrl) {
7041
7045
  if (plusUrl === void 0) { plusUrl = ''; }
7042
- var url = plusUrl ? this.serviceUri + "/" + id + plusUrl : this.serviceUri + "/" + id;
7046
+ var url = plusUrl ? this.serviceUri + "/" + plusUrl + "/" + id : this.serviceUri + "/" + id;
7043
7047
  return this._http.put(url, item).toPromise();
7044
7048
  };
7045
7049
  BaseService.prototype.delete = function (id) {
@@ -17186,8 +17190,8 @@
17186
17190
  _this.autoGetDetail = true;
17187
17191
  _this.autoSave = true;
17188
17192
  _this.saving = false;
17193
+ _this.getDetailPlusUrl = null;
17189
17194
  _this.insertPlusUrl = null;
17190
- _this.updatePlusUrl = null;
17191
17195
  _this.dynamicControl = {};
17192
17196
  _this.setValidateForm = true;
17193
17197
  _this.haveEntityMetadataAPI = true;
@@ -17218,6 +17222,9 @@
17218
17222
  else {
17219
17223
  this.model.formState = exports.FormState.VIEW;
17220
17224
  }
17225
+ if (this.model.data.isBuildInAll && !this._userService.isSuperUser()) {
17226
+ this.model.formState = exports.FormState.VIEW;
17227
+ }
17221
17228
  }
17222
17229
  this.__isFormView = this._isFormView();
17223
17230
  };
@@ -17367,7 +17374,7 @@
17367
17374
  return __awaiter(this, void 0, void 0, function () {
17368
17375
  return __generator(this, function (_a) {
17369
17376
  switch (_a.label) {
17370
- case 0: return [4 /*yield*/, this.setting.baseService.getDetailWithPermission(this.model.data.id, this.model.data.pid)];
17377
+ case 0: return [4 /*yield*/, this.setting.baseService.getDetailWithPermission(this.model.data.id, this.model.data.pid, this.getDetailPlusUrl)];
17371
17378
  case 1: return [2 /*return*/, _a.sent()];
17372
17379
  }
17373
17380
  });
@@ -17602,10 +17609,7 @@
17602
17609
  };
17603
17610
  DataFormBase.prototype.disableBuildInField = function () {
17604
17611
  if (!this._isFormAddNew()) {
17605
- if (this.model.data.isBuildIn && this.setting.schema['code']) {
17606
- this.setting.schema['code'].disabled = true;
17607
- }
17608
- if (this.model.data.isBuildInAll) {
17612
+ if (this.model.data.isBuildInAll && !this._userService.isSuperUser()) {
17609
17613
  this.setting.schema.forEach(function (item) {
17610
17614
  item.disabled = true;
17611
17615
  });
@@ -17909,7 +17913,7 @@
17909
17913
  DataFormBase.prototype.handleUpdateError = function () {
17910
17914
  };
17911
17915
  DataFormBase.prototype.getPromiseActionUpdate = function () {
17912
- return this.setting.baseService.put(this.model.data.id.toString(), this.model.data, this.updatePlusUrl);
17916
+ return this.setting.baseService.put(this.model.data.id.toString(), this.model.data);
17913
17917
  };
17914
17918
  DataFormBase.prototype.setDefaultValue = function (model) {
17915
17919
  if (model.isBuildIn === null || model.isBuildIn === undefined) {
@@ -22278,9 +22282,10 @@
22278
22282
 
22279
22283
  var TreeTableComponent = /** @class */ (function (_super) {
22280
22284
  __extends(TreeTableComponent, _super);
22281
- function TreeTableComponent(injector, _crudService, _notifierService) {
22285
+ function TreeTableComponent(injector, _crudService, _translateService, _notifierService) {
22282
22286
  var _this = _super.call(this, injector) || this;
22283
22287
  _this._crudService = _crudService;
22288
+ _this._translateService = _translateService;
22284
22289
  _this._notifierService = _notifierService;
22285
22290
  _this.model = new CrudListData();
22286
22291
  _this.setting = new CrudListSetting();
@@ -22364,15 +22369,177 @@
22364
22369
  // this.getColorSetting();
22365
22370
  // this.getColumnSetting(colGroup);
22366
22371
  // this.getPageSetting();
22367
- // this.extendColumns(this.setting.cols);
22372
+ this.extendColumns(this.setting.cols);
22368
22373
  // this.formatColumns(this.setting.cols);
22369
22374
  // this.applyColumnSetting();
22370
22375
  this.buildFilterColumn(this.setting.cols);
22371
22376
  }
22372
22377
  };
22378
+ TreeTableComponent.prototype.extendColumns = function (cols, appendCol) {
22379
+ var _this = this;
22380
+ if (appendCol === void 0) { appendCol = true; }
22381
+ if (!cols) {
22382
+ return;
22383
+ }
22384
+ this.setting.advanceData.fieldNeedGetRef = [];
22385
+ var temp = [];
22386
+ var tmpCols = __spread(cols);
22387
+ if (this.setting.columnSetting.details) {
22388
+ this.setting.columnSetting.details.forEach(function (colReorder) {
22389
+ for (var i = 0; i < cols.length; i++) {
22390
+ if (cols[i].field == colReorder.columnCode) {
22391
+ temp.push(cols[i]);
22392
+ cols.splice(i, 1);
22393
+ }
22394
+ }
22395
+ });
22396
+ // Còn lại những code mà không được cấu hình thì ghép lại theo index được khai báo
22397
+ var tempCols_1 = [];
22398
+ cols.forEach(function (col) {
22399
+ var indexColOld = tmpCols.findIndex(function (p) { return p.field == col.field; });
22400
+ if (indexColOld == 0) {
22401
+ temp.splice(0, 0, col);
22402
+ }
22403
+ else {
22404
+ // Tìm vị trí của cột phía trước trong list reorder mới
22405
+ var indexColBeforeNew = temp.findIndex(function (p) { return p.field == tmpCols[indexColOld - 1].field; });
22406
+ while (indexColBeforeNew == -1) {
22407
+ tempCols_1.splice(0, 0, col);
22408
+ // Tìm vị trí của cột trước cột đang kiểm tra trong list cột gốc
22409
+ indexColOld = tmpCols.findIndex(function (p) { return p.field == tmpCols[indexColOld - 1].field; });
22410
+ indexColBeforeNew = temp.findIndex(function (p) { return p.field == tmpCols[indexColOld - 1].field; });
22411
+ }
22412
+ // => Đến khi thấy thì add cột hiện tại và list tạm vào vị trí chèn
22413
+ if (indexColBeforeNew == temp.length - 1) {
22414
+ temp.push.apply(temp, __spread([col], tempCols_1));
22415
+ }
22416
+ else {
22417
+ temp.splice.apply(temp, __spread([indexColBeforeNew + 1, 0, col], tempCols_1));
22418
+ }
22419
+ tempCols_1 = [];
22420
+ }
22421
+ });
22422
+ }
22423
+ else {
22424
+ }
22425
+ cols.splice(0, cols.length);
22426
+ cols.splice.apply(cols, __spread([0, 0], temp));
22427
+ var firstColVisible = null;
22428
+ var foundItemShowEditLink = false;
22429
+ temp.splice(0, temp.length);
22430
+ var tmpCol = null;
22431
+ var _loop_1 = function (ind) {
22432
+ var element = cols[ind];
22433
+ if (element.rawColumn) {
22434
+ return "continue";
22435
+ }
22436
+ temp.push(element);
22437
+ var config = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == element.field; });
22438
+ if (config && config.visible !== undefined && config.visible !== null) {
22439
+ element.visible = config.visible;
22440
+ }
22441
+ if (element.label) {
22442
+ element.label = this_1._translateService.instant(element.label);
22443
+ }
22444
+ if (config && config.textAlign !== undefined && config.textAlign !== null) {
22445
+ element.textAlign = config.textAlign;
22446
+ }
22447
+ if (config && config.width !== undefined && config.width !== null) {
22448
+ element.width = config.width;
22449
+ }
22450
+ if (element.dataType == null || element.dataType == undefined || element.dataType == '') {
22451
+ element.dataType = exports.DataType.string;
22452
+ }
22453
+ if (element.visible
22454
+ || (this_1.setting.groupColumn
22455
+ && element.field == this_1.setting.groupColumn.field)) {
22456
+ if (element.baseService != null) {
22457
+ element.controlType = exports.ControlType.dropdown;
22458
+ if (!element.rawColumn) {
22459
+ this_1.setting.advanceData.fieldNeedGetRef.push(element);
22460
+ element[KeyFieldGetRefType] = exports.EnumGetRefType.SERVER;
22461
+ if (element.valueField == null) {
22462
+ element.valueField = 'id';
22463
+ }
22464
+ if (element.displayField == null) {
22465
+ element.displayField = 'ten';
22466
+ }
22467
+ 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 }));
22468
+ var configRefField = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == tmpCol.field; });
22469
+ if (configRefField && configRefField.visible != null) {
22470
+ tmpCol.visible = configRefField.visible;
22471
+ }
22472
+ temp.push(tmpCol);
22473
+ element.visible = false;
22474
+ if (!firstColVisible) {
22475
+ firstColVisible = tmpCol;
22476
+ }
22477
+ }
22478
+ }
22479
+ else if (element.dataSource && element.dataSource.length > 0) {
22480
+ element.controlType = exports.ControlType.dropdown;
22481
+ if (!element.rawColumn) {
22482
+ this_1.setting.advanceData.fieldNeedGetRef.push(element);
22483
+ element[KeyFieldGetRefType] = exports.EnumGetRefType.LOCAL;
22484
+ 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, generatedRefColumn: true }));
22485
+ var configRefField = this_1.setting.columnSetting.details.find(function (p) { return p.columnCode == tmpCol.field; });
22486
+ if (configRefField && configRefField.visible != null) {
22487
+ tmpCol.visible = configRefField.visible;
22488
+ }
22489
+ temp.push(tmpCol);
22490
+ element.visible = false;
22491
+ if (!firstColVisible) {
22492
+ firstColVisible = tmpCol;
22493
+ }
22494
+ }
22495
+ }
22496
+ else if (!firstColVisible) {
22497
+ firstColVisible = element;
22498
+ }
22499
+ }
22500
+ else if (element.forceGetData) {
22501
+ if (element.baseService != null) {
22502
+ this_1.setting.advanceData.fieldNeedGetRef.push(element);
22503
+ element[KeyFieldGetRefType] = exports.EnumGetRefType.SERVER;
22504
+ if (element.valueField == null) {
22505
+ element.valueField = 'id';
22506
+ }
22507
+ if (element.displayField == null) {
22508
+ element.displayField = 'ten';
22509
+ }
22510
+ element.visible = false;
22511
+ }
22512
+ }
22513
+ if (element.showEditLink) {
22514
+ foundItemShowEditLink = true;
22515
+ }
22516
+ };
22517
+ var this_1 = this;
22518
+ for (var ind in cols) {
22519
+ _loop_1(ind);
22520
+ }
22521
+ if (!foundItemShowEditLink && firstColVisible) {
22522
+ firstColVisible.showEditLink = true;
22523
+ }
22524
+ cols.length = 0;
22525
+ cols.push.apply(cols, __spread(temp));
22526
+ this.setting.advanceData.fieldNeedGetRef.sort(multipleSort({ name: 'sort', primer: function (a) { return a == null; } }, 'order'));
22527
+ this.setting.advanceData.fieldHasMaximumLength = [];
22528
+ this.setting.advanceData.fieldHasMaximumWord = [];
22529
+ cols.forEach(function (col) {
22530
+ if (!col.visible)
22531
+ return;
22532
+ if (col.maxWordDisplay) {
22533
+ _this.setting.advanceData.fieldHasMaximumWord.push(col);
22534
+ }
22535
+ else if (col.maxLengthDisplay) {
22536
+ _this.setting.advanceData.fieldHasMaximumLength.push(col);
22537
+ }
22538
+ });
22539
+ };
22373
22540
  TreeTableComponent.prototype.createSearchSchema = function () {
22374
22541
  return __awaiter(this, void 0, void 0, function () {
22375
- var searchInfo, _a, _b, col, control, e_1_1, _loop_1, this_1, _c, _d, field;
22542
+ var searchInfo, _a, _b, col, control, e_1_1, _loop_2, this_2, _c, _d, field;
22376
22543
  var e_1, _e, _f, e_2, _g;
22377
22544
  return __generator(this, function (_h) {
22378
22545
  switch (_h.label) {
@@ -22477,23 +22644,23 @@
22477
22644
  return [7 /*endfinally*/];
22478
22645
  case 8:
22479
22646
  if (searchInfo.fieldSearchText) {
22480
- _loop_1 = function (field) {
22647
+ _loop_2 = function (field) {
22481
22648
  if (searchInfo.fieldSearchText.indexOf(field) == -1) {
22482
22649
  searchInfo.fieldSearchText.push(field);
22483
22650
  if (!searchInfo.tooltipSearchText) {
22484
22651
  searchInfo.tooltipSearchText = 'Tìm kiếm theo các trường:';
22485
22652
  }
22486
- var col = this_1.setting.modelSchemas.find(function (p) { return p.field == field; });
22653
+ var col = this_2.setting.modelSchemas.find(function (p) { return p.field == field; });
22487
22654
  if (col != null) {
22488
22655
  searchInfo.tooltipSearchText += " \"" + col.name + "\",";
22489
22656
  }
22490
22657
  }
22491
22658
  };
22492
- this_1 = this;
22659
+ this_2 = this;
22493
22660
  try {
22494
22661
  for (_c = __values(searchInfo.fieldSearchText), _d = _c.next(); !_d.done; _d = _c.next()) {
22495
22662
  field = _d.value;
22496
- _loop_1(field);
22663
+ _loop_2(field);
22497
22664
  }
22498
22665
  }
22499
22666
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -22950,21 +23117,21 @@
22950
23117
  };
22951
23118
  TreeTableComponent.prototype.preProcessData = function (dataSource) {
22952
23119
  return __awaiter(this, void 0, void 0, function () {
22953
- var colHasPipe, _loop_2, this_2, colHasPipe_1, colHasPipe_1_1, col;
23120
+ var colHasPipe, _loop_3, this_3, colHasPipe_1, colHasPipe_1_1, col;
22954
23121
  var e_5, _a;
22955
23122
  return __generator(this, function (_b) {
22956
23123
  colHasPipe = this.setting.cols.filter(function (x) { return x.pipe; });
22957
- _loop_2 = function (col) {
23124
+ _loop_3 = function (col) {
22958
23125
  var e_6, _a;
22959
- var _loop_3 = function (item) {
22960
- this_2.transform(col.pipe, col.asyncPipe, item[col.field]).then(function (rs) {
23126
+ var _loop_4 = function (item) {
23127
+ this_3.transform(col.pipe, col.asyncPipe, item[col.field]).then(function (rs) {
22961
23128
  item["pipe__" + col.field + " "] = rs;
22962
23129
  });
22963
23130
  };
22964
23131
  try {
22965
23132
  for (var dataSource_1 = (e_6 = void 0, __values(dataSource)), dataSource_1_1 = dataSource_1.next(); !dataSource_1_1.done; dataSource_1_1 = dataSource_1.next()) {
22966
23133
  var item = dataSource_1_1.value;
22967
- _loop_3(item);
23134
+ _loop_4(item);
22968
23135
  }
22969
23136
  }
22970
23137
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
@@ -22975,11 +23142,11 @@
22975
23142
  finally { if (e_6) throw e_6.error; }
22976
23143
  }
22977
23144
  };
22978
- this_2 = this;
23145
+ this_3 = this;
22979
23146
  try {
22980
23147
  for (colHasPipe_1 = __values(colHasPipe), colHasPipe_1_1 = colHasPipe_1.next(); !colHasPipe_1_1.done; colHasPipe_1_1 = colHasPipe_1.next()) {
22981
23148
  col = colHasPipe_1_1.value;
22982
- _loop_2(col);
23149
+ _loop_3(col);
22983
23150
  }
22984
23151
  }
22985
23152
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
@@ -23180,6 +23347,7 @@
23180
23347
  TreeTableComponent.ctorParameters = function () { return [
23181
23348
  { type: i0.Injector },
23182
23349
  { type: CrudService },
23350
+ { type: i2.TranslateService },
23183
23351
  { type: NotifierService }
23184
23352
  ]; };
23185
23353
  TreeTableComponent.propDecorators = {
@@ -24540,7 +24708,7 @@
24540
24708
  };
24541
24709
  DataListBase.prototype._getDataSource = function (response) {
24542
24710
  return __awaiter(this, void 0, void 0, function () {
24543
- var dataSource, lstItemId, statusNotAllowEdits_1, userIdCurrent, fieldKey_1, callBackWhenNotHaveStatus, _baseService, dataTask_1, result;
24711
+ var dataSource, lstItemId, funcModifyItem, statusNotAllowEdits_1, userIdCurrent, fieldKey_1, callBackWhenNotHaveStatus, _baseService, dataTask_1, result;
24544
24712
  var _this = this;
24545
24713
  return __generator(this, function (_a) {
24546
24714
  switch (_a.label) {
@@ -24554,20 +24722,25 @@
24554
24722
  });
24555
24723
  dataSource = response.data;
24556
24724
  lstItemId = [];
24725
+ funcModifyItem = function (item, index) {
24726
+ item._index = (_this.setting.pageSetting.page - 1) * _this.setting.pageSetting.pageSize + 1 + index;
24727
+ lstItemId.push(item.id);
24728
+ if ((item.isBuildInAll || item.isBuildIn)
24729
+ && !_this._userService.isSuperUser()) {
24730
+ item.__disableEdit = true;
24731
+ item.__disableDelete = true;
24732
+ }
24733
+ };
24557
24734
  if (this.setting.workflowSetting) {
24558
24735
  statusNotAllowEdits_1 = this.setting.workflowSetting.statuses.filter(function (p) { return !p.options.choPhepSua; }).map(function (item) { return item.trangThaiContainer.ma; });
24559
24736
  dataSource.forEach(function (item, index) {
24560
- item._index = (_this.setting.pageSetting.page - 1) * _this.setting.pageSetting.pageSize + 1 + index;
24561
- // item.currentStateCode = item.currentStateCode;
24562
24737
  item.__disableEdit = statusNotAllowEdits_1.indexOf(item.currentStateCode) > -1;
24563
- lstItemId.push(item.id);
24738
+ funcModifyItem(item, index);
24564
24739
  });
24565
24740
  }
24566
24741
  else {
24567
24742
  dataSource.forEach(function (item, index) {
24568
- item._index = (_this.setting.pageSetting.page - 1) * _this.setting.pageSetting.pageSize + 1 + index;
24569
- // item.currentStateCode = item.currentStateCode;
24570
- lstItemId.push(item.id);
24743
+ funcModifyItem(item, index);
24571
24744
  });
24572
24745
  }
24573
24746
  if (!(this.setting.workflowSettingNew
@@ -44868,6 +45041,10 @@
44868
45041
  try {
44869
45042
  for (var _f = __values(data.connections), _g = _f.next(); !_g.done; _g = _f.next()) {
44870
45043
  var conn = _g.value;
45044
+ // fix openPopup của một số workflow cũ chưa có trường này
45045
+ if (conn.openPopup === null || conn.openPopup === undefined) {
45046
+ conn.openPopup = true;
45047
+ }
44871
45048
  var newObj = JSON.parse(JSON.stringify(conn));
44872
45049
  newObj.source = mapping[conn.source];
44873
45050
  newObj.target = mapping[conn.target];
@@ -55548,6 +55725,13 @@
55548
55725
  _this.fieldParent = 'idParent';
55549
55726
  _this.valueParentRoot = null;
55550
55727
  _this.levelOpen = 1;
55728
+ _this.funcModifyItem = function (item) {
55729
+ if ((item.isBuildInAll || item.isBuildIn)
55730
+ && !_this._userService.isSuperUser()) {
55731
+ item.__disableEdit = true;
55732
+ item.__disableDelete = true;
55733
+ }
55734
+ };
55551
55735
  return _this;
55552
55736
  }
55553
55737
  TreeListBase.prototype.ngOnInit = function () {
@@ -55588,6 +55772,7 @@
55588
55772
  level: level,
55589
55773
  children: []
55590
55774
  };
55775
+ _this.funcModifyItem(item);
55591
55776
  result.push(node);
55592
55777
  _this.createTreeData(dataSource, node.children, node.data.id, level + 1, __spread(lstIdParent, [item.id]));
55593
55778
  });