@ticatec/uniface-element 0.1.49 → 0.1.50

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.
@@ -74,6 +74,7 @@ export class CommonTreeNodes {
74
74
  const parentKey = item[this.parentKeyField];
75
75
  if (this.checkIsRoot(item)) { //|| !this.nodeMap.has(parentKey)
76
76
  this._nodes.push(node);
77
+ this._nodes.sort(this.compareFun);
77
78
  }
78
79
  else {
79
80
  const parentNode = this.nodeMap.get(parentKey);
@@ -125,6 +126,9 @@ export default class TreeNodes extends CommonTreeNodes {
125
126
  if (parent && parent.children && parent.children.length > 0) {
126
127
  parent.children = parent.children.sort(this.compareFun);
127
128
  }
129
+ else {
130
+ this._nodes.sort(this.compareFun);
131
+ }
128
132
  }
129
133
  }
130
134
  remove(item) {
@@ -133,10 +137,18 @@ export default class TreeNodes extends CommonTreeNodes {
133
137
  if (node) {
134
138
  let parent = this.nodeMap.get(node.item[this.parentKeyField]);
135
139
  this.nodeMap.delete(idKey);
136
- if (parent && parent.children) {
137
- let pos = parent.children.findIndex(el => el.item[this.keyField] == idKey);
140
+ if (parent) {
141
+ if (parent.children) {
142
+ let pos = parent.children.findIndex(el => el.item[this.keyField] == idKey);
143
+ if (pos > -1) {
144
+ parent.children.splice(pos, 1);
145
+ }
146
+ }
147
+ }
148
+ else {
149
+ let pos = this._nodes.findIndex(el => el.item[this.keyField] == idKey);
138
150
  if (pos > -1) {
139
- parent.children.splice(pos, 1);
151
+ this._nodes.splice(pos, 1);
140
152
  }
141
153
  }
142
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-element",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "uniface web elements",
5
5
  "scripts": {
6
6
  "dev": "vite dev",