@autobest-ui/components 2.3.0 → 2.5.0

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 (141) hide show
  1. package/esm/accordion/Item.js +6 -23
  2. package/esm/accordion/index.js +8 -36
  3. package/esm/affix/PortalAffix.js +7 -11
  4. package/esm/affix/index.js +30 -70
  5. package/esm/carousel/index.js +45 -141
  6. package/esm/checkbox/index.js +12 -37
  7. package/esm/collapse/index.js +11 -49
  8. package/esm/confirm/index.d.ts +8 -0
  9. package/esm/confirm/index.js +23 -31
  10. package/esm/date-picker/DateEnum.js +0 -3
  11. package/esm/date-picker/calendar/Day.js +62 -78
  12. package/esm/date-picker/calendar/MonthYear.js +20 -53
  13. package/esm/date-picker/calendar/grid/index.js +7 -12
  14. package/esm/date-picker/calendar/index.js +4 -31
  15. package/esm/date-picker/index.js +11 -51
  16. package/esm/date-picker/utils.js +6 -11
  17. package/esm/drawer/Child.js +10 -20
  18. package/esm/drawer/index.js +22 -71
  19. package/esm/ellipsis/index.js +9 -17
  20. package/esm/guide/index.js +25 -63
  21. package/esm/index.d.ts +2 -2
  22. package/esm/index.js +1 -1
  23. package/esm/input-number/ControlArrow.js +0 -2
  24. package/esm/input-number/constants.js +2 -2
  25. package/esm/input-number/index.js +26 -106
  26. package/esm/lazy-image/index.js +10 -55
  27. package/esm/link-list/index.js +11 -35
  28. package/esm/loading/index.js +15 -42
  29. package/esm/loading-container/index.js +3 -6
  30. package/esm/loading-icon/index.js +0 -2
  31. package/esm/mask/index.js +6 -9
  32. package/esm/message/index.d.ts +44 -7
  33. package/esm/message/index.js +96 -111
  34. package/esm/message/renderMessage.d.ts +17 -0
  35. package/esm/message/renderMessage.js +137 -0
  36. package/esm/message/style/index.css +1 -1
  37. package/esm/modal/Title.js +5 -12
  38. package/esm/modal/getPopupLocation.js +5 -7
  39. package/esm/modal/index.js +44 -125
  40. package/esm/move/index.js +32 -132
  41. package/esm/move/range.js +6 -12
  42. package/esm/move/utils.js +3 -10
  43. package/esm/popover/index.js +9 -28
  44. package/esm/portal/index.js +1 -22
  45. package/esm/script/index.js +19 -59
  46. package/esm/select/index.js +28 -106
  47. package/esm/show-more/index.js +40 -103
  48. package/esm/skeleton/Item.js +1 -3
  49. package/esm/skeleton/index.js +5 -11
  50. package/esm/style.css +1 -1
  51. package/esm/table/body/BodyRow.js +11 -28
  52. package/esm/table/body/CheckIcon.js +10 -18
  53. package/esm/table/body/index.js +8 -12
  54. package/esm/table/header/CheckIcon.js +3 -11
  55. package/esm/table/header/HeaderCell.js +12 -33
  56. package/esm/table/header/HeaderRow.js +6 -17
  57. package/esm/table/index.js +30 -100
  58. package/esm/tabs/index.js +35 -118
  59. package/esm/tooltip/index.js +0 -4
  60. package/esm/trigger/align.js +6 -6
  61. package/esm/trigger/bottomAlign.js +33 -45
  62. package/esm/trigger/constants.js +0 -1
  63. package/esm/trigger/getPopupLocation.js +48 -68
  64. package/esm/trigger/index.js +52 -187
  65. package/esm/trigger/leftAlign.js +33 -47
  66. package/esm/trigger/ref.js +2 -7
  67. package/esm/trigger/rightAlign.js +33 -45
  68. package/esm/trigger/topAlign.js +33 -45
  69. package/esm/trigger/utils.js +28 -45
  70. package/lib/accordion/Item.js +6 -27
  71. package/lib/accordion/index.js +8 -41
  72. package/lib/affix/PortalAffix.js +7 -17
  73. package/lib/affix/index.js +30 -75
  74. package/lib/carousel/index.js +45 -146
  75. package/lib/checkbox/index.js +12 -41
  76. package/lib/collapse/index.js +11 -53
  77. package/lib/confirm/index.d.ts +8 -0
  78. package/lib/confirm/index.js +23 -38
  79. package/lib/date-picker/DateEnum.js +0 -3
  80. package/lib/date-picker/calendar/Day.js +62 -87
  81. package/lib/date-picker/calendar/MonthYear.js +20 -62
  82. package/lib/date-picker/calendar/grid/index.js +7 -16
  83. package/lib/date-picker/calendar/index.js +4 -37
  84. package/lib/date-picker/index.js +9 -58
  85. package/lib/date-picker/utils.js +6 -26
  86. package/lib/drawer/Child.js +10 -25
  87. package/lib/drawer/index.js +22 -78
  88. package/lib/ellipsis/index.js +9 -23
  89. package/lib/guide/index.js +25 -71
  90. package/lib/index.d.ts +2 -2
  91. package/lib/index.js +12 -32
  92. package/lib/input-number/ControlArrow.js +0 -4
  93. package/lib/input-number/constants.js +2 -2
  94. package/lib/input-number/index.js +26 -114
  95. package/lib/lazy-image/index.js +10 -58
  96. package/lib/link-list/index.js +11 -40
  97. package/lib/loading/index.js +13 -48
  98. package/lib/loading-bar/index.js +0 -5
  99. package/lib/loading-container/index.js +3 -11
  100. package/lib/loading-icon/index.js +0 -7
  101. package/lib/mask/index.js +6 -17
  102. package/lib/message/index.d.ts +44 -7
  103. package/lib/message/index.js +97 -120
  104. package/lib/message/renderMessage.d.ts +17 -0
  105. package/lib/message/renderMessage.js +144 -0
  106. package/lib/message/style/index.css +1 -1
  107. package/lib/modal/Affix.js +0 -4
  108. package/lib/modal/Title.js +5 -15
  109. package/lib/modal/getPopupLocation.js +5 -9
  110. package/lib/modal/index.js +44 -135
  111. package/lib/move/index.js +32 -144
  112. package/lib/move/range.js +6 -14
  113. package/lib/move/utils.js +3 -12
  114. package/lib/popover/index.js +9 -33
  115. package/lib/portal/index.js +1 -25
  116. package/lib/script/index.js +19 -61
  117. package/lib/select/index.js +28 -113
  118. package/lib/show-more/index.js +40 -110
  119. package/lib/skeleton/Item.js +1 -8
  120. package/lib/skeleton/index.js +5 -16
  121. package/lib/style.css +1 -1
  122. package/lib/table/body/BodyRow.js +11 -33
  123. package/lib/table/body/CheckIcon.js +10 -22
  124. package/lib/table/body/index.js +8 -17
  125. package/lib/table/header/CheckIcon.js +3 -15
  126. package/lib/table/header/HeaderCell.js +12 -37
  127. package/lib/table/header/HeaderRow.js +6 -22
  128. package/lib/table/index.js +30 -107
  129. package/lib/tabs/index.js +35 -122
  130. package/lib/tooltip/index.js +0 -9
  131. package/lib/trigger/align.js +0 -4
  132. package/lib/trigger/bottomAlign.js +33 -48
  133. package/lib/trigger/constants.js +0 -2
  134. package/lib/trigger/getPopupLocation.js +48 -74
  135. package/lib/trigger/index.js +52 -198
  136. package/lib/trigger/leftAlign.js +33 -50
  137. package/lib/trigger/ref.js +2 -12
  138. package/lib/trigger/rightAlign.js +33 -48
  139. package/lib/trigger/topAlign.js +33 -48
  140. package/lib/trigger/utils.js +28 -53
  141. package/package.json +7 -3
