@vtx/components 4.0.0-beta.7 → 4.0.0-beta.71

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.
Files changed (212) hide show
  1. package/README.md +19 -19
  2. package/es/index.js +3 -0
  3. package/es/utils/components/LabelIconTip/index.js +7 -7
  4. package/es/utils/conversionMomentValue/index.js +25 -25
  5. package/es/utils/filterSpecialCharacters.js +53 -52
  6. package/es/utils/genCopyable/index.js +6 -6
  7. package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
  8. package/es/utils/hooks/useDebounceFn/index.js +4 -4
  9. package/es/utils/hooks/useDebounceValue/index.js +6 -6
  10. package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
  11. package/es/utils/hooks/useLatest/index.js +2 -2
  12. package/es/utils/hooks/useRefCallback/index.js +5 -5
  13. package/es/utils/index.js +1 -2
  14. package/es/utils/isBrowser/index.js +7 -7
  15. package/es/utils/isUrl/index.js +4 -4
  16. package/es/utils/merge/index.js +4 -4
  17. package/es/utils/nanoid/index.js +4 -4
  18. package/es/utils/omitBoolean/index.js +4 -4
  19. package/es/utils/parseValueToMoment/index.js +4 -4
  20. package/es/utils/proFieldParsingText/index.js +10 -10
  21. package/es/utils/transformKeySubmitValue/index.js +57 -57
  22. package/es/utils/useEditableArray/index.js +46 -46
  23. package/es/utils/useEditableMap/index.js +22 -22
  24. package/es/utils/useMediaQuery/index.js +5 -5
  25. package/es/vtx-color-picker/index.js +138 -33
  26. package/es/vtx-color-picker/style/index.js +36 -12
  27. package/es/vtx-combogrid/Combogrid.js +16 -10
  28. package/es/vtx-combogrid/index.js +7 -4
  29. package/es/vtx-combogrid/style/index.js +4 -4
  30. package/es/vtx-datagrid/Store/Provide.js +109 -132
  31. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +15 -9
  32. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  33. package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  34. package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  35. package/es/vtx-datagrid/ToolBar/index.js +2 -2
  36. package/es/vtx-datagrid/columnState.js +64 -0
  37. package/es/vtx-datagrid/index.js +114 -35
  38. package/es/vtx-datagrid/mergeComponents.js +15 -0
  39. package/es/vtx-datagrid/renderColumnButtons.js +30 -11
  40. package/es/vtx-datagrid/style/index.js +102 -20
  41. package/es/vtx-datagrid/style/index.less +242 -242
  42. package/es/vtx-date-picker/QdatePicker.js +1 -1
  43. package/es/vtx-date-picker/style/index.less +39 -39
  44. package/es/vtx-descriptions/Descriptions.js +29 -0
  45. package/es/vtx-descriptions/index.js +3 -0
  46. package/es/vtx-descriptions/style/index.js +19 -0
  47. package/es/vtx-ellipsis-text/index.js +7 -2
  48. package/es/vtx-ellipsis-text/style/index.js +3 -1
  49. package/es/vtx-export/index.js +33 -33
  50. package/es/vtx-export-async/History.js +11 -3
  51. package/es/vtx-export-async/index.js +45 -15
  52. package/es/vtx-form-layout/Card.js +10 -10
  53. package/es/vtx-form-layout/Divider.js +1 -1
  54. package/es/vtx-form-layout/FormItem.js +18 -17
  55. package/es/vtx-form-layout/Pane.js +23 -12
  56. package/es/vtx-icon/index.js +54 -45
  57. package/es/vtx-icon/index.js1 +90 -0
  58. package/es/vtx-image/Preview.js +11 -6
  59. package/es/vtx-image/style/index.js +0 -1
  60. package/es/vtx-import/index.js +155 -43
  61. package/es/vtx-import/result.js +6 -2
  62. package/es/vtx-import/style/index.js +16 -1
  63. package/es/vtx-import2/Content.js +2 -1
  64. package/es/vtx-import2/index.js +31 -20
  65. package/es/vtx-import2/style/index.js +60 -9
  66. package/es/vtx-input/TextArea/index.js +11 -6
  67. package/es/vtx-modal/index.js +11 -6
  68. package/es/vtx-modal/style/index.js +5 -3
  69. package/es/vtx-page-layout/Basic.js +2 -2
  70. package/es/vtx-page-layout/Content.js +1 -1
  71. package/es/vtx-page-layout/TabLayout.js +7 -13
  72. package/es/vtx-page-layout/TableLayout.js +24 -14
  73. package/es/vtx-page-layout/TableWrap.js +3 -2
  74. package/es/vtx-page-layout/TreeLayout.js +8 -14
  75. package/es/vtx-page-layout/container.js +8 -7
  76. package/es/vtx-page-layout/style/index.js +4 -2
  77. package/es/vtx-provider/index.js +50 -40
  78. package/es/vtx-provider/intl.js +9 -9
  79. package/es/vtx-provider/locale/en_US.js +65 -5
  80. package/es/vtx-provider/locale/zh_CN.js +75 -5
  81. package/es/vtx-provider/useStyle/index.js +25 -21
  82. package/es/vtx-scrollable-row/index.js +38 -28
  83. package/es/vtx-search/index.js +18 -13
  84. package/es/vtx-search/style/index.js +2 -1
  85. package/es/vtx-select/index.js +132 -46
  86. package/es/vtx-select/style/index.js +11 -56
  87. package/es/vtx-signature/index.js +5 -4
  88. package/es/vtx-signature/style/index.js +1 -1
  89. package/es/vtx-split-pane/Resizer.js +0 -1
  90. package/es/vtx-split-pane/SplitPane.js +34 -25
  91. package/es/vtx-split-pane/style/index.js +8 -112
  92. package/es/vtx-time-picker/index.js +27 -1
  93. package/es/vtx-transfer/Transfer.js +29 -0
  94. package/es/vtx-transfer/index.js +3 -0
  95. package/es/vtx-transfer/style/index.js +19 -0
  96. package/es/vtx-transfer-select/TransferSelect.js +143 -0
  97. package/es/vtx-transfer-select/index.js +3 -0
  98. package/es/vtx-transfer-select/style/index.js +19 -0
  99. package/es/vtx-tree/index.js +104 -40
  100. package/es/vtx-tree-select/index.js +75 -105
  101. package/es/vtx-tree-select/style/index.js +9 -3
  102. package/es/vtx-upload/FilePreview.js +2 -1
  103. package/es/vtx-wang-editor/index.js +291 -113
  104. package/es/vtx-wang-editor/style/index.less +12 -12
  105. package/es/vtx-wang-editor/wangEditorUtil.js +59 -9
  106. package/lib/index.js +36 -0
  107. package/lib/utils/components/LabelIconTip/index.js +7 -7
  108. package/lib/utils/conversionMomentValue/index.js +25 -25
  109. package/lib/utils/filterSpecialCharacters.js +54 -52
  110. package/lib/utils/genCopyable/index.js +6 -6
  111. package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
  112. package/lib/utils/hooks/useDebounceFn/index.js +4 -4
  113. package/lib/utils/hooks/useDebounceValue/index.js +6 -6
  114. package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
  115. package/lib/utils/hooks/useLatest/index.js +2 -2
  116. package/lib/utils/hooks/useRefCallback/index.js +5 -5
  117. package/lib/utils/index.js +0 -7
  118. package/lib/utils/isBrowser/index.js +7 -7
  119. package/lib/utils/isUrl/index.js +4 -4
  120. package/lib/utils/merge/index.js +4 -4
  121. package/lib/utils/nanoid/index.js +4 -4
  122. package/lib/utils/omitBoolean/index.js +4 -4
  123. package/lib/utils/parseValueToMoment/index.js +4 -4
  124. package/lib/utils/proFieldParsingText/index.js +10 -10
  125. package/lib/utils/transformKeySubmitValue/index.js +57 -57
  126. package/lib/utils/useEditableArray/index.js +46 -46
  127. package/lib/utils/useEditableMap/index.js +22 -22
  128. package/lib/utils/useMediaQuery/index.js +5 -5
  129. package/lib/vtx-color-picker/index.js +139 -34
  130. package/lib/vtx-color-picker/style/index.js +36 -12
  131. package/lib/vtx-combogrid/Combogrid.js +16 -10
  132. package/lib/vtx-combogrid/index.js +7 -4
  133. package/lib/vtx-combogrid/style/index.js +4 -4
  134. package/lib/vtx-datagrid/Store/Provide.js +116 -138
  135. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +15 -10
  136. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  137. package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  138. package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  139. package/lib/vtx-datagrid/ToolBar/index.js +2 -2
  140. package/lib/vtx-datagrid/columnState.js +73 -0
  141. package/lib/vtx-datagrid/index.js +115 -35
  142. package/lib/vtx-datagrid/mergeComponents.js +21 -0
  143. package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
  144. package/lib/vtx-datagrid/style/index.js +102 -20
  145. package/lib/vtx-datagrid/style/index.less +242 -242
  146. package/lib/vtx-date-picker/QdatePicker.js +1 -1
  147. package/lib/vtx-date-picker/style/index.less +39 -39
  148. package/lib/vtx-descriptions/Descriptions.js +38 -0
  149. package/lib/vtx-descriptions/index.js +15 -0
  150. package/lib/vtx-descriptions/style/index.js +25 -0
  151. package/lib/vtx-ellipsis-text/index.js +7 -2
  152. package/lib/vtx-ellipsis-text/style/index.js +3 -1
  153. package/lib/vtx-export/index.js +34 -34
  154. package/lib/vtx-export-async/History.js +11 -3
  155. package/lib/vtx-export-async/index.js +43 -13
  156. package/lib/vtx-form-layout/Card.js +9 -9
  157. package/lib/vtx-form-layout/Divider.js +1 -1
  158. package/lib/vtx-form-layout/FormItem.js +18 -17
  159. package/lib/vtx-form-layout/Pane.js +22 -11
  160. package/lib/vtx-icon/index.js +54 -52
  161. package/lib/vtx-icon/index.js1 +90 -0
  162. package/lib/vtx-image/Preview.js +11 -6
  163. package/lib/vtx-image/style/index.js +0 -1
  164. package/lib/vtx-import/index.js +154 -42
  165. package/lib/vtx-import/result.js +6 -2
  166. package/lib/vtx-import/style/index.js +16 -1
  167. package/lib/vtx-import2/Content.js +2 -1
  168. package/lib/vtx-import2/index.js +30 -19
  169. package/lib/vtx-import2/style/index.js +60 -9
  170. package/lib/vtx-input/TextArea/index.js +11 -6
  171. package/lib/vtx-modal/index.js +11 -6
  172. package/lib/vtx-modal/style/index.js +5 -3
  173. package/lib/vtx-page-layout/Basic.js +2 -2
  174. package/lib/vtx-page-layout/Content.js +1 -1
  175. package/lib/vtx-page-layout/TabLayout.js +8 -14
  176. package/lib/vtx-page-layout/TableLayout.js +24 -14
  177. package/lib/vtx-page-layout/TableWrap.js +3 -2
  178. package/lib/vtx-page-layout/TreeLayout.js +9 -15
  179. package/lib/vtx-page-layout/container.js +8 -7
  180. package/lib/vtx-page-layout/style/index.js +4 -2
  181. package/lib/vtx-provider/index.js +49 -40
  182. package/lib/vtx-provider/intl.js +9 -9
  183. package/lib/vtx-provider/locale/en_US.js +65 -5
  184. package/lib/vtx-provider/locale/zh_CN.js +75 -5
  185. package/lib/vtx-provider/useStyle/index.js +25 -21
  186. package/lib/vtx-scrollable-row/index.js +38 -28
  187. package/lib/vtx-search/index.js +18 -13
  188. package/lib/vtx-search/style/index.js +2 -1
  189. package/lib/vtx-select/index.js +134 -48
  190. package/lib/vtx-select/style/index.js +11 -56
  191. package/lib/vtx-signature/index.js +4 -3
  192. package/lib/vtx-signature/style/index.js +1 -1
  193. package/lib/vtx-split-pane/Resizer.js +0 -1
  194. package/lib/vtx-split-pane/SplitPane.js +32 -23
  195. package/lib/vtx-split-pane/style/index.js +8 -112
  196. package/lib/vtx-time-picker/index.js +27 -1
  197. package/lib/vtx-transfer/Transfer.js +38 -0
  198. package/lib/vtx-transfer/index.js +15 -0
  199. package/lib/vtx-transfer/style/index.js +25 -0
  200. package/lib/vtx-transfer-select/TransferSelect.js +151 -0
  201. package/lib/vtx-transfer-select/index.js +15 -0
  202. package/lib/vtx-transfer-select/style/index.js +25 -0
  203. package/lib/vtx-tree/index.js +102 -38
  204. package/lib/vtx-tree-select/index.js +75 -105
  205. package/lib/vtx-tree-select/style/index.js +9 -3
  206. package/lib/vtx-upload/FilePreview.js +2 -1
  207. package/lib/vtx-wang-editor/index.js +289 -113
  208. package/lib/vtx-wang-editor/style/index.less +12 -12
  209. package/lib/vtx-wang-editor/wangEditorUtil.js +59 -10
  210. package/package.json +238 -222
  211. package/es/utils/hooks/useFetchData/index.js +0 -82
  212. package/lib/utils/hooks/useFetchData/index.js +0 -89
