@industry-theme/repository-composition-panels 0.2.25 → 0.2.26
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/panels.bundle.js +54 -26
- package/dist/panels.bundle.js.map +1 -1
- package/package.json +2 -2
package/dist/panels.bundle.js
CHANGED
|
@@ -7861,6 +7861,7 @@ function TreeNode({
|
|
|
7861
7861
|
style: { flexShrink: 0 }
|
|
7862
7862
|
}, rightContent));
|
|
7863
7863
|
}
|
|
7864
|
+
var GitStatusContext = React2.createContext(null);
|
|
7864
7865
|
var getGitStatusDisplay2 = (status, theme) => {
|
|
7865
7866
|
switch (status) {
|
|
7866
7867
|
case "M":
|
|
@@ -7941,38 +7942,38 @@ var sortGitNodes = (a2, b) => {
|
|
|
7941
7942
|
return 1;
|
|
7942
7943
|
return a2.name.localeCompare(b.name, void 0, { sensitivity: "base" });
|
|
7943
7944
|
};
|
|
7944
|
-
var
|
|
7945
|
+
var transformTreeStructure = (fileTree) => {
|
|
7945
7946
|
const transformNode = (node, parentId) => {
|
|
7946
7947
|
const id = parentId ? `${parentId}/${node.name}` : node.name;
|
|
7947
|
-
const gitStatus = gitStatusMap.get(id);
|
|
7948
7948
|
const arborNode = {
|
|
7949
7949
|
id,
|
|
7950
|
-
name: node.name
|
|
7951
|
-
gitStatus
|
|
7950
|
+
name: node.name
|
|
7952
7951
|
};
|
|
7953
7952
|
if ("children" in node && node.children) {
|
|
7954
7953
|
arborNode.children = node.children.map((child) => transformNode(child, id)).sort(sortGitNodes);
|
|
7955
|
-
if (arborNode.children) {
|
|
7956
|
-
const hasChangedChildren = arborNode.children.some((child) => child.gitStatus || child.hasChangedChildren);
|
|
7957
|
-
arborNode.hasChangedChildren = hasChangedChildren;
|
|
7958
|
-
}
|
|
7959
7954
|
}
|
|
7960
7955
|
return arborNode;
|
|
7961
7956
|
};
|
|
7962
7957
|
return fileTree.root.children.map((node) => transformNode(node, "")).sort(sortGitNodes);
|
|
7963
7958
|
};
|
|
7964
|
-
var filterGitStatusNodes = (nodes,
|
|
7965
|
-
if (showUnchangedFiles)
|
|
7966
|
-
return nodes;
|
|
7959
|
+
var filterGitStatusNodes = (nodes, gitStatusMap) => {
|
|
7967
7960
|
const result = [];
|
|
7961
|
+
const hasGitChanges = (node) => {
|
|
7962
|
+
if (gitStatusMap.has(node.id))
|
|
7963
|
+
return true;
|
|
7964
|
+
if (node.children) {
|
|
7965
|
+
return node.children.some((child) => hasGitChanges(child));
|
|
7966
|
+
}
|
|
7967
|
+
return false;
|
|
7968
|
+
};
|
|
7968
7969
|
for (const node of nodes) {
|
|
7969
7970
|
if (node.children) {
|
|
7970
|
-
if (node
|
|
7971
|
-
const filteredChildren = filterGitStatusNodes(node.children,
|
|
7971
|
+
if (hasGitChanges(node)) {
|
|
7972
|
+
const filteredChildren = filterGitStatusNodes(node.children, gitStatusMap);
|
|
7972
7973
|
result.push({ ...node, children: filteredChildren });
|
|
7973
7974
|
}
|
|
7974
7975
|
} else {
|
|
7975
|
-
if (node.
|
|
7976
|
+
if (gitStatusMap.has(node.id)) {
|
|
7976
7977
|
result.push(node);
|
|
7977
7978
|
}
|
|
7978
7979
|
}
|
|
@@ -7996,7 +7997,7 @@ var GitStatusFileTree = ({
|
|
|
7996
7997
|
fileTree,
|
|
7997
7998
|
theme,
|
|
7998
7999
|
gitStatusData,
|
|
7999
|
-
selectedDirectories = [],
|
|
8000
|
+
selectedDirectories: _selectedDirectories = [],
|
|
8000
8001
|
selectedFile,
|
|
8001
8002
|
onDirectorySelect,
|
|
8002
8003
|
onFileSelect,
|
|
@@ -8017,11 +8018,14 @@ var GitStatusFileTree = ({
|
|
|
8017
8018
|
}, [gitStatusData]);
|
|
8018
8019
|
const NodeRenderer = (props) => {
|
|
8019
8020
|
const { node } = props;
|
|
8020
|
-
const
|
|
8021
|
+
const ctx = React2.useContext(GitStatusContext);
|
|
8022
|
+
const gitStatus = ctx == null ? void 0 : ctx.gitStatusMap.get(node.data.id);
|
|
8023
|
+
const hasChangedChildren = ctx == null ? void 0 : ctx.hasChangedChildrenMap.get(node.data.id);
|
|
8024
|
+
const gitDisplay = gitStatus ? getGitStatusDisplay2(gitStatus, theme) : null;
|
|
8021
8025
|
let nameColor;
|
|
8022
8026
|
if (gitDisplay) {
|
|
8023
8027
|
nameColor = gitDisplay.color;
|
|
8024
|
-
} else if (
|
|
8028
|
+
} else if (hasChangedChildren) {
|
|
8025
8029
|
const baseColor = theme.colors.primary || "#007bff";
|
|
8026
8030
|
nameColor = baseColor + "80";
|
|
8027
8031
|
}
|
|
@@ -8039,7 +8043,7 @@ var GitStatusFileTree = ({
|
|
|
8039
8043
|
fontSize: "12px",
|
|
8040
8044
|
fontWeight: "bold"
|
|
8041
8045
|
}
|
|
8042
|
-
},
|
|
8046
|
+
}, gitStatus)) : null;
|
|
8043
8047
|
return /* @__PURE__ */ React2.createElement(TreeNode, {
|
|
8044
8048
|
...props,
|
|
8045
8049
|
theme,
|
|
@@ -8053,14 +8057,36 @@ var GitStatusFileTree = ({
|
|
|
8053
8057
|
}
|
|
8054
8058
|
});
|
|
8055
8059
|
};
|
|
8060
|
+
const treeStructure = useMemo(() => {
|
|
8061
|
+
return transformTreeStructure(fileTree);
|
|
8062
|
+
}, [fileTree]);
|
|
8056
8063
|
const treeData = useMemo(() => {
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
transformedData = filterGitStatusNodes(transformedData, showUnchangedFiles);
|
|
8064
|
+
if (showUnchangedFiles) {
|
|
8065
|
+
return treeStructure;
|
|
8060
8066
|
}
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8067
|
+
return filterGitStatusNodes(treeStructure, gitStatusMap);
|
|
8068
|
+
}, [treeStructure, showUnchangedFiles, gitStatusMap]);
|
|
8069
|
+
const hasChangedChildrenMap = useMemo(() => {
|
|
8070
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
8071
|
+
const markChangedParents = (nodes) => {
|
|
8072
|
+
let hasChanged = false;
|
|
8073
|
+
for (const node of nodes) {
|
|
8074
|
+
if (node.children) {
|
|
8075
|
+
const childrenChanged = markChangedParents(node.children);
|
|
8076
|
+
if (childrenChanged) {
|
|
8077
|
+
map2.set(node.id, true);
|
|
8078
|
+
hasChanged = true;
|
|
8079
|
+
}
|
|
8080
|
+
}
|
|
8081
|
+
if (gitStatusMap.has(node.id)) {
|
|
8082
|
+
hasChanged = true;
|
|
8083
|
+
}
|
|
8084
|
+
}
|
|
8085
|
+
return hasChanged;
|
|
8086
|
+
};
|
|
8087
|
+
markChangedParents(treeData);
|
|
8088
|
+
return map2;
|
|
8089
|
+
}, [treeData, gitStatusMap]);
|
|
8064
8090
|
const handleSelect = (selectedNodes) => {
|
|
8065
8091
|
const selectedFiles = selectedNodes.filter((node) => !node.data.children).map((node) => node.data.id);
|
|
8066
8092
|
const selectedDirs = selectedNodes.filter((node) => node.data.children).map((node) => node.data.id);
|
|
@@ -8088,15 +8114,17 @@ var GitStatusFileTree = ({
|
|
|
8088
8114
|
fontFamily: theme.fonts.body,
|
|
8089
8115
|
...autoHeight ? {} : { height: "100%" }
|
|
8090
8116
|
}
|
|
8117
|
+
}, /* @__PURE__ */ React2.createElement(GitStatusContext.Provider, {
|
|
8118
|
+
value: { gitStatusMap, hasChangedChildrenMap }
|
|
8091
8119
|
}, /* @__PURE__ */ React2.createElement(Tree, {
|
|
8092
|
-
|
|
8120
|
+
data: treeData,
|
|
8093
8121
|
onSelect: handleSelect,
|
|
8094
8122
|
...selectedFile !== void 0 && { selection: selectedFile },
|
|
8095
8123
|
...openByDefault !== void 0 && { openByDefault },
|
|
8096
8124
|
width: "100%",
|
|
8097
8125
|
height: containerHeight,
|
|
8098
8126
|
rowHeight: 28
|
|
8099
|
-
}, NodeRenderer));
|
|
8127
|
+
}, NodeRenderer)));
|
|
8100
8128
|
};
|
|
8101
8129
|
class _ {
|
|
8102
8130
|
static buildTreeFromPaths(j, k = "") {
|