@vtx/components 4.0.0-beta.8 → 4.0.0-beta.81

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 (196) 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-combogrid/Combogrid.js +5 -4
  26. package/es/vtx-combogrid/index.js +7 -4
  27. package/es/vtx-datagrid/Store/Provide.js +106 -137
  28. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
  29. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  30. package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  31. package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  32. package/es/vtx-datagrid/columnState.js +91 -0
  33. package/es/vtx-datagrid/index.js +124 -32
  34. package/es/vtx-datagrid/mergeComponents.js +15 -0
  35. package/es/vtx-datagrid/renderColumnButtons.js +30 -11
  36. package/es/vtx-datagrid/style/index.js +102 -20
  37. package/es/vtx-datagrid/style/index.less +242 -242
  38. package/es/vtx-date-picker/QdatePicker.js +1 -1
  39. package/es/vtx-date-picker/style/index.less +39 -39
  40. package/es/vtx-descriptions/Descriptions.js +29 -0
  41. package/es/vtx-descriptions/index.js +3 -0
  42. package/es/vtx-descriptions/style/index.js +19 -0
  43. package/es/vtx-ellipsis-text/index.js +7 -2
  44. package/es/vtx-ellipsis-text/style/index.js +3 -1
  45. package/es/vtx-export/index.js +33 -33
  46. package/es/vtx-export-async/History.js +15 -7
  47. package/es/vtx-export-async/index.js +45 -15
  48. package/es/vtx-export-async/util.js +16 -5
  49. package/es/vtx-form-layout/Card.js +10 -10
  50. package/es/vtx-form-layout/Divider.js +1 -1
  51. package/es/vtx-form-layout/FormItem.js +16 -16
  52. package/es/vtx-form-layout/Pane.js +23 -12
  53. package/es/vtx-icon/index.js +54 -45
  54. package/es/vtx-icon/index.js1 +90 -0
  55. package/es/vtx-image/Preview.js +11 -6
  56. package/es/vtx-image/style/index.js +0 -1
  57. package/es/vtx-import/index.js +211 -70
  58. package/es/vtx-import/result.js +28 -26
  59. package/es/vtx-import/style/index.js +16 -1
  60. package/es/vtx-import2/Content.js +2 -1
  61. package/es/vtx-import2/index.js +30 -19
  62. package/es/vtx-import2/style/index.js +60 -9
  63. package/es/vtx-modal/index.js +11 -6
  64. package/es/vtx-page-layout/Basic.js +2 -2
  65. package/es/vtx-page-layout/TabLayout.js +6 -6
  66. package/es/vtx-page-layout/TableLayout.js +10 -10
  67. package/es/vtx-page-layout/TreeLayout.js +6 -6
  68. package/es/vtx-page-layout/container.js +2 -2
  69. package/es/vtx-page-layout/style/index.js +4 -2
  70. package/es/vtx-provider/index.js +37 -33
  71. package/es/vtx-provider/intl.js +9 -9
  72. package/es/vtx-provider/locale/en_US.js +57 -3
  73. package/es/vtx-provider/locale/zh_CN.js +57 -3
  74. package/es/vtx-provider/useStyle/index.js +17 -17
  75. package/es/vtx-search/index.js +13 -9
  76. package/es/vtx-search/style/index.js +2 -1
  77. package/es/vtx-select/index.js +102 -36
  78. package/es/vtx-select/style/index.js +11 -56
  79. package/es/vtx-signature/index.js +5 -4
  80. package/es/vtx-signature/style/index.js +1 -1
  81. package/es/vtx-split-pane/Resizer.js +0 -1
  82. package/es/vtx-split-pane/SplitPane.js +42 -34
  83. package/es/vtx-split-pane/style/index.js +8 -112
  84. package/es/vtx-time-picker/index.js +27 -1
  85. package/es/vtx-transfer/Transfer.js +29 -0
  86. package/es/vtx-transfer/index.js +3 -0
  87. package/es/vtx-transfer/style/index.js +19 -0
  88. package/es/vtx-transfer-select/TransferSelect.js +143 -0
  89. package/es/vtx-transfer-select/index.js +3 -0
  90. package/es/vtx-transfer-select/style/index.js +19 -0
  91. package/es/vtx-tree/index.js +98 -35
  92. package/es/vtx-tree-select/index.js +71 -105
  93. package/es/vtx-tree-select/style/index.js +9 -3
  94. package/es/vtx-upload/FilePreview.js +2 -1
  95. package/es/vtx-wang-editor/index.js +93 -39
  96. package/es/vtx-wang-editor/style/index.less +12 -12
  97. package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
  98. package/lib/index.js +36 -0
  99. package/lib/utils/components/LabelIconTip/index.js +7 -7
  100. package/lib/utils/conversionMomentValue/index.js +25 -25
  101. package/lib/utils/filterSpecialCharacters.js +54 -52
  102. package/lib/utils/genCopyable/index.js +6 -6
  103. package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
  104. package/lib/utils/hooks/useDebounceFn/index.js +4 -4
  105. package/lib/utils/hooks/useDebounceValue/index.js +6 -6
  106. package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
  107. package/lib/utils/hooks/useLatest/index.js +2 -2
  108. package/lib/utils/hooks/useRefCallback/index.js +5 -5
  109. package/lib/utils/index.js +0 -7
  110. package/lib/utils/isBrowser/index.js +7 -7
  111. package/lib/utils/isUrl/index.js +4 -4
  112. package/lib/utils/merge/index.js +4 -4
  113. package/lib/utils/nanoid/index.js +4 -4
  114. package/lib/utils/omitBoolean/index.js +4 -4
  115. package/lib/utils/parseValueToMoment/index.js +4 -4
  116. package/lib/utils/proFieldParsingText/index.js +10 -10
  117. package/lib/utils/transformKeySubmitValue/index.js +57 -57
  118. package/lib/utils/useEditableArray/index.js +46 -46
  119. package/lib/utils/useEditableMap/index.js +22 -22
  120. package/lib/utils/useMediaQuery/index.js +5 -5
  121. package/lib/vtx-combogrid/Combogrid.js +5 -4
  122. package/lib/vtx-combogrid/index.js +7 -4
  123. package/lib/vtx-datagrid/Store/Provide.js +113 -143
  124. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
  125. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  126. package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  127. package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  128. package/lib/vtx-datagrid/columnState.js +100 -0
  129. package/lib/vtx-datagrid/index.js +124 -32
  130. package/lib/vtx-datagrid/mergeComponents.js +21 -0
  131. package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
  132. package/lib/vtx-datagrid/style/index.js +102 -20
  133. package/lib/vtx-datagrid/style/index.less +242 -242
  134. package/lib/vtx-date-picker/QdatePicker.js +1 -1
  135. package/lib/vtx-date-picker/style/index.less +39 -39
  136. package/lib/vtx-descriptions/Descriptions.js +38 -0
  137. package/lib/vtx-descriptions/index.js +15 -0
  138. package/lib/vtx-descriptions/style/index.js +25 -0
  139. package/lib/vtx-ellipsis-text/index.js +7 -2
  140. package/lib/vtx-ellipsis-text/style/index.js +3 -1
  141. package/lib/vtx-export/index.js +34 -34
  142. package/lib/vtx-export-async/History.js +14 -8
  143. package/lib/vtx-export-async/index.js +43 -13
  144. package/lib/vtx-export-async/util.js +16 -5
  145. package/lib/vtx-form-layout/Card.js +9 -9
  146. package/lib/vtx-form-layout/Divider.js +1 -1
  147. package/lib/vtx-form-layout/FormItem.js +16 -16
  148. package/lib/vtx-form-layout/Pane.js +22 -11
  149. package/lib/vtx-icon/index.js +54 -52
  150. package/lib/vtx-icon/index.js1 +90 -0
  151. package/lib/vtx-image/Preview.js +11 -6
  152. package/lib/vtx-image/style/index.js +0 -1
  153. package/lib/vtx-import/index.js +209 -71
  154. package/lib/vtx-import/result.js +29 -27
  155. package/lib/vtx-import/style/index.js +16 -1
  156. package/lib/vtx-import2/Content.js +2 -1
  157. package/lib/vtx-import2/index.js +29 -18
  158. package/lib/vtx-import2/style/index.js +60 -9
  159. package/lib/vtx-modal/index.js +11 -6
  160. package/lib/vtx-page-layout/Basic.js +2 -2
  161. package/lib/vtx-page-layout/TabLayout.js +6 -6
  162. package/lib/vtx-page-layout/TableLayout.js +10 -10
  163. package/lib/vtx-page-layout/TreeLayout.js +6 -6
  164. package/lib/vtx-page-layout/container.js +2 -2
  165. package/lib/vtx-page-layout/style/index.js +4 -2
  166. package/lib/vtx-provider/index.js +37 -33
  167. package/lib/vtx-provider/intl.js +9 -9
  168. package/lib/vtx-provider/locale/en_US.js +57 -3
  169. package/lib/vtx-provider/locale/zh_CN.js +57 -3
  170. package/lib/vtx-provider/useStyle/index.js +17 -17
  171. package/lib/vtx-search/index.js +13 -9
  172. package/lib/vtx-search/style/index.js +2 -1
  173. package/lib/vtx-select/index.js +104 -38
  174. package/lib/vtx-select/style/index.js +11 -56
  175. package/lib/vtx-signature/index.js +4 -3
  176. package/lib/vtx-signature/style/index.js +1 -1
  177. package/lib/vtx-split-pane/Resizer.js +0 -1
  178. package/lib/vtx-split-pane/SplitPane.js +40 -31
  179. package/lib/vtx-split-pane/style/index.js +8 -112
  180. package/lib/vtx-time-picker/index.js +27 -1
  181. package/lib/vtx-transfer/Transfer.js +38 -0
  182. package/lib/vtx-transfer/index.js +15 -0
  183. package/lib/vtx-transfer/style/index.js +25 -0
  184. package/lib/vtx-transfer-select/TransferSelect.js +151 -0
  185. package/lib/vtx-transfer-select/index.js +15 -0
  186. package/lib/vtx-transfer-select/style/index.js +25 -0
  187. package/lib/vtx-tree/index.js +96 -33
  188. package/lib/vtx-tree-select/index.js +71 -105
  189. package/lib/vtx-tree-select/style/index.js +9 -3
  190. package/lib/vtx-upload/FilePreview.js +2 -1
  191. package/lib/vtx-wang-editor/index.js +91 -37
  192. package/lib/vtx-wang-editor/style/index.less +12 -12
  193. package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
  194. package/package.json +240 -225
  195. package/es/utils/hooks/useFetchData/index.js +0 -82
  196. package/lib/utils/hooks/useFetchData/index.js +0 -89
