tnx-shared 5.3.269 → 5.3.271

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.
@@ -1307,6 +1307,7 @@
1307
1307
  this.hiddenKySoSimCaNhan = false;
1308
1308
  this.hiddenKySoUsbCaNhan = false;
1309
1309
  this.hiddenKySoDonVi = false;
1310
+ this.arrFieldMustValidate = [];
1310
1311
  this.getCustomDataTrinhKy = function (rowData) { return ({}); };
1311
1312
  for (var key in init) {
1312
1313
  this[key] = init[key];
@@ -10261,6 +10262,19 @@
10261
10262
  }
10262
10263
  });
10263
10264
  };
10265
+ TemplateInstanceService.prototype.fillTemplateByCodeAndPreviewPdf = function (templateCode, data) {
10266
+ var _this = this;
10267
+ var url = this.serviceUri + "/fillWordByTemplateCode/" + templateCode + "?isPrint=true";
10268
+ return this._httpClient
10269
+ .post(url, data)
10270
+ .toPromise().then(function (res) {
10271
+ if (res.data) {
10272
+ var file = _this.b64toBlob(res.data, 'application/pdf');
10273
+ var fileURL = URL.createObjectURL(file);
10274
+ window.open(fileURL);
10275
+ }
10276
+ });
10277
+ };
10264
10278
  /**
10265
10279
  * Word
10266
10280
  * @param templateCode
@@ -16255,14 +16269,15 @@
16255
16269
  };
16256
16270
  CrudFormComponent.prototype.validateForm = function (setValidateForm) {
16257
16271
  if (setValidateForm === void 0) { setValidateForm = true; }
16272
+ var _a;
16258
16273
  return __awaiter(this, void 0, void 0, function () {
16259
16274
  var _this = this;
16260
16275
  return __generator(this, function (_e) {
16261
16276
  switch (_e.label) {
16262
16277
  case 0:
16263
- if (!setValidateForm) return [3 /*break*/, 2];
16278
+ if (!(setValidateForm || ((_a = this.setting.arrFieldMustValidate) === null || _a === void 0 ? void 0 : _a.length))) return [3 /*break*/, 2];
16264
16279
  this._inValidForm = false;
16265
- return [4 /*yield*/, this.validateModel(this._rootNode)];
16280
+ return [4 /*yield*/, this.validateModel(this._rootNode, setValidateForm)];
16266
16281
  case 1:
16267
16282
  _e.sent();
16268
16283
  if (this._inValidForm) {
@@ -16277,7 +16292,9 @@
16277
16292
  });
16278
16293
  });
16279
16294
  };
