x-star-design 0.0.94 → 0.0.96

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.
@@ -11,18 +11,6 @@ var ProgramConfigItem = function ProgramConfigItem(_ref) {
11
11
  isFinish = _ref.isFinish;
12
12
  var _useLocale = useLocale('AcConfig'),
13
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
- };
26
14
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
27
15
  style: {
28
16
  display: type === 'advanced' ? 'block' : 'none'
@@ -108,47 +96,39 @@ var ProgramConfigItem = function ProgramConfigItem(_ref) {
108
96
  }, t('never')), /*#__PURE__*/React.createElement(Radio, {
109
97
  value: 'afterExam'
110
98
  }, t('afterExam'))))), /*#__PURE__*/React.createElement(Form.Item, {
99
+ label: t('downloadDataEnable'),
100
+ name: 'downloadDataEnable'
101
+ }, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
102
+ value: true,
103
+ "data-testid": "downloadDataEnable-true"
104
+ }, t('ALLOW')), /*#__PURE__*/React.createElement(Radio, {
105
+ value: false,
106
+ "data-testid": "downloadDataEnable-false"
107
+ }, t('PROHIBIT')))), /*#__PURE__*/React.createElement(Form.Item, {
111
108
  noStyle: true,
112
- shouldUpdate: function shouldUpdate(prevValues, currentValues) {
113
- return prevValues.dualEvaluation !== currentValues.dualEvaluation;
109
+ shouldUpdate: function shouldUpdate(perValues, nextValues) {
110
+ return perValues['downloadDataEnable'] !== nextValues['downloadDataEnable'];
114
111
  }
115
112
  }, function (_ref4) {
116
113
  var getFieldValue = _ref4.getFieldValue;
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
- }));
114
+ return /*#__PURE__*/React.createElement(Form.Item, {
115
+ label: t('NumberDownloadsAllowed'),
116
+ name: 'downloadDataCount'
117
+ }, /*#__PURE__*/React.createElement(InputNumber, {
118
+ min: 0,
119
+ max: 100,
120
+ "data-testid": "downloadDataCount-input",
121
+ disabled: !getFieldValue('downloadDataEnable')
122
+ // formatter={(value) => parseInt(value?.toString()).toString() || '0'}
123
+ // parser={(val) => {
124
+ // return parseInt(val);
125
+ // }}
150
126
  }));
151
- }), /*#__PURE__*/React.createElement(Form.Item, {
127
+ }), /*#__PURE__*/React.createElement("div", {
128
+ style: {
129
+ display: type === 'advanced' ? 'block' : 'none'
130
+ }
131
+ }, /*#__PURE__*/React.createElement(Form.Item, {
152
132
  label: t('Show_Top_N_Submissions'),
153
133
  name: 'showTopNSubmission',
154
134
  extra: t('Show_Top_N_Submissions_Extra')
@@ -163,8 +143,8 @@ var ProgramConfigItem = function ProgramConfigItem(_ref) {
163
143
  shouldUpdate: function shouldUpdate(perValues, nextValues) {
164
144
  return perValues['showTopNSubmission'] !== nextValues['showTopNSubmission'];
165
145
  }
166
- }, function (_ref6) {
167
- var getFieldValue = _ref6.getFieldValue;
146
+ }, function (_ref5) {
147
+ var getFieldValue = _ref5.getFieldValue;
168
148
  var isVisible = getFieldValue('showTopNSubmission');
169
149
  return isVisible && /*#__PURE__*/React.createElement(Form.Item, {
170
150
  label: t('Top_N_Submissions'),
@@ -183,14 +163,12 @@ var ProgramConfigItem = function ProgramConfigItem(_ref) {
183
163
  }, /*#__PURE__*/React.createElement(InfoCircleOutlined, null))),
184
164
  name: 'dualEvaluation',
185
165
  extra: t('Dual_Track_Judgement_Extra')
186
- }, /*#__PURE__*/React.createElement(Radio.Group, {
187
- onChange: handleDualEvaluationChange
188
- }, /*#__PURE__*/React.createElement(Radio, {
166
+ }, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
189
167
  value: true,
190
168
  "data-testid": "dualEvaluation-true"
191
169
  }, t('Enable')), /*#__PURE__*/React.createElement(Radio, {
192
170
  value: false,
193
171
  "data-testid": "dualEvaluation-false"
194
- }, t('Disable')))));
172
+ }, t('Disable'))))));
195
173
  };
