gis-common 5.1.29 → 5.1.30
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.
- package/dist/gis-common.es.js +10 -4
- package/dist/gis-common.umd.js +1 -1
- package/dist/index.d.ts +5 -3
- package/package.json +1 -1
package/dist/gis-common.es.js
CHANGED
|
@@ -2864,12 +2864,18 @@ const TreeUtil = {
|
|
|
2864
2864
|
* @param data 树形结构的节点数组
|
|
2865
2865
|
* @returns 展平后的一维节点数组
|
|
2866
2866
|
*/
|
|
2867
|
-
flatTree(data) {
|
|
2867
|
+
flatTree(data, leaf) {
|
|
2868
2868
|
let result = [];
|
|
2869
2869
|
data.forEach((node) => {
|
|
2870
|
-
|
|
2870
|
+
if (leaf) {
|
|
2871
|
+
if (!node.children || node.children.length === 0) {
|
|
2872
|
+
result.push(node);
|
|
2873
|
+
}
|
|
2874
|
+
} else {
|
|
2875
|
+
result.push(node);
|
|
2876
|
+
}
|
|
2871
2877
|
if (node.children && node.children.length > 0) {
|
|
2872
|
-
result = result.concat(this.flatTree(node.children));
|
|
2878
|
+
result = result.concat(this.flatTree(node.children, leaf));
|
|
2873
2879
|
}
|
|
2874
2880
|
});
|
|
2875
2881
|
return result;
|
|
@@ -3472,7 +3478,7 @@ class DateTime extends Date {
|
|
|
3472
3478
|
return fmt;
|
|
3473
3479
|
}
|
|
3474
3480
|
addDate(interval, number) {
|
|
3475
|
-
const date = new
|
|
3481
|
+
const date = new DateTime(this);
|
|
3476
3482
|
switch (interval) {
|
|
3477
3483
|
case "y":
|
|
3478
3484
|
date.setFullYear(this.getFullYear() + number);
|