vue-layout-gitcode 1.5.69 → 1.5.71
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/{dist/GloabarSearch-BZb_AQ_p.js → GloabarSearch-BVc018QM.js} +3 -5
- package/{dist/ProjectSearch-10Vyr8h_.js → ProjectSearch-OYQR1jQ1.js} +1 -1
- package/SearchHistoryList-DcJLzYiO.js +99 -0
- package/{dist/SearchPrefixTag-t4kN1J7O.js → SearchPrefixTag-BFhDidRA.js} +2 -2
- package/{dist/SearchRecommed-D76hxxeA.js → SearchRecommed-c-THl16l.js} +5 -5
- package/{dist/SearchScopeList-B22z5UAY.js → SearchScopeList-BypAkGfx.js} +2 -2
- package/{dist/UserSearch-Bx0G5NV8.js → UserSearch-Dtgpli89.js} +1 -1
- package/{dist/index-Br6vcucJ.js → index-B5WuOGOg.js} +2 -2
- package/{dist/index-Bxhc6nCo.js → index-Ba99LRw5.js} +3508 -2019
- package/{dist/index-XjwMbIbJ.js → index-Cqo1SLWx.js} +9 -11
- package/{dist/index.d.ts → index.d.ts} +4 -45
- package/index.js +14 -0
- package/{dist/notice-DaYgpSkE.js → notice-BUVKdd9a.js} +1 -1
- package/package.json +11 -72
- package/style.css +1 -0
- package/README.md +0 -528
- package/dist/MenuItem-DzFWRd3i.js +0 -156
- package/dist/ProjectMenuList-DFZFG7Uj.js +0 -402
- package/dist/ProjectMenuListV2-wIv5Ewd6.js +0 -221
- package/dist/SearchHistoryList-sF4YL25O.js +0 -161
- package/dist/index.js +0 -14
- package/dist/package.json +0 -13
- package/dist/style.css +0 -1
- package/dist/transWebUrl-DTXUrWYK.js +0 -21
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
import { defineComponent, inject, ref, reactive, watch, computed, createElementBlock, openBlock, createCommentVNode, createBlock, withDirectives, Fragment, createElementVNode, createVNode, toDisplayString, unref, withModifiers, normalizeClass, withCtx, renderList, createTextVNode, vShow } from "vue";
|
|
2
|
-
import { a as i18n, q as useLayoutConfig, G as GIcon, C as _sfc_main$1, D as loadAsideData, A as emitEvent, s as setLoginTriggerSource, d as useRequestReport, F as asideRequest, _ as _export_sfc } from "./index-Bxhc6nCo.js";
|
|
3
|
-
import { useRouter } from "vue-router";
|
|
4
|
-
import { t as transWebUrl } from "./transWebUrl-DTXUrWYK.js";
|
|
5
|
-
import { Select, Option } from "vue-devui-lal/select";
|
|
6
|
-
import { Input } from "vue-devui-lal/input";
|
|
7
|
-
import { Skeleton } from "vue-devui-lal/skeleton";
|
|
8
|
-
import { MenuItem } from "vue-devui-lal/menu";
|
|
9
|
-
import { Button } from "vue-devui-lal/button";
|
|
10
|
-
import "vue-devui-lal/select/style.css";
|
|
11
|
-
import "vue-devui-lal/input/style.css";
|
|
12
|
-
import "vue-devui-lal/skeleton/style.css";
|
|
13
|
-
import "vue-devui-lal/menu/style.css";
|
|
14
|
-
import "vue-devui-lal/button/style.css";
|
|
15
|
-
const _hoisted_1 = { class: "devui-submenu layer_2 my-work-platform submenu-item relative" };
|
|
16
|
-
const _hoisted_2 = {
|
|
17
|
-
class: "devui-submenu-title layer_2",
|
|
18
|
-
style: { "padding": "0px 24px" }
|
|
19
|
-
};
|
|
20
|
-
const _hoisted_3 = { class: "devui-submenu-title-content cursor-auto" };
|
|
21
|
-
const _hoisted_4 = {
|
|
22
|
-
class: "devui-submenu-title layer_2",
|
|
23
|
-
style: { "padding": "0px 24px" }
|
|
24
|
-
};
|
|
25
|
-
const _hoisted_5 = { class: "devui-submenu-title-content cursor-auto" };
|
|
26
|
-
const _hoisted_6 = { key: 0 };
|
|
27
|
-
const _hoisted_7 = { class: "project-label" };
|
|
28
|
-
const _hoisted_8 = { class: "project-label flex-1 min-w-0 ellipsis" };
|
|
29
|
-
const _hoisted_9 = {
|
|
30
|
-
key: 1,
|
|
31
|
-
class: "project-label"
|
|
32
|
-
};
|
|
33
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
34
|
-
__name: "ProjectMenuList",
|
|
35
|
-
props: {
|
|
36
|
-
type: { default: "project" },
|
|
37
|
-
buttonText: { default: "" },
|
|
38
|
-
subShow: { type: Boolean, default: false },
|
|
39
|
-
query: { default: {} },
|
|
40
|
-
defaultData: { default: {} },
|
|
41
|
-
isLogin: { type: Boolean, default: false },
|
|
42
|
-
defaultOrg: { default: {} },
|
|
43
|
-
username: { default: "" }
|
|
44
|
-
},
|
|
45
|
-
setup(__props) {
|
|
46
|
-
const { t } = i18n.global;
|
|
47
|
-
const request = inject("request");
|
|
48
|
-
const API = asideRequest(request);
|
|
49
|
-
const globalStore = inject("globalStore");
|
|
50
|
-
const { useReport } = useRequestReport(request, globalStore);
|
|
51
|
-
const layoutConfig = useLayoutConfig();
|
|
52
|
-
const props = __props;
|
|
53
|
-
const projectList = ref([]);
|
|
54
|
-
const loading = ref(false);
|
|
55
|
-
const pageQuery = reactive({
|
|
56
|
-
page: 1,
|
|
57
|
-
size: 10
|
|
58
|
-
});
|
|
59
|
-
const firstLoading = ref(false);
|
|
60
|
-
const showSearch = ref(false);
|
|
61
|
-
const extendQuery = {};
|
|
62
|
-
const searchKey = ref("");
|
|
63
|
-
const nameSpace = ref(0);
|
|
64
|
-
let storeData = [];
|
|
65
|
-
const totalNum = ref(0);
|
|
66
|
-
const router = useRouter();
|
|
67
|
-
const inputIng = ref(false);
|
|
68
|
-
const projectRoute = {
|
|
69
|
-
name: "newRepo",
|
|
70
|
-
query: { position: "nav_top" }
|
|
71
|
-
};
|
|
72
|
-
const teamRoute = {
|
|
73
|
-
name: "newOrg"
|
|
74
|
-
};
|
|
75
|
-
let scTimer = null;
|
|
76
|
-
let loadMoreTotal = 0;
|
|
77
|
-
watch(
|
|
78
|
-
() => props.defaultData,
|
|
79
|
-
() => {
|
|
80
|
-
firstLoading.value = !!props.defaultData.loading;
|
|
81
|
-
if (props.defaultData && props.defaultData.list) {
|
|
82
|
-
projectList.value = [...props.defaultData.list];
|
|
83
|
-
if (props.defaultData.storeData) {
|
|
84
|
-
storeData = [...props.defaultData.storeData];
|
|
85
|
-
}
|
|
86
|
-
totalNum.value = props.defaultData.totalNum || 0;
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{ immediate: true, deep: true }
|
|
90
|
-
);
|
|
91
|
-
const customRequest = (params, type) => {
|
|
92
|
-
if (type === "project" && params.namespace_id === "my-repo") {
|
|
93
|
-
const temp = { ...params };
|
|
94
|
-
delete temp.namespace_id;
|
|
95
|
-
return {
|
|
96
|
-
params: {
|
|
97
|
-
...temp,
|
|
98
|
-
repo_query_type: "created",
|
|
99
|
-
repo_type: "0,1,2"
|
|
100
|
-
},
|
|
101
|
-
requestFn: (params2) => API.getMyCreatedProjects(params2)
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
params,
|
|
106
|
-
requestFn: type === "project" ? (params2) => API.getMyProjects(params2) : (params2) => API.getMyGroups(params2)
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
const loadMoreData = (loadType) => {
|
|
110
|
-
const data = [...storeData];
|
|
111
|
-
if (totalNum.value > pageQuery.size * pageQuery.page || loadType === "search") {
|
|
112
|
-
pageQuery.page = pageQuery.page + 1;
|
|
113
|
-
loading.value = true;
|
|
114
|
-
const params = {
|
|
115
|
-
page: pageQuery.page,
|
|
116
|
-
per_page: pageQuery.size,
|
|
117
|
-
...props.query,
|
|
118
|
-
...extendQuery
|
|
119
|
-
};
|
|
120
|
-
const { params: newParams, requestFn } = customRequest(params, props.type);
|
|
121
|
-
loadAsideData(requestFn, newParams, props.type).then(
|
|
122
|
-
(res) => {
|
|
123
|
-
if (params.search !== searchKey.value && loadType === "search") {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (res.list) {
|
|
127
|
-
data.push(...res.list);
|
|
128
|
-
}
|
|
129
|
-
if (loadType === "search" && res.storeData) {
|
|
130
|
-
storeData = [...res.storeData];
|
|
131
|
-
}
|
|
132
|
-
totalNum.value = res.totalNum || 0;
|
|
133
|
-
projectList.value.push(...data);
|
|
134
|
-
loading.value = false;
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
} else {
|
|
138
|
-
projectList.value.push(...data);
|
|
139
|
-
}
|
|
140
|
-
storeData = [];
|
|
141
|
-
};
|
|
142
|
-
const selectQuery = {
|
|
143
|
-
page: 1,
|
|
144
|
-
size: 10
|
|
145
|
-
};
|
|
146
|
-
const moreOrgData = ref([]);
|
|
147
|
-
const DEFAULT_ORG_FILTER_OPTIONS = [{ id: 0, label: t("gitCodeLayout.common.all") }, { id: "my-repo", label: props.username || t("gitCodeLayout.common.iCreated") }];
|
|
148
|
-
const teamList = computed(() => {
|
|
149
|
-
var _a;
|
|
150
|
-
if (props.defaultOrg.list) {
|
|
151
|
-
loadMoreTotal = props.defaultOrg.totalNum;
|
|
152
|
-
const propStoreData = ((_a = props.defaultOrg) == null ? void 0 : _a.storeData) || [];
|
|
153
|
-
return [...DEFAULT_ORG_FILTER_OPTIONS, ...props.defaultOrg.list, ...propStoreData, ...moreOrgData.value];
|
|
154
|
-
}
|
|
155
|
-
return [...DEFAULT_ORG_FILTER_OPTIONS, ...moreOrgData.value];
|
|
156
|
-
});
|
|
157
|
-
const fastToLink = (type) => {
|
|
158
|
-
if (type === "project") {
|
|
159
|
-
router.push({ name: "userRepos", params: { namespace: props.username } });
|
|
160
|
-
} else {
|
|
161
|
-
router.push({ name: "settingOrganization" });
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
const loadMoreTeams = () => {
|
|
165
|
-
loadAsideData(
|
|
166
|
-
(params) => API.getMyProjects(params),
|
|
167
|
-
{
|
|
168
|
-
page: selectQuery.page,
|
|
169
|
-
per_page: selectQuery.size
|
|
170
|
-
},
|
|
171
|
-
"team"
|
|
172
|
-
).then((res) => {
|
|
173
|
-
loadMoreTotal = res.totalNum || 0;
|
|
174
|
-
if (res.list) {
|
|
175
|
-
moreOrgData.value.push(...res.list, ...res.storeData || []);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
const loadTeam = () => {
|
|
180
|
-
if (loadMoreTotal > selectQuery.size * selectQuery.page) {
|
|
181
|
-
selectQuery.page++;
|
|
182
|
-
loadMoreTeams();
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
const searchProject = () => {
|
|
186
|
-
extendQuery.search = searchKey.value;
|
|
187
|
-
extendQuery.namespace_id = nameSpace.value !== 0 ? nameSpace.value : void 0;
|
|
188
|
-
pageQuery.page = 0;
|
|
189
|
-
projectList.value = [];
|
|
190
|
-
storeData = [];
|
|
191
|
-
loadMoreData("search");
|
|
192
|
-
};
|
|
193
|
-
const searchTeam = () => {
|
|
194
|
-
extendQuery.search = searchKey.value;
|
|
195
|
-
pageQuery.page = 0;
|
|
196
|
-
projectList.value = [];
|
|
197
|
-
storeData = [];
|
|
198
|
-
loadMoreData("search");
|
|
199
|
-
};
|
|
200
|
-
const valChange = () => {
|
|
201
|
-
if (inputIng.value) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
if (scTimer) clearTimeout(scTimer);
|
|
205
|
-
scTimer = setTimeout(() => {
|
|
206
|
-
if (props.type === "project") {
|
|
207
|
-
searchProject();
|
|
208
|
-
} else {
|
|
209
|
-
searchTeam();
|
|
210
|
-
}
|
|
211
|
-
}, 200);
|
|
212
|
-
};
|
|
213
|
-
const handleOpenSearch = () => {
|
|
214
|
-
if (!props.isLogin) {
|
|
215
|
-
emitEvent("login", { loginTriggerSource: "org_search" });
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
showSearch.value = !showSearch.value;
|
|
219
|
-
};
|
|
220
|
-
const createRepoOrOrg = () => {
|
|
221
|
-
if (!props.isLogin) {
|
|
222
|
-
setLoginTriggerSource(props.type === "project" ? "aside_createRepo" : "aside_createOrg");
|
|
223
|
-
useReport("login_exposure", { source: props.type === "project" ? "aside_createRepo" : "aside_createOrg" });
|
|
224
|
-
}
|
|
225
|
-
const targetRoute = props.type === "project" ? projectRoute : teamRoute;
|
|
226
|
-
if (router.hasRoute(targetRoute.name)) {
|
|
227
|
-
router.push(targetRoute);
|
|
228
|
-
} else {
|
|
229
|
-
window.location.href = `${layoutConfig.VITE_HOST}/${props.type !== "project" ? "org/" : ""}create?position=nav_top`;
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
return (_ctx, _cache) => {
|
|
233
|
-
return openBlock(), createElementBlock("ul", _hoisted_1, [
|
|
234
|
-
_ctx.type === "project" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
235
|
-
createElementVNode("div", _hoisted_2, [
|
|
236
|
-
_cache[12] || (_cache[12] = createElementVNode("span", { class: "devui-menu-icon" }, null, -1)),
|
|
237
|
-
createElementVNode("span", _hoisted_3, [
|
|
238
|
-
createElementVNode("div", {
|
|
239
|
-
class: "fast-click-button",
|
|
240
|
-
onClick: _cache[0] || (_cache[0] = ($event) => fastToLink("project"))
|
|
241
|
-
}, toDisplayString(unref(t)("gitCodeLayout.org.project")), 1)
|
|
242
|
-
])
|
|
243
|
-
]),
|
|
244
|
-
createVNode(GIcon, {
|
|
245
|
-
class: "my-work-platform-searchicon",
|
|
246
|
-
color: "var(--theme-menu-icon-fill)",
|
|
247
|
-
name: "gt-search",
|
|
248
|
-
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => showSearch.value = !showSearch.value, ["stop"]))
|
|
249
|
-
}),
|
|
250
|
-
createElementVNode("div", {
|
|
251
|
-
class: normalizeClass(["flex flex-col pl-[0] my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
|
|
252
|
-
onClick: _cache[6] || (_cache[6] = withModifiers(() => {
|
|
253
|
-
}, ["stop"]))
|
|
254
|
-
}, [
|
|
255
|
-
createVNode(unref(Select), {
|
|
256
|
-
"menu-class": "my-work-platform-select",
|
|
257
|
-
modelValue: nameSpace.value,
|
|
258
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => nameSpace.value = $event),
|
|
259
|
-
class: "mb-[8px]",
|
|
260
|
-
placeholder: "",
|
|
261
|
-
filter: true,
|
|
262
|
-
onLoadMore: loadTeam,
|
|
263
|
-
onValueChange: searchProject
|
|
264
|
-
}, {
|
|
265
|
-
default: withCtx(() => [
|
|
266
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(teamList.value, (item, index) => {
|
|
267
|
-
return openBlock(), createBlock(unref(Option), {
|
|
268
|
-
key: index,
|
|
269
|
-
value: item.id,
|
|
270
|
-
name: item.label,
|
|
271
|
-
title: item.label
|
|
272
|
-
}, null, 8, ["value", "name", "title"]);
|
|
273
|
-
}), 128))
|
|
274
|
-
]),
|
|
275
|
-
_: 1
|
|
276
|
-
}, 8, ["modelValue"]),
|
|
277
|
-
createVNode(unref(Input), {
|
|
278
|
-
modelValue: searchKey.value,
|
|
279
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => searchKey.value = $event),
|
|
280
|
-
placeholder: unref(t)("gitCodeLayout.common.search"),
|
|
281
|
-
onInput: valChange,
|
|
282
|
-
onCompositionstart: _cache[4] || (_cache[4] = ($event) => inputIng.value = true),
|
|
283
|
-
onCompositionend: _cache[5] || (_cache[5] = ($event) => inputIng.value = false)
|
|
284
|
-
}, {
|
|
285
|
-
prefix: withCtx(() => [
|
|
286
|
-
createVNode(GIcon, {
|
|
287
|
-
name: "gt-search",
|
|
288
|
-
color: "var(--theme-menu-icon-fill)"
|
|
289
|
-
})
|
|
290
|
-
]),
|
|
291
|
-
_: 1
|
|
292
|
-
}, 8, ["modelValue", "placeholder"])
|
|
293
|
-
], 2)
|
|
294
|
-
], 64)) : createCommentVNode("", true),
|
|
295
|
-
_ctx.type === "team" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
296
|
-
createElementVNode("div", _hoisted_4, [
|
|
297
|
-
_cache[13] || (_cache[13] = createElementVNode("span", { class: "devui-menu-icon" }, null, -1)),
|
|
298
|
-
createElementVNode("span", _hoisted_5, [
|
|
299
|
-
createElementVNode("div", {
|
|
300
|
-
class: "fast-click-button",
|
|
301
|
-
onClick: _cache[7] || (_cache[7] = ($event) => fastToLink("team"))
|
|
302
|
-
}, toDisplayString(unref(t)("gitCodeLayout.common.organize")), 1)
|
|
303
|
-
])
|
|
304
|
-
]),
|
|
305
|
-
createVNode(GIcon, {
|
|
306
|
-
class: "my-work-platform-searchicon",
|
|
307
|
-
name: "gt-search",
|
|
308
|
-
onClick: withModifiers(handleOpenSearch, ["stop"]),
|
|
309
|
-
color: "var(--theme-menu-icon-fill)"
|
|
310
|
-
}),
|
|
311
|
-
createElementVNode("div", {
|
|
312
|
-
class: normalizeClass(["flex flex-col pl-[0] my-work-platform-inputbox", showSearch.value ? "" : "my-work-platform-hideInputBox"]),
|
|
313
|
-
onClick: _cache[11] || (_cache[11] = withModifiers(() => {
|
|
314
|
-
}, ["stop"]))
|
|
315
|
-
}, [
|
|
316
|
-
createVNode(unref(Input), {
|
|
317
|
-
modelValue: searchKey.value,
|
|
318
|
-
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => searchKey.value = $event),
|
|
319
|
-
placeholder: unref(t)("gitCodeLayout.common.search"),
|
|
320
|
-
onInput: valChange,
|
|
321
|
-
onCompositionstart: _cache[9] || (_cache[9] = ($event) => inputIng.value = true),
|
|
322
|
-
onCompositionend: _cache[10] || (_cache[10] = ($event) => inputIng.value = false)
|
|
323
|
-
}, {
|
|
324
|
-
prefix: withCtx(() => [
|
|
325
|
-
createVNode(GIcon, {
|
|
326
|
-
name: "gt-search",
|
|
327
|
-
color: "var(--theme-menu-icon-fill)"
|
|
328
|
-
})
|
|
329
|
-
]),
|
|
330
|
-
_: 1
|
|
331
|
-
}, 8, ["modelValue", "placeholder"])
|
|
332
|
-
], 2)
|
|
333
|
-
], 64)) : createCommentVNode("", true),
|
|
334
|
-
firstLoading.value ? (openBlock(), createBlock(unref(Skeleton), {
|
|
335
|
-
key: 2,
|
|
336
|
-
rows: 1
|
|
337
|
-
})) : createCommentVNode("", true),
|
|
338
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(projectList.value, (item) => {
|
|
339
|
-
return openBlock(), createBlock(unref(MenuItem), {
|
|
340
|
-
key: item.key,
|
|
341
|
-
"data-openBlank": true,
|
|
342
|
-
"data-href": unref(transWebUrl)(item.web_url),
|
|
343
|
-
class: "text",
|
|
344
|
-
title: _ctx.type === "project" ? `${item.namespace}/${item.label}` : item.label
|
|
345
|
-
}, {
|
|
346
|
-
icon: withCtx(() => [
|
|
347
|
-
_ctx.type === "project" ? (openBlock(), createBlock(GIcon, {
|
|
348
|
-
key: 0,
|
|
349
|
-
name: "gt-line-project",
|
|
350
|
-
color: "var(--theme-menu-icon-fill)",
|
|
351
|
-
size: "16"
|
|
352
|
-
})) : (openBlock(), createBlock(_sfc_main$1, {
|
|
353
|
-
key: 1,
|
|
354
|
-
src: item.avatar,
|
|
355
|
-
name: item.key,
|
|
356
|
-
width: 16,
|
|
357
|
-
height: 16,
|
|
358
|
-
class: normalizeClass(!item.avatar ? "avatar" : "avatar1")
|
|
359
|
-
}, null, 8, ["src", "name", "class"]))
|
|
360
|
-
]),
|
|
361
|
-
default: withCtx(() => [
|
|
362
|
-
_ctx.type === "project" ? (openBlock(), createElementBlock("span", _hoisted_6, [
|
|
363
|
-
createElementVNode("span", _hoisted_7, toDisplayString((item.namespace || "").slice(0, 10)) + toDisplayString((item.namespace || "").length > 10 ? "..." : ""), 1),
|
|
364
|
-
createElementVNode("span", _hoisted_8, "/" + toDisplayString(item.label), 1)
|
|
365
|
-
])) : (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(item.label), 1))
|
|
366
|
-
]),
|
|
367
|
-
_: 2
|
|
368
|
-
}, 1032, ["data-href", "title"]);
|
|
369
|
-
}), 128)),
|
|
370
|
-
!totalNum.value && !firstLoading.value ? (openBlock(), createBlock(unref(Button), {
|
|
371
|
-
key: 3,
|
|
372
|
-
variant: "text",
|
|
373
|
-
class: "more-btn",
|
|
374
|
-
onClick: withModifiers(createRepoOrOrg, ["stop"])
|
|
375
|
-
}, {
|
|
376
|
-
default: withCtx(() => [
|
|
377
|
-
createTextVNode(toDisplayString(_ctx.buttonText), 1)
|
|
378
|
-
]),
|
|
379
|
-
_: 1
|
|
380
|
-
})) : createCommentVNode("", true),
|
|
381
|
-
withDirectives(createVNode(unref(Button), {
|
|
382
|
-
variant: "text",
|
|
383
|
-
class: "more-btn",
|
|
384
|
-
onClick: withModifiers(loadMoreData, ["stop"]),
|
|
385
|
-
loading: loading.value,
|
|
386
|
-
disabled: loading.value
|
|
387
|
-
}, {
|
|
388
|
-
default: withCtx(() => [
|
|
389
|
-
createTextVNode(toDisplayString(unref(t)("gitCodeLayout.org.expand_more")), 1)
|
|
390
|
-
]),
|
|
391
|
-
_: 1
|
|
392
|
-
}, 8, ["loading", "disabled"]), [
|
|
393
|
-
[vShow, (totalNum.value > pageQuery.size * pageQuery.page || unref(storeData).length) && props.subShow]
|
|
394
|
-
])
|
|
395
|
-
]);
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
const ProjectMenuList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
|
|
400
|
-
export {
|
|
401
|
-
ProjectMenuList as default
|
|
402
|
-
};
|
|
@@ -1,221 +0,0 @@
|
|
|
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-Bxhc6nCo.js";
|
|
3
|
-
import { useRouter } from "vue-router";
|
|
4
|
-
import { t as transWebUrl } from "./transWebUrl-DTXUrWYK.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
|
-
};
|