baai-components 1.0.0
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/README.md +201 -0
- package/dist/Icon/Down.vue.d.ts +2 -0
- package/dist/Icon/Header.vue.d.ts +2 -0
- package/dist/components/Button/index.vue.d.ts +39 -0
- package/dist/components/Header/src/Avatar.vue.d.ts +16 -0
- package/dist/components/Header/src/Header.vue.d.ts +27 -0
- package/dist/components/Header/src/Locale.vue.d.ts +48 -0
- package/dist/components/Header/src/Login.vue.d.ts +2 -0
- package/dist/components/Header/src/config/locale.d.ts +8 -0
- package/dist/components/Header/src/config/menus.d.ts +29 -0
- package/dist/components/Header/src/config/texts.d.ts +8 -0
- package/dist/components/Header/src/constants/locale.d.ts +4 -0
- package/dist/components/Header/src/hooks/useHeaderMenu.d.ts +56 -0
- package/dist/components/Header/src/hooks/useHeaderTheme.d.ts +8 -0
- package/dist/components/Header/src/index.d.ts +11 -0
- package/dist/components/Header/src/utils/openLink.d.ts +1 -0
- package/dist/components/Header/src/utils/path.d.ts +2 -0
- package/dist/components/Table/index.vue.d.ts +37 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +934 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,934 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString, renderSlot, createTextVNode, createCommentVNode, computed, normalizeClass, inject, ref, resolveComponent, createBlock, withCtx, createVNode, unref, provide, watch, onMounted, onUnmounted, nextTick } from "vue";
|
|
2
|
+
import { useRouter } from "vue-router";
|
|
3
|
+
import { ElMessage } from "element-plus";
|
|
4
|
+
import throttle from "lodash/throttle";
|
|
5
|
+
const _sfc_main$7 = defineComponent({
|
|
6
|
+
name: "MyTable",
|
|
7
|
+
props: {
|
|
8
|
+
columns: {
|
|
9
|
+
type: Array,
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
data: {
|
|
13
|
+
type: Array,
|
|
14
|
+
default: () => []
|
|
15
|
+
},
|
|
16
|
+
rowKey: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ""
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _export_sfc = (sfc, props) => {
|
|
23
|
+
const target = sfc.__vccOpts || sfc;
|
|
24
|
+
for (const [key, val] of props) {
|
|
25
|
+
target[key] = val;
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
const _hoisted_1$6 = { class: "w-full overflow-auto" };
|
|
30
|
+
const _hoisted_2$4 = { class: "w-full border-collapse table-fixed" };
|
|
31
|
+
const _hoisted_3$1 = { key: 0 };
|
|
32
|
+
const _hoisted_4$1 = ["colspan"];
|
|
33
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
34
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
35
|
+
createElementVNode("table", _hoisted_2$4, [
|
|
36
|
+
createElementVNode("thead", null, [
|
|
37
|
+
createElementVNode("tr", null, [
|
|
38
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column) => {
|
|
39
|
+
return openBlock(), createElementBlock("th", {
|
|
40
|
+
key: column.key,
|
|
41
|
+
style: normalizeStyle({ width: column.width }),
|
|
42
|
+
class: "p-3 text-left bg-gray-100 text-gray-700 font-medium text-sm border-b border-gray-200"
|
|
43
|
+
}, toDisplayString(column.title), 5);
|
|
44
|
+
}), 128))
|
|
45
|
+
])
|
|
46
|
+
]),
|
|
47
|
+
createElementVNode("tbody", null, [
|
|
48
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data, (row, rowIndex) => {
|
|
49
|
+
return openBlock(), createElementBlock("tr", {
|
|
50
|
+
key: _ctx.rowKey ? row[_ctx.rowKey] : rowIndex,
|
|
51
|
+
class: "hover:bg-gray-50"
|
|
52
|
+
}, [
|
|
53
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column) => {
|
|
54
|
+
return openBlock(), createElementBlock("td", {
|
|
55
|
+
key: column.key,
|
|
56
|
+
class: "p-3 text-left border-b border-gray-200 text-sm"
|
|
57
|
+
}, [
|
|
58
|
+
renderSlot(_ctx.$slots, column.key, {
|
|
59
|
+
row,
|
|
60
|
+
index: rowIndex
|
|
61
|
+
}, () => [
|
|
62
|
+
createTextVNode(toDisplayString(row[column.key]), 1)
|
|
63
|
+
])
|
|
64
|
+
]);
|
|
65
|
+
}), 128))
|
|
66
|
+
]);
|
|
67
|
+
}), 128)),
|
|
68
|
+
!_ctx.data || _ctx.data.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_3$1, [
|
|
69
|
+
createElementVNode("td", {
|
|
70
|
+
colspan: _ctx.columns.length,
|
|
71
|
+
class: "p-8 text-center text-gray-500"
|
|
72
|
+
}, [
|
|
73
|
+
renderSlot(_ctx.$slots, "empty", {}, () => [
|
|
74
|
+
_cache[0] || (_cache[0] = createTextVNode("\u6682\u65E0\u6570\u636E"))
|
|
75
|
+
])
|
|
76
|
+
], 8, _hoisted_4$1)
|
|
77
|
+
])) : createCommentVNode("", true)
|
|
78
|
+
])
|
|
79
|
+
])
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
const MyTable = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$3]]);
|
|
83
|
+
const _sfc_main$6 = defineComponent({
|
|
84
|
+
name: "MyButton",
|
|
85
|
+
props: {
|
|
86
|
+
type: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: "default"
|
|
89
|
+
},
|
|
90
|
+
disabled: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: false
|
|
93
|
+
},
|
|
94
|
+
loading: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
emits: ["click"],
|
|
100
|
+
setup(props, { emit }) {
|
|
101
|
+
const typeClasses = computed(() => {
|
|
102
|
+
switch (props.type) {
|
|
103
|
+
case "primary":
|
|
104
|
+
return "bg-primary hover:bg-blue-500 text-white border-transparent";
|
|
105
|
+
case "success":
|
|
106
|
+
return "bg-success hover:bg-green-500 text-white border-transparent";
|
|
107
|
+
case "warning":
|
|
108
|
+
return "bg-warning hover:bg-yellow-500 text-white border-transparent";
|
|
109
|
+
case "danger":
|
|
110
|
+
return "bg-danger hover:bg-red-500 text-white border-transparent";
|
|
111
|
+
case "info":
|
|
112
|
+
return "bg-info hover:bg-gray-500 text-white border-transparent";
|
|
113
|
+
default:
|
|
114
|
+
return "bg-white hover:bg-gray-100 text-gray-700 border border-gray-300";
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const handleClick = (e) => {
|
|
118
|
+
if (props.disabled || props.loading)
|
|
119
|
+
return;
|
|
120
|
+
emit("click", e);
|
|
121
|
+
};
|
|
122
|
+
return {
|
|
123
|
+
typeClasses,
|
|
124
|
+
handleClick
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
const index_vue_vue_type_style_index_0_lang = "";
|
|
129
|
+
const _hoisted_1$5 = ["disabled"];
|
|
130
|
+
const _hoisted_2$3 = {
|
|
131
|
+
key: 0,
|
|
132
|
+
class: "mr-2 w-4 h-4 i-svg-spinners-270-ring-with-bg"
|
|
133
|
+
};
|
|
134
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
135
|
+
return openBlock(), createElementBlock("button", {
|
|
136
|
+
class: normalizeClass(["inline-flex justify-center items-center h-8 px-4 py-2 rounded-md text-sm font-medium transition-colors duration-200 focus:outline-none", [
|
|
137
|
+
_ctx.typeClasses,
|
|
138
|
+
{
|
|
139
|
+
"opacity-50 cursor-not-allowed": _ctx.disabled,
|
|
140
|
+
"relative": _ctx.loading
|
|
141
|
+
}
|
|
142
|
+
]]),
|
|
143
|
+
disabled: _ctx.disabled || _ctx.loading,
|
|
144
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
145
|
+
}, [
|
|
146
|
+
_ctx.loading ? (openBlock(), createElementBlock("span", _hoisted_2$3)) : createCommentVNode("", true),
|
|
147
|
+
renderSlot(_ctx.$slots, "default")
|
|
148
|
+
], 10, _hoisted_1$5);
|
|
149
|
+
}
|
|
150
|
+
const MyButton = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$2]]);
|
|
151
|
+
var LocaleTypeEnum = /* @__PURE__ */ ((LocaleTypeEnum2) => {
|
|
152
|
+
LocaleTypeEnum2["English"] = "en";
|
|
153
|
+
LocaleTypeEnum2["Chinese"] = "zh-CN";
|
|
154
|
+
return LocaleTypeEnum2;
|
|
155
|
+
})(LocaleTypeEnum || {});
|
|
156
|
+
const NAV_TEXTS_KEY = Symbol("nav-texts");
|
|
157
|
+
const buildNavTexts = (lang) => {
|
|
158
|
+
const isZh = lang === LocaleTypeEnum.Chinese;
|
|
159
|
+
return {
|
|
160
|
+
loginText: isZh ? "\u767B\u5F55/\u6CE8\u518C" : "Log In / Sign Up",
|
|
161
|
+
logoutText: isZh ? "\u9000\u51FA\u767B\u5F55" : "Log Out"
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
const _sfc_main$5 = {};
|
|
165
|
+
const _hoisted_1$4 = {
|
|
166
|
+
width: "16",
|
|
167
|
+
height: "16",
|
|
168
|
+
viewBox: "0 0 16 16",
|
|
169
|
+
fill: "none",
|
|
170
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
171
|
+
};
|
|
172
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
173
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [
|
|
174
|
+
createElementVNode("g", { id: "icon/down" }, [
|
|
175
|
+
createElementVNode("path", {
|
|
176
|
+
id: "Union",
|
|
177
|
+
d: "M12.1382 5.86191C11.8778 5.60156 11.4557 5.60156 11.1954 5.86191L8.0001 9.05717L4.80484 5.86191C4.54449 5.60156 4.12238 5.60156 3.86203 5.86191C3.60168 6.12226 3.60168 6.54437 3.86203 6.80472L7.29299 10.2357C7.68352 10.6262 8.31668 10.6262 8.70721 10.2357L12.1382 6.80472C12.3985 6.54437 12.3985 6.12226 12.1382 5.86191Z",
|
|
178
|
+
fill: "#2C364B"
|
|
179
|
+
})
|
|
180
|
+
], -1)
|
|
181
|
+
]));
|
|
182
|
+
}
|
|
183
|
+
const Down = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$1]]);
|
|
184
|
+
const _sfc_main$4 = {};
|
|
185
|
+
const _hoisted_1$3 = {
|
|
186
|
+
width: "19px",
|
|
187
|
+
height: "20px",
|
|
188
|
+
viewBox: "0 0 19 20",
|
|
189
|
+
version: "1.1",
|
|
190
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
191
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
192
|
+
};
|
|
193
|
+
function _sfc_render(_ctx, _cache) {
|
|
194
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$3, _cache[0] || (_cache[0] = [
|
|
195
|
+
createElementVNode("title", null, "yonghu-2", -1),
|
|
196
|
+
createElementVNode("g", {
|
|
197
|
+
id: "\u9875\u9762-1",
|
|
198
|
+
stroke: "none",
|
|
199
|
+
"stroke-width": "1",
|
|
200
|
+
fill: "none",
|
|
201
|
+
"fill-rule": "evenodd"
|
|
202
|
+
}, [
|
|
203
|
+
createElementVNode("g", {
|
|
204
|
+
id: "flagos\u9996\u9875\u5907\u4EFD-4",
|
|
205
|
+
transform: "translate(-1187, -32)",
|
|
206
|
+
fill: "#FFFFFF",
|
|
207
|
+
"fill-rule": "nonzero"
|
|
208
|
+
}, [
|
|
209
|
+
createElementVNode("g", {
|
|
210
|
+
id: "yonghu-2",
|
|
211
|
+
transform: "translate(1187, 32)"
|
|
212
|
+
}, [
|
|
213
|
+
createElementVNode("path", {
|
|
214
|
+
d: "M4.16667254,6.66658844 C4.16667254,3.9091208 6.40897956,1.66664712 9.1664472,1.66664712 C11.9239148,1.66664712 14.1663885,3.9091208 14.1663885,6.66658844 C14.1663885,9.42388942 11.9239148,11.6665298 9.1664472,11.6665298 C6.40897956,11.6665298 4.16650588,9.42388942 4.16650588,6.66658844 M18.3046733,18.9521109 C17.4853496,15.8829803 15.3253749,13.4830084 12.6130734,12.3621883 C14.5387175,11.192202 15.8330356,9.08056012 15.8330356,6.66642176 C15.832869,2.99079823 12.8420707,0 9.16628054,0 C5.49049035,0 2.4996921,2.99079823 2.4996921,6.66658844 C2.4996921,9.08056012 3.79384359,11.192202 5.72048764,12.3621883 C3.00801947,13.4838418 0.848044811,15.8829803 0.028221107,18.9521109 C-0.0900085115,19.3963877 0.174049854,19.8524478 0.618214182,19.971099 C1.06293982,20.0897021 1.51968816,19.8256771 1.63886887,19.3811059 C2.59002437,15.820481 5.68498805,13.3331769 9.16661386,13.3331769 C12.6482397,13.3331769 15.74387,15.8206477 16.6948589,19.3814392 C16.7515138,19.5951643 16.8909444,19.7775312 17.0823388,19.8882397 C17.2737332,19.9989483 17.5013346,20.0288842 17.7148469,19.9714323 C18.1590942,19.8527834 18.423176,19.3966084 18.30484,18.9522776",
|
|
215
|
+
id: "\u5F62\u72B6"
|
|
216
|
+
})
|
|
217
|
+
])
|
|
218
|
+
])
|
|
219
|
+
], -1)
|
|
220
|
+
]));
|
|
221
|
+
}
|
|
222
|
+
const Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render]]);
|
|
223
|
+
const _hoisted_1$2 = { class: "flex items-center cursor-pointer" };
|
|
224
|
+
const _hoisted_2$2 = { class: "w-24 h-24 rounded-50% font-600 flex-center mr-8" };
|
|
225
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
226
|
+
__name: "Avatar",
|
|
227
|
+
props: {
|
|
228
|
+
userNickName: {},
|
|
229
|
+
currentPath: {},
|
|
230
|
+
logout: { type: Function }
|
|
231
|
+
},
|
|
232
|
+
setup(__props) {
|
|
233
|
+
const navTexts = inject(NAV_TEXTS_KEY);
|
|
234
|
+
const dropdownVisible = ref(false);
|
|
235
|
+
const onVisibleChange = (visible) => {
|
|
236
|
+
dropdownVisible.value = visible;
|
|
237
|
+
};
|
|
238
|
+
return (_ctx, _cache) => {
|
|
239
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
240
|
+
const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
|
|
241
|
+
const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
|
|
242
|
+
const _component_el_dropdown = resolveComponent("el-dropdown");
|
|
243
|
+
return openBlock(), createBlock(_component_el_dropdown, {
|
|
244
|
+
"popper-class": "custom-dropdown",
|
|
245
|
+
size: "large",
|
|
246
|
+
ref: "dropdown",
|
|
247
|
+
trigger: "click",
|
|
248
|
+
"show-arrow": false,
|
|
249
|
+
onVisibleChange
|
|
250
|
+
}, {
|
|
251
|
+
dropdown: withCtx(() => [
|
|
252
|
+
createVNode(_component_el_dropdown_menu, null, {
|
|
253
|
+
default: withCtx(() => [
|
|
254
|
+
createVNode(_component_el_dropdown_item, null, {
|
|
255
|
+
default: withCtx(() => {
|
|
256
|
+
var _a;
|
|
257
|
+
return [
|
|
258
|
+
createElementVNode("div", {
|
|
259
|
+
class: "flex items-center w-full text-14 mb-4",
|
|
260
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.logout && _ctx.logout(...args))
|
|
261
|
+
}, toDisplayString((_a = unref(navTexts)) == null ? void 0 : _a.logoutText), 1)
|
|
262
|
+
];
|
|
263
|
+
}),
|
|
264
|
+
_: 1
|
|
265
|
+
})
|
|
266
|
+
]),
|
|
267
|
+
_: 1
|
|
268
|
+
})
|
|
269
|
+
]),
|
|
270
|
+
default: withCtx(() => [
|
|
271
|
+
createElementVNode("div", _hoisted_1$2, [
|
|
272
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
273
|
+
createVNode(Header$1)
|
|
274
|
+
]),
|
|
275
|
+
createElementVNode("span", null, toDisplayString(_ctx.userNickName), 1),
|
|
276
|
+
createVNode(_component_el_icon, {
|
|
277
|
+
class: normalizeClass(["el-icon--right !ml-16 transition-all duration-200", {
|
|
278
|
+
" rotate-180": dropdownVisible.value
|
|
279
|
+
}]),
|
|
280
|
+
size: 16
|
|
281
|
+
}, {
|
|
282
|
+
default: withCtx(() => [
|
|
283
|
+
createVNode(Down)
|
|
284
|
+
]),
|
|
285
|
+
_: 1
|
|
286
|
+
}, 8, ["class"])
|
|
287
|
+
])
|
|
288
|
+
]),
|
|
289
|
+
_: 1
|
|
290
|
+
}, 512);
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
const Avatar_vue_vue_type_style_index_0_scoped_35cafb1a_lang = "";
|
|
295
|
+
const Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-35cafb1a"]]);
|
|
296
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
297
|
+
__name: "Login",
|
|
298
|
+
setup(__props) {
|
|
299
|
+
const navTexts = inject(NAV_TEXTS_KEY);
|
|
300
|
+
const router = useRouter();
|
|
301
|
+
const login = () => {
|
|
302
|
+
router.push({ path: "/login", query: { redirect_url: encodeURIComponent(location.href) } });
|
|
303
|
+
};
|
|
304
|
+
return (_ctx, _cache) => {
|
|
305
|
+
const _component_el_button = resolveComponent("el-button");
|
|
306
|
+
return openBlock(), createBlock(_component_el_button, {
|
|
307
|
+
type: "primary",
|
|
308
|
+
class: "!rounded-4",
|
|
309
|
+
onClick: login
|
|
310
|
+
}, {
|
|
311
|
+
default: withCtx(() => {
|
|
312
|
+
var _a;
|
|
313
|
+
return [
|
|
314
|
+
createTextVNode(toDisplayString((_a = unref(navTexts)) == null ? void 0 : _a.loginText), 1)
|
|
315
|
+
];
|
|
316
|
+
}),
|
|
317
|
+
_: 1
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
const NAV_LOCALE_OPTIONS = [
|
|
323
|
+
{ value: LocaleTypeEnum.Chinese, label: "\u4E2D\u6587" },
|
|
324
|
+
{ value: LocaleTypeEnum.English, label: "English" }
|
|
325
|
+
];
|
|
326
|
+
const NAV_LOCALE_TO_LANG = {
|
|
327
|
+
[LocaleTypeEnum.Chinese]: "cn",
|
|
328
|
+
[LocaleTypeEnum.English]: "en"
|
|
329
|
+
};
|
|
330
|
+
const NAV_LANG_TO_LOCALE = {
|
|
331
|
+
cn: LocaleTypeEnum.Chinese,
|
|
332
|
+
en: LocaleTypeEnum.English
|
|
333
|
+
};
|
|
334
|
+
const NAV_WIKI_LANG_BY_LOCALE = {
|
|
335
|
+
[LocaleTypeEnum.Chinese]: "zh",
|
|
336
|
+
[LocaleTypeEnum.English]: "en"
|
|
337
|
+
};
|
|
338
|
+
const _hoisted_1$1 = {
|
|
339
|
+
width: "20px",
|
|
340
|
+
height: "20px",
|
|
341
|
+
viewBox: "0 0 20 20",
|
|
342
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
343
|
+
};
|
|
344
|
+
const _hoisted_2$1 = ["fill"];
|
|
345
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
346
|
+
__name: "Locale",
|
|
347
|
+
props: {
|
|
348
|
+
isWhiteTheme: { type: Boolean, default: false },
|
|
349
|
+
currentLocale: {},
|
|
350
|
+
localeOptions: { default: () => NAV_LOCALE_OPTIONS }
|
|
351
|
+
},
|
|
352
|
+
emits: ["change-language"],
|
|
353
|
+
setup(__props, { emit: __emit }) {
|
|
354
|
+
const active = ref(false);
|
|
355
|
+
const handleChange = (val) => {
|
|
356
|
+
active.value = val;
|
|
357
|
+
};
|
|
358
|
+
const props = __props;
|
|
359
|
+
const emits = __emit;
|
|
360
|
+
const isWhite = computed(() => props.isWhiteTheme);
|
|
361
|
+
const currentLocale = computed(() => props.currentLocale);
|
|
362
|
+
const localeOptions = computed(() => props.localeOptions);
|
|
363
|
+
const emitChangeLanguage = (locale) => {
|
|
364
|
+
if (locale === currentLocale.value) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
emits("change-language", locale);
|
|
368
|
+
};
|
|
369
|
+
return (_ctx, _cache) => {
|
|
370
|
+
const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
|
|
371
|
+
const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
|
|
372
|
+
const _component_el_dropdown = resolveComponent("el-dropdown");
|
|
373
|
+
return openBlock(), createBlock(_component_el_dropdown, {
|
|
374
|
+
class: "cursor-pointer",
|
|
375
|
+
trigger: "click",
|
|
376
|
+
"popper-class": "custom-dropdown",
|
|
377
|
+
placement: "bottom",
|
|
378
|
+
onVisibleChange: handleChange
|
|
379
|
+
}, {
|
|
380
|
+
dropdown: withCtx(() => [
|
|
381
|
+
createVNode(_component_el_dropdown_menu, null, {
|
|
382
|
+
default: withCtx(() => [
|
|
383
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(localeOptions.value, (locale) => {
|
|
384
|
+
return openBlock(), createBlock(_component_el_dropdown_item, {
|
|
385
|
+
key: locale.value,
|
|
386
|
+
class: normalizeClass({ "is-active": locale.value === currentLocale.value }),
|
|
387
|
+
onClick: ($event) => emitChangeLanguage(locale.value)
|
|
388
|
+
}, {
|
|
389
|
+
default: withCtx(() => [
|
|
390
|
+
createElementVNode("span", {
|
|
391
|
+
class: normalizeClass({ "color-primary": locale.value === currentLocale.value })
|
|
392
|
+
}, toDisplayString(locale.label), 3)
|
|
393
|
+
]),
|
|
394
|
+
_: 2
|
|
395
|
+
}, 1032, ["class", "onClick"]);
|
|
396
|
+
}), 128))
|
|
397
|
+
]),
|
|
398
|
+
_: 1
|
|
399
|
+
})
|
|
400
|
+
]),
|
|
401
|
+
default: withCtx(() => [
|
|
402
|
+
(openBlock(), createElementBlock("svg", _hoisted_1$1, [
|
|
403
|
+
_cache[0] || (_cache[0] = createElementVNode("rect", {
|
|
404
|
+
fill: "#D8D8D8",
|
|
405
|
+
opacity: "0",
|
|
406
|
+
x: "0",
|
|
407
|
+
y: "0",
|
|
408
|
+
width: "20",
|
|
409
|
+
height: "20"
|
|
410
|
+
}, null, -1)),
|
|
411
|
+
createElementVNode("path", {
|
|
412
|
+
fill: isWhite.value ? "#ffffff" : "#2C364B",
|
|
413
|
+
"fill-rule": "nonzero",
|
|
414
|
+
d: "M10,0 C4.48583334,0 0,4.48583334 0,10 C0,15.5141667 4.48583334,20 10,20 C15.5141667,20 20,15.5141667 20,10 C20,4.48583334 15.5141667,0 10,0 Z M18.6966667,10.9491667 L18.6925,10.9741667 C18.6575,11.2791667 18.6075,11.5791667 18.5425,11.8741667 L18.5425,11.875 L15.5258333,11.875 C15.657032,10.6284426 15.657032,9.37155738 15.5258333,8.125 L18.5425,8.125 C18.6075,8.42 18.6566667,8.72 18.6925,9.025 C18.6925,9.03333334 18.695,9.04166666 18.6966667,9.05083334 C18.7675,9.68166668 18.7675,10.3183333 18.6966667,10.9491667 L18.6966667,10.9491667 Z M13.34,18.0833333 C14.2783333,16.8683333 14.9891667,15.1491667 15.3516667,13.1241667 L18.1633333,13.1241667 C17.3009588,15.3668017 15.5579816,17.158563 13.34,18.0825 L13.34,18.0833333 Z M18.1625,6.87333334 L15.3516667,6.87333334 C14.9891667,4.84833334 14.2783333,3.13 13.34,1.915 C15.5576659,2.83912386 17.3003173,4.63085972 18.1625,6.87333334 L18.1625,6.87333334 Z M14.2658333,8.12333334 C14.4114344,9.36909341 14.4114344,10.6275733 14.2658333,11.8733333 L10.6241667,11.8733333 L10.6241667,8.12333334 L14.2658333,8.12333334 Z M10.6241667,6.87333334 L10.6241667,1.355 C12.1825,1.825 13.5008333,4.0025 14.07,6.87583334 L10.625,6.87583334 L10.6241667,6.87333334 Z M10.6241667,13.1233333 L14.07,13.1233333 C13.5008333,15.9983333 12.1825,18.175 10.625,18.645 L10.625,13.125 L10.6241667,13.1233333 Z M1.8375,13.1241667 L4.64833334,13.1241667 C5.01083334,15.1491667 5.72166668,16.8683333 6.66,18.0825 C4.44233408,17.1583761 2.69968275,15.3666403 1.8375,13.1241667 L1.8375,13.1241667 Z M6.66,1.91666666 C5.72166666,3.13 5.01083334,4.85 4.64833334,6.875 L1.83666666,6.875 C2.69923303,4.63220345 4.44253606,2.84041679 6.66083334,1.91666666 L6.66,1.91666666 Z M5.73416666,11.875 C5.58856559,10.6292399 5.58856559,9.37076007 5.73416666,8.125 L9.375,8.125 L9.375,11.875 L5.73333334,11.875 L5.73416666,11.875 Z M9.375,13.125 L9.375,18.6458333 C7.81666666,18.1758333 6.49916666,15.9983333 5.93,13.125 L9.375,13.125 Z M9.375,6.875 L5.93,6.875 C6.49916666,4.00166666 7.81666666,1.825 9.375,1.35416666 L9.375,6.875 Z M1.30416666,9.05 C1.30416666,9.04333334 1.30666666,9.03583334 1.3075,9.02833334 C1.34166666,8.725 1.39166666,8.42333334 1.4575,8.125 L4.47416666,8.125 C4.34243809,9.37152952 4.34243809,10.6284705 4.47416666,11.875 L1.4575,11.875 C1.39166666,11.5766667 1.34166666,11.275 1.3075,10.9716667 L1.30416666,10.9491667 C1.23220566,10.3184348 1.23220566,9.68156522 1.30416666,9.05083334 L1.30416666,9.05 Z"
|
|
415
|
+
}, null, 8, _hoisted_2$1)
|
|
416
|
+
]))
|
|
417
|
+
]),
|
|
418
|
+
_: 1
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
const matchPath = (path, targetPath) => {
|
|
424
|
+
if (!path || !targetPath)
|
|
425
|
+
return false;
|
|
426
|
+
return path.toLowerCase().indexOf(targetPath.toLowerCase()) >= 0;
|
|
427
|
+
};
|
|
428
|
+
const matchAnyPath = (path, targetPaths) => {
|
|
429
|
+
return targetPaths.some((targetPath) => matchPath(path, targetPath));
|
|
430
|
+
};
|
|
431
|
+
const __uno = "";
|
|
432
|
+
const _hoisted_1 = { class: "flex-center" };
|
|
433
|
+
const _hoisted_2 = ["src"];
|
|
434
|
+
const _hoisted_3 = { class: "flex gap-48 ml-80" };
|
|
435
|
+
const _hoisted_4 = ["index"];
|
|
436
|
+
const _hoisted_5 = { class: "text-16" };
|
|
437
|
+
const _hoisted_6 = { class: "text-14 mb-16 !font-500" };
|
|
438
|
+
const _hoisted_7 = { class: "text-14 whitespace-normal !font-400" };
|
|
439
|
+
const _hoisted_8 = { class: "text-16" };
|
|
440
|
+
const _hoisted_9 = { class: "text-14 mb-16 !font-500" };
|
|
441
|
+
const _hoisted_10 = { class: "text-14 whitespace-normal !font-400" };
|
|
442
|
+
const _hoisted_11 = { class: "text-16" };
|
|
443
|
+
const _hoisted_12 = { class: "text-14 text-#bbbbbb leading-22 mb-20" };
|
|
444
|
+
const _hoisted_13 = { class: "text-14 mb-16 !font-500" };
|
|
445
|
+
const _hoisted_14 = { class: "text-14 whitespace-normal !font-400" };
|
|
446
|
+
const _hoisted_15 = ["onClick"];
|
|
447
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
448
|
+
__name: "Header",
|
|
449
|
+
props: {
|
|
450
|
+
routePath: {},
|
|
451
|
+
menuList: {},
|
|
452
|
+
isWhiteTheme: { type: Boolean },
|
|
453
|
+
isScrolledTheme: { type: Boolean },
|
|
454
|
+
currentLocale: {},
|
|
455
|
+
userName: {},
|
|
456
|
+
userNickName: {},
|
|
457
|
+
onLogoClick: { type: Function },
|
|
458
|
+
onJumpPage: { type: Function },
|
|
459
|
+
onChangeLanguage: { type: Function },
|
|
460
|
+
onLogout: { type: Function }
|
|
461
|
+
},
|
|
462
|
+
setup(__props) {
|
|
463
|
+
const props = __props;
|
|
464
|
+
provide(
|
|
465
|
+
NAV_TEXTS_KEY,
|
|
466
|
+
computed(() => buildNavTexts(props.currentLocale))
|
|
467
|
+
);
|
|
468
|
+
return (_ctx, _cache) => {
|
|
469
|
+
const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
|
|
470
|
+
const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
|
|
471
|
+
const _component_el_dropdown = resolveComponent("el-dropdown");
|
|
472
|
+
return openBlock(), createElementBlock("div", {
|
|
473
|
+
class: normalizeClass(["w-[calc(100vw-160px)] header-wrapper h-64px pl-120 pr-120 py-19 backdrop-blur-[14px] flex items-center justify-between text-#000 fixed left-0 top-0 z-99 bg-transparent overflow-x-scroll", {
|
|
474
|
+
"theme-white": _ctx.isWhiteTheme,
|
|
475
|
+
"theme-scrolled": _ctx.isScrolledTheme,
|
|
476
|
+
"!b-0": unref(matchPath)(_ctx.routePath, "/CommunityMembers")
|
|
477
|
+
}])
|
|
478
|
+
}, [
|
|
479
|
+
createElementVNode("div", _hoisted_1, [
|
|
480
|
+
createElementVNode("img", {
|
|
481
|
+
class: "logo",
|
|
482
|
+
src: _ctx.isWhiteTheme ? "https://flagos.ks3-cn-beijing.ksyuncs.com/images/logo.svg" : "https://flagos.ks3-cn-beijing.ksyuncs.com/images/logo-black.svg",
|
|
483
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onLogoClick && _ctx.onLogoClick(...args))
|
|
484
|
+
}, null, 8, _hoisted_2),
|
|
485
|
+
createElementVNode("div", _hoisted_3, [
|
|
486
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuList, (menu, index2) => {
|
|
487
|
+
return openBlock(), createElementBlock("div", {
|
|
488
|
+
index: index2,
|
|
489
|
+
class: normalizeClass(["menu-item cursor-pointer whitespace-nowrap", { active: menu.active }])
|
|
490
|
+
}, [
|
|
491
|
+
menu.dropdownList && menu.id === "learn" ? (openBlock(), createBlock(_component_el_dropdown, {
|
|
492
|
+
key: 0,
|
|
493
|
+
"popper-class": "custom-dropdown-new",
|
|
494
|
+
"show-arrow": false
|
|
495
|
+
}, {
|
|
496
|
+
dropdown: withCtx(() => [
|
|
497
|
+
createVNode(_component_el_dropdown_menu, { class: "flex-row" }, {
|
|
498
|
+
default: withCtx(() => [
|
|
499
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(menu.dropdownList, (childMenu, idx) => {
|
|
500
|
+
return openBlock(), createBlock(_component_el_dropdown_item, {
|
|
501
|
+
key: idx,
|
|
502
|
+
class: normalizeClass({ active: unref(matchPath)(_ctx.routePath, childMenu.path) }),
|
|
503
|
+
onClick: ($event) => _ctx.onJumpPage(menu, childMenu)
|
|
504
|
+
}, {
|
|
505
|
+
default: withCtx(() => [
|
|
506
|
+
createElementVNode("span", _hoisted_6, toDisplayString(childMenu.label), 1),
|
|
507
|
+
createElementVNode("span", _hoisted_7, toDisplayString(childMenu.desc), 1)
|
|
508
|
+
]),
|
|
509
|
+
_: 2
|
|
510
|
+
}, 1032, ["class", "onClick"]);
|
|
511
|
+
}), 128))
|
|
512
|
+
]),
|
|
513
|
+
_: 2
|
|
514
|
+
}, 1024)
|
|
515
|
+
]),
|
|
516
|
+
default: withCtx(() => [
|
|
517
|
+
createElementVNode("span", _hoisted_5, toDisplayString(menu.label), 1)
|
|
518
|
+
]),
|
|
519
|
+
_: 2
|
|
520
|
+
}, 1024)) : menu.dropdownList && menu.id === "tools" ? (openBlock(), createBlock(_component_el_dropdown, {
|
|
521
|
+
key: 1,
|
|
522
|
+
"popper-class": "custom-dropdown-new",
|
|
523
|
+
"show-arrow": false
|
|
524
|
+
}, {
|
|
525
|
+
dropdown: withCtx(() => [
|
|
526
|
+
createVNode(_component_el_dropdown_menu, null, {
|
|
527
|
+
default: withCtx(() => [
|
|
528
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(menu.dropdownList, (childMenu, idx) => {
|
|
529
|
+
return openBlock(), createBlock(_component_el_dropdown_item, {
|
|
530
|
+
key: idx,
|
|
531
|
+
onClick: ($event) => _ctx.onJumpPage(menu, childMenu)
|
|
532
|
+
}, {
|
|
533
|
+
default: withCtx(() => [
|
|
534
|
+
createElementVNode("span", _hoisted_9, toDisplayString(childMenu.label), 1),
|
|
535
|
+
createElementVNode("span", _hoisted_10, toDisplayString(childMenu.desc), 1)
|
|
536
|
+
]),
|
|
537
|
+
_: 2
|
|
538
|
+
}, 1032, ["onClick"]);
|
|
539
|
+
}), 128))
|
|
540
|
+
]),
|
|
541
|
+
_: 2
|
|
542
|
+
}, 1024)
|
|
543
|
+
]),
|
|
544
|
+
default: withCtx(() => [
|
|
545
|
+
createElementVNode("span", _hoisted_8, toDisplayString(menu.label), 1)
|
|
546
|
+
]),
|
|
547
|
+
_: 2
|
|
548
|
+
}, 1024)) : menu.dropdownGroups && menu.id === "projects" ? (openBlock(), createBlock(_component_el_dropdown, {
|
|
549
|
+
key: 2,
|
|
550
|
+
"popper-class": "custom-dropdown-new",
|
|
551
|
+
"show-arrow": false
|
|
552
|
+
}, {
|
|
553
|
+
dropdown: withCtx(() => [
|
|
554
|
+
createVNode(_component_el_dropdown_menu, { class: "flex gap-20 el-dropdown-menu_out" }, {
|
|
555
|
+
default: withCtx(() => [
|
|
556
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(menu.dropdownGroups, (group, idx) => {
|
|
557
|
+
return openBlock(), createElementBlock("ul", {
|
|
558
|
+
key: idx,
|
|
559
|
+
class: "flex-1 el-dropdown-menu !w-[50%] !max-h-560px"
|
|
560
|
+
}, [
|
|
561
|
+
createElementVNode("span", _hoisted_12, toDisplayString(group.label), 1),
|
|
562
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(group.list, (childMenu, cidx) => {
|
|
563
|
+
return openBlock(), createBlock(_component_el_dropdown_item, {
|
|
564
|
+
key: cidx,
|
|
565
|
+
class: "el-dropdown-menu__item !w-full",
|
|
566
|
+
onClick: ($event) => _ctx.onJumpPage(menu, childMenu)
|
|
567
|
+
}, {
|
|
568
|
+
default: withCtx(() => [
|
|
569
|
+
createElementVNode("span", _hoisted_13, toDisplayString(childMenu.label), 1),
|
|
570
|
+
createElementVNode("span", _hoisted_14, toDisplayString(childMenu.desc), 1)
|
|
571
|
+
]),
|
|
572
|
+
_: 2
|
|
573
|
+
}, 1032, ["onClick"]);
|
|
574
|
+
}), 128))
|
|
575
|
+
]);
|
|
576
|
+
}), 128))
|
|
577
|
+
]),
|
|
578
|
+
_: 2
|
|
579
|
+
}, 1024)
|
|
580
|
+
]),
|
|
581
|
+
default: withCtx(() => [
|
|
582
|
+
createElementVNode("span", _hoisted_11, toDisplayString(menu.label), 1)
|
|
583
|
+
]),
|
|
584
|
+
_: 2
|
|
585
|
+
}, 1024)) : (openBlock(), createElementBlock("span", {
|
|
586
|
+
key: 3,
|
|
587
|
+
onClick: ($event) => _ctx.onJumpPage(menu)
|
|
588
|
+
}, toDisplayString(menu.label), 9, _hoisted_15))
|
|
589
|
+
], 10, _hoisted_4);
|
|
590
|
+
}), 256))
|
|
591
|
+
])
|
|
592
|
+
]),
|
|
593
|
+
createElementVNode("div", {
|
|
594
|
+
class: normalizeClass(["flex-center", _ctx.isWhiteTheme ? "text-#ffffff" : "text-#262642"])
|
|
595
|
+
}, [
|
|
596
|
+
createVNode(_sfc_main$1, {
|
|
597
|
+
isWhiteTheme: _ctx.isWhiteTheme,
|
|
598
|
+
"current-locale": _ctx.currentLocale,
|
|
599
|
+
onChangeLanguage: _ctx.onChangeLanguage
|
|
600
|
+
}, null, 8, ["isWhiteTheme", "current-locale", "onChangeLanguage"]),
|
|
601
|
+
!_ctx.userName ? (openBlock(), createBlock(_sfc_main$2, {
|
|
602
|
+
key: 0,
|
|
603
|
+
class: "ml-20"
|
|
604
|
+
})) : createCommentVNode("", true),
|
|
605
|
+
_ctx.userName ? (openBlock(), createBlock(Avatar, {
|
|
606
|
+
key: 1,
|
|
607
|
+
class: normalizeClass(["header_avatar ml-20", _ctx.isWhiteTheme ? "text-#ffffff" : "text-#262642"]),
|
|
608
|
+
"user-nick-name": _ctx.userNickName,
|
|
609
|
+
"current-path": _ctx.routePath,
|
|
610
|
+
logout: _ctx.onLogout
|
|
611
|
+
}, null, 8, ["class", "user-nick-name", "current-path", "logout"])) : createCommentVNode("", true)
|
|
612
|
+
], 2)
|
|
613
|
+
], 2);
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
const Header_vue_vue_type_style_index_0_scoped_0da7041c_lang = "";
|
|
618
|
+
const Header_vue_vue_type_style_index_1_lang = "";
|
|
619
|
+
const Header = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0da7041c"]]);
|
|
620
|
+
const mainDevHost = ["platform-aiintegration-dev.baai.ac.cn"];
|
|
621
|
+
const mainProdHost = ["flagos.io", "flagos.net", "www.flagos.io", "www.flagos.net"];
|
|
622
|
+
const mainHost = [...mainProdHost, ...mainDevHost];
|
|
623
|
+
const isMainApp = () => {
|
|
624
|
+
return mainHost.includes(location.host);
|
|
625
|
+
};
|
|
626
|
+
const buildMenu = (lang) => {
|
|
627
|
+
const isZh = lang === LocaleTypeEnum.Chinese;
|
|
628
|
+
NAV_WIKI_LANG_BY_LOCALE[lang];
|
|
629
|
+
return [
|
|
630
|
+
{
|
|
631
|
+
id: "home",
|
|
632
|
+
label: isZh ? "\u9996\u9875" : "Home",
|
|
633
|
+
path: "/Home"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
id: "projects",
|
|
637
|
+
label: isZh ? "\u8F6F\u4EF6\u6808" : "Software Stack",
|
|
638
|
+
dropdownGroups: [
|
|
639
|
+
{
|
|
640
|
+
id: "coreLib",
|
|
641
|
+
label: isZh ? "\u5F00\u6E90\u6838\u5FC3\u5E93" : "Open-Source Core Libraries",
|
|
642
|
+
list: [
|
|
643
|
+
{
|
|
644
|
+
id: "flagscale",
|
|
645
|
+
label: "FlagScale",
|
|
646
|
+
path: "/FlagScale",
|
|
647
|
+
desc: isZh ? "\u7EDF\u4E00\u591A\u82AF\u7247\u3001\u591A\u540E\u7AEF\u7684\u5927\u6A21\u578B\u6846\u67B6\uFF0C\u63D0\u4F9B\u8986\u76D6\u8BAD\u7EC3\u3001\u5FAE\u8C03\u4E0E\u63A8\u7406\u90E8\u7F72\u7684\u5168\u6D41\u7A0B\u80FD\u529B" : "A unified multi-backend large model framework across diverse chips, providing end-to-end capabilities spanning training, fine-tuning, and inference deployment.",
|
|
648
|
+
type: "route"
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
id: "flaggems",
|
|
652
|
+
label: "FlagGems",
|
|
653
|
+
path: "/FlagGems",
|
|
654
|
+
desc: isZh ? "\u57FA\u4E8ETriton\u5B9E\u73B0\u7684\u9AD8\u6027\u80FD\u901A\u7528\u7B97\u5B50\u5E93" : "A high-performance general operator library built on Triton.",
|
|
655
|
+
type: "route"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
id: "flagtree",
|
|
659
|
+
label: "FlagTree",
|
|
660
|
+
path: "/FlagTree",
|
|
661
|
+
desc: isZh ? "\u9762\u5411\u591A\u79CD\u786C\u4EF6\u7684\u5F00\u6E90\u3001\u7EDF\u4E00AI\u7F16\u8BD1\u5668" : "An open-source unified AI compiler for diverse hardware.",
|
|
662
|
+
type: "route"
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
id: "flagcx",
|
|
666
|
+
label: "FlagCX",
|
|
667
|
+
path: "/FlagCX",
|
|
668
|
+
desc: isZh ? "\u4E00\u6B3E\u4E13\u4E3A\u5927\u89C4\u6A21AI\u7CFB\u7EDF\u8BBE\u8BA1\u7684\u53EF\u6269\u5C55\u3001\u81EA\u9002\u5E94\u9AD8\u6027\u80FD\u8DE8\u82AF\u7247\u901A\u4FE1\u5E93" : "A scalable, adaptive, high-performance cross-chip communication library designed for large-scale AI systems.",
|
|
669
|
+
type: "route"
|
|
670
|
+
}
|
|
671
|
+
]
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
id: "ecosystem",
|
|
675
|
+
label: isZh ? "\u751F\u6001\u4F7F\u80FD\u9879\u76EE" : "FlagOS Ecosystem Enablement Project",
|
|
676
|
+
list: [
|
|
677
|
+
{
|
|
678
|
+
id: "megatronfl",
|
|
679
|
+
label: "Megatron-FL",
|
|
680
|
+
path: "https://github.com/flagos-ai/Megatron-LM-FL",
|
|
681
|
+
desc: isZh ? "\u4E3AMegatron-LM\u6253\u9020\u7684\u591A\u82AF\u7247\u63D2\u4EF6\uFF0C\u5B9E\u73B0\u5927\u6A21\u578B\u591A\u82AF\u7247\u9AD8\u6548\u8BAD\u7EC3" : "A multi-chip plugin for Megatron-LM, enabling efficient large-scale training across diverse chips.",
|
|
682
|
+
type: "link"
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
id: "vllmpluginfl",
|
|
686
|
+
label: "vLLM-plugin-FL",
|
|
687
|
+
path: "https://github.com/flagos-ai/vllm-plugin-FL",
|
|
688
|
+
desc: isZh ? "\u4E3AvLLM\u6253\u9020\u7684\u591A\u82AF\u7247\u63D2\u4EF6\uFF0C\u5B9E\u73B0\u5927\u6A21\u578B\u591A\u82AF\u7247\u9AD8\u6548\u63A8\u7406\u90E8\u7F72" : "A multi-chip plugin for vLLM, enabling efficient large model inference and deployment across diverse chips.",
|
|
689
|
+
type: "link"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
id: "transformerenginefl",
|
|
693
|
+
label: "TransformerEngine-FL",
|
|
694
|
+
path: "https://github.com/flagos-ai/TransformerEngine-FL",
|
|
695
|
+
desc: isZh ? "\u4E3ATransformerEngine\u6253\u9020\u7684\u591A\u82AF\u7247\u63D2\u4EF6\uFF0C\u5B9E\u73B0\u591A\u79CD\u82AF\u7247\u4E0A\u5206\u5E03\u5F0F\u7B97\u5B50" : "A multi-chip plugin for TransformerEngine, enabling distributed operators across diverse chip architectures.",
|
|
696
|
+
type: "link"
|
|
697
|
+
}
|
|
698
|
+
]
|
|
699
|
+
}
|
|
700
|
+
]
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
id: "tools",
|
|
704
|
+
label: isZh ? "\u5DE5\u5177" : "Tools",
|
|
705
|
+
dropdownList: [
|
|
706
|
+
{
|
|
707
|
+
id: "skill",
|
|
708
|
+
label: isZh ? "Skill\u5E7F\u573A" : "SkillHub",
|
|
709
|
+
path: resolvePath("/SkillHub"),
|
|
710
|
+
desc: isZh ? "\u4E00\u7AD9\u5F0FAI\u8BA1\u7B97\u6280\u80FD\u5E93" : "One-stop AI computing skills library.",
|
|
711
|
+
type: "route"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
id: "onlinelab",
|
|
715
|
+
label: isZh ? "\u7EBF\u4E0A\u5B9E\u9A8C\u5BA4" : "Online Laboratory",
|
|
716
|
+
path: isMainApp() ? "/OnlineLab" : resolvePath("/OnlineLab"),
|
|
717
|
+
desc: isZh ? "\u5F00\u7BB1\u5373\u7528\u7684\u5728\u7EBF\u5B9E\u9A8C\u73AF\u5883" : "Ready-to-use online experiment environment.",
|
|
718
|
+
type: "route"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
id: "modelplatform",
|
|
722
|
+
label: isZh ? "\u6A21\u578B\u670D\u52A1\u5E73\u53F0" : "MaaS",
|
|
723
|
+
path: "",
|
|
724
|
+
desc: isZh ? "\u5168\u751F\u547D\u5468\u671F\u5927\u6A21\u578BAPI\u670D\u52A1\u5E73\u53F0" : "A full-lifecycle API service platform for large models.",
|
|
725
|
+
type: "unopen"
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
id: "kernelgen",
|
|
729
|
+
label: "KernelGen",
|
|
730
|
+
path: "https://kernelgen.flagos.io/",
|
|
731
|
+
desc: isZh ? "\u5206\u949F\u7EA7\u6784\u5EFAKernel\uFF0C\u652F\u6301\u591A\u82AF\u7247\u540E\u7AEF" : "Build Kernels in Minutes with Multi-Backend Support.",
|
|
732
|
+
type: "link"
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
id: "flagrelease",
|
|
736
|
+
label: "FlagRelease",
|
|
737
|
+
path: "",
|
|
738
|
+
desc: isZh ? "\u4E00\u5957\u81EA\u52A8\u5316\u8FC1\u79FB\u5927\u6A21\u578B\u81F3\u4E0D\u540C\u786C\u4EF6\u4EA7\u54C1\u7684\u5DE5\u5177\u5E73\u53F0" : "An automated tool platform for migrating large model to diverse hardware.",
|
|
739
|
+
type: "unopen"
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
id: "flagcicd",
|
|
743
|
+
label: "FlagCICD",
|
|
744
|
+
path: "",
|
|
745
|
+
desc: isZh ? "\u9762\u5411 AI \u5F00\u53D1\u7684\u6301\u7EED\u96C6\u6210 / \u6301\u7EED\u90E8\u7F72\u5DE5\u5177\u94FE" : "A CI/CD toolchain for AI development.",
|
|
746
|
+
type: "unopen"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
id: "flagmodelhub",
|
|
750
|
+
label: isZh ? "\u4E5D\u9F0EAI\u4E00\u4F53\u5316\u5E73\u53F0" : "Jiuding AI Integrated Platform",
|
|
751
|
+
path: "",
|
|
752
|
+
desc: isZh ? "\u6574\u5408 FlagOS \u5168\u6808\u80FD\u529B\uFF0C\u63D0\u4F9B\u4ECE\u6A21\u578B\u5F00\u53D1\u3001\u8BAD\u7EC3\u5230\u90E8\u7F72\u7684\u4E00\u7AD9\u5F0F AI \u5DE5\u7A0B\u5316\u5E73\u53F0" : "Jiuding AI Platform.",
|
|
753
|
+
type: "unopen"
|
|
754
|
+
}
|
|
755
|
+
]
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
id: "docs",
|
|
759
|
+
label: isZh ? "\u6587\u6863" : "Docs"
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
id: "learn",
|
|
763
|
+
label: isZh ? "\u5B66\u4E60" : "Learn",
|
|
764
|
+
dropdownList: [
|
|
765
|
+
{
|
|
766
|
+
id: "wiki",
|
|
767
|
+
label: "Wiki",
|
|
768
|
+
desc: isZh ? "\u667A\u80FD\u6587\u6863\uFF0C\u8FB9\u770B\u8FB9\u95EE\u8FB9\u5B66" : "AI-powered interactive docs: query and learn in real-time.",
|
|
769
|
+
path: `https://wiki.flagos.io`,
|
|
770
|
+
type: "link"
|
|
771
|
+
},
|
|
772
|
+
{ id: "professionalcourse", label: isZh ? "\u4E13\u4E1A\u8BFE" : "Core Courses", desc: isZh ? "\u4F17\u667AFlagOS\u7CFB\u5217\u5F00\u6E90\u8BFE\u7A0B" : "The official open-source course series for the FlagOS ecosystem.", path: "https://flagos.educoder.net/paths", type: "link" },
|
|
773
|
+
{ id: "course", label: isZh ? "\u8BB2\u5EA7" : "Tech Talks", desc: isZh ? "\u5927\u5496\u5206\u4EAB\uFF0C\u4E1A\u754C\u524D\u6CBF\u8BB2\u5EA7" : "Cutting-edge insights and deep dives from industry leaders.", path: "/LearnCenter", type: "route" }
|
|
774
|
+
]
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
id: "events",
|
|
778
|
+
label: isZh ? "\u6D3B\u52A8\u8D5B\u4E8B" : "Event & Competition",
|
|
779
|
+
path: isMainApp() ? "/events" : resolvePath("/events")
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
id: "onlinelab-top",
|
|
783
|
+
label: isZh ? "\u7EBF\u4E0A\u5B9E\u9A8C\u5BA4" : "Online Laboratory",
|
|
784
|
+
path: isMainApp() ? "/OnlineLab" : resolvePath("/OnlineLab")
|
|
785
|
+
}
|
|
786
|
+
];
|
|
787
|
+
};
|
|
788
|
+
const resolvePath = (path) => {
|
|
789
|
+
if (mainProdHost.includes(location.hostname)) {
|
|
790
|
+
return `https://${location.hostname}${path}`;
|
|
791
|
+
} else {
|
|
792
|
+
return `${location.protocol}//${path.slice(1).toLocaleLowerCase()}.${mainDevHost[0]}`;
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
const resolveMenuPaths = (items) => {
|
|
796
|
+
return items;
|
|
797
|
+
};
|
|
798
|
+
const getNavMenuApi = (lang) => {
|
|
799
|
+
return resolveMenuPaths(buildMenu(lang));
|
|
800
|
+
};
|
|
801
|
+
const openLink = (url) => {
|
|
802
|
+
window.open(url, "_blank");
|
|
803
|
+
};
|
|
804
|
+
function useHeaderMenu(currentLocale, route, router, unopenTip) {
|
|
805
|
+
const menuList = ref([]);
|
|
806
|
+
const fetchMenu = (lang) => {
|
|
807
|
+
var _a;
|
|
808
|
+
const data = getNavMenuApi(lang);
|
|
809
|
+
const activeId = (_a = menuList.value.find((m) => m.active)) == null ? void 0 : _a.id;
|
|
810
|
+
menuList.value = data.map((m) => ({ ...m, active: m.id === activeId }));
|
|
811
|
+
};
|
|
812
|
+
watch(currentLocale, (lang) => fetchMenu(lang), { immediate: true });
|
|
813
|
+
const syncActiveMenu = () => {
|
|
814
|
+
menuList.value.forEach((item) => item.active = false);
|
|
815
|
+
const curIdx = menuList.value.findIndex((item) => {
|
|
816
|
+
if (item.dropdownList) {
|
|
817
|
+
return item.dropdownList.some((child) => matchPath(route == null ? void 0 : route.path, child.path));
|
|
818
|
+
}
|
|
819
|
+
if (item.dropdownGroups) {
|
|
820
|
+
return item.dropdownGroups.some(
|
|
821
|
+
(group) => group.list.some((child) => matchPath(route == null ? void 0 : route.path, child.path))
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
if (matchPath(item.path, "/events") && matchAnyPath(route == null ? void 0 : route.path, ["/EventDetail", "/RaceDetail"]))
|
|
825
|
+
return true;
|
|
826
|
+
if (item.id === "onlinelab-top" && matchPath(route == null ? void 0 : route.path, "/OnlineLab"))
|
|
827
|
+
return true;
|
|
828
|
+
return matchPath(route == null ? void 0 : route.path, item.path);
|
|
829
|
+
});
|
|
830
|
+
if (curIdx >= 0)
|
|
831
|
+
menuList.value[curIdx].active = true;
|
|
832
|
+
};
|
|
833
|
+
const handleJumpPage = (menu, childMenu) => {
|
|
834
|
+
const tip = typeof unopenTip === "string" ? unopenTip : unopenTip.value;
|
|
835
|
+
if (["tools", "projects", "learn"].includes(menu.id)) {
|
|
836
|
+
if (!childMenu)
|
|
837
|
+
return;
|
|
838
|
+
if (childMenu.path.startsWith("http"))
|
|
839
|
+
return openLink(childMenu.path);
|
|
840
|
+
if (childMenu.path)
|
|
841
|
+
return router.push(childMenu.path);
|
|
842
|
+
if (childMenu.type === "unopen")
|
|
843
|
+
return ElMessage.warning(tip);
|
|
844
|
+
}
|
|
845
|
+
if (menu.id === "docs")
|
|
846
|
+
return openLink("https://docs.flagos.io/");
|
|
847
|
+
menuList.value.forEach((item) => item.active = false);
|
|
848
|
+
menu.active = true;
|
|
849
|
+
router.push(childMenu ? childMenu.path : menu.path);
|
|
850
|
+
};
|
|
851
|
+
return { menuList, syncActiveMenu, handleJumpPage };
|
|
852
|
+
}
|
|
853
|
+
function useHeaderTheme(route) {
|
|
854
|
+
const lastScrollTop = ref(0);
|
|
855
|
+
const isWhiteTheme = ref(false);
|
|
856
|
+
const isScrolledTheme = ref(false);
|
|
857
|
+
const SCROLL_THRESHOLDS = {
|
|
858
|
+
home: { getThreshold: () => window.innerHeight - 80 },
|
|
859
|
+
events: { getThreshold: () => 390 - 80 },
|
|
860
|
+
onlineLab: { getThreshold: () => 180 - 80 }
|
|
861
|
+
};
|
|
862
|
+
const updateThemeByScroll = (scrollTop, threshold) => {
|
|
863
|
+
if (scrollTop > threshold) {
|
|
864
|
+
isWhiteTheme.value = false;
|
|
865
|
+
isScrolledTheme.value = true;
|
|
866
|
+
} else {
|
|
867
|
+
isWhiteTheme.value = true;
|
|
868
|
+
isScrolledTheme.value = false;
|
|
869
|
+
}
|
|
870
|
+
lastScrollTop.value = scrollTop <= 0 ? 0 : scrollTop;
|
|
871
|
+
};
|
|
872
|
+
const handleScroll = throttle(() => {
|
|
873
|
+
const scrollTop = window.scrollY || document.documentElement.scrollTop || 0;
|
|
874
|
+
updateThemeByScroll(scrollTop, SCROLL_THRESHOLDS.home.getThreshold());
|
|
875
|
+
}, 200);
|
|
876
|
+
const handleEventsScroll = throttle(() => {
|
|
877
|
+
const scrollTop = window.scrollY || document.documentElement.scrollTop || 0;
|
|
878
|
+
const threshold = matchPath(route == null ? void 0 : route.path, "/OnlineLab") ? SCROLL_THRESHOLDS.onlineLab.getThreshold() : SCROLL_THRESHOLDS.events.getThreshold();
|
|
879
|
+
updateThemeByScroll(scrollTop, threshold);
|
|
880
|
+
}, 200);
|
|
881
|
+
const bindByRoute = () => {
|
|
882
|
+
window.removeEventListener("scroll", handleScroll);
|
|
883
|
+
window.removeEventListener("scroll", handleEventsScroll);
|
|
884
|
+
if (matchPath(route == null ? void 0 : route.path, "/Home")) {
|
|
885
|
+
isWhiteTheme.value = true;
|
|
886
|
+
isScrolledTheme.value = false;
|
|
887
|
+
window.addEventListener("scroll", handleScroll);
|
|
888
|
+
nextTick(() => handleScroll());
|
|
889
|
+
} else if (matchAnyPath(route == null ? void 0 : route.path, ["/events", "/EventDetail", "/RaceDetail", "/OnlineLab"])) {
|
|
890
|
+
isWhiteTheme.value = true;
|
|
891
|
+
isScrolledTheme.value = false;
|
|
892
|
+
window.addEventListener("scroll", handleEventsScroll);
|
|
893
|
+
nextTick(() => handleEventsScroll());
|
|
894
|
+
} else {
|
|
895
|
+
isWhiteTheme.value = false;
|
|
896
|
+
isScrolledTheme.value = false;
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
onMounted(() => bindByRoute());
|
|
900
|
+
onUnmounted(() => {
|
|
901
|
+
window.removeEventListener("scroll", handleScroll);
|
|
902
|
+
window.removeEventListener("scroll", handleEventsScroll);
|
|
903
|
+
});
|
|
904
|
+
return { lastScrollTop, isWhiteTheme, isScrolledTheme, bindByRoute, handleScroll, handleEventsScroll };
|
|
905
|
+
}
|
|
906
|
+
const index = {
|
|
907
|
+
install(app) {
|
|
908
|
+
app.component("MyButton", MyButton);
|
|
909
|
+
app.component("MyTable", MyTable);
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
export {
|
|
913
|
+
Header,
|
|
914
|
+
LocaleTypeEnum,
|
|
915
|
+
MyButton,
|
|
916
|
+
MyTable,
|
|
917
|
+
NAV_LANG_TO_LOCALE,
|
|
918
|
+
NAV_LOCALE_OPTIONS,
|
|
919
|
+
NAV_LOCALE_TO_LANG,
|
|
920
|
+
NAV_TEXTS_KEY,
|
|
921
|
+
NAV_WIKI_LANG_BY_LOCALE,
|
|
922
|
+
Avatar as NavAvatar,
|
|
923
|
+
Header as NavHeader,
|
|
924
|
+
_sfc_main$1 as NavLocale,
|
|
925
|
+
_sfc_main$2 as NavLogin,
|
|
926
|
+
buildNavTexts,
|
|
927
|
+
index as default,
|
|
928
|
+
getNavMenuApi,
|
|
929
|
+
matchAnyPath,
|
|
930
|
+
matchPath,
|
|
931
|
+
useHeaderMenu,
|
|
932
|
+
useHeaderTheme
|
|
933
|
+
};
|
|
934
|
+
//# sourceMappingURL=index.esm.js.map
|