vue-layout-gitcode 1.3.20 → 1.3.22

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,216 @@
1
+ import { defineComponent, inject, createElementBlock, openBlock, Fragment, createElementVNode, toDisplayString, createVNode, unref, 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, b as REPO_EVENT, _ as _export_sfc, c as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-CqAiepjz.js";
5
+ import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-CHIT0RIe.js";
6
+ import "vue-devui-lal/tooltip";
7
+ import "vue-devui-lal/tooltip/style.css";
8
+ import "vue-router";
9
+ import "vue-devui-lal/grid";
10
+ import "vue-devui-lal/skeleton";
11
+ import "vue-devui-lal/grid/style.css";
12
+ import "vue-devui-lal/skeleton/style.css";
13
+ import "@vueuse/core";
14
+ const vElementExposure = {
15
+ mounted(el, binding) {
16
+ let observer = new IntersectionObserver(function(entries, observer2) {
17
+ entries.forEach(function(entry) {
18
+ var _a;
19
+ if (entry.isIntersecting) {
20
+ (_a = binding.value) == null ? void 0 : _a.trigger("expo");
21
+ observer2.unobserve(entry.target);
22
+ }
23
+ });
24
+ }, { threshold: 0 });
25
+ observer.observe(el);
26
+ },
27
+ beforeUnmount() {
28
+ }
29
+ };
30
+ const _hoisted_1$1 = { class: "mb-[4px] mt-[16px] flex justify-between" };
31
+ const _hoisted_2$1 = { class: "title" };
32
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
33
+ __name: "SearchRepoCardList",
34
+ props: {
35
+ dataList: {
36
+ type: Array,
37
+ default: () => []
38
+ },
39
+ searchStr: {
40
+ type: String,
41
+ default: ""
42
+ },
43
+ type: {
44
+ type: String,
45
+ default: ""
46
+ },
47
+ name: {
48
+ type: String,
49
+ default: ""
50
+ }
51
+ },
52
+ emits: ["report"],
53
+ setup(__props, { emit: __emit }) {
54
+ const API = headRequest(inject("request"));
55
+ const { triggerReport } = useReportRepo({ moduleName: REPO_MODULE.SEARCH_SUGGESTION_CARD }, API.viewReport);
56
+ const { t: $t } = i18n.global;
57
+ const useReport = inject("useReport");
58
+ const emits = __emit;
59
+ const handleReport = (item) => {
60
+ useReport(REPO_EVENT.CLICK, { module_name: REPO_MODULE.SEARCH_SUGGESTION_CARD, repo_id: item.id });
61
+ };
62
+ const handleMore = () => {
63
+ emits("more");
64
+ };
65
+ return (_ctx, _cache) => {
66
+ return openBlock(), createElementBlock(Fragment, null, [
67
+ createElementVNode("div", _hoisted_1$1, [
68
+ createElementVNode("p", _hoisted_2$1, toDisplayString(__props.name), 1),
69
+ createElementVNode("a", {
70
+ class: "more-btn",
71
+ onClick: handleMore
72
+ }, [
73
+ createElementVNode("span", null, toDisplayString(unref($t)("gitCodeLayout.common.more")), 1),
74
+ createVNode(GIcon, {
75
+ name: "gt-line-right",
76
+ color: "var(--theme-placeholder)"
77
+ })
78
+ ])
79
+ ]),
80
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.dataList, (item, index) => {
81
+ return withDirectives((openBlock(), createBlock(SearchRepoCard, {
82
+ key: item.id,
83
+ class: "mb-[8px]",
84
+ info: { ...item, index },
85
+ keyword: __props.searchStr,
86
+ hover: "",
87
+ hideTopicTags: "",
88
+ hideStarBtn: "",
89
+ hideFooter: "",
90
+ hideDescription: "",
91
+ onReport: () => handleReport(item),
92
+ cardType: __props.type,
93
+ "url-params": { source_module: "search_project" }
94
+ }, null, 8, ["info", "keyword", "onReport", "cardType"])), [
95
+ [unref(vElementExposure), { trigger: (type) => unref(triggerReport)(type, item) }]
96
+ ]);
97
+ }), 128))
98
+ ], 64);
99
+ };
100
+ }
101
+ });
102
+ const SearchRepoCardList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-gitcode-layout-lib"]]);
103
+ const _hoisted_1 = {
104
+ key: 0,
105
+ class: "px-[8px] history-list-project pl-[8px]"
106
+ };
107
+ const _hoisted_2 = {
108
+ key: 1,
109
+ class: "px-[8px] history-list-project pl-[8px]"
110
+ };
111
+ const _hoisted_3 = {
112
+ key: 2,
113
+ class: "px-[8px] history-list-project pl-[8px]"
114
+ };
115
+ const _sfc_main = {
116
+ __name: "GloabarSearch",
117
+ props: ["searchStr"],
118
+ emits: ["searchMore"],
119
+ setup(__props, { emit: __emit }) {
120
+ const emits = __emit;
121
+ const { t: $t } = i18n.global;
122
+ const API = headRequest(inject("request"));
123
+ const useReport = inject("useReport");
124
+ const projectList = ref([]);
125
+ const datasetList = ref([]);
126
+ const modelList = ref([]);
127
+ const origin = window.location.origin;
128
+ const props = __props;
129
+ let timer = null;
130
+ const convertDataList = (dataList) => {
131
+ return dataList == null ? void 0 : dataList.slice(0, 5).map((item) => {
132
+ const isGitcodeRepo = REPO_TYPE.GITCODE === item.is_mirrors;
133
+ const repoName = (!isGitcodeRepo ? extractRepoInfoWithURL(item.import_url) : item.name_with_namespace) || item.name_with_namespace;
134
+ const displayName = formatNameSpace(repoName).join("/");
135
+ return {
136
+ ...item,
137
+ path: `${origin}/${item.path_with_namespace}`,
138
+ displayName,
139
+ web_url: `${origin}/${item.path_with_namespace}`
140
+ };
141
+ });
142
+ };
143
+ const handleMore = (type) => {
144
+ emits("searchMore", type);
145
+ };
146
+ const getData = async () => {
147
+ if (!props.searchStr) {
148
+ return;
149
+ }
150
+ try {
151
+ useReport("search-project", {});
152
+ const res = await API.getGloabarSearchKeyLink({ q: props.searchStr });
153
+ const { recommend_project = [], recommend_model = [], recommend_dataset = [] } = res.data || {};
154
+ projectList.value = convertDataList(recommend_project);
155
+ modelList.value = convertDataList(recommend_model);
156
+ datasetList.value = convertDataList(recommend_dataset);
157
+ } catch (error) {
158
+ console.error("Failed to fetch search results:", error);
159
+ projectList.value = [];
160
+ modelList.value = [];
161
+ datasetList.value = [];
162
+ }
163
+ };
164
+ if (props.searchStr) {
165
+ getData();
166
+ }
167
+ watch(
168
+ () => props.searchStr,
169
+ () => {
170
+ if (timer) {
171
+ clearTimeout(timer);
172
+ }
173
+ timer = setTimeout(() => {
174
+ getData();
175
+ }, 300);
176
+ }
177
+ );
178
+ onMounted(() => {
179
+ console.log("GloabarSearch");
180
+ });
181
+ return (_ctx, _cache) => {
182
+ return openBlock(), createElementBlock(Fragment, null, [
183
+ projectList.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
184
+ createVNode(SearchRepoCardList, {
185
+ "data-list": projectList.value,
186
+ "search-str": __props.searchStr,
187
+ name: unref($t)("gitCodeLayout.header.repo"),
188
+ type: "repo",
189
+ onMore: _cache[0] || (_cache[0] = () => handleMore("repo"))
190
+ }, null, 8, ["data-list", "search-str", "name"])
191
+ ])) : createCommentVNode("", true),
192
+ modelList.value.length ? (openBlock(), createElementBlock("div", _hoisted_2, [
193
+ createVNode(SearchRepoCardList, {
194
+ "data-list": modelList.value,
195
+ "search-str": __props.searchStr,
196
+ name: unref($t)("gitCodeLayout.aihub.model"),
197
+ type: "model",
198
+ onMore: _cache[1] || (_cache[1] = () => handleMore("model"))
199
+ }, null, 8, ["data-list", "search-str", "name"])
200
+ ])) : createCommentVNode("", true),
201
+ datasetList.value.length ? (openBlock(), createElementBlock("div", _hoisted_3, [
202
+ createVNode(SearchRepoCardList, {
203
+ "data-list": datasetList.value,
204
+ "search-str": __props.searchStr,
205
+ name: unref($t)("gitCodeLayout.aihub.dataSet"),
206
+ type: "dataset",
207
+ onMore: _cache[2] || (_cache[2] = () => handleMore("dataset"))
208
+ }, null, 8, ["data-list", "search-str", "name"])
209
+ ])) : createCommentVNode("", true)
210
+ ], 64);
211
+ };
212
+ }
213
+ };
214
+ export {
215
+ _sfc_main as default
216
+ };
@@ -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-rXcur-WJ.js";
2
+ import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-CqAiepjz.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-rXcur-WJ.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-CqAiepjz.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-rXcur-WJ.js";
2
+ import { G as GIcon, _ as _export_sfc } from "./index-CqAiepjz.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-kGuvm88x.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-rXcur-WJ.js";
2
+ import { u as useReportRepo, S as SearchRepoCard } from "./index-CHIT0RIe.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-CqAiepjz.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-rXcur-WJ.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-CqAiepjz.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-rXcur-WJ.js";
2
+ import { a as i18n, h as headRequest, G as GIcon } from "./index-CqAiepjz.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,6 +1,6 @@
1
1
  import { defineComponent, onMounted, createBlock, openBlock, unref, withCtx, createElementVNode } from "vue";