@@ -9,56 +9,40 @@ var __extends = this && this.__extends || function () {
9
9
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
10
10
  }
11
11
  };
12
-
13
12
  return _extendStatics(d, b);
14
13
  };
15
-
16
14
  return function (d, b) {
17
15
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18
-
19
16
  _extendStatics(d, b);
20
-
21
17
  function __() {
22
18
  this.constructor = d;
23
19
  }
24
-
25
20
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26
21
  };
27
22
  }();
28
-
29
23
  import React from 'react';
30
24
  import ReactDOM from 'react-dom';
31
-
32
- var Portal =
33
- /** @class */
34
- function (_super) {
25
+ var Portal = /** @class */function (_super) {
35
26
  __extends(Portal, _super);
36
-
37
27
  function Portal() {
38
28
  return _super !== null && _super.apply(this, arguments) || this;
39
29
  }
40
-
41
30
  Portal.prototype.componentDidMount = function () {
42
31
  this.createContainer();
43
32
  };
44
-
45
33
  Portal.prototype.componentDidUpdate = function (prevProps) {
46
34
  var didUpdate = this.props.didUpdate;
47
-
48
35
  if (didUpdate) {
49
36
  didUpdate(prevProps);
50
37
  }
51
38
  };
52
-
53
39
  Portal.prototype.componentWillUnmount = function () {
54
40
  this.removeContainer();
55
41
  };
56
-
57
42
  Portal.prototype.createContainer = function () {
58
43
  this.container = this.props.getContainer ? this.props.getContainer() : Portal.getContainer();
59
44
  this.forceUpdate();
60
45
  };
61
-
62
46
  Portal.prototype.removeContainer = function () {
63
47
  if (this.container && this.container.parentNode) {
64
48
  try {
@@ -66,15 +50,12 @@ function (_super) {
66
50
  } catch (e) {}
67
51
  }
68
52
  };
69
-
70
53
  Portal.prototype.render = function () {
71
54
  if (this.container) {
72
55
  return /*#__PURE__*/ReactDOM.createPortal(this.props.children, this.container);
73
56
  }
74
-
75
57
  return /*#__PURE__*/React.createElement(React.Fragment, null);
76
58
  };
77
-
78
59
  Portal.getContainer = function () {
79
60
  var element = document.createElement('div');
80
61
  element.style.position = 'absolute';
@@ -84,8 +65,6 @@ function (_super) {
84
65
  window.document.body.appendChild(element);
85
66
  return element;
86
67
  };
87
-
88
68
  return Portal;
89
69
  }(React.Component);
90
-
91
70
  export default Portal;
@@ -9,169 +9,130 @@ var __extends = this && this.__extends || function () {
9
9
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
10
10
  }
11
11
  };
12
-
13
12
  return _extendStatics(d, b);
14
13
  };
15
-
16
14
  return function (d, b) {
17
15
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18
-
19
16
  _extendStatics(d, b);
20
-
21
17
  function __() {
22
18
  this.constructor = d;
23
19
  }
24
-
25
20
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26
21
  };
27
22
  }();
