@kdcloudjs/kdesign 1.8.14 → 1.8.16

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 (75) hide show
  1. package/dist/kdesign-complete.less +297 -81
  2. package/dist/kdesign.css +269 -58
  3. package/dist/kdesign.css.map +1 -1
  4. package/dist/kdesign.js +987 -543
  5. package/dist/kdesign.js.map +1 -1
  6. package/dist/kdesign.min.css +3 -3
  7. package/dist/kdesign.min.js +10 -10
  8. package/dist/kdesign.min.js.map +1 -1
  9. package/es/breadcrumb/breadcrumb.js +2 -2
  10. package/es/button/group.d.ts +1 -1
  11. package/es/button/group.js +5 -3
  12. package/es/city-picker/city-picker.js +12 -27
  13. package/es/city-picker/option.js +1 -5
  14. package/es/city-picker/style/index.css +8 -0
  15. package/es/city-picker/style/index.less +10 -0
  16. package/es/color-picker/color-picker-panel.js +332 -82
  17. package/es/color-picker/color-picker.js +128 -58
  18. package/es/color-picker/constant/colorTypes.js +4 -4
  19. package/es/color-picker/constant/defaultColor.d.ts +1 -1
  20. package/es/color-picker/constant/defaultColor.js +1 -1
  21. package/es/color-picker/interface.d.ts +33 -11
  22. package/es/color-picker/style/index.css +256 -53
  23. package/es/color-picker/style/index.less +277 -73
  24. package/es/color-picker/style/token.less +6 -2
  25. package/es/color-picker/utils/colorFormat.d.ts +5 -1
  26. package/es/color-picker/utils/colorFormat.js +10 -10
  27. package/es/color-picker/utils/convertLetters.d.ts +1 -0
  28. package/es/color-picker/utils/convertLetters.js +12 -0
  29. package/es/color-picker/utils/validateColor.js +12 -9
  30. package/es/config-provider/compDefaultProps.d.ts +8 -0
  31. package/es/config-provider/compDefaultProps.js +8 -0
  32. package/es/popper/index.d.ts +1 -1
  33. package/es/popper/index.js +4 -1
  34. package/es/popper/style/index.css +4 -4
  35. package/es/popper/style/index.less +4 -6
  36. package/es/signature/signature.d.ts +1 -0
  37. package/es/signature/signature.js +42 -8
  38. package/es/tree/tree.d.ts +1 -0
  39. package/es/tree/tree.js +3 -1
  40. package/es/tree/treeNode.d.ts +1 -0
  41. package/es/tree/treeNode.js +3 -2
  42. package/lib/breadcrumb/breadcrumb.js +2 -2
  43. package/lib/button/group.d.ts +1 -1
  44. package/lib/button/group.js +5 -3
  45. package/lib/city-picker/city-picker.js +12 -27
  46. package/lib/city-picker/option.js +1 -5
  47. package/lib/city-picker/style/index.css +8 -0
  48. package/lib/city-picker/style/index.less +10 -0
  49. package/lib/color-picker/color-picker-panel.js +329 -79
  50. package/lib/color-picker/color-picker.js +125 -55
  51. package/lib/color-picker/constant/colorTypes.js +4 -4
  52. package/lib/color-picker/constant/defaultColor.d.ts +1 -1
  53. package/lib/color-picker/constant/defaultColor.js +1 -1
  54. package/lib/color-picker/interface.d.ts +33 -11
  55. package/lib/color-picker/style/index.css +256 -53
  56. package/lib/color-picker/style/index.less +277 -73
  57. package/lib/color-picker/style/token.less +6 -2
  58. package/lib/color-picker/utils/colorFormat.d.ts +5 -1
  59. package/lib/color-picker/utils/colorFormat.js +10 -9
  60. package/lib/color-picker/utils/convertLetters.d.ts +1 -0
  61. package/lib/color-picker/utils/convertLetters.js +13 -0
  62. package/lib/color-picker/utils/validateColor.js +12 -9
  63. package/lib/config-provider/compDefaultProps.d.ts +8 -0
  64. package/lib/config-provider/compDefaultProps.js +8 -0
  65. package/lib/popper/index.d.ts +1 -1
  66. package/lib/popper/index.js +4 -1
  67. package/lib/popper/style/index.css +4 -4
  68. package/lib/popper/style/index.less +4 -6
  69. package/lib/signature/signature.d.ts +1 -0
  70. package/lib/signature/signature.js +42 -8
  71. package/lib/tree/tree.d.ts +1 -0
  72. package/lib/tree/tree.js +3 -1
  73. package/lib/tree/treeNode.d.ts +1 -0
  74. package/lib/tree/treeNode.js +3 -2
  75. package/package.json +1 -1
@@ -142,8 +142,8 @@ var Breadcrumb = function Breadcrumb(props) {
142
142
  };
