vue-layout-gitcode 1.3.23 → 1.3.24

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,94 @@
1
+ import { inject, ref, watch, onMounted, createElementBlock, createCommentVNode, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, createBlock } from "vue";
2
+ import "vue-devui-lal/icon";
3
+ import "vue-devui-lal/icon/style.css";
4
+ import { a as i18n, h as headRequest, R as REPO_MODULE, b as REPO_TYPE, e as extractRepoInfoWithURL, c as REPO_EVENT } from "./index-DC9YPjPv.js";
5
+ import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-243BN_SR.js";
6
+ const _hoisted_1 = {
7
+ key: 0,
8
+ class: "px-[8px] history-list-project pl-[8px]"
9
+ };
10
+ const _hoisted_2 = { class: "history-list-project-globartitle mb-[4px] mt-[16px]" };
11
+ const _sfc_main = {
12
+ __name: "GloabarSearch",
13
+ props: ["searchStr"],
14
+ setup(__props) {
15
+ const { t: $t } = i18n.global;
16
+ const API = headRequest(inject("request"));
17
+ const useReport = inject("useReport");
18
+ const { triggerReport } = useReportRepo({ moduleName: REPO_MODULE.SEARCH_SUGGESTION_CARD }, API.viewReport);
19
+ const searchFileList = ref([]);
20
+ const origin = window.location.origin;
21
+ const props = __props;
22
+ let timer = null;
23
+ const handleReport = (item) => {
24
+ useReport(REPO_EVENT.CLICK, { module_name: REPO_MODULE.SEARCH_SUGGESTION_CARD, repo_id: item.id });
25
+ };
26
+ const getData = async () => {
27
+ if (!props.searchStr) {
28
+ return;
29
+ }
30
+ try {
31
+ useReport("search-project", {});
32
+ const res = await API.getGloabarSearchKeyLink({ q: props.searchStr });
33
+ const { recommend_project = [] } = res.data || {};
34
+ searchFileList.value = recommend_project.slice(0, 5).map((item) => {
35
+ const isGitcodeRepo = REPO_TYPE.GITCODE === item.is_mirrors;
36
+ const repoName = (!isGitcodeRepo ? extractRepoInfoWithURL(item.import_url) : item.name_with_namespace) || item.name_with_namespace;
37
+ const displayName = formatNameSpace(repoName).join("/");
38
+ return {
39
+ ...item,
40
+ path: `${origin}/${item.path_with_namespace}`,
41
+ displayName,
42
+ web_url: `${origin}/${item.path_with_namespace}`
43
+ };
44
+ });
45
+ searchFileList.value.forEach((item, index) => {
46
+ triggerReport("expo", { ...item, index });
47
+ });
48
+ } catch (error) {
49
+ console.error("Failed to fetch search results:", error);
50
+ searchFileList.value = [];
51
+ }
52
+ };
53
+ if (props.searchStr) {
54
+ getData();
55
+ }
56
+ watch(
57
+ () => props.searchStr,
58
+ () => {
59
+ if (timer) {
60
+ clearTimeout(timer);
61
+ }
62
+ timer = setTimeout(() => {
63
+ getData();
64
+ }, 300);
65
+ }
66
+ );
67
+ onMounted(() => {
68
+ console.log("GloabarSearch");
69
+ });
70
+ return (_ctx, _cache) => {
71
+ return searchFileList.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
72
+ createElementVNode("p", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.header.repo")), 1),
73
+ (openBlock(true), createElementBlock(Fragment, null, renderList(searchFileList.value, (item, index) => {
74
+ return openBlock(), createBlock(SearchRepoCard, {
75
+ key: item.id,
76
+ class: "mb-[8px]",
77
+ info: { ...item, index },
78
+ keyword: __props.searchStr,
79
+ hover: "",
80
+ hideTopicTags: "",
81
+ hideStarBtn: "",
82
+ hideFooter: "",
83
+ onReport: (evt) => handleReport(item),
84
+ cardType: "repo",
85
+ "url-params": { source_module: "search_project" }
86
+ }, null, 8, ["info", "keyword", "onReport"]);
87
+ }), 128))
88
+ ])) : createCommentVNode("", true);
89
+ };
90
+ }
91
+ };
92
+ export {
93
+ _sfc_main as default
94
+ };
@@ -1,5 +1,5 @@
1
1
  import { ref, inject, 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-GfreO8FI.js";
2
+ import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-DC9YPjPv.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, G as GIcon, _ as _export_sfc } from "./index-GfreO8FI.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-DC9YPjPv.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,5 +1,5 @@
1
1
  import { defineComponent, createElementBlock, openBlock, createElementVNode, withDirectives, toDisplayString, withModifiers, createVNode, vShow } from "vue";
