tnx-shared 5.1.420 → 5.1.421

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.
@@ -7479,10 +7479,10 @@
7479
7479
  result.push(data);
7480
7480
  continue;
7481
7481
  }
7482
- data._level = ++dataParent._level;
7482
+ data._level = dataParent._level + 1;
7483
7483
  data._prefix = dataParent._root === true
7484
7484
  ? '|--'
7485
- : dataParent.data._prefix + '---';
7485
+ : dataParent._prefix + '---';
7486
7486
  dataMap.set(nodeKey, data);
7487
7487
  result.push(data);
7488
7488
  }
@@ -7599,7 +7599,7 @@
7599
7599
  var e_5, _a;
7600
7600
  // count++;
7601
7601
  node.data._prefix = prefix;
7602
- node.data._level = ++parentNode.data._level;
7602
+ node.data._level = parentNode.data._level + 1;
7603
7603
  result.push(node.data);
7604
7604
  if (node.children == null || node.children.length == 0) {
7605
7605
  return;
@@ -7679,17 +7679,46 @@
7679
7679
  options = new DropdownOptions();
7680
7680
  this.setDefaultOptionsTree(options, fieldParent);
7681
7681
  return new Promise(function (resolve, reject) {
7682
- _this._getDataDropdownByFilter(filters, options)
7683
- .then(function (res) {
7684
- var treeData = options.isTreeBaseModel === true
7685
- ? _this.getTreeModelBase(res.data, fieldParent, options.fieldParentTreeItem)
7686
- : _this.getTreeData(res.data, fieldParent, options.fieldParentTreeItem);
7687
- res.data = treeData;
7688
- resolve(res);
7689
- })
7690
- .catch(function (err) { return reject(err); });
7682
+ if (options.isTreeBaseModel) {
7683
+ var gridInfo = _this.generateGridInfoDropdown(filters, options);
7684
+ _this.baseGetTreeData(gridInfo)
7685
+ .then(function (res) {
7686
+ var treeData = _this.getTreeModelBase(res.data, fieldParent, options.fieldParentTreeItem);
7687
+ res.data = treeData;
7688
+ resolve(res);
7689
+ })
7690
+ .catch(function (err) { return reject(err); });
7691
+ }
7692
+ else {
7693
+ _this._getDataDropdownByFilter(filters, options)
7694
+ .then(function (res) {
7695
+ var treeData = _this.getTreeData(res.data, fieldParent, options.fieldParentTreeItem);
7696
+ res.data = treeData;
7697
+ resolve(res);
7698
+ })
7699
+ .catch(function (err) { return reject(err); });
7700
+ }
7691
7701
  });
7692
7702
  };
7703
+ BaseService.prototype.getFieldsFromDropdownOptions = function (options) {
7704
+ var fields = [];
7705
+ if (options.valueField && options.valueField !== '') {
7706
+ fields.push(options.valueField);
7707
+ }
7708
+ if (options.displayField && options.displayField !== '') {
7709
+ fields.push(options.displayField);
7710
+ }
7711
+ if (options.fieldParentTreeItem && options.fieldParentTreeItem !== '') {
7712
+ fields.push(options.fieldParentTreeItem);
7713
+ }
7714
+ if (options.fieldTree && options.fieldTree !== '') {
7715
+ fields.push(options.fieldTree);
7716
+ }
7717
+ if (options.fieldPlus && options.fieldPlus !== '') {
7718
+ fields.push.apply(fields, __spread(options.fieldPlus.split(',').filter(function (x) { return x !== ''; })));
7719
+ }
7720
+ return Array.from(new Set(fields)).join(',');
7721
+ };
7693
7722
  /**
7694
7723
  * get detail với api do Dev tự viết, mặc định url 'Custom/{id}'
7695
7724
  * @param id - id bản ghi
@@ -32394,7 +32423,7 @@
32394
32423
  };
32395
32424
  DropdownComponent.prototype.setDefaultSetting = function () {
32396
32425
  var _this = this;
32397
- if (this.control.isTree) {
32426
+ if (this.control.isTree || this.control.isTreeBaseModel) {
32398
32427
  this.delayFilter = 200;
32399
32428
  if (!this.control.funcGetLabel) {
32400
32429
  this.control.funcGetLabel = function (item) {