@vtx/components 4.0.0-beta.52 → 4.0.0-beta.54

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.
@@ -154,7 +154,7 @@ function VtxTable(props) {
154
154
  var resizeObserver = new ResizeObserver(function () {
155
155
  calculateHeight();
156
156
  });
157
- if (autoFit && rootDomRef.current) {
157
+ if (autoFit && rootDomRef.current && scrollY) {
158
158
  resizeObserver.observe(rootDomRef.current, {
159
159
  box: 'border-box'
160
160
  });
@@ -164,7 +164,7 @@ function VtxTable(props) {
164
164
  resizeObserver.disconnect();
165
165
  }
166
166
  };
167
- }, [autoFit, tableSize]);
167
+ }, [autoFit, tableSize, scrollY]);
168
168
  useLayoutEffect(function () {
169
169
  if (autoFit) {
170
170
  calculateHeight();
@@ -369,8 +369,11 @@ function VtxTable(props) {
369
369
  x: 'max-content'
370
370
  }, scroll),
371
371
  pagination: getPagination(rest.pagination),
372
- style: {
373
- height: "calc(100% - ".concat(toolbarHeight.current + alertHeight.current, "px)")
372
+ xs: true,
373
+ styles: {
374
+ root: {
375
+ height: "calc(100% - ".concat(toolbarHeight.current + alertHeight.current, "px)")
376
+ }
374
377
  },
375
378
  locale: _objectSpread({
376
379
  emptyText: /*#__PURE__*/_jsx(Empty, {
@@ -26,21 +26,32 @@ var genVtxStyle = function genVtxStyle(token) {
26
26
  }, '.ant-table', _defineProperty({
27
27
  // height: '100%',
28
28
  flex: 1
29
- }, '.ant-table-container', _defineProperty(_defineProperty({}, '.ant-table-body', {
29
+ }, '.ant-table-container', _defineProperty(_defineProperty({
30
+ height: '100%',
31
+ borderInlineStart: "none"
32
+ }, '.ant-table-body', {
30
33
  scrollbarWidth: "thin"
31
34
  }), '.ant-table-content', _defineProperty({
32
- // height: '100%',
35
+ height: '100%',
33
36
  scrollbarWidth: "thin"
34
37
  }, 'table', {
35
38
  // height: '100%',
36
39
  minWidth: "calc(100% - 1px) !important"
37
40
  })))))), '.ant-table', _defineProperty(_defineProperty(_defineProperty({}, '.ant-table-header', _defineProperty({}, '.ant-table-thead', {
38
41
  '>tr>th': {
39
- background: token.colorBgContainer
42
+ background: token.colorBgContainer,
43
+ '&:first-child': {
44
+ borderInlineStart: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)"
45
+ }
40
46
  }
41
47
  })), '.ant-table-cell', {
42
48
  // minWidth: 10,
43
49
  }), '.ant-table-tbody', {
50
+ '>tr>td': {
51
+ '&:first-child': {
52
+ borderInlineStart: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)"
53
+ }
54
+ },
44
55
  '>tr.ant-table-placeholder': {
45
56
  position: 'absolute',
46
57
  top: "auto",
@@ -68,10 +79,13 @@ var genVtxStyle = function genVtxStyle(token) {
68
79
  }
69
80
  }
70
81
  }
71
- })), '.ant-pagination', _defineProperty({}, '.ant-pagination-item', {
82
+ })), '.ant-pagination', _defineProperty({
83
+ margin: "var(--ant-margin) 0 0 0"
84
+ }, '.ant-pagination-item', {
72
85
  borderRadius: token.borderRadiusSM
73
86
  })))), "".concat(componentCls, "-fit"), {
74
- height: '100%'
87
+ height: '100%',
88
+ minHeight: 200
75
89
  }), "".concat(componentCls, "-noFit"), {}), "".concat(componentCls, "-no-border"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, "".concat(antCls, "-table"), _defineProperty({}, '>.ant-table-container', _defineProperty(_defineProperty({
76
90
  borderColor: 'transparent'
77
91
  }, '.ant-table-thead', {
@@ -126,10 +140,14 @@ var genVtxStyle = function genVtxStyle(token) {
126
140
  '>tr>th': {
127
141
  background: token.colorBgContainer
128
142
  }
129
- }))), "".concat(componentCls, "-no-data"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({}, '.ant-table-content', _defineProperty({
143
+ }))), "".concat(componentCls, "-no-data"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({
144
+ borderInlineStart: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)"
145
+ }, '.ant-table-content', _defineProperty({
130
146
  borderRight: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
131
147
  borderBottom: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)"
132
- }, 'table', {})))))))), "".concat(componentCls, "-no-data").concat(componentCls, "-no-border"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({}, '.ant-table-content', {
148
+ }, 'table', {})))))))), "".concat(componentCls, "-no-data").concat(componentCls, "-no-border"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({
149
+ borderInlineStart: "none"
150
+ }, '.ant-table-content', {
133
151
  borderRight: "none",
134
152
  borderBottom: "none"
135
153
  })))))));
