@kdcloudjs/kdesign 1.7.0 → 1.7.2

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 (208) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/default-theme.js +4 -5
  3. package/dist/kdesign-complete.less +332 -35
  4. package/dist/kdesign.css +549 -30
  5. package/dist/kdesign.css.map +1 -1
  6. package/dist/kdesign.js +21841 -3922
  7. package/dist/kdesign.js.map +1 -1
  8. package/dist/kdesign.min.css +3 -3
  9. package/dist/kdesign.min.js +9 -9
  10. package/dist/kdesign.min.js.map +1 -1
  11. package/es/alert/style/index.css +2 -0
  12. package/es/anchor/style/index.css +2 -0
  13. package/es/avatar/style/index.css +2 -0
  14. package/es/badge/style/index.css +2 -0
  15. package/es/base-data/style/index.css +2 -0
  16. package/es/button/style/index.css +2 -0
  17. package/es/card/style/index.css +2 -0
  18. package/es/carousel/style/index.css +2 -0
  19. package/es/cascader/style/index.css +2 -0
  20. package/es/checkbox/style/index.css +2 -0
  21. package/es/city-picker/style/index.css +2 -0
  22. package/es/collapse/style/index.css +2 -0
  23. package/es/color-picker/color-picker-panel.d.ts +4 -0
  24. package/es/color-picker/color-picker-panel.js +239 -0
  25. package/es/color-picker/color-picker.d.ts +4 -0
  26. package/es/color-picker/color-picker.js +201 -0
  27. package/es/color-picker/constant/colorTypes.d.ts +4 -0
  28. package/es/color-picker/constant/colorTypes.js +13 -0
  29. package/es/color-picker/constant/defaultColor.d.ts +1 -0
  30. package/es/color-picker/constant/defaultColor.js +1 -0
  31. package/es/color-picker/constant/systemPresetColor.d.ts +1 -0
  32. package/es/color-picker/constant/systemPresetColor.js +1 -0
  33. package/es/color-picker/index.d.ts +3 -0
  34. package/es/color-picker/index.js +3 -0
  35. package/es/color-picker/interface.d.ts +64 -0
  36. package/es/color-picker/interface.js +3 -0
  37. package/es/color-picker/style/css.js +2 -0
  38. package/es/color-picker/style/index.css +323 -0
  39. package/es/color-picker/style/index.d.ts +2 -0
  40. package/es/color-picker/style/index.js +2 -0
  41. package/es/color-picker/style/index.less +257 -0
  42. package/es/color-picker/style/mixin.less +5 -0
  43. package/es/color-picker/style/token.less +22 -0
  44. package/es/color-picker/utils/colorFormat.d.ts +18 -0
  45. package/es/color-picker/utils/colorFormat.js +153 -0
  46. package/es/color-picker/utils/convertLetters.d.ts +1 -0
  47. package/es/color-picker/utils/convertLetters.js +12 -0
  48. package/es/color-picker/utils/hooks/useOnClickOutside.d.ts +2 -0
  49. package/es/color-picker/utils/hooks/useOnClickOutside.js +16 -0
  50. package/es/color-picker/utils/validateColor.d.ts +1 -0
  51. package/es/color-picker/utils/validateColor.js +24 -0
  52. package/es/config-provider/compDefaultProps.d.ts +12 -0
  53. package/es/config-provider/compDefaultProps.js +12 -0
  54. package/es/date-picker/style/index.css +2 -0
  55. package/es/drawer/style/index.css +2 -0
  56. package/es/dropdown/dropdown.js +2 -7
  57. package/es/dropdown/menu.js +3 -0
  58. package/es/dropdown/style/index.css +2 -0
  59. package/es/empty/style/index.css +2 -0
  60. package/es/filter/style/index.css +2 -0
  61. package/es/form/style/index.css +2 -0
  62. package/es/grid/style/index.css +2 -0
  63. package/es/icon/style/index.css +2 -0
  64. package/es/image/style/index.css +2 -0
  65. package/es/image-cropper/style/index.css +2 -0
  66. package/es/index.d.ts +1 -0
  67. package/es/index.js +2 -1
  68. package/es/input/style/index.css +2 -0
  69. package/es/input-number/style/index.css +2 -0
  70. package/es/layout/style/index.css +2 -0
  71. package/es/link/style/index.css +2 -0
  72. package/es/locale/locale.d.ts +4 -0
  73. package/es/locale/locale.js +6 -4
  74. package/es/locale/zh-CN.d.ts +1 -0
  75. package/es/locale/zh-CN.js +1 -0
  76. package/es/menu/style/index.css +2 -0
  77. package/es/message/style/index.css +2 -0
  78. package/es/modal/modal.d.ts +7 -1
  79. package/es/modal/modal.js +29 -5
  80. package/es/modal/style/index.css +2 -0
  81. package/es/notification/style/index.css +2 -0
  82. package/es/pagination/style/index.css +116 -29
  83. package/es/pagination/style/index.less +38 -29
  84. package/es/popconfirm/style/index.css +2 -0
  85. package/es/progress/style/index.css +2 -0
  86. package/es/radio/style/index.css +2 -0
  87. package/es/rate/style/index.css +2 -0
  88. package/es/search/style/index.css +2 -0
  89. package/es/select/style/index.css +2 -0
  90. package/es/slider/style/index.css +2 -0
  91. package/es/space/style/index.css +2 -0
  92. package/es/spin/style/index.css +2 -0
  93. package/es/split-panel/style/index.css +2 -0
  94. package/es/stepper/style/index.css +2 -0
  95. package/es/steps/style/index.css +2 -0
  96. package/es/style/index.css +2 -0
  97. package/es/style/themes/default.less +10 -6
  98. package/es/switch/style/index.css +2 -0
  99. package/es/table/style/index.css +2 -0
  100. package/es/tabs/style/index.css +2 -0
  101. package/es/tag/style/index.css +2 -0
  102. package/es/timeline/style/index.css +2 -0
  103. package/es/tooltip/style/index.css +2 -0
  104. package/es/transfer/style/index.css +2 -0
  105. package/es/tree/style/index.css +2 -0
  106. package/es/tree-select/style/index.css +2 -0
  107. package/es/typography/style/index.css +2 -0
  108. package/es/upload/style/index.css +2 -0
  109. package/lib/alert/style/index.css +2 -0
  110. package/lib/anchor/style/index.css +2 -0
  111. package/lib/avatar/style/index.css +2 -0
  112. package/lib/badge/style/index.css +2 -0
  113. package/lib/base-data/style/index.css +2 -0
  114. package/lib/button/style/index.css +2 -0
  115. package/lib/card/style/index.css +2 -0
  116. package/lib/carousel/style/index.css +2 -0
  117. package/lib/cascader/style/index.css +2 -0
  118. package/lib/checkbox/style/index.css +2 -0
  119. package/lib/city-picker/style/index.css +2 -0
  120. package/lib/collapse/style/index.css +2 -0
  121. package/lib/color-picker/color-picker-panel.d.ts +4 -0
  122. package/lib/color-picker/color-picker-panel.js +253 -0
  123. package/lib/color-picker/color-picker.d.ts +4 -0
  124. package/lib/color-picker/color-picker.js +214 -0
  125. package/lib/color-picker/constant/colorTypes.d.ts +4 -0
  126. package/lib/color-picker/constant/colorTypes.js +20 -0
  127. package/lib/color-picker/constant/defaultColor.d.ts +1 -0
  128. package/lib/color-picker/constant/defaultColor.js +8 -0
  129. package/lib/color-picker/constant/systemPresetColor.d.ts +1 -0
  130. package/lib/color-picker/constant/systemPresetColor.js +8 -0
  131. package/lib/color-picker/index.d.ts +3 -0
  132. package/lib/color-picker/index.js +27 -0
  133. package/lib/color-picker/interface.d.ts +64 -0
  134. package/lib/color-picker/interface.js +11 -0
  135. package/lib/color-picker/style/css.js +4 -0
  136. package/lib/color-picker/style/index.css +323 -0
  137. package/lib/color-picker/style/index.d.ts +2 -0
  138. package/lib/color-picker/style/index.js +4 -0
  139. package/lib/color-picker/style/index.less +257 -0
  140. package/lib/color-picker/style/mixin.less +5 -0
  141. package/lib/color-picker/style/token.less +22 -0
  142. package/lib/color-picker/utils/colorFormat.d.ts +18 -0
  143. package/lib/color-picker/utils/colorFormat.js +166 -0
  144. package/lib/color-picker/utils/convertLetters.d.ts +1 -0
  145. package/lib/color-picker/utils/convertLetters.js +18 -0
  146. package/lib/color-picker/utils/hooks/useOnClickOutside.d.ts +2 -0
  147. package/lib/color-picker/utils/hooks/useOnClickOutside.js +23 -0
  148. package/lib/color-picker/utils/validateColor.d.ts +1 -0
  149. package/lib/color-picker/utils/validateColor.js +30 -0
  150. package/lib/config-provider/compDefaultProps.d.ts +12 -0
  151. package/lib/config-provider/compDefaultProps.js +12 -0
  152. package/lib/date-picker/style/index.css +2 -0
  153. package/lib/drawer/style/index.css +2 -0
  154. package/lib/dropdown/dropdown.js +2 -7
  155. package/lib/dropdown/menu.js +3 -0
  156. package/lib/dropdown/style/index.css +2 -0
  157. package/lib/empty/style/index.css +2 -0
  158. package/lib/filter/style/index.css +2 -0
  159. package/lib/form/style/index.css +2 -0
  160. package/lib/grid/style/index.css +2 -0
  161. package/lib/icon/style/index.css +2 -0
  162. package/lib/image/style/index.css +2 -0
  163. package/lib/image-cropper/style/index.css +2 -0
  164. package/lib/index.d.ts +1 -0
  165. package/lib/index.js +7 -0
  166. package/lib/input/style/index.css +2 -0
  167. package/lib/input-number/style/index.css +2 -0
  168. package/lib/layout/style/index.css +2 -0
  169. package/lib/link/style/index.css +2 -0
  170. package/lib/locale/locale.d.ts +4 -0
  171. package/lib/locale/locale.js +6 -4
  172. package/lib/locale/zh-CN.d.ts +1 -0
  173. package/lib/locale/zh-CN.js +1 -0
  174. package/lib/menu/style/index.css +2 -0
  175. package/lib/message/style/index.css +2 -0
  176. package/lib/modal/modal.d.ts +7 -1
  177. package/lib/modal/modal.js +31 -7
  178. package/lib/modal/style/index.css +2 -0
  179. package/lib/notification/style/index.css +2 -0
  180. package/lib/pagination/style/index.css +116 -29
  181. package/lib/pagination/style/index.less +38 -29
  182. package/lib/popconfirm/style/index.css +2 -0
  183. package/lib/progress/style/index.css +2 -0
  184. package/lib/radio/style/index.css +2 -0
  185. package/lib/rate/style/index.css +2 -0
  186. package/lib/search/style/index.css +2 -0
  187. package/lib/select/style/index.css +2 -0
  188. package/lib/slider/style/index.css +2 -0
  189. package/lib/space/style/index.css +2 -0
  190. package/lib/spin/style/index.css +2 -0
  191. package/lib/split-panel/style/index.css +2 -0
  192. package/lib/stepper/style/index.css +2 -0
  193. package/lib/steps/style/index.css +2 -0
  194. package/lib/style/components.less +1 -0
  195. package/lib/style/index.css +2 -0
  196. package/lib/style/themes/default.less +10 -6
  197. package/lib/switch/style/index.css +2 -0
  198. package/lib/table/style/index.css +2 -0
  199. package/lib/tabs/style/index.css +2 -0
  200. package/lib/tag/style/index.css +2 -0
  201. package/lib/timeline/style/index.css +2 -0
  202. package/lib/tooltip/style/index.css +2 -0
  203. package/lib/transfer/style/index.css +2 -0
  204. package/lib/tree/style/index.css +2 -0
  205. package/lib/tree-select/style/index.css +2 -0
  206. package/lib/typography/style/index.css +2 -0
  207. package/lib/upload/style/index.css +2 -0
  208. package/package.json +5 -1
