vue-layout-gitcode 1.12.15-beta.5 → 1.12.15-beta.51

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,4 +1,4 @@
1
- import { y as useLayoutConfig } from "./index-D8ySyL6a.js";
1
+ import { z as useLayoutConfig } from "./index-BBdEwjQ0.js";
2
2
  const layoutConfig = useLayoutConfig();
3
3
  const transWebUrl = (url, params) => {
4
4
  if (!url) return url;
@@ -1,7 +1,6 @@
1
- import { ref, watchEffect, defineComponent, toDisplayString, unref, mergeModels, useModel, watch, createElementBlock, openBlock, createVNode, withDirectives, normalizeClass, createElementVNode, vShow, inject, withModifiers, createBlock, Fragment, computed, createCommentVNode, normalizeStyle, createTextVNode, onMounted, onUnmounted, renderList, withCtx, reactive } from "vue";
2
- import debounce from "lodash/debounce";
3
- import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, f as useRequestReport, r as reqCatch, h as headRequest, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, j as useCookie, k as usePageResize, L as LANG_ZH, m as isGstarRepo, n as _sfc_main$b, o as isIncubationRepo, p as highlightWords, t as transformUrl, q as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL, w as LANG_KEY } from "./index-D8ySyL6a.js";
4
- import { t as transWebUrl } from "./transWebUrl-CtGPMiCw.js";
1
+ import { defineComponent, toDisplayString, unref, useModel, ref, watch, openBlock, createElementBlock, createVNode, normalizeClass, withDirectives, createElementVNode, vShow, mergeModels, inject, withModifiers, createBlock, Fragment, computed, normalizeStyle, createCommentVNode, createTextVNode, renderList, withCtx, reactive, onMounted, watchEffect } from "vue";
2
+ import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, r as reqCatch, f as useRequestReport, h as headRequest, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, j as useCookie, k as usePageResize, L as LANG_ZH, m as isGstarRepo, o as _sfc_main$b, p as isIncubationRepo, q as highlightWords, t as transformUrl, w as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL, x as LANG_KEY } from "./index-BBdEwjQ0.js";
3
+ import { t as transWebUrl } from "./transWebUrl-DlK6GU_m.js";
5
4
  import { useRouter } from "vue-router";
6
5
  import { Row, Col } from "vue-devui-lal/grid";
7
6
  import { Skeleton, SkeletonItem } from "vue-devui-lal/skeleton";
@@ -9,74 +8,7 @@ import "vue-devui-lal/grid/style.css";
9
8
  import "vue-devui-lal/skeleton/style.css";
10
9
  import { Popover } from "vue-devui-lal/popover";
11
10
  import "vue-devui-lal/popover/style.css";
12
- const useReportRepo = (reportParams, viewReport) => {
13
- const list = ref([]);
14
- const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
15
- const locationHref = ref((window == null ? void 0 : window.location.href) || "");
16
- const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
17
- const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
18
- const triggerReport = (type, data) => {
19
- if (type === "click") {
20
- const params = {
21
- chat_title: "",
22
- related: {
23
- list: [formatItem(data)],
24
- type: "repo"
25
- }
26
- };
27
- viewReport(pageRef.value, locationHref.value, "click", params);
28
- } else if (type === "expo") {
29
- list.value.push(data);
30
- }
31
- };
32
- const formatItem = (data) => {
33
- const channelNames = [];
34
- if (data.channelName) channelNames.push(data.channelName);
35
- if (data.subChannelName) channelNames.push(data.subChannelName);
36
- const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
37
- return {
38
- type: "gitcode",
39
- repo_id: repoId,
40
- dest_url: data.web_url,
41
- strategy: channelNames.join("、") || "",
42
- // 官方项目
43
- repo_index: data.index,
44
- page: data.pageIndex || data.p || 0,
45
- per_page: data.pageSize || data.pp || 0,
46
- q: data.keyword || ""
47
- };
48
- };
49
- const doReport = debounce(() => {
50
- if (list.value.length >= 1) {
51
- const reportList = list.value.splice(0).map((item) => {
52
- return formatItem(item);
53
- });
54
- const params = {
55
- chat_title: "",
56
- extend_json: {
57
- key_words: keyword.value,
58
- module_name: moduleName.value
59
- },
60
- related: {
61
- list: reportList,
62
- type: "repo"
63
- }
64
- };
65
- viewReport(pageRef.value, locationHref.value, "expo", params);
66
- }
67
- }, 500, { leading: false });
68
- watchEffect(() => {
69
- if (list.value.length) {
70
- doReport();
71
- }
72
- });
73
- return {
74
- triggerReport
75
- };
76
- };
77
- const formatNameSpace = (content) => {
78
- return content.trim().replace(/\s+/g, "").replace(/^(GitHub加速计划\/|HuggingFace镜像\/)/, "").split("/").filter(Boolean);
79
- };
11
+ import debounce from "lodash/debounce";
80
12
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
81
13
  __name: "index",