143
143
  useEffect(function () {
144
144
  var isMore = itemsConfig === null || itemsConfig === void 0 ? void 0 : itemsConfig.some(function (item) {
145
- var _a, _b;
146
- return ((_b = (_a = item === null || item === void 0 ? void 0 : item.title) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.children.type.displayName) === 'Tooltip';
145
+ var _a, _b, _c, _d;
146
+ return ((_d = (_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.title) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.displayName) === 'Tooltip';
147
147
  });
148
148
  setOpenEllipsis(isMore && itemsConfig.length === MIN_ITEM);
149
149
  }, [itemsConfig]);
@@ -1,6 +1,6 @@
1
1
  import React, { CSSProperties, ReactNode } from 'react';
2
- import { PopperProps } from '../_utils/usePopper';
3
2
  import { ButtonType, ButtonSize } from './button';
3
+ import { PopperProps } from '../popper';
4
4
  export declare const ButtonGroupTypes: ["basic", "similar"];
5
5
  export declare type ButtonGroupType = typeof ButtonGroupTypes[number];
6
6
  export interface OverlayType {
@@ -8,9 +8,9 @@ import classNames from 'classnames';
8
8
  import ConfigContext from '../config-provider/ConfigContext';
9
9
  import { getCompProps } from '../_utils';
10
10
  import { Button, Icon } from '../index';
11
- import usePopper from '../_utils/usePopper';
12
11
  import { toArray } from '../_utils/react-children';
13
12
  import { tuple } from '../_utils/type';
13
+ import Popper from '../popper';
14
14
  export var ButtonGroupTypes = tuple('basic', 'similar');
15
15
  var InternalButtonGroup = function InternalButtonGroup(props, ref) {
16
16
  var _context;
@@ -37,7 +37,7 @@ var InternalButtonGroup = function InternalButtonGroup(props, ref) {
37
37
  _useState2 = _slicedToArray(_useState, 2),
38
38
  optionShow = _useState2[0],
39
39
  setOptionShow = _useState2[1];
40
- var refBtnGroup = React.useRef(null) || ref;
40
+ var refBtnGroup = ref || React.createRef();
41
41
  var triggerRef = React.useRef(null);
42
42
  var isBsicType = type === 'basic';
43
43
  var btnGroupPrefixCls = getPrefixCls(prefixCls, 'btn-group', customPrefixcls);
@@ -120,7 +120,9 @@ var InternalButtonGroup = function InternalButtonGroup(props, ref) {
120
120
  return isBsicType ? locatorNode : triggerRef.current;
121
121
  }
122
122
  });
123
- return usePopper(renderTriggerButton(), renderContent(), popperProps);
123
+ return React.createElement(Popper, _extends({
124
+ tip: renderContent()
125
+ }, popperProps), renderTriggerButton());
124
126
  };
125
127
  var ButtonGroup = React.forwardRef(InternalButtonGroup);
126
128
  ButtonGroup.displayName = 'ButtonGroup';
@@ -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 usePopper from '../_utils/usePopper';
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';
@@ -152,15 +153,6 @@ var InternalSelect = function InternalSelect(props, ref) {
152
153
  setAfterChangeFocus(false);
153
154
  onBlur && onBlur(e);
154
155
  }, [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
156
  var handleSearchChange = useCallback(function (event) {
165
157
  var val = event.currentTarget.value;
166
158
  setOptionShow(true);
@@ -359,14 +351,7 @@ var InternalSelect = function InternalSelect(props, ref) {
359
351
  }, [optionShow]);
360
352
  useEffect(function () {
361
353
  var _a;
362
- var fn = function fn(e) {
363
- e.stopPropagation();
364
- };
365
- (_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseup', fn);
366
- return function () {
367
- var _a;
368
- (_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseup', fn);
369
- };
354
+ (_a = clearRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('click', handleReset);
370
355
  }, [initValue]);
371
356
  var curkeyboardList = useMemo(function () {
372
357
  if (!searchValue) {
@@ -395,14 +380,16 @@ var InternalSelect = function InternalSelect(props, ref) {
395
380
  setActiveIndex(index === undefined ? getActiveIndex(0) : index);
396
381
  };
397
382
  useEffect(function () {
398
- initActiveIndex(searchValue ? undefined : -1);
399
- }, [searchValue, tabsValue, curkeyboardList]);
383
+ var index = _findIndexInstanceProperty(curkeyboardList).call(curkeyboardList, function (item) {
384
+ return item.id === initValue;
385
+ });
386
+ initActiveIndex(index >= 0 ? index : undefined);
387
+ }, [curkeyboardList, initValue]);
400
388
  var onInternalKeyDown = function onInternalKeyDown(e) {
401
389
  var _a, _b, _c;
402
390
  var which = e.which;
403
391
  if (which === KeyCode.ENTER || which === KeyCode.UP || which === KeyCode.DOWN) {
404
392
  e.preventDefault();
405
- setOptionShow(true);
406
393
  }
407
394
  if (optionShow) {
408
395
  var offset = 0;
@@ -467,15 +454,11 @@ var InternalSelect = function InternalSelect(props, ref) {
467
454
  minWidth: width,
468
455
  maxWidth: 600
469
456
  }, dropdownStyle), {
470
- width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || 'auto',
471
- zIndex: 1050
457
+ width: (dropdownStyle === null || dropdownStyle === void 0 ? void 0 : dropdownStyle.width) || 'auto'
472
458
  }), popperStyle);
473
459
  }
474
460
  };
475
461
  var handleVisibleChange = function handleVisibleChange(visible) {
476
- if (!visible) {
477
- initActiveIndex(-1);
478
- }
479
462
  if (visible !== optionShow) {
480
463
  props.visible === undefined && setOptionShow(visible);
481
464
  onVisibleChange && onVisibleChange(visible);
@@ -495,7 +478,9 @@ var InternalSelect = function InternalSelect(props, ref) {
495
478
  }
496
479
  }
497
480
  });
498
- return usePopper(renderCityPicker(), renderContent(), popperProps);
481
+ return React.createElement(Popper, _extends({
482
+ tip: renderContent()
483
+ }, popperProps), renderCityPicker());
499
484
  };
500
485
  var Select = React.forwardRef(InternalSelect);
501
486
  Select.displayName = 'CityPicker';
@@ -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 React.createElement(React.Fragment, null, 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) : React.createElement(React.Fragment, null, React.createElement("span", {
47
43
  className: "".concat(selectOptionPrefixCls, "-content")
48
44
  }, children), 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%;