@kdcloudjs/kdesign 1.7.34 → 1.7.37

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 (109) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/kdesign-complete.less +244 -77
  3. package/dist/kdesign.css +263 -42
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +614 -168
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +3 -3
  8. package/dist/kdesign.min.js +5 -5
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/city-picker/city-picker.js +1 -1
  11. package/es/clipboard/clipboard.d.ts +21 -0
  12. package/es/clipboard/clipboard.js +106 -0
  13. package/es/clipboard/index.d.ts +4 -0
  14. package/es/clipboard/index.js +3 -0
  15. package/es/clipboard/style/css.js +2 -0
  16. package/es/clipboard/style/index.css +190 -0
  17. package/es/clipboard/style/index.d.ts +2 -0
  18. package/es/clipboard/style/index.js +2 -0
  19. package/es/clipboard/style/index.less +32 -0
  20. package/es/clipboard/style/mixin.less +39 -0
  21. package/es/clipboard/style/token.less +52 -0
  22. package/es/clipboard/util.d.ts +13 -0
  23. package/es/clipboard/util.js +197 -0
  24. package/es/color-picker/color-picker-panel.js +15 -6
  25. package/es/color-picker/color-picker.js +17 -3
  26. package/es/color-picker/interface.d.ts +5 -0
  27. package/es/color-picker/style/index.css +30 -13
  28. package/es/color-picker/style/index.less +49 -43
  29. package/es/config-provider/compDefaultProps.d.ts +5 -0
  30. package/es/config-provider/compDefaultProps.js +5 -0
  31. package/es/index.d.ts +1 -0
  32. package/es/index.js +2 -1
  33. package/es/locale/locale.d.ts +2 -0
  34. package/es/locale/zh-CN.d.ts +2 -0
  35. package/es/locale/zh-CN.js +3 -1
  36. package/es/message/content.js +1 -4
  37. package/es/select/interface.d.ts +1 -0
  38. package/es/select/select.js +15 -12
  39. package/es/select/style/index.css +12 -9
  40. package/es/select/style/index.less +22 -12
  41. package/es/select/style/token.less +1 -0
  42. package/es/tree/style/index.css +22 -15
  43. package/es/tree/style/index.less +33 -18
  44. package/es/tree/tree.d.ts +1 -0
  45. package/es/tree/tree.js +29 -13
  46. package/es/tree/treeHooks.d.ts +2 -2
  47. package/es/tree/treeHooks.js +11 -6
  48. package/es/tree/treeNode.d.ts +2 -3
  49. package/es/tree/treeNode.js +6 -5
  50. package/es/tree/utils/treeUtils.d.ts +2 -2
  51. package/es/tree/utils/treeUtils.js +5 -6
  52. package/es/tree-select/interface.d.ts +1 -0
  53. package/es/tree-select/style/index.css +7 -4
  54. package/es/tree-select/style/index.less +12 -4
  55. package/es/tree-select/style/token.less +1 -0
  56. package/es/tree-select/tree-select.js +6 -2
  57. package/lib/city-picker/city-picker.js +1 -1
  58. package/lib/clipboard/clipboard.d.ts +21 -0
  59. package/lib/clipboard/clipboard.js +121 -0
  60. package/lib/clipboard/index.d.ts +4 -0
  61. package/lib/clipboard/index.js +11 -0
  62. package/lib/clipboard/style/css.js +4 -0
  63. package/lib/clipboard/style/index.css +190 -0
  64. package/lib/clipboard/style/index.d.ts +2 -0
  65. package/lib/clipboard/style/index.js +4 -0
  66. package/lib/clipboard/style/index.less +32 -0
  67. package/lib/clipboard/style/mixin.less +39 -0
  68. package/lib/clipboard/style/token.less +52 -0
  69. package/lib/clipboard/util.d.ts +13 -0
  70. package/lib/clipboard/util.js +204 -0
  71. package/lib/color-picker/color-picker-panel.js +16 -7
  72. package/lib/color-picker/color-picker.js +17 -3
  73. package/lib/color-picker/interface.d.ts +5 -0
  74. package/lib/color-picker/style/index.css +30 -13
  75. package/lib/color-picker/style/index.less +49 -43
  76. package/lib/config-provider/compDefaultProps.d.ts +5 -0
  77. package/lib/config-provider/compDefaultProps.js +5 -0
  78. package/lib/index.d.ts +1 -0
  79. package/lib/index.js +7 -0
  80. package/lib/locale/locale.d.ts +2 -0
  81. package/lib/locale/zh-CN.d.ts +2 -0
  82. package/lib/locale/zh-CN.js +3 -1
  83. package/lib/message/content.js +1 -4
  84. package/lib/select/interface.d.ts +1 -0
  85. package/lib/select/select.js +15 -12
  86. package/lib/select/style/index.css +12 -9
  87. package/lib/select/style/index.less +22 -12
  88. package/lib/select/style/token.less +1 -0
  89. package/lib/style/components.less +1 -0
  90. package/lib/tree/style/index.css +22 -15
  91. package/lib/tree/style/index.less +33 -18
  92. package/lib/tree/tree.d.ts +1 -0
  93. package/lib/tree/tree.js +28 -12
  94. package/lib/tree/treeHooks.d.ts +2 -2
  95. package/lib/tree/treeHooks.js +10 -5
  96. package/lib/tree/treeNode.d.ts +2 -3
  97. package/lib/tree/treeNode.js +6 -5
  98. package/lib/tree/utils/treeUtils.d.ts +2 -2
  99. package/lib/tree/utils/treeUtils.js +5 -6
  100. package/lib/tree-select/interface.d.ts +1 -0
  101. package/lib/tree-select/style/index.css +7 -4
  102. package/lib/tree-select/style/index.less +12 -4
  103. package/lib/tree-select/style/token.less +1 -0
  104. package/lib/tree-select/tree-select.js +6 -2
  105. package/package.json +1 -1
  106. package/es/color-picker/utils/hooks/useOnClickOutside.d.ts +0 -2
  107. package/es/color-picker/utils/hooks/useOnClickOutside.js +0 -16
  108. package/lib/color-picker/utils/hooks/useOnClickOutside.d.ts +0 -2
  109. package/lib/color-picker/utils/hooks/useOnClickOutside.js +0 -23
