x-star-design 0.0.92 → 0.0.94

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.
@@ -1,5 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { Form, InputNumber, Radio, Select } from 'antd';
2
+ import { InfoCircleOutlined } from '@ant-design/icons';
3
+ import { Flex, Form, InputNumber, Radio, Select, Tooltip } from 'antd';
3
4
  import React from 'react';
4
5
  import { useLocale } from "../locales";
5
6
  import TimingFormItem from "./TimingFormItem";
@@ -10,6 +11,18 @@ var ProgramConfigItem = function ProgramConfigItem(_ref) {
10
11
  isFinish = _ref.isFinish;
11
12
  var _useLocale = useLocale('AcConfig'),
12
13
  t = _useLocale.format;
14
+ var form = Form.useFormInstance();
15
+
16
+ // 监听双轨评测选项变化
17
+ var handleDualEvaluationChange = function handleDualEvaluationChange(e) {
18
+ var dualEvaluationEnabled = e.target.value;
19
+ // 如果开启了双轨评测,自动禁止下载错误数据
20
+ if (dualEvaluationEnabled) {
21
+ form.setFieldsValue({
22
+ downloadDataEnable: false
23
+ });
24
+ }
25
+ };
13
26
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
14
27
  style: {
15
28
  display: type === 'advanced' ? 'block' : 'none'
@@ -95,33 +108,45 @@ var ProgramConfigItem = function ProgramConfigItem(_ref) {
95
108
  }, t('never')), /*#__PURE__*/React.createElement(Radio, {
96
109
  value: 'afterExam'
97
110
  }, t('afterExam'))))), /*#__PURE__*/React.createElement(Form.Item, {
98
- label: t('downloadDataEnable'),
99
- name: 'downloadDataEnable'
100
- }, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
101
- value: true,
102
- "data-testid": "downloadDataEnable-true"
103
- }, t('ALLOW')), /*#__PURE__*/React.createElement(Radio, {
104
- value: false,
105
- "data-testid": "downloadDataEnable-false"
106
- }, t('PROHIBIT')))), /*#__PURE__*/React.createElement(Form.Item, {
107
111
  noStyle: true,
108
- shouldUpdate: function shouldUpdate(perValues, nextValues) {
109
- return perValues['downloadDataEnable'] !== nextValues['downloadDataEnable'];
112
+ shouldUpdate: function shouldUpdate(prevValues, currentValues) {
113
+ return prevValues.dualEvaluation !== currentValues.dualEvaluation;
110
114
  }
111
115
  }, function (_ref4) {
112
116
  var getFieldValue = _ref4.getFieldValue;
113
- return /*#__PURE__*/React.createElement(Form.Item, {
114
- label: t('NumberDownloadsAllowed'),
115
- name: 'downloadDataCount'
116
- }, /*#__PURE__*/React.createElement(InputNumber, {
117
- min: 0,
118
- max: 100,
119
- "data-testid": "downloadDataCount-input",
120
- disabled: !getFieldValue('downloadDataEnable')
121
- // formatter={(value) => parseInt(value?.toString()).toString() || '0'}
122
- // parser={(val) => {
123
- // return parseInt(val);
124
- // }}
117
+ // 获取双轨评测的当前值
118
+ var dualEvaluationEnabled = getFieldValue('dualEvaluation');
119
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
120
+ label: t('downloadDataEnable'),
121
+ name: 'downloadDataEnable'
122
+ }, /*#__PURE__*/React.createElement(Radio.Group, {
123
+ disabled: dualEvaluationEnabled === true
124
+ }, /*#__PURE__*/React.createElement(Radio, {
125
+ value: true,
126
+ "data-testid": "downloadDataEnable-true"
127
+ }, t('ALLOW')), /*#__PURE__*/React.createElement(Radio, {
128
+ value: false,
129
+ "data-testid": "downloadDataEnable-false"
130
+ }, t('PROHIBIT')))), /*#__PURE__*/React.createElement(Form.Item, {
131
+ noStyle: true,
132
+ shouldUpdate: function shouldUpdate(perValues, nextValues) {
133
+ return perValues['downloadDataEnable'] !== nextValues['downloadDataEnable'];
134
+ }
135
+ }, function (_ref5) {
136
+ var getFieldValue = _ref5.getFieldValue;
137
+ return /*#__PURE__*/React.createElement(Form.Item, {
138
+ label: t('NumberDownloadsAllowed'),
139
+ name: 'downloadDataCount'
140
+ }, /*#__PURE__*/React.createElement(InputNumber, {
141
+ min: 0,
142
+ max: 100,
143
+ "data-testid": "downloadDataCount-input",
144
+ disabled: !getFieldValue('downloadDataEnable')
145
+ // formatter={(value) => parseInt(value?.toString()).toString() || '0'}
146
+ // parser={(val) => {
147
+ // return parseInt(val);
148
+ // }}
149
+ }));
125
150
  }));
126
151
  }), /*#__PURE__*/React.createElement(Form.Item, {
127
152
  label: t('Show_Top_N_Submissions'),
@@ -138,8 +163,8 @@ var ProgramConfigItem = function ProgramConfigItem(_ref) {
138
163
  shouldUpdate: function shouldUpdate(perValues, nextValues) {
139
164
  return perValues['showTopNSubmission'] !== nextValues['showTopNSubmission'];
140
165
  }
141
- }, function (_ref5) {
142
- var getFieldValue = _ref5.getFieldValue;
166
+ }, function (_ref6) {
167
+ var getFieldValue = _ref6.getFieldValue;
143
168
  var isVisible = getFieldValue('showTopNSubmission');
144
169
  return isVisible && /*#__PURE__*/React.createElement(Form.Item, {
145
170
  label: t('Top_N_Submissions'),
@@ -149,6 +174,23 @@ var ProgramConfigItem = function ProgramConfigItem(_ref) {
149
174
  max: 100,
150
175
  "data-testid": "showTopNSubmission-input"
151
176
  }));
152
- }));
177
+ }), /*#__PURE__*/React.createElement(Form.Item, {
178
+ label: /*#__PURE__*/React.createElement(Flex, {
179
+ align: "center",
180
+ gap: 2
181
+ }, /*#__PURE__*/React.createElement("div", null, t('Dual_Track_Judgement')), /*#__PURE__*/React.createElement(Tooltip, {
182
+ title: t('Dual_Track_Judgement_Tooltip')
183
+ }, /*#__PURE__*/React.createElement(InfoCircleOutlined, null))),
184
+ name: 'dualEvaluation',
185
+ extra: t('Dual_Track_Judgement_Extra')
186
+ }, /*#__PURE__*/React.createElement(Radio.Group, {
187
+ onChange: handleDualEvaluationChange
188
+ }, /*#__PURE__*/React.createElement(Radio, {
189
+ value: true,
190
+ "data-testid": "dualEvaluation-true"
191
+ }, t('Enable')), /*#__PURE__*/React.createElement(Radio, {
192
+ value: false,
193
+ "data-testid": "dualEvaluation-false"
194
+ }, t('Disable')))));
153
195
  };
