ps-toolkit-ui 1.22.20 → 1.22.22

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.
@@ -2083,7 +2083,7 @@ class InputClass {
2083
2083
  const rs = this.getSelectedOptions(f.options);
2084
2084
  l = l.concat(rs);
2085
2085
  }
2086
- return l;
2086
+ return l.sort((a, b) => a.priority - b.priority);
2087
2087
  }
2088
2088
  getSelectedRows(rows = this.rows) {
2089
2089
  let l = [];
@@ -2112,6 +2112,7 @@ class OptionClass {
2112
2112
  constructor(name, value, options = [], cls = null, dis = false) {
2113
2113
  this.show = true;
2114
2114
  this.selected = false;
2115
+ this.priority = 0;
2115
2116
  this.parent = null;
2116
2117
  this.loading = false;
2117
2118
  this.disabled = false;
@@ -5846,6 +5847,7 @@ class FormSelectComponent {
5846
5847
  constructor() {
5847
5848
  this.changeIndex = new EventEmitter();
5848
5849
  this.cSearch = '';
5850
+ this.priority = 0;
5849
5851
  }
5850
5852
  get type() { return InputType; }
5851
5853
  ngOnInit() {
@@ -5861,6 +5863,7 @@ class FormSelectComponent {
5861
5863
  if (v != null) {
5862
5864
  this.inp.value = v.map(String);
5863
5865
  this.setValue(v.map(String));
5866
+ this.priority = v.map(String).length;
5864
5867
  }
5865
5868
  }
5866
5869
  };
@@ -5894,6 +5897,7 @@ class FormSelectComponent {
5894
5897
  }
5895
5898
  else {
5896
5899
  this.setValue([]);
5900
+ this.priority = 0;
5897
5901
  }
5898
5902
  if (this.inp.rel != null) {
5899
5903
  this.inp.rel.options = [];
@@ -5913,7 +5917,6 @@ class FormSelectComponent {
5913
5917
  d[this.inp.name + 'Name'] = this.inp.search;
5914
5918
  if (this.inp.addNew) {
5915
5919
  d[this.inp.name] = this.inp.search;
5916
- d[this.inp.name + 'Name'] = this.inp.search;
5917
5920
  d[this.inp.name + 'Id'] = this.inp.value;
5918
5921
  }
5919
5922
  return d;
@@ -5936,6 +5939,9 @@ class FormSelectComponent {
5936
5939
  setValue(ids, rows = this.inp.options) {
5937
5940
  for (const r of rows) {
5938
5941
  r.selected = ids.includes(r.value);
5942
+ if (r.selected) {
5943
+ r.priority = ids.indexOf(r.value);
5944
+ }
5939
5945
  if (this.inp.onlyChild) {
5940
5946
  if (r.selected) {
5941
5947
  this.checkParent(r.parent);
@@ -6113,6 +6119,7 @@ class FormSelectComponent {
6113
6119
  this.inp.value = op.value;
6114
6120
  this.inp.options.find(x => x.value === op.parent.value).options.forEach(x => x.selected = false);
6115
6121
  op.selected = true;
6122
+ op.priority = this.priority++;
6116
6123
  }
6117
6124
  }
6118
6125
  toggle(op) {
@@ -6133,6 +6140,7 @@ class FormSelectComponent {
6133
6140
  }
6134
6141
  check(c) {
6135
6142
  c.selected = true;
6143
+ c.priority = this.priority++;
6136
6144
  if (this.inp.onlyChild) {
6137
6145
  this.checkChildren(c);
6138
6146
  }
@@ -6157,6 +6165,7 @@ class FormSelectComponent {
6157
6165
  }
6158
6166
  else {
6159
6167
  p.selected = true;
6168
+ p.priority = this.priority++;
6160
6169
  }
6161
6170
  this.checkParent(p.parent);
6162
6171
  }