@@ -28,6 +28,11 @@ function VtxEllipsisText(props) {
28
28
  tooltip = _props$tooltip === void 0 ? {} : _props$tooltip,
29
29
  className = props.className,
30
30
  style = props.style;
31
+
32
+ // 边界检查
33
+ if (!text) {
34
+ return null;
35
+ }
31
36
  var _useContext = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext),
32
37
  getPrefixCls = _useContext.getPrefixCls;
33
38
  var prefixCls = getPrefixCls('vtx-ellipsis-text');
@@ -35,7 +40,7 @@ function VtxEllipsisText(props) {
35
40
  wrapSSR = _useStyle.wrapSSR,
36
41
  hashId = _useStyle.hashId;
37
42
  var textStyle = {};
38
- if (lineClamp > 2) {
43
+ if (lineClamp >= 1) {
39
44
  textStyle['WebkitLineClamp'] = lineClamp;
40
45
  }
41
46
  return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, _objectSpread(_objectSpread({
@@ -44,7 +49,7 @@ function VtxEllipsisText(props) {
44
49
  mouseEnterDelay: 0.3
45
50
  }, tooltip), {}, {
46
51
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
47
- className: (0, _classnames2.default)(prefixCls, hashId, _defineProperty(_defineProperty({}, "".concat(prefixCls, "--single"), lineClamp < 2), "".concat(prefixCls, "--multi"), lineClamp >= 2), className),
52
+ className: (0, _classnames2.default)(prefixCls, hashId, _defineProperty(_defineProperty({}, "".concat(prefixCls, "--single"), lineClamp < 1), "".concat(prefixCls, "--multi"), lineClamp >= 1), className),
48
53
  style: _objectSpread(_objectSpread({}, style), textStyle),
49
54
  children: text
50
55
  })
@@ -16,7 +16,9 @@ var genVtxEllipsisTextStyle = function genVtxEllipsisTextStyle(token) {
16
16
  return _defineProperty({}, componentCls, _defineProperty(_defineProperty({
17
17
  margin: 0,
18
18
  overflow: 'hidden',
19
- textOverflow: 'ellipsis'
19
+ textOverflow: 'ellipsis',
20
+ wordBreak: "break-all",
21
+ wordWrap: "break-word"
20
22
  }, "&--single", {
21
23
  whiteSpace: 'nowrap'
22
24
  }), "&--multi", {
@@ -11,12 +11,14 @@ var _axios = _interopRequireDefault(require("axios"));
11
11
  var _querystring = _interopRequireDefault(require("querystring"));
12
12
  var _getToken = _interopRequireDefault(require("../utils/getToken"));
13
13
  var _icons = require("@ant-design/icons");
14
- var _utils = require("@vtx/utils");
15
- var _utils2 = require("../utils");
14
+ var _downloadFile = _interopRequireDefault(require("@vtx/utils/lib/downloadFile"));
15
+ var _getSignature = _interopRequireDefault(require("@vtx/utils/lib/getSignature"));
16
+ var _utils = require("../utils");
16
17
  var _index = require("./style/index");
17
18
  var _antd = require("antd");
18
19
  var _classnames = _interopRequireDefault(require("classnames"));
19
20
  var _vtxProvider = require("../vtx-provider");
21
+ var _vtxIcon = _interopRequireDefault(require("../vtx-icon"));
20
22
  var _jsxRuntime = require("react/jsx-runtime");
21
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
24
  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); }
@@ -76,10 +78,10 @@ var VtxExport = exports.VtxExport = function VtxExport(props) {
76
78
  }
77
79
 
78
80
  // eslint-disable-next-line valid-jsdoc
79
- /**
80
- * 发送http请求
81
- * @param {Object} postData api参数
82
- * @return reponse
81
+ /**
82
+ * 发送http请求
83
+ * @param {Object} postData api参数
84
+ * @return reponse
83
85
  */
84
86
  function requestToResponse(postData) {
85
87
  var params = {
@@ -90,7 +92,7 @@ var VtxExport = exports.VtxExport = function VtxExport(props) {
90
92
  headers: _objectSpread(_objectSpread({
91
93
  'Content-Type': 'application/x-www-form-urlencoded',
92
94
  Authorization: token ? "Bearer ".concat(token) : ''
93
- }, headers), (0, _utils.getSignature)((0, _utils2.isObject)(postData) ? postData : {}, undefined, (0, _utils2.isObject)(postData) ? undefined : postData)),
95
+ }, headers), (0, _getSignature.default)((0, _utils.isObject)(postData) ? postData : {}, undefined, (0, _utils.isObject)(postData) ? undefined : postData)),
94
96
  data: (headers === null || headers === void 0 ? void 0 : headers['Content-Type']) === 'application/json' ? postData : _querystring.default.stringify(postData)
95
97
  };
96
98
  return new Promise(function (resolve, reject) {
@@ -109,31 +111,26 @@ var VtxExport = exports.VtxExport = function VtxExport(props) {
109
111
  spinning: true,
110
112
  className: (0, _classnames.default)(prefixCls, hashId, 'vtx-spin')
111
113
  }), div);
114
+ var status = false;
112
115
  document.body.appendChild(div);
113
- requestToResponse(postData).then(function (res) {
114
- var status = false;
115
- // 文件存在
116
- if (res.headers['content-disposition']) {
117
- var contentDisposition = res.headers['content-disposition'];
118
- var filename;
119
- if (contentDisposition.indexOf('filename*=') > -1) {
120
- filename = decodeURI(contentDisposition.split('filename*=')[1].replace("utf-8'zh_cn'", ''));
121
- } else {
122
- filename = decodeURI(contentDisposition.split('filename=')[1]);
116
+ (0, _downloadFile.default)(downloadURL, {
117
+ timeout: timeout,
118
+ data: postData,
119
+ extraHeader: headers,
120
+ success: function success() {
121
+ status = true;
122
+ },
123
+ fail: function fail() {
124
+ status = false;
125
+ _antd.message.error('导出失败');
126
+ },
127
+ finally: function _finally() {
128
+ document.body.removeChild(div);
129
+ if (afterExport && typeof afterExport === 'function') {
130
+ afterExport(status);
123
131
  }
124
- if ('download' in document.createElement('a')) {
125
- download(res.data, filename);
126
- status = true;
127
- } else {
128
- _antd.message.warning(intl.getMessage('fallback.browserNotSupported', '浏览器不支持'));
129
- }
130
- }
131
- // 关闭loading,执行回调
132
- document.body.removeChild(div);
133
- if (afterExport && typeof afterExport === 'function') {
134
- afterExport(status);
135
132
  }
136
- });
133
+ }, 'blob');
137
134
  }
138
135
  /* 下载并 兼容IE */
139
136
  function download(content, filename) {
@@ -145,10 +142,10 @@ var VtxExport = exports.VtxExport = function VtxExport(props) {
145
142
  downloadByATag(window.URL.createObjectURL(blob), filename);
146
143
  }
147
144
  }
148
- /**
149
- * 通过a标签模拟下载
150
- * @param {String} href
151
- * @param {String} filename
145
+ /**
146
+ * 通过a标签模拟下载
147
+ * @param {String} href
148
+ * @param {String} filename
152
149
  */
153
150
  function downloadByATag(href, filename) {
154
151
  var a = document.createElement('a');
@@ -184,7 +181,10 @@ var VtxExport = exports.VtxExport = function VtxExport(props) {
184
181
  trigger: ['click'],
185
182
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Button, {
186
183
  icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ExportOutlined, {}),
187
- children: [exportText, " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownOutlined, {})]
184
+ children: [exportText, " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_vtxIcon.default, {
185
+ type: "downOutlined",
186
+ fileType: "svg"
187
+ })]
188
188
  })
189
189
  }));
190
190
  };
