vue-layout-gitcode 1.12.15-beta.49 → 1.12.15-beta.50

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-D27sLwSF.js";
1
+ import { z as useLayoutConfig } from "./index-lXkdtPpx.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-D27sLwSF.js";
4
- import { t as transWebUrl } from "./transWebUrl-DFYqL_Qw.js";
1
+ import { defineComponent, toDisplayString, unref, mergeModels, useModel, ref, watch, createElementBlock, openBlock, createVNode, withDirectives, normalizeClass, createElementVNode, vShow, inject, withModifiers, createBlock, Fragment, computed, createCommentVNode, normalizeStyle, createTextVNode, renderList, withCtx, reactive, onMounted, watchEffect } from "vue";
2
+ 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, 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-lXkdtPpx.js";
3
+ import { t as transWebUrl } from "./transWebUrl-DGesD31K.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: __props.number, fixed: __props.fixed, byte: __props.byte, gt100: __props.gt100 }));
22
+ return toDisplayString(unref(transferNumber)({ number: _ctx.number, fixed: _ctx.fixed, byte: _ctx.byte, gt100: _ctx.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
- __props.isLike ? (openBlock(), createBlock(Like, {
160
+ _ctx.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: __props.count || 0
214
+ number: _ctx.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
- !__props.hideText ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(unref($t)("gitCodeLayout.components.repo.today")), 1)) : createCommentVNode("", true),
276
+ !_ctx.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: __props.starCountOne || 0
278
+ number: _ctx.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 ", -1)),
309
+ _cache[0] || (_cache[0] = createTextVNode("Star ")),
387
310
  createVNode(_sfc_main$a, {
388
- number: __props.count || 0,
311
+ number: _ctx.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
- __props.tagInfo ? (openBlock(), createBlock(LanguageTag, {
361
+ _ctx.tagInfo ? (openBlock(), createBlock(LanguageTag, {
449
362
  key: 0,
450
- "tag-info": __props.tagInfo
363
+ "tag-info": _ctx.tagInfo
451
364
  }, null, 8, ["tag-info"])) : createCommentVNode("", true),
452
- !__props.hideStarCount ? (openBlock(), createBlock(StarCountOne, {
365
+ !_ctx.hideStarCount ? (openBlock(), createBlock(StarCountOne, {
453
366
  key: 1,
454
367
  hideText: "",
455
- starCountOne: __props.repoInfo.star_count
368
+ starCountOne: _ctx.repoInfo.star_count
456
369
  }, null, 8, ["starCountOne"])) : createCommentVNode("", true),
457
- __props.repoInfo.forks_count ? (openBlock(), createBlock(ForkTag, {
370
+ _ctx.repoInfo.forks_count ? (openBlock(), createBlock(ForkTag, {
458
371
  key: 2,
459
- count: __props.repoInfo.forks_count
372
+ count: _ctx.repoInfo.forks_count
460
373
  }, null, 8, ["count"])) : createCommentVNode("", true),
461
374
  showUpdateTimeDot.value ? (openBlock(), createElementBlock("div", _hoisted_2$2)) : createCommentVNode("", true),
462
- !__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),
463
- !__props.hideStarIncrease && __props.repoInfo.star_count_one ? (openBlock(), createBlock(StarCountOne, {
375
+ !_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),
376
+ !_ctx.hideStarIncrease && _ctx.repoInfo.star_count_one ? (openBlock(), createBlock(StarCountOne, {
464
377
  key: 5,
465
- starCountOne: __props.repoInfo.star_count_one
378
+ starCountOne: _ctx.repoInfo.star_count_one
466
379
  }, null, 8, ["starCountOne"])) : createCommentVNode("", true),
467
- __props.repoInfo.is_gh_mirrors ? (openBlock(), createBlock(GithubStarNum, {
380
+ _ctx.repoInfo.is_gh_mirrors ? (openBlock(), createBlock(GithubStarNum, {
468
381
  key: 6,
469
- count: __props.repoInfo.import_star_count
382
+ count: _ctx.repoInfo.import_star_count
470
383
  }, null, 8, ["count"])) : createCommentVNode("", true)
471
384
  ])
472
385
  ]),
473
- !__props.hideTopicTags && topicNames.value.length && __props.searchCard ? (openBlock(), createElementBlock("div", {
386
+ !_ctx.hideTopicTags && topicNames.value.length && _ctx.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,7 +450,8 @@ 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
453
+ _: 1,
454
+ __: [0]
538
455
  })) : createCommentVNode("", true);
539
456
  };
540
457
  }
@@ -623,18 +540,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
623
540
  info: {},
624
541
  keyword: {},
625
542
  cardType: {},
626
- noborder: { type: Boolean },
627
- hover: { type: Boolean },
628
- hideTopicTags: { type: Boolean },
629
- urlParams: {},
630
- hideStarBtn: { type: Boolean },
631
- hideFooter: { type: Boolean },
632
- hideDescription: { type: Boolean }
543
+ noborder: { type: Boolean, default: false },
544
+ hover: { type: Boolean, default: false },
545
+ hideTopicTags: { type: Boolean, default: false },
546
+ urlParams: { default: () => ({}) },
547
+ hideStarBtn: { type: Boolean, default: false },
548
+ hideFooter: { type: Boolean, default: false },
549
+ hideDescription: { type: Boolean, default: false }
633
550
  },
634
551
  emits: ["report"],
635
552
  setup(__props, { emit: __emit }) {
636
553
  const lang = useCookie(LANG_KEY, LANG_ZH);
637
- const API = headRequest(inject("request"));
554
+ const request = inject("request") || (() => Promise.resolve({ data: {} }));
555
+ const API = headRequest(request);
638
556
  const emits = __emit;
639
557
  const router = useRouter();
640
558
  const { widthType } = usePageResize();
@@ -701,7 +619,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
701
619
  name_with_namespace: nameWithSpace,
702
620
  path_with_namespace: path,
703
621
  import_url: importUrl,
704
- is_gh_mirrors: isGhMirrors,
705
622
  is_mirrors: isMirrors
706
623
  } = info || {};
707
624
  const isGitcodeRepo = REPO_TYPE.GITCODE === isMirrors;
@@ -718,7 +635,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
718
635
  });
719
636
  return (_ctx, _cache) => {
720
637
  return openBlock(), createElementBlock("a", {
721
- class: normalizeClass(["i-search-projects-card", { noborder: __props.noborder, "full-hover": __props.hover }]),
638
+ class: normalizeClass(["i-search-projects-card", { noborder: _ctx.noborder, "full-hover": _ctx.hover }]),
722
639
  onClick: handleClick
723
640
  }, [
724
641
  createVNode(unref(Row), { class: "i-search-projects-card-title" }, {
@@ -732,43 +649,45 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
732
649
  return [
733
650
  createVNode(GIcon, {
734
651
  name: iconName.value,
735
- class: normalizeClass({ "align-middle": __props.info.is_gh_mirrors }),
652
+ class: normalizeClass({ "align-middle": _ctx.info.is_gh_mirrors }),
736
653
  color: "var(--theme-placeholder)"
737
654
  }, null, 8, ["name", "class"]),
738
655
  createElementVNode("span", {
739
656
  class: "repo-title",
740
657
  innerHTML: preHandWord()
741
658
  }, null, 8, _hoisted_1),
742
- __props.info.show_recommend_icon ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.search.recommendTag")), 1)) : createCommentVNode("", true),
743
- unref(isGstarRepo)(__props.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_3, [
659
+ _ctx.info.show_recommend_icon ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.search.recommendTag")), 1)) : createCommentVNode("", true),
660
+ unref(isGstarRepo)(_ctx.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_3, [
744
661
  createVNode(_sfc_main$b, {
745
662
  origin: "repo",
746
663
  icon: "",
747
664
  type: "gstar",
748
665
  message: `G-Star ${unref($t)("gitCodeLayout.GStar.project.graduation")}`
749
666
  }, {
750
- default: withCtx(() => [..._cache[0] || (_cache[0] = [
751
- createTextVNode("G-Star ", -1)
752
- ])]),
753
- _: 1
667
+ default: withCtx(() => _cache[0] || (_cache[0] = [
668
+ createTextVNode("G-Star ")
669
+ ])),
670
+ _: 1,
671
+ __: [0]
754
672
  }, 8, ["message"])
755
673
  ])) : createCommentVNode("", true),
756
- unref(isIncubationRepo)(__props.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_4, [
674
+ unref(isIncubationRepo)(_ctx.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_4, [
757
675
  createVNode(_sfc_main$b, {
758
676
  origin: "repo",
759
677
  icon: "",
760
678
  type: "incubation",
761
679
  message: `G-Star ${unref($t)("gitCodeLayout.GStar.project.incubation")}`
762
680
  }, {
763
- default: withCtx(() => [..._cache[1] || (_cache[1] = [
764
- createTextVNode(" G-Star ", -1)
765
- ])]),
766
- _: 1
681
+ default: withCtx(() => _cache[1] || (_cache[1] = [
682
+ createTextVNode(" G-Star ")
683
+ ])),
684
+ _: 1,
685
+ __: [1]
767
686
  }, 8, ["message"])
768
687
  ])) : createCommentVNode("", true),
769
688
  createVNode(NewTag, {
770
- repoType: __props.cardType,
771
- isNew: ((_a = __props.info) == null ? void 0 : _a.is_new) || false
689
+ repoType: _ctx.cardType,
690
+ isNew: ((_a = _ctx.info) == null ? void 0 : _a.is_new) || false
772
691
  }, null, 8, ["repoType", "isNew"])
773
692
  ];
774
693
  }),
@@ -776,7 +695,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
776
695
  }),
777
696
  createVNode(unref(Col), { flex: "none" }, {
778
697
  default: withCtx(() => [
779
- !__props.hideStarBtn ? (openBlock(), createBlock(StarTag, {
698
+ !_ctx.hideStarBtn ? (openBlock(), createBlock(StarTag, {
780
699
  key: 0,
781
700
  isLike: isModel.value,
782
701
  "star-info": starInfo.value,
@@ -788,12 +707,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
788
707
  ]),
789
708
  _: 1
790
709
  }),
791
- !__props.hideDescription ? (openBlock(), createElementBlock("div", {
710
+ !_ctx.hideDescription ? (openBlock(), createElementBlock("div", {
792
711
  key: 0,
793
712
  innerHTML: unref(highlightWords)("", description.value),
794
713
  class: "i-search-projects-card-desc ellipsis"
795
714
  }, null, 8, _hoisted_5)) : createCommentVNode("", true),
796
- __props.info.index === 0 && __props.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
715
+ _ctx.info.index === 0 && _ctx.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
797
716
  queryLoading.value ? (openBlock(), createBlock(unref(Skeleton), { key: 0 }, {
798
717
  placeholder: withCtx(() => [
799
718
  createVNode(unref(Row), {
@@ -833,14 +752,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
833
752
  })) : createCommentVNode("", true)
834
753
  ])) : isModel.value ? (openBlock(), createBlock(ModelCardFooter, {
835
754
  key: 2,
836
- repoInfo: __props.info
755
+ repoInfo: _ctx.info
837
756
  }, null, 8, ["repoInfo"])) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
838
- !__props.hideFooter ? (openBlock(), createBlock(RepoCardFooter, {
757
+ !_ctx.hideFooter ? (openBlock(), createBlock(RepoCardFooter, {
839
758
  key: 0,
840
- hideTopicTags: __props.hideTopicTags,
759
+ hideTopicTags: _ctx.hideTopicTags,
841
760
  hideStarCount: "",
842
761
  tagInfo: tagInfo.value,
843
- repoInfo: __props.info,
762
+ repoInfo: _ctx.info,
844
763
  searchCard: "",
845
764
  class: "i-search-projects-card-bottom",
846
765
  onTopicClick: handleTopicClick
@@ -851,6 +770,71 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
851
770
  }
852
771
  });
853
772
  const SearchRepoCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
773
+ const useReportRepo = (reportParams, viewReport) => {
774
+ const list = ref([]);
775
+ const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
776
+ const locationHref = ref((window == null ? void 0 : window.location.href) || "");
777
+ const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
778
+ const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
779
+ const triggerReport = (type, data) => {
780
+ if (type === "click") {
781
+ const params = {
782
+ chat_title: "",
783
+ related: {
784
+ list: [formatItem(data)],
785
+ type: "repo"
786
+ }
787
+ };
788
+ viewReport(pageRef.value, locationHref.value, "click", params);
789
+ } else if (type === "expo") {
790
+ list.value.push(data);
791
+ }
792
+ };
793
+ const formatItem = (data) => {
794
+ const channelNames = [];
795
+ if (data.channelName) channelNames.push(data.channelName);
796
+ if (data.subChannelName) channelNames.push(data.subChannelName);
797
+ const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
798
+ return {
799
+ type: "gitcode",
800
+ repo_id: repoId,
801
+ dest_url: data.web_url,
802
+ strategy: channelNames.join("、") || "",
803
+ // 官方项目
804
+ repo_index: data.index,
805
+ page: data.pageIndex || data.p || 0,
806
+ per_page: data.pageSize || data.pp || 0,
807
+ q: data.keyword || ""
808
+ };
809
+ };
810
+ const doReport = debounce(() => {
811
+ if (list.value.length >= 1) {
812
+ const reportList = list.value.splice(0).map((item) => {
813
+ return formatItem(item);
814
+ });
815
+ const params = {
816
+ chat_title: "",
817
+ extend_json: {
818
+ key_words: keyword.value,
819
+ module_name: moduleName.value
820
+ },
821
+ related: {
822
+ list: reportList,
823
+ type: "repo"
824
+ }
825
+ };
826
+ viewReport(pageRef.value, locationHref.value, "expo", params);
827
+ }
828
+ }, 500, { leading: false });
829
+ watchEffect(() => {
830
+ if (list.value.length) {
831
+ doReport();
832
+ }
833
+ });
834
+ return {
835
+ triggerReport
836
+ };
837
+ };
854
838
  export {
855
839
  SearchRepoCard as S,
856
840
  formatNameSpace as f,