@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,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Sizes = exports.BorderTypes = void 0;
7
+ var _type = require("../_utils/type");
8
+ var BorderTypes = (0, _type.tuple)('none', 'underline', 'bordered');
9
+ exports.BorderTypes = BorderTypes;
10
+ var Sizes = (0, _type.tuple)('large', 'middle', 'small'); // 选择框大小
11
+ exports.Sizes = Sizes;
@@ -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,55 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
4
+ var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
5
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
6
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
12
+ var _react = _interopRequireWildcard(require("react"));
13
+ var _classnames = _interopRequireDefault(require("classnames"));
14
+ var _ConfigContext = _interopRequireDefault(require("../config-provider/ConfigContext"));
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+ var InternalOption = function InternalOption(props, ref) {
18
+ var _classNames;
19
+ var optionRef = (0, _react.useRef)(null) || ref;
20
+ var children = props.children,
21
+ value = props.value,
22
+ disabled = props.disabled,
23
+ onChangeSelect = props.onChangeSelect,
24
+ _props$city = props.city,
25
+ city = _props$city === void 0 ? {} : _props$city,
26
+ renderCityInfo = props.renderCityInfo,
27
+ itemRender = props.itemRender;
28
+ var id = city.id,
29
+ name = city.name;
30
+ var _useContext = (0, _react.useContext)(_ConfigContext.default),
31
+ getPrefixCls = _useContext.getPrefixCls,
32
+ prefixCls = _useContext.prefixCls;
33
+ var selectOptionPrefixCls = getPrefixCls(prefixCls, 'city-picker-list-item');
34
+ var isSelected = id !== undefined ? id === value : false;
35
+ var optionCls = (0, _classnames.default)(selectOptionPrefixCls, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(selectOptionPrefixCls, "-selected"), isSelected), (0, _defineProperty2.default)(_classNames, "".concat(selectOptionPrefixCls, "-disabled"), disabled), _classNames));
36
+ var handleClick = function handleClick(e) {
37
+ e.preventDefault();
38
+ if (disabled || id === undefined) return;
39
+ onChangeSelect === null || onChangeSelect === void 0 ? void 0 : onChangeSelect(city);
40
+ };
41
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
42
+ ref: optionRef,
43
+ className: optionCls,
44
+ title: name,
45
+ onClick: handleClick
46
+ }, typeof itemRender === 'function' ? itemRender(city) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
47
+ className: "".concat(selectOptionPrefixCls, "-content")
48
+ }, children), /*#__PURE__*/_react.default.createElement("div", {
49
+ className: "".concat(selectOptionPrefixCls, "-info")
50
+ }, renderCityInfo === null || renderCityInfo === void 0 ? void 0 : renderCityInfo(city, true)))));
51
+ };
52
+ var Option = /*#__PURE__*/_react.default.forwardRef(InternalOption);
53
+ Option.displayName = 'CityPickerOption';
54
+ var _default = Option;
55
+ exports.default = _default;