@vtx/components 4.0.0-beta.23 → 4.0.0-beta.24

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.
@@ -121,6 +121,7 @@ function VtxTable(props) {
121
121
  })[0];
122
122
  if (bodyDiv) {
123
123
  bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
124
+ bodyDiv.style.overflowY = 'auto';
124
125
  }
125
126
  if (tablePlaceholder) {
126
127
  tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
@@ -63,7 +63,7 @@ export default function FormItem(props) {
63
63
  return placeholder;
64
64
  }
65
65
  if (typeof label === 'string') {
66
- if (!['Input', 'Select', 'RangePicker', 'VtxInput', 'InputNumber', 'VtxSelect', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
66
+ if (!['Input', 'Select', 'DatePicker', 'TimePicker', 'RangePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker', 'VtxInput', 'InputNumber', 'VtxSelect', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
67
67
  // console.log(type?.displayName)
68
68
  }
69
69
  if (['Input', 'InputNumber', 'VtxInput', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
@@ -74,7 +74,7 @@ export default function FormItem(props) {
74
74
  return '请选择' + label;
75
75
  // return '请选择'
76
76
  }
77
- if (['RangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
77
+ if (['DatePicker', 'RangePicker', 'TimePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
78
78
  return undefined;
79
79
  }
80
80
  }
@@ -98,6 +98,7 @@ Content.propTypes = {
98
98
  customText: PropTypes.string,
99
99
  extraText: PropTypes.string,
100
100
  TextEnum: PropTypes.object,
101
- extraDom: [PropTypes.string, PropTypes.node]
101
+ // extraDom: [PropTypes.string, PropTypes.node],
102
+ extraDom: PropTypes.object
102
103
  };
103
104
  export default Content;
@@ -35,7 +35,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
35
35
  import { jsxs as _jsxs } from "react/jsx-runtime";
36
36
  function getFileName() {
37
37
  var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
38
- var intl = useIntl();
38
+ var _ref = arguments.length > 1 ? arguments[1] : undefined,
39
+ intl = _ref.intl;
39
40
  var index = name.lastIndexOf('.');
40
41
  var suffix = name.substring(index);
41
42
  return name.substring(0, index) + "(".concat(intl.getMessage('import.errorFile', '错误文件'), ")") + suffix;
@@ -44,7 +45,7 @@ var VtxImport2 = function VtxImport2(props) {
44
45
  var intl = useIntl();
45
46
  var _useContext = useContext(VtxProvider),
46
47
  getPrefixCls = _useContext.getPrefixCls;
47
- var prefixCls = getPrefixCls('import2', props.prefixCls);
48
+ var prefixCls = getPrefixCls('', 'vtx-import2');
48
49
  var _useStyle = useStyle(prefixCls),
49
50
  wrapSSR = _useStyle.wrapSSR,
50
51
  hashId = _useStyle.hashId;
@@ -148,7 +149,9 @@ var VtxImport2 = function VtxImport2(props) {
148
149
  }, interval);
149
150
  useEffect(function () {
150
151
  if (fileList.length !== 0) {
151
- fileName.current = getFileName(fileList[0].name);
152
+ fileName.current = getFileName(fileList[0].name, {
153
+ intl: intl
154
+ });
152
155
  }
153
156
  }, [fileList]);
154
157
 
@@ -331,9 +334,9 @@ var VtxImport2 = function VtxImport2(props) {
331
334
  }
332
335
  }
333
336
  };
334
- var onUpload = function onUpload(_ref) {
335
- var _ref$files = _ref.files,
336
- files = _ref$files === void 0 ? fileList : _ref$files;
337
+ var onUpload = function onUpload(_ref2) {
338
+ var _ref2$files = _ref2.files,
339
+ files = _ref2$files === void 0 ? fileList : _ref2$files;
337
340
  if (typeof props.beforeUpload === 'function') {
338
341
  var flag = beforeUpload(files[0]);
339
342
  if (!flag) {
@@ -449,7 +452,8 @@ VtxImport2.propTypes = {
449
452
  beforeUpload: PropTypes.func,
450
453
  chunkSize: PropTypes.number,
451
454
  width: PropTypes.number,
452
- extraDom: [PropTypes.string, PropTypes.node]
455
+ // extraDom: [PropTypes.string, PropTypes.node],
456
+ extraDom: PropTypes.object
453
457
  };
454
458
  export { VtxImport2 };
455
459
  export default VtxImport2;
@@ -7,7 +7,8 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import { useStyle as useAntdStyle } from "../../vtx-provider";
8
8
  var genVtxImport2Style = function genVtxImport2Style(token) {
9
9
  var componentCls = token.componentCls;
10
- return _defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-modal-header-title', {
10
+ console.log('componentCls', componentCls);
11
+ return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-modal-header-title', {
11
12
  color: token.colorText
12
13
  }), '&-modal-header-text', {
13
14
  fontWeight: '400'
@@ -25,7 +26,7 @@ var genVtxImport2Style = function genVtxImport2Style(token) {
25
26
  height: '80px',
26
27
  padding: '16px 16px 16px 48px',
27
28
  color: token.colorPrimary,
28
- fontSize: '14px',
29
+ fontSize: 14,
29
30
  backgroundColor: token.colorBgLayoutTable,
30
31
  borderRadius: '4px'
31
32
  }, "".concat(componentCls, "-download"), {
@@ -48,7 +49,58 @@ var genVtxImport2Style = function genVtxImport2Style(token) {
48
49
  display: 'flex',
49
50
  alignItems: 'center',
50
51
  justifyContent: 'space-between',
51
- color: 'fade(@black, 65%)'
52
+ color: token.colorTextSecondary
53
+ }, "".concat(componentCls, "-file-name"), {
54
+ overflow: 'hidden',
55
+ whiteSpace: 'nowrap',
56
+ textOverflow: 'ellipsis'
57
+ }))), '&:last-child ', {
58
+ marginTop: '20px'
59
+ }), "".concat(componentCls, "-content-mark"), {
60
+ position: 'absolute',
61
+ top: 0,
62
+ left: 0,
63
+ display: 'flex',
64
+ alignItems: 'center',
65
+ justifyContent: 'center',
66
+ width: '28px',
67
+ height: '22px',
68
+ color: '#fff',
69
+ backgroundColor: token.colorPrimary,
70
+ border: "1px solid ".concat(token.colorPrimary),
71
+ borderRadius: '4px 0',
72
+ opacity: 0.6
73
+ }))), "".concat(componentCls, "-content-box"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
74
+ position: 'relative',
75
+ display: 'flex',
76
+ alignItems: 'center',
77
+ height: '80px',
78
+ padding: '16px 16px 16px 48px',
79
+ color: token.colorPrimary,
80
+ fontSize: 14,
81
+ backgroundColor: token.colorBgLayoutTable,
82
+ borderRadius: '4px'
83
+ }, "".concat(componentCls, "-download"), {
84
+ marginLeft: '16px'
85
+ }), "".concat(componentCls, "-file-list"), _defineProperty(_defineProperty({
86
+ display: 'flex',
87
+ flexDirection: 'column',
88
+ justifyContent: 'space-between',
89
+ width: '100%',
90
+ marginLeft: '16px',
91
+ overflow: 'hidden',
92
+ whiteSpace: 'nowrap',
93
+ textOverflow: 'ellipsis'
94
+ }, "".concat(componentCls, "-text"), {
95
+ cursor: 'pointer',
96
+ overflowRrap: 'break-word',
97
+ wordBreak: 'break-all',
98
+ whiteSpace: 'pre-wrap'
99
+ }), "".concat(componentCls, "-file-item"), _defineProperty({
100
+ display: 'flex',
101
+ alignItems: 'center',
102
+ justifyContent: 'space-between',
103
+ color: token.colorBase
52
104
  }, "".concat(componentCls, "-file-name"), {
53
105
  overflow: 'hidden',
54
106
  whiteSpace: 'nowrap',
@@ -77,17 +129,17 @@ var genVtxImport2Style = function genVtxImport2Style(token) {
77
129
  }, "".concat(componentCls, "-result"), {
78
130
  marginTop: '20px',
79
131
  marginBottom: '12px',
80
- color: 'fade(@black, 85%)',
132
+ color: token.colorText,
81
133
  fontWeight: '700',
82
134
  fontSize: '24px'
83
135
  }), "&-success-tips", {
84
- color: 'fade(@black, 45%)',
85
- fontSize: '14px'
136
+ color: token.colorTextSecondary,
137
+ fontSize: 14
86
138
  }), "&-error-tips", {
87
139
  color: token.colorPrimary,
88
- fontSize: '14px',
140
+ fontSize: 14,
89
141
  cursor: 'pointer'
90
- })));
142
+ }));
91
143
  };
