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.
- package/es/button-drawer/index.d.ts +10 -0
- package/es/button-drawer/index.js +116 -0
- package/es/button-drawer/style/index.d.ts +1 -0
- package/es/button-drawer/style/index.js +1 -0
- package/es/button-modal/index.d.ts +14 -0
- package/es/button-modal/index.js +131 -0
- package/es/button-modal/style/index.d.ts +1 -0
- package/es/button-modal/style/index.js +1 -0
- package/es/condition-input/index.d.ts +15 -0
- package/es/condition-input/index.js +108 -0
- package/es/condition-input/parse2RegexOption.d.ts +13 -0
- package/es/condition-input/parse2RegexOption.js +57 -0
- package/es/condition-input/style/index.d.ts +1 -0
- package/es/condition-input/style/index.js +1 -0
- package/es/copy-to-clipboard/index.d.ts +22 -0
- package/es/copy-to-clipboard/index.js +95 -0
- package/es/copy-to-clipboard/style/index.css +249 -0
- package/es/copy-to-clipboard/style/index.d.ts +1 -0
- package/es/copy-to-clipboard/style/index.js +1 -0
- package/es/copy-to-clipboard/style/index.less +1 -0
- package/es/highlight-textarea/HighlighedContents.d.ts +7 -0
- package/es/highlight-textarea/HighlighedContents.js +15 -0
- package/es/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
- package/es/highlight-textarea/extractSpansOfClasses.js +159 -0
- package/es/highlight-textarea/getRanges.d.ts +2 -0
- package/es/highlight-textarea/getRanges.js +142 -0
- package/es/highlight-textarea/getType.d.ts +2 -0
- package/es/highlight-textarea/getType.js +29 -0
- package/es/highlight-textarea/index.d.ts +12 -0
- package/es/highlight-textarea/index.js +132 -0
- package/es/highlight-textarea/style/index.css +38 -0
- package/es/highlight-textarea/style/index.d.ts +2 -0
- package/es/highlight-textarea/style/index.js +2 -0
- package/es/highlight-textarea/style/index.less +42 -0
- package/es/highlight-textarea/types.d.ts +16 -0
- package/es/highlight-textarea/types.js +0 -0
- package/es/highlight-words/index.d.ts +3 -0
- package/es/highlight-words/index.js +2 -0
- package/es/highlight-words/style/index.d.ts +1 -0
- package/es/highlight-words/style/index.js +0 -0
- package/es/icon/demo/svg/check-circle-filled.svg +6 -0
- package/es/icon/demo/svg/coin-circle.svg +9 -0
- package/es/icon/index.d.ts +27 -0
- package/es/icon/index.js +95 -0
- package/es/icon/style/index.d.ts +1 -0
- package/es/icon/style/index.js +0 -0
- package/es/icon/utils.d.ts +6 -0
- package/es/icon/utils.js +22 -0
- package/es/img-crop/EasyCrop.d.ts +6 -0
- package/es/img-crop/EasyCrop.js +113 -0
- package/es/img-crop/getCroppedImg.d.ts +6 -0
- package/es/img-crop/getCroppedImg.js +199 -0
- package/es/img-crop/index.d.ts +53 -0
- package/es/img-crop/index.js +531 -0
- package/es/img-crop/style/index.css +52 -0
- package/es/img-crop/style/index.d.ts +3 -0
- package/es/img-crop/style/index.js +3 -0
- package/es/img-crop/style/index.less +54 -0
- package/es/index.d.ts +34 -2
- package/es/index.js +18 -2
- package/es/keep-tab/demo/index.modules.less +66 -0
- package/es/keep-tab/index.d.ts +29 -0
- package/es/keep-tab/index.js +129 -0
- package/es/keep-tab/style/index.css +1129 -0
- package/es/keep-tab/style/index.d.ts +2 -0
- package/es/keep-tab/style/index.js +2 -0
- package/es/keep-tab/style/index.less +2 -0
- package/es/number-input/index.d.ts +22 -7
- package/es/number-input/index.js +22 -11
- package/es/number-input/style/index.d.ts +1 -1
- package/es/number-input/style/index.js +1 -1
- package/es/number-input/utils.d.ts +10 -11
- package/es/number-input/utils.js +7 -7
- package/es/rc-echart/core.d.ts +32 -0
- package/es/rc-echart/core.js +136 -0
- package/es/rc-echart/index.d.ts +21 -0
- package/es/rc-echart/index.js +27 -0
- package/es/rc-echart/style/index.d.ts +1 -0
- package/es/rc-echart/style/index.js +0 -0
- package/es/rc-motion/demo/CSSMotion.less +91 -0
- package/es/rc-motion/index.d.ts +2 -0
- package/es/rc-motion/index.js +2 -0
- package/es/rc-motion/style/index.d.ts +1 -0
- package/es/rc-motion/style/index.js +0 -0
- package/es/rc-qrcode/index.d.ts +20 -0
- package/es/rc-qrcode/index.js +57 -0
- package/es/rc-qrcode/style/index.d.ts +1 -0
- package/es/rc-qrcode/style/index.js +0 -0
- package/es/rc-qrcode/useQrcode.d.ts +4 -0
- package/es/rc-qrcode/useQrcode.js +50 -0
- package/es/rc-transition-group/index.d.ts +2 -0
- package/es/rc-transition-group/index.js +2 -0
- package/es/rc-transition-group/style/index.d.ts +1 -0
- package/es/rc-transition-group/style/index.js +0 -0
- package/es/single-img-upload/index.d.ts +19 -0
- package/es/single-img-upload/index.js +199 -0
- package/es/single-img-upload/style/index.css +74 -0
- package/es/single-img-upload/style/index.d.ts +3 -0
- package/es/single-img-upload/style/index.js +3 -0
- package/es/single-img-upload/style/index.less +85 -0
- package/es/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
- package/es/sortable-hoc/demo/index.modules.less +248 -0
- package/es/sortable-hoc/index.d.ts +2 -0
- package/es/sortable-hoc/index.js +2 -0
- package/es/sortable-hoc/style/index.d.ts +1 -0
- package/es/sortable-hoc/style/index.js +0 -0
- package/es/split-pane/index.d.ts +59 -0
- package/es/split-pane/index.js +21 -0
- package/es/split-pane/style/index.css +41 -0
- package/es/split-pane/style/index.d.ts +1 -0
- package/es/split-pane/style/index.js +1 -0
- package/es/split-pane/style/index.less +49 -0
- package/es/text-area/index.d.ts +12 -0
- package/es/text-area/index.js +96 -0
- package/es/text-area/style/index.d.ts +1 -0
- package/es/text-area/style/index.js +1 -0
- package/es/text-input/index.d.ts +5 -0
- package/es/text-input/index.js +85 -0
- package/es/{number-input → text-input}/style/index.css +0 -3
- package/es/text-input/style/index.d.ts +1 -0
- package/es/text-input/style/index.js +1 -0
- package/es/{number-input → text-input}/style/index.less +0 -4
- package/lib/button-drawer/index.d.ts +10 -0
- package/lib/button-drawer/index.js +164 -0
- package/lib/button-drawer/style/index.d.ts +1 -0
- package/lib/button-drawer/style/index.js +7 -0
- package/lib/button-modal/index.d.ts +14 -0
- package/lib/button-modal/index.js +178 -0
- package/lib/button-modal/style/index.d.ts +1 -0
- package/lib/button-modal/style/index.js +7 -0
- package/lib/condition-input/index.d.ts +15 -0
- package/lib/condition-input/index.js +158 -0
- package/lib/condition-input/parse2RegexOption.d.ts +13 -0
- package/lib/condition-input/parse2RegexOption.js +72 -0
- package/lib/condition-input/style/index.d.ts +1 -0
- package/lib/condition-input/style/index.js +7 -0
- package/lib/copy-to-clipboard/index.d.ts +22 -0
- package/lib/copy-to-clipboard/index.js +143 -0
- package/lib/copy-to-clipboard/style/index.css +249 -0
- package/lib/copy-to-clipboard/style/index.d.ts +1 -0
- package/lib/copy-to-clipboard/style/index.js +7 -0
- package/lib/copy-to-clipboard/style/index.less +1 -0
- package/lib/highlight-textarea/HighlighedContents.d.ts +7 -0
- package/lib/highlight-textarea/HighlighedContents.js +29 -0
- package/lib/highlight-textarea/extractSpansOfClasses.d.ts +15 -0
- package/lib/highlight-textarea/extractSpansOfClasses.js +173 -0
- package/lib/highlight-textarea/getRanges.d.ts +2 -0
- package/lib/highlight-textarea/getRanges.js +156 -0
- package/lib/highlight-textarea/getType.d.ts +2 -0
- package/lib/highlight-textarea/getType.js +37 -0
- package/lib/highlight-textarea/index.d.ts +12 -0
- package/lib/highlight-textarea/index.js +183 -0
- package/lib/highlight-textarea/style/index.css +38 -0
- package/lib/highlight-textarea/style/index.d.ts +2 -0
- package/lib/highlight-textarea/style/index.js +9 -0
- package/lib/highlight-textarea/style/index.less +42 -0
- package/lib/highlight-textarea/types.d.ts +16 -0
- package/lib/highlight-textarea/types.js +5 -0
- package/lib/highlight-words/index.d.ts +3 -0
- package/lib/highlight-words/index.js +15 -0
- package/lib/highlight-words/style/index.d.ts +1 -0
- package/lib/highlight-words/style/index.js +0 -0
- package/lib/icon/demo/svg/check-circle-filled.svg +6 -0
- package/lib/icon/demo/svg/coin-circle.svg +9 -0
- package/lib/icon/index.d.ts +27 -0
- package/lib/icon/index.js +143 -0
- package/lib/icon/style/index.d.ts +1 -0
- package/lib/icon/style/index.js +0 -0
- package/lib/icon/utils.d.ts +6 -0
- package/lib/icon/utils.js +32 -0
- package/lib/img-crop/EasyCrop.d.ts +6 -0
- package/lib/img-crop/EasyCrop.js +160 -0
- package/lib/img-crop/getCroppedImg.d.ts +6 -0
- package/lib/img-crop/getCroppedImg.js +205 -0
- package/lib/img-crop/index.d.ts +53 -0
- package/lib/img-crop/index.js +582 -0
- package/lib/img-crop/style/index.css +52 -0
- package/lib/img-crop/style/index.d.ts +3 -0
- package/lib/img-crop/style/index.js +11 -0
- package/lib/img-crop/style/index.less +54 -0
- package/lib/index.d.ts +34 -2
- package/lib/index.js +160 -9
- package/lib/keep-tab/demo/index.modules.less +66 -0
- package/lib/keep-tab/index.d.ts +29 -0
- package/lib/keep-tab/index.js +181 -0
- package/lib/keep-tab/style/index.css +1129 -0
- package/lib/keep-tab/style/index.d.ts +2 -0
- package/lib/keep-tab/style/index.js +9 -0
- package/lib/keep-tab/style/index.less +2 -0
- package/lib/number-input/index.d.ts +22 -7
- package/lib/number-input/index.js +22 -11
- package/lib/number-input/style/index.d.ts +1 -1
- package/lib/number-input/style/index.js +1 -1
- package/lib/number-input/utils.d.ts +10 -11
- package/lib/number-input/utils.js +8 -8
- package/lib/rc-echart/core.d.ts +32 -0
- package/lib/rc-echart/core.js +185 -0
- package/lib/rc-echart/index.d.ts +21 -0
- package/lib/rc-echart/index.js +75 -0
- package/lib/rc-echart/style/index.d.ts +1 -0
- package/lib/rc-echart/style/index.js +0 -0
- package/lib/rc-motion/demo/CSSMotion.less +91 -0
- package/lib/rc-motion/index.d.ts +2 -0
- package/lib/rc-motion/index.js +43 -0
- package/lib/rc-motion/style/index.d.ts +1 -0
- package/lib/rc-motion/style/index.js +0 -0
- package/lib/rc-qrcode/index.d.ts +20 -0
- package/lib/rc-qrcode/index.js +108 -0
- package/lib/rc-qrcode/style/index.d.ts +1 -0
- package/lib/rc-qrcode/style/index.js +0 -0
- package/lib/rc-qrcode/useQrcode.d.ts +4 -0
- package/lib/rc-qrcode/useQrcode.js +66 -0
- package/lib/rc-transition-group/index.d.ts +2 -0
- package/lib/rc-transition-group/index.js +43 -0
- package/lib/rc-transition-group/style/index.d.ts +1 -0
- package/lib/rc-transition-group/style/index.js +0 -0
- package/lib/single-img-upload/index.d.ts +19 -0
- package/lib/single-img-upload/index.js +250 -0
- package/lib/single-img-upload/style/index.css +74 -0
- package/lib/single-img-upload/style/index.d.ts +3 -0
- package/lib/single-img-upload/style/index.js +11 -0
- package/lib/single-img-upload/style/index.less +85 -0
- package/lib/sortable-hoc/demo/VerticalListBase/index.modules.less +63 -0
- package/lib/sortable-hoc/demo/index.modules.less +248 -0
- package/lib/sortable-hoc/index.d.ts +2 -0
- package/lib/sortable-hoc/index.js +43 -0
- package/lib/sortable-hoc/style/index.d.ts +1 -0
- package/lib/sortable-hoc/style/index.js +0 -0
- package/lib/split-pane/index.d.ts +59 -0
- package/lib/split-pane/index.js +69 -0
- package/lib/split-pane/style/index.css +41 -0
- package/lib/split-pane/style/index.d.ts +1 -0
- package/lib/split-pane/style/index.js +7 -0
- package/lib/split-pane/style/index.less +49 -0
- package/lib/text-area/index.d.ts +12 -0
- package/lib/text-area/index.js +144 -0
- package/lib/text-area/style/index.d.ts +1 -0
- package/lib/text-area/style/index.js +7 -0
- package/lib/text-input/index.d.ts +5 -0
- package/lib/text-input/index.js +99 -0
- package/lib/{number-input → text-input}/style/index.css +0 -3
- package/lib/text-input/style/index.d.ts +1 -0
- package/lib/text-input/style/index.js +7 -0
- package/lib/{number-input → text-input}/style/index.less +0 -4
- package/package.json +20 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawerProps } from 'antd/lib/drawer';
|
|
3
|
+
export interface ButtonDrawerProps extends DrawerProps {
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onOpen: () => void;
|
|
6
|
+
content: React.ReactElement;
|
|
7
|
+
children: React.ReactElement;
|
|
8
|
+
}
|
|
9
|
+
declare const ForwardRefButtonDrawer: React.ForwardRefExoticComponent<ButtonDrawerProps & React.RefAttributes<unknown>>;
|
|
10
|
+
export default ForwardRefButtonDrawer;
|
|
@@ -0,0 +1,116 @@
|
|
|
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 __rest = this && this.__rest || function (s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
|
|
20
|
+
for (var p in s) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var __read = this && this.__read || function (o, n) {
|
|
31
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
32
|
+
if (!m) return o;
|
|
33
|
+
var i = m.call(o),
|
|
34
|
+
r,
|
|
35
|
+
ar = [],
|
|
36
|
+
e;
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
40
|
+
ar.push(r.value);
|
|
41
|
+
}
|
|
42
|
+
} catch (error) {
|
|
43
|
+
e = {
|
|
44
|
+
error: error
|
|
45
|
+
};
|
|
46
|
+
} finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
} finally {
|
|
50
|
+
if (e) throw e.error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return ar;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
import React, { useState, useRef, useImperativeHandle } from 'react';
|
|
58
|
+
import Drawer from 'antd/lib/drawer';
|
|
59
|
+
import classNames from 'classnames';
|
|
60
|
+
|
|
61
|
+
var ButtonDrawer = function ButtonDrawer(props, ref) {
|
|
62
|
+
var _a = __read(useState(false), 2),
|
|
63
|
+
drawerVisible = _a[0],
|
|
64
|
+
setDrawerVisible = _a[1];
|
|
65
|
+
|
|
66
|
+
var children = props.children,
|
|
67
|
+
onOpen = props.onOpen,
|
|
68
|
+
onClose = props.onClose,
|
|
69
|
+
content = props.content,
|
|
70
|
+
title = props.title,
|
|
71
|
+
className = props.className,
|
|
72
|
+
restProps = __rest(props, ["children", "onOpen", "onClose", "content", "title", "className"]);
|
|
73
|
+
|
|
74
|
+
var closeDrawer = function closeDrawer() {
|
|
75
|
+
if (onClose) {
|
|
76
|
+
onClose();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
setDrawerVisible(false);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var openDrawer = function openDrawer() {
|
|
83
|
+
if (onOpen) {
|
|
84
|
+
onOpen();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setDrawerVisible(true);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var actionRef = useRef({
|
|
91
|
+
close: function close() {
|
|
92
|
+
closeDrawer();
|
|
93
|
+
},
|
|
94
|
+
open: function open() {
|
|
95
|
+
openDrawer();
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
useImperativeHandle(ref, function () {
|
|
99
|
+
return actionRef.current;
|
|
100
|
+
}, [actionRef.current]);
|
|
101
|
+
var buttonNode = children && /*#__PURE__*/React.cloneElement(children, {
|
|
102
|
+
onClick: openDrawer
|
|
103
|
+
});
|
|
104
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, buttonNode, /*#__PURE__*/React.createElement(Drawer, __assign({
|
|
105
|
+
maskClosable: false,
|
|
106
|
+
className: classNames('button-drawer', className),
|
|
107
|
+
title: title,
|
|
108
|
+
onClose: closeDrawer,
|
|
109
|
+
visible: drawerVisible
|
|
110
|
+
}, restProps), /*#__PURE__*/React.cloneElement(content, {
|
|
111
|
+
drawerAction: actionRef.current
|
|
112
|
+
})));
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
var ForwardRefButtonDrawer = /*#__PURE__*/React.forwardRef(ButtonDrawer);
|
|
116
|
+
export default ForwardRefButtonDrawer; // export default React.memo(ButtonDrawer);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'antd/es/drawer/style';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '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,131 @@
|
|
|
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 __rest = this && this.__rest || function (s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
|
|
20
|
+
for (var p in s) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var __read = this && this.__read || function (o, n) {
|
|
31
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
32
|
+
if (!m) return o;
|
|
33
|
+
var i = m.call(o),
|
|
34
|
+
r,
|
|
35
|
+
ar = [],
|
|
36
|
+
e;
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
40
|
+
ar.push(r.value);
|
|
41
|
+
}
|
|
42
|
+
} catch (error) {
|
|
43
|
+
e = {
|
|
44
|
+
error: error
|
|
45
|
+
};
|
|
46
|
+
} finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
} finally {
|
|
50
|
+
if (e) throw e.error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return ar;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
import * as React from 'react';
|
|
58
|
+
import Modal from 'antd/lib/modal';
|
|
59
|
+
|
|
60
|
+
var ButtonModal = function ButtonModal(props, ref) {
|
|
61
|
+
var _a = __read(React.useState(false), 2),
|
|
62
|
+
visible = _a[0],
|
|
63
|
+
setModalVisible = _a[1];
|
|
64
|
+
|
|
65
|
+
var children = props.children,
|
|
66
|
+
content = props.content,
|
|
67
|
+
onOpen = props.onOpen,
|
|
68
|
+
onClose = props.onClose,
|
|
69
|
+
onOk = props.onOk,
|
|
70
|
+
onCancel = props.onCancel,
|
|
71
|
+
restModalProps = __rest(props, ["children", "content", "onOpen", "onClose", "onOk", "onCancel"]);
|
|
72
|
+
|
|
73
|
+
var openModal = function openModal() {
|
|
74
|
+
if (onOpen) {
|
|
75
|
+
onOpen();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
setModalVisible(true);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
var closeModal = function closeModal() {
|
|
82
|
+
if (onClose) {
|
|
83
|
+
onClose();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
setModalVisible(false);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var modalActionRef = React.useRef({
|
|
90
|
+
open: open,
|
|
91
|
+
close: close
|
|
92
|
+
});
|
|
93
|
+
React.useImperativeHandle(ref, function () {
|
|
94
|
+
return {
|
|
95
|
+
open: open,
|
|
96
|
+
close: close
|
|
97
|
+
};
|
|
98
|
+
}, [modalActionRef]);
|
|
99
|
+
|
|
100
|
+
var handleModalOk = function handleModalOk(e) {
|
|
101
|
+
if (onOk) {
|
|
102
|
+
return onOk(e);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
close();
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var handleModalCancel = function handleModalCancel(e) {
|
|
109
|
+
if (onCancel) {
|
|
110
|
+
onCancel(e);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
closeModal();
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var buttonNode = children && /*#__PURE__*/React.cloneElement(children, {
|
|
117
|
+
onClick: openModal
|
|
118
|
+
});
|
|
119
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, buttonNode, /*#__PURE__*/React.createElement(Modal, __assign({
|
|
120
|
+
visible: visible,
|
|
121
|
+
onOk: handleModalOk,
|
|
122
|
+
onCancel: handleModalCancel,
|
|
123
|
+
centered: true,
|
|
124
|
+
maskClosable: false
|
|
125
|
+
}, restModalProps), /*#__PURE__*/React.cloneElement(content, {
|
|
126
|
+
modalAction: modalActionRef.current
|
|
127
|
+
})));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
var ForwardRefButtonModal = /*#__PURE__*/React.forwardRef(ButtonModal);
|
|
131
|
+
export default ForwardRefButtonModal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'antd/es/modal/style';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '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,108 @@
|
|
|
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 __rest = this && this.__rest || function (s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
|
|
20
|
+
for (var p in s) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var __read = this && this.__read || function (o, n) {
|
|
31
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
32
|
+
if (!m) return o;
|
|
33
|
+
var i = m.call(o),
|
|
34
|
+
r,
|
|
35
|
+
ar = [],
|
|
36
|
+
e;
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
40
|
+
ar.push(r.value);
|
|
41
|
+
}
|
|
42
|
+
} catch (error) {
|
|
43
|
+
e = {
|
|
44
|
+
error: error
|
|
45
|
+
};
|
|
46
|
+
} finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
} finally {
|
|
50
|
+
if (e) throw e.error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return ar;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
import * as React from 'react';
|
|
58
|
+
import isArray from 'lodash/isArray';
|
|
59
|
+
import Input from 'antd/lib/input';
|
|
60
|
+
import isFunction from 'lodash/isFunction';
|
|
61
|
+
import parse2RegexOption from './parse2RegexOption';
|
|
62
|
+
|
|
63
|
+
var ConditionInput = function ConditionInput(props) {
|
|
64
|
+
var regexp = props.regexp,
|
|
65
|
+
formatter = props.formatter,
|
|
66
|
+
value = props.value,
|
|
67
|
+
onChange = props.onChange,
|
|
68
|
+
rest = __rest(props, ["regexp", "formatter", "value", "onChange"]);
|
|
69
|
+
|
|
70
|
+
var _a = __read(React.useState(''), 2),
|
|
71
|
+
stateValue = _a[0],
|
|
72
|
+
setStateValue = _a[1];
|
|
73
|
+
|
|
74
|
+
var resultValue = value === undefined ? stateValue : value;
|
|
75
|
+
|
|
76
|
+
var handleChange = function handleChange(e) {
|
|
77
|
+
var originalValue = e.target.value;
|
|
78
|
+
var resultRegexp = isArray(regexp) ? regexp : [regexp];
|
|
79
|
+
var nextValue = resultRegexp.reduce(function (cur, acc) {
|
|
80
|
+
var regexOption = parse2RegexOption(acc);
|
|
81
|
+
|
|
82
|
+
if (regexOption.isValid) {
|
|
83
|
+
return cur.replace(regexOption.pattern, regexOption.replacement);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return cur;
|
|
87
|
+
}, originalValue);
|
|
88
|
+
|
|
89
|
+
if (isFunction(formatter)) {
|
|
90
|
+
nextValue = formatter(nextValue);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (resultValue !== nextValue) {
|
|
94
|
+
setStateValue(nextValue);
|
|
95
|
+
|
|
96
|
+
if (onChange) {
|
|
97
|
+
onChange(nextValue);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return /*#__PURE__*/React.createElement(Input, __assign({
|
|
103
|
+
value: resultValue,
|
|
104
|
+
onChange: handleChange
|
|
105
|
+
}, rest));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export 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,57 @@
|
|
|
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
|
+
import isRegExp from 'lodash/isRegExp';
|
|
18
|
+
import isString from 'lodash/isString';
|
|
19
|
+
import isObject from 'lodash/isObject';
|
|
20
|
+
var defaultOptionValues = {
|
|
21
|
+
isValid: true,
|
|
22
|
+
replacement: ''
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var parseRegex2RegexOption = function parseRegex2RegexOption(regex, options) {
|
|
26
|
+
return __assign(__assign(__assign({}, defaultOptionValues), {
|
|
27
|
+
pattern: regex
|
|
28
|
+
}), options);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var parseString2RegexOption = function parseString2RegexOption(regexString, options) {
|
|
32
|
+
return parseRegex2RegexOption(new RegExp(regexString), options);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var parse2RegexOption = function parse2RegexOption(regex) {
|
|
36
|
+
if (isRegExp(regex)) {
|
|
37
|
+
return parseRegex2RegexOption(regex);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (isString(regex)) {
|
|
41
|
+
return parseString2RegexOption(regex);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (isObject(regex)) {
|
|
45
|
+
return __assign(__assign(__assign({}, defaultOptionValues), {
|
|
46
|
+
isValid: !!regex.pattern
|
|
47
|
+
}), regex);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
isValid: false,
|
|
52
|
+
replacement: '',
|
|
53
|
+
pattern: /./
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default parse2RegexOption;
|