@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.
- package/CHANGELOG.md +11 -0
- package/dist/kdesign-complete.less +244 -77
- package/dist/kdesign.css +263 -42
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +614 -168
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +5 -5
- package/dist/kdesign.min.js.map +1 -1
- package/es/city-picker/city-picker.js +1 -1
- package/es/clipboard/clipboard.d.ts +21 -0
- package/es/clipboard/clipboard.js +106 -0
- package/es/clipboard/index.d.ts +4 -0
- package/es/clipboard/index.js +3 -0
- package/es/clipboard/style/css.js +2 -0
- package/es/clipboard/style/index.css +190 -0
- package/es/clipboard/style/index.d.ts +2 -0
- package/es/clipboard/style/index.js +2 -0
- package/es/clipboard/style/index.less +32 -0
- package/es/clipboard/style/mixin.less +39 -0
- package/es/clipboard/style/token.less +52 -0
- package/es/clipboard/util.d.ts +13 -0
- package/es/clipboard/util.js +197 -0
- package/es/color-picker/color-picker-panel.js +15 -6
- package/es/color-picker/color-picker.js +17 -3
- package/es/color-picker/interface.d.ts +5 -0
- package/es/color-picker/style/index.css +30 -13
- package/es/color-picker/style/index.less +49 -43
- package/es/config-provider/compDefaultProps.d.ts +5 -0
- package/es/config-provider/compDefaultProps.js +5 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/locale/locale.d.ts +2 -0
- package/es/locale/zh-CN.d.ts +2 -0
- package/es/locale/zh-CN.js +3 -1
- package/es/message/content.js +1 -4
- package/es/select/interface.d.ts +1 -0
- package/es/select/select.js +15 -12
- package/es/select/style/index.css +12 -9
- package/es/select/style/index.less +22 -12
- package/es/select/style/token.less +1 -0
- package/es/tree/style/index.css +22 -15
- package/es/tree/style/index.less +33 -18
- package/es/tree/tree.d.ts +1 -0
- package/es/tree/tree.js +29 -13
- package/es/tree/treeHooks.d.ts +2 -2
- package/es/tree/treeHooks.js +11 -6
- package/es/tree/treeNode.d.ts +2 -3
- package/es/tree/treeNode.js +6 -5
- package/es/tree/utils/treeUtils.d.ts +2 -2
- package/es/tree/utils/treeUtils.js +5 -6
- package/es/tree-select/interface.d.ts +1 -0
- package/es/tree-select/style/index.css +7 -4
- package/es/tree-select/style/index.less +12 -4
- package/es/tree-select/style/token.less +1 -0
- package/es/tree-select/tree-select.js +6 -2
- package/lib/city-picker/city-picker.js +1 -1
- package/lib/clipboard/clipboard.d.ts +21 -0
- package/lib/clipboard/clipboard.js +121 -0
- package/lib/clipboard/index.d.ts +4 -0
- package/lib/clipboard/index.js +11 -0
- package/lib/clipboard/style/css.js +4 -0
- package/lib/clipboard/style/index.css +190 -0
- package/lib/clipboard/style/index.d.ts +2 -0
- package/lib/clipboard/style/index.js +4 -0
- package/lib/clipboard/style/index.less +32 -0
- package/lib/clipboard/style/mixin.less +39 -0
- package/lib/clipboard/style/token.less +52 -0
- package/lib/clipboard/util.d.ts +13 -0
- package/lib/clipboard/util.js +204 -0
- package/lib/color-picker/color-picker-panel.js +16 -7
- package/lib/color-picker/color-picker.js +17 -3
- package/lib/color-picker/interface.d.ts +5 -0
- package/lib/color-picker/style/index.css +30 -13
- package/lib/color-picker/style/index.less +49 -43
- package/lib/config-provider/compDefaultProps.d.ts +5 -0
- package/lib/config-provider/compDefaultProps.js +5 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -0
- package/lib/locale/locale.d.ts +2 -0
- package/lib/locale/zh-CN.d.ts +2 -0
- package/lib/locale/zh-CN.js +3 -1
- package/lib/message/content.js +1 -4
- package/lib/select/interface.d.ts +1 -0
- package/lib/select/select.js +15 -12
- package/lib/select/style/index.css +12 -9
- package/lib/select/style/index.less +22 -12
- package/lib/select/style/token.less +1 -0
- package/lib/style/components.less +1 -0
- package/lib/tree/style/index.css +22 -15
- package/lib/tree/style/index.less +33 -18
- package/lib/tree/tree.d.ts +1 -0
- package/lib/tree/tree.js +28 -12
- package/lib/tree/treeHooks.d.ts +2 -2
- package/lib/tree/treeHooks.js +10 -5
- package/lib/tree/treeNode.d.ts +2 -3
- package/lib/tree/treeNode.js +6 -5
- package/lib/tree/utils/treeUtils.d.ts +2 -2
- package/lib/tree/utils/treeUtils.js +5 -6
- package/lib/tree-select/interface.d.ts +1 -0
- package/lib/tree-select/style/index.css +7 -4
- package/lib/tree-select/style/index.less +12 -4
- package/lib/tree-select/style/token.less +1 -0
- package/lib/tree-select/tree-select.js +6 -2
- package/package.json +1 -1
- package/es/color-picker/utils/hooks/useOnClickOutside.d.ts +0 -2
- package/es/color-picker/utils/hooks/useOnClickOutside.js +0 -16
- package/lib/color-picker/utils/hooks/useOnClickOutside.d.ts +0 -2
- package/lib/color-picker/utils/hooks/useOnClickOutside.js +0 -23
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.onClipboardCut = exports.onClipboardCopy = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* 获取元素的内容
|
|
9
|
+
* @param {HTMLElement} element
|
|
10
|
+
* @return {string}
|
|
11
|
+
*/
|
|
12
|
+
var getContent = function getContent(element) {
|
|
13
|
+
var content;
|
|
14
|
+
if (element.nodeName === 'SELECT') {
|
|
15
|
+
content = element.value;
|
|
16
|
+
} else if (element.nodeName === 'INPUT') {
|
|
17
|
+
content = element.value;
|
|
18
|
+
} else if (element.nodeName === 'TEXTAREA') {
|
|
19
|
+
content = element.value;
|
|
20
|
+
} else {
|
|
21
|
+
// 其他类型通过 select 与 range 来获取文本
|
|
22
|
+
// 获取 select
|
|
23
|
+
var selection = window.getSelection();
|
|
24
|
+
// 创建 range
|
|
25
|
+
var range = document.createRange();
|
|
26
|
+
// 设置 range 的元素
|
|
27
|
+
range.selectNodeContents(element);
|
|
28
|
+
// 重置 select
|
|
29
|
+
selection.removeAllRanges();
|
|
30
|
+
// 设置 select 的 range
|
|
31
|
+
selection.addRange(range);
|
|
32
|
+
// 获取选中的文本
|
|
33
|
+
content = selection.toString();
|
|
34
|
+
// 获取到文本后清空选中范围
|
|
35
|
+
selection.removeAllRanges();
|
|
36
|
+
}
|
|
37
|
+
return content;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* 清空元素的内容
|
|
41
|
+
* @param {HTMLElement} element
|
|
42
|
+
*/
|
|
43
|
+
var clearElement = function clearElement(element) {
|
|
44
|
+
if (element.nodeName === 'SELECT') {
|
|
45
|
+
;
|
|
46
|
+
element.value = '';
|
|
47
|
+
} else if (element.nodeName === 'INPUT') {
|
|
48
|
+
;
|
|
49
|
+
element.value = '';
|
|
50
|
+
} else if (element.nodeName === 'TEXTAREA') {
|
|
51
|
+
;
|
|
52
|
+
element.value = '';
|
|
53
|
+
} else {
|
|
54
|
+
element.innerHTML = '';
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 由将被复制的文本为 value 创建一个 HTMLTextAreaElement 容器
|
|
59
|
+
* @param {String} value
|
|
60
|
+
* @return {HTMLTextAreaElement}
|
|
61
|
+
*/
|
|
62
|
+
var createContainer = function createContainer(value) {
|
|
63
|
+
var isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
|
64
|
+
var container = document.createElement('textarea');
|
|
65
|
+
// 防止在 ios 上缩放
|
|
66
|
+
container.style.fontSize = '12pt';
|
|
67
|
+
// 重置样式
|
|
68
|
+
container.style.border = '0';
|
|
69
|
+
container.style.padding = '0';
|
|
70
|
+
container.style.margin = '0';
|
|
71
|
+
// 把元素定位在视窗外
|
|
72
|
+
container.style.position = 'absolute';
|
|
73
|
+
container.style[isRTL ? 'right' : 'left'] = '-9999px';
|
|
74
|
+
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
|
75
|
+
container.style.top = "".concat(yPosition, "px");
|
|
76
|
+
// 设置为只读
|
|
77
|
+
container.setAttribute('readonly', '');
|
|
78
|
+
// 将文本赋值给元素
|
|
79
|
+
container.value = value;
|
|
80
|
+
document.body.appendChild(container);
|
|
81
|
+
return container;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* 删除元素
|
|
85
|
+
* @param {HTMLElement} container
|
|
86
|
+
*/
|
|
87
|
+
var removeContainer = function removeContainer(container) {
|
|
88
|
+
document.body.removeChild(container);
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* 添加选中状态
|
|
92
|
+
* @param {HTMLElement} element
|
|
93
|
+
*/
|
|
94
|
+
var addSelection = function addSelection(element) {
|
|
95
|
+
// 在 Firefox, Edge (非 Chromium 版本) 及 Internet Explorer 中,getSelection() 对 <textarea> 及 <input> 元素不起作用
|
|
96
|
+
// 使用 select 对 <textarea> 及 <input> 单独处理
|
|
97
|
+
if (element.nodeName === 'INPUT') {
|
|
98
|
+
;
|
|
99
|
+
element.select();
|
|
100
|
+
} else if (element.nodeName === 'TEXTAREA') {
|
|
101
|
+
;
|
|
102
|
+
element.select();
|
|
103
|
+
} else {
|
|
104
|
+
var selection = window.getSelection();
|
|
105
|
+
var range = document.createRange();
|
|
106
|
+
range.selectNodeContents(element);
|
|
107
|
+
selection.removeAllRanges();
|
|
108
|
+
selection.addRange(range);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* 移除选中状态
|
|
113
|
+
* @param {HTMLElement} element
|
|
114
|
+
*/
|
|
115
|
+
var removeSelection = function removeSelection(element) {
|
|
116
|
+
var _a;
|
|
117
|
+
// 在 Firefox, Edge (非 Chromium 版本) 及 Internet Explorer 中,getSelection() 对 <textarea> 及 <input> 元素不起作用
|
|
118
|
+
// 使用 setSelectRange 对 <textarea> 及 <input> 单独处理
|
|
119
|
+
if (element.nodeName === 'INPUT') {
|
|
120
|
+
;
|
|
121
|
+
element.setSelectionRange(0, 0);
|
|
122
|
+
} else if (element.nodeName === 'TEXTAREA') {
|
|
123
|
+
;
|
|
124
|
+
element.setSelectionRange(0, 0);
|
|
125
|
+
} else {
|
|
126
|
+
(_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* 剪贴板复制操作
|
|
131
|
+
* @param {string | HTMLElement} target
|
|
132
|
+
* @return {string}
|
|
133
|
+
*/
|
|
134
|
+
var onClipboardCopy = function onClipboardCopy(target) {
|
|
135
|
+
var copiedValue;
|
|
136
|
+
if (typeof target === 'string') {
|
|
137
|
+
// 如果传的是字符串,直接复制值
|
|
138
|
+
copiedValue = target;
|
|
139
|
+
if (navigator.clipboard) {
|
|
140
|
+
// navigator.clipboard api 存在时,优先使用其进行复制操作
|
|
141
|
+
if (copiedValue !== '') {
|
|
142
|
+
navigator.clipboard.writeText(copiedValue).then(null, function () {
|
|
143
|
+
throw new Error("failed to copy to clipboard of value '".concat(copiedValue, "'"));
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
var container = createContainer(copiedValue);
|
|
148
|
+
addSelection(container);
|
|
149
|
+
document.execCommand('copy');
|
|
150
|
+
removeSelection(container);
|
|
151
|
+
removeContainer(container);
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
// 通过元素来复制
|
|
155
|
+
copiedValue = getContent(target);
|
|
156
|
+
if (navigator.clipboard) {
|
|
157
|
+
if (copiedValue !== '') {
|
|
158
|
+
navigator.clipboard.writeText(copiedValue).then(null, function () {
|
|
159
|
+
throw new Error("failed to copy to clipboard of value '".concat(copiedValue, "'"));
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
addSelection(target);
|
|
164
|
+
document.execCommand('copy');
|
|
165
|
+
removeSelection(target);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return copiedValue;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* 剪贴板剪切操作
|
|
172
|
+
* @param {HTMLElement} target
|
|
173
|
+
* @return {string}
|
|
174
|
+
*/
|
|
175
|
+
exports.onClipboardCopy = onClipboardCopy;
|
|
176
|
+
var onClipboardCut = function onClipboardCut(target) {
|
|
177
|
+
var cutValue = getContent(target);
|
|
178
|
+
if (target.nodeName === 'SELECT' || target.nodeName === 'INPUT' || target.nodeName === 'TEXTAREA') {
|
|
179
|
+
// 对于输入框,使用 document.execCommand('cut') 来剪切,防止受控的输入框无法清空内容
|
|
180
|
+
if (document.execCommand) {
|
|
181
|
+
addSelection(target);
|
|
182
|
+
document.execCommand('cut');
|
|
183
|
+
removeSelection(target);
|
|
184
|
+
} else {
|
|
185
|
+
// document.execCommand 命令不兼容,则抛出异常,因为受控的输入框无法清空元素内容
|
|
186
|
+
throw new Error("failed to cut to clipboard through unavailable api \"document.execCommand\"");
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
// 对于其他标签的元素,使用 navigator 写入剪贴板,并手动清空内容,防止其他标签无法清空内容
|
|
190
|
+
if (navigator.clipboard) {
|
|
191
|
+
if (cutValue !== '') {
|
|
192
|
+
navigator.clipboard.writeText(cutValue).then(null, function () {
|
|
193
|
+
throw new Error("failed to cut to clipboard of value '".concat(cutValue, "'"));
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
clearElement(target);
|
|
197
|
+
} else {
|
|
198
|
+
// navigator.clipboard 命令不兼容,则抛出异常,因为非输入框无法适用 document.execCommand('cut')
|
|
199
|
+
throw new Error("failed to cut to clipboard through unavailable api \"navigator.clipboard\"");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return cutValue;
|
|
203
|
+
};
|
|
204
|
+
exports.onClipboardCut = onClipboardCut;
|
|
@@ -22,7 +22,7 @@ var _convertLetters = require("./utils/convertLetters");
|
|
|
22
22
|
var _color = _interopRequireDefault(require("color"));
|
|
23
23
|
var _reactColor = require("react-color");
|
|
24
24
|
var _devwarning = _interopRequireDefault(require("../_utils/devwarning"));
|
|
25
|
-
var
|
|
25
|
+
var _hooks = require("../_utils/hooks");
|
|
26
26
|
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); }
|
|
27
27
|
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; }
|
|
28
28
|
/* eslint-disable */
|
|
@@ -39,6 +39,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
39
39
|
setColTypeArr = props.setColTypeArr,
|
|
40
40
|
setCurrentColorType = props.setCurrentColorType,
|
|
41
41
|
onChange = props.onChange,
|
|
42
|
+
onVisibleChange = props.onVisibleChange,
|
|
42
43
|
alpha = props.alpha,
|
|
43
44
|
alphaNoVerifyVal = props.alphaNoVerifyVal,
|
|
44
45
|
clickedColorIndex = props.clickedColorIndex,
|
|
@@ -56,7 +57,9 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
56
57
|
showPresetColor = props.showPresetColor,
|
|
57
58
|
showColorPickerBox = props.showColorPickerBox,
|
|
58
59
|
showColorPickerPanel = props.showColorPickerPanel,
|
|
59
|
-
value = props.value
|
|
60
|
+
value = props.value,
|
|
61
|
+
visible = props.visible,
|
|
62
|
+
showPanel = props.showPanel;
|
|
60
63
|
var panelInputRef = (0, _react.useRef)(null);
|
|
61
64
|
var panelClsRef = (0, _react.useRef)(null);
|
|
62
65
|
var Option = _index.Select.Option;
|
|
@@ -68,8 +71,9 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
68
71
|
var panelCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel"));
|
|
69
72
|
var panelChromePickerCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-chrome"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(colorPickerPrefixCls, "-panel-chrome-no-box"), !(showColorPickerBox === null || showColorPickerBox === void 0 ? void 0 : showColorPickerBox.showBox)), (0, _defineProperty2.default)(_classNames, "".concat(colorPickerPrefixCls, "-panel-chrome-no-hue"), !(showColorPickerBox === null || showColorPickerBox === void 0 ? void 0 : showColorPickerBox.showHue)), (0, _defineProperty2.default)(_classNames, "".concat(colorPickerPrefixCls, "-panel-chrome-no-opacity"), !(showColorPickerBox === null || showColorPickerBox === void 0 ? void 0 : showColorPickerBox.showOpacity)), _classNames));
|
|
70
73
|
var panelFollowThemeCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-switch"));
|
|
71
|
-
var
|
|
72
|
-
var
|
|
74
|
+
var panelContainerCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-container"));
|
|
75
|
+
var panelInputCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-container-input"));
|
|
76
|
+
var transparentCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-container-transparent"));
|
|
73
77
|
var colorDivContainerCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-panel-colorDivContainer"), (0, _defineProperty2.default)({}, "".concat(colorPickerPrefixCls, "-panel-colorDivContainer-unset-color"), (presetColor === null || presetColor === void 0 ? void 0 : presetColor.length) === 0));
|
|
74
78
|
var colorLiClick = function colorLiClick(index, colorValue) {
|
|
75
79
|
var formatArr = (0, _colorFormat.colorFormat)(colorValue, alpha);
|
|
@@ -183,8 +187,11 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
183
187
|
(0, _devwarning.default)(!isTrueFormat, 'color-picker', "'presetColor' must be an array of hexadecimal, RGB, HSB, HSL or English color name string type");
|
|
184
188
|
return isTrueFormat;
|
|
185
189
|
};
|
|
186
|
-
(0,
|
|
187
|
-
|
|
190
|
+
(0, _hooks.useOnClickOutside)([panelClsRef, inputRef], function () {
|
|
191
|
+
if (typeof visible === 'undefined') {
|
|
192
|
+
setShowPanel(false);
|
|
193
|
+
}
|
|
194
|
+
showPanel && onVisibleChange && onVisibleChange(false);
|
|
188
195
|
});
|
|
189
196
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showColorPickerPanel && /*#__PURE__*/_react.default.createElement("div", {
|
|
190
197
|
className: panelCls,
|
|
@@ -198,7 +205,9 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
198
205
|
}, /*#__PURE__*/_react.default.createElement("span", null, (switchName === null || switchName === void 0 ? void 0 : switchName.internationalName) && locale.getLangMsg('ColorPicker', switchName.internationalName) || switchName.name), /*#__PURE__*/_react.default.createElement(_index.Switch, {
|
|
199
206
|
checked: isFollow,
|
|
200
207
|
onChange: handleSwitchChange
|
|
201
|
-
})), showColorTransfer && /*#__PURE__*/_react.default.createElement(
|
|
208
|
+
})), showColorTransfer && /*#__PURE__*/_react.default.createElement("div", {
|
|
209
|
+
className: panelContainerCls
|
|
210
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
202
211
|
className: panelInputCls,
|
|
203
212
|
ref: panelInputRef
|
|
204
213
|
}, /*#__PURE__*/_react.default.createElement(_index.Select, {
|
|
@@ -48,8 +48,10 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
48
48
|
placeholder = colorPickerProps.placeholder,
|
|
49
49
|
defaultValue = colorPickerProps.defaultValue,
|
|
50
50
|
defaultOpen = colorPickerProps.defaultOpen,
|
|
51
|
+
visible = colorPickerProps.visible,
|
|
51
52
|
suffixIcon = colorPickerProps.suffixIcon,
|
|
52
|
-
onChange = colorPickerProps.onChange
|
|
53
|
+
onChange = colorPickerProps.onChange,
|
|
54
|
+
onVisibleChange = colorPickerProps.onVisibleChange;
|
|
53
55
|
var _useState = (0, _react.useState)(defaultValue || ''),
|
|
54
56
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
55
57
|
inputColorValue = _useState2[0],
|
|
@@ -66,7 +68,7 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
66
68
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
67
69
|
colTypeArr = _useState8[0],
|
|
68
70
|
setColTypeArr = _useState8[1];
|
|
69
|
-
var _useState9 = (0, _react.useState)(defaultOpen),
|
|
71
|
+
var _useState9 = (0, _react.useState)(typeof visible === 'undefined' ? !!defaultOpen : !!visible),
|
|
70
72
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
71
73
|
showPanel = _useState10[0],
|
|
72
74
|
setShowPanel = _useState10[1];
|
|
@@ -130,8 +132,16 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
130
132
|
functionalColor && showSwitch && setIsFollow(false);
|
|
131
133
|
};
|
|
132
134
|
var handleClick = function handleClick() {
|
|
133
|
-
|
|
135
|
+
if (typeof visible === 'undefined') {
|
|
136
|
+
setShowPanel(!showPanel);
|
|
137
|
+
}
|
|
138
|
+
onVisibleChange && onVisibleChange(!showPanel);
|
|
134
139
|
};
|
|
140
|
+
(0, _react.useEffect)(function () {
|
|
141
|
+
if (typeof visible !== 'undefined') {
|
|
142
|
+
setShowPanel(visible);
|
|
143
|
+
}
|
|
144
|
+
}, [visible]);
|
|
135
145
|
(0, _react.useEffect)(function () {
|
|
136
146
|
if (value) {
|
|
137
147
|
setIconColor(value);
|
|
@@ -181,6 +191,9 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
181
191
|
switchName: switchName,
|
|
182
192
|
presetColor: presetColor,
|
|
183
193
|
value: value,
|
|
194
|
+
visible: visible,
|
|
195
|
+
showPanel: showPanel,
|
|
196
|
+
onVisibleChange: onVisibleChange,
|
|
184
197
|
// private
|
|
185
198
|
setInputColorValue: setInputColorValue,
|
|
186
199
|
setCorrectColorValue: setCorrectColorValue,
|
|
@@ -207,6 +220,7 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
207
220
|
placement: 'bottomLeft',
|
|
208
221
|
defaultVisible: showPanel,
|
|
209
222
|
visible: showPanel,
|
|
223
|
+
onVisibleChange: null,
|
|
210
224
|
clickToClose: false
|
|
211
225
|
});
|
|
212
226
|
return (0, _usePopper.default)(colorInputEle, panel, popperProps);
|
|
@@ -32,7 +32,9 @@ export interface IColorPickerProps extends PopperProps {
|
|
|
32
32
|
showOpacity: boolean;
|
|
33
33
|
};
|
|
34
34
|
defaultOpen: boolean;
|
|
35
|
+
visible: boolean;
|
|
35
36
|
onChange: (inputValue: string, formatColorArr: Array<IColorTypesObj>) => void;
|
|
37
|
+
onVisibleChange: (visible: boolean) => void;
|
|
36
38
|
}
|
|
37
39
|
export interface IColorPickerPanelProps {
|
|
38
40
|
alpha: number;
|
|
@@ -60,6 +62,8 @@ export interface IColorPickerPanelProps {
|
|
|
60
62
|
};
|
|
61
63
|
showColorPickerPanel: boolean;
|
|
62
64
|
value: string;
|
|
65
|
+
visible: boolean;
|
|
66
|
+
showPanel: boolean;
|
|
63
67
|
setCurrentColorType: (currentColorType: IColorTypesObj['type']) => void;
|
|
64
68
|
setColTypeArr: (colTypeArr: Array<IColorTypesObj>) => void;
|
|
65
69
|
setClickedColorIndex: (clickedColorIndex: number) => void;
|
|
@@ -70,4 +74,5 @@ export interface IColorPickerPanelProps {
|
|
|
70
74
|
setInputColorValue: (colorValue: string) => void;
|
|
71
75
|
setShowPanel: (showPanel: boolean) => void;
|
|
72
76
|
onChange?: (inputValue: string, formatColorArr: Array<IColorTypesObj>) => void;
|
|
77
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
73
78
|
}
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
/* ----------- zIndex ——————---- end */
|
|
106
106
|
.kd-color-picker-container {
|
|
107
107
|
position: relative;
|
|
108
|
+
width: var(--kd-c-color-picker-input-sizing-width, 230px);
|
|
108
109
|
}
|
|
109
110
|
.kd-color-picker-container .kd-color-picker-input {
|
|
110
111
|
width: var(--kd-c-color-picker-input-sizing-width, 230px);
|
|
@@ -146,6 +147,9 @@
|
|
|
146
147
|
transition: transform 0.2s ease-in-out;
|
|
147
148
|
transition: transform 0.2s ease-in-out, -webkit-transform 0.2s ease-in-out;
|
|
148
149
|
}
|
|
150
|
+
.kd-color-picker-pop {
|
|
151
|
+
width: var(--kd-c-color-picker-panel-sizing-width, 304px);
|
|
152
|
+
}
|
|
149
153
|
.kd-color-picker-pop.topLeft.hidden,
|
|
150
154
|
.kd-color-picker-pop.bottomLeft.hidden,
|
|
151
155
|
.kd-color-picker-pop.topRight.hidden,
|
|
@@ -255,19 +259,30 @@
|
|
|
255
259
|
vertical-align: middle;
|
|
256
260
|
margin-right: 9px;
|
|
257
261
|
}
|
|
258
|
-
.kd-color-picker-pop .kd-color-picker-panel-
|
|
262
|
+
.kd-color-picker-pop .kd-color-picker-panel-container {
|
|
263
|
+
display: -webkit-box;
|
|
264
|
+
display: -ms-flexbox;
|
|
265
|
+
display: flex;
|
|
266
|
+
-ms-flex-wrap: nowrap;
|
|
267
|
+
flex-wrap: nowrap;
|
|
268
|
+
margin-top: 10px;
|
|
269
|
+
}
|
|
270
|
+
.kd-color-picker-pop .kd-color-picker-panel-container-input {
|
|
271
|
+
-webkit-box-flex: 1;
|
|
272
|
+
-ms-flex: 1 1 auto;
|
|
273
|
+
flex: 1 1 auto;
|
|
259
274
|
display: inline-block;
|
|
260
275
|
position: relative;
|
|
261
|
-
margin-top: 12px;
|
|
262
276
|
font-size: var(--kd-c-color-picker-panel-select-font-size, var(--kd-g-font-size-middle, 14px));
|
|
263
277
|
}
|
|
264
|
-
.kd-color-picker-pop .kd-color-picker-panel-input-
|
|
265
|
-
margin
|
|
278
|
+
.kd-color-picker-pop .kd-color-picker-panel-container-input .kd-select-dropdown-panel {
|
|
279
|
+
margin: 0 !important;
|
|
266
280
|
}
|
|
267
|
-
.kd-color-picker-pop .kd-color-picker-panel-input .kd-select.bottomLeft,
|
|
268
|
-
.kd-color-picker-pop .kd-color-picker-panel-input .kd-select.topLeft {
|
|
281
|
+
.kd-color-picker-pop .kd-color-picker-panel-container-input .kd-select-dropdown-panel.bottomLeft,
|
|
282
|
+
.kd-color-picker-pop .kd-color-picker-panel-container-input .kd-select-dropdown-panel.topLeft {
|
|
269
283
|
position: absolute;
|
|
270
284
|
width: 60px !important;
|
|
285
|
+
min-width: unset !important;
|
|
271
286
|
background: #FFFFFF;
|
|
272
287
|
right: 0;
|
|
273
288
|
left: unset !important;
|
|
@@ -275,7 +290,7 @@
|
|
|
275
290
|
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2);
|
|
276
291
|
border-radius: 2px;
|
|
277
292
|
}
|
|
278
|
-
.kd-color-picker-pop .kd-color-picker-panel-input .kd-select .kd-select-dropdown .kd-select-item-option {
|
|
293
|
+
.kd-color-picker-pop .kd-color-picker-panel-container-input .kd-select-dropdown-panel .kd-select-dropdown .kd-select-item-option {
|
|
279
294
|
display: -webkit-box;
|
|
280
295
|
display: -ms-flexbox;
|
|
281
296
|
display: flex;
|
|
@@ -284,21 +299,23 @@
|
|
|
284
299
|
justify-content: center;
|
|
285
300
|
min-width: unset;
|
|
286
301
|
}
|
|
287
|
-
.kd-color-picker-pop .kd-color-picker-panel-input .kd-select-bordered {
|
|
302
|
+
.kd-color-picker-pop .kd-color-picker-panel-container-input .kd-select-bordered {
|
|
288
303
|
border-radius: 2px;
|
|
289
304
|
width: var(--kd-c-color-picker-panel-select-sizing-width, 212px);
|
|
290
305
|
height: var(--kd-c-color-picker-panel-select-sizing-height, 28px);
|
|
291
306
|
min-height: 28px;
|
|
292
|
-
|
|
307
|
+
padding: 0 28px 0 0;
|
|
293
308
|
}
|
|
294
|
-
.kd-color-picker-pop .kd-color-picker-panel-input .kd-select-bordered .kd-select-placeholder {
|
|
309
|
+
.kd-color-picker-pop .kd-color-picker-panel-container-input .kd-select-bordered .kd-select-placeholder {
|
|
295
310
|
left: 8px;
|
|
296
311
|
}
|
|
297
|
-
.kd-color-picker-pop .kd-color-picker-panel-input .active-option {
|
|
312
|
+
.kd-color-picker-pop .kd-color-picker-panel-container-input .active-option {
|
|
298
313
|
background-color: var(--kd-c-color-picker-panel-option-color-background-selected, var(--kd-g-color-theme-3, #e3eeff));
|
|
299
314
|
}
|
|
300
|
-
.kd-color-picker-pop .kd-color-picker-panel-transparent {
|
|
301
|
-
|
|
315
|
+
.kd-color-picker-pop .kd-color-picker-panel-container-transparent {
|
|
316
|
+
-webkit-box-flex: 0;
|
|
317
|
+
-ms-flex: 0 0 60px;
|
|
318
|
+
flex: 0 0 60px;
|
|
302
319
|
height: 28px;
|
|
303
320
|
margin-left: 8px;
|
|
304
321
|
text-align: center;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.@{color-picker-prefix-cls}-container {
|
|
8
8
|
position: relative;
|
|
9
|
+
width: @color-picker-input-sizing-width;
|
|
9
10
|
|
|
10
11
|
.@{color-picker-prefix-cls}-input {
|
|
11
12
|
width: @color-picker-input-sizing-width;
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
.@{color-picker-prefix-cls}-pop {
|
|
56
|
+
width: @color-picker-panel-sizing-width;
|
|
55
57
|
|
|
56
58
|
&.topLeft.hidden,
|
|
57
59
|
&.bottomLeft.hidden,
|
|
@@ -202,63 +204,67 @@
|
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
206
|
|
|
205
|
-
&-
|
|
206
|
-
display:
|
|
207
|
-
|
|
208
|
-
margin-top:
|
|
209
|
-
font-size: @color-picker-panel-select-font-size;
|
|
207
|
+
&-container {
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-wrap: nowrap;
|
|
210
|
+
margin-top: 10px;
|
|
210
211
|
|
|
211
|
-
&-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
&-input {
|
|
213
|
+
flex: 1 1 auto;
|
|
214
|
+
display: inline-block;
|
|
215
|
+
position: relative;
|
|
216
|
+
font-size: @color-picker-panel-select-font-size;
|
|
217
|
+
|
|
218
|
+
.@{kd-prefix}-select-dropdown-panel {
|
|
219
|
+
margin: 0 !important;
|
|
220
|
+
|
|
221
|
+
&.bottomLeft,
|
|
222
|
+
&.topLeft {
|
|
223
|
+
position: absolute;
|
|
224
|
+
width: 60px !important;
|
|
225
|
+
min-width: unset !important;
|
|
226
|
+
background: #FFFFFF;
|
|
227
|
+
right: 0;
|
|
228
|
+
left: unset !important;
|
|
229
|
+
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.20);
|
|
230
|
+
border-radius: 2px;
|
|
231
|
+
}
|
|
214
232
|
|
|
215
|
-
|
|
233
|
+
.@{kd-prefix}-select-dropdown {
|
|
234
|
+
.@{kd-prefix}-select-item-option {
|
|
235
|
+
display: flex;
|
|
236
|
+
justify-content: center;
|
|
237
|
+
min-width: unset;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
216
241
|
|
|
217
|
-
|
|
218
|
-
&.topLeft {
|
|
219
|
-
position: absolute;
|
|
220
|
-
width: 60px !important;
|
|
221
|
-
background: #FFFFFF;
|
|
222
|
-
right: 0;
|
|
223
|
-
left: unset !important;
|
|
224
|
-
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.20);
|
|
242
|
+
.@{kd-prefix}-select-bordered {
|
|
225
243
|
border-radius: 2px;
|
|
226
|
-
|
|
244
|
+
width: @color-picker-panel-select-sizing-width;
|
|
245
|
+
height: @color-picker-panel-select-sizing-height;
|
|
246
|
+
min-height: 28px;
|
|
247
|
+
padding: 0 28px 0 0;
|
|
227
248
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
display: flex;
|
|
231
|
-
justify-content: center;
|
|
232
|
-
min-width: unset;
|
|
249
|
+
.@{kd-prefix}-select-placeholder {
|
|
250
|
+
left: 8px;
|
|
233
251
|
}
|
|
234
252
|
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.@{kd-prefix}-select-bordered {
|
|
238
|
-
border-radius: 2px;
|
|
239
|
-
width: @color-picker-panel-select-sizing-width;
|
|
240
|
-
height: @color-picker-panel-select-sizing-height;
|
|
241
|
-
min-height: 28px;
|
|
242
|
-
margin-top: -2px;
|
|
243
253
|
|
|
244
|
-
|
|
245
|
-
|
|
254
|
+
.active-option {
|
|
255
|
+
background-color: @color-picker-panel-option-color-background;
|
|
246
256
|
}
|
|
247
257
|
}
|
|
248
258
|
|
|
249
|
-
|
|
250
|
-
|
|
259
|
+
&-transparent {
|
|
260
|
+
flex: 0 0 60px;
|
|
261
|
+
height: 28px;
|
|
262
|
+
margin-left: 8px;
|
|
263
|
+
text-align: center;
|
|
264
|
+
font-size: @color-picker-panel-alpha-font-size;
|
|
251
265
|
}
|
|
252
266
|
}
|
|
253
267
|
|
|
254
|
-
&-transparent {
|
|
255
|
-
width: 60px;
|
|
256
|
-
height: 28px;
|
|
257
|
-
margin-left: 8px;
|
|
258
|
-
text-align: center;
|
|
259
|
-
font-size: @color-picker-panel-alpha-font-size;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
268
|
&-colorDivContainer {
|
|
263
269
|
display: grid;
|
|
264
270
|
grid-template-columns: repeat(12, 1fr);
|
|
@@ -490,6 +490,11 @@ var compDefaultProps = {
|
|
|
490
490
|
showDescription: true,
|
|
491
491
|
optionHighlightProps: 'highlightText',
|
|
492
492
|
allowClear: true
|
|
493
|
+
},
|
|
494
|
+
Clipboard: {
|
|
495
|
+
action: 'copy',
|
|
496
|
+
disabled: false,
|
|
497
|
+
size: 'middle'
|
|
493
498
|
}
|
|
494
499
|
};
|
|
495
500
|
var _default = compDefaultProps;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -73,6 +73,12 @@ Object.defineProperty(exports, "CityPicker", {
|
|
|
73
73
|
return _cityPicker.default;
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
+
Object.defineProperty(exports, "Clipboard", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function get() {
|
|
79
|
+
return _clipboard.default;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
76
82
|
Object.defineProperty(exports, "Col", {
|
|
77
83
|
enumerable: true,
|
|
78
84
|
get: function get() {
|
|
@@ -430,6 +436,7 @@ var _baseData = _interopRequireDefault(require("./base-data"));
|
|
|
430
436
|
var _link = _interopRequireDefault(require("./link"));
|
|
431
437
|
var _treeSelect = _interopRequireDefault(require("./tree-select"));
|
|
432
438
|
var _colorPicker = _interopRequireDefault(require("./color-picker"));
|
|
439
|
+
var _clipboard = _interopRequireDefault(require("./clipboard"));
|
|
433
440
|
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); }
|
|
434
441
|
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; }
|
|
435
442
|
/* @remove-on-es-build-begin */
|
package/lib/locale/locale.d.ts
CHANGED
|
@@ -98,6 +98,8 @@ declare class LocaleCache {
|
|
|
98
98
|
'Table.notIsNull': string;
|
|
99
99
|
'Table.resetFilter': string;
|
|
100
100
|
'Table.confirmFilter': string;
|
|
101
|
+
'Select.selectAll': string;
|
|
102
|
+
'Select.seleted': string;
|
|
101
103
|
'DatePicker.placeholder': string;
|
|
102
104
|
'DatePicker.yearPlaceholder': string;
|
|
103
105
|
'DatePicker.quarterPlaceholder': string;
|
package/lib/locale/zh-CN.d.ts
CHANGED
|
@@ -72,6 +72,8 @@ declare const locale: {
|
|
|
72
72
|
'Table.notIsNull': string;
|
|
73
73
|
'Table.resetFilter': string;
|
|
74
74
|
'Table.confirmFilter': string;
|
|
75
|
+
'Select.selectAll': string;
|
|
76
|
+
'Select.seleted': string;
|
|
75
77
|
'DatePicker.placeholder': string;
|
|
76
78
|
'DatePicker.yearPlaceholder': string;
|
|
77
79
|
'DatePicker.quarterPlaceholder': string;
|
package/lib/locale/zh-CN.js
CHANGED
|
@@ -82,7 +82,9 @@ var locale = (0, _extends2.default)((0, _extends2.default)({
|
|
|
82
82
|
'Table.isNull': '为空',
|
|
83
83
|
'Table.notIsNull': '不为空',
|
|
84
84
|
'Table.resetFilter': '重置',
|
|
85
|
-
'Table.confirmFilter': '确定'
|
|
85
|
+
'Table.confirmFilter': '确定',
|
|
86
|
+
'Select.selectAll': '全选',
|
|
87
|
+
'Select.seleted': '已选{size}项'
|
|
86
88
|
});
|
|
87
89
|
var _default = locale;
|
|
88
90
|
exports.default = _default;
|
package/lib/message/content.js
CHANGED
|
@@ -70,16 +70,13 @@ var Content = function Content(args) {
|
|
|
70
70
|
}));
|
|
71
71
|
};
|
|
72
72
|
var getMainElement = function getMainElement() {
|
|
73
|
-
if (typeof content === 'string') {
|
|
73
|
+
if (typeof content === 'string' || /*#__PURE__*/_react.default.isValidElement(content)) {
|
|
74
74
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
75
75
|
className: "".concat(classPrefix, "-main")
|
|
76
76
|
}, renderIcon(), /*#__PURE__*/_react.default.createElement("div", {
|
|
77
77
|
className: "".concat(classPrefix, "-text")
|
|
78
78
|
}, content)), renderCloseIcon());
|
|
79
79
|
}
|
|
80
|
-
if ( /*#__PURE__*/_react.default.isValidElement(content)) {
|
|
81
|
-
return content;
|
|
82
|
-
}
|
|
83
80
|
return null;
|
|
84
81
|
};
|
|
85
82
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, getMainElement());
|