@arco-design/mobile-react 2.20.0 → 2.21.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 (295) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/avatar/index.d.ts +1 -1
  5. package/cjs/avatar/index.js +1 -1
  6. package/cjs/badge/index.d.ts +1 -1
  7. package/cjs/badge/index.js +1 -1
  8. package/cjs/carousel/index.d.ts +1 -1
  9. package/cjs/carousel/index.js +1 -1
  10. package/cjs/cell/index.d.ts +1 -1
  11. package/cjs/cell/index.js +1 -1
  12. package/cjs/checkbox/index.d.ts +1 -1
  13. package/cjs/checkbox/index.js +1 -1
  14. package/cjs/collapse/index.d.ts +1 -1
  15. package/cjs/collapse/index.js +1 -1
  16. package/cjs/count-down/index.d.ts +1 -1
  17. package/cjs/count-down/index.js +1 -1
  18. package/cjs/date-picker/index.d.ts +1 -1
  19. package/cjs/date-picker/index.js +1 -1
  20. package/cjs/dropdown/dropdown.js +36 -20
  21. package/cjs/dropdown/style/css/index.css +3 -0
  22. package/cjs/dropdown/style/index.less +2 -0
  23. package/cjs/ellipsis/index.d.ts +1 -1
  24. package/cjs/ellipsis/index.js +1 -1
  25. package/cjs/image/index.d.ts +1 -1
  26. package/cjs/image/index.js +1 -1
  27. package/cjs/image-picker/index.d.ts +4 -175
  28. package/cjs/image-picker/index.js +41 -18
  29. package/cjs/image-picker/type.d.ts +174 -0
  30. package/cjs/image-picker/type.js +3 -0
  31. package/cjs/image-preview/index.d.ts +1 -1
  32. package/cjs/image-preview/index.js +1 -1
  33. package/cjs/index.d.ts +2 -0
  34. package/cjs/index.js +9 -1
  35. package/cjs/input/hooks.js +49 -8
  36. package/cjs/input/index.d.ts +1 -1
  37. package/cjs/input/index.js +1 -1
  38. package/cjs/input/props.d.ts +8 -2
  39. package/cjs/notice-bar/index.d.ts +1 -1
  40. package/cjs/notice-bar/index.js +1 -1
  41. package/cjs/picker/index.d.ts +1 -1
  42. package/cjs/picker/index.js +1 -1
  43. package/cjs/picker-view/index.d.ts +1 -1
  44. package/cjs/picker-view/index.js +1 -1
  45. package/cjs/popover/index.d.ts +1 -1
  46. package/cjs/popover/index.js +1 -1
  47. package/cjs/popup-swiper/index.js +3 -2
  48. package/cjs/radio/index.d.ts +1 -1
  49. package/cjs/radio/index.js +1 -1
  50. package/cjs/rate/index.d.ts +1 -1
  51. package/cjs/rate/index.js +1 -1
  52. package/cjs/search-bar/association.d.ts +3 -0
  53. package/cjs/search-bar/association.js +92 -0
  54. package/cjs/search-bar/cancel-button.d.ts +10 -0
  55. package/cjs/search-bar/cancel-button.js +41 -0
  56. package/cjs/search-bar/demo/style/css/mobile.css +5 -0
  57. package/cjs/search-bar/demo/style/mobile.less +9 -0
  58. package/cjs/search-bar/highlight.d.ts +12 -0
  59. package/cjs/search-bar/highlight.js +77 -0
  60. package/cjs/search-bar/index.d.ts +13 -0
  61. package/cjs/search-bar/index.js +239 -0
  62. package/cjs/search-bar/style/css/index.css +148 -0
  63. package/cjs/search-bar/style/css/index.d.ts +2 -0
  64. package/cjs/search-bar/style/css/index.js +5 -0
  65. package/cjs/search-bar/style/index.d.ts +2 -0
  66. package/cjs/search-bar/style/index.js +5 -0
  67. package/cjs/search-bar/style/index.less +111 -0
  68. package/cjs/search-bar/type.d.ts +163 -0
  69. package/cjs/search-bar/type.js +3 -0
  70. package/cjs/slider/index.d.ts +1 -1
  71. package/cjs/slider/index.js +1 -1
  72. package/cjs/steps/index.d.ts +1 -1
  73. package/cjs/steps/index.js +1 -1
  74. package/cjs/sticky/index.d.ts +1 -1
  75. package/cjs/style.d.ts +2 -0
  76. package/cjs/style.js +4 -0
  77. package/cjs/swipe-action/demo/style/css/mobile.css +5 -0
  78. package/cjs/swipe-action/demo/style/mobile.less +9 -0
  79. package/cjs/swipe-action/index.d.ts +12 -0
  80. package/cjs/swipe-action/index.js +339 -0
  81. package/cjs/swipe-action/item.d.ts +11 -0
  82. package/cjs/swipe-action/item.js +52 -0
  83. package/cjs/swipe-action/style/css/index.css +88 -0
  84. package/cjs/swipe-action/style/css/index.d.ts +2 -0
  85. package/cjs/swipe-action/style/css/index.js +5 -0
  86. package/cjs/swipe-action/style/index.d.ts +2 -0
  87. package/cjs/swipe-action/style/index.js +5 -0
  88. package/cjs/swipe-action/style/index.less +89 -0
  89. package/cjs/swipe-action/type.d.ts +123 -0
  90. package/cjs/swipe-action/type.js +3 -0
  91. package/cjs/switch/index.d.ts +1 -1
  92. package/cjs/switch/index.js +1 -1
  93. package/cjs/tabs/tab-pane.js +5 -1
  94. package/cjs/tag/index.d.ts +1 -1
  95. package/cjs/tag/index.js +1 -1
  96. package/cjs/textarea/index.d.ts +1 -1
  97. package/cjs/textarea/index.js +1 -1
  98. package/dist/index.js +7450 -6611
  99. package/dist/index.min.js +6 -6
  100. package/dist/style.css +203 -0
  101. package/dist/style.min.css +1 -1
  102. package/esm/avatar/index.d.ts +1 -1
  103. package/esm/avatar/index.js +1 -1
  104. package/esm/badge/index.d.ts +1 -1
  105. package/esm/badge/index.js +1 -1
  106. package/esm/carousel/index.d.ts +1 -1
  107. package/esm/carousel/index.js +1 -1
  108. package/esm/cell/index.d.ts +1 -1
  109. package/esm/cell/index.js +1 -1
  110. package/esm/checkbox/index.d.ts +1 -1
  111. package/esm/checkbox/index.js +1 -1
  112. package/esm/collapse/index.d.ts +1 -1
  113. package/esm/collapse/index.js +1 -1
  114. package/esm/count-down/index.d.ts +1 -1
  115. package/esm/count-down/index.js +1 -1
  116. package/esm/date-picker/index.d.ts +1 -1
  117. package/esm/date-picker/index.js +1 -1
  118. package/esm/dropdown/dropdown.js +36 -20
  119. package/esm/dropdown/style/css/index.css +3 -0
  120. package/esm/dropdown/style/index.less +2 -0
  121. package/esm/ellipsis/index.d.ts +1 -1
  122. package/esm/ellipsis/index.js +1 -1
  123. package/esm/image/index.d.ts +1 -1
  124. package/esm/image/index.js +1 -1
  125. package/esm/image-picker/index.d.ts +4 -175
  126. package/esm/image-picker/index.js +30 -17
  127. package/esm/image-picker/type.d.ts +174 -0
  128. package/esm/image-picker/type.js +1 -0
  129. package/esm/image-preview/index.d.ts +1 -1
  130. package/esm/image-preview/index.js +1 -1
  131. package/esm/index.d.ts +2 -0
  132. package/esm/index.js +2 -0
  133. package/esm/input/hooks.js +49 -8
  134. package/esm/input/index.d.ts +1 -1
  135. package/esm/input/index.js +1 -1
  136. package/esm/input/props.d.ts +8 -2
  137. package/esm/notice-bar/index.d.ts +1 -1
  138. package/esm/notice-bar/index.js +1 -1
  139. package/esm/picker/index.d.ts +1 -1
  140. package/esm/picker/index.js +1 -1
  141. package/esm/picker-view/index.d.ts +1 -1
  142. package/esm/picker-view/index.js +1 -1
  143. package/esm/popover/index.d.ts +1 -1
  144. package/esm/popover/index.js +1 -1
  145. package/esm/popup-swiper/index.js +3 -2
  146. package/esm/radio/index.d.ts +1 -1
  147. package/esm/radio/index.js +1 -1
  148. package/esm/rate/index.d.ts +1 -1
  149. package/esm/rate/index.js +1 -1
  150. package/esm/search-bar/association.d.ts +3 -0
  151. package/esm/search-bar/association.js +82 -0
  152. package/esm/search-bar/cancel-button.d.ts +10 -0
  153. package/esm/search-bar/cancel-button.js +30 -0
  154. package/esm/search-bar/demo/style/css/mobile.css +5 -0
  155. package/esm/search-bar/demo/style/mobile.less +9 -0
  156. package/esm/search-bar/highlight.d.ts +12 -0
  157. package/esm/search-bar/highlight.js +66 -0
  158. package/esm/search-bar/index.d.ts +13 -0
  159. package/esm/search-bar/index.js +213 -0
  160. package/esm/search-bar/style/css/index.css +148 -0
  161. package/esm/search-bar/style/css/index.d.ts +2 -0
  162. package/esm/search-bar/style/css/index.js +2 -0
  163. package/esm/search-bar/style/index.d.ts +2 -0
  164. package/esm/search-bar/style/index.js +2 -0
  165. package/esm/search-bar/style/index.less +111 -0
  166. package/esm/search-bar/type.d.ts +163 -0
  167. package/esm/search-bar/type.js +1 -0
  168. package/esm/slider/index.d.ts +1 -1
  169. package/esm/slider/index.js +1 -1
  170. package/esm/steps/index.d.ts +1 -1
  171. package/esm/steps/index.js +1 -1
  172. package/esm/sticky/index.d.ts +1 -1
  173. package/esm/style.d.ts +2 -0
  174. package/esm/style.js +2 -0
  175. package/esm/swipe-action/demo/style/css/mobile.css +5 -0
  176. package/esm/swipe-action/demo/style/mobile.less +9 -0
  177. package/esm/swipe-action/index.d.ts +12 -0
  178. package/esm/swipe-action/index.js +321 -0
  179. package/esm/swipe-action/item.d.ts +11 -0
  180. package/esm/swipe-action/item.js +42 -0
  181. package/esm/swipe-action/style/css/index.css +88 -0
  182. package/esm/swipe-action/style/css/index.d.ts +2 -0
  183. package/esm/swipe-action/style/css/index.js +2 -0
  184. package/esm/swipe-action/style/index.d.ts +2 -0
  185. package/esm/swipe-action/style/index.js +2 -0
  186. package/esm/swipe-action/style/index.less +89 -0
  187. package/esm/swipe-action/type.d.ts +123 -0
  188. package/esm/swipe-action/type.js +1 -0
  189. package/esm/switch/index.d.ts +1 -1
  190. package/esm/switch/index.js +1 -1
  191. package/esm/tabs/tab-pane.js +5 -1
  192. package/esm/tag/index.d.ts +1 -1
  193. package/esm/tag/index.js +1 -1
  194. package/esm/textarea/index.d.ts +1 -1
  195. package/esm/textarea/index.js +1 -1
  196. package/package.json +3 -3
  197. package/tokens/app/arcodesign/default/css-variables.less +34 -0
  198. package/tokens/app/arcodesign/default/index.d.ts +34 -0
  199. package/tokens/app/arcodesign/default/index.js +34 -0
  200. package/tokens/app/arcodesign/default/index.json +398 -0
  201. package/tokens/app/arcodesign/default/index.less +34 -0
  202. package/umd/avatar/index.d.ts +1 -1
  203. package/umd/avatar/index.js +1 -1
  204. package/umd/badge/index.d.ts +1 -1
  205. package/umd/badge/index.js +1 -1
  206. package/umd/carousel/index.d.ts +1 -1
  207. package/umd/carousel/index.js +1 -1
  208. package/umd/cell/index.d.ts +1 -1
  209. package/umd/cell/index.js +1 -1
  210. package/umd/checkbox/index.d.ts +1 -1
  211. package/umd/checkbox/index.js +1 -1
  212. package/umd/collapse/index.d.ts +1 -1
  213. package/umd/collapse/index.js +1 -1
  214. package/umd/count-down/index.d.ts +1 -1
  215. package/umd/count-down/index.js +1 -1
  216. package/umd/date-picker/index.d.ts +1 -1
  217. package/umd/date-picker/index.js +1 -1
  218. package/umd/dropdown/dropdown.js +36 -20
  219. package/umd/dropdown/style/css/index.css +3 -0
  220. package/umd/dropdown/style/index.less +2 -0
  221. package/umd/ellipsis/index.d.ts +1 -1
  222. package/umd/ellipsis/index.js +1 -1
  223. package/umd/image/index.d.ts +1 -1
  224. package/umd/image/index.js +1 -1
  225. package/umd/image-picker/index.d.ts +4 -175
  226. package/umd/image-picker/index.js +40 -22
  227. package/umd/image-picker/type.d.ts +174 -0
  228. package/umd/image-picker/type.js +17 -0
  229. package/umd/image-preview/index.d.ts +1 -1
  230. package/umd/image-preview/index.js +1 -1
  231. package/umd/index.d.ts +2 -0
  232. package/umd/index.js +9 -5
  233. package/umd/input/hooks.js +48 -7
  234. package/umd/input/index.d.ts +1 -1
  235. package/umd/input/index.js +1 -1
  236. package/umd/input/props.d.ts +8 -2
  237. package/umd/notice-bar/index.d.ts +1 -1
  238. package/umd/notice-bar/index.js +1 -1
  239. package/umd/picker/index.d.ts +1 -1
  240. package/umd/picker/index.js +1 -1
  241. package/umd/picker-view/index.d.ts +1 -1
  242. package/umd/picker-view/index.js +1 -1
  243. package/umd/popover/index.d.ts +1 -1
  244. package/umd/popover/index.js +1 -1
  245. package/umd/popup-swiper/index.js +3 -2
  246. package/umd/radio/index.d.ts +1 -1
  247. package/umd/radio/index.js +1 -1
  248. package/umd/rate/index.d.ts +1 -1
  249. package/umd/rate/index.js +1 -1
  250. package/umd/search-bar/association.d.ts +3 -0
  251. package/umd/search-bar/association.js +101 -0
  252. package/umd/search-bar/cancel-button.d.ts +10 -0
  253. package/umd/search-bar/cancel-button.js +52 -0
  254. package/umd/search-bar/demo/style/css/mobile.css +5 -0
  255. package/umd/search-bar/demo/style/mobile.less +9 -0
  256. package/umd/search-bar/highlight.d.ts +12 -0
  257. package/umd/search-bar/highlight.js +87 -0
  258. package/umd/search-bar/index.d.ts +13 -0
  259. package/umd/search-bar/index.js +235 -0
  260. package/umd/search-bar/style/css/index.css +148 -0
  261. package/umd/search-bar/style/css/index.d.ts +2 -0
  262. package/umd/search-bar/style/css/index.js +15 -0
  263. package/umd/search-bar/style/index.d.ts +2 -0
  264. package/umd/search-bar/style/index.js +15 -0
  265. package/umd/search-bar/style/index.less +111 -0
  266. package/umd/search-bar/type.d.ts +163 -0
  267. package/umd/search-bar/type.js +17 -0
  268. package/umd/slider/index.d.ts +1 -1
  269. package/umd/slider/index.js +1 -1
  270. package/umd/steps/index.d.ts +1 -1
  271. package/umd/steps/index.js +1 -1
  272. package/umd/sticky/index.d.ts +1 -1
  273. package/umd/style.d.ts +2 -0
  274. package/umd/style.js +4 -4
  275. package/umd/swipe-action/demo/style/css/mobile.css +5 -0
  276. package/umd/swipe-action/demo/style/mobile.less +9 -0
  277. package/umd/swipe-action/index.d.ts +12 -0
  278. package/umd/swipe-action/index.js +342 -0
  279. package/umd/swipe-action/item.d.ts +11 -0
  280. package/umd/swipe-action/item.js +62 -0
  281. package/umd/swipe-action/style/css/index.css +88 -0
  282. package/umd/swipe-action/style/css/index.d.ts +2 -0
  283. package/umd/swipe-action/style/css/index.js +15 -0
  284. package/umd/swipe-action/style/index.d.ts +2 -0
  285. package/umd/swipe-action/style/index.js +15 -0
  286. package/umd/swipe-action/style/index.less +89 -0
  287. package/umd/swipe-action/type.d.ts +123 -0
  288. package/umd/swipe-action/type.js +17 -0
  289. package/umd/switch/index.d.ts +1 -1
  290. package/umd/switch/index.js +1 -1
  291. package/umd/tabs/tab-pane.js +5 -1
  292. package/umd/tag/index.d.ts +1 -1
  293. package/umd/tag/index.js +1 -1
  294. package/umd/textarea/index.d.ts +1 -1
  295. package/umd/textarea/index.js +1 -1