@@ -189,7 +189,7 @@ var InternalSelect = function InternalSelect(props, ref) {
189
189
  if (disabled) return null;
190
190
  var suffixIcon = selectProps.suffixIcon;
191
191
  var arrowIconCls = classNames((_classNames4 = {}, _defineProperty(_classNames4, "".concat(selectPrefixCls, "-icon-arrow"), true), _defineProperty(_classNames4, "".concat(selectPrefixCls, "-icon-arrow-up"), optionShow), _defineProperty(_classNames4, "".concat(selectPrefixCls, "-icon-arrow-down"), !optionShow), _defineProperty(_classNames4, "".concat(selectPrefixCls, "-icon-arrow-focus"), optionShow), _classNames4));
192
- var iconShow = allowClear && !disabled && ((initValue !== null && initValue !== void 0 ? initValue : '') !== '' || searchValue);
192
+ var iconShow = allowClear && !disabled && (initValue !== null && initValue !== void 0 ? initValue : '') !== '';
193
193
  return /*#__PURE__*/React.createElement(React.Fragment, null, iconShow && /*#__PURE__*/React.createElement("span", {
194
194
  onClick: handleReset,
195
195
  onMouseDown: function onMouseDown(e) {
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare const ClipboardActions: ["copy", "cut"];
3
+ export declare type ClipboardAction = typeof ClipboardActions[number];
4
+ export declare const ClipboardSizes: ["large", "middle", "small"];
5
+ export declare type ClipboardSize = typeof ClipboardSizes[number];
6
+ export interface IClipboardProps {
7
+ action?: ClipboardAction;
8
+ content?: string;
9
+ children?: React.ReactNode;
10
+ className?: string;
11
+ disabled?: boolean;
12
+ icon?: React.ReactNode | false;
13
+ prefixCls?: string;
14
+ size?: ClipboardSize;
15
+ style?: Record<string, unknown>;
16
+ target?: () => HTMLElement | string;
17
+ onError?: (error: Error) => void;
18
+ onSuccess?: (content: string) => void;
19
+ }
20
+ declare const Clipboard: React.ForwardRefExoticComponent<IClipboardProps & React.RefAttributes<unknown>>;
21
+ export default Clipboard;
@@ -0,0 +1,106 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
2
+ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
3
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
4
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
5
+ var __rest = this && this.__rest || function (s, e) {
6
+ var t = {};
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
8
+ if (s != null && typeof _Object$getOwnPropertySymbols === "function") for (var i = 0, p = _Object$getOwnPropertySymbols(s); i < p.length; i++) {
9
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import classNames from 'classnames';
14
+ import React, { useCallback, useContext } from 'react';
15
+ import { getCompProps } from '../_utils';
16
+ import devWarning from '../_utils/devwarning';
17
+ import { tuple } from '../_utils/type';
18
+ import ConfigContext from '../config-provider/ConfigContext';
19
+ import Icon from '../icon';
20
+ import { onClipboardCopy, onClipboardCut } from './util';
21
+ export var ClipboardActions = tuple('copy', 'cut');
22
+ export var ClipboardSizes = tuple('large', 'middle', 'small');
23
+ var InternalClipboard = function InternalClipboard(props, ref) {
24
+ var _context, _classNames;
25
+ var _useContext = useContext(ConfigContext),
26
+ getPrefixCls = _useContext.getPrefixCls,
27
+ prefixCls = _useContext.prefixCls,
28
+ userDefaultProps = _useContext.compDefaultProps;
29
+ // 剪贴板参数,合并了系统默认参数、用户定义组件统一参数及组件传参
30
+ var clipboardProps = getCompProps('Clipboard', userDefaultProps, props);
31
+ var className = clipboardProps.className,
32
+ customPrefixcls = clipboardProps.prefixCls,
33
+ action = clipboardProps.action,
34
+ content = clipboardProps.content,
35
+ children = clipboardProps.children,
36
+ disabled = clipboardProps.disabled,
37
+ icon = clipboardProps.icon,
38
+ size = clipboardProps.size,
39
+ target = clipboardProps.target,
40
+ onError = clipboardProps.onError,
41
+ onSuccess = clipboardProps.onSuccess,
42
+ others = __rest(clipboardProps, ["className", "prefixCls", "action", "content", "children", "disabled", "icon", "size", "target", "onError", "onSuccess"]);
43
+ devWarning(ClipboardActions.indexOf(action) === -1, 'clipboard', "cannot found clipboard action '".concat(action, "'"));
44
+ devWarning(ClipboardSizes.indexOf(size) === -1, 'clipboard', "cannot found clipboard size '".concat(size, "'"));
45
+ // 剪贴板样式前缀
46
+ var clipboardPrefixCls = getPrefixCls(prefixCls, 'clipboard', customPrefixcls);
47
+ var clipboardClass = classNames(clipboardPrefixCls, className, (_classNames = {}, _defineProperty(_classNames, _concatInstanceProperty(_context = "".concat(clipboardPrefixCls, "-size-")).call(_context, size), size), _defineProperty(_classNames, "".concat(clipboardPrefixCls, "-icon-only"), !children && children !== 0 && icon !== null), _classNames));
48
+ // ref
49
+ var clipboardRef = ref || /*#__PURE__*/React.createRef();
50
+ // 如果没有传 icon,则使用默认图标
51
+ // 如果 icon 传 null,则不使用图标
52
+ var iconNode = icon || (icon === undefined ? /*#__PURE__*/React.createElement(Icon, {
53
+ type: "copy-code"
54
+ }) : null);
55
+ // 如果传的 children 为 string,则将 children 包装成块标签
56
+ var childrenNode = typeof children === 'string' ? /*#__PURE__*/React.createElement("span", null, children) : children;
57
+ /**
58
+ * 剪贴板 click 事件处理
59
+ */
60
+ var handleClick = useCallback(function () {
61
+ if (disabled) {
62
+ // 禁用状态不触发点击事件
63
+ return;
64
+ }
65
+ var selectedText;
66
+ try {
67
+ if (content) {
68
+ // 如果传了 content,则直接复制 content
69
+ selectedText = onClipboardCopy(content);
70
+ } else {
71
+ var targetElement = typeof target === 'string' ? document.querySelector(target) : target();
72
+ if (!targetElement) {
73
+ // 没有获取到元素,抛出异常
74
+ throw new Error("target element '".concat(target, "' does not exist"));
75
+ } else {
76
+ if (action === 'copy' && targetElement.hasAttribute('disabled')) {
77
+ // 复制被置为 disabled 的元素,抛出异常
78
+ throw new Error("invalid \"target\" attribute of element '".concat(targetElement, "'. Please use \"readonly\" instead of \"disabled\" attribute"));
79
+ }
80
+ if (action === 'cut' && (targetElement.hasAttribute('readonly') || targetElement.hasAttribute('disabled'))) {
81
+ // 剪切被置为 readonly 或 disabled 的元素,抛出异常
82
+ throw new Error("invalid \"target\" attribute of element '".concat(targetElement, "'. You can't cut text from elements with \"readonly\" or \"disabled\" attributes"));
83
+ }
84
+ }
85
+ // 对 targetElement 的值进行复制或剪切
86
+ selectedText = action === 'copy' ? onClipboardCopy(targetElement) : onClipboardCut(targetElement);
87
+ }
88
+ } catch (error) {
89
+ // 触发失败的回调
90
+ onError === null || onError === void 0 ? void 0 : onError(error);
91
+ // 退出处理器
92
+ return;
93
+ }
94
+ // 触发成功的回调
95
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(selectedText);
96
+ }, [action, content, disabled, onError, onSuccess, target]);
97
+ return /*#__PURE__*/React.createElement("div", _extends({
98
+ className: clipboardClass,
99
+ disabled: disabled,
100
+ onClick: handleClick,
101
+ ref: clipboardRef
102
+ }, others), iconNode, childrenNode);
103
+ };
104
+ var Clipboard = /*#__PURE__*/React.forwardRef(InternalClipboard);
105
+ Clipboard.displayName = 'Clipboard';
106
+ export default Clipboard;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ declare const Clipboard: import("react").ForwardRefExoticComponent<import("./clipboard").IClipboardProps & import("react").RefAttributes<unknown>>;
3
+ export { ClipboardAction, IClipboardProps } from './clipboard';
4
+ export default Clipboard;
@@ -0,0 +1,3 @@
1
+ import InternalClipboard from './clipboard';
2
+ var Clipboard = InternalClipboard;
3
+ export default Clipboard;
@@ -0,0 +1,2 @@
1
+ import '../../style/index.css';
2
+ import './index.css';
@@ -0,0 +1,190 @@
1
+ /* ----------- color ——————---- start */
2
+ /* ----------- color ——————---- end */
3
+ /* ----------- motion ——————---- start */
4
+ /* ----------- motion ——————---- end */
5
+ /* ----------- transition ——————---- start */
6
+ /* ----------- transition ——————---- end */
7
+ /* ----------- font ——————---- start */
8
+ /* ----------- font ——————---- end */
9
+ /* ----------- zIndex ——————---- start */
10
+ /*
11
+ 普通组件内部自身层级应设置在0-100间
12
+ */
13
+ /* ----------- zIndex ——————---- end */
14
+ /* ----------- Button ——————---- start */
15
+ /* ----------- Button ——————---- end */
16
+ /* ----------- Collapse ——————---- start */
17
+ /* ----------- Collapse ——————---- end */
18
+ /* ----------- Card ——————---- start */
19
+ /* ----------- Card ——————---- end */
20
+ /* ----------- Carousel ——————---- start */
21
+ /* ----------- Carousel ——————---- end */
22
+ /* ----------- Cascader ——————---- start */
23
+ /* ----------- Cascader ——————---- end */
24
+ /* ----------- Switch ——————---- start */
25
+ /* ----------- Switch ——————---- end */
26
+ /* ----------- Input ——————---- start */
27
+ /* ----------- Input ——————---- end */
28
+ /* ----------- InputNumber ——————---- start */
29
+ /* ----------- InputNumber ——————---- end */
30
+ /* ----------- checkbox ——————---- start */
31
+ /* ----------- checkbox ——————---- start */
32
+ /* ----------- checkbox ——————---- end */
33
+ /* ----------- Radio ——————---- start */
34
+ /* ----------- Radio ——————---- end */
35
+ /* ----------- icon ——————---- start */
36
+ /* ----------- icon ——————---- end */
37
+ /* ----------- Popconfirm ——————---- start */
38
+ /* ----------- Popconfirm ——————---- end */
39
+ /* ----------- Progress ——————---- start */
40
+ /* ----------- Progress ——————---- end */
41
+ /* ----------- Pagination ——————---- start */
42
+ /* ----------- Pagination ——————---- end */
43
+ /* ----------- Timeline ——————---- start */
44
+ /* ----------- Timeline ——————---- end */
45
+ /* ----------- Tabs ——————---- start */
46
+ /* ----------- Tabs ——————---- end */
47
+ /* ----------- Select ——————---- start */
48
+ /* ----------- Select ——————---- end */
49
+ /* ----------- Rate ——————---- start */
50
+ /* ----------- Rate ——————---- end */
51
+ /* ----------- Dropdown ——————---- start */
52
+ /* ----------- Dropdown ——————---- end */
53
+ /* ----------- Tooltip ——————---- start */
54
+ /* ----------- Tooltip ——————---- end */
55
+ /* ----------- Transfer ——————---- start */
56
+ /* ----------- Transfer ——————---- end */
57
+ /* ----------- DatePicker ——————---- start */
58
+ /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
61
+ /* ----------- Tree ——————---- start */
62
+ /* ----------- Tree ——————---- end */
63
+ /* ----------- Alert ——————---- start */
64
+ /* ----------- Alert ——————---- end */
65
+ /* ----------- Split-Panel ——————---- start */
66
+ /* ----------- Split-Panel ——————---- end */
67
+ /* ----------- Modal ——————---- start */
68
+ /* ----------- Modal ——————---- end */
69
+ /* ----------- Steps ——————---- start */
70
+ /* ----------- Steps ——————---- end */
71
+ /* ----------- Form ——————---- start */
72
+ /* ----------- Form ——————---- end */
73
+ /* ----------- Tag ——————---- start */
74
+ /* ----------- Tag ——————---- end */
75
+ /* ----------- Menu ——————---- start */
76
+ /* ----------- Menu ——————---- end */
77
+ /* ----------- notice ——————---- start */
78
+ /* ----------- message ——————---- end */
79
+ /* ----------- Spin ——————---- start */
80
+ /* ----------- Spin ——————---- end */
81
+ /* ----------- Spin ——————---- start */
82
+ /* ----------- Spin ——————---- end */
83
+ /* ----------- Layout ——————---- start */
84
+ /* ----------- Layout ——————---- end */
85
+ /* ----------- Typography ——————---- start */
86
+ /* ----------- Typography ——————---- start */
87
+ /* ----------- Search ——————---- start */
88
+ /* ----------- Search ——————---- start */
89
+ /* ----------- Badge ——————---- start */
90
+ /* ----------- Badge ——————---- end */
91
+ /* ----------- Anchor ——————---- start */
92
+ /* ----------- Anchor ——————---- end */
93
+ /* ----------- Avatar ——————---- start */
94
+ /* ----------- Avatar ——————---- end */
95
+ /* ----------- AdvancedSelector ——————---- start */
96
+ /* ----------- AdvancedSelector ——————---- end */
97
+ /* ----------- motion ——————---- start */
98
+ /* ----------- motion ——————---- end */
99
+ /* ----------- transition ——————---- start */
100
+ /* ----------- transition ——————---- end */
101
+ /* ----------- zIndex ——————---- start */
102
+ /*
103
+ 普通组件内部自身层级应设置在0-100间
104
+ */
105
+ /* ----------- zIndex ——————---- end */
106
+ .kd-clipboard {
107
+ padding: 0;
108
+ position: relative;
109
+ display: inline-block;
110
+ vertical-align: middle;
111
+ -webkit-box-sizing: border-box;
112
+ box-sizing: border-box;
113
+ font-weight: var(--kd-c-clipboard-font-weight, var(--kd-g-font-weight, 400));
114
+ color: #bbbbbb;
115
+ cursor: pointer;
116
+ white-space: nowrap;
117
+ overflow: hidden;
118
+ -webkit-user-select: none;
119
+ -moz-user-select: none;
120
+ -ms-user-select: none;
121
+ user-select: none;
122
+ }
123
+ .kd-clipboard:hover {
124
+ color: #5582f3;
125
+ }
126
+ .kd-clipboard:disabled,
127
+ .kd-clipboard[disabled] {
128
+ color: #bbbbbb;
129
+ cursor: not-allowed;
130
+ }
131
+ .kd-clipboard-size-small {
132
+ height: var(--kd-c-clipboard-sizing-height-small, 24px);
133
+ padding: var(--kd-c-clipboard-spacing-padding-vertical-small, 3px) var(--kd-c-clipboard-spacing-padding-horizontal-small, 8px);
134
+ font-size: var(--kd-c-clipboard-font-size-small, var(--kd-g-font-size-small, 12px));
135
+ line-height: calc(var(--kd-c-clipboard-sizing-height-small, 24px) - (var(--kd-c-clipboard-spacing-padding-vertical-small, 3px)) * 2);
136
+ }
137
+ .kd-clipboard-size-small.kd-clipboard-icon-only {
138
+ font-size: var(--kd-c-clipboard-icon-font-size-small, 14px);
139
+ padding: 0 var(--kd-c-clipboard-icon-spacing-padding-horizontal, 4px);
140
+ display: -webkit-inline-box;
141
+ display: -ms-inline-flexbox;
142
+ display: inline-flex;
143
+ -webkit-box-pack: center;
144
+ -ms-flex-pack: center;
145
+ justify-content: center;
146
+ -webkit-box-align: center;
147
+ -ms-flex-align: center;
148
+ align-items: center;
149
+ }
150
+ .kd-clipboard-size-middle {
151
+ height: var(--kd-c-clipboard-sizing-height-middle, 28px);
152
+ padding: var(--kd-c-clipboard-spacing-padding-vertical-middle, 5px) var(--kd-c-clipboard-spacing-padding-horizontal-middle, 8px);
153
+ font-size: var(--kd-c-clipboard-font-size-middle, var(--kd-g-font-size-middle, 14px));
154
+ line-height: calc(var(--kd-c-clipboard-sizing-height-middle, 28px) - (var(--kd-c-clipboard-spacing-padding-vertical-middle, 5px)) * 2);
155
+ }
156
+ .kd-clipboard-size-middle.kd-clipboard-icon-only {
157
+ font-size: var(--kd-c-clipboard-icon-font-size-middle, 16px);
158
+ padding: 0 var(--kd-c-clipboard-icon-spacing-padding-horizontal, 4px);
159
+ display: -webkit-inline-box;
160
+ display: -ms-inline-flexbox;
161
+ display: inline-flex;
162
+ -webkit-box-pack: center;
163
+ -ms-flex-pack: center;
164
+ justify-content: center;
165
+ -webkit-box-align: center;
166
+ -ms-flex-align: center;
167
+ align-items: center;
168
+ }
169
+ .kd-clipboard-size-large {
170
+ height: var(--kd-c-clipboard-sizing-height-large, 32px);
171
+ padding: var(--kd-c-clipboard-spacing-padding-vertical-large, 6px) var(--kd-c-clipboard-spacing-padding-horizontal-large, 8px);
172
+ font-size: var(--kd-c-clipboard-font-size-large, var(--kd-g-font-size-large, 16px));
173
+ line-height: calc(var(--kd-c-clipboard-sizing-height-large, 32px) - (var(--kd-c-clipboard-spacing-padding-vertical-large, 6px)) * 2);
174
+ }
175
+ .kd-clipboard-size-large.kd-clipboard-icon-only {
176
+ font-size: var(--kd-c-clipboard-icon-font-size-large, 18px);
177
+ padding: 0 var(--kd-c-clipboard-icon-spacing-padding-horizontal, 4px);
178
+ display: -webkit-inline-box;
179
+ display: -ms-inline-flexbox;
180
+ display: inline-flex;
181
+ -webkit-box-pack: center;
182
+ -ms-flex-pack: center;
183
+ justify-content: center;
184
+ -webkit-box-align: center;
185
+ -ms-flex-align: center;
186
+ align-items: center;
187
+ }
188
+ .kd-clipboard:not(.kd-clipboard-icon-only) > i:not(:last-child) {
189
+ margin-right: 2px;
190
+ }
@@ -0,0 +1,2 @@
1
+ import '../../style/index.less';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import '../../style/index.less';
2
+ import './index.less';
@@ -0,0 +1,32 @@
1
+ @import '../../style/themes/index';
2
+ @import './mixin.less';
3
+ @clipboard-prefix-cls: ~'@{kd-prefix}-clipboard';
4
+
5
+ .@{clipboard-prefix-cls} {
6
+ .clipboard;
7
+
8
+ &-size-small {
9
+ .clipboard-size(@clipboard-small-height, @clipboard-small-font-size, @clipboard-small-padding-vertical, @clipboard-small-padding-horizontal);
10
+ &.@{clipboard-prefix-cls}-icon-only {
11
+ .clipboard-icon-only(@clipboard-icon-small-font-size, @clipboard-icon-padding-horizontal);
12
+ }
13
+ }
14
+
15
+ &-size-middle {
16
+ .clipboard-size(@clipboard-middle-height, @clipboard-middle-font-size, @clipboard-middle-padding-vertical, @clipboard-middle-padding-horizontal);
17
+ &.@{clipboard-prefix-cls}-icon-only {
18
+ .clipboard-icon-only(@clipboard-icon-middle-font-size, @clipboard-icon-padding-horizontal);
19
+ }
20
+ }
21
+
22
+ &-size-large {
23
+ .clipboard-size(@clipboard-large-height, @clipboard-large-font-size, @clipboard-large-padding-vertical, @clipboard-large-padding-horizontal);
24
+ &.@{clipboard-prefix-cls}-icon-only {
25
+ .clipboard-icon-only(@clipboard-icon-large-font-size, @clipboard-icon-padding-horizontal);
26
+ }
27
+ }
28
+
29
+ &:not(.@{clipboard-prefix-cls}-icon-only) > i:not(:last-child) {
30
+ margin-right: 2px;
31
+ }
32
+ }
@@ -0,0 +1,39 @@
1
+ @import './token.less';
2
+
3
+ .clipboard() {
4
+ padding: 0;
5
+ position: relative;
6
+ display: inline-block;
7
+ vertical-align: middle;
8
+ box-sizing: border-box;
9
+ font-weight: @clipboard-g-font-weight;
10
+ color: #bbbbbb;
11
+ cursor: pointer;
12
+ white-space: nowrap;
13
+ overflow: hidden;
14
+ user-select: none;
15
+
16
+ &:hover {
17
+ color: #5582f3;
18
+ }
19
+ &:disabled,
20
+ &[disabled] {
21
+ color: #bbbbbb;
22
+ cursor: not-allowed;
23
+ }
24
+ }
25
+
26
+ .clipboard-size(@height, @font-size, @padding-vertical, @padding-horizontal) {
27
+ height: @height;
28
+ padding: @padding-vertical @padding-horizontal;
29
+ font-size: @font-size;
30
+ line-height: calc(@height - (@padding-vertical) * 2);
31
+ }
32
+
33
+ .clipboard-icon-only(@font-size, @padding-horizontal) {
34
+ font-size: @font-size;
35
+ padding: 0 @padding-horizontal;
36
+ display: inline-flex;
37
+ justify-content: center;
38
+ align-items: center;
39
+ }
@@ -0,0 +1,52 @@
1
+ @import '../../style/themes/token.less';
2
+
3
+ @clipboard-custom-prefix: ~'--@{kd-prefix}-c-clipboard';
4
+
5
+ // color
6
+ @clipboard-font-color: var(~'@{clipboard-custom-prefix}-color-text', @color-theme); // color-theme为全局token
7
+
8
+ // font
9
+ @clipboard-g-font-weight: var(~'@{clipboard-custom-prefix}-font-weight', @font-weight-light); // 字体粗细
10
+ @clipboard-small-font-size: var(~'@{clipboard-custom-prefix}-font-size-small', @font-size-small); // 小号 文字大小
11
+ @clipboard-middle-font-size: var(~'@{clipboard-custom-prefix}-font-size-middle', @font-size-middle); // 中号 文字大小
12
+ @clipboard-large-font-size: var(~'@{clipboard-custom-prefix}-font-size-large', @font-size-large); // 大号 文字大小
13
+
14
+ @clipboard-icon-small-font-size: var(~'@{clipboard-custom-prefix}-icon-font-size-small', 14px); // 小号 图标大小
15
+ @clipboard-icon-middle-font-size: var(~'@{clipboard-custom-prefix}-icon-font-size-middle', 16px); // 中号 图标大小
16
+ @clipboard-icon-large-font-size: var(~'@{clipboard-custom-prefix}-icon-font-size-large', 18px); // 大号 图标大小
17
+
18
+ // motion
19
+ @clipboard-duration-fade: var(~'@{clipboard-custom-prefix}-motion-duration-fade', @duration-slowly);
20
+ @clipboard-duration-wave: var(~'@{clipboard-custom-prefix}-motion-duration-wave', @duration-quickly);
21
+
22
+ // sizing
23
+ @clipboard-small-height: var(~'@{clipboard-custom-prefix}-sizing-height-small', 24px); // 小号 高度
24
+ @clipboard-middle-height: var(~'@{clipboard-custom-prefix}-sizing-height-middle', 28px); // 中号 高度
25
+ @clipboard-large-height: var(~'@{clipboard-custom-prefix}-sizing-height-large', 32px); // 大号 高度
26
+
27
+ // spacing
28
+ @clipboard-small-padding-vertical: var(
29
+ ~'@{clipboard-custom-prefix}-spacing-padding-vertical-small',
30
+ 3px
31
+ ); // 小号 内间距 纵向
32
+ @clipboard-small-padding-horizontal: var(
33
+ ~'@{clipboard-custom-prefix}-spacing-padding-horizontal-small',
34
+ 8px
35
+ ); // 小号 内间距 横向
36
+ @clipboard-middle-padding-vertical: var(
37
+ ~'@{clipboard-custom-prefix}-spacing-padding-vertical-middle',
38
+ 5px
39
+ ); // 中号 内间距 纵向
40
+ @clipboard-middle-padding-horizontal: var(
41
+ ~'@{clipboard-custom-prefix}-spacing-padding-horizontal-middle',
42
+ 8px
43
+ ); // 中号 内间距 横向
44
+ @clipboard-large-padding-vertical: var(
45
+ ~'@{clipboard-custom-prefix}-spacing-padding-vertical-large',
46
+ 6px
47
+ ); // 大号 内间距 纵向
48
+ @clipboard-large-padding-horizontal: var(
49
+ ~'@{clipboard-custom-prefix}-spacing-padding-horizontal-large',
50
+ 8px
51
+ ); // 大号 内间距 横向
52
+ @clipboard-icon-padding-horizontal: var(~'@{clipboard-custom-prefix}-icon-spacing-padding-horizontal', 4px);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 剪贴板复制操作
3
+ * @param {string | HTMLElement} target
4
+ * @return {string}
5
+ */
6
+ declare const onClipboardCopy: (target: string | HTMLElement) => string;
7
+ /**
8
+ * 剪贴板剪切操作
9
+ * @param {HTMLElement} target
10
+ * @return {string}
11
+ */
12
+ declare const onClipboardCut: (target: HTMLElement) => string;
13
+ export { onClipboardCopy, onClipboardCut };