vue-layout-gitcode 1.5.40 → 1.5.41

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,209 @@
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, G as GIcon, s as setLoginTriggerSource, d as useRequestReport, _ as _export_sfc } from "./index-B0UuQjML.js";
3
+ import { useRouter } from "vue-router";
4
+ import { t as transWebUrl } from "./transWebUrl-C4ZsGLzN.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 props = __props;
38
+ const btnLoading = ref(false);
39
+ const pageQuery = reactive({
40
+ size: INIT_SHOW_COUNT
41
+ });
42
+ const firstLoading = ref(false);
43
+ const showSearch = ref(false);
44
+ const searchKey = ref("");
45
+ const totalNum = ref(0);
46
+ const inputIng = ref(false);
47
+ const originList = ref([]);
48
+ const filteredList = computed(() => {
49
+ if (!searchKey.value) return originList.value;
50
+ const key = searchKey.value.toLowerCase();
51
+ return originList.value.filter((item) => {
52
+ return item.label && item.label.toLowerCase().includes(key) || item.namespace && item.namespace.toLowerCase().includes(key);
53
+ });
54
+ });
55
+ const projectList = computed(() => {
56
+ return filteredList.value.slice(0, pageQuery.size);
57
+ });
58
+ watch(
59
+ () => props.defaultData,
60
+ () => {
61
+ firstLoading.value = !!props.defaultData.loading;
62
+ if (props.defaultData && props.defaultData.list) {
63
+ originList.value = [...props.defaultData.list];
64
+ totalNum.value = props.defaultData.totalNum || 0;
65
+ pageQuery.size = INIT_SHOW_COUNT;
66
+ searchKey.value = "";
67
+ }
68
+ },
69
+ { immediate: true, deep: true }
70
+ );
71
+ watch(
72
+ searchKey,
73
+ () => {
74
+ if (inputIng.value) return;
75
+ pageQuery.size = INIT_SHOW_COUNT;
76
+ },
77
+ { flush: "post" }
78
+ );
79
+ const showExpandMore = computed(() => {
80
+ return filteredList.value.length > pageQuery.size;
81
+ });
82
+ const loadMoreData = () => {
83
+ btnLoading.value = true;
84
+ setTimeout(() => {
85
+ const remain = filteredList.value.length - pageQuery.size;
86
+ if (remain > 0) {
87
+ if (pageQuery.size === INIT_SHOW_COUNT) {
88
+ const target = LOAD_MORE_COUNT * 2;
89
+ pageQuery.size = Math.min(target, filteredList.value.length);
90
+ } else {
91
+ pageQuery.size = Math.min(pageQuery.size + LOAD_MORE_COUNT, filteredList.value.length);
92
+ }
93
+ }
94
+ btnLoading.value = false;
95
+ }, 200);
96
+ };
97
+ const router = useRouter();
98
+ const fastToLink = () => {
99
+ router.push({ name: "userRepos", params: { namespace: props.username } });
100
+ };
101
+ const createRepoOrOrg = () => {
102
+ if (!props.isLogin) {
103
+ setLoginTriggerSource("aside_createRepo");
104
+ useReport("login_exposure", { source: "aside_createRepo" });
105
+ }
106
+ router.push({
107
+ name: "newRepo",
108
+ query: { position: "nav_top" }
109
+ });
110
+ };
111
+ return (_ctx, _cache) => {
112
+ return openBlock(), createElementBlock("ul", _hoisted_1, [
113
+ createElementVNode("div", _hoisted_2, [
114
+ _cache[6] || (_cache[6] = createElementVNode("span", { class: "devui-menu-icon" }, null, -1)),
115
+ createElementVNode("span", _hoisted_3, [
116
+ createElementVNode("div", {
117
+ class: "fast-click-button",
118
+ onClick: _cache[0] || (_cache[0] = ($event) => fastToLink())
119
+ }, toDisplayString(unref(t)("gitCodeLayout.org.project")), 1)
120
+ ])
121
+ ]),
122
+ createVNode(GIcon, {
123
+ class: "my-work-platform-searchicon",
124
+ color: "var(--theme-menu-icon-fill)",
125
+ name: "gt-search",
126
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => showSearch.value = !showSearch.value, ["stop"]))
127
+ }),
128
+ createElementVNode("div", {
129
+ class: normalizeClass(["flex flex-col pl-[0] my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
130
+ onClick: _cache[5] || (_cache[5] = withModifiers(() => {
131
+ }, ["stop"]))
132
+ }, [
133
+ createVNode(unref(Input), {
134
+ modelValue: searchKey.value,
135
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchKey.value = $event),
136
+ placeholder: unref(t)("gitCodeLayout.common.search"),
137
+ onCompositionstart: _cache[3] || (_cache[3] = ($event) => inputIng.value = true),
138
+ onCompositionend: _cache[4] || (_cache[4] = ($event) => inputIng.value = false)
139
+ }, {
140
+ prefix: withCtx(() => [
141
+ createVNode(GIcon, {
142
+ name: "gt-search",
143
+ color: "var(--theme-menu-icon-fill)"
144
+ })
145
+ ]),
146
+ _: 1
147
+ }, 8, ["modelValue", "placeholder"])
148
+ ], 2),
149
+ firstLoading.value ? (openBlock(), createBlock(unref(Skeleton), {
150
+ key: 0,
151
+ rows: 4
152
+ })) : createCommentVNode("", true),
153
+ (openBlock(true), createElementBlock(Fragment, null, renderList(projectList.value, (item) => {
154
+ return openBlock(), createBlock(unref(MenuItem), {
155
+ key: item.key,
156
+ "data-openBlank": true,
157
+ "data-href": unref(transWebUrl)(item.web_url),
158
+ class: "text",
159
+ title: `${item.namespace}/${item.label}`
160
+ }, {
161
+ icon: withCtx(() => [
162
+ createVNode(GIcon, {
163
+ name: "gt-line-project",
164
+ color: "var(--theme-menu-icon-fill)",
165
+ size: "16"
166
+ })
167
+ ]),
168
+ default: withCtx(() => [
169
+ createElementVNode("span", null, [
170
+ createElementVNode("span", _hoisted_4, toDisplayString((item.namespace || "").slice(0, 10)) + toDisplayString((item.namespace || "").length > 10 ? "..." : ""), 1),
171
+ createElementVNode("span", _hoisted_5, "/" + toDisplayString(item.label), 1)
172
+ ])
173
+ ]),
174
+ _: 2
175
+ }, 1032, ["data-href", "title"]);
176
+ }), 128)),
177
+ !totalNum.value && !firstLoading.value ? (openBlock(), createBlock(unref(Button), {
178
+ key: 1,
179
+ variant: "text",
180
+ class: "more-btn",
181
+ onClick: withModifiers(createRepoOrOrg, ["stop"])
182
+ }, {
183
+ default: withCtx(() => [
184
+ createTextVNode(toDisplayString(_ctx.buttonText), 1)
185
+ ]),
186
+ _: 1
187
+ })) : createCommentVNode("", true),
188
+ withDirectives(createVNode(unref(Button), {
189
+ variant: "text",
190
+ class: "more-btn",
191
+ onClick: withModifiers(loadMoreData, ["stop"]),
192
+ loading: btnLoading.value,
193
+ disabled: btnLoading.value
194
+ }, {
195
+ default: withCtx(() => [
196
+ createTextVNode(toDisplayString(unref(t)("gitCodeLayout.org.expand_more")), 1)
197
+ ]),
198
+ _: 1
199
+ }, 8, ["loading", "disabled"]), [
200
+ [vShow, showExpandMore.value && props.subShow]
201
+ ])
202
+ ]);
203
+ };
204
+ }
205
+ });
206
+ const ProjectMenuListV2 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-gitcode-layout-lib"]]);
207
+ export {
208
+ ProjectMenuListV2 as default
209
+ };
@@ -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-B811122P.js";
2
+ import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-B0UuQjML.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,13 +1,15 @@
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-B811122P.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-B0UuQjML.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" };
6
6
  const _hoisted_2 = ["onClick", "onMouseenter"];
