cloud-b2b 1.1.52 → 1.1.54
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/es/Area/Area.js +141 -0
- package/es/Card/Card.js +19 -0
- package/es/CodeInput/CodeInput.js +123 -0
- package/es/Control/Control.js +444 -0
- package/es/Control/event.js +43 -0
- package/es/Enhance/Dialogs.js +52 -0
- package/es/Enhance/Loading.js +131 -0
- package/{src → es}/Enhance/index.js +6 -8
- package/es/Header/Header.js +162 -0
- package/es/Header/Vertical.js +106 -0
- package/es/ImageView/ImageView.js +100 -0
- package/es/Indent/Indent.js +19 -0
- package/es/InpurCascader/InputCascader.js +108 -0
- package/es/InputEditor/InputEditor.js +173 -0
- package/es/InputSearch/InputSearch.js +266 -0
- package/es/InputSelect/InputSelect.js +160 -0
- package/es/InputTreeSelect/InputTreeSelect.js +121 -0
- package/es/InputWriting/InputWriting.js +85 -0
- package/es/Layout/Layout.js +201 -0
- package/es/LayoutLink/LayoutLink.js +73 -0
- package/es/Link/Link.js +85 -0
- package/es/Loading/Loading.js +13 -0
- package/es/Loading2/Loading2.js +9 -0
- package/es/ModalWithDrag/ModalWithDrag.js +29 -0
- package/{src → es}/ModalWithDrag/drag.js +116 -128
- package/es/NumberInput/NumberInput.js +200 -0
- package/es/Search/Search.js +497 -0
- package/es/Sidebar/Sidebar.js +144 -0
- package/es/Sidebar2/Sidebar.js +165 -0
- package/es/SuperForm/SuperForm.js +598 -0
- package/es/SuperForm2/SuperForm.js +687 -0
- package/es/SuperIcon/SuperIcon.js +27 -0
- package/es/SuperPagination/SuperPagination.js +109 -0
- package/es/SuperTab/SuperTab.js +107 -0
- package/es/SuperTab2/SuperTab2.js +145 -0
- package/es/SuperTable/DragSortRow.js +97 -0
- package/es/SuperTable/FilterDropDown.js +164 -0
- package/es/SuperTable/SuperTable.js +808 -0
- package/es/SuperTable/fixed.js +34 -0
- package/es/SuperTable2/SuperTable2.js +894 -0
- package/es/SuperTable2/SuperTableCell.js +198 -0
- package/es/SuperTable3/FilterDropDown.js +164 -0
- package/es/SuperTable3/SuperTable.js +665 -0
- package/es/SuperTable3/fixed.js +34 -0
- package/es/SuperToolbar/SuperToolbar.js +195 -0
- package/es/SuperUpload/SuperUpload.js +356 -0
- package/es/Title/Title.js +33 -0
- package/es/Viewer/ImageViews.js +258 -0
- package/es/Viewer/Viewer.js +122 -0
- package/es/WingBlank/WingBlank.js +16 -0
- package/es/helper.js +240 -0
- package/{src → es}/history.js +6 -6
- package/es/index.js +37 -0
- package/es/variables.js +6 -0
- package/lib/Area/Area.js +149 -0
- package/lib/Area/package.json +6 -0
- package/lib/Card/Card.js +27 -0
- package/lib/Card/package.json +6 -0
- package/lib/CodeInput/CodeInput.js +131 -0
- package/lib/CodeInput/package.json +6 -0
- package/lib/Control/Control.js +450 -0
- package/lib/Control/event.js +51 -0
- package/lib/Control/package.json +6 -0
- package/lib/Enhance/Dialogs.js +60 -0
- package/lib/Enhance/Loading.js +138 -0
- package/lib/Enhance/index.js +25 -0
- package/lib/Enhance/package.json +6 -0
- package/lib/Header/Header.js +169 -0
- package/lib/Header/Header.less +95 -0
- package/lib/Header/Vertical.js +114 -0
- package/lib/Header/Vertical.less +60 -0
- package/lib/Header/package.json +6 -0
- package/lib/ImageView/ImageView.js +108 -0
- package/lib/ImageView/ImageView.less +14 -0
- package/lib/ImageView/package.json +6 -0
- package/lib/Indent/Indent.js +27 -0
- package/lib/Indent/package.json +6 -0
- package/lib/InpurCascader/InputCascader.js +115 -0
- package/lib/InpurCascader/package.json +6 -0
- package/lib/InputEditor/InputEditor.js +181 -0
- package/lib/InputEditor/inputEditor.less +8 -0
- package/lib/InputEditor/package.json +6 -0
- package/lib/InputSearch/InputSearch.js +274 -0
- package/lib/InputSearch/package.json +6 -0
- package/lib/InputSelect/InputSelect.js +168 -0
- package/lib/InputSelect/package.json +6 -0
- package/lib/InputTreeSelect/InputTreeSelect.js +128 -0
- package/lib/InputTreeSelect/package.json +6 -0
- package/lib/InputWriting/InputWriting.js +93 -0
- package/lib/InputWriting/package.json +6 -0
- package/lib/Layout/Layout.js +209 -0
- package/lib/Layout/Layout.less +28 -0
- package/lib/Layout/package.json +6 -0
- package/lib/LayoutLink/LayoutLink.js +86 -0
- package/lib/LayoutLink/LayoutLink.less +53 -0
- package/lib/LayoutLink/package.json +6 -0
- package/lib/Link/Link.js +93 -0
- package/lib/Link/package.json +6 -0
- package/lib/Loading/Loading.js +21 -0
- package/lib/Loading/Loading.less +13 -0
- package/lib/Loading/package.json +6 -0
- package/lib/Loading2/Loading2.js +17 -0
- package/lib/Loading2/Loading2.less +19 -0
- package/lib/Loading2/package.json +6 -0
- package/lib/ModalWithDrag/ModalWithDrag.js +37 -0
- package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
- package/lib/ModalWithDrag/drag.js +124 -0
- package/lib/ModalWithDrag/package.json +6 -0
- package/lib/NumberInput/NumberInput.js +208 -0
- package/lib/NumberInput/package.json +6 -0
- package/lib/Search/Search.js +510 -0
- package/lib/Search/Search.less +63 -0
- package/lib/Search/package.json +6 -0
- package/lib/Sidebar/Sidebar.js +152 -0
- package/lib/Sidebar/Sidebar.less +78 -0
- package/lib/Sidebar/package.json +6 -0
- package/lib/Sidebar2/Sidebar.js +173 -0
- package/lib/Sidebar2/Sidebar.less +153 -0
- package/lib/Sidebar2/package.json +6 -0
- package/lib/SuperForm/SuperForm.js +610 -0
- package/lib/SuperForm/SuperForm.less +52 -0
- package/lib/SuperForm/package.json +6 -0
- package/lib/SuperForm2/SuperForm.js +699 -0
- package/lib/SuperForm2/SuperForm.less +52 -0
- package/lib/SuperForm2/package.json +6 -0
- package/lib/SuperIcon/SuperIcon.js +35 -0
- package/lib/SuperIcon/package.json +6 -0
- package/lib/SuperPagination/SuperPagination.js +117 -0
- package/lib/SuperPagination/package.json +6 -0
- package/lib/SuperTab/SuperTab.js +115 -0
- package/lib/SuperTab/SuperTab.less +43 -0
- package/lib/SuperTab/package.json +6 -0
- package/lib/SuperTab2/SuperTab2.js +153 -0
- package/lib/SuperTab2/SuperTab2.less +18 -0
- package/lib/SuperTab2/package.json +6 -0
- package/lib/SuperTable/DragSortRow.js +105 -0
- package/lib/SuperTable/DragSortRow.less +17 -0
- package/lib/SuperTable/FilterDropDown.js +172 -0
- package/lib/SuperTable/FilterDropDown.less +30 -0
- package/lib/SuperTable/SuperTable.js +816 -0
- package/lib/SuperTable/SuperTable.less +132 -0
- package/lib/SuperTable/fixed.js +42 -0
- package/lib/SuperTable/package.json +6 -0
- package/lib/SuperTable2/SuperTable2.js +907 -0
- package/lib/SuperTable2/SuperTable2.less +118 -0
- package/lib/SuperTable2/SuperTableCell.js +203 -0
- package/lib/SuperTable2/package.json +6 -0
- package/lib/SuperTable3/FilterDropDown.js +172 -0
- package/lib/SuperTable3/FilterDropDown.less +29 -0
- package/lib/SuperTable3/SuperTable.js +673 -0
- package/lib/SuperTable3/SuperTable.less +99 -0
- package/lib/SuperTable3/fixed.js +42 -0
- package/lib/SuperTable3/package.json +6 -0
- package/lib/SuperToolbar/SuperToolbar.js +203 -0
- package/lib/SuperToolbar/SuperToolbar.less +17 -0
- package/lib/SuperToolbar/package.json +6 -0
- package/lib/SuperUpload/SuperUpload.js +368 -0
- package/lib/SuperUpload/SuperUpload.less +28 -0
- package/lib/SuperUpload/package.json +6 -0
- package/lib/Title/Title.js +41 -0
- package/lib/Title/Title.less +35 -0
- package/lib/Title/package.json +6 -0
- package/lib/Viewer/ImageViews.js +266 -0
- package/lib/Viewer/Viewer.js +130 -0
- package/lib/Viewer/Viewer.less +67 -0
- package/lib/Viewer/imgView.less +59 -0
- package/lib/Viewer/package.json +7 -0
- package/lib/WingBlank/WingBlank.js +24 -0
- package/lib/WingBlank/WingBlank.less +12 -0
- package/lib/WingBlank/package.json +6 -0
- package/lib/adjust.less +89 -0
- package/lib/helper.js +246 -0
- package/lib/history.js +12 -0
- package/lib/index.js +271 -0
- package/lib/index.less +31 -0
- package/lib/style.less +30 -0
- package/lib/variables.js +14 -0
- package/lib/variables.less +73 -0
- package/package.json +22 -44
- package/src/Area/Area.js +0 -94
- package/src/Card/Card.js +0 -16
- package/src/CodeInput/CodeInput.js +0 -76
- package/src/Control/Control.js +0 -338
- package/src/Control/event.js +0 -45
- package/src/Enhance/Dialogs.js +0 -24
- package/src/Enhance/Loading.js +0 -83
- package/src/Header/Header.js +0 -149
- package/src/Header/Vertical.js +0 -74
- package/src/ImageView/ImageView.js +0 -62
- package/src/Indent/Indent.js +0 -12
- package/src/InpurCascader/InputCascader.js +0 -83
- package/src/InputEditor/InputEditor.js +0 -93
- package/src/InputSearch/InputSearch.js +0 -186
- package/src/InputSelect/InputSelect.js +0 -103
- package/src/InputTreeSelect/InputTreeSelect.js +0 -87
- package/src/InputWriting/InputWriting.js +0 -65
- package/src/Layout/Layout.js +0 -121
- package/src/LayoutLink/LayoutLink.js +0 -59
- package/src/Link/Link.js +0 -57
- package/src/Loading/Loading.js +0 -15
- package/src/Loading2/Loading2.js +0 -15
- package/src/ModalWithDrag/ModalWithDrag.js +0 -17
- package/src/NumberInput/NumberInput.js +0 -137
- package/src/Search/Search.js +0 -368
- package/src/Sidebar/Sidebar.js +0 -111
- package/src/Sidebar2/Sidebar.js +0 -143
- package/src/SuperForm/SuperForm.js +0 -516
- package/src/SuperForm2/SuperForm.js +0 -588
- package/src/SuperIcon/SuperIcon.js +0 -14
- package/src/SuperPagination/SuperPagination.js +0 -65
- package/src/SuperTab/SuperTab.js +0 -84
- package/src/SuperTab2/SuperTab2.js +0 -94
- package/src/SuperTable/DragSortRow.js +0 -62
- package/src/SuperTable/FilterDropDown.js +0 -111
- package/src/SuperTable/SuperTable.js +0 -590
- package/src/SuperTable/fixed.js +0 -34
- package/src/SuperTable2/SuperTable2.js +0 -600
- package/src/SuperTable2/SuperTableCell.js +0 -144
- package/src/SuperTable3/FilterDropDown.js +0 -111
- package/src/SuperTable3/SuperTable.js +0 -498
- package/src/SuperTable3/fixed.js +0 -34
- package/src/SuperToolbar/SuperToolbar.js +0 -128
- package/src/SuperUpload/SuperUpload.js +0 -137
- package/src/Title/Title.js +0 -18
- package/src/Viewer/ImageViews.js +0 -220
- package/src/Viewer/Viewer.js +0 -97
- package/src/WingBlank/WingBlank.js +0 -14
- package/src/helper.js +0 -185
- package/src/index.js +0 -38
- package/src/variables.js +0 -5
- package/test/index.html +0 -10
- package/test/test.js +0 -16
- package/test/test.less +0 -12
- package/test/webpack.config.js +0 -71
- package/tools/babel.config.js +0 -14
- package/tools/build.js +0 -70
- package/tools/publish.js +0 -9
- package/tools/util.js +0 -53
- /package/{src → es}/Area/package.json +0 -0
- /package/{src → es}/Card/package.json +0 -0
- /package/{src → es}/CodeInput/package.json +0 -0
- /package/{src → es}/Control/package.json +0 -0
- /package/{src → es}/Enhance/package.json +0 -0
- /package/{src → es}/Header/Header.less +0 -0
- /package/{src → es}/Header/Vertical.less +0 -0
- /package/{src → es}/Header/package.json +0 -0
- /package/{src → es}/ImageView/ImageView.less +0 -0
- /package/{src → es}/ImageView/package.json +0 -0
- /package/{src → es}/Indent/package.json +0 -0
- /package/{src → es}/InpurCascader/package.json +0 -0
- /package/{src → es}/InputEditor/inputEditor.less +0 -0
- /package/{src → es}/InputEditor/package.json +0 -0
- /package/{src → es}/InputSearch/package.json +0 -0
- /package/{src → es}/InputSelect/package.json +0 -0
- /package/{src → es}/InputTreeSelect/package.json +0 -0
- /package/{src → es}/InputWriting/package.json +0 -0
- /package/{src → es}/Layout/Layout.less +0 -0
- /package/{src → es}/Layout/package.json +0 -0
- /package/{src → es}/LayoutLink/LayoutLink.less +0 -0
- /package/{src → es}/LayoutLink/package.json +0 -0
- /package/{src → es}/Link/package.json +0 -0
- /package/{src → es}/Loading/Loading.less +0 -0
- /package/{src → es}/Loading/package.json +0 -0
- /package/{src → es}/Loading2/Loading2.less +0 -0
- /package/{src → es}/Loading2/package.json +0 -0
- /package/{src → es}/ModalWithDrag/ModalWithDrag.less +0 -0
- /package/{src → es}/ModalWithDrag/package.json +0 -0
- /package/{src → es}/NumberInput/package.json +0 -0
- /package/{src → es}/Search/Search.less +0 -0
- /package/{src → es}/Search/package.json +0 -0
- /package/{src → es}/Sidebar/Sidebar.less +0 -0
- /package/{src → es}/Sidebar/package.json +0 -0
- /package/{src → es}/Sidebar2/Sidebar.less +0 -0
- /package/{src → es}/Sidebar2/package.json +0 -0
- /package/{src → es}/SuperForm/SuperForm.less +0 -0
- /package/{src → es}/SuperForm/package.json +0 -0
- /package/{src → es}/SuperForm2/SuperForm.less +0 -0
- /package/{src → es}/SuperForm2/package.json +0 -0
- /package/{src → es}/SuperIcon/package.json +0 -0
- /package/{src → es}/SuperPagination/package.json +0 -0
- /package/{src → es}/SuperTab/SuperTab.less +0 -0
- /package/{src → es}/SuperTab/package.json +0 -0
- /package/{src → es}/SuperTab2/SuperTab2.less +0 -0
- /package/{src → es}/SuperTab2/package.json +0 -0
- /package/{src → es}/SuperTable/DragSortRow.less +0 -0
- /package/{src → es}/SuperTable/FilterDropDown.less +0 -0
- /package/{src → es}/SuperTable/SuperTable.less +0 -0
- /package/{src → es}/SuperTable/package.json +0 -0
- /package/{src → es}/SuperTable2/SuperTable2.less +0 -0
- /package/{src → es}/SuperTable2/package.json +0 -0
- /package/{src → es}/SuperTable3/FilterDropDown.less +0 -0
- /package/{src → es}/SuperTable3/SuperTable.less +0 -0
- /package/{src → es}/SuperTable3/package.json +0 -0
- /package/{src → es}/SuperToolbar/SuperToolbar.less +0 -0
- /package/{src → es}/SuperToolbar/package.json +0 -0
- /package/{src → es}/SuperUpload/SuperUpload.less +0 -0
- /package/{src → es}/SuperUpload/package.json +0 -0
- /package/{src → es}/Title/Title.less +0 -0
- /package/{src → es}/Title/package.json +0 -0
- /package/{src → es}/Viewer/Viewer.less +0 -0
- /package/{src → es}/Viewer/imgView.less +0 -0
- /package/{src → es}/Viewer/package.json +0 -0
- /package/{src → es}/WingBlank/WingBlank.less +0 -0
- /package/{src → es}/WingBlank/package.json +0 -0
- /package/{src → es}/adjust.less +0 -0
- /package/{src → es}/style.less +0 -0
- /package/{src → es}/variables.less +0 -0
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
3
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
9
|
+
import _Row from "antd/es/row";
|
|
10
|
+
import _Col from "antd/es/col";
|
|
11
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
12
|
+
import _Checkbox from "antd/es/checkbox";
|
|
13
|
+
import _Icon from "antd/es/icon";
|
|
14
|
+
import _typeof from "@babel/runtime-corejs3/helpers/typeof";
|
|
15
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
16
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
17
|
+
import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
|
|
18
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
19
|
+
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
20
|
+
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
21
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
22
|
+
import _Form from "antd/es/form";
|
|
23
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
24
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
25
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
26
|
+
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
27
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
28
|
+
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
29
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
30
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
31
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context17, _context18; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context17 = ownKeys(Object(t), !0)).call(_context17, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context18 = ownKeys(Object(t))).call(_context18, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
32
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
34
|
+
import React from 'react';
|
|
35
|
+
import PropTypes from 'prop-types';
|
|
36
|
+
import ReactDOM from 'react-dom';
|
|
37
|
+
import helper from '../helper';
|
|
38
|
+
import Control, { getTitle, makeString } from '../Control';
|
|
39
|
+
import variables from '../variables';
|
|
40
|
+
var FormItem = _Form.Item;
|
|
41
|
+
var defaultSize = 'small';
|
|
42
|
+
var defaultColNum = 4;
|
|
43
|
+
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg', 'cascader', 'treeSelect'];
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* key:[必须],用于唯一标识该Form下的一个表单元素
|
|
47
|
+
* title:[必须],表单元素的标签
|
|
48
|
+
* type:[必须],表单元素类型
|
|
49
|
+
* required: [可选],是否为必填项
|
|
50
|
+
* options: [可选],对象数组(type为readonly,radio,search, searchText,select, selectText时有效)
|
|
51
|
+
* span: [可选],占据的列数,默认为1
|
|
52
|
+
* showAdd: [可选],是否显示+号,点击+号会触发onAdd事件,默认为false
|
|
53
|
+
* rule: [可选],用于设置校验规则
|
|
54
|
+
* highLightKeys: [可选],用于设置高亮样式,仅只读字段生效
|
|
55
|
+
*/
|
|
56
|
+
var ControlType = {
|
|
57
|
+
key: PropTypes.string.isRequired,
|
|
58
|
+
title: PropTypes.string,
|
|
59
|
+
type: PropTypes.oneOf(TYPE).isRequired,
|
|
60
|
+
required: PropTypes.bool,
|
|
61
|
+
options: PropTypes.array,
|
|
62
|
+
span: PropTypes.number,
|
|
63
|
+
onCheckItem: PropTypes.any,
|
|
64
|
+
showAdd: PropTypes.any,
|
|
65
|
+
rule: PropTypes.object,
|
|
66
|
+
props: PropTypes.object
|
|
67
|
+
};
|
|
68
|
+
var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
69
|
+
_inherits(Controlled, _React$Component);
|
|
70
|
+
var _super = _createSuper(Controlled);
|
|
71
|
+
function Controlled(props) {
|
|
72
|
+
var _this;
|
|
73
|
+
_classCallCheck(this, Controlled);
|
|
74
|
+
_this = _super.call(this, props);
|
|
75
|
+
_defineProperty(_assertThisInitialized(_this), "onChange", function (value) {
|
|
76
|
+
var onChange = _this.props.onChange;
|
|
77
|
+
_this.setState({
|
|
78
|
+
value: value
|
|
79
|
+
});
|
|
80
|
+
onChange && onChange(value);
|
|
81
|
+
});
|
|
82
|
+
_this.state = {
|
|
83
|
+
value: props.value
|
|
84
|
+
};
|
|
85
|
+
return _this;
|
|
86
|
+
}
|
|
87
|
+
_createClass(Controlled, [{
|
|
88
|
+
key: "componentWillReceiveProps",
|
|
89
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
90
|
+
if (this.props.value !== nextProps.value) {
|
|
91
|
+
this.setState({
|
|
92
|
+
value: nextProps.value
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "render",
|
|
98
|
+
value: function render() {
|
|
99
|
+
var props = _objectSpread(_objectSpread({}, this.props), {}, {
|
|
100
|
+
value: this.state.value,
|
|
101
|
+
onChange: this.onChange
|
|
102
|
+
});
|
|
103
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
104
|
+
}
|
|
105
|
+
}]);
|
|
106
|
+
return Controlled;
|
|
107
|
+
}(React.Component);
|
|
108
|
+
/**
|
|
109
|
+
* colNum:[可选],表单的列数,默认为4
|
|
110
|
+
* readonly: [可选],为true时,所有表单元素都是只读的; 为字符串数组时,用于指定key的表单元素是只读的
|
|
111
|
+
* hideControls: [可选],指定key的表单元素被隐藏
|
|
112
|
+
* options: [可选],键值对,值与ControlType中options作用相同,但优先级更高
|
|
113
|
+
* onChange:内容改变时触发,原型为func(key, value)
|
|
114
|
+
* onSearch:搜索框中用户输入时触发,原型为func(key, title, control)
|
|
115
|
+
* onAdd: 点击+号时触发,原型为func(key)
|
|
116
|
+
* checkable:是否显示checkbox选择框
|
|
117
|
+
* onOpenChange:控制日期框显示隐藏回调func(key, open)
|
|
118
|
+
* onAreaSearch:联级选择器触发,原型为func(key - 当前联级key, title - 输入值, parentKey - 主体联级key)
|
|
119
|
+
* OnFileChange:上传组件触发,原型为func(key,{fileList, fileDeleteList})
|
|
120
|
+
*/
|
|
121
|
+
var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
122
|
+
_inherits(SuperForm, _React$Component2);
|
|
123
|
+
var _super2 = _createSuper(SuperForm);
|
|
124
|
+
function SuperForm() {
|
|
125
|
+
var _context;
|
|
126
|
+
var _this2;
|
|
127
|
+
_classCallCheck(this, SuperForm);
|
|
128
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
129
|
+
args[_key] = arguments[_key];
|
|
130
|
+
}
|
|
131
|
+
_this2 = _super2.call.apply(_super2, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
132
|
+
_defineProperty(_assertThisInitialized(_this2), "onAdd", function (key, title) {
|
|
133
|
+
var onAdd = _this2.props.onAdd;
|
|
134
|
+
onAdd && onAdd(key, title);
|
|
135
|
+
});
|
|
136
|
+
_defineProperty(_assertThisInitialized(_this2), "onChange", function (key, value) {
|
|
137
|
+
var onChange = _this2.props.onChange;
|
|
138
|
+
if (onChange) {
|
|
139
|
+
_this2.onExitValid(key);
|
|
140
|
+
onChange(key, value);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
_defineProperty(_assertThisInitialized(_this2), "onBlur", function (key, value) {
|
|
144
|
+
var onChange = _this2.props.onChange;
|
|
145
|
+
if (onChange) {
|
|
146
|
+
_this2.onExitValid(key);
|
|
147
|
+
onChange(key, value);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
_defineProperty(_assertThisInitialized(_this2), "onFileChange", function (_ref, file) {
|
|
151
|
+
var key = _ref.key;
|
|
152
|
+
var onFileChange = _this2.props.onFileChange;
|
|
153
|
+
onFileChange && onFileChange(key, file);
|
|
154
|
+
});
|
|
155
|
+
_defineProperty(_assertThisInitialized(_this2), "onExitValid", function (key, value) {
|
|
156
|
+
if (key === _this2.validKey) {
|
|
157
|
+
_this2.validKey = '';
|
|
158
|
+
_this2.props.onExitValid();
|
|
159
|
+
}
|
|
160
|
+
_this2.props.onChangeOperate && _this2.props.onChangeOperate(key, value);
|
|
161
|
+
});
|
|
162
|
+
// 动态生成getValidState方法
|
|
163
|
+
_defineProperty(_assertThisInitialized(_this2), "initValidState", function () {
|
|
164
|
+
var _this2$props = _this2.props,
|
|
165
|
+
value = _this2$props.value,
|
|
166
|
+
valid = _this2$props.valid;
|
|
167
|
+
var invalid = function invalid() {
|
|
168
|
+
return null;
|
|
169
|
+
};
|
|
170
|
+
var _valid = function _valid(_ref2) {
|
|
171
|
+
var key = _ref2.key,
|
|
172
|
+
required = _ref2.required;
|
|
173
|
+
if (required) {
|
|
174
|
+
if (!value || helper.isEmpty2(value[key]) || !_Array$isArray(value[key]) && _typeof(value[key]) === 'object' && helper.isEmpty(value[key].value)) {
|
|
175
|
+
_this2.getValidState = invalid;
|
|
176
|
+
_this2.validKey = key;
|
|
177
|
+
return 'error';
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
};
|
|
182
|
+
_this2.getValidState = valid ? _valid : invalid;
|
|
183
|
+
});
|
|
184
|
+
_defineProperty(_assertThisInitialized(_this2), "validDate", function (_ref3) {
|
|
185
|
+
var key = _ref3.key,
|
|
186
|
+
type = _ref3.type;
|
|
187
|
+
return function (date) {
|
|
188
|
+
var _this2$props$value = _this2.props.value,
|
|
189
|
+
value = _this2$props$value === void 0 ? {} : _this2$props$value;
|
|
190
|
+
if (!date || !value[key]) {
|
|
191
|
+
return false;
|
|
192
|
+
} else {
|
|
193
|
+
if (type === '>') {
|
|
194
|
+
return date.format('YYYY-MM-DD') <= value[key];
|
|
195
|
+
} else if (type === '<') {
|
|
196
|
+
return date.format('YYYY-MM-DD') >= value[key];
|
|
197
|
+
} else {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
_defineProperty(_assertThisInitialized(_this2), "getPopupContainer", function () {
|
|
204
|
+
var container = _this2.props.container;
|
|
205
|
+
if (typeof container === 'undefined') {
|
|
206
|
+
return ReactDOM.findDOMNode(_assertThisInitialized(_this2));
|
|
207
|
+
} else if (typeof container === 'boolean') {
|
|
208
|
+
return document.body;
|
|
209
|
+
} else {
|
|
210
|
+
return ReactDOM.findDOMNode(container);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
_defineProperty(_assertThisInitialized(_this2), "getMaxWidth", function () {
|
|
214
|
+
var _this2$props$colNum = _this2.props.colNum,
|
|
215
|
+
colNum = _this2$props$colNum === void 0 ? defaultColNum : _this2$props$colNum;
|
|
216
|
+
return colNum * 250;
|
|
217
|
+
});
|
|
218
|
+
_defineProperty(_assertThisInitialized(_this2), "getContainer", function () {
|
|
219
|
+
return _this2.props.getContainer;
|
|
220
|
+
});
|
|
221
|
+
_defineProperty(_assertThisInitialized(_this2), "getControls", function () {
|
|
222
|
+
var _this2$props2 = _this2.props,
|
|
223
|
+
hideControls = _this2$props2.hideControls,
|
|
224
|
+
controls = _this2$props2.controls;
|
|
225
|
+
if (!hideControls) {
|
|
226
|
+
return controls;
|
|
227
|
+
} else {
|
|
228
|
+
return _filterInstanceProperty(controls).call(controls, function (control) {
|
|
229
|
+
return !_someInstanceProperty(hideControls).call(hideControls, function (key) {
|
|
230
|
+
return control.key === key;
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
_defineProperty(_assertThisInitialized(_this2), "getType", function (_ref4) {
|
|
236
|
+
var _context2;
|
|
237
|
+
var key = _ref4.key,
|
|
238
|
+
type = _ref4.type;
|
|
239
|
+
var readonly = _this2.props.readonly;
|
|
240
|
+
if (_includesInstanceProperty(_context2 = ['area', 'uploadImg']).call(_context2, type)) {
|
|
241
|
+
return type;
|
|
242
|
+
} else if (!readonly) {
|
|
243
|
+
return type;
|
|
244
|
+
} else if (readonly === true) {
|
|
245
|
+
return 'readonly';
|
|
246
|
+
} else if (_Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
|
|
247
|
+
return readonlyKey === key;
|
|
248
|
+
})) {
|
|
249
|
+
return 'readonly';
|
|
250
|
+
} else {
|
|
251
|
+
return type;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
_defineProperty(_assertThisInitialized(_this2), "specialProps", function (type, _ref5) {
|
|
255
|
+
var key = _ref5.key,
|
|
256
|
+
_ref5$props = _ref5.props,
|
|
257
|
+
props = _ref5$props === void 0 ? {} : _ref5$props,
|
|
258
|
+
originType = _ref5.type;
|
|
259
|
+
if (type === 'readonly') {
|
|
260
|
+
var _this2$props$highLigh = _this2.props.highLightKeys,
|
|
261
|
+
highLightKeys = _this2$props$highLigh === void 0 ? [] : _this2$props$highLigh;
|
|
262
|
+
var style = _includesInstanceProperty(highLightKeys).call(highLightKeys, key) ? {
|
|
263
|
+
backgroundColor: 'red',
|
|
264
|
+
color: 'white'
|
|
265
|
+
} : {
|
|
266
|
+
backgroundColor: '#f0f0f0'
|
|
267
|
+
};
|
|
268
|
+
if (originType === 'textArea') {
|
|
269
|
+
var _context3;
|
|
270
|
+
return {
|
|
271
|
+
type: 'textArea',
|
|
272
|
+
readonly: true,
|
|
273
|
+
style: style,
|
|
274
|
+
onBlur: _bindInstanceProperty(_context3 = _this2.onExitValid).call(_context3, _assertThisInitialized(_this2), key)
|
|
275
|
+
};
|
|
276
|
+
} else {
|
|
277
|
+
var _context4;
|
|
278
|
+
return {
|
|
279
|
+
style: style,
|
|
280
|
+
onBlur: _bindInstanceProperty(_context4 = _this2.onExitValid).call(_context4, _assertThisInitialized(_this2), key)
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
} else if (type === 'text' || type === 'textArea') {
|
|
284
|
+
var _context5, _context6;
|
|
285
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
286
|
+
onChange: _bindInstanceProperty(_context5 = _this2.onExitValid).call(_context5, _assertThisInitialized(_this2), key),
|
|
287
|
+
onBlur: _bindInstanceProperty(_context6 = _this2.onChange).call(_context6, _assertThisInitialized(_this2), key)
|
|
288
|
+
});
|
|
289
|
+
} else if (type === 'date') {
|
|
290
|
+
var _context7, _context8;
|
|
291
|
+
var propsObj = _objectSpread(_objectSpread({}, props), {}, {
|
|
292
|
+
onChange: _bindInstanceProperty(_context7 = _this2.onBlur).call(_context7, _assertThisInitialized(_this2), key),
|
|
293
|
+
onBlur: _bindInstanceProperty(_context8 = _this2.onExitValid).call(_context8, _assertThisInitialized(_this2), key)
|
|
294
|
+
});
|
|
295
|
+
if (_this2.props.onOpenChange && typeof _this2.props.onOpenChange === 'function') {
|
|
296
|
+
var _context9;
|
|
297
|
+
propsObj.onOpenChange = _bindInstanceProperty(_context9 = _this2.props.onOpenChange).call(_context9, _assertThisInitialized(_this2), key);
|
|
298
|
+
}
|
|
299
|
+
return propsObj;
|
|
300
|
+
} else if (type === 'area') {
|
|
301
|
+
var _context10, _context11;
|
|
302
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
303
|
+
onChange: _bindInstanceProperty(_context10 = _this2.onBlur).call(_context10, _assertThisInitialized(_this2), key),
|
|
304
|
+
onBlur: _bindInstanceProperty(_context11 = _this2.onExitValid).call(_context11, _assertThisInitialized(_this2), key),
|
|
305
|
+
onAreaSearch: _this2.props.onAreaSearch
|
|
306
|
+
});
|
|
307
|
+
} else {
|
|
308
|
+
var _context12, _context13;
|
|
309
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
310
|
+
onChange: _bindInstanceProperty(_context12 = _this2.onBlur).call(_context12, _assertThisInitialized(_this2), key),
|
|
311
|
+
onBlur: _bindInstanceProperty(_context13 = _this2.onExitValid).call(_context13, _assertThisInitialized(_this2), key)
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
_defineProperty(_assertThisInitialized(_this2), "getControlProps", function (control, status) {
|
|
316
|
+
var _this2$props$value2 = _this2.props.value,
|
|
317
|
+
value = _this2$props$value2 === void 0 ? {} : _this2$props$value2;
|
|
318
|
+
var type = _this2.getType(control);
|
|
319
|
+
var props = _this2.specialProps(type, control);
|
|
320
|
+
return _objectSpread(_objectSpread({
|
|
321
|
+
autoFocus: !!status,
|
|
322
|
+
type: type
|
|
323
|
+
}, props), {}, {
|
|
324
|
+
size: defaultSize,
|
|
325
|
+
value: makeString(value[control.key])
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
_defineProperty(_assertThisInitialized(_this2), "getOptions", function (key, options) {
|
|
329
|
+
var higher = _this2.props.options || {};
|
|
330
|
+
return higher[key] || options;
|
|
331
|
+
});
|
|
332
|
+
_defineProperty(_assertThisInitialized(_this2), "toEmpty", function (props) {});
|
|
333
|
+
_defineProperty(_assertThisInitialized(_this2), "toText", function (props) {
|
|
334
|
+
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
335
|
+
});
|
|
336
|
+
_defineProperty(_assertThisInitialized(_this2), "toPassword", function (props) {
|
|
337
|
+
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
338
|
+
});
|
|
339
|
+
_defineProperty(_assertThisInitialized(_this2), "toEditor", function (props, control) {
|
|
340
|
+
props.inputKey = control.key;
|
|
341
|
+
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
342
|
+
});
|
|
343
|
+
_defineProperty(_assertThisInitialized(_this2), "toSelectWriting", function (props, control) {
|
|
344
|
+
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
345
|
+
});
|
|
346
|
+
_defineProperty(_assertThisInitialized(_this2), "toTextArea", function (props, control) {
|
|
347
|
+
if (control.allFullFather) {
|
|
348
|
+
props.rows = control.rows;
|
|
349
|
+
props.maxLength = control.maxLength;
|
|
350
|
+
props.style = {
|
|
351
|
+
'resize': 'none'
|
|
352
|
+
};
|
|
353
|
+
} else {
|
|
354
|
+
props.autoSize = {
|
|
355
|
+
minRows: 1,
|
|
356
|
+
maxRows: 5
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
360
|
+
});
|
|
361
|
+
_defineProperty(_assertThisInitialized(_this2), "toNumber", function (props) {
|
|
362
|
+
props.defaultValue = props.value;
|
|
363
|
+
delete props.value;
|
|
364
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
365
|
+
});
|
|
366
|
+
_defineProperty(_assertThisInitialized(_this2), "toSelect", function (props, _ref6) {
|
|
367
|
+
var options = _ref6.options,
|
|
368
|
+
key = _ref6.key;
|
|
369
|
+
props.getPopupContainer = _this2.getPopupContainer;
|
|
370
|
+
props.options = _this2.getOptions(key, options);
|
|
371
|
+
props.dropdownMatchSelectWidth = false;
|
|
372
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
373
|
+
});
|
|
374
|
+
_defineProperty(_assertThisInitialized(_this2), "createSearchEvent", function (control) {
|
|
375
|
+
if (_this2.props.onSearch) {
|
|
376
|
+
return function (value) {
|
|
377
|
+
return _this2.props.onSearch(control.key, value, control);
|
|
378
|
+
};
|
|
379
|
+
} else {
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
_defineProperty(_assertThisInitialized(_this2), "toSearch", function (props, control) {
|
|
384
|
+
props.getPopupContainer = _this2.getPopupContainer;
|
|
385
|
+
props.options = _this2.getOptions(control.key, control.options);
|
|
386
|
+
props.onSearch = _this2.createSearchEvent(control);
|
|
387
|
+
props.dropdownMatchSelectWidth = false;
|
|
388
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
389
|
+
});
|
|
390
|
+
_defineProperty(_assertThisInitialized(_this2), "toDate", function (props, _ref7) {
|
|
391
|
+
var rule = _ref7.rule;
|
|
392
|
+
props.getCalendarContainer = _this2.getPopupContainer;
|
|
393
|
+
props.style = {
|
|
394
|
+
width: '100%'
|
|
395
|
+
};
|
|
396
|
+
rule && (props.disabledDate = _this2.validDate(rule));
|
|
397
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
398
|
+
});
|
|
399
|
+
_defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props, _ref8) {
|
|
400
|
+
var key = _ref8.key,
|
|
401
|
+
options = _ref8.options;
|
|
402
|
+
props.options = _this2.getOptions(key, options);
|
|
403
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
404
|
+
});
|
|
405
|
+
_defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props, _ref9) {
|
|
406
|
+
var options = _ref9.options,
|
|
407
|
+
key = _ref9.key;
|
|
408
|
+
props.value = getTitle(props.value, _this2.getOptions(key, options));
|
|
409
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
410
|
+
});
|
|
411
|
+
_defineProperty(_assertThisInitialized(_this2), "selectSearch", function (props, control) {
|
|
412
|
+
props.getPopupContainer = _this2.getPopupContainer;
|
|
413
|
+
props.options = _this2.getOptions(control.key, control.options);
|
|
414
|
+
props.onSearch = _this2.createSearchEvent(control);
|
|
415
|
+
props.dropdownMatchSelectWidth = false;
|
|
416
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
417
|
+
});
|
|
418
|
+
_defineProperty(_assertThisInitialized(_this2), "area", function (props, _ref10) {
|
|
419
|
+
var key = _ref10.key,
|
|
420
|
+
options = _ref10.options;
|
|
421
|
+
var readonly = _this2.props.readonly;
|
|
422
|
+
props.parentKey = key;
|
|
423
|
+
props.options = _this2.getOptions(key, options);
|
|
424
|
+
props.dropdownMatchSelectWidth = false;
|
|
425
|
+
props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
|
|
426
|
+
return readonlyKey === key;
|
|
427
|
+
}) ? true : false;
|
|
428
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
429
|
+
});
|
|
430
|
+
_defineProperty(_assertThisInitialized(_this2), "uploadImg", function (props, control) {
|
|
431
|
+
var _context14;
|
|
432
|
+
var readonly = _this2.props.readonly;
|
|
433
|
+
props.required = control.required || false;
|
|
434
|
+
props.onFileChange = _bindInstanceProperty(_context14 = _this2.onFileChange).call(_context14, _assertThisInitialized(_this2), control);
|
|
435
|
+
props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
|
|
436
|
+
return readonlyKey === control.key;
|
|
437
|
+
}) ? true : false;
|
|
438
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
439
|
+
});
|
|
440
|
+
_defineProperty(_assertThisInitialized(_this2), "toCascader", function (props, control) {
|
|
441
|
+
var container = _this2.getContainer();
|
|
442
|
+
container && (props.getPopupContainer = container);
|
|
443
|
+
props.options = control.options || [];
|
|
444
|
+
props.onSearch = _this2.createSearchEvent(control);
|
|
445
|
+
props.placeholder = props.placeholder || '';
|
|
446
|
+
props.loadData = _this2.createSearchEvent(control);
|
|
447
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
448
|
+
});
|
|
449
|
+
_defineProperty(_assertThisInitialized(_this2), "toTreeSelect", function (props, filter) {
|
|
450
|
+
var container = _this2.getContainer();
|
|
451
|
+
container && (props.getPopupContainer = container);
|
|
452
|
+
props.options = _this2.getOptions(filter);
|
|
453
|
+
props.onSearch = _this2.createSearchEvent(filter);
|
|
454
|
+
props.placeholder = filter.placeholder || '';
|
|
455
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
456
|
+
});
|
|
457
|
+
_defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
|
|
458
|
+
switch (props.type) {
|
|
459
|
+
case 'readonly':
|
|
460
|
+
return _this2.toReadonly(props, control);
|
|
461
|
+
case 'text':
|
|
462
|
+
return _this2.toText(props, control);
|
|
463
|
+
case 'number':
|
|
464
|
+
return _this2.toNumber(props, control);
|
|
465
|
+
case 'select':
|
|
466
|
+
case 'selectText':
|
|
467
|
+
return _this2.toSelect(props, control);
|
|
468
|
+
case 'search':
|
|
469
|
+
case 'searchText':
|
|
470
|
+
return _this2.toSearch(props, control);
|
|
471
|
+
case 'date':
|
|
472
|
+
return _this2.toDate(props, control);
|
|
473
|
+
case 'radioGroup':
|
|
474
|
+
return _this2.toRadioGroup(props, control);
|
|
475
|
+
case 'textArea':
|
|
476
|
+
return _this2.toTextArea(props, control);
|
|
477
|
+
case 'password':
|
|
478
|
+
return _this2.toPassword(props, control);
|
|
479
|
+
case 'editor':
|
|
480
|
+
return _this2.toEditor(props, control);
|
|
481
|
+
case 'selectWriting':
|
|
482
|
+
return _this2.toSelectWriting(props, control);
|
|
483
|
+
case 'selectSearch':
|
|
484
|
+
return _this2.selectSearch(props, control);
|
|
485
|
+
case 'empty':
|
|
486
|
+
return _this2.toEmpty(props, control);
|
|
487
|
+
case 'area':
|
|
488
|
+
return _this2.area(props, control);
|
|
489
|
+
case 'uploadImg':
|
|
490
|
+
return _this2.uploadImg(props, control);
|
|
491
|
+
case 'cascader':
|
|
492
|
+
return _this2.toCascader(props, control);
|
|
493
|
+
case 'treeSelect':
|
|
494
|
+
return _this2.toTreeSelect(props, control);
|
|
495
|
+
default:
|
|
496
|
+
return 'type error';
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
_defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref11, type) {
|
|
500
|
+
var title = _ref11.title,
|
|
501
|
+
showAdd = _ref11.showAdd,
|
|
502
|
+
key = _ref11.key;
|
|
503
|
+
if (showAdd && type !== 'readonly') {
|
|
504
|
+
var _context15;
|
|
505
|
+
var onClick = _bindInstanceProperty(_context15 = _this2.onAdd).call(_context15, _assertThisInitialized(_this2), key, title);
|
|
506
|
+
return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
|
|
507
|
+
role: "add",
|
|
508
|
+
type: "plus-circle-o",
|
|
509
|
+
onClick: onClick
|
|
510
|
+
}));
|
|
511
|
+
} else {
|
|
512
|
+
return title;
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
_defineProperty(_assertThisInitialized(_this2), "toCol", function (span, control) {
|
|
516
|
+
var factor = control.span || 1;
|
|
517
|
+
var status = _this2.getValidState(control);
|
|
518
|
+
var controlProps = _this2.getControlProps(control, status);
|
|
519
|
+
var itemProps = {
|
|
520
|
+
label: _this2.toLabel(control, controlProps.type),
|
|
521
|
+
required: control.required,
|
|
522
|
+
validateStatus: status
|
|
523
|
+
};
|
|
524
|
+
var _this2$props3 = _this2.props,
|
|
525
|
+
checkable = _this2$props3.checkable,
|
|
526
|
+
onCheckItem = _this2$props3.onCheckItem;
|
|
527
|
+
return control.type !== 'empty' ? /*#__PURE__*/React.createElement(_Col, {
|
|
528
|
+
span: span * factor,
|
|
529
|
+
key: control.key
|
|
530
|
+
}, checkable && /*#__PURE__*/React.createElement(_Checkbox, {
|
|
531
|
+
className: variables('SuperForm').checkbox,
|
|
532
|
+
onChange: _bindInstanceProperty(onCheckItem).call(onCheckItem, _assertThisInitialized(_this2), control),
|
|
533
|
+
checked: control.checked
|
|
534
|
+
}), /*#__PURE__*/React.createElement(FormItem, _extends({}, itemProps, {
|
|
535
|
+
className: checkable ? variables('SuperForm').formItemWithCheckbox : ''
|
|
536
|
+
}), _this2.toControl(controlProps, control))) : /*#__PURE__*/React.createElement(_Col, {
|
|
537
|
+
span: span * factor,
|
|
538
|
+
key: control.key,
|
|
539
|
+
style: {
|
|
540
|
+
height: '44px'
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
_defineProperty(_assertThisInitialized(_this2), "toCols", function () {
|
|
545
|
+
var _context16;
|
|
546
|
+
var _this2$props4 = _this2.props,
|
|
547
|
+
_this2$props4$colNum = _this2$props4.colNum,
|
|
548
|
+
colNum = _this2$props4$colNum === void 0 ? defaultColNum : _this2$props4$colNum,
|
|
549
|
+
allFullFather = _this2$props4.allFullFather;
|
|
550
|
+
if (allFullFather) {
|
|
551
|
+
colNum = 1;
|
|
552
|
+
}
|
|
553
|
+
var span = 24 / colNum;
|
|
554
|
+
return _mapInstanceProperty(_context16 = _this2.getControls()).call(_context16, function (control) {
|
|
555
|
+
if (allFullFather) {
|
|
556
|
+
control.allFullFather = allFullFather;
|
|
557
|
+
}
|
|
558
|
+
return _this2.toCol(span, control);
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
return _this2;
|
|
562
|
+
}
|
|
563
|
+
_createClass(SuperForm, [{
|
|
564
|
+
key: "render",
|
|
565
|
+
value: function render() {
|
|
566
|
+
this.initValidState();
|
|
567
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
568
|
+
className: variables('SuperForm')
|
|
569
|
+
}, /*#__PURE__*/React.createElement(_Form, {
|
|
570
|
+
layout: "vertical",
|
|
571
|
+
style: {
|
|
572
|
+
maxWidth: this.props.allFullFather ? '100%' : this.getMaxWidth()
|
|
573
|
+
}
|
|
574
|
+
}, /*#__PURE__*/React.createElement(_Row, {
|
|
575
|
+
gutter: 20
|
|
576
|
+
}, this.toCols())));
|
|
577
|
+
}
|
|
578
|
+
}]);
|
|
579
|
+
return SuperForm;
|
|
580
|
+
}(React.Component);
|
|
581
|
+
_defineProperty(SuperForm, "propTypes", {
|
|
582
|
+
controls: PropTypes.arrayOf(PropTypes.shape(ControlType)).isRequired,
|
|
583
|
+
value: PropTypes.object,
|
|
584
|
+
colNum: PropTypes.number,
|
|
585
|
+
valid: PropTypes.bool,
|
|
586
|
+
readonly: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
|
|
587
|
+
hideControls: PropTypes.array,
|
|
588
|
+
options: PropTypes.object,
|
|
589
|
+
onChange: PropTypes.func,
|
|
590
|
+
onSearch: PropTypes.func,
|
|
591
|
+
onExitValid: PropTypes.func,
|
|
592
|
+
onAdd: PropTypes.func,
|
|
593
|
+
checkable: PropTypes.bool,
|
|
594
|
+
onOpenChange: PropTypes.func,
|
|
595
|
+
onAreaSearch: PropTypes.func,
|
|
596
|
+
OnFileChange: PropTypes.func
|
|
597
|
+
});
|
|
598
|
+
export default SuperForm;
|