x-star-design 0.0.72 → 0.0.73
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 +9 -0
- package/dist/ac-config/GeneralConfigItem.js +227 -0
- package/dist/ac-config/ProgramConfigItem.d.ts +6 -0
- package/dist/ac-config/ProgramConfigItem.js +123 -0
- package/dist/ac-config/TimingFormItem.d.ts +8 -0
- package/dist/ac-config/TimingFormItem.js +47 -0
- package/dist/ac-config/define.d.ts +128 -0
- package/dist/ac-config/define.js +6 -0
- package/dist/ac-config/index.d.ts +18 -0
- package/dist/ac-config/index.js +213 -0
- package/dist/contest-time-input/index.d.ts +13 -0
- package/dist/contest-time-input/index.js +61 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/locales/en_US.d.ts +70 -0
- package/dist/locales/en_US.js +70 -0
- package/dist/locales/index.d.ts +141 -1
- package/dist/locales/zh_CN.d.ts +70 -0
- package/dist/locales/zh_CN.js +70 -0
- package/dist/styles/index.css +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface GeneralConfigItemProps {
|
|
4
|
+
type: 'advanced' | 'simple';
|
|
5
|
+
contestType?: 'contest' | 'homework';
|
|
6
|
+
form: FormInstance<any>;
|
|
7
|
+
}
|
|
8
|
+
declare const GeneralConfigItem: ({ type, contestType, form, }: GeneralConfigItemProps) => React.JSX.Element;
|
|
9
|
+
export default GeneralConfigItem;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { QuestionCircleOutlined } from '@ant-design/icons';
|
|
2
|
+
import { Checkbox, Col, DatePicker, Form, Radio, Row, Space, Tooltip } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import ContestTimeInput from "../contest-time-input";
|
|
5
|
+
import { useLocale } from "../locales";
|
|
6
|
+
import TimingFormItem from "./TimingFormItem";
|
|
7
|
+
var RangePicker = DatePicker.RangePicker;
|
|
8
|
+
var GeneralConfigItem = function GeneralConfigItem(_ref) {
|
|
9
|
+
var type = _ref.type,
|
|
10
|
+
contestType = _ref.contestType,
|
|
11
|
+
form = _ref.form;
|
|
12
|
+
var FOREVER = 876000; // 100 年 = 876000 小时
|
|
13
|
+
var _useLocale = useLocale('AcConfig'),
|
|
14
|
+
t = _useLocale.format;
|
|
15
|
+
|
|
16
|
+
// 监听 submission 字段
|
|
17
|
+
var submitType = Form.useWatch('submission', form);
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form.Item, {
|
|
19
|
+
name: 'contestTime',
|
|
20
|
+
label: contestType === 'contest' ? t('ExamTime') : t('HomeworkTime'),
|
|
21
|
+
rules: [{
|
|
22
|
+
required: true
|
|
23
|
+
}],
|
|
24
|
+
extra: contestType === 'contest' && /*#__PURE__*/React.createElement("span", null, t('Contest_Time_Tip'))
|
|
25
|
+
}, contestType === 'contest' ? /*#__PURE__*/React.createElement(RangePicker, {
|
|
26
|
+
showTime: true,
|
|
27
|
+
format: 'YYYY-MM-DD HH:mm',
|
|
28
|
+
"data-testid": "contest-config-time-input"
|
|
29
|
+
}) : /*#__PURE__*/React.createElement(Radio.Group, {
|
|
30
|
+
style: {
|
|
31
|
+
display: 'flex'
|
|
32
|
+
}
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Radio, {
|
|
34
|
+
value: 'limitTime',
|
|
35
|
+
"data-testid": "contestTime-limitTime"
|
|
36
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
37
|
+
dependencies: ['contestTime'],
|
|
38
|
+
noStyle: true,
|
|
39
|
+
name: 'limitTime',
|
|
40
|
+
rules: [function (_ref2) {
|
|
41
|
+
var getFieldValue = _ref2.getFieldValue;
|
|
42
|
+
return {
|
|
43
|
+
validator: function validator(_, value) {
|
|
44
|
+
var contestTime = getFieldValue(['contestTime']);
|
|
45
|
+
if (contestTime === 'limitTime' && ((value === null || value === void 0 ? void 0 : value.limitHour) === 0 && (value === null || value === void 0 ? void 0 : value.limitMinute) === 0 || (value === null || value === void 0 ? void 0 : value.limitHour) === FOREVER)) {
|
|
46
|
+
return Promise.reject(new Error(t('Illegal_Duration')));
|
|
47
|
+
}
|
|
48
|
+
return Promise.resolve();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}]
|
|
52
|
+
}, /*#__PURE__*/React.createElement(ContestTimeInput, null))), /*#__PURE__*/React.createElement(Radio, {
|
|
53
|
+
style: {
|
|
54
|
+
alignItems: 'center'
|
|
55
|
+
},
|
|
56
|
+
value: 'noLimit'
|
|
57
|
+
}, t('UnrestrictedDuration')))), /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
style: {
|
|
59
|
+
display: type === 'advanced' ? 'block' : 'none'
|
|
60
|
+
}
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
62
|
+
name: 'gradeRelease',
|
|
63
|
+
label: t('SCORE_RELEASE')
|
|
64
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
65
|
+
value: 'afterExam'
|
|
66
|
+
}, t('RELEASE_AFTER_THE_EXAM')), /*#__PURE__*/React.createElement(Radio, {
|
|
67
|
+
value: 'afterApproval'
|
|
68
|
+
}, t('RELEASE_AFTER_TEACHER_CONFIRMATION')), /*#__PURE__*/React.createElement(Radio, {
|
|
69
|
+
value: 'scheduled',
|
|
70
|
+
"data-testid": "gradeRelease-scheduled"
|
|
71
|
+
}, t('SCHEDULED_RELEASE')))), /*#__PURE__*/React.createElement(TimingFormItem, {
|
|
72
|
+
field: 'gradeRelease',
|
|
73
|
+
name: 'gradeTime',
|
|
74
|
+
label: t('SCORE_DISPLAY_TIME')
|
|
75
|
+
}), /*#__PURE__*/React.createElement(Form.Item, {
|
|
76
|
+
name: 'rankListRelease',
|
|
77
|
+
label: t('LEADERBOARD_VISIBLE')
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
79
|
+
value: 'afterGradeRelease',
|
|
80
|
+
"data-testid": "rankListRelease-afterGradeRelease"
|
|
81
|
+
}, t('VISIBLE_AFTER_GRADE_RELEASE')), /*#__PURE__*/React.createElement(Radio, {
|
|
82
|
+
value: 'afterApproval'
|
|
83
|
+
}, t('VISIBLE_AFTER_TEACHER_CONFIRMATION')), /*#__PURE__*/React.createElement(Radio, {
|
|
84
|
+
value: 'scheduled'
|
|
85
|
+
}, t('TIMED_VISIBILITY')), /*#__PURE__*/React.createElement(Radio, {
|
|
86
|
+
value: 'always'
|
|
87
|
+
}, t('Always_Visible')))), /*#__PURE__*/React.createElement(TimingFormItem, {
|
|
88
|
+
field: 'rankListRelease',
|
|
89
|
+
name: 'rankListTime',
|
|
90
|
+
label: t('LEADERBOARD_VISIBLE_TIME')
|
|
91
|
+
}), /*#__PURE__*/React.createElement(Form.Item, {
|
|
92
|
+
name: 'paperRelease',
|
|
93
|
+
label: t('TEST_PAPER_VISIBLE')
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
95
|
+
value: 'afterExam'
|
|
96
|
+
}, t('VISIBLE_AFTER_THE_EXAM')), /*#__PURE__*/React.createElement(Radio, {
|
|
97
|
+
value: 'afterGradeRelease'
|
|
98
|
+
}, t('VISIBLE_AFTER_GRADE_RELEASE')), /*#__PURE__*/React.createElement(Radio, {
|
|
99
|
+
value: 'afterApproval'
|
|
100
|
+
}, t('VISIBLE_AFTER_TEACHER_CONFIRMATION')), /*#__PURE__*/React.createElement(Radio, {
|
|
101
|
+
value: 'scheduled',
|
|
102
|
+
"data-testid": "paperRelease-scheduled"
|
|
103
|
+
}, t('TIMED_VISIBILITY')))), /*#__PURE__*/React.createElement(TimingFormItem, {
|
|
104
|
+
field: 'paperRelease',
|
|
105
|
+
name: 'paperTime',
|
|
106
|
+
label: t('TEST_PAPER_VISIBLE_TIME')
|
|
107
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
108
|
+
name: 'answerRelease',
|
|
109
|
+
label: t('ANSWER_DISPLAY')
|
|
110
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
111
|
+
value: 'afterExam',
|
|
112
|
+
"data-testid": "answerRelease-afterExam"
|
|
113
|
+
}, t('DISPLAY_AFTER_TEACHER_CONFIRMATION_01')), /*#__PURE__*/React.createElement(Radio, {
|
|
114
|
+
value: 'afterGradeRelease'
|
|
115
|
+
}, t('DISPLAY_AFTER_TEACHER_CONFIRMATION_02')), /*#__PURE__*/React.createElement(Radio, {
|
|
116
|
+
value: 'afterApproval'
|
|
117
|
+
}, t('DISPLAY_AFTER_TEACHER_CONFIRMATION')), /*#__PURE__*/React.createElement(Radio, {
|
|
118
|
+
value: 'scheduled'
|
|
119
|
+
}, t('TIMED_DISPLAY')))), /*#__PURE__*/React.createElement(TimingFormItem, {
|
|
120
|
+
field: 'answerRelease',
|
|
121
|
+
name: 'answerTime',
|
|
122
|
+
label: t('ANSWER_DISPLAY_TIME')
|
|
123
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
124
|
+
style: {
|
|
125
|
+
display: type === 'advanced' ? 'block' : 'none'
|
|
126
|
+
}
|
|
127
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
128
|
+
label: t('RanklistShowRealName'),
|
|
129
|
+
name: 'rankListShowRealName'
|
|
130
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
131
|
+
value: true,
|
|
132
|
+
"data-testid": "rankListShowRealName-allow"
|
|
133
|
+
}, t('ALLOW')), /*#__PURE__*/React.createElement(Radio, {
|
|
134
|
+
value: false
|
|
135
|
+
}, t('PROHIBIT')))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
136
|
+
label: t('RankShowUserLabel'),
|
|
137
|
+
name: 'rankShowUserLabel'
|
|
138
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
139
|
+
value: true
|
|
140
|
+
}, t('ALLOW')), /*#__PURE__*/React.createElement(Radio, {
|
|
141
|
+
value: false,
|
|
142
|
+
"data-testid": "rankShowUserLabel-prohibit"
|
|
143
|
+
}, t('PROHIBIT'))))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
144
|
+
name: 'submission',
|
|
145
|
+
label: t('HAND_IN_THE_PAPER_IN_ADVANCE')
|
|
146
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
147
|
+
value: 'allowEarlySubmission'
|
|
148
|
+
}, t('ALLOW')), /*#__PURE__*/React.createElement(Radio, {
|
|
149
|
+
value: 'noEarlySubmission'
|
|
150
|
+
}, t('PROHIBIT')), /*#__PURE__*/React.createElement(Radio, {
|
|
151
|
+
value: 'timedSubmission',
|
|
152
|
+
"data-testid": "submission-timedSubmission"
|
|
153
|
+
}, t('ALLOW_SETTIMEOUT_SUBMI')))), submitType === 'timedSubmission' && /*#__PURE__*/React.createElement(Form.Item, {
|
|
154
|
+
label: t('AFTER_CONTEST_START')
|
|
155
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
156
|
+
name: 'submissionLimitTime',
|
|
157
|
+
noStyle: true,
|
|
158
|
+
"data-testid": "submissionLimitTime",
|
|
159
|
+
dependencies: ['contestTime', 'limitTime'],
|
|
160
|
+
rules: [function (_ref3) {
|
|
161
|
+
var getFieldValue = _ref3.getFieldValue;
|
|
162
|
+
return {
|
|
163
|
+
validator: function validator(_, value) {
|
|
164
|
+
var _contestTime$;
|
|
165
|
+
var contestTime = getFieldValue('contestTime');
|
|
166
|
+
var limitHour = getFieldValue(['limitTime', 'limitHour']);
|
|
167
|
+
var limitMinute = getFieldValue(['limitTime', 'limitMinute']);
|
|
168
|
+
if (contestType !== 'contest' && contestTime === 'limitTime' && value.limitHour * 60 + value.limitMinute >= limitHour * 60 + limitMinute) {
|
|
169
|
+
return Promise.reject(new Error(t('TimedSubmissionError')));
|
|
170
|
+
} else if (contestType === 'contest' && ((_contestTime$ = contestTime[1]) === null || _contestTime$ === void 0 ? void 0 : _contestTime$.diff(contestTime[0], 'minute')) <= value.limitHour * 60 + value.limitMinute) {
|
|
171
|
+
return Promise.reject(new Error(t('TimedSubmissionError')));
|
|
172
|
+
}
|
|
173
|
+
return Promise.resolve();
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}]
|
|
177
|
+
}, /*#__PURE__*/React.createElement(ContestTimeInput, {
|
|
178
|
+
suffix: t('ALLOW_SUBMIT')
|
|
179
|
+
}))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
180
|
+
name: 'disorder',
|
|
181
|
+
label: t('RandomOrder')
|
|
182
|
+
}, /*#__PURE__*/React.createElement(Checkbox.Group, null, /*#__PURE__*/React.createElement(Row, {
|
|
183
|
+
gutter: [8, 2]
|
|
184
|
+
}, /*#__PURE__*/React.createElement(Col, {
|
|
185
|
+
span: 8
|
|
186
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
187
|
+
value: "part"
|
|
188
|
+
}, t('PartOrder'))), /*#__PURE__*/React.createElement(Col, {
|
|
189
|
+
span: 8
|
|
190
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
191
|
+
value: "program"
|
|
192
|
+
}, t('ProgrammingOrder'))), /*#__PURE__*/React.createElement(Col, {
|
|
193
|
+
span: 8
|
|
194
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
195
|
+
value: "objective"
|
|
196
|
+
}, t('ObjectiveOrder'))), /*#__PURE__*/React.createElement(Col, {
|
|
197
|
+
span: 8
|
|
198
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
199
|
+
value: "combinationInternal"
|
|
200
|
+
}, t('CompositeInternalOrder'))), /*#__PURE__*/React.createElement(Col, {
|
|
201
|
+
span: 8
|
|
202
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
203
|
+
value: "singleOption"
|
|
204
|
+
}, t('SingleChoiceOrder'))), /*#__PURE__*/React.createElement(Col, {
|
|
205
|
+
span: 8
|
|
206
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
207
|
+
value: "multipleOption"
|
|
208
|
+
}, t('MultipleChoiceOrder'))), /*#__PURE__*/React.createElement(Col, {
|
|
209
|
+
span: 24
|
|
210
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
211
|
+
style: {
|
|
212
|
+
fontSize: '14px',
|
|
213
|
+
color: 'rgba(0, 0, 0, 0.45)',
|
|
214
|
+
marginTop: '10px'
|
|
215
|
+
}
|
|
216
|
+
}, t('practice_end_restore_order')))))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
217
|
+
name: 'restriction',
|
|
218
|
+
label: /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("span", null, t('ResourceRestriction')), /*#__PURE__*/React.createElement(Tooltip, {
|
|
219
|
+
title: t('ResourceRestrictionDesc')
|
|
220
|
+
}, /*#__PURE__*/React.createElement(QuestionCircleOutlined, null)))
|
|
221
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
222
|
+
value: 'never'
|
|
223
|
+
}, t('No_limit')), /*#__PURE__*/React.createElement(Radio, {
|
|
224
|
+
value: 'beforeHomeworkExam'
|
|
225
|
+
}, t('RestrictionsDuringHomeworkExam')))));
|
|
226
|
+
};
|
|
227
|
+
export default GeneralConfigItem;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { Form, InputNumber, Radio, Select } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useLocale } from "../locales";
|
|
5
|
+
import TimingFormItem from "./TimingFormItem";
|
|
6
|
+
import { langVL } from "./define";
|
|
7
|
+
var ProgramConfigItem = function ProgramConfigItem(_ref) {
|
|
8
|
+
var type = _ref.type;
|
|
9
|
+
var _useLocale = useLocale('AcConfig'),
|
|
10
|
+
t = _useLocale.format;
|
|
11
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
style: {
|
|
13
|
+
display: type === 'advanced' ? 'block' : 'none'
|
|
14
|
+
}
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
16
|
+
label: t('ProgrammingLanguage'),
|
|
17
|
+
name: 'lang',
|
|
18
|
+
rules: [{
|
|
19
|
+
required: true
|
|
20
|
+
}]
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
22
|
+
mode: "multiple",
|
|
23
|
+
"data-testid": "lang-select",
|
|
24
|
+
allowClear: true,
|
|
25
|
+
style: {
|
|
26
|
+
maxWidth: 350
|
|
27
|
+
},
|
|
28
|
+
options: Array.from(langVL, function (_ref2) {
|
|
29
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
30
|
+
value = _ref3[0],
|
|
31
|
+
label = _ref3[1];
|
|
32
|
+
return {
|
|
33
|
+
label: label,
|
|
34
|
+
value: value
|
|
35
|
+
};
|
|
36
|
+
})
|
|
37
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
38
|
+
label: t('personalScoreVisibility'),
|
|
39
|
+
name: 'personalScoreVisibility'
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
41
|
+
value: 'always',
|
|
42
|
+
"data-testid": "personalScoreVisibility-always"
|
|
43
|
+
}, t('always')), /*#__PURE__*/React.createElement(Radio, {
|
|
44
|
+
value: 'never'
|
|
45
|
+
}, t('never')), /*#__PURE__*/React.createElement(Radio, {
|
|
46
|
+
value: 'afterExam'
|
|
47
|
+
}, t('afterExam')))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
48
|
+
name: 'tipRelease',
|
|
49
|
+
label: t('TIPS_DISPLAY')
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
51
|
+
value: 'afterExam',
|
|
52
|
+
"data-testid": "tipRelease-afterExam"
|
|
53
|
+
}, t('DISPLAY_AFTER_TEACHER_CONFIRMATION_01')), /*#__PURE__*/React.createElement(Radio, {
|
|
54
|
+
value: 'afterGradeRelease'
|
|
55
|
+
}, t('DISPLAY_AFTER_TEACHER_CONFIRMATION_02')), /*#__PURE__*/React.createElement(Radio, {
|
|
56
|
+
value: 'afterApproval'
|
|
57
|
+
}, t('DISPLAY_AFTER_TEACHER_CONFIRMATION')), /*#__PURE__*/React.createElement(Radio, {
|
|
58
|
+
value: 'scheduled'
|
|
59
|
+
}, t('TIMED_DISPLAY')), /*#__PURE__*/React.createElement(Radio, {
|
|
60
|
+
value: 'always'
|
|
61
|
+
}, t('Always_Visible')))), /*#__PURE__*/React.createElement(TimingFormItem, {
|
|
62
|
+
field: 'tipRelease',
|
|
63
|
+
name: 'tipTime',
|
|
64
|
+
label: t('TIPS_DISPLAY_TIME')
|
|
65
|
+
}), /*#__PURE__*/React.createElement(Form.Item, {
|
|
66
|
+
label: t('RankingValue'),
|
|
67
|
+
name: 'scoreTypeInMatch'
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
69
|
+
value: 'latestSubmit',
|
|
70
|
+
"data-testid": "scoreTypeInMatch-latestSubmit"
|
|
71
|
+
}, t('LatestSubmit')), /*#__PURE__*/React.createElement(Radio, {
|
|
72
|
+
value: 'maxScore'
|
|
73
|
+
}, t('maxScore')))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
74
|
+
label: t('rankingMethod'),
|
|
75
|
+
name: 'rankingMethod'
|
|
76
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
77
|
+
value: 'score',
|
|
78
|
+
"data-testid": "rankingMethod-score"
|
|
79
|
+
}, t('Sort_By_Score')), /*#__PURE__*/React.createElement(Radio, {
|
|
80
|
+
value: 'acNumber'
|
|
81
|
+
}, t('Sort_By_AC_Count')))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
82
|
+
label: t('highScoreProgramVisibility'),
|
|
83
|
+
name: 'highScoreProgramVisibility'
|
|
84
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
85
|
+
value: 'always',
|
|
86
|
+
"data-testid": "highScoreProgramVisibility-always"
|
|
87
|
+
}, t('always')), /*#__PURE__*/React.createElement(Radio, {
|
|
88
|
+
value: 'never'
|
|
89
|
+
}, t('never')), /*#__PURE__*/React.createElement(Radio, {
|
|
90
|
+
value: 'afterExam'
|
|
91
|
+
}, t('afterExam'))))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
92
|
+
label: t('downloadDataEnable'),
|
|
93
|
+
name: 'downloadDataEnable'
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
|
|
95
|
+
value: true,
|
|
96
|
+
"data-testid": "downloadDataEnable-true"
|
|
97
|
+
}, t('ALLOW')), /*#__PURE__*/React.createElement(Radio, {
|
|
98
|
+
value: false,
|
|
99
|
+
"data-testid": "downloadDataEnable-false"
|
|
100
|
+
}, t('PROHIBIT')))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
101
|
+
noStyle: true,
|
|
102
|
+
shouldUpdate: function shouldUpdate(perValues, nextValues) {
|
|
103
|
+
return perValues['downloadDataEnable'] !== nextValues['downloadDataEnable'];
|
|
104
|
+
}
|
|
105
|
+
}, function (_ref4) {
|
|
106
|
+
var getFieldValue = _ref4.getFieldValue;
|
|
107
|
+
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
108
|
+
label: t('NumberDownloadsAllowed'),
|
|
109
|
+
name: 'downloadDataCount'
|
|
110
|
+
}, /*#__PURE__*/React.createElement(InputNumber, {
|
|
111
|
+
min: 0,
|
|
112
|
+
max: 100,
|
|
113
|
+
"data-testid": "downloadDataCount-input",
|
|
114
|
+
disabled: !getFieldValue('downloadDataEnable')
|
|
115
|
+
// formatter={(value) => parseInt(value?.toString()).toString() || '0'}
|
|
116
|
+
// parser={(val) => {
|
|
117
|
+
// return parseInt(val);
|
|
118
|
+
// }}
|
|
119
|
+
}));
|
|
120
|
+
}));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export default ProgramConfigItem;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DatePicker, Form } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useLocale } from "../locales";
|
|
4
|
+
var TimingFormItem = function TimingFormItem(_ref) {
|
|
5
|
+
var field = _ref.field,
|
|
6
|
+
name = _ref.name,
|
|
7
|
+
label = _ref.label;
|
|
8
|
+
var _useLocale = useLocale('AcConfig'),
|
|
9
|
+
locale = _useLocale.locale;
|
|
10
|
+
var lang = {
|
|
11
|
+
zh_CN: 'zh',
|
|
12
|
+
en_US: 'en'
|
|
13
|
+
}[locale];
|
|
14
|
+
var showTimeFormat = {
|
|
15
|
+
zh_CN: 'HH:mm',
|
|
16
|
+
en_US: 'h:mm A'
|
|
17
|
+
}[locale];
|
|
18
|
+
var dateFormat = {
|
|
19
|
+
zh_CN: 'YYYY-MM-DD HH:mm',
|
|
20
|
+
en_US: 'YYYY-MM-DD h:mm A'
|
|
21
|
+
}[locale];
|
|
22
|
+
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
23
|
+
noStyle: true,
|
|
24
|
+
shouldUpdate: function shouldUpdate(perValues, nextValues) {
|
|
25
|
+
// 成绩发布方式改变时更新
|
|
26
|
+
return perValues[field] !== nextValues[field];
|
|
27
|
+
}
|
|
28
|
+
}, function (_ref2) {
|
|
29
|
+
var getFieldValue = _ref2.getFieldValue;
|
|
30
|
+
// 成绩发布定时发布时显示
|
|
31
|
+
var isVisible = getFieldValue(field) === 'scheduled';
|
|
32
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isVisible && /*#__PURE__*/React.createElement(Form.Item, {
|
|
33
|
+
name: name,
|
|
34
|
+
label: label,
|
|
35
|
+
rules: [{
|
|
36
|
+
required: true
|
|
37
|
+
}]
|
|
38
|
+
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
39
|
+
showTime: {
|
|
40
|
+
use12Hours: lang === 'en',
|
|
41
|
+
format: showTimeFormat
|
|
42
|
+
},
|
|
43
|
+
format: dateFormat
|
|
44
|
+
})));
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
export default TimingFormItem;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
export type ConfigStatus = 'afterExam' | 'afterApproval' | 'scheduled' | 'afterGradeRelease';
|
|
3
|
+
export type SubmissionConfigStatus = 'noEarlySubmission' | 'allowEarlySubmission';
|
|
4
|
+
export type restrictionStatus = {
|
|
5
|
+
type: 'never' | 'beforeHomeworkExam';
|
|
6
|
+
};
|
|
7
|
+
export interface GeneralConfigStatus<T extends string = 'General'> {
|
|
8
|
+
type: T extends 'Grade' ? Omit<ConfigStatus, 'afterGradeRelease'> : T extends 'Ranklist' ? Omit<ConfigStatus, 'afterExam'> | 'always' : T extends 'Submission' ? SubmissionConfigStatus : ConfigStatus;
|
|
9
|
+
scheduled?: {
|
|
10
|
+
releaseTime?: number;
|
|
11
|
+
};
|
|
12
|
+
submissionTimed?: number;
|
|
13
|
+
}
|
|
14
|
+
export type ProgramConfigStatus = 'always' | 'never' | 'afterExam';
|
|
15
|
+
export interface DisorderConfigStatus {
|
|
16
|
+
part: boolean;
|
|
17
|
+
program: boolean;
|
|
18
|
+
objective: boolean;
|
|
19
|
+
combinationInternal: boolean;
|
|
20
|
+
singleOption: boolean;
|
|
21
|
+
multipleOption: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface Configuration {
|
|
24
|
+
general: {
|
|
25
|
+
gradeRelease: GeneralConfigStatus<'Grade'>;
|
|
26
|
+
rankListRelease: GeneralConfigStatus<'Ranklist'>;
|
|
27
|
+
paperRelease: GeneralConfigStatus;
|
|
28
|
+
answerRelease: GeneralConfigStatus;
|
|
29
|
+
submission: GeneralConfigStatus<'Submission'>;
|
|
30
|
+
tipRelease: GeneralConfigStatus;
|
|
31
|
+
disorder: DisorderConfigStatus;
|
|
32
|
+
restriction: restrictionStatus;
|
|
33
|
+
};
|
|
34
|
+
rank: {
|
|
35
|
+
rankListShowRealName: boolean;
|
|
36
|
+
rankShowUserLabel: boolean;
|
|
37
|
+
};
|
|
38
|
+
program: {
|
|
39
|
+
highScoreProgramVisibility: ProgramConfigStatus;
|
|
40
|
+
personalScoreVisibility: ProgramConfigStatus;
|
|
41
|
+
rankingMethod: 'score' | 'acNumber';
|
|
42
|
+
downloadDataEnable: boolean;
|
|
43
|
+
downloadDataCount: number;
|
|
44
|
+
scoreTypeInMatch: 'latestSubmit' | 'maxScore';
|
|
45
|
+
lang: string[];
|
|
46
|
+
};
|
|
47
|
+
homework?: {
|
|
48
|
+
noLimit?: boolean;
|
|
49
|
+
limitTime?: number;
|
|
50
|
+
};
|
|
51
|
+
contest?: {
|
|
52
|
+
startTime?: number;
|
|
53
|
+
endTime?: number;
|
|
54
|
+
};
|
|
55
|
+
type?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface RawConfig {
|
|
58
|
+
contestTime?: [Dayjs, Dayjs] | number | string;
|
|
59
|
+
gradeTime: Dayjs;
|
|
60
|
+
rankListTime: Dayjs;
|
|
61
|
+
paperTime: Dayjs;
|
|
62
|
+
answerTime: Dayjs;
|
|
63
|
+
gradeRelease: GeneralConfigStatus<'Grade'>['type'];
|
|
64
|
+
rankListRelease: GeneralConfigStatus<'Ranklist'>['type'];
|
|
65
|
+
paperRelease: GeneralConfigStatus['type'];
|
|
66
|
+
answerRelease: GeneralConfigStatus['type'];
|
|
67
|
+
tipRelease: GeneralConfigStatus['type'];
|
|
68
|
+
tipTime: Dayjs;
|
|
69
|
+
submission: SubmissionConfigStatus;
|
|
70
|
+
restriction: restrictionStatus['type'];
|
|
71
|
+
disorder: Array<keyof DisorderConfigStatus>;
|
|
72
|
+
/**
|
|
73
|
+
* 个人分数可见性
|
|
74
|
+
*/
|
|
75
|
+
personalScoreVisibility: 'always' | 'never' | 'afterExam';
|
|
76
|
+
/**
|
|
77
|
+
* 排名方式
|
|
78
|
+
*/
|
|
79
|
+
rankingMethod: 'score' | 'acNumber';
|
|
80
|
+
/**
|
|
81
|
+
* 高分代码可见性
|
|
82
|
+
*/
|
|
83
|
+
highScoreProgramVisibility: 'always' | 'never' | 'afterExam';
|
|
84
|
+
/**
|
|
85
|
+
* XJOI 比赛是否允许下载错误数据
|
|
86
|
+
*/
|
|
87
|
+
downloadDataEnable: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* 允许下载次数
|
|
90
|
+
*/
|
|
91
|
+
downloadDataCount: number;
|
|
92
|
+
scoreTypeInMatch: 'latestSubmit' | 'maxScore';
|
|
93
|
+
lang: ('gcc' | 'g++' | 'g++11' | 'g++14' | 'g++17' | 'python2.7' | 'python3.8' | 'java8' | 'fpc')[];
|
|
94
|
+
/**
|
|
95
|
+
* 学生排行榜真实姓名
|
|
96
|
+
*/
|
|
97
|
+
rankListShowRealName: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* 学生排行榜用户标签
|
|
100
|
+
*/
|
|
101
|
+
rankShowUserLabel: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* 提前交卷时间限制
|
|
104
|
+
*/
|
|
105
|
+
submissionLimitTime: {
|
|
106
|
+
limitHour: number;
|
|
107
|
+
limitMinute: number;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* 作业时长限制
|
|
111
|
+
*/
|
|
112
|
+
limitTime: {
|
|
113
|
+
limitHour: number;
|
|
114
|
+
limitMinute: number;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export type ReleaseType = keyof Omit<Configuration['general'], 'disorder'>;
|
|
118
|
+
export type GenerateConfigReturn<T extends ReleaseType> = Record<T, {
|
|
119
|
+
type: RawConfig[T];
|
|
120
|
+
scheduled: {
|
|
121
|
+
releaseTime?: number;
|
|
122
|
+
};
|
|
123
|
+
}>;
|
|
124
|
+
export declare const langVL: Map<string, string>;
|
|
125
|
+
export declare enum ContestExamType {
|
|
126
|
+
Homework = "homework",
|
|
127
|
+
Exam = "contest"
|
|
128
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var langVL = new Map([['g++11', 'C++11'], ['g++14', 'C++14'], ['g++17', 'C++17'], ['g++', 'C++'], ['gcc', 'C'], ['fpc', 'Pascal'], ['python2.7', 'Python2.7'], ['python3.8', 'Python3.8'], ['java8', 'Java8']]);
|
|
2
|
+
export var ContestExamType = /*#__PURE__*/function (ContestExamType) {
|
|
3
|
+
ContestExamType["Homework"] = "homework";
|
|
4
|
+
ContestExamType["Exam"] = "contest";
|
|
5
|
+
return ContestExamType;
|
|
6
|
+
}({});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormInstance, FormProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Configuration, ContestExamType, RawConfig } from './define';
|
|
4
|
+
export interface AcConfigProps extends Omit<FormProps, 'children'> {
|
|
5
|
+
type?: 'simple' | 'advanced';
|
|
6
|
+
contestType?: ContestExamType;
|
|
7
|
+
initialValues?: Configuration;
|
|
8
|
+
onFinish?: (values: Configuration) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface AcConfigHandle {
|
|
11
|
+
form: FormInstance<any>;
|
|
12
|
+
}
|
|
13
|
+
export declare const getConfigData: ({ rawData, contestType, }: {
|
|
14
|
+
rawData: RawConfig;
|
|
15
|
+
contestType: ContestExamType;
|
|
16
|
+
}) => Configuration;
|
|
17
|
+
declare const AcConfig: React.ForwardRefExoticComponent<AcConfigProps & React.RefAttributes<AcConfigHandle>>;
|
|
18
|
+
export default AcConfig;
|