fan-standard-comp 3.1.4 → 3.1.6
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/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +173 -0
- package/dist/fan-standard-comp.umd.js +597 -0
- 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 +2 -0
- package/es/ButtonGroup/ButtonList.js +37 -0
- package/es/ButtonGroup/ButtonMenu.d.ts +2 -0
- package/es/ButtonGroup/ButtonMenu.js +38 -0
- package/es/ButtonGroup/PopConfirmTitle.d.ts +9 -0
- package/es/ButtonGroup/PopConfirmTitle.js +37 -0
- package/es/ButtonGroup/index.d.ts +30 -0
- package/es/ButtonGroup/index.js +374 -0
- package/es/ButtonGroup/style/index.less +36 -0
- package/es/DragContent/DragBar.js +21 -0
- package/es/DragContent/index.d.ts +14 -0
- package/es/DragContent/index.js +173 -0
- package/es/DragContent/index.less +44 -0
- package/es/FormComp/ChunkUploader/api.js +76 -0
- package/es/FormComp/ChunkUploader/index.js +391 -0
- package/es/FormComp/ChunkUploader/lib.js +96 -0
- package/es/FormComp/ChunkUploader/style/style.less +3 -0
- package/es/FormComp/ChunkUploader/upload-queue.class.js +167 -0
- package/es/FormComp/ChunkUploader/worker.js +23 -0
- package/es/FormComp/EditButton/index.d.ts +26 -0
- package/es/FormComp/EditButton/index.js +140 -0
- package/es/FormComp/FieldComponent/ReUpload.d.ts +3 -0
- package/es/FormComp/FieldComponent/ReUpload.js +131 -0
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +251 -0
- package/es/FormComp/FieldComponent/TitleNode.d.ts +6 -0
- package/es/FormComp/FieldComponent/TitleNode.js +9 -0
- package/es/FormComp/FieldComponent/index.d.ts +38 -0
- package/es/FormComp/FieldComponent/index.js +413 -0
- package/es/FormComp/FieldComponent/setReadonlyValues.js +236 -0
- package/es/FormComp/FieldComponent/style/index.less +120 -0
- package/es/FormComp/RenderItemGroup/index.d.ts +37 -0
- package/es/FormComp/RenderItemGroup/index.js +234 -0
- package/es/FormComp/Uploader/index.d.ts +21 -0
- package/es/FormComp/Uploader/index.js +277 -0
- package/es/FormComp/Uploader/style/index.less +14 -0
- package/es/FormComp/Uploader/util.d.ts +8 -0
- package/es/FormComp/Uploader/util.js +38 -0
- package/es/FormComp/VarTemplate/index.js +293 -0
- package/es/FormComp/index.d.ts +1 -0
- package/es/FormComp/index.js +1 -0
- package/es/NavLeafScroll/index.js +379 -0
- package/es/NavLeafScroll/style/index.less +119 -0
- package/es/RefactorTree/data.d.ts +7 -0
- package/es/RefactorTree/index.d.ts +40 -0
- package/es/RefactorTree/index.js +167 -0
- package/es/RefactorTree/indexTreeNode.d.ts +39 -0
- package/es/RefactorTree/indexTreeNode.js +237 -0
- package/es/RefactorTree/style/index.d.ts +1 -0
- package/es/RefactorTree/style/index.js +1 -0
- package/es/RefactorTree/style/index.less +22 -0
- package/es/RefactorTree/util.d.ts +42 -0
- package/es/RefactorTree/util.js +187 -0
- package/es/SpecIcon/fonts/demo.css +539 -0
- package/es/SpecIcon/fonts/demo_index.html +1315 -0
- package/es/SpecIcon/fonts/iconfont.css +211 -0
- package/es/SpecIcon/fonts/iconfont.eot +0 -0
- package/es/SpecIcon/fonts/iconfont.js +41 -0
- package/es/SpecIcon/fonts/iconfont.json +352 -0
- package/es/SpecIcon/fonts/iconfont.svg +173 -0
- 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 +17 -0
- package/es/SpecIcon/index.js +77 -0
- package/es/SpecIcon/style/iconfont.less +213 -0
- package/es/SpecIcon/style/index.less +98 -0
- package/es/SplitterLayout/Pane.d.ts +13 -0
- package/es/SplitterLayout/Pane.js +36 -0
- package/es/SplitterLayout/index.js +375 -0
- package/es/SplitterLayout/index.less +58 -0
- package/es/StandardContent/SplitterLayout/Pane.js +50 -0
- package/es/StandardContent/SplitterLayout/index.js +374 -0
- package/es/StandardContent/SplitterLayout/index.less +58 -0
- package/es/StandardContent/SubfieldContent.d.ts +17 -0
- package/es/StandardContent/SubfieldContent.js +41 -0
- package/es/StandardContent/WrapperContent.d.ts +13 -0
- package/es/StandardContent/WrapperContent.js +29 -0
- package/es/StandardContent/data.d.ts +101 -0
- package/es/StandardContent/style/index.less +80 -0
- package/es/StandardDragModal/index.d.ts +11 -0
- package/es/StandardDragModal/index.js +30 -0
- package/es/StandardFilter/index.d.ts +35 -0
- package/es/StandardFilter/index.js +253 -0
- package/es/StandardFilter/style/index.less +62 -0
- package/es/StandardForm/ActionList.js +44 -0
- package/es/StandardForm/StepForm.d.ts +19 -0
- package/es/StandardForm/StepForm.js +267 -0
- package/es/StandardForm/TabForm.d.ts +19 -0
- package/es/StandardForm/TabForm.js +122 -0
- package/es/StandardForm/index.d.ts +32 -0
- package/es/StandardForm/index.js +170 -0
- package/es/StandardForm/style/index.less +58 -0
- package/es/StandardModal/UpdateFormRef.js +18 -0
- package/es/StandardModal/index.d.ts +44 -0
- package/es/StandardModal/index.js +495 -0
- package/es/StandardModal/style/index.less +50 -0
- package/es/StandardPanel/index.d.ts +28 -0
- package/es/StandardPanel/index.js +134 -0
- package/es/StandardPanel/style/index.less +135 -0
- package/es/StandardTable/index.d.ts +22 -0
- package/es/StandardTable/index.js +126 -0
- package/es/StandardTable/style/index.d.ts +1 -0
- package/es/StandardTable/style/index.js +1 -0
- package/es/StandardTable/style/index.less +206 -0
- package/es/components/IconNode/index.d.ts +16 -0
- package/es/components/IconNode/index.js +28 -0
- package/es/components/index.d.ts +2 -0
- package/es/components/index.js +2 -0
- package/es/data/func.code.js +112 -0
- package/es/data/general.config.js +172 -0
- package/es/data/index.js +3 -0
- package/es/index.d.ts +24 -0
- package/es/index.js +31 -0
- package/es/styles/index.less +0 -0
- package/es/theme/spec-variable.less +48 -0
- package/es/utils/ValueFormat.js +50 -0
- package/es/utils/filterPermission.js +111 -0
- package/es/utils/getParentNodes.js +215 -0
- package/es/utils/index.js +3 -0
- package/lib/ButtonGroup/ButtonList.d.ts +2 -0
- package/lib/ButtonGroup/ButtonList.js +55 -0
- package/lib/ButtonGroup/ButtonMenu.d.ts +2 -0
- package/lib/ButtonGroup/ButtonMenu.js +51 -0
- package/lib/ButtonGroup/PopConfirmTitle.d.ts +9 -0
- package/lib/ButtonGroup/PopConfirmTitle.js +48 -0
- package/lib/ButtonGroup/index.d.ts +30 -0
- package/lib/ButtonGroup/index.js +405 -0
- package/lib/ButtonGroup/style/index.less +36 -0
- package/lib/DragContent/DragBar.js +33 -0
- package/lib/DragContent/index.d.ts +14 -0
- package/lib/DragContent/index.js +191 -0
- package/lib/DragContent/index.less +44 -0
- package/lib/FormComp/ChunkUploader/api.js +89 -0
- package/lib/FormComp/ChunkUploader/index.js +410 -0
- package/lib/FormComp/ChunkUploader/lib.js +113 -0
- package/lib/FormComp/ChunkUploader/style/style.less +3 -0
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +174 -0
- package/lib/FormComp/ChunkUploader/worker.js +28 -0
- package/lib/FormComp/EditButton/index.d.ts +26 -0
- package/lib/FormComp/EditButton/index.js +159 -0
- package/lib/FormComp/FieldComponent/ReUpload.d.ts +3 -0
- package/lib/FormComp/FieldComponent/ReUpload.js +151 -0
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +274 -0
- package/lib/FormComp/FieldComponent/TitleNode.d.ts +6 -0
- package/lib/FormComp/FieldComponent/TitleNode.js +19 -0
- package/lib/FormComp/FieldComponent/index.d.ts +38 -0
- package/lib/FormComp/FieldComponent/index.js +457 -0
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +263 -0
- package/lib/FormComp/FieldComponent/style/index.less +120 -0
- package/lib/FormComp/RenderItemGroup/index.d.ts +37 -0
- package/lib/FormComp/RenderItemGroup/index.js +255 -0
- package/lib/FormComp/Uploader/index.d.ts +21 -0
- package/lib/FormComp/Uploader/index.js +303 -0
- package/lib/FormComp/Uploader/style/index.less +14 -0
- package/lib/FormComp/Uploader/util.d.ts +8 -0
- package/lib/FormComp/Uploader/util.js +47 -0
- package/lib/FormComp/VarTemplate/index.js +308 -0
- package/lib/FormComp/index.d.ts +1 -0
- package/lib/FormComp/index.js +15 -0
- package/lib/NavLeafScroll/index.js +397 -0
- package/lib/NavLeafScroll/style/index.less +119 -0
- package/lib/RefactorTree/data.d.ts +7 -0
- package/lib/RefactorTree/index.d.ts +40 -0
- package/lib/RefactorTree/index.js +190 -0
- package/lib/RefactorTree/indexTreeNode.d.ts +39 -0
- package/lib/RefactorTree/indexTreeNode.js +260 -0
- package/lib/RefactorTree/style/index.d.ts +1 -0
- package/lib/RefactorTree/style/index.js +3 -0
- package/lib/RefactorTree/style/index.less +22 -0
- package/lib/RefactorTree/util.d.ts +42 -0
- package/lib/RefactorTree/util.js +195 -0
- package/lib/SpecIcon/fonts/demo.css +539 -0
- package/lib/SpecIcon/fonts/demo_index.html +1315 -0
- package/lib/SpecIcon/fonts/iconfont.css +211 -0
- package/lib/SpecIcon/fonts/iconfont.eot +0 -0
- package/lib/SpecIcon/fonts/iconfont.js +43 -0
- package/lib/SpecIcon/fonts/iconfont.json +352 -0
- package/lib/SpecIcon/fonts/iconfont.svg +173 -0
- 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 +17 -0
- package/lib/SpecIcon/index.js +90 -0
- package/lib/SpecIcon/style/iconfont.less +213 -0
- package/lib/SpecIcon/style/index.less +98 -0
- package/lib/SplitterLayout/Pane.d.ts +13 -0
- package/lib/SplitterLayout/Pane.js +48 -0
- package/lib/SplitterLayout/index.js +386 -0
- package/lib/SplitterLayout/index.less +58 -0
- package/lib/StandardContent/SplitterLayout/Pane.js +62 -0
- package/lib/StandardContent/SplitterLayout/index.js +387 -0
- package/lib/StandardContent/SplitterLayout/index.less +58 -0
- package/lib/StandardContent/SubfieldContent.d.ts +17 -0
- package/lib/StandardContent/SubfieldContent.js +56 -0
- package/lib/StandardContent/WrapperContent.d.ts +13 -0
- package/lib/StandardContent/WrapperContent.js +43 -0
- package/lib/StandardContent/data.d.ts +101 -0
- package/lib/StandardContent/style/index.less +80 -0
- package/lib/StandardDragModal/index.d.ts +11 -0
- package/lib/StandardDragModal/index.js +43 -0
- package/lib/StandardFilter/index.d.ts +35 -0
- package/lib/StandardFilter/index.js +272 -0
- package/lib/StandardFilter/style/index.less +62 -0
- package/lib/StandardForm/ActionList.js +57 -0
- package/lib/StandardForm/StepForm.d.ts +19 -0
- package/lib/StandardForm/StepForm.js +295 -0
- package/lib/StandardForm/TabForm.d.ts +19 -0
- package/lib/StandardForm/TabForm.js +148 -0
- package/lib/StandardForm/index.d.ts +32 -0
- package/lib/StandardForm/index.js +197 -0
- package/lib/StandardForm/style/index.less +58 -0
- package/lib/StandardModal/UpdateFormRef.js +32 -0
- package/lib/StandardModal/index.d.ts +44 -0
- package/lib/StandardModal/index.js +525 -0
- package/lib/StandardModal/style/index.less +50 -0
- package/lib/StandardPanel/index.d.ts +28 -0
- package/lib/StandardPanel/index.js +155 -0
- package/lib/StandardPanel/style/index.less +135 -0
- package/lib/StandardTable/index.d.ts +22 -0
- package/lib/StandardTable/index.js +143 -0
- package/lib/StandardTable/style/index.d.ts +1 -0
- package/lib/StandardTable/style/index.js +3 -0
- package/lib/StandardTable/style/index.less +206 -0
- package/lib/components/IconNode/index.d.ts +16 -0
- package/lib/components/IconNode/index.js +39 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +15 -0
- package/lib/data/func.code.js +119 -0
- package/lib/data/general.config.js +179 -0
- package/lib/data/index.js +23 -0
- package/lib/index.d.ts +24 -0
- package/lib/index.js +236 -0
- package/lib/styles/index.less +0 -0
- package/lib/theme/spec-variable.less +48 -0
- package/lib/utils/ValueFormat.js +58 -0
- package/lib/utils/filterPermission.js +127 -0
- package/lib/utils/getParentNodes.js +226 -0
- package/lib/utils/index.js +35 -0
- package/package.json +1 -1
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import "antd/es/rate/style";
|
|
2
|
+
import _Rate from "antd/es/rate";
|
|
3
|
+
import "antd/es/mentions/style";
|
|
4
|
+
import _Mentions from "antd/es/mentions";
|
|
5
|
+
import "antd/es/slider/style";
|
|
6
|
+
import _Slider from "antd/es/slider";
|
|
7
|
+
import "antd/es/switch/style";
|
|
8
|
+
import _Switch from "antd/es/switch";
|
|
9
|
+
import "antd/es/cascader/style";
|
|
10
|
+
import _Cascader from "antd/es/cascader";
|
|
11
|
+
import "antd/es/button/style";
|
|
12
|
+
import _Button from "antd/es/button";
|
|
13
|
+
import "antd/es/time-picker/style";
|
|
14
|
+
import _TimePicker from "antd/es/time-picker";
|
|
15
|
+
import "antd/es/radio/style";
|
|
16
|
+
import _Radio from "antd/es/radio";
|
|
17
|
+
import "antd/es/checkbox/style";
|
|
18
|
+
import _Checkbox from "antd/es/checkbox";
|
|
19
|
+
import "antd/es/input-number/style";
|
|
20
|
+
import _InputNumber from "antd/es/input-number";
|
|
21
|
+
import "antd/es/date-picker/style";
|
|
22
|
+
import _DatePicker from "antd/es/date-picker";
|
|
23
|
+
import "antd/es/select/style";
|
|
24
|
+
import _Select from "antd/es/select";
|
|
25
|
+
import "antd/es/input/style";
|
|
26
|
+
import _Input from "antd/es/input";
|
|
27
|
+
import React from "react";
|
|
28
|
+
import Uploader from '../Uploader';
|
|
29
|
+
import SpecIcon from '../../SpecIcon';
|
|
30
|
+
import RefactorTreeSelect from './RefactorTreeSelect.js';
|
|
31
|
+
import { setSelectValue, setUploaderValue, setDatePickerValue, setTimePickerValue, setCascaderValue } from './setReadonlyValues.js';
|
|
32
|
+
import TitleNode from './TitleNode';
|
|
33
|
+
import ReUpload from './ReUpload';
|
|
34
|
+
var TextArea = _Input.TextArea,
|
|
35
|
+
Password = _Input.Password;
|
|
36
|
+
var Option = _Select.Option;
|
|
37
|
+
var RangePicker = _DatePicker.RangePicker; // 表单组件类型
|
|
38
|
+
|
|
39
|
+
var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
40
|
+
var type = props.type,
|
|
41
|
+
_onChange = props.onChange,
|
|
42
|
+
value = props.value,
|
|
43
|
+
style = props.style,
|
|
44
|
+
placeholder = props.placeholder,
|
|
45
|
+
protoConfig = props.protoConfig,
|
|
46
|
+
_props$treeData = props.treeData,
|
|
47
|
+
treeData = _props$treeData === void 0 ? [] : _props$treeData,
|
|
48
|
+
filedName = props.filedName,
|
|
49
|
+
_props$selectOptionNa = props.selectOptionName,
|
|
50
|
+
selectOptionName = _props$selectOptionNa === void 0 ? {
|
|
51
|
+
value: 'value',
|
|
52
|
+
label: 'label',
|
|
53
|
+
disabled: 'disabled',
|
|
54
|
+
title: 'title'
|
|
55
|
+
} : _props$selectOptionNa,
|
|
56
|
+
fieldNames = props.fieldNames,
|
|
57
|
+
_props$treeOptionName = props.treeOptionName,
|
|
58
|
+
treeOptionName = _props$treeOptionName === void 0 ? {
|
|
59
|
+
title: 'title',
|
|
60
|
+
value: 'value',
|
|
61
|
+
children: 'children',
|
|
62
|
+
disabled: 'disabled'
|
|
63
|
+
} : _props$treeOptionName,
|
|
64
|
+
_props$fieldStatus = props.fieldStatus,
|
|
65
|
+
fieldStatus = _props$fieldStatus === void 0 ? 'default' : _props$fieldStatus,
|
|
66
|
+
_props$size = props.size,
|
|
67
|
+
size = _props$size === void 0 ? 'middle' : _props$size,
|
|
68
|
+
showFullLevel = props.showFullLevel,
|
|
69
|
+
separator = props.separator,
|
|
70
|
+
disabledFields = props.disabledFields,
|
|
71
|
+
selectOptionRender = props.selectOptionRender,
|
|
72
|
+
render = props.render;
|
|
73
|
+
var selectOptions = props.selectOptions;
|
|
74
|
+
var compContent;
|
|
75
|
+
|
|
76
|
+
if (selectOptionName && selectOptions) {
|
|
77
|
+
// 将传值的数据进行转换
|
|
78
|
+
selectOptions = selectOptions.map(function (item) {
|
|
79
|
+
return Object.assign(Object.assign({}, item), {
|
|
80
|
+
value: item[selectOptionName.value || 'value'],
|
|
81
|
+
label: item[selectOptionName.label || 'label'],
|
|
82
|
+
disabled: item[selectOptionName.disabled || 'disabled'],
|
|
83
|
+
title: item[selectOptionName.title || 'title']
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var defaultProps = Object.assign({
|
|
89
|
+
style: style,
|
|
90
|
+
onChange: _onChange,
|
|
91
|
+
value: value,
|
|
92
|
+
render: render,
|
|
93
|
+
size: size,
|
|
94
|
+
ref: ref
|
|
95
|
+
}, protoConfig);
|
|
96
|
+
|
|
97
|
+
if (fieldStatus === 'disabled') {
|
|
98
|
+
defaultProps.disabled = true;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
var sortLimitRule = {}; // 排序字段长度限制
|
|
102
|
+
|
|
103
|
+
if (filedName === 'sorts' || filedName === 'sort' || filedName === 'indexSort' || filedName === 'sorta' || filedName === 'categorySort') {
|
|
104
|
+
sortLimitRule = {
|
|
105
|
+
min: 0,
|
|
106
|
+
max: 999999999,
|
|
107
|
+
maxLength: 9
|
|
108
|
+
};
|
|
109
|
+
} // 设置纯展示模式下的“下拉树”控件返回值
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
var viewOnly = fieldStatus === 'viewOnly'; // 是否纯展示
|
|
113
|
+
|
|
114
|
+
switch (type) {
|
|
115
|
+
case 'input':
|
|
116
|
+
compContent = viewOnly ? value || '-' : /*#__PURE__*/React.createElement(_Input, Object.assign({
|
|
117
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入',
|
|
118
|
+
autoComplete: "off",
|
|
119
|
+
title: fieldStatus === 'disabled' || defaultProps.disabled ? value : null,
|
|
120
|
+
maxLength: defaultProps.maxLength || 50
|
|
121
|
+
}, defaultProps));
|
|
122
|
+
break;
|
|
123
|
+
|
|
124
|
+
case 'password':
|
|
125
|
+
compContent = viewOnly ? value ? "\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF" : '-' : /*#__PURE__*/React.createElement(Password, Object.assign({
|
|
126
|
+
autoComplete: "off",
|
|
127
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入',
|
|
128
|
+
maxLength: defaultProps.maxLength || 50
|
|
129
|
+
}, defaultProps));
|
|
130
|
+
break;
|
|
131
|
+
|
|
132
|
+
case 'textarea':
|
|
133
|
+
compContent = viewOnly ? value || '-' : /*#__PURE__*/React.createElement(TextArea, Object.assign({
|
|
134
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入',
|
|
135
|
+
maxLength: defaultProps.maxLength || 500,
|
|
136
|
+
title: fieldStatus === 'disabled' || defaultProps.disabled ? value : null
|
|
137
|
+
}, defaultProps));
|
|
138
|
+
break;
|
|
139
|
+
|
|
140
|
+
case 'inputNumber':
|
|
141
|
+
compContent = viewOnly ? value || 0 : /*#__PURE__*/React.createElement(_InputNumber, Object.assign({
|
|
142
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入数字'
|
|
143
|
+
}, sortLimitRule, defaultProps, {
|
|
144
|
+
style: Object.assign({
|
|
145
|
+
width: '120px'
|
|
146
|
+
}, defaultProps.style)
|
|
147
|
+
}));
|
|
148
|
+
break;
|
|
149
|
+
|
|
150
|
+
case 'select':
|
|
151
|
+
// 重置返回完整字段值
|
|
152
|
+
var resetResultOption = function resetResultOption(Option) {
|
|
153
|
+
if (!Option) return Option;
|
|
154
|
+
if (Array.isArray(Option)) return selectOptions.filter(function (childOpt) {
|
|
155
|
+
return Option.filter(function (optItem) {
|
|
156
|
+
return childOpt.value === optItem.value;
|
|
157
|
+
}).length > 0;
|
|
158
|
+
}); // 数据为数组
|
|
159
|
+
|
|
160
|
+
var extraParam = selectOptions.filter(function (childOpt) {
|
|
161
|
+
return childOpt.value === Option.value;
|
|
162
|
+
})[0];
|
|
163
|
+
return Object.assign(Object.assign({}, Option), extraParam);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
compContent = viewOnly ? setSelectValue(value, {
|
|
167
|
+
selectOptions: selectOptions,
|
|
168
|
+
selectOptionRender: selectOptionRender,
|
|
169
|
+
defaultProps: defaultProps,
|
|
170
|
+
type: type
|
|
171
|
+
}) : /*#__PURE__*/React.createElement(_Select, Object.assign({
|
|
172
|
+
allowClear: true,
|
|
173
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || "".concat(defaultProps.showSearch ? '请输入选择' : '请选择'),
|
|
174
|
+
filterOption: function filterOption(inputValue, option) {
|
|
175
|
+
return defaultProps.showSearch ? option.children.toLowerCase().indexOf(inputValue.toLowerCase()) >= 0 : false;
|
|
176
|
+
},
|
|
177
|
+
value: value
|
|
178
|
+
}, defaultProps, {
|
|
179
|
+
// onChange返回参数:累加当前选中包括其他字段值的数据
|
|
180
|
+
onChange: function onChange(value, Option) {
|
|
181
|
+
return _onChange(value, resetResultOption(Option));
|
|
182
|
+
}
|
|
183
|
+
}), fieldNames ? null : selectOptions.map(function (val, index) {
|
|
184
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
185
|
+
value: val.value,
|
|
186
|
+
key: val.value || index,
|
|
187
|
+
title: selectOptionRender ? selectOptionRender(val) : val.title || val.label,
|
|
188
|
+
disabled: val.disabled
|
|
189
|
+
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
190
|
+
}));
|
|
191
|
+
break;
|
|
192
|
+
|
|
193
|
+
case 'tree-select':
|
|
194
|
+
compContent = /*#__PURE__*/React.createElement(RefactorTreeSelect, Object.assign({
|
|
195
|
+
treeData: treeData,
|
|
196
|
+
treeOptionName: treeOptionName,
|
|
197
|
+
allowClear: true,
|
|
198
|
+
separator: separator,
|
|
199
|
+
showFullLevel: showFullLevel,
|
|
200
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请选择',
|
|
201
|
+
protoTreeNode: protoConfig && protoConfig.TreeNode || {},
|
|
202
|
+
fieldStatus: fieldStatus,
|
|
203
|
+
disabledFields: disabledFields
|
|
204
|
+
}, defaultProps));
|
|
205
|
+
break;
|
|
206
|
+
|
|
207
|
+
case 'checkbox':
|
|
208
|
+
delete defaultProps.ref;
|
|
209
|
+
compContent = viewOnly ? setSelectValue(value, {
|
|
210
|
+
selectOptions: selectOptions,
|
|
211
|
+
selectOptionRender: selectOptionRender,
|
|
212
|
+
defaultProps: defaultProps,
|
|
213
|
+
separator: separator
|
|
214
|
+
}) : /*#__PURE__*/React.createElement(_Checkbox.Group, Object.assign({}, defaultProps, {
|
|
215
|
+
style: Object.assign({
|
|
216
|
+
width: 'auto'
|
|
217
|
+
}, defaultProps.style)
|
|
218
|
+
}), selectOptions && selectOptions.map(function (val, index) {
|
|
219
|
+
return /*#__PURE__*/React.createElement(_Checkbox, {
|
|
220
|
+
value: val.value,
|
|
221
|
+
key: val.value || index,
|
|
222
|
+
// @ts-ignore
|
|
223
|
+
title: /*#__PURE__*/React.createElement(TitleNode, {
|
|
224
|
+
render: selectOptionRender,
|
|
225
|
+
data: val
|
|
226
|
+
}),
|
|
227
|
+
// title={selectOptionRender ? selectOptionRender(val) : (val.title || val.label)}
|
|
228
|
+
disabled: val.disabled
|
|
229
|
+
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
230
|
+
}));
|
|
231
|
+
break;
|
|
232
|
+
|
|
233
|
+
case 'radio':
|
|
234
|
+
delete defaultProps.ref;
|
|
235
|
+
compContent = viewOnly ? setSelectValue(value, {
|
|
236
|
+
selectOptions: selectOptions,
|
|
237
|
+
selectOptionRender: selectOptionRender,
|
|
238
|
+
defaultProps: defaultProps
|
|
239
|
+
}) : /*#__PURE__*/React.createElement(_Radio.Group, Object.assign({}, defaultProps, {
|
|
240
|
+
style: Object.assign({
|
|
241
|
+
width: 'auto'
|
|
242
|
+
}, defaultProps.style)
|
|
243
|
+
}), selectOptions && selectOptions.map(function (val, index) {
|
|
244
|
+
if (defaultProps.optionType === 'button') {
|
|
245
|
+
return /*#__PURE__*/React.createElement(_Radio.Button, {
|
|
246
|
+
value: val.value,
|
|
247
|
+
key: val.value || index,
|
|
248
|
+
// @ts-ignore
|
|
249
|
+
title: /*#__PURE__*/React.createElement(TitleNode, {
|
|
250
|
+
render: selectOptionRender,
|
|
251
|
+
data: val
|
|
252
|
+
}),
|
|
253
|
+
disabled: val.disabled
|
|
254
|
+
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return /*#__PURE__*/React.createElement(_Radio, {
|
|
258
|
+
value: val.value,
|
|
259
|
+
key: val.value,
|
|
260
|
+
// @ts-ignore
|
|
261
|
+
title: /*#__PURE__*/React.createElement(TitleNode, {
|
|
262
|
+
render: selectOptionRender,
|
|
263
|
+
data: val
|
|
264
|
+
}),
|
|
265
|
+
disabled: val.disabled
|
|
266
|
+
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
267
|
+
}));
|
|
268
|
+
break;
|
|
269
|
+
|
|
270
|
+
case 'datePicker': // 使用配置 picker设置其属于week,month,year
|
|
271
|
+
|
|
272
|
+
case 'dateTimePicker':
|
|
273
|
+
compContent = viewOnly ? setDatePickerValue(value, {
|
|
274
|
+
type: type,
|
|
275
|
+
protoConfig: protoConfig
|
|
276
|
+
}) : /*#__PURE__*/React.createElement(_DatePicker, Object.assign({
|
|
277
|
+
showTime: defaultProps.showTime || type === 'dateTimePicker',
|
|
278
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请选择'
|
|
279
|
+
}, defaultProps, {
|
|
280
|
+
style: Object.assign({
|
|
281
|
+
'minWidth': 'auto'
|
|
282
|
+
}, defaultProps.style)
|
|
283
|
+
}));
|
|
284
|
+
break;
|
|
285
|
+
|
|
286
|
+
case 'rangePicker':
|
|
287
|
+
case 'rangeTimePicker':
|
|
288
|
+
if (fieldStatus === 'disabled' || defaultProps.disabled) defaultProps.placeholder = ''; // 禁用时,placeHolder不显示
|
|
289
|
+
|
|
290
|
+
compContent = viewOnly ? setDatePickerValue(value, {
|
|
291
|
+
type: type,
|
|
292
|
+
protoConfig: protoConfig
|
|
293
|
+
}) : /*#__PURE__*/React.createElement(RangePicker, Object.assign({
|
|
294
|
+
showTime: defaultProps.showTime || type === 'rangeTimePicker'
|
|
295
|
+
}, defaultProps, {
|
|
296
|
+
style: Object.assign({
|
|
297
|
+
width: type === 'rangeTimePicker' ? 'auto' : '100%'
|
|
298
|
+
}, defaultProps.style)
|
|
299
|
+
}));
|
|
300
|
+
break;
|
|
301
|
+
|
|
302
|
+
case 'timePicker':
|
|
303
|
+
if (fieldStatus === 'disabled' || defaultProps.disabled) defaultProps.placeholder = ''; // 禁用时,placeHolder不显示
|
|
304
|
+
|
|
305
|
+
compContent = viewOnly ? setTimePickerValue(value, {
|
|
306
|
+
type: type,
|
|
307
|
+
protoConfig: protoConfig
|
|
308
|
+
}) : /*#__PURE__*/React.createElement(_TimePicker, Object.assign({}, defaultProps, {
|
|
309
|
+
style: Object.assign(Object.assign({
|
|
310
|
+
'minWidth': 'auto'
|
|
311
|
+
}, defaultProps.style), {
|
|
312
|
+
width: 'auto'
|
|
313
|
+
})
|
|
314
|
+
}));
|
|
315
|
+
break;
|
|
316
|
+
|
|
317
|
+
case 'timePickerRange':
|
|
318
|
+
if (fieldStatus === 'disabled' || defaultProps.disabled) defaultProps.placeholder = ''; // 禁用时,placeHolder不显示
|
|
319
|
+
// @ts-ignore
|
|
320
|
+
|
|
321
|
+
compContent = viewOnly ? setTimePickerValue(value, {
|
|
322
|
+
type: type,
|
|
323
|
+
protoConfig: protoConfig
|
|
324
|
+
}) : /*#__PURE__*/React.createElement(_TimePicker.RangePicker, Object.assign({}, defaultProps, {
|
|
325
|
+
style: Object.assign(Object.assign({
|
|
326
|
+
'minWidth': 'auto'
|
|
327
|
+
}, defaultProps.style), {
|
|
328
|
+
width: 'auto'
|
|
329
|
+
})
|
|
330
|
+
}));
|
|
331
|
+
break;
|
|
332
|
+
|
|
333
|
+
case 'upload':
|
|
334
|
+
compContent = viewOnly && (!value || value.length === 0) ? '-' : /*#__PURE__*/React.createElement(ReUpload, Object.assign({}, defaultProps, {
|
|
335
|
+
viewOnly: viewOnly,
|
|
336
|
+
disabled: viewOnly || fieldStatus === 'disabled' || defaultProps.disabled
|
|
337
|
+
}), defaultProps.children ? defaultProps.children : defaultProps.fileList && defaultProps.fileList.length >= 1 || defaultProps.defaultFileList && defaultProps.defaultFileList.length >= 1 ? null : /*#__PURE__*/React.createElement(React.Fragment, null, defaultProps.listType === 'picture-card' ? /*#__PURE__*/React.createElement("div", {
|
|
338
|
+
className: 'spec-uploader-control'
|
|
339
|
+
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
340
|
+
name: "plus"
|
|
341
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
342
|
+
className: "ant-upload-text"
|
|
343
|
+
}, "\u70B9\u51FB\u9009\u62E9")) : /*#__PURE__*/React.createElement(_Button, null, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
344
|
+
name: "upload"
|
|
345
|
+
}), " \u70B9\u51FB\u4E0A\u4F20")));
|
|
346
|
+
break;
|
|
347
|
+
|
|
348
|
+
case 'uploader':
|
|
349
|
+
compContent = viewOnly ? setUploaderValue(value) : /*#__PURE__*/React.createElement(Uploader, Object.assign({}, defaultProps, {
|
|
350
|
+
size: protoConfig === null || protoConfig === void 0 ? void 0 : protoConfig.size
|
|
351
|
+
})); // compContent = <Uploader {...defaultProps}></Uploader>
|
|
352
|
+
|
|
353
|
+
break;
|
|
354
|
+
|
|
355
|
+
case 'cascader':
|
|
356
|
+
compContent = viewOnly ? setCascaderValue(value, {
|
|
357
|
+
selectOptions: selectOptions,
|
|
358
|
+
selectOptionRender: selectOptionRender,
|
|
359
|
+
defaultProps: defaultProps
|
|
360
|
+
}) : /*#__PURE__*/React.createElement(_Cascader, Object.assign({
|
|
361
|
+
options: selectOptions,
|
|
362
|
+
allowClear: true,
|
|
363
|
+
fieldNames: fieldNames || selectOptionName,
|
|
364
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请选择'
|
|
365
|
+
}, defaultProps));
|
|
366
|
+
break;
|
|
367
|
+
|
|
368
|
+
case 'switch':
|
|
369
|
+
compContent = /*#__PURE__*/React.createElement(_Switch, Object.assign({}, defaultProps, {
|
|
370
|
+
disabled: viewOnly || defaultProps.disabled,
|
|
371
|
+
checked: value,
|
|
372
|
+
style: Object.assign(Object.assign({}, defaultProps.style), {
|
|
373
|
+
width: 'auto'
|
|
374
|
+
})
|
|
375
|
+
})); // compContent = viewOnly ? (String(value) === 'undefined' ? '-' : String(value)) : (<Switch {...defaultProps} checked={value} style={{ ...defaultProps.style, width: 'auto' }} />)
|
|
376
|
+
|
|
377
|
+
break;
|
|
378
|
+
|
|
379
|
+
case 'slider':
|
|
380
|
+
compContent = viewOnly ? value : /*#__PURE__*/React.createElement(_Slider, Object.assign({}, defaultProps, {
|
|
381
|
+
style: Object.assign({}, defaultProps.style)
|
|
382
|
+
}));
|
|
383
|
+
break;
|
|
384
|
+
|
|
385
|
+
case 'mentions':
|
|
386
|
+
compContent = viewOnly ? value : /*#__PURE__*/React.createElement(_Mentions, Object.assign({
|
|
387
|
+
placeholder: "\u8BF7\u8F93\u5165 ".concat(defaultProps.prefix || '@', " \u9009\u62E9")
|
|
388
|
+
}, defaultProps), selectOptions.map(function (val, index) {
|
|
389
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
390
|
+
value: val.value || index,
|
|
391
|
+
key: val.value
|
|
392
|
+
}, selectOptionRender ? selectOptionRender(val) : val.label);
|
|
393
|
+
}));
|
|
394
|
+
break;
|
|
395
|
+
|
|
396
|
+
case 'rate':
|
|
397
|
+
compContent = /*#__PURE__*/React.createElement(_Rate, Object.assign({
|
|
398
|
+
disabled: viewOnly || defaultProps.disabled
|
|
399
|
+
}, defaultProps));
|
|
400
|
+
break;
|
|
401
|
+
|
|
402
|
+
case 'custom':
|
|
403
|
+
compContent = defaultProps.render && defaultProps.render(props) || defaultProps.customRender && defaultProps.customRender(props) || null;
|
|
404
|
+
break;
|
|
405
|
+
|
|
406
|
+
default:
|
|
407
|
+
compContent = value;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return compContent;
|
|
412
|
+
});
|
|
413
|
+
export default FieldComponent;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import "antd/es/image/style";
|
|
2
|
+
import _Image from "antd/es/image";
|
|
3
|
+
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
|
|
6
|
+
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."); }
|
|
7
|
+
|
|
8
|
+
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); }
|
|
9
|
+
|
|
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
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
|
|
16
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
17
|
+
import moment from 'moment';
|
|
18
|
+
import { getBase64 } from "../Uploader/util"; // 设置纯展示模式下的级联选择显示值
|
|
19
|
+
|
|
20
|
+
var setCascaderValue = function setCascaderValue(value, props) {
|
|
21
|
+
var selectOptions = props.selectOptions,
|
|
22
|
+
defaultProps = props.defaultProps;
|
|
23
|
+
if (!value || value.length === 0 || !selectOptions) return '-'; // 无值情况 下
|
|
24
|
+
|
|
25
|
+
var matchNode = undefined;
|
|
26
|
+
var matchValueItems = [];
|
|
27
|
+
value.forEach(function (valKey) {
|
|
28
|
+
var matchValue; // 第一个值使用 ‘selectOptions’查找,后面使用上一次匹配到的父节点查找 matchNode
|
|
29
|
+
|
|
30
|
+
if (matchNode && matchNode.children) {
|
|
31
|
+
matchValue = matchNode.children.filter(function (seItem) {
|
|
32
|
+
return seItem.value == valKey;
|
|
33
|
+
});
|
|
34
|
+
} else {
|
|
35
|
+
matchValue = selectOptions.filter(function (seItem) {
|
|
36
|
+
return seItem.value == valKey;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (matchValue.length > 0) {
|
|
41
|
+
matchNode = matchValue[0];
|
|
42
|
+
matchValueItems.push(matchValue[0]);
|
|
43
|
+
}
|
|
44
|
+
}); // 如果自定义"选择后展示的渲染函数"则直接返回此选择方法
|
|
45
|
+
|
|
46
|
+
if (defaultProps.displayRender) return defaultProps.displayRender(matchValueItems.map(function (item) {
|
|
47
|
+
return item.label;
|
|
48
|
+
}), matchValueItems);
|
|
49
|
+
return matchValueItems.map(function (item) {
|
|
50
|
+
return item.label;
|
|
51
|
+
}).join('/');
|
|
52
|
+
}; // 设置纯展示模式下的下拉、单选、多选表单值
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
var setSelectValue = function setSelectValue(value, props) {
|
|
56
|
+
var selectOptions = props.selectOptions,
|
|
57
|
+
selectOptionRender = props.selectOptionRender,
|
|
58
|
+
defaultProps = props.defaultProps,
|
|
59
|
+
type = props.type,
|
|
60
|
+
separator = props.separator;
|
|
61
|
+
var labelInValue = defaultProps.labelInValue;
|
|
62
|
+
if (!value && value !== 0 || !selectOptions) return '-'; // 无值情况 下
|
|
63
|
+
// 数组情况
|
|
64
|
+
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
if (value.length == 0) {
|
|
67
|
+
return '-'; // 无值情况 下
|
|
68
|
+
} // 返回是数组
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var matchValues = [];
|
|
72
|
+
value.forEach(function (valKey, index) {
|
|
73
|
+
var matchValue = selectOptions.filter(function (seItem) {
|
|
74
|
+
return seItem.value == (labelInValue ? valKey.value : valKey);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (matchValue.length > 0) {
|
|
78
|
+
// 如果 select 配置选项展示内容,则直接使用其配置值展示当前只读信息
|
|
79
|
+
if (selectOptionRender) {
|
|
80
|
+
matchValues.push( /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
key: index,
|
|
82
|
+
className: "checkbox-viewonly-item"
|
|
83
|
+
}, selectOptionRender(matchValue[0]), value.length - 1 > index ? separator ? separator : separator == null ? '' : ',' : ''));
|
|
84
|
+
} else {
|
|
85
|
+
matchValues.push(matchValue[0].label);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}); // 如果 select 配置选项展示内容,则直接使用其配置值展示当前只读信息
|
|
89
|
+
|
|
90
|
+
if (selectOptionRender) {
|
|
91
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "checkbox-viewonly-list"
|
|
93
|
+
}, matchValues);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return matchValues.join(separator ? separator : ',');
|
|
97
|
+
} else {
|
|
98
|
+
// 如select配置labelInValue则value返回数据是对象{key: 'xxx'}
|
|
99
|
+
var matchValue = selectOptions.filter(function (seItem) {
|
|
100
|
+
return seItem.value == (labelInValue ? value.value : value);
|
|
101
|
+
}); // 如果 select 配置选项展示内容,则直接使用其配置值展示当前只读信息
|
|
102
|
+
|
|
103
|
+
if (selectOptionRender) {
|
|
104
|
+
return matchValue.length > 0 ? selectOptionRender(matchValue[0]) : '-';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return matchValue.length > 0 ? matchValue[0].label : '-';
|
|
108
|
+
}
|
|
109
|
+
}; // 设置纯展示模式下的日期控件值
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
var setDatePickerValue = function setDatePickerValue(value, props) {
|
|
113
|
+
var type = props.type,
|
|
114
|
+
protoConfig = props.protoConfig;
|
|
115
|
+
if (!value && value !== 0) return '-'; // 无值情况 下
|
|
116
|
+
// 数组情况 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'
|
|
117
|
+
|
|
118
|
+
switch (type) {
|
|
119
|
+
case 'datePicker':
|
|
120
|
+
return moment(value).format(protoConfig && protoConfig.format || 'YYYY-MM-DD');
|
|
121
|
+
break;
|
|
122
|
+
|
|
123
|
+
case 'dateTimePicker':
|
|
124
|
+
return moment(value).format(protoConfig && protoConfig.format || 'YYYY-MM-DD HH:mm:ss');
|
|
125
|
+
break;
|
|
126
|
+
|
|
127
|
+
case 'rangePicker':
|
|
128
|
+
return "".concat(moment(value[0]).format(protoConfig && protoConfig.format || 'YYYY-MM-DD'), " - ").concat(moment(value[1]).format(protoConfig && protoConfig.format || 'YYYY-MM-DD'));
|
|
129
|
+
break;
|
|
130
|
+
|
|
131
|
+
case 'rangeTimePicker':
|
|
132
|
+
return "".concat(moment(value[0]).format(protoConfig && protoConfig.format || 'YYYY-MM-DD HH:mm:ss'), " - ").concat(moment(value[1]).format(protoConfig && protoConfig.format || 'YYYY-MM-DD HH:mm:ss'));
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
case 'monthPicker':
|
|
136
|
+
return moment(value).format(protoConfig && protoConfig.format || 'MM月');
|
|
137
|
+
break;
|
|
138
|
+
|
|
139
|
+
default:
|
|
140
|
+
return '-';
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}; // 设置纯展示模式下的时间控件值
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
var setTimePickerValue = function setTimePickerValue(value, props) {
|
|
147
|
+
var type = props.type,
|
|
148
|
+
protoConfig = props.protoConfig;
|
|
149
|
+
if (!value && value !== 0) return '-'; // 无值情况 下
|
|
150
|
+
|
|
151
|
+
switch (type) {
|
|
152
|
+
case 'timePicker':
|
|
153
|
+
return moment(value).format(protoConfig && protoConfig.format || 'HH:mm:ss');
|
|
154
|
+
break;
|
|
155
|
+
|
|
156
|
+
case 'timePickerRange':
|
|
157
|
+
return "".concat(moment(value[0]).format(protoConfig && protoConfig.format || 'HH:mm:ss'), " - ").concat(moment(value[1]).format(protoConfig && protoConfig.format || 'HH:mm:ss'));
|
|
158
|
+
break;
|
|
159
|
+
|
|
160
|
+
default:
|
|
161
|
+
return '-';
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}; // 设置纯展示模式下上传控件显示值
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
var setUploaderValue = function setUploaderValue(value, props) {
|
|
168
|
+
if (!value && value !== 0) return '-'; // 无值情况 下
|
|
169
|
+
|
|
170
|
+
if (Array.isArray(value)) {
|
|
171
|
+
var _useState = useState(),
|
|
172
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
173
|
+
previews = _useState2[0],
|
|
174
|
+
setPreviews = _useState2[1];
|
|
175
|
+
|
|
176
|
+
useEffect(function () {
|
|
177
|
+
var previewsUlr = [];
|
|
178
|
+
value.forEach(function (vItem) {
|
|
179
|
+
if (vItem === null || vItem === void 0 ? void 0 : vItem.downloadUrl) {
|
|
180
|
+
previewsUlr.push({
|
|
181
|
+
url: vItem.downloadUrl
|
|
182
|
+
});
|
|
183
|
+
setPreviews(previewsUlr.filter(function (pItem) {
|
|
184
|
+
return pItem;
|
|
185
|
+
}));
|
|
186
|
+
} else {
|
|
187
|
+
if (vItem === null || vItem === void 0 ? void 0 : vItem.originFileObj) getBase64(vItem.originFileObj).then(function (result) {
|
|
188
|
+
previewsUlr.push(result);
|
|
189
|
+
setPreviews(previewsUlr.filter(function (pItem) {
|
|
190
|
+
return pItem;
|
|
191
|
+
}));
|
|
192
|
+
return result;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}, [value]);
|
|
197
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
198
|
+
className: 'spec-uploader-viewonly'
|
|
199
|
+
}, /*#__PURE__*/React.createElement(_Image.PreviewGroup, null, previews && (previews === null || previews === void 0 ? void 0 : previews.map(function (item, index) {
|
|
200
|
+
return (item === null || item === void 0 ? void 0 : item.url) ? /*#__PURE__*/React.createElement(_Image, {
|
|
201
|
+
key: index,
|
|
202
|
+
width: 100,
|
|
203
|
+
height: 100,
|
|
204
|
+
style: {
|
|
205
|
+
objectFit: 'contain'
|
|
206
|
+
},
|
|
207
|
+
src: item.url
|
|
208
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
209
|
+
key: index,
|
|
210
|
+
className: "spec-uploader-viewonly-item"
|
|
211
|
+
}, "\u6682\u65E0\u56FE\u7247");
|
|
212
|
+
}))));
|
|
213
|
+
} else {
|
|
214
|
+
var _useState3 = useState(),
|
|
215
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
216
|
+
preview = _useState4[0],
|
|
217
|
+
setPreview = _useState4[1];
|
|
218
|
+
|
|
219
|
+
useEffect(function () {
|
|
220
|
+
getBase64(value).then(function (result) {
|
|
221
|
+
setPreview(result);
|
|
222
|
+
});
|
|
223
|
+
}, [value]);
|
|
224
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
225
|
+
className: "spec-uploader-viewonly"
|
|
226
|
+
}, preview ? /*#__PURE__*/React.createElement(_Image, {
|
|
227
|
+
style: {
|
|
228
|
+
objectFit: 'contain'
|
|
229
|
+
},
|
|
230
|
+
width: 100,
|
|
231
|
+
src: preview === null || preview === void 0 ? void 0 : preview.url
|
|
232
|
+
}) : '暂无图片');
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export { setCascaderValue, setSelectValue, setDatePickerValue, setTimePickerValue, setUploaderValue };
|