assui 2.0.2 → 2.0.6

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 (245) hide show
  1. package/es/button-drawer/index.d.ts +10 -0
  2. package/es/button-drawer/index.js +116 -0
  3. package/es/button-drawer/style/index.d.ts +1 -0
  4. package/es/button-drawer/style/index.js +1 -0
  5. package/es/button-modal/index.d.ts +14 -0
  6. package/es/button-modal/index.js +131 -0
  7. package/es/button-modal/style/index.d.ts +1 -0
  8. package/es/button-modal/style/index.js +1 -0
  9. package/es/condition-input/index.d.ts +15 -0
  10. package/es/condition-input/index.js +108 -0
  11. package/es/condition-input/parse2RegexOption.d.ts +13 -0
  12. package/es/condition-input/parse2RegexOption.js +57 -0
  13. package/es/condition-input/style/index.d.ts +1 -0
  14. package/es/condition-input/style/index.js +1 -0
  15. package/es/copy-to-clipboard/index.d.ts +22 -0
  16. package/es/copy-to-clipboard/index.js +95 -0
  17. package/es/copy-to-clipboard/style/index.css +249 -0
  18. package/es/copy-to-clipboard/style/index.d.ts +1 -0
  19. package/es/copy-to-clipboard/style/index.js +1 -0
  20. package/es/copy-to-clipboard/style/index.less +1 -0
  21. package/es/highlight-textarea/HighlighedContents.d.ts +7 -0
  22. package/es/highlight-textarea/HighlighedContents.js +15 -0
  23. package/es/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
  24. package/es/highlight-textarea/extractSpansOfClasses.js +159 -0
  25. package/es/highlight-textarea/getRanges.d.ts +2 -0
  26. package/es/highlight-textarea/getRanges.js +142 -0
  27. package/es/highlight-textarea/getType.d.ts +2 -0
  28. package/es/highlight-textarea/getType.js +29 -0
  29. package/es/highlight-textarea/index.d.ts +12 -0
  30. package/es/highlight-textarea/index.js +132 -0
  31. package/es/highlight-textarea/style/index.css +38 -0
  32. package/es/highlight-textarea/style/index.d.ts +2 -0
  33. package/es/highlight-textarea/style/index.js +2 -0
  34. package/es/highlight-textarea/style/index.less +42 -0
  35. package/es/highlight-textarea/types.d.ts +16 -0
  36. package/es/highlight-textarea/types.js +0 -0
  37. package/es/highlight-words/index.d.ts +3 -0
  38. package/es/highlight-words/index.js +2 -0
  39. package/es/highlight-words/style/index.d.ts +1 -0
  40. package/es/highlight-words/style/index.js +0 -0
  41. package/es/icon/demo/svg/check-circle-filled.svg +6 -0
  42. package/es/icon/demo/svg/coin-circle.svg +9 -0
  43. package/es/icon/index.d.ts +27 -0
  44. package/es/icon/index.js +95 -0
  45. package/es/icon/style/index.d.ts +1 -0
  46. package/es/icon/style/index.js +0 -0
  47. package/es/icon/utils.d.ts +6 -0
  48. package/es/icon/utils.js +22 -0
  49. package/es/img-crop/EasyCrop.d.ts +6 -0
  50. package/es/img-crop/EasyCrop.js +113 -0
  51. package/es/img-crop/getCroppedImg.d.ts +6 -0
  52. package/es/img-crop/getCroppedImg.js +199 -0
  53. package/es/img-crop/index.d.ts +53 -0
  54. package/es/img-crop/index.js +531 -0
  55. package/es/img-crop/style/index.css +52 -0
  56. package/es/img-crop/style/index.d.ts +3 -0
  57. package/es/img-crop/style/index.js +3 -0
  58. package/es/img-crop/style/index.less +54 -0
  59. package/es/index.d.ts +34 -2
  60. package/es/index.js +18 -2
  61. package/es/keep-tab/demo/index.modules.less +66 -0
  62. package/es/keep-tab/index.d.ts +29 -0
  63. package/es/keep-tab/index.js +129 -0
  64. package/es/keep-tab/style/index.css +1129 -0
  65. package/es/keep-tab/style/index.d.ts +2 -0
  66. package/es/keep-tab/style/index.js +2 -0
  67. package/es/keep-tab/style/index.less +2 -0
  68. package/es/number-input/index.d.ts +22 -7
  69. package/es/number-input/index.js +22 -11
  70. package/es/number-input/style/index.d.ts +1 -1
  71. package/es/number-input/style/index.js +1 -1
  72. package/es/number-input/utils.d.ts +10 -11
  73. package/es/number-input/utils.js +7 -7
  74. package/es/rc-echart/core.d.ts +32 -0
  75. package/es/rc-echart/core.js +136 -0
  76. package/es/rc-echart/index.d.ts +21 -0
  77. package/es/rc-echart/index.js +27 -0
  78. package/es/rc-echart/style/index.d.ts +1 -0
  79. package/es/rc-echart/style/index.js +0 -0
  80. package/es/rc-motion/demo/CSSMotion.less +91 -0
  81. package/es/rc-motion/index.d.ts +2 -0
  82. package/es/rc-motion/index.js +2 -0
  83. package/es/rc-motion/style/index.d.ts +1 -0
  84. package/es/rc-motion/style/index.js +0 -0
  85. package/es/rc-qrcode/index.d.ts +20 -0
  86. package/es/rc-qrcode/index.js +57 -0
  87. package/es/rc-qrcode/style/index.d.ts +1 -0
  88. package/es/rc-qrcode/style/index.js +0 -0
  89. package/es/rc-qrcode/useQrcode.d.ts +4 -0
  90. package/es/rc-qrcode/useQrcode.js +50 -0
  91. package/es/rc-transition-group/index.d.ts +2 -0
  92. package/es/rc-transition-group/index.js +2 -0
  93. package/es/rc-transition-group/style/index.d.ts +1 -0
  94. package/es/rc-transition-group/style/index.js +0 -0
  95. package/es/single-img-upload/index.d.ts +19 -0
  96. package/es/single-img-upload/index.js +199 -0
  97. package/es/single-img-upload/style/index.css +74 -0
  98. package/es/single-img-upload/style/index.d.ts +3 -0
  99. package/es/single-img-upload/style/index.js +3 -0
  100. package/es/single-img-upload/style/index.less +85 -0
  101. package/es/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
  102. package/es/sortable-hoc/demo/index.modules.less +248 -0
  103. package/es/sortable-hoc/index.d.ts +2 -0
  104. package/es/sortable-hoc/index.js +2 -0
  105. package/es/sortable-hoc/style/index.d.ts +1 -0
  106. package/es/sortable-hoc/style/index.js +0 -0
  107. package/es/split-pane/index.d.ts +59 -0
  108. package/es/split-pane/index.js +21 -0
  109. package/es/split-pane/style/index.css +41 -0
  110. package/es/split-pane/style/index.d.ts +1 -0
  111. package/es/split-pane/style/index.js +1 -0
  112. package/es/split-pane/style/index.less +49 -0
  113. package/es/text-area/index.d.ts +12 -0
  114. package/es/text-area/index.js +96 -0
  115. package/es/text-area/style/index.d.ts +1 -0
  116. package/es/text-area/style/index.js +1 -0
  117. package/es/text-input/index.d.ts +5 -0
  118. package/es/text-input/index.js +85 -0
  119. package/es/{number-input → text-input}/style/index.css +0 -3
  120. package/es/text-input/style/index.d.ts +1 -0
  121. package/es/text-input/style/index.js +1 -0
  122. package/es/{number-input → text-input}/style/index.less +0 -4
  123. package/lib/button-drawer/index.d.ts +10 -0
  124. package/lib/button-drawer/index.js +164 -0
  125. package/lib/button-drawer/style/index.d.ts +1 -0
  126. package/lib/button-drawer/style/index.js +7 -0
  127. package/lib/button-modal/index.d.ts +14 -0
  128. package/lib/button-modal/index.js +178 -0
  129. package/lib/button-modal/style/index.d.ts +1 -0
  130. package/lib/button-modal/style/index.js +7 -0
  131. package/lib/condition-input/index.d.ts +15 -0
  132. package/lib/condition-input/index.js +158 -0
  133. package/lib/condition-input/parse2RegexOption.d.ts +13 -0
  134. package/lib/condition-input/parse2RegexOption.js +72 -0
  135. package/lib/condition-input/style/index.d.ts +1 -0
  136. package/lib/condition-input/style/index.js +7 -0
  137. package/lib/copy-to-clipboard/index.d.ts +22 -0
  138. package/lib/copy-to-clipboard/index.js +143 -0
  139. package/lib/copy-to-clipboard/style/index.css +249 -0
  140. package/lib/copy-to-clipboard/style/index.d.ts +1 -0
  141. package/lib/copy-to-clipboard/style/index.js +7 -0
  142. package/lib/copy-to-clipboard/style/index.less +1 -0
  143. package/lib/highlight-textarea/HighlighedContents.d.ts +7 -0
  144. package/lib/highlight-textarea/HighlighedContents.js +29 -0
  145. package/lib/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
  146. package/lib/highlight-textarea/extractSpansOfClasses.js +173 -0
  147. package/lib/highlight-textarea/getRanges.d.ts +2 -0
  148. package/lib/highlight-textarea/getRanges.js +156 -0
  149. package/lib/highlight-textarea/getType.d.ts +2 -0
  150. package/lib/highlight-textarea/getType.js +37 -0
  151. package/lib/highlight-textarea/index.d.ts +12 -0
  152. package/lib/highlight-textarea/index.js +183 -0
  153. package/lib/highlight-textarea/style/index.css +38 -0
  154. package/lib/highlight-textarea/style/index.d.ts +2 -0
  155. package/lib/highlight-textarea/style/index.js +9 -0
  156. package/lib/highlight-textarea/style/index.less +42 -0
  157. package/lib/highlight-textarea/types.d.ts +16 -0
  158. package/lib/highlight-textarea/types.js +5 -0
  159. package/lib/highlight-words/index.d.ts +3 -0
  160. package/lib/highlight-words/index.js +15 -0
  161. package/lib/highlight-words/style/index.d.ts +1 -0
  162. package/lib/highlight-words/style/index.js +0 -0
  163. package/lib/icon/demo/svg/check-circle-filled.svg +6 -0
  164. package/lib/icon/demo/svg/coin-circle.svg +9 -0
  165. package/lib/icon/index.d.ts +27 -0
  166. package/lib/icon/index.js +143 -0
  167. package/lib/icon/style/index.d.ts +1 -0
  168. package/lib/icon/style/index.js +0 -0
  169. package/lib/icon/utils.d.ts +6 -0
  170. package/lib/icon/utils.js +32 -0
  171. package/lib/img-crop/EasyCrop.d.ts +6 -0
  172. package/lib/img-crop/EasyCrop.js +160 -0
  173. package/lib/img-crop/getCroppedImg.d.ts +6 -0
  174. package/lib/img-crop/getCroppedImg.js +205 -0
  175. package/lib/img-crop/index.d.ts +53 -0
  176. package/lib/img-crop/index.js +582 -0
  177. package/lib/img-crop/style/index.css +52 -0
  178. package/lib/img-crop/style/index.d.ts +3 -0
  179. package/lib/img-crop/style/index.js +11 -0
  180. package/lib/img-crop/style/index.less +54 -0
  181. package/lib/index.d.ts +34 -2
  182. package/lib/index.js +160 -9
  183. package/lib/keep-tab/demo/index.modules.less +66 -0
  184. package/lib/keep-tab/index.d.ts +29 -0
  185. package/lib/keep-tab/index.js +181 -0
  186. package/lib/keep-tab/style/index.css +1129 -0
  187. package/lib/keep-tab/style/index.d.ts +2 -0
  188. package/lib/keep-tab/style/index.js +9 -0
  189. package/lib/keep-tab/style/index.less +2 -0
  190. package/lib/number-input/index.d.ts +22 -7
  191. package/lib/number-input/index.js +22 -11
  192. package/lib/number-input/style/index.d.ts +1 -1
  193. package/lib/number-input/style/index.js +1 -1
  194. package/lib/number-input/utils.d.ts +10 -11
  195. package/lib/number-input/utils.js +8 -8
  196. package/lib/rc-echart/core.d.ts +32 -0
  197. package/lib/rc-echart/core.js +185 -0
  198. package/lib/rc-echart/index.d.ts +21 -0
  199. package/lib/rc-echart/index.js +75 -0
  200. package/lib/rc-echart/style/index.d.ts +1 -0
  201. package/lib/rc-echart/style/index.js +0 -0
  202. package/lib/rc-motion/demo/CSSMotion.less +91 -0
  203. package/lib/rc-motion/index.d.ts +2 -0
  204. package/lib/rc-motion/index.js +43 -0
  205. package/lib/rc-motion/style/index.d.ts +1 -0
  206. package/lib/rc-motion/style/index.js +0 -0
  207. package/lib/rc-qrcode/index.d.ts +20 -0
  208. package/lib/rc-qrcode/index.js +108 -0
  209. package/lib/rc-qrcode/style/index.d.ts +1 -0
  210. package/lib/rc-qrcode/style/index.js +0 -0
  211. package/lib/rc-qrcode/useQrcode.d.ts +4 -0
  212. package/lib/rc-qrcode/useQrcode.js +66 -0
  213. package/lib/rc-transition-group/index.d.ts +2 -0
  214. package/lib/rc-transition-group/index.js +43 -0
  215. package/lib/rc-transition-group/style/index.d.ts +1 -0
  216. package/lib/rc-transition-group/style/index.js +0 -0
  217. package/lib/single-img-upload/index.d.ts +19 -0
  218. package/lib/single-img-upload/index.js +250 -0
  219. package/lib/single-img-upload/style/index.css +74 -0
  220. package/lib/single-img-upload/style/index.d.ts +3 -0
  221. package/lib/single-img-upload/style/index.js +11 -0
  222. package/lib/single-img-upload/style/index.less +85 -0
  223. package/lib/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
  224. package/lib/sortable-hoc/demo/index.modules.less +248 -0
  225. package/lib/sortable-hoc/index.d.ts +2 -0
  226. package/lib/sortable-hoc/index.js +43 -0
  227. package/lib/sortable-hoc/style/index.d.ts +1 -0
  228. package/lib/sortable-hoc/style/index.js +0 -0
  229. package/lib/split-pane/index.d.ts +59 -0
  230. package/lib/split-pane/index.js +69 -0
  231. package/lib/split-pane/style/index.css +41 -0
  232. package/lib/split-pane/style/index.d.ts +1 -0
  233. package/lib/split-pane/style/index.js +7 -0
  234. package/lib/split-pane/style/index.less +49 -0
  235. package/lib/text-area/index.d.ts +12 -0
  236. package/lib/text-area/index.js +144 -0
  237. package/lib/text-area/style/index.d.ts +1 -0
  238. package/lib/text-area/style/index.js +7 -0
  239. package/lib/text-input/index.d.ts +5 -0
  240. package/lib/text-input/index.js +99 -0
  241. package/lib/{number-input → text-input}/style/index.css +0 -3
  242. package/lib/text-input/style/index.d.ts +1 -0
  243. package/lib/text-input/style/index.js +7 -0
  244. package/lib/{number-input → text-input}/style/index.less +0 -4
  245. package/package.json +20 -3
