@kdcloudjs/kdesign 1.5.10 → 1.5.11
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/dist/kdesign-complete.less +4 -7
- package/dist/kdesign.css +5 -8
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +959 -221
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +6 -6
- package/dist/kdesign.min.js.map +1 -1
- package/es/_utils/KeyCode.d.ts +436 -0
- package/es/_utils/KeyCode.js +623 -0
- package/es/_utils/hooks.d.ts +1 -0
- package/es/_utils/hooks.js +51 -1
- package/es/alert/style/index.css +0 -1
- package/es/alert/style/index.less +0 -1
- package/es/button/style/index.css +3 -0
- package/es/button/style/mixin.less +3 -0
- package/es/config-provider/compDefaultProps.d.ts +1 -0
- package/es/config-provider/compDefaultProps.js +2 -1
- package/es/date-picker/date-picker.js +15 -14
- package/es/date-picker/hooks/use-picker-input.js +44 -38
- package/es/date-picker/range-picker.js +24 -13
- package/es/drawer/drawer.d.ts +1 -0
- package/es/drawer/drawer.js +6 -3
- package/es/notification-base/notification.js +4 -4
- package/es/pagination/style/index.css +1 -3
- package/es/pagination/style/index.less +1 -3
- package/es/transfer/style/index.css +0 -3
- package/es/transfer/style/index.less +0 -3
- package/lib/_utils/KeyCode.d.ts +436 -0
- package/lib/_utils/KeyCode.js +631 -0
- package/lib/_utils/hooks.d.ts +1 -0
- package/lib/_utils/hooks.js +54 -1
- package/lib/alert/style/index.css +0 -1
- package/lib/alert/style/index.less +0 -1
- package/lib/button/style/index.css +3 -0
- package/lib/button/style/mixin.less +3 -0
- package/lib/config-provider/compDefaultProps.d.ts +1 -0
- package/lib/config-provider/compDefaultProps.js +2 -1
- package/lib/date-picker/date-picker.js +15 -15
- package/lib/date-picker/hooks/use-picker-input.js +45 -37
- package/lib/date-picker/range-picker.js +24 -14
- package/lib/drawer/drawer.d.ts +1 -0
- package/lib/drawer/drawer.js +5 -2
- package/lib/notification-base/notification.js +4 -3
- package/lib/pagination/style/index.css +1 -3
- package/lib/pagination/style/index.less +1 -3
- package/lib/transfer/style/index.css +0 -3
- package/lib/transfer/style/index.less +0 -3
- package/package.json +1 -1
|
@@ -3,7 +3,6 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
|
3
3
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
4
4
|
import React, { useContext, useEffect } from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
-
import parse from 'date-fns/parse';
|
|
7
6
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
8
7
|
import { useMergedState, useOnClickOutside } from '../_utils/hooks';
|
|
9
8
|
import { getCompProps } from '../_utils';
|
|
@@ -168,19 +167,21 @@ function DatePicker(props) {
|
|
|
168
167
|
var _useTextValueMapping = useTextValueMapping({
|
|
169
168
|
valueText: valueText,
|
|
170
169
|
onTextChange: function onTextChange(newText) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
170
|
+
if (newText === '') {
|
|
171
|
+
setSelectedValue(null);
|
|
172
|
+
setDateValue(null);
|
|
173
|
+
} else if (newText && newText.length === _format.length) {
|
|
174
|
+
var inputTempDate = parseDate(newText, _format);
|
|
175
|
+
|
|
176
|
+
if (inputTempDate && (!disabledDate || !disabledDate(inputTempDate))) {
|
|
177
|
+
if (picker !== 'year') {
|
|
178
|
+
setSelectedValue(inputTempDate);
|
|
179
|
+
setDateValue(inputTempDate);
|
|
180
|
+
} else if (isValid(inputTempDate)) {
|
|
181
|
+
setSelectedValue(inputTempDate);
|
|
182
|
+
setDateValue(inputTempDate);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
3
|
+
import { useState, useEffect, useRef } from 'react';
|
|
4
|
+
import KeyCode from '../../_utils/KeyCode';
|
|
4
5
|
export default function usePickerInput(_ref) {
|
|
5
6
|
var preventBlurRef = _ref.preventBlurRef,
|
|
6
7
|
open = _ref.open,
|
|
@@ -29,42 +30,47 @@ export default function usePickerInput(_ref) {
|
|
|
29
30
|
setTyping(true);
|
|
30
31
|
triggerOpen(true);
|
|
31
32
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
33
|
+
onKeyDown: function onKeyDown(e) {
|
|
34
|
+
var _context;
|
|
35
|
+
|
|
36
|
+
setTyping(true);
|
|
37
|
+
triggerOpen(true);
|
|
38
|
+
|
|
39
|
+
switch (e.which) {
|
|
40
|
+
case KeyCode.ENTER:
|
|
41
|
+
{
|
|
42
|
+
if (!open) {
|
|
43
|
+
triggerOpen(true);
|
|
44
|
+
} else if (onSubmit() !== false) {
|
|
45
|
+
setTyping(true);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
case KeyCode.TAB:
|
|
53
|
+
{
|
|
54
|
+
if (typing && open && !e.shiftKey) {
|
|
55
|
+
setTyping(false);
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
case KeyCode.ESC:
|
|
63
|
+
{
|
|
64
|
+
setTyping(true);
|
|
65
|
+
onCancel();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!open && !_includesInstanceProperty(_context = [KeyCode.SHIFT]).call(_context, e.which)) {
|
|
71
|
+
triggerOpen(true);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
68
74
|
onFocus: function onFocus(e) {
|
|
69
75
|
setTyping(true);
|
|
70
76
|
setFocused(true);
|
|
@@ -6,7 +6,6 @@ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
|
6
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
7
7
|
import React, { useContext, useEffect } from 'react';
|
|
8
8
|
import isSameWeek from 'date-fns/isSameWeek';
|
|
9
|
-
import parse from 'date-fns/parse';
|
|
10
9
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
11
10
|
import { useMergedState, useOnClickOutside } from '../_utils/hooks';
|
|
12
11
|
import { getCompProps } from '../_utils';
|
|
@@ -249,20 +248,32 @@ function DatePicker(props) {
|
|
|
249
248
|
});
|
|
250
249
|
|
|
251
250
|
var _onTextChange = function onTextChange(newText, index) {
|
|
252
|
-
var
|
|
251
|
+
var inputTempDate;
|
|
253
252
|
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
var disabledFunc = index === 0 ? disabledStartDate : disabledEndDate;
|
|
253
|
+
if (newText === '') {
|
|
254
|
+
if (index === 0 && selectedValue && selectedValue.length === 2) {
|
|
255
|
+
inputTempDate = selectedValue[1];
|
|
256
|
+
} else if (index === 1 && selectedValue && selectedValue.length === 2) {
|
|
257
|
+
inputTempDate = selectedValue[0];
|
|
258
|
+
}
|
|
262
259
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
if (inputTempDate) {
|
|
261
|
+
setSelectedValue(updateValues(selectedValue, inputTempDate, index));
|
|
262
|
+
setViewDate(inputTempDate, index);
|
|
263
|
+
}
|
|
264
|
+
} else if (newText && newText.length === _format.length) {
|
|
265
|
+
inputTempDate = parseDate(newText, _format);
|
|
266
|
+
var disabledFunc = index === 0 ? disabledStartDate : disabledEndDate;
|
|
267
|
+
|
|
268
|
+
if (inputTempDate && (!disabledFunc || !disabledFunc(inputTempDate))) {
|
|
269
|
+
if (picker !== 'year') {
|
|
270
|
+
setSelectedValue(updateValues(selectedValue, inputTempDate, index));
|
|
271
|
+
setViewDate(inputTempDate, index);
|
|
272
|
+
} else if (isValid(inputTempDate)) {
|
|
273
|
+
setSelectedValue(updateValues(selectedValue, inputTempDate, index));
|
|
274
|
+
setViewDate(inputTempDate, index);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
266
277
|
}
|
|
267
278
|
}; // input 展示
|
|
268
279
|
|
package/es/drawer/drawer.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export interface IDrawerProps {
|
|
|
36
36
|
width?: string | number;
|
|
37
37
|
height?: string | number;
|
|
38
38
|
zIndex?: string | number;
|
|
39
|
+
disableScroll?: boolean;
|
|
39
40
|
}
|
|
40
41
|
declare const Drawer: React.ForwardRefExoticComponent<IDrawerProps & React.RefAttributes<unknown>>;
|
|
41
42
|
export default Drawer;
|
package/es/drawer/drawer.js
CHANGED
|
@@ -12,7 +12,7 @@ import classNames from 'classnames';
|
|
|
12
12
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
13
13
|
import { getCompProps } from '../_utils';
|
|
14
14
|
import devWarning from '../_utils/devwarning';
|
|
15
|
-
import { useResizeObserver,
|
|
15
|
+
import { useResizeObserver, useOverflowHidden } from '../_utils/hooks'; // import { usePrevious } from '../_utils/hooks'
|
|
16
16
|
|
|
17
17
|
import { toArray } from '../_utils/react-children';
|
|
18
18
|
export var PlacementTypes = tuple('top', 'right', 'bottom', 'left');
|
|
@@ -37,6 +37,8 @@ var documentBody = document.body; // function transformSize(size: string | numbe
|
|
|
37
37
|
var InternalDrawer = function InternalDrawer(props, ref) {
|
|
38
38
|
var _classNames, _context2, _context3, _classNames2;
|
|
39
39
|
|
|
40
|
+
var _a;
|
|
41
|
+
|
|
40
42
|
var _useContext = useContext(ConfigContext),
|
|
41
43
|
getPrefixCls = _useContext.getPrefixCls,
|
|
42
44
|
prefixCls = _useContext.prefixCls,
|
|
@@ -70,7 +72,8 @@ var InternalDrawer = function InternalDrawer(props, ref) {
|
|
|
70
72
|
getContainer = drawerProps.getContainer,
|
|
71
73
|
forceRender = drawerProps.forceRender,
|
|
72
74
|
destroyOnClose = drawerProps.destroyOnClose,
|
|
73
|
-
customPrefixcls = drawerProps.prefixCls
|
|
75
|
+
customPrefixcls = drawerProps.prefixCls,
|
|
76
|
+
disableScroll = drawerProps.disableScroll;
|
|
74
77
|
var drawerPrefixCls = getPrefixCls(prefixCls, 'drawer', customPrefixcls);
|
|
75
78
|
|
|
76
79
|
var _useState = useState(false),
|
|
@@ -138,7 +141,7 @@ var InternalDrawer = function InternalDrawer(props, ref) {
|
|
|
138
141
|
|
|
139
142
|
return drawerContainer || ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.parentNode);
|
|
140
143
|
}, handleContainerResize);
|
|
141
|
-
|
|
144
|
+
useOverflowHidden(drawerContainer || ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.parentNode), visible && mask, disableScroll); // 为了单测
|
|
142
145
|
|
|
143
146
|
useEffect(function () {
|
|
144
147
|
setCurrentWidth(width);
|
|
@@ -60,11 +60,11 @@ var Notification = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
var remove = function remove(key) {
|
|
63
|
-
|
|
64
|
-
return
|
|
63
|
+
setNotices(function (preNotices) {
|
|
64
|
+
return _filterInstanceProperty(preNotices).call(preNotices, function (notice) {
|
|
65
|
+
return notice.key !== key;
|
|
66
|
+
});
|
|
65
67
|
});
|
|
66
|
-
|
|
67
|
-
setNotices(filter);
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
var _onClose = function onClose(notice) {
|
|
@@ -430,9 +430,7 @@
|
|
|
430
430
|
}
|
|
431
431
|
.kd-pagination.less .kd-pagination-pages-item:hover button,
|
|
432
432
|
.kd-pagination.less .kd-pagination-pages-item:active button,
|
|
433
|
-
.kd-pagination.less .kd-pagination-pages-item.active button
|
|
434
|
-
.kd-pagination.less .kd-pagination-pages-item:first-child button,
|
|
435
|
-
.kd-pagination.less .kd-pagination-pages-item:last-child button {
|
|
433
|
+
.kd-pagination.less .kd-pagination-pages-item.active button {
|
|
436
434
|
color: var(--kd-g-color-theme, #5582f3);
|
|
437
435
|
}
|
|
438
436
|
.kd-pagination.less .kd-pagination-pages-item:first-child button,
|