@@ -16,13 +16,15 @@ import PropTypes from 'prop-types';
16
16
  import axios from 'axios';
17
17
  import qs from 'querystring';
18
18
  import getToken from "../utils/getToken";
19
- import { DownOutlined, ExportOutlined } from '@ant-design/icons';
20
- import { getSignature } from '@vtx/utils';
19
+ import { ExportOutlined } from '@ant-design/icons';
20
+ import downloadFile from '@vtx/utils/lib/downloadFile';
21
+ import getSignature from '@vtx/utils/lib/getSignature';
21
22
  import { isObject } from "../utils";
22
23
  import { useStyle } from "./style/index";
23
24
  import { ConfigProvider, message, Spin, Dropdown, Menu, Button } from 'antd';
24
25
  import classnames from 'classnames';
25
26
  import { useIntl } from "../vtx-provider";
27
+ import VtxIcon from "../vtx-icon";
26
28
  import { jsx as _jsx } from "react/jsx-runtime";
27
29
  import { Fragment as _Fragment } from "react/jsx-runtime";
28
30
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -69,10 +71,10 @@ var VtxExport = function VtxExport(props) {
69
71
  }
70
72
 
71
73
  // eslint-disable-next-line valid-jsdoc
72
- /**
73
- * 发送http请求
74
- * @param {Object} postData api参数
75
- * @return reponse
74
+ /**
75
+ * 发送http请求
76
+ * @param {Object} postData api参数
77
+ * @return reponse
76
78
  */