@@ -0,0 +1,87 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "@babel/runtime/helpers/extends", "@babel/runtime/helpers/objectWithoutPropertiesLoose", "react"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("@babel/runtime/helpers/extends"), require("@babel/runtime/helpers/objectWithoutPropertiesLoose"), require("react"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global._extends, global.objectWithoutPropertiesLoose, global.react);
11
+ global.highlight = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _objectWithoutPropertiesLoose2, _react) {
14
+ "use strict";
15
+
16
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
+
18
+ _exports.__esModule = true;
19
+ _exports.highlightWithContainMode = highlightWithContainMode;
20
+ _exports.highlightWithPrefixMode = highlightWithPrefixMode;
21
+ _extends2 = _interopRequireDefault(_extends2);
22
+ _objectWithoutPropertiesLoose2 = _interopRequireDefault(_objectWithoutPropertiesLoose2);
23
+ _react = _interopRequireDefault(_react);
24
+ var _excluded = ["content", "keyword"];
25
+
26
+ function createHighlightNode(config, index) {
27
+ var keyword = config.keyword,
28
+ highlightClassName = config.highlightClassName,
29
+ highlightStyle = config.highlightStyle;
30
+ return /*#__PURE__*/_react.default.createElement("span", {
31
+ className: highlightClassName,
32
+ style: highlightStyle,
33
+ key: index
34
+ }, keyword);
35
+ }
36
+ /**
37
+ * 高亮搜索候选项中,包含的关键字
38
+ *
39
+ */
40
+
41
+
42
+ function highlightWithContainMode(config) {
43
+ var _config$content = config.content,
44
+ content = _config$content === void 0 ? '' : _config$content,
45
+ _config$keyword = config.keyword,
46
+ keyword = _config$keyword === void 0 ? '' : _config$keyword; // 具体实现思路就是将keyword作为split的分隔符,切割content得到数组
47
+
48
+ var splitContent = content.split(keyword); // 再将高亮后的keyword节点,插空填入数组
49
+
50
+ var highlightResult = splitContent.reduce(function (prev, word, index) {
51
+ prev.push(word);
52
+
53
+ if (index !== splitContent.length - 1) {
54
+ prev.push(createHighlightNode(config, index));
55
+ }
56
+
57
+ return prev;
58
+ }, []);
59
+ return highlightResult;
60
+ }
61
+ /**
62
+ * 高亮搜索候选项和关键字的最长前缀公共字符串
63
+ *
64
+ */
65
+
66
+
67
+ function highlightWithPrefixMode(config) {
68
+ var _config$content2 = config.content,
69
+ content = _config$content2 === void 0 ? '' : _config$content2,
70
+ _config$keyword2 = config.keyword,
71
+ keyword = _config$keyword2 === void 0 ? '' : _config$keyword2,
72
+ otherConfig = (0, _objectWithoutPropertiesLoose2.default)(config, _excluded);
73
+ var splitIndex = -1;
74
+
75
+ for (var i = 0; i < keyword.length; i++) {
76
+ if (i >= content.length || content[i] !== keyword[i]) {
77
+ break;
78
+ }
79
+
80
+ splitIndex = i;
81
+ }
82
+
83
+ return splitIndex > -1 ? [createHighlightNode((0, _extends2.default)({}, otherConfig, {
84
+ keyword: content.substring(0, splitIndex + 1)
85
+ }), 0), content.substring(splitIndex + 1)] : content;
86
+ }
87
+ });
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { SearchAssociationBaseItem, SearchBarProps, SearchBarRef } from './type';
3
+ export { SearchBarProps, SearchBarRef, SearchAssociationHighlightMode, SearchAssociationItem, SearchAssociationShowType, SearchBarShape, } from './type';
4
+ /**
5
+ * 搜索栏组件
6
+ * @en SearchBar component
7
+ * @type 数据录入
8
+ * @type_en Data Entry
9
+ * @name 搜索栏
10
+ * @name_en SearchBar
11
+ */
12
+ declare const SearchBar: React.ForwardRefExoticComponent<SearchBarProps<SearchAssociationBaseItem> & React.RefAttributes<SearchBarRef>>;
13
+ export default SearchBar;
@@ -0,0 +1,235 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "@babel/runtime/helpers/extends", "@babel/runtime/helpers/objectWithoutPropertiesLoose", "@arco-design/mobile-utils", "react", "../context-provider", "../icon", "../input/hooks", "./association", "./cancel-button", "./type"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("@babel/runtime/helpers/extends"), require("@babel/runtime/helpers/objectWithoutPropertiesLoose"), require("@arco-design/mobile-utils"), require("react"), require("../context-provider"), require("../icon"), require("../input/hooks"), require("./association"), require("./cancel-button"), require("./type"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global._extends, global.objectWithoutPropertiesLoose, global.mobileUtils, global.react, global.contextProvider, global.icon, global.hooks, global.association, global.cancelButton, global.type);
11
+ global.index = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _objectWithoutPropertiesLoose2, _mobileUtils, _react, _contextProvider, _icon, _hooks, _association, _cancelButton, _type) {
14
+ "use strict";
15
+
16
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
+
18
+ _exports.__esModule = true;
19
+ _exports.default = _exports.SearchBarShape = _exports.SearchBarRef = _exports.SearchBarProps = _exports.SearchAssociationShowType = _exports.SearchAssociationItem = _exports.SearchAssociationHighlightMode = void 0;
20
+ _extends2 = _interopRequireDefault(_extends2);
21
+ _objectWithoutPropertiesLoose2 = _interopRequireDefault(_objectWithoutPropertiesLoose2);
22
+ _react = _interopRequireWildcard(_react);
23
+ _exports.SearchBarProps = _type.SearchBarProps;
24
+ _exports.SearchBarRef = _type.SearchBarRef;
25
+ _exports.SearchAssociationHighlightMode = _type.SearchAssociationHighlightMode;
26
+ _exports.SearchAssociationItem = _type.SearchAssociationItem;
27
+ _exports.SearchAssociationShowType = _type.SearchAssociationShowType;
28
+ _exports.SearchBarShape = _type.SearchBarShape;
29
+ var _excluded = ["inputClass", "inputStyle", "type", "nativeProps", "id", "name", "maxLength", "placeholder", "readOnly", "onKeyUp", "onKeyPress", "disabled", "pattern", "prefix", "append", "textAlign", "actionButton", "clearable", "clearShowType", "shape", "className", "enableAssociation", "associationVisible", "associationShowType", "associationItems", "highlightClassName", "highlightMode", "highlightStyle", "onCancel", "onAssociationClick", "onAssociationItemClick", "renderAssociation", "renderAssociationItem"];
30
+
31
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
+
33
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
34
+
35
+ /**
36
+ * 搜索栏组件
37
+ * @en SearchBar component
38
+ * @type 数据录入
39
+ * @type_en Data Entry
40
+ * @name 搜索栏
41
+ * @name_en SearchBar
42
+ */
43
+ var SearchBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
44
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
45
+ prefixCls = _useContext.prefixCls,
46
+ locale = _useContext.locale;
47
+
48
+ var searchBarPrefixCls = prefixCls + "-search-bar";
49
+ var inputClass = props.inputClass,
50
+ inputStyle = props.inputStyle,
51
+ _props$type = props.type,
52
+ type = _props$type === void 0 ? 'search' : _props$type,
53
+ nativeProps = props.nativeProps,
54
+ id = props.id,
55
+ name = props.name,
56
+ maxLength = props.maxLength,
57
+ _props$placeholder = props.placeholder,
58
+ placeholder = _props$placeholder === void 0 ? locale == null ? void 0 : locale.SearchBar.placeholder : _props$placeholder,
59
+ readOnly = props.readOnly,
60
+ onKeyUp = props.onKeyUp,
61
+ onKeyPress = props.onKeyPress,
62
+ disabled = props.disabled,
63
+ pattern = props.pattern,
64
+ _props$prefix = props.prefix,
65
+ prefix = _props$prefix === void 0 ? /*#__PURE__*/_react.default.createElement(_icon.IconSearch, {
66
+ className: searchBarPrefixCls + "-search-icon"
67
+ }) : _props$prefix,
68
+ append = props.append,
69
+ _props$textAlign = props.textAlign,
70
+ textAlign = _props$textAlign === void 0 ? 'left' : _props$textAlign,
71
+ actionButton = props.actionButton,
72
+ _props$clearable = props.clearable,
73
+ clearable = _props$clearable === void 0 ? true : _props$clearable,
74
+ _props$clearShowType = props.clearShowType,
75
+ clearShowType = _props$clearShowType === void 0 ? 'value' : _props$clearShowType,
76
+ _props$shape = props.shape,
77
+ shape = _props$shape === void 0 ? 'square' : _props$shape,
78
+ className = props.className,
79
+ _props$enableAssociat = props.enableAssociation,
80
+ enableAssociation = _props$enableAssociat === void 0 ? false : _props$enableAssociat,
81
+ associationVisible = props.associationVisible,
82
+ _props$associationSho = props.associationShowType,
83
+ associationShowType = _props$associationSho === void 0 ? 'default' : _props$associationSho,
84
+ associationItems = props.associationItems,
85
+ highlightClassName = props.highlightClassName,
86
+ highlightMode = props.highlightMode,
87
+ highlightStyle = props.highlightStyle,
88
+ onCancel = props.onCancel,
89
+ onAssociationClick = props.onAssociationClick,
90
+ onAssociationItemClick = props.onAssociationItemClick,
91
+ renderAssociation = props.renderAssociation,
92
+ renderAssociationItem = props.renderAssociationItem,
93
+ inputProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
94
+ var inputRef = (0, _react.useRef)(null);
95
+ /**
96
+ * 格式化搜索输入框尾部要插入的内容
97
+ * @en Format the content to be inserted at the end of the search input box
98
+ */
99
+
100
+ var formatAppendProp = function formatAppendProp(focusing, currentInputValue) {
101
+ var appendNode = null;
102
+
103
+ if (typeof append === 'function') {
104
+ appendNode = append(focusing, currentInputValue);
105
+ } else {
106
+ appendNode = append;
107
+ } // 默认情况下,在激活时或有内容时插入一个cancelBtn
108
+ // @en By default inserts a cancelBtn on activation or when there is content
109
+
110
+
111
+ var formatActionButton = typeof actionButton === 'undefined' ? /*#__PURE__*/_react.default.createElement(_cancelButton.CancelButton, {
112
+ focusing: focusing,
113
+ currentInputValue: currentInputValue,
114
+ className: searchBarPrefixCls + "-cancel-btn",
115
+ onCancel: onCancel,
116
+ text: locale == null ? void 0 : locale.SearchBar.cancelBtn
117
+ }) : actionButton;
118
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, appendNode, formatActionButton, enableAssociation ? /*#__PURE__*/_react.default.createElement(_association.SearchBarAssociation, {
119
+ prefixCls: searchBarPrefixCls,
120
+ keyword: currentInputValue // eslint-disable-next-line @typescript-eslint/no-use-before-define
121
+ ,
122
+ visible: actualVisible,
123
+ associationItems: associationItems,
124
+ highlightClassName: highlightClassName,
125
+ highlightMode: highlightMode,
126
+ highlightStyle: highlightStyle,
127
+ onAssociationClick: onAssociationClick,
128
+ onAssociationItemClick: onAssociationItemClick,
129
+ renderAssociation: renderAssociation,
130
+ renderAssociationItem: renderAssociationItem
131
+ }) : null);
132
+ };
133
+
134
+ var _useInputLogic = (0, _hooks.useInputLogic)((0, _extends2.default)({
135
+ className: (0, _mobileUtils.cls)(className, searchBarPrefixCls + "-" + shape),
136
+ prefix: prefix,
137
+ clearable: clearable,
138
+ append: formatAppendProp,
139
+ clearShowType: clearShowType
140
+ }, inputProps), inputRef),
141
+ inputValue = _useInputLogic.inputValue,
142
+ handleChange = _useInputLogic.handleChange,
143
+ handleInput = _useInputLogic.handleInput,
144
+ handleKeyDown = _useInputLogic.handleKeyDown,
145
+ handleFocus = _useInputLogic.handleFocus,
146
+ handleBlur = _useInputLogic.handleBlur,
147
+ handleClick = _useInputLogic.handleClick,
148
+ renderWrapper = _useInputLogic.renderWrapper,
149
+ wrapRef = _useInputLogic.wrapRef;
150
+
151
+ var _useState = (0, _react.useState)(associationShowType === 'always' || (associationShowType === 'value' || associationShowType === 'default') && Boolean(inputValue)),
152
+ visible = _useState[0],
153
+ setVisible = _useState[1]; // 真实的控制搜索联想框显隐,受控模式优先生效
154
+ // @en Control the display and hide of the search association box, and the controlled mode takes effect first
155
+
156
+
157
+ var actualVisible = associationVisible != null ? associationVisible : visible;
158
+ (0, _react.useImperativeHandle)(ref, function () {
159
+ return {
160
+ dom: wrapRef.current,
161
+ input: inputRef.current,
162
+ toggleAssociation: function toggleAssociation(newVisible) {
163
+ setVisible(newVisible != null ? newVisible : !visible);
164
+ }
165
+ };
166
+ });
167
+ /**
168
+ * 处理非受控逻辑下,搜索联想框的显隐状态
169
+ * @en Handle the display state of the search association box under uncontrolled logic
170
+ *
171
+ * @param {boolean} newVisible 新的visible
172
+ * @param {string} newValue 新的输入框值
173
+ */
174
+
175
+ var formatSetAssociationVisible = function formatSetAssociationVisible(newVisible, newValue) {
176
+ if (associationShowType === 'always') {
177
+ setVisible(true); // 聚焦模式下,直接把visible和newVisible对齐即可
178
+ // @en In focus mode, just align visible and newVisible directly
179
+ } else if (associationShowType === 'focus') {
180
+ setVisible(newVisible); // 聚焦 + 有值模式下,需要newVisible为true和newValue.length > 0同时满足
181
+ // @en In focus + valued mode, newVisible is required to be true and newValue.length > 0 to be satisfied at the same time
182
+ } else if (associationShowType === 'default') {
183
+ setVisible(newVisible && Boolean(newValue)); // 仅有值模式下,visible需要newValue.length > 0
184
+ // @en In value-only mode, visible requires newValue.length > 0
185
+ } else if (associationShowType === 'value') {
186
+ setVisible(Boolean(newValue));
187
+ }
188
+ };
189
+
190
+ var handleInputFocus = function handleInputFocus(e) {
191
+ formatSetAssociationVisible(true, e.target.value);
192
+ handleFocus(e);
193
+ };
194
+
195
+ var handleInputBlur = function handleInputBlur(e) {
196
+ formatSetAssociationVisible(false, e.target.value);
197
+ handleBlur(e);
198
+ };
199
+
200
+ var handleInputChange = function handleInputChange(e) {
201
+ var newValue = e.target.value;
202
+ formatSetAssociationVisible(Boolean(newValue), newValue);
203
+ handleChange(e);
204
+ };
205
+
206
+ var renderSearchBar = function renderSearchBar() {
207
+ return renderWrapper(searchBarPrefixCls, type, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, nativeProps, {
208
+ id: id,
209
+ name: name,
210
+ maxLength: maxLength,
211
+ placeholder: placeholder,
212
+ readOnly: readOnly,
213
+ onFocus: handleInputFocus,
214
+ onBlur: handleInputBlur,
215
+ onKeyUp: onKeyUp,
216
+ onKeyPress: onKeyPress,
217
+ ref: inputRef,
218
+ className: (0, _mobileUtils.cls)(searchBarPrefixCls + "-input", inputClass, searchBarPrefixCls + "-input-" + textAlign),
219
+ style: inputStyle,
220
+ value: inputValue,
221
+ type: type,
222
+ disabled: disabled,
223
+ pattern: pattern,
224
+ onChange: handleInputChange,
225
+ onInput: handleInput,
226
+ onKeyDown: handleKeyDown,
227
+ onClick: handleClick
228
+ })));
229
+ };
230
+
231
+ return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, renderSearchBar);
232
+ });
233
+ var _default = SearchBar;
234
+ _exports.default = _default;
235
+ });
@@ -0,0 +1,148 @@
1
+ .arco-search-bar-container {
2
+ display: -webkit-box;
3
+ display: -webkit-flex;
4
+ display: flex;
5
+ -webkit-box-align: center;
6
+ -webkit-align-items: center;
7
+ align-items: center;
8
+ position: relative;
9
+ padding: 0.32rem ;
10
+ background-color: #FFFFFF ;
11
+ }
12
+ .arco-search-bar-square .arco-search-bar-wrap {
13
+ border-radius: 0.04rem ;
14
+ }
15
+ .arco-search-bar-round .arco-search-bar-wrap {
16
+ border-radius: 199.98rem ;
17
+ }
18
+ .arco-search-bar-wrap {
19
+ display: -webkit-box;
20
+ display: -webkit-flex;
21
+ display: flex;
22
+ -webkit-box-align: center;
23
+ -webkit-align-items: center;
24
+ align-items: center;
25
+ -webkit-box-flex: 1;
26
+ -webkit-flex: 1;
27
+ flex: 1;
28
+ height: 0.72rem ;
29
+ font-size: 0.28rem ;
30
+ padding: 0.16rem 0.28rem ;
31
+ background-color: #F2F3F5 ;
32
+ }
33
+ .arco-search-bar-input {
34
+ -webkit-box-flex: 1;
35
+ -webkit-flex: 1;
36
+ flex: 1;
37
+ background-color: transparent;
38
+ height: 0.4rem ;
39
+ caret-color: #165dff ;
40
+ }
41
+ .arco-search-bar-input-left {
42
+ text-align: left;
43
+ }
44
+ .arco-search-bar-input-right {
45
+ text-align: right;
46
+ }
47
+ .arco-search-bar-input-center {
48
+ text-align: center;
49
+ }
50
+ .arco-search-bar-input::-webkit-input-placeholder {
51
+ color: #c9cdd4 ;
52
+ }
53
+ .arco-search-bar-input::placeholder {
54
+ color: #c9cdd4 ;
55
+ }
56
+ .arco-search-bar-input::-webkit-search-cancel-button {
57
+ display: none;
58
+ }
59
+ .arco-search-bar-prefix,
60
+ .arco-search-bar-suffix,
61
+ .arco-search-bar-clear {
62
+ -webkit-box-align: center;
63
+ -webkit-align-items: center;
64
+ align-items: center;
65
+ -webkit-box-pack: center;
66
+ -webkit-justify-content: center;
67
+ justify-content: center;
68
+ display: -webkit-box;
69
+ display: -webkit-flex;
70
+ display: flex;
71
+ }
72
+ .arco-search-bar-prefix {
73
+ margin-right: 0.18rem ;
74
+ }
75
+ .arco-search-bar-clear {
76
+ color: #C9CDD4 ;
77
+ }
78
+ .arco-search-bar-search-icon {
79
+ color: #86909C ;
80
+ font-size: 0.32rem ;
81
+ }
82
+ .arco-search-bar-cancel-btn {
83
+ margin-left: 0.32rem ;
84
+ color: #165dff ;
85
+ font-size: 0.3rem ;
86
+ }
87
+ .arco-search-bar-association {
88
+ position: absolute;
89
+ left: 0;
90
+ right: 0;
91
+ background-color: #FFFFFF ;
92
+ top: 100%;
93
+ display: none;
94
+ }
95
+ .arco-search-bar-association-visible {
96
+ display: block;
97
+ }
98
+ .arco-search-bar-association-item {
99
+ height: 1.04rem ;
100
+ display: -webkit-box;
101
+ display: -webkit-flex;
102
+ display: flex;
103
+ -webkit-box-align: center;
104
+ -webkit-align-items: center;
105
+ align-items: center;
106
+ position: relative;
107
+ color: #1d2129 ;
108
+ padding: 0.32rem ;
109
+ font-size: 0.3rem ;
110
+ }
111
+ .arco-search-bar-association-item:not(:last-child) {
112
+ position: relative;
113
+ border-width: 0;
114
+ }
115
+ .arco-search-bar-association-item:not(:last-child)::after {
116
+ content: '';
117
+ width: 100%;
118
+ height: 1PX;
119
+ position: absolute;
120
+ left: 0;
121
+ bottom: 0;
122
+ z-index: 1;
123
+ border-bottom-style: solid;
124
+ border-bottom-width: 1PX;
125
+ border-bottom-color: #e5e6eb;
126
+ box-sizing: border-box;
127
+ transform-origin: left bottom;
128
+ -webkit-transform-origin: left bottom;
129
+ pointer-events: none;
130
+ border-radius: 0;
131
+ }
132
+ @media (-webkit-min-device-pixel-ratio: 2), (min-device-pixel-ratio: 2) {
133
+ .arco-search-bar-association-item:not(:last-child)::after {
134
+ transform: scaleY(0.5);
135
+ -webkit-transform: scaleY(0.5);
136
+ border-radius: 0;
137
+ }
138
+ }
139
+ @media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
140
+ .arco-search-bar-association-item:not(:last-child)::after {
141
+ transform: scaleY(0.33333333);
142
+ -webkit-transform: scaleY(0.33333333);
143
+ border-radius: 0;
144
+ }
145
+ }
146
+ .arco-search-bar-association-item-highlight {
147
+ color: #165dff ;
148
+ }
@@ -0,0 +1,2 @@
1
+ import '../../../../style/css/public.css';
2
+ import './index.css';
@@ -0,0 +1,15 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["../../../../style/css/public.css", "./index.css"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(require("../../../../style/css/public.css"), require("./index.css"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(global._public, global.index);
11
+ global.index = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_public, _index) {
14
+ "use strict";
15
+ });
@@ -0,0 +1,2 @@
1
+ import '../../../style/public.less';
2
+ import './index.less';
@@ -0,0 +1,15 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["../../../style/public.less", "./index.less"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(require("../../../style/public.less"), require("./index.less"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(global._public, global.index);
11
+ global.index = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_public, _index) {
14
+ "use strict";
15
+ });
@@ -0,0 +1,111 @@
1
+ @import '../../../style/mixin.less';
2
+
3
+ .@{prefix}-search-bar {
4
+ &-container {
5
+ display: flex;
6
+ align-items: center;
7
+ position: relative;
8
+ .use-var(padding, search-bar-padding);
9
+ .use-var(background-color, search-bar-background-color);
10
+ }
11
+ &-square {
12
+ .@{prefix}-search-bar-wrap {
13
+ .use-var(border-radius, search-bar-square-shape-border-radius);
14
+ }
15
+ }
16
+ &-round {
17
+ .@{prefix}-search-bar-wrap {
18
+ .use-var(border-radius, search-bar-round-shape-border-radius);
19
+ }
20
+ }
21
+ &-wrap {
22
+ display: flex;
23
+ align-items: center;
24
+ flex: 1;
25
+ .use-var(height, search-bar-input-wrapper-height);
26
+ .use-var(font-size, search-bar-input-wrapper-font-size);
27
+ .use-var(padding, search-bar-input-wrapper-padding);
28
+ .use-var(background-color, search-bar-input-wrapper-background-color);
29
+ }
30
+ &-input {
31
+ flex: 1;
32
+ background-color: transparent;
33
+ .use-var(height, search-bar-input-height);
34
+ .use-var(caret-color, search-bar-input-caret-color);
35
+ &-left {
36
+ text-align: left;
37
+ }
38
+ &-right {
39
+ text-align: right;
40
+ }
41
+ &-center {
42
+ text-align: center;
43
+ }
44
+
45
+ &::placeholder {
46
+ .use-var(color, search-bar-input-placeholder-color);
47
+ }
48
+
49
+ &::-webkit-search-cancel-button {
50
+ display: none;
51
+ }
52
+ }
53
+
54
+ &-prefix,
55
+ &-suffix,
56
+ &-clear {
57
+ align-items: center;
58
+ justify-content: center;
59
+ display: flex;
60
+ }
61
+
62
+ &-prefix {
63
+ .use-var(margin-right, search-bar-prefix-margin-right);
64
+ }
65
+
66
+ &-clear {
67
+ .use-var(color, search-bar-clear-icon-color);
68
+ }
69
+
70
+ &-search-icon {
71
+ .use-var(color, search-bar-search-icon-color);
72
+ .use-var(font-size, search-bar-search-icon-font-size);
73
+ }
74
+
75
+ &-cancel-btn {
76
+ .use-var(margin-left, search-bar-cancel-btn-margin-left);
77
+ .use-var(color, search-bar-cancel-btn-color);
78
+ .use-var(font-size, search-bar-cancel-btn-font-size);
79
+ }
80
+
81
+ &-association {
82
+ position: absolute;
83
+ left: 0;
84
+ right: 0;
85
+ .use-var(background-color, search-bar-association-background-color);
86
+ top: 100%;
87
+ display: none;
88
+
89
+ &-visible {
90
+ display: block;
91
+ }
92
+
93
+ &-item {
94
+ .use-var(height, search-bar-association-item-height);
95
+ display: flex;
96
+ align-items: center;
97
+ position: relative;
98
+ .use-var(color, search-bar-association-item-color);
99
+ .use-var(padding, search-bar-association-item-padding);
100
+ .use-var(font-size, search-bar-association-item-font-size);
101
+
102
+ &:not(:last-child) {
103
+ .onepx-border-var(bottom, line-color);
104
+ }
105
+
106
+ &-highlight {
107
+ .use-var(color, search-bar-association-item-highlight-color)
108
+ }
109
+ }
110
+ }
111
+ }