2
- import { G as GIcon, _ as _export_sfc } from "./index-GfreO8FI.js";
2
+ import { G as GIcon, _ as _export_sfc } from "./index-DC9YPjPv.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = { class: "ellipsis" };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, inject, ref, onMounted, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, createBlock, createVNode, withCtx } from "vue";
2
- import { u as useReportRepo, S as SearchRepoCard } from "./index-HOUvAjiR.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-GfreO8FI.js";
2
+ import { u as useReportRepo, S as SearchRepoCard } from "./index-243BN_SR.js";
3
+ import { a as i18n, h as headRequest, R as REPO_MODULE, c as REPO_EVENT, l as localStorage, _ as _export_sfc } from "./index-DC9YPjPv.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";
@@ -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-GfreO8FI.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-DC9YPjPv.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 { 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 } from "./index-GfreO8FI.js";
2
+ import { a as i18n, h as headRequest, G as GIcon } from "./index-DC9YPjPv.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = { class: "px-[8px] history-list-project pl-[8px]" };
@@ -1,5 +1,5 @@
1
1
  import { ref, watchEffect, defineComponent, toDisplayString, unref, inject, createElementBlock, openBlock, normalizeClass, createElementVNode, withModifiers, withDirectives, vShow, createVNode, computed, createCommentVNode, normalizeStyle, createTextVNode, onMounted, onUnmounted, Fragment, createBlock, renderList, reactive, withCtx } from "vue";
2
- import { d as debounce, t as transferNumber, G as GIcon, s as setLoginTriggerSource, f as useRequestReport, r as reqCatch, h as headRequest, _ as _export_sfc, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, L as LANG_KEY, j as LANG_ZH, k as usePageResize, m as isGstarRepo, n as _sfc_main$8, o as isIncubationRepo, p as highlightWords, q as transWebUrl, v as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-GfreO8FI.js";
2
+ import { d as debounce, t as transferNumber, G as GIcon, s as setLoginTriggerSource, f as useRequestReport, r as reqCatch, h as headRequest, _ as _export_sfc, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, L as LANG_KEY, j as LANG_ZH, k as usePageResize, m as isGstarRepo, n as _sfc_main$8, o as isIncubationRepo, p as highlightWords, q as transWebUrl, v as _frEventTrack, E as EVENT_NAME, b as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-DC9YPjPv.js";
3
3
  import { useRouter } from "vue-router";
4
4
  import { Row, Col } from "vue-devui-lal/grid";
5
5
  import { Skeleton, SkeletonItem } from "vue-devui-lal/skeleton";
@@ -422,7 +422,7 @@ const _hoisted_2 = {
422
422
  const _hoisted_3 = { key: 1 };
423
423
  const _hoisted_4 = { key: 2 };
424
424
  const _hoisted_5 = ["innerHTML"];
425
- const _hoisted_6 = { key: 1 };
425
+ const _hoisted_6 = { key: 0 };
426
426
  const _sfc_main = /* @__PURE__ */ defineComponent({
427
427
  __name: "index",
428
428
  props: {
@@ -434,8 +434,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
434
434
  hideTopicTags: { type: Boolean },
435
435
  urlParams: {},
436
436
  hideStarBtn: { type: Boolean },
437
- hideFooter: { type: Boolean },
438
- hideDescription: { type: Boolean }
437
+ hideFooter: { type: Boolean }
439
438
  },
440
439
  emits: ["report"],
441
440
  setup(__props, { emit: __emit }) {
@@ -523,7 +522,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
523
522
  class: normalizeClass(["i-search-projects-card", { noborder: _ctx.noborder, "full-hover": _ctx.hover }]),
524
523
  onClick: handleClick
525
524
  }, [
526
- createVNode(unref(Row), { class: "i-search-projects-card-title" }, {
525
+ createVNode(unref(Row), { class: "i-search-projects-card-title mb-[8px]" }, {
527
526
  default: withCtx(() => [
528
527
  createVNode(unref(Col), {
529
528
  class: "ellipsis flex items-center gap-[8px]",
@@ -550,8 +549,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
550
549
  default: withCtx(() => _cache[0] || (_cache[0] = [
551
550
  createTextVNode("G-Star ")
552
551
  ])),
553
- _: 1,
554
- __: [0]
552
+ _: 1
555
553
  }, 8, ["message"])
556
554
  ])) : createCommentVNode("", true),
557
555
  unref(isIncubationRepo)(_ctx.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_4, [
@@ -564,8 +562,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
564
562
  default: withCtx(() => _cache[1] || (_cache[1] = [
565
563
  createTextVNode(" G-Star ")
566
564
  ])),
567
- _: 1,
568
- __: [1]
565
+ _: 1
569
566
  }, 8, ["message"])
570
567
  ])) : createCommentVNode("", true)
571
568
  ]),
@@ -584,11 +581,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
584
581
  ]),
585
582
  _: 1
586
583
  }),
587
- !_ctx.hideDescription ? (openBlock(), createElementBlock("div", {
588
- key: 0,
584
+ createElementVNode("div", {
589
585
  innerHTML: unref(highlightWords)("", description.value),
590
- class: "i-search-projects-card-desc ellipsis mt-[8px]"
591
- }, null, 8, _hoisted_5)) : createCommentVNode("", true),
586
+ class: "i-search-projects-card-desc ellipsis"
587
+ }, null, 8, _hoisted_5),
592
588
  _ctx.info.index === 0 && _ctx.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
593
589
  queryLoading.value ? (openBlock(), createBlock(unref(Skeleton), { key: 0 }, {
594
590
  placeholder: withCtx(() => [
@@ -627,7 +623,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
627
623
  ]),
628
624
  _: 1
629
625
  })) : createCommentVNode("", true)
630
- ])) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
626
+ ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
631
627
  !_ctx.hideFooter ? (openBlock(), createBlock(RepoCardFooter, {
632
628
  key: 0,
633
629
  hideTopicTags: _ctx.hideTopicTags,