@@ -46,7 +46,9 @@ function History(props) {
46
46
  _props$customTablePro = props.customTableProps,
47
47
  customTableProps = _props$customTablePro === void 0 ? {} : _props$customTablePro,
48
48
  refreshTime = props.refreshTime,
49
- downloadInNewTab = props.downloadInNewTab;
49
+ downloadInNewTab = props.downloadInNewTab,
50
+ _props$headers = props.headers,
51
+ headers = _props$headers === void 0 ? {} : _props$headers;
50
52
  var _Form$useForm = _antd.Form.useForm(),
51
53
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
52
54
  form = _Form$useForm2[0];
@@ -114,6 +116,10 @@ function History(props) {
114
116
  timer.current = setInterval(function () {
115
117
  refresh();
116
118
  }, refreshTime * 1000);
119
+ return function () {
120
+ timer.current && clearInterval(timer.current);
121
+ timer.current = null;
122
+ };
117
123
  }, [JSON.stringify(tableProps.dataSource)]);
118
124
  var pageSize = pagination.pageSize,
119
125
  current = pagination.current;
@@ -159,7 +165,8 @@ function History(props) {
159
165
  (0, _utils.downloadFile)(downFileUrl, {
160
166
  data: {
161
167
  id: record.id
162
- }
168
+ },
169
+ extraHeader: headers
163
170
  }, 'blob');