77
79
  function requestToResponse(postData) {
78
80
  var params = {
@@ -102,31 +104,26 @@ var VtxExport = function VtxExport(props) {
102
104
  spinning: true,
103
105
  className: classnames(prefixCls, hashId, 'vtx-spin')
104
106
  }), div);
107
+ var status = false;
105
108
  document.body.appendChild(div);
106
- requestToResponse(postData).then(function (res) {
107
- var status = false;
108
- // 文件存在
109
- if (res.headers['content-disposition']) {
110
- var contentDisposition = res.headers['content-disposition'];
111
- var filename;
112
- if (contentDisposition.indexOf('filename*=') > -1) {
113
- filename = decodeURI(contentDisposition.split('filename*=')[1].replace("utf-8'zh_cn'", ''));
114
- } else {
115
- filename = decodeURI(contentDisposition.split('filename=')[1]);
109
+ downloadFile(downloadURL, {
110
+ timeout: timeout,
111
+ data: postData,
112
+ extraHeader: headers,
113
+ success: function success() {
114
+ status = true;
115
+ },
116
+ fail: function fail() {
117
+ status = false;
118
+ message.error('导出失败');
119
+ },
120
+ finally: function _finally() {
121
+ document.body.removeChild(div);
122
+ if (afterExport && typeof afterExport === 'function') {
123
+ afterExport(status);
116
124
  }
117
- if ('download' in document.createElement('a')) {
118
- download(res.data, filename);
119
- status = true;
120
- } else {
121
- message.warning(intl.getMessage('fallback.browserNotSupported', '浏览器不支持'));
122
- }
123
- }
124
- // 关闭loading,执行回调
125
- document.body.removeChild(div);
126
- if (afterExport && typeof afterExport === 'function') {
127
- afterExport(status);
128
125
  }
129
- });
126
+ }, 'blob');
130
127
  }
131
128
  /* 下载并 兼容IE */
132
129
  function download(content, filename) {
@@ -138,10 +135,10 @@ var VtxExport = function VtxExport(props) {
138
135
  downloadByATag(window.URL.createObjectURL(blob), filename);
139
136
  }
140
137
  }
141
- /**
142
- * 通过a标签模拟下载
143
- * @param {String} href
144
- * @param {String} filename
138
+ /**
139
+ * 通过a标签模拟下载
140
+ * @param {String} href
141
+ * @param {String} filename
145
142
  */
146
143
  function downloadByATag(href, filename) {
147
144
  var a = document.createElement('a');
@@ -177,7 +174,10 @@ var VtxExport = function VtxExport(props) {
177
174
  trigger: ['click'],
178
175
  children: /*#__PURE__*/_jsxs(Button, {
179
176
  icon: /*#__PURE__*/_jsx(ExportOutlined, {}),
180
- children: [exportText, " ", /*#__PURE__*/_jsx(DownOutlined, {})]
177
+ children: [exportText, " ", /*#__PURE__*/_jsx(VtxIcon, {
178
+ type: "downOutlined",
179
+ fileType: "svg"
180
+ })]
181
181
  })
182
182
  }));
