vue-layout-gitcode 1.5.71 → 1.5.72

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,221 @@
1
+ import { defineComponent, inject, ref, reactive, computed, watch, createElementBlock, openBlock, createElementVNode, createVNode, createBlock, createCommentVNode, withDirectives, toDisplayString, unref, withModifiers, normalizeClass, withCtx, Fragment, renderList, createTextVNode, vShow } from "vue";
2
+ import { a as i18n, q as useLayoutConfig, G as GIcon, A as emitEvent, s as setLoginTriggerSource, d as useRequestReport, _ as _export_sfc } from "./index-B66_WJIL.js";
3
+ import { useRouter } from "vue-router";
4
+ import { t as transWebUrl } from "./transWebUrl-CdGkJDeO.js";
5
+ import { Input } from "vue-devui-lal/input";
6
+ import { Skeleton } from "vue-devui-lal/skeleton";
7
+ import { MenuItem } from "vue-devui-lal/menu";
8
+ import { Button } from "vue-devui-lal/button";
9
+ import "vue-devui-lal/input/style.css";
10
+ import "vue-devui-lal/skeleton/style.css";
11
+ import "vue-devui-lal/menu/style.css";
12
+ import "vue-devui-lal/button/style.css";
13
+ const _hoisted_1 = { class: "devui-submenu layer_2 my-work-platform submenu-item relative" };
14
+ const _hoisted_2 = {
15
+ class: "devui-submenu-title layer_2",
16
+ style: { "padding": "0px 24px" }
17
+ };
18
+ const _hoisted_3 = { class: "devui-submenu-title-content cursor-auto" };
19
+ const _hoisted_4 = { class: "project-label" };
20
+ const _hoisted_5 = { class: "project-label flex-1 min-w-0 ellipsis" };
21
+ const INIT_SHOW_COUNT = 4;
22
+ const LOAD_MORE_COUNT = 10;
23
+ const _sfc_main = /* @__PURE__ */ defineComponent({
24
+ __name: "ProjectMenuListV2",
25
+ props: {
26
+ buttonText: { default: "" },
27
+ subShow: { type: Boolean, default: false },
28
+ defaultData: {},
29
+ isLogin: { type: Boolean, default: false },
30
+ username: { default: "" }
31
+ },
32
+ setup(__props) {
33
+ const { t } = i18n.global;
34
+ const request = inject("request");
35
+ const globalStore = inject("globalStore");
36
+ const { useReport } = useRequestReport(request, globalStore);
37
+ const layoutConfig = useLayoutConfig();
38
+ const props = __props;
39
+ const btnLoading = ref(false);
40
+ const pageQuery = reactive({
41
+ size: INIT_SHOW_COUNT
42
+ });
43
+ const firstLoading = ref(false);
44
+ const showSearch = ref(false);
45
+ const searchKey = ref("");
46
+ const totalNum = ref(0);
47
+ const inputIng = ref(false);
48
+ const originList = ref([]);
49
+ const filteredList = computed(() => {
50
+ if (!searchKey.value) return originList.value;
51
+ const key = searchKey.value.toLowerCase();
52
+ return originList.value.filter((item) => {
53
+ return item.label && item.label.toLowerCase().includes(key) || item.namespace && item.namespace.toLowerCase().includes(key);
54
+ });
55
+ });
56
+ const projectList = computed(() => {
57
+ return filteredList.value.slice(0, pageQuery.size);
58
+ });
59
+ watch(
60
+ () => props.defaultData,
61
+ () => {
62
+ firstLoading.value = !!props.defaultData.loading;
63
+ if (props.defaultData && props.defaultData.list) {
64
+ originList.value = [...props.defaultData.list];
65
+ totalNum.value = props.defaultData.totalNum || 0;
66
+ pageQuery.size = INIT_SHOW_COUNT;
67
+ searchKey.value = "";
68
+ }
69
+ },
70
+ { immediate: true, deep: true }
71
+ );
72
+ watch(
73
+ searchKey,
74
+ () => {
75
+ if (inputIng.value) return;
76
+ pageQuery.size = INIT_SHOW_COUNT;
77
+ },
78
+ { flush: "post" }
79
+ );
80
+ const showExpandMore = computed(() => {
81
+ return filteredList.value.length > pageQuery.size;
82
+ });
83
+ const loadMoreData = () => {
84
+ btnLoading.value = true;
85
+ setTimeout(() => {
86
+ const remain = filteredList.value.length - pageQuery.size;
87
+ if (remain > 0) {
88
+ if (pageQuery.size === INIT_SHOW_COUNT) {
89
+ const target = LOAD_MORE_COUNT * 2;
90
+ pageQuery.size = Math.min(target, filteredList.value.length);
91
+ } else {
92
+ pageQuery.size = Math.min(pageQuery.size + LOAD_MORE_COUNT, filteredList.value.length);
93
+ }
94
+ }
95
+ btnLoading.value = false;
96
+ }, 200);
97
+ };
98
+ const router = useRouter();
99
+ const fastToLink = () => {
100
+ router.push({ name: "userRepos", params: { namespace: props.username } });
101
+ };
102
+ const handleOpenSearch = () => {
103
+ if (!props.isLogin) {
104
+ emitEvent("login", { loginTriggerSource: "project_search" });
105
+ return;
106
+ }
107
+ showSearch.value = !showSearch.value;
108
+ };
109
+ const createRepoOrOrg = () => {
110
+ if (!props.isLogin) {
111
+ setLoginTriggerSource("aside_createRepo");
112
+ useReport("login_exposure", { source: "aside_createRepo" });
113
+ }
114
+ if (router.hasRoute("newRepo")) {
115
+ router.push({
116
+ name: "newRepo",
117
+ query: { position: "nav_top" }
118
+ });
119
+ } else {
120
+ window.location.href = `${layoutConfig.VITE_HOST}/create?position=nav_top`;
121
+ }
122
+ };
123
+ return (_ctx, _cache) => {
124
+ return openBlock(), createElementBlock("ul", _hoisted_1, [
125
+ createElementVNode("div", _hoisted_2, [
126
+ _cache[5] || (_cache[5] = createElementVNode("span", { class: "devui-menu-icon" }, null, -1)),
127
+ createElementVNode("span", _hoisted_3, [
128
+ createElementVNode("div", {
129
+ class: "fast-click-button",
130
+ onClick: _cache[0] || (_cache[0] = ($event) => fastToLink())
131
+ }, toDisplayString(unref(t)("gitCodeLayout.org.project")), 1)
132
+ ])
133
+ ]),
134
+ createVNode(GIcon, {
135
+ class: "my-work-platform-searchicon",
136
+ color: "var(--theme-menu-icon-fill)",
137
+ name: "gt-search",
138
+ onClick: withModifiers(handleOpenSearch, ["stop"])
139
+ }),
140
+ createElementVNode("div", {
141
+ class: normalizeClass(["flex flex-col pl-[0] my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
142
+ onClick: _cache[4] || (_cache[4] = withModifiers(() => {
143
+ }, ["stop"]))
144
+ }, [
145
+ createVNode(unref(Input), {
146
+ modelValue: searchKey.value,
147
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchKey.value = $event),
148
+ placeholder: unref(t)("gitCodeLayout.common.search"),
149
+ onCompositionstart: _cache[2] || (_cache[2] = ($event) => inputIng.value = true),
150
+ onCompositionend: _cache[3] || (_cache[3] = ($event) => inputIng.value = false)
151
+ }, {
152
+ prefix: withCtx(() => [
153
+ createVNode(GIcon, {
154
+ name: "gt-search",
155
+ color: "var(--theme-menu-icon-fill)"
156
+ })
157
+ ]),
158
+ _: 1
159
+ }, 8, ["modelValue", "placeholder"])
160
+ ], 2),
161
+ firstLoading.value ? (openBlock(), createBlock(unref(Skeleton), {
162
+ key: 0,
163
+ rows: 4
164
+ })) : createCommentVNode("", true),
165
+ (openBlock(true), createElementBlock(Fragment, null, renderList(projectList.value, (item) => {
166
+ return openBlock(), createBlock(unref(MenuItem), {
167
+ key: item.key,
168
+ "data-openBlank": true,
169
+ "data-href": unref(transWebUrl)(item.web_url),
170
+ class: "text",
171
+ title: `${item.namespace}/${item.label}`
172
+ }, {
173
+ icon: withCtx(() => [
174
+ createVNode(GIcon, {
175
+ name: "gt-line-project",
176
+ color: "var(--theme-menu-icon-fill)",
177
+ size: "16"
178
+ })
179
+ ]),
180
+ default: withCtx(() => [
181
+ createElementVNode("span", null, [
182
+ createElementVNode("span", _hoisted_4, toDisplayString((item.namespace || "").slice(0, 10)) + toDisplayString((item.namespace || "").length > 10 ? "..." : ""), 1),
183
+ createElementVNode("span", _hoisted_5, "/" + toDisplayString(item.label), 1)
184
+ ])
185
+ ]),
186
+ _: 2
187
+ }, 1032, ["data-href", "title"]);
188
+ }), 128)),
189
+ !totalNum.value && !firstLoading.value ? (openBlock(), createBlock(unref(Button), {
190
+ key: 1,
191
+ variant: "text",
192
+ class: "more-btn",
193
+ onClick: withModifiers(createRepoOrOrg, ["stop"])
194
+ }, {
195
+ default: withCtx(() => [
196
+ createTextVNode(toDisplayString(_ctx.buttonText), 1)
197
+ ]),
198
+ _: 1
199
+ })) : createCommentVNode("", true),
200
+ withDirectives(createVNode(unref(Button), {
201
+ variant: "text",
202
+ class: "more-btn",
203
+ onClick: withModifiers(loadMoreData, ["stop"]),
204
+ loading: btnLoading.value,
205
+ disabled: btnLoading.value
206
+ }, {
207
+ default: withCtx(() => [
208
+ createTextVNode(toDisplayString(unref(t)("gitCodeLayout.org.expand_more")), 1)
209
+ ]),
210
+ _: 1
211
+ }, 8, ["loading", "disabled"]), [
212
+ [vShow, showExpandMore.value && props.subShow]
213
+ ])
214
+ ]);
215
+ };
216
+ }
217
+ });
218
+ const ProjectMenuListV2 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
219
+ export {
220
+ ProjectMenuListV2 as default
221
+ };
@@ -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-Ba99LRw5.js";
2
+ import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-B66_WJIL.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";
@@ -0,0 +1,161 @@
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-B66_WJIL.js";
3
+ import "vue-devui-lal/icon";
4
+ import "vue-devui-lal/icon/style.css";
5
+ const _hoisted_1 = { class: "history-list" };
6
+ const _hoisted_2 = ["onClick", "onMouseenter"];
7
+ const _hoisted_3 = { class: "history-list-box__content flex items-center justify-between w-full" };
8
+ const _hoisted_4 = { class: "flex items-center" };
9
+ const _hoisted_5 = ["title"];
10
+ const _hoisted_6 = ["title"];
11
+ const _hoisted_7 = { class: "item-tx" };
12
+ const _hoisted_8 = { class: "flex items-center gap-[8px]" };
13
+ const _sfc_main = /* @__PURE__ */ defineComponent({
14
+ __name: "SearchHistoryList",
15
+ props: {
16
+ searchHistoryList: {},
17
+ visitHistoryList: {},
18
+ activeIndex: {}
19
+ },
20
+ emits: [
21
+ "clearHistoryData",
22
+ "toSearch",
23
+ "onDeleteHistory",
24
+ "onDeleteVist",
25
+ "onVistPage",
26
+ "onSearchEnter",
27
+ "resetIndex"
28
+ ],
29
+ setup(__props, { emit: __emit }) {
30
+ const { t } = i18n.global;
31
+ const props = __props;
32
+ const emits = __emit;
33
+ const getRepoType = (item) => {
34
+ const typeMap = {
35
+ repo: {
36
+ text: t("gitCodeLayout.header.repo"),
37
+ icon: "gt-plane-project",
38
+ hoverIcon: "gt-plane-project-red"
39
+ },
40
+ model: {
41
+ text: t("gitCodeLayout.aihub.model"),
42
+ icon: "gt-plane-Models",
43
+ hoverIcon: "gt-plane-Models-red"
44
+ },
45
+ dataset: {
46
+ text: t("gitCodeLayout.aihub.dataSet"),
47
+ icon: "gt-plane-Datasets",
48
+ hoverIcon: "gt-plane-Datasets-red"
49
+ },
50
+ issue: {
51
+ text: "Issues",
52
+ icon: "gt-plane-issues",
53
+ hoverIcon: "gt-plane-issues-red"
54
+ },
55
+ pullrequest: {
56
+ text: "Pull requests",
57
+ icon: "gt-plane-pullRequest",
58
+ hoverIcon: "gt-plane-pullRequest-red"
59
+ },
60
+ group: {
61
+ text: t("gitCodeLayout.header.org"),
62
+ icon: "gt-plane-users",
63
+ hoverIcon: "gt-plane-users-red"
64
+ },
65
+ user: {
66
+ text: t("gitCodeLayout.header.user"),
67
+ icon: "gt-plane-user",
68
+ hoverIcon: "gt-plane-user-red"
69
+ },
70
+ tag: {
71
+ text: t("gitCodeLayout.header.tags"),
72
+ icon: "gt-plane-topics",
73
+ hoverIcon: "gt-plane-topics-red"
74
+ },
75
+ topic: {
76
+ text: t("gitCodeLayout.header.topic"),
77
+ icon: "gt-plane-topic",
78
+ hoverIcon: "gt-plane-topic-red"
79
+ }
80
+ };
81
+ return typeMap[item.type] || typeMap["repo"];
82
+ };
83
+ const historyList = computed(() => {
84
+ var _a;
85
+ return (_a = props.searchHistoryList) == null ? void 0 : _a.map((item) => {
86
+ const repoTitle = item.repo ? `${t("gitCodeLayout.header.repo")} ${decodeURIComponent(item.repo)}:` : "";
87
+ const namespaceTitle = item.namespace ? `${item.scope === "group" ? t("gitCodeLayout.header.org") : t("gitCodeLayout.header.user")} ${decodeURIComponent(item.namespace)}:` : "";
88
+ return { ...item, repoTitle, namespaceTitle };
89
+ });
90
+ });
91
+ computed(() => {
92
+ return props.visitHistoryList;
93
+ });
94
+ const resetIndex = () => {
95
+ emits("resetIndex");
96
+ };
97
+ const toSearch = (item) => {
98
+ emits("toSearch", item);
99
+ };
100
+ const onDeleteHistory = (index) => {
101
+ emits("onDeleteHistory", index);
102
+ };
103
+ const onSearchEnter = (index) => {
104
+ emits("onSearchEnter", index);
105
+ };
106
+ return (_ctx, _cache) => {
107
+ return openBlock(), createElementBlock("div", _hoisted_1, [
108
+ _ctx.searchHistoryList.length ? (openBlock(), createElementBlock("ul", {
109
+ key: 0,
110
+ class: "history-list-box mt-[16px]",
111
+ onMouseleave: resetIndex
112
+ }, [
113
+ (openBlock(true), createElementBlock(Fragment, null, renderList(historyList.value, (item, index) => {
114
+ return openBlock(), createElementBlock("li", {
115
+ key: item,
116
+ class: normalizeClass(_ctx.activeIndex === index ? "hoverbg" : ""),
117
+ onClick: ($event) => toSearch(item),
118
+ onMouseenter: ($event) => onSearchEnter(index)
119
+ }, [
120
+ createElementVNode("div", _hoisted_3, [
121
+ createElementVNode("div", _hoisted_4, [
122
+ createVNode(GIcon, {
123
+ name: "gt-line-time",
124
+ color: "var(--devui-aide-text)",
125
+ class: "mr-[8px]"
126
+ }),
127
+ createElementVNode("span", {
128
+ class: "whitespace-nowrap overflow-hidden text-ellipsis",
129
+ title: item.repoTitle
130
+ }, toDisplayString(item.repoTitle), 9, _hoisted_5),
131
+ createElementVNode("span", {
132
+ class: "whitespace-nowrap overflow-hidden text-ellipsis",
133
+ title: item.namespaceTitle
134
+ }, toDisplayString(item.namespaceTitle), 9, _hoisted_6),
135
+ createElementVNode("span", _hoisted_7, toDisplayString(item.q || item), 1)
136
+ ]),
137
+ createElementVNode("div", _hoisted_8, [
138
+ createElementVNode("span", {
139
+ class: normalizeClass(_ctx.activeIndex === index ? "text-[var(--theme-text)]" : "text-[var(--theme-placeholder)]")
140
+ }, toDisplayString(getRepoType(item).text), 3),
141
+ createVNode(GIcon, {
142
+ name: _ctx.activeIndex === index ? getRepoType(item).hoverIcon : getRepoType(item).icon
143
+ }, null, 8, ["name"])
144
+ ])
145
+ ]),
146
+ createVNode(GIcon, {
147
+ name: "gt-line-close",
148
+ class: "itemClose",
149
+ onClick: withModifiers(($event) => onDeleteHistory(index), ["stop"])
150
+ }, null, 8, ["onClick"])
151
+ ], 42, _hoisted_2);
152
+ }), 128))
153
+ ], 32)) : createCommentVNode("", true)
154
+ ]);
155
+ };
156
+ }
157
+ });
158
+ const SearchHistoryList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
159
+ export {
160
+ SearchHistoryList as default
161
+ };
@@ -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-Ba99LRw5.js";
2
+ import { G as GIcon, _ as _export_sfc } from "./index-B66_WJIL.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = { class: "ellipsis" };
@@ -40,7 +40,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40
40
  };