164
171
  }
165
172
  },
@@ -259,6 +266,7 @@ History.propTypes = {
259
266
  TextEnum: _propTypes.default.object,
260
267
  customTableProps: _propTypes.default.object,
261
268
  refreshTime: _propTypes.default.number,
262
- downloadInNewTab: _propTypes.default.bool
269
+ downloadInNewTab: _propTypes.default.bool,
270
+ headers: _propTypes.default.object
263
271
  };
264
272
  var _default = exports.default = History;
@@ -18,6 +18,8 @@ var _index = require("./style/index");
18
18
  var _classnames = _interopRequireDefault(require("classnames"));
19
19
  var _vtxProvider = require("../vtx-provider");
20
20
  var _vtxModal = _interopRequireDefault(require("../vtx-modal"));
21
+ var _vtxInput = _interopRequireDefault(require("../vtx-input"));
22
+ var _filterSpecialCharacters = require("../utils/filterSpecialCharacters");
21
23
  var _jsxRuntime = require("react/jsx-runtime");
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
25
  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); }
@@ -33,15 +35,16 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
33
35
  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; }
34
36
  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; } }
35
37
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
36
- var timer = null;
38
+ var Includes = ['\\\\', '\\/', ':', '*', '?', '"', '<', '>', '|'];
37
39
  var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
