@kdcloudjs/kdesign 1.7.68-stable.8 → 1.7.68-stable.9
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 +33 -0
- package/dist/kdesign-complete.less +110 -0
- package/dist/kdesign.css +365 -1
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +3876 -167
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +12 -12
- package/dist/kdesign.min.js.map +1 -1
- package/es/_utils/useId.d.ts +2 -0
- package/es/_utils/useId.js +30 -0
- package/es/city-picker/city-picker.js +16 -28
- package/es/city-picker/option.js +1 -5
- package/es/city-picker/style/index.css +8 -0
- package/es/city-picker/style/index.less +10 -0
- package/es/config-provider/compDefaultProps.d.ts +0 -1
- package/es/config-provider/compDefaultProps.js +0 -1
- package/es/locale/locale.d.ts +1 -0
- package/es/locale/zh-CN.d.ts +1 -0
- package/es/locale/zh-CN.js +1 -0
- package/es/popper/index.d.ts +61 -0
- package/es/popper/index.js +550 -0
- package/es/popper/style/css.js +2 -0
- package/es/popper/style/index.css +355 -0
- package/es/popper/style/index.d.ts +2 -0
- package/es/popper/style/index.js +2 -0
- package/es/popper/style/index.less +99 -0
- package/lib/_utils/useId.d.ts +2 -0
- package/lib/_utils/useId.js +43 -0
- package/lib/city-picker/city-picker.js +16 -28
- package/lib/city-picker/option.js +1 -5
- package/lib/city-picker/style/index.css +8 -0
- package/lib/city-picker/style/index.less +10 -0
- package/lib/config-provider/compDefaultProps.d.ts +0 -1
- package/lib/config-provider/compDefaultProps.js +0 -1
- package/lib/locale/locale.d.ts +1 -0
- package/lib/locale/zh-CN.d.ts +1 -0
- package/lib/locale/zh-CN.js +1 -0
- package/lib/popper/index.d.ts +61 -0
- package/lib/popper/index.js +567 -0
- package/lib/popper/style/css.js +4 -0
- package/lib/popper/style/index.css +355 -0
- package/lib/popper/style/index.d.ts +2 -0
- package/lib/popper/style/index.js +4 -0
- package/lib/popper/style/index.less +99 -0
- package/lib/style/components.less +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
2
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
function getUseId() {
|
|
5
|
+
var fullClone = _extends({}, React);
|
|
6
|
+
return fullClone === null || fullClone === void 0 ? void 0 : fullClone.useId;
|
|
7
|
+
}
|
|
8
|
+
var uuid = 0;
|
|
9
|
+
var useOriginId = getUseId();
|
|
10
|
+
export default useOriginId ? function useId(id) {
|
|
11
|
+
var reactId = useOriginId();
|
|
12
|
+
if (id) {
|
|
13
|
+
return id;
|
|
14
|
+
}
|
|
15
|
+
return reactId;
|
|
16
|
+
} : function useCompatId(id) {
|
|
17
|
+
var _React$useState = React.useState('ssr-id'),
|
|
18
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
19
|
+
innerId = _React$useState2[0],
|
|
20
|
+
setInnerId = _React$useState2[1];
|
|
21
|
+
React.useEffect(function () {
|
|
22
|
+
var nextId = uuid;
|
|
23
|
+
uuid += 1;
|
|
24
|
+
setInnerId("kd_unique_".concat(nextId));
|
|
25
|
+
}, []);
|
|
26
|
+
if (id) {
|
|
27
|
+
return id;
|
|
28
|
+
}
|
|
29
|
+
return innerId;
|
|
30
|
+
};
|
|
@@ -6,13 +6,14 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
|
6
6
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
7
7
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
8
8
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
9
|
+
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
9
10
|
import React, { useContext, useRef, useEffect, useState, useCallback, useMemo } from 'react';
|
|
10
11
|
import { useMergedState } from '../_utils/hooks';
|
|
11
12
|
import classNames from 'classnames';
|
|
12
13
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
13
14
|
import { getCompProps } from '../_utils';
|
|
14
15
|
import { Icon, Tabs, Spin } from '../index';
|
|
15
|
-
import
|
|
16
|
+
import Popper from '../popper';
|
|
16
17
|
import Option from './option';
|
|
17
18
|
import escapeRegExp from 'lodash/escapeRegExp';
|
|
18
19
|
import KeyCode from '../_utils/KeyCode';
|
|
@@ -59,7 +60,8 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
59
60
|
clearIcon = selectProps.clearIcon,
|
|
60
61
|
loading = selectProps.loading,
|
|
61
62
|
showDescription = selectProps.showDescription,
|
|
62
|
-
|
|
63
|
+
_selectProps$descript = selectProps.description,
|
|
64
|
+
description = _selectProps$descript === void 0 ? cityPickerLangMsg.title : _selectProps$descript,
|
|
63
65
|
optionHighlightProps = selectProps.optionHighlightProps,
|
|
64
66
|
_selectProps$popperSt = selectProps.popperStyle,
|
|
65
67
|
popperStyle = _selectProps$popperSt === void 0 ? {} : _selectProps$popperSt,
|
|
@@ -152,15 +154,6 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
152
154
|
setAfterChangeFocus(false);
|
|
153
155
|
onBlur && onBlur(e);
|
|
154
156
|
}, [onBlur]);
|
|
155
|
-
useEffect(function () {
|
|
156
|
-
selectionRef.current.addEventListener('mouseup', function (e) {
|
|
157
|
-
var _a;
|
|
158
|
-
var isCloseBtn = ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.className.indexOf('kd-tag-close-icon')) > -1;
|
|
159
|
-
if (isCloseBtn) {
|
|
160
|
-
e.stopPropagation();
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}, []);
|
|
164
157
|
// 输入框变化搜索内容
|
|
165
158
|
var handleSearchChange = useCallback(function (event) {
|
|
166
159
|
var val = event.currentTarget.value;
|
|
@@ -365,14 +358,7 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
365
358
|
}, [optionShow]);
|
|
366
359
|
useEffect(function () {
|
|
367
360
|
var _a;
|
|
368
|
-
|
|
369
|
-
e.stopPropagation();
|
|
370
|
-
};
|
|
371
|
-
(_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseup', fn);
|
|
372
|
-
return function () {
|
|
373
|
-
var _a;
|
|
374
|
-
(_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', fn);
|
|
375
|
-
};
|
|
361
|
+
(_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('click', handleReset);
|
|
376
362
|
}, [initValue]);
|
|
377
363
|
// keyboard
|
|
378
364
|
var curkeyboardList = useMemo(function () {
|
|
@@ -402,15 +388,17 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
402
388
|
setActiveIndex(index === undefined ? getActiveIndex(0) : index);
|
|
403
389
|
};
|
|
404
390
|
useEffect(function () {
|
|
405
|
-
|
|
406
|
-
|
|
391
|
+
var index = _findIndexInstanceProperty(curkeyboardList).call(curkeyboardList, function (item) {
|
|
392
|
+
return item.id === initValue;
|
|
393
|
+
});
|
|
394
|
+
initActiveIndex(index >= 0 ? index : undefined);
|
|
395
|
+
}, [curkeyboardList, initValue]);
|
|
407
396
|
var onInternalKeyDown = function onInternalKeyDown(e) {
|
|
408
397
|
var _a, _b, _c;
|
|
409
398
|
var which = e.which;
|
|
410
399
|
// open
|
|
411
400
|
if (which === KeyCode.ENTER || which === KeyCode.UP || which === KeyCode.DOWN) {
|
|
412
401
|
e.preventDefault();
|
|
413
|
-
setOptionShow(true);
|
|
414
402
|
}
|
|
415
403
|
// up、down、enter、esc
|
|
416
404
|
if (optionShow) {
|
|
@@ -431,6 +419,8 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
431
419
|
break;
|
|
432
420
|
}
|
|
433
421
|
case KeyCode.ESC:
|
|
422
|
+
e.stopPropagation();
|
|
423
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
434
424
|
handleVisibleChange(false);
|
|
435
425
|
break;
|
|
436
426
|
default:
|
|
@@ -476,15 +466,11 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
476
466
|
minWidth: width,
|
|
477
467
|
maxWidth: 600
|
|
478
468
|
}, dropdownStyle), {
|
|
479
|
-
width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || 'auto'
|
|
480
|
-
zIndex: 1050
|
|
469
|
+
width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || 'auto'
|
|
481
470
|
}), popperStyle);
|
|
482
471
|
}
|
|
483
472
|
};
|
|
484
473
|
var handleVisibleChange = function handleVisibleChange(visible) {
|
|
485
|
-
if (!visible) {
|
|
486
|
-
initActiveIndex(-1);
|
|
487
|
-
}
|
|
488
474
|
if (visible !== optionShow) {
|
|
489
475
|
props.visible === undefined && setOptionShow(visible);
|
|
490
476
|
onVisibleChange && onVisibleChange(visible);
|
|
@@ -504,7 +490,9 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
504
490
|
}
|
|
505
491
|
}
|
|
506
492
|
});
|
|
507
|
-
return
|
|
493
|
+
return /*#__PURE__*/React.createElement(Popper, _extends({
|
|
494
|
+
tip: renderContent()
|
|
495
|
+
}, popperProps), renderCityPicker());
|
|
508
496
|
};
|
|
509
497
|
var Select = /*#__PURE__*/React.forwardRef(InternalSelect);
|
|
510
498
|
Select.displayName = 'CityPicker';
|
package/es/city-picker/option.js
CHANGED
|
@@ -33,16 +33,12 @@ var InternalOption = function InternalOption(props, ref) {
|
|
|
33
33
|
var handleOnMouseEnter = function handleOnMouseEnter() {
|
|
34
34
|
onChangeActiveIndex && onChangeActiveIndex(index);
|
|
35
35
|
};
|
|
36
|
-
var handleOnMouseLeave = function handleOnMouseLeave() {
|
|
37
|
-
onChangeActiveIndex && onChangeActiveIndex(-1);
|
|
38
|
-
};
|
|
39
36
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
40
37
|
ref: optionRef,
|
|
41
38
|
className: optionCls,
|
|
42
39
|
title: name,
|
|
43
40
|
onClick: handleClick,
|
|
44
|
-
onMouseEnter: handleOnMouseEnter
|
|
45
|
-
onMouseLeave: handleOnMouseLeave
|
|
41
|
+
onMouseEnter: handleOnMouseEnter
|
|
46
42
|
}, typeof itemRender === 'function' ? itemRender(city) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
47
43
|
className: "".concat(selectOptionPrefixCls, "-content")
|
|
48
44
|
}, children), /*#__PURE__*/React.createElement("span", {
|
|
@@ -270,6 +270,14 @@
|
|
|
270
270
|
-webkit-box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2);
|
|
271
271
|
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2);
|
|
272
272
|
}
|
|
273
|
+
.kd-city-picker-dropdown.kd-popper-bottom-start-in {
|
|
274
|
+
-webkit-animation-name: kdSlideUpIn;
|
|
275
|
+
animation-name: kdSlideUpIn;
|
|
276
|
+
}
|
|
277
|
+
.kd-city-picker-dropdown.kd-popper-bottom-start-out {
|
|
278
|
+
-webkit-animation-name: kdSlideUpOut;
|
|
279
|
+
animation-name: kdSlideUpOut;
|
|
280
|
+
}
|
|
273
281
|
.kd-city-picker-dropdown .kd-tabs-tab-list {
|
|
274
282
|
width: 100%;
|
|
275
283
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
@city-picker-prefix-cls: ~'@{kd-prefix}-city-picker';
|
|
6
6
|
@tabs-prefix-cls: ~'@{kd-prefix}-tabs';
|
|
7
|
+
@popper-prefix-cls: ~'@{kd-prefix}-popper';
|
|
7
8
|
|
|
8
9
|
.@{city-picker-prefix-cls} {
|
|
9
10
|
position: relative;
|
|
@@ -156,6 +157,15 @@
|
|
|
156
157
|
outline: none;
|
|
157
158
|
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2);
|
|
158
159
|
|
|
160
|
+
&.@{popper-prefix-cls}-bottom-start {
|
|
161
|
+
&-in {
|
|
162
|
+
animation-name: kdSlideUpIn;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&-out {
|
|
166
|
+
animation-name: kdSlideUpOut;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
159
169
|
// 调整tabs样式
|
|
160
170
|
.@{tabs-prefix-cls}-tab-list {
|
|
161
171
|
width: 100%;
|
package/es/locale/locale.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ declare class LocaleCache {
|
|
|
69
69
|
'CityPicker.commonEmptyText': string;
|
|
70
70
|
'CityPicker.tabsDomestic': string;
|
|
71
71
|
'CityPicker.tabsInternation': string;
|
|
72
|
+
'CityPicker.title': string;
|
|
72
73
|
'ColorPicker.followFunctionalColor': string;
|
|
73
74
|
'Search.placeholder': string;
|
|
74
75
|
'Search.desc': string[];
|
package/es/locale/zh-CN.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ declare const locale: {
|
|
|
41
41
|
'CityPicker.commonEmptyText': string;
|
|
42
42
|
'CityPicker.tabsDomestic': string;
|
|
43
43
|
'CityPicker.tabsInternation': string;
|
|
44
|
+
'CityPicker.title': string;
|
|
44
45
|
'ColorPicker.followFunctionalColor': string;
|
|
45
46
|
'Search.placeholder': string;
|
|
46
47
|
'Search.desc': string[];
|
package/es/locale/zh-CN.js
CHANGED
|
@@ -45,6 +45,7 @@ var locale = _extends(_extends({
|
|
|
45
45
|
'CityPicker.commonEmptyText': '无常用城市',
|
|
46
46
|
'CityPicker.tabsDomestic': '国内',
|
|
47
47
|
'CityPicker.tabsInternation': '国际/中国港澳台',
|
|
48
|
+
'CityPicker.title': '城市',
|
|
48
49
|
'ColorPicker.followFunctionalColor': '跟随功能色',
|
|
49
50
|
'Search.placeholder': '请输入需要搜索的内容',
|
|
50
51
|
'Search.desc': ['空格代表"或",回车代表"且"'],
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modifier, Placement } from '@popperjs/core';
|
|
3
|
+
export declare const Placements: ["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"];
|
|
4
|
+
export declare type PlacementType = typeof Placements[number];
|
|
5
|
+
export declare const Triggers: ["hover", "focus", "click", "contextMenu"];
|
|
6
|
+
export declare type TriggerType = typeof Triggers[number];
|
|
7
|
+
export declare type Reason = TriggerType | 'scroll' | 'clickOutside' | 'clickToClose' | 'parentHidden' | 'unknown';
|
|
8
|
+
export declare type RenderFunction = () => React.ReactNode;
|
|
9
|
+
export declare type PopperProps = {
|
|
10
|
+
gap?: number;
|
|
11
|
+
arrow?: boolean;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
prefixCls?: string;
|
|
14
|
+
arrowSize?: number;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
arrowOffset?: number;
|
|
17
|
+
scrollHidden?: boolean;
|
|
18
|
+
mouseEnterDelay?: number;
|
|
19
|
+
mouseLeaveDelay?: number;
|
|
20
|
+
defaultVisible?: boolean;
|
|
21
|
+
autoPlacement?: boolean;
|
|
22
|
+
autoPlacementList?: Placement[];
|
|
23
|
+
className?: string;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
popperClassName?: string;
|
|
26
|
+
popperStyle?: React.CSSProperties;
|
|
27
|
+
popperOuterClassName?: string;
|
|
28
|
+
popperOuterStyle?: React.CSSProperties;
|
|
29
|
+
placement?: PlacementType;
|
|
30
|
+
tip?: any;
|
|
31
|
+
trigger?: TriggerType | Array<TriggerType>;
|
|
32
|
+
strategy?: 'fixed' | 'absolute';
|
|
33
|
+
clickToClose?: boolean;
|
|
34
|
+
onTrigger?: (trigger: TriggerType) => void;
|
|
35
|
+
onVisibleChange?: (visible: boolean, reason?: Reason) => void;
|
|
36
|
+
getTriggerElement?: (locatorNode: HTMLElement) => HTMLElement;
|
|
37
|
+
getPopupContainer?: (locatorNode: HTMLElement) => HTMLElement;
|
|
38
|
+
onTransitionEnd?: (e: React.TransitionEvent) => void;
|
|
39
|
+
onAnimationEnd?: (e: React.AnimationEvent) => void;
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
customerModifiers?: (modifiers: Partial<Modifier<any, any>>[]) => Partial<Modifier<any, any>>[];
|
|
42
|
+
};
|
|
43
|
+
export interface TriggerContextProps {
|
|
44
|
+
registerSubPopup: (id: string, node: any) => void;
|
|
45
|
+
}
|
|
46
|
+
export declare const popperPlacementMap: {
|
|
47
|
+
top: string;
|
|
48
|
+
left: string;
|
|
49
|
+
right: string;
|
|
50
|
+
bottom: string;
|
|
51
|
+
topLeft: string;
|
|
52
|
+
topRight: string;
|
|
53
|
+
bottomLeft: string;
|
|
54
|
+
bottomRight: string;
|
|
55
|
+
leftTop: string;
|
|
56
|
+
leftBottom: string;
|
|
57
|
+
rightTop: string;
|
|
58
|
+
rightBottom: string;
|
|
59
|
+
};
|
|
60
|
+
export declare const Popper: React.ForwardRefExoticComponent<PopperProps & React.RefAttributes<unknown>>;
|
|
61
|
+
export default Popper;
|