cloud-b2b 1.1.27 → 1.1.28
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 +95 -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 +95 -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
|
@@ -10,11 +10,8 @@ import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
|
10
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
11
11
|
import _Icon from "antd/es/icon";
|
|
12
12
|
import _AutoComplete from "antd/es/auto-complete";
|
|
13
|
-
|
|
14
13
|
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); }; }
|
|
15
|
-
|
|
16
14
|
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; } }
|
|
17
|
-
|
|
18
15
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
19
16
|
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
20
17
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
@@ -26,8 +23,9 @@ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign"
|
|
|
26
23
|
import React from 'react';
|
|
27
24
|
import PropTypes from 'prop-types';
|
|
28
25
|
import { getObjectExclude } from '../helper';
|
|
29
|
-
var SelectOption = _AutoComplete.Option;
|
|
26
|
+
var SelectOption = _AutoComplete.Option;
|
|
30
27
|
|
|
28
|
+
// 如果写在局部,每次渲染时生成的suffix引用值不同,会使antd的Input认为suffix动态变化了,从而导致Input报出警告 (antd的BUG)
|
|
31
29
|
var suffix = /*#__PURE__*/React.createElement(_Icon, {
|
|
32
30
|
type: "search",
|
|
33
31
|
style: {
|
|
@@ -47,13 +45,13 @@ var OPTION_STYLE2 = {
|
|
|
47
45
|
color: '#aaa',
|
|
48
46
|
whiteSpace: 'pre-wrap'
|
|
49
47
|
};
|
|
48
|
+
|
|
50
49
|
/**
|
|
51
50
|
* filter: 为true表示下拉列表会依据输入的值进行前端过滤,默认为true; 如果不想过滤,则设为false
|
|
52
51
|
* remark: 为true表示options的option中含有remark字段,并需要用remark值进行过滤下拉,默认为false
|
|
53
52
|
* searchWhenClick: 每次点击时,触发onSearch事件,默认为false
|
|
54
53
|
* noSearchWhenTypo: 当输入时,不触发onSearch事件,默认为false
|
|
55
54
|
*/
|
|
56
|
-
|
|
57
55
|
var PROPS = {
|
|
58
56
|
filter: PropTypes.bool,
|
|
59
57
|
remark: PropTypes.bool,
|
|
@@ -67,48 +65,36 @@ var PROPS = {
|
|
|
67
65
|
onSelect: PropTypes.func,
|
|
68
66
|
onSearch: PropTypes.func
|
|
69
67
|
};
|
|
70
|
-
|
|
71
68
|
var PROPS_KEYS = _Object$keys(PROPS);
|
|
72
|
-
|
|
73
69
|
var InputSearch = /*#__PURE__*/function (_React$Component) {
|
|
74
70
|
_inherits(InputSearch, _React$Component);
|
|
75
|
-
|
|
76
71
|
var _super = _createSuper(InputSearch);
|
|
77
|
-
|
|
78
72
|
function InputSearch(_props) {
|
|
79
73
|
var _this;
|
|
80
|
-
|
|
81
74
|
_classCallCheck(this, InputSearch);
|
|
82
|
-
|
|
83
75
|
_this = _super.call(this, _props);
|
|
84
|
-
|
|
85
76
|
_defineProperty(_assertThisInitialized(_this), "onSearch", function (value) {
|
|
86
77
|
_this.setState({
|
|
87
78
|
value: value
|
|
88
79
|
});
|
|
89
|
-
|
|
90
80
|
var _this$props = _this.props,
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
onSearch = _this$props.onSearch,
|
|
82
|
+
noSearchWhenTypo = _this$props.noSearchWhenTypo;
|
|
93
83
|
!noSearchWhenTypo && onSearch && onSearch(value);
|
|
94
84
|
});
|
|
95
|
-
|
|
96
85
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function () {
|
|
97
86
|
var _this$props2 = _this.props,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
87
|
+
_this$props2$autoAdd = _this$props2.autoAdd,
|
|
88
|
+
autoAdd = _this$props2$autoAdd === void 0 ? false : _this$props2$autoAdd,
|
|
89
|
+
_this$props2$options = _this$props2.options,
|
|
90
|
+
options = _this$props2$options === void 0 ? [] : _this$props2$options,
|
|
91
|
+
onChange = _this$props2.onChange,
|
|
92
|
+
onBlur = _this$props2.onBlur;
|
|
105
93
|
if (_this.props.value !== _this.state.value) {
|
|
106
94
|
var index = _findIndexInstanceProperty(options).call(options, function (option) {
|
|
107
95
|
return option.title === _this.state.value;
|
|
108
96
|
});
|
|
109
|
-
|
|
110
97
|
var value = '';
|
|
111
|
-
|
|
112
98
|
if (index === -1) {
|
|
113
99
|
if (autoAdd && _this.state.value) {
|
|
114
100
|
if (typeof _this.state.value === 'string') {
|
|
@@ -123,87 +109,69 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
|
|
|
123
109
|
} else {
|
|
124
110
|
value = options[index];
|
|
125
111
|
}
|
|
126
|
-
|
|
127
112
|
_this.setState({
|
|
128
113
|
value: value
|
|
129
114
|
});
|
|
130
|
-
|
|
131
115
|
onChange && onChange(value);
|
|
132
116
|
onBlur && onBlur(value);
|
|
133
117
|
} else {
|
|
134
118
|
onBlur && onBlur(_this.props.value);
|
|
135
119
|
}
|
|
136
120
|
});
|
|
137
|
-
|
|
138
121
|
_defineProperty(_assertThisInitialized(_this), "onSelect", function (value) {
|
|
139
122
|
var _this$props3 = _this.props,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
123
|
+
onChange = _this$props3.onChange,
|
|
124
|
+
_this$props3$options = _this$props3.options,
|
|
125
|
+
options = _this$props3$options === void 0 ? [] : _this$props3$options;
|
|
144
126
|
var index = _findIndexInstanceProperty(options).call(options, function (option) {
|
|
145
127
|
return String(option.value) === value;
|
|
146
128
|
});
|
|
147
|
-
|
|
148
129
|
if (index > -1) {
|
|
149
130
|
_this.setState({
|
|
150
131
|
value: options[index]
|
|
151
132
|
});
|
|
152
|
-
|
|
153
133
|
onChange && onChange(options[index]);
|
|
154
134
|
}
|
|
155
135
|
});
|
|
156
|
-
|
|
157
136
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
|
|
158
137
|
var _this$props4 = _this.props,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
138
|
+
_this$props4$options = _this$props4.options,
|
|
139
|
+
options = _this$props4$options === void 0 ? [] : _this$props4$options,
|
|
140
|
+
onSearch = _this$props4.onSearch,
|
|
141
|
+
searchWhenClick = _this$props4.searchWhenClick,
|
|
142
|
+
value = _this$props4.value;
|
|
165
143
|
if (onSearch && (!options.length || !value && searchWhenClick)) {
|
|
166
144
|
onSearch(e.target.value);
|
|
167
145
|
}
|
|
168
146
|
});
|
|
169
|
-
|
|
170
147
|
_defineProperty(_assertThisInitialized(_this), "makeValueValid", function (value) {
|
|
171
148
|
var _context;
|
|
172
|
-
|
|
173
149
|
return _includesInstanceProperty(_context = [NaN, undefined, null]).call(_context, value) ? '' : value;
|
|
174
150
|
});
|
|
175
|
-
|
|
176
151
|
_defineProperty(_assertThisInitialized(_this), "getValue", function () {
|
|
177
152
|
var value = _this.state.value;
|
|
178
153
|
return String(_this.makeValueValid(_typeof(value) === 'object' ? value.value : value));
|
|
179
154
|
});
|
|
180
|
-
|
|
181
155
|
_defineProperty(_assertThisInitialized(_this), "isMatch", function (inputValue, option) {
|
|
182
156
|
var _context2;
|
|
183
|
-
|
|
184
157
|
return option.props.children && _indexOfInstanceProperty(_context2 = option.props.children).call(_context2, inputValue) !== -1;
|
|
185
158
|
});
|
|
186
|
-
|
|
187
159
|
_defineProperty(_assertThisInitialized(_this), "isMatchRemark", function (inputValue, option) {
|
|
188
160
|
var _option$props = option.props,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
161
|
+
_option$props$text = _option$props.text,
|
|
162
|
+
text = _option$props$text === void 0 ? '' : _option$props$text,
|
|
163
|
+
_option$props$remark = _option$props.remark,
|
|
164
|
+
remark = _option$props$remark === void 0 ? '' : _option$props$remark;
|
|
193
165
|
return _indexOfInstanceProperty(text).call(text, inputValue) > -1 || _indexOfInstanceProperty(remark).call(remark, inputValue) > -1;
|
|
194
166
|
});
|
|
195
|
-
|
|
196
167
|
_defineProperty(_assertThisInitialized(_this), "isValidValue", function (value) {
|
|
197
168
|
var _context3;
|
|
198
|
-
|
|
199
169
|
// value必须为对象,且有属性value的值不等''或undefined
|
|
200
170
|
return value && !_includesInstanceProperty(_context3 = ['', undefined]).call(_context3, value.value);
|
|
201
171
|
});
|
|
202
|
-
|
|
203
172
|
_defineProperty(_assertThisInitialized(_this), "getOptions", function () {
|
|
204
173
|
var value = _this.state.value;
|
|
205
174
|
var options = _this.props.options;
|
|
206
|
-
|
|
207
175
|
if (options && options.length) {
|
|
208
176
|
if (_this.isValidValue(value) && !_findInstanceProperty(options).call(options, function (option) {
|
|
209
177
|
return option.value === value.value;
|
|
@@ -218,10 +186,8 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
|
|
|
218
186
|
return [];
|
|
219
187
|
}
|
|
220
188
|
});
|
|
221
|
-
|
|
222
189
|
_defineProperty(_assertThisInitialized(_this), "getDataSource", function () {
|
|
223
190
|
var _context4;
|
|
224
|
-
|
|
225
191
|
return _mapInstanceProperty(_context4 = _this.getOptions()).call(_context4, function (option) {
|
|
226
192
|
return {
|
|
227
193
|
value: String(option.value),
|
|
@@ -229,10 +195,8 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
|
|
|
229
195
|
};
|
|
230
196
|
});
|
|
231
197
|
});
|
|
232
|
-
|
|
233
198
|
_defineProperty(_assertThisInitialized(_this), "getDataSourceRemark", function () {
|
|
234
199
|
var _context5;
|
|
235
|
-
|
|
236
200
|
return _mapInstanceProperty(_context5 = _this.getOptions()).call(_context5, function (option, index) {
|
|
237
201
|
return /*#__PURE__*/React.createElement(SelectOption, {
|
|
238
202
|
key: index,
|
|
@@ -246,13 +210,11 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
|
|
|
246
210
|
}, option.description || ''));
|
|
247
211
|
});
|
|
248
212
|
});
|
|
249
|
-
|
|
250
213
|
_defineProperty(_assertThisInitialized(_this), "getProps", function () {
|
|
251
214
|
var _this$props5 = _this.props,
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
215
|
+
inputRef = _this$props5.inputRef,
|
|
216
|
+
_this$props5$filter = _filterInstanceProperty(_this$props5),
|
|
217
|
+
filter = _this$props5$filter === void 0 ? true : _this$props5$filter;
|
|
256
218
|
var props = _Object$assign(getObjectExclude(_this.props, PROPS_KEYS), {
|
|
257
219
|
value: _this.getValue(),
|
|
258
220
|
allowClear: true,
|
|
@@ -264,7 +226,6 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
|
|
|
264
226
|
onSelect: _this.onSelect,
|
|
265
227
|
onBlur: _this.onBlur
|
|
266
228
|
});
|
|
267
|
-
|
|
268
229
|
if (_this.props.remark) {
|
|
269
230
|
props.dataSource = _this.getDataSourceRemark();
|
|
270
231
|
props.filterOption = filter ? _this.isMatchRemark : false;
|
|
@@ -273,16 +234,13 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
|
|
|
273
234
|
props.dataSource = _this.getDataSource();
|
|
274
235
|
props.filterOption = filter ? _this.isMatch : false;
|
|
275
236
|
}
|
|
276
|
-
|
|
277
237
|
return props;
|
|
278
238
|
});
|
|
279
|
-
|
|
280
239
|
_this.state = {
|
|
281
240
|
value: _props.value
|
|
282
241
|
};
|
|
283
242
|
return _this;
|
|
284
243
|
}
|
|
285
|
-
|
|
286
244
|
_createClass(InputSearch, [{
|
|
287
245
|
key: "componentWillReceiveProps",
|
|
288
246
|
value: function componentWillReceiveProps(props) {
|
|
@@ -302,10 +260,7 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
|
|
|
302
260
|
})));
|
|
303
261
|
}
|
|
304
262
|
}]);
|
|
305
|
-
|
|
306
263
|
return InputSearch;
|
|
307
264
|
}(React.Component);
|
|
308
|
-
|
|
309
265
|
_defineProperty(InputSearch, "propTypes", PROPS);
|
|
310
|
-
|
|
311
266
|
export default InputSearch;
|
|
@@ -15,11 +15,8 @@ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleC
|
|
|
15
15
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
16
16
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
17
17
|
import _Select from "antd/es/select";
|
|
18
|
-
|
|
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 _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
-
|
|
23
20
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
24
21
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
25
22
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
@@ -27,11 +24,8 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
|
27
24
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
28
25
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
29
26
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
30
|
-
|
|
31
27
|
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); }; }
|
|
32
|
-
|
|
33
28
|
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
|
-
|
|
35
29
|
import React from 'react';
|
|
36
30
|
var SelectOption = _Select.Option;
|
|
37
31
|
var OPTION_STYLE = {
|
|
@@ -41,58 +35,45 @@ var OPTION_STYLE = {
|
|
|
41
35
|
color: '#aaa',
|
|
42
36
|
whiteSpace: 'pre-wrap'
|
|
43
37
|
};
|
|
44
|
-
|
|
45
38
|
var InputSelect = /*#__PURE__*/function (_React$Component) {
|
|
46
39
|
_inherits(InputSelect, _React$Component);
|
|
47
|
-
|
|
48
40
|
var _super = _createSuper(InputSelect);
|
|
49
|
-
|
|
50
41
|
function InputSelect() {
|
|
51
42
|
var _context;
|
|
52
|
-
|
|
53
43
|
var _this;
|
|
54
|
-
|
|
55
44
|
_classCallCheck(this, InputSelect);
|
|
56
|
-
|
|
57
45
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
58
46
|
args[_key] = arguments[_key];
|
|
59
47
|
}
|
|
60
|
-
|
|
61
48
|
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
62
|
-
|
|
63
49
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
|
|
64
50
|
var _this$props = _this.props,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
_this$props$options = _this$props.options,
|
|
52
|
+
options = _this$props$options === void 0 ? [] : _this$props$options,
|
|
53
|
+
onSearch = _this$props.onSearch,
|
|
54
|
+
_this$props$value = _this$props.value,
|
|
55
|
+
value = _this$props$value === void 0 ? [] : _this$props$value,
|
|
56
|
+
_this$props$searchWhe = _this$props.searchWhenClick,
|
|
57
|
+
searchWhenClick = _this$props$searchWhe === void 0 ? false : _this$props$searchWhe;
|
|
58
|
+
// if (onSearch && (options.length <= value.length)) {
|
|
73
59
|
if (onSearch && searchWhenClick) {
|
|
74
60
|
onSearch(e.target.value);
|
|
75
61
|
}
|
|
76
62
|
});
|
|
77
|
-
|
|
78
63
|
_defineProperty(_assertThisInitialized(_this), "onSearch", function (value) {
|
|
79
64
|
var onSearch = _this.props.onSearch;
|
|
80
65
|
onSearch && onSearch(value);
|
|
81
66
|
});
|
|
82
|
-
|
|
83
67
|
_defineProperty(_assertThisInitialized(_this), "isMatch", function (inputValue, option) {
|
|
84
68
|
var _context2;
|
|
85
|
-
|
|
86
69
|
return _indexOfInstanceProperty(_context2 = option.props.children).call(_context2, inputValue) !== -1;
|
|
87
70
|
});
|
|
88
|
-
|
|
89
71
|
_defineProperty(_assertThisInitialized(_this), "isMatchRemark", function (inputValue, option) {
|
|
90
72
|
var _option$props = option.props,
|
|
91
|
-
|
|
92
|
-
|
|
73
|
+
text = _option$props.text,
|
|
74
|
+
remark = _option$props.remark;
|
|
93
75
|
return _indexOfInstanceProperty(text).call(text, inputValue) > -1 || _indexOfInstanceProperty(remark).call(remark, inputValue) > -1;
|
|
94
76
|
});
|
|
95
|
-
|
|
96
77
|
_defineProperty(_assertThisInitialized(_this), "toRemarkOption", function (option, index) {
|
|
97
78
|
return /*#__PURE__*/React.createElement(SelectOption, {
|
|
98
79
|
key: index,
|
|
@@ -104,7 +85,6 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
104
85
|
style: OPTION_STYLE
|
|
105
86
|
}, option.remark || ''));
|
|
106
87
|
});
|
|
107
|
-
|
|
108
88
|
_defineProperty(_assertThisInitialized(_this), "toOption", function (option, index) {
|
|
109
89
|
return /*#__PURE__*/React.createElement(SelectOption, {
|
|
110
90
|
key: index,
|
|
@@ -112,7 +92,6 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
112
92
|
disabled: option.disabled || false
|
|
113
93
|
}, option.title);
|
|
114
94
|
});
|
|
115
|
-
|
|
116
95
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (options, keyValue) {
|
|
117
96
|
var onChange = _this.props.onChange;
|
|
118
97
|
var objValue = keyValue.length > 0 ? _mapInstanceProperty(keyValue).call(keyValue, function (item) {
|
|
@@ -125,10 +104,8 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
125
104
|
}) : [];
|
|
126
105
|
onChange && onChange(objValue);
|
|
127
106
|
});
|
|
128
|
-
|
|
129
107
|
_defineProperty(_assertThisInitialized(_this), "getValue", function () {
|
|
130
108
|
var value = _this.props.value;
|
|
131
|
-
|
|
132
109
|
if (_typeof(value) === 'object' && _Array$isArray(value)) {
|
|
133
110
|
return _mapInstanceProperty(value).call(value, function (item) {
|
|
134
111
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -140,32 +117,26 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
140
117
|
return [];
|
|
141
118
|
}
|
|
142
119
|
});
|
|
143
|
-
|
|
144
120
|
return _this;
|
|
145
121
|
}
|
|
146
|
-
|
|
147
122
|
_createClass(InputSelect, [{
|
|
148
123
|
key: "render",
|
|
149
124
|
value: function render() {
|
|
150
125
|
var _context3, _context4;
|
|
151
|
-
|
|
152
126
|
var _this$props2 = this.props,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
127
|
+
_this$props2$options = _this$props2.options,
|
|
128
|
+
options = _this$props2$options === void 0 ? [] : _this$props2$options,
|
|
129
|
+
size = _this$props2.size,
|
|
130
|
+
_this$props2$value = _this$props2.value,
|
|
131
|
+
value = _this$props2$value === void 0 ? [] : _this$props2$value,
|
|
132
|
+
_this$props2$allowCle = _this$props2.allowClear,
|
|
133
|
+
allowClear = _this$props2$allowCle === void 0 ? true : _this$props2$allowCle;
|
|
161
134
|
var values = _mapInstanceProperty(value).call(value, function (o) {
|
|
162
135
|
return o.value;
|
|
163
136
|
});
|
|
164
|
-
|
|
165
137
|
var allOptions = _concatInstanceProperty(_context3 = _filterInstanceProperty(options).call(options, function (o) {
|
|
166
138
|
return !_includesInstanceProperty(values).call(values, o.value);
|
|
167
139
|
})).call(_context3, value);
|
|
168
|
-
|
|
169
140
|
var props = {
|
|
170
141
|
value: this.getValue(),
|
|
171
142
|
style: this.props.style || {},
|
|
@@ -184,8 +155,6 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
184
155
|
}, /*#__PURE__*/React.createElement(_Select, props, this.props.remark ? _mapInstanceProperty(allOptions).call(allOptions, this.toRemarkOption) : _mapInstanceProperty(allOptions).call(allOptions, this.toOption)));
|
|
185
156
|
}
|
|
186
157
|
}]);
|
|
187
|
-
|
|
188
158
|
return InputSelect;
|
|
189
159
|
}(React.Component);
|
|
190
|
-
|
|
191
160
|
export default InputSelect;
|
|
@@ -9,78 +9,58 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
|
9
9
|
import _Select from "antd/es/select";
|
|
10
10
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
11
11
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
12
|
-
|
|
13
12
|
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); }; }
|
|
14
|
-
|
|
15
13
|
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; } }
|
|
16
|
-
|
|
17
14
|
import React from 'react';
|
|
18
15
|
var Option = _Select.Option;
|
|
19
|
-
|
|
20
16
|
var InputWriting = /*#__PURE__*/function (_React$Component) {
|
|
21
17
|
_inherits(InputWriting, _React$Component);
|
|
22
|
-
|
|
23
18
|
var _super = _createSuper(InputWriting);
|
|
24
|
-
|
|
25
19
|
function InputWriting() {
|
|
26
20
|
var _context;
|
|
27
|
-
|
|
28
21
|
var _this;
|
|
29
|
-
|
|
30
22
|
_classCallCheck(this, InputWriting);
|
|
31
|
-
|
|
32
23
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
33
24
|
args[_key] = arguments[_key];
|
|
34
25
|
}
|
|
35
|
-
|
|
36
26
|
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
37
|
-
|
|
38
27
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
39
28
|
options: [],
|
|
40
29
|
value: [],
|
|
41
30
|
fetching: false
|
|
42
31
|
});
|
|
43
|
-
|
|
44
32
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
|
|
45
33
|
var _this$props = _this.props,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
_this$props$options = _this$props.options,
|
|
35
|
+
options = _this$props$options === void 0 ? [] : _this$props$options,
|
|
36
|
+
onSearch = _this$props.onSearch,
|
|
37
|
+
value = _this$props.value;
|
|
51
38
|
if (onSearch && !options.length) {
|
|
52
39
|
onSearch(e.target.value);
|
|
53
40
|
}
|
|
54
41
|
});
|
|
55
|
-
|
|
56
42
|
_defineProperty(_assertThisInitialized(_this), "onSearch", function (value) {
|
|
57
43
|
var onSearch = _this.props.onSearch;
|
|
58
44
|
onSearch && onSearch(value);
|
|
59
45
|
});
|
|
60
|
-
|
|
61
46
|
_defineProperty(_assertThisInitialized(_this), "isMatch", function (inputValue, option) {
|
|
62
47
|
var _context2;
|
|
63
|
-
|
|
64
48
|
return _indexOfInstanceProperty(_context2 = option.props.children).call(_context2, inputValue) !== -1;
|
|
65
49
|
});
|
|
66
|
-
|
|
67
50
|
_defineProperty(_assertThisInitialized(_this), "toOption", function (option, index) {
|
|
68
51
|
return /*#__PURE__*/React.createElement(SelectOption, {
|
|
69
52
|
key: index,
|
|
70
53
|
value: String(option.value)
|
|
71
54
|
}, option.title);
|
|
72
55
|
});
|
|
73
|
-
|
|
74
56
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (keyValue) {
|
|
75
57
|
var _this$props2 = _this.props,
|
|
76
|
-
|
|
77
|
-
|
|
58
|
+
onChange = _this$props2.onChange,
|
|
59
|
+
value = _this$props2.value;
|
|
78
60
|
onChange && onChange(keyValue);
|
|
79
61
|
});
|
|
80
|
-
|
|
81
62
|
return _this;
|
|
82
63
|
}
|
|
83
|
-
|
|
84
64
|
_createClass(InputWriting, [{
|
|
85
65
|
key: "render",
|
|
86
66
|
value: function render() {
|
|
@@ -100,8 +80,6 @@ var InputWriting = /*#__PURE__*/function (_React$Component) {
|
|
|
100
80
|
}, /*#__PURE__*/React.createElement(_Select, props));
|
|
101
81
|
}
|
|
102
82
|
}]);
|
|
103
|
-
|
|
104
83
|
return InputWriting;
|
|
105
84
|
}(React.Component);
|
|
106
|
-
|
|
107
85
|
export default InputWriting;
|