38
40
  var intl = (0, _vtxProvider.useIntl)();
39
41
  var _useContext = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext),
40
42
  getPrefixCls = _useContext.getPrefixCls;
41
- var prefixCls = getPrefixCls('vtx-export-async', props.prefixCls);
43
+ var prefixCls = getPrefixCls('', 'vtx-export-async');
42
44
  var _useStyle = (0, _index.useStyle)(prefixCls),
43
45
  wrapSSR = _useStyle.wrapSSR,
44
46
  hashId = _useStyle.hashId;
47
+ var timerRef = (0, _react.useRef)(null);
45
48
  var uniqueKey = props.uniqueKey,
46
49
  _props$title = props.title,
47
50
  title = _props$title === void 0 ? '' : _props$title,
@@ -84,9 +87,13 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
84
87
  downloadInNewTab = _props$downloadInNewT === void 0 ? false : _props$downloadInNewT,
85
88
  _props$enableCustomSe = props.enableCustomSelect,
86
89
  enableCustomSelect = _props$enableCustomSe === void 0 ? false : _props$enableCustomSe,
87
- beforeExport = props.beforeExport,
88
90
  _props$headers = props.headers,
89
- headers = _props$headers === void 0 ? {} : _props$headers;
91
+ headers = _props$headers === void 0 ? {} : _props$headers,
92
+ beforeExport = props.beforeExport,
93
+ _props$historyHeaders = props.historyHeaders,
94
+ historyHeaders = _props$historyHeaders === void 0 ? {} : _props$historyHeaders,
95
+ _props$hideContent = props.hideContent,
96
+ hideContent = _props$hideContent === void 0 ? false : _props$hideContent;
90
97
  var _Form$useForm = _antd.Form.useForm(),
91
98
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
92
99
  form = _Form$useForm2[0];
@@ -168,9 +175,9 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
168
175
  });
169
176
  }, [state.visible]);
