vue-layout-gitcode 1.12.34 → 1.12.36
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-CbyaXQ9_.js +154 -0
- package/{MenuItem-BJi1TIAW.js → MenuItem-CpNGRzXl.js} +5 -5
- package/{ProjectMenuList-B9ndArm7.js → ProjectMenuList-i-DG-Lp_.js} +20 -20
- package/{ProjectMenuListV2-C9gbFrMy.js → ProjectMenuListV2-BWAcoaLB.js} +10 -10
- package/{ProjectSearch-CKMlZXBZ.js → ProjectSearch-BF6NwnUD.js} +35 -22
- package/{SearchHistoryList-BI2TtBMA.js → SearchHistoryList-HPLScuap.js} +16 -13
- package/{SearchRecommed-D4IS58Qy.js → SearchRecommed-CfoABOec.js} +7 -7
- package/{SearchScopeList-DF4bvq2k.js → SearchScopeList-MDfy39Wg.js} +6 -6
- package/{UserSearch-DH9xxOrf.js → UserSearch-B3OpNc8B.js} +19 -16
- package/{index-BYIXHuOy.js → index-BOa97Aot.js} +4420 -2873
- package/{index-COV_1Ik6.js → index-BsMZ1sa2.js} +2 -2
- package/{index-2l6YPDov.js → index-CDZJ6srp.js} +4 -4
- package/index.d.ts +42 -673
- package/index.js +21 -14
- package/{notice-B3Mv74nx.js → notice-wiD3_kEI.js} +14 -13
- package/package.json +1 -1
- package/style.css +1 -1
- package/{transWebUrl-C3zC-G_1.js → transWebUrl-BjEWcV7K.js} +1 -1
- package/{index-C0Ixjtci.js → useReportRepo-C61yRVsW.js} +157 -176
- package/GloabarSearch-DvgDMvgv.js +0 -202
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { defineComponent, inject, openBlock, createElementBlock, Fragment, createElementVNode, toDisplayString, unref, createVNode, renderList, withDirectives, createBlock, ref, watch, onMounted, createCommentVNode } from "vue";
|
|
2
|
-
import "vue-devui-lal/icon";
|
|
3
|
-
import "vue-devui-lal/icon/style.css";
|
|
4
|
-
import { h as headRequest, R as REPO_MODULE, a as i18n, G as GIcon, v as vElementExposure, b as REPO_EVENT, _ as _export_sfc, c as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-BYIXHuOy.js";
|
|
5
|
-
import "lodash/debounce";
|
|
6
|
-
import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-C0Ixjtci.js";
|
|
7
|
-
import "./transWebUrl-C3zC-G_1.js";
|
|
8
|
-
import "vue-devui-lal/tooltip";
|
|
9
|
-
import "vue-devui-lal/tooltip/style.css";
|
|
10
|
-
import "vue-router";
|
|
11
|
-
import "vue-devui-lal/grid";
|
|
12
|
-
import "vue-devui-lal/skeleton";
|
|
13
|
-
import "vue-devui-lal/grid/style.css";
|
|
14
|
-
import "vue-devui-lal/skeleton/style.css";
|
|
15
|
-
import "vue-devui-lal/popover";
|
|
16
|
-
import "vue-devui-lal/popover/style.css";
|
|
17
|
-
const _hoisted_1$1 = { class: "mb-[4px] mt-[16px] flex justify-between" };
|
|
18
|
-
const _hoisted_2$1 = { class: "title" };
|
|
19
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
20
|
-
__name: "SearchRepoCardList",
|
|
21
|
-
props: {
|
|
22
|
-
dataList: {
|
|
23
|
-
type: Array,
|
|
24
|
-
default: () => []
|
|
25
|
-
},
|
|
26
|
-
searchStr: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: ""
|
|
29
|
-
},
|
|
30
|
-
type: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: ""
|
|
33
|
-
},
|
|
34
|
-
name: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: ""
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
emits: ["report"],
|
|
40
|
-
setup(__props, { emit: __emit }) {
|
|
41
|
-
const API = headRequest(inject("request"));
|
|
42
|
-
const { triggerReport } = useReportRepo({ moduleName: REPO_MODULE.SEARCH_SUGGESTION_CARD }, API.viewReport);
|
|
43
|
-
const { t: $t } = i18n.global;
|
|
44
|
-
const useReport = inject("useReport");
|
|
45
|
-
const emits = __emit;
|
|
46
|
-
const handleReport = (item) => {
|
|
47
|
-
useReport(REPO_EVENT.CLICK, { module_name: REPO_MODULE.SEARCH_SUGGESTION_CARD, repo_id: item.id });
|
|
48
|
-
};
|
|
49
|
-
const handleMore = () => {
|
|
50
|
-
emits("more");
|
|
51
|
-
};
|
|
52
|
-
return (_ctx, _cache) => {
|
|
53
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
54
|
-
createElementVNode("div", _hoisted_1$1, [
|
|
55
|
-
createElementVNode("p", _hoisted_2$1, toDisplayString(__props.name), 1),
|
|
56
|
-
createElementVNode("a", {
|
|
57
|
-
class: "more-btn",
|
|
58
|
-
onClick: handleMore
|
|
59
|
-
}, [
|
|
60
|
-
createElementVNode("span", null, toDisplayString(unref($t)("gitCodeLayout.common.more")), 1),
|
|
61
|
-
createVNode(GIcon, {
|
|
62
|
-
name: "gt-line-right",
|
|
63
|
-
color: "var(--theme-placeholder)"
|
|
64
|
-
})
|
|
65
|
-
])
|
|
66
|
-
]),
|
|
67
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.dataList, (item, index) => {
|
|
68
|
-
return withDirectives((openBlock(), createBlock(SearchRepoCard, {
|
|
69
|
-
key: item.id,
|
|
70
|
-
class: "mb-[8px]",
|
|
71
|
-
info: { ...item, index },
|
|
72
|
-
keyword: __props.searchStr,
|
|
73
|
-
hover: "",
|
|
74
|
-
hideTopicTags: "",
|
|
75
|
-
hideStarBtn: "",
|
|
76
|
-
hideFooter: "",
|
|
77
|
-
hideDescription: "",
|
|
78
|
-
onReport: () => handleReport(item),
|
|
79
|
-
cardType: __props.type,
|
|
80
|
-
"url-params": { source_module: "search_project" }
|
|
81
|
-
}, null, 8, ["info", "keyword", "onReport", "cardType"])), [
|
|
82
|
-
[unref(vElementExposure), { trigger: (type) => unref(triggerReport)(type, item) }]
|
|
83
|
-
]);
|
|
84
|
-
}), 128))
|
|
85
|
-
], 64);
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
const SearchRepoCardList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-vue-layout-gitcode"]]);
|
|
90
|
-
const _hoisted_1 = {
|
|
91
|
-
key: 0,
|
|
92
|
-
class: "px-[8px] history-list-project pl-[8px]"
|
|
93
|
-
};
|
|
94
|
-
const _hoisted_2 = {
|
|
95
|
-
key: 1,
|
|
96
|
-
class: "px-[8px] history-list-project pl-[8px]"
|
|
97
|
-
};
|
|
98
|
-
const _hoisted_3 = {
|
|
99
|
-
key: 2,
|
|
100
|
-
class: "px-[8px] history-list-project pl-[8px]"
|
|
101
|
-
};
|
|
102
|
-
const _sfc_main = {
|
|
103
|
-
__name: "GloabarSearch",
|
|
104
|
-
props: ["searchStr"],
|
|
105
|
-
emits: ["searchMore"],
|
|
106
|
-
setup(__props, { emit: __emit }) {
|
|
107
|
-
const emits = __emit;
|
|
108
|
-
const { t: $t } = i18n.global;
|
|
109
|
-
const API = headRequest(inject("request"));
|
|
110
|
-
const useReport = inject("useReport");
|
|
111
|
-
const projectList = ref([]);
|
|
112
|
-
const datasetList = ref([]);
|
|
113
|
-
const modelList = ref([]);
|
|
114
|
-
const origin = window.location.origin;
|
|
115
|
-
const props = __props;
|
|
116
|
-
let timer = null;
|
|
117
|
-
const convertDataList = (dataList) => {
|
|
118
|
-
return dataList == null ? void 0 : dataList.slice(0, 5).map((item) => {
|
|
119
|
-
const isGitcodeRepo = REPO_TYPE.GITCODE === item.is_mirrors;
|
|
120
|
-
const repoName = (!isGitcodeRepo ? extractRepoInfoWithURL(item.import_url) : item.name_with_namespace) || item.name_with_namespace;
|
|
121
|
-
const displayName = formatNameSpace(repoName).join("/");
|
|
122
|
-
return {
|
|
123
|
-
...item,
|
|
124
|
-
path: `${origin}/${item.path_with_namespace}`,
|
|
125
|
-
displayName,
|
|
126
|
-
web_url: `${origin}/${item.path_with_namespace}`
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
const handleMore = (type) => {
|
|
131
|
-
emits("searchMore", type);
|
|
132
|
-
};
|
|
133
|
-
const getData = async () => {
|
|
134
|
-
if (!props.searchStr) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
try {
|
|
138
|
-
useReport("search-project", {});
|
|
139
|
-
const res = await API.getGloabarSearchKeyLink({ q: props.searchStr });
|
|
140
|
-
const { recommend_project = [], recommend_model = [], recommend_dataset = [] } = res.data || {};
|
|
141
|
-
projectList.value = convertDataList(recommend_project);
|
|
142
|
-
modelList.value = convertDataList(recommend_model);
|
|
143
|
-
datasetList.value = convertDataList(recommend_dataset);
|
|
144
|
-
} catch (error) {
|
|
145
|
-
console.error("Failed to fetch search results:", error);
|
|
146
|
-
projectList.value = [];
|
|
147
|
-
modelList.value = [];
|
|
148
|
-
datasetList.value = [];
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
if (props.searchStr) {
|
|
152
|
-
getData();
|
|
153
|
-
}
|
|
154
|
-
watch(
|
|
155
|
-
() => props.searchStr,
|
|
156
|
-
() => {
|
|
157
|
-
if (timer) {
|
|
158
|
-
clearTimeout(timer);
|
|
159
|
-
}
|
|
160
|
-
timer = setTimeout(() => {
|
|
161
|
-
getData();
|
|
162
|
-
}, 300);
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
onMounted(() => {
|
|
166
|
-
});
|
|
167
|
-
return (_ctx, _cache) => {
|
|
168
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
169
|
-
projectList.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
170
|
-
createVNode(SearchRepoCardList, {
|
|
171
|
-
"data-list": projectList.value,
|
|
172
|
-
"search-str": __props.searchStr,
|
|
173
|
-
name: unref($t)("gitCodeLayout.header.repo"),
|
|
174
|
-
type: "repo",
|
|
175
|
-
onMore: _cache[0] || (_cache[0] = () => handleMore("repo"))
|
|
176
|
-
}, null, 8, ["data-list", "search-str", "name"])
|
|
177
|
-
])) : createCommentVNode("", true),
|
|
178
|
-
modelList.value.length ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
179
|
-
createVNode(SearchRepoCardList, {
|
|
180
|
-
"data-list": modelList.value,
|
|
181
|
-
"search-str": __props.searchStr,
|
|
182
|
-
name: unref($t)("gitCodeLayout.aihub.model"),
|
|
183
|
-
type: "model",
|
|
184
|
-
onMore: _cache[1] || (_cache[1] = () => handleMore("model"))
|
|
185
|
-
}, null, 8, ["data-list", "search-str", "name"])
|
|
186
|
-
])) : createCommentVNode("", true),
|
|
187
|
-
datasetList.value.length ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
188
|
-
createVNode(SearchRepoCardList, {
|
|
189
|
-
"data-list": datasetList.value,
|
|
190
|
-
"search-str": __props.searchStr,
|
|
191
|
-
name: unref($t)("gitCodeLayout.aihub.dataSet"),
|
|
192
|
-
type: "dataset",
|
|
193
|
-
onMore: _cache[2] || (_cache[2] = () => handleMore("dataset"))
|
|
194
|
-
}, null, 8, ["data-list", "search-str", "name"])
|
|
195
|
-
])) : createCommentVNode("", true)
|
|
196
|
-
], 64);
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
export {
|
|
201
|
-
_sfc_main as default
|
|
202
|
-
};
|