vue-layout-gitcode 1.12.53 → 1.12.54-multiple-account
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/GloabarSearch-BDNhph93.js +202 -0
- package/{MenuItem-BznpPcWm.js → MenuItem-BPWpzVf_.js} +5 -5
- package/{ProjectMenuList-1HqdBGW9.js → ProjectMenuList-_Q_qB-mQ.js} +12 -12
- package/{ProjectMenuListV2-CYynTRGA.js → ProjectMenuListV2-BcWPp3mC.js} +9 -9
- package/ProjectSearch-BR2Zu_zU.js +87 -0
- package/{SearchHistoryList-BRHEDL2D.js → SearchHistoryList-iGL9LbMG.js} +9 -12
- package/{SearchRecommed-DiWjRapV.js → SearchRecommed-DPla4Bfu.js} +15 -23
- package/{SearchScopeList-CNJd45Ge.js → SearchScopeList-Cl3Mjaa2.js} +5 -5
- package/{UserSearch-B68GygQe.js → UserSearch-BjXMgkLa.js} +16 -19
- package/{index-D__jXgPB.js → index-Bv5SHa4l.js} +2 -2
- package/{search-suggestion-DQTeiN-d.js → index-BwIAQssk.js} +140 -191
- package/{index-N8tCNQEp.js → index-DFn-iMIL.js} +2 -2
- package/{index-D6SmTn3U.js → index-DYOYbfLQ.js} +9938 -10560
- package/index.d.ts +375 -47
- package/index.js +14 -22
- package/{notice-Dleiw4LE.js → notice-Y6bk2JPj.js} +6 -7
- package/package.json +1 -1
- package/style.css +1 -1
- package/{transWebUrl-MIelOtyv.js → transWebUrl-yyTGj_5G.js} +3 -3
- package/GloabarSearch-D4WuCsub.js +0 -127
- package/ProjectSearch-g_ooyoDn.js +0 -121
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as useLayoutConfig } from "./index-DYOYbfLQ.js";
|
|
2
2
|
const layoutConfig = useLayoutConfig();
|
|
3
|
-
const transWebUrl = (url, params
|
|
3
|
+
const transWebUrl = (url, params) => {
|
|
4
4
|
if (!url) return url;
|
|
5
5
|
let processedUrl = url;
|
|
6
|
-
if (layoutConfig.VITE_ENV !== "production"
|
|
6
|
+
if (layoutConfig.VITE_ENV !== "production") {
|
|
7
7
|
const regex = /^(?:https?:\/\/)?(?:www\.)?([^\/]+)(\/.*)$/;
|
|
8
8
|
const match = url.match(regex);
|
|
9
9
|
processedUrl = match ? match[2] : url || "/";
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { defineComponent, inject, createElementBlock, openBlock, Fragment, renderList, withDirectives, createBlock, unref, ref, watch, createElementVNode, createCommentVNode, createVNode, toDisplayString } from "vue";
|
|
2
|
-
import { h as headRequest, R as REPO_MODULE, v as vElementExposure, b as REPO_EVENT, _ as _export_sfc, a as i18n, c as useLayoutConfig, G as GIcon } from "./index-D6SmTn3U.js";
|
|
3
|
-
import { u as useReportRepo, S as SearchRepoCard, m as mergeSearchSuggestions } from "./search-suggestion-DQTeiN-d.js";
|
|
4
|
-
import "vue-devui-lal/icon";
|
|
5
|
-
import "vue-devui-lal/icon/style.css";
|
|
6
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
7
|
-
__name: "SearchRepoCardList",
|
|
8
|
-
props: {
|
|
9
|
-
dataList: { default: () => [] },
|
|
10
|
-
searchStr: { default: "" },
|
|
11
|
-
type: { default: "" }
|
|
12
|
-
},
|
|
13
|
-
setup(__props) {
|
|
14
|
-
const props = __props;
|
|
15
|
-
const API = headRequest(inject("request"));
|
|
16
|
-
const { triggerReport } = useReportRepo({ moduleName: REPO_MODULE.SEARCH_SUGGESTION_CARD }, API.viewReport);
|
|
17
|
-
const useReport = inject("useReport");
|
|
18
|
-
const handleReport = (item) => {
|
|
19
|
-
useReport(REPO_EVENT.CLICK, { module_name: REPO_MODULE.SEARCH_SUGGESTION_CARD, repo_id: item.id });
|
|
20
|
-
};
|
|
21
|
-
return (_ctx, _cache) => {
|
|
22
|
-
return openBlock(true), createElementBlock(Fragment, null, renderList(props.dataList, (item, index) => {
|
|
23
|
-
return withDirectives((openBlock(), createBlock(SearchRepoCard, {
|
|
24
|
-
key: `${item.searchType || props.type}-${item.id}`,
|
|
25
|
-
class: "search-repo-list-card",
|
|
26
|
-
info: { ...item, index },
|
|
27
|
-
keyword: props.searchStr,
|
|
28
|
-
hover: "",
|
|
29
|
-
noborder: false,
|
|
30
|
-
hideTopicTags: "",
|
|
31
|
-
hideStarBtn: "",
|
|
32
|
-
hideFooter: "",
|
|
33
|
-
hideDescription: "",
|
|
34
|
-
onReport: () => handleReport(item),
|
|
35
|
-
cardType: item.searchType || props.type,
|
|
36
|
-
"url-params": { source_module: "search_project" },
|
|
37
|
-
"preserve-url-origin": item.searchType === "repo"
|
|
38
|
-
}, null, 8, ["info", "keyword", "onReport", "cardType", "preserve-url-origin"])), [
|
|
39
|
-
[unref(vElementExposure), { trigger: (type) => unref(triggerReport)(type, item) }]
|
|
40
|
-
]);
|
|
41
|
-
}), 128);
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const SearchRepoCardList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-vue-layout-gitcode"]]);
|
|
46
|
-
const _hoisted_1 = {
|
|
47
|
-
key: 0,
|
|
48
|
-
class: "history-list-project history-list-project--padded"
|
|
49
|
-
};
|
|
50
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
51
|
-
__name: "GloabarSearch",
|
|
52
|
-
props: {
|
|
53
|
-
searchStr: {}
|
|
54
|
-
},
|
|
55
|
-
emits: ["searchMore"],
|
|
56
|
-
setup(__props, { emit: __emit }) {
|
|
57
|
-
const emits = __emit;
|
|
58
|
-
const { t: $t } = i18n.global;
|
|
59
|
-
const API = headRequest(inject("request", () => Promise.resolve({ data: {} })));
|
|
60
|
-
const layoutConfig = useLayoutConfig();
|
|
61
|
-
const useReport = inject("useReport", () => {
|
|
62
|
-
});
|
|
63
|
-
const searchSuggestionList = ref([]);
|
|
64
|
-
const origin = window.location.origin;
|
|
65
|
-
const props = __props;
|
|
66
|
-
let timer = null;
|
|
67
|
-
const handleSearchAll = () => {
|
|
68
|
-
emits("searchMore", "all");
|
|
69
|
-
};
|
|
70
|
-
const getData = async () => {
|
|
71
|
-
if (!props.searchStr) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
useReport("search-project", {});
|
|
76
|
-
const res = await API.getGloabarSearchKeyLink({ q: props.searchStr });
|
|
77
|
-
searchSuggestionList.value = mergeSearchSuggestions({
|
|
78
|
-
response: res.data || {},
|
|
79
|
-
origin,
|
|
80
|
-
projectOrigin: layoutConfig.VITE_HOST
|
|
81
|
-
}).items;
|
|
82
|
-
} catch (error) {
|
|
83
|
-
console.error("Failed to fetch search results:", error);
|
|
84
|
-
searchSuggestionList.value = [];
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
if (props.searchStr) {
|
|
88
|
-
getData();
|
|
89
|
-
}
|
|
90
|
-
watch(
|
|
91
|
-
() => props.searchStr,
|
|
92
|
-
() => {
|
|
93
|
-
if (timer) {
|
|
94
|
-
clearTimeout(timer);
|
|
95
|
-
}
|
|
96
|
-
timer = setTimeout(() => {
|
|
97
|
-
getData();
|
|
98
|
-
}, 300);
|
|
99
|
-
}
|
|
100
|
-
);
|
|
101
|
-
return (_ctx, _cache) => {
|
|
102
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
103
|
-
createElementVNode("button", {
|
|
104
|
-
type: "button",
|
|
105
|
-
class: "global-search-all",
|
|
106
|
-
onClick: handleSearchAll
|
|
107
|
-
}, [
|
|
108
|
-
createVNode(GIcon, {
|
|
109
|
-
name: "gt-search",
|
|
110
|
-
color: "var(--theme-placeholder)"
|
|
111
|
-
}),
|
|
112
|
-
createElementVNode("span", null, toDisplayString(unref($t)("gitCodeLayout.header.searchAll", { keyword: __props.searchStr })), 1)
|
|
113
|
-
]),
|
|
114
|
-
searchSuggestionList.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
115
|
-
createVNode(SearchRepoCardList, {
|
|
116
|
-
"data-list": searchSuggestionList.value,
|
|
117
|
-
"search-str": __props.searchStr,
|
|
118
|
-
type: "repo"
|
|
119
|
-
}, null, 8, ["data-list", "search-str"])
|
|
120
|
-
])) : createCommentVNode("", true)
|
|
121
|
-
], 64);
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
export {
|
|
126
|
-
_sfc_main as default
|
|
127
|
-
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, inject, watch, computed, withDirectives, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, createVNode, vShow } from "vue";
|
|
2
|
-
import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-D6SmTn3U.js";
|
|
3
|
-
import { useRoute, useRouter } from "vue-router";
|
|
4
|
-
import "vue-devui-lal/icon";
|
|
5
|
-
import "vue-devui-lal/icon/style.css";
|
|
6
|
-
const extractSearchFileList = (response) => {
|
|
7
|
-
const responseData = Array.isArray(response) ? response : response == null ? void 0 : response.data;
|
|
8
|
-
const data = responseData && typeof responseData === "object" && !Array.isArray(responseData) && "data" in responseData ? responseData.data : responseData;
|
|
9
|
-
return Array.isArray(data) ? data.filter((item) => typeof item === "string") : [];
|
|
10
|
-
};
|
|
11
|
-
const _hoisted_1 = { class: "history-list-project history-list-project--padded" };
|
|
12
|
-
const _hoisted_2 = { class: "history-list-project-globartitle history-list-project-globartitle--gap" };
|
|
13
|
-
const _hoisted_3 = ["href"];
|
|
14
|
-
const _hoisted_4 = { class: "history-list-project-globarbox" };
|
|
15
|
-
const _hoisted_5 = { class: "ellipsis history-list-project__name" };
|
|
16
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
-
...{ name: "SearchFileList" },
|
|
18
|
-
__name: "ProjectSearch",
|
|
19
|
-
props: {
|
|
20
|
-
searchStr: {},
|
|
21
|
-
searchInfo: {},
|
|
22
|
-
isSearchPage: { type: Boolean }
|
|
23
|
-
},
|
|
24
|
-
setup(__props) {
|
|
25
|
-
const { t: $t } = i18n.global;
|
|
26
|
-
const props = __props;
|
|
27
|
-
const filedList = ref([]);
|
|
28
|
-
const route = useRoute();
|
|
29
|
-
const router = useRouter();
|
|
30
|
-
const API = headRequest(inject("request", () => Promise.resolve({ data: {} })));
|
|
31
|
-
let fileListRequestId = 0;
|
|
32
|
-
const loadFileList = async () => {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
const searchScopeName = (_a = props == null ? void 0 : props.searchInfo) == null ? void 0 : _a.searchScopeName;
|
|
35
|
-
const requestId = ++fileListRequestId;
|
|
36
|
-
if (!searchScopeName) {
|
|
37
|
-
filedList.value = [];
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const params = {
|
|
41
|
-
repoId: encodeURIComponent(searchScopeName),
|
|
42
|
-
ref_name: ((_b = props.searchInfo) == null ? void 0 : _b.branch) || ""
|
|
43
|
-
};
|
|
44
|
-
const res = await reqCatch(API.getRepoFileList, params);
|
|
45
|
-
if (requestId !== fileListRequestId) return;
|
|
46
|
-
filedList.value = extractSearchFileList(res == null ? void 0 : res.data);
|
|
47
|
-
};
|
|
48
|
-
watch(
|
|
49
|
-
() => {
|
|
50
|
-
var _a, _b;
|
|
51
|
-
return [(_a = props.searchInfo) == null ? void 0 : _a.searchScopeName, (_b = props.searchInfo) == null ? void 0 : _b.branch];
|
|
52
|
-
},
|
|
53
|
-
() => {
|
|
54
|
-
void loadFileList();
|
|
55
|
-
},
|
|
56
|
-
{ immediate: true }
|
|
57
|
-
);
|
|
58
|
-
const searchFileList = computed(() => {
|
|
59
|
-
return filedList.value.filter((item) => {
|
|
60
|
-
var _a;
|
|
61
|
-
return (_a = item == null ? void 0 : item.toLowerCase()) == null ? void 0 : _a.includes(props.searchStr);
|
|
62
|
-
}).splice(0, 5);
|
|
63
|
-
});
|
|
64
|
-
const getRoutePath = (filePath) => {
|
|
65
|
-
let params = {};
|
|
66
|
-
if (props.isSearchPage) {
|
|
67
|
-
const [namespace, repoName] = decodeURIComponent(props.searchInfo.repo).split("/");
|
|
68
|
-
params.namespace = namespace;
|
|
69
|
-
params.repoName = repoName;
|
|
70
|
-
} else {
|
|
71
|
-
params = (route == null ? void 0 : route.params) || {};
|
|
72
|
-
}
|
|
73
|
-
const defaultBranch = props.searchInfo.branch;
|
|
74
|
-
const branchName = Array.isArray(defaultBranch) ? defaultBranch : defaultBranch == null ? void 0 : defaultBranch.split("/");
|
|
75
|
-
const filePathList = filePath.split("/");
|
|
76
|
-
if (router == null ? void 0 : router.hasRoute("repoFile")) {
|
|
77
|
-
return router.resolve({
|
|
78
|
-
name: "repoFile",
|
|
79
|
-
params: {
|
|
80
|
-
...params,
|
|
81
|
-
branchName,
|
|
82
|
-
filePath: filePathList
|
|
83
|
-
},
|
|
84
|
-
query: {
|
|
85
|
-
init: "initTree"
|
|
86
|
-
}
|
|
87
|
-
}).href;
|
|
88
|
-
}
|
|
89
|
-
const joinSegments = (value) => {
|
|
90
|
-
const segmentList = Array.isArray(value) ? value : [value];
|
|
91
|
-
return segmentList.filter((seg) => seg !== void 0 && seg !== null && seg !== "").map((seg) => encodeURIComponent(String(seg))).join("/");
|
|
92
|
-
};
|
|
93
|
-
const repoSegment = params.repo || params.repoName;
|
|
94
|
-
return `/${params.namespace}/${repoSegment}/blob/${joinSegments(branchName)}/${joinSegments(filePathList)}?init=initTree`;
|
|
95
|
-
};
|
|
96
|
-
return (_ctx, _cache) => {
|
|
97
|
-
return withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
|
|
98
|
-
createElementVNode("p", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.header.file")), 1),
|
|
99
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(searchFileList.value, (item, index) => {
|
|
100
|
-
return openBlock(), createElementBlock("a", {
|
|
101
|
-
key: index,
|
|
102
|
-
href: getRoutePath(item)
|
|
103
|
-
}, [
|
|
104
|
-
createElementVNode("p", _hoisted_4, [
|
|
105
|
-
createVNode(GIcon, {
|
|
106
|
-
name: "gt-file-c",
|
|
107
|
-
style: { "flex-shrink": "0" }
|
|
108
|
-
}),
|
|
109
|
-
createElementVNode("span", _hoisted_5, toDisplayString(item), 1)
|
|
110
|
-
])
|
|
111
|
-
], 8, _hoisted_3);
|
|
112
|
-
}), 128))
|
|
113
|
-
], 512)), [
|
|
114
|
-
[vShow, searchFileList.value.length]
|
|
115
|
-
]);
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
export {
|
|
120
|
-
_sfc_main as default
|
|
121
|
-
};
|