vue-layout-gitcode 1.12.15-beta.65 → 1.12.15-beta.67
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.
- package/{GloabarSearch-C_uS_Hbh.js → GloabarSearch-CwbCgDdJ.js} +14 -41
- package/{MenuItem-CJEDocOW.js → MenuItem-hlBK-DsB.js} +2 -2
- package/{ProjectMenuList-ybKddQc8.js → ProjectMenuList-XUYTmyR3.js} +11 -11
- package/{ProjectMenuListV2-DIuZkXS0.js → ProjectMenuListV2-CX1-06i7.js} +4 -4
- package/{ProjectSearch-DwDXaTML.js → ProjectSearch-CtFakerA.js} +2 -2
- package/{SearchHistoryList-Cu6UkkuX.js → SearchHistoryList-BLg4OuDp.js} +6 -6
- package/{SearchRecommed-DPdZOEmw.js → SearchRecommed-13VdUFCm.js} +18 -12
- package/{SearchScopeList-CxmQceVu.js → SearchScopeList-BaJHPP1Z.js} +3 -3
- package/{UserSearch-BNK0_7Sb.js → UserSearch-Bp2I3R2Z.js} +2 -2
- package/{index-ByMlkNg8.js → index-BG-BxIZg.js} +2 -2
- package/{index-yb4pP7I6.js → index-CMQVrAyP.js} +5 -6
- package/{index-C2PKzuq6.js → index-Cj5V-7gF.js} +2090 -1352
- package/index.js +19 -19
- package/{notice-CObdDYSj.js → notice-CebMhCRS.js} +11 -13
- package/package.json +1 -1
- package/{useReportRepo-CBA-Tnmu.js → search-suggestion-B_qiWuu9.js} +118 -51
- package/style.css +1 -1
- package/{transWebUrl-9O_5B0ff.js → transWebUrl-BIzhUzss.js} +3 -3
package/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P, Q, S, U, V, W, X, Y, Z, $, a0, a1, a2, a3, a4, a5, C, a6, a7, a8, a9 } from "./index-Cj5V-7gF.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
P as AsideFooterTools,
|
|
4
|
+
Q as AtomCodeLauncher,
|
|
5
|
+
S as EnterpriseHeader,
|
|
6
6
|
U as GitCodeAside,
|
|
7
7
|
V as GitCodeAsideV2,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
W as GitCodeHeader,
|
|
9
|
+
X as GitCodeLayoutEmitter,
|
|
10
|
+
Y as HEADER_CREATE_MENU_PATHS,
|
|
11
|
+
Z as HeaderCreateMenu,
|
|
12
|
+
$ as HeaderSkeleton,
|
|
13
|
+
a0 as HomeHeaderActions,
|
|
14
|
+
a1 as Login,
|
|
15
|
+
a2 as SceneValue,
|
|
16
|
+
a3 as ScrollActiveContainer,
|
|
17
|
+
a4 as SiteAnnouncement,
|
|
18
|
+
a5 as ToolsFloat,
|
|
19
19
|
C as currentTheme,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
a6 as default,
|
|
21
|
+
a7 as setLayoutConfig,
|
|
22
|
+
a8 as setTheme,
|
|
23
|
+
a9 as useLogin
|
|
24
24
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, computed,
|
|
2
|
-
import { i as isPhone, u as useModel, _ as _export_sfc } from "./index-
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref, isRef, withCtx, createElementVNode, normalizeClass, createVNode, createTextVNode } from "vue";
|
|
2
|
+
import { i as isPhone, u as useModel, _ as _export_sfc } from "./index-Cj5V-7gF.js";
|
|
3
3
|
import { Notification } from "vue-devui-lal/notification";
|
|
4
4
|
import { Button } from "vue-devui-lal/button";
|
|
5
5
|
import "vue-devui-lal/notification/style.css";
|
|
@@ -33,14 +33,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
33
33
|
createVNode(unref(Button), {
|
|
34
34
|
variant: "outline",
|
|
35
35
|
size: isMobile.value ? "sm" : "md",
|
|
36
|
-
onClick:
|
|
36
|
+
onClick: __props.onClose,
|
|
37
37
|
class: "email-notice__btn-ignore"
|
|
38
38
|
}, {
|
|
39
|
-
default: withCtx(() => _cache[1] || (_cache[1] = [
|
|
40
|
-
createTextVNode("忽略")
|
|
41
|
-
])),
|
|
42
|
-
_: 1
|
|
43
|
-
__: [1]
|
|
39
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
40
|
+
createTextVNode("忽略", -1)
|
|
41
|
+
])]),
|
|
42
|
+
_: 1
|
|
44
43
|
}, 8, ["size", "onClick"]),
|
|
45
44
|
createVNode(unref(Button), {
|
|
46
45
|
variant: "solid",
|
|
@@ -48,11 +47,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
48
47
|
color: "primary",
|
|
49
48
|
onClick: handleConfirm
|
|
50
49
|
}, {
|
|
51
|
-
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
52
|
-
createTextVNode("修改")
|
|
53
|
-
])),
|
|
54
|
-
_: 1
|
|
55
|
-
__: [2]
|
|
50
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
51
|
+
createTextVNode("修改", -1)
|
|
52
|
+
])]),
|
|
53
|
+
_: 1
|
|
56
54
|
}, 8, ["size"])
|
|
57
55
|
], 2)
|
|
58
56
|
]),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent, toDisplayString, unref,
|
|
2
|
-
import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource,
|
|
3
|
-
import { t as transWebUrl } from "./transWebUrl-
|
|
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, e as useRequestReport, h as headRequest, a as i18n, T as TOPIC_TYPE, f as useTimeFormat, g as useCookie, j as usePageResize, L as LANG_ZH, k as isGstarRepo, m as _sfc_main$b, o as isIncubationRepo, p as highlightWords, t as transformUrl, q as _frEventTrack, E as EVENT_NAME, w as REPO_TYPE, x as extractRepoInfoWithURL, y as LANG_KEY } from "./index-Cj5V-7gF.js";
|
|
3
|
+
import { t as transWebUrl } from "./transWebUrl-BIzhUzss.js";
|
|
4
4
|
import { useRouter } from "vue-router";
|
|
5
5
|
import { Row, Col } from "vue-devui-lal/grid";
|
|
6
6
|
import { Skeleton, SkeletonItem } from "vue-devui-lal/skeleton";
|
|
@@ -19,7 +19,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
19
19
|
},
|
|
20
20
|
setup(__props) {
|
|
21
21
|
return (_ctx, _cache) => {
|
|
22
|
-
return toDisplayString(unref(transferNumber)({ number:
|
|
22
|
+
return toDisplayString(unref(transferNumber)({ number: __props.number, fixed: __props.fixed, byte: __props.byte, gt100: __props.gt100 }));
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
});
|
|
@@ -157,7 +157,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
157
157
|
}]),
|
|
158
158
|
onClick: withModifiers(handleStar, ["stop", "prevent"])
|
|
159
159
|
}, [
|
|
160
|
-
|
|
160
|
+
__props.isLike ? (openBlock(), createBlock(Like, {
|
|
161
161
|
key: 0,
|
|
162
162
|
class: "i-star-tag__icon-mr",
|
|
163
163
|
modelValue: starred.value,
|
|
@@ -211,7 +211,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
211
211
|
}),
|
|
212
212
|
createElementVNode("span", null, [
|
|
213
213
|
createVNode(_sfc_main$a, {
|
|
214
|
-
number:
|
|
214
|
+
number: __props.count || 0
|
|
215
215
|
}, null, 8, ["number"])
|
|
216
216
|
])
|
|
217
217
|
]);
|
|
@@ -273,9 +273,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
273
273
|
color: "var(--theme-home-card-color-placeholder)",
|
|
274
274
|
size: "14"
|
|
275
275
|
}),
|
|
276
|
-
!
|
|
276
|
+
!__props.hideText ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(unref($t)("gitCodeLayout.components.repo.today")), 1)) : createCommentVNode("", true),
|
|
277
277
|
createVNode(_sfc_main$a, {
|
|
278
|
-
number:
|
|
278
|
+
number: __props.starCountOne || 0
|
|
279
279
|
}, null, 8, ["number"])
|
|
280
280
|
]);
|
|
281
281
|
};
|
|
@@ -306,9 +306,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
306
306
|
size: "14"
|
|
307
307
|
}),
|
|
308
308
|
createElementVNode("span", _hoisted_2$3, [
|
|
309
|
-
_cache[0] || (_cache[0] = createTextVNode("Star ")),
|
|
309
|
+
_cache[0] || (_cache[0] = createTextVNode("Star ", -1)),
|
|
310
310
|
createVNode(_sfc_main$a, {
|
|
311
|
-
number:
|
|
311
|
+
number: __props.count || 0,
|
|
312
312
|
gt100: true
|
|
313
313
|
}, null, 8, ["number"])
|
|
314
314
|
])
|
|
@@ -358,32 +358,32 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
358
358
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
359
359
|
createElementVNode("div", null, [
|
|
360
360
|
createElementVNode("div", _hoisted_1$3, [
|
|
361
|
-
|
|
361
|
+
__props.tagInfo ? (openBlock(), createBlock(LanguageTag, {
|
|
362
362
|
key: 0,
|
|
363
|
-
"tag-info":
|
|
363
|
+
"tag-info": __props.tagInfo
|
|
364
364
|
}, null, 8, ["tag-info"])) : createCommentVNode("", true),
|
|
365
|
-
!
|
|
365
|
+
!__props.hideStarCount ? (openBlock(), createBlock(StarCountOne, {
|
|
366
366
|
key: 1,
|
|
367
367
|
hideText: "",
|
|
368
|
-
starCountOne:
|
|
368
|
+
starCountOne: __props.repoInfo.star_count
|
|
369
369
|
}, null, 8, ["starCountOne"])) : createCommentVNode("", true),
|
|
370
|
-
|
|
370
|
+
__props.repoInfo.forks_count ? (openBlock(), createBlock(ForkTag, {
|
|
371
371
|
key: 2,
|
|
372
|
-
count:
|
|
372
|
+
count: __props.repoInfo.forks_count
|
|
373
373
|
}, null, 8, ["count"])) : createCommentVNode("", true),
|
|
374
374
|
showUpdateTimeDot.value ? (openBlock(), createElementBlock("div", _hoisted_2$2)) : createCommentVNode("", true),
|
|
375
|
-
!
|
|
376
|
-
!
|
|
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, {
|
|
377
377
|
key: 5,
|
|
378
|
-
starCountOne:
|
|
378
|
+
starCountOne: __props.repoInfo.star_count_one
|
|
379
379
|
}, null, 8, ["starCountOne"])) : createCommentVNode("", true),
|
|
380
|
-
|
|
380
|
+
__props.repoInfo.is_gh_mirrors ? (openBlock(), createBlock(GithubStarNum, {
|
|
381
381
|
key: 6,
|
|
382
|
-
count:
|
|
382
|
+
count: __props.repoInfo.import_star_count
|
|
383
383
|
}, null, 8, ["count"])) : createCommentVNode("", true)
|
|
384
384
|
])
|
|
385
385
|
]),
|
|
386
|
-
!
|
|
386
|
+
!__props.hideTopicTags && topicNames.value.length && __props.searchCard ? (openBlock(), createElementBlock("div", {
|
|
387
387
|
key: 0,
|
|
388
388
|
class: "topic-tags",
|
|
389
389
|
ref_key: "topicTagsRef",
|
|
@@ -450,8 +450,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
450
450
|
default: withCtx(() => [
|
|
451
451
|
_cache[0] || (_cache[0] = createElementVNode("div", { class: "new-tag" }, "New", -1))
|
|
452
452
|
]),
|
|
453
|
-
_: 1
|
|
454
|
-
__: [0]
|
|
453
|
+
_: 1
|
|
455
454
|
})) : createCommentVNode("", true);
|
|
456
455
|
};
|
|
457
456
|
}
|
|
@@ -544,6 +543,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
544
543
|
hover: { type: Boolean, default: false },
|
|
545
544
|
hideTopicTags: { type: Boolean, default: false },
|
|
546
545
|
urlParams: { default: () => ({}) },
|
|
546
|
+
preserveUrlOrigin: { type: Boolean, default: false },
|
|
547
547
|
hideStarBtn: { type: Boolean, default: false },
|
|
548
548
|
hideFooter: { type: Boolean, default: false },
|
|
549
549
|
hideDescription: { type: Boolean, default: false }
|
|
@@ -558,7 +558,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
558
558
|
const { widthType } = usePageResize();
|
|
559
559
|
const { t: $t } = i18n.global;
|
|
560
560
|
const handleClick = () => {
|
|
561
|
-
window.open(transWebUrl(transformUrl(props.info.web_url), props.urlParams
|
|
561
|
+
window.open(transWebUrl(transformUrl(props.info.web_url), props.urlParams, {
|
|
562
|
+
preserveOrigin: props.preserveUrlOrigin
|
|
563
|
+
}), "_blank");
|
|
562
564
|
emits("report");
|
|
563
565
|
_frEventTrack(EVENT_NAME.CLICK_SEARCH_RESULT);
|
|
564
566
|
};
|
|
@@ -635,7 +637,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
635
637
|
});
|
|
636
638
|
return (_ctx, _cache) => {
|
|
637
639
|
return openBlock(), createElementBlock("a", {
|
|
638
|
-
class: normalizeClass(["i-search-projects-card", { noborder:
|
|
640
|
+
class: normalizeClass(["i-search-projects-card", { noborder: __props.noborder, "full-hover": __props.hover }]),
|
|
639
641
|
onClick: handleClick
|
|
640
642
|
}, [
|
|
641
643
|
createVNode(unref(Row), { class: "i-search-projects-card-title" }, {
|
|
@@ -649,45 +651,43 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
649
651
|
return [
|
|
650
652
|
createVNode(GIcon, {
|
|
651
653
|
name: iconName.value,
|
|
652
|
-
class: normalizeClass({ "align-middle":
|
|
654
|
+
class: normalizeClass({ "align-middle": __props.info.is_gh_mirrors }),
|
|
653
655
|
color: "var(--theme-placeholder)"
|
|
654
656
|
}, null, 8, ["name", "class"]),
|
|
655
657
|
createElementVNode("span", {
|
|
656
658
|
class: "repo-title",
|
|
657
659
|
innerHTML: preHandWord()
|
|
658
660
|
}, null, 8, _hoisted_1),
|
|
659
|
-
|
|
660
|
-
unref(isGstarRepo)(
|
|
661
|
+
__props.info.show_recommend_icon ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.search.recommendTag")), 1)) : createCommentVNode("", true),
|
|
662
|
+
unref(isGstarRepo)(__props.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
661
663
|
createVNode(_sfc_main$b, {
|
|
662
664
|
origin: "repo",
|
|
663
665
|
icon: "",
|
|
664
666
|
type: "gstar",
|
|
665
667
|
message: `G-Star ${unref($t)("gitCodeLayout.GStar.project.graduation")}`
|
|
666
668
|
}, {
|
|
667
|
-
default: withCtx(() => _cache[0] || (_cache[0] = [
|
|
668
|
-
createTextVNode("G-Star ")
|
|
669
|
-
])),
|
|
670
|
-
_: 1
|
|
671
|
-
__: [0]
|
|
669
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
670
|
+
createTextVNode("G-Star ", -1)
|
|
671
|
+
])]),
|
|
672
|
+
_: 1
|
|
672
673
|
}, 8, ["message"])
|
|
673
674
|
])) : createCommentVNode("", true),
|
|
674
|
-
unref(isIncubationRepo)(
|
|
675
|
+
unref(isIncubationRepo)(__props.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
675
676
|
createVNode(_sfc_main$b, {
|
|
676
677
|
origin: "repo",
|
|
677
678
|
icon: "",
|
|
678
679
|
type: "incubation",
|
|
679
680
|
message: `G-Star ${unref($t)("gitCodeLayout.GStar.project.incubation")}`
|
|
680
681
|
}, {
|
|
681
|
-
default: withCtx(() => _cache[1] || (_cache[1] = [
|
|
682
|
-
createTextVNode(" G-Star ")
|
|
683
|
-
])),
|
|
684
|
-
_: 1
|
|
685
|
-
__: [1]
|
|
682
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
683
|
+
createTextVNode(" G-Star ", -1)
|
|
684
|
+
])]),
|
|
685
|
+
_: 1
|
|
686
686
|
}, 8, ["message"])
|
|
687
687
|
])) : createCommentVNode("", true),
|
|
688
688
|
createVNode(NewTag, {
|
|
689
|
-
repoType:
|
|
690
|
-
isNew: ((_a =
|
|
689
|
+
repoType: __props.cardType,
|
|
690
|
+
isNew: ((_a = __props.info) == null ? void 0 : _a.is_new) || false
|
|
691
691
|
}, null, 8, ["repoType", "isNew"])
|
|
692
692
|
];
|
|
693
693
|
}),
|
|
@@ -695,7 +695,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
695
695
|
}),
|
|
696
696
|
createVNode(unref(Col), { flex: "none" }, {
|
|
697
697
|
default: withCtx(() => [
|
|
698
|
-
!
|
|
698
|
+
!__props.hideStarBtn ? (openBlock(), createBlock(StarTag, {
|
|
699
699
|
key: 0,
|
|
700
700
|
isLike: isModel.value,
|
|
701
701
|
"star-info": starInfo.value,
|
|
@@ -707,12 +707,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
707
707
|
]),
|
|
708
708
|
_: 1
|
|
709
709
|
}),
|
|
710
|
-
!
|
|
710
|
+
!__props.hideDescription ? (openBlock(), createElementBlock("div", {
|
|
711
711
|
key: 0,
|
|
712
712
|
innerHTML: unref(highlightWords)("", description.value),
|
|
713
713
|
class: "i-search-projects-card-desc ellipsis"
|
|
714
714
|
}, null, 8, _hoisted_5)) : createCommentVNode("", true),
|
|
715
|
-
|
|
715
|
+
__props.info.index === 0 && __props.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
716
716
|
queryLoading.value ? (openBlock(), createBlock(unref(Skeleton), { key: 0 }, {
|
|
717
717
|
placeholder: withCtx(() => [
|
|
718
718
|
createVNode(unref(Row), {
|
|
@@ -750,16 +750,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
750
750
|
]),
|
|
751
751
|
_: 1
|
|
752
752
|
})) : createCommentVNode("", true)
|
|
753
|
-
])) : isModel.value && !
|
|
753
|
+
])) : isModel.value && !__props.hideFooter ? (openBlock(), createBlock(ModelCardFooter, {
|
|
754
754
|
key: 2,
|
|
755
|
-
repoInfo:
|
|
755
|
+
repoInfo: __props.info
|
|
756
756
|
}, null, 8, ["repoInfo"])) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
757
|
-
!
|
|
757
|
+
!__props.hideFooter ? (openBlock(), createBlock(RepoCardFooter, {
|
|
758
758
|
key: 0,
|
|
759
|
-
hideTopicTags:
|
|
759
|
+
hideTopicTags: __props.hideTopicTags,
|
|
760
760
|
hideStarCount: "",
|
|
761
761
|
tagInfo: tagInfo.value,
|
|
762
|
-
repoInfo:
|
|
762
|
+
repoInfo: __props.info,
|
|
763
763
|
searchCard: "",
|
|
764
764
|
class: "i-search-projects-card-bottom",
|
|
765
765
|
onTopicClick: handleTopicClick
|
|
@@ -835,8 +835,75 @@ const useReportRepo = (reportParams, viewReport) => {
|
|
|
835
835
|
triggerReport
|
|
836
836
|
};
|
|
837
837
|
};
|
|
838
|
+
const normalizeOrigin = (origin) => {
|
|
839
|
+
const value = origin.trim().replace(/\/+$/, "");
|
|
840
|
+
if (!value) return "";
|
|
841
|
+
try {
|
|
842
|
+
const url = new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(value) ? value : `https://${value}`);
|
|
843
|
+
return url.origin;
|
|
844
|
+
} catch {
|
|
845
|
+
return value;
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
const getStringValue = (value) => typeof value === "string" ? value : "";
|
|
849
|
+
const normalizeProjectUrlForMainSite = (value, projectOrigin, currentOrigin) => {
|
|
850
|
+
const urlValue = getStringValue(value).trim();
|
|
851
|
+
if (!urlValue) return urlValue;
|
|
852
|
+
const mainOrigin = normalizeOrigin(projectOrigin) || normalizeOrigin(currentOrigin);
|
|
853
|
+
if (!mainOrigin) return urlValue;
|
|
854
|
+
try {
|
|
855
|
+
const mainSiteUrl = new URL(mainOrigin);
|
|
856
|
+
const projectUrl = new URL(urlValue, `${mainSiteUrl.origin}/`);
|
|
857
|
+
if (projectUrl.protocol !== "http:" && projectUrl.protocol !== "https:") return urlValue;
|
|
858
|
+
projectUrl.protocol = mainSiteUrl.protocol;
|
|
859
|
+
projectUrl.host = mainSiteUrl.host;
|
|
860
|
+
projectUrl.username = "";
|
|
861
|
+
projectUrl.password = "";
|
|
862
|
+
return projectUrl.toString();
|
|
863
|
+
} catch {
|
|
864
|
+
return urlValue;
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
const isProjectSuggestionType = (repoType) => {
|
|
868
|
+
if (repoType === void 0 || repoType === null || repoType === "") return true;
|
|
869
|
+
const normalizedType = String(repoType).trim().toLowerCase();
|
|
870
|
+
return !normalizedType || ["repo", "repository", "project", "0"].includes(normalizedType);
|
|
871
|
+
};
|
|
872
|
+
const convertDataList = ({ dataList, searchType, origin }) => {
|
|
873
|
+
if (!Array.isArray(dataList)) {
|
|
874
|
+
return { items: [] };
|
|
875
|
+
}
|
|
876
|
+
const baseOrigin = normalizeOrigin(origin);
|
|
877
|
+
const items = dataList.slice(0, 3).filter((item) => Boolean(item) && typeof item === "object" && !Array.isArray(item)).map((item) => {
|
|
878
|
+
const isGitcodeRepo = REPO_TYPE.GITCODE === item.is_mirrors;
|
|
879
|
+
const importUrl = getStringValue(item.import_url);
|
|
880
|
+
const importedRepoName = importUrl ? extractRepoInfoWithURL(importUrl) : "";
|
|
881
|
+
const nameWithNamespace = getStringValue(item.name_with_namespace);
|
|
882
|
+
const pathWithNamespace = getStringValue(item.path_with_namespace);
|
|
883
|
+
const repoName = (isGitcodeRepo ? nameWithNamespace : importedRepoName) || nameWithNamespace || pathWithNamespace;
|
|
884
|
+
const displayName = formatNameSpace(repoName).join("/");
|
|
885
|
+
const path = `${baseOrigin}/${pathWithNamespace}`;
|
|
886
|
+
return {
|
|
887
|
+
...item,
|
|
888
|
+
searchType,
|
|
889
|
+
path,
|
|
890
|
+
displayName,
|
|
891
|
+
web_url: path
|
|
892
|
+
};
|
|
893
|
+
});
|
|
894
|
+
return { items };
|
|
895
|
+
};
|
|
896
|
+
const mergeSearchSuggestions = ({ response = {}, origin, projectOrigin }) => ({
|
|
897
|
+
items: [
|
|
898
|
+
...convertDataList({ dataList: response.recommend_project, searchType: "repo", origin: projectOrigin || origin }).items,
|
|
899
|
+
...convertDataList({ dataList: response.recommend_model, searchType: "model", origin }).items,
|
|
900
|
+
...convertDataList({ dataList: response.recommend_dataset, searchType: "dataset", origin }).items
|
|
901
|
+
]
|
|
902
|
+
});
|
|
838
903
|
export {
|
|
839
904
|
SearchRepoCard as S,
|
|
840
|
-
|
|
905
|
+
isProjectSuggestionType as i,
|
|
906
|
+
mergeSearchSuggestions as m,
|
|
907
|
+
normalizeProjectUrlForMainSite as n,
|
|
841
908
|
useReportRepo as u
|
|
842
909
|
};
|