@kdcloudjs/kdesign 1.7.19 → 1.7.20

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/kdesign-complete.less +331 -239
  3. package/dist/kdesign.css +266 -239
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +512 -625
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +2 -2
  8. package/dist/kdesign.min.js +9 -9
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/button/style/token.less +1 -0
  11. package/es/checkbox/checkbox.js +5 -5
  12. package/es/checkbox/style/index.css +2 -0
  13. package/es/checkbox/style/index.less +2 -0
  14. package/es/checkbox/style/token.less +1 -1
  15. package/es/city-picker/city-picker.d.ts +3 -23
  16. package/es/city-picker/city-picker.js +351 -124
  17. package/es/city-picker/interface.d.ts +57 -0
  18. package/es/city-picker/interface.js +3 -0
  19. package/es/city-picker/option.d.ts +4 -0
  20. package/es/city-picker/option.js +42 -0
  21. package/es/city-picker/style/index.css +264 -239
  22. package/es/city-picker/style/index.less +262 -218
  23. package/es/city-picker/style/mixin.less +26 -3
  24. package/es/city-picker/style/token.less +42 -14
  25. package/es/config-provider/compDefaultProps.d.ts +13 -0
  26. package/es/config-provider/compDefaultProps.js +13 -0
  27. package/es/input/style/token.less +2 -8
  28. package/lib/button/style/token.less +1 -0
  29. package/lib/checkbox/checkbox.js +4 -4
  30. package/lib/checkbox/style/index.css +2 -0
  31. package/lib/checkbox/style/index.less +2 -0
  32. package/lib/checkbox/style/token.less +1 -1
  33. package/lib/city-picker/city-picker.d.ts +3 -23
  34. package/lib/city-picker/city-picker.js +350 -123
  35. package/lib/city-picker/interface.d.ts +57 -0
  36. package/lib/city-picker/interface.js +11 -0
  37. package/lib/city-picker/option.d.ts +4 -0
  38. package/lib/city-picker/option.js +55 -0
  39. package/lib/city-picker/style/index.css +264 -239
  40. package/lib/city-picker/style/index.less +262 -218
  41. package/lib/city-picker/style/mixin.less +26 -3
  42. package/lib/city-picker/style/token.less +42 -14
  43. package/lib/config-provider/compDefaultProps.d.ts +13 -0
  44. package/lib/config-provider/compDefaultProps.js +13 -0
  45. package/lib/input/style/token.less +2 -8
  46. package/package.json +1 -1
  47. package/es/city-picker/city-group.d.ts +0 -8
  48. package/es/city-picker/city-group.js +0 -38
  49. package/es/city-picker/city-list.d.ts +0 -12
  50. package/es/city-picker/city-list.js +0 -55
  51. package/es/city-picker/city-panel-item.d.ts +0 -13
  52. package/es/city-picker/city-panel-item.js +0 -22
  53. package/es/city-picker/city-panel.d.ts +0 -17
  54. package/es/city-picker/city-panel.js +0 -153
  55. package/es/city-picker/city-search-panel.d.ts +0 -9
  56. package/es/city-picker/city-search-panel.js +0 -44
  57. package/es/city-picker/no-data.d.ts +0 -3
  58. package/es/city-picker/no-data.js +0 -18
  59. package/es/city-picker/utils/grouping.d.ts +0 -7
  60. package/es/city-picker/utils/grouping.js +0 -24
  61. package/lib/city-picker/city-group.d.ts +0 -8
  62. package/lib/city-picker/city-group.js +0 -51
  63. package/lib/city-picker/city-list.d.ts +0 -12
  64. package/lib/city-picker/city-list.js +0 -68
  65. package/lib/city-picker/city-panel-item.d.ts +0 -13
  66. package/lib/city-picker/city-panel-item.js +0 -35
  67. package/lib/city-picker/city-panel.d.ts +0 -17
  68. package/lib/city-picker/city-panel.js +0 -166
  69. package/lib/city-picker/city-search-panel.d.ts +0 -9
  70. package/lib/city-picker/city-search-panel.js +0 -57
  71. package/lib/city-picker/no-data.d.ts +0 -3
  72. package/lib/city-picker/no-data.js +0 -31
  73. package/lib/city-picker/utils/grouping.d.ts +0 -7
  74. 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,3 @@
1
+ import { tuple } from '../_utils/type';
2
+ export var BorderTypes = tuple('none', 'underline', 'bordered');
3
+ export var Sizes = tuple('large', 'middle', 'small'); // 选择框大小
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ICityPickerOptionProps } from './interface';
3
+ declare const Option: React.ForwardRefExoticComponent<ICityPickerOptionProps & React.RefAttributes<unknown>>;
4
+ export default Option;
@@ -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;