@@ -11,7 +11,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
11
11
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import React, { useRef, useEffect, useContext } from 'react';
14
- import { message, Button } from 'antd';
14
+ import { message, Button, Tooltip } from 'antd';
15
15
  import PropTypes from 'prop-types';
16
16
  import useSet from "../utils/useSet";
17
17
  import VtxImportResult from "./result";
@@ -72,7 +72,8 @@ function VtxImport(props) {
72
72
  currentIndex: 0,
73
73
  chunkId: '',
74
74
  chunks: [],
75
- operation: props.operation || intl.getMessage('import.operation', '导入')
75
+ operation: props.operation || intl.getMessage('import.operation', '导入'),
76
+ fileName: ''
76
77
  }),
77
78
  _useSet2 = _slicedToArray(_useSet, 2),
78
79
  state = _useSet2[0],
@@ -418,19 +419,80 @@ function VtxImport(props) {
418
419
  startUpload();
419
420
  }
420
421
  }, [state.chunkId]);
422
+ var truncateFileName = function truncateFileName(fileName) {
423
+ var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 28;
424
+ if (fileName.length <= maxLength) return fileName;
425
+ var extIndex = fileName.lastIndexOf('.');
426
+ var ext = extIndex !== -1 ? fileName.slice(extIndex) : '';
427
+ var name = extIndex !== -1 ? fileName.slice(0, extIndex) : fileName;
428
+ var availableLength = maxLength - ext.length - 3; // 3 是 "..."
429
+ if (availableLength <= 0) return "...".concat(ext);
430
+ var startLength = Math.ceil(availableLength / 2);
431
+ var endLength = Math.floor(availableLength / 2);
432
+ var start = name.slice(0, startLength);
433
+ var end = name.slice(-endLength);
434
+ return "".concat(start, "...").concat(end).concat(ext);
435
+ };
436
+
437
+ // 处理文件选择变化
438
+ var handleFileChange = function handleFileChange(event) {
439
+ var _event$target$files;
440
+ var file = (_event$target$files = event.target.files) === null || _event$target$files === void 0 ? void 0 : _event$target$files[0];
441
+ if (file) {
442
+ setState(function (prev) {
443
+ return _objectSpread(_objectSpread({}, prev), {}, {
444
+ fileName: truncateFileName(file.name)
445
+ });
446
+ });
447
+ // 这里可以添加文件上传或其他处理逻辑
448
+ // 例如:uploadFile(file);
449
+ } else {
450
+ setState(function (prev) {
451
+ return _objectSpread(_objectSpread({}, prev), {}, {
452
+ fileName: ''
453
+ });
454
+ });
455
+ }
456
+ };
457
+ var handleSelectFile = function handleSelectFile() {
458
+ var _fileInputRef$current3;
459
+ (_fileInputRef$current3 = fileInputRef.current) === null || _fileInputRef$current3 === void 0 || _fileInputRef$current3.click();
460
+ };
421
461
  return wrapSSR( /*#__PURE__*/_jsxs(VtxModal, _objectSpread(_objectSpread({}, modalProps), {}, {
422
- children: [props.children, /*#__PURE__*/_jsx("form", {
462
+ children: [props.children, /*#__PURE__*/_jsxs("form", {
423
463
  encType: "multipart/form-data",
424
464
  method: "post",
425
465
  target: "tmp",
426
466
  action: uploadURL,
427
467
  ref: formRef,
428
- children: /*#__PURE__*/_jsx("input", {
468
+ children: [/*#__PURE__*/_jsxs("div", {
469
+ className: "".concat(prefixCls, "-btn"),
470
+ children: [/*#__PURE__*/_jsx(Button, {
471
+ onClick: handleSelectFile,
472
+ children: /*#__PURE__*/_jsx("span", {
473
+ className: "".concat(prefixCls, "-label"),
474
+ children: intl.getMessage('import.selectFile', '选择文件')
475
+ })
476
+ }), state.fileName ? /*#__PURE__*/_jsx(Tooltip, {
477
+ title: state.fileName,
478
+ children: /*#__PURE__*/_jsx("div", {
479
+ className: "".concat(prefixCls, "-file-name"),
480
+ children: state.fileName
481
+ })
482
+ }) : /*#__PURE__*/_jsx("div", {
483
+ className: "".concat(prefixCls, "-file-name"),
484
+ children: intl.getMessage('import.noFileSelected', '未选择任何文件')
485
+ })]
486
+ }), /*#__PURE__*/_jsx("input", {
429
487
  type: "file",
430
488
  name: state.fileKey,
431
489
  accept: state.accept,
432
- ref: fileInputRef
433
- })
490
+ ref: fileInputRef,
491
+ style: {
492
+ display: 'none'
493
+ },
494
+ onChange: handleFileChange
495
+ })]
434
496
  }), /*#__PURE__*/_jsx("iframe", {
435
497
  name: "tmp",
436
498
  style: {
@@ -7,7 +7,7 @@ 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 genVtxImportStyle = function genVtxImportStyle(token) {
9
9
  var componentCls = token.componentCls;
10
- return _defineProperty({}, componentCls, {
10
+ return _defineProperty({}, componentCls, _defineProperty({
11
11
  '.ant-modal-container': {
12
12
  padding: 0,
13
13
  '.ant-modal-header': {
@@ -17,7 +17,12 @@ var genVtxImportStyle = function genVtxImportStyle(token) {
17
17
  padding: 20
18
18
  }
19
19
  }
20
- });
20
+ }, '&-btn', {
21
+ display: 'flex',
22
+ justifyContent: 'flex-start',
23
+ alignItems: 'center',
24
+ gap: 8
25
+ }));
21
26
  };
22
27
  export function useStyle(prefixCls) {
23
28
  return useAntdStyle('VtxImport', function (token) {
@@ -96,7 +96,7 @@ var genVtxStyle = function genVtxStyle(token) {
96
96
  '&-wrap': _objectSpread(_objectSpread({}, absolute()), {}, {
97
97
  backgroundColor: token.colorBgContainer,
98
98
  borderRadius: token.borderRadiusLG,
99
- padding: '0 20px'
99
+ padding: '0 20px 20px 20px'
100
100
  }),
101
101
  '&-card': {
102
102
  background: token.colorBgContainer,
@@ -125,6 +125,8 @@ export default {
125
125
  operation: 'Import',
126
126
  error: 'Upload failed',
127
127
  success: 'Upload successful',
128
+ selectFile: 'Click to select file',
129
+ noFileSelected: "No file selected",
128
130
  downloadTemplate: 'Download template',
129
131
  pleaseSelectFile: 'Please select the file to upload',
130
132
  upload: 'Upload',
@@ -124,6 +124,8 @@ export default {
124
124
  operation: '导入',
125
125
  error: '上传失败',
126
126
  success: '上传成功',
127
+ selectFile: '选择文件',
128
+ noFileSelected: "未选择任何文件",
127
129
  downloadTemplate: '下载模板',
128
130
  pleaseSelectFile: '请选择需要上传的文件',
129
131
  upload: '上传',
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  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; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  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); }
7
- import { over } from '@umijs/utils/compiled/lodash';
8
7
  import { useStyle as useAntdStyle } from "../../vtx-provider";
9
8
  var genVtxSelectStyle = function genVtxSelectStyle(token) {
10
9
  var componentCls = token.componentCls;
@@ -164,7 +164,7 @@ function VtxTable(props) {
164
164
  var resizeObserver = new ResizeObserver(function () {
165
165
  calculateHeight();
166
166
  });
167
- if (autoFit && rootDomRef.current) {
167
+ if (autoFit && rootDomRef.current && scrollY) {
168
168
  resizeObserver.observe(rootDomRef.current, {
169
169
  box: 'border-box'
170
170
  });
@@ -174,7 +174,7 @@ function VtxTable(props) {
174
174
  resizeObserver.disconnect();
175
175
  }
176
176
  };
177
- }, [autoFit, tableSize]);
177
+ }, [autoFit, tableSize, scrollY]);
178
178
  (0, _react.useLayoutEffect)(function () {
179
179
  if (autoFit) {
180
180
  calculateHeight();
@@ -379,8 +379,11 @@ function VtxTable(props) {
379
379
  x: 'max-content'
380
380
  }, scroll),
381
381
  pagination: getPagination(rest.pagination),
382
- style: {
383
- height: "calc(100% - ".concat(toolbarHeight.current + alertHeight.current, "px)")
382
+ xs: true,
383
+ styles: {
384
+ root: {
385
+ height: "calc(100% - ".concat(toolbarHeight.current + alertHeight.current, "px)")
386
+ }
384
387
  },
385
388
  locale: _objectSpread({
386
389
  emptyText: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Empty, {
@@ -32,21 +32,32 @@ var genVtxStyle = function genVtxStyle(token) {
32
32
  }, '.ant-table', _defineProperty({
33
33
  // height: '100%',
34
34
  flex: 1
35
- }, '.ant-table-container', _defineProperty(_defineProperty({}, '.ant-table-body', {
35
+ }, '.ant-table-container', _defineProperty(_defineProperty({
36
+ height: '100%',
37
+ borderInlineStart: "none"
38
+ }, '.ant-table-body', {
36
39
  scrollbarWidth: "thin"
37
40
  }), '.ant-table-content', _defineProperty({
38
- // height: '100%',
41
+ height: '100%',
39
42
  scrollbarWidth: "thin"
40
43
  }, 'table', {
41
44
  // height: '100%',
42
45
  minWidth: "calc(100% - 1px) !important"
43
46
  })))))), '.ant-table', _defineProperty(_defineProperty(_defineProperty({}, '.ant-table-header', _defineProperty({}, '.ant-table-thead', {
44
47
  '>tr>th': {
45
- background: token.colorBgContainer
48
+ background: token.colorBgContainer,
49
+ '&:first-child': {
50
+ borderInlineStart: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)"
51
+ }
46
52
  }
47
53
  })), '.ant-table-cell', {
48
54
  // minWidth: 10,
49
55
  }), '.ant-table-tbody', {
56
+ '>tr>td': {
57
+ '&:first-child': {
58
+ borderInlineStart: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)"
59
+ }
60
+ },
50
61
  '>tr.ant-table-placeholder': {
51
62
  position: 'absolute',
52
63
  top: "auto",
@@ -74,10 +85,13 @@ var genVtxStyle = function genVtxStyle(token) {
74
85
  }
75
86
  }
76
87
  }
77
- })), '.ant-pagination', _defineProperty({}, '.ant-pagination-item', {
88
+ })), '.ant-pagination', _defineProperty({
89
+ margin: "var(--ant-margin) 0 0 0"
90
+ }, '.ant-pagination-item', {
78
91
  borderRadius: token.borderRadiusSM
79
92
  })))), "".concat(componentCls, "-fit"), {
80
- height: '100%'
93
+ height: '100%',
94
+ minHeight: 200
81
95
  }), "".concat(componentCls, "-noFit"), {}), "".concat(componentCls, "-no-border"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, "".concat(antCls, "-table"), _defineProperty({}, '>.ant-table-container', _defineProperty(_defineProperty({
82
96
  borderColor: 'transparent'
83
97
  }, '.ant-table-thead', {
@@ -132,10 +146,14 @@ var genVtxStyle = function genVtxStyle(token) {
132
146
  '>tr>th': {
133
147
  background: token.colorBgContainer
134
148
  }
135
- }))), "".concat(componentCls, "-no-data"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({}, '.ant-table-content', _defineProperty({
149
+ }))), "".concat(componentCls, "-no-data"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({
150
+ borderInlineStart: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)"
151
+ }, '.ant-table-content', _defineProperty({
136
152
  borderRight: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)",
137
153
  borderBottom: "var(--ant-line-width) var(--ant-line-type) var(--ant-table-border-color)"
138
- }, 'table', {})))))))), "".concat(componentCls, "-no-data").concat(componentCls, "-no-border"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({}, '.ant-table-content', {
154
+ }, 'table', {})))))))), "".concat(componentCls, "-no-data").concat(componentCls, "-no-border"), _defineProperty({}, "".concat(antCls, "-table-wrapper"), _defineProperty({}, '.ant-spin', _defineProperty({}, '.ant-spin-container', _defineProperty({}, '.ant-table', _defineProperty({}, '.ant-table-container', _defineProperty({
155
+ borderInlineStart: "none"
156
+ }, '.ant-table-content', {
139
157
  borderRight: "none",
140
158
  borderBottom: "none"
141
159
  })))))));
