vxe-pc-ui 4.16.21 → 4.16.22

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 (59) hide show
  1. package/dist/all.esm.js +316 -66
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/color-picker/index.js +14 -0
  5. package/es/color-picker/src/color-picker.js +40 -28
  6. package/es/color-picker/src/util.js +252 -36
  7. package/es/date-picker/src/date-picker.js +2 -1
  8. package/es/date-range-picker/src/date-range-picker.js +2 -1
  9. package/es/icon/style.css +1 -1
  10. package/es/select/src/select.js +2 -1
  11. package/es/style.css +1 -1
  12. package/es/style.min.css +1 -1
  13. package/es/ui/index.js +1 -1
  14. package/es/ui/src/log.js +1 -1
  15. package/lib/color-picker/index.js +14 -0
  16. package/lib/color-picker/index.min.js +1 -1
  17. package/lib/color-picker/src/color-picker.js +38 -27
  18. package/lib/color-picker/src/color-picker.min.js +1 -1
  19. package/lib/color-picker/src/util.js +272 -49
  20. package/lib/color-picker/src/util.min.js +1 -1
  21. package/lib/date-picker/src/date-picker.js +2 -1
  22. package/lib/date-picker/src/date-picker.min.js +1 -1
  23. package/lib/date-range-picker/src/date-range-picker.js +2 -1
  24. package/lib/date-range-picker/src/date-range-picker.min.js +1 -1
  25. package/lib/icon/style/style.css +1 -1
  26. package/lib/icon/style/style.min.css +1 -1
  27. package/lib/index.umd.js +324 -80
  28. package/lib/index.umd.min.js +1 -1
  29. package/lib/select/src/select.js +2 -1
  30. package/lib/select/src/select.min.js +1 -1
  31. package/lib/style.css +1 -1
  32. package/lib/style.min.css +1 -1
  33. package/lib/ui/index.js +1 -1
  34. package/lib/ui/index.min.js +1 -1
  35. package/lib/ui/src/log.js +1 -1
  36. package/lib/ui/src/log.min.js +1 -1
  37. package/package.json +1 -1
  38. package/packages/color-picker/index.ts +15 -0
  39. package/packages/color-picker/src/color-picker.ts +40 -29
  40. package/packages/color-picker/src/util.ts +267 -42
  41. package/packages/date-picker/src/date-picker.ts +3 -2
  42. package/packages/date-range-picker/src/date-range-picker.ts +3 -2
  43. package/packages/select/src/select.ts +3 -2
  44. package/types/components/color-picker.d.ts +93 -0
  45. package/types/components/grid.d.ts +6 -0
  46. package/types/components/table.d.ts +2 -2
  47. package/types/ui/index.d.ts +2 -0
  48. /package/es/icon/{iconfont.1784868322028.ttf → iconfont.1784893283450.ttf} +0 -0
  49. /package/es/icon/{iconfont.1784868322028.woff → iconfont.1784893283450.woff} +0 -0
  50. /package/es/icon/{iconfont.1784868322028.woff2 → iconfont.1784893283450.woff2} +0 -0
  51. /package/es/{iconfont.1784868322028.ttf → iconfont.1784893283450.ttf} +0 -0
  52. /package/es/{iconfont.1784868322028.woff → iconfont.1784893283450.woff} +0 -0
  53. /package/es/{iconfont.1784868322028.woff2 → iconfont.1784893283450.woff2} +0 -0
  54. /package/lib/icon/style/{iconfont.1784868322028.ttf → iconfont.1784893283450.ttf} +0 -0
  55. /package/lib/icon/style/{iconfont.1784868322028.woff → iconfont.1784893283450.woff} +0 -0
  56. /package/lib/icon/style/{iconfont.1784868322028.woff2 → iconfont.1784893283450.woff2} +0 -0
  57. /package/lib/{iconfont.1784868322028.ttf → iconfont.1784893283450.ttf} +0 -0
  58. /package/lib/{iconfont.1784868322028.woff → iconfont.1784893283450.woff} +0 -0
  59. /package/lib/{iconfont.1784868322028.woff2 → iconfont.1784893283450.woff2} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import VxeColorPickerComponent from './src/color-picker';