@@ -0,0 +1 @@
1
+ import 'antd/es/input/style';
@@ -0,0 +1 @@
1
+ import 'antd/es/input/style';
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { TooltipProps } from 'antd/lib/tooltip';
3
+ export interface CopyToClipboardProps {
4
+ /** 需要复制的字符串 */
5
+ text: string;
6
+ /** 触发复制事件的元素 */
7
+ children: React.ReactElement;
8
+ /** 文本被复制时候的回调 */
9
+ onCopy?(text: string, result: boolean): void;
10
+ /** ant design Tooltip props */
11
+ tooltipProps: TooltipProps;
12
+ /** 复制成功的Tooltip提示文案 */
13
+ tooltipTitle?: React.ReactNode;
14
+ /** 依赖底层组件 https://github.com/sudodoki/copy-to-clipboard 的 options */
15
+ options?: {
16
+ debug?: boolean;
17
+ message?: string;
18
+ format?: string;
19
+ };
20
+ }
21
+ declare const _default: React.MemoExoticComponent<(props: CopyToClipboardProps) => JSX.Element>;
22
+ export default _default;
@@ -0,0 +1,95 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+
6
+ for (var p in s) {
7
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ var __read = this && this.__read || function (o, n) {
18
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
19
+ if (!m) return o;
20
+ var i = m.call(o),
21
+ r,
22
+ ar = [],
23
+ e;
24
+
25
+ try {
26
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
27
+ ar.push(r.value);
28
+ }
29
+ } catch (error) {
30
+ e = {
31
+ error: error
32
+ };
33
+ } finally {
34
+ try {
35
+ if (r && !r.done && (m = i["return"])) m.call(i);
36
+ } finally {
37
+ if (e) throw e.error;
38
+ }
39
+ }
40
+
41
+ return ar;
42
+ };
43
+
44
+ import React, { useState } from 'react';
45
+ import copy from 'copy-to-clipboard';
46
+ import Tooltip from 'antd/lib/tooltip';
47
+
48
+ var CopyToClipboard = function CopyToClipboard(props) {
49
+ var text = props.text,
50
+ onCopy = props.onCopy,
51
+ children = props.children,
52
+ options = props.options,
53
+ tooltipTitle = props.tooltipTitle,
54
+ tooltipProps = props.tooltipProps;
55
+
56
+ var _a = __read(useState(false), 2),
57
+ tooltipVisible = _a[0],
58
+ setTooltipVisible = _a[1];
59
+
60
+ var handleCopySuccess = function handleCopySuccess() {
61
+ setTooltipVisible(true);
62
+ setTimeout(function () {
63
+ setTooltipVisible(false);
64
+ }, 1000);
65
+ };
66
+
67
+ var onClick = function onClick(event) {
68
+ var elem = React.Children.only(children);
69
+ var result = copy(text, options);
70
+
71
+ if (onCopy) {
72
+ onCopy(text, result);
73
+ }
74
+
75
+ if (tooltipTitle) {
76
+ handleCopySuccess();
77
+ }
78
+
79
+ if (elem && elem.props && typeof elem.props.onClick === 'function') {
80
+ elem.props.onClick(event);
81
+ }
82
+ };
83
+
84
+ return tooltipTitle ? /*#__PURE__*/React.createElement(Tooltip, __assign({
85
+ placement: "topLeft",
86
+ visible: tooltipVisible,
87
+ title: tooltipTitle
88
+ }, tooltipProps), /*#__PURE__*/React.cloneElement(children, {
89
+ onClick: onClick
90
+ })) : /*#__PURE__*/React.cloneElement(children, {
91
+ onClick: onClick
92
+ });
93
+ };
94
+
95
+ export default /*#__PURE__*/React.memo(CopyToClipboard);
@@ -0,0 +1,249 @@
1
+ /* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
2
+ /* stylelint-disable no-duplicate-selectors */
3
+ /* stylelint-disable */
4
+ /* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
5
+ .ant-tooltip {
6
+ box-sizing: border-box;
7
+ margin: 0;
8
+ padding: 0;
9
+ color: rgba(0, 0, 0, 0.85);
10
+ font-size: 14px;
11
+ font-variant: tabular-nums;
12
+ line-height: 1.5715;
13
+ list-style: none;
14
+ font-feature-settings: 'tnum';
15
+ position: absolute;
16
+ z-index: 1070;
17
+ display: block;
18
+ width: -webkit-max-content;
19
+ width: -moz-max-content;
20
+ width: max-content;
21
+ max-width: 250px;
22
+ visibility: visible;
23
+ }
24
+ .ant-tooltip-hidden {
25
+ display: none;
26
+ }
27
+ .ant-tooltip-placement-top,
28
+ .ant-tooltip-placement-topLeft,
29
+ .ant-tooltip-placement-topRight {
30
+ padding-bottom: 8px;
31
+ }
32
+ .ant-tooltip-placement-right,
33
+ .ant-tooltip-placement-rightTop,
34
+ .ant-tooltip-placement-rightBottom {
35
+ padding-left: 8px;
36
+ }
37
+ .ant-tooltip-placement-bottom,
38
+ .ant-tooltip-placement-bottomLeft,
39
+ .ant-tooltip-placement-bottomRight {
40
+ padding-top: 8px;
41
+ }
42
+ .ant-tooltip-placement-left,
43
+ .ant-tooltip-placement-leftTop,
44
+ .ant-tooltip-placement-leftBottom {
45
+ padding-right: 8px;
46
+ }
47
+ .ant-tooltip-inner {
48
+ min-width: 30px;
49
+ min-height: 32px;
50
+ padding: 6px 8px;
51
+ color: #fff;
52
+ text-align: left;
53
+ text-decoration: none;
54
+ word-wrap: break-word;
55
+ background-color: rgba(0, 0, 0, 0.75);
56
+ border-radius: 2px;
57
+ box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
58
+ }
59
+ .ant-tooltip-arrow {
60
+ position: absolute;
61
+ display: block;
62
+ width: 13.07106781px;
63
+ height: 13.07106781px;
64
+ overflow: hidden;
65
+ background: transparent;
66
+ pointer-events: none;
67
+ }
68
+ .ant-tooltip-arrow-content {
69
+ position: absolute;
70
+ top: 0;
71
+ right: 0;
72
+ bottom: 0;
73
+ left: 0;
74
+ display: block;
75
+ width: 5px;
76
+ height: 5px;
77
+ margin: auto;
78
+ background-color: rgba(0, 0, 0, 0.75);
79
+ content: '';
80
+ pointer-events: auto;
81
+ }
82
+ .ant-tooltip-placement-top .ant-tooltip-arrow,
83
+ .ant-tooltip-placement-topLeft .ant-tooltip-arrow,
84
+ .ant-tooltip-placement-topRight .ant-tooltip-arrow {
85
+ bottom: -5.07106781px;
86
+ }
87
+ .ant-tooltip-placement-top .ant-tooltip-arrow-content,
88
+ .ant-tooltip-placement-topLeft .ant-tooltip-arrow-content,
89
+ .ant-tooltip-placement-topRight .ant-tooltip-arrow-content {
90
+ box-shadow: 3px 3px 7px rgba(0, 0, 0, 0.07);
91
+ transform: translateY(-6.53553391px) rotate(45deg);
92
+ }
93
+ .ant-tooltip-placement-top .ant-tooltip-arrow {
94
+ left: 50%;
95
+ transform: translateX(-50%);
96
+ }
97
+ .ant-tooltip-placement-topLeft .ant-tooltip-arrow {
98
+ left: 13px;
99
+ }
100
+ .ant-tooltip-placement-topRight .ant-tooltip-arrow {
101
+ right: 13px;
102
+ }
103
+ .ant-tooltip-placement-right .ant-tooltip-arrow,
104
+ .ant-tooltip-placement-rightTop .ant-tooltip-arrow,
105
+ .ant-tooltip-placement-rightBottom .ant-tooltip-arrow {
106
+ left: -5.07106781px;
107
+ }
108
+ .ant-tooltip-placement-right .ant-tooltip-arrow-content,
109
+ .ant-tooltip-placement-rightTop .ant-tooltip-arrow-content,
110
+ .ant-tooltip-placement-rightBottom .ant-tooltip-arrow-content {
111
+ box-shadow: -3px 3px 7px rgba(0, 0, 0, 0.07);
112
+ transform: translateX(6.53553391px) rotate(45deg);
113
+ }
114
+ .ant-tooltip-placement-right .ant-tooltip-arrow {
115
+ top: 50%;
116
+ transform: translateY(-50%);
117
+ }
118
+ .ant-tooltip-placement-rightTop .ant-tooltip-arrow {
119
+ top: 5px;
120
+ }
121
+ .ant-tooltip-placement-rightBottom .ant-tooltip-arrow {
122
+ bottom: 5px;
123
+ }
124
+ .ant-tooltip-placement-left .ant-tooltip-arrow,
125
+ .ant-tooltip-placement-leftTop .ant-tooltip-arrow,
126
+ .ant-tooltip-placement-leftBottom .ant-tooltip-arrow {
127
+ right: -5.07106781px;
128
+ }
129
+ .ant-tooltip-placement-left .ant-tooltip-arrow-content,
130
+ .ant-tooltip-placement-leftTop .ant-tooltip-arrow-content,
131
+ .ant-tooltip-placement-leftBottom .ant-tooltip-arrow-content {
132
+ box-shadow: 3px -3px 7px rgba(0, 0, 0, 0.07);
133
+ transform: translateX(-6.53553391px) rotate(45deg);
134
+ }
135
+ .ant-tooltip-placement-left .ant-tooltip-arrow {
136
+ top: 50%;
137
+ transform: translateY(-50%);
138
+ }
139
+ .ant-tooltip-placement-leftTop .ant-tooltip-arrow {
140
+ top: 5px;
141
+ }
142
+ .ant-tooltip-placement-leftBottom .ant-tooltip-arrow {
143
+ bottom: 5px;
144
+ }
145
+ .ant-tooltip-placement-bottom .ant-tooltip-arrow,
146
+ .ant-tooltip-placement-bottomLeft .ant-tooltip-arrow,
147
+ .ant-tooltip-placement-bottomRight .ant-tooltip-arrow {
148
+ top: -5.07106781px;
149
+ }
150
+ .ant-tooltip-placement-bottom .ant-tooltip-arrow-content,
151
+ .ant-tooltip-placement-bottomLeft .ant-tooltip-arrow-content,
152
+ .ant-tooltip-placement-bottomRight .ant-tooltip-arrow-content {
153
+ box-shadow: -3px -3px 7px rgba(0, 0, 0, 0.07);
154
+ transform: translateY(6.53553391px) rotate(45deg);
155
+ }
156
+ .ant-tooltip-placement-bottom .ant-tooltip-arrow {
157
+ left: 50%;
158
+ transform: translateX(-50%);
159
+ }
160
+ .ant-tooltip-placement-bottomLeft .ant-tooltip-arrow {
161
+ left: 13px;
162
+ }
163
+ .ant-tooltip-placement-bottomRight .ant-tooltip-arrow {
164
+ right: 13px;
165
+ }
166
+ .ant-tooltip-pink .ant-tooltip-inner {
167
+ background-color: #eb2f96;
168
+ }
169
+ .ant-tooltip-pink .ant-tooltip-arrow-content {
170
+ background-color: #eb2f96;
171
+ }
172
+ .ant-tooltip-magenta .ant-tooltip-inner {
173
+ background-color: #eb2f96;
174
+ }
175
+ .ant-tooltip-magenta .ant-tooltip-arrow-content {
176
+ background-color: #eb2f96;
177
+ }
178
+ .ant-tooltip-red .ant-tooltip-inner {
179
+ background-color: #f5222d;
180
+ }
181
+ .ant-tooltip-red .ant-tooltip-arrow-content {
182
+ background-color: #f5222d;
183
+ }
184
+ .ant-tooltip-volcano .ant-tooltip-inner {
185
+ background-color: #fa541c;
186
+ }
187
+ .ant-tooltip-volcano .ant-tooltip-arrow-content {
188
+ background-color: #fa541c;
189
+ }
190
+ .ant-tooltip-orange .ant-tooltip-inner {
191
+ background-color: #fa8c16;
192
+ }
193
+ .ant-tooltip-orange .ant-tooltip-arrow-content {
194
+ background-color: #fa8c16;
195
+ }
196
+ .ant-tooltip-yellow .ant-tooltip-inner {
197
+ background-color: #fadb14;
198
+ }
199
+ .ant-tooltip-yellow .ant-tooltip-arrow-content {
200
+ background-color: #fadb14;
201
+ }
202
+ .ant-tooltip-gold .ant-tooltip-inner {
203
+ background-color: #faad14;
204
+ }
205
+ .ant-tooltip-gold .ant-tooltip-arrow-content {
206
+ background-color: #faad14;
207
+ }
208
+ .ant-tooltip-cyan .ant-tooltip-inner {
209
+ background-color: #13c2c2;
210
+ }
211
+ .ant-tooltip-cyan .ant-tooltip-arrow-content {
212
+ background-color: #13c2c2;
213
+ }
214
+ .ant-tooltip-lime .ant-tooltip-inner {
215
+ background-color: #a0d911;
216
+ }
217
+ .ant-tooltip-lime .ant-tooltip-arrow-content {
218
+ background-color: #a0d911;
219
+ }
220
+ .ant-tooltip-green .ant-tooltip-inner {
221
+ background-color: #52c41a;
222
+ }
223
+ .ant-tooltip-green .ant-tooltip-arrow-content {
224
+ background-color: #52c41a;
225
+ }
226
+ .ant-tooltip-blue .ant-tooltip-inner {
227
+ background-color: #1890ff;
228
+ }
229
+ .ant-tooltip-blue .ant-tooltip-arrow-content {
230
+ background-color: #1890ff;
231
+ }
232
+ .ant-tooltip-geekblue .ant-tooltip-inner {
233
+ background-color: #2f54eb;
234
+ }
235
+ .ant-tooltip-geekblue .ant-tooltip-arrow-content {
236
+ background-color: #2f54eb;
237
+ }
238
+ .ant-tooltip-purple .ant-tooltip-inner {
239
+ background-color: #722ed1;
240
+ }
241
+ .ant-tooltip-purple .ant-tooltip-arrow-content {
242
+ background-color: #722ed1;
243
+ }
244
+ .ant-tooltip-rtl {
245
+ direction: rtl;
246
+ }
247
+ .ant-tooltip-rtl .ant-tooltip-inner {
248
+ text-align: right;
249
+ }
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ @import '~antd/es/tooltip/style/index.less';
@@ -0,0 +1,7 @@
1
+ import { HighlightType } from './types';
2
+ export interface HighlighedContentsProps {
3
+ value: string;
4
+ highlight: HighlightType;
5
+ }
6
+ declare const HighlighedContents: ({ value, highlight }: HighlighedContentsProps) => JSX.Element;
7
+ export default HighlighedContents;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import getRanges from './getRanges';
3
+ import extractSpansOfClasses from './extractSpansOfClasses';
4
+
5
+ var HighlighedContents = function HighlighedContents(_a) {
6
+ var value = _a.value,
7
+ highlight = _a.highlight;
8
+ var ranges = getRanges(value, highlight);
9
+ var parts = extractSpansOfClasses(value, ranges);
10
+ return /*#__PURE__*/React.createElement(React.Fragment, null, parts.map(function (part) {
11
+ return part.render();
12
+ }));
13
+ };
14
+
15
+ export default HighlighedContents;
@@ -0,0 +1,15 @@
1
+ import { RangesType } from './types';
2
+ declare class Span {
3
+ beginIndex: number;
4
+ endIndex: number;
5
+ markClasses: Set<string>;
6
+ isMark: boolean;
7
+ text: string;
8
+ constructor(text: string, beginIndex: number);
9
+ setMark(className: string): void;
10
+ carve(beginIndex2: number): Span;
11
+ get className(): string;
12
+ render(): JSX.Element;
13
+ }
14
+ export default function extractSpansOfClasses(value: string, ranges: RangesType): Span[];
15
+ export {};
@@ -0,0 +1,159 @@
1
+ var __read = this && this.__read || function (o, n) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3
+ if (!m) return o;
4
+ var i = m.call(o),
5
+ r,
6
+ ar = [],
7
+ e;
8
+
9
+ try {
10
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
11
+ ar.push(r.value);
12
+ }
13
+ } catch (error) {
14
+ e = {
15
+ error: error
16
+ };
17
+ } finally {
18
+ try {
19
+ if (r && !r.done && (m = i["return"])) m.call(i);
20
+ } finally {
21
+ if (e) throw e.error;
22
+ }
23
+ }
24
+
25
+ return ar;
26
+ };
27
+
28
+ var __spread = this && this.__spread || function () {
29
+ for (var ar = [], i = 0; i < arguments.length; i++) {
30
+ ar = ar.concat(__read(arguments[i]));
31
+ }
32
+
33
+ return ar;
34
+ };
35
+
36
+ import React from 'react';
37
+
38
+ var Span = function () {
39
+ function Span(text, beginIndex) {
40
+ this.beginIndex = beginIndex;
41
+ this.endIndex = beginIndex + text.length;
42
+ this.text = text;
43
+ this.isMark = false;
44
+ this.markClasses = new Set();
45
+ }
46
+
47
+ Span.prototype.setMark = function (className) {
48
+ var _this = this;
49
+
50
+ this.isMark = true;
51
+
52
+ if (className) {
53
+ className.split(' ').forEach(function (cls) {
54
+ _this.markClasses.add(cls);
55
+ });
56
+ }
57
+ };
58
+
59
+ Span.prototype.carve = function (beginIndex2) {
60
+ var rightText = this.text.slice(beginIndex2 - this.beginIndex);
61
+ this.text = this.text.slice(0, beginIndex2 - this.beginIndex);
62
+ this.endIndex = beginIndex2;
63
+ var right = new Span(rightText, beginIndex2);
64
+ right.isMark = this.isMark;
65
+ right.markClasses = new Set(__spread(this.markClasses));
66
+ return right;
67
+ };
68
+
69
+ Object.defineProperty(Span.prototype, "className", {
70
+ get: function get() {
71
+ if (this.markClasses && this.markClasses.size > 0) {
72
+ return __spread(this.markClasses).sort().join(' ');
73
+ }
74
+
75
+ return '';
76
+ },
77
+ enumerable: false,
78
+ configurable: true
79
+ });
80
+
81
+ Span.prototype.render = function () {
82
+ if (this.isMark) {
83
+ var className = this.className;
84
+
85
+ if (className) {
86
+ return /*#__PURE__*/React.createElement("mark", {
87
+ key: this.beginIndex,
88
+ className: className
89
+ }, this.text);
90
+ }
91
+
92
+ return /*#__PURE__*/React.createElement("mark", {
93
+ key: this.beginIndex
94
+ }, this.text);
95
+ }
96
+
97
+ return /*#__PURE__*/React.createElement("span", {
98
+ key: this.beginIndex
99
+ }, this.text);
100
+ };
101
+
102
+ return Span;
103
+ }();
104
+
105
+ export default function extractSpansOfClasses(value, ranges) {
106
+ var spans = [new Span(value, 0)];
107
+ ranges.forEach(function (range) {
108
+ var beginIndex = range[0];
109
+ var endIndex = range[1];
110
+ var rangeOption = range[2];
111
+ var _a = (rangeOption || {}).className,
112
+ className = _a === void 0 ? '' : _a;
113
+
114
+ for (var i = 0; i < spans.length; i++) {
115
+ var span = spans[i]; // since spans are sorted, So this is always true: beginIndex >= span.beginIndex.
116
+
117
+ if (beginIndex < span.endIndex) {
118
+ if (beginIndex === span.beginIndex) {
119
+ if (endIndex < span.endIndex) {
120
+ // [range]
121
+ // [s p a n]
122
+ var span2 = span.carve(endIndex);
123
+ span.setMark(className);
124
+ spans.splice(i + 1, 0, span2);
125
+ beginIndex = endIndex;
126
+ i += 1;
127
+ } else {
128
+ // [range] or [r a n g e]
129
+ // [span-] [span]
130
+ span.setMark(className);
131
+ beginIndex = span.endIndex;
132
+ }
133
+ } else if (endIndex < span.endIndex) {
134
+ // [range]
135
+ // [s p a n]
136
+ var span2 = span.carve(beginIndex);
137
+ var span3 = span2.carve(endIndex);
138
+ span2.setMark(className);
139
+ spans.splice(i + 1, 0, span2, span3);
140
+ beginIndex = endIndex;
141
+ i += 2;
142
+ } else {
143
+ // [range] or [range]
144
+ // [s p a n] [span]
145
+ var span2 = span.carve(beginIndex);
146
+ span2.setMark(className);
147
+ spans.splice(i + 1, 0, span2);
148
+ beginIndex = span2.endIndex;
149
+ i += 1;
150
+ }
151
+ }
152
+
153
+ if (beginIndex === endIndex) {
154
+ break;
155
+ }
156
+ }
157
+ });
158
+ return spans;
159
+ }