82
14
  props: {
@@ -87,7 +19,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
87
19
  },
88
20
  setup(__props) {
89
21
  return (_ctx, _cache) => {
90
- return toDisplayString(unref(transferNumber)({ number: _ctx.number, fixed: _ctx.fixed, byte: _ctx.byte, gt100: _ctx.gt100 }));
22
+ return toDisplayString(unref(transferNumber)({ number: __props.number, fixed: __props.fixed, byte: __props.byte, gt100: __props.gt100 }));
91
23
  };
92
24
  }
93
25
  });
@@ -225,7 +157,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
225
157
  }]),
226
158
  onClick: withModifiers(handleStar, ["stop", "prevent"])
227
159
  }, [
228
- _ctx.isLike ? (openBlock(), createBlock(Like, {
160
+ __props.isLike ? (openBlock(), createBlock(Like, {
229
161
  key: 0,
230
162
  class: "i-star-tag__icon-mr",
231
163
  modelValue: starred.value,
@@ -279,7 +211,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
279
211
  }),
280
212
  createElementVNode("span", null, [
281
213
  createVNode(_sfc_main$a, {
282
- number: _ctx.count || 0
214
+ number: __props.count || 0
283
215
  }, null, 8, ["number"])
284
216
  ])
285
217
  ]);
@@ -290,7 +222,7 @@ const ForkTag = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-
290
222
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
291
223
  __name: "index",
292
224
  props: {
293
- tagInfo: { default: [] },
225
+ tagInfo: { default: () => [] },
294
226
  type: {}
295
227
  },
296
228
  setup(__props) {
@@ -298,15 +230,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
298
230
  const isTag = computed(() => props.type === "tag");
299
231
  const languageTag = props.tagInfo[0] || "";
300
232
  const tagColor = props.tagInfo[1] || "#00ADD8";
301
- computed(() => {
302
- if (isTag.value) {
303
- return {
304
- background: tagColor,
305
- opacity: 0.1
306
- };
307
- }
308
- return {};
309
- });
310
233
  const tagFontColor = computed(() => {
311
234
  if (isTag.value) {
312
235
  return { color: tagColor };
@@ -350,9 +273,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
350
273
  color: "var(--theme-home-card-color-placeholder)",
351
274
  size: "14"
352
275
  }),
353
- !_ctx.hideText ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(unref($t)("gitCodeLayout.components.repo.today")), 1)) : createCommentVNode("", true),
276
+ !__props.hideText ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(unref($t)("gitCodeLayout.components.repo.today")), 1)) : createCommentVNode("", true),
354
277
  createVNode(_sfc_main$a, {
355
- number: _ctx.starCountOne || 0
278
+ number: __props.starCountOne || 0
356
279
  }, null, 8, ["number"])
357
280
  ]);
358
281
  };
@@ -383,9 +306,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
383
306
  size: "14"
384
307
  }),
385
308
  createElementVNode("span", _hoisted_2$3, [
386
- _cache[0] || (_cache[0] = createTextVNode("Star ")),
309
+ _cache[0] || (_cache[0] = createTextVNode("Star ", -1)),
387
310
  createVNode(_sfc_main$a, {
388
- number: _ctx.count || 0,
311
+ number: __props.count || 0,
389
312
  gt100: true
390
313
  }, null, 8, ["number"])
391
314
  ])
