@luck-design-biz/luckda 0.0.22-3 → 0.0.22-4
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.
|
@@ -5,14 +5,14 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
5
5
|
var _excluded = ["formId", "formRef", "showNote", "operates", "loading", "uploadUrl", "forbiddenTypes", "beforeUpload", "formMode", "onUploadChange", "zipName", "resetActions", "getUrl", "wrapperRef"];
|
|
6
6
|
import React, { useState, useRef, forwardRef } from 'react';
|
|
7
7
|
import { getDvaApp } from 'umi';
|
|
8
|
-
import { useMemoizedFn } from 'ahooks';
|
|
8
|
+
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
9
9
|
import { Button, Upload, Tooltip, Icon } from 'luck-design/antd';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import { last } from 'lodash';
|
|
12
12
|
import { BasicForm, BasicFormItem, PopWindow } from 'luck-design';
|
|
13
13
|
import api from "@/services/ApiConfig";
|
|
14
14
|
import { FormBtn, GridForm } from '@luck-design-biz/base/FormList';
|
|
15
|
-
import { byteConvert, formatMessage, beforeUpload as _beforeUpload2, patchDownloadZip, showPop, request, canPreview } from '@luck-design-biz/base/utils';
|
|
15
|
+
import { byteConvert, formatMessage, beforeUpload as _beforeUpload2, getSupportUploadTypes, patchDownloadZip, showPop, request, canPreview } from '@luck-design-biz/base/utils';
|
|
16
16
|
var columns = [{
|
|
17
17
|
field: 'name',
|
|
18
18
|
title: '附件名称'
|
|
@@ -77,6 +77,9 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
77
77
|
var gridRef = wrapperRef || useRef(null);
|
|
78
78
|
var _getDvaApp$_store$get = (_getDvaApp = getDvaApp()) === null || _getDvaApp === void 0 ? void 0 : _getDvaApp._store.getState().user,
|
|
79
79
|
currentUser = _getDvaApp$_store$get.currentUser;
|
|
80
|
+
var supportUploadTypes = useCreation(function () {
|
|
81
|
+
return getSupportUploadTypes(forbiddenTypes);
|
|
82
|
+
}, [forbiddenTypes]);
|
|
80
83
|
|
|
81
84
|
// 下载
|
|
82
85
|
var downloadFile = function downloadFile(filenames, tag) {
|
|
@@ -209,7 +212,7 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
209
212
|
var upload = _beforeUpload2({
|
|
210
213
|
file: file,
|
|
211
214
|
fileList: fileList,
|
|
212
|
-
|
|
215
|
+
supportUploadTypes: supportUploadTypes,
|
|
213
216
|
beforeUpload: _beforeUpload
|
|
214
217
|
});
|
|
215
218
|
if (!upload) setUploadLoading(false);
|
|
@@ -232,7 +235,15 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
232
235
|
}, formatMessage({
|
|
233
236
|
id: 'app.base.operate.add',
|
|
234
237
|
label: '添加'
|
|
235
|
-
})) : /*#__PURE__*/React.createElement(
|
|
238
|
+
})) : /*#__PURE__*/React.createElement(Tooltip, {
|
|
239
|
+
title: "".concat(formatMessage({
|
|
240
|
+
id: 'app.upload.supportUpload',
|
|
241
|
+
label: '支持上传'
|
|
242
|
+
})).concat(supportUploadTypes.join(',')).concat(formatMessage({
|
|
243
|
+
id: 'app.upload.supportUpload.type',
|
|
244
|
+
label: '类型的文件'
|
|
245
|
+
}))
|
|
246
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormBtn, {
|
|
236
247
|
formId: "formId"
|
|
237
248
|
}, /*#__PURE__*/React.createElement(Upload, formItemProps, /*#__PURE__*/React.createElement(Button, {
|
|
238
249
|
type: "primary",
|
|
@@ -243,7 +254,7 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
243
254
|
}, formatMessage({
|
|
244
255
|
id: 'app.base.operate.add',
|
|
245
256
|
label: '添加'
|
|
246
|
-
}))))), /*#__PURE__*/React.createElement(Button, {
|
|
257
|
+
}))))))), /*#__PURE__*/React.createElement(Button, {
|
|
247
258
|
type: "primary",
|
|
248
259
|
onClick: function onClick() {
|
|
249
260
|
var _gridRef$current$form;
|
|
@@ -348,6 +359,13 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
348
359
|
type: "upload",
|
|
349
360
|
name: "files",
|
|
350
361
|
label: "\u9644\u4EF6",
|
|
362
|
+
extra: "".concat(formatMessage({
|
|
363
|
+
id: 'app.upload.supportUpload',
|
|
364
|
+
label: '支持上传'
|
|
365
|
+
})).concat(supportUploadTypes.join(',')).concat(formatMessage({
|
|
366
|
+
id: 'app.upload.supportUpload.type',
|
|
367
|
+
label: '类型的文件'
|
|
368
|
+
})),
|
|
351
369
|
config: _objectSpread(_objectSpread({}, rest), {}, {
|
|
352
370
|
required: true,
|
|
353
371
|
message: '请上传',
|
|
@@ -359,7 +377,7 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
359
377
|
return _beforeUpload2({
|
|
360
378
|
file: file,
|
|
361
379
|
fileList: fileList,
|
|
362
|
-
|
|
380
|
+
supportUploadTypes: supportUploadTypes,
|
|
363
381
|
beforeUpload: _beforeUpload
|
|
364
382
|
});
|
|
365
383
|
}
|
|
@@ -4,7 +4,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
4
4
|
var _excluded = ["uploadUrl", "moduleCode", "bucket", "tag", "note", "config", "forbiddenTypes", "children", "dataFormat", "listType"];
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { BasicFormItem } from 'luck-design';
|
|
7
|
-
import { formatMessage, beforeUpload as _beforeUpload } from '@luck-design-biz/base/utils';
|
|
7
|
+
import { formatMessage, beforeUpload as _beforeUpload, getSupportUploadTypes } from '@luck-design-biz/base/utils';
|
|
8
|
+
import { useCreation } from 'ahooks';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* 表单类型富文本上传
|
|
@@ -42,7 +43,18 @@ function buildComponent(props) {
|
|
|
42
43
|
var getUrl = function getUrl(behaviorKey) {
|
|
43
44
|
return "".concat(window.appConfig.OSS_HOST_V3, "?moduleCode=").concat(moduleCode, "&behaviorKey=").concat(behaviorKey, "&bucket=").concat(bucket, "&tag=").concat(tag, "¬e=").concat(note);
|
|
44
45
|
};
|
|
45
|
-
|
|
46
|
+
var supportUploadTypes = useCreation(function () {
|
|
47
|
+
return getSupportUploadTypes(forbiddenTypes);
|
|
48
|
+
}, [forbiddenTypes]);
|
|
49
|
+
return /*#__PURE__*/React.createElement(BasicFormItem, _extends({
|
|
50
|
+
extra: "".concat(formatMessage({
|
|
51
|
+
id: 'app.upload.supportUpload',
|
|
52
|
+
label: '支持上传'
|
|
53
|
+
})).concat(supportUploadTypes.join(',')).concat(formatMessage({
|
|
54
|
+
id: 'app.upload.supportUpload.type',
|
|
55
|
+
label: '类型的文件'
|
|
56
|
+
}))
|
|
57
|
+
}, rest, {
|
|
46
58
|
type: "uploadV3",
|
|
47
59
|
config: _objectSpread(_objectSpread({
|
|
48
60
|
required: false,
|
|
@@ -68,7 +80,7 @@ function buildComponent(props) {
|
|
|
68
80
|
return _beforeUpload({
|
|
69
81
|
file: file,
|
|
70
82
|
fileList: fileList,
|
|
71
|
-
|
|
83
|
+
supportUploadTypes: supportUploadTypes,
|
|
72
84
|
beforeUpload: config && config.beforeUpload
|
|
73
85
|
});
|
|
74
86
|
}
|
|
@@ -85,6 +85,9 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
85
85
|
var gridRef = wrapperRef || (0, _react.useRef)(null);
|
|
86
86
|
var _getDvaApp$_store$get = (_getDvaApp = (0, _umi.getDvaApp)()) === null || _getDvaApp === void 0 ? void 0 : _getDvaApp._store.getState().user,
|
|
87
87
|
currentUser = _getDvaApp$_store$get.currentUser;
|
|
88
|
+
var supportUploadTypes = (0, _ahooks.useCreation)(function () {
|
|
89
|
+
return (0, _utils.getSupportUploadTypes)(forbiddenTypes);
|
|
90
|
+
}, [forbiddenTypes]);
|
|
88
91
|
|
|
89
92
|
// 下载
|
|
90
93
|
var downloadFile = function downloadFile(filenames, tag) {
|
|
@@ -217,7 +220,7 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
217
220
|
var upload = (0, _utils.beforeUpload)({
|
|
218
221
|
file: file,
|
|
219
222
|
fileList: fileList,
|
|
220
|
-
|
|
223
|
+
supportUploadTypes: supportUploadTypes,
|
|
221
224
|
beforeUpload: _beforeUpload
|
|
222
225
|
});
|
|
223
226
|
if (!upload) setUploadLoading(false);
|
|
@@ -240,7 +243,15 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
240
243
|
}, (0, _utils.formatMessage)({
|
|
241
244
|
id: 'app.base.operate.add',
|
|
242
245
|
label: '添加'
|
|
243
|
-
})) : /*#__PURE__*/_react.default.createElement(
|
|
246
|
+
})) : /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
|
|
247
|
+
title: "".concat((0, _utils.formatMessage)({
|
|
248
|
+
id: 'app.upload.supportUpload',
|
|
249
|
+
label: '支持上传'
|
|
250
|
+
})).concat(supportUploadTypes.join(',')).concat((0, _utils.formatMessage)({
|
|
251
|
+
id: 'app.upload.supportUpload.type',
|
|
252
|
+
label: '类型的文件'
|
|
253
|
+
}))
|
|
254
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_FormList.FormBtn, {
|
|
244
255
|
formId: "formId"
|
|
245
256
|
}, /*#__PURE__*/_react.default.createElement(_antd.Upload, formItemProps, /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
246
257
|
type: "primary",
|
|
@@ -251,7 +262,7 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
251
262
|
}, (0, _utils.formatMessage)({
|
|
252
263
|
id: 'app.base.operate.add',
|
|
253
264
|
label: '添加'
|
|
254
|
-
}))))), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
265
|
+
}))))))), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
255
266
|
type: "primary",
|
|
256
267
|
onClick: function onClick() {
|
|
257
268
|
var _gridRef$current$form;
|
|
@@ -356,6 +367,13 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
356
367
|
type: "upload",
|
|
357
368
|
name: "files",
|
|
358
369
|
label: "\u9644\u4EF6",
|
|
370
|
+
extra: "".concat((0, _utils.formatMessage)({
|
|
371
|
+
id: 'app.upload.supportUpload',
|
|
372
|
+
label: '支持上传'
|
|
373
|
+
})).concat(supportUploadTypes.join(',')).concat((0, _utils.formatMessage)({
|
|
374
|
+
id: 'app.upload.supportUpload.type',
|
|
375
|
+
label: '类型的文件'
|
|
376
|
+
})),
|
|
359
377
|
config: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rest), {}, {
|
|
360
378
|
required: true,
|
|
361
379
|
message: '请上传',
|
|
@@ -367,7 +385,7 @@ var UploadGridForm = function UploadGridForm(_ref) {
|
|
|
367
385
|
return (0, _utils.beforeUpload)({
|
|
368
386
|
file: file,
|
|
369
387
|
fileList: fileList,
|
|
370
|
-
|
|
388
|
+
supportUploadTypes: supportUploadTypes,
|
|
371
389
|
beforeUpload: _beforeUpload
|
|
372
390
|
});
|
|
373
391
|
}
|
|
@@ -11,6 +11,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _luckDesign = require("luck-design");
|
|
13
13
|
var _utils = require("@luck-design-biz/base/utils");
|
|
14
|
+
var _ahooks = require("ahooks");
|
|
14
15
|
var _excluded = ["uploadUrl", "moduleCode", "bucket", "tag", "note", "config", "forbiddenTypes", "children", "dataFormat", "listType"];
|
|
15
16
|
/**
|
|
16
17
|
* 表单类型富文本上传
|
|
@@ -48,7 +49,18 @@ function buildComponent(props) {
|
|
|
48
49
|
var getUrl = function getUrl(behaviorKey) {
|
|
49
50
|
return "".concat(window.appConfig.OSS_HOST_V3, "?moduleCode=").concat(moduleCode, "&behaviorKey=").concat(behaviorKey, "&bucket=").concat(bucket, "&tag=").concat(tag, "¬e=").concat(note);
|
|
50
51
|
};
|
|
51
|
-
|
|
52
|
+
var supportUploadTypes = (0, _ahooks.useCreation)(function () {
|
|
53
|
+
return (0, _utils.getSupportUploadTypes)(forbiddenTypes);
|
|
54
|
+
}, [forbiddenTypes]);
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_luckDesign.BasicFormItem, (0, _extends2.default)({
|
|
56
|
+
extra: "".concat((0, _utils.formatMessage)({
|
|
57
|
+
id: 'app.upload.supportUpload',
|
|
58
|
+
label: '支持上传'
|
|
59
|
+
})).concat(supportUploadTypes.join(',')).concat((0, _utils.formatMessage)({
|
|
60
|
+
id: 'app.upload.supportUpload.type',
|
|
61
|
+
label: '类型的文件'
|
|
62
|
+
}))
|
|
63
|
+
}, rest, {
|
|
52
64
|
type: "uploadV3",
|
|
53
65
|
config: (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
54
66
|
required: false,
|
|
@@ -74,7 +86,7 @@ function buildComponent(props) {
|
|
|
74
86
|
return (0, _utils.beforeUpload)({
|
|
75
87
|
file: file,
|
|
76
88
|
fileList: fileList,
|
|
77
|
-
|
|
89
|
+
supportUploadTypes: supportUploadTypes,
|
|
78
90
|
beforeUpload: config && config.beforeUpload
|
|
79
91
|
});
|
|
80
92
|
}
|
package/package.json
CHANGED