28
-
29
23
  import React from 'react';
30
24
  /**
31
25
  * 动态加入js 代码
32
26
  * @param code
33
27
  * @param url
34
28
  */
35
-
36
29
  function loadScriptCode(code, url) {
37
30
  if (!code) {
38
31
  return;
39
32
  }
40
-
41
33
  var script = document.createElement('script');
42
34
  script.type = 'text/javascript';
43
35
  script.setAttribute('data-src', url);
44
-
45
36
  try {
46
37
  script.appendChild(document.createTextNode(code));
47
38
  } catch (ex) {
48
39
  // 兼容IE
49
40
  script.text = code;
50
41
  }
51
-
52
42
  document.body.appendChild(script);
53
43
  }
54
44
  /**
55
45
  * 动态创建和加载js文件,比如jquery
56
46
  */
57
-
58
-
59
- var Script =
60
- /** @class */
61
- function (_super) {
47
+ var Script = /** @class */function (_super) {
62
48
  __extends(Script, _super);
63
-
64
49
  function Script() {
65
50
  var _this = _super !== null && _super.apply(this, arguments) || this;
66
-
67
51
  _this.loadSrc = function (isRefresh, preProps) {
68
52
  var _a = _this.props,
69
- url = _a.url,
70
- beforeCode = _a.beforeCode,
71
- cancelable = _a.cancelable,
72
- onRemove = _a.onRemove; // beforeCode
73
-
53
+ url = _a.url,
54
+ beforeCode = _a.beforeCode,
55
+ cancelable = _a.cancelable,
56
+ onRemove = _a.onRemove;
57
+ // beforeCode
74
58
  if (isRefresh || preProps.beforeCode !== beforeCode) {
75
59
  // 这里只支持在url改变时,删除code, 并不对code进行判断来删除url的script, 原因是没有这种需求
76
60
  if (cancelable && preProps && preProps.beforeCode !== beforeCode) {
77
61
  var preCodeElement = document.querySelector("script[data-src='".concat(preProps.url, "']"));
78
-
79
62
  if (preCodeElement && preCodeElement.remove) {
80
63
  preCodeElement.remove();
81
64
  }
82
-
83
65
  onRemove(true, preProps.url, preProps.attributes);
84
66
  }
85
-
86
67
  loadScriptCode(beforeCode, url);
87
- } // url 不变的情况下,每个组件只执行一次onLoad,onError
88
-
89
-
68
+ }
69
+ // url 不变的情况下,每个组件只执行一次onLoad,onError
90
70
  if (isRefresh || url !== preProps.url) {
91
- var scriptsElement = document.querySelector("script[src='".concat(url, "']")); // 如果已经存在, 警告, 并终止执行
92
-
71
+ var scriptsElement = document.querySelector("script[src='".concat(url, "']"));
72
+ // 如果已经存在, 警告, 并终止执行
93
73
  if (scriptsElement) {
94
74
  // eslint-disable-next-line no-console
95
75
  console.error("Src: ".concat(url, " has been created, the corresponding callback will no longer be executed, Please use it directly"));
96
76
  return;
97
77
  }
98
-
99
78
  if (cancelable && preProps && url !== preProps.url) {
100
79
  var preScriptsElement = document.querySelector("script[src='".concat(preProps.url, "']"));
101
-
102
80
  if (preScriptsElement && preScriptsElement.remove) {
103
81
  preScriptsElement.remove();
104
82
  }
105
-
106
83
  onRemove(false, preProps.url, preProps.attributes);
107
84
  }
108
-
109
85
  _this.createScript();
110
86
  }
111
87
  };
112
-
113
88
  return _this;
114
89
  }
115
-
116
90
  Script.prototype.componentDidMount = function () {
117
91
  this.loadSrc(true);
118
92
  };
119
-
120
93
  Script.prototype.componentDidUpdate = function (prevProps) {
121
94
  this.loadSrc(false, prevProps);
122
95
  };
123
-
124
96
  Script.prototype.componentWillUnmount = function () {
125
97
  var _a = this.props,
126
- cancelable = _a.cancelable,
127
- url = _a.url,
128
- attributes = _a.attributes,
129
- onRemove = _a.onRemove;
130
-
98
+ cancelable = _a.cancelable,
99
+ url = _a.url,
100
+ attributes = _a.attributes,
101
+ onRemove = _a.onRemove;
131
102
  if (cancelable && url) {
132
103
  var scriptsElement = document.querySelector("script[src='".concat(url, "']"));
133
-
134
104
  if (scriptsElement && scriptsElement.remove) {
135
105
  scriptsElement.remove();
136
106
  }
137
-
138
107
  onRemove(false, url, attributes);
139
108
  }
140
109
  };
141
-
142
110
  Script.prototype.createScript = function () {
143
111
  var _a = this.props,
144
- url = _a.url,
145
- attributes = _a.attributes,
146
- onCreate = _a.onCreate,
147
- onLoad = _a.onLoad,
148
- onError = _a.onError;
112
+ url = _a.url,
113
+ attributes = _a.attributes,
114
+ onCreate = _a.onCreate,
115
+ onLoad = _a.onLoad,
116
+ onError = _a.onError;
149
117
  onCreate(url, attributes);
150
118
  var script = document.createElement('script');
151
-
152
119
  if (attributes) {
153
120
  Object.keys(attributes).forEach(function (prop) {
154
121
  script.setAttribute(prop, prop === 'async' || prop === 'crossOrigin' ? '' : attributes[prop]);
155
122
  });
156
123
  }
157
-
158
124
  script.src = url;
159
-
160
125
  script.onload = function () {
161
126
  onLoad(url, attributes);
162
127
  };
163
-
164
128
  script.onerror = function () {
165
129
  onError(url, attributes);
166
130
  };
167
-
168
131
  document.body.appendChild(script);
169
132
  };
170
-
171
133
  Script.prototype.render = function () {
172
134
  return null;
173
135
  };
174
-
175
136
  Script.defaultProps = {
176
137
  beforeCode: '',
177
138
  cancelable: true,
@@ -185,5 +146,4 @@ function (_super) {
185
146
  };
186
147
  return Script;
187
148
  }(React.Component);
188
-
189
149
  export default Script;
@@ -9,52 +9,39 @@ var __extends = this && this.__extends || function () {
9
9
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
10
10
  }
11
11
  };
