fan-standard-comp 3.1.2 → 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.
Files changed (244) hide show
  1. package/package.json +1 -1
  2. package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
  3. package/dist/fan-standard-comp.umd.js +0 -597
  4. package/dist/fonts/iconfont.eot +0 -0
  5. package/dist/fonts/iconfont.ttf +0 -0
  6. package/dist/fonts/iconfont.woff +0 -0
  7. package/es/ButtonGroup/ButtonList.d.ts +0 -2
  8. package/es/ButtonGroup/ButtonList.js +0 -37
  9. package/es/ButtonGroup/ButtonMenu.d.ts +0 -2
  10. package/es/ButtonGroup/ButtonMenu.js +0 -38
  11. package/es/ButtonGroup/PopConfirmTitle.d.ts +0 -9
  12. package/es/ButtonGroup/PopConfirmTitle.js +0 -37
  13. package/es/ButtonGroup/index.d.ts +0 -30
  14. package/es/ButtonGroup/index.js +0 -374
  15. package/es/ButtonGroup/style/index.less +0 -36
  16. package/es/DragContent/DragBar.js +0 -21
  17. package/es/DragContent/index.d.ts +0 -14
  18. package/es/DragContent/index.js +0 -173
  19. package/es/DragContent/index.less +0 -44
  20. package/es/FormComp/ChunkUploader/api.js +0 -76
  21. package/es/FormComp/ChunkUploader/index.js +0 -391
  22. package/es/FormComp/ChunkUploader/lib.js +0 -96
  23. package/es/FormComp/ChunkUploader/style/style.less +0 -3
  24. package/es/FormComp/ChunkUploader/upload-queue.class.js +0 -167
  25. package/es/FormComp/ChunkUploader/worker.js +0 -23
  26. package/es/FormComp/EditButton/index.d.ts +0 -26
  27. package/es/FormComp/EditButton/index.js +0 -140
  28. package/es/FormComp/FieldComponent/ReUpload.d.ts +0 -3
  29. package/es/FormComp/FieldComponent/ReUpload.js +0 -131
  30. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +0 -245
  31. package/es/FormComp/FieldComponent/TitleNode.d.ts +0 -6
  32. package/es/FormComp/FieldComponent/TitleNode.js +0 -9
  33. package/es/FormComp/FieldComponent/index.d.ts +0 -38
  34. package/es/FormComp/FieldComponent/index.js +0 -413
  35. package/es/FormComp/FieldComponent/setReadonlyValues.js +0 -236
  36. package/es/FormComp/FieldComponent/style/index.less +0 -116
  37. package/es/FormComp/RenderItemGroup/index.d.ts +0 -37
  38. package/es/FormComp/RenderItemGroup/index.js +0 -234
  39. package/es/FormComp/Uploader/index.d.ts +0 -19
  40. package/es/FormComp/Uploader/index.js +0 -275
  41. package/es/FormComp/Uploader/style/index.less +0 -14
  42. package/es/FormComp/Uploader/util.d.ts +0 -8
  43. package/es/FormComp/Uploader/util.js +0 -38
  44. package/es/FormComp/VarTemplate/index.js +0 -293
  45. package/es/FormComp/index.d.ts +0 -1
  46. package/es/FormComp/index.js +0 -1
  47. package/es/NavLeafScroll/index.js +0 -379
  48. package/es/NavLeafScroll/style/index.less +0 -119
  49. package/es/RefactorTree/data.d.ts +0 -7
  50. package/es/RefactorTree/index.d.ts +0 -40
  51. package/es/RefactorTree/index.js +0 -167
  52. package/es/RefactorTree/indexTreeNode.d.ts +0 -39
  53. package/es/RefactorTree/indexTreeNode.js +0 -237
  54. package/es/RefactorTree/style/index.d.ts +0 -1
  55. package/es/RefactorTree/style/index.js +0 -1
  56. package/es/RefactorTree/style/index.less +0 -22
  57. package/es/RefactorTree/util.d.ts +0 -42
  58. package/es/RefactorTree/util.js +0 -187
  59. package/es/SpecIcon/fonts/demo.css +0 -539
  60. package/es/SpecIcon/fonts/demo_index.html +0 -1315
  61. package/es/SpecIcon/fonts/iconfont.css +0 -211
  62. package/es/SpecIcon/fonts/iconfont.eot +0 -0
  63. package/es/SpecIcon/fonts/iconfont.js +0 -41
  64. package/es/SpecIcon/fonts/iconfont.json +0 -352
  65. package/es/SpecIcon/fonts/iconfont.svg +0 -173
  66. package/es/SpecIcon/fonts/iconfont.ttf +0 -0
  67. package/es/SpecIcon/fonts/iconfont.woff +0 -0
  68. package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
  69. package/es/SpecIcon/index.d.ts +0 -17
  70. package/es/SpecIcon/index.js +0 -77
  71. package/es/SpecIcon/style/iconfont.less +0 -213
  72. package/es/SpecIcon/style/index.less +0 -98
  73. package/es/SplitterLayout/Pane.d.ts +0 -13
  74. package/es/SplitterLayout/Pane.js +0 -36
  75. package/es/SplitterLayout/index.js +0 -375
  76. package/es/SplitterLayout/index.less +0 -58
  77. package/es/StandardContent/SplitterLayout/Pane.js +0 -50
  78. package/es/StandardContent/SplitterLayout/index.js +0 -374
  79. package/es/StandardContent/SplitterLayout/index.less +0 -58
  80. package/es/StandardContent/SubfieldContent.d.ts +0 -17
  81. package/es/StandardContent/SubfieldContent.js +0 -41
  82. package/es/StandardContent/WrapperContent.d.ts +0 -13
  83. package/es/StandardContent/WrapperContent.js +0 -29
  84. package/es/StandardContent/data.d.ts +0 -101
  85. package/es/StandardContent/style/index.less +0 -80
  86. package/es/StandardDragModal/index.d.ts +0 -11
  87. package/es/StandardDragModal/index.js +0 -30
  88. package/es/StandardFilter/index.d.ts +0 -35
  89. package/es/StandardFilter/index.js +0 -253
  90. package/es/StandardFilter/style/index.less +0 -62
  91. package/es/StandardForm/ActionList.js +0 -44
  92. package/es/StandardForm/StepForm.d.ts +0 -19
  93. package/es/StandardForm/StepForm.js +0 -267
  94. package/es/StandardForm/TabForm.d.ts +0 -19
  95. package/es/StandardForm/TabForm.js +0 -122
  96. package/es/StandardForm/index.d.ts +0 -32
  97. package/es/StandardForm/index.js +0 -170
  98. package/es/StandardForm/style/index.less +0 -58
  99. package/es/StandardModal/UpdateFormRef.js +0 -18
  100. package/es/StandardModal/index.d.ts +0 -44
  101. package/es/StandardModal/index.js +0 -495
  102. package/es/StandardModal/style/index.less +0 -50
  103. package/es/StandardPanel/index.d.ts +0 -28
  104. package/es/StandardPanel/index.js +0 -134
  105. package/es/StandardPanel/style/index.less +0 -135
  106. package/es/StandardTable/index.d.ts +0 -22
  107. package/es/StandardTable/index.js +0 -126
  108. package/es/StandardTable/style/index.d.ts +0 -1
  109. package/es/StandardTable/style/index.js +0 -1
  110. package/es/StandardTable/style/index.less +0 -206
  111. package/es/components/IconNode/index.d.ts +0 -16
  112. package/es/components/IconNode/index.js +0 -28
  113. package/es/components/index.d.ts +0 -2
  114. package/es/components/index.js +0 -2
  115. package/es/data/func.code.js +0 -112
  116. package/es/data/general.config.js +0 -172
  117. package/es/data/index.js +0 -3
  118. package/es/index.d.ts +0 -24
  119. package/es/index.js +0 -31
  120. package/es/styles/index.less +0 -0
  121. package/es/theme/spec-variable.less +0 -48
  122. package/es/utils/ValueFormat.js +0 -50
  123. package/es/utils/filterPermission.js +0 -111
  124. package/es/utils/getParentNodes.js +0 -215
  125. package/es/utils/index.js +0 -3
  126. package/lib/ButtonGroup/ButtonList.d.ts +0 -2
  127. package/lib/ButtonGroup/ButtonList.js +0 -55
  128. package/lib/ButtonGroup/ButtonMenu.d.ts +0 -2
  129. package/lib/ButtonGroup/ButtonMenu.js +0 -51
  130. package/lib/ButtonGroup/PopConfirmTitle.d.ts +0 -9
  131. package/lib/ButtonGroup/PopConfirmTitle.js +0 -48
  132. package/lib/ButtonGroup/index.d.ts +0 -30
  133. package/lib/ButtonGroup/index.js +0 -405
  134. package/lib/ButtonGroup/style/index.less +0 -36
  135. package/lib/DragContent/DragBar.js +0 -33
  136. package/lib/DragContent/index.d.ts +0 -14
  137. package/lib/DragContent/index.js +0 -191
  138. package/lib/DragContent/index.less +0 -44
  139. package/lib/FormComp/ChunkUploader/api.js +0 -89
  140. package/lib/FormComp/ChunkUploader/index.js +0 -410
  141. package/lib/FormComp/ChunkUploader/lib.js +0 -113
  142. package/lib/FormComp/ChunkUploader/style/style.less +0 -3
  143. package/lib/FormComp/ChunkUploader/upload-queue.class.js +0 -174
  144. package/lib/FormComp/ChunkUploader/worker.js +0 -28
  145. package/lib/FormComp/EditButton/index.d.ts +0 -26
  146. package/lib/FormComp/EditButton/index.js +0 -159
  147. package/lib/FormComp/FieldComponent/ReUpload.d.ts +0 -3
  148. package/lib/FormComp/FieldComponent/ReUpload.js +0 -151
  149. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +0 -268
  150. package/lib/FormComp/FieldComponent/TitleNode.d.ts +0 -6
  151. package/lib/FormComp/FieldComponent/TitleNode.js +0 -19
  152. package/lib/FormComp/FieldComponent/index.d.ts +0 -38
  153. package/lib/FormComp/FieldComponent/index.js +0 -457
  154. package/lib/FormComp/FieldComponent/setReadonlyValues.js +0 -263
  155. package/lib/FormComp/FieldComponent/style/index.less +0 -116
  156. package/lib/FormComp/RenderItemGroup/index.d.ts +0 -37
  157. package/lib/FormComp/RenderItemGroup/index.js +0 -255
  158. package/lib/FormComp/Uploader/index.d.ts +0 -19
  159. package/lib/FormComp/Uploader/index.js +0 -301
  160. package/lib/FormComp/Uploader/style/index.less +0 -14
  161. package/lib/FormComp/Uploader/util.d.ts +0 -8
  162. package/lib/FormComp/Uploader/util.js +0 -47
  163. package/lib/FormComp/VarTemplate/index.js +0 -308
  164. package/lib/FormComp/index.d.ts +0 -1
  165. package/lib/FormComp/index.js +0 -15
  166. package/lib/NavLeafScroll/index.js +0 -397
  167. package/lib/NavLeafScroll/style/index.less +0 -119
  168. package/lib/RefactorTree/data.d.ts +0 -7
  169. package/lib/RefactorTree/index.d.ts +0 -40
  170. package/lib/RefactorTree/index.js +0 -190
  171. package/lib/RefactorTree/indexTreeNode.d.ts +0 -39
  172. package/lib/RefactorTree/indexTreeNode.js +0 -260
  173. package/lib/RefactorTree/style/index.d.ts +0 -1
  174. package/lib/RefactorTree/style/index.js +0 -3
  175. package/lib/RefactorTree/style/index.less +0 -22
  176. package/lib/RefactorTree/util.d.ts +0 -42
  177. package/lib/RefactorTree/util.js +0 -195
  178. package/lib/SpecIcon/fonts/demo.css +0 -539
  179. package/lib/SpecIcon/fonts/demo_index.html +0 -1315
  180. package/lib/SpecIcon/fonts/iconfont.css +0 -211
  181. package/lib/SpecIcon/fonts/iconfont.eot +0 -0
  182. package/lib/SpecIcon/fonts/iconfont.js +0 -43
  183. package/lib/SpecIcon/fonts/iconfont.json +0 -352
  184. package/lib/SpecIcon/fonts/iconfont.svg +0 -173
  185. package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
  186. package/lib/SpecIcon/fonts/iconfont.woff +0 -0
  187. package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
  188. package/lib/SpecIcon/index.d.ts +0 -17
  189. package/lib/SpecIcon/index.js +0 -90
  190. package/lib/SpecIcon/style/iconfont.less +0 -213
  191. package/lib/SpecIcon/style/index.less +0 -98
  192. package/lib/SplitterLayout/Pane.d.ts +0 -13
  193. package/lib/SplitterLayout/Pane.js +0 -48
  194. package/lib/SplitterLayout/index.js +0 -386
  195. package/lib/SplitterLayout/index.less +0 -58
  196. package/lib/StandardContent/SplitterLayout/Pane.js +0 -62
  197. package/lib/StandardContent/SplitterLayout/index.js +0 -387
  198. package/lib/StandardContent/SplitterLayout/index.less +0 -58
  199. package/lib/StandardContent/SubfieldContent.d.ts +0 -17
  200. package/lib/StandardContent/SubfieldContent.js +0 -56
  201. package/lib/StandardContent/WrapperContent.d.ts +0 -13
  202. package/lib/StandardContent/WrapperContent.js +0 -43
  203. package/lib/StandardContent/data.d.ts +0 -101
  204. package/lib/StandardContent/style/index.less +0 -80
  205. package/lib/StandardDragModal/index.d.ts +0 -11
  206. package/lib/StandardDragModal/index.js +0 -43
  207. package/lib/StandardFilter/index.d.ts +0 -35
  208. package/lib/StandardFilter/index.js +0 -272
  209. package/lib/StandardFilter/style/index.less +0 -62
  210. package/lib/StandardForm/ActionList.js +0 -57
  211. package/lib/StandardForm/StepForm.d.ts +0 -19
  212. package/lib/StandardForm/StepForm.js +0 -295
  213. package/lib/StandardForm/TabForm.d.ts +0 -19
  214. package/lib/StandardForm/TabForm.js +0 -148
  215. package/lib/StandardForm/index.d.ts +0 -32
  216. package/lib/StandardForm/index.js +0 -197
  217. package/lib/StandardForm/style/index.less +0 -58
  218. package/lib/StandardModal/UpdateFormRef.js +0 -32
  219. package/lib/StandardModal/index.d.ts +0 -44
  220. package/lib/StandardModal/index.js +0 -525
  221. package/lib/StandardModal/style/index.less +0 -50
  222. package/lib/StandardPanel/index.d.ts +0 -28
  223. package/lib/StandardPanel/index.js +0 -155
  224. package/lib/StandardPanel/style/index.less +0 -135
  225. package/lib/StandardTable/index.d.ts +0 -22
  226. package/lib/StandardTable/index.js +0 -143
  227. package/lib/StandardTable/style/index.d.ts +0 -1
  228. package/lib/StandardTable/style/index.js +0 -3
  229. package/lib/StandardTable/style/index.less +0 -206
  230. package/lib/components/IconNode/index.d.ts +0 -16
  231. package/lib/components/IconNode/index.js +0 -39
  232. package/lib/components/index.d.ts +0 -2
  233. package/lib/components/index.js +0 -15
  234. package/lib/data/func.code.js +0 -119
  235. package/lib/data/general.config.js +0 -179
  236. package/lib/data/index.js +0 -23
  237. package/lib/index.d.ts +0 -24
  238. package/lib/index.js +0 -236
  239. package/lib/styles/index.less +0 -0
  240. package/lib/theme/spec-variable.less +0 -48
  241. package/lib/utils/ValueFormat.js +0 -58
  242. package/lib/utils/filterPermission.js +0 -127
  243. package/lib/utils/getParentNodes.js +0 -226
  244. package/lib/utils/index.js +0 -35
@@ -1,413 +0,0 @@
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;
@@ -1,236 +0,0 @@
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 };