92
144
  export function useStyle(prefixCls) {
93
145
  return useAntdStyle('VtxImport2', function (token) {
@@ -1,5 +1,6 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["value", "format"];
2
+ var _excluded = ["value", "format"],
3
+ _excluded2 = ["value", "format"];
3
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
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; }
@@ -12,6 +13,7 @@ import { TimePicker } from 'antd';
12
13
  import dayjs from 'dayjs';
13
14
  import PropTypes from 'prop-types';
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
+ var RangePicker = TimePicker.RangePicker;
15
17
  var VtxTimePicker = /*#__PURE__*/forwardRef(function (props, ref) {
16
18
  var value = props.value,
17
19
  _props$format = props.format,
@@ -28,7 +30,31 @@ var VtxTimePicker = /*#__PURE__*/forwardRef(function (props, ref) {
28
30
  }
29
31
  }));
30
32
  });
33
+
34
+ // 时间范围选择器
35
+ var VtxTimeRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
36
+ var value = props.value,
37
+ _props$format2 = props.format,
38
+ format = _props$format2 === void 0 ? 'HH:mm:ss' : _props$format2,
39
+ rest = _objectWithoutProperties(props, _excluded2);
40
+ var newValue = value && Array.isArray(value) ? value.map(function (item) {
41
+ return item ? dayjs.isDayjs(item) ? item : dayjs(item, format) : null;
42
+ }) : null;
43
+ return /*#__PURE__*/_jsx(RangePicker, _objectSpread(_objectSpread({
44
+ value: newValue,
45
+ format: format
46
+ }, rest), {}, {
47
+ ref: ref,
48
+ style: {
49
+ width: '100%'
50
+ }
51
+ }));
52
+ });
31
53
  VtxTimePicker.displayName = 'VtxTimePicker';