12
-
13
12
  return _extendStatics(d, b);
14
13
  };
15
-
16
14
  return function (d, b) {
17
15
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18
-
19
16
  _extendStatics(d, b);
20
-
21
17
  function __() {
22
18
  this.constructor = d;
23
19
  }
24
-
25
20
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26
21
  };
27
22
  }();
28
-
29
23
  var __assign = this && this.__assign || function () {
30
24
  __assign = Object.assign || function (t) {
31
25
  for (var s, i = 1, n = arguments.length; i < n; i++) {
32
26
  s = arguments[i];
33
-
34
27
  for (var p in s) {
35
28
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
36
29
  }
37
30
  }
38
-
39
31
  return t;
40
32
  };
41
-
42
33
  return __assign.apply(this, arguments);
43
34
  };
44
-
45
35
  var __rest = this && this.__rest || function (s, e) {
46
36
  var t = {};
47
-
48
37
  for (var p in s) {
49
38
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
50
39
  }
51
-
52
40
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
41
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
54
42
  }
55
43
  return t;
56
44
  };
57
-
58
45
  var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
59
46
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
60
47
  if (ar || !(i in from)) {
@@ -64,71 +51,53 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
64
51
  }
65
52
  return to.concat(ar || Array.prototype.slice.call(from));
66
53
  };
