@pisell/materials 1.0.407 → 1.0.409
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/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +4 -4
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +59 -16
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +62 -19
- package/es/components/browserSelect/chevron-down.png +0 -0
- package/es/components/browserSelect/index.d.ts +15 -0
- package/es/components/browserSelect/index.js +36 -0
- package/es/components/browserSelect/index.less +18 -0
- package/es/components/date-picker/constants.d.ts +39 -0
- package/es/components/date-picker/constants.js +76 -0
- package/es/components/date-picker/datePickerCpt.d.ts +8 -0
- package/es/components/date-picker/datePickerCpt.js +370 -0
- package/es/components/date-picker/hooks/useMediaQuery.d.ts +2 -0
- package/es/components/date-picker/hooks/useMediaQuery.js +28 -0
- package/es/components/date-picker/index.js +2 -2
- package/es/components/date-picker/index.less +1880 -0
- package/es/components/drag-sort-tree/index.d.ts +0 -1
- package/es/components/drag-sort-tree/index.js +2 -1
- package/es/components/page/index.js +4 -2
- package/es/components/picker-view/index.d.ts +2 -0
- package/es/components/picker-view/index.js +2 -0
- package/es/components/pisell-config-provider/index.js +2 -0
- package/es/components/pisellModal/components/functions/index.d.ts +23 -5
- package/es/components/pisellModal/components/functions/index.js +7 -2
- package/es/components/pisellModal/index.d.ts +20 -5
- package/es/components/pisellTags/index.d.ts +13 -0
- package/es/components/pisellTags/index.js +83 -0
- package/es/components/pisellTags/index.less +17 -0
- package/es/components/pisellTags/utils.d.ts +1 -0
- package/es/components/pisellTags/utils.js +89 -0
- package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.js +33 -48
- package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js +9 -9
- package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.js +28 -43
- package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.js +45 -44
- package/es/components/table/Actions/component/ExportImport/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/index.js +34 -25
- package/es/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
- package/es/components/table/Actions/component/ExportImport/utils/index.js +11 -0
- package/es/components/table/BasicTable/index.js +5 -3
- package/es/components/table/Gallery/index.js +2 -1
- package/es/components/table/Table/fields/rangePicker/Edit/index.js +13 -11
- package/es/components/table/Table/index.d.ts +2 -2
- package/es/components/table/Table/index.js +68 -42
- package/es/components/table/Table/index.less +3 -0
- package/es/components/table/Table/utils.d.ts +14 -2
- package/es/components/table/Table/utils.js +6 -2
- package/es/components/table/View/index.d.ts +2 -2
- package/es/components/table/View/index.js +27 -16
- package/es/components/table/hooks/useGenScroll.js +1 -1
- package/es/components/table/hooks/useTableSetting.js +29 -7
- package/es/components/table/hooks/useTransDataSource.d.ts +1 -0
- package/es/components/table/hooks/useTransDataSource.js +8 -6
- package/es/components/table/index.js +7 -5
- package/es/components/table/index.less +9 -0
- package/es/components/table/serve.d.ts +3 -1
- package/es/components/table/serve.js +71 -9
- package/es/components/table/types.d.ts +17 -4
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/locales/en-US.d.ts +12 -0
- package/es/locales/en-US.js +13 -0
- package/es/locales/zh-CN.d.ts +12 -0
- package/es/locales/zh-CN.js +13 -0
- package/es/locales/zh-TW.d.ts +12 -0
- package/es/locales/zh-TW.js +13 -0
- package/lib/components/browserSelect/chevron-down.png +0 -0
- package/lib/components/browserSelect/index.d.ts +15 -0
- package/lib/components/browserSelect/index.js +59 -0
- package/lib/components/browserSelect/index.less +18 -0
- package/lib/components/date-picker/constants.d.ts +39 -0
- package/lib/components/date-picker/constants.js +78 -0
- package/lib/components/date-picker/datePickerCpt.d.ts +8 -0
- package/lib/components/date-picker/datePickerCpt.js +403 -0
- package/lib/components/date-picker/hooks/useMediaQuery.d.ts +2 -0
- package/lib/components/date-picker/hooks/useMediaQuery.js +43 -0
- package/lib/components/date-picker/index.js +2 -2
- package/lib/components/date-picker/index.less +1880 -0
- package/lib/components/drag-sort-tree/index.d.ts +0 -1
- package/lib/components/drag-sort-tree/index.js +0 -1
- package/lib/components/page/index.js +3 -2
- package/lib/components/picker-view/index.d.ts +2 -0
- package/lib/components/picker-view/index.js +36 -0
- package/lib/components/pisell-config-provider/index.js +2 -0
- package/lib/components/pisellModal/components/functions/index.d.ts +23 -5
- package/lib/components/pisellModal/components/functions/index.js +13 -7
- package/lib/components/pisellModal/index.d.ts +20 -5
- package/lib/components/pisellTags/index.d.ts +13 -0
- package/lib/components/pisellTags/index.js +113 -0
- package/lib/components/pisellTags/index.less +17 -0
- package/lib/components/pisellTags/utils.d.ts +1 -0
- package/lib/components/pisellTags/utils.js +86 -0
- package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.js +9 -22
- package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.js +3 -8
- package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.js +9 -22
- package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.js +5 -8
- package/lib/components/table/Actions/component/ExportImport/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/index.js +15 -8
- package/lib/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
- package/lib/components/table/Actions/component/ExportImport/utils/index.js +31 -0
- package/lib/components/table/BasicTable/index.js +2 -3
- package/lib/components/table/Gallery/index.js +2 -1
- package/lib/components/table/Table/fields/rangePicker/Edit/index.js +1 -9
- package/lib/components/table/Table/index.d.ts +2 -2
- package/lib/components/table/Table/index.js +61 -34
- package/lib/components/table/Table/index.less +3 -0
- package/lib/components/table/Table/utils.d.ts +14 -2
- package/lib/components/table/Table/utils.js +7 -1
- package/lib/components/table/View/index.d.ts +2 -2
- package/lib/components/table/View/index.js +28 -19
- package/lib/components/table/hooks/useGenScroll.js +1 -1
- package/lib/components/table/hooks/useTableSetting.js +26 -11
- package/lib/components/table/hooks/useTransDataSource.d.ts +1 -0
- package/lib/components/table/hooks/useTransDataSource.js +6 -5
- package/lib/components/table/index.js +4 -4
- package/lib/components/table/index.less +9 -0
- package/lib/components/table/serve.d.ts +3 -1
- package/lib/components/table/serve.js +38 -6
- package/lib/components/table/types.d.ts +17 -4
- package/lib/index.d.ts +3 -1
- package/lib/index.js +6 -0
- package/lib/locales/en-US.d.ts +12 -0
- package/lib/locales/en-US.js +13 -0
- package/lib/locales/zh-CN.d.ts +12 -0
- package/lib/locales/zh-CN.js +13 -0
- package/lib/locales/zh-TW.d.ts +12 -0
- package/lib/locales/zh-TW.js +13 -0
- package/lowcode/table/meta.ts +26 -18
- package/lowcode/table/snippets.ts +2 -3
- package/package.json +3 -3
- package/dist/umd/materials.min.css +0 -1
- package/dist/umd/materials.min.js +0 -1
- package/dist/umd/static/DotsSix.57d66266.svg +0 -1
- package/dist/umd/static/arrow-left.e542294f.svg +0 -1
- package/dist/umd/static/arrow-right.763f03e0.svg +0 -1
- package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
- package/dist/umd/static/help-circle.31c9be40.svg +0 -1
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +0 -1
|
@@ -10,47 +10,31 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import { useRequest } from
|
|
14
|
-
import { Spin, Table } from
|
|
15
|
-
import React, { useEffect, useRef, useState } from
|
|
13
|
+
import { useRequest } from 'ahooks';
|
|
14
|
+
import { Spin, Table } from 'antd';
|
|
15
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
16
16
|
import useEngineContext from "../../../../../../../hooks/useEngineContext";
|
|
17
17
|
import { getText } from "../../../../../../../locales/index";
|
|
18
|
-
import {
|
|
19
|
-
import { defaultOptions } from "../../../../../status";
|
|
18
|
+
import { getImportLog } from "../../../../../serve";
|
|
20
19
|
import { request } from "../../../../../utils";
|
|
21
20
|
import { formatDate } from "../../utils/date";
|
|
22
21
|
import Detail from "./Detail";
|
|
23
22
|
import "./index.less";
|
|
24
23
|
var defaultData = {
|
|
25
|
-
type: defaultOptions.importValue,
|
|
26
24
|
skip: 1,
|
|
27
25
|
num: 10
|
|
28
26
|
};
|
|
29
27
|
var ImportLog = function ImportLog(props) {
|
|
30
28
|
var exportImport = props.exportImport;
|
|
31
|
-
var
|
|
32
|
-
|
|
29
|
+
var apiUrl = exportImport.apiUrl,
|
|
30
|
+
otherParams = exportImport.otherParams;
|
|
33
31
|
var detailRef = useRef(null);
|
|
34
32
|
var _useState = useState([]),
|
|
35
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
34
|
list = _useState2[0],
|
|
37
35
|
setList = _useState2[1];
|
|
38
|
-
var _useState3 = useState(defaultData),
|
|
39
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
-
defaultParams = _useState4[0],
|
|
41
|
-
setDefaultParams = _useState4[1];
|
|
42
36
|
var context = useEngineContext();
|
|
43
37
|
request.setRequest(context.appHelper.utils.request);
|
|
44
|
-
useEffect(function () {
|
|
45
|
-
var params = {};
|
|
46
|
-
if (formId) {
|
|
47
|
-
params.form_id = formId;
|
|
48
|
-
}
|
|
49
|
-
if (formCode) {
|
|
50
|
-
params.code = formCode;
|
|
51
|
-
}
|
|
52
|
-
setDefaultParams(_objectSpread(_objectSpread({}, defaultParams), params));
|
|
53
|
-
}, [formId, formCode]);
|
|
54
38
|
|
|
55
39
|
/**
|
|
56
40
|
* @title: 导入日志
|
|
@@ -59,7 +43,7 @@ var ImportLog = function ImportLog(props) {
|
|
|
59
43
|
* @Author: WangHan
|
|
60
44
|
* @Date: 2024-06-29 15:14
|
|
61
45
|
*/
|
|
62
|
-
var _historyList = useRequest(
|
|
46
|
+
var _historyList = useRequest(getImportLog, {
|
|
63
47
|
manual: true,
|
|
64
48
|
onSuccess: function onSuccess(res) {
|
|
65
49
|
if (res.code == 200) {
|
|
@@ -69,24 +53,25 @@ var ImportLog = function ImportLog(props) {
|
|
|
69
53
|
}
|
|
70
54
|
});
|
|
71
55
|
var init = function init() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
56
|
+
var _defaultParams = _objectSpread(_objectSpread(_objectSpread({}, defaultData), otherParams), {}, {
|
|
57
|
+
url: apiUrl === null || apiUrl === void 0 ? void 0 : apiUrl.import_log
|
|
58
|
+
});
|
|
59
|
+
_historyList.run(_defaultParams);
|
|
75
60
|
};
|
|
76
61
|
useEffect(function () {
|
|
77
62
|
init();
|
|
78
|
-
}, [
|
|
63
|
+
}, [exportImport]);
|
|
79
64
|
var columns = [{
|
|
80
|
-
title: getText(
|
|
81
|
-
dataIndex:
|
|
65
|
+
title: getText('table-action-export-import-log-name'),
|
|
66
|
+
dataIndex: 'file_name'
|
|
82
67
|
}, {
|
|
83
|
-
title: getText(
|
|
84
|
-
dataIndex:
|
|
68
|
+
title: getText('table-action-export-import-log-result'),
|
|
69
|
+
dataIndex: 'result',
|
|
85
70
|
render: function render(text, record) {
|
|
86
71
|
var _record$result;
|
|
87
|
-
return /*#__PURE__*/React.createElement("div", null, getText(
|
|
72
|
+
return /*#__PURE__*/React.createElement("div", null, getText('table-action-export-import-log-ok')((text === null || text === void 0 ? void 0 : text.success) || 0), record !== null && record !== void 0 && (_record$result = record.result) !== null && _record$result !== void 0 && _record$result.fail ? getText('table-action-export-import-log-err')((text === null || text === void 0 ? void 0 : text.fail) || 0) : null, text !== null && text !== void 0 && text.fail ? /*#__PURE__*/React.createElement("a", {
|
|
88
73
|
style: {
|
|
89
|
-
marginLeft:
|
|
74
|
+
marginLeft: '10px'
|
|
90
75
|
},
|
|
91
76
|
onClick: function onClick() {
|
|
92
77
|
var _detailRef$current, _detailRef$current$op;
|
|
@@ -94,32 +79,32 @@ var ImportLog = function ImportLog(props) {
|
|
|
94
79
|
list: [record]
|
|
95
80
|
});
|
|
96
81
|
}
|
|
97
|
-
}, getText(
|
|
82
|
+
}, getText('table-action-export-import-log-check')) : null);
|
|
98
83
|
}
|
|
99
84
|
}, {
|
|
100
|
-
title: getText(
|
|
101
|
-
dataIndex:
|
|
85
|
+
title: getText('table-action-export-import-file-account'),
|
|
86
|
+
dataIndex: 'account',
|
|
102
87
|
render: function render(text) {
|
|
103
|
-
return text ? /*#__PURE__*/React.createElement("div", null, "".concat((text === null || text === void 0 ? void 0 : text.first_name) ||
|
|
88
|
+
return text ? /*#__PURE__*/React.createElement("div", null, "".concat((text === null || text === void 0 ? void 0 : text.first_name) || '', " ").concat((text === null || text === void 0 ? void 0 : text.last_name) || '')) : null;
|
|
104
89
|
}
|
|
105
90
|
}, {
|
|
106
|
-
title: getText(
|
|
107
|
-
dataIndex:
|
|
91
|
+
title: getText('table-action-export-import-file-created'),
|
|
92
|
+
dataIndex: 'created_at',
|
|
108
93
|
render: function render(text) {
|
|
109
94
|
return formatDate(text);
|
|
110
95
|
}
|
|
111
96
|
}];
|
|
112
97
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
113
|
-
className:
|
|
98
|
+
className: 'export-history-content'
|
|
114
99
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
115
100
|
spinning: _historyList === null || _historyList === void 0 ? void 0 : _historyList.loading
|
|
116
101
|
}, /*#__PURE__*/React.createElement("div", {
|
|
117
|
-
className:
|
|
118
|
-
}, getText(
|
|
102
|
+
className: 'content-hint'
|
|
103
|
+
}, getText('table-action-export-import-log-hint'), /*#__PURE__*/React.createElement("a", {
|
|
119
104
|
onClick: function onClick() {
|
|
120
105
|
return init();
|
|
121
106
|
}
|
|
122
|
-
}, getText(
|
|
107
|
+
}, getText('table-action-export-import-file-refresh'))), /*#__PURE__*/React.createElement(Table, {
|
|
123
108
|
rowClassName: "antd-table-row",
|
|
124
109
|
columns: columns,
|
|
125
110
|
dataSource: list,
|
package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { ExportImportType } from
|
|
3
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExportImportType } from '../../../../../types';
|
|
3
|
+
import './index.less';
|
|
4
4
|
declare type ImportTableProps = {
|
|
5
5
|
onChange: any;
|
|
6
6
|
exportImport: ExportImportType;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
9
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -8,9 +13,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
14
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import { InboxOutlined } from
|
|
12
|
-
import { Button, message } from
|
|
13
|
-
import React, { useMemo, useState } from
|
|
16
|
+
import { InboxOutlined } from '@ant-design/icons';
|
|
17
|
+
import { Button, message } from 'antd';
|
|
18
|
+
import React, { useMemo, useState } from 'react';
|
|
14
19
|
import useEngineContext from "../../../../../../../hooks/useEngineContext";
|
|
15
20
|
import { getText } from "../../../../../../../locales/index";
|
|
16
21
|
import IconFont from "../../../../../../iconfont";
|
|
@@ -24,9 +29,9 @@ var ImportTable = function ImportTable(props) {
|
|
|
24
29
|
var onChange = props.onChange,
|
|
25
30
|
exportImport = props.exportImport,
|
|
26
31
|
errorStatus = props.errorStatus;
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
var templateFileUrl = exportImport.templateFileUrl,
|
|
33
|
+
apiUrl = exportImport.apiUrl,
|
|
34
|
+
otherParams = exportImport.otherParams;
|
|
30
35
|
|
|
31
36
|
// 当前上传列表
|
|
32
37
|
var _useState = useState(null),
|
|
@@ -48,32 +53,28 @@ var ImportTable = function ImportTable(props) {
|
|
|
48
53
|
break;
|
|
49
54
|
}
|
|
50
55
|
download(templateFileUrl);
|
|
51
|
-
_context.next =
|
|
56
|
+
_context.next = 11;
|
|
52
57
|
break;
|
|
53
58
|
case 4:
|
|
54
59
|
message.loading({
|
|
55
|
-
content:
|
|
60
|
+
content: 'Loading...',
|
|
56
61
|
key: loadingKey
|
|
57
62
|
});
|
|
58
|
-
params = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (formCode) {
|
|
63
|
-
params.code = formCode;
|
|
64
|
-
}
|
|
65
|
-
_context.next = 10;
|
|
63
|
+
params = _objectSpread({
|
|
64
|
+
url: apiUrl === null || apiUrl === void 0 ? void 0 : apiUrl.template
|
|
65
|
+
}, otherParams);
|
|
66
|
+
_context.next = 8;
|
|
66
67
|
return importTemplate(params);
|
|
67
|
-
case
|
|
68
|
+
case 8:
|
|
68
69
|
_yield$importTemplate = _context.sent;
|
|
69
70
|
data = _yield$importTemplate.data;
|
|
70
71
|
download(data === null || data === void 0 ? void 0 : data.url);
|
|
71
|
-
case
|
|
72
|
+
case 11:
|
|
72
73
|
message.success({
|
|
73
|
-
content: getText(
|
|
74
|
+
content: getText('table-action-export-import-table-success-download'),
|
|
74
75
|
key: loadingKey
|
|
75
76
|
});
|
|
76
|
-
case
|
|
77
|
+
case 12:
|
|
77
78
|
case "end":
|
|
78
79
|
return _context.stop();
|
|
79
80
|
}
|
|
@@ -85,62 +86,62 @@ var ImportTable = function ImportTable(props) {
|
|
|
85
86
|
}();
|
|
86
87
|
var fileType = useMemo(function () {
|
|
87
88
|
if (file) {
|
|
88
|
-
return file.type.indexOf(
|
|
89
|
+
return file.type.indexOf('/csv') !== -1 ? 'csv' : 'excel';
|
|
89
90
|
}
|
|
90
|
-
return
|
|
91
|
+
return '';
|
|
91
92
|
}, [file]);
|
|
92
93
|
var fileName = useMemo(function () {
|
|
93
94
|
if (file) {
|
|
94
95
|
return file.name;
|
|
95
96
|
}
|
|
96
|
-
return
|
|
97
|
+
return '';
|
|
97
98
|
}, [file]);
|
|
98
99
|
var _handleSelectFile = function _handleSelectFile(e) {
|
|
99
100
|
var _e$target;
|
|
100
101
|
var _file = e !== null && e !== void 0 && (_e$target = e.target) !== null && _e$target !== void 0 && _e$target.files ? e.target.files[0] : null;
|
|
101
102
|
if (_file) {
|
|
102
|
-
if (_file.name.indexOf(
|
|
103
|
-
return message.error(getText(
|
|
103
|
+
if (_file.name.indexOf('.csv') === -1 && _file.name.indexOf('.xls') === -1 && _file.name.indexOf('.xlsx') === -1) {
|
|
104
|
+
return message.error(getText('table-action-export-import-table-error-file'));
|
|
104
105
|
}
|
|
105
106
|
onChange(_file);
|
|
106
107
|
setFile(_file);
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
110
|
return /*#__PURE__*/React.createElement(React.Fragment, null, errorStatus ? /*#__PURE__*/React.createElement("div", {
|
|
110
|
-
className:
|
|
111
|
+
className: 'error-hint'
|
|
111
112
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
112
113
|
type: "icontixingshixin",
|
|
113
|
-
className:
|
|
114
|
+
className: 'error-icon'
|
|
114
115
|
}), /*#__PURE__*/React.createElement("div", {
|
|
115
|
-
className:
|
|
116
|
+
className: 'text'
|
|
116
117
|
}, errorStatus)) : null, /*#__PURE__*/React.createElement("div", {
|
|
117
|
-
className:
|
|
118
|
-
}, getText(
|
|
118
|
+
className: 'import-title'
|
|
119
|
+
}, getText('table-action-export-import-table-text-click-download'), /*#__PURE__*/React.createElement("a", {
|
|
119
120
|
onClick: handleDownload
|
|
120
|
-
}, getText(
|
|
121
|
-
className:
|
|
121
|
+
}, getText('table-action-export-import-table-text-product-template'))), file ? /*#__PURE__*/React.createElement("div", {
|
|
122
|
+
className: 'file-list'
|
|
122
123
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
123
|
-
type: fileType ===
|
|
124
|
-
className:
|
|
124
|
+
type: fileType === 'csv' ? 'icon-csv' : 'icon-excel',
|
|
125
|
+
className: 'file-icon'
|
|
125
126
|
}), /*#__PURE__*/React.createElement("div", {
|
|
126
|
-
className:
|
|
127
|
-
}, fileName), /*#__PURE__*/React.createElement(Button, null, getText(
|
|
127
|
+
className: 'file-name'
|
|
128
|
+
}, fileName), /*#__PURE__*/React.createElement(Button, null, getText('table-action-export-import-table-text-edit-file'), /*#__PURE__*/React.createElement("input", {
|
|
128
129
|
accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
|
|
129
|
-
className:
|
|
130
|
+
className: 'upload-input',
|
|
130
131
|
type: "file",
|
|
131
132
|
onChange: _handleSelectFile,
|
|
132
133
|
value: ""
|
|
133
134
|
}))) : /*#__PURE__*/React.createElement("div", {
|
|
134
|
-
className:
|
|
135
|
+
className: 'default-view'
|
|
135
136
|
}, /*#__PURE__*/React.createElement("div", {
|
|
136
|
-
className:
|
|
137
|
+
className: 'icon-wrap'
|
|
137
138
|
}, /*#__PURE__*/React.createElement(InboxOutlined, null)), /*#__PURE__*/React.createElement("p", {
|
|
138
|
-
className:
|
|
139
|
-
}, getText(
|
|
140
|
-
className:
|
|
141
|
-
}, getText(
|
|
139
|
+
className: 'text'
|
|
140
|
+
}, getText('table-action-export-import-table-text-input-title')), /*#__PURE__*/React.createElement("p", {
|
|
141
|
+
className: 'hint'
|
|
142
|
+
}, getText('table-action-export-import-table-text-input-describe')), /*#__PURE__*/React.createElement("input", {
|
|
142
143
|
accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
|
|
143
|
-
className:
|
|
144
|
+
className: 'upload-input',
|
|
144
145
|
type: "file",
|
|
145
146
|
onChange: _handleSelectFile,
|
|
146
147
|
value: ""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { ExportImportType } from
|
|
3
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExportImportType } from '../../../types';
|
|
3
|
+
import './index.less';
|
|
4
4
|
declare type ExportImportProps = {
|
|
5
5
|
exportImport: ExportImportType;
|
|
6
6
|
};
|
|
@@ -8,10 +8,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import ImportExport from
|
|
12
|
-
import { useRequest } from
|
|
13
|
-
import { Dropdown, Modal, message } from
|
|
14
|
-
import React, { useMemo, useState } from
|
|
11
|
+
import ImportExport from '@pisell/icon/es/ImportExport';
|
|
12
|
+
import { useRequest } from 'ahooks';
|
|
13
|
+
import { Dropdown, Modal, message } from 'antd';
|
|
14
|
+
import React, { useMemo, useState } from 'react';
|
|
15
15
|
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
16
16
|
import { getText } from "../../../../../locales/index";
|
|
17
17
|
import { batchImport } from "../../../serve";
|
|
@@ -47,7 +47,7 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
47
47
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
48
48
|
type = _useState6[0],
|
|
49
49
|
setType = _useState6[1];
|
|
50
|
-
var _useState7 = useState(
|
|
50
|
+
var _useState7 = useState(''),
|
|
51
51
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
52
52
|
value = _useState8[0],
|
|
53
53
|
setValue = _useState8[1];
|
|
@@ -62,22 +62,28 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
62
62
|
var context = useEngineContext();
|
|
63
63
|
request.setRequest(context.appHelper.utils.request);
|
|
64
64
|
var _items = useMemo(function () {
|
|
65
|
+
var _Object$entries$map;
|
|
65
66
|
// 将对象转成数组
|
|
66
|
-
var result = Object.entries(exportImportOptions).map(function (_ref2) {
|
|
67
|
+
var result = (_Object$entries$map = Object.entries(exportImportOptions).map(function (_ref2) {
|
|
68
|
+
var _exportImport$hiddenK;
|
|
67
69
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
68
70
|
key = _ref3[0],
|
|
69
71
|
value = _ref3[1];
|
|
72
|
+
// 如果开启了隐藏字段则不显示该字段
|
|
73
|
+
if (Array.isArray(exportImport === null || exportImport === void 0 ? void 0 : exportImport.hiddenKeys) && exportImport !== null && exportImport !== void 0 && (_exportImport$hiddenK = exportImport.hiddenKeys) !== null && _exportImport$hiddenK !== void 0 && _exportImport$hiddenK.includes(key)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
70
76
|
return {
|
|
71
77
|
key: key,
|
|
72
78
|
label: value
|
|
73
79
|
};
|
|
74
|
-
});
|
|
80
|
+
})) === null || _Object$entries$map === void 0 ? void 0 : _Object$entries$map.filter(Boolean);
|
|
75
81
|
return result;
|
|
76
|
-
}, []);
|
|
82
|
+
}, [exportImport === null || exportImport === void 0 ? void 0 : exportImport.hiddenKeys]);
|
|
77
83
|
var Content = useMemo(function () {
|
|
78
|
-
|
|
79
|
-
return Com[
|
|
80
|
-
}, [value]);
|
|
84
|
+
var _value = value || defaultOptions.importValue;
|
|
85
|
+
return Com[_value];
|
|
86
|
+
}, [value, defaultOptions.importValue]);
|
|
81
87
|
var _footer = useMemo(function () {
|
|
82
88
|
var types = defaultOptions.footerHintTypes;
|
|
83
89
|
if (types.includes(value)) {
|
|
@@ -92,18 +98,18 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
92
98
|
if (!value) return null;
|
|
93
99
|
var types = defaultOptions.okShowButtonTypes;
|
|
94
100
|
var lang = getCurrentLocale();
|
|
95
|
-
var isEn = lang ===
|
|
101
|
+
var isEn = lang === 'en-US' || lang === 'en';
|
|
96
102
|
|
|
97
103
|
// 导出导入标题
|
|
98
104
|
if (types.includes(value) && exportImport !== null && exportImport !== void 0 && exportImport.title) {
|
|
99
|
-
return "".concat(exportImportOptions[value]).concat(isEn ?
|
|
105
|
+
return "".concat(exportImportOptions[value]).concat(isEn ? ' ' : '').concat(exportImport.title);
|
|
100
106
|
}
|
|
101
107
|
return exportImportOptions[value];
|
|
102
108
|
}, [value, exportImport === null || exportImport === void 0 ? void 0 : exportImport.title]);
|
|
103
109
|
var _okText = useMemo(function () {
|
|
104
110
|
var types = defaultOptions.okShowButtonTypes;
|
|
105
111
|
if (types.includes(value)) {
|
|
106
|
-
return value === defaultOptions.exportValue ? getText(
|
|
112
|
+
return value === defaultOptions.exportValue ? getText('table-action-export-import-button') : getText('table-action-export-import-button-import');
|
|
107
113
|
}
|
|
108
114
|
}, [value]);
|
|
109
115
|
var handleClick = function handleClick(e) {
|
|
@@ -113,7 +119,7 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
113
119
|
};
|
|
114
120
|
var onCancel = function onCancel() {
|
|
115
121
|
setOpen(false);
|
|
116
|
-
setValue(
|
|
122
|
+
setValue('');
|
|
117
123
|
setFile(null);
|
|
118
124
|
setErrorStatus(null);
|
|
119
125
|
setType(defaultOptions.exportType);
|
|
@@ -125,7 +131,7 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
125
131
|
setErrorStatus(null);
|
|
126
132
|
message.destroy();
|
|
127
133
|
message.success({
|
|
128
|
-
content: getText(
|
|
134
|
+
content: getText('table-action-export-import-import-success'),
|
|
129
135
|
key: value
|
|
130
136
|
});
|
|
131
137
|
onCancel();
|
|
@@ -137,11 +143,11 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
137
143
|
});
|
|
138
144
|
var onOk = /*#__PURE__*/function () {
|
|
139
145
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
140
|
-
var
|
|
146
|
+
var apiUrl, otherParams, _params, result, formData, formId, formCode;
|
|
141
147
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
142
148
|
while (1) switch (_context.prev = _context.next) {
|
|
143
149
|
case 0:
|
|
144
|
-
|
|
150
|
+
apiUrl = exportImport.apiUrl, otherParams = exportImport.otherParams; // 导出
|
|
145
151
|
if (!(value === defaultOptions.exportValue)) {
|
|
146
152
|
_context.next = 9;
|
|
147
153
|
break;
|
|
@@ -163,16 +169,19 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
163
169
|
case 9:
|
|
164
170
|
if (value === defaultOptions.importValue) {
|
|
165
171
|
formData = new FormData();
|
|
166
|
-
formData.append(
|
|
172
|
+
formData.append('file', file);
|
|
173
|
+
formId = otherParams === null || otherParams === void 0 ? void 0 : otherParams.form_id;
|
|
174
|
+
formCode = otherParams === null || otherParams === void 0 ? void 0 : otherParams.code;
|
|
167
175
|
if (formId) {
|
|
168
|
-
formData.append(
|
|
176
|
+
formData.append('form_id', formId);
|
|
169
177
|
}
|
|
170
178
|
if (formCode) {
|
|
171
|
-
formData.append(
|
|
179
|
+
formData.append('code', formCode);
|
|
172
180
|
}
|
|
181
|
+
formData.append('url', (apiUrl === null || apiUrl === void 0 ? void 0 : apiUrl.export) || '');
|
|
173
182
|
if (formData) {
|
|
174
183
|
message.loading({
|
|
175
|
-
content:
|
|
184
|
+
content: 'Loading...',
|
|
176
185
|
key: value
|
|
177
186
|
});
|
|
178
187
|
_batchImport.run(formData);
|
|
@@ -199,7 +208,7 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
199
208
|
isActive: false
|
|
200
209
|
}, /*#__PURE__*/React.createElement(ImportExport, {
|
|
201
210
|
style: {
|
|
202
|
-
cursor:
|
|
211
|
+
cursor: 'pointer',
|
|
203
212
|
fontSize: 20
|
|
204
213
|
}
|
|
205
214
|
}))), /*#__PURE__*/React.createElement(Modal, {
|
|
@@ -211,11 +220,11 @@ var ExportImport = function ExportImport(_ref) {
|
|
|
211
220
|
className: "export-import-modal",
|
|
212
221
|
onCancel: onCancel,
|
|
213
222
|
bodyStyle: {
|
|
214
|
-
padding:
|
|
223
|
+
padding: '0px'
|
|
215
224
|
},
|
|
216
225
|
destroyOnClose: true,
|
|
217
226
|
onOk: onOk,
|
|
218
|
-
cancelText: getText(
|
|
227
|
+
cancelText: getText('table-action-export-import-cancel'),
|
|
219
228
|
okButtonProps: {
|
|
220
229
|
disabled: value === defaultOptions.importValue && (!file || !!errorStatus)
|
|
221
230
|
}
|
|
@@ -84,7 +84,6 @@ var BasicTable = function BasicTable(props) {
|
|
|
84
84
|
total: _total
|
|
85
85
|
};
|
|
86
86
|
}, [localPagination, dataSource, formPagination === null || formPagination === void 0 ? void 0 : formPagination.page, formPagination === null || formPagination === void 0 ? void 0 : formPagination.size, filter, sort, other.columns]);
|
|
87
|
-
console.log(pagination, 'wh8888');
|
|
88
87
|
|
|
89
88
|
// 总数
|
|
90
89
|
var total = useMemo(function () {
|
|
@@ -110,7 +109,7 @@ var BasicTable = function BasicTable(props) {
|
|
|
110
109
|
type: 'setCurrentDataSource',
|
|
111
110
|
payload: (_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list) || []
|
|
112
111
|
});
|
|
113
|
-
}, [_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list]);
|
|
112
|
+
}, [JSON.stringify(_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list)]);
|
|
114
113
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, _extends({
|
|
115
114
|
key: defaultExpandedRowKeys.join('-')
|
|
116
115
|
}, other, {
|
|
@@ -140,7 +139,10 @@ var BasicTable = function BasicTable(props) {
|
|
|
140
139
|
defaultExpandAllRows: true
|
|
141
140
|
}
|
|
142
141
|
})), total > ((pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || (pagination === null || pagination === void 0 ? void 0 : (_pagination$pageSizeO = pagination.pageSizeOptions) === null || _pagination$pageSizeO === void 0 ? void 0 : _pagination$pageSizeO[0]) || 10) || pagination !== null && pagination !== void 0 && pagination.showPagination && total > 10 ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
143
|
-
name: "pagination"
|
|
142
|
+
name: "pagination",
|
|
143
|
+
style: {
|
|
144
|
+
margin: 0
|
|
145
|
+
}
|
|
144
146
|
}, /*#__PURE__*/React.createElement(FormPagination, _extends({}, pagination, {
|
|
145
147
|
showTotal: _showTotal,
|
|
146
148
|
total: total
|
|
@@ -46,7 +46,8 @@ var Gallery = function Gallery(props) {
|
|
|
46
46
|
form: form,
|
|
47
47
|
localPagination: !!(pagination !== null && pagination !== void 0 && pagination.localPagination),
|
|
48
48
|
rowKey: rowKey,
|
|
49
|
-
filter: filter
|
|
49
|
+
filter: filter,
|
|
50
|
+
currentView: 'gallery'
|
|
50
51
|
});
|
|
51
52
|
useEffect(function () {
|
|
52
53
|
onDataSourceChange === null || onDataSourceChange === void 0 ? void 0 : onDataSourceChange(dataSource);
|