renusify 1.0.3 → 1.0.4
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/LICENSE +1 -1
- package/components/button/buttonGroup.vue +0 -4
- package/components/button/index.vue +0 -2
- package/components/card/index.vue +0 -2
- package/components/chat/MessageList.vue +0 -2
- package/components/chat/chatMsg.vue +4 -4
- package/components/form/colorPicker/Alpha.vue +26 -45
- package/components/form/colorPicker/Hue.vue +32 -51
- package/components/form/colorPicker/Preview.vue +21 -28
- package/components/form/colorPicker/Saturation.vue +49 -69
- package/components/form/colorPicker/index.vue +53 -38
- package/components/form/colorPicker/mixin.js +6 -1
- package/components/form/colorPicker/picker.vue +80 -39
- package/components/form/group-input.vue +122 -105
- package/components/form/inputTel/index.vue +8 -10
- package/components/form/json/JsonView.vue +15 -11
- package/components/form/json/index.vue +29 -10
- package/components/form/mask-input.vue +0 -5
- package/components/form/range.vue +0 -2
- package/components/form/select.vue +14 -14
- package/components/iframe/index.vue +60 -38
- package/components/index.js +91 -85
- package/components/infinite/div.vue +2 -3
- package/components/infinite/page.vue +2 -3
- package/components/list/index.vue +0 -2
- package/components/menu/index.vue +2 -5
- package/components/searchBox/index.vue +0 -4
- package/components/slider/index.vue +0 -4
- package/components/swiper/index.vue +0 -4
- package/components/table/index.vue +0 -4
- package/directive/index.js +18 -19
- package/directive/touch/index.js +31 -18
- package/index.js +9 -2
- package/package.json +1 -1
- package/tools/helper.js +23 -0
- package/components/form/colorPicker/Box.vue +0 -85
package/LICENSE
CHANGED
|
@@ -29,13 +29,9 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script>
|
|
32
|
-
import clickOutside from '../../directive/clickOutSide/index'
|
|
33
32
|
|
|
34
33
|
export default {
|
|
35
34
|
name: 'r-button-group',
|
|
36
|
-
directives: {
|
|
37
|
-
'click-outside': clickOutside
|
|
38
|
-
},
|
|
39
35
|
props: {
|
|
40
36
|
items: [Array, Object],
|
|
41
37
|
icon: {
|
|
@@ -23,11 +23,9 @@
|
|
|
23
23
|
<script>
|
|
24
24
|
import './style.scss'
|
|
25
25
|
import { roots } from '../../tools/rootable'
|
|
26
|
-
import Ripple from '../../directive/ripple/index'
|
|
27
26
|
export default {
|
|
28
27
|
name: 'r-btn',
|
|
29
28
|
mixins: [roots],
|
|
30
|
-
directives: { ripple: Ripple },
|
|
31
29
|
props: {
|
|
32
30
|
tag: {
|
|
33
31
|
type: String,
|
|
@@ -8,13 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
10
|
import {roots} from '../../tools/rootable';
|
|
11
|
-
import Ripple from '../../directive/ripple/index';
|
|
12
11
|
import './style.scss';
|
|
13
12
|
|
|
14
13
|
export default {
|
|
15
14
|
name: 'r-card',
|
|
16
15
|
mixins: [roots],
|
|
17
|
-
directives: {ripple: Ripple},
|
|
18
16
|
props: {
|
|
19
17
|
flat: Boolean,
|
|
20
18
|
hover: Boolean,
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
</div>
|
|
43
43
|
</template>
|
|
44
44
|
<script>
|
|
45
|
-
import {Intersect} from '../../directive/intersect'
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
|
|
47
|
+
export default {
|
|
48
48
|
name: 'r-chat-msg',
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
|
|
50
|
+
props: {
|
|
51
51
|
isMe: Boolean,
|
|
52
52
|
user: {
|
|
53
53
|
type: Object,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="color-alpha ms-1"
|
|
3
|
-
<canvas ref="
|
|
4
|
-
|
|
2
|
+
<div class="color-alpha ms-1">
|
|
3
|
+
<canvas ref="canvas" :width="width" :height="height" v-touch="{'end':move,
|
|
4
|
+
'move':move}"/>
|
|
5
|
+
<div :style="style" class="slide"/>
|
|
5
6
|
</div>
|
|
6
7
|
</template>
|
|
7
8
|
|
|
@@ -32,8 +33,9 @@ export default {
|
|
|
32
33
|
emits: ['selectAlpha'],
|
|
33
34
|
data() {
|
|
34
35
|
return {
|
|
35
|
-
|
|
36
|
+
style: {},
|
|
36
37
|
alphaSize: 5,
|
|
38
|
+
ctx: null
|
|
37
39
|
}
|
|
38
40
|
},
|
|
39
41
|
watch: {
|
|
@@ -45,65 +47,44 @@ export default {
|
|
|
45
47
|
},
|
|
46
48
|
},
|
|
47
49
|
mounted() {
|
|
50
|
+
this.ctx = this.$refs.canvas.getContext('2d', {willReadFrequently: true})
|
|
48
51
|
this.renderColor()
|
|
49
52
|
this.renderSlide()
|
|
50
53
|
},
|
|
51
54
|
methods: {
|
|
52
55
|
renderColor() {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const size = this.alphaSize
|
|
57
|
-
const canvasSquare = this.createAlphaSquare(size)
|
|
58
|
-
|
|
59
|
-
const ctx = canvas.getContext('2d')
|
|
60
|
-
canvas.width = width
|
|
61
|
-
canvas.height = height
|
|
62
|
-
|
|
63
|
-
ctx.fillStyle = ctx.createPattern(canvasSquare, 'repeat')
|
|
64
|
-
ctx.fillRect(0, 0, width, height)
|
|
56
|
+
const canvasSquare = this.createAlphaSquare(this.alphaSize)
|
|
57
|
+
this.ctx.fillStyle = this.ctx.createPattern(canvasSquare, 'repeat')
|
|
58
|
+
this.ctx.fillRect(0, 0, this.width, this.height)
|
|
65
59
|
|
|
66
60
|
this.createLinearGradient(
|
|
67
61
|
'p',
|
|
68
|
-
ctx,
|
|
69
|
-
width,
|
|
70
|
-
height,
|
|
62
|
+
this.ctx,
|
|
63
|
+
this.width,
|
|
64
|
+
this.height,
|
|
71
65
|
'rgba(255,255,255,0)',
|
|
72
66
|
this.color
|
|
73
67
|
)
|
|
74
68
|
},
|
|
75
69
|
renderSlide() {
|
|
76
|
-
this.
|
|
77
|
-
top: this.rgba.a * this.height
|
|
70
|
+
this.style = {
|
|
71
|
+
top: this.rgba.a * this.height + 'px',
|
|
78
72
|
}
|
|
79
73
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (y < 0) {
|
|
87
|
-
y = 0
|
|
88
|
-
}
|
|
89
|
-
if (y > this.height) {
|
|
90
|
-
y = this.height
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
let a = parseFloat((y / this.height).toFixed(2))
|
|
94
|
-
this.$emit('selectAlpha', a)
|
|
74
|
+
move(e) {
|
|
75
|
+
let y = e.current.y
|
|
76
|
+
if (y <= 0) {
|
|
77
|
+
this.$emit('selectAlpha', 0)
|
|
78
|
+
return
|
|
95
79
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const mouseup = () => {
|
|
100
|
-
document.removeEventListener('mousemove', mousemove)
|
|
101
|
-
document.removeEventListener('mouseup', mouseup)
|
|
80
|
+
if (y >= this.height) {
|
|
81
|
+
this.$emit('selectAlpha', 1)
|
|
82
|
+
return
|
|
102
83
|
}
|
|
103
84
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
85
|
+
let a = parseFloat((y / this.height).toFixed(2))
|
|
86
|
+
this.$emit('selectAlpha', a)
|
|
87
|
+
}
|
|
107
88
|
},
|
|
108
89
|
}
|
|
109
90
|
</script>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="hue ms-1"
|
|
3
|
-
<canvas ref="
|
|
4
|
-
|
|
2
|
+
<div class="hue ms-1">
|
|
3
|
+
<canvas ref="canvas" :width="width" :height="height" v-touch="{'end':move,
|
|
4
|
+
'move':move}"/>
|
|
5
|
+
<div :style="style" class="slide"/>
|
|
5
6
|
</div>
|
|
6
7
|
</template>
|
|
7
8
|
|
|
@@ -26,71 +27,51 @@ export default
|
|
|
26
27
|
emits: ['selectHue'],
|
|
27
28
|
data() {
|
|
28
29
|
return {
|
|
29
|
-
|
|
30
|
+
style: {},
|
|
31
|
+
ctx: null
|
|
30
32
|
}
|
|
31
33
|
},
|
|
32
34
|
mounted() {
|
|
35
|
+
this.ctx = this.$refs.canvas.getContext('2d', {willReadFrequently: true})
|
|
33
36
|
this.renderColor()
|
|
34
37
|
this.renderSlide()
|
|
35
38
|
},
|
|
36
39
|
methods: {
|
|
37
40
|
renderColor() {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
gradient.addColorStop(0.17 * 2, '#0000FF') // blue
|
|
49
|
-
gradient.addColorStop(0.17 * 3, '#00FFFF') // green
|
|
50
|
-
gradient.addColorStop(0.17 * 4, '#00FF00') // green
|
|
51
|
-
gradient.addColorStop(0.17 * 5, '#FFFF00') // yellow
|
|
52
|
-
gradient.addColorStop(1, '#FF0000') // red
|
|
53
|
-
ctx.fillStyle = gradient
|
|
54
|
-
ctx.fillRect(0, 0, width, height)
|
|
41
|
+
const g = this.ctx.createLinearGradient(0, 0, 0, this.height)
|
|
42
|
+
g.addColorStop(0, '#FF0000') // red
|
|
43
|
+
g.addColorStop(0.17 * 1, '#FF00FF') // purple
|
|
44
|
+
g.addColorStop(0.17 * 2, '#0000FF') // blue
|
|
45
|
+
g.addColorStop(0.17 * 3, '#00FFFF') // green
|
|
46
|
+
g.addColorStop(0.17 * 4, '#00FF00') // green
|
|
47
|
+
g.addColorStop(0.17 * 5, '#FFFF00') // yellow
|
|
48
|
+
g.addColorStop(1, '#FF0000') // red
|
|
49
|
+
this.ctx.fillStyle = g
|
|
50
|
+
this.ctx.fillRect(0, 0, this.width, this.height)
|
|
55
51
|
},
|
|
56
52
|
renderSlide() {
|
|
57
|
-
this.
|
|
58
|
-
top: (1 - this.hsv.h / 360) * this.height
|
|
53
|
+
this.style = {
|
|
54
|
+
top: (1 - this.hsv.h / 360) * this.height + 'px',
|
|
59
55
|
}
|
|
60
56
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const ctx = e.target.getContext('2d')
|
|
64
|
-
|
|
65
|
-
const mousemove = (e) => {
|
|
66
|
-
let y = e.clientY - hueTop
|
|
57
|
+
move(e) {
|
|
58
|
+
let y = e.current.y
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
this.slideHueStyle = {
|
|
76
|
-
top: y - 2 + 'px',
|
|
77
|
-
}
|
|
78
|
-
// If you use the maximum value, the selected pixel will be empty, and the empty default is black
|
|
79
|
-
const imgData = ctx.getImageData(0, Math.min(y, this.height - 1), 1, 1)
|
|
80
|
-
const [r, g, b] = imgData.data
|
|
81
|
-
this.$emit('selectHue', { r, g, b })
|
|
60
|
+
if (y < 0) {
|
|
61
|
+
y = 0
|
|
62
|
+
}
|
|
63
|
+
if (y > this.height) {
|
|
64
|
+
y = this.height
|
|
82
65
|
}
|
|
83
66
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const mouseup = () => {
|
|
87
|
-
document.removeEventListener('mousemove', mousemove)
|
|
88
|
-
document.removeEventListener('mouseup', mouseup)
|
|
67
|
+
this.style = {
|
|
68
|
+
top: y - 2 + 'px',
|
|
89
69
|
}
|
|
90
70
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
71
|
+
const imgData = this.ctx.getImageData(0, Math.min(y, this.height - 1), 1, 1)
|
|
72
|
+
const [r, g, b] = imgData.data
|
|
73
|
+
this.$emit('selectHue', {r, g, b})
|
|
74
|
+
}
|
|
94
75
|
},
|
|
95
76
|
}
|
|
96
77
|
</script>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<canvas />
|
|
2
|
+
<canvas ref="canvas" :width="width" :height="height"/>
|
|
3
3
|
</template>
|
|
4
|
-
<script
|
|
4
|
+
<script>
|
|
5
5
|
import {color} from "./mixin";
|
|
6
6
|
|
|
7
|
-
export default
|
|
8
|
-
{
|
|
7
|
+
export default {
|
|
9
8
|
props: {
|
|
10
9
|
color: {
|
|
11
10
|
type: String,
|
|
@@ -20,37 +19,31 @@ export default
|
|
|
20
19
|
default: 30,
|
|
21
20
|
},
|
|
22
21
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
mixins: [color],
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
alphaSize: 7,
|
|
26
|
+
ctx: null
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
watch: {
|
|
30
|
+
color() {
|
|
31
|
+
this.renderColor()
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
34
|
mounted() {
|
|
35
|
+
this.ctx = this.$refs.canvas.getContext('2d', {willReadFrequently: true})
|
|
35
36
|
this.renderColor()
|
|
36
37
|
},
|
|
37
38
|
methods: {
|
|
38
39
|
renderColor() {
|
|
39
|
-
const
|
|
40
|
-
const width = this.width
|
|
41
|
-
const height = this.height
|
|
42
|
-
const size = this.alphaSize
|
|
43
|
-
const canvasSquare = this.createAlphaSquare(size)
|
|
44
|
-
|
|
45
|
-
const ctx = canvas.getContext('2d')
|
|
46
|
-
canvas.width = width
|
|
47
|
-
canvas.height = height
|
|
40
|
+
const canvasSquare = this.createAlphaSquare(this.alphaSize)
|
|
48
41
|
|
|
49
|
-
ctx.fillStyle = ctx.createPattern(canvasSquare, 'repeat')
|
|
50
|
-
ctx.fillRect(0, 0, width, height)
|
|
42
|
+
this.ctx.fillStyle = this.ctx.createPattern(canvasSquare, 'repeat')
|
|
43
|
+
this.ctx.fillRect(0, 0, this.width, this.height)
|
|
51
44
|
|
|
52
|
-
ctx.fillStyle = this.color
|
|
53
|
-
ctx.fillRect(0, 0, width, height)
|
|
45
|
+
this.ctx.fillStyle = this.color
|
|
46
|
+
this.ctx.fillRect(0, 0, this.width, this.height)
|
|
54
47
|
},
|
|
55
48
|
},
|
|
56
49
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="saturation"
|
|
3
|
-
<canvas ref="
|
|
4
|
-
|
|
2
|
+
<div class="saturation">
|
|
3
|
+
<canvas ref="canvas" :width="size" :height="size" v-touch="{'end':move,
|
|
4
|
+
'move':move}"/>
|
|
5
|
+
<div :style="style" class="slide"/>
|
|
5
6
|
</div>
|
|
6
7
|
</template>
|
|
7
8
|
|
|
8
|
-
<script
|
|
9
|
+
<script>
|
|
9
10
|
import {color} from "./mixin";
|
|
10
11
|
|
|
11
|
-
export default
|
|
12
|
-
{
|
|
12
|
+
export default {
|
|
13
13
|
props: {
|
|
14
14
|
color: {
|
|
15
15
|
type: String,
|
|
@@ -24,94 +24,73 @@ export default
|
|
|
24
24
|
default: 152,
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
mixins: [color],
|
|
28
|
+
emits: ['selectSaturation'],
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
style: {},
|
|
32
|
+
ctx: null
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
mounted() {
|
|
36
|
+
this.ctx = this.$refs.canvas.getContext('2d', {willReadFrequently: true})
|
|
37
|
+
this.renderColor()
|
|
38
|
+
this.renderSlide()
|
|
39
|
+
},
|
|
38
40
|
methods: {
|
|
39
41
|
renderColor() {
|
|
40
|
-
const canvas = this.$refs.canvasSaturation
|
|
41
42
|
const size = this.size
|
|
42
|
-
const ctx = canvas.getContext('2d')
|
|
43
|
-
canvas.width = size
|
|
44
|
-
canvas.height = size
|
|
45
43
|
|
|
46
|
-
ctx.fillStyle = this.color
|
|
47
|
-
ctx.fillRect(0, 0, size, size)
|
|
44
|
+
this.ctx.fillStyle = this.color
|
|
45
|
+
this.ctx.fillRect(0, 0, size, size)
|
|
48
46
|
|
|
49
47
|
this.createLinearGradient(
|
|
50
48
|
'l',
|
|
51
|
-
ctx,
|
|
49
|
+
this.ctx,
|
|
52
50
|
size,
|
|
53
51
|
size,
|
|
54
52
|
'#FFFFFF',
|
|
55
53
|
'rgba(255,255,255,0)'
|
|
56
54
|
)
|
|
57
|
-
this.createLinearGradient('p', ctx, size, size, 'rgba(0,0,0,0)', '#000000')
|
|
55
|
+
this.createLinearGradient('p', this.ctx, size, size, 'rgba(0,0,0,0)', '#000000')
|
|
58
56
|
},
|
|
59
57
|
renderSlide() {
|
|
60
|
-
this.
|
|
58
|
+
this.style = {
|
|
61
59
|
left: this.hsv.s * this.size - 5 + 'px',
|
|
62
60
|
top: (1 - this.hsv.v) * this.size - 5 + 'px',
|
|
63
61
|
}
|
|
64
62
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
left: saturationLeft,
|
|
69
|
-
} = this.$el.getBoundingClientRect()
|
|
70
|
-
const ctx = e.target.getContext('2d')
|
|
63
|
+
move(e) {
|
|
64
|
+
let x = e.current.x
|
|
65
|
+
let y = e.current.y
|
|
71
66
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
if (x < 0) {
|
|
68
|
+
x = 0
|
|
69
|
+
}
|
|
70
|
+
if (y < 0) {
|
|
71
|
+
y = 0
|
|
72
|
+
}
|
|
73
|
+
if (x > this.size) {
|
|
74
|
+
x = this.size
|
|
75
|
+
}
|
|
76
|
+
if (y > this.size) {
|
|
77
|
+
y = this.size
|
|
78
|
+
}
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
y = 0
|
|
81
|
-
}
|
|
82
|
-
if (x > this.size) {
|
|
83
|
-
x = this.size
|
|
84
|
-
}
|
|
85
|
-
if (y > this.size) {
|
|
86
|
-
y = this.size
|
|
87
|
-
}
|
|
80
|
+
this.style = {
|
|
81
|
+
left: x - 5 + 'px',
|
|
82
|
+
top: y - 5 + 'px',
|
|
83
|
+
}
|
|
88
84
|
|
|
89
|
-
|
|
90
|
-
this.slideSaturationStyle = {
|
|
91
|
-
left: x - 5 + 'px',
|
|
92
|
-
top: y - 5 + 'px',
|
|
93
|
-
}
|
|
94
|
-
// If you use the maximum value, the selected pixel will be empty, and the empty default is black
|
|
95
|
-
const imgData = ctx.getImageData(
|
|
85
|
+
const imgData = this.ctx.getImageData(
|
|
96
86
|
Math.min(x, this.size - 1),
|
|
97
87
|
Math.min(y, this.size - 1),
|
|
98
88
|
1,
|
|
99
89
|
1
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
mousemove(e)
|
|
106
|
-
|
|
107
|
-
const mouseup = () => {
|
|
108
|
-
document.removeEventListener('mousemove', mousemove)
|
|
109
|
-
document.removeEventListener('mouseup', mouseup)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
document.addEventListener('mousemove', mousemove)
|
|
113
|
-
document.addEventListener('mouseup', mouseup)
|
|
114
|
-
},
|
|
90
|
+
)
|
|
91
|
+
const [r, g, b] = imgData.data
|
|
92
|
+
this.$emit('selectSaturation', {r, g, b})
|
|
93
|
+
}
|
|
115
94
|
},
|
|
116
95
|
}
|
|
117
96
|
</script>
|
|
@@ -120,6 +99,7 @@ export default
|
|
|
120
99
|
.saturation {
|
|
121
100
|
position: relative;
|
|
122
101
|
cursor: pointer;
|
|
102
|
+
|
|
123
103
|
.slide {
|
|
124
104
|
position: absolute;
|
|
125
105
|
left: 100px;
|
|
@@ -1,50 +1,65 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<r-input class="mt-5" :model-value="modelValue" hide labelControlClass="label-active"
|
|
3
|
+
:class="`${$r.prefix}color-picker`">
|
|
4
|
+
<div @click="open=true" class="shower" :style="{'background-color':modelValue||'#ffffff'}"></div>
|
|
5
|
+
<r-modal v-model="open" maxWidth="260px" :closebtn="false" closable>
|
|
6
|
+
<picker :color="modelValue" @changeColor="emit"></picker>
|
|
7
|
+
<div class="d-flex h-space-between">
|
|
8
|
+
<r-btn class="color-success flex-grow-1 me-1" @click.prevent="close()">
|
|
9
|
+
<r-icon v-html="$r.icons.check" exact></r-icon>
|
|
10
|
+
</r-btn>
|
|
11
|
+
<r-btn class=" color-error flex-grow-1 ms-1" @click.prevent="clear()" exact>
|
|
12
|
+
<r-icon v-html="$r.icons.delete"></r-icon>
|
|
13
|
+
</r-btn>
|
|
14
|
+
</div>
|
|
15
|
+
</r-modal>
|
|
16
|
+
</r-input>
|
|
9
17
|
</template>
|
|
10
18
|
<script>
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
name: 'r-color-picker',
|
|
14
|
-
components: {Picker},
|
|
15
|
-
props: {
|
|
16
|
-
modelValue: String,
|
|
17
|
-
format:{type:String,default:'rgba'}
|
|
18
|
-
},
|
|
19
|
-
data() {
|
|
20
|
-
return {
|
|
21
|
-
open:false
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
methods: {
|
|
25
|
-
close() {
|
|
26
|
-
this.open = false
|
|
27
|
-
this.$emit('close', true)
|
|
28
|
-
},
|
|
29
|
-
emit(e) {
|
|
30
|
-
let r = e.hex
|
|
31
|
-
if (this.format === 'rgba') {
|
|
32
|
-
r = e.rgba
|
|
33
|
-
}
|
|
34
|
-
this.$emit('update:model-value', r)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
19
|
+
import Picker from "./picker";
|
|
37
20
|
|
|
21
|
+
export default {
|
|
22
|
+
name: 'r-color-picker',
|
|
23
|
+
components: {Picker},
|
|
24
|
+
props: {
|
|
25
|
+
modelValue: String,
|
|
26
|
+
format: {type: String, default: 'rgba'}
|
|
27
|
+
},
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
open: false
|
|
38
31
|
}
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
clear() {
|
|
35
|
+
this.open = false
|
|
36
|
+
this.$emit('update:model-value', null)
|
|
37
|
+
this.$emit('close', true)
|
|
38
|
+
},
|
|
39
|
+
close() {
|
|
40
|
+
this.open = false
|
|
41
|
+
this.$emit('close', true)
|
|
42
|
+
},
|
|
43
|
+
emit(e) {
|
|
44
|
+
let r = e.hex
|
|
45
|
+
if (this.format === 'rgba') {
|
|
46
|
+
r = e.rgba
|
|
47
|
+
}
|
|
48
|
+
this.$emit('update:model-value', r)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
39
53
|
</script>
|
|
40
54
|
<style lang="scss">
|
|
41
|
-
|
|
55
|
+
@import "../../../style/include";
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
.shower{
|
|
57
|
+
.#{$prefix}color-picker {
|
|
58
|
+
.shower {
|
|
45
59
|
width: 100%;
|
|
46
60
|
height: 30px;
|
|
47
61
|
cursor: pointer;
|
|
62
|
+
border: 1px solid black;
|
|
63
|
+
}
|
|
48
64
|
}
|
|
49
|
-
|
|
50
|
-
</style>
|
|
65
|
+
</style>
|