cloud-b2b 1.1.45 → 1.1.50

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 (109) hide show
  1. package/es/Area/Area.js +45 -16
  2. package/es/Card/Card.js +4 -3
  3. package/es/CodeInput/CodeInput.js +59 -30
  4. package/es/Control/Control.js +117 -58
  5. package/es/Control/event.js +14 -0
  6. package/es/Enhance/Dialogs.js +21 -6
  7. package/es/Enhance/Loading.js +46 -26
  8. package/es/Enhance/index.js +2 -0
  9. package/es/Header/Header.js +35 -3
  10. package/es/Header/Vertical.js +24 -1
  11. package/es/ImageView/ImageView.js +22 -5
  12. package/es/Indent/Indent.js +7 -3
  13. package/es/InpurCascader/InputCascader.js +36 -10
  14. package/es/InputEditor/InputEditor.js +52 -53
  15. package/es/InputSearch/InputSearch.js +71 -26
  16. package/es/InputSelect/InputSelect.js +48 -17
  17. package/es/InputTreeSelect/InputTreeSelect.js +147 -0
  18. package/es/InputTreeSelect/package.json +6 -0
  19. package/es/InputWriting/InputWriting.js +28 -6
  20. package/es/Layout/Layout.js +59 -28
  21. package/es/LayoutLink/LayoutLink.js +20 -11
  22. package/es/Link/Link.js +27 -4
  23. package/es/Loading/Loading.js +3 -1
  24. package/es/Loading2/Loading2.js +2 -0
  25. package/es/ModalWithDrag/ModalWithDrag.js +8 -3
  26. package/es/ModalWithDrag/drag.js +29 -12
  27. package/es/NumberInput/NumberInput.js +64 -24
  28. package/es/Search/Search.js +164 -54
  29. package/es/Sidebar/Sidebar.js +34 -13
  30. package/es/Sidebar2/Sidebar.js +30 -3
  31. package/es/SuperForm/SuperForm.js +164 -27
  32. package/es/SuperForm2/SuperForm.js +182 -31
  33. package/es/SuperIcon/SuperIcon.js +6 -3
  34. package/es/SuperPagination/SuperPagination.js +32 -15
  35. package/es/SuperTab/SuperTab.js +27 -4
  36. package/es/SuperTab2/SuperTab2.js +33 -11
  37. package/es/SuperTable/DragSortRow.js +34 -6
  38. package/es/SuperTable/FilterDropDown.js +34 -10
  39. package/es/SuperTable/SuperTable.js +216 -84
  40. package/es/SuperTable/fixed.js +9 -1
  41. package/es/SuperTable2/SuperTable2.js +227 -102
  42. package/es/SuperTable2/SuperTableCell.js +60 -16
  43. package/es/SuperTable3/FilterDropDown.js +34 -10
  44. package/es/SuperTable3/SuperTable.js +175 -50
  45. package/es/SuperTable3/fixed.js +9 -1
  46. package/es/SuperToolbar/SuperToolbar.js +49 -21
  47. package/es/SuperUpload/SuperUpload.js +233 -156
  48. package/es/Title/Title.js +15 -12
  49. package/es/Viewer/ImageViews.js +60 -7
  50. package/es/Viewer/Viewer.js +32 -5
  51. package/es/WingBlank/WingBlank.js +6 -2
  52. package/es/helper.js +29 -7
  53. package/es/history.js +2 -3
  54. package/lib/Area/Area.js +64 -16
  55. package/lib/Card/Card.js +13 -3
  56. package/lib/CodeInput/CodeInput.js +77 -30
  57. package/lib/Control/Control.js +160 -58
  58. package/lib/Control/event.js +16 -0
  59. package/lib/Enhance/Dialogs.js +32 -6
  60. package/lib/Enhance/Loading.js +62 -26
  61. package/lib/Enhance/index.js +9 -0
  62. package/lib/Header/Header.js +48 -3
  63. package/lib/Header/Vertical.js +36 -1
  64. package/lib/ImageView/ImageView.js +30 -5
  65. package/lib/Indent/Indent.js +13 -3
  66. package/lib/InpurCascader/InputCascader.js +50 -11
  67. package/lib/InputEditor/InputEditor.js +61 -53
  68. package/lib/InputSearch/InputSearch.js +78 -26
  69. package/lib/InputSelect/InputSelect.js +62 -17
  70. package/lib/InputTreeSelect/InputTreeSelect.js +169 -0
  71. package/lib/InputTreeSelect/package.json +6 -0
  72. package/lib/InputWriting/InputWriting.js +35 -6
  73. package/lib/Layout/Layout.js +76 -28
  74. package/lib/LayoutLink/LayoutLink.js +38 -11
  75. package/lib/Link/Link.js +40 -4
  76. package/lib/Loading/Loading.js +9 -1
  77. package/lib/Loading2/Loading2.js +8 -0
  78. package/lib/ModalWithDrag/ModalWithDrag.js +18 -3
  79. package/lib/ModalWithDrag/drag.js +34 -12
  80. package/lib/NumberInput/NumberInput.js +77 -24
  81. package/lib/Search/Search.js +171 -54
  82. package/lib/Sidebar/Sidebar.js +46 -13
  83. package/lib/Sidebar2/Sidebar.js +42 -3
  84. package/lib/SuperForm/SuperForm.js +162 -27
  85. package/lib/SuperForm2/SuperForm.js +175 -31
  86. package/lib/SuperIcon/SuperIcon.js +14 -3
  87. package/lib/SuperPagination/SuperPagination.js +42 -15
  88. package/lib/SuperTab/SuperTab.js +34 -4
  89. package/lib/SuperTab2/SuperTab2.js +48 -11
  90. package/lib/SuperTable/DragSortRow.js +42 -6
  91. package/lib/SuperTable/FilterDropDown.js +42 -10
  92. package/lib/SuperTable/SuperTable.js +211 -83
  93. package/lib/SuperTable/fixed.js +13 -1
  94. package/lib/SuperTable2/SuperTable2.js +241 -102
  95. package/lib/SuperTable2/SuperTableCell.js +67 -13
  96. package/lib/SuperTable3/FilterDropDown.js +42 -10
  97. package/lib/SuperTable3/SuperTable.js +170 -49
  98. package/lib/SuperTable3/fixed.js +13 -1
  99. package/lib/SuperToolbar/SuperToolbar.js +64 -20
  100. package/lib/SuperUpload/SuperUpload.js +267 -156
  101. package/lib/Title/Title.js +24 -12
  102. package/lib/Viewer/ImageViews.js +63 -7
  103. package/lib/Viewer/Viewer.js +41 -5
  104. package/lib/WingBlank/WingBlank.js +14 -2
  105. package/lib/helper.js +47 -6
  106. package/lib/history.js +5 -0
  107. package/lib/index.js +76 -0
  108. package/lib/variables.js +4 -0
  109. package/package.json +2 -2
