@kdcloudjs/kdesign 1.7.59 → 1.7.60
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/CHANGELOG.md +3 -12
- package/dist/kdesign-complete.less +126 -1
- package/dist/kdesign.css +212 -1
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +2118 -83
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +2 -2
- package/dist/kdesign.min.js +16 -12
- package/dist/kdesign.min.js.map +1 -1
- package/es/_utils/domUtil.d.ts +2 -0
- package/es/_utils/domUtil.js +15 -0
- package/es/cascader/cascader.js +41 -10
- package/es/config-provider/compDefaultProps.d.ts +7 -0
- package/es/config-provider/compDefaultProps.js +7 -0
- package/es/date-picker/date-picker.js +19 -17
- package/es/date-picker/hooks/use-range-view-dates.js +8 -2
- package/es/date-picker/range-picker.js +4 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/locale/locale.d.ts +5 -0
- package/es/locale/zh-CN.d.ts +5 -0
- package/es/locale/zh-CN.js +6 -1
- package/es/signature/drawingBoard.d.ts +15 -0
- package/es/signature/drawingBoard.js +163 -0
- package/es/signature/index.d.ts +3 -0
- package/es/signature/index.js +3 -0
- package/es/signature/signature.d.ts +32 -0
- package/es/signature/signature.js +268 -0
- package/es/signature/style/css.js +2 -0
- package/es/signature/style/index.css +210 -0
- package/es/signature/style/index.d.ts +2 -0
- package/es/signature/style/index.js +2 -0
- package/es/signature/style/index.less +95 -0
- package/es/signature/style/mixin.less +6 -0
- package/es/signature/style/token.less +22 -0
- package/es/signature/utils/signature_pad.d.ts +106 -0
- package/es/signature/utils/signature_pad.js +690 -0
- package/es/style/themes/default.less +1 -1
- package/lib/_utils/domUtil.d.ts +2 -0
- package/lib/_utils/domUtil.js +23 -0
- package/lib/cascader/cascader.js +41 -10
- package/lib/config-provider/compDefaultProps.d.ts +7 -0
- package/lib/config-provider/compDefaultProps.js +7 -0
- package/lib/date-picker/date-picker.js +18 -16
- package/lib/date-picker/hooks/use-range-view-dates.js +7 -1
- package/lib/date-picker/range-picker.js +4 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -0
- package/lib/locale/locale.d.ts +5 -0
- package/lib/locale/zh-CN.d.ts +5 -0
- package/lib/locale/zh-CN.js +6 -1
- package/lib/signature/drawingBoard.d.ts +15 -0
- package/lib/signature/drawingBoard.js +176 -0
- package/lib/signature/index.d.ts +3 -0
- package/lib/signature/index.js +27 -0
- package/lib/signature/signature.d.ts +32 -0
- package/lib/signature/signature.js +282 -0
- package/lib/signature/style/css.js +4 -0
- package/lib/signature/style/index.css +210 -0
- package/lib/signature/style/index.d.ts +2 -0
- package/lib/signature/style/index.js +4 -0
- package/lib/signature/style/index.less +95 -0
- package/lib/signature/style/mixin.less +6 -0
- package/lib/signature/style/token.less +22 -0
- package/lib/signature/utils/signature_pad.d.ts +106 -0
- package/lib/signature/utils/signature_pad.js +697 -0
- package/lib/style/components.less +1 -0
- package/lib/style/themes/default.less +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
3
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
4
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
5
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
6
|
+
var t = {};
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
8
|
+
if (s != null && typeof _Object$getOwnPropertySymbols === "function") for (var i = 0, p = _Object$getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import React, { useContext, useState, useRef, useEffect } from 'react';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import SignaturePad from './utils/signature_pad';
|
|
16
|
+
import Modal from '../modal';
|
|
17
|
+
import Icon from '../icon';
|
|
18
|
+
import Image from '../image';
|
|
19
|
+
import Button from '../button';
|
|
20
|
+
import DrawingBoard from './drawingBoard';
|
|
21
|
+
import ConfigContext from '../config-provider/ConfigContext';
|
|
22
|
+
import { getCompProps } from '../_utils';
|
|
23
|
+
import { useResizeObserver } from '../_utils/hooks';
|
|
24
|
+
import { tuple } from '../_utils/type';
|
|
25
|
+
export var DataUrlTypes = tuple('png', 'jpeg', 'svg');
|
|
26
|
+
var typeMapping = {
|
|
27
|
+
png: 'image/png',
|
|
28
|
+
jpeg: 'image/jpeg',
|
|
29
|
+
svg: 'image/svg+xml'
|
|
30
|
+
};
|
|
31
|
+
var Signature = function Signature(props) {
|
|
32
|
+
var _classNames2;
|
|
33
|
+
var _useContext = useContext(ConfigContext),
|
|
34
|
+
getPrefixCls = _useContext.getPrefixCls,
|
|
35
|
+
prefixCls = _useContext.prefixCls,
|
|
36
|
+
userDefaultProps = _useContext.compDefaultProps,
|
|
37
|
+
locale = _useContext.locale;
|
|
38
|
+
var signatureProps = getCompProps('Signature', userDefaultProps, props);
|
|
39
|
+
var signatureLangMsg = locale.getCompLangMsg({
|
|
40
|
+
componentName: 'Signature'
|
|
41
|
+
});
|
|
42
|
+
var className = signatureProps.className,
|
|
43
|
+
style = signatureProps.style,
|
|
44
|
+
customPrefixcls = signatureProps.prefixCls,
|
|
45
|
+
containerWidth = signatureProps.containerWidth,
|
|
46
|
+
containerHeight = signatureProps.containerHeight,
|
|
47
|
+
getSignatureData = signatureProps.getSignatureData,
|
|
48
|
+
onStart = signatureProps.onStart,
|
|
49
|
+
onEnd = signatureProps.onEnd,
|
|
50
|
+
onClear = signatureProps.onClear,
|
|
51
|
+
undo = signatureProps.undo,
|
|
52
|
+
redo = signatureProps.redo,
|
|
53
|
+
penColor = signatureProps.penColor,
|
|
54
|
+
backgroundColor = signatureProps.backgroundColor,
|
|
55
|
+
_signatureProps$dataU = signatureProps.dataUrlType,
|
|
56
|
+
dataUrlType = _signatureProps$dataU === void 0 ? 'png' : _signatureProps$dataU,
|
|
57
|
+
title = signatureProps.title,
|
|
58
|
+
onClose = signatureProps.onClose,
|
|
59
|
+
disabled = signatureProps.disabled,
|
|
60
|
+
preview = signatureProps.preview,
|
|
61
|
+
canFullScreen = signatureProps.canFullScreen,
|
|
62
|
+
restProps = __rest(signatureProps, ["className", "style", "prefixCls", "containerWidth", "containerHeight", "getSignatureData", "onStart", "onEnd", "onClear", "undo", "redo", "penColor", "backgroundColor", "dataUrlType", "title", "onClose", "disabled", "preview", "canFullScreen"]);
|
|
63
|
+
var signaturePrefixCls = getPrefixCls(prefixCls, 'signature', customPrefixcls);
|
|
64
|
+
var signatureClass = classNames(signaturePrefixCls, className, _defineProperty({}, "".concat(signaturePrefixCls, "-disabled"), disabled));
|
|
65
|
+
var _useState = useState(false),
|
|
66
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
67
|
+
modalVisible = _useState2[0],
|
|
68
|
+
setModalVisible = _useState2[1];
|
|
69
|
+
var _useState3 = useState(''),
|
|
70
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
71
|
+
dataUrl = _useState4[0],
|
|
72
|
+
setDataUrl = _useState4[1];
|
|
73
|
+
var _useState5 = useState(true),
|
|
74
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
75
|
+
isEmpty = _useState6[0],
|
|
76
|
+
setIsEmpty = _useState6[1];
|
|
77
|
+
var _useState7 = useState(false),
|
|
78
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
79
|
+
isFullScreen = _useState8[0],
|
|
80
|
+
setIsFullScreen = _useState8[1];
|
|
81
|
+
var modalRef = useRef();
|
|
82
|
+
var modalBodyRef = useRef();
|
|
83
|
+
var triggerRef = useRef();
|
|
84
|
+
var signaturePadRef = useRef();
|
|
85
|
+
var handleOnClick = function handleOnClick() {
|
|
86
|
+
if (disabled) return;
|
|
87
|
+
setModalVisible(true);
|
|
88
|
+
};
|
|
89
|
+
var setJpegBgColor = function setJpegBgColor() {
|
|
90
|
+
var canvas = modalBodyRef.current.getCanvasRef();
|
|
91
|
+
var ctx = canvas.getContext('2d');
|
|
92
|
+
ctx.globalCompositeOperation = 'destination-over';
|
|
93
|
+
ctx.fillStyle = backgroundColor;
|
|
94
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
95
|
+
};
|
|
96
|
+
var handleModalOk = function handleModalOk() {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
var type = typeMapping[dataUrlType] || '';
|
|
99
|
+
if (type === 'image/jpeg') setJpegBgColor();
|
|
100
|
+
var result = (_a = signaturePadRef.current) === null || _a === void 0 ? void 0 : _a.toDataURL(type);
|
|
101
|
+
result && setDataUrl(result);
|
|
102
|
+
getSignatureData && getSignatureData(result);
|
|
103
|
+
(_b = signaturePadRef.current) === null || _b === void 0 ? void 0 : _b.clear();
|
|
104
|
+
setModalVisible(false);
|
|
105
|
+
};
|
|
106
|
+
var handleDelete = function handleDelete() {
|
|
107
|
+
if (disabled) return;
|
|
108
|
+
setDataUrl('');
|
|
109
|
+
};
|
|
110
|
+
var handleModalCancel = function handleModalCancel() {
|
|
111
|
+
onClose && onClose();
|
|
112
|
+
setModalVisible(false);
|
|
113
|
+
};
|
|
114
|
+
var handleFullScreen = function handleFullScreen(type) {
|
|
115
|
+
setIsFullScreen(true);
|
|
116
|
+
type === 'open' ? setIsFullScreen(true) : setIsFullScreen(false);
|
|
117
|
+
};
|
|
118
|
+
useResizeObserver(modalRef.current, function (rect) {
|
|
119
|
+
var width = rect.width,
|
|
120
|
+
height = rect.height;
|
|
121
|
+
var canvas = modalBodyRef.current.getCanvasRef();
|
|
122
|
+
canvas.width = width - 40;
|
|
123
|
+
canvas.height = height - 142;
|
|
124
|
+
});
|
|
125
|
+
useEffect(function () {
|
|
126
|
+
if (modalBodyRef.current) {
|
|
127
|
+
var canvas = modalBodyRef.current.getCanvasRef();
|
|
128
|
+
signaturePadRef.current = new SignaturePad(canvas, {
|
|
129
|
+
penColor: penColor
|
|
130
|
+
});
|
|
131
|
+
signaturePadRef.current.addEventListener('beginStroke', function () {
|
|
132
|
+
setIsEmpty(false);
|
|
133
|
+
onStart && onStart();
|
|
134
|
+
});
|
|
135
|
+
signaturePadRef.current.addEventListener('endStroke', function () {
|
|
136
|
+
modalBodyRef.current.saveSignatureToHistory();
|
|
137
|
+
onEnd && onEnd();
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return function () {
|
|
141
|
+
if (signaturePadRef.current) {
|
|
142
|
+
signaturePadRef.current.off();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}, []);
|
|
146
|
+
useEffect(function () {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
if (modalVisible) {
|
|
149
|
+
(_a = signaturePadRef.current) === null || _a === void 0 ? void 0 : _a.on();
|
|
150
|
+
modalBodyRef.current.saveSignatureToHistory();
|
|
151
|
+
} else {
|
|
152
|
+
(_b = signaturePadRef.current) === null || _b === void 0 ? void 0 : _b.off();
|
|
153
|
+
modalBodyRef.current.setSignatureHistory([]);
|
|
154
|
+
modalBodyRef.current.setCurrentHistoryIndex(-1);
|
|
155
|
+
}
|
|
156
|
+
}, [modalVisible]);
|
|
157
|
+
useEffect(function () {
|
|
158
|
+
signaturePadRef.current && (signaturePadRef.current.penColor = penColor);
|
|
159
|
+
}, [penColor]);
|
|
160
|
+
var DrawingBoardProps = {
|
|
161
|
+
prefixCls: signaturePrefixCls,
|
|
162
|
+
signatureLangMsg: signatureLangMsg,
|
|
163
|
+
undo: undo,
|
|
164
|
+
redo: redo,
|
|
165
|
+
isEmpty: isEmpty,
|
|
166
|
+
onClear: onClear,
|
|
167
|
+
setDataUrl: setDataUrl,
|
|
168
|
+
setIsEmpty: setIsEmpty,
|
|
169
|
+
signaturePad: function signaturePad() {
|
|
170
|
+
return signaturePadRef.current;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var modalClasses = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(signaturePrefixCls, "-modal"), true), _defineProperty(_classNames2, "".concat(signaturePrefixCls, "-modal-fullscreen"), isFullScreen), _classNames2));
|
|
174
|
+
var footer = /*#__PURE__*/React.createElement("div", {
|
|
175
|
+
className: "".concat(signaturePrefixCls, "-modal-footer")
|
|
176
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
177
|
+
onClick: handleModalCancel
|
|
178
|
+
}, signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.cancelText), /*#__PURE__*/React.createElement(Button, {
|
|
179
|
+
type: "primary",
|
|
180
|
+
onClick: handleModalOk,
|
|
181
|
+
disabled: isEmpty
|
|
182
|
+
}, signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.okText));
|
|
183
|
+
var titleIcon = /*#__PURE__*/React.createElement(React.Fragment, null, !isFullScreen ? /*#__PURE__*/React.createElement("span", {
|
|
184
|
+
className: "kd-modal-expand-icon",
|
|
185
|
+
onClick: function onClick() {
|
|
186
|
+
return handleFullScreen('open');
|
|
187
|
+
}
|
|
188
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
189
|
+
width: "1em",
|
|
190
|
+
height: "1em",
|
|
191
|
+
viewBox: "0 0 32 32"
|
|
192
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
193
|
+
id: "977.\u5168\u5C4F",
|
|
194
|
+
stroke: "none",
|
|
195
|
+
"stroke-width": "1",
|
|
196
|
+
fill: "none",
|
|
197
|
+
"fill-rule": "evenodd"
|
|
198
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
199
|
+
id: "\u7F16\u7EC4",
|
|
200
|
+
transform: "translate(2.000000, 2.000000)",
|
|
201
|
+
fill: "#000000",
|
|
202
|
+
"fill-rule": "nonzero"
|
|
203
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
204
|
+
d: "M1.07692308,17.4339622 C1.67169125,17.4339622 2.15384615,17.9161171 2.15384615,18.5108853 L2.15169231,24.8518084 L8.50424095,18.2911144 C8.91128276,17.8706218 9.58213195,17.8597178 10.0026246,18.2667596 L10.0077312,18.2717362 C10.4291221,18.6851765 10.4378354,19.3612143 10.0272402,19.7853779 L4.12030769,25.8856545 L10.2510885,25.8867924 C10.8346347,25.8867924 11.3076923,26.35985 11.3076923,26.9433963 C11.3076923,27.5269424 10.8346347,28 10.2510885,28 L1.0566038,28 C0.473057639,28 0,27.5269424 0,26.9433963 L0,18.5108853 C0,17.9161171 0.4821549,17.4339622 1.07692308,17.4339622 Z M26.9230769,16.9056604 C27.5178452,16.9056604 28,17.3878153 28,17.9825835 L28,17.9825835 L28,26.4150942 C28,26.9986405 27.5269424,27.4716981 26.9433963,27.4716981 L26.9433963,27.4716981 L17.7489115,27.4716981 C17.1653653,27.4716981 16.6923077,26.9986405 16.6923077,26.4150942 C16.6923077,25.8315482 17.1653653,25.3584905 17.7489115,25.3584905 L17.7489115,25.3584905 L25.8461538,25.3573527 L25.8461538,17.9825835 C25.8461538,17.3878153 26.3283087,16.9056604 26.9230769,16.9056604 Z M26.9433963,0 C27.5269424,0 28,0.473057639 28,1.0566038 L28,9.48911467 C28,10.0838829 27.5178452,10.5660378 26.9230769,10.5660378 C26.3283087,10.5660378 25.8461538,10.0838829 25.8461538,9.48911467 L25.8483077,3.1481916 L19.495759,9.70888562 C19.0887172,10.1293782 18.417868,10.1402822 17.9973754,9.73324042 L17.9922688,9.72826376 C17.5708779,9.31482358 17.5621646,8.63878569 17.9727599,8.21462222 L23.8796923,2.11434544 L17.7489115,2.11320756 C17.1653653,2.11320756 16.6923077,1.64014992 16.6923077,1.0566038 C16.6923077,0.473057639 17.1653653,0 17.7489115,0 L26.9433963,0 Z M10.2510885,0 C10.8346347,0 11.3076923,0.473057639 11.3076923,1.0566038 C11.3076923,1.64014992 10.8346347,2.11320756 10.2510885,2.11320756 L10.2510885,2.11320756 L2.15384615,2.11434544 L2.15384615,9.48911467 C2.15384615,10.0838829 1.67169125,10.5660378 1.07692308,10.5660378 C0.4821549,10.5660378 0,10.0838829 0,9.48911467 L0,9.48911467 L0,1.0566038 C0,0.473057639 0.473057639,0 1.0566038,0 L1.0566038,0 L10.2510885,0 Z",
|
|
205
|
+
id: "\u5F62\u72B6",
|
|
206
|
+
fill: "#666666"
|
|
207
|
+
}))))) : /*#__PURE__*/React.createElement("span", {
|
|
208
|
+
className: "kd-modal-expand-icon",
|
|
209
|
+
onClick: function onClick() {
|
|
210
|
+
return handleFullScreen('close');
|
|
211
|
+
}
|
|
212
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
213
|
+
width: "16px",
|
|
214
|
+
height: "16px",
|
|
215
|
+
viewBox: "0 0 32 32"
|
|
216
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
217
|
+
id: "1226-\u5173\u95ED\u5168\u5C4F",
|
|
218
|
+
stroke: "none",
|
|
219
|
+
"stroke-width": "1",
|
|
220
|
+
fill: "none",
|
|
221
|
+
"fill-rule": "evenodd"
|
|
222
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
223
|
+
id: "\u7F16\u7EC4",
|
|
224
|
+
transform: "translate(4.000000, 4.000000)",
|
|
225
|
+
fill: "#000000",
|
|
226
|
+
"fill-rule": "nonzero"
|
|
227
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
228
|
+
d: "M15.9569224,17.3691573 L15.9569224,22.6490507 C15.9569224,23.385811 16.0714999,23.9626957 15.336072,23.9626957 C14.6019762,23.9626957 14.6566004,23.385811 14.6566004,22.6490507 L14.6566004,15.9875652 C14.6566004,15.5932053 14.8191407,15.2747863 15.076274,15.0549573 C15.3252286,14.7994658 15.66681,14.6553386 16.0235372,14.6552681 L22.6370601,14.6552681 C23.3711558,14.6552681 23.9520373,14.6073054 23.9520373,15.3427334 C23.9520373,16.0794937 23.3711558,15.9022982 22.6370601,15.9022982 L17.2545798,15.9022982 L15.9569224,17.367825 L15.9569224,17.3691573 Z M8.00977019,17.4064616 L6.7107805,15.9382702 L1.32963251,15.9382702 C0.595536804,15.9382702 0.0146552671,16.116798 0.0146552671,15.3800378 C0.0146552671,14.6446098 0.595536804,14.6939048 1.32963251,14.6939048 L7.94315534,14.6939048 C8.31486623,14.6939048 8.6492728,14.8471189 8.88908626,15.0935939 C9.16260631,15.3252747 9.31724071,15.6678192 9.31009215,16.0262018 L9.31009215,22.6876874 C9.31009215,23.4231154 9.36471634,24 8.63062063,24 C7.89519263,24 8.00977017,23.4231153 8.00977019,22.6863551 L8.00977019,17.4064616 L8.00977019,17.4064616 Z M15.9569224,6.59487065 L17.2559121,8.06172976 L22.6370601,8.06172976 C23.3711558,8.06172976 23.9520373,7.88453425 23.9520373,8.62129455 C23.9520373,9.35539026 23.3711558,9.30742755 22.6370601,9.30742755 L16.0235372,9.30742755 C15.66681,9.30735708 15.3252286,9.16322991 15.076274,8.90773844 C14.8032501,8.675801 14.649122,8.33329396 14.6566004,7.97513047 L14.6566004,1.31364494 C14.6552817,0.578216941 14.6019762,0 15.3347396,0 C16.0701676,0 15.9555901,0.578216941 15.9555901,1.31364494 L15.9555901,6.59487065 L15.9569224,6.59487065 Z M7.9951149,6.59487065 L7.9951149,1.31364494 C7.99378262,0.578216941 7.88053736,0 8.61596536,0 C9.34872876,0 9.29543688,0.578216941 9.29543688,1.31364494 L9.29543688,7.97513047 C9.30291535,8.33329396 9.14878718,8.675801 8.87576331,8.90773844 C8.62648612,9.16356115 8.2843572,9.30771659 7.92716776,9.30742755 L1.31497725,9.30742755 C0.579549251,9.30742755 0,9.35539026 0,8.61996227 C0,7.88453427 0.579549251,8.06172978 1.31497725,8.06172976 L6.69612523,8.06172976 L7.99378262,6.59487065 L7.9951149,6.59487065 Z",
|
|
229
|
+
id: "\u5F62\u72B6",
|
|
230
|
+
fill: "#666666"
|
|
231
|
+
}))))));
|
|
232
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, dataUrl ? /*#__PURE__*/React.createElement(Image, {
|
|
233
|
+
preview: preview,
|
|
234
|
+
src: dataUrl,
|
|
235
|
+
title: "\u5220\u9664",
|
|
236
|
+
operations: !disabled ? [/*#__PURE__*/React.createElement(Icon, {
|
|
237
|
+
type: "delete",
|
|
238
|
+
key: "delete",
|
|
239
|
+
onClick: function onClick() {
|
|
240
|
+
return handleDelete();
|
|
241
|
+
}
|
|
242
|
+
})] : undefined
|
|
243
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
244
|
+
className: signatureClass,
|
|
245
|
+
ref: triggerRef,
|
|
246
|
+
onClick: handleOnClick,
|
|
247
|
+
style: style
|
|
248
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
249
|
+
type: "edit"
|
|
250
|
+
}), /*#__PURE__*/React.createElement("span", null, signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.clickToSign)), /*#__PURE__*/React.createElement(Modal, _extends({
|
|
251
|
+
width: containerWidth,
|
|
252
|
+
height: containerHeight,
|
|
253
|
+
ref: modalRef,
|
|
254
|
+
className: modalClasses,
|
|
255
|
+
visible: modalVisible,
|
|
256
|
+
onOk: handleModalOk,
|
|
257
|
+
onCancel: handleModalCancel,
|
|
258
|
+
resizable: true,
|
|
259
|
+
title: title || (signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.handwrittenSignature),
|
|
260
|
+
titleIcon: canFullScreen && titleIcon,
|
|
261
|
+
body: /*#__PURE__*/React.createElement(DrawingBoard, _extends({}, DrawingBoardProps, {
|
|
262
|
+
ref: modalBodyRef
|
|
263
|
+
})),
|
|
264
|
+
footer: footer
|
|
265
|
+
}, restProps)));
|
|
266
|
+
};
|
|
267
|
+
Signature.displayName = 'Signature';
|
|
268
|
+
export default Signature;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/* ----------- color ——————---- start */
|
|
2
|
+
/* ----------- color ——————---- end */
|
|
3
|
+
/* ----------- motion ——————---- start */
|
|
4
|
+
/* ----------- motion ——————---- end */
|
|
5
|
+
/* ----------- transition ——————---- start */
|
|
6
|
+
/* ----------- transition ——————---- end */
|
|
7
|
+
/* ----------- font ——————---- start */
|
|
8
|
+
/* ----------- font ——————---- end */
|
|
9
|
+
/* ----------- zIndex ——————---- start */
|
|
10
|
+
/*
|
|
11
|
+
普通组件内部自身层级应设置在0-100间
|
|
12
|
+
*/
|
|
13
|
+
/* ----------- zIndex ——————---- end */
|
|
14
|
+
/* ----------- Button ——————---- start */
|
|
15
|
+
/* ----------- Button ——————---- end */
|
|
16
|
+
/* ----------- Collapse ——————---- start */
|
|
17
|
+
/* ----------- Collapse ——————---- end */
|
|
18
|
+
/* ----------- Card ——————---- start */
|
|
19
|
+
/* ----------- Card ——————---- end */
|
|
20
|
+
/* ----------- Carousel ——————---- start */
|
|
21
|
+
/* ----------- Carousel ——————---- end */
|
|
22
|
+
/* ----------- Cascader ——————---- start */
|
|
23
|
+
/* ----------- Cascader ——————---- end */
|
|
24
|
+
/* ----------- Switch ——————---- start */
|
|
25
|
+
/* ----------- Switch ——————---- end */
|
|
26
|
+
/* ----------- Input ——————---- start */
|
|
27
|
+
/* ----------- Input ——————---- end */
|
|
28
|
+
/* ----------- InputNumber ——————---- start */
|
|
29
|
+
/* ----------- InputNumber ——————---- end */
|
|
30
|
+
/* ----------- checkbox ——————---- start */
|
|
31
|
+
/* ----------- checkbox ——————---- start */
|
|
32
|
+
/* ----------- checkbox ——————---- end */
|
|
33
|
+
/* ----------- Radio ——————---- start */
|
|
34
|
+
/* ----------- Radio ——————---- end */
|
|
35
|
+
/* ----------- icon ——————---- start */
|
|
36
|
+
/* ----------- icon ——————---- end */
|
|
37
|
+
/* ----------- Popconfirm ——————---- start */
|
|
38
|
+
/* ----------- Popconfirm ——————---- end */
|
|
39
|
+
/* ----------- Progress ——————---- start */
|
|
40
|
+
/* ----------- Progress ——————---- end */
|
|
41
|
+
/* ----------- Pagination ——————---- start */
|
|
42
|
+
/* ----------- Pagination ——————---- end */
|
|
43
|
+
/* ----------- Timeline ——————---- start */
|
|
44
|
+
/* ----------- Timeline ——————---- end */
|
|
45
|
+
/* ----------- Tabs ——————---- start */
|
|
46
|
+
/* ----------- Tabs ——————---- end */
|
|
47
|
+
/* ----------- Select ——————---- start */
|
|
48
|
+
/* ----------- Select ——————---- end */
|
|
49
|
+
/* ----------- Rate ——————---- start */
|
|
50
|
+
/* ----------- Rate ——————---- end */
|
|
51
|
+
/* ----------- Dropdown ——————---- start */
|
|
52
|
+
/* ----------- Dropdown ——————---- end */
|
|
53
|
+
/* ----------- Tooltip ——————---- start */
|
|
54
|
+
/* ----------- Tooltip ——————---- end */
|
|
55
|
+
/* ----------- Transfer ——————---- start */
|
|
56
|
+
/* ----------- Transfer ——————---- end */
|
|
57
|
+
/* ----------- DatePicker ——————---- start */
|
|
58
|
+
/* ----------- DatePicker ——————---- end */
|
|
59
|
+
/* ----------- ColorPicker ——————---- start */
|
|
60
|
+
/* ----------- ColorPicker ——————---- end */
|
|
61
|
+
/* ----------- Tree ——————---- start */
|
|
62
|
+
/* ----------- Tree ——————---- end */
|
|
63
|
+
/* ----------- Alert ——————---- start */
|
|
64
|
+
/* ----------- Alert ——————---- end */
|
|
65
|
+
/* ----------- Split-Panel ——————---- start */
|
|
66
|
+
/* ----------- Split-Panel ——————---- end */
|
|
67
|
+
/* ----------- Modal ——————---- start */
|
|
68
|
+
/* ----------- Modal ——————---- end */
|
|
69
|
+
/* ----------- Steps ——————---- start */
|
|
70
|
+
/* ----------- Steps ——————---- end */
|
|
71
|
+
/* ----------- Form ——————---- start */
|
|
72
|
+
/* ----------- Form ——————---- end */
|
|
73
|
+
/* ----------- Tag ——————---- start */
|
|
74
|
+
/* ----------- Tag ——————---- end */
|
|
75
|
+
/* ----------- Menu ——————---- start */
|
|
76
|
+
/* ----------- Menu ——————---- end */
|
|
77
|
+
/* ----------- notice ——————---- start */
|
|
78
|
+
/* ----------- message ——————---- end */
|
|
79
|
+
/* ----------- Spin ——————---- start */
|
|
80
|
+
/* ----------- Spin ——————---- end */
|
|
81
|
+
/* ----------- Spin ——————---- start */
|
|
82
|
+
/* ----------- Spin ——————---- end */
|
|
83
|
+
/* ----------- Layout ——————---- start */
|
|
84
|
+
/* ----------- Layout ——————---- end */
|
|
85
|
+
/* ----------- Typography ——————---- start */
|
|
86
|
+
/* ----------- Typography ——————---- start */
|
|
87
|
+
/* ----------- Search ——————---- start */
|
|
88
|
+
/* ----------- Search ——————---- start */
|
|
89
|
+
/* ----------- Badge ——————---- start */
|
|
90
|
+
/* ----------- Badge ——————---- end */
|
|
91
|
+
/* ----------- Anchor ——————---- start */
|
|
92
|
+
/* ----------- Anchor ——————---- end */
|
|
93
|
+
/* ----------- Avatar ——————---- start */
|
|
94
|
+
/* ----------- Avatar ——————---- end */
|
|
95
|
+
/* ----------- AdvancedSelector ——————---- start */
|
|
96
|
+
/* ----------- AdvancedSelector ——————---- end */
|
|
97
|
+
/* ----------- motion ——————---- start */
|
|
98
|
+
/* ----------- motion ——————---- end */
|
|
99
|
+
/* ----------- transition ——————---- start */
|
|
100
|
+
/* ----------- transition ——————---- end */
|
|
101
|
+
/* ----------- zIndex ——————---- start */
|
|
102
|
+
/*
|
|
103
|
+
普通组件内部自身层级应设置在0-100间
|
|
104
|
+
*/
|
|
105
|
+
/* ----------- zIndex ——————---- end */
|
|
106
|
+
.kd-signature {
|
|
107
|
+
-webkit-box-sizing: border-box;
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
border: 1px dashed #e5e5e5;
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 100%;
|
|
112
|
+
display: -webkit-box;
|
|
113
|
+
display: -ms-flexbox;
|
|
114
|
+
display: flex;
|
|
115
|
+
-webkit-box-orient: vertical;
|
|
116
|
+
-webkit-box-direction: normal;
|
|
117
|
+
-ms-flex-direction: column;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
-webkit-box-pack: center;
|
|
120
|
+
-ms-flex-pack: center;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
-webkit-box-align: center;
|
|
123
|
+
-ms-flex-align: center;
|
|
124
|
+
align-items: center;
|
|
125
|
+
background: var(--kd-c-signature-bg-color, #fafafa);
|
|
126
|
+
color: var(--kd-c-signature-color-text, #999999);
|
|
127
|
+
font-size: var(--kd-c-signature-font-size, 12px);
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
border-radius: var(--kd-c-signature-border-radius, var(--kd-g-radius-border, 2px));
|
|
130
|
+
-webkit-transition: border-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s)), background-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s));
|
|
131
|
+
transition: border-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s)), background-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s));
|
|
132
|
+
}
|
|
133
|
+
.kd-signature:hover {
|
|
134
|
+
border-color: var(--kd-c-signature-border-color-hover, var(--kd-g-color-theme-5, #87adff));
|
|
135
|
+
background-color: var(--kd-c-signature-bg-color-hover, var(--kd-g-color-theme-1, #f2f8ff));
|
|
136
|
+
}
|
|
137
|
+
.kd-signature.kd-signature-disabled {
|
|
138
|
+
cursor: not-allowed;
|
|
139
|
+
border: 1px solid var(--kd-g-color-border-disabled, #ccc);
|
|
140
|
+
background: var(--kd-c-signature-bg-color, #fafafa);
|
|
141
|
+
color: var(--kd-c-signature-color-text, #999999);
|
|
142
|
+
}
|
|
143
|
+
.kd-signature-drawing-board {
|
|
144
|
+
width: 100%;
|
|
145
|
+
height: 100%;
|
|
146
|
+
border: 1px solid #e5e5e5;
|
|
147
|
+
-webkit-box-sizing: border-box;
|
|
148
|
+
box-sizing: border-box;
|
|
149
|
+
background: var(--kd-c-signature-drawing-board-bg-color, #fafafa);
|
|
150
|
+
position: relative;
|
|
151
|
+
}
|
|
152
|
+
.kd-signature-drawing-board-operation {
|
|
153
|
+
display: -webkit-box;
|
|
154
|
+
display: -ms-flexbox;
|
|
155
|
+
display: flex;
|
|
156
|
+
-webkit-box-align: center;
|
|
157
|
+
-ms-flex-align: center;
|
|
158
|
+
align-items: center;
|
|
159
|
+
position: absolute;
|
|
160
|
+
top: 9px;
|
|
161
|
+
right: 9px;
|
|
162
|
+
color: #b2b2b2;
|
|
163
|
+
z-index: 9999;
|
|
164
|
+
}
|
|
165
|
+
.kd-signature-drawing-board-operation > * {
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
}
|
|
168
|
+
.kd-signature-drawing-board-operation > *:not(:last-child) {
|
|
169
|
+
margin-right: 13px;
|
|
170
|
+
}
|
|
171
|
+
.kd-signature-drawing-board-operation span:nth-of-type(2) {
|
|
172
|
+
-webkit-transform: scaleX(-1) !important;
|
|
173
|
+
transform: scaleX(-1) !important;
|
|
174
|
+
}
|
|
175
|
+
.kd-signature-drawing-board-operation.enabled {
|
|
176
|
+
color: #666666;
|
|
177
|
+
}
|
|
178
|
+
.kd-signature-drawing-board-tip {
|
|
179
|
+
position: absolute;
|
|
180
|
+
top: 50%;
|
|
181
|
+
left: 50%;
|
|
182
|
+
-webkit-transform: translate(-50%, -50%);
|
|
183
|
+
transform: translate(-50%, -50%);
|
|
184
|
+
color: var(--kd-c-signature-board-tip-color, #b2b2b2);
|
|
185
|
+
font-size: 12px;
|
|
186
|
+
-webkit-user-select: none;
|
|
187
|
+
-moz-user-select: none;
|
|
188
|
+
-ms-user-select: none;
|
|
189
|
+
user-select: none;
|
|
190
|
+
}
|
|
191
|
+
.kd-signature-modal .kd-modal-header {
|
|
192
|
+
position: relative;
|
|
193
|
+
}
|
|
194
|
+
.kd-signature-modal-footer .kd-btn:not(:last-child) {
|
|
195
|
+
margin-right: 12px;
|
|
196
|
+
}
|
|
197
|
+
.kd-signature-modal .kd-modal-expand-icon {
|
|
198
|
+
position: absolute;
|
|
199
|
+
right: 43.5px;
|
|
200
|
+
font-size: 14px;
|
|
201
|
+
cursor: pointer;
|
|
202
|
+
}
|
|
203
|
+
.kd-signature-modal.kd-signature-modal-fullscreen .kd-modal-container-box {
|
|
204
|
+
width: 90vw !important;
|
|
205
|
+
height: 90vh !important;
|
|
206
|
+
top: 5vh;
|
|
207
|
+
left: 5vw;
|
|
208
|
+
-webkit-transform: none !important;
|
|
209
|
+
transform: none !important;
|
|
210
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@import '../../style/themes/index';
|
|
2
|
+
@import './mixin.less';
|
|
3
|
+
@signature-prefix-cls: ~'@{kd-prefix}-signature';
|
|
4
|
+
@signature-board-prefix-cls: ~'@{kd-prefix}-signature-drawing-board';
|
|
5
|
+
|
|
6
|
+
.@{signature-prefix-cls} {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
border: 1px dashed #e5e5e5;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
background: @signature-bg-color;
|
|
16
|
+
color: @signature-color-text;
|
|
17
|
+
font-size: @signature-font-size;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
border-radius: @signature-border-radius;
|
|
20
|
+
transition: border-color @signature-transition-duration, background-color @signature-transition-duration;
|
|
21
|
+
&:hover {
|
|
22
|
+
border-color: @signature-border-color-hover;
|
|
23
|
+
background-color: @signature-bg-color-hover;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
.@{signature-prefix-cls}.@{signature-prefix-cls}-disabled {
|
|
27
|
+
cursor: not-allowed;
|
|
28
|
+
border: 1px solid @color-border-disabled;
|
|
29
|
+
background: @signature-bg-color;
|
|
30
|
+
color: @signature-color-text;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.@{signature-board-prefix-cls} {
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
border: 1px solid #e5e5e5;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
background: @signature-drawing-board-bg-color;
|
|
39
|
+
position: relative;
|
|
40
|
+
&-operation {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: 9px;
|
|
45
|
+
right: 9px;
|
|
46
|
+
color: #b2b2b2;
|
|
47
|
+
z-index: 9999;
|
|
48
|
+
& > * {
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
& > *:not(:last-child) {
|
|
52
|
+
margin-right: 13px;
|
|
53
|
+
}
|
|
54
|
+
span:nth-of-type(2) {
|
|
55
|
+
transform: scaleX(-1) !important;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
&-operation.enabled {
|
|
59
|
+
color: #666666;
|
|
60
|
+
}
|
|
61
|
+
&-tip {
|
|
62
|
+
position: absolute;
|
|
63
|
+
top: 50%;
|
|
64
|
+
left: 50%;
|
|
65
|
+
transform: translate(-50%, -50%);
|
|
66
|
+
color: @signature-board-tip-color;
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
user-select: none;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.@{signature-prefix-cls}-modal {
|
|
72
|
+
.kd-modal-header {
|
|
73
|
+
position: relative;
|
|
74
|
+
}
|
|
75
|
+
&-footer {
|
|
76
|
+
.kd-btn:not(:last-child) {
|
|
77
|
+
margin-right: 12px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
.kd-modal-expand-icon {
|
|
81
|
+
position: absolute;
|
|
82
|
+
right: 43.5px;
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
.@{signature-prefix-cls}-modal.@{signature-prefix-cls}-modal-fullscreen {
|
|
88
|
+
.kd-modal-container-box {
|
|
89
|
+
width: 90vw !important;
|
|
90
|
+
height: 90vh !important;
|
|
91
|
+
top: 5vh;
|
|
92
|
+
left: 5vw;
|
|
93
|
+
transform: none !important;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@import '../../style/themes/token.less';
|
|
2
|
+
|
|
3
|
+
@signature-custom-prefix: ~'--@{kd-prefix}-c-signature';
|
|
4
|
+
|
|
5
|
+
// color
|
|
6
|
+
@signature-color-text: var(~'@{signature-custom-prefix}-color-text', #999999);
|
|
7
|
+
@signature-bg-color: var(~'@{signature-custom-prefix}-bg-color', #fafafa);
|
|
8
|
+
@signature-border-color: var(~'@{signature-custom-prefix}-border-color-hover', @color-theme-hover);
|
|
9
|
+
@signature-border-color-hover: var(~'@{signature-custom-prefix}-border-color-hover', @color-theme-hover);
|
|
10
|
+
@signature-border-color-disabled: var(~'@{signature-custom-prefix}-border-color-disabled', @color-border-disabled);
|
|
11
|
+
@signature-bg-color-hover: var(~'@{signature-custom-prefix}-bg-color-hover', @color-theme-1);
|
|
12
|
+
@signature-drawing-board-bg-color:var(~'@{signature-custom-prefix}-drawing-board-bg-color', #fafafa);
|
|
13
|
+
@signature-board-tip-color: var(~'@{signature-custom-prefix}-board-tip-color', #b2b2b2);
|
|
14
|
+
// font
|
|
15
|
+
@signature-font-size: var(~'@{signature-custom-prefix}-font-size', 12px);
|
|
16
|
+
|
|
17
|
+
// motion
|
|
18
|
+
@signature-transition-duration: var(~'@{signature-custom-prefix}-motion-duration', @duration-promptly);
|
|
19
|
+
|
|
20
|
+
// radius
|
|
21
|
+
@signature-border-radius: var(~'@{signature-custom-prefix}-border-radius', @radius-border);
|
|
22
|
+
|