@@ -0,0 +1,18 @@
1
+ declare type IOutType = 'HEX' | 'HSB' | 'HSL' | 'RGB' | 'all';
2
+ export declare const colorFormat: (colorStr: string, alpha?: number, outType?: IOutType, formatHex?: boolean) => any;
3
+ export declare const getColorObj: (colorStr: string) => string | {
4
+ h: string;
5
+ s: number;
6
+ v: number;
7
+ alpha?: undefined;
8
+ } | {
9
+ h: number;
10
+ s: number;
11
+ v: number;
12
+ alpha: number;
13
+ };
14
+ export declare const strFixed: (numStr: string | number, num?: number) => number;
15
+ export declare const valOfCorrespondingType: (currentColorType: string) => number | undefined;
16
+ export declare const highlightPresetColorIndex: (color: string, colorArr: string[]) => number;
17
+ export declare const presetColorToHEX: (colorArr: string[] | undefined) => string[];
18
+ export {};
@@ -0,0 +1,153 @@
1
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
2
+ import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
3
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
4
+ import Color from 'color';
5
+ import { validateColor } from './validateColor';
6
+ import { toLowerCase } from './convertLetters';
7
+ export var colorFormat = function colorFormat(colorStr) {
8
+ var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9
+ var outType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all';
10
+ var formatHex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
11
+ var ColorTools = Color(getColorObj(colorStr)).alpha(alpha);
12
+ var toHex = function toHex() {
13
+ if (/^#([0-9a-fA-F]{8})$/.test(colorStr)) {
14
+ if (formatHex) {
15
+ return toLowerCase(alpha === 1 ? ColorTools.hex() : ColorTools.hexa());
16
+ } else {
17
+ return colorStr;
18
+ }
19
+ } else {
20
+ return toLowerCase(alpha === 1 ? ColorTools.hex() : ColorTools.hexa());
21
+ }
22
+ };
23
+ var HEX = toHex();
24
+ var HSB = colorToStr(ColorTools.hsv());
25
+ var RGB = ColorTools.rgb().string();
26
+ var HSL = colorToStr(ColorTools.hsl());
27
+ if (outType === 'HEX') return HEX;
28
+ if (outType === 'HSB') return HSB;
29
+ if (outType === 'HSL') return HSL;
30
+ if (outType === 'RGB') return RGB;
31
+ if (outType === 'all') {
32
+ return [{
33
+ type: 'HEX',
34
+ value: HEX
35
+ }, {
36
+ type: 'HSB',
37
+ value: HSB
38
+ }, {
39
+ type: 'RGB',
40
+ value: RGB
41
+ }, {
42
+ type: 'HSL',
43
+ value: HSL
44
+ }];
45
+ }
46
+ };
47
+ export var getColorObj = function getColorObj(colorStr) {
48
+ var colorArray = colorStr.split(',');
49
+ var type = validateColor(colorStr);
50
+ if (type === 'HSB' || type === 'HSBA') {
51
+ var s = removePercentage(colorArray[1]);
52
+ if (type === 'HSB') {
53
+ var h = colorArray[0].replace('hsb(', '');
54
+ var b = colorArray[2].replace(')', '');
55
+ return {
56
+ h: h,
57
+ s: s,
58
+ v: removePercentage(b)
59
+ };
60
+ } else {
61
+ var _h = colorArray[0].replace('hsba(', '');
62
+ var _b = colorArray[2];
63
+ var a = colorArray[3].replace(')', '');
64
+ return {
65
+ h: +_h,
66
+ s: s,
67
+ v: removePercentage(_b),
68
+ alpha: +a
69
+ };
70
+ }
71
+ } else if (type === 'HSL' || type === 'HSLA') {
72
+ var _s = addPercentage(colorArray[1]);
73
+ if (type === 'HSL') {
74
+ var _context, _context2;
75
+ var _h2 = colorArray[0].replace('hsl(', '');
76
+ var l = colorArray[2].replace(')', '');
77
+ return _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "hsl(".concat(_h2, ",")).call(_context2, _s, ",")).call(_context, addPercentage(l), ")");
78
+ } else {
79
+ var _context3, _context4, _context5;
80
+ var _h3 = colorArray[0].replace('hsla(', '');
81
+ var _l = colorArray[2];
82
+ var _a = colorArray[3].replace(')', '');
83
+ return _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = "hsla(".concat(_h3, ",")).call(_context5, _s, ",")).call(_context4, addPercentage(_l), ",")).call(_context3, _a, ")");
84
+ }
85
+ } else if (type === 'RGB' || type === 'RGBA') {
86
+ var g = colorArray[1];
87
+ if (type === 'RGB') {
88
+ var _context6, _context7;
89
+ var r = colorArray[0].replace('rgb(', '');
90
+ var _b2 = colorArray[2].replace(')', '');
91
+ return _concatInstanceProperty(_context6 = _concatInstanceProperty(_context7 = "rgb(".concat(strFixed(r), ",")).call(_context7, strFixed(g), ",")).call(_context6, strFixed(_b2), ")");
92
+ } else {
93
+ var _context8, _context9, _context10;
94
+ var _r = colorArray[0].replace('rgba(', '');
95
+ var _b3 = colorArray[2];
96
+ var _a2 = colorArray[3].replace(')', '');
97
+ return _concatInstanceProperty(_context8 = _concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "rgba(".concat(strFixed(_r), ",")).call(_context10, strFixed(g), ",")).call(_context9, strFixed(_b3), ",")).call(_context8, strFixed(_a2, 2), ")");
98
+ }
99
+ } else {
100
+ return colorStr;
101
+ }
102
+ };
103
+ var addPercentage = function addPercentage(parameter) {
104
+ return (parameter === null || parameter === void 0 ? void 0 : parameter.indexOf('%')) !== -1 ? parameter : +parameter > 0 && +parameter <= 1 ? +parameter * 100 + '%' : parameter + '%';
105
+ };
106
+ var removePercentage = function removePercentage(parameter) {
107
+ return (parameter === null || parameter === void 0 ? void 0 : parameter.indexOf('%')) !== -1 ? +parameter.replace('%', '') : +parameter > 0 && +parameter <= 1 ? +parameter * 100 : +parameter;
108
+ };
109
+ var colorToStr = function colorToStr(obj) {
110
+ var arr = obj.color;
111
+ if (obj.valpha === 1) {
112
+ var _context11, _context12, _context13;
113
+ return _concatInstanceProperty(_context11 = _concatInstanceProperty(_context12 = _concatInstanceProperty(_context13 = "".concat(obj.model === 'hsv' ? 'hsb' : 'hsl', "(")).call(_context13, strFixed(arr[0]), ", ")).call(_context12, strFixed(arr[1]), "%, ")).call(_context11, strFixed(arr[2]), "%)");
114
+ } else {
115
+ var _context14, _context15, _context16, _context17;
116
+ return _concatInstanceProperty(_context14 = _concatInstanceProperty(_context15 = _concatInstanceProperty(_context16 = _concatInstanceProperty(_context17 = "".concat(obj.model === 'hsv' ? 'hsba' : 'hsla', "(")).call(_context17, strFixed(arr[0]), ", ")).call(_context16, strFixed(arr[1]), "%, ")).call(_context15, strFixed(arr[2]), "%, ")).call(_context14, strFixed(obj.valpha, 2), ")");
117
+ }
118
+ };
119
+ export var strFixed = function strFixed(numStr) {
120
+ var num = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
121
+ return +(+numStr).toFixed(num);
122
+ };
123
+ export var valOfCorrespondingType = function valOfCorrespondingType(currentColorType) {
124
+ var index;
125
+ switch (currentColorType) {
126
+ case 'HEX':
127
+ index = 0;
128
+ break;
129
+ case 'HSB':
130
+ index = 1;
131
+ break;
132
+ case 'RGB':
133
+ index = 2;
134
+ break;
135
+ case 'HSL':
136
+ index = 3;
137
+ break;
138
+ }
139
+ return index;
140
+ };
141
+ export var highlightPresetColorIndex = function highlightPresetColorIndex(color, colorArr) {
142
+ var index = _findIndexInstanceProperty(colorArr).call(colorArr, function (val) {
143
+ return val === color;
144
+ });
145
+ return index;
146
+ };
147
+ export var presetColorToHEX = function presetColorToHEX(colorArr) {
148
+ if (!colorArr) return [];
149
+ var hexColorArr = _mapInstanceProperty(colorArr).call(colorArr, function (color) {
150
+ return colorFormat(color, 1, 'HEX');
151
+ });
152
+ return hexColorArr;
153
+ };
@@ -0,0 +1 @@
1
+ export declare function toLowerCase(str: string): string;
@@ -0,0 +1,12 @@
1
+ export function toLowerCase(str) {
2
+ var result = '';
3
+ for (var i = 0; i < str.length; i++) {
4
+ var charCode = str.charCodeAt(i);
5
+ if (charCode >= 65 && charCode <= 90) {
6
+ result += String.fromCharCode(charCode + 32);
7
+ } else {
8
+ result += str[i];
9
+ }
10
+ }
11
+ return result;
12
+ }
@@ -0,0 +1,2 @@
1
+ declare const useOnClickOutside: (refArr: Array<any>, handler: (e: Event) => void) => void;
2
+ export default useOnClickOutside;
@@ -0,0 +1,16 @@
1
+ import { useEffect } from 'react';
2
+ var useOnClickOutside = function useOnClickOutside(refArr, handler) {
3
+ useEffect(function () {
4
+ var mouseDownListener = function mouseDownListener(event) {
5
+ if (refArr.some(function (ref) {
6
+ return !ref.current || ref.current.contains(event.target);
7
+ })) {
8
+ return;
9
+ }
10
+ handler(event);
11
+ };
12
+ document.addEventListener('mousedown', mouseDownListener);
13
+ document.addEventListener('touchstart', mouseDownListener);
14
+ }, [refArr, handler]);
15
+ };
16
+ export default useOnClickOutside;
@@ -0,0 +1 @@
1
+ export declare function validateColor(color: string): string;
@@ -0,0 +1,24 @@
1
+ // 输入框颜色类型校验
2
+ export function validateColor(color) {
3
+ var hexReg = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
4
+ var hexaReg = /^#([0-9a-fA-F]{8})$/;
5
+ var hsbReg = /^hsb\(\s*(-?\d+|-?\d*\.\d+)(?:,\s*(-?\d+|-?\d*\.\d+|-?\d+%|-?\d*\.\d+%)){2}\s*\)$/;
6
+ var hsbaReg = /^hsba\(\s*(-?\d+|-?\d*\.\d+)(?:,\s*(-?\d+|-?\d*\.\d+|-?\d+%|-?\d*\.\d+%)){2}\s*,\s*(-?\d+|-?\d*\.\d+)\)$/;
7
+ // const rgbaReg = /^rgba\(\s*(-?\d+|-?\d*\.\d+)(?:,\s*(-?\d+|-?\d*\.\d+)){2},\s*(-?\d+|-?\d*\.\d+)|(^\d+%)\s*\)$/
8
+ var rgbaReg = /^rgba\(\s*(-?\d+|-?\d*\.\d+)(?:,\s*(-?\d+|-?\d*\.\d+)){2},\s*(-?\d+|-?\d*\.\d+)\)$/;
9
+ var rgbReg = /^rgb\(\s*(-?\d+|-?\d*\.\d+)(?:,\s*(-?\d+|-?\d*\.\d+)){2}\)$/;
10
+ var hslReg = /^hsl\(\s*(-?\d+|-?\d*\.\d+)(?:,\s*(-?\d+|-?\d*\.\d+|-?\d+%|-?\d*\.\d+%)){2}\s*\)$/;
11
+ var hslaReg = /^hsla\(\s*(-?\d+|-?\d*\.\d+)(?:,\s*(-?\d+|-?\d*\.\d+|-?\d+%|-?\d*\.\d+%)){2}\s*,\s*(-?\d+|-?\d*\.\d+)\)$/;
12
+ // const hslaReg = /^hsla\(\s*(-?\d+|-?\d*\.\d+)(?:,\s*(-?\d+|-?\d*\.\d+)){2}\s*,\s*(-?\d+|-?\d*\.\d+)|(^\d+%)\s*\)$/
13
+ var colorNameReg = /^(?:aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen)$/;
14
+ if (hexReg.test(color)) return 'HEX';
15
+ if (hexaReg.test(color)) return 'HEXA';
16
+ if (hsbReg.test(color)) return 'HSB';
17
+ if (hsbaReg.test(color)) return 'HSBA';
18
+ if (rgbaReg.test(color)) return 'RGBA';
19
+ if (rgbReg.test(color)) return 'RGB';
20
+ if (hslReg.test(color)) return 'HSL';
21
+ if (hslaReg.test(color)) return 'HSLA';
22
+ if (colorNameReg.test(color)) return 'colorName';
23
+ return '';
24
+ }
@@ -60,6 +60,18 @@ declare const compDefaultProps: {
60
60
  CollapsePanel: {
61
61
  disabled: boolean;
62
62
  };
63
+ ColorPicker: {
64
+ borderType: string;
65
+ defaultOpen: boolean;
66
+ functionalColorName: string;
67
+ switchName: {
68
+ name: string;
69
+ internationalName: string;
70
+ };
71
+ placeholder: string;
72
+ showColorTransfer: boolean;
73
+ showPresetColor: boolean;
74
+ };
63
75
  Checkbox: {
64
76
  defaultChecked: boolean;
65
77
  checkboxType: string;
@@ -65,6 +65,18 @@ var compDefaultProps = {
65
65
  CollapsePanel: {
66
66
  disabled: false
67
67
  },
68
+ ColorPicker: {
69
+ borderType: 'bordered',
70
+ defaultOpen: false,
71
+ functionalColorName: '#themeColor',
72
+ switchName: {
73
+ name: '跟随主题色',
74
+ internationalName: 'followFunctionalColor'
75
+ },
76
+ placeholder: '#',
77
+ showColorTransfer: true,
78
+ showPresetColor: true
79
+ },
68
80
  Checkbox: {
69
81
  defaultChecked: false,
70
82
  checkboxType: 'default',
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -16,7 +16,7 @@ var findItem = function findItem(element) {
16
16
  }
17
17
  };
18
18
  var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
19
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
19
+ var _a, _b, _c;
20
20
  var _React$useContext = React.useContext(ConfigContext),
21
21
  getPrefixCls = _React$useContext.getPrefixCls,
22
22
  pkgPrefixCls = _React$useContext.prefixCls,
@@ -74,12 +74,7 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
74
74
  onClick: handleItemClick,
75
75
  selectable: menuSelectable
76
76
  });
77
- var isItem = React.Children.count((_d = menu.props) === null || _d === void 0 ? void 0 : _d.children) === 1 && ((_g = (_f = (_e = menu.props) === null || _e === void 0 ? void 0 : _e.children) === null || _f === void 0 ? void 0 : _f.type) === null || _g === void 0 ? void 0 : _g.displayName) === 'DropdownMenuItem' || Array.isArray((_k = (_j = (_h = menu.props) === null || _h === void 0 ? void 0 : _h.children) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.children) || ((_p = (_o = (_m = (_l = menu.props) === null || _l === void 0 ? void 0 : _l.children) === null || _m === void 0 ? void 0 : _m.props) === null || _o === void 0 ? void 0 : _o.children.type) === null || _p === void 0 ? void 0 : _p.displayName) === 'DropdownMenuItem';
78
- var menuElement = isMenu ? Array.isArray((_q = menu.props) === null || _q === void 0 ? void 0 : _q.children) || isItem ? cloneObj : /*#__PURE__*/React.createElement("ul", {
79
- className: "".concat(prefixCls, "-menu"),
80
- onClick: handleItemClick,
81
- role: "menu"
82
- }, menu.props.children) : /*#__PURE__*/React.createElement("ul", {
77
+ var menuElement = isMenu ? cloneObj : /*#__PURE__*/React.createElement("ul", {
83
78
  className: "".concat(prefixCls, "-menu"),
84
79
  onClick: handleItemClick,
85
80
  role: "menu"
@@ -30,6 +30,9 @@ var Menu = /*#__PURE__*/React.forwardRef(function (props, ref) {
30
30
  // className前缀
31
31
  var prefixCls = getPrefixCls(pkgPrefixCls, 'dropdown-menu', customPrefixcls);
32
32
  var cloneItem = function cloneItem(item, index) {
33
+ if (! /*#__PURE__*/React.isValidElement(item)) {
34
+ return item;
35
+ }
33
36
  var key = item.key || index;
34
37
  var selected = selectable && String(selectedKey) === String(key);
35
38
  return /*#__PURE__*/React.cloneElement(item, {
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
package/es/index.d.ts CHANGED
@@ -54,3 +54,4 @@ export { default as Stepper } from './stepper';
54
54
  export { default as BaseData } from './base-data';
55
55
  export { default as Link } from './link';
56
56
  export { default as TreeSelect } from './tree-select';
57
+ export { default as ColorPicker } from './color-picker';
package/es/index.js CHANGED
@@ -53,4 +53,5 @@ export { default as Table } from './table';
53
53
  export { default as Stepper } from './stepper';
54
54
  export { default as BaseData } from './base-data';
55
55
  export { default as Link } from './link';
56
- export { default as TreeSelect } from './tree-select';
56
+ export { default as TreeSelect } from './tree-select';
57
+ export { default as ColorPicker } from './color-picker';
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -59,11 +59,15 @@ declare class LocaleCache {
59
59
  'QuickSearch.desc': string[];
60
60
  'QuickSearch.nplDesc': string;
61
61
  'QuickSearch.emptyTip': string;
62
+ /**
63
+ * 获取当前语言包数据
64
+ */
62
65
  'QuickSearch.or': string;
63
66
  'CityPicker.domestic': string;
64
67
  'CityPicker.internation': string;
65
68
  'CityPicker.common': string;
66
69
  'CityPicker.noData': string;
70
+ 'ColorPicker.followFunctionalColor': string;
67
71
  'Search.placeholder': string;
68
72
  'Search.desc': string[];
69
73
  'Search.nplDesc': string;
@@ -1,5 +1,6 @@
1
1
  import _typeof from "@babel/runtime-corejs3/helpers/typeof";
2
2
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
3
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
3
4
  import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
4
5
  import _createClass from "@babel/runtime-corejs3/helpers/createClass";
5
6
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -26,13 +27,14 @@ var LocaleCache = /*#__PURE__*/function () {
26
27
  _createClass(LocaleCache, [{
27
28
  key: "setLocalesData",
28
29
  value: function setLocalesData(locale, localeData) {
29
- var newLocaleData = localeData || this.localesData[locale];
30
- if (!newLocaleData) {
30
+ if (!(localeData || this.localesData[locale])) {
31
31
  console.error("\u7F3A\u5C11\u8BED\u8A00".concat(locale, "\u5BF9\u5E94\u7684\u8BED\u8A00\u5305\uFF0C\u8BF7\u68C0\u67E5\u540E\u91CD\u65B0\u8BBE\u7F6E"));
32
32
  return;
33
33
  }
34
- this.locale = locale;
35
- this.localesData[locale] = newLocaleData;
34
+ var newLocaleData = _extends(_extends({}, zhCNData), localeData);
35
+ var newLocale = locale || (newLocaleData === null || newLocaleData === void 0 ? void 0 : newLocaleData.locale);
36
+ this.locale = newLocale;
37
+ this.localesData[newLocale] = newLocaleData;
36
38
  return localeData;
37
39
  }
38
40
  /**
@@ -38,6 +38,7 @@ declare const locale: {
38
38
  'CityPicker.internation': string;
39
39
  'CityPicker.common': string;
40
40
  'CityPicker.noData': string;
41
+ 'ColorPicker.followFunctionalColor': string;
41
42
  'Search.placeholder': string;
42
43
  'Search.desc': string[];
43
44
  'Search.nplDesc': string;
@@ -42,6 +42,7 @@ var locale = _extends(_extends({
42
42
  'CityPicker.internation': '国际',
43
43
  'CityPicker.common': '常用',
44
44
  'CityPicker.noData': '暂无数据',
45
+ 'ColorPicker.followFunctionalColor': '跟随主题色',
45
46
  'Search.placeholder': '请输入需要搜索的内容',
46
47
  'Search.desc': ['空格代表"或",回车代表"且"'],
47
48
  'Search.nplDesc': '智能搜索',
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -56,6 +56,8 @@
56
56
  /* ----------- Transfer ——————---- end */
57
57
  /* ----------- DatePicker ——————---- start */
58
58
  /* ----------- DatePicker ——————---- end */
59
+ /* ----------- ColorPicker ——————---- start */
60
+ /* ----------- ColorPicker ——————---- end */
59
61
  /* ----------- Tree ——————---- start */
60
62
  /* ----------- Tree ——————---- end */
61
63
  /* ----------- Alert ——————---- start */
@@ -1,5 +1,6 @@
1
1
  import React, { ReactNode, CSSProperties } from 'react';
2
2
  import { IButtonProps } from '../button/button';
3
+ import type { DraggableBounds, DraggableEventHandler } from 'react-draggable';
3
4
  declare type CSSSelector = string;
4
5
  export declare const ConfirmModalTypes: string[];
5
6
  export declare const ModalTypes: ["confirm", "warning", "error", "normal"];
@@ -8,6 +9,7 @@ export interface IModalProps {
8
9
  body?: ReactNode;
9
10
  bodyClassName?: string;
10
11
  bodyStyle?: CSSProperties;
12
+ style?: CSSProperties;
11
13
  cancelButtonProps?: IButtonProps;
12
14
  cancelText?: ReactNode;
13
15
  className?: string;
@@ -40,6 +42,10 @@ export interface IModalProps {
40
42
  visible?: boolean;
41
43
  width?: number;
42
44
  showline?: boolean;
45
+ bounds?: DraggableBounds | string | false;
46
+ onDragStart?: DraggableEventHandler;
47
+ onDrag?: DraggableEventHandler;
48
+ onDragStop?: DraggableEventHandler;
43
49
  }
44
- declare const Modal: React.FC<IModalProps>;
50
+ declare const Modal: React.ForwardRefExoticComponent<IModalProps & React.RefAttributes<unknown>>;
45
51
  export default Modal;