@kdcloudjs/kdesign 1.7.39 → 1.7.41
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 +35 -0
- package/dist/kdesign-complete.less +182 -14
- package/dist/kdesign.css +249 -3
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +1664 -129
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +14 -9
- package/dist/kdesign.min.js.map +1 -1
- package/es/alert/style/index.css +4 -2
- package/es/alert/style/index.less +3 -1
- package/es/button/index.d.ts +2 -1
- package/es/carousel/index.d.ts +2 -2
- package/es/city-picker/index.d.ts +2 -0
- package/es/collapse/index.d.ts +2 -2
- package/es/config-provider/compDefaultProps.d.ts +10 -0
- package/es/config-provider/compDefaultProps.js +11 -1
- package/es/date-picker/context.d.ts +4 -2
- package/es/date-picker/date-picker.d.ts +9 -0
- package/es/date-picker/date-picker.js +4 -2
- package/es/date-picker/panel/month/month.js +14 -9
- package/es/date-picker/panel/quarter/quarter.js +12 -4
- package/es/date-picker/panel/time/time-column.d.ts +2 -0
- package/es/date-picker/panel/time/time-column.js +14 -5
- package/es/date-picker/panel/time/time.js +8 -4
- package/es/date-picker/panel/week/week.js +20 -10
- package/es/date-picker/panel/year/year.js +12 -4
- package/es/date-picker/range-picker.js +11 -4
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/input/TextArea.js +16 -8
- package/es/input/style/index.css +3 -0
- package/es/input/style/index.less +9 -5
- package/es/modal/modal.d.ts +5 -0
- package/es/modal/modal.js +242 -15
- package/es/modal/style/index.css +86 -0
- package/es/modal/style/index.less +95 -9
- package/es/notification-base/notice.js +6 -1
- package/es/qr-code/index.d.ts +3 -0
- package/es/qr-code/index.js +3 -0
- package/es/qr-code/qr-code.d.ts +42 -0
- package/es/qr-code/qr-code.js +80 -0
- package/es/qr-code/style/css.js +2 -0
- package/es/qr-code/style/index.css +154 -0
- package/es/qr-code/style/index.d.ts +2 -0
- package/es/qr-code/style/index.js +2 -0
- package/es/qr-code/style/index.less +42 -0
- package/es/qr-code/style/mixin.less +6 -0
- package/es/qr-code/style/token.less +24 -0
- package/es/search/search-panel.d.ts +1 -1
- package/es/select/index.d.ts +1 -0
- package/es/select/index.js +1 -0
- package/es/tree/tree.js +2 -2
- package/es/tree/treeHooks.d.ts +1 -1
- package/es/tree/treeHooks.js +2 -2
- package/lib/alert/style/index.css +4 -2
- package/lib/alert/style/index.less +3 -1
- package/lib/button/index.d.ts +2 -1
- package/lib/carousel/index.d.ts +2 -2
- package/lib/city-picker/index.d.ts +2 -0
- package/lib/collapse/index.d.ts +2 -2
- package/lib/config-provider/compDefaultProps.d.ts +10 -0
- package/lib/config-provider/compDefaultProps.js +11 -1
- package/lib/date-picker/context.d.ts +4 -2
- package/lib/date-picker/date-picker.d.ts +9 -0
- package/lib/date-picker/date-picker.js +4 -2
- package/lib/date-picker/panel/month/month.js +14 -9
- package/lib/date-picker/panel/quarter/quarter.js +12 -4
- package/lib/date-picker/panel/time/time-column.d.ts +2 -0
- package/lib/date-picker/panel/time/time-column.js +14 -5
- package/lib/date-picker/panel/time/time.js +8 -4
- package/lib/date-picker/panel/week/week.js +20 -10
- package/lib/date-picker/panel/year/year.js +12 -4
- package/lib/date-picker/range-picker.js +11 -4
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -0
- package/lib/input/TextArea.js +16 -8
- package/lib/input/style/index.css +3 -0
- package/lib/input/style/index.less +9 -5
- package/lib/modal/modal.d.ts +5 -0
- package/lib/modal/modal.js +242 -15
- package/lib/modal/style/index.css +86 -0
- package/lib/modal/style/index.less +95 -9
- package/lib/notification-base/notice.js +6 -1
- package/lib/qr-code/index.d.ts +3 -0
- package/lib/qr-code/index.js +27 -0
- package/lib/qr-code/qr-code.d.ts +42 -0
- package/lib/qr-code/qr-code.js +96 -0
- package/lib/qr-code/style/css.js +4 -0
- package/lib/qr-code/style/index.css +154 -0
- package/lib/qr-code/style/index.d.ts +2 -0
- package/lib/qr-code/style/index.js +4 -0
- package/lib/qr-code/style/index.less +42 -0
- package/lib/qr-code/style/mixin.less +6 -0
- package/lib/qr-code/style/token.less +24 -0
- package/lib/search/search-panel.d.ts +1 -1
- package/lib/select/index.d.ts +1 -0
- package/lib/select/index.js +14 -0
- package/lib/style/components.less +1 -0
- package/lib/tree/tree.js +2 -2
- package/lib/tree/treeHooks.d.ts +1 -1
- package/lib/tree/treeHooks.js +2 -2
- package/package.json +11 -3
package/es/modal/modal.js
CHANGED
|
@@ -26,8 +26,30 @@ import { getLangMsg } from '../locale/locale';
|
|
|
26
26
|
import { useHideDocumentScrollBar } from '../_utils/hooks';
|
|
27
27
|
export var ConfirmModalTypes = ['confirm', 'normal'];
|
|
28
28
|
export var ModalTypes = tuple('confirm', 'warning', 'error', 'normal');
|
|
29
|
+
var DragDirection;
|
|
30
|
+
(function (DragDirection) {
|
|
31
|
+
DragDirection["N"] = "n";
|
|
32
|
+
DragDirection["E"] = "e";
|
|
33
|
+
DragDirection["S"] = "s";
|
|
34
|
+
DragDirection["W"] = "w";
|
|
35
|
+
DragDirection["NE"] = "ne";
|
|
36
|
+
DragDirection["NW"] = "nw";
|
|
37
|
+
DragDirection["SE"] = "se";
|
|
38
|
+
DragDirection["SW"] = "sw";
|
|
39
|
+
})(DragDirection || (DragDirection = {}));
|
|
40
|
+
var initPosition = {
|
|
41
|
+
initialX: 0,
|
|
42
|
+
initialY: 0,
|
|
43
|
+
initialWidth: 0,
|
|
44
|
+
initialHeight: 0,
|
|
45
|
+
top: 0,
|
|
46
|
+
left: 0,
|
|
47
|
+
x: 0,
|
|
48
|
+
y: 0,
|
|
49
|
+
type: null
|
|
50
|
+
};
|
|
29
51
|
var InternalModal = function InternalModal(props, ref) {
|
|
30
|
-
var _classNames3, _classNames4, _context2, _context3;
|
|
52
|
+
var _classNames3, _classNames4, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12;
|
|
31
53
|
var _useContext = useContext(ConfigContext),
|
|
32
54
|
getPrefixCls = _useContext.getPrefixCls,
|
|
33
55
|
prefixCls = _useContext.prefixCls,
|
|
@@ -70,7 +92,9 @@ var InternalModal = function InternalModal(props, ref) {
|
|
|
70
92
|
onDrag = modalProps.onDrag,
|
|
71
93
|
onDragStop = modalProps.onDragStop,
|
|
72
94
|
bounds = modalProps.bounds,
|
|
73
|
-
|
|
95
|
+
overroll = modalProps.overroll,
|
|
96
|
+
resizable = modalProps.resizable,
|
|
97
|
+
others = __rest(modalProps, ["body", "bodyClassName", "bodyStyle", "cancelButtonProps", "cancelText", "className", "closable", "closeIcon", "destroyOnClose", "draggable", "focusTriggerAfterClose", "footer", "footerClassName", "footerStyle", "footerBtnOrder", "getContainer", "height", "keyboard", "mask", "maskClosable", "maskStyle", "maskClassName", "okButtonProps", "okText", "onCancel", "onOk", "prefixCls", "title", "titleIcon", "type", "visible", "width", "showline", "onDragStart", "onDrag", "onDragStop", "bounds", "overroll", "resizable"]);
|
|
74
98
|
var isForceController = visible !== undefined;
|
|
75
99
|
var _useState = useState(isForceController ? visible : true),
|
|
76
100
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -78,6 +102,7 @@ var InternalModal = function InternalModal(props, ref) {
|
|
|
78
102
|
setInnerVisible = _useState2[1]; // 需要根据visible来判断,不能一开始为true再去设置false
|
|
79
103
|
var previousActiveElement = useRef(null);
|
|
80
104
|
var innerRef = useRef(null);
|
|
105
|
+
var wrapperRef = useRef(null);
|
|
81
106
|
var containerRef = ref || innerRef;
|
|
82
107
|
var modalPrefixCls = getPrefixCls(prefixCls, 'modal', customPrefixcls);
|
|
83
108
|
devWarning(ModalTypes.indexOf(type) === -1, 'modal', "cannot found modal type '".concat(type, "'"));
|
|
@@ -90,6 +115,16 @@ var InternalModal = function InternalModal(props, ref) {
|
|
|
90
115
|
}
|
|
91
116
|
modalContainer = document.body;
|
|
92
117
|
}
|
|
118
|
+
var _useState3 = useState(modalContainer && !overroll ? {
|
|
119
|
+
x: -(width / 2),
|
|
120
|
+
y: -(height / 2)
|
|
121
|
+
} : {
|
|
122
|
+
x: 0,
|
|
123
|
+
y: 0
|
|
124
|
+
}),
|
|
125
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
126
|
+
position = _useState4[0],
|
|
127
|
+
setPosition = _useState4[1];
|
|
93
128
|
useHideDocumentScrollBar(isForceController ? !!visible : !!innerVisible, modalContainer === document.body, !!mask);
|
|
94
129
|
var closeModal = useCallback(function () {
|
|
95
130
|
setInnerVisible(false);
|
|
@@ -180,16 +215,168 @@ var InternalModal = function InternalModal(props, ref) {
|
|
|
180
215
|
document.body.removeEventListener('keydown', escapeToCloseModal);
|
|
181
216
|
};
|
|
182
217
|
}, [keyboard, escapeToCloseModal, proxyCloseModal, onCancel]);
|
|
218
|
+
var isResizing = false;
|
|
219
|
+
var initPositionRef = useRef(initPosition);
|
|
220
|
+
var startResize = useCallback(function (event) {
|
|
221
|
+
var targetElement = event.target;
|
|
222
|
+
if (!targetElement.classList.contains("".concat(modalPrefixCls, "-resise-handle")) || !containerRef.current) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
var _containerRef$current = containerRef.current.getBoundingClientRect(),
|
|
226
|
+
initialWidth = _containerRef$current.width,
|
|
227
|
+
initialHeight = _containerRef$current.height,
|
|
228
|
+
top = _containerRef$current.top,
|
|
229
|
+
left = _containerRef$current.left;
|
|
230
|
+
initPositionRef.current = {
|
|
231
|
+
initialX: event.clientX,
|
|
232
|
+
initialY: event.clientY,
|
|
233
|
+
initialWidth: initialWidth,
|
|
234
|
+
initialHeight: initialHeight,
|
|
235
|
+
top: top,
|
|
236
|
+
left: left,
|
|
237
|
+
x: position.x,
|
|
238
|
+
y: position.y,
|
|
239
|
+
type: targetElement.dataset.type
|
|
240
|
+
};
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
isResizing = true;
|
|
243
|
+
if (overroll && wrapperRef.current) {
|
|
244
|
+
wrapperRef.current.classList.add("".concat(modalPrefixCls, "-wrapper-resizable"));
|
|
245
|
+
setPosition({
|
|
246
|
+
x: left,
|
|
247
|
+
y: top
|
|
248
|
+
});
|
|
249
|
+
initPositionRef.current.x = left;
|
|
250
|
+
initPositionRef.current.y = top;
|
|
251
|
+
}
|
|
252
|
+
document.addEventListener('mousemove', resize);
|
|
253
|
+
document.addEventListener('mouseup', stopResize);
|
|
254
|
+
}, [position]);
|
|
255
|
+
useEffect(function () {
|
|
256
|
+
if (containerRef.current && visible) {
|
|
257
|
+
containerRef.current.addEventListener('mousedown', startResize);
|
|
258
|
+
}
|
|
259
|
+
return function () {
|
|
260
|
+
if (containerRef.current) {
|
|
261
|
+
containerRef.current.removeEventListener('mousedown', startResize);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
}, [containerRef, startResize, visible]);
|
|
265
|
+
var resize = function resize(event) {
|
|
266
|
+
if (!containerRef.current) return;
|
|
267
|
+
if (!isResizing || !containerRef.current) return;
|
|
268
|
+
var _initPositionRef$curr = initPositionRef.current,
|
|
269
|
+
initialX = _initPositionRef$curr.initialX,
|
|
270
|
+
initialY = _initPositionRef$curr.initialY,
|
|
271
|
+
initialHeight = _initPositionRef$curr.initialHeight,
|
|
272
|
+
initialWidth = _initPositionRef$curr.initialWidth,
|
|
273
|
+
y = _initPositionRef$curr.y,
|
|
274
|
+
x = _initPositionRef$curr.x,
|
|
275
|
+
type = _initPositionRef$curr.type;
|
|
276
|
+
var curNHeight = initialY - event.clientY;
|
|
277
|
+
var curSHeight = -curNHeight;
|
|
278
|
+
var curEWidth = event.clientX - initialX;
|
|
279
|
+
var curWWidth = -curEWidth;
|
|
280
|
+
switch (type) {
|
|
281
|
+
case DragDirection.N:
|
|
282
|
+
{
|
|
283
|
+
containerRef.current.style.height = "".concat(curNHeight + initialHeight, "px");
|
|
284
|
+
setPosition(function (pre) {
|
|
285
|
+
return {
|
|
286
|
+
y: y - curNHeight,
|
|
287
|
+
x: pre.x
|
|
288
|
+
};
|
|
289
|
+
});
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
case DragDirection.E:
|
|
293
|
+
{
|
|
294
|
+
containerRef.current.style.width = "".concat(curEWidth + initialWidth, "px");
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case DragDirection.S:
|
|
298
|
+
{
|
|
299
|
+
containerRef.current.style.height = "".concat(curSHeight + initialHeight, "px");
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
case DragDirection.W:
|
|
303
|
+
{
|
|
304
|
+
containerRef.current.style.width = "".concat(curWWidth + initialWidth, "px");
|
|
305
|
+
setPosition(function (pre) {
|
|
306
|
+
return {
|
|
307
|
+
y: pre.y,
|
|
308
|
+
x: x - curWWidth
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
case DragDirection.NE:
|
|
314
|
+
{
|
|
315
|
+
containerRef.current.style.height = "".concat(curNHeight + initialHeight, "px");
|
|
316
|
+
containerRef.current.style.width = "".concat(curEWidth + initialWidth, "px");
|
|
317
|
+
setPosition(function (pre) {
|
|
318
|
+
return {
|
|
319
|
+
y: y - curNHeight,
|
|
320
|
+
x: pre.x
|
|
321
|
+
};
|
|
322
|
+
});
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
case DragDirection.NW:
|
|
326
|
+
{
|
|
327
|
+
containerRef.current.style.height = "".concat(curNHeight + initialHeight, "px");
|
|
328
|
+
containerRef.current.style.width = "".concat(curWWidth + initialWidth, "px");
|
|
329
|
+
setPosition({
|
|
330
|
+
y: y - curNHeight,
|
|
331
|
+
x: x - curWWidth
|
|
332
|
+
});
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
case DragDirection.SE:
|
|
336
|
+
{
|
|
337
|
+
containerRef.current.style.height = "".concat(curSHeight + initialHeight, "px");
|
|
338
|
+
containerRef.current.style.width = "".concat(curEWidth + initialWidth, "px");
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
case DragDirection.SW:
|
|
342
|
+
{
|
|
343
|
+
containerRef.current.style.width = "".concat(curWWidth + initialWidth, "px");
|
|
344
|
+
containerRef.current.style.height = "".concat(curSHeight + initialHeight, "px");
|
|
345
|
+
setPosition(function (pre) {
|
|
346
|
+
return {
|
|
347
|
+
y: pre.y,
|
|
348
|
+
x: x - curWWidth
|
|
349
|
+
};
|
|
350
|
+
});
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
default:
|
|
354
|
+
{
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
var stopResize = function stopResize() {
|
|
360
|
+
isResizing = false;
|
|
361
|
+
initPositionRef.current = initPosition;
|
|
362
|
+
document.removeEventListener('mousemove', resize);
|
|
363
|
+
document.removeEventListener('mouseup', stopResize);
|
|
364
|
+
};
|
|
183
365
|
var handleMaskClick = useCallback(function () {
|
|
184
366
|
if (maskClosable) {
|
|
185
367
|
proxyCloseModal(onCancel);
|
|
186
368
|
}
|
|
187
369
|
}, [proxyCloseModal, onCancel, maskClosable]);
|
|
370
|
+
var handleWrapperClick = function handleWrapperClick(e) {
|
|
371
|
+
if (wrapperRef.current === e.target) {
|
|
372
|
+
handleMaskClick();
|
|
373
|
+
}
|
|
374
|
+
};
|
|
188
375
|
var isHidden = !destroyOnClose && !(isForceController ? visible : innerVisible);
|
|
189
376
|
var modalClasses = classNames(modalPrefixCls, className, (_classNames3 = {}, _defineProperty(_classNames3, "".concat(modalPrefixCls, "-container"), true), _defineProperty(_classNames3, "".concat(modalPrefixCls, "-container-hidden"), isHidden), _defineProperty(_classNames3, "".concat(modalPrefixCls, "-container-show"), !isHidden), _classNames3));
|
|
190
377
|
var headerClass = "".concat(modalPrefixCls, "-header");
|
|
191
378
|
var container = /*#__PURE__*/React.createElement("div", {
|
|
192
|
-
className: classNames((_classNames4 = {}, _defineProperty(_classNames4, "".concat(modalPrefixCls, "-container-box"), true), _defineProperty(_classNames4, "".concat(modalPrefixCls, "-has-container-box"), modalContainer), _defineProperty(_classNames4, "".concat(modalPrefixCls, "-showline"), showline), _classNames4)),
|
|
379
|
+
className: classNames((_classNames4 = {}, _defineProperty(_classNames4, "".concat(modalPrefixCls, "-container-box"), true), _defineProperty(_classNames4, "".concat(modalPrefixCls, "-has-container-box"), modalContainer && !overroll), _defineProperty(_classNames4, "".concat(modalPrefixCls, "-showline"), showline), _classNames4)),
|
|
193
380
|
style: {
|
|
194
381
|
width: width,
|
|
195
382
|
height: height
|
|
@@ -197,7 +384,31 @@ var InternalModal = function InternalModal(props, ref) {
|
|
|
197
384
|
ref: containerRef,
|
|
198
385
|
tabIndex: -1,
|
|
199
386
|
onKeyDown: enterToCloseModal
|
|
200
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
387
|
+
}, resizable && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
388
|
+
"data-type": "n",
|
|
389
|
+
className: _concatInstanceProperty(_context2 = "".concat(modalPrefixCls, "-resise-handle ")).call(_context2, modalPrefixCls, "-resise-n")
|
|
390
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
391
|
+
"data-type": "e",
|
|
392
|
+
className: _concatInstanceProperty(_context3 = "".concat(modalPrefixCls, "-resise-handle ")).call(_context3, modalPrefixCls, "-resise-e")
|
|
393
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
394
|
+
"data-type": "s",
|
|
395
|
+
className: _concatInstanceProperty(_context4 = "".concat(modalPrefixCls, "-resise-handle ")).call(_context4, modalPrefixCls, "-resise-s")
|
|
396
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
397
|
+
"data-type": "w",
|
|
398
|
+
className: _concatInstanceProperty(_context5 = "".concat(modalPrefixCls, "-resise-handle ")).call(_context5, modalPrefixCls, "-resise-w")
|
|
399
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
400
|
+
"data-type": "ne",
|
|
401
|
+
className: _concatInstanceProperty(_context6 = "".concat(modalPrefixCls, "-resise-handle ")).call(_context6, modalPrefixCls, "-resise-ne")
|
|
402
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
403
|
+
"data-type": "se",
|
|
404
|
+
className: _concatInstanceProperty(_context7 = "".concat(modalPrefixCls, "-resise-handle ")).call(_context7, modalPrefixCls, "-resise-se")
|
|
405
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
406
|
+
"data-type": "sw",
|
|
407
|
+
className: _concatInstanceProperty(_context8 = "".concat(modalPrefixCls, "-resise-handle ")).call(_context8, modalPrefixCls, "-resise-sw")
|
|
408
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
409
|
+
"data-type": "nw",
|
|
410
|
+
className: _concatInstanceProperty(_context9 = "".concat(modalPrefixCls, "-resise-handle ")).call(_context9, modalPrefixCls, "-resise-nw")
|
|
411
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
201
412
|
className: headerClass
|
|
202
413
|
}, /*#__PURE__*/React.createElement("div", {
|
|
203
414
|
className: "".concat(modalPrefixCls, "-title-container")
|
|
@@ -216,7 +427,7 @@ var InternalModal = function InternalModal(props, ref) {
|
|
|
216
427
|
className: classNames("".concat(modalPrefixCls, "-body"), bodyClassName),
|
|
217
428
|
style: bodyStyle
|
|
218
429
|
}, body), footer !== null && /*#__PURE__*/React.createElement("div", {
|
|
219
|
-
className: classNames("".concat(modalPrefixCls, "-footer"), _concatInstanceProperty(
|
|
430
|
+
className: classNames("".concat(modalPrefixCls, "-footer"), _concatInstanceProperty(_context10 = "".concat(modalPrefixCls, "-")).call(_context10, type, "-footer"), footerClassName),
|
|
220
431
|
style: _extends({
|
|
221
432
|
flexDirection: !footer && (!footerBtnOrder || footerBtnOrder === 'normal') ? 'row' : 'row-reverse'
|
|
222
433
|
}, footerStyle || {})
|
|
@@ -226,12 +437,12 @@ var InternalModal = function InternalModal(props, ref) {
|
|
|
226
437
|
var handleDragStart = function handleDragStart(e, data) {
|
|
227
438
|
onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(e, data);
|
|
228
439
|
};
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
440
|
+
var handleDrag = function handleDrag(e, ui) {
|
|
441
|
+
setPosition({
|
|
442
|
+
x: ui.x,
|
|
443
|
+
y: ui.y
|
|
444
|
+
});
|
|
445
|
+
onDrag === null || onDrag === void 0 ? void 0 : onDrag(e, ui);
|
|
235
446
|
};
|
|
236
447
|
var comp = /*#__PURE__*/React.createElement("div", _extends({
|
|
237
448
|
className: modalClasses
|
|
@@ -239,15 +450,31 @@ var InternalModal = function InternalModal(props, ref) {
|
|
|
239
450
|
onClick: handleMaskClick,
|
|
240
451
|
className: classNames(maskClassName, _defineProperty({}, "".concat(modalPrefixCls, "-mask"), true)),
|
|
241
452
|
style: maskStyle
|
|
242
|
-
}), /*#__PURE__*/React.createElement(
|
|
243
|
-
|
|
453
|
+
}), overroll ? /*#__PURE__*/React.createElement("div", {
|
|
454
|
+
tabIndex: -1,
|
|
455
|
+
className: classNames(_defineProperty({}, "".concat(modalPrefixCls, "-wrapper"), modalContainer && ((isForceController ? visible : innerVisible) || !destroyOnClose))),
|
|
456
|
+
ref: wrapperRef,
|
|
457
|
+
onMouseDown: handleWrapperClick
|
|
458
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
459
|
+
className: "".concat(modalPrefixCls, "-dialog")
|
|
460
|
+
}, /*#__PURE__*/React.createElement(Draggable, {
|
|
461
|
+
position: position,
|
|
462
|
+
handle: ".".concat(headerClass),
|
|
463
|
+
disabled: !draggable,
|
|
464
|
+
onStart: handleDragStart,
|
|
465
|
+
onDrag: handleDrag,
|
|
466
|
+
onStop: onDragStop,
|
|
467
|
+
bounds: bounds,
|
|
468
|
+
cancel: _concatInstanceProperty(_context11 = ".".concat(modalPrefixCls, "-title-container, .")).call(_context11, modalPrefixCls, "-close-icon")
|
|
469
|
+
}, container))) : /*#__PURE__*/React.createElement(Draggable, {
|
|
244
470
|
handle: ".".concat(headerClass),
|
|
245
471
|
disabled: !draggable,
|
|
472
|
+
position: position,
|
|
246
473
|
onStart: handleDragStart,
|
|
247
|
-
onDrag:
|
|
474
|
+
onDrag: handleDrag,
|
|
248
475
|
onStop: onDragStop,
|
|
249
476
|
bounds: bounds,
|
|
250
|
-
cancel: _concatInstanceProperty(
|
|
477
|
+
cancel: _concatInstanceProperty(_context12 = ".".concat(modalPrefixCls, "-title-container, .")).call(_context12, modalPrefixCls, "-close-icon")
|
|
251
478
|
}, container));
|
|
252
479
|
var renderComp = ((isForceController ? visible : innerVisible) || !destroyOnClose) && comp;
|
|
253
480
|
if (modalContainer && renderComp) return /*#__PURE__*/ReactDOM.createPortal(renderComp, modalContainer);
|
package/es/modal/style/index.css
CHANGED
|
@@ -249,9 +249,95 @@
|
|
|
249
249
|
-ms-flex-negative: 0;
|
|
250
250
|
flex-shrink: 0;
|
|
251
251
|
}
|
|
252
|
+
.kd-modal-container-box .kd-modal-resise-handle {
|
|
253
|
+
position: absolute;
|
|
254
|
+
}
|
|
255
|
+
.kd-modal-container-box .kd-modal-resise-n {
|
|
256
|
+
top: 0;
|
|
257
|
+
left: 0;
|
|
258
|
+
width: 100%;
|
|
259
|
+
height: 6px;
|
|
260
|
+
cursor: ns-resize;
|
|
261
|
+
}
|
|
262
|
+
.kd-modal-container-box .kd-modal-resise-e {
|
|
263
|
+
top: 0;
|
|
264
|
+
right: 0;
|
|
265
|
+
height: 100%;
|
|
266
|
+
width: 6px;
|
|
267
|
+
cursor: ew-resize;
|
|
268
|
+
}
|
|
269
|
+
.kd-modal-container-box .kd-modal-resise-s {
|
|
270
|
+
bottom: 0;
|
|
271
|
+
left: 0;
|
|
272
|
+
height: 6px;
|
|
273
|
+
width: 100%;
|
|
274
|
+
cursor: ns-resize;
|
|
275
|
+
}
|
|
276
|
+
.kd-modal-container-box .kd-modal-resise-w {
|
|
277
|
+
left: 0;
|
|
278
|
+
top: 0;
|
|
279
|
+
height: 100%;
|
|
280
|
+
width: 6px;
|
|
281
|
+
cursor: ew-resize;
|
|
282
|
+
}
|
|
283
|
+
.kd-modal-container-box .kd-modal-resise-ne {
|
|
284
|
+
top: 0;
|
|
285
|
+
right: 0;
|
|
286
|
+
width: 6px;
|
|
287
|
+
height: 6px;
|
|
288
|
+
cursor: nesw-resize;
|
|
289
|
+
}
|
|
290
|
+
.kd-modal-container-box .kd-modal-resise-se {
|
|
291
|
+
bottom: 0;
|
|
292
|
+
right: 0;
|
|
293
|
+
width: 6px;
|
|
294
|
+
height: 6px;
|
|
295
|
+
cursor: nwse-resize;
|
|
296
|
+
}
|
|
297
|
+
.kd-modal-container-box .kd-modal-resise-sw {
|
|
298
|
+
bottom: 0;
|
|
299
|
+
left: 0;
|
|
300
|
+
width: 6px;
|
|
301
|
+
height: 6px;
|
|
302
|
+
cursor: nesw-resize;
|
|
303
|
+
}
|
|
304
|
+
.kd-modal-container-box .kd-modal-resise-nw {
|
|
305
|
+
top: 0;
|
|
306
|
+
left: 0;
|
|
307
|
+
width: 6px;
|
|
308
|
+
height: 6px;
|
|
309
|
+
cursor: nwse-resize;
|
|
310
|
+
}
|
|
252
311
|
.kd-modal-margin-btn {
|
|
253
312
|
margin-right: var(--kd-c-modal-footer-button-spacing, 12px);
|
|
254
313
|
}
|
|
314
|
+
.kd-modal-wrapper {
|
|
315
|
+
position: fixed;
|
|
316
|
+
top: 0;
|
|
317
|
+
right: 0;
|
|
318
|
+
bottom: 0;
|
|
319
|
+
left: 0;
|
|
320
|
+
overflow: auto;
|
|
321
|
+
text-align: center;
|
|
322
|
+
}
|
|
323
|
+
.kd-modal-wrapper::before {
|
|
324
|
+
display: inline-block;
|
|
325
|
+
width: 0;
|
|
326
|
+
height: 100%;
|
|
327
|
+
vertical-align: middle;
|
|
328
|
+
content: '';
|
|
329
|
+
}
|
|
330
|
+
.kd-modal-wrapper-resizable {
|
|
331
|
+
text-align: unset;
|
|
332
|
+
}
|
|
333
|
+
.kd-modal-wrapper-resizable::before {
|
|
334
|
+
height: 0;
|
|
335
|
+
}
|
|
336
|
+
.kd-modal-dialog {
|
|
337
|
+
display: inline-block;
|
|
338
|
+
vertical-align: middle;
|
|
339
|
+
max-width: calc(100vw);
|
|
340
|
+
}
|
|
255
341
|
.kd-modal-showline .kd-modal-header {
|
|
256
342
|
border-bottom: var(--kd-c-modal-sizing-border, 1px) solid var(--kd-c-modal-color-border, var(--kd-g-color-border-strong-2, #d9d9d9));
|
|
257
343
|
}
|
|
@@ -29,15 +29,13 @@
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
&-hidden {
|
|
32
|
-
display: none
|
|
32
|
+
display: none;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
&-mask {
|
|
36
36
|
.overlay(@modal-mask-color-background, 0);
|
|
37
37
|
}
|
|
38
|
-
// &-mask + &-container-box {
|
|
39
38
|
|
|
40
|
-
// }
|
|
41
39
|
&-has-container-box {
|
|
42
40
|
position: fixed;
|
|
43
41
|
left: 50%;
|
|
@@ -116,16 +114,104 @@
|
|
|
116
114
|
color: @modal-footer-font-color;
|
|
117
115
|
flex-shrink: 0;
|
|
118
116
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
|
|
118
|
+
.@{modal-prefix-cls}-resise {
|
|
119
|
+
&-handle {
|
|
120
|
+
position: absolute;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&-n {
|
|
124
|
+
top: 0;
|
|
125
|
+
left: 0;
|
|
126
|
+
width: 100%;
|
|
127
|
+
height: 6px;
|
|
128
|
+
cursor: ns-resize;
|
|
129
|
+
}
|
|
130
|
+
&-e {
|
|
131
|
+
top: 0;
|
|
132
|
+
right: 0;
|
|
133
|
+
height: 100%;
|
|
134
|
+
width: 6px;
|
|
135
|
+
cursor: ew-resize;
|
|
136
|
+
}
|
|
137
|
+
&-s {
|
|
138
|
+
bottom: 0;
|
|
139
|
+
left: 0;
|
|
140
|
+
height: 6px;
|
|
141
|
+
width: 100%;
|
|
142
|
+
cursor: ns-resize;
|
|
143
|
+
}
|
|
144
|
+
&-w {
|
|
145
|
+
left: 0;
|
|
146
|
+
top: 0;
|
|
147
|
+
height: 100%;
|
|
148
|
+
width: 6px;
|
|
149
|
+
cursor: ew-resize;
|
|
150
|
+
}
|
|
151
|
+
&-ne {
|
|
152
|
+
top: 0;
|
|
153
|
+
right: 0;
|
|
154
|
+
width: 6px;
|
|
155
|
+
height: 6px;
|
|
156
|
+
cursor: nesw-resize;
|
|
157
|
+
}
|
|
158
|
+
&-se {
|
|
159
|
+
bottom: 0;
|
|
160
|
+
right: 0;
|
|
161
|
+
width: 6px;
|
|
162
|
+
height: 6px;
|
|
163
|
+
cursor: nwse-resize;
|
|
164
|
+
}
|
|
165
|
+
&-sw {
|
|
166
|
+
bottom: 0;
|
|
167
|
+
left: 0;
|
|
168
|
+
width: 6px;
|
|
169
|
+
height: 6px;
|
|
170
|
+
cursor: nesw-resize;
|
|
171
|
+
}
|
|
172
|
+
&-nw {
|
|
173
|
+
top: 0;
|
|
174
|
+
left: 0;
|
|
175
|
+
width: 6px;
|
|
176
|
+
height: 6px;
|
|
177
|
+
cursor: nwse-resize;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
124
180
|
}
|
|
125
181
|
|
|
126
182
|
&-margin-btn {
|
|
127
183
|
margin-right: @modal-footer-button-spacing;
|
|
128
184
|
}
|
|
185
|
+
|
|
186
|
+
&-wrapper {
|
|
187
|
+
position: fixed;
|
|
188
|
+
top: 0;
|
|
189
|
+
right: 0;
|
|
190
|
+
bottom: 0;
|
|
191
|
+
left: 0;
|
|
192
|
+
overflow: auto;
|
|
193
|
+
text-align: center;
|
|
194
|
+
|
|
195
|
+
&::before {
|
|
196
|
+
display: inline-block;
|
|
197
|
+
width: 0;
|
|
198
|
+
height: 100%;
|
|
199
|
+
vertical-align: middle;
|
|
200
|
+
content: '';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&-resizable {
|
|
204
|
+
text-align: unset;
|
|
205
|
+
&::before {
|
|
206
|
+
height: 0;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
&-dialog {
|
|
211
|
+
display: inline-block;
|
|
212
|
+
vertical-align: middle;
|
|
213
|
+
max-width: calc(100vw);
|
|
214
|
+
}
|
|
129
215
|
}
|
|
130
216
|
|
|
131
217
|
.@{modal-prefix-cls}-showline {
|
|
@@ -135,4 +221,4 @@
|
|
|
135
221
|
.@{modal-prefix-cls}-footer {
|
|
136
222
|
border-top: @modal-border-width solid @modal-border-color;
|
|
137
223
|
}
|
|
138
|
-
}
|
|
224
|
+
}
|
|
@@ -25,6 +25,7 @@ var Notice = function Notice(props) {
|
|
|
25
25
|
key = noticeProps.key;
|
|
26
26
|
var noticePrefixCls = getPrefixCls(prefixCls, suffixCls, customPrefixcls);
|
|
27
27
|
var timer = null;
|
|
28
|
+
var isTransition = false;
|
|
28
29
|
var noticeRef = useRef();
|
|
29
30
|
var noticeClasses = classNames(noticePrefixCls, className, (_classNames = {}, _defineProperty(_classNames, _concatInstanceProperty(_context = "".concat(noticePrefixCls, "-")).call(_context, type), type), _defineProperty(_classNames, "".concat(noticePrefixCls, "-closable"), closable), _classNames));
|
|
30
31
|
var animationEvent = function animationEvent() {
|
|
@@ -33,7 +34,10 @@ var Notice = function Notice(props) {
|
|
|
33
34
|
(_b = noticeRef.current) === null || _b === void 0 ? void 0 : _b.classList.add("".concat(noticePrefixCls, "-leave-after"));
|
|
34
35
|
};
|
|
35
36
|
var transitionEvent = function transitionEvent() {
|
|
36
|
-
|
|
37
|
+
if (!isTransition) {
|
|
38
|
+
onClose && onClose(key);
|
|
39
|
+
}
|
|
40
|
+
isTransition = true;
|
|
37
41
|
};
|
|
38
42
|
var clearEventListener = function clearEventListener() {
|
|
39
43
|
var _a, _b;
|
|
@@ -42,6 +46,7 @@ var Notice = function Notice(props) {
|
|
|
42
46
|
};
|
|
43
47
|
var handleClose = function handleClose() {
|
|
44
48
|
var _a, _b, _c;
|
|
49
|
+
isTransition = false;
|
|
45
50
|
(_a = noticeRef.current) === null || _a === void 0 ? void 0 : _a.classList.add("".concat(noticePrefixCls, "-leave"));
|
|
46
51
|
(_b = noticeRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('animationend', animationEvent);
|
|
47
52
|
(_c = noticeRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('transitionend', transitionEvent);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { CSSProperties, FunctionComponentElement } from 'react';
|
|
2
|
+
export declare type QRPropsCanvas = QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement>;
|
|
3
|
+
export declare type QRPropsSvg = QRProps & React.SVGAttributes<SVGSVGElement>;
|
|
4
|
+
export declare const QRCodeTypes: ["canvas", "svg"];
|
|
5
|
+
export declare type QRCodeType = typeof QRCodeTypes[number];
|
|
6
|
+
export declare const QRCodeStatus: ["active", "expired", "loading"];
|
|
7
|
+
export declare type QRCodeStatus = typeof QRCodeStatus[number];
|
|
8
|
+
export declare const QRCodeErrorLevels: ["L", "M", "Q", "H"];
|
|
9
|
+
export declare type QRCodeErrorLevel = typeof QRCodeErrorLevels[number];
|
|
10
|
+
interface ImageSettings {
|
|
11
|
+
src: string;
|
|
12
|
+
height: number;
|
|
13
|
+
width: number;
|
|
14
|
+
excavate: boolean;
|
|
15
|
+
x?: number;
|
|
16
|
+
y?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface QRProps {
|
|
19
|
+
value: string;
|
|
20
|
+
type?: QRCodeType;
|
|
21
|
+
size?: number;
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
color?: string;
|
|
24
|
+
bgColor?: string;
|
|
25
|
+
bordered?: boolean;
|
|
26
|
+
imageSettings?: ImageSettings;
|
|
27
|
+
}
|
|
28
|
+
export interface QRCodeProps extends QRProps {
|
|
29
|
+
className?: string;
|
|
30
|
+
prefixCls?: string;
|
|
31
|
+
icon?: string;
|
|
32
|
+
iconSize?: number;
|
|
33
|
+
status?: QRCodeStatus;
|
|
34
|
+
errorLevel?: QRCodeErrorLevel;
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
onRefresh?: () => void;
|
|
37
|
+
}
|
|
38
|
+
declare const QRCode: {
|
|
39
|
+
(props: QRCodeProps): FunctionComponentElement<QRCodeProps>;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
42
|
+
export default QRCode;
|