vue-layout-gitcode 1.12.42 → 1.12.44

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.
@@ -1,6 +1,6 @@
1
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, c as REPO_TYPE, e as extractRepoInfoWithURL, a as i18n, G as GIcon } from "./index-xs_vbnzn.js";
3
- import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./useReportRepo-DeZOj1S_.js";
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-DiN4g4by.js";
3
+ import { u as useReportRepo, S as SearchRepoCard, m as mergeSearchSuggestions } from "./search-suggestion-DCJDSykA.js";
4
4
  import "vue-devui-lal/icon";
5
5
  import "vue-devui-lal/icon/style.css";
6
6
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
@@ -33,8 +33,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
33
33
  hideDescription: "",
34
34
  onReport: () => handleReport(item),
35
35
  cardType: item.searchType || props.type,
36
- "url-params": { source_module: "search_project" }
37
- }, null, 8, ["info", "keyword", "onReport", "cardType"])), [
36
+ "url-params": { source_module: "search_project" },
37
+ "preserve-url-origin": item.searchType === "repo"
38
+ }, null, 8, ["info", "keyword", "onReport", "cardType", "preserve-url-origin"])), [
38
39
  [unref(vElementExposure), { trigger: (type) => unref(triggerReport)(type, item) }]
39
40
  ]);
40
41
  }), 128);
@@ -42,39 +43,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
42
43
  }
43
44
  });
44
45
  const SearchRepoCardList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-vue-layout-gitcode"]]);
45
- const normalizeOrigin = (origin) => origin.replace(/\/+$/, "");
46
- const getStringValue = (value) => typeof value === "string" ? value : "";
47
- const convertDataList = ({ dataList, searchType, origin }) => {
48
- if (!Array.isArray(dataList)) {
49
- return { items: [] };
50
- }
51
- const baseOrigin = normalizeOrigin(origin);
52
- const items = dataList.slice(0, 3).filter((item) => Boolean(item) && typeof item === "object" && !Array.isArray(item)).map((item) => {
53
- const isGitcodeRepo = REPO_TYPE.GITCODE === item.is_mirrors;
54
- const importUrl = getStringValue(item.import_url);
55
- const importedRepoName = importUrl ? extractRepoInfoWithURL(importUrl) : "";
56
- const nameWithNamespace = getStringValue(item.name_with_namespace);
57
- const pathWithNamespace = getStringValue(item.path_with_namespace);
58
- const repoName = (isGitcodeRepo ? nameWithNamespace : importedRepoName) || nameWithNamespace || pathWithNamespace;
59
- const displayName = formatNameSpace(repoName).join("/");
60
- const path = `${baseOrigin}/${pathWithNamespace}`;
61
- return {
62
- ...item,
63
- searchType,
64
- path,
65
- displayName,
66
- web_url: path
67
- };
68
- });
69
- return { items };
70
- };
71
- const mergeSearchSuggestions = ({ response = {}, origin }) => ({
72
- items: [
73
- ...convertDataList({ dataList: response.recommend_project, searchType: "repo", origin }).items,
74
- ...convertDataList({ dataList: response.recommend_model, searchType: "model", origin }).items,
75
- ...convertDataList({ dataList: response.recommend_dataset, searchType: "dataset", origin }).items
76
- ]
77
- });
78
46
  const _hoisted_1 = {
79
47
  key: 0,
80
48
  class: "history-list-project history-list-project--padded"
@@ -89,6 +57,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
89
57
  const emits = __emit;
90
58
  const { t: $t } = i18n.global;
91
59
  const API = headRequest(inject("request", () => Promise.resolve({ data: {} })));
60
+ const layoutConfig = useLayoutConfig();
92
61
  const useReport = inject("useReport", () => {
93
62
  });
94
63
  const searchSuggestionList = ref([]);
@@ -105,7 +74,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
105
74
  try {
106
75
  useReport("search-project", {});
107
76
  const res = await API.getGloabarSearchKeyLink({ q: props.searchStr });
108
- searchSuggestionList.value = mergeSearchSuggestions({ response: res.data || {}, origin }).items;
77
+ searchSuggestionList.value = mergeSearchSuggestions({
78
+ response: res.data || {},
79
+ origin,
80
+ projectOrigin: layoutConfig.VITE_HOST
81
+ }).items;
109
82
  } catch (error) {
110
83
  console.error("Failed to fetch search results:", error);
111
84
  searchSuggestionList.value = [];
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, useSlots, computed, ref, createBlock, openBlock, unref, withCtx, createElementVNode, normalizeClass, createElementBlock, createCommentVNode, createTextVNode, toDisplayString, renderSlot } from "vue";
2
- import { a as i18n, z as useLayoutConfig, B as ThemeType, C as currentTheme, L as LANG_ZH, D as LANG_EN, F as getLocaleLang, G as GIcon, H as emitEvent, b as REPO_EVENT, I as ASIDE_MENU_REPO, J as isHttps, K as navigateWithMigrationGuard, _ as _export_sfc } from "./index-xs_vbnzn.js";
2
+ import { a as i18n, c as useLayoutConfig, B as ThemeType, C as currentTheme, L as LANG_ZH, D as LANG_EN, F as getLocaleLang, G as GIcon, H as emitEvent, b as REPO_EVENT, I as ASIDE_MENU_REPO, J as isHttps, K as navigateWithMigrationGuard, _ as _export_sfc } from "./index-DiN4g4by.js";
3
3
  import { useRouter } from "vue-router";
4
4
  import { Popover } from "vue-devui-lal/popover";
5
5
  import "vue-devui-lal/popover/style.css";
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, inject, ref, reactive, watch, computed, createElementBlock, openBlock, createCommentVNode, createBlock, withDirectives, Fragment, createElementVNode, createVNode, toDisplayString, unref, withModifiers, normalizeClass, withCtx, renderList, createTextVNode, vShow } from "vue";
2
- import { a as i18n, z as useLayoutConfig, G as GIcon, t as transformUrl, N as _sfc_main$1, O as loadAsideData, K as navigateWithMigrationGuard, H as emitEvent, s as setLoginTriggerSource, f as useRequestReport, M as asideRequest, _ as _export_sfc } from "./index-xs_vbnzn.js";
2
+ import { a as i18n, c as useLayoutConfig, G as GIcon, t as transformUrl, N as _sfc_main$1, O as loadAsideData, K as navigateWithMigrationGuard, H as emitEvent, s as setLoginTriggerSource, e as useRequestReport, M as asideRequest, _ as _export_sfc } from "./index-DiN4g4by.js";
3
3
  import { useRouter } from "vue-router";
