@kdcloudjs/kdesign 1.8.21 → 1.8.23
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/dist/kdesign-complete.less +258 -13
- package/dist/kdesign.css +688 -240
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +125 -64
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +4 -4
- package/dist/kdesign.min.js +9 -9
- package/dist/kdesign.min.js.map +1 -1
- package/es/cascader/style/index.less +4 -3
- package/es/color-picker/color-picker-panel.js +41 -24
- package/es/color-picker/color-picker.d.ts +3 -3
- package/es/color-picker/color-picker.js +20 -5
- package/es/color-picker/interface.d.ts +6 -0
- package/es/color-picker/style/index.css +17 -6
- package/es/color-picker/style/index.less +16 -5
- package/es/color-picker/utils/removeTransparency.d.ts +3 -0
- package/es/color-picker/utils/removeTransparency.js +4 -0
- package/es/config-provider/compDefaultProps.d.ts +2 -3
- package/es/config-provider/compDefaultProps.js +2 -3
- package/es/icon/icon.js +9 -4
- package/es/icon/style/index.less +2 -2
- package/es/input/style/index.css +3 -3
- package/es/input/style/index.less +1 -1
- package/es/input/style/token.less +1 -1
- package/es/style/icon/kdicon.less +231 -0
- package/es/style/index.css +667 -1
- package/es/style/index.less +1 -1
- package/es/switch/style/index.less +2 -1
- package/lib/cascader/style/index.less +4 -3
- package/lib/color-picker/color-picker-panel.js +41 -24
- package/lib/color-picker/color-picker.d.ts +3 -3
- package/lib/color-picker/color-picker.js +19 -4
- package/lib/color-picker/interface.d.ts +6 -0
- package/lib/color-picker/style/index.css +17 -6
- package/lib/color-picker/style/index.less +16 -5
- package/lib/color-picker/utils/removeTransparency.d.ts +3 -0
- package/lib/color-picker/utils/removeTransparency.js +11 -0
- package/lib/config-provider/compDefaultProps.d.ts +2 -3
- package/lib/config-provider/compDefaultProps.js +2 -3
- package/lib/icon/icon.js +9 -4
- package/lib/icon/style/index.less +2 -2
- package/lib/input/style/index.css +3 -3
- package/lib/input/style/index.less +1 -1
- package/lib/input/style/token.less +1 -1
- package/lib/style/icon/kdicon.less +231 -0
- package/lib/style/index.css +667 -1
- package/lib/style/index.less +1 -1
- package/lib/switch/style/index.less +2 -1
- package/package.json +1 -1
- package/es/style/icon/kdicon.css +0 -229
- package/lib/style/icon/kdicon.css +0 -229
|
@@ -29,6 +29,8 @@ var _reactColor = require("react-color");
|
|
|
29
29
|
var _devwarning = _interopRequireDefault(require("../_utils/devwarning"));
|
|
30
30
|
var _hooks = require("../_utils/hooks");
|
|
31
31
|
var _ieUtil = require("../_utils/ieUtil");
|
|
32
|
+
var _removeTransparency = require("./utils/removeTransparency");
|
|
33
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
32
34
|
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); }
|
|
33
35
|
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; }
|
|
34
36
|
var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
@@ -71,6 +73,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
71
73
|
showColorPickerBox = props.showColorPickerBox,
|
|
72
74
|
showColorPickerPanel = props.showColorPickerPanel,
|
|
73
75
|
showAlphaInput = props.showAlphaInput,
|
|
76
|
+
scrollHidden = props.scrollHidden,
|
|
74
77
|
value = props.value,
|
|
75
78
|
visible = props.visible,
|
|
76
79
|
showPanel = props.showPanel;
|
|
@@ -130,7 +133,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
130
133
|
var presetColorClick = function presetColorClick(index, colorValue) {
|
|
131
134
|
var colorLiAlpha = (0, _colorFormat.strFixed)((0, _color.default)((0, _colorFormat.getColorObj)(colorValue)).alpha(), 2);
|
|
132
135
|
var formatArr = (0, _colorFormat.colorFormat)(colorValue, colorLiAlpha);
|
|
133
|
-
var formatCorrectValue = removeTransparency(colorValue);
|
|
136
|
+
var formatCorrectValue = (0, _removeTransparency.removeTransparency)(colorValue, currentColorType);
|
|
134
137
|
var formatInputValue = (0, _convertLetters.toUpCase)(formatArr[(0, _colorFormat.valOfCorrespondingType)(format)].value);
|
|
135
138
|
setIsFollow(false);
|
|
136
139
|
setAlpha(isFollow ? 1 : colorLiAlpha);
|
|
@@ -146,7 +149,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
146
149
|
var historicalColorClick = function historicalColorClick(index, colorValue) {
|
|
147
150
|
var colorLiAlpha = (0, _colorFormat.strFixed)((0, _color.default)((0, _colorFormat.getColorObj)(colorValue)).alpha(), 2);
|
|
148
151
|
var formatArr = (0, _colorFormat.colorFormat)(colorValue, colorLiAlpha);
|
|
149
|
-
var formatCorrectValue = removeTransparency(colorValue);
|
|
152
|
+
var formatCorrectValue = (0, _removeTransparency.removeTransparency)(colorValue, currentColorType);
|
|
150
153
|
var formatInputValue = (0, _convertLetters.toUpCase)(formatArr[(0, _colorFormat.valOfCorrespondingType)(format)].value);
|
|
151
154
|
setIsFollow(false);
|
|
152
155
|
setAlpha(isFollow ? 1 : colorLiAlpha);
|
|
@@ -162,19 +165,18 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
162
165
|
var handleTypeChange = function handleTypeChange(selectValue) {
|
|
163
166
|
var _a, _b, _c;
|
|
164
167
|
setCurrentColorType(selectValue);
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return (0, _colorFormat.colorFormat)(color, 1, currentColorType, true);
|
|
168
|
+
if (inputCorrectColorValue) {
|
|
169
|
+
var colorStr = (_a = (0, _find.default)(colTypeArr).call(colTypeArr, function (item) {
|
|
170
|
+
return item.type === selectValue;
|
|
171
|
+
})) === null || _a === void 0 ? void 0 : _a.value;
|
|
172
|
+
setCorrectColorValue((0, _colorFormat.colorFormat)(colorStr, 1, selectValue, true));
|
|
173
|
+
setInputColorValue((_b = (0, _find.default)(colTypeArr).call(colTypeArr, function (item) {
|
|
174
|
+
return item.type === format;
|
|
175
|
+
})) === null || _b === void 0 ? void 0 : _b.value);
|
|
176
|
+
onChange === null || onChange === void 0 ? void 0 : onChange((_c = (0, _find.default)(colTypeArr).call(colTypeArr, function (item) {
|
|
177
|
+
return item.type === format;
|
|
178
|
+
})) === null || _c === void 0 ? void 0 : _c.value, colTypeArr);
|
|
179
|
+
}
|
|
178
180
|
};
|
|
179
181
|
var handleAlphaChange = function handleAlphaChange(e) {
|
|
180
182
|
var regPercentage = /^(0|[1-9][0-9]?|100)%$/;
|
|
@@ -183,7 +185,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
183
185
|
var getColorFormat = function getColorFormat(alpha) {
|
|
184
186
|
var formatArr = (0, _colorFormat.colorFormat)(correctColorValue, alpha, 'all', true);
|
|
185
187
|
var outValue = formatArr[(0, _colorFormat.valOfCorrespondingType)(format)].value;
|
|
186
|
-
var innerInput = removeTransparency(outValue);
|
|
188
|
+
var innerInput = (0, _removeTransparency.removeTransparency)(outValue, currentColorType);
|
|
187
189
|
return {
|
|
188
190
|
formatArr: formatArr,
|
|
189
191
|
outValue: outValue,
|
|
@@ -234,25 +236,25 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
234
236
|
var formatArr = (0, _colorFormat.colorFormat)(val, inputCorrectColorValue ? alpha : 1, 'all', true);
|
|
235
237
|
var outValue = formatArr[(0, _colorFormat.valOfCorrespondingType)(format)].value;
|
|
236
238
|
if (value === undefined) {
|
|
237
|
-
var innerInput = removeTransparency(val);
|
|
239
|
+
var innerInput = (0, _removeTransparency.removeTransparency)(val, currentColorType);
|
|
238
240
|
if (!inputCorrectColorValue) {
|
|
239
241
|
setPanelState(formatArr, innerInput, outValue, 1, '100%');
|
|
240
242
|
} else {
|
|
241
243
|
setPanelState(formatArr, innerInput, outValue);
|
|
242
244
|
}
|
|
243
245
|
} else if (onChange === undefined) {
|
|
244
|
-
setPanelState(colTypeArr, removeTransparency(correctColor), correctColor);
|
|
246
|
+
setPanelState(colTypeArr, (0, _removeTransparency.removeTransparency)(correctColor, currentColorType), correctColor);
|
|
245
247
|
}
|
|
246
248
|
onChange === null || onChange === void 0 ? void 0 : onChange(outValue, formatArr);
|
|
247
249
|
} else {
|
|
248
250
|
if (!inputCorrectColorValue) {
|
|
249
251
|
var _formatArr = (0, _colorFormat.colorFormat)(correctColor, 1, 'all', true);
|
|
250
|
-
setPanelState(_formatArr, removeTransparency(correctColor), correctColor, 1, '100%');
|
|
252
|
+
setPanelState(_formatArr, (0, _removeTransparency.removeTransparency)(correctColor, currentColorType), correctColor, 1, '100%');
|
|
251
253
|
onChange === null || onChange === void 0 ? void 0 : onChange((_b = (0, _find.default)(_formatArr).call(_formatArr, function (item) {
|
|
252
254
|
return item.type === format;
|
|
253
255
|
})) === null || _b === void 0 ? void 0 : _b.value, _formatArr);
|
|
254
256
|
} else {
|
|
255
|
-
setPanelState(colTypeArr, removeTransparency(correctColor), correctColor);
|
|
257
|
+
setPanelState(colTypeArr, (0, _removeTransparency.removeTransparency)(correctColor, currentColorType), correctColor);
|
|
256
258
|
onChange === null || onChange === void 0 ? void 0 : onChange((_c = (0, _find.default)(colTypeArr).call(colTypeArr, function (item) {
|
|
257
259
|
return item.type === format;
|
|
258
260
|
})) === null || _c === void 0 ? void 0 : _c.value, colTypeArr);
|
|
@@ -276,7 +278,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
276
278
|
var correctColor = (_a = (0, _find.default)(colTypeArr).call(colTypeArr, function (item) {
|
|
277
279
|
return item.type === format;
|
|
278
280
|
})) === null || _a === void 0 ? void 0 : _a.value;
|
|
279
|
-
setPanelState(colTypeArr, removeTransparency(correctColor), correctColor);
|
|
281
|
+
setPanelState(colTypeArr, (0, _removeTransparency.removeTransparency)(correctColor, currentColorType), correctColor);
|
|
280
282
|
}
|
|
281
283
|
onChange === null || onChange === void 0 ? void 0 : onChange(outValue, formatArr);
|
|
282
284
|
};
|
|
@@ -322,7 +324,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
322
324
|
setIsFollow(switchValue);
|
|
323
325
|
if (switchValue) {
|
|
324
326
|
formatArr = (0, _colorFormat.colorFormat)(functionalColor, alpha);
|
|
325
|
-
setPanelState(formatArr, removeTransparency(formatArr[(0, _colorFormat.valOfCorrespondingType)(currentColorType)].value), functionalColorName, (0, _colorFormat.strFixed)((0, _color.default)((0, _colorFormat.getColorObj)(functionalColor)).alpha(), 2), (0, _colorFormat.strFixed)((0, _color.default)((0, _colorFormat.getColorObj)(functionalColor)).alpha(), 2) * 100 + '%');
|
|
327
|
+
setPanelState(formatArr, (0, _removeTransparency.removeTransparency)(formatArr[(0, _colorFormat.valOfCorrespondingType)(currentColorType)].value, currentColorType), functionalColorName, (0, _colorFormat.strFixed)((0, _color.default)((0, _colorFormat.getColorObj)(functionalColor)).alpha(), 2), (0, _colorFormat.strFixed)((0, _color.default)((0, _colorFormat.getColorObj)(functionalColor)).alpha(), 2) * 100 + '%');
|
|
326
328
|
setClickColorIndex(formatArr[0].value);
|
|
327
329
|
} else {
|
|
328
330
|
formatArr = (0, _colorFormat.colorFormat)(_defaultColor.defaultSystemColor, 1, 'all', true);
|
|
@@ -342,10 +344,9 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
342
344
|
var handleChromeChange = function handleChromeChange(color) {
|
|
343
345
|
var formatArr = (0, _colorFormat.colorFormat)(color.hex, inputCorrectColorValue ? color.rgb.a : 1);
|
|
344
346
|
var colorObj = formatArr[(0, _colorFormat.valOfCorrespondingType)(currentColorType)];
|
|
345
|
-
console.log('colorObj', formatArr, colorObj);
|
|
346
347
|
if (value === undefined) {
|
|
347
348
|
setIsFollow(false);
|
|
348
|
-
setPanelState(formatArr, removeTransparency(colorObj.value), colorObj.value, inputCorrectColorValue ? color.rgb.a : 1, inputCorrectColorValue ? (color.rgb.a * 100).toFixed() + '%' : '100%');
|
|
349
|
+
setPanelState(formatArr, (0, _removeTransparency.removeTransparency)(colorObj.value, currentColorType), colorObj.value, inputCorrectColorValue ? color.rgb.a : 1, inputCorrectColorValue ? (color.rgb.a * 100).toFixed() + '%' : '100%');
|
|
349
350
|
setClickColorIndex(formatArr[0].value);
|
|
350
351
|
}
|
|
351
352
|
onChange === null || onChange === void 0 ? void 0 : onChange(colorObj.value, formatArr);
|
|
@@ -364,6 +365,22 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
|
364
365
|
}
|
|
365
366
|
showPanel && onVisibleChange && onVisibleChange(false);
|
|
366
367
|
});
|
|
368
|
+
(0, _react.useEffect)(function () {
|
|
369
|
+
if (showPanel) {
|
|
370
|
+
var scrollAlign = (0, _debounce.default)(function (e) {
|
|
371
|
+
var _a;
|
|
372
|
+
var isPopperScroll = e.target === panelClsRef.current || ((_a = panelClsRef === null || panelClsRef === void 0 ? void 0 : panelClsRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target));
|
|
373
|
+
if (scrollHidden && !isPopperScroll) {
|
|
374
|
+
visible === undefined && setShowPanel(!showPanel);
|
|
375
|
+
onVisibleChange && onVisibleChange(false);
|
|
376
|
+
}
|
|
377
|
+
}, 10);
|
|
378
|
+
document.addEventListener('scroll', scrollAlign, true);
|
|
379
|
+
return function () {
|
|
380
|
+
document.removeEventListener('scroll', scrollAlign, true);
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
}, [showPanel]);
|
|
367
384
|
(0, _react.useEffect)(function () {
|
|
368
385
|
if (!panelFormatConfig) return;
|
|
369
386
|
if (!Array.isArray(panelFormatConfig.show) || panelFormatConfig.show.length === 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IColorPickerProps } from './interface';
|
|
3
|
-
declare const ColorPicker:
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IColorPickerProps, IColorPickerInputRef } from './interface';
|
|
3
|
+
declare const ColorPicker: React.ForwardRefExoticComponent<Partial<IColorPickerProps> & React.RefAttributes<IColorPickerInputRef>>;
|
|
4
4
|
export default ColorPicker;
|
|
@@ -26,6 +26,7 @@ var _color = _interopRequireDefault(require("color"));
|
|
|
26
26
|
var _utils = require("../_utils");
|
|
27
27
|
var _usePopper = _interopRequireDefault(require("../_utils/usePopper"));
|
|
28
28
|
var _systemPresetColor = require("./constant/systemPresetColor");
|
|
29
|
+
var _removeTransparency = require("./utils/removeTransparency");
|
|
29
30
|
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); }
|
|
30
31
|
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; }
|
|
31
32
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
@@ -36,7 +37,7 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
36
37
|
}
|
|
37
38
|
return t;
|
|
38
39
|
};
|
|
39
|
-
var
|
|
40
|
+
var InternalColorPicker = function InternalColorPicker(props, ref) {
|
|
40
41
|
var _useContext = (0, _react.useContext)(_configProvider.ConfigContext),
|
|
41
42
|
getPrefixCls = _useContext.getPrefixCls,
|
|
42
43
|
prefixCls = _useContext.prefixCls,
|
|
@@ -63,13 +64,15 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
63
64
|
placeholder = colorPickerProps.placeholder,
|
|
64
65
|
defaultValue = colorPickerProps.defaultValue,
|
|
65
66
|
defaultOpen = colorPickerProps.defaultOpen,
|
|
67
|
+
disabled = colorPickerProps.disabled,
|
|
66
68
|
visible = colorPickerProps.visible,
|
|
69
|
+
scrollHidden = colorPickerProps.scrollHidden,
|
|
67
70
|
popperClassName = colorPickerProps.popperClassName,
|
|
68
71
|
suffixIcon = colorPickerProps.suffixIcon,
|
|
69
72
|
prefixIcon = colorPickerProps.prefixIcon,
|
|
70
73
|
onChange = colorPickerProps.onChange,
|
|
71
74
|
onVisibleChange = colorPickerProps.onVisibleChange,
|
|
72
|
-
otherProps = __rest(colorPickerProps, ["value", "className", "style", "pure", "functionalColor", "functionalColorName", "switchName", "showAlphaInput", "showClear", "showSwitch", "showColorTransfer", "showPresetColor", "showColorPickerBox", "format", "panelFormatConfig", "borderType", "presetColor", "historicalColor", "placeholder", "defaultValue", "defaultOpen", "visible", "popperClassName", "suffixIcon", "prefixIcon", "onChange", "onVisibleChange"]);
|
|
75
|
+
otherProps = __rest(colorPickerProps, ["value", "className", "style", "pure", "functionalColor", "functionalColorName", "switchName", "showAlphaInput", "showClear", "showSwitch", "showColorTransfer", "showPresetColor", "showColorPickerBox", "format", "panelFormatConfig", "borderType", "presetColor", "historicalColor", "placeholder", "defaultValue", "defaultOpen", "disabled", "visible", "scrollHidden", "popperClassName", "suffixIcon", "prefixIcon", "onChange", "onVisibleChange"]);
|
|
73
76
|
var _useState = (0, _react.useState)(defaultValue || ''),
|
|
74
77
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
75
78
|
inputColorValue = _useState2[0],
|
|
@@ -191,6 +194,7 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
191
194
|
onChange === null || onChange === void 0 ? void 0 : onChange(getCurrentOutputColor(), formatArr);
|
|
192
195
|
};
|
|
193
196
|
var handleClick = function handleClick() {
|
|
197
|
+
if (disabled) return;
|
|
194
198
|
if (typeof visible === 'undefined') {
|
|
195
199
|
setShowPanel(!showPanel);
|
|
196
200
|
}
|
|
@@ -215,19 +219,27 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
215
219
|
}
|
|
216
220
|
}
|
|
217
221
|
}, [value, defaultValue]);
|
|
222
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
223
|
+
return {
|
|
224
|
+
dom: inputRef.current
|
|
225
|
+
};
|
|
226
|
+
});
|
|
218
227
|
var beforeIcon = (0, _react.useCallback)(function () {
|
|
219
228
|
var _classNames2;
|
|
220
229
|
var afterIconContainerCls = (0, _classnames.default)("".concat(colorPickerPrefixCls, "-icon"), (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(colorPickerPrefixCls, "-icon-underline"), borderType === 'underline'), (0, _defineProperty2.default)(_classNames2, "".concat(colorPickerPrefixCls, "-icon-bordered"), borderType === 'bordered'), _classNames2));
|
|
230
|
+
var getBgc = function getBgc() {
|
|
231
|
+
return inputCorrectColorValue ? colTypeArr[2].value : (0, _removeTransparency.removeTransparency)(colTypeArr[2].value, currentColorType);
|
|
232
|
+
};
|
|
221
233
|
var noneLineCls = "".concat(colorPickerPrefixCls, "-icon-no-color-line");
|
|
222
234
|
return _react.default.createElement("div", {
|
|
223
235
|
className: afterIconContainerCls,
|
|
224
236
|
style: {
|
|
225
|
-
backgroundColor:
|
|
237
|
+
backgroundColor: getBgc() || _defaultColor.defaultSystemColor
|
|
226
238
|
}
|
|
227
239
|
}, !(0, _validateColor.validateColor)(value) && !inputCorrectColorValue && _react.default.createElement("div", {
|
|
228
240
|
className: noneLineCls
|
|
229
241
|
}));
|
|
230
|
-
}, [borderType, colTypeArr, colorPickerPrefixCls, inputCorrectColorValue, value]);
|
|
242
|
+
}, [borderType, colTypeArr, colorPickerPrefixCls, currentColorType, inputCorrectColorValue, value]);
|
|
231
243
|
var colorInputEle = _react.default.createElement("div", {
|
|
232
244
|
className: containerCls,
|
|
233
245
|
ref: inputRef,
|
|
@@ -235,6 +247,7 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
235
247
|
}, _react.default.createElement(_index.Input, {
|
|
236
248
|
borderType: pure ? 'bordered' : borderType,
|
|
237
249
|
placeholder: placeholder,
|
|
250
|
+
disabled: disabled,
|
|
238
251
|
value: value !== null && value !== void 0 ? value : inputColorValue,
|
|
239
252
|
className: inputCls,
|
|
240
253
|
onChange: handleChange,
|
|
@@ -263,6 +276,7 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
263
276
|
panelFormatConfig: panelFormatConfig,
|
|
264
277
|
presetColor: presetColor,
|
|
265
278
|
historicalColor: historicalColor,
|
|
279
|
+
scrollHidden: scrollHidden,
|
|
266
280
|
value: value,
|
|
267
281
|
visible: visible,
|
|
268
282
|
showPanel: showPanel,
|
|
@@ -302,6 +316,7 @@ var ColorPicker = function ColorPicker(props) {
|
|
|
302
316
|
});
|
|
303
317
|
return (0, _usePopper.default)(colorInputEle, panel, popperProps);
|
|
304
318
|
};
|
|
319
|
+
var ColorPicker = (0, _react.forwardRef)(InternalColorPicker);
|
|
305
320
|
ColorPicker.displayName = 'ColorPicker';
|
|
306
321
|
var _default = ColorPicker;
|
|
307
322
|
exports.default = _default;
|
|
@@ -6,6 +6,9 @@ export interface IColorTypesObj {
|
|
|
6
6
|
type: ColorType;
|
|
7
7
|
value: string;
|
|
8
8
|
}
|
|
9
|
+
export interface IColorPickerInputRef {
|
|
10
|
+
dom: HTMLDivElement | null;
|
|
11
|
+
}
|
|
9
12
|
export declare const BorderTypes: ["underline", "bordered"];
|
|
10
13
|
export declare type BorderType = typeof BorderTypes[number];
|
|
11
14
|
export interface IInnerFormat {
|
|
@@ -15,8 +18,10 @@ export interface IInnerFormat {
|
|
|
15
18
|
export interface IColorPickerProps extends PopperProps {
|
|
16
19
|
borderType: BorderType;
|
|
17
20
|
className: string;
|
|
21
|
+
children: ReactNode;
|
|
18
22
|
defaultValue: string;
|
|
19
23
|
defaultOpen: boolean;
|
|
24
|
+
disabled: boolean;
|
|
20
25
|
functionalColorName: string;
|
|
21
26
|
functionalColor: string;
|
|
22
27
|
format: Exclude<typeof ColorTypes[number], 'themeColor'>;
|
|
@@ -83,6 +88,7 @@ export interface IColorPickerPanelProps {
|
|
|
83
88
|
value: string;
|
|
84
89
|
visible: boolean;
|
|
85
90
|
showPanel: boolean;
|
|
91
|
+
scrollHidden: boolean;
|
|
86
92
|
setCurrentColorType: (currentColorType: IColorTypesObj['type']) => void;
|
|
87
93
|
setColTypeArr: (colTypeArr: Array<IColorTypesObj>) => void;
|
|
88
94
|
setClickedPresetColorIndex: (clickedColorIndex: number) => void;
|
|
@@ -136,7 +136,6 @@
|
|
|
136
136
|
height: 100%;
|
|
137
137
|
width: 100%;
|
|
138
138
|
padding: 0 8px;
|
|
139
|
-
border-bottom: 1px solid #d9d9d9;
|
|
140
139
|
font-size: var(--kd-c-color-picker-input-font-size, var(--kd-g-font-size-middle, 14px));
|
|
141
140
|
}
|
|
142
141
|
.kd-color-picker-container .kd-color-picker-icon-container {
|
|
@@ -171,15 +170,27 @@
|
|
|
171
170
|
width: var(--kd-c-color-picker-panel-sizing-width, 304px);
|
|
172
171
|
}
|
|
173
172
|
.kd-color-picker-pop.topLeft.hidden,
|
|
173
|
+
.kd-color-picker-pop.topRight.hidden {
|
|
174
|
+
-webkit-animation-name: kdSlideDownOut;
|
|
175
|
+
animation-name: kdSlideDownOut;
|
|
176
|
+
}
|
|
177
|
+
.kd-color-picker-pop.topLeft,
|
|
178
|
+
.kd-color-picker-pop.topRight {
|
|
179
|
+
-webkit-animation-name: kdSlideDownIn;
|
|
180
|
+
animation-name: kdSlideDownIn;
|
|
181
|
+
}
|
|
174
182
|
.kd-color-picker-pop.bottomLeft.hidden,
|
|
175
|
-
.kd-color-picker-pop.topRight.hidden,
|
|
176
183
|
.kd-color-picker-pop.bottomRight.hidden {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
-webkit-animation-name: kdSlideUpOut;
|
|
185
|
+
animation-name: kdSlideUpOut;
|
|
186
|
+
}
|
|
187
|
+
.kd-color-picker-pop.bottomLeft,
|
|
188
|
+
.kd-color-picker-pop.bottomRight {
|
|
189
|
+
-webkit-animation-name: kdSlideUpIn;
|
|
190
|
+
animation-name: kdSlideUpIn;
|
|
181
191
|
}
|
|
182
192
|
.kd-color-picker-pop .kd-color-picker-panel {
|
|
193
|
+
position: relative;
|
|
183
194
|
-webkit-box-sizing: border-box;
|
|
184
195
|
box-sizing: border-box;
|
|
185
196
|
width: var(--kd-c-color-picker-panel-sizing-width, 304px);
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
height: 100%;
|
|
37
37
|
width: 100%;
|
|
38
38
|
padding: 0 8px;
|
|
39
|
-
border-bottom: 1px solid rgba(217, 217, 217, 1);
|
|
40
39
|
font-size: @color-picker-input-font-size;
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -70,15 +69,27 @@
|
|
|
70
69
|
width: @color-picker-panel-sizing-width;
|
|
71
70
|
|
|
72
71
|
&.topLeft.hidden,
|
|
72
|
+
&.topRight.hidden {
|
|
73
|
+
animation-name: kdSlideDownOut;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.topLeft,
|
|
77
|
+
&.topRight {
|
|
78
|
+
animation-name: kdSlideDownIn;
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
&.bottomLeft.hidden,
|
|
74
|
-
&.topRight.hidden,
|
|
75
82
|
&.bottomRight.hidden {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
animation-name: kdSlideUpOut;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.bottomLeft,
|
|
87
|
+
&.bottomRight {
|
|
88
|
+
animation-name: kdSlideUpIn;
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
.@{color-picker-prefix-cls}-panel {
|
|
92
|
+
position: relative;
|
|
82
93
|
box-sizing: border-box;
|
|
83
94
|
width: @color-picker-panel-sizing-width;
|
|
84
95
|
padding: 4px 12px 16px;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.removeTransparency = void 0;
|
|
7
|
+
var _colorFormat = require("./colorFormat");
|
|
8
|
+
var removeTransparency = function removeTransparency(color, currentColorType) {
|
|
9
|
+
return (0, _colorFormat.colorFormat)(color, 1, currentColorType, true);
|
|
10
|
+
};
|
|
11
|
+
exports.removeTransparency = removeTransparency;
|
|
@@ -73,6 +73,7 @@ declare const compDefaultProps: {
|
|
|
73
73
|
internationalName: string;
|
|
74
74
|
};
|
|
75
75
|
placeholder: string;
|
|
76
|
+
scrollHidden: boolean;
|
|
76
77
|
pure: boolean;
|
|
77
78
|
showAlphaInput: boolean;
|
|
78
79
|
showClear: boolean;
|
|
@@ -156,9 +157,7 @@ declare const compDefaultProps: {
|
|
|
156
157
|
labelAlign: string;
|
|
157
158
|
size: string;
|
|
158
159
|
};
|
|
159
|
-
Icon: {
|
|
160
|
-
prefix: string;
|
|
161
|
-
};
|
|
160
|
+
Icon: {};
|
|
162
161
|
Input: {
|
|
163
162
|
type: string;
|
|
164
163
|
size: string;
|
|
@@ -83,6 +83,7 @@ var compDefaultProps = {
|
|
|
83
83
|
internationalName: 'followFunctionalColor'
|
|
84
84
|
},
|
|
85
85
|
placeholder: '#',
|
|
86
|
+
scrollHidden: false,
|
|
86
87
|
pure: false,
|
|
87
88
|
showAlphaInput: true,
|
|
88
89
|
showClear: true,
|
|
@@ -166,9 +167,7 @@ var compDefaultProps = {
|
|
|
166
167
|
labelAlign: 'left',
|
|
167
168
|
size: 'middle'
|
|
168
169
|
},
|
|
169
|
-
Icon: {
|
|
170
|
-
prefix: 'kdicon'
|
|
171
|
-
},
|
|
170
|
+
Icon: {},
|
|
172
171
|
Input: {
|
|
173
172
|
type: 'text',
|
|
174
173
|
size: 'middle',
|
package/lib/icon/icon.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.default = void 0;
|
|
|
11
11
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
13
13
|
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
14
|
+
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
14
15
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
15
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
16
17
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -29,12 +30,14 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
29
30
|
var InternalIcon = function InternalIcon(props, ref) {
|
|
30
31
|
var _context, _classNames;
|
|
31
32
|
var _useContext = (0, _react.useContext)(_ConfigContext.default),
|
|
32
|
-
|
|
33
|
+
getPrefixCls = _useContext.getPrefixCls,
|
|
34
|
+
userDefaultProps = _useContext.compDefaultProps,
|
|
35
|
+
prefixCls = _useContext.prefixCls;
|
|
33
36
|
var iconProps = (0, _utils.getCompProps)('Icon', userDefaultProps, props);
|
|
34
37
|
var type = iconProps.type,
|
|
35
38
|
spin = iconProps.spin,
|
|
36
39
|
style = iconProps.style,
|
|
37
|
-
|
|
40
|
+
customPrefixcls = iconProps.prefix,
|
|
38
41
|
className = iconProps.className,
|
|
39
42
|
rotate = iconProps.rotate,
|
|
40
43
|
onClick = iconProps.onClick,
|
|
@@ -43,8 +46,10 @@ var InternalIcon = function InternalIcon(props, ref) {
|
|
|
43
46
|
others = __rest(iconProps, ["type", "spin", "style", "prefix", "className", "rotate", "onClick", "onMouseEnter", "onMouseLeave"]);
|
|
44
47
|
var innerRef = _react.default.useRef();
|
|
45
48
|
var iconRef = ref || innerRef;
|
|
46
|
-
var iconPrefix =
|
|
47
|
-
var
|
|
49
|
+
var iconPrefix = getPrefixCls(prefixCls, 'icon', customPrefixcls);
|
|
50
|
+
var lastDashIndex = iconPrefix.lastIndexOf('-');
|
|
51
|
+
var iconPrefixCls = lastDashIndex > -1 ? (0, _slice.default)(iconPrefix).call(iconPrefix, 0, lastDashIndex) + (0, _slice.default)(iconPrefix).call(iconPrefix, lastDashIndex + 1) : iconPrefix;
|
|
52
|
+
var iconClass = (0, _classnames.default)(iconPrefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, (0, _concat.default)(_context = "".concat(iconPrefixCls, "-")).call(_context, type), type), (0, _defineProperty2.default)(_classNames, "icon-spin", spin), _classNames));
|
|
48
53
|
var handleClick = function handleClick(e) {
|
|
49
54
|
onClick && onClick(e);
|
|
50
55
|
};
|
|
@@ -236,7 +236,7 @@ textarea {
|
|
|
236
236
|
.kd-input-disabled {
|
|
237
237
|
background-color: var(--kd-c-input-color-background-disabled, var(--kd-g-color-background-contain-disabled, #f5f5f5));
|
|
238
238
|
border-color: var(--kd-c-input-color-border-disabled, var(--kd-g-color-border-strong, #d9d9d9));
|
|
239
|
-
color: var(--kd-
|
|
239
|
+
color: var(--kd-g-color-text-primary, #212121);
|
|
240
240
|
cursor: not-allowed;
|
|
241
241
|
}
|
|
242
242
|
.kd-input-underline.kd-input-disabled {
|
|
@@ -372,7 +372,7 @@ textarea {
|
|
|
372
372
|
-ms-flex-pack: center;
|
|
373
373
|
justify-content: center;
|
|
374
374
|
word-break: keep-all;
|
|
375
|
-
color: var(--kd-c-input-affix-color-text, #
|
|
375
|
+
color: var(--kd-c-input-affix-color-text, #999);
|
|
376
376
|
}
|
|
377
377
|
.kd-input-wrapper-size-small {
|
|
378
378
|
height: var(--kd-c-input-sizing-height-small, 20px);
|
|
@@ -571,7 +571,7 @@ textarea {
|
|
|
571
571
|
}
|
|
572
572
|
.kd-input-group-wrapper .kd-input-group .kd-input-group-addon {
|
|
573
573
|
position: relative;
|
|
574
|
-
color: var(--kd-c-input-affix-color-text, #
|
|
574
|
+
color: var(--kd-c-input-affix-color-text, #999);
|
|
575
575
|
padding: 0 9px;
|
|
576
576
|
font-weight: 400;
|
|
577
577
|
font-size: 14px;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
@input-border-color-disabled-inner: var(~'@{input-prefix}-color-border-disabled', @color-border-strong);
|
|
15
15
|
@input-underline-border-color-disabled-inner: var(~'@{input-prefix}-underline-color-border-disabled', @color-border-weak);
|
|
16
16
|
@input-color-disabled-inner: var(~'@{input-prefix}-color-disabled', @color-disabled);
|
|
17
|
-
@input-affix-color: var(~'@{input-prefix}-affix-color-text', #
|
|
17
|
+
@input-affix-color: var(~'@{input-prefix}-affix-color-text', #999);
|
|
18
18
|
@input-error-color: var(~'@{input-prefix}-color-error', @color-error);
|
|
19
19
|
|
|
20
20
|
// font
|