vxe-pc-ui 4.16.21 → 4.16.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/all.esm.js +316 -66
- package/dist/style.css +1 -1
- package/dist/style.min.css +1 -1
- package/es/color-picker/index.js +14 -0
- package/es/color-picker/src/color-picker.js +40 -28
- package/es/color-picker/src/util.js +252 -36
- package/es/date-picker/src/date-picker.js +2 -1
- package/es/date-range-picker/src/date-range-picker.js +2 -1
- package/es/form/style.css +2 -2
- package/es/form/style.min.css +1 -1
- package/es/icon/style.css +1 -1
- package/es/select/src/select.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-form/style.css +2 -2
- package/es/vxe-form/style.min.css +1 -1
- package/lib/color-picker/index.js +14 -0
- package/lib/color-picker/index.min.js +1 -1
- package/lib/color-picker/src/color-picker.js +38 -27
- package/lib/color-picker/src/color-picker.min.js +1 -1
- package/lib/color-picker/src/util.js +272 -49
- package/lib/color-picker/src/util.min.js +1 -1
- package/lib/date-picker/src/date-picker.js +2 -1
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/date-range-picker/src/date-range-picker.js +2 -1
- package/lib/date-range-picker/src/date-range-picker.min.js +1 -1
- package/lib/form/style/style.css +2 -2
- package/lib/form/style/style.min.css +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +324 -80
- package/lib/index.umd.min.js +1 -1
- package/lib/select/src/select.js +2 -1
- package/lib/select/src/select.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-form/style/style.css +2 -2
- package/lib/vxe-form/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/color-picker/index.ts +15 -0
- package/packages/color-picker/src/color-picker.ts +40 -29
- package/packages/color-picker/src/util.ts +267 -42
- package/packages/date-picker/src/date-picker.ts +3 -2
- package/packages/date-range-picker/src/date-range-picker.ts +3 -2
- package/packages/select/src/select.ts +3 -2
- package/styles/components/form.scss +2 -2
- package/types/components/color-picker.d.ts +93 -0
- package/types/components/grid.d.ts +6 -0
- package/types/components/table.d.ts +2 -2
- package/types/ui/index.d.ts +2 -0
- /package/es/icon/{iconfont.1784868322028.ttf → iconfont.1785242772217.ttf} +0 -0
- /package/es/icon/{iconfont.1784868322028.woff → iconfont.1785242772217.woff} +0 -0
- /package/es/icon/{iconfont.1784868322028.woff2 → iconfont.1785242772217.woff2} +0 -0
- /package/es/{iconfont.1784868322028.ttf → iconfont.1785242772217.ttf} +0 -0
- /package/es/{iconfont.1784868322028.woff → iconfont.1785242772217.woff} +0 -0
- /package/es/{iconfont.1784868322028.woff2 → iconfont.1785242772217.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1784868322028.ttf → iconfont.1785242772217.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1784868322028.woff → iconfont.1785242772217.woff} +0 -0
- /package/lib/icon/style/{iconfont.1784868322028.woff2 → iconfont.1785242772217.woff2} +0 -0
- /package/lib/{iconfont.1784868322028.ttf → iconfont.1785242772217.ttf} +0 -0
- /package/lib/{iconfont.1784868322028.woff → iconfont.1785242772217.woff} +0 -0
- /package/lib/{iconfont.1784868322028.woff2 → iconfont.1785242772217.woff2} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
2
|
|
|
3
|
+
import type { VxeColorPickerDefines } from '../../../types'
|
|
4
|
+
|
|
3
5
|
const hexAlphaKeyMaps: Record<string, number> = {}
|
|
4
6
|
const hexAlphaNumMaps: Record<string, string> = {}
|
|
5
7
|
'FF,FC,FA,F7,F5,F2,F0,ED,EB,E8,E6,E3,E0,DE,DB,D9,D6,D4,D1,CF,CC,C9,C7,C4,C2,BF,BD,BA,B8,B5,B3,B0,AD,AB,A8,A6,A3,A1,9E,9C,99,96,94,91,8F,8C,8A,87,85,82,80,7D,7A,78,75,73,70,6E,6B,69,66,63,61,5E,5C,59,57,54,52,4F,4D,4A,47,45,42,40,3D,3B,38,36,33,30,2E,2B,29,26,24,21,1F,1C,1A,17,14,12,0F,0D,0A,08,05,03,00'.split(',').forEach((key, i) => {
|
|
@@ -10,15 +12,156 @@ const hexAlphaNumMaps: Record<string, string> = {}
|
|
|
10
12
|
|
|
11
13
|
const rgbRE = /^rgb(a?)\((\d{1,3})[,\s]+(\d{1,3})[,\s]+(\d{1,3})([,//\s]+([0-9.]{1,4})(%?))?\)$/
|
|
12
14
|
export function hasRgb (value: string) {
|
|
13
|
-
return value && rgbRE.test(value)
|
|
15
|
+
return !!(value && rgbRE.test(value))
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
const hexRE = /^(#?)([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/
|
|
17
19
|
export function hasHex (value: string) {
|
|
18
|
-
return value && hexRE.test(value)
|
|
20
|
+
return !!(value && hexRE.test(value))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function toRgb (value: string) {
|
|
24
|
+
if (value) {
|
|
25
|
+
if (hexRE.test(value)) {
|
|
26
|
+
return hexToRgb(value)
|
|
27
|
+
}
|
|
28
|
+
return parseRgbVal(value)
|
|
29
|
+
}
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function toRgbString (value: string) {
|
|
34
|
+
const rgbRest = toRgb(value)
|
|
35
|
+
if (rgbRest) {
|
|
36
|
+
return rgbRest.label
|
|
37
|
+
}
|
|
38
|
+
return ''
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function toHex (value: string) {
|
|
42
|
+
if (value) {
|
|
43
|
+
if (rgbRE.test(value)) {
|
|
44
|
+
return rgbValToHex(value)
|
|
45
|
+
}
|
|
46
|
+
return parseHexVal(value)
|
|
47
|
+
}
|
|
48
|
+
return null
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function toHexString (value: string) {
|
|
52
|
+
const hexRest = toHex(value)
|
|
53
|
+
if (hexRest) {
|
|
54
|
+
return hexRest.label
|
|
55
|
+
}
|
|
56
|
+
return ''
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function toHsl (value: string) {
|
|
60
|
+
const rgbRest = toRgb(value)
|
|
61
|
+
if (rgbRest) {
|
|
62
|
+
const hslRest = rgbToHsl(rgbRest)
|
|
63
|
+
if (hslRest) {
|
|
64
|
+
const rest: VxeColorPickerDefines.HslObj = { value, type: 'hsl', ...hslRest }
|
|
65
|
+
return rest
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return null
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function toHsv (value: string) {
|
|
72
|
+
const rgbRest = toRgb(value)
|
|
73
|
+
if (rgbRest) {
|
|
74
|
+
const hslRest = rgbToHsv(rgbRest)
|
|
75
|
+
if (hslRest) {
|
|
76
|
+
const rest: VxeColorPickerDefines.HsvObj = { value, type: 'hsv', ...hslRest }
|
|
77
|
+
return rest
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return null
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function parseColor<T extends keyof VxeColorPickerDefines.ParseResultMap> (val: string, format?: T): VxeColorPickerDefines.ParseResultMap[T] | null {
|
|
84
|
+
if (val) {
|
|
85
|
+
if (format === 'hex') {
|
|
86
|
+
return toHex(val) as any
|
|
87
|
+
}
|
|
88
|
+
if (format === 'hsl') {
|
|
89
|
+
return toHsl(val) as any
|
|
90
|
+
}
|
|
91
|
+
if (format === 'hsv') {
|
|
92
|
+
return toHsv(val) as any
|
|
93
|
+
}
|
|
94
|
+
return toRgb(val) as any
|
|
95
|
+
}
|
|
96
|
+
return null
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function handleNumClamp (val: number) {
|
|
100
|
+
return Math.min(1, Math.max(0, val))
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function createLightenDarken (isAdd: number) {
|
|
104
|
+
return function (val: string, ratio?: number) {
|
|
105
|
+
const colorRest = parseColor(val)
|
|
106
|
+
const hslRest = toHsl(val)
|
|
107
|
+
if (colorRest && hslRest) {
|
|
108
|
+
ratio = ratio === 0 ? 0 : ratio || 10
|
|
109
|
+
hslRest.l += (isAdd ? ratio : -ratio) / 100
|
|
110
|
+
hslRest.l = handleNumClamp(hslRest.l)
|
|
111
|
+
const rgbRest = hslToRgb(hslRest)
|
|
112
|
+
if (rgbRest) {
|
|
113
|
+
if (colorRest?.type === 'hex') {
|
|
114
|
+
return rgbToHexVal(rgbRest.r, rgbRest.g, rgbRest.b, hslRest.a)
|
|
115
|
+
}
|
|
116
|
+
return toValRgb(rgbRest.r, rgbRest.g, rgbRest.b, hslRest.a)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return val
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const lighten = createLightenDarken(1)
|
|
124
|
+
export const darken = createLightenDarken(0)
|
|
125
|
+
|
|
126
|
+
function parseHexVal (value: string) {
|
|
127
|
+
if (value) {
|
|
128
|
+
const hexRest = value.match(hexRE)
|
|
129
|
+
if (hexRest) {
|
|
130
|
+
const rest:VxeColorPickerDefines.HexObj = {
|
|
131
|
+
value,
|
|
132
|
+
label: value,
|
|
133
|
+
type: 'hex',
|
|
134
|
+
hex: value,
|
|
135
|
+
hexV: hexRest[2],
|
|
136
|
+
hexA: hexRest[3] || '',
|
|
137
|
+
a: (hexRest[3] ? hexAlphaKeyMaps[hexRest[3].toUpperCase()] : 1) || 1
|
|
138
|
+
}
|
|
139
|
+
return rest
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return null
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function parseRgbVal (value: string) {
|
|
146
|
+
if (value) {
|
|
147
|
+
const rgbRest = value.match(rgbRE)
|
|
148
|
+
if (rgbRest) {
|
|
149
|
+
const rest: VxeColorPickerDefines.RgbObj = {
|
|
150
|
+
value,
|
|
151
|
+
label: value,
|
|
152
|
+
type: (rgbRest[6] ? 'rgba' : 'rgb') as 'rgba' | 'rgb',
|
|
153
|
+
r: parseInt(rgbRest[2]),
|
|
154
|
+
g: parseInt(rgbRest[3]),
|
|
155
|
+
b: parseInt(rgbRest[4]),
|
|
156
|
+
a: rgbRest[7] ? parseInt(rgbRest[6]) / 100 : (rgbRest[6] ? parseFloat(rgbRest[6]) : 1)
|
|
157
|
+
}
|
|
158
|
+
return rest
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return null
|
|
19
162
|
}
|
|
20
163
|
|
|
21
|
-
export function
|
|
164
|
+
export function parseValColor (value: string) {
|
|
22
165
|
const rest = {
|
|
23
166
|
value: '',
|
|
24
167
|
type: '',
|
|
@@ -31,57 +174,47 @@ export function parseColor (value: string) {
|
|
|
31
174
|
a: 1
|
|
32
175
|
}
|
|
33
176
|
if (value) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
rest
|
|
38
|
-
rest.hex = value
|
|
39
|
-
rest.hexV = hexRest[2]
|
|
40
|
-
rest.hexA = hexRest[3] || ''
|
|
41
|
-
rest.a = (hexRest[3] ? hexAlphaKeyMaps[hexRest[3].toUpperCase()] : 1) || 1
|
|
42
|
-
}
|
|
43
|
-
const rgbRest = value.match(rgbRE)
|
|
44
|
-
if (rgbRest) {
|
|
45
|
-
rest.value = value
|
|
46
|
-
rest.type = rgbRest[6] ? 'rgba' : 'rgb'
|
|
47
|
-
rest.r = parseInt(rgbRest[2])
|
|
48
|
-
rest.g = parseInt(rgbRest[3])
|
|
49
|
-
rest.b = parseInt(rgbRest[4])
|
|
50
|
-
rest.a = rgbRest[7] ? parseInt(rgbRest[6]) / 100 : (rgbRest[6] ? parseFloat(rgbRest[6]) : 1)
|
|
177
|
+
if (hexRE.test(value)) {
|
|
178
|
+
return Object.assign(rest, parseHexVal(value))
|
|
179
|
+
} else if (rgbRE.test(value)) {
|
|
180
|
+
return Object.assign(rest, parseRgbVal(value))
|
|
51
181
|
}
|
|
52
182
|
}
|
|
53
183
|
return rest
|
|
54
184
|
}
|
|
55
185
|
|
|
56
186
|
export function updateColorAlpha (value: string, alpha: number = 1) {
|
|
57
|
-
const colorRest =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
187
|
+
const colorRest = parseValColor(value)
|
|
188
|
+
if (colorRest) {
|
|
189
|
+
const { type } = colorRest
|
|
190
|
+
if (type === 'hex') {
|
|
191
|
+
return `#${colorRest.hexV}${alpha === 1 ? '' : (hexAlphaNumMaps[alpha] || '')}`
|
|
192
|
+
}
|
|
193
|
+
return toValRgb(colorRest.r, colorRest.g, colorRest.b, alpha)
|
|
64
194
|
}
|
|
65
195
|
return ''
|
|
66
196
|
}
|
|
67
197
|
|
|
68
|
-
export function
|
|
69
|
-
if (XEUtils.eqNull(a)) {
|
|
198
|
+
export function toValRgb (r: number, g: number, b: number, a?: number | null) {
|
|
199
|
+
if (XEUtils.eqNull(a) || a === 1) {
|
|
70
200
|
return `rgb(${r},${g},${b})`
|
|
71
201
|
}
|
|
72
202
|
return `rgba(${r},${g},${b},${a})`
|
|
73
203
|
}
|
|
74
204
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return ''
|
|
205
|
+
function rgbValToHex (value: string) {
|
|
206
|
+
const rgbRest = parseRgbVal(value)
|
|
207
|
+
if (rgbRest) {
|
|
208
|
+
const hexVal = rgbToHexVal(rgbRest.r, rgbRest.g, rgbRest.b, rgbRest.a)
|
|
209
|
+
if (hexVal) {
|
|
210
|
+
return parseHexVal(hexVal)
|
|
211
|
+
}
|
|
83
212
|
}
|
|
84
|
-
|
|
213
|
+
return null
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function rgbToHexVal (r: number, g: number, b: number, a?: number) {
|
|
217
|
+
a = XEUtils.isNumber(a) ? a : 1
|
|
85
218
|
const hexR = r.toString(16).padStart(2, '0')
|
|
86
219
|
const hexG = g.toString(16).padStart(2, '0')
|
|
87
220
|
const hexB = b.toString(16).padStart(2, '0')
|
|
@@ -136,6 +269,91 @@ export function rgbToHsv (rgbRest: {
|
|
|
136
269
|
}
|
|
137
270
|
}
|
|
138
271
|
|
|
272
|
+
function rgbToHsl (rgbRest: {
|
|
273
|
+
r: number
|
|
274
|
+
g: number
|
|
275
|
+
b: number
|
|
276
|
+
a?: number
|
|
277
|
+
}) {
|
|
278
|
+
if (!rgbRest) {
|
|
279
|
+
return null
|
|
280
|
+
}
|
|
281
|
+
const { r, g, b, a } = rgbRest
|
|
282
|
+
const rNorm = r / 255
|
|
283
|
+
const gNorm = g / 255
|
|
284
|
+
const bNorm = b / 255
|
|
285
|
+
|
|
286
|
+
const max = Math.max(rNorm, gNorm, bNorm)
|
|
287
|
+
const min = Math.min(rNorm, gNorm, bNorm)
|
|
288
|
+
const delta = max - min
|
|
289
|
+
|
|
290
|
+
let h = 0
|
|
291
|
+
let s = 0
|
|
292
|
+
const l = (max + min) / 2
|
|
293
|
+
|
|
294
|
+
if (delta !== 0) {
|
|
295
|
+
s = l > 0.5 ? delta / (2 - max - min) : delta / (max + min)
|
|
296
|
+
if (max === rNorm) {
|
|
297
|
+
h = ((gNorm - bNorm) / delta) % 6
|
|
298
|
+
} else if (max === gNorm) {
|
|
299
|
+
h = (bNorm - rNorm) / delta + 2
|
|
300
|
+
} else {
|
|
301
|
+
h = (rNorm - gNorm) / delta + 4
|
|
302
|
+
}
|
|
303
|
+
h *= 60
|
|
304
|
+
if (h < 0) {
|
|
305
|
+
h += 360
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return {
|
|
310
|
+
h,
|
|
311
|
+
s,
|
|
312
|
+
l,
|
|
313
|
+
a: XEUtils.isNumber(a) ? a : 1
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function hslToRgb (slRest: {
|
|
318
|
+
h: number
|
|
319
|
+
s: number
|
|
320
|
+
l: number
|
|
321
|
+
}) {
|
|
322
|
+
if (!slRest) {
|
|
323
|
+
return null
|
|
324
|
+
}
|
|
325
|
+
let { h, s, l } = slRest
|
|
326
|
+
const sNorm = s
|
|
327
|
+
const lNorm = l
|
|
328
|
+
|
|
329
|
+
h = ((h % 360) + 360) % 360
|
|
330
|
+
|
|
331
|
+
const c = (1 - Math.abs(2 * lNorm - 1)) * sNorm
|
|
332
|
+
const x = c * (1 - Math.abs((h / 60) % 2 - 1))
|
|
333
|
+
const m = lNorm - c / 2
|
|
334
|
+
|
|
335
|
+
let r: number, g: number, b: number
|
|
336
|
+
if (h >= 0 && h < 60) {
|
|
337
|
+
r = c; g = x; b = 0
|
|
338
|
+
} else if (h >= 60 && h < 120) {
|
|
339
|
+
r = x; g = c; b = 0
|
|
340
|
+
} else if (h >= 120 && h < 180) {
|
|
341
|
+
r = 0; g = c; b = x
|
|
342
|
+
} else if (h >= 180 && h < 240) {
|
|
343
|
+
r = 0; g = x; b = c
|
|
344
|
+
} else if (h >= 240 && h < 300) {
|
|
345
|
+
r = x; g = 0; b = c
|
|
346
|
+
} else {
|
|
347
|
+
r = c; g = 0; b = x
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return {
|
|
351
|
+
r: Math.round((r + m) * 255),
|
|
352
|
+
g: Math.round((g + m) * 255),
|
|
353
|
+
b: Math.round((b + m) * 255)
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
139
357
|
export function hsvToRgb (h: number, s: number, v: number) {
|
|
140
358
|
let r = 0
|
|
141
359
|
let g = 0
|
|
@@ -186,11 +404,18 @@ export function hexToRgb (str: string) {
|
|
|
186
404
|
if (str) {
|
|
187
405
|
const rests = str.match(/^(#?)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})?$/)
|
|
188
406
|
if (rests) {
|
|
407
|
+
const r = parseInt(rests[2], 16)
|
|
408
|
+
const g = parseInt(rests[3], 16)
|
|
409
|
+
const b = parseInt(rests[4], 16)
|
|
410
|
+
const a = (rests[5] ? hexAlphaKeyMaps[rests[5].toUpperCase()] : 1) || 1
|
|
189
411
|
return {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
412
|
+
value: str,
|
|
413
|
+
label: toValRgb(r, g, b, rests[5] ? a : null),
|
|
414
|
+
type: (rests[5] ? 'rgba' : 'rgb') as 'rgba' | 'rgb',
|
|
415
|
+
r,
|
|
416
|
+
g,
|
|
417
|
+
b,
|
|
418
|
+
a
|
|
194
419
|
}
|
|
195
420
|
}
|
|
196
421
|
}
|
|
@@ -11,7 +11,7 @@ import VxeDatePanelComponent from '../../date-panel/src/date-panel'
|
|
|
11
11
|
import VxeButtonComponent from '../../button/src/button'
|
|
12
12
|
import VxeButtonGroupComponent from '../../button/src/button-group'
|
|
13
13
|
|
|
14
|
-
import type { VxeDatePickerConstructor, VxeDatePickerEmits, DatePickerInternalData, DatePickerReactData, DatePickerMethods, VxeDatePanelDefines, VxeDatePickerPropTypes, DatePickerPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, ValueOf, VxeModalConstructor, VxeDrawerConstructor, VxeModalMethods, VxeDrawerMethods, VxeDatePickerDefines, VxeButtonGroupEvents, VxeDatePanelConstructor } from '../../../types'
|
|
14
|
+
import type { VxeDatePickerConstructor, VxeDatePickerEmits, DatePickerInternalData, DatePickerReactData, DatePickerMethods, VxeDatePanelDefines, VxeDatePickerPropTypes, DatePickerPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, ValueOf, VxeModalConstructor, VxeDrawerConstructor, VxeModalMethods, VxeDrawerMethods, VxeDatePickerDefines, VxeButtonGroupEvents, VxeDatePanelConstructor, VxeCardConstructor, VxeCardPrivateMethods } from '../../../types'
|
|
15
15
|
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/components/table'
|
|
16
16
|
|
|
17
17
|
const { warnLog, errLog } = createComponentLog('date-picker')
|
|
@@ -181,6 +181,7 @@ export default defineVxeComponent({
|
|
|
181
181
|
const $xeModal = inject<(VxeModalConstructor & VxeModalMethods) | null>('$xeModal', null)
|
|
182
182
|
const $xeDrawer = inject<(VxeDrawerConstructor & VxeDrawerMethods) | null>('$xeDrawer', null)
|
|
183
183
|
const $xeTable = inject<(VxeTableConstructor & VxeTablePrivateMethods) | null>('$xeTable', null)
|
|
184
|
+
const $xeCard = inject<(VxeCardConstructor & VxeCardPrivateMethods) | null>('$xeCard', null)
|
|
184
185
|
const $xeForm = inject<(VxeFormConstructor & VxeFormPrivateMethods) | null>('$xeForm', null)
|
|
185
186
|
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
|
|
186
187
|
|
|
@@ -223,7 +224,7 @@ export default defineVxeComponent({
|
|
|
223
224
|
if (XEUtils.isBoolean(globalTransfer)) {
|
|
224
225
|
return globalTransfer
|
|
225
226
|
}
|
|
226
|
-
if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
|
|
227
|
+
if ($xeTable || $xeModal || $xeDrawer || $xeCard || $xeForm) {
|
|
227
228
|
return true
|
|
228
229
|
}
|
|
229
230
|
}
|
|
@@ -11,7 +11,7 @@ import VxeDatePanelComponent from '../../date-panel'
|
|
|
11
11
|
import VxeButtonComponent from '../../button'
|
|
12
12
|
import VxeButtonGroupComponent from '../../button-group'
|
|
13
13
|
|
|
14
|
-
import type { VxeDateRangePickerConstructor, VxeDateRangePickerEmits, DateRangePickerInternalData, DateRangePickerReactData, DateRangePickerMethods, VxeDateRangePickerPropTypes, DateRangePickerPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, ValueOf, VxeModalConstructor, VxeDatePanelPropTypes, VxeDrawerConstructor, VxeModalMethods, VxeDrawerMethods, VxeDatePanelEvents, VxeDateRangePickerDefines, VxeButtonGroupEvents, VxeDatePanelConstructor } from '../../../types'
|
|
14
|
+
import type { VxeDateRangePickerConstructor, VxeDateRangePickerEmits, DateRangePickerInternalData, DateRangePickerReactData, DateRangePickerMethods, VxeDateRangePickerPropTypes, DateRangePickerPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, ValueOf, VxeModalConstructor, VxeDatePanelPropTypes, VxeDrawerConstructor, VxeModalMethods, VxeDrawerMethods, VxeDatePanelEvents, VxeDateRangePickerDefines, VxeButtonGroupEvents, VxeDatePanelConstructor, VxeCardConstructor, VxeCardPrivateMethods } from '../../../types'
|
|
15
15
|
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/components/table'
|
|
16
16
|
|
|
17
17
|
const { errLog } = createComponentLog('date-range-picker')
|
|
@@ -176,6 +176,7 @@ export default defineVxeComponent({
|
|
|
176
176
|
const $xeModal = inject<(VxeModalConstructor & VxeModalMethods) | null>('$xeModal', null)
|
|
177
177
|
const $xeDrawer = inject<(VxeDrawerConstructor & VxeDrawerMethods) | null>('$xeDrawer', null)
|
|
178
178
|
const $xeTable = inject<(VxeTableConstructor & VxeTablePrivateMethods) | null>('$xeTable', null)
|
|
179
|
+
const $xeCard = inject<(VxeCardConstructor & VxeCardPrivateMethods) | null>('$xeCard', null)
|
|
179
180
|
const $xeForm = inject<(VxeFormConstructor & VxeFormPrivateMethods) | null>('$xeForm', null)
|
|
180
181
|
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
|
|
181
182
|
|
|
@@ -222,7 +223,7 @@ export default defineVxeComponent({
|
|
|
222
223
|
if (XEUtils.isBoolean(globalTransfer)) {
|
|
223
224
|
return globalTransfer
|
|
224
225
|
}
|
|
225
|
-
if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
|
|
226
|
+
if ($xeTable || $xeModal || $xeDrawer || $xeCard || $xeForm) {
|
|
226
227
|
return true
|
|
227
228
|
}
|
|
228
229
|
}
|
|
@@ -9,7 +9,7 @@ import { createComponentLog } from '../../ui/src/log'
|
|
|
9
9
|
import VxeInputComponent from '../../input/src/input'
|
|
10
10
|
import VxeButtonComponent from '../../button/src/button'
|
|
11
11
|
|
|
12
|
-
import type { VxeSelectPropTypes, VxeSelectConstructor, SelectInternalData, SelectReactData, VxeSelectDefines, VxeButtonEvents, ValueOf, VxeSelectEmits, VxeComponentSlotType, VxeInputConstructor, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeOptionProps, VxeDrawerConstructor, VxeDrawerMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods, VxeInputEvents, VxeComponentStyleType } from '../../../types'
|
|
12
|
+
import type { VxeSelectPropTypes, VxeSelectConstructor, SelectInternalData, SelectReactData, VxeSelectDefines, VxeButtonEvents, ValueOf, VxeSelectEmits, VxeComponentSlotType, VxeInputConstructor, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeOptionProps, VxeDrawerConstructor, VxeDrawerMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods, VxeInputEvents, VxeComponentStyleType, VxeCardConstructor, VxeCardPrivateMethods } from '../../../types'
|
|
13
13
|
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/components/table'
|
|
14
14
|
|
|
15
15
|
const { errLog } = createComponentLog('select')
|
|
@@ -216,6 +216,7 @@ export default defineVxeComponent({
|
|
|
216
216
|
const $xeModal = inject<(VxeModalConstructor & VxeModalMethods)| null>('$xeModal', null)
|
|
217
217
|
const $xeDrawer = inject<(VxeDrawerConstructor & VxeDrawerMethods) | null>('$xeDrawer', null)
|
|
218
218
|
const $xeTable = inject<(VxeTableConstructor & VxeTablePrivateMethods) | null>('$xeTable', null)
|
|
219
|
+
const $xeCard = inject<(VxeCardConstructor & VxeCardPrivateMethods) | null>('$xeCard', null)
|
|
219
220
|
const $xeForm = inject<(VxeFormConstructor & VxeFormPrivateMethods)| null>('$xeForm', null)
|
|
220
221
|
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)
|
|
221
222
|
|
|
@@ -280,7 +281,7 @@ export default defineVxeComponent({
|
|
|
280
281
|
if (XEUtils.isBoolean(globalTransfer)) {
|
|
281
282
|
return globalTransfer
|
|
282
283
|
}
|
|
283
|
-
if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
|
|
284
|
+
if ($xeTable || $xeModal || $xeDrawer || $xeCard || $xeForm) {
|
|
284
285
|
return true
|
|
285
286
|
}
|
|
286
287
|
}
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
.vxe-form-item--valid-error-tip {
|
|
162
162
|
position: absolute;
|
|
163
163
|
width: 100%;
|
|
164
|
-
font-size:
|
|
164
|
+
font-size: var(--vxe-ui-form-validate-error-font-size, var(--vxe-ui-form-current-font-size));
|
|
165
165
|
line-height: 1em;
|
|
166
166
|
color: var(--vxe-ui-form-validate-error-color);
|
|
167
167
|
background-color: var(--vxe-ui-form-validate-error-background-color);
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
pointer-events: auto;
|
|
177
177
|
}
|
|
178
178
|
.vxe-form-item--valid-error-theme-beautify {
|
|
179
|
-
padding:
|
|
179
|
+
padding: var(--vxe-ui-form-validate-error-padding, 0.2em 0.6em);
|
|
180
180
|
color: #fff;
|
|
181
181
|
background-color: var(--vxe-ui-status-error-color);
|
|
182
182
|
.vxe-form-item--valid-error-msg {
|
|
@@ -146,6 +146,53 @@ export interface VxeColorPickerMethods extends ColorPickerMethods { }
|
|
|
146
146
|
export interface ColorPickerPrivateMethods { }
|
|
147
147
|
export interface VxeColorPickerPrivateMethods extends ColorPickerPrivateMethods { }
|
|
148
148
|
|
|
149
|
+
export interface ColorController {
|
|
150
|
+
/**
|
|
151
|
+
* 解析颜色
|
|
152
|
+
*/
|
|
153
|
+
parseColor<T extends keyof VxeColorPickerDefines.ParseResultMap>(color: string, format?: T): VxeColorPickerDefines.ParseResultMap[T] | null
|
|
154
|
+
/**
|
|
155
|
+
* 判断颜色是否 RGB 格式
|
|
156
|
+
*/
|
|
157
|
+
hasRgb(color: string): boolean
|
|
158
|
+
/**
|
|
159
|
+
* 判断颜色是否 HEX 格式
|
|
160
|
+
*/
|
|
161
|
+
hasHex(color: string): boolean
|
|
162
|
+
/**
|
|
163
|
+
* 转成 RGB 格式
|
|
164
|
+
*/
|
|
165
|
+
toRgb(color: string): VxeColorPickerDefines.RgbObj | null
|
|
166
|
+
/**
|
|
167
|
+
* 转成 RGB 字符串格式
|
|
168
|
+
*/
|
|
169
|
+
toRgbString(color: string): string
|
|
170
|
+
/**
|
|
171
|
+
* 转成 HEX 格式
|
|
172
|
+
*/
|
|
173
|
+
toHex(color: string): VxeColorPickerDefines.HexObj | null
|
|
174
|
+
/**
|
|
175
|
+
* 转成 HEX 字符串格式
|
|
176
|
+
*/
|
|
177
|
+
toHexString(color: string): string
|
|
178
|
+
/**
|
|
179
|
+
* 转成 HSL 格式
|
|
180
|
+
*/
|
|
181
|
+
toHsl(color: string): VxeColorPickerDefines.HslObj | null
|
|
182
|
+
/**
|
|
183
|
+
* 转成 HSV 格式
|
|
184
|
+
*/
|
|
185
|
+
toHsv(color: string): VxeColorPickerDefines.HsvObj | null
|
|
186
|
+
/**
|
|
187
|
+
* 对颜色进行高亮
|
|
188
|
+
*/
|
|
189
|
+
lighten(color: string, ratio: number): string
|
|
190
|
+
/**
|
|
191
|
+
* 对颜色进行加深
|
|
192
|
+
*/
|
|
193
|
+
darken(color: string, ratio: number): string
|
|
194
|
+
}
|
|
195
|
+
|
|
149
196
|
export type VxeColorPickerEmits = [
|
|
150
197
|
'update:modelValue',
|
|
151
198
|
'change',
|
|
@@ -157,6 +204,52 @@ export namespace VxeColorPickerDefines {
|
|
|
157
204
|
export interface ColorPickerEventParams extends VxeComponentEventParams {
|
|
158
205
|
$colorPicker: VxeColorPickerConstructor
|
|
159
206
|
}
|
|
207
|
+
|
|
208
|
+
export type ParseResultMap = {
|
|
209
|
+
'': VxeColorPickerDefines.RgbObj
|
|
210
|
+
'rgb': VxeColorPickerDefines.RgbObj
|
|
211
|
+
'rgba': VxeColorPickerDefines.RgbObj
|
|
212
|
+
'hex': VxeColorPickerDefines.HexObj
|
|
213
|
+
'hsl': VxeColorPickerDefines.HslObj
|
|
214
|
+
'hsv': VxeColorPickerDefines.HsvObj
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface RgbObj {
|
|
218
|
+
type: 'rgba' | 'rgb'
|
|
219
|
+
value: string
|
|
220
|
+
label: string
|
|
221
|
+
r: number
|
|
222
|
+
g: number
|
|
223
|
+
b: number
|
|
224
|
+
a: number
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface HexObj {
|
|
228
|
+
type: 'hex'
|
|
229
|
+
value: string
|
|
230
|
+
label: string
|
|
231
|
+
hex: string
|
|
232
|
+
hexV: string
|
|
233
|
+
hexA: string
|
|
234
|
+
a: number
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface HslObj {
|
|
238
|
+
type: 'hsl'
|
|
239
|
+
value: string
|
|
240
|
+
h: number
|
|
241
|
+
s: number
|
|
242
|
+
l: number
|
|
243
|
+
a: number
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface HsvObj {
|
|
247
|
+
type: 'hsv'
|
|
248
|
+
value: string
|
|
249
|
+
h: number
|
|
250
|
+
s: number
|
|
251
|
+
v: number
|
|
252
|
+
}
|
|
160
253
|
}
|
|
161
254
|
|
|
162
255
|
export type VxeColorPickerEventProps = {
|
|
@@ -7070,8 +7070,8 @@ export namespace VxeTableDefines {
|
|
|
7070
7070
|
export type CustomEventType = 'reset' | 'confirm' | 'update:width' | 'update:fixed' | 'update:sort' | 'update:visible' | 'update:align' | 'update:headerAlign' | 'update:footerAlign' | 'update:aggGroup' | 'update:aggFunc'
|
|
7071
7071
|
|
|
7072
7072
|
export interface CustomStoreData {
|
|
7073
|
-
|
|
7074
|
-
|
|
7073
|
+
pagerData?: {
|
|
7074
|
+
pSize?: number
|
|
7075
7075
|
}
|
|
7076
7076
|
alignData?: Record<string, VxeColumnPropTypes.Align>
|
|
7077
7077
|
headerAlignData?: Record<string, VxeColumnPropTypes.HeaderAlign>
|
package/types/ui/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { App } from 'vue'
|
|
2
2
|
import { VxeUI, getI18n, setConfig } from '@vxe-ui/core'
|
|
3
3
|
import { LoadingController } from '../components/loading'
|
|
4
|
+
import { ColorController } from '../components/color-picker'
|
|
4
5
|
import { ModalController } from '../components/modal'
|
|
5
6
|
import { DrawerController } from '../components/drawer'
|
|
6
7
|
import { WatermarkController } from '../components/watermark'
|
|
@@ -34,6 +35,7 @@ export const readFile: VxeUploadDefines.ReadFileFunction
|
|
|
34
35
|
declare module '@vxe-ui/core' {
|
|
35
36
|
export interface VxeUIExport {
|
|
36
37
|
loading: LoadingController
|
|
38
|
+
color: ColorController
|
|
37
39
|
modal: ModalController
|
|
38
40
|
drawer: DrawerController
|
|
39
41
|
watermark: WatermarkController
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|