fan-standard-comp 3.1.3 → 3.1.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.
- package/package.json +1 -1
- package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
- package/dist/fan-standard-comp.umd.js +0 -597
- package/dist/fonts/iconfont.eot +0 -0
- package/dist/fonts/iconfont.ttf +0 -0
- package/dist/fonts/iconfont.woff +0 -0
- package/es/ButtonGroup/ButtonList.d.ts +0 -2
- package/es/ButtonGroup/ButtonList.js +0 -37
- package/es/ButtonGroup/ButtonMenu.d.ts +0 -2
- package/es/ButtonGroup/ButtonMenu.js +0 -38
- package/es/ButtonGroup/PopConfirmTitle.d.ts +0 -9
- package/es/ButtonGroup/PopConfirmTitle.js +0 -37
- package/es/ButtonGroup/index.d.ts +0 -30
- package/es/ButtonGroup/index.js +0 -374
- package/es/ButtonGroup/style/index.less +0 -36
- package/es/DragContent/DragBar.js +0 -21
- package/es/DragContent/index.d.ts +0 -14
- package/es/DragContent/index.js +0 -173
- package/es/DragContent/index.less +0 -44
- package/es/FormComp/ChunkUploader/api.js +0 -76
- package/es/FormComp/ChunkUploader/index.js +0 -391
- package/es/FormComp/ChunkUploader/lib.js +0 -96
- package/es/FormComp/ChunkUploader/style/style.less +0 -3
- package/es/FormComp/ChunkUploader/upload-queue.class.js +0 -167
- package/es/FormComp/ChunkUploader/worker.js +0 -23
- package/es/FormComp/EditButton/index.d.ts +0 -26
- package/es/FormComp/EditButton/index.js +0 -140
- package/es/FormComp/FieldComponent/ReUpload.d.ts +0 -3
- package/es/FormComp/FieldComponent/ReUpload.js +0 -131
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +0 -251
- package/es/FormComp/FieldComponent/TitleNode.d.ts +0 -6
- package/es/FormComp/FieldComponent/TitleNode.js +0 -9
- package/es/FormComp/FieldComponent/index.d.ts +0 -38
- package/es/FormComp/FieldComponent/index.js +0 -413
- package/es/FormComp/FieldComponent/setReadonlyValues.js +0 -236
- package/es/FormComp/FieldComponent/style/index.less +0 -116
- package/es/FormComp/RenderItemGroup/index.d.ts +0 -37
- package/es/FormComp/RenderItemGroup/index.js +0 -234
- package/es/FormComp/Uploader/index.d.ts +0 -19
- package/es/FormComp/Uploader/index.js +0 -275
- package/es/FormComp/Uploader/style/index.less +0 -14
- package/es/FormComp/Uploader/util.d.ts +0 -8
- package/es/FormComp/Uploader/util.js +0 -38
- package/es/FormComp/VarTemplate/index.js +0 -293
- package/es/FormComp/index.d.ts +0 -1
- package/es/FormComp/index.js +0 -1
- package/es/NavLeafScroll/index.js +0 -379
- package/es/NavLeafScroll/style/index.less +0 -119
- package/es/RefactorTree/data.d.ts +0 -7
- package/es/RefactorTree/index.d.ts +0 -40
- package/es/RefactorTree/index.js +0 -167
- package/es/RefactorTree/indexTreeNode.d.ts +0 -39
- package/es/RefactorTree/indexTreeNode.js +0 -237
- package/es/RefactorTree/style/index.d.ts +0 -1
- package/es/RefactorTree/style/index.js +0 -1
- package/es/RefactorTree/style/index.less +0 -22
- package/es/RefactorTree/util.d.ts +0 -42
- package/es/RefactorTree/util.js +0 -187
- package/es/SpecIcon/fonts/demo.css +0 -539
- package/es/SpecIcon/fonts/demo_index.html +0 -1315
- package/es/SpecIcon/fonts/iconfont.css +0 -211
- package/es/SpecIcon/fonts/iconfont.eot +0 -0
- package/es/SpecIcon/fonts/iconfont.js +0 -41
- package/es/SpecIcon/fonts/iconfont.json +0 -352
- package/es/SpecIcon/fonts/iconfont.svg +0 -173
- package/es/SpecIcon/fonts/iconfont.ttf +0 -0
- package/es/SpecIcon/fonts/iconfont.woff +0 -0
- package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/es/SpecIcon/index.d.ts +0 -17
- package/es/SpecIcon/index.js +0 -77
- package/es/SpecIcon/style/iconfont.less +0 -213
- package/es/SpecIcon/style/index.less +0 -98
- package/es/SplitterLayout/Pane.d.ts +0 -13
- package/es/SplitterLayout/Pane.js +0 -36
- package/es/SplitterLayout/index.js +0 -375
- package/es/SplitterLayout/index.less +0 -58
- package/es/StandardContent/SplitterLayout/Pane.js +0 -50
- package/es/StandardContent/SplitterLayout/index.js +0 -374
- package/es/StandardContent/SplitterLayout/index.less +0 -58
- package/es/StandardContent/SubfieldContent.d.ts +0 -17
- package/es/StandardContent/SubfieldContent.js +0 -41
- package/es/StandardContent/WrapperContent.d.ts +0 -13
- package/es/StandardContent/WrapperContent.js +0 -29
- package/es/StandardContent/data.d.ts +0 -101
- package/es/StandardContent/style/index.less +0 -80
- package/es/StandardDragModal/index.d.ts +0 -11
- package/es/StandardDragModal/index.js +0 -30
- package/es/StandardFilter/index.d.ts +0 -35
- package/es/StandardFilter/index.js +0 -253
- package/es/StandardFilter/style/index.less +0 -62
- package/es/StandardForm/ActionList.js +0 -44
- package/es/StandardForm/StepForm.d.ts +0 -19
- package/es/StandardForm/StepForm.js +0 -267
- package/es/StandardForm/TabForm.d.ts +0 -19
- package/es/StandardForm/TabForm.js +0 -122
- package/es/StandardForm/index.d.ts +0 -32
- package/es/StandardForm/index.js +0 -170
- package/es/StandardForm/style/index.less +0 -58
- package/es/StandardModal/UpdateFormRef.js +0 -18
- package/es/StandardModal/index.d.ts +0 -44
- package/es/StandardModal/index.js +0 -495
- package/es/StandardModal/style/index.less +0 -50
- package/es/StandardPanel/index.d.ts +0 -28
- package/es/StandardPanel/index.js +0 -134
- package/es/StandardPanel/style/index.less +0 -135
- package/es/StandardTable/index.d.ts +0 -22
- package/es/StandardTable/index.js +0 -126
- package/es/StandardTable/style/index.d.ts +0 -1
- package/es/StandardTable/style/index.js +0 -1
- package/es/StandardTable/style/index.less +0 -206
- package/es/components/IconNode/index.d.ts +0 -16
- package/es/components/IconNode/index.js +0 -28
- package/es/components/index.d.ts +0 -2
- package/es/components/index.js +0 -2
- package/es/data/func.code.js +0 -112
- package/es/data/general.config.js +0 -172
- package/es/data/index.js +0 -3
- package/es/index.d.ts +0 -24
- package/es/index.js +0 -31
- package/es/styles/index.less +0 -0
- package/es/theme/spec-variable.less +0 -48
- package/es/utils/ValueFormat.js +0 -50
- package/es/utils/filterPermission.js +0 -111
- package/es/utils/getParentNodes.js +0 -215
- package/es/utils/index.js +0 -3
- package/lib/ButtonGroup/ButtonList.d.ts +0 -2
- package/lib/ButtonGroup/ButtonList.js +0 -55
- package/lib/ButtonGroup/ButtonMenu.d.ts +0 -2
- package/lib/ButtonGroup/ButtonMenu.js +0 -51
- package/lib/ButtonGroup/PopConfirmTitle.d.ts +0 -9
- package/lib/ButtonGroup/PopConfirmTitle.js +0 -48
- package/lib/ButtonGroup/index.d.ts +0 -30
- package/lib/ButtonGroup/index.js +0 -405
- package/lib/ButtonGroup/style/index.less +0 -36
- package/lib/DragContent/DragBar.js +0 -33
- package/lib/DragContent/index.d.ts +0 -14
- package/lib/DragContent/index.js +0 -191
- package/lib/DragContent/index.less +0 -44
- package/lib/FormComp/ChunkUploader/api.js +0 -89
- package/lib/FormComp/ChunkUploader/index.js +0 -410
- package/lib/FormComp/ChunkUploader/lib.js +0 -113
- package/lib/FormComp/ChunkUploader/style/style.less +0 -3
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +0 -174
- package/lib/FormComp/ChunkUploader/worker.js +0 -28
- package/lib/FormComp/EditButton/index.d.ts +0 -26
- package/lib/FormComp/EditButton/index.js +0 -159
- package/lib/FormComp/FieldComponent/ReUpload.d.ts +0 -3
- package/lib/FormComp/FieldComponent/ReUpload.js +0 -151
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +0 -274
- package/lib/FormComp/FieldComponent/TitleNode.d.ts +0 -6
- package/lib/FormComp/FieldComponent/TitleNode.js +0 -19
- package/lib/FormComp/FieldComponent/index.d.ts +0 -38
- package/lib/FormComp/FieldComponent/index.js +0 -457
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +0 -263
- package/lib/FormComp/FieldComponent/style/index.less +0 -116
- package/lib/FormComp/RenderItemGroup/index.d.ts +0 -37
- package/lib/FormComp/RenderItemGroup/index.js +0 -255
- package/lib/FormComp/Uploader/index.d.ts +0 -19
- package/lib/FormComp/Uploader/index.js +0 -301
- package/lib/FormComp/Uploader/style/index.less +0 -14
- package/lib/FormComp/Uploader/util.d.ts +0 -8
- package/lib/FormComp/Uploader/util.js +0 -47
- package/lib/FormComp/VarTemplate/index.js +0 -308
- package/lib/FormComp/index.d.ts +0 -1
- package/lib/FormComp/index.js +0 -15
- package/lib/NavLeafScroll/index.js +0 -397
- package/lib/NavLeafScroll/style/index.less +0 -119
- package/lib/RefactorTree/data.d.ts +0 -7
- package/lib/RefactorTree/index.d.ts +0 -40
- package/lib/RefactorTree/index.js +0 -190
- package/lib/RefactorTree/indexTreeNode.d.ts +0 -39
- package/lib/RefactorTree/indexTreeNode.js +0 -260
- package/lib/RefactorTree/style/index.d.ts +0 -1
- package/lib/RefactorTree/style/index.js +0 -3
- package/lib/RefactorTree/style/index.less +0 -22
- package/lib/RefactorTree/util.d.ts +0 -42
- package/lib/RefactorTree/util.js +0 -195
- package/lib/SpecIcon/fonts/demo.css +0 -539
- package/lib/SpecIcon/fonts/demo_index.html +0 -1315
- package/lib/SpecIcon/fonts/iconfont.css +0 -211
- package/lib/SpecIcon/fonts/iconfont.eot +0 -0
- package/lib/SpecIcon/fonts/iconfont.js +0 -43
- package/lib/SpecIcon/fonts/iconfont.json +0 -352
- package/lib/SpecIcon/fonts/iconfont.svg +0 -173
- package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/lib/SpecIcon/index.d.ts +0 -17
- package/lib/SpecIcon/index.js +0 -90
- package/lib/SpecIcon/style/iconfont.less +0 -213
- package/lib/SpecIcon/style/index.less +0 -98
- package/lib/SplitterLayout/Pane.d.ts +0 -13
- package/lib/SplitterLayout/Pane.js +0 -48
- package/lib/SplitterLayout/index.js +0 -386
- package/lib/SplitterLayout/index.less +0 -58
- package/lib/StandardContent/SplitterLayout/Pane.js +0 -62
- package/lib/StandardContent/SplitterLayout/index.js +0 -387
- package/lib/StandardContent/SplitterLayout/index.less +0 -58
- package/lib/StandardContent/SubfieldContent.d.ts +0 -17
- package/lib/StandardContent/SubfieldContent.js +0 -56
- package/lib/StandardContent/WrapperContent.d.ts +0 -13
- package/lib/StandardContent/WrapperContent.js +0 -43
- package/lib/StandardContent/data.d.ts +0 -101
- package/lib/StandardContent/style/index.less +0 -80
- package/lib/StandardDragModal/index.d.ts +0 -11
- package/lib/StandardDragModal/index.js +0 -43
- package/lib/StandardFilter/index.d.ts +0 -35
- package/lib/StandardFilter/index.js +0 -272
- package/lib/StandardFilter/style/index.less +0 -62
- package/lib/StandardForm/ActionList.js +0 -57
- package/lib/StandardForm/StepForm.d.ts +0 -19
- package/lib/StandardForm/StepForm.js +0 -295
- package/lib/StandardForm/TabForm.d.ts +0 -19
- package/lib/StandardForm/TabForm.js +0 -148
- package/lib/StandardForm/index.d.ts +0 -32
- package/lib/StandardForm/index.js +0 -197
- package/lib/StandardForm/style/index.less +0 -58
- package/lib/StandardModal/UpdateFormRef.js +0 -32
- package/lib/StandardModal/index.d.ts +0 -44
- package/lib/StandardModal/index.js +0 -525
- package/lib/StandardModal/style/index.less +0 -50
- package/lib/StandardPanel/index.d.ts +0 -28
- package/lib/StandardPanel/index.js +0 -155
- package/lib/StandardPanel/style/index.less +0 -135
- package/lib/StandardTable/index.d.ts +0 -22
- package/lib/StandardTable/index.js +0 -143
- package/lib/StandardTable/style/index.d.ts +0 -1
- package/lib/StandardTable/style/index.js +0 -3
- package/lib/StandardTable/style/index.less +0 -206
- package/lib/components/IconNode/index.d.ts +0 -16
- package/lib/components/IconNode/index.js +0 -39
- package/lib/components/index.d.ts +0 -2
- package/lib/components/index.js +0 -15
- package/lib/data/func.code.js +0 -119
- package/lib/data/general.config.js +0 -179
- package/lib/data/index.js +0 -23
- package/lib/index.d.ts +0 -24
- package/lib/index.js +0 -236
- package/lib/styles/index.less +0 -0
- package/lib/theme/spec-variable.less +0 -48
- package/lib/utils/ValueFormat.js +0 -58
- package/lib/utils/filterPermission.js +0 -127
- package/lib/utils/getParentNodes.js +0 -226
- package/lib/utils/index.js +0 -35
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
@root-entry-name: default;
|
|
2
|
-
@import (reference) '~antd/es/style/themes/index';
|
|
3
|
-
|
|
4
|
-
.refactor-tree-select {
|
|
5
|
-
position: relative;
|
|
6
|
-
.ant-select {
|
|
7
|
-
z-index: 2;
|
|
8
|
-
.ant-select-selector {
|
|
9
|
-
background: transparent;
|
|
10
|
-
}
|
|
11
|
-
.ant-select-selection-item {
|
|
12
|
-
//opacity: 0;
|
|
13
|
-
display: none;
|
|
14
|
-
}
|
|
15
|
-
&.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) .ant-select-selector {
|
|
16
|
-
background: transparent;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
//.ant-select-disabled.ant-select-single:not(.ant-select-customize-input) ~ .refactor-tree-select-extra{
|
|
20
|
-
//}
|
|
21
|
-
}
|
|
22
|
-
&.refactor-disabled .refactor-tree-select-extra {
|
|
23
|
-
background: @disabled-bg;
|
|
24
|
-
color: @disabled-color;
|
|
25
|
-
}
|
|
26
|
-
.refactor-tree-select-extra {
|
|
27
|
-
width: 100%;
|
|
28
|
-
background: @component-background;
|
|
29
|
-
position: absolute;
|
|
30
|
-
top: 0;
|
|
31
|
-
left: 0;
|
|
32
|
-
bottom: 0;
|
|
33
|
-
height: @input-height-base;
|
|
34
|
-
z-index: 1;
|
|
35
|
-
padding: 1px 22px 1px 8px;
|
|
36
|
-
line-height: 30px;
|
|
37
|
-
overflow: hidden;
|
|
38
|
-
text-overflow: ellipsis;
|
|
39
|
-
white-space: nowrap;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.spec-uploader-viewonly {
|
|
44
|
-
display: inline-block;
|
|
45
|
-
width: 100%;
|
|
46
|
-
&:after {
|
|
47
|
-
display: table;
|
|
48
|
-
clear: both;
|
|
49
|
-
content: '';
|
|
50
|
-
}
|
|
51
|
-
.spec-uploader-viewonly-item {
|
|
52
|
-
float: left;
|
|
53
|
-
width: 100px;
|
|
54
|
-
height: 100px;
|
|
55
|
-
padding: @padding-xs;
|
|
56
|
-
margin-right: @padding-xs;
|
|
57
|
-
margin-bottom: @padding-xs;
|
|
58
|
-
border: 1px solid @border-color-base;
|
|
59
|
-
border-radius: @border-radius-sm;
|
|
60
|
-
line-height: 88px;
|
|
61
|
-
text-align: center;
|
|
62
|
-
background: transparent;
|
|
63
|
-
img {
|
|
64
|
-
width: 100%;
|
|
65
|
-
height: 100%;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
.ant-image +.ant-image{
|
|
69
|
-
margin-left: 5px;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// 下拉树只读列表
|
|
74
|
-
.tree-select-viewonly-list {
|
|
75
|
-
position: relative;
|
|
76
|
-
width: 100%;
|
|
77
|
-
border: 1px solid fade(@border-color-split, 60%);
|
|
78
|
-
border-radius: @border-radius-sm;
|
|
79
|
-
padding: @padding-xs @padding-sm;
|
|
80
|
-
&.collapsed {
|
|
81
|
-
padding-bottom: 28px;
|
|
82
|
-
}
|
|
83
|
-
.tree-select-viewonly-item b {
|
|
84
|
-
font-size: 18px;
|
|
85
|
-
}
|
|
86
|
-
.toggle-icon {
|
|
87
|
-
position: absolute;
|
|
88
|
-
bottom: 0;
|
|
89
|
-
left: 0;
|
|
90
|
-
width: 100%;
|
|
91
|
-
height: 28px;
|
|
92
|
-
line-height: 28px;
|
|
93
|
-
text-align: center;
|
|
94
|
-
font-size: @font-size-sm;
|
|
95
|
-
cursor: pointer;
|
|
96
|
-
color: @text-color-secondary;
|
|
97
|
-
//color: color(~`colorPalette('@{text-color-secondary}', 3) `);
|
|
98
|
-
background-image: -webkit-gradient(linear, left top, left bottom, from(fade(@component-background, 0)), to(@component-background));
|
|
99
|
-
background-image: -webkit-linear-gradient(top, fade(@component-background, 0), @component-background);
|
|
100
|
-
background-image: linear-gradient(-180deg, fade(@component-background, 0), @component-background);
|
|
101
|
-
&:hover {
|
|
102
|
-
color: @primary-color;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.checkbox-viewonly-item{
|
|
108
|
-
display: inline ;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
.upload-viewonly {
|
|
113
|
-
.ant-upload-select.ant-upload-disabled {
|
|
114
|
-
display: none;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { FieldComponentProps } from '../FieldComponent';
|
|
3
|
-
export interface FieldsItemProps extends FieldComponentProps {
|
|
4
|
-
label?: string | React.ReactNode;
|
|
5
|
-
description?: string;
|
|
6
|
-
isHide?: (fields?: any, form?: any, fieldStatus?: string) => boolean | boolean;
|
|
7
|
-
customRender?: (form?: any, data?: FieldsItemProps, fieldStatus?: string) => React.ReactNode;
|
|
8
|
-
colSpan?: number;
|
|
9
|
-
display?: string | object;
|
|
10
|
-
protoFormItem?: object;
|
|
11
|
-
preExtra?: (config?: any, form?: any) => React.ReactNode;
|
|
12
|
-
extra?: (config?: any, form?: any) => React.ReactNode;
|
|
13
|
-
rules?: any;
|
|
14
|
-
fieldOptions?: any;
|
|
15
|
-
size?: 'large' | 'middle' | 'small' | string;
|
|
16
|
-
componentStyle?: React.CSSProperties;
|
|
17
|
-
}
|
|
18
|
-
interface layoutProps {
|
|
19
|
-
labelCol?: any;
|
|
20
|
-
wrapperCol?: any;
|
|
21
|
-
}
|
|
22
|
-
interface displayLayoutProps extends layoutProps {
|
|
23
|
-
side?: layoutProps;
|
|
24
|
-
block?: layoutProps;
|
|
25
|
-
}
|
|
26
|
-
interface ItemGroupProps {
|
|
27
|
-
itemGroup: any | FieldsItemProps[];
|
|
28
|
-
size?: string;
|
|
29
|
-
fieldStatus?: 'default' | 'viewOnly' | 'disabled';
|
|
30
|
-
fieldSize?: 'large' | 'middle' | 'small' | any;
|
|
31
|
-
displayLayout?: displayLayoutProps;
|
|
32
|
-
form?: any;
|
|
33
|
-
layout?: string;
|
|
34
|
-
doUpdateFormFields?: () => void;
|
|
35
|
-
}
|
|
36
|
-
declare const RenderItemGroup: (props: ItemGroupProps) => any;
|
|
37
|
-
export default RenderItemGroup;
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import "antd/es/row/style";
|
|
2
|
-
import _Row from "antd/es/row";
|
|
3
|
-
import "antd/es/tooltip/style";
|
|
4
|
-
import _Tooltip from "antd/es/tooltip";
|
|
5
|
-
import "antd/es/col/style";
|
|
6
|
-
import _Col from "antd/es/col";
|
|
7
|
-
import "antd/es/form/style";
|
|
8
|
-
import _Form from "antd/es/form";
|
|
9
|
-
|
|
10
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
11
|
-
|
|
12
|
-
import React from "react";
|
|
13
|
-
import { general } from '../../data';
|
|
14
|
-
import Field from '../FieldComponent';
|
|
15
|
-
import SpecIcon from '../../SpecIcon';
|
|
16
|
-
var FormItem = _Form.Item;
|
|
17
|
-
|
|
18
|
-
var RenderItemGroup = function RenderItemGroup(props) {
|
|
19
|
-
var itemGroup = props.itemGroup,
|
|
20
|
-
_props$size = props.size,
|
|
21
|
-
size = _props$size === void 0 ? 'md' : _props$size,
|
|
22
|
-
_props$fieldStatus = props.fieldStatus,
|
|
23
|
-
fieldStatus = _props$fieldStatus === void 0 ? 'default' : _props$fieldStatus,
|
|
24
|
-
_props$fieldSize = props.fieldSize,
|
|
25
|
-
fieldSize = _props$fieldSize === void 0 ? 'middle' : _props$fieldSize,
|
|
26
|
-
displayLayout = props.displayLayout,
|
|
27
|
-
form = props.form,
|
|
28
|
-
doUpdateFormFields = props.doUpdateFormFields,
|
|
29
|
-
_props$layout = props.layout,
|
|
30
|
-
layout = _props$layout === void 0 ? "horizontal" : _props$layout;
|
|
31
|
-
|
|
32
|
-
var setColSpan = function setColSpan(display, modalSize) {
|
|
33
|
-
if (_typeof(display) === 'object' || display === 'block' || modalSize === 'xs' || modalSize === 'sm') {
|
|
34
|
-
return 24;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (modalSize === 'lg' || modalSize === 'xlg') {
|
|
38
|
-
return 8;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return 12;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
var updateFormFields = function updateFormFields() {
|
|
45
|
-
// if (newVal) form && form.setFieldsValue({ ...newVal })
|
|
46
|
-
if (doUpdateFormFields) doUpdateFormFields(); // 用于触发更新表单实例赋值
|
|
47
|
-
}; // useEffect(() => {
|
|
48
|
-
// // updateFormFields()
|
|
49
|
-
// }, [form])
|
|
50
|
-
// 渲染隐藏指定控件
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var itemIsHide = function itemIsHide(isHide, getFieldsValue, FormInstance) {
|
|
54
|
-
if (typeof isHide === 'function') {
|
|
55
|
-
return isHide(getFieldsValue, FormInstance, fieldStatus);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return isHide || false;
|
|
59
|
-
}; // 渲染表单控件
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var renderFormField = function renderFormField(field) {
|
|
63
|
-
var componentStyle = field.componentStyle,
|
|
64
|
-
extra = field.extra,
|
|
65
|
-
preExtra = field.preExtra; // 当前可传参的配置值
|
|
66
|
-
// 带前缀或后缀控件渲染
|
|
67
|
-
|
|
68
|
-
if (preExtra || extra) {
|
|
69
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, preExtra ? preExtra(field, form) : '', /*#__PURE__*/React.createElement(FormItem, {
|
|
70
|
-
noStyle: true,
|
|
71
|
-
rules: field.rules || (field.fieldOptions ? field.fieldOptions.rules : []),
|
|
72
|
-
name: field.filedName
|
|
73
|
-
}, /*#__PURE__*/React.createElement(Field, Object.assign({}, field, {
|
|
74
|
-
onChange: function onChange(eOrValue) {
|
|
75
|
-
updateFormFields();
|
|
76
|
-
|
|
77
|
-
for (var _len = arguments.length, otherParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
78
|
-
otherParams[_key - 1] = arguments[_key];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (field.onChange) field.onChange.apply(field, [eOrValue].concat(otherParams));
|
|
82
|
-
},
|
|
83
|
-
fieldStatus: field.fieldStatus || fieldStatus,
|
|
84
|
-
size: field.protoConfig && field.protoConfig.size || field.size || fieldSize,
|
|
85
|
-
style: componentStyle || Object.assign({}, general.formItemStyle.wide)
|
|
86
|
-
}))), extra ? extra(field, form) : '');
|
|
87
|
-
} else {
|
|
88
|
-
return /*#__PURE__*/React.createElement(Field, Object.assign({}, field, {
|
|
89
|
-
onChange: function onChange(eOrValue) {
|
|
90
|
-
// let updateValue = val
|
|
91
|
-
// if (field.type === 'input' || field.type === 'textarea' || field.type === 'radio' || field.type === 'password') {
|
|
92
|
-
// updateValue = val.target.value
|
|
93
|
-
// }
|
|
94
|
-
// updateFormFields({ [field.filedName]: updateValue })
|
|
95
|
-
updateFormFields(); // if (field.onChange) field.onChange(val, form)
|
|
96
|
-
|
|
97
|
-
for (var _len2 = arguments.length, otherParams = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
98
|
-
otherParams[_key2 - 1] = arguments[_key2];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (field.onChange) field.onChange.apply(field, [eOrValue].concat(otherParams));
|
|
102
|
-
},
|
|
103
|
-
fieldStatus: field.fieldStatus || fieldStatus,
|
|
104
|
-
size: field.protoConfig && field.protoConfig.size || field.size || fieldSize,
|
|
105
|
-
style: componentStyle || Object.assign({}, general.formItemStyle.wide)
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
var renderColFormItem = function renderColFormItem(item, index, formLayout) {
|
|
111
|
-
var label = item.label,
|
|
112
|
-
description = item.description,
|
|
113
|
-
type = item.type,
|
|
114
|
-
customRender = item.customRender,
|
|
115
|
-
filedName = item.filedName; // 当前可传参的配置值
|
|
116
|
-
|
|
117
|
-
if (layout === "horizontal") {
|
|
118
|
-
return /*#__PURE__*/React.createElement(_Col, {
|
|
119
|
-
key: index,
|
|
120
|
-
span: item.colSpan || setColSpan(item.display, size)
|
|
121
|
-
}, /*#__PURE__*/React.createElement(FormItem, Object.assign({
|
|
122
|
-
name: type !== 'custom' && filedName,
|
|
123
|
-
className: fieldStatus === 'viewOnly' ? 'form-item-view-only' : '',
|
|
124
|
-
label: description ? /*#__PURE__*/React.createElement("span", null, label, /*#__PURE__*/React.createElement(_Tooltip, {
|
|
125
|
-
title: description
|
|
126
|
-
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
127
|
-
name: "info"
|
|
128
|
-
}))) : label,
|
|
129
|
-
rules: item.preExtra || item.extra ? [] : item.rules || (item.fieldOptions ? item.fieldOptions.rules : []),
|
|
130
|
-
required: item.rules && item.rules.filter(function (rItem) {
|
|
131
|
-
return rItem.required;
|
|
132
|
-
}).length > 0
|
|
133
|
-
}, formLayout, item.protoFormItem), type === 'custom' && customRender ? customRender(form, Object.assign({}, item), fieldStatus) : renderFormField(Object.assign({}, item))));
|
|
134
|
-
} else {
|
|
135
|
-
return /*#__PURE__*/React.createElement(FormItem, Object.assign({
|
|
136
|
-
key: index,
|
|
137
|
-
name: type !== 'custom' && filedName,
|
|
138
|
-
className: fieldStatus === 'viewOnly' ? 'form-item-view-only' : '',
|
|
139
|
-
label: description ? /*#__PURE__*/React.createElement("span", null, label, /*#__PURE__*/React.createElement(_Tooltip, {
|
|
140
|
-
title: description
|
|
141
|
-
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
142
|
-
name: "info"
|
|
143
|
-
}))) : label,
|
|
144
|
-
rules: item.rules || (item.fieldOptions ? item.fieldOptions.rules : [])
|
|
145
|
-
}, formLayout, item.protoFormItem), type === 'custom' && customRender ? customRender(form, Object.assign({}, item), fieldStatus) : renderFormField(Object.assign({}, item)));
|
|
146
|
-
}
|
|
147
|
-
}; // 渲染表单控件列表
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
var renderItemGroupNode = function renderItemGroupNode() {
|
|
151
|
-
return itemGroup.map(function (item, index) {
|
|
152
|
-
var label = item.label,
|
|
153
|
-
isHide = item.isHide,
|
|
154
|
-
type = item.type,
|
|
155
|
-
_item$display = item.display,
|
|
156
|
-
display = _item$display === void 0 ? 'side' : _item$display; // 当前可传参的配置值
|
|
157
|
-
|
|
158
|
-
var formLayout = {}; // if (displayLayout) {
|
|
159
|
-
// // 如果未配置,则使用以下配置值
|
|
160
|
-
// formLayout = { ...displayLayout }
|
|
161
|
-
// }
|
|
162
|
-
// 优先级 displayLayout.side > displayLayout > general
|
|
163
|
-
// 优先级:若有displayLayout.block 则直接使用 general > displayLayout
|
|
164
|
-
|
|
165
|
-
formLayout = (displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.side) || ((displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.block) ? general.modalSize[size].formLayout : !displayLayout || JSON.stringify(displayLayout) === '{}' ? general.modalSize[size].formLayout : displayLayout);
|
|
166
|
-
|
|
167
|
-
if (item.hasOwnProperty('display')) {
|
|
168
|
-
if (typeof display === 'string') {
|
|
169
|
-
if (display === 'block') {
|
|
170
|
-
formLayout = (displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.block) || general.modalSize[size].formBlockLayout;
|
|
171
|
-
} else {// 使用默认
|
|
172
|
-
// formLayout = displayLayout?.side || (displayLayout?.block ? general.modalSize[size].formLayout : displayLayout) || general.modalSize[size].formLayout
|
|
173
|
-
}
|
|
174
|
-
} else {
|
|
175
|
-
formLayout = item.display; // 对象类型传值如: {labelCol: {span: 3},wrapperCol: {span: 8}} 优先级最高
|
|
176
|
-
}
|
|
177
|
-
} // 当布局为 'vertical'或'inline'时,不配置栅格结构
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (layout !== 'horizontal') {
|
|
181
|
-
formLayout = {};
|
|
182
|
-
} // title标题或html渲染
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (type === 'title' || type === 'html') {
|
|
186
|
-
return /*#__PURE__*/React.createElement(FormItem, {
|
|
187
|
-
key: index,
|
|
188
|
-
noStyle: true,
|
|
189
|
-
shouldUpdate: true
|
|
190
|
-
}, function (FormInstance) {
|
|
191
|
-
var _a; // isHide 返回为true则隐藏当前控件
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
return !itemIsHide(isHide, FormInstance.getFieldValue(), FormInstance) ? /*#__PURE__*/React.createElement(_Col, {
|
|
195
|
-
span: item.colSpan || 24
|
|
196
|
-
}, type === 'title' ? /*#__PURE__*/React.createElement("h3", Object.assign({
|
|
197
|
-
className: "modalPanelTitle ".concat((_a = item === null || item === void 0 ? void 0 : item.protoConfig) === null || _a === void 0 ? void 0 : _a.className)
|
|
198
|
-
}, item.protoConfig), label) : label) : /*#__PURE__*/React.createElement(React.Fragment, null, null);
|
|
199
|
-
});
|
|
200
|
-
} // 判断是否强制重新渲染表单
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (item.protoFormItem && item.protoFormItem.shouldUpdate) {
|
|
204
|
-
return /*#__PURE__*/React.createElement(FormItem, {
|
|
205
|
-
key: index,
|
|
206
|
-
noStyle: true,
|
|
207
|
-
shouldUpdate: item.protoFormItem.shouldUpdate
|
|
208
|
-
}, function (FormInstance) {
|
|
209
|
-
// isHide 返回为true则隐藏当前控件
|
|
210
|
-
return !itemIsHide(isHide, FormInstance.getFieldValue(), FormInstance) ? renderColFormItem(item, index, formLayout) : null;
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return renderColFormItem(item, index, formLayout);
|
|
215
|
-
});
|
|
216
|
-
}; // itemGroup = Array 则按以下结构渲染
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (itemGroup && Array.isArray(itemGroup)) {
|
|
220
|
-
// 布局配置为'vertical或inline'
|
|
221
|
-
if (layout !== 'horizontal') {
|
|
222
|
-
return renderItemGroupNode();
|
|
223
|
-
} // 布局配置为horizontal
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return /*#__PURE__*/React.createElement(_Row, null, renderItemGroupNode());
|
|
227
|
-
}
|
|
228
|
-
/* itemGroup = ReactNode则直接返回 */
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return itemGroup;
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
export default RenderItemGroup;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface UploaderProps {
|
|
3
|
-
extraExt?: string;
|
|
4
|
-
accept?: string;
|
|
5
|
-
fileList?: any[];
|
|
6
|
-
fileType?: string;
|
|
7
|
-
className?: string;
|
|
8
|
-
isOnly?: boolean;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
onChange?: (file?: any) => void;
|
|
11
|
-
value?: any;
|
|
12
|
-
size?: number;
|
|
13
|
-
modalSize?: string;
|
|
14
|
-
onPreview?: (file?: any) => any;
|
|
15
|
-
beforeUpload?: (file: any, fileList: any) => any;
|
|
16
|
-
limit?: number;
|
|
17
|
-
}
|
|
18
|
-
declare const Uploader: React.ForwardRefExoticComponent<UploaderProps & React.RefAttributes<unknown>>;
|
|
19
|
-
export default Uploader;
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import "antd/es/upload/style";
|
|
2
|
-
import _Upload from "antd/es/upload";
|
|
3
|
-
import "antd/es/button/style";
|
|
4
|
-
import _Button from "antd/es/button";
|
|
5
|
-
import "antd/es/message/style";
|
|
6
|
-
import _message from "antd/es/message";
|
|
7
|
-
|
|
8
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
|
-
|
|
10
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
-
|
|
12
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
13
|
-
|
|
14
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
15
|
-
|
|
16
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
-
|
|
18
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
-
|
|
20
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
25
|
-
|
|
26
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
-
|
|
28
|
-
import { __awaiter } from "tslib";
|
|
29
|
-
import React, { useMemo, useState, useCallback, useEffect } from 'react';
|
|
30
|
-
import { PlusOutlined } from '@ant-design/icons';
|
|
31
|
-
import { getAccept, getBase64 } from "./util"; // import RcUpload from 'rc-upload';
|
|
32
|
-
|
|
33
|
-
import StandardModal from "../../StandardModal";
|
|
34
|
-
var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
35
|
-
var accept = props.accept,
|
|
36
|
-
extraExt = props.extraExt,
|
|
37
|
-
fileType = props.fileType,
|
|
38
|
-
className = props.className,
|
|
39
|
-
isOnly = props.isOnly,
|
|
40
|
-
children = props.children,
|
|
41
|
-
onChange = props.onChange,
|
|
42
|
-
value = props.value,
|
|
43
|
-
_props$size = props.size,
|
|
44
|
-
size = _props$size === void 0 ? 2 * 1024 * 1024 : _props$size,
|
|
45
|
-
_props$modalSize = props.modalSize,
|
|
46
|
-
modalSize = _props$modalSize === void 0 ? 'md' : _props$modalSize,
|
|
47
|
-
onPreview = props.onPreview,
|
|
48
|
-
beforeUpload = props.beforeUpload,
|
|
49
|
-
limit = props.limit; // 图片预览数据
|
|
50
|
-
|
|
51
|
-
var _useState = useState({
|
|
52
|
-
visible: false,
|
|
53
|
-
url: ''
|
|
54
|
-
}),
|
|
55
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
-
showConfig = _useState2[0],
|
|
57
|
-
setShowConfig = _useState2[1]; // 用于展示的缩略图
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var _useState3 = useState([]),
|
|
61
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
62
|
-
fileList = _useState4[0],
|
|
63
|
-
setFileList = _useState4[1];
|
|
64
|
-
|
|
65
|
-
useEffect(function () {
|
|
66
|
-
if (!value) {
|
|
67
|
-
setFileList([]);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
var S4 = function S4() {
|
|
72
|
-
return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
if (Object.prototype.toString.call(value) === '[object Array]') {
|
|
76
|
-
setFileList(value.map(function (file, index) {
|
|
77
|
-
file.uid = file.uid || "".concat(S4(), "-").concat(S4());
|
|
78
|
-
file.url = file.downloadUrl || file.url;
|
|
79
|
-
file.status = 'done';
|
|
80
|
-
return file;
|
|
81
|
-
}));
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
86
|
-
setFileList([Object.assign({
|
|
87
|
-
uid: "".concat(S4(), "-").concat(S4()),
|
|
88
|
-
url: value.downloadUrl || value.url,
|
|
89
|
-
status: 'done'
|
|
90
|
-
}, value)]);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (Object.prototype.toString.call(value) === '[object String]') {
|
|
95
|
-
setFileList([{
|
|
96
|
-
uid: "".concat(S4(), "-").concat(S4()),
|
|
97
|
-
url: value,
|
|
98
|
-
name: '附件',
|
|
99
|
-
status: 'done'
|
|
100
|
-
}]);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
}, [value]);
|
|
104
|
-
var splitAccept = useMemo(function () {
|
|
105
|
-
var res = getAccept(fileType);
|
|
106
|
-
|
|
107
|
-
if (extraExt) {
|
|
108
|
-
res = res + ',' + extraExt;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (accept) {
|
|
112
|
-
res = res + ',' + accept;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return res;
|
|
116
|
-
}, [fileType, extraExt]); // 点击文件链接或预览图标时的回调
|
|
117
|
-
|
|
118
|
-
var handlePreview = useCallback(function (file) {
|
|
119
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
120
|
-
var res;
|
|
121
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
122
|
-
while (1) {
|
|
123
|
-
switch (_context.prev = _context.next) {
|
|
124
|
-
case 0:
|
|
125
|
-
if (!(!file.url && !file.preview)) {
|
|
126
|
-
_context.next = 5;
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
_context.next = 3;
|
|
131
|
-
return getBase64(file.originFileObj);
|
|
132
|
-
|
|
133
|
-
case 3:
|
|
134
|
-
res = _context.sent;
|
|
135
|
-
|
|
136
|
-
if (res && res.status === 'success') {
|
|
137
|
-
file.preview = res.url;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
case 5:
|
|
141
|
-
setShowConfig({
|
|
142
|
-
visible: true,
|
|
143
|
-
url: file.url || file.preview
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
case 6:
|
|
147
|
-
case "end":
|
|
148
|
-
return _context.stop();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}, _callee);
|
|
152
|
-
}));
|
|
153
|
-
}, [setShowConfig]); // 检查文件是否规范
|
|
154
|
-
|
|
155
|
-
var handleCheck = useCallback(function (file) {
|
|
156
|
-
var isLtSize = file.size < size;
|
|
157
|
-
|
|
158
|
-
if (!isLtSize) {
|
|
159
|
-
_message.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(Math.round(size / 1024 / 1024 * 100) / 100, "MB!"));
|
|
160
|
-
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return true;
|
|
165
|
-
}, [fileType, size]);
|
|
166
|
-
var handleChange = useCallback(function (res) {
|
|
167
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
168
|
-
var isOk, result, list;
|
|
169
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
170
|
-
while (1) {
|
|
171
|
-
switch (_context2.prev = _context2.next) {
|
|
172
|
-
case 0:
|
|
173
|
-
if (!(res.file.status === 'removed')) {
|
|
174
|
-
_context2.next = 4;
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
setFileList(res.fileList);
|
|
179
|
-
onChange && onChange(isOnly ? res.fileList[0] && res.fileList[0].originFileObj : res.fileList);
|
|
180
|
-
return _context2.abrupt("return");
|
|
181
|
-
|
|
182
|
-
case 4:
|
|
183
|
-
isOk = handleCheck(res.file);
|
|
184
|
-
|
|
185
|
-
if (isOk) {
|
|
186
|
-
list = res.fileList.map(function (file) {
|
|
187
|
-
if (!file.url) {
|
|
188
|
-
file.url = file.thumbUrl;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return file;
|
|
192
|
-
});
|
|
193
|
-
result = _toConsumableArray(list);
|
|
194
|
-
setFileList(list);
|
|
195
|
-
onChange && onChange(isOnly ? result[0] && result[0].originFileObj : result);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
case 6:
|
|
199
|
-
case "end":
|
|
200
|
-
return _context2.stop();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}, _callee2);
|
|
204
|
-
}));
|
|
205
|
-
}, [isOnly, handleCheck]); // 渲染预览窗口
|
|
206
|
-
|
|
207
|
-
var renderPreviewComponent = useMemo(function () {
|
|
208
|
-
if (fileType === 'image' || fileType === 'svg') {
|
|
209
|
-
var visible = showConfig.visible,
|
|
210
|
-
url = showConfig.url;
|
|
211
|
-
return /*#__PURE__*/React.createElement(StandardModal, {
|
|
212
|
-
visible: visible,
|
|
213
|
-
hideFooter: true,
|
|
214
|
-
onCancel: function onCancel() {
|
|
215
|
-
return setShowConfig({
|
|
216
|
-
visible: false,
|
|
217
|
-
url: ''
|
|
218
|
-
});
|
|
219
|
-
},
|
|
220
|
-
size: modalSize
|
|
221
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
222
|
-
style: {
|
|
223
|
-
textAlign: 'center'
|
|
224
|
-
}
|
|
225
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
226
|
-
style: {
|
|
227
|
-
maxWidth: '100%'
|
|
228
|
-
},
|
|
229
|
-
src: url,
|
|
230
|
-
alt: ""
|
|
231
|
-
})));
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return null;
|
|
235
|
-
}, [fileType, showConfig]);
|
|
236
|
-
var renderChildrenComponent = useMemo(function () {
|
|
237
|
-
var renderButton = function renderButton() {
|
|
238
|
-
if (fileType === 'image' || fileType === 'svg') {
|
|
239
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
240
|
-
className: 'spec-uploader-control'
|
|
241
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
|
|
242
|
-
className: "ant-upload-text"
|
|
243
|
-
}, "\u70B9\u51FB\u9009\u62E9"));
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return /*#__PURE__*/React.createElement(_Button, {
|
|
247
|
-
className: 'spec-uploader-button'
|
|
248
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, null), "\u70B9\u51FB\u9009\u62E9");
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
if (children) {
|
|
252
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, " ", children, " ");
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (isOnly && fileList.length === 1 || limit && fileList.length === limit) {
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, renderButton());
|
|
260
|
-
}, [fileType, isOnly, children, fileList, limit]);
|
|
261
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Upload, Object.assign({}, props, {
|
|
262
|
-
ref: ref,
|
|
263
|
-
accept: splitAccept,
|
|
264
|
-
fileList: fileList,
|
|
265
|
-
listType: fileType === 'image' || fileType === 'svg' ? 'picture-card' : 'text',
|
|
266
|
-
className: "spec-uploader ".concat(className),
|
|
267
|
-
onPreview: onPreview ? onPreview : fileType === 'image' || fileType === 'svg' ? handlePreview : function () {},
|
|
268
|
-
beforeUpload: beforeUpload ? beforeUpload : function () {
|
|
269
|
-
return false;
|
|
270
|
-
},
|
|
271
|
-
onChange: handleChange
|
|
272
|
-
}), renderChildrenComponent), renderPreviewComponent);
|
|
273
|
-
}); // as IUploader
|
|
274
|
-
|
|
275
|
-
export default Uploader;
|