54
+ VtxTimeRangePicker.displayName = 'VtxTimeRangePicker';
55
+
56
+ // 将范围选择器作为 VtxTimePicker 的属性
57
+ VtxTimePicker.VtxTimeRangePicker = VtxTimeRangePicker;
32
58
  export { VtxTimePicker };
33
59
  export default VtxTimePicker;
34
60
  VtxTimePicker.propTypes = {
@@ -131,6 +131,7 @@ function VtxTable(props) {
131
131
  })[0];
132
132
  if (bodyDiv) {
133
133
  bodyDiv.style.minHeight = "".concat(bodyHeight - (rest.scrollY || 0), "px");
134
+ bodyDiv.style.overflowY = 'auto';
134
135
  }
135
136
  if (tablePlaceholder) {
136
137
  tablePlaceholder.style.height = "".concat(bodyHeight - (rest.scrollY || 0) - 12, "px");
@@ -69,7 +69,7 @@ function FormItem(props) {
69
69
  return placeholder;
70
70
  }
71
71
  if (typeof label === 'string') {
72
- if (!['Input', 'Select', 'RangePicker', 'VtxInput', 'InputNumber', 'VtxSelect', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
72
+ if (!['Input', 'Select', 'DatePicker', 'TimePicker', 'RangePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker', 'VtxInput', 'InputNumber', 'VtxSelect', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
73
73
  // console.log(type?.displayName)
74
74
  }
75
75
  if (['Input', 'InputNumber', 'VtxInput', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
@@ -80,7 +80,7 @@ function FormItem(props) {
80
80
  return '请选择' + label;
81
81
  // return '请选择'
82
82
  }
83
- if (['RangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
83
+ if (['DatePicker', 'RangePicker', 'TimePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
84
84
  return undefined;
85
85
  }
86
86
  }
@@ -107,6 +107,7 @@ Content.propTypes = {
107
107
  customText: _propTypes.default.string,
108
108
  extraText: _propTypes.default.string,
109
109
  TextEnum: _propTypes.default.object,
110
- extraDom: [_propTypes.default.string, _propTypes.default.node]
110
+ // extraDom: [PropTypes.string, PropTypes.node],
111
+ extraDom: _propTypes.default.object
111
112
  };
112
113
  var _default = exports.default = Content;
@@ -41,7 +41,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
41
41
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
42
42
  function getFileName() {
43
43
  var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
44
- var intl = (0, _vtxProvider.useIntl)();
44
+ var _ref = arguments.length > 1 ? arguments[1] : undefined,
45
+ intl = _ref.intl;
45
46
  var index = name.lastIndexOf('.');
46
47
  var suffix = name.substring(index);
47
48
  return name.substring(0, index) + "(".concat(intl.getMessage('import.errorFile', '错误文件'), ")") + suffix;
@@ -50,7 +51,7 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
50
51
  var intl = (0, _vtxProvider.useIntl)();
51
52
  var _useContext = (0, _react.useContext)(_vtxProvider.VtxProvider),
52
53
  getPrefixCls = _useContext.getPrefixCls;
53
- var prefixCls = getPrefixCls('import2', props.prefixCls);
54
+ var prefixCls = getPrefixCls('', 'vtx-import2');
54
55
  var _useStyle = (0, _index.useStyle)(prefixCls),
55
56
  wrapSSR = _useStyle.wrapSSR,
56
57
  hashId = _useStyle.hashId;
@@ -154,7 +155,9 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
154
155
  }, interval);
155
156
  (0, _react.useEffect)(function () {
156
157
  if (fileList.length !== 0) {
157
- fileName.current = getFileName(fileList[0].name);
158
+ fileName.current = getFileName(fileList[0].name, {
159
+ intl: intl
160
+ });
158
161
  }
159
162
  }, [fileList]);
160
163
 
@@ -337,9 +340,9 @@ var VtxImport2 = exports.VtxImport2 = function VtxImport2(props) {
337
340
  }
338
341
  }
339
342
  };
340
- var onUpload = function onUpload(_ref) {
341
- var _ref$files = _ref.files,
342
- files = _ref$files === void 0 ? fileList : _ref$files;
343
+ var onUpload = function onUpload(_ref2) {
344
+ var _ref2$files = _ref2.files,
345
+ files = _ref2$files === void 0 ? fileList : _ref2$files;
343
346
  if (typeof props.beforeUpload === 'function') {
344
347
  var flag = beforeUpload(files[0]);
345
348
  if (!flag) {
@@ -455,6 +458,7 @@ VtxImport2.propTypes = {
455
458
  beforeUpload: _propTypes.default.func,
456
459
  chunkSize: _propTypes.default.number,
457
460
  width: _propTypes.default.number,
458
- extraDom: [_propTypes.default.string, _propTypes.default.node]
461
+ // extraDom: [PropTypes.string, PropTypes.node],
462
+ extraDom: _propTypes.default.object
459
463
  };
460
464
  var _default = exports.default = VtxImport2;
@@ -13,7 +13,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
13
13
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
14
  var genVtxImport2Style = function genVtxImport2Style(token) {
15
15
  var componentCls = token.componentCls;
16
- return _defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-modal-header-title', {
16
+ console.log('componentCls', componentCls);
17
+ return _defineProperty(_defineProperty(_defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, '&-modal-header-title', {
17
18
  color: token.colorText
18
19
  }), '&-modal-header-text', {
19
20
  fontWeight: '400'
@@ -31,7 +32,7 @@ var genVtxImport2Style = function genVtxImport2Style(token) {
31
32
  height: '80px',
32
33
  padding: '16px 16px 16px 48px',
33
34
  color: token.colorPrimary,
34
- fontSize: '14px',
35
+ fontSize: 14,
35
36
  backgroundColor: token.colorBgLayoutTable,
36
37
  borderRadius: '4px'
37
38
  }, "".concat(componentCls, "-download"), {
@@ -54,7 +55,58 @@ var genVtxImport2Style = function genVtxImport2Style(token) {
54
55
  display: 'flex',
55
56
  alignItems: 'center',
56
57
  justifyContent: 'space-between',
57
- color: 'fade(@black, 65%)'
58
+ color: token.colorTextSecondary
59
+ }, "".concat(componentCls, "-file-name"), {
60
+ overflow: 'hidden',
61
+ whiteSpace: 'nowrap',
62
+ textOverflow: 'ellipsis'
63
+ }))), '&:last-child ', {
64
+ marginTop: '20px'
65
+ }), "".concat(componentCls, "-content-mark"), {
66
+ position: 'absolute',
67
+ top: 0,
68
+ left: 0,
69
+ display: 'flex',
70
+ alignItems: 'center',
71
+ justifyContent: 'center',
72
+ width: '28px',
73
+ height: '22px',
74
+ color: '#fff',
75
+ backgroundColor: token.colorPrimary,
76
+ border: "1px solid ".concat(token.colorPrimary),
77
+ borderRadius: '4px 0',
78
+ opacity: 0.6
79
+ }))), "".concat(componentCls, "-content-box"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({
80
+ position: 'relative',
81
+ display: 'flex',
82
+ alignItems: 'center',
83
+ height: '80px',
84
+ padding: '16px 16px 16px 48px',
85
+ color: token.colorPrimary,
86
+ fontSize: 14,
87
+ backgroundColor: token.colorBgLayoutTable,
88
+ borderRadius: '4px'
89
+ }, "".concat(componentCls, "-download"), {
90
+ marginLeft: '16px'
91
+ }), "".concat(componentCls, "-file-list"), _defineProperty(_defineProperty({
92
+ display: 'flex',
93
+ flexDirection: 'column',
94
+ justifyContent: 'space-between',
95
+ width: '100%',
96
+ marginLeft: '16px',
97
+ overflow: 'hidden',
98
+ whiteSpace: 'nowrap',
99
+ textOverflow: 'ellipsis'
100
+ }, "".concat(componentCls, "-text"), {
101
+ cursor: 'pointer',
102
+ overflowRrap: 'break-word',
103
+ wordBreak: 'break-all',
104
+ whiteSpace: 'pre-wrap'
105
+ }), "".concat(componentCls, "-file-item"), _defineProperty({
106
+ display: 'flex',
107
+ alignItems: 'center',
108
+ justifyContent: 'space-between',
109
+ color: token.colorBase
58
110
  }, "".concat(componentCls, "-file-name"), {
59
111
  overflow: 'hidden',
60
112
  whiteSpace: 'nowrap',
@@ -83,17 +135,17 @@ var genVtxImport2Style = function genVtxImport2Style(token) {
83
135
  }, "".concat(componentCls, "-result"), {
84
136
  marginTop: '20px',
85
137
  marginBottom: '12px',
86
- color: 'fade(@black, 85%)',
138
+ color: token.colorText,
87
139
  fontWeight: '700',
88
140
  fontSize: '24px'
89
141
  }), "&-success-tips", {
90
- color: 'fade(@black, 45%)',
91
- fontSize: '14px'
142
+ color: token.colorTextSecondary,
143
+ fontSize: 14
92
144
  }), "&-error-tips", {
93
145
  color: token.colorPrimary,
94
- fontSize: '14px',
146
+ fontSize: 14,
95
147
  cursor: 'pointer'
96
- })));
148
+ }));
97
149
  };
98
150
  function useStyle(prefixCls) {
99
151
  return (0, _vtxProvider.useStyle)('VtxImport2', function (token) {
@@ -10,7 +10,8 @@ var _antd = require("antd");
10
10
  var _dayjs = _interopRequireDefault(require("dayjs"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
- var _excluded = ["value", "format"];
13
+ var _excluded = ["value", "format"],
14
+ _excluded2 = ["value", "format"];
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -21,6 +22,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
21
22
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
22
23
  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; }
23
24
  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; }
25
+ var RangePicker = _antd.TimePicker.RangePicker;
24
26
  var VtxTimePicker = exports.VtxTimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
25
27
  var value = props.value,
26
28
  _props$format = props.format,
@@ -37,7 +39,31 @@ var VtxTimePicker = exports.VtxTimePicker = /*#__PURE__*/(0, _react.forwardRef)(
37
39
  }
38
40
  }));
39
41
  });
