x-star-design 0.0.14 → 0.0.16
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-mirror-wrapper/define.js +1 -4
- package/dist/code-mirror-wrapper/index.js +3 -9
- package/dist/config-provider-wrapper/index.d.ts +5 -0
- package/dist/config-provider-wrapper/index.js +14 -0
- package/dist/draggable-layout/index.js +1 -6
- package/dist/error-boundary/index.js +6 -14
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -1
- package/dist/input-numbers/index.d.ts +12 -0
- package/dist/input-numbers/index.js +53 -0
- package/dist/loading-mask/index.js +1 -6
- package/dist/pane-title/index.d.ts +9 -0
- package/dist/pane-title/index.js +27 -0
- package/dist/sort-table/index.d.ts +7 -0
- package/dist/sort-table/index.js +86 -0
- package/dist/status-tag/index.js +4 -14
- package/dist/styles/index.css +119 -0
- package/dist/user-avatar/index.d.ts +1 -1
- package/dist/user-avatar/index.js +6 -11
- package/dist/virtual-table/index.d.ts +4 -0
- package/dist/virtual-table/index.js +278 -0
- package/dist/visual-data-config/SingleDataConfig.js +5 -12
- package/dist/visual-data-config/SubTaskConfig.js +5 -12
- package/dist/visual-data-config/define.js +1 -1
- package/dist/visual-data-config/index.js +9 -15
- package/dist/xtabs/index.d.ts +10 -0
- package/dist/xtabs/index.js +34 -0
- package/package.json +6 -1
|
@@ -1,8 +1,5 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
var _langCompleteOptionsM, _themeMap;
|
|
2
|
-
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); }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
3
|
export var LangId = /*#__PURE__*/function (LangId) {
|
|
7
4
|
LangId["CPP"] = "g++";
|
|
8
5
|
LangId["CPP11"] = "g++11";
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
1
4
|
var _excluded = ["className", "value", "theme", "onChange", "lang", "readOnly"];
|
|
2
|
-
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); }
|
|
3
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
-
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."); }
|
|
5
|
-
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); }
|
|
6
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
7
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
5
|
import { autocompletion } from '@codemirror/autocomplete';
|
|
12
6
|
import { cpp } from '@codemirror/lang-cpp';
|
|
13
7
|
import { java } from '@codemirror/lang-java';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConfigProvider } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var ConfigProviderWrapper = function ConfigProviderWrapper(_ref) {
|
|
4
|
+
var children = _ref.children;
|
|
5
|
+
return /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
6
|
+
prefixCls: 'x-star-design',
|
|
7
|
+
theme: {
|
|
8
|
+
token: {
|
|
9
|
+
colorPrimary: '#1890ff'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}, children);
|
|
13
|
+
};
|
|
14
|
+
export default ConfigProviderWrapper;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
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."); }
|
|
3
|
-
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); }
|
|
4
|
-
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; }
|
|
5
|
-
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; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
7
2
|
import { useMemoizedFn } from 'ahooks';
|
|
8
3
|
import classNames from 'classnames';
|
|
9
4
|
import React, { useRef, useState } from 'react';
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
9
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
12
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
15
7
|
// 本组件代码参考自 https://juejin.cn/post/6937474904375689224
|
|
16
8
|
import React from 'react';
|
|
17
9
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,15 @@ export { default as DraggableLayout } from './draggable-layout';
|
|
|
5
5
|
export { default as ErrorBoundary } from './error-boundary';
|
|
6
6
|
export type { FallbackProps } from './error-boundary';
|
|
7
7
|
export { default as LoadingMask } from './loading-mask';
|
|
8
|
+
export { LocaleProvider } from './locales';
|
|
9
|
+
export { default as PaneTitle } from './pane-title';
|
|
8
10
|
export { default as RainbowCat } from './rainbow-cat';
|
|
11
|
+
export { default as SortTable } from './sort-table';
|
|
9
12
|
export { default as StatusTag } from './status-tag';
|
|
10
13
|
export type { StatusTagProps, StatusTagShape, StatusTagStyle, StatusTagType, } from './status-tag/define';
|
|
11
14
|
export { default as SubmissionStatus } from './submission-status';
|
|
12
15
|
export { default as TitleWithIcon } from './title-with-icon';
|
|
13
16
|
export { default as UserAvatar } from './user-avatar';
|
|
17
|
+
export { default as VirtualTable } from './virtual-table';
|
|
14
18
|
export { default as VisualDataConfig } from './visual-data-config';
|
|
19
|
+
export { default as XTabs } from './xtabs';
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,14 @@ export { LangId, Language, Theme } from "./code-mirror-wrapper/define";
|
|
|
4
4
|
export { default as DraggableLayout } from "./draggable-layout";
|
|
5
5
|
export { default as ErrorBoundary } from "./error-boundary";
|
|
6
6
|
export { default as LoadingMask } from "./loading-mask";
|
|
7
|
+
export { LocaleProvider } from "./locales";
|
|
8
|
+
export { default as PaneTitle } from "./pane-title";
|
|
7
9
|
export { default as RainbowCat } from "./rainbow-cat";
|
|
10
|
+
export { default as SortTable } from "./sort-table";
|
|
8
11
|
export { default as StatusTag } from "./status-tag";
|
|
9
12
|
export { default as SubmissionStatus } from "./submission-status";
|
|
10
13
|
export { default as TitleWithIcon } from "./title-with-icon";
|
|
11
14
|
export { default as UserAvatar } from "./user-avatar";
|
|
12
|
-
export { default as
|
|
15
|
+
export { default as VirtualTable } from "./virtual-table";
|
|
16
|
+
export { default as VisualDataConfig } from "./visual-data-config";
|
|
17
|
+
export { default as XTabs } from "./xtabs";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InputNumberProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface InputNumbersValue {
|
|
4
|
+
start?: number;
|
|
5
|
+
end?: number;
|
|
6
|
+
}
|
|
7
|
+
type InputNumbersValueProps = InputNumberProps & {
|
|
8
|
+
value?: InputNumbersValue;
|
|
9
|
+
onChange?: (value: InputNumbersValue) => void;
|
|
10
|
+
};
|
|
11
|
+
declare const InputNumbers: ({ value, onChange, ...props }: InputNumbersValueProps) => React.JSX.Element;
|
|
12
|
+
export default InputNumbers;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["value", "onChange"];
|
|
5
|
+
import { InputNumber, Space } from 'antd';
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
8
|
+
var InputNumbers = function InputNumbers(_ref) {
|
|
9
|
+
var value = _ref.value,
|
|
10
|
+
_onChange = _ref.onChange,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
var _useState = useState(value === null || value === void 0 ? void 0 : value.start),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
start = _useState2[0],
|
|
15
|
+
setStart = _useState2[1];
|
|
16
|
+
var _useState3 = useState(value === null || value === void 0 ? void 0 : value.end),
|
|
17
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
18
|
+
end = _useState4[0],
|
|
19
|
+
setEnd = _useState4[1];
|
|
20
|
+
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Space, {
|
|
21
|
+
split: '-',
|
|
22
|
+
align: "center"
|
|
23
|
+
}, /*#__PURE__*/React.createElement(InputNumber, _extends({
|
|
24
|
+
min: 0,
|
|
25
|
+
max: 100
|
|
26
|
+
}, props, {
|
|
27
|
+
value: (value === null || value === void 0 ? void 0 : value.start) || start,
|
|
28
|
+
onChange: function onChange(v) {
|
|
29
|
+
if (typeof v === 'number') {
|
|
30
|
+
setStart(v);
|
|
31
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange({
|
|
32
|
+
start: v,
|
|
33
|
+
end: end
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
})), /*#__PURE__*/React.createElement(InputNumber, _extends({
|
|
38
|
+
min: 0,
|
|
39
|
+
max: 100,
|
|
40
|
+
value: (value === null || value === void 0 ? void 0 : value.end) || end
|
|
41
|
+
}, props, {
|
|
42
|
+
onChange: function onChange(v) {
|
|
43
|
+
if (typeof v === 'number') {
|
|
44
|
+
setEnd(v);
|
|
45
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange({
|
|
46
|
+
start: start,
|
|
47
|
+
end: v
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}))));
|
|
52
|
+
};
|
|
53
|
+
export default InputNumbers;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
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."); }
|
|
3
|
-
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); }
|
|
4
|
-
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; }
|
|
5
|
-
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; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
7
2
|
import classNames from 'classnames';
|
|
8
3
|
import React from 'react';
|
|
9
4
|
import { useDelayedMount } from 'x-star-utils';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Space } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
4
|
+
import TitleWithIcon from "../title-with-icon";
|
|
5
|
+
import { prefix } from "../utils/global";
|
|
6
|
+
var PaneTitle = function PaneTitle(_ref) {
|
|
7
|
+
var title = _ref.title,
|
|
8
|
+
description = _ref.description,
|
|
9
|
+
children = _ref.children,
|
|
10
|
+
style = _ref.style;
|
|
11
|
+
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
style: style
|
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: "".concat(prefix, "title")
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
16
|
+
align: "center"
|
|
17
|
+
}, /*#__PURE__*/React.createElement(TitleWithIcon, {
|
|
18
|
+
title: title
|
|
19
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: "".concat(prefix, "description")
|
|
21
|
+
}, description), /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
style: {
|
|
23
|
+
marginLeft: 40
|
|
24
|
+
}
|
|
25
|
+
}, children)))));
|
|
26
|
+
};
|
|
27
|
+
export default PaneTitle;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TableProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type customProps = {
|
|
4
|
+
onSortEnd?: (newDataSource: Array<any>) => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
declare const SortTable: (props: TableProps<any> & customProps) => React.JSX.Element;
|
|
7
|
+
export default SortTable;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
+
import { MenuOutlined } from '@ant-design/icons';
|
|
5
|
+
import { Table } from 'antd';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
|
8
|
+
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
9
|
+
var SortTable = function SortTable(props) {
|
|
10
|
+
var dataSource = (props === null || props === void 0 ? void 0 : props.dataSource) || [];
|
|
11
|
+
var rowKey = props.rowKey,
|
|
12
|
+
onEnd = props.onSortEnd;
|
|
13
|
+
var DragHandle = SortableHandle(function () {
|
|
14
|
+
return /*#__PURE__*/React.createElement(MenuOutlined, {
|
|
15
|
+
style: {
|
|
16
|
+
cursor: 'grab',
|
|
17
|
+
color: '#999'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
var newColumns = [{
|
|
22
|
+
title: 'Sort',
|
|
23
|
+
dataIndex: 'sort',
|
|
24
|
+
align: 'center',
|
|
25
|
+
width: 80,
|
|
26
|
+
ellipsis: true,
|
|
27
|
+
className: 'drag-visible',
|
|
28
|
+
render: function render() {
|
|
29
|
+
return /*#__PURE__*/React.createElement(DragHandle, null);
|
|
30
|
+
}
|
|
31
|
+
}].concat(_toConsumableArray(props !== null && props !== void 0 && props.columns ? props === null || props === void 0 ? void 0 : props.columns : []));
|
|
32
|
+
var SortableItem = SortableElement(function (props) {
|
|
33
|
+
return /*#__PURE__*/React.createElement("tr", props);
|
|
34
|
+
});
|
|
35
|
+
var SortableBody = SortableContainer(function (props) {
|
|
36
|
+
return /*#__PURE__*/React.createElement("tbody", props);
|
|
37
|
+
});
|
|
38
|
+
var onSortEnd = function onSortEnd(sortEnd) {
|
|
39
|
+
var oldIndex = sortEnd.oldIndex,
|
|
40
|
+
newIndex = sortEnd.newIndex;
|
|
41
|
+
if (oldIndex !== newIndex) {
|
|
42
|
+
var newData = _toConsumableArray(dataSource); // 创建 dataSource 的副本
|
|
43
|
+
// 移除旧位置的元素,并将其插入新位置
|
|
44
|
+
var _newData$splice = newData.splice(oldIndex, 1),
|
|
45
|
+
_newData$splice2 = _slicedToArray(_newData$splice, 1),
|
|
46
|
+
removedItem = _newData$splice2[0];
|
|
47
|
+
newData.splice(newIndex, 0, removedItem);
|
|
48
|
+
var filteredData = newData.filter(function (el) {
|
|
49
|
+
return !!el;
|
|
50
|
+
}); // 过滤掉空元素
|
|
51
|
+
if (typeof onEnd === 'function') {
|
|
52
|
+
onEnd(filteredData);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var DraggableContainer = function DraggableContainer(props) {
|
|
57
|
+
return /*#__PURE__*/React.createElement(SortableBody, _extends({}, props, {
|
|
58
|
+
useDragHandle: true,
|
|
59
|
+
disableAutoscroll: true,
|
|
60
|
+
helperClass: "row-dragging",
|
|
61
|
+
onSortEnd: onSortEnd
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
var DraggableBodyRow = function DraggableBodyRow(props) {
|
|
65
|
+
// function findIndex base on Table rowKey props and should always be a right array index
|
|
66
|
+
var index = dataSource.findIndex(function (x) {
|
|
67
|
+
return x[String(rowKey)] === props['data-row-key'];
|
|
68
|
+
});
|
|
69
|
+
return /*#__PURE__*/React.createElement(SortableItem, _extends({}, props, {
|
|
70
|
+
index: index,
|
|
71
|
+
key: index
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
75
|
+
columns: newColumns,
|
|
76
|
+
rowKey: rowKey,
|
|
77
|
+
dataSource: dataSource,
|
|
78
|
+
components: {
|
|
79
|
+
body: {
|
|
80
|
+
wrapper: DraggableContainer,
|
|
81
|
+
row: DraggableBodyRow
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
})));
|
|
85
|
+
};
|
|
86
|
+
export default SortTable;
|
package/dist/status-tag/index.js
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
5
|
var _excluded = ["shape", "status", "hover", "required", "children", "onClick"];
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
-
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."); }
|
|
10
|
-
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); }
|
|
11
|
-
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; }
|
|
12
|
-
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; } }
|
|
13
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
6
|
import classNames from 'classnames';
|
|
17
7
|
import React, { useRef, useState } from 'react';
|
|
18
8
|
import correctSVG from "../assets/status-tag/correct.svg";
|
package/dist/styles/index.css
CHANGED
|
@@ -290,3 +290,122 @@
|
|
|
290
290
|
display: inline;
|
|
291
291
|
margin-left: 10px;
|
|
292
292
|
}
|
|
293
|
+
|
|
294
|
+
.x-star-design-virtual-grid::-webkit-scrollbar {
|
|
295
|
+
width: 7px;
|
|
296
|
+
height: 7px;
|
|
297
|
+
}
|
|
298
|
+
.x-star-design-virtual-grid::-webkit-scrollbar-thumb {
|
|
299
|
+
border-radius: 3px;
|
|
300
|
+
box-shadow: inset 0 0 5px #9b9ba3;
|
|
301
|
+
background: rgba(152, 155, 163, 0.5);
|
|
302
|
+
}
|
|
303
|
+
.x-star-design-virtual-grid::-webkit-scrollbar-thumb:hover {
|
|
304
|
+
background: rgba(152, 155, 163, 0.7);
|
|
305
|
+
}
|
|
306
|
+
.x-star-design-virtual-grid::-webkit-scrollbar-thumb:active {
|
|
307
|
+
background: rgba(152, 155, 163, 0.9);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.x-star-design-virtual-table-cell {
|
|
311
|
+
box-sizing: border-box;
|
|
312
|
+
padding: 14px;
|
|
313
|
+
border-bottom: 1px solid #e8e8e8;
|
|
314
|
+
border-right: 1px solid #e8e8e8;
|
|
315
|
+
background: #fff;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
[data-theme=dark] .x-star-design-virtual-table-cell {
|
|
319
|
+
box-sizing: border-box;
|
|
320
|
+
padding: 14px;
|
|
321
|
+
border-bottom: 1px solid #303030;
|
|
322
|
+
border-right: 1px solid #303030;
|
|
323
|
+
background: #141414;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.x-star-design-title {
|
|
327
|
+
background-color: #fff;
|
|
328
|
+
min-height: 50px;
|
|
329
|
+
margin: 0;
|
|
330
|
+
padding: 10px 20px;
|
|
331
|
+
}
|
|
332
|
+
.x-star-design-title .x-star-design-description {
|
|
333
|
+
font-size: 12px;
|
|
334
|
+
color: #b6b6b6;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.x-star-design-XTabs.x-star-design-tabs, .x-star-design-XTabs.ant-tabs {
|
|
338
|
+
width: 100%;
|
|
339
|
+
min-height: 80vh;
|
|
340
|
+
border: 0;
|
|
341
|
+
background-color: #fff;
|
|
342
|
+
color: #9e9e9e;
|
|
343
|
+
}
|
|
344
|
+
.x-star-design-XTabs .x-star-design-tabs-nav-wrap,
|
|
345
|
+
.x-star-design-XTabs .ant-tabs-nav-wrap {
|
|
346
|
+
background-color: #e3ecff;
|
|
347
|
+
}
|
|
348
|
+
.x-star-design-XTabs.x-star-design-tabs-card > .x-star-design-tabs-nav .x-star-design-tabs-tab, .x-star-design-XTabs.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab {
|
|
349
|
+
width: 130px;
|
|
350
|
+
height: 130px;
|
|
351
|
+
background-color: #e3ecff;
|
|
352
|
+
display: flex;
|
|
353
|
+
align-content: center;
|
|
354
|
+
align-items: center;
|
|
355
|
+
justify-content: center;
|
|
356
|
+
border: 0;
|
|
357
|
+
}
|
|
358
|
+
.x-star-design-XTabs.x-star-design-tabs-card > .x-star-design-tabs-nav .x-star-design-tabs-tab-active, .x-star-design-XTabs.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab-active {
|
|
359
|
+
border-left: 6px solid #1890ff;
|
|
360
|
+
background-color: #fff;
|
|
361
|
+
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
362
|
+
}
|
|
363
|
+
.x-star-design-XTabs .x-star-design-tabs-tab-btn,
|
|
364
|
+
.x-star-design-XTabs .ant-tabs-tab-btn {
|
|
365
|
+
text-align: center;
|
|
366
|
+
white-space: normal;
|
|
367
|
+
}
|
|
368
|
+
.x-star-design-XTabs .x-star-design-tabs-content,
|
|
369
|
+
.x-star-design-XTabs .ant-tabs-content {
|
|
370
|
+
display: flex;
|
|
371
|
+
width: 100%;
|
|
372
|
+
height: 100%;
|
|
373
|
+
border: 1px solid #d7d7d7;
|
|
374
|
+
padding: 0 20px;
|
|
375
|
+
}
|
|
376
|
+
.x-star-design-XTabs .x-star-design-tabs-tabpane,
|
|
377
|
+
.x-star-design-XTabs .ant-tabs-tabpane {
|
|
378
|
+
padding: 0 24px 24px;
|
|
379
|
+
}
|
|
380
|
+
.x-star-design-XTabs .x-star-design-icon-img {
|
|
381
|
+
text-align: center;
|
|
382
|
+
font-size: 44px;
|
|
383
|
+
padding-left: 10px;
|
|
384
|
+
}
|
|
385
|
+
.x-star-design-XTabs .x-star-design-icon-title {
|
|
386
|
+
font-size: 16px;
|
|
387
|
+
display: block;
|
|
388
|
+
padding-top: 10px;
|
|
389
|
+
font-style: normal;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.x-star-design-form {
|
|
393
|
+
width: 90%;
|
|
394
|
+
}
|
|
395
|
+
.x-star-design-form .x-star-design-row {
|
|
396
|
+
width: 100%;
|
|
397
|
+
}
|
|
398
|
+
.x-star-design-form .x-star-design-row .x-star-design-explainItem {
|
|
399
|
+
margin: -20px 0 16px;
|
|
400
|
+
}
|
|
401
|
+
.x-star-design-form .x-star-design-row .x-star-design-form-item-extra {
|
|
402
|
+
clear: both;
|
|
403
|
+
color: rgba(0, 0, 0, 0.4509803922);
|
|
404
|
+
font-size: 14px;
|
|
405
|
+
line-height: 1.5715;
|
|
406
|
+
transition: color 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
407
|
+
min-height: 24px;
|
|
408
|
+
}
|
|
409
|
+
.x-star-design-form .x-star-design-formList {
|
|
410
|
+
width: 100%;
|
|
411
|
+
}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
4
|
var _excluded = ["user", "style"];
|
|
3
|
-
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); }
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
5
|
import { Avatar, Tooltip } from 'antd';
|
|
12
6
|
import randomColor from 'randomcolor';
|
|
13
7
|
import React, { useMemo } from 'react';
|
|
8
|
+
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
14
9
|
var UserAvatar = function UserAvatar(_ref) {
|
|
15
10
|
var _ref2, _ref2$filter;
|
|
16
11
|
var user = _ref.user,
|
|
@@ -24,12 +19,12 @@ var UserAvatar = function UserAvatar(_ref) {
|
|
|
24
19
|
format: 'rgb'
|
|
25
20
|
});
|
|
26
21
|
}, [name]);
|
|
27
|
-
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
22
|
+
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
28
23
|
title: name
|
|
29
24
|
}, /*#__PURE__*/React.createElement(Avatar, _extends({
|
|
30
25
|
style: _objectSpread({
|
|
31
26
|
background: background
|
|
32
27
|
}, style)
|
|
33
|
-
}, props), name[0].toUpperCase()));
|
|
28
|
+
}, props), name[0].toUpperCase())));
|
|
34
29
|
};
|
|
35
30
|
export default UserAvatar;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
|
+
var _excluded = ["children"],
|
|
7
|
+
_excluded2 = ["children"];
|
|
8
|
+
import { Table } from 'antd';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import ResizeObserver from 'rc-resize-observer';
|
|
11
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
12
|
+
import { VariableSizeGrid as Grid } from 'react-window';
|
|
13
|
+
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
14
|
+
import { prefix } from "../utils/global";
|
|
15
|
+
var VirtualTable = function VirtualTable(props) {
|
|
16
|
+
var columns = props.columns,
|
|
17
|
+
scroll = props.scroll;
|
|
18
|
+
/**
|
|
19
|
+
* 表格实际宽度
|
|
20
|
+
*/
|
|
21
|
+
var _useState = useState(0),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
tableWidth = _useState2[0],
|
|
24
|
+
setTableWidth = _useState2[1];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 自动设置列宽
|
|
28
|
+
*/
|
|
29
|
+
var mergedColumns = useMemo(function () {
|
|
30
|
+
/**
|
|
31
|
+
* 将分组的列展平
|
|
32
|
+
* @param columns 分组的列
|
|
33
|
+
* @returns 展平的列
|
|
34
|
+
*/
|
|
35
|
+
var flatten = function flatten(columns) {
|
|
36
|
+
var result = [];
|
|
37
|
+
columns === null || columns === void 0 ? void 0 : columns.forEach(function (column) {
|
|
38
|
+
return result.push.apply(result, _toConsumableArray('children' in column ? flatten(column.children) : [column]));
|
|
39
|
+
});
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
var flattenedColumns = flatten(columns);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 未设置宽度的列数
|
|
46
|
+
*/
|
|
47
|
+
var widthColumnCount = flattenedColumns.filter(function (_ref) {
|
|
48
|
+
var width = _ref.width;
|
|
49
|
+
return !width;
|
|
50
|
+
}).length;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 内容实际宽度
|
|
54
|
+
*/
|
|
55
|
+
var totalWidth = flattenedColumns.reduce(function (value, column) {
|
|
56
|
+
return value + column.width;
|
|
57
|
+
}, 0);
|
|
58
|
+
return flattenedColumns.map(function (column) {
|
|
59
|
+
if (column.width) {
|
|
60
|
+
if (!widthColumnCount && totalWidth < tableWidth) {
|
|
61
|
+
/**
|
|
62
|
+
* 等比例放大列宽
|
|
63
|
+
*/
|
|
64
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
65
|
+
width: column.width / totalWidth * tableWidth
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return column;
|
|
69
|
+
}
|
|
70
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
71
|
+
width: tableWidth / widthColumnCount
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}, [columns, tableWidth]);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 固定在左侧的列
|
|
78
|
+
*/
|
|
79
|
+
var fixedColumns = useMemo(function () {
|
|
80
|
+
for (var i = 0; i < mergedColumns.length; i++) {
|
|
81
|
+
if (!mergedColumns[i].fixed) {
|
|
82
|
+
return mergedColumns.slice(0, i);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return mergedColumns;
|
|
86
|
+
}, [mergedColumns]);
|
|
87
|
+
var gridRef = useRef();
|
|
88
|
+
var _useState3 = useState(function () {
|
|
89
|
+
var obj = {};
|
|
90
|
+
Object.defineProperty(obj, 'scrollLeft', {
|
|
91
|
+
get: function get() {
|
|
92
|
+
if (gridRef.current) {
|
|
93
|
+
var _gridRef$current, _gridRef$current$stat;
|
|
94
|
+
return (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : (_gridRef$current$stat = _gridRef$current.state) === null || _gridRef$current$stat === void 0 ? void 0 : _gridRef$current$stat.scrollLeft;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
},
|
|
98
|
+
set: function set(scrollLeft) {
|
|
99
|
+
if (gridRef.current) {
|
|
100
|
+
gridRef.current.scrollTo({
|
|
101
|
+
scrollLeft: scrollLeft
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return obj;
|
|
107
|
+
}),
|
|
108
|
+
_useState4 = _slicedToArray(_useState3, 1),
|
|
109
|
+
connectObject = _useState4[0];
|
|
110
|
+
var resetVirtualGrid = function resetVirtualGrid() {
|
|
111
|
+
var _gridRef$current2;
|
|
112
|
+
return (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.resetAfterIndices({
|
|
113
|
+
columnIndex: 0,
|
|
114
|
+
shouldForceUpdate: true
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
useEffect(function () {
|
|
118
|
+
return resetVirtualGrid;
|
|
119
|
+
}, [mergedColumns]);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 起始渲染行
|
|
123
|
+
*/
|
|
124
|
+
var startRowIndex = useRef(0);
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* 渲染虚拟列表
|
|
128
|
+
*/
|
|
129
|
+
var renderVirtualList = function renderVirtualList(rawData, _ref2) {
|
|
130
|
+
var ref = _ref2.ref,
|
|
131
|
+
_onScroll = _ref2.onScroll;
|
|
132
|
+
ref.current = connectObject;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 内容实际高度
|
|
136
|
+
*/
|
|
137
|
+
var totalHeight = rawData.length * 54;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* 渲染单元格
|
|
141
|
+
*/
|
|
142
|
+
var Cell = function Cell(_ref3) {
|
|
143
|
+
var _column$onCell;
|
|
144
|
+
var columnIndex = _ref3.columnIndex,
|
|
145
|
+
rowIndex = _ref3.rowIndex,
|
|
146
|
+
style = _ref3.style,
|
|
147
|
+
data = _ref3.data;
|
|
148
|
+
var column = mergedColumns[columnIndex];
|
|
149
|
+
/**
|
|
150
|
+
* 如果没有数据则不渲染固定列的单元格
|
|
151
|
+
*/
|
|
152
|
+
if (!data && column.fixed) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
var record = rawData[rowIndex];
|
|
156
|
+
var props = (_column$onCell = column.onCell) === null || _column$onCell === void 0 ? void 0 : _column$onCell.call(column, record, rowIndex);
|
|
157
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
158
|
+
className: classNames("".concat(prefix, "virtual-table-cell"), {
|
|
159
|
+
'virtual-table-cell-last': columnIndex === mergedColumns.length - 1
|
|
160
|
+
}, props === null || props === void 0 ? void 0 : props.className),
|
|
161
|
+
style: _objectSpread(_objectSpread({}, style), props === null || props === void 0 ? void 0 : props.style)
|
|
162
|
+
}), column.render ? column.render(column.dataIndex !== undefined ? record[column.dataIndex] : record, record, rowIndex) : column.dataIndex !== undefined && record[column.dataIndex]);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* 渲染固定列和其余内容
|
|
167
|
+
*/
|
|
168
|
+
var innerElementType = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
169
|
+
var children = _ref4.children,
|
|
170
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
171
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
172
|
+
ref: ref
|
|
173
|
+
}, rest),
|
|
174
|
+
/**
|
|
175
|
+
* 渲染固定列
|
|
176
|
+
*/
|
|
177
|
+
fixedColumns.map(function (column, columnIndex) {
|
|
178
|
+
var _gridRef$current3, _gridRef$current3$sta, _gridRef$current4, _gridRef$current4$sta;
|
|
179
|
+
/**
|
|
180
|
+
* 左边距设置为左侧列宽度之和加水平滚动距离,模拟固定效果
|
|
181
|
+
*/
|
|
182
|
+
var left = fixedColumns.slice(0, columnIndex).reduce(function (value, column) {
|
|
183
|
+
return value + column.width;
|
|
184
|
+
}, 0) + ((_gridRef$current3 = gridRef.current) === null || _gridRef$current3 === void 0 ? void 0 : (_gridRef$current3$sta = _gridRef$current3.state) === null || _gridRef$current3$sta === void 0 ? void 0 : _gridRef$current3$sta.scrollLeft);
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 水平滚动距离大于 0 时最右侧的固定列加上阴影
|
|
188
|
+
*/
|
|
189
|
+
var boxShadow = ((_gridRef$current4 = gridRef.current) === null || _gridRef$current4 === void 0 ? void 0 : (_gridRef$current4$sta = _gridRef$current4.state) === null || _gridRef$current4$sta === void 0 ? void 0 : _gridRef$current4$sta.scrollLeft) > 0 && columnIndex === fixedColumns.length - 1 ? '4px 0px 4px #e8e8e8' : undefined;
|
|
190
|
+
return rawData.slice(startRowIndex.current, startRowIndex.current + Math.ceil(scroll.y / 54) + 2).map(function (_, rowIndex) {
|
|
191
|
+
return /*#__PURE__*/React.createElement(Cell, {
|
|
192
|
+
key: "".concat(columnIndex, ",").concat(rowIndex),
|
|
193
|
+
columnIndex: columnIndex,
|
|
194
|
+
rowIndex: rowIndex + startRowIndex.current,
|
|
195
|
+
style: {
|
|
196
|
+
position: 'absolute',
|
|
197
|
+
top: (rowIndex + startRowIndex.current) * 54,
|
|
198
|
+
left: left,
|
|
199
|
+
width: column.width,
|
|
200
|
+
height: 54,
|
|
201
|
+
boxShadow: boxShadow,
|
|
202
|
+
transition: 'box-shadow 0.3s',
|
|
203
|
+
zIndex: 1
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 传递任意数据以渲染固定列的单元格
|
|
207
|
+
*/,
|
|
208
|
+
data: true
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
}),
|
|
212
|
+
/**
|
|
213
|
+
* 渲染其余内容
|
|
214
|
+
*/
|
|
215
|
+
children);
|
|
216
|
+
});
|
|
217
|
+
return /*#__PURE__*/React.createElement(Grid, {
|
|
218
|
+
ref: gridRef,
|
|
219
|
+
className: "".concat(prefix, "virtual-grid"),
|
|
220
|
+
columnCount: mergedColumns.length,
|
|
221
|
+
columnWidth: function columnWidth(index) {
|
|
222
|
+
var width = mergedColumns[index].width;
|
|
223
|
+
return totalHeight > scroll.y && columns && index === columns.length - 1 ? width - 7 : width;
|
|
224
|
+
},
|
|
225
|
+
height: scroll.y,
|
|
226
|
+
rowCount: rawData.length,
|
|
227
|
+
rowHeight: function rowHeight() {
|
|
228
|
+
return 54;
|
|
229
|
+
},
|
|
230
|
+
width: tableWidth,
|
|
231
|
+
innerElementType: innerElementType,
|
|
232
|
+
onScroll: function onScroll(_ref5) {
|
|
233
|
+
var scrollTop = _ref5.scrollTop,
|
|
234
|
+
scrollLeft = _ref5.scrollLeft;
|
|
235
|
+
startRowIndex.current = Math.max(Math.floor(scrollTop / 54) - 1, 0);
|
|
236
|
+
_onScroll({
|
|
237
|
+
scrollLeft: scrollLeft
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}, Cell);
|
|
241
|
+
};
|
|
242
|
+
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
243
|
+
onResize: function onResize(_ref6) {
|
|
244
|
+
var width = _ref6.width;
|
|
245
|
+
return setTableWidth(width);
|
|
246
|
+
}
|
|
247
|
+
}, /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
248
|
+
className: classNames("".concat(prefix, "virtual-table"), props.className),
|
|
249
|
+
pagination: false,
|
|
250
|
+
components: {
|
|
251
|
+
header: {
|
|
252
|
+
/**
|
|
253
|
+
* 渲染自定义表头,修复固定列问题
|
|
254
|
+
*/
|
|
255
|
+
row: function row(_ref7) {
|
|
256
|
+
var children = _ref7.children,
|
|
257
|
+
rest = _objectWithoutProperties(_ref7, _excluded2);
|
|
258
|
+
var newChildren = _toConsumableArray(children);
|
|
259
|
+
for (var i = 0, left = 0; i < newChildren.length; i++) {
|
|
260
|
+
var _props = newChildren[i].props;
|
|
261
|
+
if (!_props.column.fixed) {
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
newChildren[i] = _objectSpread(_objectSpread({}, newChildren[i]), {}, {
|
|
265
|
+
props: _objectSpread(_objectSpread({}, _props), {}, {
|
|
266
|
+
fixLeft: left
|
|
267
|
+
})
|
|
268
|
+
});
|
|
269
|
+
left += _props.column.width;
|
|
270
|
+
}
|
|
271
|
+
return /*#__PURE__*/React.createElement("tr", rest, children);
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
body: renderVirtualList
|
|
275
|
+
}
|
|
276
|
+
}))));
|
|
277
|
+
};
|
|
278
|
+
export default VirtualTable;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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; }
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
12
4
|
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
|
13
5
|
import { Button, Col, Form, Input, InputNumber, Row, Space } from 'antd';
|
|
14
6
|
import React, { useState } from 'react';
|
|
@@ -55,7 +47,8 @@ var SingleDataConfig = function SingleDataConfig() {
|
|
|
55
47
|
}), /*#__PURE__*/React.createElement(InputNumber, null))), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
|
56
48
|
className: "dynamic-delete-button",
|
|
57
49
|
style: {
|
|
58
|
-
lineHeight:
|
|
50
|
+
lineHeight: 32,
|
|
51
|
+
height: 32
|
|
59
52
|
},
|
|
60
53
|
onClick: function onClick() {
|
|
61
54
|
return remove(field.name);
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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; }
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
12
4
|
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
|
13
5
|
import { Button, Col, Form, Input, InputNumber, Row, Space } from 'antd';
|
|
14
6
|
import React, { useState } from 'react';
|
|
@@ -59,7 +51,8 @@ var SubTaskConfig = function SubTaskConfig() {
|
|
|
59
51
|
}), /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
|
60
52
|
className: "dynamic-delete-button",
|
|
61
53
|
style: {
|
|
62
|
-
lineHeight:
|
|
54
|
+
lineHeight: 32,
|
|
55
|
+
height: 32
|
|
63
56
|
},
|
|
64
57
|
onClick: function onClick() {
|
|
65
58
|
return remove(field.name);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
2
|
// 删除空对象 删除'', null, undefined
|
|
3
3
|
export var isEmpty = function isEmpty(obj) {
|
|
4
4
|
if (_typeof(obj) === 'object') {
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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; }
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
11
4
|
import { Button, Col, Divider, Form, Input, InputNumber, Radio, Row } from 'antd';
|
|
12
5
|
import React, { useEffect } from 'react';
|
|
6
|
+
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
13
7
|
import { useLocale } from "../locales";
|
|
14
8
|
import { prefix } from "../utils/global";
|
|
15
9
|
import SingleDataConfig from "./SingleDataConfig";
|
|
@@ -72,7 +66,7 @@ var VisualDataConfig = function VisualDataConfig(_ref) {
|
|
|
72
66
|
}
|
|
73
67
|
};
|
|
74
68
|
};
|
|
75
|
-
return /*#__PURE__*/React.createElement(Form, {
|
|
69
|
+
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Form, {
|
|
76
70
|
form: form,
|
|
77
71
|
onFinish: /*#__PURE__*/function () {
|
|
78
72
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
|
|
@@ -89,7 +83,7 @@ var VisualDataConfig = function VisualDataConfig(_ref) {
|
|
|
89
83
|
}
|
|
90
84
|
}, _callee);
|
|
91
85
|
}));
|
|
92
|
-
return function (
|
|
86
|
+
return function (_x) {
|
|
93
87
|
return _ref2.apply(this, arguments);
|
|
94
88
|
};
|
|
95
89
|
}(),
|
|
@@ -149,7 +143,7 @@ var VisualDataConfig = function VisualDataConfig(_ref) {
|
|
|
149
143
|
}, /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Col, {
|
|
150
144
|
span: 24
|
|
151
145
|
}, /*#__PURE__*/React.createElement("div", {
|
|
152
|
-
className: "
|
|
146
|
+
className: "".concat(prefix, "form-item-extra ", "".concat(prefix, "explainItem"))
|
|
153
147
|
}, t('Input_Output_Format_Tip'))), /*#__PURE__*/React.createElement(Col, {
|
|
154
148
|
span: 8
|
|
155
149
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
@@ -163,7 +157,7 @@ var VisualDataConfig = function VisualDataConfig(_ref) {
|
|
|
163
157
|
}, /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Col, {
|
|
164
158
|
span: 24
|
|
165
159
|
}, /*#__PURE__*/React.createElement("div", {
|
|
166
|
-
className: "
|
|
160
|
+
className: "".concat(prefix, "form-item-extra ").concat(prefix, "explainItem")
|
|
167
161
|
}, t('File_Input_Output_Format_Tip'))), /*#__PURE__*/React.createElement(Col, {
|
|
168
162
|
span: 12
|
|
169
163
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
@@ -195,6 +189,6 @@ var VisualDataConfig = function VisualDataConfig(_ref) {
|
|
|
195
189
|
}), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
|
|
196
190
|
type: 'primary',
|
|
197
191
|
htmlType: "submit"
|
|
198
|
-
}, t('Confirm_Import'))));
|
|
192
|
+
}, t('Confirm_Import')))));
|
|
199
193
|
};
|
|
200
194
|
export default VisualDataConfig;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TabsProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type XTabsItem = Exclude<TabsProps['items'], undefined> extends (infer Item)[] ? Item & {
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
} : undefined;
|
|
6
|
+
interface XTabsProps extends TabsProps {
|
|
7
|
+
items: XTabsItem[];
|
|
8
|
+
}
|
|
9
|
+
declare const XTabs: ({ items, ...props }: XTabsProps) => React.JSX.Element;
|
|
10
|
+
export default XTabs;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["items"];
|
|
5
|
+
import { Tabs } from 'antd';
|
|
6
|
+
import React, { useMemo } from 'react';
|
|
7
|
+
import ConfigProviderWrapper from "../config-provider-wrapper";
|
|
8
|
+
import { prefix } from "../utils/global";
|
|
9
|
+
var XTabs = function XTabs(_ref) {
|
|
10
|
+
var items = _ref.items,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
var newItems = useMemo(function () {
|
|
13
|
+
return items === null || items === void 0 ? void 0 : items.map(function (item) {
|
|
14
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
15
|
+
label: /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
className: "".concat(prefix, "icon-pane")
|
|
17
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: "".concat(prefix, "icon-img")
|
|
19
|
+
}, item.icon), /*#__PURE__*/React.createElement("em", {
|
|
20
|
+
className: "".concat(prefix, "icon-title")
|
|
21
|
+
}, item === null || item === void 0 ? void 0 : item.label))
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}, [items]);
|
|
25
|
+
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Tabs, _extends({
|
|
26
|
+
className: "".concat(prefix, "XTabs"),
|
|
27
|
+
tabPosition: 'left',
|
|
28
|
+
size: "large",
|
|
29
|
+
type: "card",
|
|
30
|
+
destroyInactiveTabPane: true,
|
|
31
|
+
items: newItems
|
|
32
|
+
}, props)));
|
|
33
|
+
};
|
|
34
|
+
export default XTabs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-star-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "A react component library developed by turingstar",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
]
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
+
"@babel/runtime": "^7.23.1",
|
|
47
48
|
"@codemirror/autocomplete": "^6.9.0",
|
|
48
49
|
"@codemirror/lang-cpp": "^6.0.2",
|
|
49
50
|
"@codemirror/lang-java": "^6.0.1",
|
|
@@ -58,6 +59,9 @@
|
|
|
58
59
|
"ahooks": "^3.7.8",
|
|
59
60
|
"classnames": "^2.3.2",
|
|
60
61
|
"randomcolor": "^0.6.2",
|
|
62
|
+
"rc-resize-observer": "^1.3.1",
|
|
63
|
+
"react-sortable-hoc": "^2.0.0",
|
|
64
|
+
"react-window": "^1.8.9",
|
|
61
65
|
"x-star-utils": "^0.0.4"
|
|
62
66
|
},
|
|
63
67
|
"devDependencies": {
|
|
@@ -66,6 +70,7 @@
|
|
|
66
70
|
"@commitlint/config-conventional": "^17.1.0",
|
|
67
71
|
"@types/react": "^18.0.0",
|
|
68
72
|
"@types/react-dom": "^18.0.0",
|
|
73
|
+
"@types/react-window": "^1.8.5",
|
|
69
74
|
"@umijs/lint": "^4.0.0",
|
|
70
75
|
"antd": "5.2.2",
|
|
71
76
|
"dumi": "^2.2.0",
|