@ccs-ui/rc-pro 1.1.24-beta-17 → 1.1.24-beta-19
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/aj-captcha/index.d.ts +31 -0
- package/es/aj-captcha/index.js +270 -0
- package/es/aj-captcha/index.less +105 -0
- package/es/dialog/HookModal.d.ts +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/interval-button/index.d.ts +10 -13
- package/es/interval-button/index.js +11 -4
- package/es/layout-single-page/index.less +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
type Point = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
export type AjCaptchaProps = {
|
|
7
|
+
/** 打开验证弹框 */
|
|
8
|
+
open: boolean;
|
|
9
|
+
/** sliding|wordSelect,滑动窗口、文字点选 */
|
|
10
|
+
captchaType: 'sliding' | 'wordSelect';
|
|
11
|
+
/** 背景图片 */
|
|
12
|
+
bgImg?: string;
|
|
13
|
+
/** 滑块图片 */
|
|
14
|
+
sliderImg?: string;
|
|
15
|
+
/** 文字选择 */
|
|
16
|
+
words?: string[];
|
|
17
|
+
/** 图片加载loading */
|
|
18
|
+
loadingImg: boolean;
|
|
19
|
+
/** 校验loading */
|
|
20
|
+
loadingValid: boolean;
|
|
21
|
+
/** 校验结果 */
|
|
22
|
+
validErrorMsg?: string;
|
|
23
|
+
/** 关闭验证弹框 */
|
|
24
|
+
onCancel: () => void;
|
|
25
|
+
/** 刷新验证图片 */
|
|
26
|
+
onRefresh: () => void;
|
|
27
|
+
/** 校验方法 */
|
|
28
|
+
onValid: (point: Point | Point[], captchaType: 'sliding' | 'wordSelect') => void;
|
|
29
|
+
};
|
|
30
|
+
export default function AjCaptcha(props: AjCaptchaProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import { Button, Modal, Spin } from 'antd';
|
|
18
|
+
import "./index.less";
|
|
19
|
+
import { useEffect, useRef, useState } from 'react';
|
|
20
|
+
import { CloseOutlined, LeftOutlined, LoadingOutlined, ReloadOutlined, RightOutlined } from '@ant-design/icons';
|
|
21
|
+
import { useEventListener } from 'ahooks';
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
25
|
+
function ShowMsg(_ref) {
|
|
26
|
+
var msg = _ref.msg;
|
|
27
|
+
var _useState = useState(true),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
visible = _useState2[0],
|
|
30
|
+
setVisible = _useState2[1];
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
if (msg) {
|
|
33
|
+
setTimeout(function () {
|
|
34
|
+
setVisible(false);
|
|
35
|
+
}, 1000);
|
|
36
|
+
}
|
|
37
|
+
}, []);
|
|
38
|
+
return visible ? msg : '';
|
|
39
|
+
}
|
|
40
|
+
function AjCaptchaSliding(_ref2) {
|
|
41
|
+
var bgImg = _ref2.bgImg,
|
|
42
|
+
sliderImg = _ref2.sliderImg,
|
|
43
|
+
loadingImg = _ref2.loadingImg,
|
|
44
|
+
loadingValid = _ref2.loadingValid,
|
|
45
|
+
validErrorMsg = _ref2.validErrorMsg,
|
|
46
|
+
onValid = _ref2.onValid,
|
|
47
|
+
onCancel = _ref2.onCancel,
|
|
48
|
+
onRefresh = _ref2.onRefresh;
|
|
49
|
+
var sliderBarRef = useRef(null);
|
|
50
|
+
var sliderImgRef = useRef(null);
|
|
51
|
+
var moveRef = useRef({
|
|
52
|
+
start: false,
|
|
53
|
+
startX: 0
|
|
54
|
+
});
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
moveRef.current = {
|
|
57
|
+
start: false,
|
|
58
|
+
startX: 0
|
|
59
|
+
};
|
|
60
|
+
sliderBarRef.current.style.left = '0px';
|
|
61
|
+
sliderImgRef.current.style.left = '0px';
|
|
62
|
+
}, [sliderImg]);
|
|
63
|
+
var onChangePosition = function onChangePosition(offsetX) {
|
|
64
|
+
if (offsetX < 0) {
|
|
65
|
+
sliderBarRef.current.style.left = '0px';
|
|
66
|
+
sliderImgRef.current.style.left = '0px';
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
var left = offsetX > 263 ? '263px' : "".concat(offsetX, "px");
|
|
70
|
+
sliderBarRef.current.style.left = left;
|
|
71
|
+
sliderImgRef.current.style.left = left;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// 开始
|
|
75
|
+
useEventListener('mousedown', function (e) {
|
|
76
|
+
if (loadingValid) return;
|
|
77
|
+
if (!moveRef.current.startX) {
|
|
78
|
+
moveRef.current.startX = e.clientX;
|
|
79
|
+
}
|
|
80
|
+
moveRef.current.start = true;
|
|
81
|
+
}, {
|
|
82
|
+
target: sliderBarRef
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// 移动
|
|
86
|
+
useEventListener('mousemove', function (e) {
|
|
87
|
+
if (moveRef.current.start) {
|
|
88
|
+
var offsetX = e.clientX - moveRef.current.startX;
|
|
89
|
+
onChangePosition(offsetX);
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
target: sliderBarRef
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// 结束
|
|
96
|
+
useEventListener('mouseup', function (e) {
|
|
97
|
+
var offsetX = e.clientX - moveRef.current.startX;
|
|
98
|
+
// 触发校验
|
|
99
|
+
onValid({
|
|
100
|
+
x: offsetX,
|
|
101
|
+
y: 5
|
|
102
|
+
}, 'sliding');
|
|
103
|
+
moveRef.current.start = false;
|
|
104
|
+
}, {
|
|
105
|
+
target: sliderBarRef
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// 离开
|
|
109
|
+
useEventListener('mouseleave', function () {
|
|
110
|
+
moveRef.current.start = false;
|
|
111
|
+
}, {
|
|
112
|
+
target: sliderBarRef
|
|
113
|
+
});
|
|
114
|
+
return /*#__PURE__*/_jsxs(Spin, {
|
|
115
|
+
indicator: /*#__PURE__*/_jsx(LoadingOutlined, {
|
|
116
|
+
style: {
|
|
117
|
+
fontSize: 24
|
|
118
|
+
}
|
|
119
|
+
}),
|
|
120
|
+
spinning: loadingImg,
|
|
121
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
122
|
+
className: "ccs-aj-body",
|
|
123
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
124
|
+
className: "ccs-aj-bg",
|
|
125
|
+
src: bgImg ? "data:image/png;base64,".concat(bgImg) : undefined,
|
|
126
|
+
width: 310,
|
|
127
|
+
height: 155
|
|
128
|
+
}), /*#__PURE__*/_jsx("img", {
|
|
129
|
+
ref: sliderImgRef,
|
|
130
|
+
className: "ccs-aj-slider-img",
|
|
131
|
+
style: {
|
|
132
|
+
height: 155
|
|
133
|
+
},
|
|
134
|
+
src: sliderImg ? "data:image/png;base64,".concat(sliderImg) : undefined
|
|
135
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
136
|
+
className: "ccs-aj-btn",
|
|
137
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
138
|
+
onClick: onRefresh,
|
|
139
|
+
type: "text",
|
|
140
|
+
icon: /*#__PURE__*/_jsx(ReloadOutlined, {})
|
|
141
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
142
|
+
className: "ccs-aj-error",
|
|
143
|
+
children: /*#__PURE__*/_jsx(ShowMsg, {
|
|
144
|
+
msg: validErrorMsg
|
|
145
|
+
}, sliderImg)
|
|
146
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
147
|
+
onClick: onCancel,
|
|
148
|
+
type: "text",
|
|
149
|
+
icon: /*#__PURE__*/_jsx(CloseOutlined, {})
|
|
150
|
+
})]
|
|
151
|
+
})]
|
|
152
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
153
|
+
className: "ccs-aj-slider",
|
|
154
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
155
|
+
className: "ccs-aj-slider-track",
|
|
156
|
+
children: "\u6309\u4F4F\u6ED1\u5757\uFF0C\u62D6\u52A8\u5B8C\u6210\u4E0A\u65B9\u62FC\u56FE"
|
|
157
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
158
|
+
className: "ccs-aj-slider-bar",
|
|
159
|
+
ref: sliderBarRef,
|
|
160
|
+
children: loadingValid ? /*#__PURE__*/_jsx(LoadingOutlined, {}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
161
|
+
children: [/*#__PURE__*/_jsx(LeftOutlined, {}), /*#__PURE__*/_jsx(RightOutlined, {})]
|
|
162
|
+
})
|
|
163
|
+
})]
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function AjCaptchaWord(_ref3) {
|
|
168
|
+
var bgImg = _ref3.bgImg,
|
|
169
|
+
words = _ref3.words,
|
|
170
|
+
loadingImg = _ref3.loadingImg,
|
|
171
|
+
loadingValid = _ref3.loadingValid,
|
|
172
|
+
validErrorMsg = _ref3.validErrorMsg,
|
|
173
|
+
onValid = _ref3.onValid,
|
|
174
|
+
onCancel = _ref3.onCancel,
|
|
175
|
+
onRefresh = _ref3.onRefresh;
|
|
176
|
+
var bgImgRef = useRef(null);
|
|
177
|
+
var _useState3 = useState([]),
|
|
178
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
179
|
+
points = _useState4[0],
|
|
180
|
+
setPoints = _useState4[1];
|
|
181
|
+
useEffect(function () {
|
|
182
|
+
setPoints([]);
|
|
183
|
+
}, [bgImg]);
|
|
184
|
+
|
|
185
|
+
// 结束
|
|
186
|
+
useEventListener('mouseup', function (e) {
|
|
187
|
+
setPoints([].concat(_toConsumableArray(points), [{
|
|
188
|
+
x: e.offsetX,
|
|
189
|
+
y: e.offsetY
|
|
190
|
+
}]));
|
|
191
|
+
}, {
|
|
192
|
+
target: bgImgRef
|
|
193
|
+
});
|
|
194
|
+
useEffect(function () {
|
|
195
|
+
if (points.length === (words === null || words === void 0 ? void 0 : words.length)) {
|
|
196
|
+
onValid(points, 'wordSelect');
|
|
197
|
+
}
|
|
198
|
+
}, [points.length]);
|
|
199
|
+
return /*#__PURE__*/_jsxs(Spin, {
|
|
200
|
+
indicator: /*#__PURE__*/_jsx(LoadingOutlined, {
|
|
201
|
+
style: {
|
|
202
|
+
fontSize: 24
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
spinning: loadingImg || loadingValid,
|
|
206
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
207
|
+
className: "ccs-aj-body",
|
|
208
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
209
|
+
ref: bgImgRef,
|
|
210
|
+
className: "ccs-aj-bg",
|
|
211
|
+
src: bgImg ? "data:image/png;base64,".concat(bgImg) : undefined,
|
|
212
|
+
width: 310,
|
|
213
|
+
height: 155
|
|
214
|
+
}), points.map(function (point, index) {
|
|
215
|
+
return /*#__PURE__*/_jsx("div", {
|
|
216
|
+
className: "ccs-word-point",
|
|
217
|
+
style: {
|
|
218
|
+
left: point.x - 13,
|
|
219
|
+
top: point.y - 13
|
|
220
|
+
},
|
|
221
|
+
children: index + 1
|
|
222
|
+
}, point.x);
|
|
223
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
224
|
+
className: "ccs-aj-btn",
|
|
225
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
226
|
+
onClick: onRefresh,
|
|
227
|
+
type: "text",
|
|
228
|
+
icon: /*#__PURE__*/_jsx(ReloadOutlined, {})
|
|
229
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
230
|
+
className: "ccs-aj-error",
|
|
231
|
+
children: /*#__PURE__*/_jsx(ShowMsg, {
|
|
232
|
+
msg: validErrorMsg
|
|
233
|
+
}, bgImg)
|
|
234
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
235
|
+
onClick: onCancel,
|
|
236
|
+
type: "text",
|
|
237
|
+
icon: /*#__PURE__*/_jsx(CloseOutlined, {})
|
|
238
|
+
})]
|
|
239
|
+
})]
|
|
240
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
241
|
+
className: "ccs-aj-word-slider",
|
|
242
|
+
children: ["\u8BF7\u4F9D\u6B21\u70B9\u51FB\u3010", words === null || words === void 0 ? void 0 : words.join(', '), "\u3011"]
|
|
243
|
+
})]
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
export default function AjCaptcha(props) {
|
|
247
|
+
var bodyPadding = props.captchaType === 'sliding' ? '10px 10px 0 10px' : 10;
|
|
248
|
+
return /*#__PURE__*/_jsx(Modal, {
|
|
249
|
+
width: 330,
|
|
250
|
+
open: props.open,
|
|
251
|
+
destroyOnClose: true,
|
|
252
|
+
onCancel: props.onCancel,
|
|
253
|
+
footer: null,
|
|
254
|
+
closable: false,
|
|
255
|
+
maskClosable: false,
|
|
256
|
+
styles: {
|
|
257
|
+
body: {
|
|
258
|
+
padding: bodyPadding
|
|
259
|
+
},
|
|
260
|
+
mask: {
|
|
261
|
+
backgroundColor: 'rgba(0, 0, 0, 0.25)'
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
className: "ccs-aj-modal",
|
|
265
|
+
style: {
|
|
266
|
+
top: 'calc(50vh - 200px)'
|
|
267
|
+
},
|
|
268
|
+
children: props.captchaType === 'sliding' ? /*#__PURE__*/_jsx(AjCaptchaSliding, _objectSpread({}, props)) : /*#__PURE__*/_jsx(AjCaptchaWord, _objectSpread({}, props))
|
|
269
|
+
});
|
|
270
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
.ccs-aj-modal {
|
|
2
|
+
.ccs-aj-bg {
|
|
3
|
+
-webkit-user-drag: none;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ant-modal-close {
|
|
7
|
+
top: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
width: 20px;
|
|
10
|
+
height: 20px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ccs-aj-slider-img {
|
|
14
|
+
position: absolute;
|
|
15
|
+
-webkit-user-drag: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ccs-aj-body {
|
|
19
|
+
position: relative;
|
|
20
|
+
background-color: #f5f6f7;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ccs-aj-btn {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
margin-top: 5px;
|
|
27
|
+
align-items: center;
|
|
28
|
+
|
|
29
|
+
.ant-btn {
|
|
30
|
+
color: #6d6c6c;
|
|
31
|
+
|
|
32
|
+
&:first-child {
|
|
33
|
+
flex: 0 0 auto;
|
|
34
|
+
margin-right: 5px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:last-child {
|
|
38
|
+
flex: 0 0 auto;
|
|
39
|
+
margin-left: 5px;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ccs-aj-error {
|
|
45
|
+
color: red;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ccs-aj-slider {
|
|
49
|
+
position: relative;
|
|
50
|
+
height: 40px;
|
|
51
|
+
background-color: #fff;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ccs-aj-slider-track {
|
|
55
|
+
height: 30px;
|
|
56
|
+
margin-top: 10px;
|
|
57
|
+
background-color: #f5f6f7;
|
|
58
|
+
text-align: center;
|
|
59
|
+
line-height: 30px;
|
|
60
|
+
border-radius: 15px;
|
|
61
|
+
user-select: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ccs-aj-slider-bar {
|
|
65
|
+
height: 40px;
|
|
66
|
+
width: 40px;
|
|
67
|
+
position: absolute;
|
|
68
|
+
bottom: 5px;
|
|
69
|
+
background: #fff;
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
color: gray;
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
box-shadow: 0 0 3px #ccc;
|
|
77
|
+
background-color: #f5f6f7;
|
|
78
|
+
border: 1px solid #e1e1e1;
|
|
79
|
+
cursor: move;
|
|
80
|
+
|
|
81
|
+
&:hover {
|
|
82
|
+
box-shadow: rgb(102, 102, 102) 0 0 8px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ccs-aj-word-slider {
|
|
87
|
+
color: #52c41a;
|
|
88
|
+
text-align: center;
|
|
89
|
+
border: 1px solid #52c41a;
|
|
90
|
+
height: 36px;
|
|
91
|
+
line-height: 36px;
|
|
92
|
+
margin-top: 10px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ccs-word-point {
|
|
96
|
+
background-color: #52c41a;
|
|
97
|
+
border-radius: 15px;
|
|
98
|
+
width: 26px;
|
|
99
|
+
height: 26px;
|
|
100
|
+
line-height: 26px;
|
|
101
|
+
text-align: center;
|
|
102
|
+
color: #fff;
|
|
103
|
+
position: absolute;
|
|
104
|
+
}
|
|
105
|
+
}
|
package/es/dialog/HookModal.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { FormProps } from 'antd';
|
|
3
3
|
import { DialogFormRef } from './form';
|
|
4
4
|
import { CcsDialogModal, CcsDialogModalProps } from './hook';
|
|
5
|
-
export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "
|
|
5
|
+
export declare const DialogSelfButton: ({ auth, formRef, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "onCancel" | "auth" | "request" | "onRequestBefore"> & {
|
|
6
6
|
formRef: React.RefObject<DialogFormRef>;
|
|
7
7
|
formInitialValues: FormProps['initialValues'];
|
|
8
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ButtonProps } from 'antd';
|
|
2
|
-
type
|
|
3
|
+
export type IntervalBtnInstance = {
|
|
4
|
+
onStart: () => void;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("react").ForwardRefExoticComponent<ButtonProps & {
|
|
3
7
|
/** 计时数 */
|
|
4
|
-
num?: number;
|
|
8
|
+
num?: number | undefined;
|
|
5
9
|
/** 包含字符串`num`的文本内容 */
|
|
6
|
-
disabledText?: string;
|
|
10
|
+
disabledText?: string | undefined;
|
|
7
11
|
/** 缓存key */
|
|
8
|
-
cacheKey?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
* 倒计时按钮组件
|
|
12
|
-
* @param PropsType
|
|
13
|
-
* @param IntervalInstance
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
declare function IntervalButton({ num, cacheKey, disabledText, children, ...restProps }: CcsIntervalButton): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
-
export default IntervalButton;
|
|
12
|
+
cacheKey?: string | undefined;
|
|
13
|
+
} & import("react").RefAttributes<IntervalBtnInstance>>;
|
|
14
|
+
export default _default;
|
|
@@ -18,7 +18,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
18
18
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
19
|
import { useInterval } from 'ahooks';
|
|
20
20
|
import { Button } from 'antd';
|
|
21
|
-
import { useLayoutEffect, useMemo, useState } from 'react';
|
|
21
|
+
import { forwardRef, useImperativeHandle, useLayoutEffect, useMemo, useState } from 'react';
|
|
22
22
|
import { CcsUtils } from "../";
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
/**
|
|
@@ -27,7 +27,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
27
27
|
* @param IntervalInstance
|
|
28
28
|
* @returns
|
|
29
29
|
*/
|
|
30
|
-
function IntervalButton(_ref) {
|
|
30
|
+
function IntervalButton(_ref, ref) {
|
|
31
31
|
var _ref$num = _ref.num,
|
|
32
32
|
num = _ref$num === void 0 ? 60 : _ref$num,
|
|
33
33
|
cacheKey = _ref.cacheKey,
|
|
@@ -99,6 +99,8 @@ function IntervalButton(_ref) {
|
|
|
99
99
|
immediate: true
|
|
100
100
|
});
|
|
101
101
|
var disabled = count !== 0 && count !== num;
|
|
102
|
+
|
|
103
|
+
// 开始计时
|
|
102
104
|
var onStart = function onStart() {
|
|
103
105
|
setCodeInterval(1000);
|
|
104
106
|
if (key) {
|
|
@@ -108,12 +110,17 @@ function IntervalButton(_ref) {
|
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
112
|
};
|
|
113
|
+
useImperativeHandle(ref, function () {
|
|
114
|
+
return {
|
|
115
|
+
onStart: onStart
|
|
116
|
+
};
|
|
117
|
+
});
|
|
111
118
|
return count === -1 ? null : /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
112
119
|
type: "primary"
|
|
113
120
|
}, restProps), {}, {
|
|
114
|
-
onClick: onStart,
|
|
121
|
+
onClick: restProps.onClick ? restProps.onClick : onStart,
|
|
115
122
|
disabled: restProps.disabled ? true : disabled,
|
|
116
123
|
children: disabled ? "".concat(count, "\u79D2").concat(disabledText) : "".concat(children)
|
|
117
124
|
}));
|
|
118
125
|
}
|
|
119
|
-
export default IntervalButton;
|
|
126
|
+
export default /*#__PURE__*/forwardRef(IntervalButton);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ccs-ui/rc-pro",
|
|
3
|
-
"version": "1.1.24-beta-
|
|
4
|
-
"description": "修复table双滚动条问题;修复modal按钮无间距问题;修改antd组件过期参数使用问题;修复ccs date-picker插件bug;colorful
|
|
3
|
+
"version": "1.1.24-beta-19",
|
|
4
|
+
"description": "修复table双滚动条问题;修复modal按钮无间距问题;修改antd组件过期参数使用问题;修复ccs date-picker插件bug;colorful 主题组件样式调整;添加单页布局模式;倒计时按钮组件添加实例方法;添加滑块验证码组件;",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Hong",
|