@vtx/components 4.0.0-beta.9 → 4.0.0-beta.91
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 +6 -6
- 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 +109 -140
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/index.js +2 -1
- package/es/vtx-datagrid/ToolBar/style.js +6 -3
- package/es/vtx-datagrid/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +134 -37
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +108 -18
- 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 +2 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -38
- package/es/vtx-export-async/History.js +15 -7
- package/es/vtx-export-async/index.js +18 -8
- package/es/vtx-export-async/util.js +16 -5
- package/es/vtx-form-layout/FormItem.js +16 -16
- package/es/vtx-form-layout/style/index.js +6 -4
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +143 -42
- 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 +29 -19
- package/es/vtx-import2/style/index.js +59 -8
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-modal/style/index.js +5 -2
- 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 +33 -31
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_GB.js +1 -1
- package/es/vtx-provider/locale/en_US.js +58 -4
- 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 +30 -12
- package/es/vtx-search/style/index.js +6 -3
- package/es/vtx-select/index.js +123 -40
- package/es/vtx-select/style/index.js +11 -56
- 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-statistics-column/style/index.js +1 -1
- 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 +27 -9
- package/es/vtx-tree-select/index.js +81 -110
- 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 +41 -32
- package/es/vtx-wang-editor/style/index.less +12 -12
- 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 +6 -6
- 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 +112 -142
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/index.js +2 -1
- package/lib/vtx-datagrid/ToolBar/style.js +6 -3
- package/lib/vtx-datagrid/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +134 -37
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +108 -18
- 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 +2 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -39
- package/lib/vtx-export-async/History.js +14 -8
- package/lib/vtx-export-async/index.js +18 -8
- package/lib/vtx-export-async/util.js +16 -5
- package/lib/vtx-form-layout/FormItem.js +16 -16
- package/lib/vtx-form-layout/style/index.js +6 -4
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +141 -43
- 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 -19
- package/lib/vtx-import2/style/index.js +59 -8
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-modal/style/index.js +5 -2
- 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 +33 -31
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_GB.js +1 -1
- package/lib/vtx-provider/locale/en_US.js +58 -4
- 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 +32 -12
- package/lib/vtx-search/style/index.js +6 -3
- package/lib/vtx-select/index.js +125 -42
- package/lib/vtx-select/style/index.js +11 -56
- 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-statistics-column/style/index.js +1 -1
- 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 +27 -9
- package/lib/vtx-tree-select/index.js +81 -112
- 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 +39 -30
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/package.json +239 -238
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -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,36 +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
|
-
console.log('Export status:', status);
|
|
135
|
-
afterExport(status);
|
|
136
132
|
}
|
|
137
|
-
}
|
|
138
|
-
console.error('Export failed:', err);
|
|
139
|
-
_antd.message.error('导出失败');
|
|
140
|
-
document.body.removeChild(div);
|
|
141
|
-
});
|
|
133
|
+
}, 'blob');
|
|
142
134
|
}
|
|
143
135
|
/* 下载并 兼容IE */
|
|
144
136
|
function download(content, filename) {
|
|
@@ -150,10 +142,10 @@ var VtxExport = exports.VtxExport = function VtxExport(props) {
|
|
|
150
142
|
downloadByATag(window.URL.createObjectURL(blob), filename);
|
|
151
143
|
}
|
|
152
144
|
}
|
|
153
|
-
/**
|
|
154
|
-
* 通过a标签模拟下载
|
|
155
|
-
* @param {String} href
|
|
156
|
-
* @param {String} filename
|
|
145
|
+
/**
|
|
146
|
+
* 通过a标签模拟下载
|
|
147
|
+
* @param {String} href
|
|
148
|
+
* @param {String} filename
|
|
157
149
|
*/
|
|
158
150
|
function downloadByATag(href, filename) {
|
|
159
151
|
var a = document.createElement('a');
|
|
@@ -189,7 +181,10 @@ var VtxExport = exports.VtxExport = function VtxExport(props) {
|
|
|
189
181
|
trigger: ['click'],
|
|
190
182
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Button, {
|
|
191
183
|
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ExportOutlined, {}),
|
|
192
|
-
children: [exportText, " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
184
|
+
children: [exportText, " ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_vtxIcon.default, {
|
|
185
|
+
type: "downOutlined",
|
|
186
|
+
fileType: "svg"
|
|
187
|
+
})]
|
|
193
188
|
})
|
|
194
189
|
}));
|
|
195
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;
|
|
@@ -40,7 +40,7 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
|
|
|
40
40
|
var intl = (0, _vtxProvider.useIntl)();
|
|
41
41
|
var _useContext = (0, _react.useContext)(_antd.ConfigProvider.ConfigContext),
|
|
42
42
|
getPrefixCls = _useContext.getPrefixCls;
|
|
43
|
-
var prefixCls = getPrefixCls('vtx-export-async'
|
|
43
|
+
var prefixCls = getPrefixCls('', 'vtx-export-async');
|
|
44
44
|
var _useStyle = (0, _index.useStyle)(prefixCls),
|
|
45
45
|
wrapSSR = _useStyle.wrapSSR,
|
|
46
46
|
hashId = _useStyle.hashId;
|
|
@@ -87,9 +87,13 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
|
|
|
87
87
|
downloadInNewTab = _props$downloadInNewT === void 0 ? false : _props$downloadInNewT,
|
|
88
88
|
_props$enableCustomSe = props.enableCustomSelect,
|
|
89
89
|
enableCustomSelect = _props$enableCustomSe === void 0 ? false : _props$enableCustomSe,
|
|
90
|
-
beforeExport = props.beforeExport,
|
|
91
90
|
_props$headers = props.headers,
|
|
92
|
-
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;
|
|
93
97
|
var _Form$useForm = _antd.Form.useForm(),
|
|
94
98
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
95
99
|
form = _Form$useForm2[0];
|
|
@@ -304,7 +308,9 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
|
|
|
304
308
|
subtitle: TextEnum.modalTitleText
|
|
305
309
|
}) : TextEnum.modalTitleText,
|
|
306
310
|
open: state.visible,
|
|
307
|
-
|
|
311
|
+
mask: {
|
|
312
|
+
closable: false
|
|
313
|
+
},
|
|
308
314
|
onCancel: close,
|
|
309
315
|
footer: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
310
316
|
onClick: close,
|
|
@@ -342,7 +348,8 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
|
|
|
342
348
|
exclude: _filterSpecialCharacters.SpecialCharacters.filter(function (v) {
|
|
343
349
|
return !Includes.includes(v);
|
|
344
350
|
})
|
|
345
|
-
}
|
|
351
|
+
},
|
|
352
|
+
maxLength: 255
|
|
346
353
|
})
|
|
347
354
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, {
|
|
348
355
|
label: TextEnum.fieldTypeText,
|
|
@@ -359,7 +366,7 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
|
|
|
359
366
|
}, item.key);
|
|
360
367
|
})
|
|
361
368
|
})
|
|
362
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, {
|
|
369
|
+
}), hideContent ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, {
|
|
363
370
|
label: TextEnum.fieldContentText,
|
|
364
371
|
name: "content",
|
|
365
372
|
rules: [{
|
|
@@ -394,7 +401,8 @@ var VtxExportAsync = exports.VtxExportAsync = function VtxExportAsync(props) {
|
|
|
394
401
|
TextEnum: TextEnum,
|
|
395
402
|
customTableProps: customTableProps,
|
|
396
403
|
refreshTime: refreshTime,
|
|
397
|
-
downloadInNewTab: downloadInNewTab
|
|
404
|
+
downloadInNewTab: downloadInNewTab,
|
|
405
|
+
headers: historyHeaders
|
|
398
406
|
})]
|
|
399
407
|
}));
|
|
400
408
|
};
|
|
@@ -424,6 +432,8 @@ VtxExportAsync.propTypes = {
|
|
|
424
432
|
refreshTime: _propTypes.default.number,
|
|
425
433
|
downloadInNewTab: _propTypes.default.bool,
|
|
426
434
|
enableCustomSelect: _propTypes.default.bool,
|
|
427
|
-
headers: _propTypes.default.object
|
|
435
|
+
headers: _propTypes.default.object,
|
|
436
|
+
beforeExport: _propTypes.default.object,
|
|
437
|
+
historyHeaders: _propTypes.default.object
|
|
428
438
|
};
|
|
429
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);
|
|
@@ -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
|
};
|
|
@@ -29,7 +29,7 @@ var genVtxFormLayoutStyle = function genVtxFormLayoutStyle(token) {
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
'.ant-form-item-control': {
|
|
32
|
-
|
|
32
|
+
img: {
|
|
33
33
|
borderRadius: token.borderRadius
|
|
34
34
|
},
|
|
35
35
|
'.ant-select,.ant-input-number': {
|
|
@@ -135,10 +135,12 @@ var genVtxFormLayoutStyle = function genVtxFormLayoutStyle(token) {
|
|
|
135
135
|
cursor: 'pointer'
|
|
136
136
|
},
|
|
137
137
|
'.ant-card-body': {
|
|
138
|
-
padding: 0
|
|
138
|
+
padding: '0 10px'
|
|
139
139
|
},
|
|
140
140
|
'.ant-card-head': {
|
|
141
|
-
height: '44px'
|
|
141
|
+
height: '44px',
|
|
142
|
+
background: '#F5F7FA',
|
|
143
|
+
padding: '0 20px'
|
|
142
144
|
},
|
|
143
145
|
'.ant-card-head-wrapper, .ant-card-head-title': {
|
|
144
146
|
fontWeight: '600',
|
|
@@ -151,7 +153,7 @@ var genVtxFormLayoutStyle = function genVtxFormLayoutStyle(token) {
|
|
|
151
153
|
color: token.colorTextSecondary
|
|
152
154
|
},
|
|
153
155
|
'.ant-card-head-title': {
|
|
154
|
-
paddingLeft: '
|
|
156
|
+
paddingLeft: '12px !important',
|
|
155
157
|
display: 'flex',
|
|
156
158
|
alignItems: 'center'
|
|
157
159
|
},
|
package/lib/vtx-icon/index.js
CHANGED
|
@@ -6,76 +6,78 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.VtxIcon = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
var _alignRightOutlined = _interopRequireDefault(require("./svg/alignRightOutlined.js"));
|
|
10
|
+
var _columnHeightOutlined = _interopRequireDefault(require("./svg/columnHeightOutlined.js"));
|
|
11
|
+
var _downOutlined = _interopRequireDefault(require("./svg/downOutlined.js"));
|
|
12
|
+
var _fullscreen = _interopRequireDefault(require("./svg/fullscreen.js"));
|
|
13
|
+
var _redoOutlined = _interopRequireDefault(require("./svg/redoOutlined.js"));
|
|
14
|
+
var _rightOutlined = _interopRequireDefault(require("./svg/rightOutlined.js"));
|
|
15
|
+
var _settingOutlined = _interopRequireDefault(require("./svg/settingOutlined.js"));
|
|
9
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
var _excluded = ["
|
|
17
|
+
var _excluded = ["width", "height", "style", "className"],
|
|
18
|
+
_excluded2 = ["type", "size", "className", "style", "color", "fileType"];
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
22
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
24
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
25
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
26
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
var iconComponents = {
|
|
28
|
+
alignRightOutlined: _alignRightOutlined.default,
|
|
29
|
+
columnHeightOutlined: _columnHeightOutlined.default,
|
|
30
|
+
downOutlined: _downOutlined.default,
|
|
31
|
+
fullscreen: _fullscreen.default,
|
|
32
|
+
redoOutlined: _redoOutlined.default,
|
|
33
|
+
rightOutlined: _rightOutlined.default,
|
|
34
|
+
settingOutlined: _settingOutlined.default
|
|
35
|
+
// 低频图标如果确实需要,可以再考虑 lazy
|
|
36
|
+
};
|
|
37
|
+
var EmptySvg = function EmptySvg(_ref) {
|
|
38
|
+
var width = _ref.width,
|
|
39
|
+
height = _ref.height,
|
|
40
|
+
style = _ref.style,
|
|
41
|
+
className = _ref.className,
|
|
31
42
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread({
|
|
44
|
+
width: width,
|
|
45
|
+
height: height,
|
|
46
|
+
style: style,
|
|
47
|
+
className: className
|
|
48
|
+
}, props));
|
|
49
|
+
};
|
|
50
|
+
var VtxIcon = exports.VtxIcon = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
51
|
+
var type = _ref2.type,
|
|
52
|
+
_ref2$size = _ref2.size,
|
|
53
|
+
size = _ref2$size === void 0 ? 16 : _ref2$size,
|
|
54
|
+
_ref2$className = _ref2.className,
|
|
55
|
+
className = _ref2$className === void 0 ? '' : _ref2$className,
|
|
56
|
+
_ref2$style = _ref2.style,
|
|
57
|
+
style = _ref2$style === void 0 ? {} : _ref2$style,
|
|
58
|
+
color = _ref2.color,
|
|
59
|
+
_ref2$fileType = _ref2.fileType,
|
|
60
|
+
fileType = _ref2$fileType === void 0 ? 'webp' : _ref2$fileType,
|
|
61
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
32
62
|
var width = props.width || size;
|
|
33
63
|
var height = props.height || size;
|
|
34
64
|
if (!type) {
|
|
35
65
|
return null;
|
|
36
66
|
}
|
|
37
|
-
var SvgComponent = (0, _react.useMemo)(function () {
|
|
38
|
-
// 动态导入并缓存结果
|
|
39
|
-
return /*#__PURE__*/(0, _react.lazy)(function () {
|
|
40
|
-
return function (specifier) {
|
|
41
|
-
return new Promise(function (r) {
|
|
42
|
-
return r(specifier);
|
|
43
|
-
}).then(function (s) {
|
|
44
|
-
return _interopRequireWildcard(require(s));
|
|
45
|
-
});
|
|
46
|
-
}( /* @vite-ignore */"./svg/".concat(type, ".js"));
|
|
47
|
-
});
|
|
48
|
-
}, [type]);
|
|
49
67
|
|
|
50
68
|
// 默认返回空元素
|
|
51
69
|
if (fileType == 'svg') {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
style: _objectSpread({
|
|
57
|
-
width: width,
|
|
58
|
-
height: height
|
|
59
|
-
}, style)
|
|
60
|
-
}),
|
|
61
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SvgComponent, _objectSpread({
|
|
62
|
-
className: className,
|
|
63
|
-
style: _objectSpread({
|
|
64
|
-
width: width,
|
|
65
|
-
height: height
|
|
66
|
-
}, style),
|
|
67
|
-
fill: color
|
|
68
|
-
}, props))
|
|
69
|
-
});
|
|
70
|
-
} catch (error) {
|
|
71
|
-
// 如果动态导入失败,返回空的 SVG 元素
|
|
72
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread({
|
|
70
|
+
var SvgComponent = iconComponents[type] || EmptySvg;
|
|
71
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SvgComponent, _objectSpread({
|
|
72
|
+
className: className,
|
|
73
|
+
style: _objectSpread({
|
|
73
74
|
width: width,
|
|
74
|
-
height: height
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
height: height
|
|
76
|
+
}, style),
|
|
77
|
+
width: width,
|
|
78
|
+
height: height,
|
|
79
|
+
fill: color
|
|
80
|
+
}, props));
|
|
79
81
|
} else {
|
|
80
82
|
return (
|
|
81
83
|
/*#__PURE__*/
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { lazy, memo, Suspense, useMemo } from 'react';
|
|
2
|
+
import AlignRightOutlined from './svg/alignRightOutlined.js';
|
|
3
|
+
import ColumnHeightOutlined from './svg/columnHeightOutlined.js';
|
|
4
|
+
import DownOutlined from './svg/downOutlined.js';
|
|
5
|
+
import Fullscreen from './svg/fullscreen.js';
|
|
6
|
+
import RedoOutlined from './svg/redoOutlined.js';
|
|
7
|
+
import RightOutlined from './svg/rightOutlined.js';
|
|
8
|
+
import SettingOutlined from './svg/settingOutlined.js';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const iconComponents = {
|
|
12
|
+
alignRightOutlined: AlignRightOutlined,
|
|
13
|
+
columnHeightOutlined: ColumnHeightOutlined,
|
|
14
|
+
downOutlined: DownOutlined,
|
|
15
|
+
fullscreen: Fullscreen,
|
|
16
|
+
redoOutlined: RedoOutlined,
|
|
17
|
+
rightOutlined: RightOutlined,
|
|
18
|
+
settingOutlined: SettingOutlined,
|
|
19
|
+
// 低频图标如果确实需要,可以再考虑 lazy
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// const iconComponents = {
|
|
23
|
+
// // 核心:添加你需要的所有图标, 动态导入有的组件会失败
|
|
24
|
+
// alignRightOutlined: lazy(() => import('./svg/alignRightOutlined.js')),
|
|
25
|
+
// columnHeightOutlined: lazy(() => import('./svg/columnHeightOutlined.js')),
|
|
26
|
+
// downOutlined: lazy(() => import('./svg/downOutlined.js')),
|
|
27
|
+
// fullscreen: lazy(() => import('./svg/fullscreen.js')),
|
|
28
|
+
// redoOutlined: lazy(() => import('./svg/redoOutlined.js')),
|
|
29
|
+
// rightOutlined: lazy(() => import('./svg/rightOutlined.js')),
|
|
30
|
+
// settingOutlined: lazy(() => import('./svg/settingOutlined.js')),
|
|
31
|
+
// // 新增其他图标...
|
|
32
|
+
// };
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
const VtxIcon = memo(({
|
|
36
|
+
type,
|
|
37
|
+
size = 16,
|
|
38
|
+
className = '',
|
|
39
|
+
style = {},
|
|
40
|
+
color,
|
|
41
|
+
fileType = 'webp',
|
|
42
|
+
...props
|
|
43
|
+
}) => {
|
|
44
|
+
const width = props.width || size;
|
|
45
|
+
const height = props.height || size;
|
|
46
|
+
if (!type) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
// const SvgComponent = useMemo(() => {
|
|
50
|
+
// // 动态导入并缓存结果
|
|
51
|
+
// return lazy(() => import(/* @vite-ignore */`./svg/${type}.js`));
|
|
52
|
+
// }, [type]);
|
|
53
|
+
|
|
54
|
+
const SvgComponent = useMemo(() => {
|
|
55
|
+
// 兜底:找不到对应图标时,返回一个空组件(避免报错)
|
|
56
|
+
return iconComponents[type] || lazy(() => Promise.resolve({ default: () => <svg width={width} height={height} /> }));
|
|
57
|
+
}, [type, width, height]);
|
|
58
|
+
|
|
59
|
+
// 默认返回空元素
|
|
60
|
+
if (fileType == 'svg') {
|
|
61
|
+
try {
|
|
62
|
+
// const SvgComponent = lazy(() => import(`./svg/${type}.js`));
|
|
63
|
+
return (
|
|
64
|
+
<Suspense fallback={<div style={{ width, height, ...style }} />}>
|
|
65
|
+
<SvgComponent
|
|
66
|
+
className={className}
|
|
67
|
+
style={{ width, height, ...style }}
|
|
68
|
+
fill={color}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
</Suspense>
|
|
72
|
+
);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
// 如果动态导入失败,返回空的 SVG 元素
|
|
75
|
+
return (
|
|
76
|
+
<svg width={width} height={height} style={style} className={className} {...props} />
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
return (
|
|
81
|
+
// <img
|
|
82
|
+
// src={require(`./assets/${type}.${fileType}`)}
|
|
83
|
+
// style={{ width, height, ...style }}
|
|
84
|
+
// />
|
|
85
|
+
<></>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
export { VtxIcon }
|
|
90
|
+
export default VtxIcon;
|