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

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 (135) hide show
  1. package/es/index.js +3 -0
  2. package/es/utils/filterSpecialCharacters.js +47 -46
  3. package/es/utils/index.js +1 -2
  4. package/es/vtx-combogrid/Combogrid.js +5 -4
  5. package/es/vtx-combogrid/index.js +7 -4
  6. package/es/vtx-datagrid/Store/Provide.js +106 -137
  7. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -3
  8. package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  9. package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  10. package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  11. package/es/vtx-datagrid/columnState.js +91 -0
  12. package/es/vtx-datagrid/index.js +124 -32
  13. package/es/vtx-datagrid/mergeComponents.js +15 -0
  14. package/es/vtx-datagrid/renderColumnButtons.js +30 -11
  15. package/es/vtx-datagrid/style/index.js +102 -20
  16. package/es/vtx-date-picker/QdatePicker.js +1 -1
  17. package/es/vtx-descriptions/Descriptions.js +29 -0
  18. package/es/vtx-descriptions/index.js +3 -0
  19. package/es/vtx-descriptions/style/index.js +19 -0
  20. package/es/vtx-ellipsis-text/index.js +7 -2
  21. package/es/vtx-ellipsis-text/style/index.js +3 -1
  22. package/es/vtx-export/index.js +25 -25
  23. package/es/vtx-export-async/History.js +11 -3
  24. package/es/vtx-export-async/index.js +45 -15
  25. package/es/vtx-export-async/util.js +16 -5
  26. package/es/vtx-form-layout/Card.js +10 -10
  27. package/es/vtx-form-layout/Divider.js +1 -1
  28. package/es/vtx-form-layout/FormItem.js +16 -16
  29. package/es/vtx-form-layout/Pane.js +23 -12
  30. package/es/vtx-icon/index.js +54 -45
  31. package/es/vtx-icon/index.js1 +90 -0
  32. package/es/vtx-image/Preview.js +11 -6
  33. package/es/vtx-image/style/index.js +0 -1
  34. package/es/vtx-import/index.js +207 -65
  35. package/es/vtx-import/result.js +28 -26
  36. package/es/vtx-import/style/index.js +16 -1
  37. package/es/vtx-import2/Content.js +2 -1
  38. package/es/vtx-import2/index.js +30 -19
  39. package/es/vtx-import2/style/index.js +60 -9
  40. package/es/vtx-modal/index.js +9 -4
  41. package/es/vtx-page-layout/style/index.js +4 -2
  42. package/es/vtx-provider/index.js +7 -3
  43. package/es/vtx-provider/locale/en_US.js +57 -3
  44. package/es/vtx-provider/locale/zh_CN.js +57 -3
  45. package/es/vtx-search/index.js +13 -9
  46. package/es/vtx-search/style/index.js +2 -1
  47. package/es/vtx-select/index.js +102 -36
  48. package/es/vtx-select/style/index.js +11 -56
  49. package/es/vtx-signature/index.js +5 -4
  50. package/es/vtx-signature/style/index.js +1 -1
  51. package/es/vtx-split-pane/Resizer.js +0 -1
  52. package/es/vtx-split-pane/SplitPane.js +42 -34
  53. package/es/vtx-split-pane/style/index.js +8 -112
  54. package/es/vtx-time-picker/index.js +27 -1
  55. package/es/vtx-transfer/Transfer.js +29 -0
  56. package/es/vtx-transfer/index.js +3 -0
  57. package/es/vtx-transfer/style/index.js +19 -0
  58. package/es/vtx-transfer-select/TransferSelect.js +143 -0
  59. package/es/vtx-transfer-select/index.js +3 -0
  60. package/es/vtx-transfer-select/style/index.js +19 -0
  61. package/es/vtx-tree/index.js +98 -35
  62. package/es/vtx-tree-select/index.js +71 -105
  63. package/es/vtx-tree-select/style/index.js +9 -3
  64. package/es/vtx-upload/FilePreview.js +2 -1
  65. package/es/vtx-wang-editor/index.js +93 -39
  66. package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
  67. package/lib/index.js +36 -0
  68. package/lib/utils/filterSpecialCharacters.js +48 -46
  69. package/lib/utils/index.js +0 -7
  70. package/lib/vtx-combogrid/Combogrid.js +5 -4
  71. package/lib/vtx-combogrid/index.js +7 -4
  72. package/lib/vtx-datagrid/Store/Provide.js +113 -143
  73. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -3
  74. package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
  75. package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
  76. package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
  77. package/lib/vtx-datagrid/columnState.js +100 -0
  78. package/lib/vtx-datagrid/index.js +124 -32
  79. package/lib/vtx-datagrid/mergeComponents.js +21 -0
  80. package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
  81. package/lib/vtx-datagrid/style/index.js +102 -20
  82. package/lib/vtx-date-picker/QdatePicker.js +1 -1
  83. package/lib/vtx-descriptions/Descriptions.js +38 -0
  84. package/lib/vtx-descriptions/index.js +15 -0
  85. package/lib/vtx-descriptions/style/index.js +25 -0
  86. package/lib/vtx-ellipsis-text/index.js +7 -2
  87. package/lib/vtx-ellipsis-text/style/index.js +3 -1
  88. package/lib/vtx-export/index.js +26 -26
  89. package/lib/vtx-export-async/History.js +11 -3
  90. package/lib/vtx-export-async/index.js +43 -13
  91. package/lib/vtx-export-async/util.js +16 -5
  92. package/lib/vtx-form-layout/Card.js +9 -9
  93. package/lib/vtx-form-layout/Divider.js +1 -1
  94. package/lib/vtx-form-layout/FormItem.js +16 -16
  95. package/lib/vtx-form-layout/Pane.js +22 -11
  96. package/lib/vtx-icon/index.js +54 -52
  97. package/lib/vtx-icon/index.js1 +90 -0
  98. package/lib/vtx-image/Preview.js +11 -6
  99. package/lib/vtx-image/style/index.js +0 -1
  100. package/lib/vtx-import/index.js +205 -63
  101. package/lib/vtx-import/result.js +29 -27
  102. package/lib/vtx-import/style/index.js +16 -1
  103. package/lib/vtx-import2/Content.js +2 -1
  104. package/lib/vtx-import2/index.js +29 -18
  105. package/lib/vtx-import2/style/index.js +60 -9
  106. package/lib/vtx-modal/index.js +9 -4
  107. package/lib/vtx-page-layout/style/index.js +4 -2
  108. package/lib/vtx-provider/index.js +7 -3
  109. package/lib/vtx-provider/locale/en_US.js +57 -3
  110. package/lib/vtx-provider/locale/zh_CN.js +57 -3
  111. package/lib/vtx-search/index.js +13 -9
  112. package/lib/vtx-search/style/index.js +2 -1
  113. package/lib/vtx-select/index.js +104 -38
  114. package/lib/vtx-select/style/index.js +11 -56
  115. package/lib/vtx-signature/index.js +4 -3
  116. package/lib/vtx-signature/style/index.js +1 -1
  117. package/lib/vtx-split-pane/Resizer.js +0 -1
  118. package/lib/vtx-split-pane/SplitPane.js +40 -31
  119. package/lib/vtx-split-pane/style/index.js +8 -112
  120. package/lib/vtx-time-picker/index.js +27 -1
  121. package/lib/vtx-transfer/Transfer.js +38 -0
  122. package/lib/vtx-transfer/index.js +15 -0
  123. package/lib/vtx-transfer/style/index.js +25 -0
  124. package/lib/vtx-transfer-select/TransferSelect.js +151 -0
  125. package/lib/vtx-transfer-select/index.js +15 -0
  126. package/lib/vtx-transfer-select/style/index.js +25 -0
  127. package/lib/vtx-tree/index.js +96 -33
  128. package/lib/vtx-tree-select/index.js +71 -105
  129. package/lib/vtx-tree-select/style/index.js +9 -3
  130. package/lib/vtx-upload/FilePreview.js +2 -1
  131. package/lib/vtx-wang-editor/index.js +91 -37
  132. package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
  133. package/package.json +47 -32
  134. package/es/utils/hooks/useFetchData/index.js +0 -82
  135. package/lib/utils/hooks/useFetchData/index.js +0 -89