3
3
  import { dynamicApp } from '../dynamics';
4
+ import { parseColor, hasRgb, hasHex, toRgb, toHex, toHsl, toHsv, toRgbString, toHexString, lighten, darken } from './src/util';
4
5
  export const VxeColorPicker = Object.assign({}, VxeColorPickerComponent, {
5
6
  install(app) {
6
7
  app.component(VxeColorPickerComponent.name, VxeColorPickerComponent);
@@ -8,5 +9,18 @@ export const VxeColorPicker = Object.assign({}, VxeColorPickerComponent, {
8
9
  });
9
10
  dynamicApp.use(VxeColorPicker);
10
11
  VxeUI.component(VxeColorPickerComponent);
12
+ VxeUI.color = {
13
+ parseColor,
14
+ hasRgb,
15
+ hasHex,
16
+ toRgb,
17
+ toRgbString,
18
+ toHex,
19
+ toHexString,
20
+ toHsl,
21
+ toHsv,
22
+ lighten,
23
+ darken
24
+ };
11
25
  export const ColorPicker = VxeColorPicker;
12
26
  export default VxeColorPicker;
@@ -4,7 +4,7 @@ import XEUtils from 'xe-utils';
4
4
  import { VxeUI, getIcon, getConfig, getI18n, globalEvents, createEvent, useSize, renderEmptyElement } from '../../ui';
5
5
  import { getEventTargetNode, getPopupContainer, toCssUnit, updatePanelPlacement } from '../../ui/src/dom';
6
6
  import { getLastZIndex, nextZIndex } from '../../ui/src/utils';
7
- import { parseColor, updateColorAlpha, hexToHsv, rgbToHsv, rgbToHex, hexToRgb, hsvToRgb, toRgb } from './util';
7
+ import { parseValColor, updateColorAlpha, hexToHsv, rgbToHsv, rgbToHexVal, hexToRgb, hsvToRgb, toValRgb } from './util';
8
8
  import VxeButtonComponent from '../../button';
9
9
  import VxeInputComponent from '../../input';
10
10
  import VxeNumberInputComponent from '../../number-input';
@@ -77,6 +77,7 @@ export default defineVxeComponent({
77
77
  const $xeModal = inject('$xeModal', null);
78
78
  const $xeDrawer = inject('$xeDrawer', null);
79
79
  const $xeTable = inject('$xeTable', null);
80
+ const $xeCard = inject('$xeCard', null);
80
81
  const $xeForm = inject('$xeForm', null);
81
82
  const formItemInfo = inject('xeFormItemInfo', null);
82
83
  const WinEyeDropper = typeof window !== 'undefined' ? window.EyeDropper : null;
@@ -143,7 +144,7 @@ export default defineVxeComponent({
143
144
  if (XEUtils.isBoolean(globalTransfer)) {
144
145
  return globalTransfer;
145
146
  }
146
- if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
147
+ if ($xeTable || $xeModal || $xeDrawer || $xeCard || $xeForm) {
147
148
  return true;
148
149
  }
149
150
  }
@@ -212,32 +213,43 @@ export default defineVxeComponent({
212
213
  const isRgb = computeIsRgb.value;
213
214
  const hueSliderEl = refHueSliderElem.value;
214
215
  const alphaSliderEl = refAlphaSliderElem.value;
215
- const colorRest = parseColor(selectColor);
216
- reactData.hexValue = colorRest.hex;
217
- reactData.rValue = colorRest.r;
218
- reactData.gValue = colorRest.g;
219
- reactData.bValue = colorRest.b;
220
- reactData.aValue = colorRest.a;
221
- if (colorRest.value) {
222
- if (isRgb) {
223
- if (colorRest.type === 'hex') {
224
- const rgbRest = hexToRgb(colorRest.hex);
225
- if (rgbRest) {
226
- reactData.rValue = rgbRest.r;
227
- reactData.gValue = rgbRest.g;
228
- reactData.bValue = rgbRest.b;
229
- reactData.aValue = rgbRest.a;
230
- }
231
- }
216
+ const colorRest = parseValColor(selectColor);
217
+ reactData.hexValue = '';
218
+ reactData.rValue = 0;
219
+ reactData.gValue = 0;
220
+ reactData.bValue = 0;
221
+ reactData.aValue = 1;
222
+ if (colorRest) {
223
+ if (colorRest.type === 'hex') {
224
+ reactData.hexValue = colorRest.hex;
232
225
  }
233
226
  else {
234
- if (colorRest.type !== 'hex') {
235
- reactData.hexValue = rgbToHex(colorRest);
227
+ reactData.rValue = colorRest.r;
228
+ reactData.gValue = colorRest.g;
229
+ reactData.bValue = colorRest.b;
230
+ reactData.aValue = colorRest.a;
231
+ }
232
+ if (colorRest.value) {
233
+ if (isRgb) {
234
+ if (colorRest.type === 'hex') {
235
+ const rgbRest = hexToRgb(colorRest.hex);
236
+ if (rgbRest) {
237
+ reactData.rValue = rgbRest.r;
238
+ reactData.gValue = rgbRest.g;
239
+ reactData.bValue = rgbRest.b;
240
+ reactData.aValue = rgbRest.a;
241
+ }
242
+ }
243
+ }
244
+ else {
245
+ if (colorRest.type !== 'hex') {
246
+ reactData.hexValue = rgbToHexVal(colorRest.r, colorRest.g, colorRest.b, colorRest.a);
247
+ }
236
248
  }
237
249
  }
238
250
  }
239
251
  if (isAniVisible) {
240
- const hsvRest = colorRest.type === 'hex' ? hexToHsv(colorRest.hex) : rgbToHsv(colorRest);
252
+ const hsvRest = colorRest ? (colorRest.type === 'hex' ? hexToHsv(colorRest.hex) : rgbToHsv(colorRest)) : null;
241
253
  const colorPanelEl = refColorPanelElem.value;
242
254
  if (hsvRest) {
243
255
  if (colorPanelEl) {
@@ -250,7 +262,7 @@ export default defineVxeComponent({
250
262
  }
251
263
  }
252
264
  if (alphaSliderEl) {
253
- handleAlphaColor(alphaSliderEl.clientWidth * colorRest.a);
265
+ handleAlphaColor(alphaSliderEl.clientWidth * reactData.aValue);
254
266
  }
255
267
  }
256
268
  };
@@ -413,7 +425,7 @@ export default defineVxeComponent({
413
425
  gNum = itemNum - offsetNum;
414
426
  break;
415
427
  }
416
- reactData.panelColor = toRgb(rNum, gNum, bNum);
428
+ reactData.panelColor = toValRgb(rNum, gNum, bNum);
417
429
  hueSliderBtnEl.style.left = toCssUnit(offsetLeft);
418
430
  }
419
431
  };
@@ -483,7 +495,7 @@ export default defineVxeComponent({
483
495
  };
484
496
  const handleInputRgbEvent = () => {
485
497
  const { rValue, gValue, bValue, aValue } = reactData;
486
- reactData.selectColor = toRgb(rValue, gValue, bValue, aValue);
498
+ reactData.selectColor = toValRgb(rValue, gValue, bValue, aValue);
487
499
  updateModelColor();
488
500
  };
489
501
  const handleInputAlphaEvent = () => {
@@ -534,12 +546,12 @@ export default defineVxeComponent({
534
546
  const colorPanelRect = colorPanelEl.getBoundingClientRect();
535
547
  const offsetTop = Math.min(clientHeight, Math.max(0, clientY - colorPanelRect.y));
536
548
  const offsetLeft = Math.min(clientWidth, Math.max(0, clientX - colorPanelRect.x));
537
- const colorRest = parseColor(panelColor);
549
+ const colorRest = parseValColor(panelColor);
538
550
  if (colorRest) {
539
551
  const hsvRest = colorRest.type === 'hex' ? hexToHsv(colorRest.hex) : rgbToHsv(colorRest);
540
552
  if (hsvRest) {
541
553
  const ragRest = hsvToRgb(hsvRest.h, offsetLeft / clientWidth, (1 - offsetTop / clientHeight));
542
- reactData.selectColor = toRgb(ragRest.r, ragRest.g, ragRest.b, showAlpha ? aValue : null);
554
+ reactData.selectColor = toValRgb(ragRest.r, ragRest.g, ragRest.b, showAlpha ? aValue : null);
543
555
  updateModelColor();
544
556
  }
545
557
  }
@@ -875,7 +887,7 @@ export default defineVxeComponent({
875
887
  reactData.hexValue = val;
876
888
  },
877
889
  onChange() {
878
- const colorRest = parseColor(reactData.hexValue);
890
+ const colorRest = parseValColor(reactData.hexValue);
879
891
  if (colorRest) {
880
892
  if (colorRest.value) {
881
893
  reactData.selectColor = colorRest.value;
@@ -8,13 +8,142 @@ const hexAlphaNumMaps = {};
8
8
  });
9
9
  const rgbRE = /^rgb(a?)\((\d{1,3})[,\s]+(\d{1,3})[,\s]+(\d{1,3})([,//\s]+([0-9.]{1,4})(%?))?\)$/;
10
10
  export function hasRgb(value) {
11
- return value && rgbRE.test(value);
11
+ return !!(value && rgbRE.test(value));
12
12
  }
13
13
  const hexRE = /^(#?)([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/;
14
14
  export function hasHex(value) {
15
- return value && hexRE.test(value);
15
+ return !!(value && hexRE.test(value));
16
16
  }
17
- export function parseColor(value) {
17
+ export function toRgb(value) {
18
+ if (value) {
19
+ if (hexRE.test(value)) {
20
+ return hexToRgb(value);
21
+ }
22
+ return parseRgbVal(value);
23
+ }
24
+ return null;
25
+ }
26
+ export function toRgbString(value) {
27
+ const rgbRest = toRgb(value);
28
+ if (rgbRest) {
29
+ return rgbRest.label;
30
+ }
31
+ return '';
32
+ }
33
+ export function toHex(value) {
34
+ if (value) {
35
+ if (rgbRE.test(value)) {
36
+ return rgbValToHex(value);
37
+ }
38
+ return parseHexVal(value);
39
+ }
40
+ return null;
41
+ }
42
+ export function toHexString(value) {
43
+ const hexRest = toHex(value);
44
+ if (hexRest) {
45
+ return hexRest.label;
46
+ }
47
+ return '';
48
+ }
49
+ export function toHsl(value) {
50
+ const rgbRest = toRgb(value);
51
+ if (rgbRest) {
52
+ const hslRest = rgbToHsl(rgbRest);
53
+ if (hslRest) {
54
+ const rest = Object.assign({ value, type: 'hsl' }, hslRest);
55
+ return rest;
56
+ }
57
+ }
58
+ return null;
59
+ }
60
+ export function toHsv(value) {
61
+ const rgbRest = toRgb(value);
62
+ if (rgbRest) {
63
+ const hslRest = rgbToHsv(rgbRest);
64
+ if (hslRest) {
65
+ const rest = Object.assign({ value, type: 'hsv' }, hslRest);
66
+ return rest;
67
+ }
68
+ }
69
+ return null;
70
+ }
71
+ export function parseColor(val, format) {
72
+ if (val) {
73
+ if (format === 'hex') {
74
+ return toHex(val);
75
+ }
76
+ if (format === 'hsl') {
77
+ return toHsl(val);
78
+ }
79
+ if (format === 'hsv') {
80
+ return toHsv(val);
81
+ }
82
+ return toRgb(val);
83
+ }
84
+ return null;
85
+ }
86
+ function handleNumClamp(val) {
87
+ return Math.min(1, Math.max(0, val));
88
+ }
89
+ function createLightenDarken(isAdd) {
90
+ return function (val, ratio) {
91
+ const colorRest = parseColor(val);
92
+ const hslRest = toHsl(val);
93
+ if (colorRest && hslRest) {
94
+ ratio = ratio === 0 ? 0 : ratio || 10;
95
+ hslRest.l += (isAdd ? ratio : -ratio) / 100;
96
+ hslRest.l = handleNumClamp(hslRest.l);
97
+ const rgbRest = hslToRgb(hslRest);
98
+ if (rgbRest) {
99
+ if ((colorRest === null || colorRest === void 0 ? void 0 : colorRest.type) === 'hex') {
100
+ return rgbToHexVal(rgbRest.r, rgbRest.g, rgbRest.b, hslRest.a);
101
+ }
102
+ return toValRgb(rgbRest.r, rgbRest.g, rgbRest.b, hslRest.a);
103
+ }
104
+ }
105
+ return val;
106
+ };
107
+ }
108
+ export const lighten = createLightenDarken(1);
109
+ export const darken = createLightenDarken(0);
110
+ function parseHexVal(value) {
111
+ if (value) {
112
+ const hexRest = value.match(hexRE);
113
+ if (hexRest) {
114
+ const rest = {
115
+ value,
116
+ label: value,
117
+ type: 'hex',
118
+ hex: value,
119
+ hexV: hexRest[2],
120
+ hexA: hexRest[3] || '',
121
+ a: (hexRest[3] ? hexAlphaKeyMaps[hexRest[3].toUpperCase()] : 1) || 1
122
+ };
123
+ return rest;
124
+ }
125
+ }
126
+ return null;
127
+ }
128
+ function parseRgbVal(value) {
129
+ if (value) {
130
+ const rgbRest = value.match(rgbRE);
131
+ if (rgbRest) {
132
+ const rest = {
133
+ value,
134
+ label: value,
135
+ type: (rgbRest[6] ? 'rgba' : 'rgb'),
136
+ r: parseInt(rgbRest[2]),
137
+ g: parseInt(rgbRest[3]),
138
+ b: parseInt(rgbRest[4]),
139
+ a: rgbRest[7] ? parseInt(rgbRest[6]) / 100 : (rgbRest[6] ? parseFloat(rgbRest[6]) : 1)
140
+ };
141
+ return rest;
142
+ }
143
+ }
144
+ return null;
145
+ }
146
+ export function parseValColor(value) {
18
147
  const rest = {
19
148
  value: '',
20
149
  type: '',
@@ -27,49 +156,44 @@ export function parseColor(value) {
27
156
  a: 1
28
157
  };
29
158
  if (value) {
30
- const hexRest = value.match(hexRE);
31
- if (hexRest) {
32
- rest.value = value;
33
- rest.type = 'hex';
34
- rest.hex = value;
35
- rest.hexV = hexRest[2];
36
- rest.hexA = hexRest[3] || '';
37
- rest.a = (hexRest[3] ? hexAlphaKeyMaps[hexRest[3].toUpperCase()] : 1) || 1;
159
+ if (hexRE.test(value)) {
160
+ return Object.assign(rest, parseHexVal(value));
38
161
  }
39
- const rgbRest = value.match(rgbRE);
40
- if (rgbRest) {
41
- rest.value = value;
42
- rest.type = rgbRest[6] ? 'rgba' : 'rgb';
43
- rest.r = parseInt(rgbRest[2]);
44
- rest.g = parseInt(rgbRest[3]);
45
- rest.b = parseInt(rgbRest[4]);
46
- rest.a = rgbRest[7] ? parseInt(rgbRest[6]) / 100 : (rgbRest[6] ? parseFloat(rgbRest[6]) : 1);
162
+ else if (rgbRE.test(value)) {
163
+ return Object.assign(rest, parseRgbVal(value));
47
164
  }
48
165
  }
49
166
  return rest;
50
167
  }
51
168
  export function updateColorAlpha(value, alpha = 1) {
52
- const colorRest = parseColor(value);
53
- const { type, hexV, r, g, b } = colorRest;
54
- if (type === 'rgb' || type === 'rgba') {
55
- return toRgb(r, g, b, alpha);
56
- }
57
- if (type === 'hex') {
58
- return `#${hexV}${alpha === 1 ? '' : (hexAlphaNumMaps[alpha] || '')}`;
169
+ const colorRest = parseValColor(value);
170
+ if (colorRest) {
171
+ const { type } = colorRest;
172
+ if (type === 'hex') {
173
+ return `#${colorRest.hexV}${alpha === 1 ? '' : (hexAlphaNumMaps[alpha] || '')}`;
174
+ }
175
+ return toValRgb(colorRest.r, colorRest.g, colorRest.b, alpha);
59
176
  }
60
177
  return '';
61
178
  }
62
- export function toRgb(r, g, b, a) {
63
- if (XEUtils.eqNull(a)) {
179
+ export function toValRgb(r, g, b, a) {
180
+ if (XEUtils.eqNull(a) || a === 1) {
64
181
  return `rgb(${r},${g},${b})`;
65
182
  }
66
183
  return `rgba(${r},${g},${b},${a})`;
67
184
  }
68
- export function rgbToHex(rgbRest) {
69
- if (!rgbRest) {
70
- return '';
185
+ function rgbValToHex(value) {
186
+ const rgbRest = parseRgbVal(value);
187
+ if (rgbRest) {
188
+ const hexVal = rgbToHexVal(rgbRest.r, rgbRest.g, rgbRest.b, rgbRest.a);
189
+ if (hexVal) {
190
+ return parseHexVal(hexVal);
191
+ }
71
192
  }
72
- const { r, g, b, a = 1 } = rgbRest;
193
+ return null;
194
+ }
195
+ export function rgbToHexVal(r, g, b, a) {
196
+ a = XEUtils.isNumber(a) ? a : 1;
73
197
  const hexR = r.toString(16).padStart(2, '0');
74
198
  const hexG = g.toString(16).padStart(2, '0');
75
199
  const hexB = b.toString(16).padStart(2, '0');
@@ -120,6 +244,91 @@ export function rgbToHsv(rgbRest) {
120
244
  v: XEUtils.round(val, 2)
121
245
  };
122
246
  }
247
+ function rgbToHsl(rgbRest) {
248
+ if (!rgbRest) {
249
+ return null;
250
+ }
251
+ const { r, g, b, a } = rgbRest;
252
+ const rNorm = r / 255;
253
+ const gNorm = g / 255;
254
+ const bNorm = b / 255;
255
+ const max = Math.max(rNorm, gNorm, bNorm);
256
+ const min = Math.min(rNorm, gNorm, bNorm);
257
+ const delta = max - min;
258
+ let h = 0;
259
+ let s = 0;
260
+ const l = (max + min) / 2;
261
+ if (delta !== 0) {
262
+ s = l > 0.5 ? delta / (2 - max - min) : delta / (max + min);
263
+ if (max === rNorm) {
264
+ h = ((gNorm - bNorm) / delta) % 6;
265
+ }
266
+ else if (max === gNorm) {
267
+ h = (bNorm - rNorm) / delta + 2;
268
+ }
269
+ else {
270
+ h = (rNorm - gNorm) / delta + 4;
271
+ }
272
+ h *= 60;
273
+ if (h < 0) {
274
+ h += 360;
275
+ }
276
+ }
277
+ return {
278
+ h,
279
+ s,
280
+ l,
281
+ a: XEUtils.isNumber(a) ? a : 1
282
+ };
283
+ }
284
+ function hslToRgb(slRest) {
285
+ if (!slRest) {
286
+ return null;
287
+ }
288
+ let { h, s, l } = slRest;
289
+ const sNorm = s;
290
+ const lNorm = l;
291
+ h = ((h % 360) + 360) % 360;
292
+ const c = (1 - Math.abs(2 * lNorm - 1)) * sNorm;
293
+ const x = c * (1 - Math.abs((h / 60) % 2 - 1));
294
+ const m = lNorm - c / 2;
295
+ let r, g, b;
296
+ if (h >= 0 && h < 60) {
297
+ r = c;
298
+ g = x;
299
+ b = 0;
300
+ }
301
+ else if (h >= 60 && h < 120) {
302
+ r = x;
303
+ g = c;
304
+ b = 0;
305
+ }
306
+ else if (h >= 120 && h < 180) {
307
+ r = 0;
308
+ g = c;
309
+ b = x;
310
+ }
311
+ else if (h >= 180 && h < 240) {
312
+ r = 0;
313
+ g = x;
314
+ b = c;
315
+ }
316
+ else if (h >= 240 && h < 300) {
317
+ r = x;
318
+ g = 0;
319
+ b = c;
320
+ }
321
+ else {
322
+ r = c;
323
+ g = 0;
324
+ b = x;
325
+ }
326
+ return {
327
+ r: Math.round((r + m) * 255),
328
+ g: Math.round((g + m) * 255),
329
+ b: Math.round((b + m) * 255)
330
+ };
331
+ }
123
332
  export function hsvToRgb(h, s, v) {
124
333
  let r = 0;
125
334
  let g = 0;
@@ -178,11 +387,18 @@ export function hexToRgb(str) {
178
387
  if (str) {
179
388
  const rests = str.match(/^(#?)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})?$/);
180
389
  if (rests) {
390
+ const r = parseInt(rests[2], 16);
391
+ const g = parseInt(rests[3], 16);
392
+ const b = parseInt(rests[4], 16);
393
+ const a = (rests[5] ? hexAlphaKeyMaps[rests[5].toUpperCase()] : 1) || 1;
181
394
  return {
182
- r: parseInt(rests[2], 16),
183
- g: parseInt(rests[3], 16),
184
- b: parseInt(rests[4], 16),
185
- a: (rests[5] ? hexAlphaKeyMaps[rests[5].toUpperCase()] : 1) || 1
395
+ value: str,
396
+ label: toValRgb(r, g, b, rests[5] ? a : null),
397
+ type: (rests[5] ? 'rgba' : 'rgb'),
398
+ r,
399
+ g,
400
+ b,
401
+ a
186
402
  };
187
403
  }
188
404
  }
@@ -167,6 +167,7 @@ export default defineVxeComponent({
167
167
  const $xeModal = inject('$xeModal', null);
168
168
  const $xeDrawer = inject('$xeDrawer', null);
169
169
  const $xeTable = inject('$xeTable', null);
170
+ const $xeCard = inject('$xeCard', null);
170
171
  const $xeForm = inject('$xeForm', null);
171
172
  const formItemInfo = inject('xeFormItemInfo', null);
172
173
  const xID = XEUtils.uniqueId();
@@ -201,7 +202,7 @@ export default defineVxeComponent({
201
202
  if (XEUtils.isBoolean(globalTransfer)) {
202
203
  return globalTransfer;
203
204
  }
204
- if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
205
+ if ($xeTable || $xeModal || $xeDrawer || $xeCard || $xeForm) {
205
206
  return true;
206
207
  }
207
208
  }
@@ -164,6 +164,7 @@ export default defineVxeComponent({
164
164
  const $xeModal = inject('$xeModal', null);
165
165
  const $xeDrawer = inject('$xeDrawer', null);
166
166
  const $xeTable = inject('$xeTable', null);
167
+ const $xeCard = inject('$xeCard', null);
167
168
  const $xeForm = inject('$xeForm', null);
168
169
  const formItemInfo = inject('xeFormItemInfo', null);
169
170
  const xID = XEUtils.uniqueId();
@@ -200,7 +201,7 @@ export default defineVxeComponent({
200
201
  if (XEUtils.isBoolean(globalTransfer)) {
201
202
  return globalTransfer;
202
203
  }
203
- if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
204
+ if ($xeTable || $xeModal || $xeDrawer || $xeCard || $xeForm) {
204
205
  return true;
205
206
  }
206
207
  }