183
183
  };
@@ -13,14 +13,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
13
  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; }
14
14
  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; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
- import React, { useEffect, useRef } from 'react';
17
- import { VtxDatagrid, VtxInput, VtxModal, VtxEllipsisText } from "./..";
16
+ import { VtxDatagrid, VtxEllipsisText, VtxInput, VtxModal } from "./..";
18
17
  import { downloadFile, request } from '@vtx/utils';
19
18
  import { useAntdTable } from 'ahooks';
20
19
  import { Button, Form, Modal, message } from 'antd';
21
- import { getData } from "./util";
22
20
  import PropTypes from 'prop-types';
21
+ import { useEffect, useRef } from 'react';
23
22
  import getToken from "../utils/getToken";
23
+ import { getData } from "./util";
24
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
25
  import { jsxs as _jsxs } from "react/jsx-runtime";
26
26
  function History(props) {
@@ -38,7 +38,9 @@ function History(props) {
38
38
  _props$customTablePro = props.customTableProps,
39
39
  customTableProps = _props$customTablePro === void 0 ? {} : _props$customTablePro,
40
40
  refreshTime = props.refreshTime,
41
- downloadInNewTab = props.downloadInNewTab;
41
+ downloadInNewTab = props.downloadInNewTab,
42
+ _props$headers = props.headers,
43
+ headers = _props$headers === void 0 ? {} : _props$headers;
42
44
  var _Form$useForm = Form.useForm(),
43
45
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
44
46
  form = _Form$useForm2[0];
@@ -106,6 +108,10 @@ function History(props) {
106
108
  timer.current = setInterval(function () {
107
109
  refresh();
108
110
  }, refreshTime * 1000);
111
+ return function () {
112
+ timer.current && clearInterval(timer.current);
113
+ timer.current = null;
114
+ };
109
115
  }, [JSON.stringify(tableProps.dataSource)]);
110
116
  var pageSize = pagination.pageSize,
111
117
  current = pagination.current;
@@ -146,12 +152,13 @@ function History(props) {
146
152
  name: TextEnum.downloadBtnText,
147
153
  onClick: function onClick() {
148
154
  if (downloadInNewTab) {
149
- window.open("".concat(downFileUrl, "?id=").concat(record.id, "&token=").concat(getToken('token')), '_blank');
155
+ window.location.href = "".concat(downFileUrl, "?id=").concat(record.id, "&token=").concat(getToken('token'));
150
156
  } else {
151
157
  downloadFile(downFileUrl, {
152
158
  data: {
153
159
  id: record.id
154
- }
160
+ },
161
+ extraHeader: headers
155
162
  }, 'blob');
156
163
  }
157
164
  },
@@ -251,6 +258,7 @@ History.propTypes = {
251
258
  TextEnum: PropTypes.object,
252
259
  customTableProps: PropTypes.object,
253
260
  refreshTime: PropTypes.number,
254
- downloadInNewTab: PropTypes.bool
261
+ downloadInNewTab: PropTypes.bool,
262
+ headers: PropTypes.object
255
263
  };
256
264
  export default History;
@@ -10,11 +10,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  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; }
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
- import React, { useEffect, forwardRef, useContext, useMemo } from 'react';
13
+ import React, { useEffect, forwardRef, useContext, useMemo, useRef } from 'react';
14
14
  import { ExportOutlined } from '@ant-design/icons';
15
15
  import PropTypes from 'prop-types';
16
16
  import { useSetState } from 'ahooks';
17
- import { Button, Form, Input, message, Modal, Radio, ConfigProvider } from 'antd';
17
+ import { Button, Form, message, Modal, Radio, ConfigProvider } from 'antd';
18
18
  import dayjs from 'dayjs';
19
19
  import { postData } from "./util";
20
20
  import History from "./History";
@@ -23,17 +23,20 @@ import { useStyle } from "./style/index";
23
23
  import classnames from 'classnames';
24
24
  import { useIntl } from "../vtx-provider";
25
25
  import VtxModal from "../vtx-modal";
26
+ import VtxInput from "../vtx-input";
27
+ import { SpecialCharacters } from "../utils/filterSpecialCharacters";
26
28
  import { jsx as _jsx } from "react/jsx-runtime";
27
29
  import { jsxs as _jsxs } from "react/jsx-runtime";