196
174
  export default ProgramConfigItem;
@@ -133,7 +133,8 @@ var AcConfig = /*#__PURE__*/forwardRef(function (_ref3, ref) {
133
133
  scoreTypeInMatch = _ref6.scoreTypeInMatch,
134
134
  lang = _ref6.lang,
135
135
  showTopNSubmission = _ref6.showTopNSubmission,
136
- showTopNSubmissionCount = _ref6.showTopNSubmissionCount;
136
+ showTopNSubmissionCount = _ref6.showTopNSubmissionCount,
137
+ dualEvaluation = _ref6.dualEvaluation;
137
138
  var _ref7 = (initialValues === null || initialValues === void 0 ? void 0 : initialValues.rank) || {},
138
139
  rankListShowRealName = _ref7.rankListShowRealName,
139
140
  rankShowUserLabel = _ref7.rankShowUserLabel;
@@ -183,7 +184,8 @@ var AcConfig = /*#__PURE__*/forwardRef(function (_ref3, ref) {
183
184
  downloadDataCount: downloadDataCount,
184
185
  restriction: restriction === null || restriction === void 0 ? void 0 : restriction.type,
185
186
  showTopNSubmission: showTopNSubmission,
186
- showTopNSubmissionCount: showTopNSubmissionCount
187
+ showTopNSubmissionCount: showTopNSubmissionCount,
188
+ dualEvaluation: dualEvaluation
187
189
  };
188
190
  useImperativeHandle(ref, function () {
189
191
  return {
@@ -31,6 +31,9 @@ declare const _default: {
31
31
  readonly TIME: "Time";
32
32
  readonly SCORE: "Score";
33
33
  readonly BATCH_ADD: "Batch Add";
34
+ readonly Import_To: "Import To:";
35
+ readonly Full_Test_Point: "Full Test Point";
36
+ readonly Precheck_Test_Point: "Precheck Test Point";
34
37
  };
35
38
  readonly TranslateButton: {
36
39
  readonly CURRENT_LANG: "Current Language:";
@@ -30,7 +30,10 @@ export default {
30
30
  Multi_Cases_Tip: 'You can enter an interval or a number, separated by commas, for example :[1-5],7',
31
31
  TIME: 'Time',
32
32
  SCORE: 'Score',
33
- BATCH_ADD: 'Batch Add'
33
+ BATCH_ADD: 'Batch Add',
34
+ Import_To: 'Import To:',
35
+ Full_Test_Point: 'Full Test Point',
36
+ Precheck_Test_Point: 'Precheck Test Point'
34
37
  },
35
38
  TranslateButton: {
36
39
  CURRENT_LANG: 'Current Language:'
@@ -42,6 +42,9 @@ export declare const useLocale: <T extends "VisualDataConfig" | "TranslateButton
42
42
  readonly TIME: "时间";
43
43
  readonly SCORE: "得分";
44
44
  readonly BATCH_ADD: "批量添加";
45
+ readonly Import_To: "导入至:";
46
+ readonly Full_Test_Point: "完整评测点";
47
+ readonly Precheck_Test_Point: "预检评测点";
45
48
  };
46
49
  readonly TranslateButton: {
47
50
  readonly CURRENT_LANG: "当前语言:";
@@ -268,6 +271,9 @@ export declare const useLocale: <T extends "VisualDataConfig" | "TranslateButton
268
271
  readonly TIME: "Time";
269
272
  readonly SCORE: "Score";
270
273
  readonly BATCH_ADD: "Batch Add";
274
+ readonly Import_To: "Import To:";
275
+ readonly Full_Test_Point: "Full Test Point";
276
+ readonly Precheck_Test_Point: "Precheck Test Point";
271
277
  };
272
278
  readonly TranslateButton: {
273
279
  readonly CURRENT_LANG: "Current Language:";
@@ -31,6 +31,9 @@ declare const _default: {
31
31
  readonly TIME: "时间";
32
32
  readonly SCORE: "得分";
33
33
  readonly BATCH_ADD: "批量添加";
34
+ readonly Import_To: "导入至:";
35
+ readonly Full_Test_Point: "完整评测点";
36
+ readonly Precheck_Test_Point: "预检评测点";
34
37
  };
35
38
  readonly TranslateButton: {
36
39
  readonly CURRENT_LANG: "当前语言:";
@@ -30,7 +30,10 @@ export default {
30
30
  Multi_Cases_Tip: '可以填入区间,也可以填入一个数字,逗号分割,例如:[1-5],7',
31
31
  TIME: '时间',
32
32
  SCORE: '得分',
33
- BATCH_ADD: '批量添加'
33
+ BATCH_ADD: '批量添加',
34
+ Import_To: '导入至:',
35
+ Full_Test_Point: '完整评测点',
36
+ Precheck_Test_Point: '预检评测点'
34
37
  },
35
38
  TranslateButton: {
36
39
  CURRENT_LANG: '当前语言:'
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface VisualDataConfigProps {
3
- onConfirm: (value: string) => void;
3
+ onConfirm: (value: string, importType: 'full' | 'precheck') => void;
4
4
  }
5
5
  declare const VisualDataConfig: ({ onConfirm }: VisualDataConfigProps) => React.JSX.Element;
6
6
  export default VisualDataConfig;
@@ -1,8 +1,8 @@
1
1
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
- import { Button, Col, Divider, Form, Input, InputNumber, Radio, Row } from 'antd';
5
- import React, { useEffect } from 'react';
4
+ import { Button, Col, Divider, Form, Input, InputNumber, Modal, Radio, Row, Space } from 'antd';
5
+ import React, { useEffect, useState } from 'react';
6
6
  import ConfigProviderWrapper from "../config-provider-wrapper";
7
7
  import { useLocale } from "../locales";
8
8
  import { prefix } from "../utils/global";
@@ -16,6 +16,16 @@ var VisualDataConfig = function VisualDataConfig(_ref) {
16
16
  form = _Form$useForm2[0];
17
17
  var _useLocale = useLocale('VisualDataConfig'),
18
18
  t = _useLocale.format;
19
+ // 导入类型 完整评测点 预检评测点
20
+ var _useState = useState('full'),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ importType = _useState2[0],
23
+ setImportType = _useState2[1];
24
+ // 是否显示导入弹窗
25
+ var _useState3 = useState(false),
26
+ _useState4 = _slicedToArray(_useState3, 2),
27
+ isModalVisible = _useState4[0],
28
+ setIsModalVisible = _useState4[1];
19
29
  useEffect(function () {
20
30
  form.setFieldsValue({
21
31
  timeLimit: 1000,
@@ -76,7 +86,7 @@ var VisualDataConfig = function VisualDataConfig(_ref) {
76
86
  case 0:
77
87
  config = configTranslate(values);
78
88
  res = compactObj(config); // 删除空对象
79
- onConfirm(JSON.stringify(res));
89
+ onConfirm(JSON.stringify(res), importType);
80
90
  case 3:
81
91
  case "end":
82
92
  return _context.stop();
@@ -188,7 +198,30 @@ var VisualDataConfig = function VisualDataConfig(_ref) {
188
198
  return /*#__PURE__*/React.createElement(React.Fragment, null, isVisible ? /*#__PURE__*/React.createElement(SingleDataConfig, null) : /*#__PURE__*/React.createElement(SubTaskConfig, null));
189
199
  }), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
190
200
  type: 'primary',
191
- htmlType: "submit"
192
- }, t('Confirm_Import')))));
201
+ onClick: function onClick() {
202
+ return setIsModalVisible(true);
203
+ }
204
+ }, t('Confirm_Import')))), /*#__PURE__*/React.createElement(Modal, {
205
+ title: t('Confirm_Import'),
206
+ open: isModalVisible,
207
+ onOk: function onOk() {
208
+ form.submit();
209
+ setIsModalVisible(false);
210
+ },
211
+ destroyOnClose: true,
212
+ onCancel: function onCancel() {
213
+ return setIsModalVisible(false);
214
+ }
215
+ }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("div", null, t('Import_To')), /*#__PURE__*/React.createElement(Radio.Group, {
216
+ value: importType,
217
+ onChange: function onChange(e) {
218
+ setImportType(e.target.value);
219
+ }
220
+ }, /*#__PURE__*/React.createElement(Radio, {
221
+ value: 'full'
222
+ }, t('Full_Test_Point')), /*#__PURE__*/React.createElement(Radio, {
223
+ value: 'precheck',
224
+ "data-testid": "precheck-test-point"
225
+ }, t('Precheck_Test_Point'))))));
193
226
  };
194
227
  export default VisualDataConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-star-design",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
4
4
  "description": "A react component library developed by turingstar",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",