170
177
  function close() {
171
- if (timer) {
172
- clearInterval(timer);
173
- timer = null;
178
+ if (timerRef.current) {
179
+ clearInterval(timerRef.current);
180
+ timerRef.current = null;
174
181
  }
175
182
  form.resetFields();
176
183
  setState({
@@ -180,6 +187,15 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
180
187
  timer: null
181
188
  });
182
189
  }
190
+
191
+ // 组件卸载时也要清理
192
+ (0, _react.useEffect)(function () {
193
+ return function () {
194
+ if (timerRef.current) {
195
+ clearInterval(timerRef.current);
196
+ }
197
+ };
198
+ }, []);
183
199
  function showHistory() {
184
200
  setState({
185
201
  showHistoryModal: true
@@ -261,6 +277,8 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
261
277
  } else {
262
278
  _antd.message.error((res === null || res === void 0 ? void 0 : res.msg) || "".concat(intl.getMessage('export.exportText', '导出')).concat(intl.getMessage('export.failure', '失败')));
263
279
  }
280
+ }).catch(function (err) {
281
+ _antd.message.error('导出失败:' + (err.message || '网络错误'));
264
282
  });
265
283
  }
266
284
  });
@@ -290,7 +308,9 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
290
308
  subtitle: TextEnum.modalTitleText
291
309
  }) : TextEnum.modalTitleText,
292
310
  open: state.visible,
293
- maskClosable: false,
311
+ mask: {
312
+ closable: false
313
+ },
294
314
  onCancel: close,
295
315
  footer: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
296
316
  onClick: close,
@@ -321,8 +341,15 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
321
341
  required: true,
322
342
  message: TextEnum.requireFieldMsgText
323
343
  }],
324
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Input, {
325
- placeholder: TextEnum.placeholderFileName
344
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vtxInput.default, {
345
+ placeholder: TextEnum.placeholderFileName,
346
+ specialCharactersFilter: {
347
+ include: Includes,
348
+ exclude: _filterSpecialCharacters.SpecialCharacters.filter(function (v) {
349
+ return !Includes.includes(v);
350
+ })
351
+ },
352
+ maxLength: 255
326
353
  })
327
354
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, {
328
355
  label: TextEnum.fieldTypeText,
@@ -339,7 +366,7 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
339
366
  }, item.key);
340
367
  })
341
368
  })
342
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, {
369
+ }), hideContent ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, {
343
370
  label: TextEnum.fieldContentText,
344
371
  name: "content",
345
372
  rules: [{
@@ -374,7 +401,8 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
374
401
  TextEnum: TextEnum,
375
402
  customTableProps: customTableProps,
376
403
  refreshTime: refreshTime,
377
- downloadInNewTab: downloadInNewTab
404
+ downloadInNewTab: downloadInNewTab,
405
+ headers: historyHeaders
378
406
  })]
379
407
  }));
380
408
  };
@@ -404,6 +432,8 @@ VtxExportAsync.propTypes = {
404
432
  refreshTime: _propTypes.default.number,
405
433
  downloadInNewTab: _propTypes.default.bool,
406
434
  enableCustomSelect: _propTypes.default.bool,
407
- headers: _propTypes.default.object
435
+ headers: _propTypes.default.object,
436
+ beforeExport: _propTypes.default.object,
437
+ historyHeaders: _propTypes.default.object
408
438
  };
409
439
  var _default = exports.default = VtxExportAsync;
@@ -31,17 +31,17 @@ function VtxCard(props) {
31
31
  _props$expand = props.expand,
32
32
  expand = _props$expand === void 0 ? true : _props$expand,
33
33
  extra = props.extra,
34
- onExpandChange = props.onExpandChange;
34
+ onExpandChange = props.onExpandChange,
35
+ children = props.children;
35
36
  var _useState = (0, _react.useState)(expand),
36
37
  _useState2 = _slicedToArray(_useState, 2),
37
38
  visible = _useState2[0],
38
39
  setVisible = _useState2[1];
39
- var style = {};
40
- if (visible) {
41
- style = {
40
+ var iconStyle = (0, _react.useMemo)(function () {
41
+ return visible ? {
42
42
  transform: 'rotate(90deg)'
43
- };
44
- }
43
+ } : {};
44
+ }, [visible]);
45
45
  (0, _react.useEffect)(function () {
46
46
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
47
47
  onExpandChange && onExpandChange(visible);
@@ -59,8 +59,8 @@ function VtxCard(props) {
59
59
  },
60
60
  children: extra
61
61
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.RightOutlined, {
62
- className: "".concat(prefixCls, "-expand-icon\""),
63
- style: style,
62
+ className: "".concat(prefixCls, "-expand-icon"),
63
+ style: iconStyle,
64
64
  onClick: function onClick() {
65
65
  return setVisible(function (pre) {
66
66
  return !pre;
@@ -69,7 +69,7 @@ function VtxCard(props) {
69
69
  }),
70
70
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
71
71
  className: (0, _classnames2.default)("".concat(prefixCls, "-content"), _defineProperty({}, "".concat(prefixCls, "-content-hide"), !visible)),
72
- children: props.children
72
+ children: children
73
73
  })
74
74
  });
75
75
  }
@@ -22,7 +22,7 @@ function VtxDivider(props) {
22
22
  var prefixCls = getPrefixCls('', 'vtx-form-layout-divider');
23
23
  var size = props.size;
24
24
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Divider, {
25
- className: (0, _classnames2.default)(prefixCls, _defineProperty({}, "".concat(prefixCls, "--small'"), size === 'small'))
25
+ className: (0, _classnames2.default)(prefixCls, _defineProperty({}, "".concat(prefixCls, "--small"), size === 'small'))
26
26
  });
27
27
  }
