x-star-design 0.0.55 → 0.0.56
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/code-detail-modal/index.d.ts +1 -1
- package/dist/code-detail-modal/index.js +5 -3
- package/dist/draggable-layout/index.js +1 -1
- package/dist/error-boundary/error-page/index.js +10 -11
- package/dist/error-boundary/index.d.ts +1 -0
- package/dist/feedback/index.d.ts +4 -4
- package/dist/feedback/index.js +7 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/input-numbers/index.d.ts +3 -3
- package/dist/loading-mask/index.js +2 -1
- package/dist/styles/index.css +17 -17
- package/dist/submission-status/index.d.ts +5 -5
- package/dist/submission-status/index.js +5 -6
- package/dist/types/{svg.d.ts → image.d.ts} +2 -1
- package/dist/user-avatar/index.d.ts +3 -3
- package/dist/virtual-table/index.d.ts +1 -1
- package/dist/virtual-table/index.js +38 -43
- package/dist/{xtabs → x-tabs}/index.js +5 -5
- package/package.json +19 -12
- /package/dist/{xtabs → x-tabs}/index.d.ts +0 -0
|
@@ -4,9 +4,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
4
4
|
var _excluded = ["codeData", "open", "onCancel"];
|
|
5
5
|
import { DownloadOutlined } from '@ant-design/icons';
|
|
6
6
|
import { Button, Modal, Table } from 'antd';
|
|
7
|
-
import dayjs from 'dayjs';
|
|
8
7
|
import React, { useState } from 'react';
|
|
9
|
-
import { getTransResult } from 'x-star-utils';
|
|
8
|
+
import { formatDate, getTransResult } from 'x-star-utils';
|
|
10
9
|
import CodeMirrorWrapper from "../code-mirror-wrapper";
|
|
11
10
|
import { Theme } from "../code-mirror-wrapper/define";
|
|
12
11
|
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
@@ -104,7 +103,10 @@ var CodeDetailModal = function CodeDetailModal(_ref) {
|
|
|
104
103
|
title: t('Submission_Time'),
|
|
105
104
|
dataIndex: 'submissionTime',
|
|
106
105
|
render: function render(v) {
|
|
107
|
-
return v ? /*#__PURE__*/React.createElement("span", null,
|
|
106
|
+
return v ? /*#__PURE__*/React.createElement("span", null, formatDate(v * 1000, {
|
|
107
|
+
lang: lang,
|
|
108
|
+
separator: '-'
|
|
109
|
+
})) : '-';
|
|
108
110
|
}
|
|
109
111
|
}];
|
|
110
112
|
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Modal, _extends({
|
|
@@ -123,7 +123,7 @@ var DraggableLayout = function DraggableLayout(_ref) {
|
|
|
123
123
|
}, /*#__PURE__*/React.createElement("div", {
|
|
124
124
|
"data-testid": "divider",
|
|
125
125
|
ref: dividerRef,
|
|
126
|
-
className: dividerClassName !== null && dividerClassName !== void 0 ? dividerClassName :
|
|
126
|
+
className: dividerClassName !== null && dividerClassName !== void 0 ? dividerClassName : "".concat(prefix, "-draggable-divider"),
|
|
127
127
|
style: {
|
|
128
128
|
left: "calc(".concat(defaultWidth, " - ").concat(dividerWidth, " / 2)")
|
|
129
129
|
},
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { useLocale } from "../../locales";
|
|
4
3
|
import { prefix } from "../../utils/global";
|
|
@@ -15,31 +14,31 @@ var ErrorPage = function ErrorPage(_ref) {
|
|
|
15
14
|
location.reload();
|
|
16
15
|
}
|
|
17
16
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
-
className:
|
|
17
|
+
className: "".concat(prefix, "-errorPage")
|
|
19
18
|
}, /*#__PURE__*/React.createElement("div", {
|
|
20
|
-
className:
|
|
19
|
+
className: "hello"
|
|
21
20
|
}), /*#__PURE__*/React.createElement("div", {
|
|
22
|
-
className:
|
|
21
|
+
className: "ip"
|
|
23
22
|
}), /*#__PURE__*/React.createElement("div", {
|
|
24
|
-
className:
|
|
23
|
+
className: "planets"
|
|
25
24
|
}), /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
className:
|
|
25
|
+
className: "content"
|
|
27
26
|
}, isFetchError(error) ? /*#__PURE__*/React.createElement("div", {
|
|
28
27
|
"data-testid": "hint",
|
|
29
|
-
className:
|
|
28
|
+
className: "hint"
|
|
30
29
|
}, /*#__PURE__*/React.createElement("div", {
|
|
31
|
-
className:
|
|
30
|
+
className: "description"
|
|
32
31
|
}, /*#__PURE__*/React.createElement("div", null, t('RELOAD_HINT')))) : /*#__PURE__*/React.createElement("div", {
|
|
33
32
|
"data-testid": "alert",
|
|
34
|
-
className:
|
|
33
|
+
className: "alert"
|
|
35
34
|
}, /*#__PURE__*/React.createElement("h2", {
|
|
36
35
|
style: {
|
|
37
36
|
fontWeight: 'bold'
|
|
38
37
|
}
|
|
39
38
|
}, t('ERROR')), /*#__PURE__*/React.createElement("div", {
|
|
40
|
-
className:
|
|
39
|
+
className: "description"
|
|
41
40
|
}, /*#__PURE__*/React.createElement("div", null, t('ERROR_BOUNDARY_TIP_1')), /*#__PURE__*/React.createElement("div", null, t('ERROR_BOUNDARY_TIP_2')), /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className:
|
|
41
|
+
className: "actions"
|
|
43
42
|
}, /*#__PURE__*/React.createElement("a", {
|
|
44
43
|
href: "/"
|
|
45
44
|
}, ">> ".concat(t('RETURN_TO_HOME'))), /*#__PURE__*/React.createElement("a", {
|
|
@@ -2,3 +2,4 @@ import React from 'react';
|
|
|
2
2
|
import type { ErrorBoundaryProps as ReactErrorBoundaryProps } from 'react-error-boundary';
|
|
3
3
|
declare const ErrorBoundary: ({ fallback, fallbackRender, FallbackComponent, ...rest }: Partial<ReactErrorBoundaryProps>) => React.JSX.Element;
|
|
4
4
|
export default ErrorBoundary;
|
|
5
|
+
export type { FallbackProps } from 'react-error-boundary';
|
package/dist/feedback/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
interface FeedbackItem {
|
|
3
3
|
value: string | number;
|
|
4
4
|
label: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
interface FeedbackProps {
|
|
7
7
|
/**
|
|
8
8
|
* @description 标题
|
|
@@ -12,11 +12,11 @@ interface FeedbackProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* @description 好评 Radio.Group 的选项
|
|
14
14
|
*/
|
|
15
|
-
feedbackListGood?:
|
|
15
|
+
feedbackListGood?: FeedbackItem[];
|
|
16
16
|
/**
|
|
17
17
|
* @description 差评 Radio.Group 的选项
|
|
18
18
|
*/
|
|
19
|
-
feedbackListBad?:
|
|
19
|
+
feedbackListBad?: FeedbackItem[];
|
|
20
20
|
/**
|
|
21
21
|
* @description 选中的颜色
|
|
22
22
|
*/
|
package/dist/feedback/index.js
CHANGED
|
@@ -54,7 +54,7 @@ var Feedback = function Feedback(_ref) {
|
|
|
54
54
|
width: '100%'
|
|
55
55
|
}
|
|
56
56
|
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
-
className:
|
|
57
|
+
className: "".concat(prefix, "-feedbackIcon")
|
|
58
58
|
}, /*#__PURE__*/React.createElement(CoffeeOutlined, null)), /*#__PURE__*/React.createElement("div", null, t('FEEDBACK_RESPONSE')));
|
|
59
59
|
};
|
|
60
60
|
var submitFormContent = function submitFormContent() {
|
|
@@ -82,7 +82,7 @@ var Feedback = function Feedback(_ref) {
|
|
|
82
82
|
message: t('FEEDBACK_MESSAGE_1')
|
|
83
83
|
}]
|
|
84
84
|
}, /*#__PURE__*/React.createElement(Radio.Group, {
|
|
85
|
-
className:
|
|
85
|
+
className: "".concat(prefix, "-feedbackRadioGroup"),
|
|
86
86
|
style: {
|
|
87
87
|
padding: '20px 0 10px 0'
|
|
88
88
|
},
|
|
@@ -179,7 +179,7 @@ var Feedback = function Feedback(_ref) {
|
|
|
179
179
|
}
|
|
180
180
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
181
181
|
type: "primary",
|
|
182
|
-
className:
|
|
182
|
+
className: "".concat(prefix, "-feedbackButton"),
|
|
183
183
|
htmlType: "submit",
|
|
184
184
|
onClick: function onClick() {
|
|
185
185
|
return form.setFieldValue(feedbackKey, choiceType);
|
|
@@ -187,11 +187,11 @@ var Feedback = function Feedback(_ref) {
|
|
|
187
187
|
}, t('SUBMIT')))));
|
|
188
188
|
};
|
|
189
189
|
var content = /*#__PURE__*/React.createElement("div", {
|
|
190
|
-
className:
|
|
190
|
+
className: "".concat(prefix, "-feedbackContent")
|
|
191
191
|
}, submittedContent(), submitFormContent());
|
|
192
192
|
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement("div", {
|
|
193
193
|
ref: mainContainer,
|
|
194
|
-
className:
|
|
194
|
+
className: "".concat(prefix, "-feedbackContainer")
|
|
195
195
|
}, /*#__PURE__*/React.createElement(Popover, {
|
|
196
196
|
content: content,
|
|
197
197
|
title: title !== null && title !== void 0 ? title : t('FEEDBACK_ON_THE_PROBLEM'),
|
|
@@ -222,7 +222,7 @@ var Feedback = function Feedback(_ref) {
|
|
|
222
222
|
"data-testid": "popover-testId"
|
|
223
223
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
224
224
|
type: "link",
|
|
225
|
-
className:
|
|
225
|
+
className: "".concat(prefix, "-outsideFeedbackButton"),
|
|
226
226
|
"data-testid": "feedback-button-like",
|
|
227
227
|
icon: choiceType === 2 ? /*#__PURE__*/React.createElement(LikeFilled, {
|
|
228
228
|
style: {
|
|
@@ -239,7 +239,7 @@ var Feedback = function Feedback(_ref) {
|
|
|
239
239
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
240
240
|
type: "link",
|
|
241
241
|
"data-testid": "feedback-button-dislike",
|
|
242
|
-
className:
|
|
242
|
+
className: "".concat(prefix, "-outsideFeedbackButton"),
|
|
243
243
|
icon: choiceType === 1 ? /*#__PURE__*/React.createElement(DislikeFilled, {
|
|
244
244
|
style: {
|
|
245
245
|
color: activeColor
|
package/dist/index.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ export { default as TitleWithIcon } from './title-with-icon';
|
|
|
21
21
|
export { default as UserAvatar } from './user-avatar';
|
|
22
22
|
export { default as VirtualTable } from './virtual-table';
|
|
23
23
|
export { default as VisualDataConfig } from './visual-data-config';
|
|
24
|
-
export { default as XTabs } from './
|
|
24
|
+
export { default as XTabs } from './x-tabs';
|
package/dist/index.js
CHANGED
|
@@ -18,4 +18,4 @@ export { default as TitleWithIcon } from "./title-with-icon";
|
|
|
18
18
|
export { default as UserAvatar } from "./user-avatar";
|
|
19
19
|
export { default as VirtualTable } from "./virtual-table";
|
|
20
20
|
export { default as VisualDataConfig } from "./visual-data-config";
|
|
21
|
-
export { default as XTabs } from "./
|
|
21
|
+
export { default as XTabs } from "./x-tabs";
|
|
@@ -4,9 +4,9 @@ export interface InputNumbersValue {
|
|
|
4
4
|
start?: string | number | null;
|
|
5
5
|
end?: string | number | null;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
interface InputNumbersProps extends Omit<InputNumberProps, 'value' | 'onChange'> {
|
|
8
8
|
value?: InputNumbersValue;
|
|
9
9
|
onChange?: (value: InputNumbersValue) => void;
|
|
10
|
-
}
|
|
11
|
-
declare const InputNumbers: ({ value, onChange, ...props }:
|
|
10
|
+
}
|
|
11
|
+
declare const InputNumbers: ({ value, onChange, ...props }: InputNumbersProps) => React.JSX.Element;
|
|
12
12
|
export default InputNumbers;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import React from 'react';
|
|
@@ -14,7 +15,7 @@ var LoadingMask = function LoadingMask(_ref) {
|
|
|
14
15
|
visible = _useDelayedMount2[1];
|
|
15
16
|
return /*#__PURE__*/React.createElement(React.Fragment, null, mount && /*#__PURE__*/React.createElement("div", {
|
|
16
17
|
"data-testid": 'loadingMask',
|
|
17
|
-
className: classNames("".concat(prefix, "-loadingMask"),
|
|
18
|
+
className: classNames("".concat(prefix, "-loadingMask"), _defineProperty({}, "".concat(prefix, "-loadingHide"), !visible))
|
|
18
19
|
}, /*#__PURE__*/React.createElement("div", {
|
|
19
20
|
className: "".concat(prefix, "-loadingLoader")
|
|
20
21
|
}, /*#__PURE__*/React.createElement("div", {
|
package/dist/styles/index.css
CHANGED
|
@@ -516,20 +516,20 @@
|
|
|
516
516
|
width: 100%;
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
.x-star-design-
|
|
519
|
+
.x-star-design-x-tabs-wrapper {
|
|
520
520
|
width: 100%;
|
|
521
521
|
}
|
|
522
|
-
.x-star-design-
|
|
522
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs.x-star-design-tabs {
|
|
523
523
|
width: 100%;
|
|
524
524
|
min-height: 80vh;
|
|
525
525
|
border: 0;
|
|
526
526
|
background-color: #fff;
|
|
527
527
|
color: #9e9e9e;
|
|
528
528
|
}
|
|
529
|
-
.x-star-design-
|
|
530
|
-
background-color: var(--
|
|
529
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs .x-star-design-tabs-nav-wrap {
|
|
530
|
+
background-color: var(--x-tabs-secondary-color);
|
|
531
531
|
}
|
|
532
|
-
.x-star-design-
|
|
532
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs.x-star-design-tabs-card > .x-star-design-tabs-nav .x-star-design-tabs-tab {
|
|
533
533
|
width: 130px;
|
|
534
534
|
height: 130px;
|
|
535
535
|
background-color: unset;
|
|
@@ -540,42 +540,42 @@
|
|
|
540
540
|
border: 0;
|
|
541
541
|
color: #9e9e9e;
|
|
542
542
|
}
|
|
543
|
-
.x-star-design-
|
|
544
|
-
border-left: 6px solid var(--
|
|
543
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs.x-star-design-tabs-card > .x-star-design-tabs-nav .x-star-design-tabs-tab-active {
|
|
544
|
+
border-left: 6px solid var(--x-tabs-primary-color);
|
|
545
545
|
background-color: #fff;
|
|
546
546
|
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
547
547
|
border-radius: 0;
|
|
548
548
|
}
|
|
549
|
-
.x-star-design-
|
|
550
|
-
color: var(--
|
|
549
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs.x-star-design-tabs .x-star-design-tabs-tab:hover {
|
|
550
|
+
color: var(--x-tabs-primary-color);
|
|
551
551
|
}
|
|
552
|
-
.x-star-design-
|
|
552
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs .x-star-design-tabs-tab-btn {
|
|
553
553
|
text-align: center;
|
|
554
554
|
white-space: normal;
|
|
555
555
|
}
|
|
556
|
-
.x-star-design-
|
|
556
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs .x-star-design-tabs-content-holder {
|
|
557
557
|
border-left: 0;
|
|
558
558
|
}
|
|
559
|
-
.x-star-design-
|
|
559
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs .x-star-design-tabs-content {
|
|
560
560
|
display: flex;
|
|
561
561
|
width: 100%;
|
|
562
562
|
height: 100%;
|
|
563
563
|
border: 1px solid #d7d7d7;
|
|
564
564
|
padding: 0 20px;
|
|
565
565
|
}
|
|
566
|
-
.x-star-design-
|
|
566
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs .x-star-design-tabs-tabpane {
|
|
567
567
|
padding: 0 24px 24px;
|
|
568
568
|
}
|
|
569
|
-
.x-star-design-
|
|
569
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs .x-star-design-tabs-tab-icon {
|
|
570
570
|
display: none;
|
|
571
571
|
}
|
|
572
|
-
.x-star-design-
|
|
572
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs .x-star-design-icon-img {
|
|
573
573
|
font-size: 44px;
|
|
574
574
|
}
|
|
575
|
-
.x-star-design-
|
|
575
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs .x-star-design-icon-img .anticon {
|
|
576
576
|
margin: 0;
|
|
577
577
|
}
|
|
578
|
-
.x-star-design-
|
|
578
|
+
.x-star-design-x-tabs-wrapper .x-star-design-x-tabs .x-star-design-icon-title {
|
|
579
579
|
margin-top: -5px;
|
|
580
580
|
padding-bottom: 10px;
|
|
581
581
|
display: block;
|
|
@@ -19,11 +19,11 @@ export declare enum Status {
|
|
|
19
19
|
Unknown = "Unknown",
|
|
20
20
|
WrongAnswer = "Wrong Answer"
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
status: string;
|
|
22
|
+
interface SubmissionStatusProps {
|
|
24
23
|
className?: string;
|
|
25
|
-
onClick?: () => void;
|
|
26
24
|
style?: React.CSSProperties;
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
status: string;
|
|
26
|
+
onClick?: () => void;
|
|
27
|
+
}
|
|
28
|
+
declare const SubmissionStatus: ({ className, style, status, onClick, }: SubmissionStatusProps) => React.JSX.Element;
|
|
29
29
|
export default SubmissionStatus;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import { Tooltip } from 'antd';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
6
5
|
import { useLocale } from "../locales";
|
|
@@ -29,20 +28,20 @@ var scopeColor = new Map([[Status.Accepted, '#00ad07'], [Status.WrongAnswer, '#f
|
|
|
29
28
|
var statusZh = new Map([[Status.Abnormal, ''], [Status.Accepted, '答案正确'], [Status.CheckerJudgementFailed, '代码检查失败'], [Status.CompileError, '编译错误'], [Status.DangerousSyscall, '危险系统调用'], [Status.JudgeFailed, '评测失败'], [Status.JudgementFailed, '评测失败'], [Status.MemoryLimitExceeded, '内存超限'], [Status.OutputLimitExceeded, '输出超限'], [Status.Pending, '排队'], [Status.PresentationError, '段错误'], [Status.Running, '运行'], [Status.RuntimeError, '运行出错'], [Status.Skipped, '忽略'], [Status.SpecialJudgeError, ''], [Status.TimeLimitExceeded, '运行超时'], [Status.Unknown, 'OI赛制提交结果不可见'], [Status.WrongAnswer, '答案错误']]);
|
|
30
29
|
var SubmissionStatus = function SubmissionStatus(_ref) {
|
|
31
30
|
var className = _ref.className,
|
|
31
|
+
style = _ref.style,
|
|
32
32
|
status = _ref.status,
|
|
33
|
-
onClick = _ref.onClick
|
|
34
|
-
style = _ref.style;
|
|
33
|
+
onClick = _ref.onClick;
|
|
35
34
|
var _useLocale = useLocale('CodeDetailModal'),
|
|
36
35
|
locale = _useLocale.locale;
|
|
37
36
|
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
38
37
|
title: locale === 'zh_CN' && (statusZh === null || statusZh === void 0 ? void 0 : statusZh.get(status))
|
|
39
38
|
}, /*#__PURE__*/React.createElement("div", {
|
|
40
39
|
"data-testid": 'submissionStatus',
|
|
41
|
-
className:
|
|
40
|
+
className: className,
|
|
42
41
|
style: _objectSpread({
|
|
43
|
-
cursor: onClick ? 'pointer' : 'initial',
|
|
44
42
|
fontWeight: 'bold',
|
|
45
|
-
color: scopeColor.get(status)
|
|
43
|
+
color: scopeColor.get(status),
|
|
44
|
+
cursor: onClick ? 'pointer' : 'unset'
|
|
46
45
|
}, style),
|
|
47
46
|
onClick: onClick
|
|
48
47
|
}, status)));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AvatarProps } from 'antd
|
|
1
|
+
import type { AvatarProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
3
|
+
interface UserAvatarProps extends AvatarProps {
|
|
4
4
|
user: {
|
|
5
5
|
realName?: string;
|
|
6
6
|
userName?: string;
|
|
7
7
|
} | null | undefined;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
declare const UserAvatar: React.FC<UserAvatarProps>;
|
|
10
10
|
export default UserAvatar;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TableProps } from 'antd
|
|
1
|
+
import type { TableProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
declare const VirtualTable: <RecordType extends Record<string, unknown>>(props: TableProps<RecordType>) => React.JSX.Element;
|
|
4
4
|
export default VirtualTable;
|
|
@@ -3,11 +3,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
|
-
var _excluded = ["children"]
|
|
7
|
-
|
|
6
|
+
var _excluded = ["children"];
|
|
7
|
+
import { useContext } from '@rc-component/context';
|
|
8
8
|
import { Table } from 'antd';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import ResizeObserver from 'rc-resize-observer';
|
|
11
|
+
import TableContext from 'rc-table/es/context/TableContext';
|
|
11
12
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
12
13
|
import { VariableSizeGrid as Grid } from 'react-window';
|
|
13
14
|
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
@@ -18,7 +19,7 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
18
19
|
/**
|
|
19
20
|
* 表格实际宽度
|
|
20
21
|
*/
|
|
21
|
-
var _useState = useState(
|
|
22
|
+
var _useState = useState(0),
|
|
22
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
23
24
|
tableWidth = _useState2[0],
|
|
24
25
|
setTableWidth = _useState2[1];
|
|
@@ -33,9 +34,13 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
33
34
|
* @returns 展平的列
|
|
34
35
|
*/
|
|
35
36
|
var flatten = function flatten(columns) {
|
|
37
|
+
var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key';
|
|
36
38
|
var result = [];
|
|
37
|
-
columns
|
|
38
|
-
|
|
39
|
+
columns.forEach(function (column, index) {
|
|
40
|
+
var mergedKey = "".concat(parentKey, "-").concat(index);
|
|
41
|
+
result.push.apply(result, _toConsumableArray('children' in column ? flatten(column.children, mergedKey) : [_objectSpread({
|
|
42
|
+
key: mergedKey
|
|
43
|
+
}, column)]));
|
|
39
44
|
});
|
|
40
45
|
return result;
|
|
41
46
|
};
|
|
@@ -62,13 +67,13 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
62
67
|
* 等比例放大列宽
|
|
63
68
|
*/
|
|
64
69
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
65
|
-
width: column.width / totalWidth * tableWidth
|
|
70
|
+
width: Math.floor(column.width / totalWidth * tableWidth)
|
|
66
71
|
});
|
|
67
72
|
}
|
|
68
73
|
return column;
|
|
69
74
|
}
|
|
70
75
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
71
|
-
width: tableWidth / widthColumnCount
|
|
76
|
+
width: Math.floor(tableWidth / widthColumnCount)
|
|
72
77
|
});
|
|
73
78
|
});
|
|
74
79
|
}, [columns, tableWidth]);
|
|
@@ -112,7 +117,7 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
112
117
|
};
|
|
113
118
|
useEffect(function () {
|
|
114
119
|
return resetVirtualGrid;
|
|
115
|
-
}, [
|
|
120
|
+
}, [tableWidth]);
|
|
116
121
|
|
|
117
122
|
/**
|
|
118
123
|
* 起始渲染行
|
|
@@ -120,11 +125,21 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
120
125
|
var startRowIndex = useRef(0);
|
|
121
126
|
|
|
122
127
|
/**
|
|
123
|
-
*
|
|
128
|
+
* 虚拟列表
|
|
124
129
|
*/
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
|
|
130
|
+
var VirtualList = function VirtualList(_ref2) {
|
|
131
|
+
var rawData = _ref2.rawData,
|
|
132
|
+
_ref2$info = _ref2.info,
|
|
133
|
+
scrollbarSize = _ref2$info.scrollbarSize,
|
|
134
|
+
ref = _ref2$info.ref,
|
|
135
|
+
_onScroll = _ref2$info.onScroll;
|
|
136
|
+
var _useContext = useContext(TableContext, ['onColumnResize']),
|
|
137
|
+
onColumnResize = _useContext.onColumnResize;
|
|
138
|
+
useEffect(function () {
|
|
139
|
+
mergedColumns.forEach(function (column) {
|
|
140
|
+
return onColumnResize(column.key, column.width);
|
|
141
|
+
});
|
|
142
|
+
}, []);
|
|
128
143
|
ref.current = connectObject;
|
|
129
144
|
|
|
130
145
|
/**
|
|
@@ -151,9 +166,7 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
151
166
|
var record = rawData[rowIndex];
|
|
152
167
|
var props = (_column$onCell = column.onCell) === null || _column$onCell === void 0 ? void 0 : _column$onCell.call(column, record, rowIndex);
|
|
153
168
|
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
154
|
-
className: classNames("".concat(prefix, "-virtual-table-cell"),
|
|
155
|
-
'virtual-table-cell-last': columnIndex === mergedColumns.length - 1
|
|
156
|
-
}, props === null || props === void 0 ? void 0 : props.className),
|
|
169
|
+
className: classNames("".concat(prefix, "-virtual-table-cell"), props === null || props === void 0 ? void 0 : props.className),
|
|
157
170
|
style: _objectSpread(_objectSpread({}, style), props === null || props === void 0 ? void 0 : props.style)
|
|
158
171
|
}), column.render ? column.render(column.dataIndex !== undefined ? record[column.dataIndex] : record, record, rowIndex) : column.dataIndex !== undefined && record[column.dataIndex]);
|
|
159
172
|
};
|
|
@@ -181,7 +194,7 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
181
194
|
width: column.width,
|
|
182
195
|
zIndex: 1
|
|
183
196
|
}
|
|
184
|
-
}, rawData.slice(startRowIndex.current, startRowIndex.current + Math.ceil(scroll.y / 54) +
|
|
197
|
+
}, rawData.slice(startRowIndex.current, startRowIndex.current + Math.ceil(scroll.y / 54) + 8).map(function (_, rowIndex) {
|
|
185
198
|
var _gridRef$current4;
|
|
186
199
|
return /*#__PURE__*/React.createElement(Cell, {
|
|
187
200
|
key: rowIndex,
|
|
@@ -195,7 +208,7 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
195
208
|
/**
|
|
196
209
|
* 水平滚动距离大于 0 时最右侧的固定列加上阴影
|
|
197
210
|
*/
|
|
198
|
-
boxShadow: ((_gridRef$current4 = gridRef.current) === null || _gridRef$current4 === void 0 ? void 0 : _gridRef$current4.state.scrollLeft) > 0 && columnIndex === fixedColumns.length - 1 ? '4px 0px
|
|
211
|
+
boxShadow: ((_gridRef$current4 = gridRef.current) === null || _gridRef$current4 === void 0 ? void 0 : _gridRef$current4.state.scrollLeft) > 0 && columnIndex === fixedColumns.length - 1 ? '4px 0px 8px -2px rgba(5, 5, 5, 0.06)' : undefined,
|
|
199
212
|
transition: 'box-shadow 0.3s'
|
|
200
213
|
}
|
|
201
214
|
/**
|
|
@@ -216,7 +229,7 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
216
229
|
columnCount: mergedColumns.length,
|
|
217
230
|
columnWidth: function columnWidth(index) {
|
|
218
231
|
var width = mergedColumns[index].width;
|
|
219
|
-
return totalHeight > scroll.y &&
|
|
232
|
+
return totalHeight > scroll.y && index === mergedColumns.length - 1 ? width - scrollbarSize : width;
|
|
220
233
|
},
|
|
221
234
|
height: scroll.y,
|
|
222
235
|
rowCount: rawData.length,
|
|
@@ -228,7 +241,7 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
228
241
|
onScroll: function onScroll(_ref5) {
|
|
229
242
|
var scrollTop = _ref5.scrollTop,
|
|
230
243
|
scrollLeft = _ref5.scrollLeft;
|
|
231
|
-
startRowIndex.current = Math.max(Math.floor(scrollTop / 54) -
|
|
244
|
+
startRowIndex.current = Math.max(Math.floor(scrollTop / 54) - 4, 0);
|
|
232
245
|
_onScroll({
|
|
233
246
|
scrollLeft: scrollLeft
|
|
234
247
|
});
|
|
@@ -244,30 +257,12 @@ var VirtualTable = function VirtualTable(props) {
|
|
|
244
257
|
className: classNames("".concat(prefix, "-virtual-table"), props.className),
|
|
245
258
|
pagination: false,
|
|
246
259
|
components: {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
rest = _objectWithoutProperties(_ref7, _excluded2);
|
|
254
|
-
var newChildren = _toConsumableArray(children);
|
|
255
|
-
for (var i = 0, left = 0; i < newChildren.length; i++) {
|
|
256
|
-
var _props = newChildren[i].props;
|
|
257
|
-
if (!_props.column.fixed) {
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
newChildren[i] = _objectSpread(_objectSpread({}, newChildren[i]), {}, {
|
|
261
|
-
props: _objectSpread(_objectSpread({}, _props), {}, {
|
|
262
|
-
fixLeft: left
|
|
263
|
-
})
|
|
264
|
-
});
|
|
265
|
-
left += _props.column.width;
|
|
266
|
-
}
|
|
267
|
-
return /*#__PURE__*/React.createElement("tr", rest, newChildren);
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
body: renderVirtualList
|
|
260
|
+
body: function body(data, info) {
|
|
261
|
+
return /*#__PURE__*/React.createElement(VirtualList, {
|
|
262
|
+
rawData: data,
|
|
263
|
+
info: info
|
|
264
|
+
});
|
|
265
|
+
}
|
|
271
266
|
}
|
|
272
267
|
})))));
|
|
273
268
|
};
|
|
@@ -39,8 +39,8 @@ var XTabs = function XTabs(_ref) {
|
|
|
39
39
|
useEffect(function () {
|
|
40
40
|
var _colorThemeRef$curren, _colorThemeRef$curren2;
|
|
41
41
|
//设置主题色
|
|
42
|
-
(_colorThemeRef$curren = colorThemeRef.current) === null || _colorThemeRef$curren === void 0 ? void 0 : _colorThemeRef$curren.style.setProperty('--
|
|
43
|
-
(_colorThemeRef$curren2 = colorThemeRef.current) === null || _colorThemeRef$curren2 === void 0 ? void 0 : _colorThemeRef$curren2.style.setProperty('--
|
|
42
|
+
(_colorThemeRef$curren = colorThemeRef.current) === null || _colorThemeRef$curren === void 0 ? void 0 : _colorThemeRef$curren.style.setProperty('--x-tabs-primary-color', colorPrimary);
|
|
43
|
+
(_colorThemeRef$curren2 = colorThemeRef.current) === null || _colorThemeRef$curren2 === void 0 ? void 0 : _colorThemeRef$curren2.style.setProperty('--x-tabs-secondary-color', hexToRGBA(colorPrimary, 0.15));
|
|
44
44
|
}, [colorPrimary]);
|
|
45
45
|
var newItems = useMemo(function () {
|
|
46
46
|
return items === null || items === void 0 ? void 0 : items.map(function (item) {
|
|
@@ -56,11 +56,11 @@ var XTabs = function XTabs(_ref) {
|
|
|
56
56
|
});
|
|
57
57
|
}, [items]);
|
|
58
58
|
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement("div", {
|
|
59
|
-
"data-testid":
|
|
59
|
+
"data-testid": "xTabsColorTheme",
|
|
60
60
|
ref: colorThemeRef,
|
|
61
|
-
className: "".concat(prefix, "-
|
|
61
|
+
className: "".concat(prefix, "-x-tabs-wrapper")
|
|
62
62
|
}, /*#__PURE__*/React.createElement(Tabs, _extends({
|
|
63
|
-
className: classNames("".concat(prefix, "-
|
|
63
|
+
className: classNames("".concat(prefix, "-x-tabs"), className),
|
|
64
64
|
tabPosition: "left",
|
|
65
65
|
size: "large",
|
|
66
66
|
type: "card",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-star-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"description": "A react component library developed by turingstar",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"prepare": "husky install && dumi setup",
|
|
21
21
|
"prepublishOnly": "father doctor && npm run build",
|
|
22
22
|
"start": "npm run dev",
|
|
23
|
-
"test": "TZ=
|
|
23
|
+
"test": "TZ=Asia/Shanghai jest"
|
|
24
24
|
},
|
|
25
25
|
"commitlint": {
|
|
26
26
|
"extends": [
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@babel/runtime": "^7.
|
|
48
|
+
"@babel/runtime": "^7.24.1",
|
|
49
49
|
"@codemirror/autocomplete": "^6.9.0",
|
|
50
50
|
"@codemirror/lang-cpp": "^6.0.2",
|
|
51
51
|
"@codemirror/lang-java": "^6.0.1",
|
|
@@ -59,32 +59,33 @@
|
|
|
59
59
|
"@uiw/react-codemirror": "^4.21.9",
|
|
60
60
|
"ahooks": "^3.7.8",
|
|
61
61
|
"classnames": "^2.3.2",
|
|
62
|
-
"dayjs": "^1.11.10",
|
|
63
62
|
"randomcolor": "^0.6.2",
|
|
64
|
-
"rc-resize-observer": "^1.4.0",
|
|
65
63
|
"react-error-boundary": "^4.0.13",
|
|
66
64
|
"react-sortable-hoc": "^2.0.0",
|
|
67
65
|
"react-window": "^1.8.9",
|
|
68
|
-
"x-star-utils": "^0.0.
|
|
66
|
+
"x-star-utils": "^0.0.12"
|
|
69
67
|
},
|
|
70
68
|
"devDependencies": {
|
|
71
69
|
"@ant-design/icons": "^5.3.6",
|
|
72
|
-
"@babel/core": "^7.
|
|
73
|
-
"@babel/preset-env": "^7.
|
|
74
|
-
"@babel/preset-react": "^7.
|
|
75
|
-
"@babel/preset-typescript": "^7.
|
|
70
|
+
"@babel/core": "^7.24.1",
|
|
71
|
+
"@babel/preset-env": "^7.24.1",
|
|
72
|
+
"@babel/preset-react": "^7.24.1",
|
|
73
|
+
"@babel/preset-typescript": "^7.24.1",
|
|
76
74
|
"@commitlint/cli": "^17.1.2",
|
|
77
75
|
"@commitlint/config-conventional": "^17.1.0",
|
|
78
76
|
"@jest/globals": "^29.7.0",
|
|
77
|
+
"@rc-component/context": "^1.4.0",
|
|
79
78
|
"@testing-library/jest-dom": "^6.1.4",
|
|
80
79
|
"@testing-library/react": "^14.1.0",
|
|
81
80
|
"@testing-library/user-event": "^14.5.1",
|
|
81
|
+
"@types/randomcolor": "^0.5.9",
|
|
82
82
|
"@types/react": "^18.0.0",
|
|
83
83
|
"@types/react-dom": "^18.0.0",
|
|
84
84
|
"@types/react-window": "^1.8.5",
|
|
85
85
|
"@umijs/lint": "^4.0.0",
|
|
86
|
-
"antd": "^5.16.
|
|
86
|
+
"antd": "^5.16.4",
|
|
87
87
|
"babel-plugin-inline-import-data-uri": "^1.0.1",
|
|
88
|
+
"dayjs": "^1.11.10",
|
|
88
89
|
"dumi": "^2.2.0",
|
|
89
90
|
"eslint": "^8.23.0",
|
|
90
91
|
"father": "^4.1.0",
|
|
@@ -96,6 +97,8 @@
|
|
|
96
97
|
"prettier": "^2.7.1",
|
|
97
98
|
"prettier-plugin-organize-imports": "^3.0.0",
|
|
98
99
|
"prettier-plugin-packagejson": "^2.2.18",
|
|
100
|
+
"rc-resize-observer": "^1.4.0",
|
|
101
|
+
"rc-table": "^7.45.4",
|
|
99
102
|
"react": "^18.0.0",
|
|
100
103
|
"react-dom": "^18.0.0",
|
|
101
104
|
"stylelint": "^14.9.1",
|
|
@@ -103,7 +106,11 @@
|
|
|
103
106
|
},
|
|
104
107
|
"peerDependencies": {
|
|
105
108
|
"@ant-design/icons": ">=4.7.0",
|
|
106
|
-
"
|
|
109
|
+
"@rc-component/context": ">=1.3.0",
|
|
110
|
+
"antd": ">=4.23.0",
|
|
111
|
+
"dayjs": ">=1.0.0",
|
|
112
|
+
"rc-resize-observer": ">=1.0.0",
|
|
113
|
+
"rc-table": ">=7.26.0",
|
|
107
114
|
"react": ">=16.9.0",
|
|
108
115
|
"react-dom": ">=16.9.0"
|
|
109
116
|
},
|
|
File without changes
|