@@ -81,7 +81,8 @@ function VtxImport(props) {
81
81
  currentIndex: 0,
82
82
  chunkId: '',
83
83
  chunks: [],
84
- operation: props.operation || intl.getMessage('import.operation', '导入')
84
+ operation: props.operation || intl.getMessage('import.operation', '导入'),
85
+ fileName: ''
85
86
  }),
86
87
  _useSet2 = _slicedToArray(_useSet, 2),
87
88
  state = _useSet2[0],
@@ -427,19 +428,80 @@ function VtxImport(props) {
427
428
  startUpload();
428
429
  }
429
430
  }, [state.chunkId]);
431
+ var truncateFileName = function truncateFileName(fileName) {
432
+ var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 28;
433
+ if (fileName.length <= maxLength) return fileName;
434
+ var extIndex = fileName.lastIndexOf('.');
435
+ var ext = extIndex !== -1 ? fileName.slice(extIndex) : '';
436
+ var name = extIndex !== -1 ? fileName.slice(0, extIndex) : fileName;
437
+ var availableLength = maxLength - ext.length - 3; // 3 是 "..."
438
+ if (availableLength <= 0) return "...".concat(ext);
439
+ var startLength = Math.ceil(availableLength / 2);
440
+ var endLength = Math.floor(availableLength / 2);
441
+ var start = name.slice(0, startLength);
442
+ var end = name.slice(-endLength);
443
+ return "".concat(start, "...").concat(end).concat(ext);
444
+ };
445
+
446
+ // 处理文件选择变化
447
+ var handleFileChange = function handleFileChange(event) {
448
+ var _event$target$files;
449
+ var file = (_event$target$files = event.target.files) === null || _event$target$files === void 0 ? void 0 : _event$target$files[0];
450
+ if (file) {
451
+ setState(function (prev) {
452
+ return _objectSpread(_objectSpread({}, prev), {}, {
453
+ fileName: truncateFileName(file.name)
454
+ });
455
+ });
456
+ // 这里可以添加文件上传或其他处理逻辑
457
+ // 例如:uploadFile(file);
458
+ } else {
459
+ setState(function (prev) {
460
+ return _objectSpread(_objectSpread({}, prev), {}, {
461
+ fileName: ''
462
+ });
463
+ });
464
+ }
465
+ };
466
+ var handleSelectFile = function handleSelectFile() {
467
+ var _fileInputRef$current3;
468
+ (_fileInputRef$current3 = fileInputRef.current) === null || _fileInputRef$current3 === void 0 || _fileInputRef$current3.click();
469
+ };
430
470
  return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_vtxModal.default, _objectSpread(_objectSpread({}, modalProps), {}, {
431
- children: [props.children, /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
471
+ children: [props.children, /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
432
472
  encType: "multipart/form-data",
433
473
  method: "post",
434
474
  target: "tmp",
435
475
  action: uploadURL,
436
476
  ref: formRef,
437
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
477
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
478
+ className: "".concat(prefixCls, "-btn"),
479
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
480
+ onClick: handleSelectFile,
481
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
482
+ className: "".concat(prefixCls, "-label"),
483
+ children: intl.getMessage('import.selectFile', '选择文件')
484
+ })
485
+ }), state.fileName ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
486
+ title: state.fileName,
487
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
488
+ className: "".concat(prefixCls, "-file-name"),
489
+ children: state.fileName
490
+ })
491
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
492
+ className: "".concat(prefixCls, "-file-name"),
493
+ children: intl.getMessage('import.noFileSelected', '未选择任何文件')
494
+ })]
495
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
438
496
  type: "file",