4
- import { t as transWebUrl } from "./transWebUrl-Cb2G8lHL.js";
4
+ import { t as transWebUrl } from "./transWebUrl-DPYJWnMX.js";
5
5
  import { Select, Option } from "vue-devui-lal/select";
6
6
  import { Input } from "vue-devui-lal/input";
7
7
  import { Skeleton } from "vue-devui-lal/skeleton";
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, inject, ref, reactive, computed, watch, createElementBlock, openBlock, createElementVNode, createVNode, createBlock, createCommentVNode, withDirectives, toDisplayString, unref, withModifiers, normalizeClass, withCtx, Fragment, renderList, createTextVNode, vShow } from "vue";
2
- import { a as i18n, z as useLayoutConfig, t as transformUrl, M as asideRequest, G as GIcon, K as navigateWithMigrationGuard, H as emitEvent, s as setLoginTriggerSource, f as useRequestReport, _ as _export_sfc } from "./index-xs_vbnzn.js";
2
+ import { a as i18n, c as useLayoutConfig, t as transformUrl, M as asideRequest, G as GIcon, K as navigateWithMigrationGuard, H as emitEvent, s as setLoginTriggerSource, e as useRequestReport, _ as _export_sfc } from "./index-DiN4g4by.js";
3
3
  import { useRouter } from "vue-router";
4
- import { t as transWebUrl } from "./transWebUrl-Cb2G8lHL.js";
4
+ import { t as transWebUrl } from "./transWebUrl-DPYJWnMX.js";
5
5
  import { Input } from "vue-devui-lal/input";
6
6
  import { Skeleton } from "vue-devui-lal/skeleton";
7
7
  import { MenuItem } from "vue-devui-lal/menu";
@@ -1,5 +1,5 @@
1
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-xs_vbnzn.js";
2
+ import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-DiN4g4by.js";
3
3
  import { useRoute, useRouter } from "vue-router";
4
4
  import "vue-devui-lal/icon";
5
5
  import "vue-devui-lal/icon/style.css";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, Fragment, renderList, normalizeClass, createElementVNode, createVNode, toDisplayString, withModifiers } from "vue";
2
- import { a as i18n, n as normalizeSearchHistoryEntry, G as GIcon, _ as _export_sfc } from "./index-xs_vbnzn.js";
2
+ import { a as i18n, n as normalizeSearchHistoryEntry, G as GIcon, _ as _export_sfc } from "./index-DiN4g4by.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = { class: "history-list" };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, inject, ref, onMounted, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, renderSlot, createBlock, createVNode, withCtx } from "vue";
2
- import { u as useReportRepo, S as SearchRepoCard } from "./useReportRepo-DeZOj1S_.js";
3
- import { a as i18n, h as headRequest, R as REPO_MODULE, b as REPO_EVENT, l as localStorage, _ as _export_sfc } from "./index-xs_vbnzn.js";
2
+ import { u as useReportRepo, S as SearchRepoCard, i as isProjectSuggestionType, n as normalizeProjectUrlForMainSite } from "./search-suggestion-DCJDSykA.js";
3
+ import { a as i18n, h as headRequest, c as useLayoutConfig, R as REPO_MODULE, b as REPO_EVENT, l as localStorage, _ as _export_sfc } from "./index-DiN4g4by.js";
4
4
  import { Row, Col } from "vue-devui-lal/grid";