@@ -4,82 +4,80 @@ import _createClass from "@babel/runtime-corejs3/helpers/createClass";
4
4
  import _inherits from "@babel/runtime-corejs3/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
7
+
7
8
  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); }; }
9
+
8
10
  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; } }
11
+
9
12
  import React from 'react';
10
13
  import variables from '../variables';
11
- var defaultMenus = ['head',
12
- // 标题
13
- 'bold',
14
- // 粗体
15
- 'fontSize',
16
- // 字号
17
- 'fontName',
18
- // 字体
19
- 'italic',
20
- // 斜体
21
- 'underline',
22
- // 下划线
23
- 'strikeThrough',
24
- // 删除线
25
- 'foreColor',
26
- // 文字颜色
27
- 'backColor',
28
- // 背景颜色
29
- 'link',
30
- // 插入链接
31
- 'list',
32
- // 列表
33
- 'justify',
34
- // 对齐方式
35
- 'quote',
36
- // 引用
37
- 'image',
38
- // 插入图片
39
- 'table',
40
- // 表格
14
+ var defaultMenus = ['head', // 标题
15
+ 'bold', // 粗体
16
+ 'fontSize', // 字号
17
+ 'fontName', // 字体
18
+ 'italic', // 斜体
19
+ 'underline', // 下划线
20
+ 'strikeThrough', // 删除线
21
+ 'foreColor', // 文字颜色
22
+ 'backColor', // 背景颜色
23
+ 'link', // 插入链接
24
+ 'list', // 列表
25
+ 'justify', // 对齐方式
26
+ 'quote', // 引用
27
+ 'image', // 插入图片
28
+ 'table', // 表格
41
29
  'code' // 插入代码
42
30
  ];
31
+
43
32
  var InputEditor = /*#__PURE__*/function (_React$Component) {
44
33
  _inherits(InputEditor, _React$Component);
34
+
45
35
  var _super = _createSuper(InputEditor);
36
+
46
37
  function InputEditor() {
47
38
  _classCallCheck(this, InputEditor);
39
+
48
40
  return _super.apply(this, arguments);
49
41
  }
42
+
50
43
  _createClass(InputEditor, [{
51
44
  key: "componentDidMount",
52
45
  value: function componentDidMount() {
53
46
  var _this$props = this.props,
54
- inputKey = _this$props.inputKey,
55
- menus = _this$props.menus,
56
- color = _this$props.color,
57
- _this$props$showLinkI = _this$props.showLinkImg,
58
- showLinkImg = _this$props$showLinkI === void 0 ? true : _this$props$showLinkI,
59
- _this$props$uploadImg = _this$props.uploadImgShowBase64,
60
- uploadImgShowBase64 = _this$props$uploadImg === void 0 ? true : _this$props$uploadImg,
61
- onChange = _this$props.onChange,
62
- value = _this$props.value,
63
- readonly = _this$props.readonly;
47
+ inputKey = _this$props.inputKey,
48
+ menus = _this$props.menus,
49
+ color = _this$props.color,
50
+ _this$props$showLinkI = _this$props.showLinkImg,
51
+ showLinkImg = _this$props$showLinkI === void 0 ? true : _this$props$showLinkI,
52
+ _this$props$uploadImg = _this$props.uploadImgShowBase64,
53
+ uploadImgShowBase64 = _this$props$uploadImg === void 0 ? true : _this$props$uploadImg,
54
+ onChange = _this$props.onChange,
55
+ value = _this$props.value,
56
+ readonly = _this$props.readonly;
57
+
64
58
  if (!readonly) {
65
59
  var elem = this.refs[inputKey];
66
- this[inputKey] = new E(elem);
67
- //配置菜单
68
- menus && (this[inputKey].config.menus = menus);
69
- //配置颜色
70
- color && (this[inputKey].config.menus = color);
71
- //配置菜单
60
+ this[inputKey] = new E(elem); //配置菜单
61
+
62
+ menus && (this[inputKey].config.menus = menus); //配置颜色
63
+
64
+ color && (this[inputKey].config.menus = color); //配置菜单
65
+
72
66
  this[inputKey].config.menus = defaultMenus;
67
+
73
68
  if (menus) {
74
69
  this[inputKey].config.menus = menus;
75
70
  }
71
+
76
72
  this[inputKey].config.uploadImgShowBase64 = uploadImgShowBase64; //是否可以上传图片
73
+
77
74
  this[inputKey].config.showLinkImg = showLinkImg; //隐藏网络图片
78
75
 
79
76
  this[inputKey].config.onchange = function (html) {
80
77
  onChange && onChange(html);
81
- };
82
- //配置编辑区域的 z-index
78
+ }; //配置编辑区域的 z-index
79
+
80
+
83
81
  this[inputKey].config.zIndex = 0;
84
82
  this[inputKey].create();
85
83
  this[inputKey].txt.html(value);
@@ -87,17 +85,16 @@ var InputEditor = /*#__PURE__*/function (_React$Component) {
87
85
  }
88
86
  }, {
89
87
  key: "componentDidUpdate",
90
- value: function componentDidUpdate() {
91
- // const {inputKey,value='', readonly} = this.props;
88
+ value: function componentDidUpdate() {// const {inputKey,value='', readonly} = this.props;
92
89
  // !readonly && value && this[inputKey].txt.html(value); //支持清空操作
93
90
  }
94
91
  }, {
95
92
  key: "render",
96
93
  value: function render() {
97
94
  var _this$props2 = this.props,
98
- inputKey = _this$props2.inputKey,
99
- readonly = _this$props2.readonly,
100
- value = _this$props2.value;
95
+ inputKey = _this$props2.inputKey,
96
+ readonly = _this$props2.readonly,
97
+ value = _this$props2.value;
101
98
  return /*#__PURE__*/React.createElement("div", {
102
99
  className: variables('InputEditor')
103
100
  }, readonly ? /*#__PURE__*/React.createElement("div", {
@@ -109,6 +106,8 @@ var InputEditor = /*#__PURE__*/function (_React$Component) {
109
106
  }));
110
107
  }
111
108
  }]);
109
+
112
110
  return InputEditor;
113
111
  }(React.Component);
112
+
114
113
  export default InputEditor;
@@ -10,8 +10,11 @@ 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
+
13
14
  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
+
14
16
  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
+
15
18
  import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
16
19
  import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
17
20
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
@@ -23,9 +26,8 @@ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign"
23
26
  import React from 'react';
24
27
  import PropTypes from 'prop-types';
25
28
  import { getObjectExclude } from '../helper';
26
- var SelectOption = _AutoComplete.Option;
29
+ var SelectOption = _AutoComplete.Option; // 如果写在局部,每次渲染时生成的suffix引用值不同,会使antd的Input认为suffix动态变化了,从而导致Input报出警告 (antd的BUG)
27
30
 
28
- // 如果写在局部,每次渲染时生成的suffix引用值不同,会使antd的Input认为suffix动态变化了,从而导致Input报出警告 (antd的BUG)
29
31
  var suffix = /*#__PURE__*/React.createElement(_Icon, {
30
32
  type: "search",
31
33
  style: {
@@ -45,13 +47,13 @@ var OPTION_STYLE2 = {
45
47
  color: '#aaa',
46
48
  whiteSpace: 'pre-wrap'
47
49
  };
48
-
49
50
  /**
50
51
  * filter: 为true表示下拉列表会依据输入的值进行前端过滤,默认为true; 如果不想过滤,则设为false
51
52
  * remark: 为true表示options的option中含有remark字段,并需要用remark值进行过滤下拉,默认为false
52
53
  * searchWhenClick: 每次点击时,触发onSearch事件,默认为false
53
54
  * noSearchWhenTypo: 当输入时,不触发onSearch事件,默认为false
54
55
  */
56
+
55
57
  var PROPS = {
56
58
  filter: PropTypes.bool,
57
59
  remark: PropTypes.bool,
@@ -65,36 +67,48 @@ var PROPS = {
65
67
  onSelect: PropTypes.func,
66
68
  onSearch: PropTypes.func
67
69
  };
70
+
68
71
  var PROPS_KEYS = _Object$keys(PROPS);
72
+
69
73
  var InputSearch = /*#__PURE__*/function (_React$Component) {
70
74
  _inherits(InputSearch, _React$Component);
75
+
71
76
  var _super = _createSuper(InputSearch);
77
+
72
78
  function InputSearch(_props) {
73
79
  var _this;
80
+
74
81
  _classCallCheck(this, InputSearch);
82
+
75
83
  _this = _super.call(this, _props);
84
+
76
85
  _defineProperty(_assertThisInitialized(_this), "onSearch", function (value) {
77
86
  _this.setState({
78
87
  value: value
79
88
  });
89
+
80
90
  var _this$props = _this.props,
81
- onSearch = _this$props.onSearch,
82
- noSearchWhenTypo = _this$props.noSearchWhenTypo;
91
+ onSearch = _this$props.onSearch,
92
+ noSearchWhenTypo = _this$props.noSearchWhenTypo;
83
93
  !noSearchWhenTypo && onSearch && onSearch(value);
84
94
  });
95
+
85
96
  _defineProperty(_assertThisInitialized(_this), "onBlur", function () {
86
97
  var _this$props2 = _this.props,
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;
98
+ _this$props2$autoAdd = _this$props2.autoAdd,
99
+ autoAdd = _this$props2$autoAdd === void 0 ? false : _this$props2$autoAdd,
100
+ _this$props2$options = _this$props2.options,
101
+ options = _this$props2$options === void 0 ? [] : _this$props2$options,
102
+ onChange = _this$props2.onChange,
103
+ onBlur = _this$props2.onBlur;
104
+
93
105
  if (_this.props.value !== _this.state.value) {
94
106
  var index = _findIndexInstanceProperty(options).call(options, function (option) {
95
107
  return option.title === _this.state.value;
96
108
  });
109
+
97
110
  var value = '';
111
+
98
112
  if (index === -1) {
99
113
  if (autoAdd && _this.state.value) {
100
114
  if (typeof _this.state.value === 'string') {
@@ -109,69 +123,87 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
109
123
  } else {
110
124
  value = options[index];
111
125
  }
126
+
112
127
  _this.setState({
113
128
  value: value
114
129
  });
130
+
115
131
  onChange && onChange(value);
116
132
  onBlur && onBlur(value);
117
133
  } else {
118
134
  onBlur && onBlur(_this.props.value);
119
135
  }
120
136
  });
137
+
121
138
  _defineProperty(_assertThisInitialized(_this), "onSelect", function (value) {
122
139
  var _this$props3 = _this.props,
123
- onChange = _this$props3.onChange,
124
- _this$props3$options = _this$props3.options,
125
- options = _this$props3$options === void 0 ? [] : _this$props3$options;
140
+ onChange = _this$props3.onChange,
141
+ _this$props3$options = _this$props3.options,
142
+ options = _this$props3$options === void 0 ? [] : _this$props3$options;
143
+
126
144
  var index = _findIndexInstanceProperty(options).call(options, function (option) {
127
145
  return String(option.value) === value;
128
146
  });
147
+
129
148
  if (index > -1) {
130
149
  _this.setState({
131
150
  value: options[index]
132
151
  });
152
+
133
153
  onChange && onChange(options[index]);
134
154
  }
135
155
  });
156
+
136
157
  _defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
137
158
  var _this$props4 = _this.props,
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;
159
+ _this$props4$options = _this$props4.options,
160
+ options = _this$props4$options === void 0 ? [] : _this$props4$options,
161
+ onSearch = _this$props4.onSearch,
162
+ searchWhenClick = _this$props4.searchWhenClick,
163
+ value = _this$props4.value;
164
+
143
165
  if (onSearch && (!options.length || !value && searchWhenClick)) {
144
166
  onSearch(e.target.value);
145
167
  }
146
168
  });
169
+
147
170
  _defineProperty(_assertThisInitialized(_this), "makeValueValid", function (value) {
148
171
  var _context;
172
+
149
173
  return _includesInstanceProperty(_context = [NaN, undefined, null]).call(_context, value) ? '' : value;
150
174
  });
175
+
151
176
  _defineProperty(_assertThisInitialized(_this), "getValue", function () {
152
177
  var value = _this.state.value;
153
178
  return String(_this.makeValueValid(_typeof(value) === 'object' ? value.value : value));
154
179
  });
180
+
155
181
  _defineProperty(_assertThisInitialized(_this), "isMatch", function (inputValue, option) {
156
182
  var _context2;
183
+
157
184
  return option.props.children && _indexOfInstanceProperty(_context2 = option.props.children).call(_context2, inputValue) !== -1;
158
185
  });
186
+
159
187
  _defineProperty(_assertThisInitialized(_this), "isMatchRemark", function (inputValue, option) {
160
188
  var _option$props = option.props,
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;
189
+ _option$props$text = _option$props.text,
190
+ text = _option$props$text === void 0 ? '' : _option$props$text,
191
+ _option$props$remark = _option$props.remark,
192
+ remark = _option$props$remark === void 0 ? '' : _option$props$remark;
165
193
  return _indexOfInstanceProperty(text).call(text, inputValue) > -1 || _indexOfInstanceProperty(remark).call(remark, inputValue) > -1;
166
194
  });
195
+
167
196
  _defineProperty(_assertThisInitialized(_this), "isValidValue", function (value) {
168
197
  var _context3;
198
+
169
199
  // value必须为对象,且有属性value的值不等''或undefined
170
200
  return value && !_includesInstanceProperty(_context3 = ['', undefined]).call(_context3, value.value);
171
201
  });
202
+
172
203
  _defineProperty(_assertThisInitialized(_this), "getOptions", function () {
173
204
  var value = _this.state.value;
174
205
  var options = _this.props.options;
206
+
175
207
  if (options && options.length) {
176
208
  if (_this.isValidValue(value) && !_findInstanceProperty(options).call(options, function (option) {
177
209
  return option.value === value.value;
@@ -186,8 +218,10 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
186
218
  return [];
187
219
  }
188
220
  });
221
+
189
222
  _defineProperty(_assertThisInitialized(_this), "getDataSource", function () {
190
223
  var _context4;
224
+
191
225
  return _mapInstanceProperty(_context4 = _this.getOptions()).call(_context4, function (option) {
192
226
  return {
193
227
  value: String(option.value),
@@ -195,8 +229,10 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
195
229
  };
196
230
  });
197
231
  });
232
+
198
233
  _defineProperty(_assertThisInitialized(_this), "getDataSourceRemark", function () {
199
234
  var _context5;
235
+
200
236
  return _mapInstanceProperty(_context5 = _this.getOptions()).call(_context5, function (option, index) {
201
237
  return /*#__PURE__*/React.createElement(SelectOption, {
202
238
  key: index,
@@ -210,11 +246,13 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
210
246
  }, option.description || ''));
211
247
  });
212
248
  });
249
+
213
250
  _defineProperty(_assertThisInitialized(_this), "getProps", function () {
214
251
  var _this$props5 = _this.props,
215
- inputRef = _this$props5.inputRef,
216
- _this$props5$filter = _filterInstanceProperty(_this$props5),
217
- filter = _this$props5$filter === void 0 ? true : _this$props5$filter;
252
+ inputRef = _this$props5.inputRef,
253
+ _this$props5$filter = _filterInstanceProperty(_this$props5),
254
+ filter = _this$props5$filter === void 0 ? true : _this$props5$filter;
255
+
218
256
  var props = _Object$assign(getObjectExclude(_this.props, PROPS_KEYS), {
219
257
  value: _this.getValue(),
220
258
  allowClear: true,
@@ -226,6 +264,7 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
226
264
  onSelect: _this.onSelect,
227
265
  onBlur: _this.onBlur
228
266
  });
267
+
229
268
  if (_this.props.remark) {
230
269
  props.dataSource = _this.getDataSourceRemark();
231
270
  props.filterOption = filter ? _this.isMatchRemark : false;
@@ -234,13 +273,16 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
234
273
  props.dataSource = _this.getDataSource();
235
274
  props.filterOption = filter ? _this.isMatch : false;
236
275
  }
276
+
237
277
  return props;
238
278
  });
279
+
239
280
  _this.state = {
240
281
  value: _props.value
241
282
  };
242
283
  return _this;
243
284
  }
285
+
244
286
  _createClass(InputSearch, [{
245
287
  key: "componentWillReceiveProps",
246
288
  value: function componentWillReceiveProps(props) {
@@ -260,7 +302,10 @@ var InputSearch = /*#__PURE__*/function (_React$Component) {
260
302
  })));
261
303
  }
262
304
  }]);
305
+
263
306
  return InputSearch;
264
307
  }(React.Component);
308
+
265
309
  _defineProperty(InputSearch, "propTypes", PROPS);
310
+
266
311
  export default InputSearch;
@@ -15,8 +15,11 @@ 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
+
18
19
  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
+
19
21
  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
+
20
23
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
21
24
  import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
22
25
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
@@ -24,8 +27,11 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
24
27
  import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
25
28
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
26
29
  import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
30
+
27
31
  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
+
28
33
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
34
+
29
35
  import React from 'react';
30
36
  var SelectOption = _Select.Option;
31
37
  var OPTION_STYLE = {
@@ -35,45 +41,58 @@ var OPTION_STYLE = {
35
41
  color: '#aaa',
36
42
  whiteSpace: 'pre-wrap'
37
43
  };
44
+
38
45
  var InputSelect = /*#__PURE__*/function (_React$Component) {
39
46
  _inherits(InputSelect, _React$Component);
47
+
40
48
  var _super = _createSuper(InputSelect);
49
+
41
50
  function InputSelect() {
42
51
  var _context;
52
+
43
53
  var _this;
54
+
44
55
  _classCallCheck(this, InputSelect);
56
+
45
57
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
46
58
  args[_key] = arguments[_key];
47
59
  }
60
+
48
61
  _this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
62
+
49
63
  _defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
50
64
  var _this$props = _this.props,
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)) {
65
+ _this$props$options = _this$props.options,
66
+ options = _this$props$options === void 0 ? [] : _this$props$options,
67
+ onSearch = _this$props.onSearch,
68
+ _this$props$value = _this$props.value,
69
+ value = _this$props$value === void 0 ? [] : _this$props$value,
70
+ _this$props$searchWhe = _this$props.searchWhenClick,
71
+ searchWhenClick = _this$props$searchWhe === void 0 ? false : _this$props$searchWhe; // if (onSearch && (options.length <= value.length)) {
72
+
59
73
  if (onSearch && searchWhenClick) {
60
74
  onSearch(e.target.value);
61
75
  }
62
76
  });
77
+
63
78
  _defineProperty(_assertThisInitialized(_this), "onSearch", function (value) {
64
79
  var onSearch = _this.props.onSearch;
65
80
  onSearch && onSearch(value);
66
81
  });
82
+
67
83
  _defineProperty(_assertThisInitialized(_this), "isMatch", function (inputValue, option) {
68
84
  var _context2;
85
+
69
86
  return _indexOfInstanceProperty(_context2 = option.props.children).call(_context2, inputValue) !== -1;
70
87
  });
88
+
71
89
  _defineProperty(_assertThisInitialized(_this), "isMatchRemark", function (inputValue, option) {
72
90
  var _option$props = option.props,
73
- text = _option$props.text,
74
- remark = _option$props.remark;
91
+ text = _option$props.text,
92
+ remark = _option$props.remark;
75
93
  return _indexOfInstanceProperty(text).call(text, inputValue) > -1 || _indexOfInstanceProperty(remark).call(remark, inputValue) > -1;
76
94
  });
95
+
77
96
  _defineProperty(_assertThisInitialized(_this), "toRemarkOption", function (option, index) {
78
97
  return /*#__PURE__*/React.createElement(SelectOption, {
79
98
  key: index,
@@ -85,6 +104,7 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
85
104
  style: OPTION_STYLE
86
105
  }, option.remark || ''));
87
106
  });
107
+
88
108
  _defineProperty(_assertThisInitialized(_this), "toOption", function (option, index) {
89
109
  return /*#__PURE__*/React.createElement(SelectOption, {
90
110
  key: index,
@@ -92,6 +112,7 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
92
112
  disabled: option.disabled || false
93
113
  }, option.title);
94
114
  });
115
+
95
116
  _defineProperty(_assertThisInitialized(_this), "onChange", function (options, keyValue) {
96
117
  var onChange = _this.props.onChange;
97
118
  var objValue = keyValue.length > 0 ? _mapInstanceProperty(keyValue).call(keyValue, function (item) {
@@ -104,8 +125,10 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
104
125
  }) : [];
105
126
  onChange && onChange(objValue);
106
127
  });
128
+
107
129
  _defineProperty(_assertThisInitialized(_this), "getValue", function () {
108
130
  var value = _this.props.value;
131
+
109
132
  if (_typeof(value) === 'object' && _Array$isArray(value)) {
110
133
  return _mapInstanceProperty(value).call(value, function (item) {
111
134
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -117,26 +140,32 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
117
140
  return [];
118
141
  }
119
142
  });
143
+
120
144
  return _this;
121
145
  }
146
+
122
147
  _createClass(InputSelect, [{
123
148
  key: "render",
124
149
  value: function render() {
125
150
  var _context3, _context4;
151
+
126
152
  var _this$props2 = this.props,
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;
153
+ _this$props2$options = _this$props2.options,
154
+ options = _this$props2$options === void 0 ? [] : _this$props2$options,
155
+ size = _this$props2.size,
156
+ _this$props2$value = _this$props2.value,
157
+ value = _this$props2$value === void 0 ? [] : _this$props2$value,
158
+ _this$props2$allowCle = _this$props2.allowClear,
159
+ allowClear = _this$props2$allowCle === void 0 ? true : _this$props2$allowCle;
160
+
134
161
  var values = _mapInstanceProperty(value).call(value, function (o) {
135
162
  return o.value;
136
163
  });
164
+
137
165
  var allOptions = _concatInstanceProperty(_context3 = _filterInstanceProperty(options).call(options, function (o) {
138
166
  return !_includesInstanceProperty(values).call(values, o.value);
139
167
  })).call(_context3, value);
168
+
140
169
  var props = {
141
170
  value: this.getValue(),
142
171
  style: this.props.style || {},
@@ -155,6 +184,8 @@ var InputSelect = /*#__PURE__*/function (_React$Component) {
155
184
  }, /*#__PURE__*/React.createElement(_Select, props, this.props.remark ? _mapInstanceProperty(allOptions).call(allOptions, this.toRemarkOption) : _mapInstanceProperty(allOptions).call(allOptions, this.toOption)));
156
185
  }
157
186
  }]);
187
+
158
188
  return InputSelect;
159
189
  }(React.Component);
190
+
160
191
  export default InputSelect;