16280
- CrudFormComponent.prototype.validateModel = function (currentNode) {
16295
+ CrudFormComponent.prototype.validateModel = function (currentNode, setValidateForm) {
16296
+ if (setValidateForm === void 0) { setValidateForm = true; }
16297
+ var _a;
16281
16298
  return __awaiter(this, void 0, void 0, function () {
16282
16299
  var _e, _f, childNode, e_28_1;
16283
16300
  var e_28, _g;
@@ -16290,6 +16307,12 @@
16290
16307
  case 1:
16291
16308
  if (!!_f.done) return [3 /*break*/, 5];
16292
16309
  childNode = _f.value;
16310
+ if (!setValidateForm && ((_a = this.setting.arrFieldMustValidate) === null || _a === void 0 ? void 0 : _a.length)) {
16311
+ if (!this.setting.arrFieldMustValidate.includes(childNode.field)) {
16312
+ this.removeAllErrorByNodes(childNode);
16313
+ return [3 /*break*/, 4];
16314
+ }
16315
+ }
16293
16316
  if (!childNode.control) {
16294
16317
  if (childNode.childNodes == null) {
16295
16318
  return [3 /*break*/, 4];
@@ -16716,6 +16739,43 @@
16716
16739
  this._removeError(field);
16717
16740
  }
16718
16741
  };
16742
+ CrudFormComponent.prototype.removeAllErrorByNodes = function (currentNode) {
16743
+ var e_30, _e, e_31, _f;
16744
+ var _a, _b;
16745
+ currentNode.parentNode.model._errors[currentNode.field] = [];
16746
+ if (!((_a = currentNode.childNodes) === null || _a === void 0 ? void 0 : _a.length)) {
16747
+ return;
16748
+ }
16749
+ try {
16750
+ for (var _g = __values(currentNode.childNodes), _h = _g.next(); !_h.done; _h = _g.next()) {
16751
+ var childNode = _h.value;
16752
+ if (!((_b = childNode.childNodes) === null || _b === void 0 ? void 0 : _b.length)) {
16753
+ this.removeAllErrorByNodes(childNode);
16754
+ continue;
16755
+ }
16756
+ try {
16757
+ for (var _j = (e_31 = void 0, __values(childNode.childNodes)), _k = _j.next(); !_k.done; _k = _j.next()) {
16758
+ var node = _k.value;
16759
+ this.removeAllErrorByNodes(node);
16760
+ }
16761
+ }
16762
+ catch (e_31_1) { e_31 = { error: e_31_1 }; }
16763
+ finally {
16764
+ try {
16765
+ if (_k && !_k.done && (_f = _j.return)) _f.call(_j);
16766
+ }
16767
+ finally { if (e_31) throw e_31.error; }
16768
+ }
16769
+ }
16770
+ }
16771
+ catch (e_30_1) { e_30 = { error: e_30_1 }; }
16772
+ finally {
16773
+ try {
16774
+ if (_h && !_h.done && (_e = _g.return)) _e.call(_g);
16775
+ }
16776
+ finally { if (e_30) throw e_30.error; }
16777
+ }
16778
+ };
16719
16779
  CrudFormComponent.prototype.cacheControlValue = function (control, value, parentPath) {
16720
16780
  if (control && control.enableCaching) {
16721
16781
  this.cachedValues[parentPath + '.' + control.field] = value;
@@ -16795,7 +16855,7 @@
16795
16855
  * @param options
16796
16856
  */
16797
16857
  CrudFormComponent.prototype.focusFirstControl = function () {
16798
- var e_30, _e;
16858
+ var e_32, _e;
16799
16859
  var formElement = this.formElement.nativeElement;
16800
16860
  var divs = formElement.querySelectorAll('div.crud-form-control');
16801
16861
  if (divs) {
@@ -16830,12 +16890,12 @@
16830
16890
  }
16831
16891
  }
16832
16892
  }
16833
- catch (e_30_1) { e_30 = { error: e_30_1 }; }
16893
+ catch (e_32_1) { e_32 = { error: e_32_1 }; }
16834
16894
  finally {
16835
16895
  try {
16836
16896
  if (divs_1_1 && !divs_1_1.done && (_e = divs_1.return)) _e.call(divs_1);
16837
16897
  }
16838
- finally { if (e_30) throw e_30.error; }
16898
+ finally { if (e_32) throw e_32.error; }
16839
16899
  }
16840
16900
  }
16841
16901
  };
@@ -16999,7 +17059,7 @@
16999
17059
  if (fireEventFinish === void 0) { fireEventFinish = true; }
17000
17060
  return __awaiter(this, void 0, void 0, function () {
17001
17061
  var tableNode, index, parentPath, data, _e, _f, subControl, toAdd, newRowNode, _b_3, _c_3, _d_1;
17002
- var e_31, _g;
17062
+ var e_33, _g;
17003
17063
  return __generator(this, function (_h) {
17004
17064
  switch (_h.label) {
17005
17065
  case 0:
@@ -17031,12 +17091,12 @@
17031
17091
  this.initControlDefaultValue(data, subControl, parentPath);
17032
17092
  }
17033
17093
  }
17034
- catch (e_31_1) { e_31 = { error: e_31_1 }; }
17094
+ catch (e_33_1) { e_33 = { error: e_33_1 }; }
17035
17095
  finally {
17036
17096
  try {
17037
17097
  if (_f && !_f.done && (_g = _e.return)) _g.call(_e);
17038
17098
  }
17039
- finally { if (e_31) throw e_31.error; }
17099
+ finally { if (e_33) throw e_33.error; }
17040
17100
  }
17041
17101
  toAdd = true;
17042
17102
  if (control.onAdding) {
@@ -17122,7 +17182,7 @@
17122
17182
  CrudFormComponent.prototype.handleSavedTableRow = function (data) {
17123
17183
  return __awaiter(this, void 0, void 0, function () {
17124
17184
  var control, tablePath, eventType, tableNode, index, parentPath, _e, _f, subControl, toAdd, newRowNode, _b_4, _c_4, _d_2;
17125
- var e_32, _g;
17185
+ var e_34, _g;
17126
17186
  return __generator(this, function (_h) {
17127
17187
  switch (_h.label) {
17128
17188
  case 0:
@@ -17144,12 +17204,12 @@
17144
17204
  this.initControlModel(data, subControl, parentPath);
17145
17205
  }
17146
17206
  }
17147
- catch (e_32_1) { e_32 = { error: e_32_1 }; }
17207
+ catch (e_34_1) { e_34 = { error: e_34_1 }; }
17148
17208
  finally {
17149
17209
  try {
17150
17210
  if (_f && !_f.done && (_g = _e.return)) _g.call(_e);
17151
17211
  }
17152
- finally { if (e_32) throw e_32.error; }
17212
+ finally { if (e_34) throw e_34.error; }
17153
17213
  }
17154
17214
  toAdd = true;
17155
17215
  if (control.onAdding) {
@@ -17584,7 +17644,7 @@
17584
17644
  }
17585
17645
  };
17586
17646
  ControlTreeNode.prototype.initChildNodes = function (model, schemas, keysPlus) {
17587
- var e_33, _e, e_34, _f;
17647
+ var e_35, _e, e_36, _f;
17588
17648
  if (isLiteralObject(model)) {
17589
17649
  var allKey = new Set(__spreadArray(__spreadArray([], __read(keysPlus)), __read(Object.keys(model))));
17590
17650
  try {
@@ -17597,12 +17657,12 @@
17597
17657
  }
17598
17658
  }
17599
17659
  }
17600
- catch (e_33_1) { e_33 = { error: e_33_1 }; }
17660
+ catch (e_35_1) { e_35 = { error: e_35_1 }; }
17601
17661
  finally {
17602
17662
  try {
17603
17663
  if (allKey_1_1 && !allKey_1_1.done && (_e = allKey_1.return)) _e.call(allKey_1);
17604
17664
  }
17605
- finally { if (e_33) throw e_33.error; }
17665
+ finally { if (e_35) throw e_35.error; }
17606
17666
  }
17607
17667
  // Sau khi đã init xong node cho row thì fire event cho các control trong row
17608
17668
  // Thường dùng với mục đích cần disabled, hidden các control của row khi có nhu cầu
@@ -17634,12 +17694,12 @@
17634
17694
  i++;
17635
17695
  }
17636
17696
  }
17637
- catch (e_34_1) { e_34 = { error: e_34_1 }; }
17697
+ catch (e_36_1) { e_36 = { error: e_36_1 }; }
17638
17698
  finally {
17639
17699
  try {
17640
17700
  if (model_3_1 && !model_3_1.done && (_f = model_3.return)) _f.call(model_3);
17641
17701
  }
17642
- finally { if (e_34) throw e_34.error; }
17702
+ finally { if (e_36) throw e_36.error; }
17643
17703
  }
17644
17704
  }
17645
17705
  }
@@ -17785,7 +17845,7 @@
17785
17845
  return this.findSchemaInTree(this.rootNode, schemaPath.toLowerCase());
17786
17846
  };
17787
17847
  ControlTreeNode.prototype.findInTree = function (node, modelPath) {
17788
- var e_35, _e;
17848
+ var e_37, _e;
17789
17849
  if (node.modelPath != null && node.modelPath.toLowerCase() == modelPath.toLowerCase()) {
17790
17850
  return node;
17791
17851
  }
@@ -17800,18 +17860,18 @@
17800
17860
  }
17801
17861
  }
17802
17862
  }
17803
- catch (e_35_1) { e_35 = { error: e_35_1 }; }
17863
+ catch (e_37_1) { e_37 = { error: e_37_1 }; }
17804
17864
  finally {
17805
17865
  try {
17806
17866
  if (_g && !_g.done && (_e = _f.return)) _e.call(_f);
17807
17867
  }
17808
- finally { if (e_35) throw e_35.error; }
17868
+ finally { if (e_37) throw e_37.error; }
17809
17869
  }
17810
17870
  }
17811
17871
  return null;
17812
17872
  };
17813
17873
  ControlTreeNode.prototype.findSchemaInTree = function (node, schemaPath) {
17814
- var e_36, _e;
17874
+ var e_38, _e;
17815
17875
  if (node.schemaPath != null && node.schemaPath.toLowerCase() == schemaPath.toLowerCase()) {
17816
17876
  return node;
17817
17877
  }
@@ -17826,12 +17886,12 @@
17826
17886
  }
17827
17887
  }
17828
17888
  }
17829
- catch (e_36_1) { e_36 = { error: e_36_1 }; }
17889
+ catch (e_38_1) { e_38 = { error: e_38_1 }; }
17830
17890
  finally {
17831
17891
  try {
17832
17892
  if (_g && !_g.done && (_e = _f.return)) _e.call(_f);
17833
17893
  }
17834
- finally { if (e_36) throw e_36.error; }
17894
+ finally { if (e_38) throw e_38.error; }
17835
17895
  }
17836
17896
  }
17837
17897
  return null;