5
5
  import { SkeletonItem } from "vue-devui-lal/skeleton";
6
6
  import "vue-devui-lal/grid/style.css";
@@ -14,9 +14,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
14
  setup(__props) {
15
15
  const { t: $t } = i18n.global;
16
16
  const API = headRequest(inject("request"));
17
+ const layoutConfig = useLayoutConfig();
17
18
  const useReport = inject("useReport");
18
19
  const { triggerReport } = useReportRepo({ moduleName: REPO_MODULE.SEARCH_RECOMMEND_CARD }, API.viewReport);
19
20
  const recommendRepoList = ref([]);
21
+ const getCardType = (repoType) => repoType ? String(repoType) : "repo";
20
22
  const handleReport = (repo, index, evt) => {
21
23
  const params = evt === "starReport" ? {
22
24
  module_name: REPO_MODULE.SEARCH_RECOMMEND_CARD,
@@ -38,10 +40,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
38
40
  }
39
41
  const params = { history: JSON.stringify(localSearchText) };
40
42
  const res = await API.openSourceProject(params);
41
- const data = (((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.content) || []).map((item) => ({
42
- ...item,
43
- tags: item.tags || item.topic_names
44
- }));
43
+ const data = (((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.content) || []).map((item) => {
44
+ const isProject = isProjectSuggestionType(item.repo_type);
45
+ return {
46
+ ...item,
47
+ ...isProject && item.web_url ? { web_url: normalizeProjectUrlForMainSite(item.web_url, layoutConfig.VITE_HOST, window.location.origin) } : {},
48
+ tags: item.tags || item.topic_names
49
+ };
50
+ });
45
51
  data.forEach((item, index) => {
46
52
  triggerReport("expo", { ...item, index });
47
53
  });
@@ -69,9 +75,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
69
75
  hover: "",
70
76
  hideTopicTags: "",
71
77
  onReport: (evt) => handleReport(item, index, evt),
72
- cardType: (item == null ? void 0 : item.repo_type) || "repo",
73
- "url-params": { source_module: "search_box_discovery" }
74
- }, null, 8, ["info", "onReport", "cardType"]))
78
+ cardType: getCardType(item.repo_type),
79
+ "url-params": { source_module: "search_box_discovery" },
80
+ "preserve-url-origin": unref(isProjectSuggestionType)(item.repo_type)
81
+ }, null, 8, ["info", "onReport", "cardType", "preserve-url-origin"]))
75
82
  ], true);
76
83
  }), 128))
77
84
  ])) : (openBlock(), createElementBlock("div", _hoisted_4, [
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, createElementBlock, openBlock, Fragment, renderList, createElementVNode, createVNode, createCommentVNode, toDisplayString, unref } from "vue";
2
- import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-xs_vbnzn.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-DiN4g4by.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = ["onClick"];
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, ref, watch, withDirectives, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, createVNode, vShow } from "vue";
2
- import { a as i18n, h as headRequest, G as GIcon, t as transformUrl } from "./index-xs_vbnzn.js";
2
+ import { a as i18n, h as headRequest, G as GIcon, t as transformUrl } from "./index-DiN4g4by.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = { class: "history-list-project history-list-project--padded" };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, onMounted, nextTick, onUnmounted, createBlock, openBlock, unref, withCtx, createElementVNode } from "vue";
2
- import { y as slidCaptchaManager, z as useLayoutConfig, A as isZh, _ as _export_sfc } from "./index-xs_vbnzn.js";
2
+ import { z as slidCaptchaManager, c as useLayoutConfig, A as isZh, _ as _export_sfc } from "./index-DiN4g4by.js";
3
3
  import { FixedOverlay } from "vue-devui-lal/overlay";
4
4
  import "vue-devui-lal/overlay/style.css";
5
5
  const TARGET_TEXT = "Click in order:";
@@ -8,7 +8,7 @@ import { Message } from "vue-devui-lal/message";
8
8
  import "vue-devui-lal/message/style.css";
9
9
  import { FixedOverlay } from "vue-devui-lal/overlay";
10
10
  import "vue-devui-lal/overlay/style.css";
11
- import { a as i18n, k as usePageResize, A as isZh, _ as _export_sfc } from "./index-xs_vbnzn.js";
11
+ import { a as i18n, j as usePageResize, A as isZh, _ as _export_sfc } from "./index-DiN4g4by.js";
12
12
  const _YunpianCaptchaManager = class _YunpianCaptchaManager {
13
13
  // eslint-disable-next-line no-useless-constructor
14
14
  constructor() {