28
- var timer = null;
30
+ var Includes = ['\\\\', '\\/', ':', '*', '?', '"', '<', '>', '|'];
29
31
  var VtxExportAsync = function VtxExportAsync(props) {
30
32
  var intl = useIntl();
31
33
  var _useContext = useContext(ConfigProvider.ConfigContext),
32
34
  getPrefixCls = _useContext.getPrefixCls;
33
- var prefixCls = getPrefixCls('vtx-export-async', props.prefixCls);
35
+ var prefixCls = getPrefixCls('', 'vtx-export-async');
34
36
  var _useStyle = useStyle(prefixCls),
35
37
  wrapSSR = _useStyle.wrapSSR,
36
38
  hashId = _useStyle.hashId;
39
+ var timerRef = useRef(null);
37
40
  var uniqueKey = props.uniqueKey,
38
41
  _props$title = props.title,
39
42
  title = _props$title === void 0 ? '' : _props$title,
@@ -76,9 +79,13 @@ var VtxExportAsync = function VtxExportAsync(props) {
76
79
  downloadInNewTab = _props$downloadInNewT === void 0 ? false : _props$downloadInNewT,
77
80
  _props$enableCustomSe = props.enableCustomSelect,
78
81
  enableCustomSelect = _props$enableCustomSe === void 0 ? false : _props$enableCustomSe,
79
- beforeExport = props.beforeExport,
80
82
  _props$headers = props.headers,
81
- headers = _props$headers === void 0 ? {} : _props$headers;
83
+ headers = _props$headers === void 0 ? {} : _props$headers,
84
+ beforeExport = props.beforeExport,
85
+ _props$historyHeaders = props.historyHeaders,
86
+ historyHeaders = _props$historyHeaders === void 0 ? {} : _props$historyHeaders,
87
+ _props$hideContent = props.hideContent,
88
+ hideContent = _props$hideContent === void 0 ? false : _props$hideContent;
82
89
  var _Form$useForm = Form.useForm(),
83
90
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
84
91
  form = _Form$useForm2[0];
@@ -160,9 +167,9 @@ var VtxExportAsync = function VtxExportAsync(props) {
160
167
  });
161
168
  }, [state.visible]);
162
169
  function close() {
163
- if (timer) {
164
- clearInterval(timer);
165
- timer = null;
170
+ if (timerRef.current) {
171
+ clearInterval(timerRef.current);
172
+ timerRef.current = null;
166
173
  }
167
174
  form.resetFields();
168
175
  setState({
@@ -172,6 +179,15 @@ var VtxExportAsync = function VtxExportAsync(props) {
172
179
  timer: null
173
180
  });
174
181
  }
182
+
183
+ // 组件卸载时也要清理
184
+ useEffect(function () {
185
+ return function () {
186
+ if (timerRef.current) {
187
+ clearInterval(timerRef.current);
188
+ }
189
+ };
190
+ }, []);
175
191
  function showHistory() {
176
192
  setState({
177
193
  showHistoryModal: true
@@ -253,6 +269,8 @@ var VtxExportAsync = function VtxExportAsync(props) {
253
269
  } else {
254
270
  message.error((res === null || res === void 0 ? void 0 : res.msg) || "".concat(intl.getMessage('export.exportText', '导出')).concat(intl.getMessage('export.failure', '失败')));
255
271
  }
272
+ }).catch(function (err) {
273
+ message.error('导出失败:' + (err.message || '网络错误'));
256
274
  });
257
275
  }
258
276
  });
@@ -282,7 +300,9 @@ var VtxExportAsync = function VtxExportAsync(props) {
282
300
  subtitle: TextEnum.modalTitleText
283
301
  }) : TextEnum.modalTitleText,
284
302
  open: state.visible,
285
- maskClosable: false,
303
+ mask: {
304
+ closable: false
305
+ },
286
306
  onCancel: close,
287
307
  footer: [/*#__PURE__*/_jsx(Button, {
288
308
  onClick: close,
@@ -313,8 +333,15 @@ var VtxExportAsync = function VtxExportAsync(props) {
313
333
  required: true,
314
334
  message: TextEnum.requireFieldMsgText
315
335
  }],
316
- children: /*#__PURE__*/_jsx(Input, {
317
- placeholder: TextEnum.placeholderFileName
336
+ children: /*#__PURE__*/_jsx(VtxInput, {
337
+ placeholder: TextEnum.placeholderFileName,
338
+ specialCharactersFilter: {
339
+ include: Includes,
340
+ exclude: SpecialCharacters.filter(function (v) {
341
+ return !Includes.includes(v);
342
+ })
343
+ },
344
+ maxLength: 255
318
345
  })
319
346
  }), /*#__PURE__*/_jsx(Form.Item, {
320
347
  label: TextEnum.fieldTypeText,
@@ -331,7 +358,7 @@ var VtxExportAsync = function VtxExportAsync(props) {
331
358
  }, item.key);
332
359
  })
333
360
  })
334
- }), /*#__PURE__*/_jsx(Form.Item, {
361
+ }), hideContent ? null : /*#__PURE__*/_jsx(Form.Item, {
335
362
  label: TextEnum.fieldContentText,
336
363
  name: "content",
337
364
  rules: [{
@@ -366,7 +393,8 @@ var VtxExportAsync = function VtxExportAsync(props) {
366
393
  TextEnum: TextEnum,
367
394
  customTableProps: customTableProps,
368
395
  refreshTime: refreshTime,
369
- downloadInNewTab: downloadInNewTab
396
+ downloadInNewTab: downloadInNewTab,
397
+ headers: historyHeaders
370
398
  })]
371
399
  }));
