x-star-design 0.0.87 → 0.0.89
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/ac-config/GeneralConfigItem.d.ts +2 -1
- package/dist/ac-config/GeneralConfigItem.js +47 -24
- package/dist/ac-config/ProgramConfigItem.d.ts +3 -1
- package/dist/ac-config/ProgramConfigItem.js +4 -1
- package/dist/ac-config/index.d.ts +2 -0
- package/dist/ac-config/index.js +15 -6
- package/dist/contest-duration-input/index.d.ts +2 -1
- package/dist/contest-duration-input/index.js +6 -3
- package/dist/contest-time-input/index.d.ts +2 -1
- package/dist/contest-time-input/index.js +6 -3
- package/package.json +3 -2
|
@@ -4,6 +4,7 @@ interface GeneralConfigItemProps {
|
|
|
4
4
|
type: 'advanced' | 'simple';
|
|
5
5
|
contestType?: 'contest' | 'homework';
|
|
6
6
|
form: FormInstance<any>;
|
|
7
|
+
isFinish?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const GeneralConfigItem: ({ type, contestType, form, }: GeneralConfigItemProps) => React.JSX.Element;
|
|
9
|
+
declare const GeneralConfigItem: ({ type, contestType, form, isFinish, }: GeneralConfigItemProps) => React.JSX.Element;
|
|
9
10
|
export default GeneralConfigItem;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
1
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
4
|
import { QuestionCircleOutlined, SwapOutlined } from '@ant-design/icons';
|
|
3
5
|
import { Checkbox, Col, DatePicker, Flex, Form, Radio, Row, Space, Tooltip, message } from 'antd';
|
|
@@ -13,7 +15,8 @@ var RangePicker = DatePicker.RangePicker;
|
|
|
13
15
|
var GeneralConfigItem = function GeneralConfigItem(_ref) {
|
|
14
16
|
var type = _ref.type,
|
|
15
17
|
contestType = _ref.contestType,
|
|
16
|
-
form = _ref.form
|
|
18
|
+
form = _ref.form,
|
|
19
|
+
isFinish = _ref.isFinish;
|
|
17
20
|
var FOREVER = 876000; // 100 年 = 876000 小时
|
|
18
21
|
var _useLocale = useLocale('AcConfig'),
|
|
19
22
|
t = _useLocale.format;
|
|
@@ -41,22 +44,37 @@ var GeneralConfigItem = function GeneralConfigItem(_ref) {
|
|
|
41
44
|
color: primaryColor
|
|
42
45
|
},
|
|
43
46
|
"data-testid": "contest-config-time-swap",
|
|
44
|
-
onClick: function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
48
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
49
|
+
while (1) switch (_context.prev = _context.next) {
|
|
50
|
+
case 0:
|
|
51
|
+
_context.prev = 0;
|
|
52
|
+
if (!(form.getFieldValue(['contestTime']).length === 0)) {
|
|
53
|
+
_context.next = 4;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
setContestTimeMode(contestTimeMode === ContestTimeMode.New ? ContestTimeMode.Old : ContestTimeMode.New);
|
|
57
|
+
return _context.abrupt("return");
|
|
58
|
+
case 4:
|
|
59
|
+
_context.next = 6;
|
|
60
|
+
return form.validateFields(['contestTime']);
|
|
61
|
+
case 6:
|
|
62
|
+
setContestTimeMode(contestTimeMode === ContestTimeMode.New ? ContestTimeMode.Old : ContestTimeMode.New);
|
|
63
|
+
_context.next = 12;
|
|
64
|
+
break;
|
|
65
|
+
case 9:
|
|
66
|
+
_context.prev = 9;
|
|
67
|
+
_context.t0 = _context["catch"](0);
|
|
68
|
+
message.error({
|
|
69
|
+
key: 'error',
|
|
70
|
+
content: t('Please_Enter_Correct_Time_Format')
|
|
71
|
+
});
|
|
72
|
+
case 12:
|
|
73
|
+
case "end":
|
|
74
|
+
return _context.stop();
|
|
75
|
+
}
|
|
76
|
+
}, _callee, null, [[0, 9]]);
|
|
77
|
+
}))
|
|
60
78
|
}))) : t('HomeworkTime'),
|
|
61
79
|
rules: [{
|
|
62
80
|
required: true
|
|
@@ -72,10 +90,13 @@ var GeneralConfigItem = function GeneralConfigItem(_ref) {
|
|
|
72
90
|
}
|
|
73
91
|
}],
|
|
74
92
|
extra: contestType === 'contest' && /*#__PURE__*/React.createElement("span", null, t('Contest_Time_Tip'))
|
|
75
|
-
}, contestType === 'contest' ? /*#__PURE__*/React.createElement(React.Fragment, null, contestTimeMode === ContestTimeMode.New ? /*#__PURE__*/React.createElement(ContestDurationInput,
|
|
93
|
+
}, contestType === 'contest' ? /*#__PURE__*/React.createElement(React.Fragment, null, contestTimeMode === ContestTimeMode.New ? /*#__PURE__*/React.createElement(ContestDurationInput, {
|
|
94
|
+
disabled: isFinish
|
|
95
|
+
}) : /*#__PURE__*/React.createElement(RangePicker, {
|
|
76
96
|
showTime: true,
|
|
77
97
|
format: 'YYYY-MM-DD HH:mm',
|
|
78
|
-
"data-testid": "contest-config-time-input"
|
|
98
|
+
"data-testid": "contest-config-time-input",
|
|
99
|
+
disabled: isFinish
|
|
79
100
|
})) : /*#__PURE__*/React.createElement(Radio.Group, {
|
|
80
101
|
style: {
|
|
81
102
|
display: 'flex'
|
|
@@ -87,8 +108,8 @@ var GeneralConfigItem = function GeneralConfigItem(_ref) {
|
|
|
87
108
|
dependencies: ['contestTime'],
|
|
88
109
|
noStyle: true,
|
|
89
110
|
name: 'limitTime',
|
|
90
|
-
rules: [function (
|
|
91
|
-
var getFieldValue =
|
|
111
|
+
rules: [function (_ref3) {
|
|
112
|
+
var getFieldValue = _ref3.getFieldValue;
|
|
92
113
|
return {
|
|
93
114
|
validator: function validator(_, value) {
|
|
94
115
|
var contestTime = getFieldValue(['contestTime']);
|
|
@@ -193,7 +214,9 @@ var GeneralConfigItem = function GeneralConfigItem(_ref) {
|
|
|
193
214
|
}, t('PROHIBIT'))))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
194
215
|
name: 'submission',
|
|
195
216
|
label: t('HAND_IN_THE_PAPER_IN_ADVANCE')
|
|
196
|
-
}, /*#__PURE__*/React.createElement(Radio.Group,
|
|
217
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, {
|
|
218
|
+
disabled: contestType === 'contest' && isFinish
|
|
219
|
+
}, /*#__PURE__*/React.createElement(Radio, {
|
|
197
220
|
value: 'allowEarlySubmission'
|
|
198
221
|
}, t('ALLOW')), /*#__PURE__*/React.createElement(Radio, {
|
|
199
222
|
value: 'noEarlySubmission'
|
|
@@ -207,8 +230,8 @@ var GeneralConfigItem = function GeneralConfigItem(_ref) {
|
|
|
207
230
|
noStyle: true,
|
|
208
231
|
"data-testid": "submissionLimitTime",
|
|
209
232
|
dependencies: ['contestTime', 'limitTime'],
|
|
210
|
-
rules: [function (
|
|
211
|
-
var getFieldValue =
|
|
233
|
+
rules: [function (_ref4) {
|
|
234
|
+
var getFieldValue = _ref4.getFieldValue;
|
|
212
235
|
return {
|
|
213
236
|
validator: function validator(_, value) {
|
|
214
237
|
var _contestTime$;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface ProgramConfigItemProps {
|
|
3
3
|
type: 'advanced' | 'simple';
|
|
4
|
+
contestType?: 'contest' | 'homework';
|
|
5
|
+
isFinish?: boolean;
|
|
4
6
|
}
|
|
5
|
-
declare const ProgramConfigItem: ({ type }: ProgramConfigItemProps) => React.JSX.Element;
|
|
7
|
+
declare const ProgramConfigItem: ({ type, contestType, isFinish, }: ProgramConfigItemProps) => React.JSX.Element;
|
|
6
8
|
export default ProgramConfigItem;
|
|
@@ -5,7 +5,9 @@ import { useLocale } from "../locales";
|
|
|
5
5
|
import TimingFormItem from "./TimingFormItem";
|
|
6
6
|
import { langVL } from "./define";
|
|
7
7
|
var ProgramConfigItem = function ProgramConfigItem(_ref) {
|
|
8
|
-
var type = _ref.type
|
|
8
|
+
var type = _ref.type,
|
|
9
|
+
contestType = _ref.contestType,
|
|
10
|
+
isFinish = _ref.isFinish;
|
|
9
11
|
var _useLocale = useLocale('AcConfig'),
|
|
10
12
|
t = _useLocale.format;
|
|
11
13
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -25,6 +27,7 @@ var ProgramConfigItem = function ProgramConfigItem(_ref) {
|
|
|
25
27
|
style: {
|
|
26
28
|
maxWidth: 350
|
|
27
29
|
},
|
|
30
|
+
disabled: contestType === 'contest' && isFinish,
|
|
28
31
|
options: Array.from(langVL, function (_ref2) {
|
|
29
32
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
30
33
|
value = _ref3[0],
|
|
@@ -6,6 +6,8 @@ export interface AcConfigProps extends Omit<FormProps, 'children'> {
|
|
|
6
6
|
contestType?: ContestExamType;
|
|
7
7
|
initialValues?: Configuration;
|
|
8
8
|
onFinish?: (values: Configuration) => void;
|
|
9
|
+
form?: FormInstance<any>;
|
|
10
|
+
isFinish?: boolean;
|
|
9
11
|
}
|
|
10
12
|
export interface AcConfigHandle {
|
|
11
13
|
form: FormInstance<any>;
|
package/dist/ac-config/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
var _excluded = ["type", "contestType", "initialValues"];
|
|
6
|
+
var _excluded = ["type", "contestType", "initialValues", "form", "isFinish"];
|
|
7
7
|
import { Divider, Form, Space } from 'antd';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import dayjs from 'dayjs';
|
|
@@ -92,10 +92,13 @@ var AcConfig = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
92
92
|
_ref3$contestType = _ref3.contestType,
|
|
93
93
|
contestType = _ref3$contestType === void 0 ? ContestExamType.Homework : _ref3$contestType,
|
|
94
94
|
initialValues = _ref3.initialValues,
|
|
95
|
+
externalForm = _ref3.form,
|
|
96
|
+
isFinish = _ref3.isFinish,
|
|
95
97
|
props = _objectWithoutProperties(_ref3, _excluded);
|
|
96
98
|
var _Form$useForm = Form.useForm(),
|
|
97
99
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
98
|
-
|
|
100
|
+
internalForm = _Form$useForm2[0];
|
|
101
|
+
var form = externalForm || internalForm; // 使用外部传入的 form,如果没有则使用内部创建的 form
|
|
99
102
|
var _useLocale = useLocale('AcConfig'),
|
|
100
103
|
t = _useLocale.format,
|
|
101
104
|
locale = _useLocale.locale;
|
|
@@ -201,15 +204,21 @@ var AcConfig = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
201
204
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, getDescription(language, t('General_Configuration'))), /*#__PURE__*/React.createElement(GeneralConfigItem, {
|
|
202
205
|
type: type,
|
|
203
206
|
contestType: contestType,
|
|
204
|
-
form: form
|
|
207
|
+
form: form,
|
|
208
|
+
isFinish: isFinish
|
|
205
209
|
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, getDescription(language, t('Programming_Problem_Configuration'))), /*#__PURE__*/React.createElement(ProgramConfigItem, {
|
|
206
|
-
type: type
|
|
210
|
+
type: type,
|
|
211
|
+
contestType: contestType,
|
|
212
|
+
isFinish: isFinish
|
|
207
213
|
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GeneralConfigItem, {
|
|
208
214
|
type: type,
|
|
209
215
|
contestType: contestType,
|
|
210
|
-
form: form
|
|
216
|
+
form: form,
|
|
217
|
+
isFinish: isFinish
|
|
211
218
|
}), /*#__PURE__*/React.createElement(ProgramConfigItem, {
|
|
212
|
-
type: type
|
|
219
|
+
type: type,
|
|
220
|
+
contestType: contestType,
|
|
221
|
+
isFinish: isFinish
|
|
213
222
|
}))));
|
|
214
223
|
});
|
|
215
224
|
export default AcConfig;
|
|
@@ -3,7 +3,8 @@ import React from 'react';
|
|
|
3
3
|
interface ContestDurationInputProps {
|
|
4
4
|
value?: [Dayjs | null | undefined | string, Dayjs | null | undefined];
|
|
5
5
|
onChange?: (value: [Dayjs | null | undefined | string, Dayjs | null | undefined]) => void;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const isValidDate: (value: string) => boolean;
|
|
8
|
-
declare const ContestDurationInput: ({ value, onChange, }: ContestDurationInputProps) => React.JSX.Element;
|
|
9
|
+
declare const ContestDurationInput: ({ value, onChange, disabled, }: ContestDurationInputProps) => React.JSX.Element;
|
|
9
10
|
export default ContestDurationInput;
|
|
@@ -10,7 +10,8 @@ export var isValidDate = function isValidDate(value) {
|
|
|
10
10
|
};
|
|
11
11
|
var ContestDurationInput = function ContestDurationInput(_ref) {
|
|
12
12
|
var value = _ref.value,
|
|
13
|
-
onChange = _ref.onChange
|
|
13
|
+
onChange = _ref.onChange,
|
|
14
|
+
disabled = _ref.disabled;
|
|
14
15
|
var _useLocale = useLocale('ContestDurationInput'),
|
|
15
16
|
t = _useLocale.format;
|
|
16
17
|
var _useState = useState(''),
|
|
@@ -68,12 +69,14 @@ var ContestDurationInput = function ContestDurationInput(_ref) {
|
|
|
68
69
|
placeholder: t('Please_Enter_Start_Time'),
|
|
69
70
|
value: startTime,
|
|
70
71
|
onChange: handleStartTimeChange,
|
|
71
|
-
"data-testid": "duration-start-time"
|
|
72
|
+
"data-testid": "duration-start-time",
|
|
73
|
+
disabled: disabled
|
|
72
74
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
73
75
|
className: "".concat(prefix, "-contest-time-tip")
|
|
74
76
|
}, t('Input_Format')), /*#__PURE__*/React.createElement(Space, null, t('Duration'), /*#__PURE__*/React.createElement(ContestTimeInput, {
|
|
75
77
|
value: duration,
|
|
76
|
-
onChange: handleDurationChange
|
|
78
|
+
onChange: handleDurationChange,
|
|
79
|
+
disabled: disabled
|
|
77
80
|
})));
|
|
78
81
|
};
|
|
79
82
|
export default ContestDurationInput;
|
|
@@ -9,6 +9,7 @@ export interface ContestTimeInputProps {
|
|
|
9
9
|
defaultValue?: ContestTimeInputValue;
|
|
10
10
|
onChange?: (value: ContestTimeInputValue) => void;
|
|
11
11
|
value?: ContestTimeInputValue;
|
|
12
|
+
disabled?: boolean;
|
|
12
13
|
}
|
|
13
|
-
declare const ContestTimeInput: ({ suffix, prefix, defaultValue, onChange, value, }: ContestTimeInputProps) => React.JSX.Element;
|
|
14
|
+
declare const ContestTimeInput: ({ suffix, prefix, defaultValue, onChange, value, disabled, }: ContestTimeInputProps) => React.JSX.Element;
|
|
14
15
|
export default ContestTimeInput;
|
|
@@ -9,7 +9,8 @@ var ContestTimeInput = function ContestTimeInput(_ref) {
|
|
|
9
9
|
prefix = _ref.prefix,
|
|
10
10
|
defaultValue = _ref.defaultValue,
|
|
11
11
|
_onChange = _ref.onChange,
|
|
12
|
-
value = _ref.value
|
|
12
|
+
value = _ref.value,
|
|
13
|
+
disabled = _ref.disabled;
|
|
13
14
|
var _useState = useState(value !== null && value !== void 0 ? value : defaultValue),
|
|
14
15
|
_useState2 = _slicedToArray(_useState, 2),
|
|
15
16
|
innerValue = _useState2[0],
|
|
@@ -42,7 +43,8 @@ var ContestTimeInput = function ContestTimeInput(_ref) {
|
|
|
42
43
|
_onChange === null || _onChange === void 0 ? void 0 : _onChange(_objectSpread(_objectSpread({}, innerValue), {}, {
|
|
43
44
|
limitHour: newValue
|
|
44
45
|
}));
|
|
45
|
-
}
|
|
46
|
+
},
|
|
47
|
+
disabled: disabled
|
|
46
48
|
}), /*#__PURE__*/React.createElement("span", null, t('Hour')), /*#__PURE__*/React.createElement(InputNumber, {
|
|
47
49
|
"data-testid": "minute-input",
|
|
48
50
|
style: {
|
|
@@ -59,7 +61,8 @@ var ContestTimeInput = function ContestTimeInput(_ref) {
|
|
|
59
61
|
_onChange === null || _onChange === void 0 ? void 0 : _onChange(_objectSpread(_objectSpread({}, innerValue), {}, {
|
|
60
62
|
limitMinute: newValue
|
|
61
63
|
}));
|
|
62
|
-
}
|
|
64
|
+
},
|
|
65
|
+
disabled: disabled
|
|
63
66
|
}), /*#__PURE__*/React.createElement("span", null, t('Minute')), suffix);
|
|
64
67
|
};
|
|
65
68
|
export default ContestTimeInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-star-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.89",
|
|
4
4
|
"description": "A react component library developed by turingstar",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -56,13 +56,14 @@
|
|
|
56
56
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
57
57
|
"@dnd-kit/sortable": "^8.0.0",
|
|
58
58
|
"@dnd-kit/utilities": "^3.2.2",
|
|
59
|
+
"@types/classnames": "^2.3.4",
|
|
59
60
|
"@uiw/codemirror-theme-bbedit": "^4.21.9",
|
|
60
61
|
"@uiw/codemirror-theme-eclipse": "^4.21.9",
|
|
61
62
|
"@uiw/codemirror-theme-okaidia": "^4.21.9",
|
|
62
63
|
"@uiw/codemirror-theme-vscode": "^4.21.9",
|
|
63
64
|
"@uiw/react-codemirror": "^4.21.9",
|
|
64
65
|
"ahooks": "^3.8.0",
|
|
65
|
-
"classnames": "^2.
|
|
66
|
+
"classnames": "^2.5.1",
|
|
66
67
|
"html2canvas": "^1.4.1",
|
|
67
68
|
"province-city-china": "^8.5.8",
|
|
68
69
|
"qiankun": "^2.10.16",
|