@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.
- package/README.md +19 -19
- package/es/index.js +3 -0
- package/es/utils/components/LabelIconTip/index.js +7 -7
- package/es/utils/conversionMomentValue/index.js +25 -25
- package/es/utils/filterSpecialCharacters.js +53 -52
- package/es/utils/genCopyable/index.js +6 -6
- package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/es/utils/hooks/useDebounceFn/index.js +4 -4
- package/es/utils/hooks/useDebounceValue/index.js +6 -6
- package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +5 -5
- package/es/utils/index.js +1 -2
- package/es/utils/isBrowser/index.js +7 -7
- package/es/utils/isUrl/index.js +4 -4
- package/es/utils/merge/index.js +4 -4
- package/es/utils/nanoid/index.js +4 -4
- package/es/utils/omitBoolean/index.js +4 -4
- package/es/utils/parseValueToMoment/index.js +4 -4
- package/es/utils/proFieldParsingText/index.js +10 -10
- package/es/utils/transformKeySubmitValue/index.js +57 -57
- package/es/utils/useEditableArray/index.js +46 -46
- package/es/utils/useEditableMap/index.js +22 -22
- package/es/utils/useMediaQuery/index.js +5 -5
- package/es/vtx-combogrid/Combogrid.js +5 -4
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-datagrid/Store/Provide.js +106 -137
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/es/vtx-datagrid/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +124 -32
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +102 -20
- package/es/vtx-datagrid/style/index.less +242 -242
- package/es/vtx-date-picker/QdatePicker.js +1 -1
- package/es/vtx-date-picker/style/index.less +39 -39
- package/es/vtx-descriptions/Descriptions.js +29 -0
- package/es/vtx-descriptions/index.js +3 -0
- package/es/vtx-descriptions/style/index.js +19 -0
- package/es/vtx-ellipsis-text/index.js +7 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -33
- package/es/vtx-export-async/History.js +15 -7
- package/es/vtx-export-async/index.js +45 -15
- package/es/vtx-export-async/util.js +16 -5
- package/es/vtx-form-layout/Card.js +10 -10
- package/es/vtx-form-layout/Divider.js +1 -1
- package/es/vtx-form-layout/FormItem.js +16 -16
- package/es/vtx-form-layout/Pane.js +23 -12
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/Preview.js +11 -6
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +211 -70
- package/es/vtx-import/result.js +28 -26
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +30 -19
- package/es/vtx-import2/style/index.js +60 -9
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/TabLayout.js +6 -6
- package/es/vtx-page-layout/TableLayout.js +10 -10
- package/es/vtx-page-layout/TreeLayout.js +6 -6
- package/es/vtx-page-layout/container.js +2 -2
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +37 -33
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_US.js +57 -3
- package/es/vtx-provider/locale/zh_CN.js +57 -3
- package/es/vtx-provider/useStyle/index.js +17 -17
- package/es/vtx-search/index.js +13 -9
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +102 -36
- package/es/vtx-select/style/index.js +11 -56
- package/es/vtx-signature/index.js +5 -4
- package/es/vtx-signature/style/index.js +1 -1
- package/es/vtx-split-pane/Resizer.js +0 -1
- package/es/vtx-split-pane/SplitPane.js +42 -34
- package/es/vtx-split-pane/style/index.js +8 -112
- package/es/vtx-time-picker/index.js +27 -1
- package/es/vtx-transfer/Transfer.js +29 -0
- package/es/vtx-transfer/index.js +3 -0
- package/es/vtx-transfer/style/index.js +19 -0
- package/es/vtx-transfer-select/TransferSelect.js +143 -0
- package/es/vtx-transfer-select/index.js +3 -0
- package/es/vtx-transfer-select/style/index.js +19 -0
- package/es/vtx-tree/index.js +98 -35
- package/es/vtx-tree-select/index.js +71 -105
- package/es/vtx-tree-select/style/index.js +9 -3
- package/es/vtx-upload/FilePreview.js +2 -1
- package/es/vtx-wang-editor/index.js +93 -39
- package/es/vtx-wang-editor/style/index.less +12 -12
- package/es/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/lib/index.js +36 -0
- package/lib/utils/components/LabelIconTip/index.js +7 -7
- package/lib/utils/conversionMomentValue/index.js +25 -25
- package/lib/utils/filterSpecialCharacters.js +54 -52
- package/lib/utils/genCopyable/index.js +6 -6
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/lib/utils/hooks/useDebounceFn/index.js +4 -4
- package/lib/utils/hooks/useDebounceValue/index.js +6 -6
- package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/lib/utils/hooks/useLatest/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +5 -5
- package/lib/utils/index.js +0 -7
- package/lib/utils/isBrowser/index.js +7 -7
- package/lib/utils/isUrl/index.js +4 -4
- package/lib/utils/merge/index.js +4 -4
- package/lib/utils/nanoid/index.js +4 -4
- package/lib/utils/omitBoolean/index.js +4 -4
- package/lib/utils/parseValueToMoment/index.js +4 -4
- package/lib/utils/proFieldParsingText/index.js +10 -10
- package/lib/utils/transformKeySubmitValue/index.js +57 -57
- package/lib/utils/useEditableArray/index.js +46 -46
- package/lib/utils/useEditableMap/index.js +22 -22
- package/lib/utils/useMediaQuery/index.js +5 -5
- package/lib/vtx-combogrid/Combogrid.js +5 -4
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-datagrid/Store/Provide.js +113 -143
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +11 -7
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/lib/vtx-datagrid/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +124 -32
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +102 -20
- package/lib/vtx-datagrid/style/index.less +242 -242
- package/lib/vtx-date-picker/QdatePicker.js +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-descriptions/Descriptions.js +38 -0
- package/lib/vtx-descriptions/index.js +15 -0
- package/lib/vtx-descriptions/style/index.js +25 -0
- package/lib/vtx-ellipsis-text/index.js +7 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -34
- package/lib/vtx-export-async/History.js +14 -8
- package/lib/vtx-export-async/index.js +43 -13
- package/lib/vtx-export-async/util.js +16 -5
- package/lib/vtx-form-layout/Card.js +9 -9
- package/lib/vtx-form-layout/Divider.js +1 -1
- package/lib/vtx-form-layout/FormItem.js +16 -16
- package/lib/vtx-form-layout/Pane.js +22 -11
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/Preview.js +11 -6
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +209 -71
- package/lib/vtx-import/result.js +29 -27
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +29 -18
- package/lib/vtx-import2/style/index.js +60 -9
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/TabLayout.js +6 -6
- package/lib/vtx-page-layout/TableLayout.js +10 -10
- package/lib/vtx-page-layout/TreeLayout.js +6 -6
- package/lib/vtx-page-layout/container.js +2 -2
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +37 -33
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_US.js +57 -3
- package/lib/vtx-provider/locale/zh_CN.js +57 -3
- package/lib/vtx-provider/useStyle/index.js +17 -17
- package/lib/vtx-search/index.js +13 -9
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +104 -38
- package/lib/vtx-select/style/index.js +11 -56
- package/lib/vtx-signature/index.js +4 -3
- package/lib/vtx-signature/style/index.js +1 -1
- package/lib/vtx-split-pane/Resizer.js +0 -1
- package/lib/vtx-split-pane/SplitPane.js +40 -31
- package/lib/vtx-split-pane/style/index.js +8 -112
- package/lib/vtx-time-picker/index.js +27 -1
- package/lib/vtx-transfer/Transfer.js +38 -0
- package/lib/vtx-transfer/index.js +15 -0
- package/lib/vtx-transfer/style/index.js +25 -0
- package/lib/vtx-transfer-select/TransferSelect.js +151 -0
- package/lib/vtx-transfer-select/index.js +15 -0
- package/lib/vtx-transfer-select/style/index.js +25 -0
- package/lib/vtx-tree/index.js +96 -33
- package/lib/vtx-tree-select/index.js +71 -105
- package/lib/vtx-tree-select/style/index.js +9 -3
- package/lib/vtx-upload/FilePreview.js +2 -1
- package/lib/vtx-wang-editor/index.js +91 -37
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +4 -0
- package/package.json +240 -225
- package/es/utils/hooks/useFetchData/index.js +0 -82
- 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
|
|
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 <
|
|
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", {
|
package/lib/vtx-export/index.js
CHANGED
|
@@ -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
|
|
15
|
-
var
|
|
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,
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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)(
|
|
184
|
+
children: [exportText, " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_vtxIcon.default, {
|
|
185
|
+
type: "downOutlined",
|
|
186
|
+
fileType: "svg"
|
|
187
|
+
})]
|
|
188
188
|
})
|
|
189
189
|
}));
|
|
190
190
|
};
|
|
@@ -5,18 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _2 = require("./..");
|
|
10
9
|
var _utils = require("@vtx/utils");
|
|
11
10
|
var _ahooks = require("ahooks");
|
|
12
11
|
var _antd = require("antd");
|
|
13
|
-
var _util = require("./util");
|
|
14
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _react = require("react");
|
|
15
14
|
var _getToken = _interopRequireDefault(require("../utils/getToken"));
|
|
15
|
+
var _util = require("./util");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
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); }
|
|
19
|
-
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; }
|
|
20
18
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
21
19
|
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; }
|
|
22
20
|
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; }
|
|
@@ -46,7 +44,9 @@ function History(props) {
|
|
|
46
44
|
_props$customTablePro = props.customTableProps,
|
|
47
45
|
customTableProps = _props$customTablePro === void 0 ? {} : _props$customTablePro,
|
|
48
46
|
refreshTime = props.refreshTime,
|
|
49
|
-
downloadInNewTab = props.downloadInNewTab
|
|
47
|
+
downloadInNewTab = props.downloadInNewTab,
|
|
48
|
+
_props$headers = props.headers,
|
|
49
|
+
headers = _props$headers === void 0 ? {} : _props$headers;
|
|
50
50
|
var _Form$useForm = _antd.Form.useForm(),
|
|
51
51
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
52
52
|
form = _Form$useForm2[0];
|
|
@@ -114,6 +114,10 @@ function History(props) {
|
|
|
114
114
|
timer.current = setInterval(function () {
|
|
115
115
|
refresh();
|
|
116
116
|
}, refreshTime * 1000);
|
|
117
|
+
return function () {
|
|
118
|
+
timer.current && clearInterval(timer.current);
|
|
119
|
+
timer.current = null;
|
|
120
|
+
};
|
|
117
121
|
}, [JSON.stringify(tableProps.dataSource)]);
|
|
118
122
|
var pageSize = pagination.pageSize,
|
|
119
123
|
current = pagination.current;
|
|
@@ -154,12 +158,13 @@ function History(props) {
|
|
|
154
158
|
name: TextEnum.downloadBtnText,
|
|
155
159
|
onClick: function onClick() {
|
|
156
160
|
if (downloadInNewTab) {
|
|
157
|
-
window.
|
|
161
|
+
window.location.href = "".concat(downFileUrl, "?id=").concat(record.id, "&token=").concat((0, _getToken.default)('token'));
|
|
158
162
|
} else {
|
|
159
163
|
(0, _utils.downloadFile)(downFileUrl, {
|
|
160
164
|
data: {
|
|
161
165
|
id: record.id
|
|
162
|
-
}
|
|
166
|
+
},
|
|
167
|
+
extraHeader: headers
|
|
163
168
|
}, 'blob');
|
|
164
169
|
}
|
|
165
170
|
},
|
|
@@ -259,6 +264,7 @@ History.propTypes = {
|
|
|
259
264
|
TextEnum: _propTypes.default.object,
|
|
260
265
|
customTableProps: _propTypes.default.object,
|
|
261
266
|
refreshTime: _propTypes.default.number,
|
|
262
|
-
downloadInNewTab: _propTypes.default.bool
|
|
267
|
+
downloadInNewTab: _propTypes.default.bool,
|
|
268
|
+
headers: _propTypes.default.object
|
|
263
269
|
};
|
|
264
270
|
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
|
|
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'
|
|
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 (
|
|
172
|
-
clearInterval(
|
|
173
|
-
|
|
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
|
-
|
|
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)(
|
|
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;
|
|
@@ -16,6 +16,16 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
16
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
17
|
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); }
|
|
18
18
|
var token = (0, _getToken.default)();
|
|
19
|
+
var getContentType = function getContentType(headers) {
|
|
20
|
+
var contentTypeKey = Object.keys(headers || {}).find(function (key) {
|
|
21
|
+
return key.toLowerCase() === 'content-type';
|
|
22
|
+
});
|
|
23
|
+
return contentTypeKey ? headers[contentTypeKey] : '';
|
|
24
|
+
};
|
|
25
|
+
var stringifyPostData = function stringifyPostData(params, headers) {
|
|
26
|
+
var contentType = getContentType(headers);
|
|
27
|
+
return String(contentType).includes('application/json') ? JSON.stringify(params) : _querystring.default.stringify(params);
|
|
28
|
+
};
|
|
19
29
|
var getData = exports.getData = function getData(url, params, headers) {
|
|
20
30
|
return new Promise(function (resolve, reject) {
|
|
21
31
|
_axios.default.get(url, {
|
|
@@ -36,14 +46,15 @@ var getData = exports.getData = function getData(url, params, headers) {
|
|
|
36
46
|
};
|
|
37
47
|
var postData = exports.postData = function postData(url, params, headers) {
|
|
38
48
|
return new Promise(function (resolve, reject) {
|
|
49
|
+
var nextHeaders = _objectSpread(_objectSpread({
|
|
50
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
51
|
+
Authorization: token ? "Bearer ".concat(token) : ''
|
|
52
|
+
}, (0, _getSignature.default)(params)), headers);
|
|
39
53
|
(0, _axios.default)({
|
|
40
54
|
url: url,
|
|
41
55
|
method: 'post',
|
|
42
|
-
headers:
|
|
43
|
-
|
|
44
|
-
Authorization: token ? "Bearer ".concat(token) : ''
|
|
45
|
-
}, (0, _getSignature.default)(params)), headers),
|
|
46
|
-
data: _querystring.default.stringify(params)
|
|
56
|
+
headers: nextHeaders,
|
|
57
|
+
data: stringifyPostData(params, nextHeaders)
|
|
47
58
|
}).then(function (res) {
|
|
48
59
|
if (res.status == 200) {
|
|
49
60
|
resolve(res.data);
|
|
@@ -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
|
|
40
|
-
|
|
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:
|
|
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:
|
|
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
|
|
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 (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
90
|
-
|
|
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
|
};
|
|
@@ -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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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:
|
|
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,
|