41
41
  }
42
42
  });
43
- const SearchPrefixTag = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-gitcode-layout-lib"]]);
43
+ const SearchPrefixTag = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
44
44
  export {
45
45
  SearchPrefixTag as default
46
46
  };
@@ -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-Cqo1SLWx.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-Ba99LRw5.js";
2
+ import { u as useReportRepo, S as SearchRepoCard } from "./index-CN1Ye7W1.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-B66_WJIL.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";
@@ -64,9 +64,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
64
64
  hover: "",
65
65
  hideTopicTags: "",
66
66
  onReport: (evt) => handleReport(item, index, evt),
67
- cardType: "repo",
67
+ cardType: (item == null ? void 0 : item.repo_type) || "repo",
68
68
  "url-params": { source_module: "today_trending" }
69
- }, null, 8, ["info", "onReport"]);
69
+ }, null, 8, ["info", "onReport", "cardType"]);
70
70
  }), 128))
71
71
  ])) : (openBlock(), createElementBlock("div", _hoisted_4, [
72
72
  (openBlock(), createElementBlock(Fragment, null, renderList(5, (item) => {
@@ -137,7 +137,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
137
137
  };
138
138
  }
139
139
  });
140
- const SearchRecommed = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-gitcode-layout-lib"]]);
140
+ const SearchRecommed = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
141
141
  export {
142
142
  SearchRecommed as default
143
143
  };
@@ -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-Ba99LRw5.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-B66_WJIL.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = ["onClick"];
@@ -55,7 +55,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
55
55
  };
56
56
  }
57
57
  });
58
- const SearchScopeList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-gitcode-layout-lib"]]);
58
+ const SearchScopeList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
59
59
  export {
60
60
  SearchScopeList as default
61
61
  };
@@ -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-Ba99LRw5.js";
2
+ import { a as i18n, h as headRequest, G as GIcon } from "./index-B66_WJIL.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]" };