zzz-pc-view 0.0.58 → 0.0.60
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
|
@@ -44,7 +44,7 @@ export interface Param<T extends TypeWithPrototype = TypeWithPrototype> {
|
|
|
44
44
|
api: ApiList<T>;
|
|
45
45
|
query?: any;
|
|
46
46
|
global?: boolean;
|
|
47
|
-
childrenKey?: KeyMatch<CombineInstanceType<T>, undefined | CombineInstanceType<T>[]>;
|
|
47
|
+
childrenKey?: KeyMatch<CombineInstanceType<T>, undefined | null | CombineInstanceType<T>[]>;
|
|
48
48
|
onLoaded?: (list: CombineInstanceType<T>[]) => CombineInstanceType<T>[];
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
@@ -61,7 +61,7 @@ declare class LoaderConfig<T extends TypeWithPrototype = TypeWithPrototype> impl
|
|
|
61
61
|
api: ApiList<T>;
|
|
62
62
|
query: any;
|
|
63
63
|
global: boolean;
|
|
64
|
-
childrenKey?: KeyMatch<CombineInstanceType<T>, undefined | CombineInstanceType<T>[]>;
|
|
64
|
+
childrenKey?: KeyMatch<CombineInstanceType<T>, undefined | null | CombineInstanceType<T>[]>;
|
|
65
65
|
onLoaded?: (list: CombineInstanceType<T>[]) => CombineInstanceType<T>[];
|
|
66
66
|
/**
|
|
67
67
|
* 构造函数
|
package/src/index.es.js
CHANGED
|
@@ -3080,15 +3080,19 @@ const setList = (config, list2) => {
|
|
|
3080
3080
|
if (typeof onLoaded === "function") {
|
|
3081
3081
|
list2 = onLoaded(list2);
|
|
3082
3082
|
}
|
|
3083
|
-
|
|
3083
|
+
const { target } = config;
|
|
3084
|
+
if (list2.length > 0 && !(list2[0] instanceof target)) {
|
|
3084
3085
|
const { childrenKey } = config;
|
|
3085
3086
|
if (childrenKey) {
|
|
3086
|
-
|
|
3087
|
+
const primaryKey = getByClass(target).propertyKey;
|
|
3088
|
+
const map2 = toKeyValue(list2, primaryKey);
|
|
3089
|
+
const treeList = target.bindList(toFlat(list2, childrenKey));
|
|
3090
|
+
list2 = treeList.filter((node) => map2[node[primaryKey]]);
|
|
3087
3091
|
} else {
|
|
3088
|
-
list2 =
|
|
3092
|
+
list2 = target.bindList(list2);
|
|
3089
3093
|
}
|
|
3090
3094
|
}
|
|
3091
|
-
|
|
3095
|
+
target[storeKey].listRef.value = list2;
|
|
3092
3096
|
return list2;
|
|
3093
3097
|
};
|
|
3094
3098
|
const loadGlobal = async () => {
|