cloud-web-corejs 1.0.54-dev.684 → 1.0.54-dev.685
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/package.json
CHANGED
|
@@ -1108,8 +1108,28 @@ export default {
|
|
|
1108
1108
|
});
|
|
1109
1109
|
});
|
|
1110
1110
|
},
|
|
1111
|
+
async clampPathToMaxLevel(path) {
|
|
1112
|
+
if (!path || !path.length || path.length <= this.maxLevel) {
|
|
1113
|
+
return path || [];
|
|
1114
|
+
}
|
|
1115
|
+
const trimmed = path.slice(0, this.maxLevel);
|
|
1116
|
+
const last = trimmed[trimmed.length - 1];
|
|
1117
|
+
const id = this.getAreaId(last);
|
|
1118
|
+
if (id != null && (!last.name || !last.fullName)) {
|
|
1119
|
+
const detail = await this.fetchAreaById(id);
|
|
1120
|
+
if (detail) {
|
|
1121
|
+
trimmed[trimmed.length - 1] = detail;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
return trimmed;
|
|
1125
|
+
},
|
|
1111
1126
|
async applySelection(item) {
|
|
1112
|
-
|
|
1127
|
+
let path = this.selectedPath.length
|
|
1128
|
+
? this.selectedPath.map((node) => ({ ...node }))
|
|
1129
|
+
: [item];
|
|
1130
|
+
path = await this.clampPathToMaxLevel(path);
|
|
1131
|
+
this.selectedPath = path.map((node) => ({ ...node }));
|
|
1132
|
+
this.activeLevel = path.length || 1;
|
|
1113
1133
|
let last = path[path.length - 1] || item;
|
|
1114
1134
|
const leafId = this.getAreaId(last);
|
|
1115
1135
|
if (leafId != null && !last.fullName) {
|
|
@@ -1117,6 +1137,8 @@ export default {
|
|
|
1117
1137
|
if (detail) {
|
|
1118
1138
|
last = detail;
|
|
1119
1139
|
if (path.length) {
|
|
1140
|
+
path = path.slice();
|
|
1141
|
+
path[path.length - 1] = detail;
|
|
1120
1142
|
this.$set(this.selectedPath, this.selectedPath.length - 1, detail);
|
|
1121
1143
|
}
|
|
1122
1144
|
}
|