@@ -408,12 +331,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
408
331
  __name: "index",
409
332
  props: {
410
333
  repoInfo: {},
411
- hideTopicTags: { type: Boolean },
412
- tagInfo: {},
413
- hideUpdateTime: { type: Boolean },
414
- hideStarIncrease: { type: Boolean },
415
- hideStarCount: { type: Boolean },
416
- searchCard: { type: Boolean }
334
+ hideTopicTags: { type: Boolean, default: false },
335
+ tagInfo: { default: () => [] },
336
+ hideUpdateTime: { type: Boolean, default: false },
337
+ hideStarIncrease: { type: Boolean, default: false },
338
+ hideStarCount: { type: Boolean, default: false },
339
+ searchCard: { type: Boolean, default: false }
417
340
  },
418
341
  emits: ["topicClick"],
419
342
  setup(__props, { emit: __emit }) {
@@ -425,52 +348,42 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
425
348
  var _a;
426
349
  return ((_a = props.repoInfo.tags) == null ? void 0 : _a.filter((item) => item.type === TOPIC_TYPE.USER)) || [];
427
350
  });
428
- ref(topicNames.value);
429
- const visibleCount = ref(0);
430
- ref(false);
431
351
  const showUpdateTimeDot = computed(() => {
432
352
  return !props.hideUpdateTime && (!props.hideStarCount || props.tagInfo && props.tagInfo[0] || props.repoInfo.forks_count);
433
353
  });
434
- computed(() => {
435
- return topicNames.value.length - visibleCount.value + 1;
436
- });
437
354
  const handleTopicClick = (topic) => {
438
355
  emits("topicClick", topic);
439
356
  };