2
2
  import { FixedOverlay } from "vue-devui-lal/overlay";
3
- import { w as useLayoutConfig, _ as _export_sfc } from "./index-rXcur-WJ.js";
3
+ import { w as useLayoutConfig, _ as _export_sfc } from "./index-CqAiepjz.js";
4
4
  import "vue-devui-lal/overlay/style.css";
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "index",
@@ -49,7 +49,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
49
  default: withCtx(() => _cache[0] || (_cache[0] = [
50
50
  createElementVNode("div", { id: "captcha-box" }, null, -1)
51
51
  ])),
52
- _: 1
52
+ _: 1,
53
+ __: [0]
53
54
  });
54
55
  };
55
56
  }
@@ -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, b as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-rXcur-WJ.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, c as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-CqAiepjz.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: 0 };
425
+ const _hoisted_6 = { key: 1 };
426
426
  const _sfc_main = /* @__PURE__ */ defineComponent({
427
427
  __name: "index",
428
428
  props: {
@@ -434,7 +434,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
434
434
  hideTopicTags: { type: Boolean },
435
435
  urlParams: {},
436
436
  hideStarBtn: { type: Boolean },
437
- hideFooter: { type: Boolean }
437
+ hideFooter: { type: Boolean },
438
+ hideDescription: { type: Boolean }
438
439
  },
439
440
  emits: ["report"],
440
441
  setup(__props, { emit: __emit }) {
@@ -522,7 +523,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
522
523
  class: normalizeClass(["i-search-projects-card", { noborder: _ctx.noborder, "full-hover": _ctx.hover }]),
523
524
  onClick: handleClick
524
525
  }, [
525
- createVNode(unref(Row), { class: "i-search-projects-card-title mb-[8px]" }, {
526
+ createVNode(unref(Row), { class: "i-search-projects-card-title" }, {
526
527
  default: withCtx(() => [
527
528
  createVNode(unref(Col), {
528
529
  class: "ellipsis flex items-center gap-[8px]",
@@ -549,7 +550,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
549
550
  default: withCtx(() => _cache[0] || (_cache[0] = [
550
551
  createTextVNode("G-Star ")
551
552
  ])),
552
- _: 1
553
+ _: 1,
554
+ __: [0]
553
555
  }, 8, ["message"])
554
556
  ])) : createCommentVNode("", true),
555
557
  unref(isIncubationRepo)(_ctx.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_4, [
@@ -562,7 +564,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
562
564
  default: withCtx(() => _cache[1] || (_cache[1] = [
563
565
  createTextVNode(" G-Star ")
564
566
  ])),
565
- _: 1
567
+ _: 1,
568
+ __: [1]
566
569
  }, 8, ["message"])
567
570
  ])) : createCommentVNode("", true)
568
571
  ]),
@@ -581,10 +584,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
581
584
  ]),
582
585
  _: 1
583
586
  }),
584
- createElementVNode("div", {
587
+ !_ctx.hideDescription ? (openBlock(), createElementBlock("div", {
588
+ key: 0,
585
589
  innerHTML: unref(highlightWords)("", description.value),
586
- class: "i-search-projects-card-desc ellipsis"
587
- }, null, 8, _hoisted_5),
590
+ class: "i-search-projects-card-desc ellipsis mt-[8px]"
591
+ }, null, 8, _hoisted_5)) : createCommentVNode("", true),
588
592
  _ctx.info.index === 0 && _ctx.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
589
593
  queryLoading.value ? (openBlock(), createBlock(unref(Skeleton), { key: 0 }, {
590
594
  placeholder: withCtx(() => [
@@ -623,7 +627,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
623
627
  ]),
624
628
  _: 1
625
629
  })) : createCommentVNode("", true)
626
- ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
630
+ ])) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
627
631
  !_ctx.hideFooter ? (openBlock(), createBlock(RepoCardFooter, {
628
632
  key: 0,
629
633
  hideTopicTags: _ctx.hideTopicTags,