tnx-shared 5.1.403 → 5.1.404

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.
Files changed (32) hide show
  1. package/bundles/tnx-shared.umd.js +111 -28
  2. package/bundles/tnx-shared.umd.js.map +1 -1
  3. package/bundles/tnx-shared.umd.min.js +1 -1
  4. package/bundles/tnx-shared.umd.min.js.map +1 -1
  5. package/classes/base/component-base.d.ts +9 -0
  6. package/classes/base/component-base.d.ts.map +1 -1
  7. package/classes/base/data-form-base.d.ts +2 -1
  8. package/classes/base/data-form-base.d.ts.map +1 -1
  9. package/components/add-news/add-news.component.d.ts.map +1 -1
  10. package/components/autocomplete-picker/autocomplete-picker.component.d.ts +1 -1
  11. package/components/autocomplete-picker/autocomplete-picker.component.d.ts.map +1 -1
  12. package/components/crud/crud-form/crud-form.component.d.ts +5 -2
  13. package/components/crud/crud-form/crud-form.component.d.ts.map +1 -1
  14. package/components/file-explorer/file-picker-dialog/file-picker-dialog.component.d.ts.map +1 -1
  15. package/components/file-explorer/file-picker-dialog/file-picker-dialog.component.scss.shim.ngstyle.d.ts.map +1 -0
  16. package/components/file-explorer/services/file-object.service.d.ts +2 -0
  17. package/components/file-explorer/services/file-object.service.d.ts.map +1 -1
  18. package/components/workflow/process-workflow-form/process-workflow-form.component.d.ts +0 -1
  19. package/components/workflow/process-workflow-form/process-workflow-form.component.d.ts.map +1 -1
  20. package/esm2015/classes/base/component-base.js +44 -1
  21. package/esm2015/classes/base/data-form-base.js +6 -2
  22. package/esm2015/components/add-news/add-news.component.js +2 -1
  23. package/esm2015/components/autocomplete-picker/autocomplete-picker.component.js +13 -9
  24. package/esm2015/components/crud/crud-form/crud-form.component.js +23 -3
  25. package/esm2015/components/file-explorer/file-picker-dialog/file-picker-dialog.component.js +5 -3
  26. package/esm2015/components/file-explorer/services/file-object.service.js +7 -1
  27. package/esm2015/components/workflow/process-workflow-form/process-workflow-form.component.js +10 -19
  28. package/fesm2015/tnx-shared.js +99 -28
  29. package/fesm2015/tnx-shared.js.map +1 -1
  30. package/package.json +2 -2
  31. package/tnx-shared.metadata.json +1 -1
  32. package/components/file-explorer/file-picker-dialog/file-picker-dialog.component.css.shim.ngstyle.d.ts.map +0 -1
@@ -9363,6 +9363,54 @@
9363
9363
  show: false
9364
9364
  });
9365
9365
  };