@@ -0,0 +1,29 @@
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
+ 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; }
3
+ 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; }
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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
8
+ import classnames from 'classnames';
9
+ import React, { useContext } from 'react';
10
+ import { Descriptions } from 'antd';
11
+ import { useStyle } from "./style";
12
+ import { VtxProvider } from "../vtx-provider";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ function VtxDescriptions(props) {
15
+ var _useContext = useContext(VtxProvider),
16
+ getPrefixCls = _useContext.getPrefixCls;
17
+ var prefixCls = getPrefixCls('descriptions', props.prefixCls);
18
+ var _useStyle = useStyle(prefixCls),
19
+ wrapSSR = _useStyle.wrapSSR,
20
+ hashId = _useStyle.hashId;
21
+ var rest = Object.assign({}, (_objectDestructuringEmpty(props), props));
22
+ return wrapSSR( /*#__PURE__*/_jsx(Descriptions, _objectSpread({
23
+ classNames: {
24
+ root: classnames(hashId, prefixCls)
25
+ }
26
+ }, rest)));
27
+ }
28
+ VtxDescriptions.propTypes = {};
29
+ export default VtxDescriptions;
@@ -0,0 +1,3 @@
1
+ import VtxDescriptions from "./Descriptions";
2
+ export default VtxDescriptions;
3
+ export { VtxDescriptions };
@@ -0,0 +1,19 @@
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
+ 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; }
3
+ 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; }
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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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 { useStyle as useAntdStyle } from "../../vtx-provider";
8
+ var genStyle = function genStyle(token) {
9
+ var componentCls = token.componentCls;
10
+ return _defineProperty({}, componentCls, {});
11
+ };
12
+ export function useStyle(prefixCls) {
13
+ return useAntdStyle('VtxDescriptions', function (token) {
14
+ var _token = _objectSpread(_objectSpread({}, token), {}, {
15
+ componentCls: ".".concat(prefixCls)
16
+ });
17
+ return [genStyle(_token)];
18
+ });
19
+ }
@@ -19,6 +19,11 @@ function VtxEllipsisText(props) {
19
19
  tooltip = _props$tooltip === void 0 ? {} : _props$tooltip,
20
20
  className = props.className,
21
21
  style = props.style;
22
+
23
+ // 边界检查
24
+ if (!text) {
25
+ return null;
26
+ }
22
27
  var _useContext = useContext(ConfigProvider.ConfigContext),
23
28
  getPrefixCls = _useContext.getPrefixCls;
24
29
  var prefixCls = getPrefixCls('vtx-ellipsis-text');
@@ -26,7 +31,7 @@ function VtxEllipsisText(props) {
26
31
  wrapSSR = _useStyle.wrapSSR,
27
32
  hashId = _useStyle.hashId;
28
33
  var textStyle = {};
29
- if (lineClamp > 2) {
34
+ if (lineClamp >= 1) {
30
35
  textStyle['WebkitLineClamp'] = lineClamp;
31
36
  }
32
37
  return wrapSSR( /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({
@@ -35,7 +40,7 @@ function VtxEllipsisText(props) {
35
40
  mouseEnterDelay: 0.3
36
41
  }, tooltip), {}, {
37
42
  children: /*#__PURE__*/_jsx("p", {
38
- className: classnames(prefixCls, hashId, _defineProperty(_defineProperty({}, "".concat(prefixCls, "--single"), lineClamp < 2), "".concat(prefixCls, "--multi"), lineClamp >= 2), className),
43
+ className: classnames(prefixCls, hashId, _defineProperty(_defineProperty({}, "".concat(prefixCls, "--single"), lineClamp < 1), "".concat(prefixCls, "--multi"), lineClamp >= 1), className),
39
44
  style: _objectSpread(_objectSpread({}, style), textStyle),
40
45
  children: text
41
46
  })
@@ -10,7 +10,9 @@ var genVtxEllipsisTextStyle = function genVtxEllipsisTextStyle(token) {
10
10
  return _defineProperty({}, componentCls, _defineProperty(_defineProperty({
11
11
  margin: 0,
12
12
  overflow: 'hidden',
13
- textOverflow: 'ellipsis'
13
+ textOverflow: 'ellipsis',
14
+ wordBreak: "break-all",
15
+ wordWrap: "break-word"
14
16
  }, "&--single", {
15
17
  whiteSpace: 'nowrap'
16
18
  }), "&--multi", {
@@ -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";
@@ -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) {
@@ -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
  };
@@ -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;
@@ -151,7 +157,8 @@ function History(props) {
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,