cloud-b2b 1.0.0 → 1.0.1

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