439
497
  name: state.fileKey,
440
498
  accept: state.accept,
441
- ref: fileInputRef
442
- })
499
+ ref: fileInputRef,
500
+ style: {
501
+ display: 'none'
502
+ },
503
+ onChange: handleFileChange
504
+ })]
443
505
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
444
506
  name: "tmp",
445
507
  style: {
@@ -13,7 +13,7 @@ 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 genVtxImportStyle = function genVtxImportStyle(token) {
15
15
  var componentCls = token.componentCls;
16
- return _defineProperty({}, componentCls, {
16
+ return _defineProperty({}, componentCls, _defineProperty({
17
17
  '.ant-modal-container': {
18
18
  padding: 0,
19
19
  '.ant-modal-header': {
@@ -23,7 +23,12 @@ var genVtxImportStyle = function genVtxImportStyle(token) {
23
23
  padding: 20
24
24
  }
25
25
  }
26
- });
26
+ }, '&-btn', {
27
+ display: 'flex',
28
+ justifyContent: 'flex-start',
29
+ alignItems: 'center',
30
+ gap: 8
31
+ }));
27
32
  };
28
33
  function useStyle(prefixCls) {
29
34
  return (0, _vtxProvider.useStyle)('VtxImport', function (token) {
@@ -103,7 +103,7 @@ var genVtxStyle = function genVtxStyle(token) {
103
103
  '&-wrap': _objectSpread(_objectSpread({}, absolute()), {}, {
104
104
  backgroundColor: token.colorBgContainer,
105
105
  borderRadius: token.borderRadiusLG,
106
- padding: '0 20px'
106
+ padding: '0 20px 20px 20px'
107
107
  }),
108
108
  '&-card': {
109
109
  background: token.colorBgContainer,
@@ -131,6 +131,8 @@ var _default = exports.default = {
131
131
  operation: 'Import',
132
132
  error: 'Upload failed',
133
133
  success: 'Upload successful',
134
+ selectFile: 'Click to select file',
135
+ noFileSelected: "No file selected",
134
136
  downloadTemplate: 'Download template',
135
137
  pleaseSelectFile: 'Please select the file to upload',
136
138
  upload: 'Upload',
@@ -130,6 +130,8 @@ var _default = exports.default = {
130
130
  operation: '导入',
131
131
  error: '上传失败',
132
132
  success: '上传成功',
133
+ selectFile: '选择文件',
134
+ noFileSelected: "未选择任何文件",
133
135
  downloadTemplate: '下载模板',
134
136
  pleaseSelectFile: '请选择需要上传的文件',
135
137
  upload: '上传',
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useStyle = useStyle;
7
- var _lodash = require("@umijs/utils/compiled/lodash");
8
7
  var _vtxProvider = require("../../vtx-provider");
9
8
  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); }
10
9
  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; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtx/components",
3
- "version": "4.0.0-beta.52",
3
+ "version": "4.0.0-beta.54",
4
4
  "description": "React components for Vortex",
5
5
  "keywords": [
6
6
  "react",
@@ -12,6 +12,34 @@
12
12
  "es"
13
13
  ],
14
14
  "main": "lib/index.js",
15
+ "scripts": {
16
+ "start": "dumi dev",
17
+ "compile": "father build",
18
+ "build": "father build",
19
+ "bootstrap": "node ./scripts/bootstrap.mjs",
20
+ "changelog": "node ./scripts/changelogs.mjs",
21
+ "checkPublish": "npm run sync:tnpm && node ./scripts/checkPublish.mjs && npm run sync:tnpm",
22
+ "deploy": "cross-env SITE_DEPLOY='TRUE' npm run site && gh-pages -d ./dist",
23
+ "dumi": "cross-env SITE_DEPLOY='TRUE' dumi build",
24
+ "docs": "node ./scripts/docs.mjs",
25
+ "docs:dev": "pnpm docs dev",
26
+ "docs:build": "pnpm docs build",
27
+ "docs:preview": "pnpm docs preview",
28
+ "docs:create": "pnpm docs create",
29
+ "docs:check": "pnpm docs check",
30
+ "lint": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix ./ && npm run tsc",
31
+ "prettier": "prettier --write \"**/**.{js,jsx,tsx,ts,less,md,yaml,json}\" --log-level warn",
32
+ "createRelease": "node ./scripts/createRelease.mjs",
33
+ "site": "npm run build && cross-env SITE_DEPLOY='TRUE' dumi build",
34
+ "sync:tnpm": "node -e 'import(\"./scripts/syncTNPM.mjs\").then(m => m.default())'",
35
+ "test": "cross-env TZ=UTC vitest run",
36
+ "test:coverage": "cross-env TZ=UTC TEST_LOG=none vitest run --coverage",
37
+ "test:ui": "cross-env TZ=UTC vitest --ui",
38
+ "test:update": "cross-env TZ=UTC vitest -u",
39
+ "tsc": "tsc --noEmit",
40
+ "publish:beta": "npm publish --tag beta",
41
+ "update:deps": "pnpm up --latest"
42
+ },
15
43
  "homepage": "https://git.cloudhw.cn:3443/front-end/react-components.git",
16
44
  "bugs": "https://git.cloudhw.cn:3443/front-end/react-components/-/issues",
17
45
  "repository": {
@@ -200,39 +228,12 @@
200
228
  "@vtx/utils": "^1.0.25"
201
229
  },
202
230
  "peerDependenciesName": "声明宿主依赖",
231
+ "packageManager": "pnpm@9.6.0",
203
232
  "publishConfig": {
204
233
  "access": "public"
205
234
  },
206
235
  "gitHooks": {
207
236
  "pre-commit": "pretty-quick --staged",
208
237
  "commit-msg": "fabric verify-commit"
209
- },
210
- "scripts": {
211
- "start": "dumi dev",
212
- "compile": "father build",
213
- "build": "father build",
214
- "bootstrap": "node ./scripts/bootstrap.mjs",
215
- "changelog": "node ./scripts/changelogs.mjs",
216
- "checkPublish": "npm run sync:tnpm && node ./scripts/checkPublish.mjs && npm run sync:tnpm",
217
- "deploy": "cross-env SITE_DEPLOY='TRUE' npm run site && gh-pages -d ./dist",
218
- "dumi": "cross-env SITE_DEPLOY='TRUE' dumi build",
219
- "docs": "node ./scripts/docs.mjs",
220
- "docs:dev": "pnpm docs dev",
221
- "docs:build": "pnpm docs build",
222
- "docs:preview": "pnpm docs preview",
223
- "docs:create": "pnpm docs create",
224
- "docs:check": "pnpm docs check",
225
- "lint": "eslint --cache --ext .js,.jsx,.ts,.tsx --fix ./ && npm run tsc",
226
- "prettier": "prettier --write \"**/**.{js,jsx,tsx,ts,less,md,yaml,json}\" --log-level warn",
227
- "createRelease": "node ./scripts/createRelease.mjs",
228
- "site": "npm run build && cross-env SITE_DEPLOY='TRUE' dumi build",
229
- "sync:tnpm": "node -e 'import(\"./scripts/syncTNPM.mjs\").then(m => m.default())'",
230
- "test": "cross-env TZ=UTC vitest run",
231
- "test:coverage": "cross-env TZ=UTC TEST_LOG=none vitest run --coverage",
232
- "test:ui": "cross-env TZ=UTC vitest --ui",
233
- "test:update": "cross-env TZ=UTC vitest -u",
234
- "tsc": "tsc --noEmit",
235
- "publish:beta": "npm publish --tag beta",
236
- "update:deps": "pnpm up --latest"
237
238
  }
238
239
  }