vue-layout-gitcode 1.12.55-multiple-account → 1.12.55

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.
@@ -0,0 +1,127 @@
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-XmRn4ADt.js";
3
+ import { u as useReportRepo, S as SearchRepoCard, m as mergeSearchSuggestions } from "./search-suggestion-5gvGFBYY.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: _ctx.searchStr })), 1)
113
+ ]),
114
+ searchSuggestionList.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
115
+ createVNode(SearchRepoCardList, {
116
+ "data-list": searchSuggestionList.value,
117
+ "search-str": _ctx.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,5 +1,5 @@
1
- import { defineComponent, inject, useSlots, computed, ref, openBlock, createBlock, unref, withCtx, createElementVNode, normalizeClass, createElementBlock, createCommentVNode, createTextVNode, toDisplayString, renderSlot } from "vue";
2
- import { a as i18n, y as useLayoutConfig, A as ThemeType, B as currentTheme, L as LANG_ZH, C as LANG_EN, D as getLocaleLang, G as GIcon, F as emitEvent, b as REPO_EVENT, H as ASIDE_MENU_REPO, I as isHttps, J as navigateWithMigrationGuard, _ as _export_sfc } from "./index-cvKRePGR.js";
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, 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-XmRn4ADt.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";
@@ -8,10 +8,10 @@ const _hoisted_2 = {
8
8
  key: 2,
9
9
  class: "menu-item__badge"
10
10
  };
11
- const _hoisted_3 = { class: "relative" };
11
+ const _hoisted_3 = { class: "menu-item__name-wrap" };
12
12
  const _hoisted_4 = {
13
13
  key: 1,
14
- class: "token-free-text bg-[#DBE2FA] text-[#2951E0] text-[12px] rounded-[4px] px-[4px] py-[2px]"
14
+ class: "token-free-text"
15
15
  };
16
16
  const _sfc_main = /* @__PURE__ */ defineComponent({
17
17
  __name: "MenuItem",
@@ -76,7 +76,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
76
76
  return nameMap[getLocaleLang()] || props.item.left_menu_name_cn;
77
77
  });
78
78
  const isShowPopover = computed(() => {
79
- return props.item.is_show_popup && props.slotKeys.includes(props.item.popup_key) && slots[props.item.popup_key] && asideSetShow.value;
79
+ return Boolean(props.item.is_show_popup && props.slotKeys.includes(props.item.popup_key) && slots[props.item.popup_key] && asideSetShow.value);
80
80
  });
81
81
  const handleMouseEnter = () => {
82
82
  isHover.value = true;
@@ -1,7 +1,7 @@
1
- import { defineComponent, inject, ref, reactive, watch, computed, openBlock, createElementBlock, Fragment, createElementVNode, toDisplayString, unref, createVNode, withModifiers, normalizeClass, withCtx, renderList, createBlock, createCommentVNode, createTextVNode, withDirectives, vShow } from "vue";
2
- import { a as i18n, y as useLayoutConfig, G as GIcon, t as transformUrl, M as _sfc_main$1, N as loadAsideData, J as navigateWithMigrationGuard, F as emitEvent, s as setLoginTriggerSource, f as useRequestReport, K as asideRequest, _ as _export_sfc } from "./index-cvKRePGR.js";
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, 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-XmRn4ADt.js";
3
3
  import { useRouter } from "vue-router";
4
- import { t as transWebUrl } from "./transWebUrl-DdydDOiv.js";
4
+ import { t as transWebUrl } from "./transWebUrl-Bt3I_yb8.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";
@@ -12,25 +12,25 @@ import "vue-devui-lal/input/style.css";
12
12
  import "vue-devui-lal/skeleton/style.css";
13
13
  import "vue-devui-lal/menu/style.css";
14
14
  import "vue-devui-lal/button/style.css";
15
- const _hoisted_1 = { class: "devui-submenu layer_2 my-work-platform submenu-item relative" };
15
+ const _hoisted_1 = { class: "devui-submenu layer_2 my-work-platform submenu-item my-work-platform--relative" };
16
16
  const _hoisted_2 = {
17
17
  class: "devui-submenu-title layer_2",
18
18
  style: { "padding": "0px 24px" }
19
19
  };
20
- const _hoisted_3 = { class: "devui-submenu-title-content cursor-auto" };
20
+ const _hoisted_3 = { class: "devui-submenu-title-content submenu-title-static" };
21
21
  const _hoisted_4 = {
22
22
  class: "devui-submenu-title layer_2",
23
23
  style: { "padding": "0px 24px" }
24
24
  };
25
- const _hoisted_5 = { class: "devui-submenu-title-content cursor-auto" };
25
+ const _hoisted_5 = { class: "devui-submenu-title-content submenu-title-static" };
26
26
  const _hoisted_6 = {
27
27
  class: "devui-submenu-title layer_2",
28
28
  style: { "padding": "0px 24px" }
29
29
  };
30
- const _hoisted_7 = { class: "devui-submenu-title-content cursor-auto" };
30
+ const _hoisted_7 = { class: "devui-submenu-title-content submenu-title-static" };
31
31
  const _hoisted_8 = { key: 0 };
32
32
  const _hoisted_9 = { class: "project-label" };
33
- const _hoisted_10 = { class: "project-label flex-1 min-w-0 ellipsis" };
33
+ const _hoisted_10 = { class: "project-label project-label--ellipsis ellipsis" };
34
34
  const _hoisted_11 = {
35
35
  key: 1,
36
36
  class: "project-label"
@@ -250,7 +250,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
250
250
  };
251
251
  return (_ctx, _cache) => {
252
252
  return openBlock(), createElementBlock("ul", _hoisted_1, [
253
- __props.type === "project" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
253
+ _ctx.type === "project" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
254
254
  createElementVNode("div", _hoisted_2, [
255
255
  _cache[17] || (_cache[17] = createElementVNode("span", { class: "devui-menu-icon" }, null, -1)),
256
256
  createElementVNode("span", _hoisted_3, [
@@ -267,7 +267,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
267
267
  onClick: _cache[1] || (_cache[1] = withModifiers(($event) => showSearch.value = !showSearch.value, ["stop"]))
268
268
  }),
269
269
  createElementVNode("div", {
270
- class: normalizeClass(["flex flex-col pl-[0] my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
270
+ class: normalizeClass(["my-work-platform-inputbox-wrap my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
271
271
  onClick: _cache[6] || (_cache[6] = withModifiers(() => {
272
272
  }, ["stop"]))
273
273
  }, [
@@ -275,7 +275,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
275
275
  "menu-class": "my-work-platform-select",
276
276
  modelValue: nameSpace.value,
277
277
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => nameSpace.value = $event),
278
- class: "mb-[8px]",
278
+ class: "my-work-platform-select-wrap",
279
279
  placeholder: "",
280
280
  filter: true,
281
281
  onLoadMore: loadTeam,
@@ -311,7 +311,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
311
311
  }, 8, ["modelValue", "placeholder"])
312
312
  ], 2)
313
313
  ], 64)) : createCommentVNode("", true),
314
- __props.type === "team" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
314
+ _ctx.type === "team" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
315
315
  createElementVNode("div", _hoisted_4, [
316
316
  _cache[18] || (_cache[18] = createElementVNode("span", { class: "devui-menu-icon" }, null, -1)),
317
317
  createElementVNode("span", _hoisted_5, [
@@ -328,7 +328,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
328
328
  color: "var(--theme-menu-icon-fill)"
329
329
  }),
330
330
  createElementVNode("div", {
331
- class: normalizeClass(["flex flex-col pl-[0] my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
331
+ class: normalizeClass(["my-work-platform-inputbox-wrap my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
332
332
  onClick: _cache[11] || (_cache[11] = withModifiers(() => {
333
333
  }, ["stop"]))
334
334
  }, [
@@ -350,7 +350,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
350
350
  }, 8, ["modelValue", "placeholder"])
351
351
  ], 2)
352
352
  ], 64)) : createCommentVNode("", true),
353
- __props.type === "enterprise" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
353
+ _ctx.type === "enterprise" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
354
354
  createElementVNode("div", _hoisted_6, [
355
355
  _cache[19] || (_cache[19] = createElementVNode("span", { class: "devui-menu-icon" }, null, -1)),
356
356
  createElementVNode("span", _hoisted_7, [
@@ -367,7 +367,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
367
367
  color: "var(--theme-menu-icon-fill)"
368
368
  }),
369
369
  createElementVNode("div", {
370
- class: normalizeClass(["flex flex-col pl-[0] my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
370
+ class: normalizeClass(["my-work-platform-inputbox my-work-platform-inputbox--enterprise", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
371
371
  onClick: _cache[16] || (_cache[16] = withModifiers(() => {
372
372
  }, ["stop"]))
373
373
  }, [
@@ -399,10 +399,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
399
399
  "data-openBlank": true,
400
400
  "data-href": unref(transformUrl)(unref(transWebUrl)(item.web_url)),
401
401
  class: "text",
402
- title: __props.type === "project" ? `${item.namespace}/${item.label}` : item.label
402
+ title: _ctx.type === "project" ? `${item.namespace}/${item.label}` : item.label
403
403
  }, {
404
404
  icon: withCtx(() => [
405
- __props.type === "project" ? (openBlock(), createBlock(GIcon, {
405
+ _ctx.type === "project" ? (openBlock(), createBlock(GIcon, {
406
406
  key: 0,
407
407
  name: "gt-line-project",
408
408
  color: "var(--theme-menu-icon-fill)",
@@ -417,7 +417,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
417
417
  }, null, 8, ["src", "name", "class"]))
418
418
  ]),
419
419
  default: withCtx(() => [
420
- __props.type === "project" ? (openBlock(), createElementBlock("span", _hoisted_8, [
420
+ _ctx.type === "project" ? (openBlock(), createElementBlock("span", _hoisted_8, [
421
421
  createElementVNode("span", _hoisted_9, toDisplayString((item.namespace || "").slice(0, 10)) + toDisplayString((item.namespace || "").length > 10 ? "..." : ""), 1),
422
422
  createElementVNode("span", _hoisted_10, "/" + toDisplayString(item.label), 1)
423
423
  ])) : (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(item.label), 1))
@@ -425,14 +425,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
425
425
  _: 2
426
426
  }, 1032, ["data-href", "title"]);
427
427
  }), 128)),
428
- __props.type !== "enterprise" && !totalNum.value && !firstLoading.value ? (openBlock(), createBlock(unref(Button), {
428
+ _ctx.type !== "enterprise" && !totalNum.value && !firstLoading.value ? (openBlock(), createBlock(unref(Button), {
429
429
  key: 4,
430
430
  variant: "text",
431
431
  class: "more-btn",
432
432
  onClick: withModifiers(createRepoOrOrg, ["stop"])
433
433
  }, {
434
434
  default: withCtx(() => [
435
- createTextVNode(toDisplayString(__props.buttonText), 1)
435
+ createTextVNode(toDisplayString(_ctx.buttonText), 1)
436
436
  ]),
437
437
  _: 1
438
438
  })) : createCommentVNode("", true),
@@ -1,7 +1,7 @@
1
- import { defineComponent, inject, ref, reactive, computed, watch, openBlock, createElementBlock, createElementVNode, toDisplayString, unref, createVNode, withModifiers, normalizeClass, withCtx, createBlock, createCommentVNode, Fragment, renderList, createTextVNode, withDirectives, vShow } from "vue";
2
- import { a as i18n, y as useLayoutConfig, t as transformUrl, G as GIcon, K as asideRequest, J as navigateWithMigrationGuard, F as emitEvent, s as setLoginTriggerSource, f as useRequestReport, _ as _export_sfc } from "./index-cvKRePGR.js";
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, 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-XmRn4ADt.js";
3
3
  import { useRouter } from "vue-router";
4
- import { t as transWebUrl } from "./transWebUrl-DdydDOiv.js";
4
+ import { t as transWebUrl } from "./transWebUrl-Bt3I_yb8.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";
@@ -10,14 +10,14 @@ import "vue-devui-lal/input/style.css";
10
10
  import "vue-devui-lal/skeleton/style.css";
11
11
  import "vue-devui-lal/menu/style.css";
12
12
  import "vue-devui-lal/button/style.css";
13
- const _hoisted_1 = { class: "devui-submenu layer_2 my-work-platform submenu-item relative" };
13
+ const _hoisted_1 = { class: "devui-submenu layer_2 my-work-platform submenu-item my-work-platform--relative" };
14
14
  const _hoisted_2 = {
15
15
  class: "devui-submenu-title layer_2",
16
16
  style: { "padding": "0px 24px" }
17
17
  };
18
- const _hoisted_3 = { class: "devui-submenu-title-content cursor-auto" };
18
+ const _hoisted_3 = { class: "devui-submenu-title-content submenu-title-static" };
19
19
  const _hoisted_4 = { class: "project-label" };
20
- const _hoisted_5 = { class: "project-label flex-1 min-w-0 ellipsis" };
20
+ const _hoisted_5 = { class: "project-label project-label--ellipsis ellipsis" };
21
21
  const _hoisted_6 = ["href"];
22
22
  const INIT_SHOW_COUNT = 4;
23
23
  const LOAD_MORE_COUNT = 10;
@@ -26,7 +26,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
26
26
  props: {
27
27
  buttonText: { default: "" },
28
28
  subShow: { type: Boolean, default: false },
29
- defaultData: {},
29
+ defaultData: { default: () => ({ loading: false }) },
30
30
  isLogin: { type: Boolean, default: false },
31
31
  username: { default: "" }
32
32
  },
@@ -165,7 +165,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
165
165
  onClick: withModifiers(handleOpenSearch, ["stop"])
166
166
  }),
167
167
  createElementVNode("div", {
168
- class: normalizeClass(["flex flex-col pl-[0] my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
168
+ class: normalizeClass(["my-work-platform-inputbox-wrap my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
169
169
  onClick: _cache[4] || (_cache[4] = withModifiers(() => {
170
170
  }, ["stop"]))
171
171
  }, [
@@ -220,7 +220,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
220
220
  onClick: withModifiers(createRepoOrOrg, ["stop"])
221
221
  }, {
222
222
  default: withCtx(() => [
223
- createTextVNode(toDisplayString(__props.buttonText), 1)
223
+ createTextVNode(toDisplayString(_ctx.buttonText), 1)
224
224
  ]),
225
225
  _: 1
226
226
  })) : createCommentVNode("", true),
@@ -241,7 +241,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
241
241
  showTianqiRepo.value ? (openBlock(), createElementBlock("a", {
242
242
  key: 2,
243
243
  href: tianqiRepoUrl.value,
244
- class: "flex-1 min-w-0 cursor-pointer more-btn"
244
+ class: "more-btn more-btn--tianqi"
245
245
  }, toDisplayString(unref(t)("gitCodeLayout.org.tianqiRepo")) + " >", 9, _hoisted_6)) : createCommentVNode("", true)
246
246
  ]);
247
247
  };
@@ -0,0 +1,121 @@
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-XmRn4ADt.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
+ };
@@ -1,5 +1,5 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, createVNode, toDisplayString, withModifiers, createCommentVNode } from "vue";
2
- import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-cvKRePGR.js";
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-XmRn4ADt.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" };
@@ -42,6 +42,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
42
42
  icon: "gt-plane-project",
43
43
  hoverIcon: "gt-plane-project-red"
44
44
  },
45
+ all: {
46
+ text: t("gitCodeLayout.common.all"),
47
+ icon: "gt-plane-column1",
48
+ hoverIcon: "gt-plane-column-red"
49
+ },
45
50
  model: {
46
51
  text: t("gitCodeLayout.aihub.model"),
47
52
  icon: "gt-plane-Models",
@@ -83,11 +88,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
83
88
  hoverIcon: "gt-plane-topic-red"
84
89
  }
85
90
  };
86
- return typeMap[item.type] || typeMap["repo"];
91
+ const type = normalizeSearchHistoryEntry(item).type;
92
+ return typeMap[type] || typeMap["repo"];
87
93
  };
88
94
  const historyList = computed(() => {
89
95
  var _a;
90
- return (_a = props.searchHistoryList) == null ? void 0 : _a.map((raw) => typeof raw === "string" ? { q: raw } : raw).filter((item) => item == null ? void 0 : item.q).map((item) => {
96
+ return (_a = props.searchHistoryList) == null ? void 0 : _a.map((raw) => normalizeSearchHistoryEntry(raw)).filter((item) => item == null ? void 0 : item.q).map((item) => {
91
97
  const repoTitle = item.repo ? `${t("gitCodeLayout.header.repo")} ${decodeURIComponent(item.repo)}:` : "";
92
98
  const userVal = item.user || (item.scope === "user" ? item.namespace : "");
93
99
  const orgVal = item.org || (item.scope === "user" ? "" : item.namespace);
@@ -100,9 +106,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
100
106
  return { ...item, repoTitle, namespaceTitle };
101
107
  });
102
108
  });
103
- computed(() => {
104
- return props.visitHistoryList;
105
- });
106
109
  const resetIndex = () => {
107
110
  emits("resetIndex");
108
111
  };
@@ -117,15 +120,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
117
120
  };
118
121
  return (_ctx, _cache) => {
119
122
  return openBlock(), createElementBlock("div", _hoisted_1, [
120
- __props.searchHistoryList.length ? (openBlock(), createElementBlock("ul", {
123
+ _ctx.searchHistoryList.length ? (openBlock(), createElementBlock("ul", {
121
124
  key: 0,
122
- class: "history-list-box mt-[16px]",
125
+ class: "history-list-box history-list-box--mt",
123
126
  onMouseleave: resetIndex
124
127
  }, [
125
128
  (openBlock(true), createElementBlock(Fragment, null, renderList(historyList.value, (item, index) => {
126
129
  return openBlock(), createElementBlock("li", {
127
- key: item,
128
- class: normalizeClass(__props.activeIndex === index ? "hoverbg" : ""),
130
+ key: `${item.q}-${item.type || "repo"}-${index}`,
131
+ class: normalizeClass(_ctx.activeIndex === index ? "hoverbg" : ""),
129
132
  onClick: ($event) => toSearch(item),
130
133
  onMouseenter: ($event) => onSearchEnter(index)
131
134
  }, [
@@ -148,10 +151,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
148
151
  ]),
149
152
  createElementVNode("div", _hoisted_8, [
150
153
  createElementVNode("span", {
151
- class: normalizeClass(__props.activeIndex === index ? "history-list-box__type-text--active" : "history-list-box__type-text")
154
+ class: normalizeClass(_ctx.activeIndex === index ? "history-list-box__type-text--active" : "history-list-box__type-text")
152
155
  }, toDisplayString(getRepoType(item).text), 3),
153
156
  createVNode(GIcon, {
154
- name: __props.activeIndex === index ? getRepoType(item).hoverIcon : getRepoType(item).icon
157
+ name: _ctx.activeIndex === index ? getRepoType(item).hoverIcon : getRepoType(item).icon
155
158
  }, null, 8, ["name"])
156
159
  ])
157
160
  ]),