@kdcloudjs/kdesign 1.7.19 → 1.7.21
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 +51 -0
- package/dist/kdesign-complete.less +337 -240
- package/dist/kdesign.css +270 -240
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +766 -850
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +9 -9
- package/dist/kdesign.min.js.map +1 -1
- package/es/button/style/token.less +1 -0
- package/es/checkbox/checkbox.js +5 -5
- package/es/checkbox/style/index.css +2 -0
- package/es/checkbox/style/index.less +2 -0
- package/es/checkbox/style/token.less +1 -1
- package/es/city-picker/city-picker.d.ts +3 -23
- package/es/city-picker/city-picker.js +351 -124
- package/es/city-picker/interface.d.ts +57 -0
- package/es/city-picker/interface.js +3 -0
- package/es/city-picker/option.d.ts +4 -0
- package/es/city-picker/option.js +42 -0
- package/es/city-picker/style/index.css +264 -239
- package/es/city-picker/style/index.less +262 -218
- package/es/city-picker/style/mixin.less +26 -3
- package/es/city-picker/style/token.less +42 -14
- package/es/config-provider/compDefaultProps.d.ts +15 -0
- package/es/config-provider/compDefaultProps.js +16 -1
- package/es/input/style/token.less +2 -8
- package/es/select/select.js +25 -15
- package/es/tree/tree.js +61 -57
- package/es/tree/treeNode.js +1 -6
- package/es/tree-select/interface.d.ts +1 -0
- package/es/tree-select/style/index.css +4 -1
- package/es/tree-select/style/index.less +5 -1
- package/es/tree-select/style/token.less +1 -0
- package/es/tree-select/tree-select.js +18 -4
- package/lib/button/style/token.less +1 -0
- package/lib/checkbox/checkbox.js +4 -4
- package/lib/checkbox/style/index.css +2 -0
- package/lib/checkbox/style/index.less +2 -0
- package/lib/checkbox/style/token.less +1 -1
- package/lib/city-picker/city-picker.d.ts +3 -23
- package/lib/city-picker/city-picker.js +350 -123
- package/lib/city-picker/interface.d.ts +57 -0
- package/lib/city-picker/interface.js +11 -0
- package/lib/city-picker/option.d.ts +4 -0
- package/lib/city-picker/option.js +55 -0
- package/lib/city-picker/style/index.css +264 -239
- package/lib/city-picker/style/index.less +262 -218
- package/lib/city-picker/style/mixin.less +26 -3
- package/lib/city-picker/style/token.less +42 -14
- package/lib/config-provider/compDefaultProps.d.ts +15 -0
- package/lib/config-provider/compDefaultProps.js +16 -1
- package/lib/input/style/token.less +2 -8
- package/lib/select/select.js +25 -15
- package/lib/tree/tree.js +60 -56
- package/lib/tree/treeNode.js +1 -6
- package/lib/tree-select/interface.d.ts +1 -0
- package/lib/tree-select/style/index.css +4 -1
- package/lib/tree-select/style/index.less +5 -1
- package/lib/tree-select/style/token.less +1 -0
- package/lib/tree-select/tree-select.js +20 -6
- package/package.json +1 -1
- package/es/city-picker/city-group.d.ts +0 -8
- package/es/city-picker/city-group.js +0 -38
- package/es/city-picker/city-list.d.ts +0 -12
- package/es/city-picker/city-list.js +0 -55
- package/es/city-picker/city-panel-item.d.ts +0 -13
- package/es/city-picker/city-panel-item.js +0 -22
- package/es/city-picker/city-panel.d.ts +0 -17
- package/es/city-picker/city-panel.js +0 -153
- package/es/city-picker/city-search-panel.d.ts +0 -9
- package/es/city-picker/city-search-panel.js +0 -44
- package/es/city-picker/no-data.d.ts +0 -3
- package/es/city-picker/no-data.js +0 -18
- package/es/city-picker/utils/grouping.d.ts +0 -7
- package/es/city-picker/utils/grouping.js +0 -24
- package/lib/city-picker/city-group.d.ts +0 -8
- package/lib/city-picker/city-group.js +0 -51
- package/lib/city-picker/city-list.d.ts +0 -12
- package/lib/city-picker/city-list.js +0 -68
- package/lib/city-picker/city-panel-item.d.ts +0 -13
- package/lib/city-picker/city-panel-item.js +0 -35
- package/lib/city-picker/city-panel.d.ts +0 -17
- package/lib/city-picker/city-panel.js +0 -166
- package/lib/city-picker/city-search-panel.d.ts +0 -9
- package/lib/city-picker/city-search-panel.js +0 -57
- package/lib/city-picker/no-data.d.ts +0 -3
- package/lib/city-picker/no-data.js +0 -31
- package/lib/city-picker/utils/grouping.d.ts +0 -7
- package/lib/city-picker/utils/grouping.js +0 -30
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare type City = {
|
|
3
|
+
id?: string | number;
|
|
4
|
+
country?: string;
|
|
5
|
+
province?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
export declare const BorderTypes: ["none", "underline", "bordered"];
|
|
10
|
+
export declare type BorderType = typeof BorderTypes[number];
|
|
11
|
+
export declare const Sizes: ["large", "middle", "small"];
|
|
12
|
+
export declare type Size = typeof Sizes[number];
|
|
13
|
+
export declare type Type = 'domestic' | 'foreign';
|
|
14
|
+
export declare type CityList = Array<City>;
|
|
15
|
+
export interface CityPickerProps {
|
|
16
|
+
prefixCls?: string;
|
|
17
|
+
size?: Size;
|
|
18
|
+
borderType?: BorderType;
|
|
19
|
+
notFoundContent?: React.ReactNode;
|
|
20
|
+
showArrow?: boolean;
|
|
21
|
+
defaultOpen?: boolean;
|
|
22
|
+
allowClear?: boolean;
|
|
23
|
+
placeholder?: React.ReactNode;
|
|
24
|
+
type?: Type;
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
domesticList?: CityList;
|
|
27
|
+
foreignList?: CityList;
|
|
28
|
+
commonList?: CityList;
|
|
29
|
+
className?: string;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
title?: string;
|
|
33
|
+
clearIcon?: React.ReactNode;
|
|
34
|
+
suffixIcon?: React.ReactNode;
|
|
35
|
+
optionHighlightProps?: string;
|
|
36
|
+
value?: string | number;
|
|
37
|
+
defaultValue?: string | number;
|
|
38
|
+
description?: React.ReactNode;
|
|
39
|
+
showDescription?: boolean;
|
|
40
|
+
onChange?: (value: string | number, city: City) => void;
|
|
41
|
+
onBlur?: (e: React.ChangeEvent<HTMLSpanElement>) => void;
|
|
42
|
+
onFocus?: () => void;
|
|
43
|
+
onSearch?: (value: string) => void;
|
|
44
|
+
onClear?: () => void;
|
|
45
|
+
itemRender?: (city: City) => React.ReactNode;
|
|
46
|
+
}
|
|
47
|
+
export interface ICityPickerOptionProps {
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
city?: City;
|
|
50
|
+
value?: string | number;
|
|
51
|
+
children?: React.ReactNode;
|
|
52
|
+
className?: string;
|
|
53
|
+
style?: React.CSSProperties;
|
|
54
|
+
onChangeSelect?: (city: City | null) => void;
|
|
55
|
+
renderCityInfo?: (city: City, flag?: boolean, symbol?: string) => React.ReactNode;
|
|
56
|
+
itemRender?: (city: City) => React.ReactNode;
|
|
57
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
|
+
import React, { useContext, useRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import ConfigContext from '../config-provider/ConfigContext';
|
|
5
|
+
var InternalOption = function InternalOption(props, ref) {
|
|
6
|
+
var _classNames;
|
|
7
|
+
var optionRef = useRef(null) || ref;
|
|
8
|
+
var children = props.children,
|
|
9
|
+
value = props.value,
|
|
10
|
+
disabled = props.disabled,
|
|
11
|
+
onChangeSelect = props.onChangeSelect,
|
|
12
|
+
_props$city = props.city,
|
|
13
|
+
city = _props$city === void 0 ? {} : _props$city,
|
|
14
|
+
renderCityInfo = props.renderCityInfo,
|
|
15
|
+
itemRender = props.itemRender;
|
|
16
|
+
var id = city.id,
|
|
17
|
+
name = city.name;
|
|
18
|
+
var _useContext = useContext(ConfigContext),
|
|
19
|
+
getPrefixCls = _useContext.getPrefixCls,
|
|
20
|
+
prefixCls = _useContext.prefixCls;
|
|
21
|
+
var selectOptionPrefixCls = getPrefixCls(prefixCls, 'city-picker-list-item');
|
|
22
|
+
var isSelected = id !== undefined ? id === value : false;
|
|
23
|
+
var optionCls = classNames(selectOptionPrefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(selectOptionPrefixCls, "-selected"), isSelected), _defineProperty(_classNames, "".concat(selectOptionPrefixCls, "-disabled"), disabled), _classNames));
|
|
24
|
+
var handleClick = function handleClick(e) {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
if (disabled || id === undefined) return;
|
|
27
|
+
onChangeSelect === null || onChangeSelect === void 0 ? void 0 : onChangeSelect(city);
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
ref: optionRef,
|
|
31
|
+
className: optionCls,
|
|
32
|
+
title: name,
|
|
33
|
+
onClick: handleClick
|
|
34
|
+
}, typeof itemRender === 'function' ? itemRender(city) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: "".concat(selectOptionPrefixCls, "-content")
|
|
36
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "".concat(selectOptionPrefixCls, "-info")
|
|
38
|
+
}, renderCityInfo === null || renderCityInfo === void 0 ? void 0 : renderCityInfo(city, true)))));
|
|
39
|
+
};
|
|
40
|
+
var Option = /*#__PURE__*/React.forwardRef(InternalOption);
|
|
41
|
+
Option.displayName = 'CityPickerOption';
|
|
42
|
+
export default Option;
|