372
400
  };
@@ -396,7 +424,9 @@ VtxExportAsync.propTypes = {
396
424
  refreshTime: PropTypes.number,
397
425
  downloadInNewTab: PropTypes.bool,
398
426
  enableCustomSelect: PropTypes.bool,
399
- headers: PropTypes.object
427
+ headers: PropTypes.object,
428
+ beforeExport: PropTypes.object,
429
+ historyHeaders: PropTypes.object
400
430
  };
401
431
  export { VtxExportAsync };
402
432
  export default VtxExportAsync;
@@ -9,6 +9,16 @@ import qs from 'querystring';
9
9
  import getToken from "../utils/getToken";
10
10
  import getSignature from '@vtx/utils/lib/getSignature';
11
11
  var token = getToken();
12
+ var getContentType = function getContentType(headers) {
13
+ var contentTypeKey = Object.keys(headers || {}).find(function (key) {
14
+ return key.toLowerCase() === 'content-type';
15
+ });
16
+ return contentTypeKey ? headers[contentTypeKey] : '';
17
+ };
18
+ var stringifyPostData = function stringifyPostData(params, headers) {
19
+ var contentType = getContentType(headers);
20
+ return String(contentType).includes('application/json') ? JSON.stringify(params) : qs.stringify(params);
21
+ };
12
22
  var getData = function getData(url, params, headers) {
13
23
  return new Promise(function (resolve, reject) {
14
24
  axios.get(url, {
@@ -29,14 +39,15 @@ var getData = function getData(url, params, headers) {
29
39
  };
30
40
  var postData = function postData(url, params, headers) {
31
41
  return new Promise(function (resolve, reject) {
42
+ var nextHeaders = _objectSpread(_objectSpread({
43
+ 'Content-Type': 'application/x-www-form-urlencoded',
44
+ Authorization: token ? "Bearer ".concat(token) : ''
45
+ }, getSignature(params)), headers);
32
46
  axios({
33
47
  url: url,
34
48
  method: 'post',
35
- headers: _objectSpread(_objectSpread({
36
- 'Content-Type': 'application/x-www-form-urlencoded',
37
- Authorization: token ? "Bearer ".concat(token) : ''
38
- }, getSignature(params)), headers),
39
- data: qs.stringify(params)
49
+ headers: nextHeaders,
50
+ data: stringifyPostData(params, nextHeaders)
40
51
  }).then(function (res) {
41
52
  if (res.status == 200) {
42
53
  resolve(res.data);
@@ -8,7 +8,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { useEffect, useState, useContext } from 'react';
11
+ import React, { useEffect, useState, useContext, useMemo } from 'react';
12
12
  import PropTypes from 'prop-types';
13
13
  import classnames from 'classnames';
14
14
  import { Card, ConfigProvider } from 'antd';
@@ -22,17 +22,17 @@ function VtxCard(props) {
22
22
  _props$expand = props.expand,
23
23
  expand = _props$expand === void 0 ? true : _props$expand,
24
24
  extra = props.extra,
25
- onExpandChange = props.onExpandChange;
25
+ onExpandChange = props.onExpandChange,
26
+ children = props.children;
26
27
  var _useState = useState(expand),
27
28
  _useState2 = _slicedToArray(_useState, 2),
28
29
  visible = _useState2[0],
29
30
  setVisible = _useState2[1];
30
- var style = {};
31
- if (visible) {
32
- style = {
31
+ var iconStyle = useMemo(function () {
32
+ return visible ? {
33
33
  transform: 'rotate(90deg)'
34
- };
35
- }
34
+ } : {};
35
+ }, [visible]);
36
36
  useEffect(function () {
37
37
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
38
38
  onExpandChange && onExpandChange(visible);
@@ -50,8 +50,8 @@ function VtxCard(props) {
50
50
  },
51
51
  children: extra
52
52
  }) : /*#__PURE__*/_jsx(RightOutlined, {
53
- className: "".concat(prefixCls, "-expand-icon\""),
54
- style: style,
53
+ className: "".concat(prefixCls, "-expand-icon"),
54
+ style: iconStyle,
55
55
  onClick: function onClick() {
56
56
  return setVisible(function (pre) {
57
57
  return !pre;
@@ -60,7 +60,7 @@ function VtxCard(props) {
60
60
  }),
61
61
  children: /*#__PURE__*/_jsx("div", {
62
62
  className: classnames("".concat(prefixCls, "-content"), _defineProperty({}, "".concat(prefixCls, "-content-hide"), !visible)),
63
- children: props.children
63
+ children: children
64
64
  })
65
65
  });
66
66
  }
@@ -13,7 +13,7 @@ function VtxDivider(props) {
13
13
  var prefixCls = getPrefixCls('', 'vtx-form-layout-divider');
14
14
  var size = props.size;
15
15
  return /*#__PURE__*/_jsx(Divider, {
16
- className: classnames(prefixCls, _defineProperty({}, "".concat(prefixCls, "--small'"), size === 'small'))
16
+ className: classnames(prefixCls, _defineProperty({}, "".concat(prefixCls, "--small"), size === 'small'))
17
17
  });
18
18
  }
19
19
  VtxDivider.propTypes = {
@@ -12,6 +12,7 @@ import PropTypes from 'prop-types';
12
12
  import { ConfigProvider, Tooltip, Col, Form } from 'antd';
13
13
  import classnames from 'classnames';
14
14
  import { StoreCtx } from "./context";
15
+ import { useIntl } from "../vtx-provider";
15
16
 
16
17
  // 24 栅格
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -19,6 +20,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
19
20
  var SPAN = 24;
20
21
  export default function FormItem(props) {
21
22
  var _rest$rules;
23
+ var intl = useIntl();
22
24
  var _useContext = useContext(ConfigProvider.ConfigContext),
23
25
  getPrefixCls = _useContext.getPrefixCls;
24
26
  var prefixCls = getPrefixCls('', 'vtx-form-layout-item');
@@ -62,27 +64,25 @@ export default function FormItem(props) {
62
64
  if (placeholder) {
63
65
  return placeholder;
64
66
  }
65
- if (typeof label === 'string') {
66
- if (!['Input', 'Select', 'RangePicker', 'VtxInput', 'InputNumber', 'VtxSelect', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
67
- // console.log(type?.displayName)
68
- }
69
- if (['Input', 'InputNumber', 'VtxInput', 'TextArea'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
70
- return '请输入' + label;
71
- }
72
- if (['Select', 'VtxColorPicker', 'VtxSelect', 'VtxCombogrid'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
73
- return '请选择' + label;
74
- }
75
- if (['RangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
76
- return undefined;
77
- }
67
+ if (['Input', 'InputNumber', 'VtxInput', 'TextArea', 'VtxEditor'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
68
+ // return '请输入' + label
69
+ return intl.getMessage('tableForm.inputPlaceholder', '请输入');
70
+ }
71
+ if (['Select', 'VtxColorPicker', 'VtxSelect', 'VtxCombogrid', 'VtxTreeSelect', 'VtxZtreeSelect', 'VtxSearchMapInput'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
72
+ // return '请选择' + label
73
+ return intl.getMessage('tableForm.selectPlaceholder', '请选择');
74
+ }
75
+ if (['DatePicker', 'RangePicker', 'TimePicker', 'VtxDatePicker', 'VtxRangePicker', 'VtxTimePicker', 'VtxTimeRangePicker'].includes(type === null || type === void 0 ? void 0 : type.displayName)) {
76
+ return undefined;
78
77
  }
79
78
  return null;
80
79
  };
81
80
  var renderItem = function renderItem(child) {
82
81
  if ( /*#__PURE__*/isValidElement(child)) {
83
- return /*#__PURE__*/React.cloneElement(child, {
84
- placeholder: initPlaceholder(props.placeholder, label, child === null || child === void 0 ? void 0 : child.type)
85
- });
82
+ var _child$props;
83
+ return /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
84
+ 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)
85
+ }));
86
86
  }
87
87
  return child;
88
88
  };
@@ -1,4 +1,4 @@
1
- import React, { useContext } from 'react';
1
+ import React, { useContext, useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { ConfigProvider, Collapse } from 'antd';
4
4
  import { CaretRightOutlined } from '@ant-design/icons';
@@ -8,18 +8,29 @@ function Pane(props) {
8
8
  var _useContext = useContext(ConfigProvider.ConfigContext),
9
9
  getPrefixCls = _useContext.getPrefixCls;
10
10
  var prefixCls = getPrefixCls('', 'vtx-form-layout-pane');
11
- var title = props.title;
12
- var items = [{
13
- key: '1',
14
- label: /*#__PURE__*/_jsx("div", {
15
- className: "".concat(prefixCls, "-title"),
16
- children: title
17
- }),
18
- children: /*#__PURE__*/_jsx("div", {
11
+ var title = props.title,
12
+ children = props.children;
13
+
14
+ // 无标题时直接渲染内容
15
+ if (!title) {
16
+ return /*#__PURE__*/_jsx("div", {
19
17
  className: "".concat(prefixCls, "-content"),
20
- children: props.children
21
- })
22
- }];
18
+ children: children
19
+ });
20
+ }
21
+ var items = useMemo(function () {
22
+ return [{
23
+ key: '1',
24
+ label: /*#__PURE__*/_jsx("div", {
25
+ className: "".concat(prefixCls, "-title"),
26
+ children: title
27
+ }),
28
+ children: /*#__PURE__*/_jsx("div", {
29
+ className: "".concat(prefixCls, "-content"),
30
+ children: children
31
+ })
32
+ }];
33
+ }, [title, children, prefixCls]);
23
34
  return /*#__PURE__*/_jsx(Collapse, {
24
35
  className: prefixCls,
25
36
  bordered: false,
@@ -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 = ["type", "size", "className", "style", "color", "fileType"];
2
+ var _excluded = ["width", "height", "style", "className"],
3
+ _excluded2 = ["type", "size", "className", "style", "color", "fileType"];
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; }
@@ -7,62 +8,70 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
8
  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); }
8
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
- import { lazy, memo, Suspense, useMemo } from 'react';
11
+ import { memo } from 'react';
12
+ import AlignRightOutlined from "./svg/alignRightOutlined.js";
13
+ import ColumnHeightOutlined from "./svg/columnHeightOutlined.js";
14
+ import DownOutlined from "./svg/downOutlined.js";
15
+ import Fullscreen from "./svg/fullscreen.js";
16
+ import RedoOutlined from "./svg/redoOutlined.js";
17
+ import RightOutlined from "./svg/rightOutlined.js";
18
+ import SettingOutlined from "./svg/settingOutlined.js";
11
19
  import { jsx as _jsx } from "react/jsx-runtime";
12
20
  import { Fragment as _Fragment } from "react/jsx-runtime";
13
- var VtxIcon = /*#__PURE__*/memo(function (_ref) {
14
- var type = _ref.type,
15
- _ref$size = _ref.size,
16
- size = _ref$size === void 0 ? 16 : _ref$size,
17
- _ref$className = _ref.className,
18
- className = _ref$className === void 0 ? '' : _ref$className,
19
- _ref$style = _ref.style,
20
- style = _ref$style === void 0 ? {} : _ref$style,
21
- color = _ref.color,
22
- _ref$fileType = _ref.fileType,
23
- fileType = _ref$fileType === void 0 ? 'webp' : _ref$fileType,
21
+ var iconComponents = {
22
+ alignRightOutlined: AlignRightOutlined,
23
+ columnHeightOutlined: ColumnHeightOutlined,
24
+ downOutlined: DownOutlined,
25
+ fullscreen: Fullscreen,
26
+ redoOutlined: RedoOutlined,
27
+ rightOutlined: RightOutlined,
28
+ settingOutlined: SettingOutlined
29
+ // 低频图标如果确实需要,可以再考虑 lazy
30
+ };
31
+ var EmptySvg = function EmptySvg(_ref) {
32
+ var width = _ref.width,
33
+ height = _ref.height,
34
+ style = _ref.style,
35
+ className = _ref.className,
24
36
  props = _objectWithoutProperties(_ref, _excluded);
37
+ return /*#__PURE__*/_jsx("svg", _objectSpread({
38
+ width: width,
39
+ height: height,
40
+ style: style,
41
+ className: className
42
+ }, props));
43
+ };
44
+ var VtxIcon = /*#__PURE__*/memo(function (_ref2) {
45
+ var type = _ref2.type,
46
+ _ref2$size = _ref2.size,
47
+ size = _ref2$size === void 0 ? 16 : _ref2$size,
48
+ _ref2$className = _ref2.className,
49
+ className = _ref2$className === void 0 ? '' : _ref2$className,
50
+ _ref2$style = _ref2.style,
51
+ style = _ref2$style === void 0 ? {} : _ref2$style,
52
+ color = _ref2.color,
53
+ _ref2$fileType = _ref2.fileType,
54
+ fileType = _ref2$fileType === void 0 ? 'webp' : _ref2$fileType,
55
+ props = _objectWithoutProperties(_ref2, _excluded2);
25
56
  var width = props.width || size;
26
57
  var height = props.height || size;
27
58
  if (!type) {
28
59
  return null;
29
60
  }
30
- var SvgComponent = useMemo(function () {
31
- // 动态导入并缓存结果
32
- return /*#__PURE__*/lazy(function () {
33
- return import( /* @vite-ignore */"./svg/".concat(type, ".js"));
34
- });
35
- }, [type]);
36
61
 
37
62
  // 默认返回空元素
38
63
  if (fileType == 'svg') {
39
- try {
40
- // const SvgComponent = lazy(() => import(`./svg/${type}.js`));
41
- return /*#__PURE__*/_jsx(Suspense, {
42
- fallback: /*#__PURE__*/_jsx("div", {
43
- style: _objectSpread({
44
- width: width,
45
- height: height
46
- }, style)
47
- }),
48
- children: /*#__PURE__*/_jsx(SvgComponent, _objectSpread({
49
- className: className,
50
- style: _objectSpread({
51
- width: width,
52
- height: height
53
- }, style),
54
- fill: color
55
- }, props))
56
- });
57
- } catch (error) {
58
- // 如果动态导入失败,返回空的 SVG 元素
59
- return /*#__PURE__*/_jsx("svg", _objectSpread({
64
+ var SvgComponent = iconComponents[type] || EmptySvg;
65
+ return /*#__PURE__*/_jsx(SvgComponent, _objectSpread({
66
+ className: className,
67
+ style: _objectSpread({
60
68
  width: width,
61
- height: height,
62
- style: style,
63
- className: className
64
- }, props));
65
- }
69
+ height: height
70
+ }, style),
71
+ width: width,
72
+ height: height,
73
+ fill: color
74
+ }, props));
66
75
  } else {
67
76
  return (
68
77
  /*#__PURE__*/