7
- const _hoisted_3 = { class: "history-list-box__content flex items-center w-full" };
8
- const _hoisted_4 = ["title"];
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
9
  const _hoisted_5 = ["title"];
10
- const _hoisted_6 = { class: "item-tx" };
10
+ const _hoisted_6 = ["title"];
11
+ const _hoisted_7 = { class: "item-tx" };
12
+ const _hoisted_8 = { class: "flex items-center gap-[8px]" };
11
13
  const _sfc_main = /* @__PURE__ */ defineComponent({
12
14
  __name: "SearchHistoryList",
13
15
  props: {
@@ -28,6 +30,56 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
28
30
  const { t } = i18n.global;
29
31
  const props = __props;
30
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
+ };
31
83
  const historyList = computed(() => {
32
84
  var _a;
33
85
  return (_a = props.searchHistoryList) == null ? void 0 : _a.map((item) => {
@@ -66,20 +118,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
66
118
  onMouseenter: ($event) => onSearchEnter(index)
67
119
  }, [
68
120
  createElementVNode("div", _hoisted_3, [
69
- createVNode(GIcon, {
70
- name: "gt-line-time",
71
- color: "var(--devui-aide-text)",
72
- class: "mr-[8px]"
73
- }),
74
- createElementVNode("span", {
75
- class: "whitespace-nowrap overflow-hidden text-ellipsis",
76
- title: item.repoTitle
77
- }, toDisplayString(item.repoTitle), 9, _hoisted_4),
78
- createElementVNode("span", {
79
- class: "whitespace-nowrap overflow-hidden text-ellipsis",
80
- title: item.namespaceTitle
81
- }, toDisplayString(item.namespaceTitle), 9, _hoisted_5),
82
- createElementVNode("span", _hoisted_6, toDisplayString(item.q || item), 1)
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
+ createVNode(GIcon, {
139
+ name: _ctx.activeIndex === index ? getRepoType(item).hoverIcon : getRepoType(item).icon
140
+ }, null, 8, ["name"]),
141
+ createElementVNode("span", {
142
+ class: normalizeClass(_ctx.activeIndex === index ? "text-[var(--theme-text)]" : "text-[var(--theme-placeholder)]")
143
+ }, toDisplayString(getRepoType(item).text), 3)
144
+ ])
83
145
  ]),
84
146
  createVNode(GIcon, {
85
147
  name: "gt-line-close",
@@ -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-B811122P.js";
2
+ import { G as GIcon, _ as _export_sfc } from "./index-B0UuQjML.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-CRLLxvwN.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-B811122P.js";
2
+ import { u as useReportRepo, S as SearchRepoCard } from "./index-CJ6wg13B.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-B0UuQjML.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) => {
@@ -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-B811122P.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-B0UuQjML.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-B811122P.js";
2
+ import { a as i18n, h as headRequest, G as GIcon } from "./index-B0UuQjML.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]" };