42
+
43
+ // 时间范围选择器
44
+ var VtxTimeRangePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
45
+ var value = props.value,
46
+ _props$format2 = props.format,
47
+ format = _props$format2 === void 0 ? 'HH:mm:ss' : _props$format2,
48
+ rest = _objectWithoutProperties(props, _excluded2);
49
+ var newValue = value && Array.isArray(value) ? value.map(function (item) {
50
+ return item ? _dayjs.default.isDayjs(item) ? item : (0, _dayjs.default)(item, format) : null;
51
+ }) : null;
52
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(RangePicker, _objectSpread(_objectSpread({
53
+ value: newValue,
54
+ format: format
55
+ }, rest), {}, {
56
+ ref: ref,
57
+ style: {
58
+ width: '100%'
59
+ }
60
+ }));
61
+ });
40
62
  VtxTimePicker.displayName = 'VtxTimePicker';
63
+ VtxTimeRangePicker.displayName = 'VtxTimeRangePicker';
64
+
65
+ // 将范围选择器作为 VtxTimePicker 的属性
66
+ VtxTimePicker.VtxTimeRangePicker = VtxTimeRangePicker;
41
67
  var _default = exports.default = VtxTimePicker;
42
68
  VtxTimePicker.propTypes = {
43
69
  value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.instanceOf(_dayjs.default)]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtx/components",
3
- "version": "4.0.0-beta.23",
3
+ "version": "4.0.0-beta.24",
4
4
  "description": "React components for Vortex",
5
5
  "keywords": [
6
6
  "react",