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/drawer/style';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ require("antd/es/drawer/style");
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import { ModalProps } from 'antd/lib/modal';
3
+ export interface refProps {
4
+ open: () => void;
5
+ close: () => void;
6
+ }
7
+ export interface ButtonModalProps extends ModalProps {
8
+ content: React.ReactElement;
9
+ children: React.ReactElement;
10
+ onClose: () => void;
11
+ onOpen: () => void;
12
+ }
13
+ declare const ForwardRefButtonModal: React.ForwardRefExoticComponent<ButtonModalProps & React.RefAttributes<unknown>>;
14
+ export default ForwardRefButtonModal;
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+
3
+ var __assign = this && this.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+
8
+ for (var p in s) {
9
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
10
+ }
11
+ }
12
+
13
+ return t;
14
+ };
15
+
16
+ return __assign.apply(this, arguments);
17
+ };
18
+
19
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ Object.defineProperty(o, k2, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return m[k];
25
+ }
26
+ });
27
+ } : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+
32
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
33
+ Object.defineProperty(o, "default", {
34
+ enumerable: true,
35
+ value: v
36
+ });
37
+ } : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+
41
+ var __importStar = this && this.__importStar || function (mod) {
42
+ if (mod && mod.__esModule) return mod;
43
+ var result = {};
44
+ if (mod != null) for (var k in mod) {
45
+ if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
46
+ }
47
+
48
+ __setModuleDefault(result, mod);
49
+
50
+ return result;
51
+ };
52
+
53
+ var __rest = this && this.__rest || function (s, e) {
54
+ var t = {};
55
+
56
+ for (var p in s) {
57
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
58
+ }
59
+
60
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
61
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
62
+ }
63
+ return t;
64
+ };
65
+
66
+ var __read = this && this.__read || function (o, n) {
67
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
68
+ if (!m) return o;
69
+ var i = m.call(o),
70
+ r,
71
+ ar = [],
72
+ e;
73
+
74
+ try {
75
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
76
+ ar.push(r.value);
77
+ }
78
+ } catch (error) {
79
+ e = {
80
+ error: error
81
+ };
82
+ } finally {
83
+ try {
84
+ if (r && !r.done && (m = i["return"])) m.call(i);
85
+ } finally {
86
+ if (e) throw e.error;
87
+ }
88
+ }
89
+
90
+ return ar;
91
+ };
92
+
93
+ var __importDefault = this && this.__importDefault || function (mod) {
94
+ return mod && mod.__esModule ? mod : {
95
+ "default": mod
96
+ };
97
+ };
98
+
99
+ Object.defineProperty(exports, "__esModule", {
100
+ value: true
101
+ });
102
+
103
+ var React = __importStar(require("react"));
104
+
105
+ var modal_1 = __importDefault(require("antd/lib/modal"));
106
+
107
+ var ButtonModal = function ButtonModal(props, ref) {
108
+ var _a = __read(React.useState(false), 2),
109
+ visible = _a[0],
110
+ setModalVisible = _a[1];
111
+
112
+ var children = props.children,
113
+ content = props.content,
114
+ onOpen = props.onOpen,
115
+ onClose = props.onClose,
116
+ onOk = props.onOk,
117
+ onCancel = props.onCancel,
118
+ restModalProps = __rest(props, ["children", "content", "onOpen", "onClose", "onOk", "onCancel"]);
119
+
120
+ var openModal = function openModal() {
121
+ if (onOpen) {
122
+ onOpen();
123
+ }
124
+
125
+ setModalVisible(true);
126
+ };
127
+
128
+ var closeModal = function closeModal() {
129
+ if (onClose) {
130
+ onClose();
131
+ }
132
+
133
+ setModalVisible(false);
134
+ };
135
+
136
+ var modalActionRef = React.useRef({
137
+ open: open,
138
+ close: close
139
+ });
140
+ React.useImperativeHandle(ref, function () {
141
+ return {
142
+ open: open,
143
+ close: close
144
+ };
145
+ }, [modalActionRef]);
146
+
147
+ var handleModalOk = function handleModalOk(e) {
148
+ if (onOk) {
149
+ return onOk(e);
150
+ }
151
+
152
+ close();
153
+ };
154
+
155
+ var handleModalCancel = function handleModalCancel(e) {
156
+ if (onCancel) {
157
+ onCancel(e);
158
+ }
159
+
160
+ closeModal();
161
+ };
162
+
163
+ var buttonNode = children && React.cloneElement(children, {
164
+ onClick: openModal
165
+ });
166
+ return React.createElement(React.Fragment, null, buttonNode, React.createElement(modal_1["default"], __assign({
167
+ visible: visible,
168
+ onOk: handleModalOk,
169
+ onCancel: handleModalCancel,
170
+ centered: true,
171
+ maskClosable: false
172
+ }, restModalProps), React.cloneElement(content, {
173
+ modalAction: modalActionRef.current
174
+ })));
175
+ };
176
+
177
+ var ForwardRefButtonModal = React.forwardRef(ButtonModal);
178
+ exports["default"] = ForwardRefButtonModal;
@@ -0,0 +1 @@
1
+ import 'antd/es/modal/style';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ require("antd/es/modal/style");
@@ -0,0 +1,15 @@
1
+ export interface ConditionInputProps {
2
+ /** 过滤的正则条件 */
3
+ regexp: RegExp | (RegExp | string | {
4
+ pattern: RegExp;
5
+ replacement?: string;
6
+ })[];
7
+ /** 指定输入框展示值的格式 */
8
+ formatter?: (value: string) => string;
9
+ /** 变化回调 */
10
+ onChange?: (value: string) => void;
11
+ /** 输入框内容 */
12
+ value?: string;
13
+ }
14
+ declare const ConditionInput: (props: ConditionInputProps) => JSX.Element;
15
+ export default ConditionInput;
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+
3
+ var __assign = this && this.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+
8
+ for (var p in s) {
9
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
10
+ }
11
+ }
12
+
13
+ return t;
14
+ };
15
+
16
+ return __assign.apply(this, arguments);
17
+ };
18
+
19
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ Object.defineProperty(o, k2, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return m[k];
25
+ }
26
+ });
27
+ } : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+
32
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
33
+ Object.defineProperty(o, "default", {
34
+ enumerable: true,
35
+ value: v
36
+ });
37
+ } : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+
41
+ var __importStar = this && this.__importStar || function (mod) {
42
+ if (mod && mod.__esModule) return mod;
43
+ var result = {};
44
+ if (mod != null) for (var k in mod) {
45
+ if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
46
+ }
47
+
48
+ __setModuleDefault(result, mod);
49
+
50
+ return result;
51
+ };
52
+
53
+ var __rest = this && this.__rest || function (s, e) {
54
+ var t = {};
55
+
56
+ for (var p in s) {
57
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
58
+ }
59
+
60
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
61
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
62
+ }
63
+ return t;
64
+ };
65
+
66
+ var __read = this && this.__read || function (o, n) {
67
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
68
+ if (!m) return o;
69
+ var i = m.call(o),
70
+ r,
71
+ ar = [],
72
+ e;
73
+
74
+ try {
75
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
76
+ ar.push(r.value);
77
+ }
78
+ } catch (error) {
79
+ e = {
80
+ error: error
81
+ };
82
+ } finally {
83
+ try {
84
+ if (r && !r.done && (m = i["return"])) m.call(i);
85
+ } finally {
86
+ if (e) throw e.error;
87
+ }
88
+ }
89
+
90
+ return ar;
91
+ };
92
+
93
+ var __importDefault = this && this.__importDefault || function (mod) {
94
+ return mod && mod.__esModule ? mod : {
95
+ "default": mod
96
+ };
97
+ };
98
+
99
+ Object.defineProperty(exports, "__esModule", {
100
+ value: true
101
+ });
102
+
103
+ var React = __importStar(require("react"));
104
+
105
+ var isArray_1 = __importDefault(require("lodash/isArray"));
106
+
107
+ var input_1 = __importDefault(require("antd/lib/input"));
108
+
109
+ var isFunction_1 = __importDefault(require("lodash/isFunction"));
110
+
111
+ var parse2RegexOption_1 = __importDefault(require("./parse2RegexOption"));
112
+
113
+ var ConditionInput = function ConditionInput(props) {
114
+ var regexp = props.regexp,
115
+ formatter = props.formatter,
116
+ value = props.value,
117
+ onChange = props.onChange,
118
+ rest = __rest(props, ["regexp", "formatter", "value", "onChange"]);
119
+
120
+ var _a = __read(React.useState(''), 2),
121
+ stateValue = _a[0],
122
+ setStateValue = _a[1];
123
+
124
+ var resultValue = value === undefined ? stateValue : value;
125
+
126
+ var handleChange = function handleChange(e) {
127
+ var originalValue = e.target.value;
128
+ var resultRegexp = isArray_1["default"](regexp) ? regexp : [regexp];
129
+ var nextValue = resultRegexp.reduce(function (cur, acc) {
130
+ var regexOption = parse2RegexOption_1["default"](acc);
131
+
132
+ if (regexOption.isValid) {
133
+ return cur.replace(regexOption.pattern, regexOption.replacement);
134
+ }
135
+
136
+ return cur;
137
+ }, originalValue);
138
+
139
+ if (isFunction_1["default"](formatter)) {
140
+ nextValue = formatter(nextValue);
141
+ }
142
+
143
+ if (resultValue !== nextValue) {
144
+ setStateValue(nextValue);
145
+
146
+ if (onChange) {
147
+ onChange(nextValue);
148
+ }
149
+ }
150
+ };
151
+
152
+ return React.createElement(input_1["default"], __assign({
153
+ value: resultValue,
154
+ onChange: handleChange
155
+ }, rest));
156
+ };
157
+
158
+ exports["default"] = ConditionInput;
@@ -0,0 +1,13 @@
1
+ export interface RegexOptionType {
2
+ isValid: boolean;
3
+ replacement: string;
4
+ }
5
+ declare type regexParamsType = RegExp | string | {
6
+ pattern: RegExp;
7
+ replacement?: string;
8
+ };
9
+ export interface ResultType extends RegexOptionType {
10
+ pattern: RegExp;
11
+ }
12
+ declare const parse2RegexOption: (regex: regexParamsType) => ResultType;
13
+ export default parse2RegexOption;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ var __assign = this && this.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+
8
+ for (var p in s) {
9
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
10
+ }
11
+ }
12
+
13
+ return t;
14
+ };
15
+
16
+ return __assign.apply(this, arguments);
17
+ };
18
+
19
+ var __importDefault = this && this.__importDefault || function (mod) {
20
+ return mod && mod.__esModule ? mod : {
21
+ "default": mod
22
+ };
23
+ };
24
+
25
+ Object.defineProperty(exports, "__esModule", {
26
+ value: true
27
+ });
28
+
29
+ var isRegExp_1 = __importDefault(require("lodash/isRegExp"));
30
+
31
+ var isString_1 = __importDefault(require("lodash/isString"));
32
+
33
+ var isObject_1 = __importDefault(require("lodash/isObject"));
34
+
35
+ var defaultOptionValues = {
36
+ isValid: true,
37
+ replacement: ''
38
+ };
39
+
40
+ var parseRegex2RegexOption = function parseRegex2RegexOption(regex, options) {
41
+ return __assign(__assign(__assign({}, defaultOptionValues), {
42
+ pattern: regex
43
+ }), options);
44
+ };
45
+
46
+ var parseString2RegexOption = function parseString2RegexOption(regexString, options) {
47
+ return parseRegex2RegexOption(new RegExp(regexString), options);
48
+ };
49
+
50
+ var parse2RegexOption = function parse2RegexOption(regex) {
51
+ if (isRegExp_1["default"](regex)) {
52
+ return parseRegex2RegexOption(regex);
53
+ }
54
+
55
+ if (isString_1["default"](regex)) {
56
+ return parseString2RegexOption(regex);
57
+ }
58
+
59
+ if (isObject_1["default"](regex)) {
60
+ return __assign(__assign(__assign({}, defaultOptionValues), {
61
+ isValid: !!regex.pattern
62
+ }), regex);
63
+ }
64
+
65
+ return {
66
+ isValid: false,
67
+ replacement: '',
68
+ pattern: /./
69
+ };
70
+ };
71
+
72
+ exports["default"] = parse2RegexOption;