154
196
  export default ProgramConfigItem;
@@ -46,6 +46,7 @@ export interface Configuration {
46
46
  lang: string[];
47
47
  showTopNSubmission: boolean;
48
48
  showTopNSubmissionCount: number;
49
+ dualEvaluation: boolean;
49
50
  };
50
51
  homework?: {
51
52
  noLimit?: boolean;
@@ -102,6 +103,10 @@ export interface RawConfig {
102
103
  * 赛中仅显示前n项提交数量
103
104
  */
104
105
  showTopNSubmissionCount: number;
106
+ /**
107
+ * 双轨评测
108
+ */
109
+ dualEvaluation: boolean;
105
110
  /**
106
111
  * 学生排行榜真实姓名
107
112
  */
@@ -24,7 +24,7 @@ export var getConfigData = function getConfigData(_ref) {
24
24
  return _defineProperty({}, release, {
25
25
  type: status,
26
26
  scheduled: {
27
- releaseTime: status === 'scheduled' ? (rawData === null || rawData === void 0 ? void 0 : rawData[timeType]).second(0).unix().valueOf() : status === 'started' ? ((rawData === null || rawData === void 0 ? void 0 : rawData[timeType]).limitHour || 0) * 60 + ((rawData === null || rawData === void 0 ? void 0 : rawData[timeType]).limitMinute || 0) : undefined
27
+ releaseTime: status === 'scheduled' ? (rawData === null || rawData === void 0 ? void 0 : rawData[timeType]).second(0).unix().valueOf() : status === 'started' ? ((rawData === null || rawData === void 0 ? void 0 : rawData[timeType]).limitHour || 0) * 3600 + ((rawData === null || rawData === void 0 ? void 0 : rawData[timeType]).limitMinute || 0) * 60 : undefined
28
28
  }
29
29
  });
30
30
  };
@@ -68,7 +68,8 @@ export var getConfigData = function getConfigData(_ref) {
68
68
  scoreTypeInMatch: rawData.scoreTypeInMatch,
69
69
  lang: rawData.lang,
70
70
  showTopNSubmission: rawData.showTopNSubmission,
71
- showTopNSubmissionCount: rawData.showTopNSubmissionCount
71
+ showTopNSubmissionCount: rawData.showTopNSubmissionCount,
72
+ dualEvaluation: rawData.dualEvaluation
72
73
  }
73
74
  };
74
75
  if (contestType === ContestExamType.Exam) {
@@ -158,8 +159,8 @@ var AcConfig = /*#__PURE__*/forwardRef(function (_ref3, ref) {
158
159
  paperTime: dayjs.unix((paperRelease === null || paperRelease === void 0 ? void 0 : (_paperRelease$schedul = paperRelease.scheduled) === null || _paperRelease$schedul === void 0 ? void 0 : _paperRelease$schedul.releaseTime) || dayjs().valueOf() / 1000),
159
160
  answerRelease: answerRelease === null || answerRelease === void 0 ? void 0 : answerRelease.type,
160
161
  answerTime: (answerRelease === null || answerRelease === void 0 ? void 0 : answerRelease.type) === 'started' ? {
161
- limitHour: Math.floor(((answerRelease === null || answerRelease === void 0 ? void 0 : (_answerRelease$schedu = answerRelease.scheduled) === null || _answerRelease$schedu === void 0 ? void 0 : _answerRelease$schedu.releaseTime) || 0) / 60),
162
- limitMinute: ((answerRelease === null || answerRelease === void 0 ? void 0 : (_answerRelease$schedu2 = answerRelease.scheduled) === null || _answerRelease$schedu2 === void 0 ? void 0 : _answerRelease$schedu2.releaseTime) || 0) % 60
162
+ limitHour: Math.floor(((answerRelease === null || answerRelease === void 0 ? void 0 : (_answerRelease$schedu = answerRelease.scheduled) === null || _answerRelease$schedu === void 0 ? void 0 : _answerRelease$schedu.releaseTime) || 0) / 3600),
163
+ limitMinute: ((answerRelease === null || answerRelease === void 0 ? void 0 : (_answerRelease$schedu2 = answerRelease.scheduled) === null || _answerRelease$schedu2 === void 0 ? void 0 : _answerRelease$schedu2.releaseTime) || 0) % 3600 / 60
163
164
  } : dayjs.unix((answerRelease === null || answerRelease === void 0 ? void 0 : (_answerRelease$schedu3 = answerRelease.scheduled) === null || _answerRelease$schedu3 === void 0 ? void 0 : _answerRelease$schedu3.releaseTime) || dayjs().valueOf() / 1000),
164
165
  rankListShowRealName: rankListShowRealName,
165
166
  rankShowUserLabel: rankShowUserLabel,
@@ -172,8 +173,8 @@ var AcConfig = /*#__PURE__*/forwardRef(function (_ref3, ref) {
172
173
  personalScoreVisibility: personalScoreVisibility,
173
174
  tipRelease: tipRelease === null || tipRelease === void 0 ? void 0 : tipRelease.type,
174
175
  tipTime: (tipRelease === null || tipRelease === void 0 ? void 0 : tipRelease.type) === 'started' ? {
175
- limitHour: Math.floor(((tipRelease === null || tipRelease === void 0 ? void 0 : (_tipRelease$scheduled = tipRelease.scheduled) === null || _tipRelease$scheduled === void 0 ? void 0 : _tipRelease$scheduled.releaseTime) || 0) / 60),
176
- limitMinute: ((tipRelease === null || tipRelease === void 0 ? void 0 : (_tipRelease$scheduled2 = tipRelease.scheduled) === null || _tipRelease$scheduled2 === void 0 ? void 0 : _tipRelease$scheduled2.releaseTime) || 0) % 60
176
+ limitHour: Math.floor(((tipRelease === null || tipRelease === void 0 ? void 0 : (_tipRelease$scheduled = tipRelease.scheduled) === null || _tipRelease$scheduled === void 0 ? void 0 : _tipRelease$scheduled.releaseTime) || 0) / 3600),
177
+ limitMinute: ((tipRelease === null || tipRelease === void 0 ? void 0 : (_tipRelease$scheduled2 = tipRelease.scheduled) === null || _tipRelease$scheduled2 === void 0 ? void 0 : _tipRelease$scheduled2.releaseTime) || 0) % 3600 / 60
177
178
  } : dayjs.unix((tipRelease === null || tipRelease === void 0 ? void 0 : (_tipRelease$scheduled3 = tipRelease.scheduled) === null || _tipRelease$scheduled3 === void 0 ? void 0 : _tipRelease$scheduled3.releaseTime) || dayjs().valueOf() / 1000),
178
179
  scoreTypeInMatch: scoreTypeInMatch,
179
180
  rankingMethod: rankingMethod,
@@ -28,7 +28,8 @@ export var CONTEST_TEMPLATES = {
28
28
  submissionLimitTime: {
29
29
  limitHour: 0,
30
30
  limitMinute: 0
31
- }
31
+ },
32
+ dualEvaluation: false
32
33
  },
33
34
  XCPC: {
34
35
  gradeTime: dayjs(),
@@ -58,7 +59,8 @@ export var CONTEST_TEMPLATES = {
58
59
  submissionLimitTime: {
59
60
  limitHour: 0,
60
61
  limitMinute: 0
61
- }
62
+ },
63
+ dualEvaluation: false
62
64
  },
63
65
  IOI: {
64
66
  gradeTime: dayjs().add(1, 'day'),
@@ -88,7 +90,8 @@ export var CONTEST_TEMPLATES = {
88
90
  submissionLimitTime: {
89
91
  limitHour: 0,
90
92
  limitMinute: 0
91
- }
93
+ },
94
+ dualEvaluation: false
92
95
  },
93
96
  HOMEWORK1: {
94
97
  contestTime: 'noLimit',
@@ -123,7 +126,8 @@ export var CONTEST_TEMPLATES = {
123
126
  limitTime: {
124
127
  limitHour: 0,
125
128
  limitMinute: 0
126
- }
129
+ },
130
+ dualEvaluation: false
127
131
  },
128
132
  HOMEWORK2: {
129
133
  contestTime: 'limitTime',
@@ -158,6 +162,7 @@ export var CONTEST_TEMPLATES = {
158
162
  limitTime: {
159
163
  limitHour: 2,
160
164
  limitMinute: 0
161
- }
165
+ },
166
+ dualEvaluation: false
162
167
  }
163
168
  };
@@ -158,6 +158,11 @@ declare const _default: {
158
158
  readonly Top_N_Submissions: "Top N";
159
159
  readonly After_Contest_Start: "Display after N mins of contest start";
160
160
  readonly After_Contest_Start_N: "N mins of contest start";
161
+ readonly Dual_Track_Judgement: "Dual Track Judgement";
162
+ readonly Dual_Track_Judgement_Extra: "Enable automatic prohibition of error data download";
163
+ readonly Enable: "Enable";
164
+ readonly Disable: "Disable";
165
+ readonly Dual_Track_Judgement_Tooltip: "During the contest, use the pre-inspection test point, and then switch to the complete test point after the contest to re-judge and overwrite the last submission";
161
166
  };
162
167
  readonly ScoreReport: {
163
168
  readonly In_Game_Total_Score: "Timed Score";
@@ -157,7 +157,12 @@ export default {
157
157
  Show_Top_N_Submissions_Extra: 'For single problem',
158
158
  Top_N_Submissions: 'Top N',
159
159
  After_Contest_Start: 'Display after N mins of contest start',
160
- After_Contest_Start_N: 'N mins of contest start'
160
+ After_Contest_Start_N: 'N mins of contest start',
161
+ Dual_Track_Judgement: 'Dual Track Judgement',
162
+ Dual_Track_Judgement_Extra: 'Enable automatic prohibition of error data download',
163
+ Enable: 'Enable',
164
+ Disable: 'Disable',
165
+ Dual_Track_Judgement_Tooltip: 'During the contest, use the pre-inspection test point, and then switch to the complete test point after the contest to re-judge and overwrite the last submission'
161
166
  },
162
167
  ScoreReport: {
163
168
  In_Game_Total_Score: 'Timed Score',
@@ -169,6 +169,11 @@ export declare const useLocale: <T extends "VisualDataConfig" | "TranslateButton
169
169
  readonly Top_N_Submissions: "前n项";
170
170
  readonly After_Contest_Start: "比赛开始后N分钟后显示";
171
171
  readonly After_Contest_Start_N: "比赛开始N分钟";
172
+ readonly Dual_Track_Judgement: "双轨评测";
173
+ readonly Dual_Track_Judgement_Extra: "开启后自动禁止下载错误数据";
174
+ readonly Enable: "开启";
175
+ readonly Disable: "关闭";
176
+ readonly Dual_Track_Judgement_Tooltip: "赛中使用预检评测点,赛后自动切换完整评测点重新评测并覆盖最后一次提交";
172
177
  };
173
178
  readonly ScoreReport: {
174
179
  readonly In_Game_Total_Score: "赛中总分";
@@ -390,6 +395,11 @@ export declare const useLocale: <T extends "VisualDataConfig" | "TranslateButton
390
395
  readonly Top_N_Submissions: "Top N";
391
396
  readonly After_Contest_Start: "Display after N mins of contest start";
392
397
  readonly After_Contest_Start_N: "N mins of contest start";
398
+ readonly Dual_Track_Judgement: "Dual Track Judgement";
399
+ readonly Dual_Track_Judgement_Extra: "Enable automatic prohibition of error data download";
400
+ readonly Enable: "Enable";
401
+ readonly Disable: "Disable";
402
+ readonly Dual_Track_Judgement_Tooltip: "During the contest, use the pre-inspection test point, and then switch to the complete test point after the contest to re-judge and overwrite the last submission";
393
403
  };
394
404
  readonly ScoreReport: {
395
405
  readonly In_Game_Total_Score: "Timed Score";
@@ -158,6 +158,11 @@ declare const _default: {
158
158
  readonly Top_N_Submissions: "前n项";
159
159
  readonly After_Contest_Start: "比赛开始后N分钟后显示";
160
160
  readonly After_Contest_Start_N: "比赛开始N分钟";
161
+ readonly Dual_Track_Judgement: "双轨评测";
162
+ readonly Dual_Track_Judgement_Extra: "开启后自动禁止下载错误数据";
163
+ readonly Enable: "开启";
164
+ readonly Disable: "关闭";
165
+ readonly Dual_Track_Judgement_Tooltip: "赛中使用预检评测点,赛后自动切换完整评测点重新评测并覆盖最后一次提交";
161
166
  };
162
167
  readonly ScoreReport: {
163
168
  readonly In_Game_Total_Score: "赛中总分";
@@ -157,7 +157,12 @@ export default {
157
157
  Show_Top_N_Submissions_Extra: '针对单题生效',
158
158
  Top_N_Submissions: '前n项',
159
159
  After_Contest_Start: '比赛开始后N分钟后显示',
160
- After_Contest_Start_N: '比赛开始N分钟'
160
+ After_Contest_Start_N: '比赛开始N分钟',
161
+ Dual_Track_Judgement: '双轨评测',
162
+ Dual_Track_Judgement_Extra: '开启后自动禁止下载错误数据',
163
+ Enable: '开启',
164
+ Disable: '关闭',
165
+ Dual_Track_Judgement_Tooltip: '赛中使用预检评测点,赛后自动切换完整评测点重新评测并覆盖最后一次提交'
161
166
  },
162
167
  ScoreReport: {
163
168
  In_Game_Total_Score: '赛中总分',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-star-design",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "description": "A react component library developed by turingstar",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",