x-star-design 0.0.64 → 0.0.66
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/anchor-x-tabs/index.d.ts +13 -0
- package/dist/anchor-x-tabs/index.js +88 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/locales/en_US.d.ts +3 -0
- package/dist/locales/en_US.js +3 -0
- package/dist/locales/index.d.ts +7 -1
- package/dist/locales/zh_CN.d.ts +3 -0
- package/dist/locales/zh_CN.js +3 -0
- package/dist/micro-app/index.d.ts +18 -0
- package/dist/micro-app/index.js +120 -0
- package/dist/styles/index.css +35 -0
- package/dist/submission-status/index.d.ts +1 -1
- package/dist/submission-status/index.js +5 -5
- package/dist/utils/color.d.ts +8 -0
- package/dist/utils/color.js +20 -0
- package/dist/x-tabs/index.js +3 -19
- package/package.json +6 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AnchorTabProps {
|
|
3
|
+
items: {
|
|
4
|
+
key: string;
|
|
5
|
+
title: string;
|
|
6
|
+
icon: React.ReactNode;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}[];
|
|
9
|
+
rootMargin?: string;
|
|
10
|
+
stickyOffset?: number;
|
|
11
|
+
}
|
|
12
|
+
declare const AnchorXTabs: ({ items, rootMargin, stickyOffset, }: AnchorTabProps) => React.JSX.Element;
|
|
13
|
+
export default AnchorXTabs;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import { useInViewport, useMemoizedFn } from 'ahooks';
|
|
4
|
+
import { Flex } from 'antd';
|
|
5
|
+
import { ConfigContext } from 'antd/es/config-provider';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
8
|
+
import { hexToRgb } from "../utils/color";
|
|
9
|
+
import { prefix } from "../utils/global";
|
|
10
|
+
var AnchorXTabs = function AnchorXTabs(_ref) {
|
|
11
|
+
var _theme$token;
|
|
12
|
+
var items = _ref.items,
|
|
13
|
+
_ref$rootMargin = _ref.rootMargin,
|
|
14
|
+
rootMargin = _ref$rootMargin === void 0 ? '-50% 0px -50% 0px' : _ref$rootMargin,
|
|
15
|
+
_ref$stickyOffset = _ref.stickyOffset,
|
|
16
|
+
stickyOffset = _ref$stickyOffset === void 0 ? 64 : _ref$stickyOffset;
|
|
17
|
+
var colorThemeRef = useRef(null);
|
|
18
|
+
var _useContext = useContext(ConfigContext),
|
|
19
|
+
theme = _useContext.theme;
|
|
20
|
+
var _ref2 = (_theme$token = theme === null || theme === void 0 ? void 0 : theme.token) !== null && _theme$token !== void 0 ? _theme$token : {},
|
|
21
|
+
_ref2$colorPrimary = _ref2.colorPrimary,
|
|
22
|
+
colorPrimary = _ref2$colorPrimary === void 0 ? '#1990fe' : _ref2$colorPrimary;
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
var _colorThemeRef$curren, _colorThemeRef$curren2;
|
|
25
|
+
// 设置主题色
|
|
26
|
+
(_colorThemeRef$curren = colorThemeRef.current) === null || _colorThemeRef$curren === void 0 ? void 0 : _colorThemeRef$curren.style.setProperty('--anchor-x-tabs-primary-color', colorPrimary);
|
|
27
|
+
(_colorThemeRef$curren2 = colorThemeRef.current) === null || _colorThemeRef$curren2 === void 0 ? void 0 : _colorThemeRef$curren2.style.setProperty('--anchor-x-tabs-secondary-color', hexToRgb(colorPrimary, 0.15));
|
|
28
|
+
}, [colorPrimary]);
|
|
29
|
+
var targetRef = useRef([]);
|
|
30
|
+
var _useState = useState(''),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
activeItem = _useState2[0],
|
|
33
|
+
setActiveItem = _useState2[1];
|
|
34
|
+
var callback = useMemoizedFn(function (entry) {
|
|
35
|
+
if (entry.isIntersecting) {
|
|
36
|
+
var key = entry.target.getAttribute('id');
|
|
37
|
+
setActiveItem(key);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var handleMenuClick = function handleMenuClick(key) {
|
|
41
|
+
var element = document.getElementById(key);
|
|
42
|
+
element === null || element === void 0 ? void 0 : element.scrollIntoView({
|
|
43
|
+
behavior: 'smooth',
|
|
44
|
+
block: 'center',
|
|
45
|
+
inline: 'nearest'
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
useInViewport(targetRef.current, {
|
|
49
|
+
callback: callback,
|
|
50
|
+
rootMargin: rootMargin
|
|
51
|
+
});
|
|
52
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
53
|
+
"data-testid": "container",
|
|
54
|
+
gap: 30
|
|
55
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
ref: colorThemeRef,
|
|
57
|
+
className: "".concat(prefix, "-anchor-x-tabs")
|
|
58
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
style: {
|
|
60
|
+
position: 'sticky',
|
|
61
|
+
top: stickyOffset
|
|
62
|
+
}
|
|
63
|
+
}, items.map(function (item) {
|
|
64
|
+
var isActive = item.key === activeItem;
|
|
65
|
+
var anchorItemClassName = classNames("".concat(prefix, "-anchor-item"), _defineProperty({}, "".concat(prefix, "-active"), isActive));
|
|
66
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
"data-testid": "anchor-x-tabs-".concat(item.key),
|
|
68
|
+
key: item.key,
|
|
69
|
+
className: anchorItemClassName,
|
|
70
|
+
onClick: function onClick() {
|
|
71
|
+
return handleMenuClick(item.key);
|
|
72
|
+
}
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "".concat(prefix, "-icon")
|
|
75
|
+
}, item.icon), /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "".concat(prefix, "-title")
|
|
77
|
+
}, item.title));
|
|
78
|
+
}))), /*#__PURE__*/React.createElement("div", null, items.map(function (item, index) {
|
|
79
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
key: item.key,
|
|
81
|
+
ref: function ref(el) {
|
|
82
|
+
return targetRef.current[index] = el;
|
|
83
|
+
},
|
|
84
|
+
id: item.key
|
|
85
|
+
}, item.children);
|
|
86
|
+
})));
|
|
87
|
+
};
|
|
88
|
+
export default AnchorXTabs;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as AcAnimation } from './ac-animation';
|
|
2
2
|
export { default as Aliplayer } from './aliplayer';
|
|
3
3
|
export type { AliplayerConfig, AliplayerInstance } from './aliplayer';
|
|
4
|
+
export { default as AnchorXTabs } from './anchor-x-tabs';
|
|
4
5
|
export { default as CodeDetailModal } from './code-detail-modal';
|
|
5
6
|
export { default as CodeMirrorWrapper } from './code-mirror-wrapper';
|
|
6
7
|
export { LangId, Language, Theme } from './code-mirror-wrapper/define';
|
|
@@ -12,6 +13,7 @@ export { default as Feedback } from './feedback';
|
|
|
12
13
|
export { default as InputNumbers } from './input-numbers';
|
|
13
14
|
export { default as LoadingMask } from './loading-mask';
|
|
14
15
|
export { LocaleProvider } from './locales';
|
|
16
|
+
export { default as MicroApp } from './micro-app';
|
|
15
17
|
export { default as RainbowCat } from './rainbow-cat';
|
|
16
18
|
export { default as SortTable } from './sort-table';
|
|
17
19
|
export { default as StatusTag } from './status-tag';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as AcAnimation } from "./ac-animation";
|
|
2
2
|
export { default as Aliplayer } from "./aliplayer";
|
|
3
|
+
export { default as AnchorXTabs } from "./anchor-x-tabs";
|
|
3
4
|
export { default as CodeDetailModal } from "./code-detail-modal";
|
|
4
5
|
export { default as CodeMirrorWrapper } from "./code-mirror-wrapper";
|
|
5
6
|
export { LangId, Language, Theme } from "./code-mirror-wrapper/define";
|
|
@@ -10,6 +11,7 @@ export { default as Feedback } from "./feedback";
|
|
|
10
11
|
export { default as InputNumbers } from "./input-numbers";
|
|
11
12
|
export { default as LoadingMask } from "./loading-mask";
|
|
12
13
|
export { LocaleProvider } from "./locales";
|
|
14
|
+
export { default as MicroApp } from "./micro-app";
|
|
13
15
|
export { default as RainbowCat } from "./rainbow-cat";
|
|
14
16
|
export { default as SortTable } from "./sort-table";
|
|
15
17
|
export { default as StatusTag } from "./status-tag";
|
package/dist/locales/en_US.d.ts
CHANGED
|
@@ -77,5 +77,8 @@ declare const _default: {
|
|
|
77
77
|
readonly FEEDBACK_MESSAGE_2: "Please check the feedback type";
|
|
78
78
|
readonly FEEDBACK_MESSAGE_3: "Please fill in the feedback content";
|
|
79
79
|
};
|
|
80
|
+
readonly MicroApp: {
|
|
81
|
+
readonly Loading: "Loading";
|
|
82
|
+
};
|
|
80
83
|
};
|
|
81
84
|
export default _default;
|
package/dist/locales/en_US.js
CHANGED
package/dist/locales/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ interface LocaleProviderProps {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const LocaleProvider: ({ children, locale, }: LocaleProviderProps) => React.JSX.Element;
|
|
9
9
|
type MessageMap = typeof zh_CN | typeof en_US;
|
|
10
|
-
export declare const useLocale: <T extends "VisualDataConfig" | "TranslateButton" | "CodeDetailModal" | "ContactButton" | "ErrorPage" | "Feedback">(slice: T) => {
|
|
10
|
+
export declare const useLocale: <T extends "VisualDataConfig" | "TranslateButton" | "CodeDetailModal" | "ContactButton" | "ErrorPage" | "Feedback" | "MicroApp">(slice: T) => {
|
|
11
11
|
locale: string;
|
|
12
12
|
format: <U extends keyof MessageMap[T]>(key: U) => ({
|
|
13
13
|
readonly VisualDataConfig: {
|
|
@@ -88,6 +88,9 @@ export declare const useLocale: <T extends "VisualDataConfig" | "TranslateButton
|
|
|
88
88
|
readonly FEEDBACK_MESSAGE_2: "请勾选反馈类型";
|
|
89
89
|
readonly FEEDBACK_MESSAGE_3: "请填写反馈内容";
|
|
90
90
|
};
|
|
91
|
+
readonly MicroApp: {
|
|
92
|
+
readonly Loading: "加载中";
|
|
93
|
+
};
|
|
91
94
|
} | {
|
|
92
95
|
readonly VisualDataConfig: {
|
|
93
96
|
readonly Time_MS: "Time Limit(MS)";
|
|
@@ -167,6 +170,9 @@ export declare const useLocale: <T extends "VisualDataConfig" | "TranslateButton
|
|
|
167
170
|
readonly FEEDBACK_MESSAGE_2: "Please check the feedback type";
|
|
168
171
|
readonly FEEDBACK_MESSAGE_3: "Please fill in the feedback content";
|
|
169
172
|
};
|
|
173
|
+
readonly MicroApp: {
|
|
174
|
+
readonly Loading: "Loading";
|
|
175
|
+
};
|
|
170
176
|
})[T][U];
|
|
171
177
|
};
|
|
172
178
|
export {};
|
package/dist/locales/zh_CN.d.ts
CHANGED
package/dist/locales/zh_CN.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface MicroAppProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
name: string;
|
|
7
|
+
entry: string;
|
|
8
|
+
pathname: string;
|
|
9
|
+
microProps?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
declare const MicroApp: {
|
|
12
|
+
({ className, style, name, entry, pathname, microProps, }: MicroAppProps): React.JSX.Element;
|
|
13
|
+
useGlobalState({ lang, setLang, }: {
|
|
14
|
+
lang: 'zh' | 'en';
|
|
15
|
+
setLang: (lang?: 'zh' | 'en') => void;
|
|
16
|
+
}): void;
|
|
17
|
+
};
|
|
18
|
+
export default MicroApp;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
import { initGlobalState, loadMicroApp } from 'qiankun';
|
|
5
|
+
import React, { useEffect, useMemo } from 'react';
|
|
6
|
+
import ReactDOM from 'react-dom/client';
|
|
7
|
+
import { randomString } from 'x-star-utils';
|
|
8
|
+
import { useLocale } from "../locales";
|
|
9
|
+
import RainbowCat from "../rainbow-cat";
|
|
10
|
+
var MicroApp = function MicroApp(_ref) {
|
|
11
|
+
var className = _ref.className,
|
|
12
|
+
style = _ref.style,
|
|
13
|
+
name = _ref.name,
|
|
14
|
+
entry = _ref.entry,
|
|
15
|
+
pathname = _ref.pathname,
|
|
16
|
+
microProps = _ref.microProps;
|
|
17
|
+
var microAppId = useMemo(function () {
|
|
18
|
+
return "microapp-".concat(randomString(8));
|
|
19
|
+
}, []);
|
|
20
|
+
var _useLocale = useLocale('MicroApp'),
|
|
21
|
+
t = _useLocale.format;
|
|
22
|
+
useEffect(function () {
|
|
23
|
+
// 创建一个加载元素
|
|
24
|
+
var rainbowCatContainer = null;
|
|
25
|
+
var showLoading = /*#__PURE__*/function () {
|
|
26
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
27
|
+
var microAppContainer;
|
|
28
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29
|
+
while (1) switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
// 加载子应用前,创建一个容器并挂载 RainbowCat 组件
|
|
32
|
+
rainbowCatContainer = document.createElement('div');
|
|
33
|
+
rainbowCatContainer.style.position = 'absolute';
|
|
34
|
+
rainbowCatContainer.style.top = '0';
|
|
35
|
+
rainbowCatContainer.style.left = '0';
|
|
36
|
+
rainbowCatContainer.style.width = '100%';
|
|
37
|
+
microAppContainer = document.getElementById(microAppId);
|
|
38
|
+
microAppContainer.append(rainbowCatContainer);
|
|
39
|
+
ReactDOM.createRoot(rainbowCatContainer).render( /*#__PURE__*/React.createElement(RainbowCat, {
|
|
40
|
+
text: t('Loading')
|
|
41
|
+
}));
|
|
42
|
+
case 8:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
return function showLoading() {
|
|
49
|
+
return _ref2.apply(this, arguments);
|
|
50
|
+
};
|
|
51
|
+
}();
|
|
52
|
+
var hideLoading = /*#__PURE__*/function () {
|
|
53
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
54
|
+
var _rainbowCatContainer;
|
|
55
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
56
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
57
|
+
case 0:
|
|
58
|
+
// 挂载子应用前,卸载 RainbowCat 组件
|
|
59
|
+
(_rainbowCatContainer = rainbowCatContainer) === null || _rainbowCatContainer === void 0 ? void 0 : _rainbowCatContainer.remove();
|
|
60
|
+
rainbowCatContainer = null;
|
|
61
|
+
case 2:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context2.stop();
|
|
64
|
+
}
|
|
65
|
+
}, _callee2);
|
|
66
|
+
}));
|
|
67
|
+
return function hideLoading() {
|
|
68
|
+
return _ref3.apply(this, arguments);
|
|
69
|
+
};
|
|
70
|
+
}();
|
|
71
|
+
|
|
72
|
+
// 启动 qiankun
|
|
73
|
+
var microApp = loadMicroApp({
|
|
74
|
+
name: name,
|
|
75
|
+
entry: entry,
|
|
76
|
+
container: "#".concat(microAppId),
|
|
77
|
+
props: _objectSpread({
|
|
78
|
+
pathname: pathname
|
|
79
|
+
}, microProps)
|
|
80
|
+
}, undefined, {
|
|
81
|
+
beforeLoad: showLoading,
|
|
82
|
+
beforeMount: hideLoading
|
|
83
|
+
});
|
|
84
|
+
return function () {
|
|
85
|
+
microApp.unmount();
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
88
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
id: microAppId,
|
|
90
|
+
className: className,
|
|
91
|
+
style: _objectSpread({
|
|
92
|
+
position: 'relative',
|
|
93
|
+
minHeight: 600
|
|
94
|
+
}, style)
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
MicroApp.useGlobalState = function (_ref4) {
|
|
98
|
+
var lang = _ref4.lang,
|
|
99
|
+
setLang = _ref4.setLang;
|
|
100
|
+
var actions = useMemo(function () {
|
|
101
|
+
return initGlobalState({
|
|
102
|
+
lang: lang
|
|
103
|
+
});
|
|
104
|
+
}, []); // 初始化全局状态
|
|
105
|
+
|
|
106
|
+
useEffect(function () {
|
|
107
|
+
actions.onGlobalStateChange(function (state) {
|
|
108
|
+
return setLang(state.lang);
|
|
109
|
+
}); // 微应用切换语言时同步给主应用
|
|
110
|
+
return function () {
|
|
111
|
+
actions.offGlobalStateChange();
|
|
112
|
+
};
|
|
113
|
+
}, []);
|
|
114
|
+
useEffect(function () {
|
|
115
|
+
actions.setGlobalState({
|
|
116
|
+
lang: lang
|
|
117
|
+
}); // 主应用切换语言时同步给微应用
|
|
118
|
+
}, [lang]);
|
|
119
|
+
};
|
|
120
|
+
export default MicroApp;
|
package/dist/styles/index.css
CHANGED
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
|
+
.x-star-design-anchor-x-tabs {
|
|
3
|
+
width: 120px;
|
|
4
|
+
background-color: var(--anchor-x-tabs-secondary-color);
|
|
5
|
+
}
|
|
6
|
+
.x-star-design-anchor-x-tabs .x-star-design-anchor-item {
|
|
7
|
+
min-height: 120px;
|
|
8
|
+
padding: 14px;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
word-break: break-all;
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
color: #a5a5a5;
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
.x-star-design-anchor-x-tabs .x-star-design-anchor-item .x-star-design-icon {
|
|
21
|
+
font-size: 40px;
|
|
22
|
+
color: #a5a5a5;
|
|
23
|
+
}
|
|
24
|
+
.x-star-design-anchor-x-tabs .x-star-design-anchor-item .x-star-design-title {
|
|
25
|
+
text-align: center;
|
|
26
|
+
}
|
|
27
|
+
.x-star-design-anchor-x-tabs .x-star-design-active {
|
|
28
|
+
color: var(--anchor-x-tabs-primary-color);
|
|
29
|
+
background-color: #fff;
|
|
30
|
+
border-left: 6px solid var(--anchor-x-tabs-primary-color);
|
|
31
|
+
}
|
|
32
|
+
.x-star-design-anchor-x-tabs .x-star-design-active .x-star-design-icon {
|
|
33
|
+
font-size: 40px;
|
|
34
|
+
color: var(--anchor-x-tabs-primary-color);
|
|
35
|
+
}
|
|
36
|
+
|
|
2
37
|
.x-star-design-codeDetailModal .x-star-design-codeCompileResult {
|
|
3
38
|
padding: 10px 20px;
|
|
4
39
|
background-color: #fafafa;
|
|
@@ -5,6 +5,7 @@ export declare enum Status {
|
|
|
5
5
|
CheckerJudgementFailed = "Checker Judgement Failed",
|
|
6
6
|
CompileError = "Compile Error",
|
|
7
7
|
DangerousSyscall = "Dangerous Syscall",
|
|
8
|
+
Hidden = "Hidden",
|
|
8
9
|
JudgeFailed = "Judge Failed",
|
|
9
10
|
JudgementFailed = "Judgement Failed",
|
|
10
11
|
MemoryLimitExceeded = "Memory Limit Exceeded",
|
|
@@ -16,7 +17,6 @@ export declare enum Status {
|
|
|
16
17
|
Skipped = "Skipped",
|
|
17
18
|
SpecialJudgeError = "Special Judge Error",
|
|
18
19
|
TimeLimitExceeded = "Time Limit Exceeded",
|
|
19
|
-
Unknown = "Unknown",
|
|
20
20
|
WrongAnswer = "Wrong Answer"
|
|
21
21
|
}
|
|
22
22
|
interface SubmissionStatusProps {
|
|
@@ -9,6 +9,7 @@ export var Status = /*#__PURE__*/function (Status) {
|
|
|
9
9
|
Status["CheckerJudgementFailed"] = "Checker Judgement Failed";
|
|
10
10
|
Status["CompileError"] = "Compile Error";
|
|
11
11
|
Status["DangerousSyscall"] = "Dangerous Syscall";
|
|
12
|
+
Status["Hidden"] = "Hidden";
|
|
12
13
|
Status["JudgeFailed"] = "Judge Failed";
|
|
13
14
|
Status["JudgementFailed"] = "Judgement Failed";
|
|
14
15
|
Status["MemoryLimitExceeded"] = "Memory Limit Exceeded";
|
|
@@ -20,12 +21,11 @@ export var Status = /*#__PURE__*/function (Status) {
|
|
|
20
21
|
Status["Skipped"] = "Skipped";
|
|
21
22
|
Status["SpecialJudgeError"] = "Special Judge Error";
|
|
22
23
|
Status["TimeLimitExceeded"] = "Time Limit Exceeded";
|
|
23
|
-
Status["Unknown"] = "Unknown";
|
|
24
24
|
Status["WrongAnswer"] = "Wrong Answer";
|
|
25
25
|
return Status;
|
|
26
26
|
}({});
|
|
27
|
-
var
|
|
28
|
-
var statusZh = new Map([[Status.Abnormal, ''], [Status.Accepted, '
|
|
27
|
+
var statusColor = new Map([[Status.Abnormal, '#8b008b'], [Status.Accepted, '#00ad07'], [Status.CheckerJudgementFailed, '#ff4500'], [Status.CompileError, '#f5b13d'], [Status.DangerousSyscall, '#ff69b4'], [Status.Hidden, '#808080'], [Status.JudgeFailed, '#2f4f4f'], [Status.JudgementFailed, '#4b0082'], [Status.MemoryLimitExceeded, '#9256f5'], [Status.OutputLimitExceeded, '#4682b4'], [Status.Pending, '#ffa500'], [Status.PresentationError, '#1e90ff'], [Status.Running, '#ff8c00'], [Status.RuntimeError, '#f56ed3'], [Status.Skipped, '#20b2aa'], [Status.SpecialJudgeError, '#ffd700'], [Status.TimeLimitExceeded, '#56a2f5'], [Status.WrongAnswer, '#f44336']]);
|
|
28
|
+
var statusZh = new Map([[Status.Abnormal, '评测异常'], [Status.Accepted, '评测通过'], [Status.CheckerJudgementFailed, '检查器评测失败'], [Status.CompileError, '编译错误'], [Status.DangerousSyscall, '危险系统调用'], [Status.Hidden, '结果隐藏'], [Status.JudgeFailed, '评测失败'], [Status.JudgementFailed, '评测失败'], [Status.MemoryLimitExceeded, '内存超限'], [Status.OutputLimitExceeded, '输出超限'], [Status.Pending, '等待'], [Status.PresentationError, '格式错误'], [Status.Running, '运行中'], [Status.RuntimeError, '运行时错误'], [Status.Skipped, '跳过'], [Status.SpecialJudgeError, '特判器错误'], [Status.TimeLimitExceeded, '时间超限'], [Status.WrongAnswer, '答案错误']]);
|
|
29
29
|
var SubmissionStatus = function SubmissionStatus(_ref) {
|
|
30
30
|
var className = _ref.className,
|
|
31
31
|
style = _ref.style,
|
|
@@ -34,13 +34,13 @@ var SubmissionStatus = function SubmissionStatus(_ref) {
|
|
|
34
34
|
var _useLocale = useLocale('CodeDetailModal'),
|
|
35
35
|
locale = _useLocale.locale;
|
|
36
36
|
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
37
|
-
title: locale === 'zh_CN' &&
|
|
37
|
+
title: locale === 'zh_CN' && statusZh.get(status)
|
|
38
38
|
}, /*#__PURE__*/React.createElement("div", {
|
|
39
39
|
"data-testid": 'submissionStatus',
|
|
40
40
|
className: className,
|
|
41
41
|
style: _objectSpread({
|
|
42
42
|
fontWeight: 'bold',
|
|
43
|
-
color:
|
|
43
|
+
color: statusColor.get(status),
|
|
44
44
|
cursor: onClick ? 'pointer' : 'unset'
|
|
45
45
|
}, style),
|
|
46
46
|
onClick: onClick
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 将 16 进制颜色转换成 RGB
|
|
3
|
+
*
|
|
4
|
+
* @param hex 16 进制颜色
|
|
5
|
+
* @param alpha 透明度
|
|
6
|
+
* @returns RGB 颜色
|
|
7
|
+
*/
|
|
8
|
+
export var hexToRgb = function hexToRgb(hex, alpha) {
|
|
9
|
+
var r, g, b;
|
|
10
|
+
if (hex.length === 4) {
|
|
11
|
+
r = +"0x".concat(hex[1]).concat(hex[1]);
|
|
12
|
+
g = +"0x".concat(hex[2]).concat(hex[2]);
|
|
13
|
+
b = +"0x".concat(hex[3]).concat(hex[3]);
|
|
14
|
+
} else {
|
|
15
|
+
r = +"0x".concat(hex[1]).concat(hex[2]);
|
|
16
|
+
g = +"0x".concat(hex[3]).concat(hex[4]);
|
|
17
|
+
b = +"0x".concat(hex[5]).concat(hex[6]);
|
|
18
|
+
}
|
|
19
|
+
return "rgb(".concat(r, " ").concat(g, " ").concat(b, " / ").concat(alpha, ")");
|
|
20
|
+
};
|
package/dist/x-tabs/index.js
CHANGED
|
@@ -7,24 +7,8 @@ import { ConfigContext } from 'antd/es/config-provider';
|
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import React, { useContext, useEffect, useMemo, useRef } from 'react';
|
|
9
9
|
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
10
|
+
import { hexToRgb } from "../utils/color";
|
|
10
11
|
import { prefix } from "../utils/global";
|
|
11
|
-
|
|
12
|
-
//hash颜色转换rgba
|
|
13
|
-
function hexToRGBA(hex, alpha) {
|
|
14
|
-
var r = '',
|
|
15
|
-
g = '',
|
|
16
|
-
b = '';
|
|
17
|
-
if (hex.length === 4) {
|
|
18
|
-
r = '0x' + hex[1] + hex[1];
|
|
19
|
-
g = '0x' + hex[2] + hex[2];
|
|
20
|
-
b = '0x' + hex[3] + hex[3];
|
|
21
|
-
} else {
|
|
22
|
-
r = '0x' + hex[1] + hex[2];
|
|
23
|
-
g = '0x' + hex[3] + hex[4];
|
|
24
|
-
b = '0x' + hex[5] + hex[6];
|
|
25
|
-
}
|
|
26
|
-
return "rgba(".concat(+r, ",").concat(+g, ",").concat(+b, ",").concat(alpha, ")");
|
|
27
|
-
}
|
|
28
12
|
var XTabs = function XTabs(_ref) {
|
|
29
13
|
var _theme$token;
|
|
30
14
|
var className = _ref.className,
|
|
@@ -38,9 +22,9 @@ var XTabs = function XTabs(_ref) {
|
|
|
38
22
|
colorPrimary = _ref2$colorPrimary === void 0 ? '#1990fe' : _ref2$colorPrimary;
|
|
39
23
|
useEffect(function () {
|
|
40
24
|
var _colorThemeRef$curren, _colorThemeRef$curren2;
|
|
41
|
-
|
|
25
|
+
// 设置主题色
|
|
42
26
|
(_colorThemeRef$curren = colorThemeRef.current) === null || _colorThemeRef$curren === void 0 ? void 0 : _colorThemeRef$curren.style.setProperty('--x-tabs-primary-color', colorPrimary);
|
|
43
|
-
(_colorThemeRef$curren2 = colorThemeRef.current) === null || _colorThemeRef$curren2 === void 0 ? void 0 : _colorThemeRef$curren2.style.setProperty('--x-tabs-secondary-color',
|
|
27
|
+
(_colorThemeRef$curren2 = colorThemeRef.current) === null || _colorThemeRef$curren2 === void 0 ? void 0 : _colorThemeRef$curren2.style.setProperty('--x-tabs-secondary-color', hexToRgb(colorPrimary, 0.15));
|
|
44
28
|
}, [colorPrimary]);
|
|
45
29
|
var newItems = useMemo(function () {
|
|
46
30
|
return items === null || items === void 0 ? void 0 : items.map(function (item) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-star-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.66",
|
|
4
4
|
"description": "A react component library developed by turingstar",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -57,8 +57,9 @@
|
|
|
57
57
|
"@uiw/codemirror-theme-okaidia": "^4.21.9",
|
|
58
58
|
"@uiw/codemirror-theme-vscode": "^4.21.9",
|
|
59
59
|
"@uiw/react-codemirror": "^4.21.9",
|
|
60
|
-
"ahooks": "^3.
|
|
60
|
+
"ahooks": "^3.8.0",
|
|
61
61
|
"classnames": "^2.3.2",
|
|
62
|
+
"qiankun": "^2.10.16",
|
|
62
63
|
"randomcolor": "^0.6.2",
|
|
63
64
|
"react-error-boundary": "^4.0.13",
|
|
64
65
|
"react-sortable-hoc": "^2.0.0",
|
|
@@ -82,6 +83,7 @@
|
|
|
82
83
|
"@types/react": "^18.0.0",
|
|
83
84
|
"@types/react-dom": "^18.0.0",
|
|
84
85
|
"@types/react-window": "^1.8.5",
|
|
86
|
+
"@types/whatwg-fetch": "^0.0.33",
|
|
85
87
|
"@umijs/lint": "^4.0.0",
|
|
86
88
|
"antd": "^5.17.2",
|
|
87
89
|
"babel-plugin-inline-import-data-uri": "^1.0.1",
|
|
@@ -102,7 +104,8 @@
|
|
|
102
104
|
"react": "^18.0.0",
|
|
103
105
|
"react-dom": "^18.0.0",
|
|
104
106
|
"stylelint": "^14.9.1",
|
|
105
|
-
"stylelint-config-standard-scss": "^6.1.0"
|
|
107
|
+
"stylelint-config-standard-scss": "^6.1.0",
|
|
108
|
+
"whatwg-fetch": "^3.6.20"
|
|
106
109
|
},
|
|
107
110
|
"peerDependencies": {
|
|
108
111
|
"@ant-design/icons": ">=4.7.0",
|