9366
+ ComponentBase.prototype.addDistinct = function (lst, value) {
9367
+ if (lst.indexOf(value) == -1) {
9368
+ lst.push(value);
9369
+ }
9370
+ };
9371
+ ComponentBase.prototype.addDistinctList = function (lst, lstValue) {
9372
+ if (!lstValue || !lstValue.length)
9373
+ return;
9374
+ lstValue.forEach(function (value) {
9375
+ if (lst.indexOf(value) == -1) {
9376
+ lst.push(value);
9377
+ }
9378
+ });
9379
+ };
9380
+ /**
9381
+ * Convert 1 array => N array
9382
+ * @param lst Mảng phần tử
9383
+ * @param fields Mảng các field, nếu field là kiểu array thì nghĩa là mún map distinct
9384
+ * @returns N Array
9385
+ */
9386
+ ComponentBase.prototype.multipleMap = function (lst) {
9387
+ var _this = this;
9388
+ var fields = [];
9389
+ for (var _i = 1; _i < arguments.length; _i++) {
9390
+ fields[_i - 1] = arguments[_i];
9391
+ }
9392
+ var result = [];
9393
+ var funcs = [];
9394
+ var rawFields = [];
9395
+ var _push = function (lst, value) { return lst.push(value); };
9396
+ fields.forEach(function (field) {
9397
+ result.push([]);
9398
+ if (Array.isArray(field)) {
9399
+ funcs.push(_this.addDistinct);
9400
+ rawFields.push(field[0]);
9401
+ }
9402
+ else {
9403
+ funcs.push(_push);
9404
+ rawFields.push(field);
9405
+ }
9406
+ });
9407
+ lst.forEach(function (item) {
9408
+ rawFields.forEach(function (field, index) {
9409
+ funcs[index](result[index], item[field]);
9410
+ });
9411
+ });
9412
+ return result;
9413
+ };
9366
9414
  ComponentBase.prototype._printPdf = function (baseService, id, rowData) {
9367
9415
  return __awaiter(this, void 0, void 0, function () {
9368
9416
  var itemDetail, data;
@@ -15859,6 +15907,13 @@
15859
15907
  ControlTreeNode.prototype.setCrudForm = function (crudForm) {
15860
15908
  this._crudForm = crudForm;
15861
15909
  };
15910
+ Object.defineProperty(ControlTreeNode.prototype, "crudForm", {
15911
+ get: function () {
15912
+ return this.rootNode._crudForm;
15913
+ },
15914
+ enumerable: false,
15915
+ configurable: true
15916
+ });
15862
15917
  Object.defineProperty(ControlTreeNode.prototype, "parentModel", {
15863
15918
  get: function () {
15864
15919
  if (this.parentNode)
@@ -16044,12 +16099,29 @@
16044
16099
  tableNode.model = [];
16045
16100
  }
16046
16101
  tableNode.model.splice(0, tableNode.model.length);
16102
+ tableNode.setDataSourceInternal(dataSource);
16103
+ };
16104
+ ControlTreeNode.prototype.setDataSourceInternal = function (dataSource) {
16105
+ if (!(this.control instanceof TableSchema))
16106
+ return;
16047
16107
  if (dataSource.length == 0) {
16048
- tableNode.reinitChildNodes();
16108
+ this.reinitChildNodes();
16049
16109
  return;
16050
16110
  }
16051
16111
  for (var i = 0; i < dataSource.length; i++) {
16052
- this.rootNode._crudForm.addNewRow(tableNode.control, path, null, true, dataSource[i], i == dataSource.length - 1);
16112
+ this.rootNode._crudForm.addNewRow(this.control, this.modelPath, null, true, dataSource[i], i == dataSource.length - 1);
16113
+ }
16114
+ };
16115
+ ControlTreeNode.prototype.setValue = function (value) {
16116
+ if (this.control instanceof TableSchema) {
16117
+ this.setDataSourceInternal(value);
16118
+ }
16119
+ else if (this.control instanceof ContainerSchema) {
16120
+ this.parentNode.data[this.control.field] = value;
16121
+ this.crudForm.initControlDefaultValue(this.parentNode.data, this.control, this.parentNode.modelPath);
16122
+ }
16123
+ else {
16124
+ this.model = value;
16053
16125
  }
16054
16126
  };
16055
16127
  return ControlTreeNode;
@@ -17151,7 +17223,11 @@
17151
17223
  schema.required = false;
17152
17224
  };
17153
17225
  DataFormBase.prototype._setModelValue = function (field, value) {
17154
- this.crudForm._modelData[field] = value;
17226
+ var node = this.crudForm._rootNode.getNodeByPath(field);
17227
+ this._setModelValueByNode(node, value);
17228
+ };
17229
+ DataFormBase.prototype._setModelValueByNode = function (node, value) {
17230
+ node.setValue(value);
17155
17231
  this.crudForm.fireModelChanged();
17156
17232
  };
17157
17233
  DataFormBase.prototype.modifyDetailData = function (data) {
@@ -26615,9 +26691,17 @@
26615
26691
  function FileObjectService(http, injector, _moduleConfigService) {
26616
26692
  var _this = _super.call(this, http, injector, _moduleConfigService.getConfig().environment.apiDomain.fileEndpoint + "/" + _moduleConfigService.getConfig().environment.apiVersion + "/FileObject") || this;
26617
26693
  _this._moduleConfigService = _moduleConfigService;
26694
+ _this.thumborEndpoint = '';
26618
26695
  _this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.fileEndpoint;
26696
+ _this.thumborEndpoint = _moduleConfigService.getConfig().environment.apiDomain.thumbor;
26619
26697
  return _this;
26620
26698
  }
26699
+ FileObjectService.prototype.getFileUrlWithThumbor = function (fileId, width, height) {
26700
+ if (width === void 0) { width = 0; }
26701
+ if (height === void 0) { height = 0; }
26702
+ var url = this.thumborEndpoint + "/unsafe/" + width + "x" + height + "/smart/" + this.endPoint + "/v5/FileObject/public/" + fileId + "/download";
26703
+ return url;
26704
+ };
26621
26705
  FileObjectService.prototype.copyMultipleFile = function (idsFile, idDesFolder) {
26622
26706
  var url = this.serviceUri + "/CopyMultipleFile?parentFolderId=" + idDesFolder;
26623
26707
  return this.defaultPost(url, idsFile);
@@ -34341,7 +34425,9 @@
34341
34425
  }
34342
34426
  }
34343
34427
  if (element.extension.toUpperCase() == '.PNG' || element.extension.toUpperCase() == '.JPG' || element.extension.toUpperCase() == '.JPEG') {
34344
- result = '<div style="width:100%; margin-bottom: 15px;text-align: center;"><img style="display:block; margin:auto;" width="500" src="' + this._fileObjectService.endPoint + '/v5/FileObject/public/' + element.id + '/download" /><p><em>Tiêu đề hình ảnh</em></p></div>';
34428
+ result = '<div style="width:100%; margin-bottom: 15px;text-align: center;"><img style="display:block; margin:auto;" width="500" src="'
34429
+ + this._fileObjectService.getFileUrlWithThumbor(element.id, 1080)
34430
+ + '" /><p><em>Tiêu đề hình ảnh</em></p></div>';
34345
34431
  }
34346
34432
  else if (element.extension.toUpperCase() == '.MP3' || element.extension.toUpperCase() == '.WMA' || element.extension.toUpperCase() == '.FLAC' || element.extension.toUpperCase() == '.AAC' || element.extension.toUpperCase() == '.OGG') {
34347
34433
  result = '<div style="width:100%; margin-bottom: 15px"><audio style="display: block;margin-left: auto;margin-right: auto;" controls><source src="' + this._fileObjectService.endPoint + '/v5/FileObject/public/' + element.id + '/download" type="audio/mpeg"></audio></div>';
@@ -34368,7 +34454,7 @@
34368
34454
  FilePickerDialogComponent.decorators = [
34369
34455
  { type: i0.Component, args: [{
34370
34456
  selector: 'file-picker-dialog',
34371
- template: "<crud-form #crudForm [(data)]=\"model.data\" [setting]=\"setting\" [context]=\"context\" [disableCaching]=\"true\"\r\n (onFormReady)=\"_handleFormReady($event)\">\r\n <ng-template #fileManager let-control=\"control\">\r\n <file-manager serviceCode=\"user\" entity=\"user\" entityKey=\"entityKey\" label=\"My folder\" [dataType]=\"model.data.fileType\"\r\n (onSelected)=\"selectedFile($event)\"></file-manager>\r\n </ng-template>\r\n</crud-form>\r\n<ng-template #buttonTemplate>\r\n <button type=\"button\" pButton icon=\"pi pi-save\" class=\"p-button-text\" [label]=\"'FORM.SAVE' | translate\"\r\n (click)=\"chooseFiles($event)\"></button>\r\n\r\n <button type=\"button\" pButton icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\r\n [label]=\"'FORM.CANCEL' | translate\" preventTab (click)=\"_handleCancel($event)\"></button>\r\n</ng-template>\r\n",
34457
+ template: "<crud-form #crudForm [(data)]=\"model.data\" [setting]=\"setting\" [context]=\"context\" [disableCaching]=\"true\"\r\n (onFormReady)=\"_handleFormReady($event)\">\r\n <ng-template #fileManager let-control=\"control\">\r\n <file-manager serviceCode=\"user\" entity=\"user\" [entityKey]=\"entityKey\" label=\"My folder\"\r\n [dataType]=\"model.data.fileType\" (onSelected)=\"selectedFile($event)\"></file-manager>\r\n </ng-template>\r\n</crud-form>\r\n<ng-template #buttonTemplate>\r\n <button type=\"button\" pButton icon=\"pi pi-save\" class=\"p-button-text\" [label]=\"'FORM.SAVE' | translate\"\r\n (click)=\"chooseFiles($event)\"></button>\r\n\r\n <button type=\"button\" pButton icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\r\n [label]=\"'FORM.CANCEL' | translate\" preventTab (click)=\"_handleCancel($event)\"></button>\r\n</ng-template>",
34372
34458
  providers: [ComponentContextService],
34373
34459
  styles: [""]
34374
34460
  },] }
@@ -38712,25 +38798,16 @@
38712
38798
  roleIds: (_f = this.action.data.roleViewIds) !== null && _f !== void 0 ? _f : [],
38713
38799
  type: exports.EnumProcessWorkflowType.VIEW
38714
38800
  };
38715
- this.addDistinct(this.dataAllowEdit.userIds, this.initValueForTargetForm.lstUserId);
38716
- this.addDistinct(this.dataAllowEdit.departmentIds, this.initValueForTargetForm.lstDonViId);
38717
- this.addDistinct(this.dataAllowEdit.groupIds, this.initValueForTargetForm.lstGroupId);
38718
- this.addDistinct(this.dataAllowEdit.roleIds, this.initValueForTargetForm.lstRoleId);
38719
- this.addDistinct(this.dataOnlyView.userIds, this.initValueForTargetForm.lstUserViewId);
38720
- this.addDistinct(this.dataOnlyView.departmentIds, this.initValueForTargetForm.lstDonViViewId);
38721
- this.addDistinct(this.dataOnlyView.groupIds, this.initValueForTargetForm.lstGroupViewId);
38722
- this.addDistinct(this.dataOnlyView.roleIds, this.initValueForTargetForm.lstRoleViewId);
38801
+ this.addDistinctList(this.dataAllowEdit.userIds, this.initValueForTargetForm.lstUserId);
38802
+ this.addDistinctList(this.dataAllowEdit.departmentIds, this.initValueForTargetForm.lstDonViId);
38803
+ this.addDistinctList(this.dataAllowEdit.groupIds, this.initValueForTargetForm.lstGroupId);
38804
+ this.addDistinctList(this.dataAllowEdit.roleIds, this.initValueForTargetForm.lstRoleId);
38805
+ this.addDistinctList(this.dataOnlyView.userIds, this.initValueForTargetForm.lstUserViewId);
38806
+ this.addDistinctList(this.dataOnlyView.departmentIds, this.initValueForTargetForm.lstDonViViewId);
38807
+ this.addDistinctList(this.dataOnlyView.groupIds, this.initValueForTargetForm.lstGroupViewId);
38808
+ this.addDistinctList(this.dataOnlyView.roleIds, this.initValueForTargetForm.lstRoleViewId);
38723
38809
  this.formReady = true;
38724
38810
  };
38725
- ProcessWorkflowFormComponent.prototype.addDistinct = function (dest, source) {
38726
- if (!source || !source.length)
38727
- return;
38728
- source.forEach(function (item) {
38729
- if (dest.indexOf(item) == -1) {
38730
- dest.push(item);
38731
- }
38732
- });
38733
- };
38734
38811
  ProcessWorkflowFormComponent.prototype.onFormInitialized = function (evt) {
38735
38812
  return __awaiter(this, void 0, void 0, function () {
38736
38813
  return __generator(this, function (_g) {
@@ -43737,6 +43814,7 @@
43737
43814
  AddNewsComponent.prototype.modifyGridInfo = function (gridInfo) {
43738
43815
  return __awaiter(this, void 0, void 0, function () {
43739
43816
  return __generator(this, function (_a) {
43817
+ gridInfo.fields = 'id,name,newsCategoryId,type,articleType,numberView,modified,releaseDate';
43740
43818
  gridInfo.filters.splice(0, 0, this.newFilter('type', exports.Operator.equal, 'NEWS'));
43741
43819
  gridInfo.filters.splice(0, 0, this.newFilter('statusView', exports.Operator.equal, ItemStatus.DaXuatBan));
43742
43820
  gridInfo.filters.splice(0, 0, this.newFilter('releaseDate', exports.Operator.lowerThanEqual, new Date()));
@@ -44284,14 +44362,19 @@
44284
44362
  this._commonService.addDistinct(arrDisplayField, arrField);
44285
44363
  return arrField.toString();
44286
44364
  };
44287
- AutoCompletePickerComponent.prototype.getDropdownOptions = function () {
44288
- return new DropdownOptions({
44365
+ AutoCompletePickerComponent.prototype.getDropdownOptions = function (pageSize) {
44366
+ if (pageSize === void 0) { pageSize = null; }
44367
+ var result = new DropdownOptions({
44289
44368
  displayField: this.control.displayField,
44290
44369
  valueField: this.control.valueField,
44291
44370
  fieldPlus: this.control.fieldPlus,
44292
44371
  funcGetLabel: this.control.funcGetLabel,
44293
44372
  plusUrl: this.control.plusUrl
44294
44373
  });
44374
+ if (pageSize) {
44375
+ result.pageSize = pageSize;
44376
+ }
44377
+ return result;
44295
44378
  };
44296
44379
  AutoCompletePickerComponent.prototype.showPickForm = function () {
44297
44380
  return __awaiter(this, void 0, void 0, function () {
@@ -44547,7 +44630,7 @@
44547
44630
  if (!(this.value && this.value.length > 0)) return [3 /*break*/, 2];
44548
44631
  return [4 /*yield*/, this.control.baseService.getDataDropdownByFilter([
44549
44632
  this.newFilter(this.control.valueField, exports.Operator.in, this.value)
44550
- ], this.getDropdownOptions())];
44633
+ ], this.getDropdownOptions(this.value.length))];
44551
44634
  case 1:
44552
44635
  dataSource = _a.sent();
44553
44636
  this.fireEventAfterGetDataDropDown(dataSource);
@@ -44561,7 +44644,7 @@
44561
44644
  if (!this.value) return [3 /*break*/, 5];
44562
44645
  return [4 /*yield*/, this.control.baseService.getDataDropdownByFilter([
44563
44646
  this.newFilter(this.control.valueField, exports.Operator.equal, this.value)
44564
- ], this.getDropdownOptions())];
44647
+ ], this.getDropdownOptions(1))];
44565
44648
  case 4:
44566
44649
  dataSource = _a.sent();
44567
44650
  this.fireEventAfterGetDataDropDown(dataSource);
@@ -44644,7 +44727,7 @@
44644
44727
  return [4 /*yield*/, appendDefaultFilter(filters, this.control.defaultFilters)];
44645
44728
  case 1:
44646
44729
  _a.sent();
44647
- this.control.baseService.getDataDropdownByFilter(filters, this.getDropdownOptions()).then(function (res) {
44730
+ this.control.baseService.getDataDropdownByFilter(filters, this.getDropdownOptions(obj.length)).then(function (res) {
44648
44731
  _this.fireEventAfterGetDataDropDown(res);
44649
44732
  _this.reStructureDataSource(res);
44650
44733
  _this.results = _this.dataSource;
@@ -44660,7 +44743,7 @@
44660
44743
  case 3: return [3 /*break*/, 5];
44661
44744
  case 4:
44662
44745
  if (obj != null) {
44663
- this.control.baseService.getDataDropdownByFilter([this.newFilter(this.control.valueField, exports.Operator.equal, obj)], this.getDropdownOptions()).then(function (res) {
44746
+ this.control.baseService.getDataDropdownByFilter([this.newFilter(this.control.valueField, exports.Operator.equal, obj)], this.getDropdownOptions(1)).then(function (res) {
44664
44747
  if (res.length > 0) {
44665
44748
  _this.fireEventAfterGetDataDropDown(res);
44666
44749
  _this.reStructureDataSource(res);