@ticatec/uniface-element 0.3.19 → 0.3.20

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.
@@ -64,6 +64,7 @@ export interface ITreeNode<T> {
64
64
  * @returns 子节点数组,如果没有子节点返回 null
65
65
  */
66
66
  get children(): Array<ITreeNode<T>> | null;
67
+ sort(compareFn: (a: T, b: T) => number): void;
67
68
  append(childItem: T | Array<T>): ITreeNode<T> | Array<ITreeNode<T>>;
68
69
  /**
69
70
  * 从父节点中分离(删除当前节点)
@@ -157,6 +158,7 @@ declare class TreeNode<T> implements ITreeNode<T> {
157
158
  * @returns 子节点数组的浅拷贝,如果没有子节点返回 null
158
159
  */
159
160
  get children(): Array<TreeNode<T>> | null;
161
+ sort(compareFn: (a: T, b: T) => number): void;
160
162
  set children(value: Array<TreeNode<T>>);
161
163
  /**
162
164
  * 添加子节点
@@ -131,6 +131,9 @@ class TreeNode {
131
131
  get children() {
132
132
  return this._children ? [...this._children] : null;
133
133
  }
134
+ sort(compareFn) {
135
+ this._children?.sort((c1, c2) => compareFn(c1.item, c2.item));
136
+ }
134
137
  set children(value) {
135
138
  this._children = value;
136
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-element",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "A comprehensive UI component library for Svelte applications with rich form controls, data tables, layouts and interactive elements",
5
5
  "keywords": [
6
6
  "svelte",