28
28
  VtxDivider.propTypes = {
@@ -10,6 +10,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _antd = require("antd");
11
11
  var _classnames7 = _interopRequireDefault(require("classnames"));
12
12
  var _context = require("./context");
13
+ var _vtxProvider = require("../vtx-provider");
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  var _excluded = ["weights", "label", "inline", "hideTooltip", "disableHtmlFor", "tooltip", "hidden", "nameExtra"]; // 24 栅格
15
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -25,6 +26,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
25
26
  var SPAN = 24;
26
27
  function FormItem(props) {
27
28
  var _rest$rules;
29
+ var intl = (0, _vtxProvider.useIntl)();
28
30
  var _useContext = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext),
29
31
  getPrefixCls = _useContext.getPrefixCls;
30
32
  var prefixCls = getPrefixCls('', 'vtx-form-layout-item');
@@ -68,27 +70,25 @@ function FormItem(props) {
68
70
  if (placeholder) {
69
71
  return placeholder;
70
72
  }
71
- if (typeof label === 'string') {
72
- if (!['Input', 'Select', 'RangePicker', 'VtxInput', 'InputNumber', 'VtxSelect', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
73
- // console.log(type?.displayName)
74
- }
75
- if (['Input', 'InputNumber', 'VtxInput', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
76
- return '请输入' + label;
77
- }
78
- if (['Select', 'VtxColorPicker', 'VtxSelect', 'VtxCombogrid'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
79
- return '请选择' + label;
80
- }
81
- if (['RangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
82
- return undefined;
83
- }
73
+ if (['Input', 'InputNumber', 'VtxInput', 'TextArea', 'VtxEditor'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
74
+ // return '请输入' + label
75
+ return intl.getMessage('tableForm.inputPlaceholder', '请输入');
76
+ }
77
+ if (['Select', 'VtxColorPicker', 'VtxSelect', 'VtxCombogrid', 'VtxTreeSelect', 'VtxZtreeSelect', 'VtxSearchMapInput'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
78
+ // return '请选择' + label
79
+ return intl.getMessage('tableForm.selectPlaceholder', '请选择');
80
+ }
81
+ if (['DatePicker', 'RangePicker', 'TimePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
82
+ return undefined;
84
83
  }
85
84
  return null;
86
85
  };
87
86
  var renderItem = function renderItem(child) {
88
87
  if ( /*#__PURE__*/(0, _react.isValidElement)(child)) {
89
- return /*#__PURE__*/_react.default.cloneElement(child, {
90
- placeholder: initPlaceholder(props.placeholder, label, child === null || child === void 0 ? void 0 : child.type)
91
- });
88
+ var _child$props;
89
+ return /*#__PURE__*/_react.default.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
90
+ placeholder: initPlaceholder(child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.placeholder, label, child === null || child === void 0 ? void 0 : child.type)
91
+ }));
92
92
  }
93
93
  return child;
94
94
  };
@@ -106,7 +106,8 @@ function FormItem(props) {
106
106
  children: label
107
107
  }),
108
108
  required: required,
109
- hidden: hidden
109
+ hidden: hidden,
110
+ colon: label ? true : false
110
111
  }, formItemLayout), {}, {
111
112
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, _objectSpread(_objectSpread(_objectSpread({
112
113
  noStyle: true
@@ -17,18 +17,29 @@ function Pane(props) {
17
17
  var _useContext = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext),
18
18
  getPrefixCls = _useContext.getPrefixCls;
19
19
  var prefixCls = getPrefixCls('', 'vtx-form-layout-pane');
20
- var title = props.title;
21
- var items = [{
22
- key: '1',
23
- label: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
24
- className: "".concat(prefixCls, "-title"),
25
- children: title
26
- }),
27
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
20
+ var title = props.title,
21
+ children = props.children;
22
+
23
+ // 无标题时直接渲染内容
24
+ if (!title) {
25
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
28
26
  className: "".concat(prefixCls, "-content"),
29
- children: props.children
30
- })
31
- }];
27
+ children: children
28
+ });
29
+ }
30
+ var items = (0, _react.useMemo)(function () {
31
+ return [{
32
+ key: '1',
33
+ label: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
34
+ className: "".concat(prefixCls, "-title"),
35
+ children: title
36
+ }),
37
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
38
+ className: "".concat(prefixCls, "-content"),
39
+ children: children
40
+ })
41
+ }];
42
+ }, [title, children, prefixCls]);
32
43
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Collapse, {
33
44
  className: prefixCls,
34
45
  bordered: false,
@@ -6,76 +6,78 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = exports.VtxIcon = void 0;
8
8
  var _react = require("react");
9
+ var _alignRightOutlined = _interopRequireDefault(require("./svg/alignRightOutlined.js"));
10
+ var _columnHeightOutlined = _interopRequireDefault(require("./svg/columnHeightOutlined.js"));
11
+ var _downOutlined = _interopRequireDefault(require("./svg/downOutlined.js"));
12
+ var _fullscreen = _interopRequireDefault(require("./svg/fullscreen.js"));
13
+ var _redoOutlined = _interopRequireDefault(require("./svg/redoOutlined.js"));
14
+ var _rightOutlined = _interopRequireDefault(require("./svg/rightOutlined.js"));
15
+ var _settingOutlined = _interopRequireDefault(require("./svg/settingOutlined.js"));
9
16
  var _jsxRuntime = require("react/jsx-runtime");
10
- var _excluded = ["type", "size", "className", "style", "color", "fileType"];
17
+ var _excluded = ["width", "height", "style", "className"],
18
+ _excluded2 = ["type", "size", "className", "style", "color", "fileType"];
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
20
  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; }