440
- onMounted(() => {
441
- });
442
- onUnmounted(() => {
443
- });
444
357
  return (_ctx, _cache) => {
445
358
  return openBlock(), createElementBlock(Fragment, null, [
446
359
  createElementVNode("div", null, [
447
360
  createElementVNode("div", _hoisted_1$3, [
448
- _ctx.tagInfo ? (openBlock(), createBlock(LanguageTag, {
361
+ __props.tagInfo ? (openBlock(), createBlock(LanguageTag, {
449
362
  key: 0,
450
- "tag-info": _ctx.tagInfo
363
+ "tag-info": __props.tagInfo
451
364
  }, null, 8, ["tag-info"])) : createCommentVNode("", true),
452
- !_ctx.hideStarCount ? (openBlock(), createBlock(StarCountOne, {
365
+ !__props.hideStarCount ? (openBlock(), createBlock(StarCountOne, {
453
366
  key: 1,
454
367
  hideText: "",
455
- starCountOne: _ctx.repoInfo.star_count
368
+ starCountOne: __props.repoInfo.star_count
456
369
  }, null, 8, ["starCountOne"])) : createCommentVNode("", true),
457
- _ctx.repoInfo.forks_count ? (openBlock(), createBlock(ForkTag, {
370
+ __props.repoInfo.forks_count ? (openBlock(), createBlock(ForkTag, {
458
371
  key: 2,
459
- count: _ctx.repoInfo.forks_count
372
+ count: __props.repoInfo.forks_count
460
373
  }, null, 8, ["count"])) : createCommentVNode("", true),
461
374
  showUpdateTimeDot.value ? (openBlock(), createElementBlock("div", _hoisted_2$2)) : createCommentVNode("", true),
462
- !_ctx.hideUpdateTime ? (openBlock(), createElementBlock("div", _hoisted_3$2, toDisplayString(unref(formatTimeFromNow)((_ctx.searchCard ? _ctx.repoInfo.last_repository_updated_at : _ctx.repoInfo.last_activity_at) || _ctx.repoInfo.last_activity_at)), 1)) : createCommentVNode("", true),
463
- !_ctx.hideStarIncrease && _ctx.repoInfo.star_count_one ? (openBlock(), createBlock(StarCountOne, {
375
+ !__props.hideUpdateTime ? (openBlock(), createElementBlock("div", _hoisted_3$2, toDisplayString(unref(formatTimeFromNow)((__props.searchCard ? __props.repoInfo.last_repository_updated_at : __props.repoInfo.last_activity_at) || __props.repoInfo.last_activity_at)), 1)) : createCommentVNode("", true),
376
+ !__props.hideStarIncrease && __props.repoInfo.star_count_one ? (openBlock(), createBlock(StarCountOne, {
464
377
  key: 5,
465
- starCountOne: _ctx.repoInfo.star_count_one
378
+ starCountOne: __props.repoInfo.star_count_one
466
379
  }, null, 8, ["starCountOne"])) : createCommentVNode("", true),
467
- _ctx.repoInfo.is_gh_mirrors ? (openBlock(), createBlock(GithubStarNum, {
380
+ __props.repoInfo.is_gh_mirrors ? (openBlock(), createBlock(GithubStarNum, {
468
381
  key: 6,
469
- count: _ctx.repoInfo.import_star_count
382
+ count: __props.repoInfo.import_star_count
470
383
  }, null, 8, ["count"])) : createCommentVNode("", true)
471
384
  ])
472
385
  ]),
473
- !_ctx.hideTopicTags && topicNames.value.length && _ctx.searchCard ? (openBlock(), createElementBlock("div", {
386
+ !__props.hideTopicTags && topicNames.value.length && __props.searchCard ? (openBlock(), createElementBlock("div", {
474
387
  key: 0,
475
388
  class: "topic-tags",
476
389
  ref_key: "topicTagsRef",
@@ -489,6 +402,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
489
402
  }
490
403
  });
491
404
  const RepoCardFooter = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-vue-layout-gitcode"]]);
405
+ const formatNameSpace = (content) => {
406
+ return content.trim().replace(/\s+/g, "").replace(/^(GitHub加速计划\/|HuggingFace镜像\/)/, "").split("/").filter(Boolean);
407
+ };
492
408
  const _hoisted_1$2 = { class: "new-tag-content" };
493
409
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
494
410
  __name: "index",
@@ -534,8 +450,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
534
450
  default: withCtx(() => [
535
451
  _cache[0] || (_cache[0] = createElementVNode("div", { class: "new-tag" }, "New", -1))
536
452
  ]),
537
- _: 1,
538
- __: [0]
453
+ _: 1
539
454
  })) : createCommentVNode("", true);
540
455
  };
541
456
  }
@@ -624,18 +539,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
624
539
  info: {},
625
540
  keyword: {},
626
541
  cardType: {},
627
- noborder: { type: Boolean },
628
- hover: { type: Boolean },
629
- hideTopicTags: { type: Boolean },
630
- urlParams: {},
631
- hideStarBtn: { type: Boolean },
632
- hideFooter: { type: Boolean },
633
- hideDescription: { type: Boolean }
542
+ noborder: { type: Boolean, default: false },
543
+ hover: { type: Boolean, default: false },
544
+ hideTopicTags: { type: Boolean, default: false },
545
+ urlParams: { default: () => ({}) },
546
+ hideStarBtn: { type: Boolean, default: false },
547
+ hideFooter: { type: Boolean, default: false },
548
+ hideDescription: { type: Boolean, default: false }
634
549
  },
635
550
  emits: ["report"],
636
551
  setup(__props, { emit: __emit }) {
637
552
  const lang = useCookie(LANG_KEY, LANG_ZH);
638
- const API = headRequest(inject("request"));
553
+ const request = inject("request") || (() => Promise.resolve({ data: {} }));
554
+ const API = headRequest(request);
639
555
  const emits = __emit;
640
556
  const router = useRouter();
641
557
  const { widthType } = usePageResize();
@@ -702,7 +618,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
702
618
  name_with_namespace: nameWithSpace,
703
619
  path_with_namespace: path,
704
620
  import_url: importUrl,
705
- is_gh_mirrors: isGhMirrors,
706
621
  is_mirrors: isMirrors
707
622
  } = info || {};
708
623
  const isGitcodeRepo = REPO_TYPE.GITCODE === isMirrors;
@@ -719,7 +634,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
719
634
  });
720
635
  return (_ctx, _cache) => {
721
636
  return openBlock(), createElementBlock("a", {
722
- class: normalizeClass(["i-search-projects-card", { noborder: _ctx.noborder, "full-hover": _ctx.hover }]),
637
+ class: normalizeClass(["i-search-projects-card", { noborder: __props.noborder, "full-hover": __props.hover }]),
723
638
  onClick: handleClick
724
639
  }, [
725
640
  createVNode(unref(Row), { class: "i-search-projects-card-title" }, {
@@ -733,45 +648,43 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
733
648
  return [
734
649
  createVNode(GIcon, {
735
650
  name: iconName.value,
736
- class: normalizeClass({ "align-middle": _ctx.info.is_gh_mirrors }),
651
+ class: normalizeClass({ "align-middle": __props.info.is_gh_mirrors }),
737
652
  color: "var(--theme-placeholder)"
738
653
  }, null, 8, ["name", "class"]),
739
654
  createElementVNode("span", {
740
655
  class: "repo-title",
741
656
  innerHTML: preHandWord()
742
657
  }, null, 8, _hoisted_1),
743
- _ctx.info.show_recommend_icon ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.search.recommendTag")), 1)) : createCommentVNode("", true),
744
- unref(isGstarRepo)(_ctx.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_3, [
658
+ __props.info.show_recommend_icon ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.search.recommendTag")), 1)) : createCommentVNode("", true),
659
+ unref(isGstarRepo)(__props.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_3, [
745
660
  createVNode(_sfc_main$b, {
746
661
  origin: "repo",
747
662
  icon: "",
748
663
  type: "gstar",
749
664
  message: `G-Star ${unref($t)("gitCodeLayout.GStar.project.graduation")}`
750
665
  }, {
751
- default: withCtx(() => _cache[0] || (_cache[0] = [
752
- createTextVNode("G-Star ")
753
- ])),
754
- _: 1,
755
- __: [0]
666
+ default: withCtx(() => [..._cache[0] || (_cache[0] = [
667
+ createTextVNode("G-Star ", -1)
668
+ ])]),
669
+ _: 1
756
670
  }, 8, ["message"])
757
671
  ])) : createCommentVNode("", true),
758
- unref(isIncubationRepo)(_ctx.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_4, [
672
+ unref(isIncubationRepo)(__props.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_4, [
759
673
  createVNode(_sfc_main$b, {
760
674
  origin: "repo",
761
675
  icon: "",
762
676
  type: "incubation",
763
677
  message: `G-Star ${unref($t)("gitCodeLayout.GStar.project.incubation")}`
764
678
  }, {
765
- default: withCtx(() => _cache[1] || (_cache[1] = [
766
- createTextVNode(" G-Star ")
767
- ])),
768
- _: 1,
769
- __: [1]
679
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [
680
+ createTextVNode(" G-Star ", -1)
681
+ ])]),
682
+ _: 1
770
683
  }, 8, ["message"])
771
684
  ])) : createCommentVNode("", true),
772
685
  createVNode(NewTag, {
773
- repoType: _ctx.cardType,
774
- isNew: ((_a = _ctx.info) == null ? void 0 : _a.is_new) || false
686
+ repoType: __props.cardType,
687
+ isNew: ((_a = __props.info) == null ? void 0 : _a.is_new) || false
775
688
  }, null, 8, ["repoType", "isNew"])
776
689
  ];
777
690
  }),
@@ -779,7 +692,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
779
692
  }),
780
693
  createVNode(unref(Col), { flex: "none" }, {
781
694
  default: withCtx(() => [
782
- !_ctx.hideStarBtn ? (openBlock(), createBlock(StarTag, {
695
+ !__props.hideStarBtn ? (openBlock(), createBlock(StarTag, {
783
696
  key: 0,
784
697
  isLike: isModel.value,
785
698
  "star-info": starInfo.value,
@@ -791,12 +704,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
791
704
  ]),
792
705
  _: 1
793
706
  }),
794
- !_ctx.hideDescription ? (openBlock(), createElementBlock("div", {
707
+ !__props.hideDescription ? (openBlock(), createElementBlock("div", {
795
708
  key: 0,
796
709
  innerHTML: unref(highlightWords)("", description.value),
797
710
  class: "i-search-projects-card-desc ellipsis"
798
711
  }, null, 8, _hoisted_5)) : createCommentVNode("", true),
799
- _ctx.info.index === 0 && _ctx.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
712
+ __props.info.index === 0 && __props.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
800
713
  queryLoading.value ? (openBlock(), createBlock(unref(Skeleton), { key: 0 }, {
801
714
  placeholder: withCtx(() => [
802
715
  createVNode(unref(Row), {
@@ -834,16 +747,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
834
747
  ]),
835
748
  _: 1
836
749
  })) : createCommentVNode("", true)
837
- ])) : isModel.value ? (openBlock(), createBlock(ModelCardFooter, {
750
+ ])) : isModel.value && !__props.hideFooter ? (openBlock(), createBlock(ModelCardFooter, {
838
751
  key: 2,
839
- repoInfo: _ctx.info
752
+ repoInfo: __props.info
840
753
  }, null, 8, ["repoInfo"])) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
841
- !_ctx.hideFooter ? (openBlock(), createBlock(RepoCardFooter, {
754
+ !__props.hideFooter ? (openBlock(), createBlock(RepoCardFooter, {
842
755
  key: 0,
843
- hideTopicTags: _ctx.hideTopicTags,
756
+ hideTopicTags: __props.hideTopicTags,
844
757
  hideStarCount: "",
845
758
  tagInfo: tagInfo.value,
846
- repoInfo: _ctx.info,
759
+ repoInfo: __props.info,
847
760
  searchCard: "",
848
761
  class: "i-search-projects-card-bottom",
849
762
  onTopicClick: handleTopicClick
@@ -854,6 +767,71 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
854
767
  }
855
768
  });
856
769
  const SearchRepoCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
770
+ const useReportRepo = (reportParams, viewReport) => {
771
+ const list = ref([]);
772
+ const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
773
+ const locationHref = ref((window == null ? void 0 : window.location.href) || "");
774
+ const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
775
+ const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
776
+ const triggerReport = (type, data) => {
777
+ if (type === "click") {
778
+ const params = {
779
+ chat_title: "",
780
+ related: {
781
+ list: [formatItem(data)],
782
+ type: "repo"
783
+ }
784
+ };
785
+ viewReport(pageRef.value, locationHref.value, "click", params);
786
+ } else if (type === "expo") {
787
+ list.value.push(data);
788
+ }
789
+ };
790
+ const formatItem = (data) => {
791
+ const channelNames = [];
792
+ if (data.channelName) channelNames.push(data.channelName);
793
+ if (data.subChannelName) channelNames.push(data.subChannelName);
794
+ const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
795
+ return {
796
+ type: "gitcode",
797
+ repo_id: repoId,
798
+ dest_url: data.web_url,
799
+ strategy: channelNames.join("、") || "",
800
+ // 官方项目
801
+ repo_index: data.index,
802
+ page: data.pageIndex || data.p || 0,
803
+ per_page: data.pageSize || data.pp || 0,
804
+ q: data.keyword || ""
805
+ };
806
+ };
807
+ const doReport = debounce(() => {
808
+ if (list.value.length >= 1) {
809
+ const reportList = list.value.splice(0).map((item) => {
810
+ return formatItem(item);
811
+ });
812
+ const params = {
813
+ chat_title: "",
814
+ extend_json: {
815
+ key_words: keyword.value,
816
+ module_name: moduleName.value
817
+ },
818
+ related: {
819
+ list: reportList,
820
+ type: "repo"
821
+ }
822
+ };
823
+ viewReport(pageRef.value, locationHref.value, "expo", params);
824
+ }
825
+ }, 500, { leading: false });
826
+ watchEffect(() => {
827
+ if (list.value.length) {
828
+ doReport();
829
+ }
830
+ });
831
+ return {
832
+ triggerReport
833
+ };
834
+ };
857
835
  export {
858
836
  SearchRepoCard as S,
859
837
  formatNameSpace as f,