x-star-design 0.0.13 → 0.0.14

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/index.d.ts CHANGED
@@ -8,5 +8,7 @@ export { default as LoadingMask } from './loading-mask';
8
8
  export { default as RainbowCat } from './rainbow-cat';
9
9
  export { default as StatusTag } from './status-tag';
10
10
  export type { StatusTagProps, StatusTagShape, StatusTagStyle, StatusTagType, } from './status-tag/define';
11
+ export { default as SubmissionStatus } from './submission-status';
11
12
  export { default as TitleWithIcon } from './title-with-icon';
12
13
  export { default as UserAvatar } from './user-avatar';
14
+ export { default as VisualDataConfig } from './visual-data-config';
package/dist/index.js CHANGED
@@ -6,5 +6,7 @@ export { default as ErrorBoundary } from "./error-boundary";
6
6
  export { default as LoadingMask } from "./loading-mask";
7
7
  export { default as RainbowCat } from "./rainbow-cat";
8
8
  export { default as StatusTag } from "./status-tag";
9
+ export { default as SubmissionStatus } from "./submission-status";
9
10
  export { default as TitleWithIcon } from "./title-with-icon";
10
- export { default as UserAvatar } from "./user-avatar";
11
+ export { default as UserAvatar } from "./user-avatar";
12
+ export { default as VisualDataConfig } from "./visual-data-config";
@@ -0,0 +1,36 @@
1
+ declare const _default: {
2
+ readonly VisualDataConfig: {
3
+ readonly Time_MS: "Time Limit(MS)";
4
+ readonly Space_MS: "Memory Limit(KB)";
5
+ readonly Individual_Assessment: "Score of Each Case/Subtask";
6
+ readonly Individual_Assessment_Tip: "Default score, can be overridden by each case/subtask";
7
+ readonly SPJ_EXE_FILE: "Special Judge(SPJ) Executable Filename";
8
+ readonly SPJ_EXE_FILE_TIP: "Leave blank for no SPJ";
9
+ readonly Input_Format: "Input Filename Format";
10
+ readonly Output_Format: "Output Filename Format";
11
+ readonly Input_Output_Format_Tip: "For example: data#.in (data1.in), #.in (1.in); data#.out (data1.out), #.out (1.out)";
12
+ readonly File_Input_Format: "File I/O Input File";
13
+ readonly File_Output_Format: "File I/O Output File";
14
+ readonly File_Input_Output_Format_Tip: "Leave blank for no File I/O";
15
+ readonly Interactive_Library: "Interactive Function Library Filename";
16
+ readonly Interactive_Library_Tip: "Leave blank for no function library";
17
+ readonly Evaluation_Method: "Evaluation Method";
18
+ readonly Single_Point_Data_Testing: "Single point data test";
19
+ readonly SubTask: "SubTask";
20
+ readonly Confirm_Import: "Confirm and import";
21
+ readonly Test_Point: "Test Point";
22
+ readonly ID: "Id";
23
+ readonly Space: "Space";
24
+ readonly Add_New_Test_Point: "Add a new test point";
25
+ readonly Test_Data: "Test Data";
26
+ readonly Data_Dependency_Subtask: "Data dependency - subtask";
27
+ readonly Add_New_SubTask: "Add new subtask ";
28
+ readonly Add_New_SubTask_Tip: "When the evaluation machine is uoj, setting time and space limits separately does not take effect. You need to switch the tester to xjoj for this to work.";
29
+ readonly Generate_Config_Success: "The configuration is generated successfully. Please go back to the data configuration to check";
30
+ readonly Multi_Cases_Tip: "You can enter an interval or a number, separated by commas, for example :[1-5],7";
31
+ readonly TIME: "Time";
32
+ readonly SCORE: "Score";
33
+ readonly BATCH_ADD: "Batch Add";
34
+ };
35
+ };
36
+ export default _default;
@@ -0,0 +1,35 @@
1
+ export default {
2
+ VisualDataConfig: {
3
+ Time_MS: 'Time Limit(MS)',
4
+ Space_MS: 'Memory Limit(KB)',
5
+ Individual_Assessment: 'Score of Each Case/Subtask',
6
+ Individual_Assessment_Tip: 'Default score, can be overridden by each case/subtask',
7
+ SPJ_EXE_FILE: 'Special Judge(SPJ) Executable Filename',
8
+ SPJ_EXE_FILE_TIP: 'Leave blank for no SPJ',
9
+ Input_Format: 'Input Filename Format',
10
+ Output_Format: 'Output Filename Format',
11
+ Input_Output_Format_Tip: 'For example: data#.in (data1.in), #.in (1.in); data#.out (data1.out), #.out (1.out)',
12
+ File_Input_Format: 'File I/O Input File',
13
+ File_Output_Format: 'File I/O Output File',
14
+ File_Input_Output_Format_Tip: 'Leave blank for no File I/O',
15
+ Interactive_Library: 'Interactive Function Library Filename',
16
+ Interactive_Library_Tip: 'Leave blank for no function library',
17
+ Evaluation_Method: 'Evaluation Method',
18
+ Single_Point_Data_Testing: 'Single point data test',
19
+ SubTask: 'SubTask',
20
+ Confirm_Import: 'Confirm and import',
21
+ Test_Point: 'Test Point',
22
+ ID: 'Id',
23
+ Space: 'Space',
24
+ Add_New_Test_Point: 'Add a new test point',
25
+ Test_Data: 'Test Data',
26
+ Data_Dependency_Subtask: 'Data dependency - subtask',
27
+ Add_New_SubTask: 'Add new subtask ',
28
+ Add_New_SubTask_Tip: 'When the evaluation machine is uoj, setting time and space limits separately does not take effect. You need to switch the tester to xjoj for this to work.',
29
+ Generate_Config_Success: 'The configuration is generated successfully. Please go back to the data configuration to check',
30
+ Multi_Cases_Tip: 'You can enter an interval or a number, separated by commas, for example :[1-5],7',
31
+ TIME: 'Time',
32
+ SCORE: 'Score',
33
+ BATCH_ADD: 'Batch Add'
34
+ }
35
+ };
@@ -0,0 +1,151 @@
1
+ import React from 'react';
2
+ import en_US from './en_US';
3
+ import zh_CN from './zh_CN';
4
+ interface LocaleProviderProps {
5
+ children: React.ReactNode;
6
+ locale?: string;
7
+ }
8
+ export declare const LocaleProvider: ({ children, locale, }: LocaleProviderProps) => React.JSX.Element;
9
+ type MessageMap = typeof zh_CN | typeof en_US;
10
+ export declare const useLocale: <T extends "VisualDataConfig">(slice: T) => {
11
+ locale: string;
12
+ format: <U extends keyof MessageMap[T]>(key: U) => ({
13
+ readonly VisualDataConfig: {
14
+ readonly Time_MS: "时间限制(MS)";
15
+ readonly Space_MS: "空间限制(KB)";
16
+ readonly Individual_Assessment: "单个测试点/子任务分数";
17
+ readonly Individual_Assessment_Tip: "默认分数,各个测试点/子任务可以覆盖";
18
+ readonly SPJ_EXE_FILE: "Special Judge(SPJ)可执行文件名";
19
+ readonly SPJ_EXE_FILE_TIP: "不填表示不需要SPJ";
20
+ readonly Input_Format: "输入文件名格式";
21
+ readonly Output_Format: "输出文件名格式";
22
+ readonly Input_Output_Format_Tip: "例如:data#.in(表示data1.in), #.in(表示1.in);data#.out(表示data1.out), #.out(表示1.out)";
23
+ readonly File_Input_Format: "文件读写输入文件";
24
+ readonly File_Output_Format: "文件读写输出文件";
25
+ readonly File_Input_Output_Format_Tip: "不填表示不需要文件读写";
26
+ readonly Interactive_Library: "交互题函数库文件名";
27
+ readonly Interactive_Library_Tip: "不填表示不使用函数库";
28
+ readonly Evaluation_Method: "测评方式";
29
+ readonly Single_Point_Data_Testing: "单点数据测试";
30
+ readonly SubTask: "子任务";
31
+ readonly Confirm_Import: "确定并导入";
32
+ readonly Test_Point: "测试点";
33
+ readonly ID: "编号";
34
+ readonly Space: "空间";
35
+ readonly Add_New_Test_Point: "添加新测试点";
36
+ readonly Test_Data: "测试数据";
37
+ readonly Data_Dependency_Subtask: "数据依赖-子任务";
38
+ readonly Add_New_SubTask: "添加新子任务";
39
+ readonly Add_New_SubTask_Tip: "评测机为 uoj 的时候,单独设置时间和空间限制是不生效的。需要把评测机切换为xjoj才生效。";
40
+ readonly Generate_Config_Success: "配置生成成功,请回到数据配置里进行检查";
41
+ readonly Multi_Cases_Tip: "可以填入区间,也可以填入一个数字,逗号分割,例如:[1-5],7";
42
+ readonly TIME: "时间";
43
+ readonly SCORE: "得分";
44
+ readonly BATCH_ADD: "批量添加";
45
+ };
46
+ } | {
47
+ readonly VisualDataConfig: {
48
+ readonly Time_MS: "Time Limit(MS)";
49
+ readonly Space_MS: "Memory Limit(KB)";
50
+ readonly Individual_Assessment: "Score of Each Case/Subtask";
51
+ readonly Individual_Assessment_Tip: "Default score, can be overridden by each case/subtask";
52
+ readonly SPJ_EXE_FILE: "Special Judge(SPJ) Executable Filename";
53
+ readonly SPJ_EXE_FILE_TIP: "Leave blank for no SPJ";
54
+ readonly Input_Format: "Input Filename Format";
55
+ readonly Output_Format: "Output Filename Format";
56
+ readonly Input_Output_Format_Tip: "For example: data#.in (data1.in), #.in (1.in); data#.out (data1.out), #.out (1.out)";
57
+ readonly File_Input_Format: "File I/O Input File";
58
+ readonly File_Output_Format: "File I/O Output File";
59
+ readonly File_Input_Output_Format_Tip: "Leave blank for no File I/O";
60
+ readonly Interactive_Library: "Interactive Function Library Filename";
61
+ readonly Interactive_Library_Tip: "Leave blank for no function library";
62
+ readonly Evaluation_Method: "Evaluation Method";
63
+ readonly Single_Point_Data_Testing: "Single point data test";
64
+ readonly SubTask: "SubTask";
65
+ readonly Confirm_Import: "Confirm and import";
66
+ readonly Test_Point: "Test Point";
67
+ readonly ID: "Id";
68
+ readonly Space: "Space";
69
+ readonly Add_New_Test_Point: "Add a new test point";
70
+ readonly Test_Data: "Test Data";
71
+ readonly Data_Dependency_Subtask: "Data dependency - subtask";
72
+ readonly Add_New_SubTask: "Add new subtask ";
73
+ readonly Add_New_SubTask_Tip: "When the evaluation machine is uoj, setting time and space limits separately does not take effect. You need to switch the tester to xjoj for this to work.";
74
+ readonly Generate_Config_Success: "The configuration is generated successfully. Please go back to the data configuration to check";
75
+ readonly Multi_Cases_Tip: "You can enter an interval or a number, separated by commas, for example :[1-5],7";
76
+ readonly TIME: "Time";
77
+ readonly SCORE: "Score";
78
+ readonly BATCH_ADD: "Batch Add";
79
+ };
80
+ })[T][U];
81
+ };
82
+ export declare const getFormat: <T extends "VisualDataConfig">(locale: string | undefined, slice: T) => <U extends keyof MessageMap[T]>(key: U) => ({
83
+ readonly VisualDataConfig: {
84
+ readonly Time_MS: "时间限制(MS)";
85
+ readonly Space_MS: "空间限制(KB)";
86
+ readonly Individual_Assessment: "单个测试点/子任务分数";
87
+ readonly Individual_Assessment_Tip: "默认分数,各个测试点/子任务可以覆盖";
88
+ readonly SPJ_EXE_FILE: "Special Judge(SPJ)可执行文件名";
89
+ readonly SPJ_EXE_FILE_TIP: "不填表示不需要SPJ";
90
+ readonly Input_Format: "输入文件名格式";
91
+ readonly Output_Format: "输出文件名格式";
92
+ readonly Input_Output_Format_Tip: "例如:data#.in(表示data1.in), #.in(表示1.in);data#.out(表示data1.out), #.out(表示1.out)";
93
+ readonly File_Input_Format: "文件读写输入文件";
94
+ readonly File_Output_Format: "文件读写输出文件";
95
+ readonly File_Input_Output_Format_Tip: "不填表示不需要文件读写";
96
+ readonly Interactive_Library: "交互题函数库文件名";
97
+ readonly Interactive_Library_Tip: "不填表示不使用函数库";
98
+ readonly Evaluation_Method: "测评方式";
99
+ readonly Single_Point_Data_Testing: "单点数据测试";
100
+ readonly SubTask: "子任务";
101
+ readonly Confirm_Import: "确定并导入";
102
+ readonly Test_Point: "测试点";
103
+ readonly ID: "编号";
104
+ readonly Space: "空间";
105
+ readonly Add_New_Test_Point: "添加新测试点";
106
+ readonly Test_Data: "测试数据";
107
+ readonly Data_Dependency_Subtask: "数据依赖-子任务";
108
+ readonly Add_New_SubTask: "添加新子任务";
109
+ readonly Add_New_SubTask_Tip: "评测机为 uoj 的时候,单独设置时间和空间限制是不生效的。需要把评测机切换为xjoj才生效。";
110
+ readonly Generate_Config_Success: "配置生成成功,请回到数据配置里进行检查";
111
+ readonly Multi_Cases_Tip: "可以填入区间,也可以填入一个数字,逗号分割,例如:[1-5],7";
112
+ readonly TIME: "时间";
113
+ readonly SCORE: "得分";
114
+ readonly BATCH_ADD: "批量添加";
115
+ };
116
+ } | {
117
+ readonly VisualDataConfig: {
118
+ readonly Time_MS: "Time Limit(MS)";
119
+ readonly Space_MS: "Memory Limit(KB)";
120
+ readonly Individual_Assessment: "Score of Each Case/Subtask";
121
+ readonly Individual_Assessment_Tip: "Default score, can be overridden by each case/subtask";
122
+ readonly SPJ_EXE_FILE: "Special Judge(SPJ) Executable Filename";
123
+ readonly SPJ_EXE_FILE_TIP: "Leave blank for no SPJ";
124
+ readonly Input_Format: "Input Filename Format";
125
+ readonly Output_Format: "Output Filename Format";
126
+ readonly Input_Output_Format_Tip: "For example: data#.in (data1.in), #.in (1.in); data#.out (data1.out), #.out (1.out)";
127
+ readonly File_Input_Format: "File I/O Input File";
128
+ readonly File_Output_Format: "File I/O Output File";
129
+ readonly File_Input_Output_Format_Tip: "Leave blank for no File I/O";
130
+ readonly Interactive_Library: "Interactive Function Library Filename";
131
+ readonly Interactive_Library_Tip: "Leave blank for no function library";
132
+ readonly Evaluation_Method: "Evaluation Method";
133
+ readonly Single_Point_Data_Testing: "Single point data test";
134
+ readonly SubTask: "SubTask";
135
+ readonly Confirm_Import: "Confirm and import";
136
+ readonly Test_Point: "Test Point";
137
+ readonly ID: "Id";
138
+ readonly Space: "Space";
139
+ readonly Add_New_Test_Point: "Add a new test point";
140
+ readonly Test_Data: "Test Data";
141
+ readonly Data_Dependency_Subtask: "Data dependency - subtask";
142
+ readonly Add_New_SubTask: "Add new subtask ";
143
+ readonly Add_New_SubTask_Tip: "When the evaluation machine is uoj, setting time and space limits separately does not take effect. You need to switch the tester to xjoj for this to work.";
144
+ readonly Generate_Config_Success: "The configuration is generated successfully. Please go back to the data configuration to check";
145
+ readonly Multi_Cases_Tip: "You can enter an interval or a number, separated by commas, for example :[1-5],7";
146
+ readonly TIME: "Time";
147
+ readonly SCORE: "Score";
148
+ readonly BATCH_ADD: "Batch Add";
149
+ };
150
+ })[T][U];
151
+ export {};
@@ -0,0 +1,44 @@
1
+ import React, { useContext, useRef } from 'react';
2
+ import en_US from "./en_US";
3
+ import zh_CN from "./zh_CN";
4
+ var LocaleContext = /*#__PURE__*/React.createContext('');
5
+ export var LocaleProvider = function LocaleProvider(_ref) {
6
+ var children = _ref.children,
7
+ _ref$locale = _ref.locale,
8
+ locale = _ref$locale === void 0 ? '' : _ref$locale;
9
+ return /*#__PURE__*/React.createElement(LocaleContext.Provider, {
10
+ value: locale
11
+ }, children);
12
+ };
13
+ export var useLocale = function useLocale(slice) {
14
+ var _zh_CN$en_US$locale;
15
+ var locale = useContext(LocaleContext);
16
+ var message = ((_zh_CN$en_US$locale = {
17
+ zh_CN: zh_CN,
18
+ en_US: en_US
19
+ }[locale]) !== null && _zh_CN$en_US$locale !== void 0 ? _zh_CN$en_US$locale : zh_CN)[slice];
20
+ var messageLatest = useRef(message);
21
+ messageLatest.current = message;
22
+ var format = useRef(function (key) {
23
+ return messageLatest.current[key];
24
+ }).current;
25
+ return {
26
+ locale: {
27
+ zh_CN: zh_CN,
28
+ en_US: en_US
29
+ }[locale] ? locale : 'zh_CN',
30
+ format: format
31
+ };
32
+ };
33
+ export var getFormat = function getFormat() {
34
+ var _zh_CN$en_US$locale2;
35
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
36
+ var slice = arguments.length > 1 ? arguments[1] : undefined;
37
+ var message = ((_zh_CN$en_US$locale2 = {
38
+ zh_CN: zh_CN,
39
+ en_US: en_US
40
+ }[locale]) !== null && _zh_CN$en_US$locale2 !== void 0 ? _zh_CN$en_US$locale2 : zh_CN)[slice];
41
+ return function (key) {
42
+ return message[key];
43
+ };
44
+ };
@@ -0,0 +1,36 @@
1
+ declare const _default: {
2
+ readonly VisualDataConfig: {
3
+ readonly Time_MS: "时间限制(MS)";
4
+ readonly Space_MS: "空间限制(KB)";
5
+ readonly Individual_Assessment: "单个测试点/子任务分数";
6
+ readonly Individual_Assessment_Tip: "默认分数,各个测试点/子任务可以覆盖";
7
+ readonly SPJ_EXE_FILE: "Special Judge(SPJ)可执行文件名";
8
+ readonly SPJ_EXE_FILE_TIP: "不填表示不需要SPJ";
9
+ readonly Input_Format: "输入文件名格式";
10
+ readonly Output_Format: "输出文件名格式";
11
+ readonly Input_Output_Format_Tip: "例如:data#.in(表示data1.in), #.in(表示1.in);data#.out(表示data1.out), #.out(表示1.out)";
12
+ readonly File_Input_Format: "文件读写输入文件";
13
+ readonly File_Output_Format: "文件读写输出文件";
14
+ readonly File_Input_Output_Format_Tip: "不填表示不需要文件读写";
15
+ readonly Interactive_Library: "交互题函数库文件名";
16
+ readonly Interactive_Library_Tip: "不填表示不使用函数库";
17
+ readonly Evaluation_Method: "测评方式";
18
+ readonly Single_Point_Data_Testing: "单点数据测试";
19
+ readonly SubTask: "子任务";
20
+ readonly Confirm_Import: "确定并导入";
21
+ readonly Test_Point: "测试点";
22
+ readonly ID: "编号";
23
+ readonly Space: "空间";
24
+ readonly Add_New_Test_Point: "添加新测试点";
25
+ readonly Test_Data: "测试数据";
26
+ readonly Data_Dependency_Subtask: "数据依赖-子任务";
27
+ readonly Add_New_SubTask: "添加新子任务";
28
+ readonly Add_New_SubTask_Tip: "评测机为 uoj 的时候,单独设置时间和空间限制是不生效的。需要把评测机切换为xjoj才生效。";
29
+ readonly Generate_Config_Success: "配置生成成功,请回到数据配置里进行检查";
30
+ readonly Multi_Cases_Tip: "可以填入区间,也可以填入一个数字,逗号分割,例如:[1-5],7";
31
+ readonly TIME: "时间";
32
+ readonly SCORE: "得分";
33
+ readonly BATCH_ADD: "批量添加";
34
+ };
35
+ };
36
+ export default _default;
@@ -0,0 +1,35 @@
1
+ export default {
2
+ VisualDataConfig: {
3
+ Time_MS: '时间限制(MS)',
4
+ Space_MS: '空间限制(KB)',
5
+ Individual_Assessment: '单个测试点/子任务分数',
6
+ Individual_Assessment_Tip: '默认分数,各个测试点/子任务可以覆盖',
7
+ SPJ_EXE_FILE: 'Special Judge(SPJ)可执行文件名',
8
+ SPJ_EXE_FILE_TIP: '不填表示不需要SPJ',
9
+ Input_Format: '输入文件名格式',
10
+ Output_Format: '输出文件名格式',
11
+ Input_Output_Format_Tip: '例如:data#.in(表示data1.in), #.in(表示1.in);data#.out(表示data1.out), #.out(表示1.out)',
12
+ File_Input_Format: '文件读写输入文件',
13
+ File_Output_Format: '文件读写输出文件',
14
+ File_Input_Output_Format_Tip: '不填表示不需要文件读写',
15
+ Interactive_Library: '交互题函数库文件名',
16
+ Interactive_Library_Tip: '不填表示不使用函数库',
17
+ Evaluation_Method: '测评方式',
18
+ Single_Point_Data_Testing: '单点数据测试',
19
+ SubTask: '子任务',
20
+ Confirm_Import: '确定并导入',
21
+ Test_Point: '测试点',
22
+ ID: '编号',
23
+ Space: '空间',
24
+ Add_New_Test_Point: '添加新测试点',
25
+ Test_Data: '测试数据',
26
+ Data_Dependency_Subtask: '数据依赖-子任务',
27
+ Add_New_SubTask: '添加新子任务',
28
+ Add_New_SubTask_Tip: '评测机为 uoj 的时候,单独设置时间和空间限制是不生效的。需要把评测机切换为xjoj才生效。',
29
+ Generate_Config_Success: '配置生成成功,请回到数据配置里进行检查',
30
+ Multi_Cases_Tip: '可以填入区间,也可以填入一个数字,逗号分割,例如:[1-5],7',
31
+ TIME: '时间',
32
+ SCORE: '得分',
33
+ BATCH_ADD: '批量添加'
34
+ }
35
+ };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ type SubmissionStatusProps = {
3
+ status: string;
4
+ className?: string;
5
+ };
6
+ declare const SubmissionStatus: ({ className, status }: SubmissionStatusProps) => React.JSX.Element;
7
+ export default SubmissionStatus;
@@ -0,0 +1,15 @@
1
+ import classNames from 'classnames';
2
+ import React from 'react';
3
+ var scopeColor = new Map([['Accepted', '#00ad07'], ['Wrong Answer', '#f44336'], ['Time Limit Exceeded', '#56A2F5'], ['Compile Error', '#F5B13D'], ['Runtime Error', '#F56ED3'], ['Memory Limit Exceeded', '#9256F5'], ['Running', 'orange'], ['Testing', '#818181'], ['Abnormal', '#9256F5'], ['Pending', 'orange']]);
4
+ var SubmissionStatus = function SubmissionStatus(_ref) {
5
+ var className = _ref.className,
6
+ status = _ref.status;
7
+ return /*#__PURE__*/React.createElement("div", {
8
+ className: classNames(className),
9
+ style: {
10
+ fontWeight: 'bold',
11
+ color: scopeColor.get(status)
12
+ }
13
+ }, status);
14
+ };
15
+ export default SubmissionStatus;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const SingleDataConfig: () => React.JSX.Element;
3
+ export default SingleDataConfig;
@@ -0,0 +1,92 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+ import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
13
+ import { Button, Col, Form, Input, InputNumber, Row, Space } from 'antd';
14
+ import React, { useState } from 'react';
15
+ import { useLocale } from "../locales";
16
+ import { prefix } from "../utils/global";
17
+ var SingleDataConfig = function SingleDataConfig() {
18
+ var _useState = useState(20),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ addTestNumber = _useState2[0],
21
+ setAddTestNumber = _useState2[1];
22
+ var _useLocale = useLocale('VisualDataConfig'),
23
+ t = _useLocale.format;
24
+ return /*#__PURE__*/React.createElement(Form.List, {
25
+ name: "singleData"
26
+ }, function (fields, _ref) {
27
+ var add = _ref.add,
28
+ remove = _ref.remove;
29
+ return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
30
+ return /*#__PURE__*/React.createElement(Form.Item, {
31
+ label: "".concat(t('Test_Point')).concat(index + 1, "\uFF1A"),
32
+ required: false,
33
+ key: field.key,
34
+ labelCol: {
35
+ span: 24
36
+ }
37
+ }, /*#__PURE__*/React.createElement(Row, {
38
+ className: "".concat(prefix, "formList"),
39
+ gutter: [10, 0]
40
+ }, /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
41
+ label: t('ID'),
42
+ name: [field.name, 'cases'],
43
+ rules: [{
44
+ required: true
45
+ }]
46
+ }), /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
47
+ label: t('TIME'),
48
+ name: [field.name, 'timeLimit']
49
+ }), /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
50
+ label: t('Space'),
51
+ name: [field.name, 'memoryLimit']
52
+ }), /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
53
+ label: t('SCORE'),
54
+ name: [field.name, 'points']
55
+ }), /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
56
+ className: "dynamic-delete-button",
57
+ style: {
58
+ lineHeight: '32px'
59
+ },
60
+ onClick: function onClick() {
61
+ return remove(field.name);
62
+ }
63
+ })));
64
+ }), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Space, {
65
+ size: 50
66
+ }, /*#__PURE__*/React.createElement(Button, {
67
+ type: "dashed",
68
+ onClick: function onClick() {
69
+ return add();
70
+ },
71
+ icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
72
+ }, t('Add_New_Test_Point')), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
73
+ type: "primary",
74
+ onClick: function onClick() {
75
+ _toConsumableArray(new Array(addTestNumber)).forEach(function (_, index) {
76
+ return add({
77
+ cases: String(fields.length + index + 1)
78
+ });
79
+ });
80
+ },
81
+ icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
82
+ }, t('BATCH_ADD')), /*#__PURE__*/React.createElement(InputNumber, {
83
+ value: addTestNumber,
84
+ min: 1,
85
+ max: 50,
86
+ onChange: function onChange(value) {
87
+ return setAddTestNumber(value || 0);
88
+ }
89
+ }), t('Test_Point')))));
90
+ });
91
+ };
92
+ export default SingleDataConfig;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const SubTaskConfig: () => React.JSX.Element;
3
+ export default SubTaskConfig;
@@ -0,0 +1,94 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+ import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
13
+ import { Button, Col, Form, Input, InputNumber, Row, Space } from 'antd';
14
+ import React, { useState } from 'react';
15
+ import { useLocale } from "../locales";
16
+ import { prefix } from "../utils/global";
17
+ var SubTaskConfig = function SubTaskConfig() {
18
+ var _useState = useState(20),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ addTestNumber = _useState2[0],
21
+ setAddTestNumber = _useState2[1];
22
+ var _useLocale = useLocale('VisualDataConfig'),
23
+ t = _useLocale.format;
24
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.List, {
25
+ name: "subtaskData"
26
+ }, function (fields, _ref) {
27
+ var add = _ref.add,
28
+ remove = _ref.remove;
29
+ return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, index) {
30
+ return /*#__PURE__*/React.createElement(Form.Item, {
31
+ label: "".concat(t('SubTask')).concat(index + 1, "\uFF1A"),
32
+ required: false,
33
+ key: field.key,
34
+ labelCol: {
35
+ span: 24
36
+ }
37
+ }, /*#__PURE__*/React.createElement(Row, {
38
+ className: "".concat(prefix, "formList"),
39
+ gutter: [10, 10]
40
+ }, /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
41
+ label: t('TIME'),
42
+ name: [field.name, 'timeLimit']
43
+ }), /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
44
+ label: t('Space'),
45
+ name: [field.name, 'memoryLimit']
46
+ }), /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
47
+ label: t('SCORE'),
48
+ name: [field.name, 'points']
49
+ }), /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
50
+ label: t('Test_Data'),
51
+ name: [field.name, 'cases'],
52
+ extra: t('Multi_Cases_Tip'),
53
+ rules: [{
54
+ required: true
55
+ }]
56
+ }), /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Form.Item, _extends({}, field, {
57
+ label: t('Data_Dependency_Subtask'),
58
+ name: [field.name, 'dependences']
59
+ }), /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
60
+ className: "dynamic-delete-button",
61
+ style: {
62
+ lineHeight: '32px'
63
+ },
64
+ onClick: function onClick() {
65
+ return remove(field.name);
66
+ }
67
+ })));
68
+ }), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Space, {
69
+ size: 50
70
+ }, /*#__PURE__*/React.createElement(Button, {
71
+ type: "dashed",
72
+ onClick: function onClick() {
73
+ return add();
74
+ },
75
+ icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
76
+ }, t('Add_New_SubTask')), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
77
+ type: "primary",
78
+ onClick: function onClick() {
79
+ _toConsumableArray(new Array(addTestNumber)).forEach(function () {
80
+ return add();
81
+ });
82
+ },
83
+ icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
84
+ }, t('BATCH_ADD')), /*#__PURE__*/React.createElement(InputNumber, {
85
+ min: 1,
86
+ max: 50,
87
+ value: addTestNumber,
88
+ onChange: function onChange(value) {
89
+ return setAddTestNumber(value || 0);
90
+ }
91
+ }), t('SubTask')))));
92
+ }), /*#__PURE__*/React.createElement("div", null, t('Add_New_SubTask_Tip')));
93
+ };
94
+ export default SubTaskConfig;
@@ -0,0 +1,27 @@
1
+ export interface ConfigItem {
2
+ timeLimit: number;
3
+ memoryLimit: number;
4
+ points: number;
5
+ checkTarget: string;
6
+ inputFormat: string;
7
+ outputFormat: string;
8
+ fileInputFormat: string;
9
+ fileOutputFormat: string;
10
+ buildInput: string;
11
+ judgeWay: 'single' | 'subtask';
12
+ singleData?: SubTaskItem[];
13
+ subtaskData?: SubTaskItem[];
14
+ }
15
+ export interface SubTaskItem {
16
+ cases: string;
17
+ timeLimit: number;
18
+ memoryLimit: number;
19
+ points: number;
20
+ dependences?: string;
21
+ }
22
+ export declare const isEmpty: (obj: object) => boolean;
23
+ /**
24
+ * 去除对象中所有符合条件的对象
25
+ * @param {Object} obj 来源对象
26
+ */
27
+ export declare const compactObj: (obj: any) => any;
@@ -0,0 +1,32 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ // 删除空对象 删除'', null, undefined
3
+ export var isEmpty = function isEmpty(obj) {
4
+ if (_typeof(obj) === 'object') {
5
+ for (var i in obj) {
6
+ if (obj.hasOwnProperty(i)) {
7
+ return false;
8
+ }
9
+ }
10
+ return true;
11
+ } else {
12
+ return obj === '' || obj === null || obj === undefined;
13
+ }
14
+ };
15
+
16
+ /**
17
+ * 去除对象中所有符合条件的对象
18
+ * @param {Object} obj 来源对象
19
+ */
20
+ export var compactObj = function compactObj(obj) {
21
+ for (var i in obj) {
22
+ if (obj.hasOwnProperty(i)) {
23
+ if (_typeof(obj[i]) === 'object') {
24
+ compactObj(obj[i]);
25
+ }
26
+ if (isEmpty(obj[i])) {
27
+ delete obj[i];
28
+ }
29
+ }
30
+ }
31
+ return obj;
32
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const VisualDataConfig: ({ onConfirm, }: {
3
+ onConfirm: (value: string) => void;
4
+ }) => React.JSX.Element;
5
+ export default VisualDataConfig;
@@ -0,0 +1,200 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { Button, Col, Divider, Form, Input, InputNumber, Radio, Row } from 'antd';
12
+ import React, { useEffect } from 'react';
13
+ import { useLocale } from "../locales";
14
+ import { prefix } from "../utils/global";
15
+ import SingleDataConfig from "./SingleDataConfig";
16
+ import SubTaskConfig from "./SubTaskConfig";
17
+ import { compactObj } from "./define";
18
+ var VisualDataConfig = function VisualDataConfig(_ref) {
19
+ var onConfirm = _ref.onConfirm;
20
+ var _Form$useForm = Form.useForm(),
21
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
22
+ form = _Form$useForm2[0];
23
+ var _useLocale = useLocale('VisualDataConfig'),
24
+ t = _useLocale.format;
25
+ useEffect(function () {
26
+ form.setFieldsValue({
27
+ timeLimit: 1000,
28
+ memoryLimit: 262144,
29
+ points: 10,
30
+ singleData: [{
31
+ points: 10,
32
+ cases: '1'
33
+ }],
34
+ inputFormat: 'data#.in',
35
+ outputFormat: 'data#.out'
36
+ });
37
+ }, []);
38
+ var configTranslate = function configTranslate(values) {
39
+ var _values$buildInput;
40
+ var subTasks = (values === null || values === void 0 ? void 0 : values.judgeWay) === 'single' ? values === null || values === void 0 ? void 0 : values.singleData : values === null || values === void 0 ? void 0 : values.subtaskData;
41
+ return {
42
+ timeLimit: values === null || values === void 0 ? void 0 : values.timeLimit,
43
+ memoryLimit: values === null || values === void 0 ? void 0 : values.memoryLimit,
44
+ subtasks: subTasks === null || subTasks === void 0 ? void 0 : subTasks.map(function (item) {
45
+ var _item$dependences, _item$cases;
46
+ return {
47
+ timeLimit: item === null || item === void 0 ? void 0 : item.timeLimit,
48
+ memoryLimit: item === null || item === void 0 ? void 0 : item.memoryLimit,
49
+ points: (item === null || item === void 0 ? void 0 : item.points) || (values === null || values === void 0 ? void 0 : values.points) || undefined,
50
+ dependences: item === null || item === void 0 ? void 0 : (_item$dependences = item.dependences) === null || _item$dependences === void 0 ? void 0 : _item$dependences.split(','),
51
+ cases: item === null || item === void 0 ? void 0 : (_item$cases = item.cases) === null || _item$cases === void 0 ? void 0 : _item$cases.split(',')
52
+ };
53
+ }),
54
+ aliases: [{
55
+ from: values === null || values === void 0 ? void 0 : values.inputFormat,
56
+ to: 'in'
57
+ }, {
58
+ from: values === null || values === void 0 ? void 0 : values.outputFormat,
59
+ to: 'ans'
60
+ }],
61
+ check: {
62
+ target: values === null || values === void 0 ? void 0 : values.checkTarget,
63
+ input: values === null || values === void 0 ? void 0 : values.fileInputFormat,
64
+ output: values === null || values === void 0 ? void 0 : values.fileOutputFormat
65
+ },
66
+ run: {
67
+ readable: values === null || values === void 0 ? void 0 : values.fileInputFormat,
68
+ writable: values === null || values === void 0 ? void 0 : values.fileOutputFormat
69
+ },
70
+ build: {
71
+ input: values === null || values === void 0 ? void 0 : (_values$buildInput = values.buildInput) === null || _values$buildInput === void 0 ? void 0 : _values$buildInput.split(',')
72
+ }
73
+ };
74
+ };
75
+ return /*#__PURE__*/React.createElement(Form, {
76
+ form: form,
77
+ onFinish: /*#__PURE__*/function () {
78
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
79
+ var config, res;
80
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
81
+ while (1) switch (_context.prev = _context.next) {
82
+ case 0:
83
+ config = configTranslate(values);
84
+ res = compactObj(config); // 删除空对象
85
+ onConfirm(JSON.stringify(res));
86
+ case 3:
87
+ case "end":
88
+ return _context.stop();
89
+ }
90
+ }, _callee);
91
+ }));
92
+ return function (_x2) {
93
+ return _ref2.apply(this, arguments);
94
+ };
95
+ }(),
96
+ className: "".concat(prefix, "form")
97
+ }, /*#__PURE__*/React.createElement(Row, {
98
+ justify: "start",
99
+ gutter: [16, 0],
100
+ className: "".concat(prefix, "row")
101
+ }, /*#__PURE__*/React.createElement(Col, {
102
+ span: 6
103
+ }, /*#__PURE__*/React.createElement(Form.Item, {
104
+ name: "timeLimit",
105
+ label: t('Time_MS'),
106
+ rules: [{
107
+ required: true
108
+ }]
109
+ }, /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(Col, {
110
+ span: 6
111
+ }, /*#__PURE__*/React.createElement(Form.Item, {
112
+ name: "memoryLimit",
113
+ label: t('Space_MS'),
114
+ rules: [{
115
+ required: true
116
+ }]
117
+ }, /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(Col, {
118
+ span: 24
119
+ }, /*#__PURE__*/React.createElement(Form.Item, {
120
+ name: "points",
121
+ label: t('Individual_Assessment'),
122
+ extra: t('Individual_Assessment_Tip')
123
+ }, /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(Col, {
124
+ span: 24
125
+ }, /*#__PURE__*/React.createElement(Form.Item, {
126
+ name: "checkTarget",
127
+ label: t('SPJ_EXE_FILE'),
128
+ extra: t('SPJ_EXE_FILE_TIP')
129
+ }, /*#__PURE__*/React.createElement(Input, {
130
+ style: {
131
+ width: 200
132
+ }
133
+ }))), /*#__PURE__*/React.createElement(Col, {
134
+ span: 8
135
+ }, /*#__PURE__*/React.createElement(Form.Item, {
136
+ name: "inputFormat",
137
+ label: t('Input_Format'),
138
+ rules: [{
139
+ required: true
140
+ }]
141
+ }, /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Col, {
142
+ span: 9
143
+ }, /*#__PURE__*/React.createElement(Form.Item, {
144
+ name: "outputFormat",
145
+ label: t('Output_Format'),
146
+ rules: [{
147
+ required: true
148
+ }]
149
+ }, /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Col, {
150
+ span: 24
151
+ }, /*#__PURE__*/React.createElement("div", {
152
+ className: "ant-form-item-extra ".concat("".concat(prefix, "explainItem"))
153
+ }, t('Input_Output_Format_Tip'))), /*#__PURE__*/React.createElement(Col, {
154
+ span: 8
155
+ }, /*#__PURE__*/React.createElement(Form.Item, {
156
+ name: "fileInputFormat",
157
+ label: t('File_Input_Format')
158
+ }, /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Col, {
159
+ span: 8
160
+ }, /*#__PURE__*/React.createElement(Form.Item, {
161
+ name: "fileOutputFormat",
162
+ label: t('File_Output_Format')
163
+ }, /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Col, {
164
+ span: 24
165
+ }, /*#__PURE__*/React.createElement("div", {
166
+ className: "ant-form-item-extra ".concat(prefix, "explainItem")
167
+ }, t('File_Input_Output_Format_Tip'))), /*#__PURE__*/React.createElement(Col, {
168
+ span: 12
169
+ }, /*#__PURE__*/React.createElement(Form.Item, {
170
+ name: "buildInput",
171
+ label: t('Interactive_Library'),
172
+ extra: t('Interactive_Library_Tip')
173
+ }, /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Col, {
174
+ span: 24
175
+ }, /*#__PURE__*/React.createElement(Form.Item, {
176
+ name: "judgeWay",
177
+ initialValue: 'single',
178
+ label: t('Evaluation_Method'),
179
+ rules: [{
180
+ required: true
181
+ }]
182
+ }, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
183
+ value: 'single'
184
+ }, t('Single_Point_Data_Testing')), /*#__PURE__*/React.createElement(Radio, {
185
+ value: 'subtask'
186
+ }, t('SubTask')))))), /*#__PURE__*/React.createElement(Form.Item, {
187
+ noStyle: true,
188
+ shouldUpdate: function shouldUpdate(perValues, nextValues) {
189
+ return perValues['judgeWay'] !== nextValues['judgeWay'];
190
+ }
191
+ }, function (_ref3) {
192
+ var getFieldValue = _ref3.getFieldValue;
193
+ var isVisible = getFieldValue('judgeWay') && getFieldValue('judgeWay') === 'single';
194
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isVisible ? /*#__PURE__*/React.createElement(SingleDataConfig, null) : /*#__PURE__*/React.createElement(SubTaskConfig, null));
195
+ }), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
196
+ type: 'primary',
197
+ htmlType: "submit"
198
+ }, t('Confirm_Import'))));
199
+ };
200
+ export default VisualDataConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-star-design",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "A react component library developed by turingstar",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",