12
21
  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; }
13
22
  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; }
14
23
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
15
24
  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); }
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); }
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; }
18
25
  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; }
19
26
  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; }
20
- var VtxIcon = exports.VtxIcon = /*#__PURE__*/(0, _react.memo)(function (_ref) {
21
- var type = _ref.type,
22
- _ref$size = _ref.size,
23
- size = _ref$size === void 0 ? 16 : _ref$size,
24
- _ref$className = _ref.className,
25
- className = _ref$className === void 0 ? '' : _ref$className,
26
- _ref$style = _ref.style,
27
- style = _ref$style === void 0 ? {} : _ref$style,
28
- color = _ref.color,
29
- _ref$fileType = _ref.fileType,
30
- fileType = _ref$fileType === void 0 ? 'webp' : _ref$fileType,
27
+ var iconComponents = {
28
+ alignRightOutlined: _alignRightOutlined.default,
29
+ columnHeightOutlined: _columnHeightOutlined.default,
30
+ downOutlined: _downOutlined.default,
31
+ fullscreen: _fullscreen.default,
32
+ redoOutlined: _redoOutlined.default,
33
+ rightOutlined: _rightOutlined.default,
34
+ settingOutlined: _settingOutlined.default
35
+ // 低频图标如果确实需要,可以再考虑 lazy
36
+ };
37
+ var EmptySvg = function EmptySvg(_ref) {
38
+ var width = _ref.width,
39
+ height = _ref.height,
40
+ style = _ref.style,
41
+ className = _ref.className,
31
42
  props = _objectWithoutProperties(_ref, _excluded);
43
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread({
44
+ width: width,
45
+ height: height,
46
+ style: style,
47
+ className: className
48
+ }, props));
49
+ };
50
+ var VtxIcon = exports.VtxIcon = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
51
+ var type = _ref2.type,
52
+ _ref2$size = _ref2.size,
53
+ size = _ref2$size === void 0 ? 16 : _ref2$size,
54
+ _ref2$className = _ref2.className,
55
+ className = _ref2$className === void 0 ? '' : _ref2$className,
56
+ _ref2$style = _ref2.style,
57
+ style = _ref2$style === void 0 ? {} : _ref2$style,
58
+ color = _ref2.color,
59
+ _ref2$fileType = _ref2.fileType,
60
+ fileType = _ref2$fileType === void 0 ? 'webp' : _ref2$fileType,
61
+ props = _objectWithoutProperties(_ref2, _excluded2);
32
62
  var width = props.width || size;
33
63
  var height = props.height || size;
34
64
  if (!type) {
35
65
  return null;
36
66
  }
37
- var SvgComponent = (0, _react.useMemo)(function () {
38
- // 动态导入并缓存结果
39
- return /*#__PURE__*/(0, _react.lazy)(function () {
40
- return function (specifier) {
41
- return new Promise(function (r) {
42
- return r(specifier);
43
- }).then(function (s) {
44
- return _interopRequireWildcard(require(s));
45
- });
46
- }( /* @vite-ignore */"./svg/".concat(type, ".js"));
47
- });
48
- }, [type]);
49
67
 
50
68
  // 默认返回空元素
51
69
  if (fileType == 'svg') {
52
- try {
53
- // const SvgComponent = lazy(() => import(`./svg/${type}.js`));
54
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Suspense, {
55
- fallback: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
56
- style: _objectSpread({
57
- width: width,
58
- height: height
59
- }, style)
60
- }),
61
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SvgComponent, _objectSpread({
62
- className: className,
63
- style: _objectSpread({
64
- width: width,
65
- height: height
66
- }, style),
67
- fill: color
68
- }, props))
69
- });
70
- } catch (error) {
71
- // 如果动态导入失败,返回空的 SVG 元素
72
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread({
70
+ var SvgComponent = iconComponents[type] || EmptySvg;
71
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(SvgComponent, _objectSpread({
72
+ className: className,
73
+ style: _objectSpread({
73
74
  width: width,
74
- height: height,
75
- style: style,
76
- className: className
77
- }, props));
78
- }
75
+ height: height
76
+ }, style),
77
+ width: width,
78
+ height: height,
79
+ fill: color
80
+ }, props));
79
81
  } else {
80
82
  return (
81
83
  /*#__PURE__*/