cloud-b2b 1.1.27 → 1.1.29
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 +16 -45
- package/es/Card/Card.js +3 -4
- package/es/CodeInput/CodeInput.js +30 -59
- package/es/Control/Control.js +47 -94
- package/es/Control/event.js +0 -14
- package/es/Enhance/Dialogs.js +0 -15
- package/es/Enhance/Loading.js +16 -36
- package/es/Enhance/index.js +0 -2
- package/es/Header/Header.js +3 -35
- package/es/Header/Vertical.js +1 -24
- package/es/ImageView/ImageView.js +5 -22
- package/es/Indent/Indent.js +3 -7
- package/es/InpurCascader/InputCascader.js +10 -36
- package/es/InputEditor/InputEditor.js +55 -55
- package/es/InputSearch/InputSearch.js +26 -71
- package/es/InputSelect/InputSelect.js +17 -48
- package/es/InputWriting/InputWriting.js +6 -28
- package/es/Layout/Layout.js +28 -59
- package/es/LayoutLink/LayoutLink.js +11 -20
- package/es/Link/Link.js +4 -27
- package/es/Loading/Loading.js +1 -3
- package/es/Loading2/Loading2.js +0 -2
- package/es/ModalWithDrag/ModalWithDrag.js +3 -8
- package/es/ModalWithDrag/drag.js +12 -29
- package/es/NumberInput/NumberInput.js +24 -63
- package/es/Search/Search.js +53 -149
- package/es/Sidebar/Sidebar.js +13 -34
- package/es/Sidebar2/Sidebar.js +3 -30
- package/es/SuperForm/SuperForm.js +27 -150
- package/es/SuperForm2/SuperForm.js +31 -165
- package/es/SuperIcon/SuperIcon.js +3 -6
- package/es/SuperPagination/SuperPagination.js +15 -32
- package/es/SuperTab/SuperTab.js +4 -27
- package/es/SuperTab2/SuperTab2.js +11 -33
- package/es/SuperTable/DragSortRow.js +6 -34
- package/es/SuperTable/FilterDropDown.js +10 -34
- package/es/SuperTable/SuperTable.js +91 -216
- package/es/SuperTable/fixed.js +1 -9
- package/es/SuperTable2/SuperTable2.js +96 -206
- package/es/SuperTable2/SuperTableCell.js +16 -55
- package/es/SuperTable3/FilterDropDown.js +10 -34
- package/es/SuperTable3/SuperTable.js +57 -175
- package/es/SuperTable3/fixed.js +1 -9
- package/es/SuperToolbar/SuperToolbar.js +21 -49
- package/es/SuperUpload/SuperUpload.js +73 -110
- package/es/Title/Title.js +12 -15
- package/es/Viewer/ImageViews.js +7 -60
- package/es/Viewer/Viewer.js +7 -34
- package/es/WingBlank/WingBlank.js +2 -6
- package/es/helper.js +7 -27
- package/es/history.js +3 -2
- package/lib/Area/Area.js +16 -64
- package/lib/Card/Card.js +3 -13
- package/lib/CodeInput/CodeInput.js +30 -77
- package/lib/Control/Control.js +47 -135
- package/lib/Control/event.js +0 -16
- package/lib/Enhance/Dialogs.js +0 -26
- package/lib/Enhance/Loading.js +16 -52
- package/lib/Enhance/index.js +0 -9
- package/lib/Header/Header.js +3 -48
- package/lib/Header/Vertical.js +1 -36
- package/lib/ImageView/ImageView.js +5 -30
- package/lib/Indent/Indent.js +3 -13
- package/lib/InpurCascader/InputCascader.js +11 -50
- package/lib/InputEditor/InputEditor.js +55 -64
- package/lib/InputSearch/InputSearch.js +26 -78
- package/lib/InputSelect/InputSelect.js +17 -62
- package/lib/InputWriting/InputWriting.js +6 -35
- package/lib/Layout/Layout.js +28 -76
- package/lib/LayoutLink/LayoutLink.js +11 -38
- package/lib/Link/Link.js +4 -40
- package/lib/Loading/Loading.js +1 -9
- package/lib/Loading2/Loading2.js +0 -8
- package/lib/ModalWithDrag/ModalWithDrag.js +3 -18
- package/lib/ModalWithDrag/drag.js +12 -34
- package/lib/NumberInput/NumberInput.js +24 -76
- package/lib/Search/Search.js +53 -157
- package/lib/Sidebar/Sidebar.js +13 -46
- package/lib/Sidebar2/Sidebar.js +3 -42
- package/lib/SuperForm/SuperForm.js +27 -149
- package/lib/SuperForm2/SuperForm.js +31 -160
- package/lib/SuperIcon/SuperIcon.js +3 -14
- package/lib/SuperPagination/SuperPagination.js +15 -42
- package/lib/SuperTab/SuperTab.js +4 -34
- package/lib/SuperTab2/SuperTab2.js +11 -48
- package/lib/SuperTable/DragSortRow.js +6 -42
- package/lib/SuperTable/FilterDropDown.js +10 -42
- package/lib/SuperTable/SuperTable.js +90 -210
- package/lib/SuperTable/fixed.js +1 -13
- package/lib/SuperTable2/SuperTable2.js +96 -222
- package/lib/SuperTable2/SuperTableCell.js +13 -62
- package/lib/SuperTable3/FilterDropDown.js +10 -42
- package/lib/SuperTable3/SuperTable.js +56 -169
- package/lib/SuperTable3/fixed.js +1 -13
- package/lib/SuperToolbar/SuperToolbar.js +20 -64
- package/lib/SuperUpload/SuperUpload.js +73 -140
- package/lib/Title/Title.js +12 -24
- package/lib/Viewer/ImageViews.js +7 -63
- package/lib/Viewer/Viewer.js +7 -43
- package/lib/WingBlank/WingBlank.js +2 -14
- package/lib/helper.js +6 -44
- package/lib/history.js +0 -5
- package/lib/index.js +0 -76
- package/lib/variables.js +0 -4
- package/package.json +1 -1
package/es/Control/Control.js
CHANGED
|
@@ -14,12 +14,9 @@ import _Radio from "antd/es/radio";
|
|
|
14
14
|
import _Input from "antd/es/input";
|
|
15
15
|
import _Select from "antd/es/select";
|
|
16
16
|
var _excluded = ["options"],
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
_excluded2 = ["type", "autoFocus"];
|
|
19
18
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
-
|
|
21
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
-
|
|
23
20
|
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
24
21
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
25
22
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
@@ -48,10 +45,8 @@ var SelectOption = _Select.Option;
|
|
|
48
45
|
var TextArea = _Input.TextArea;
|
|
49
46
|
var RadioGroup = _Radio.Group;
|
|
50
47
|
moment.locale('zh-cn');
|
|
51
|
-
|
|
52
48
|
var getTitleOptions = function getTitleOptions(options) {
|
|
53
49
|
var existTitles = [];
|
|
54
|
-
|
|
55
50
|
if (options) {
|
|
56
51
|
return _reduceInstanceProperty(options).call(options, function (result, option) {
|
|
57
52
|
if (_includesInstanceProperty(existTitles).call(existTitles, option.title)) {
|
|
@@ -68,9 +63,9 @@ var getTitleOptions = function getTitleOptions(options) {
|
|
|
68
63
|
} else {
|
|
69
64
|
return options;
|
|
70
65
|
}
|
|
71
|
-
};
|
|
72
|
-
|
|
66
|
+
};
|
|
73
67
|
|
|
68
|
+
// 设置组件焦点
|
|
74
69
|
var setFocus = function setFocus(element, type) {
|
|
75
70
|
if (element) {
|
|
76
71
|
if (element.focus) {
|
|
@@ -82,44 +77,41 @@ var setFocus = function setFocus(element, type) {
|
|
|
82
77
|
}
|
|
83
78
|
}
|
|
84
79
|
};
|
|
85
|
-
|
|
86
80
|
var toOption = function toOption(_ref, index) {
|
|
87
81
|
var value = _ref.value,
|
|
88
|
-
|
|
82
|
+
title = _ref.title;
|
|
89
83
|
return /*#__PURE__*/React.createElement(SelectOption, {
|
|
90
84
|
key: index,
|
|
91
85
|
value: String(value)
|
|
92
86
|
}, title);
|
|
93
87
|
};
|
|
94
|
-
|
|
95
88
|
var toRadio = function toRadio(_ref2, index) {
|
|
96
89
|
var value = _ref2.value,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
title = _ref2.title,
|
|
91
|
+
_ref2$disabled = _ref2.disabled,
|
|
92
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled;
|
|
100
93
|
return /*#__PURE__*/React.createElement(_Radio, {
|
|
101
94
|
key: index,
|
|
102
95
|
value: String(value),
|
|
103
96
|
disabled: disabled
|
|
104
97
|
}, title);
|
|
105
|
-
};
|
|
106
|
-
|
|
98
|
+
};
|
|
107
99
|
|
|
100
|
+
// 文本输入框
|
|
108
101
|
var text = function text(props) {
|
|
109
102
|
if (props.value || props.defaultValue) {
|
|
110
103
|
props.title = props.value || props.defaultValue;
|
|
111
104
|
}
|
|
112
|
-
|
|
113
105
|
return /*#__PURE__*/React.createElement(_Input, props);
|
|
114
|
-
};
|
|
115
|
-
|
|
106
|
+
};
|
|
116
107
|
|
|
108
|
+
// 密码输入框
|
|
117
109
|
var password = function password(props) {
|
|
118
110
|
props.type = 'password';
|
|
119
111
|
return /*#__PURE__*/React.createElement(_Input, props);
|
|
120
|
-
};
|
|
121
|
-
|
|
112
|
+
};
|
|
122
113
|
|
|
114
|
+
// 多行文本输入框
|
|
123
115
|
var textArea = function textArea(props) {
|
|
124
116
|
if (props.readonly) {
|
|
125
117
|
delete props.readonly;
|
|
@@ -128,79 +120,67 @@ var textArea = function textArea(props) {
|
|
|
128
120
|
backgroundColor: '#f0f0f0'
|
|
129
121
|
});
|
|
130
122
|
}
|
|
131
|
-
|
|
132
123
|
return /*#__PURE__*/React.createElement(TextArea, props);
|
|
133
|
-
};
|
|
134
|
-
|
|
124
|
+
};
|
|
135
125
|
|
|
126
|
+
// 只读框
|
|
136
127
|
var readonly = function readonly(props) {
|
|
137
128
|
props.readOnly = true;
|
|
138
129
|
props.style = _Object$assign(props.style || {}, {
|
|
139
130
|
backgroundColor: '#f0f0f0'
|
|
140
131
|
});
|
|
141
|
-
|
|
142
132
|
if (props.value || props.defaultValue) {
|
|
143
133
|
props.title = props.value || props.defaultValue;
|
|
144
134
|
}
|
|
145
|
-
|
|
146
135
|
return /*#__PURE__*/React.createElement(_Input, props);
|
|
147
|
-
};
|
|
148
|
-
|
|
136
|
+
};
|
|
149
137
|
|
|
138
|
+
// 数字输入框
|
|
150
139
|
var number = function number(props) {
|
|
151
140
|
if (props.ref) {
|
|
152
141
|
props.inputRef = props.ref;
|
|
153
142
|
delete props.ref;
|
|
154
143
|
}
|
|
155
|
-
|
|
156
144
|
return /*#__PURE__*/React.createElement(NumberInput, props);
|
|
157
145
|
};
|
|
158
|
-
|
|
159
146
|
var isMatch = function isMatch(inputValue, option) {
|
|
160
147
|
var _context;
|
|
161
|
-
|
|
162
148
|
return _indexOfInstanceProperty(_context = option.props.children).call(_context, inputValue) !== -1;
|
|
163
|
-
};
|
|
164
|
-
|
|
149
|
+
};
|
|
165
150
|
|
|
151
|
+
// 下拉选择框
|
|
166
152
|
var select = function select(props) {
|
|
167
153
|
var options = props.options || [];
|
|
168
154
|
delete props.options;
|
|
169
155
|
props.showSearch = true;
|
|
170
156
|
props.filterOption = isMatch;
|
|
171
157
|
props.allowClear !== false && (props.allowClear = true);
|
|
172
|
-
|
|
173
158
|
if (props.mode === 'multiple') {
|
|
174
159
|
!props.value && typeof props.value !== 'undefined' && (props.value = []);
|
|
175
160
|
!props.defaultValue && typeof props.defaultValue !== 'undefined' && (props.defaultValue = []);
|
|
176
161
|
} else {
|
|
177
162
|
props.value && _typeof(props.value) === 'object' && (props.value = _JSON$stringify(props.value));
|
|
178
163
|
props.defaultValue && _typeof(props.defaultValue) === 'object' && (props.defaultValue = _JSON$stringify(props.defaultValue));
|
|
179
|
-
|
|
180
164
|
if (props.value !== true && props.value !== false && props.value !== '' && props.value !== undefined) {
|
|
181
165
|
props.value = String(props.value);
|
|
182
166
|
}
|
|
183
167
|
}
|
|
184
|
-
|
|
185
168
|
return /*#__PURE__*/React.createElement(_Select, props, _mapInstanceProperty(options).call(options, toOption));
|
|
186
169
|
};
|
|
187
|
-
|
|
188
170
|
var area = function area(props) {
|
|
189
171
|
var areaProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
190
172
|
onParentChange: props.onChange
|
|
191
173
|
});
|
|
192
|
-
|
|
193
174
|
return /*#__PURE__*/React.createElement(Area, areaProps);
|
|
194
|
-
};
|
|
195
|
-
|
|
175
|
+
};
|
|
196
176
|
|
|
177
|
+
// 下拉选择框-取title作为值
|
|
197
178
|
var selectText = function selectText(props) {
|
|
198
179
|
var options = getTitleOptions(props.options) || [];
|
|
199
180
|
delete props.options;
|
|
200
181
|
props.showSearch = true;
|
|
201
182
|
props.filterOption = isMatch;
|
|
202
183
|
props.allowClear !== false && (props.allowClear = true);
|
|
203
|
-
|
|
204
184
|
if (props.mode === 'multiple') {
|
|
205
185
|
!props.value && typeof props.value !== 'undefined' && (props.value = []);
|
|
206
186
|
!props.defaultValue && typeof props.defaultValue !== 'undefined' && (props.defaultValue = []);
|
|
@@ -208,64 +188,56 @@ var selectText = function selectText(props) {
|
|
|
208
188
|
props.value && _typeof(props.value) === 'object' && (props.value = _JSON$stringify(props.value));
|
|
209
189
|
props.defaultValue && _typeof(props.defaultValue) === 'object' && (props.defaultValue = _JSON$stringify(props.defaultValue));
|
|
210
190
|
}
|
|
211
|
-
|
|
212
191
|
return /*#__PURE__*/React.createElement(_Select, props, _mapInstanceProperty(options).call(options, toOption));
|
|
213
|
-
};
|
|
214
|
-
|
|
192
|
+
};
|
|
215
193
|
|
|
194
|
+
// 搜索框
|
|
216
195
|
var search = function search(props) {
|
|
217
196
|
if (props.ref) {
|
|
218
197
|
props.inputRef = props.ref;
|
|
219
198
|
delete props.ref;
|
|
220
199
|
}
|
|
221
|
-
|
|
222
200
|
return /*#__PURE__*/React.createElement(InputSearch, props);
|
|
223
|
-
};
|
|
224
|
-
|
|
201
|
+
};
|
|
225
202
|
|
|
203
|
+
// 搜索框-值取title
|
|
226
204
|
var searchText = function searchText(props) {
|
|
227
205
|
if (props.ref) {
|
|
228
206
|
props.inputRef = props.ref;
|
|
229
207
|
delete props.ref;
|
|
230
208
|
}
|
|
231
|
-
|
|
232
209
|
props.options = getTitleOptions(props.options);
|
|
233
210
|
return /*#__PURE__*/React.createElement(InputSearch, props);
|
|
234
|
-
};
|
|
235
|
-
|
|
211
|
+
};
|
|
236
212
|
|
|
213
|
+
// 多选下拉搜索
|
|
237
214
|
var selectSearch = function selectSearch(props) {
|
|
238
215
|
!props.value && typeof props.value !== 'undefined' && (props.value = []);
|
|
239
216
|
return /*#__PURE__*/React.createElement(InputSelect, props);
|
|
240
|
-
};
|
|
241
|
-
|
|
217
|
+
};
|
|
242
218
|
|
|
219
|
+
// 多选手写下拉 不支持title,value形式
|
|
243
220
|
var selectWriting = function selectWriting(props) {
|
|
244
221
|
!props.value && typeof props.value !== 'undefined' && (props.value = []);
|
|
245
222
|
return /*#__PURE__*/React.createElement(InputWriting, props);
|
|
246
|
-
};
|
|
247
|
-
|
|
223
|
+
};
|
|
248
224
|
|
|
225
|
+
// 日期选择框
|
|
249
226
|
var date = function date(props) {
|
|
250
227
|
var origin = props.onChange;
|
|
251
228
|
var MonthPicker = _DatePicker.MonthPicker;
|
|
252
|
-
|
|
253
229
|
if (typeof props.value !== 'undefined') {
|
|
254
230
|
props.value = !props.value ? undefined : moment(props.value);
|
|
255
231
|
}
|
|
256
|
-
|
|
257
232
|
if (typeof props.defaultValue !== 'undefined') {
|
|
258
233
|
props.defaultValue = !props.defaultValue ? undefined : moment(props.defaultValue);
|
|
259
234
|
}
|
|
260
|
-
|
|
261
235
|
if (props.showTime) {
|
|
262
236
|
props.format = 'YYYY-MM-DD HH:mm:ss';
|
|
263
237
|
props.placeholder = '请选择时间';
|
|
264
|
-
|
|
265
238
|
if (typeof props.showTime === 'boolean') {
|
|
266
239
|
props.showTime = '00:00:00';
|
|
267
240
|
}
|
|
268
|
-
|
|
269
241
|
if (props.showTime !== 'current') {
|
|
270
242
|
props.showTime = {
|
|
271
243
|
defaultValue: moment(props.showTime, 'HH:mm:ss')
|
|
@@ -274,13 +246,11 @@ var date = function date(props) {
|
|
|
274
246
|
props.showTime = true;
|
|
275
247
|
}
|
|
276
248
|
}
|
|
277
|
-
|
|
278
249
|
if (props.onChange) {
|
|
279
250
|
props.onChange = function (date, str) {
|
|
280
251
|
return origin(str);
|
|
281
252
|
};
|
|
282
253
|
}
|
|
283
|
-
|
|
284
254
|
if (props.month) {
|
|
285
255
|
props.format = 'YYYY-MM';
|
|
286
256
|
props.placeholder = '请选择日期';
|
|
@@ -288,64 +258,56 @@ var date = function date(props) {
|
|
|
288
258
|
onBlur: props.onBlur
|
|
289
259
|
}, /*#__PURE__*/React.createElement(MonthPicker, props));
|
|
290
260
|
}
|
|
291
|
-
|
|
292
261
|
return /*#__PURE__*/React.createElement("div", {
|
|
293
262
|
onBlur: props.onBlur
|
|
294
263
|
}, /*#__PURE__*/React.createElement(_DatePicker, props));
|
|
295
|
-
};
|
|
296
|
-
|
|
264
|
+
};
|
|
297
265
|
|
|
266
|
+
// 单选按钮组
|
|
298
267
|
var radioGroup = function radioGroup(_ref3) {
|
|
299
268
|
var _ref3$options = _ref3.options,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
269
|
+
options = _ref3$options === void 0 ? [] : _ref3$options,
|
|
270
|
+
props = _objectWithoutProperties(_ref3, _excluded);
|
|
303
271
|
var origin = props.onChange;
|
|
304
272
|
props.style = {
|
|
305
273
|
borderSpacing: 0
|
|
306
274
|
};
|
|
307
275
|
typeof props.value === 'number' && (props.value = String(props.value));
|
|
308
276
|
typeof props.defaultValue === 'number' && (props.defaultValue = String(props.defaultValue));
|
|
309
|
-
|
|
310
277
|
if (props.onChange) {
|
|
311
278
|
props.onChange = function (e) {
|
|
312
279
|
return origin(e.target.value);
|
|
313
280
|
};
|
|
314
281
|
}
|
|
315
|
-
|
|
316
282
|
return /*#__PURE__*/React.createElement(RadioGroup, props, _mapInstanceProperty(options).call(options, toRadio));
|
|
317
|
-
};
|
|
318
|
-
|
|
283
|
+
};
|
|
319
284
|
|
|
285
|
+
// 富文本编辑器
|
|
320
286
|
var editor = function editor(props) {
|
|
321
287
|
return /*#__PURE__*/React.createElement(InputEditor, props);
|
|
322
|
-
};
|
|
323
|
-
|
|
288
|
+
};
|
|
324
289
|
|
|
290
|
+
//级联选择下拉
|
|
325
291
|
var cascader = function cascader(props) {
|
|
326
292
|
!props.value && typeof props.value !== 'undefined' && (props.value = []);
|
|
327
293
|
return /*#__PURE__*/React.createElement(InpurCascader, props);
|
|
328
294
|
};
|
|
329
|
-
|
|
330
295
|
var captcha = function captcha(props) {
|
|
331
296
|
if (props.ref) {
|
|
332
297
|
props.inputRef = props.ref;
|
|
333
298
|
delete props.ref;
|
|
334
299
|
}
|
|
335
|
-
|
|
336
300
|
return /*#__PURE__*/React.createElement(CodeInput, props);
|
|
337
301
|
};
|
|
338
|
-
|
|
339
302
|
var uploadImg = function uploadImg(props) {
|
|
340
303
|
var uploadProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
341
304
|
fileList: props.value || [],
|
|
342
305
|
readonly: props.readonly || false
|
|
343
306
|
});
|
|
344
|
-
|
|
345
307
|
return /*#__PURE__*/React.createElement(SuperUpload, uploadProps);
|
|
346
|
-
};
|
|
347
|
-
|
|
308
|
+
};
|
|
348
309
|
|
|
310
|
+
// 支持的控件类型
|
|
349
311
|
var controls = {
|
|
350
312
|
text: text,
|
|
351
313
|
textArea: textArea,
|
|
@@ -366,12 +328,10 @@ var controls = {
|
|
|
366
328
|
area: area,
|
|
367
329
|
uploadImg: uploadImg
|
|
368
330
|
};
|
|
369
|
-
|
|
370
331
|
var Control = function Control(_ref4) {
|
|
371
332
|
var type = _ref4.type,
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
333
|
+
autoFocus = _ref4.autoFocus,
|
|
334
|
+
props = _objectWithoutProperties(_ref4, _excluded2);
|
|
375
335
|
var ref = autoFocus ? function (e) {
|
|
376
336
|
return setFocus(e, type);
|
|
377
337
|
} : null;
|
|
@@ -379,7 +339,6 @@ var Control = function Control(_ref4) {
|
|
|
379
339
|
ref: ref
|
|
380
340
|
}));
|
|
381
341
|
};
|
|
382
|
-
|
|
383
342
|
Control.propTypes = {
|
|
384
343
|
type: PropTypes.string.isRequired,
|
|
385
344
|
autoFocus: PropTypes.bool,
|
|
@@ -387,32 +346,28 @@ Control.propTypes = {
|
|
|
387
346
|
onSearch: PropTypes.func,
|
|
388
347
|
onBlur: PropTypes.func,
|
|
389
348
|
onGetCode: PropTypes.func
|
|
390
|
-
};
|
|
349
|
+
};
|
|
391
350
|
|
|
351
|
+
// 依据value查找对应的标题
|
|
392
352
|
var getTitle = function getTitle(value) {
|
|
393
353
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
394
|
-
|
|
395
354
|
if (typeof value === 'undefined') {
|
|
396
355
|
return '';
|
|
397
356
|
} else if (_typeof(value) === 'object') {
|
|
398
357
|
if (_Array$isArray(value)) {
|
|
399
358
|
if (options && options.length > 0) {
|
|
400
359
|
var _context2;
|
|
401
|
-
|
|
402
360
|
// 处理多选字典下拉变成只读的情况:
|
|
403
361
|
return _trimInstanceProperty(_context2 = _reduceInstanceProperty(value).call(value, function (val, it) {
|
|
404
362
|
var item = _findInstanceProperty(options).call(options, function (o) {
|
|
405
363
|
return o.value === it;
|
|
406
364
|
});
|
|
407
|
-
|
|
408
365
|
if (item) {
|
|
409
366
|
val += " ".concat(item.title);
|
|
410
367
|
}
|
|
411
|
-
|
|
412
368
|
return val;
|
|
413
369
|
}, '')).call(_context2);
|
|
414
370
|
}
|
|
415
|
-
|
|
416
371
|
return value;
|
|
417
372
|
} else {
|
|
418
373
|
return value ? value.title : '';
|
|
@@ -421,12 +376,11 @@ var getTitle = function getTitle(value) {
|
|
|
421
376
|
var index = _findIndexInstanceProperty(options).call(options, function (obj) {
|
|
422
377
|
return String(obj.value) === String(value);
|
|
423
378
|
});
|
|
424
|
-
|
|
425
379
|
return index === -1 ? value : options[index].title;
|
|
426
380
|
}
|
|
427
|
-
};
|
|
428
|
-
|
|
381
|
+
};
|
|
429
382
|
|
|
383
|
+
// 确保value的值为字符串(包含value和title的对象除外)
|
|
430
384
|
var makeString = function makeString(value) {
|
|
431
385
|
if (value === null || typeof value === 'undefined') {
|
|
432
386
|
return '';
|
|
@@ -436,6 +390,5 @@ var makeString = function makeString(value) {
|
|
|
436
390
|
return value;
|
|
437
391
|
}
|
|
438
392
|
};
|
|
439
|
-
|
|
440
393
|
export default Control;
|
|
441
394
|
export { getTitle, makeString };
|
package/es/Control/event.js
CHANGED
|
@@ -4,54 +4,40 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
|
4
4
|
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
5
5
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
6
6
|
import { getObjectExclude } from '../helper';
|
|
7
|
-
|
|
8
7
|
var EventHandler = /*#__PURE__*/_createClass(function EventHandler(props) {
|
|
9
8
|
var _this = this;
|
|
10
|
-
|
|
11
9
|
_classCallCheck(this, EventHandler);
|
|
12
|
-
|
|
13
10
|
_defineProperty(this, "toValue", function () {
|
|
14
11
|
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
15
|
-
|
|
16
12
|
if (event === null) {
|
|
17
13
|
return '';
|
|
18
14
|
} else {
|
|
19
15
|
return event.nativeEvent ? event.target.value : event;
|
|
20
16
|
}
|
|
21
17
|
});
|
|
22
|
-
|
|
23
18
|
_defineProperty(this, "onChange", function (event) {
|
|
24
19
|
_this.props.onChange(_this.toValue(event));
|
|
25
20
|
});
|
|
26
|
-
|
|
27
21
|
_defineProperty(this, "onBlur", function (event) {
|
|
28
22
|
_this.props.onBlur(_this.toValue(event), event);
|
|
29
23
|
});
|
|
30
|
-
|
|
31
24
|
_defineProperty(this, "onSearch", function (event) {
|
|
32
25
|
_this.props.onSearch(_this.toValue(event));
|
|
33
26
|
});
|
|
34
|
-
|
|
35
27
|
this.props = props;
|
|
36
28
|
});
|
|
37
|
-
|
|
38
29
|
var replaceEvent = function replaceEvent(props, handler) {
|
|
39
30
|
var events = ['onChange', 'onBlur', 'onSearch'];
|
|
40
|
-
|
|
41
31
|
var callback = _reduceInstanceProperty(events).call(events, function (result, event) {
|
|
42
32
|
if (props[event]) {
|
|
43
33
|
result[event] = handler[event];
|
|
44
34
|
}
|
|
45
|
-
|
|
46
35
|
return result;
|
|
47
36
|
}, {});
|
|
48
|
-
|
|
49
37
|
return _Object$assign({}, getObjectExclude(props, events), callback);
|
|
50
38
|
};
|
|
51
|
-
|
|
52
39
|
var eventWrapper = function eventWrapper(props) {
|
|
53
40
|
var handler = new EventHandler(props);
|
|
54
41
|
return replaceEvent(props, handler);
|
|
55
42
|
};
|
|
56
|
-
|
|
57
43
|
export default eventWrapper;
|
package/es/Enhance/Dialogs.js
CHANGED
|
@@ -8,34 +8,23 @@ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
|
8
8
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
9
9
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
10
10
|
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
11
|
-
|
|
12
11
|
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); }; }
|
|
13
|
-
|
|
14
12
|
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; } }
|
|
15
|
-
|
|
16
13
|
import React from 'react';
|
|
17
14
|
import { getObjectExclude } from '../helper';
|
|
18
|
-
|
|
19
15
|
var Enhance = function Enhance(Container, keys, Dialogs) {
|
|
20
16
|
var noContainer = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
21
17
|
return /*#__PURE__*/function (_React$Component) {
|
|
22
18
|
_inherits(_class2, _React$Component);
|
|
23
|
-
|
|
24
19
|
var _super = _createSuper(_class2);
|
|
25
|
-
|
|
26
20
|
function _class2() {
|
|
27
21
|
var _context;
|
|
28
|
-
|
|
29
22
|
var _this;
|
|
30
|
-
|
|
31
23
|
_classCallCheck(this, _class2);
|
|
32
|
-
|
|
33
24
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
25
|
args[_key] = arguments[_key];
|
|
35
26
|
}
|
|
36
|
-
|
|
37
27
|
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
38
|
-
|
|
39
28
|
_defineProperty(_assertThisInitialized(_this), "toDialogs", function () {
|
|
40
29
|
return _reduceInstanceProperty(keys).call(keys, function (result, key, index) {
|
|
41
30
|
var Dialog = Dialogs[index];
|
|
@@ -46,10 +35,8 @@ var Enhance = function Enhance(Container, keys, Dialogs) {
|
|
|
46
35
|
return result;
|
|
47
36
|
}, []);
|
|
48
37
|
});
|
|
49
|
-
|
|
50
38
|
return _this;
|
|
51
39
|
}
|
|
52
|
-
|
|
53
40
|
_createClass(_class2, [{
|
|
54
41
|
key: "render",
|
|
55
42
|
value: function render() {
|
|
@@ -59,9 +46,7 @@ var Enhance = function Enhance(Container, keys, Dialogs) {
|
|
|
59
46
|
}, /*#__PURE__*/React.createElement(Container, props), this.toDialogs());
|
|
60
47
|
}
|
|
61
48
|
}]);
|
|
62
|
-
|
|
63
49
|
return _class2;
|
|
64
50
|
}(React.Component);
|
|
65
51
|
};
|
|
66
|
-
|
|
67
52
|
export default Enhance;
|
package/es/Enhance/Loading.js
CHANGED
|
@@ -14,63 +14,52 @@ import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
|
14
14
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
15
15
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
16
16
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
17
|
-
|
|
18
17
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
|
|
22
19
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
23
|
-
|
|
24
20
|
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); }; }
|
|
25
|
-
|
|
26
21
|
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; } }
|
|
27
|
-
|
|
28
22
|
import React from 'react';
|
|
29
23
|
import PropTypes from 'prop-types';
|
|
30
24
|
import Loading from '../Loading';
|
|
31
|
-
var STATUS = ['loadingWithInit',
|
|
32
|
-
|
|
33
|
-
'
|
|
34
|
-
|
|
25
|
+
var STATUS = ['loadingWithInit',
|
|
26
|
+
// 显示加载画面,并自动触发onInit事件,默认值
|
|
27
|
+
'loading',
|
|
28
|
+
// 显示加载画面
|
|
29
|
+
'retry',
|
|
30
|
+
// 显示重试画面
|
|
31
|
+
'retryForHome',
|
|
32
|
+
// 显示重试画面(触发onInit时,home参数为true)
|
|
35
33
|
'page' // 显示正常的页面(表明页面状态已经初始化好)
|
|
36
34
|
];
|
|
35
|
+
|
|
37
36
|
/**
|
|
38
37
|
* status: [可选], 当前状态。默认为loadingWithInit
|
|
39
38
|
* home: [可选],为true表明接受首页触发的事件。默认为false
|
|
40
39
|
* onInit: [可选],原型为func(home),home为true表明初始化是来源首页
|
|
41
40
|
* onRefreshForHome:[可选],检测到来至首页时会触发该事件,原型为func()
|
|
42
41
|
*/
|
|
43
|
-
|
|
44
42
|
var Enhance = function Enhance(Component) {
|
|
45
43
|
var _class;
|
|
46
|
-
|
|
47
44
|
return _class = /*#__PURE__*/function (_React$Component) {
|
|
48
45
|
_inherits(_class, _React$Component);
|
|
49
|
-
|
|
50
46
|
var _super = _createSuper(_class);
|
|
51
|
-
|
|
52
47
|
function _class() {
|
|
53
48
|
var _context;
|
|
54
|
-
|
|
55
49
|
var _this;
|
|
56
|
-
|
|
57
50
|
_classCallCheck(this, _class);
|
|
58
|
-
|
|
59
51
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
52
|
args[_key] = arguments[_key];
|
|
61
53
|
}
|
|
62
|
-
|
|
63
54
|
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
64
|
-
|
|
65
55
|
_defineProperty(_assertThisInitialized(_this), "triggerEvent", function () {
|
|
66
56
|
if (!global.isServer) {
|
|
67
57
|
var _this$props = _this.props,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
_this$props$status = _this$props.status,
|
|
59
|
+
status = _this$props$status === void 0 ? 'loadingWithInit' : _this$props$status,
|
|
60
|
+
home = _this$props.home,
|
|
61
|
+
onInit = _this$props.onInit,
|
|
62
|
+
onRefreshForHome = _this$props.onRefreshForHome;
|
|
74
63
|
if (!home) {
|
|
75
64
|
if (status === 'loadingWithInit') {
|
|
76
65
|
onInit && onInit(false);
|
|
@@ -78,7 +67,6 @@ var Enhance = function Enhance(Component) {
|
|
|
78
67
|
} else {
|
|
79
68
|
var __home = global['__home'];
|
|
80
69
|
global['__home'] && (global['__home'] = false);
|
|
81
|
-
|
|
82
70
|
if (status === 'loadingWithInit') {
|
|
83
71
|
onInit && onInit(__home);
|
|
84
72
|
} else if (__home) {
|
|
@@ -91,27 +79,22 @@ var Enhance = function Enhance(Component) {
|
|
|
91
79
|
}
|
|
92
80
|
}
|
|
93
81
|
});
|
|
94
|
-
|
|
95
82
|
_defineProperty(_assertThisInitialized(_this), "onRetry", function () {
|
|
96
83
|
var _this$props2 = _this.props,
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
status = _this$props2.status,
|
|
85
|
+
onInit = _this$props2.onInit;
|
|
99
86
|
onInit && onInit(status === 'retryForHome');
|
|
100
87
|
});
|
|
101
|
-
|
|
102
88
|
_defineProperty(_assertThisInitialized(_this), "getPageProps", function () {
|
|
103
89
|
var props = _objectSpread({}, _this.props);
|
|
104
|
-
|
|
105
90
|
delete props.status;
|
|
106
91
|
delete props.home;
|
|
107
92
|
delete props.onInit;
|
|
108
93
|
delete props.onRefreshForHome;
|
|
109
94
|
return props;
|
|
110
95
|
});
|
|
111
|
-
|
|
112
96
|
return _this;
|
|
113
97
|
}
|
|
114
|
-
|
|
115
98
|
_createClass(_class, [{
|
|
116
99
|
key: "componentDidMount",
|
|
117
100
|
value: function componentDidMount() {
|
|
@@ -126,7 +109,6 @@ var Enhance = function Enhance(Component) {
|
|
|
126
109
|
key: "render",
|
|
127
110
|
value: function render() {
|
|
128
111
|
var status = this.props.status;
|
|
129
|
-
|
|
130
112
|
if (status !== 'page') {
|
|
131
113
|
var retry = status === 'retry' || status === 'retryForHome';
|
|
132
114
|
return /*#__PURE__*/React.createElement(Loading, {
|
|
@@ -138,7 +120,6 @@ var Enhance = function Enhance(Component) {
|
|
|
138
120
|
}
|
|
139
121
|
}
|
|
140
122
|
}]);
|
|
141
|
-
|
|
142
123
|
return _class;
|
|
143
124
|
}(React.Component), _defineProperty(_class, "propTypes", {
|
|
144
125
|
status: PropTypes.oneOf(STATUS),
|
|
@@ -147,5 +128,4 @@ var Enhance = function Enhance(Component) {
|
|
|
147
128
|
onRefreshForHome: PropTypes.func
|
|
148
129
|
}), _class;
|
|
149
130
|
};
|
|
150
|
-
|
|
151
131
|
export default Enhance;
|
package/es/Enhance/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import EnhanceLoading from './Loading';
|
|
2
2
|
import EnhanceDialogs from './Dialogs';
|
|
3
|
-
|
|
4
3
|
var EnhanceEditDialog = function EnhanceEditDialog(Container, EditDialog) {
|
|
5
4
|
return EnhanceDialogs(Container, ['edit'], [EditDialog]);
|
|
6
5
|
};
|
|
7
|
-
|
|
8
6
|
export { EnhanceLoading, EnhanceDialogs, EnhanceEditDialog };
|