67
-
68
54
  import React from 'react';
69
55
  import classNames from 'classnames';
70
56
  import { isBlank, addEventListener } from '@autobest-ui/utils';
71
57
  import Trigger from '../trigger';
72
-
73
- var Select =
74
- /** @class */
75
- function (_super) {
58
+ var Select = /** @class */function (_super) {
76
59
  __extends(Select, _super);
77
-
78
60
  function Select(props) {
79
61
  var _this = _super.call(this, props) || this;
80
-
81
62
  _this.prefixCls = 'ab-select';
82
63
  _this.keydownHandler = null;
83
64
  _this.popupContentRef = /*#__PURE__*/React.createRef();
84
65
  /**
85
66
  * 当支持过滤时,绑定过滤事件
86
67
  */
87
-
88
68
  _this.addKeydownListener = function () {
89
69
  _this.keydownHandler = addEventListener(document, 'keydown', _this.keydownCallback);
90
70
  };
91
-
92
71
  _this.removeKeydownListener = function () {
93
72
  if (_this.keydownHandler) {
94
73
  _this.keydownHandler.remove();
95
-
96
74
  _this.keydownHandler = null;
97
75
  }
98
76
  };
99
-
100
77
  _this.keydownCallback = function (event) {
101
78
  var code = event.keyCode || event.which;
102
-
103
79
  if (code >= 65 && code <= 90 || code >= 48 && code <= 57 || code >= 96 && code <= 105) {
104
80
  var findItem_1 = _this.findMatchItem(event.key.toLowerCase());
105
-
106
81
  if (!findItem_1) {
107
82
  return;
108
83
  }
109
-
110
84
  var _a = _this.props,
111
- onFilterChange_1 = _a.onFilterChange,
112
- name_1 = _a.name;
85
+ onFilterChange_1 = _a.onFilterChange,
86
+ name_1 = _a.name;
113
87
  var filterItem = _this.state.filterItem;
114
-
115
88
  if (!filterItem || findItem_1.value !== filterItem.value) {
116
89
  _this.setState({
117
90
  filterItem: findItem_1
118
91
  }, function () {
119
92
  if (onFilterChange_1) {
120
93
  onFilterChange_1(findItem_1, name_1);
121
- } // 通过搜索选择的,将滚动到该元素位置
122
-
123
-
94
+ }
95
+ // 通过搜索选择的,将滚动到该元素位置
124
96
  var element = _this.popupContentRef.current;
125
-
126
97
  if (element && element.parentNode) {
127
98
  var elementParentNode = element.parentNode;
128
-
129
99
  if (elementParentNode) {
130
100
  var activeElement = elementParentNode.querySelector(".".concat(_this.prefixCls, "-active"));
131
-
132
101
  if (activeElement) {
133
102
  // scrollIntoView有问题,设置block为start会带动全局的滚动条
134
103
  elementParentNode.scrollTop = activeElement.offsetTop;
@@ -140,14 +109,12 @@ function (_super) {
140
109
  }
141
110
  }
142
111
  };
143
-
144
112
  _this.findMatchItem = function (inputVal) {
145
113
  var list = _this.state.list;
146
-
147
114
  for (var i = 0; i < list.length; i++) {
148
115
  for (var j = 0; j < list[i].length; j++) {
149
- var item = list[i][j]; // 只对string/number类型进行筛选,
150
-
116
+ var item = list[i][j];
117
+ // 只对string/number类型进行筛选,
151
118
  if (!item.unselect && (typeof item.name === 'string' || typeof item.name === 'number')) {
152
119
  if (item.name.toString().toLowerCase().indexOf(inputVal) === 0) {
153
120
  return item;
@@ -155,105 +122,83 @@ function (_super) {
155
122
  }
156
123
  }
157
124
  }
158
-
159
125
  return null;
160
126
  };
161
127
  /**
162
128
  * 设置显示与隐藏
163
129
  */
164
-
165
-
166
130
  _this.triggerSelect = function (status) {
167
131
  if (status === void 0) {
168
132
  status = false;
169
133
  }
170
-
171
134
  if (_this.state.visible === status) {
172
135
  return;
173
136
  }
174
-
175
137
  _this.removeKeydownListener();
176
-
177
138
  if (_this.props.isFilterOption && status) {
178
139
  _this.addKeydownListener();
179
- } // 关闭下拉框,并且已经过滤到数据
180
-
181
-
140
+ }
141
+ // 关闭下拉框,并且已经过滤到数据
182
142
  var filterItem = _this.state.filterItem;
183
-
184
143
  if (filterItem && !status) {
185
144
  // 清空filter数据,并触发onChange
186
145
  _this.setState({
187
146
  filterItem: null
188
147
  });
189
-
190
148
  if (filterItem.value !== _this.props.value) {
191
149
  _this.props.onChange(filterItem, _this.props.name);
192
150
  }
193
151
  }
194
-
195
152
  _this.setState({
196
153
  visible: status
197
154
  });
198
155
  };
199
-
200
156
  _this.onTriggerSelect = function () {
201
157
  if (_this.props.disabled) {
202
158
  return;
203
159
  }
204
-
205
160
  _this.triggerSelect(!_this.state.visible);
206
161
  };
207
-
208
162
  _this.state = {
209
163
  visible: false,
210
164
  list: [[]]
211
165
  };
212
166
  return _this;
213
167
  }
214
-
215
168
  Select.getDerivedStateFromProps = function (nextProps) {
216
169
  var columnCount = nextProps.columnCount,
217
- options = nextProps.options;
218
-
170
+ options = nextProps.options;
219
171
  if (columnCount <= 1) {
220
172
  return {
221
173
  list: [__spreadArray([], options, true)]
222
174
  };
223
- } // 对columnCount值,进行分列,返回一个新的多维数组
224
-
225
-
175
+ }
176
+ // 对columnCount值,进行分列,返回一个新的多维数组
226
177
  var list = [];
227
- var maxRow = Math.ceil(options.length / columnCount); // 分列
228
-
178
+ var maxRow = Math.ceil(options.length / columnCount);
179
+ // 分列
229
180
  for (var i = 1; i <= columnCount; i++) {
230
181
  var startIndex = maxRow * (i - 1);
231
182
  var endIndex = maxRow * i;
232
183
  var columnList = options.slice(startIndex, endIndex);
233
184
  list.push(__spreadArray([], columnList, true));
234
185
  }
235
-
236
186
  return {
237
187
  list: list
238
188
  };
239
189
  };
240
-
241
190
  Select.prototype.componentWillUnmount = function () {
242
191
  this.removeKeydownListener();
243
192
  };
244
-
245
193
  Select.prototype.onSelecting = function (ev, item) {
246
194
  var _this = this;
247
-
248
195
  if (ev) {
249
196
  ev.stopPropagation();
250
197
  }
251
-
252
198
  var _a = this.props,
253
- onChange = _a.onChange,
254
- value = _a.value,
255
- name = _a.name;
256
-
199
+ onChange = _a.onChange,
200
+ value = _a.value,
201
+ name = _a.name;
257
202
  if (item.value !== value) {
258
203
  onChange(item, name);
259
204
  this.setState({
@@ -264,30 +209,23 @@ function (_super) {
264
209
  });
265
210
  return;
266
211
  }
267
-
268
212
  this.triggerSelect(false);
269
213
  };
270
-
271
214
  Select.prototype.renderTitle = function () {
272
215
  var title = this.props.title;
273
-
274
216
  if (!title) {
275
217
  return null;
276
218
  }
277
-
278
219
  var child = React.Children.only(title);
279
220
  return /*#__PURE__*/React.cloneElement(child, {
280
221
  className: classNames("".concat(this.prefixCls, "-title"), child.props.className)
281
222
  });
282
223
  };
283
-
284
224
  Select.prototype.renderBottom = function () {
285
225
  var bottom = this.props.bottom;
286
-
287
226
  if (!bottom) {
288
227
  return null;
289
228
  }
290
-
291
229
  var child = React.Children.only(bottom);
292
230
  return /*#__PURE__*/React.cloneElement(child, {
293
231
  className: classNames("".concat(this.prefixCls, "-bottom"), child.props.className)
@@ -296,11 +234,8 @@ function (_super) {
296
234
  /**
297
235
  * 下拉框内容
298
236
  */
299
-
300
-
301
237
  Select.prototype.getSelectPopup = function () {
302
238
  var _this = this;
303
-
304
239
  var cls = this.prefixCls;
305
240
  var filterItem = this.state.filterItem;
306
241
  return /*#__PURE__*/React.createElement(React.Fragment, null, this.renderTitle(), /*#__PURE__*/React.createElement("div", {
@@ -312,14 +247,12 @@ function (_super) {
312
247
  key: index
313
248
  }, col.map(function (item) {
314
249
  var _a;
315
-
316
250
  if (item.unselect) {
317
251
  return /*#__PURE__*/React.createElement("li", {
318
252
  key: "".concat(item.value, "1"),
319
253
  className: classNames(item.className, "".concat(cls, "-unselect"))
320
254
  }, item.name);
321
255
  }
322
-
323
256
  return /*#__PURE__*/React.createElement("li", {
324
257
  key: item.value,
325
258
  className: classNames(item.className, (_a = {}, _a["".concat(cls, "-active")] = filterItem ? filterItem.value === item.value : item.value === _this.props.value, _a)),
@@ -334,41 +267,32 @@ function (_super) {
334
267
  * 根据value获取当前的name,并显示出来
335
268
  * @returns {*}
336
269
  */
337
-
338
-
339
270
  Select.prototype.getCurrentName = function () {
340
271
  var _a = this.props,
341
- options = _a.options,
342
- value = _a.value;
272
+ options = _a.options,
273
+ value = _a.value;
343
274
  var filterItem = this.state.filterItem;
344
-
345
275
  if (!isBlank(value) || filterItem) {
346
276
  var currentItem = options.find(function (item) {
347
277
  return filterItem ? filterItem.value === item.value : item.value === value;
348
278
  });
349
-
350
279
  if (currentItem) {
351
280
  return currentItem.actualName || currentItem.name;
352
281
  }
353
282
  }
354
-
355
283
  return null;
356
284
  };
357
-
358
285
  Select.prototype.render = function () {
359
286
  var _a, _b;
360
-
361
287
  var visible = this.state.visible;
362
-
363
288
  var _c = this.props,
364
- className = _c.className,
365
- placeholder = _c.placeholder,
366
- disabled = _c.disabled,
367
- hiddenIcon = _c.hiddenIcon,
368
- icon = _c.icon,
369
- dropClassName = _c.dropClassName,
370
- extraProps = __rest(_c, ["className", "placeholder", "disabled", "hiddenIcon", "icon", "dropClassName"]);
371
-
289
+ className = _c.className,
290
+ placeholder = _c.placeholder,
291
+ disabled = _c.disabled,
292
+ hiddenIcon = _c.hiddenIcon,
293
+ icon = _c.icon,
294
+ dropClassName = _c.dropClassName,
295
+ extraProps = __rest(_c, ["className", "placeholder", "disabled", "hiddenIcon", "icon", "dropClassName"]);
372
296
  var cls = this.prefixCls;
373
297
  var currentName = this.getCurrentName();
374
298
  return /*#__PURE__*/React.createElement(Trigger, __assign({}, extraProps, {
@@ -389,9 +313,8 @@ function (_super) {
389
313
  }, currentName || placeholder), hiddenIcon ? null : /*#__PURE__*/React.createElement("span", {
390
314
  className: "".concat(cls, "-icon")
391
315
  }, typeof icon === 'function' ? icon() : icon)));
392
- }; // 默认值
393
-
394
-
316
+ };
317
+ // 默认值
395
318
  Select.defaultProps = {
396
319
  title: null,
397
320
  icon: /*#__PURE__*/React.createElement("svg", {
@@ -417,5 +340,4 @@ function (_super) {
417
340
  };
418
341
  return Select;
419
342
  }(React.Component);
420
-
421
343
  export default Select;