kui-vue 3.2.5 → 3.2.7
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/components/_tool/directives.js +3 -1
- package/components/_tool/docClick.js +3 -1
- package/components/_tool/outsiteclick.js +1 -2
- package/components/_tool/resize.js +2 -3
- package/components/_tool/scroll.js +2 -3
- package/components/_tool/transfer.js +3 -1
- package/components/_tool/utils.js +9 -3
- package/components/affix/affix.jsx +21 -8
- package/components/avatar/styles/index.less +1 -1
- package/components/base/drop.jsx +3 -3
- package/components/base/pop.jsx +7 -4
- package/components/bin/index.js +2 -0
- package/components/button/styles/index.less +7 -6
- package/components/colorPicker/colorpicker.jsx +27 -15
- package/components/colorPicker/demo/base.md +1 -1
- package/components/colorPicker/demo/index.vue +2 -0
- package/components/colorPicker/demo/shape.md +33 -0
- package/components/colorPicker/index.md +10 -7
- package/components/colorPicker/styles/index.less +30 -13
- package/components/datePicker/datecalendar.jsx +149 -83
- package/components/datePicker/datepicker.jsx +11 -7
- package/components/datePicker/demo/base.md +2 -0
- package/components/datePicker/demo/index.vue +2 -0
- package/components/datePicker/demo/inside.md +76 -0
- package/components/datePicker/demo/size.md +3 -3
- package/components/datePicker/index.js +2 -1
- package/components/datePicker/index.md +1 -0
- package/components/datePicker/styles/calendar.less +149 -49
- package/components/datePicker/styles/datepicker.less +3 -3
- package/components/drawer/demo/base.md +2 -2
- package/components/drawer/demo/custom.md +2 -2
- package/components/drawer/demo/form.md +1 -1
- package/components/drawer/demo/target.md +14 -3
- package/components/drawer/drawer.jsx +11 -10
- package/components/drawer/index.md +1 -1
- package/components/drawer/styles/animal.less +2 -1
- package/components/drawer/styles/index.less +26 -10
- package/components/dropdown/dropdown.jsx +0 -1
- package/components/empty/empty.jsx +2 -1
- package/components/form/form.jsx +1 -1
- package/components/icon/demo/search.vue +4 -4
- package/components/icon/index.md +1 -1
- package/components/image/preview.jsx +10 -8
- package/components/index.js +12 -4
- package/components/input/demo/size.md +3 -3
- package/components/input/styles/index.less +5 -5
- package/components/locale/index.js +74 -0
- package/components/locale/lang/de.js +55 -0
- package/components/locale/lang/el.js +72 -0
- package/components/locale/lang/en.js +55 -0
- package/components/locale/lang/fr.js +72 -0
- package/components/locale/lang/it.js +72 -0
- package/components/locale/lang/ja.js +72 -0
- package/components/locale/lang/ko.js +72 -0
- package/components/locale/lang/ru.js +55 -0
- package/components/locale/lang/th.js +72 -0
- package/components/locale/lang/ua.js +55 -0
- package/components/locale/lang/vi.js +55 -0
- package/components/locale/lang/zh-CN.js +55 -0
- package/components/locale/lang/zh-TW.js +55 -0
- package/components/message/styles/index.less +4 -3
- package/components/modal/demo/custom.md +1 -1
- package/components/modal/index.js +8 -6
- package/components/modal/modal.jsx +42 -37
- package/components/page/page.jsx +4 -3
- package/components/page/styles/index.less +13 -13
- package/components/popconfirm/popconfirm.jsx +2 -2
- package/components/select/demo/filterable.md +6 -14
- package/components/select/demo/search.md +6 -4
- package/components/select/index.md +20 -19
- package/components/select/select.jsx +7 -4
- package/components/select/styles/index.less +13 -3
- package/components/slider/slider.jsx +6 -4
- package/components/space/space.jsx +2 -2
- package/components/styles/color.less +2 -2
- package/components/table/extend.jsx +1 -1
- package/components/table/index.md +4 -3
- package/components/table/table.jsx +4 -3
- package/components/tabs/tabs.jsx +3 -3
- package/components/timeline/demo/base.md +3 -3
- package/components/timeline/demo/icon.md +5 -5
- package/components/timeline/demo/mode.md +12 -6
- package/components/timeline/index.md +7 -6
- package/components/timeline/styles/index.less +40 -13
- package/components/timeline/timeline.jsx +5 -1
- package/components/timeline/timelineitem.jsx +9 -5
- package/components/treeselect/treeselect.vue +36 -35
- package/components/upload/index.md +1 -1
- package/components/upload/styles/index.less +1 -1
- package/components/upload/upload.jsx +5 -4
- package/dist/k-ui.css +7 -1
- package/dist/k-ui.js +2 -2
- package/dist/locale/de.js +8 -0
- package/dist/locale/el.js +8 -0
- package/dist/locale/en.js +8 -0
- package/dist/locale/fr.js +8 -0
- package/dist/locale/it.js +8 -0
- package/dist/locale/ja.js +8 -0
- package/dist/locale/ko.js +8 -0
- package/dist/locale/ru.js +8 -0
- package/dist/locale/th.js +8 -0
- package/dist/locale/ua.js +8 -0
- package/dist/locale/vi.js +8 -0
- package/dist/locale/zhCN.js +8 -0
- package/dist/locale/zhTW.js +8 -0
- package/package.json +4 -3
- package/readme.md +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
const SSR = Vue.prototype.$isServer
|
|
1
3
|
export default {
|
|
2
4
|
inserted(el, { value }, vnode) {
|
|
3
5
|
let transfer = el.getAttribute ? el.getAttribute('data-transfer') : el.dataset.transfer
|
|
4
|
-
if (transfer === 'true') {
|
|
6
|
+
if (!SSR && transfer === 'true') {
|
|
5
7
|
const parentNode = el.parentNode
|
|
6
8
|
if (!parentNode) return false;
|
|
7
9
|
let empty = document.createComment('')
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
const SSR = Vue.prototype.$isServer
|
|
1
3
|
export default {
|
|
2
4
|
bind(el, binding) {
|
|
3
5
|
let docClick = (e) => {
|
|
@@ -9,7 +11,7 @@ export default {
|
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
el._docClick = docClick
|
|
12
|
-
document.addEventListener('click', docClick)
|
|
14
|
+
!SSR && document.addEventListener('click', docClick)
|
|
13
15
|
},
|
|
14
16
|
unbind(el, bind) {
|
|
15
17
|
document.removeEventListener('click', el._docClick)
|
|
@@ -2,13 +2,12 @@ import Vue from 'vue';
|
|
|
2
2
|
const SSR = Vue.prototype.$isServer
|
|
3
3
|
export default {
|
|
4
4
|
bind(el, { value }) {
|
|
5
|
-
if (SSR)
|
|
6
|
-
if (typeof value == 'function') {
|
|
5
|
+
if (typeof value == 'function' && !SSR) {
|
|
7
6
|
window.addEventListener('resize', value)
|
|
8
7
|
}
|
|
9
8
|
},
|
|
10
9
|
unbind(el, { value }) {
|
|
11
|
-
if (typeof value == 'function')
|
|
10
|
+
if (typeof value == 'function' && !SSR)
|
|
12
11
|
window.removeEventListener('resize', value)
|
|
13
12
|
}
|
|
14
13
|
}
|
|
@@ -2,13 +2,12 @@ import Vue from 'vue';
|
|
|
2
2
|
const SSR = Vue.prototype.$isServer
|
|
3
3
|
export default {
|
|
4
4
|
bind(el, { value }) {
|
|
5
|
-
if (SSR)
|
|
6
|
-
if (typeof value == 'function') {
|
|
5
|
+
if (typeof value == 'function' && !SSR) {
|
|
7
6
|
window.addEventListener('scroll', value)
|
|
8
7
|
}
|
|
9
8
|
},
|
|
10
9
|
unbind(el, { value }) {
|
|
11
|
-
if (typeof value == 'function')
|
|
10
|
+
if (typeof value == 'function' && !SSR)
|
|
12
11
|
window.removeEventListener('scroll', value)
|
|
13
12
|
}
|
|
14
13
|
}
|
|
@@ -146,12 +146,12 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
146
146
|
let hasTop = placement.slice(0, 3) == 'top'
|
|
147
147
|
let hasLeft = placement.slice(0, 4) == 'left'
|
|
148
148
|
let hasRight = placement.slice(0, 5) == 'right'
|
|
149
|
-
|
|
149
|
+
// debugger
|
|
150
150
|
if (hasBottom || hasTop) {
|
|
151
151
|
if ((hasBottom && showInBottom) || (hasTop && !showInTop)) { //正常在底部显示
|
|
152
152
|
if (transfer) {
|
|
153
153
|
top = selectionRect.bottom + offset + scrollTop;
|
|
154
|
-
left = selectionRect.left + scrollLeft
|
|
154
|
+
left = showInRight ? selectionRect.left + scrollLeft : selectionRect.right - pickerWidth + scrollLeft
|
|
155
155
|
if (placement == 'bottom' || placement == 'top') {
|
|
156
156
|
left = selectionRect.left - (pickerWidth - selectionRect.width) / 2 + scrollLeft
|
|
157
157
|
}
|
|
@@ -161,13 +161,16 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
161
161
|
if (hasTop) {
|
|
162
162
|
placement = placement.replace('top', 'bottom')
|
|
163
163
|
}
|
|
164
|
+
if (!showInRight) {
|
|
165
|
+
placement = placement.replace('left', 'right') //右边放不下去
|
|
166
|
+
}
|
|
164
167
|
} else {
|
|
165
168
|
top = selectionRect.height + offset;
|
|
166
169
|
left = 0;
|
|
167
170
|
}
|
|
168
171
|
} else if ((hasBottom && !showInBottom) || (hasTop && showInTop)) {
|
|
169
172
|
if (transfer) {
|
|
170
|
-
left = selectionRect.left + scrollLeft
|
|
173
|
+
left = showInRight ? selectionRect.left + scrollLeft : selectionRect.right - pickerWidth + scrollLeft
|
|
171
174
|
top = selectionRect.top - pickerHeight - offset + scrollTop
|
|
172
175
|
if (placement == 'top' || placement == 'bottom') {
|
|
173
176
|
left = selectionRect.left - (pickerWidth - selectionRect.width) / 2 + scrollLeft
|
|
@@ -178,6 +181,9 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
178
181
|
if (hasBottom) {
|
|
179
182
|
placement = placement.replace('bottom', 'top')
|
|
180
183
|
}
|
|
184
|
+
if (!showInRight) {
|
|
185
|
+
placement = placement.replace('left', 'right')
|
|
186
|
+
}
|
|
181
187
|
} else {
|
|
182
188
|
top = -(pickerHeight + offset);
|
|
183
189
|
left = 0;
|
|
@@ -25,13 +25,15 @@ export default {
|
|
|
25
25
|
offsetTopValue: 0,
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
beforeDestory() {
|
|
29
|
+
if (this.target() == window) {
|
|
30
|
+
target.removeEventListener('scroll', this.updatePosition)
|
|
31
|
+
}
|
|
32
|
+
},
|
|
29
33
|
mounted() {
|
|
30
34
|
let target = this.target()
|
|
31
|
-
if (target) {
|
|
32
|
-
target.addEventListener('scroll',
|
|
33
|
-
this.updatePosition(e)
|
|
34
|
-
})
|
|
35
|
+
if (target && !this.$isServer) {
|
|
36
|
+
target.addEventListener('scroll', this.updatePosition)
|
|
35
37
|
}
|
|
36
38
|
},
|
|
37
39
|
methods: {
|
|
@@ -41,18 +43,29 @@ export default {
|
|
|
41
43
|
if (!$refs.blob || !target) return;
|
|
42
44
|
|
|
43
45
|
let rect = $refs.blob.getBoundingClientRect();
|
|
44
|
-
let
|
|
46
|
+
let container = (target != window && target != document) ? target.getBoundingClientRect() : { top: 0, bottom: document.documentElement.clientHeight }
|
|
45
47
|
|
|
46
48
|
let hasbottom = typeof offsetBottom == 'number' && offsetBottom >= 0
|
|
47
|
-
let fx = hasbottom ?
|
|
49
|
+
let fx = hasbottom ? container.bottom - rect.bottom >= offsetBottom : rect.top - container.top <= offsetTop
|
|
50
|
+
|
|
48
51
|
if (!fx) {
|
|
49
52
|
this.offsetTopValue = rect.top
|
|
53
|
+
if (target == window || target == document) {
|
|
54
|
+
if (this.offsetTopValue > offsetTop && !hasbottom) {
|
|
55
|
+
this.offsetTopValue = offsetTop
|
|
56
|
+
}
|
|
57
|
+
if (hasbottom && container.bottom - rect.bottom < offsetBottom) {
|
|
58
|
+
this.offsetTopValue = container.bottom - offsetBottom - rect.height
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
//todo:
|
|
62
|
+
}
|
|
50
63
|
}
|
|
51
64
|
if (this.fixed != fx) {
|
|
52
65
|
this.fixed = fx
|
|
53
|
-
this.$emit('change', this.fixed)
|
|
54
66
|
this.width = rect.width
|
|
55
67
|
this.height = rect.height
|
|
68
|
+
this.$emit('change', this.fixed)
|
|
56
69
|
}
|
|
57
70
|
}
|
|
58
71
|
},
|
package/components/base/drop.jsx
CHANGED
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
15
|
placement: String,
|
|
16
16
|
trigger: { type: String, default: "click" },
|
|
17
17
|
transitionName: { type: String, default: 'dropdown' },
|
|
18
|
-
selection:
|
|
18
|
+
selection: { validator: v => true },
|
|
19
19
|
updateKey: [String, Object, Array]
|
|
20
20
|
},
|
|
21
21
|
|
|
@@ -53,10 +53,10 @@ export default {
|
|
|
53
53
|
},
|
|
54
54
|
mounted() {
|
|
55
55
|
this.$nextTick(() => this.setPosition())
|
|
56
|
-
document.addEventListener('mousedown', this.onMouseDown)
|
|
56
|
+
!this.$isServer && document.addEventListener('mousedown', this.onMouseDown)
|
|
57
57
|
},
|
|
58
58
|
beforeDestroy() {
|
|
59
|
-
document.removeEventListener('mousedown', this.onMouseDown)
|
|
59
|
+
!this.$isServer && document.removeEventListener('mousedown', this.onMouseDown)
|
|
60
60
|
},
|
|
61
61
|
render() {
|
|
62
62
|
const props = {
|
package/components/base/pop.jsx
CHANGED
|
@@ -3,6 +3,7 @@ import Icon from "../icon";
|
|
|
3
3
|
import { getChild } from "../_tool/utils";
|
|
4
4
|
import cloneVNode from '../_tool/clone'
|
|
5
5
|
import Drop from './drop'
|
|
6
|
+
import { t } from "../locale";
|
|
6
7
|
export default {
|
|
7
8
|
name: 'BasePop',
|
|
8
9
|
props: {
|
|
@@ -24,8 +25,8 @@ export default {
|
|
|
24
25
|
},
|
|
25
26
|
default: "top"
|
|
26
27
|
},
|
|
27
|
-
okText:
|
|
28
|
-
cancelText:
|
|
28
|
+
okText: String,
|
|
29
|
+
cancelText: String,
|
|
29
30
|
updateKey: [String, Object, Array]
|
|
30
31
|
},
|
|
31
32
|
data() {
|
|
@@ -100,14 +101,16 @@ export default {
|
|
|
100
101
|
let { placement, trigger, title, preCls, $slots, transfer, color, updateKey } = this, childNode;
|
|
101
102
|
|
|
102
103
|
title = title || getChild($slots.title)
|
|
104
|
+
let okText = this.okText || t('k.pop.ok')
|
|
105
|
+
let cancelText = this.cancelText || t('k.pop.cancel')
|
|
103
106
|
if (this.showPlacementArrow) {
|
|
104
107
|
let titleNode, contentNode, footerNode;
|
|
105
108
|
if (this.confirm) {
|
|
106
109
|
contentNode = [<Icon type="help-circle" />, <div class={`k-${preCls}-title`}>{title}</div>]
|
|
107
110
|
|
|
108
111
|
footerNode = <div class={`k-${preCls}-footer`}>
|
|
109
|
-
<Button size="small" onClick={this.cancel}>{
|
|
110
|
-
<Button type="primary" size="small" onClick={this.ok}>{
|
|
112
|
+
<Button size="small" onClick={this.cancel}>{cancelText}</Button>
|
|
113
|
+
<Button type="primary" size="small" onClick={this.ok}>{okText}</Button>
|
|
111
114
|
</div>
|
|
112
115
|
} else {
|
|
113
116
|
titleNode = title ? <div class={`k-${preCls}-title`}>{title}</div> : null
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.k-btn-sm {
|
|
71
|
-
height:
|
|
72
|
-
line-height:
|
|
71
|
+
height: 24px;
|
|
72
|
+
line-height: 22px;
|
|
73
73
|
font-size: 12px;
|
|
74
74
|
padding: 0 8px;
|
|
75
75
|
[class^="k-ion"] {
|
|
@@ -222,14 +222,15 @@
|
|
|
222
222
|
|
|
223
223
|
.k-btn-icon-only.k-btn-sm {
|
|
224
224
|
padding: 0;
|
|
225
|
-
height:
|
|
226
|
-
width:
|
|
225
|
+
height: 24px;
|
|
226
|
+
width: 24px;
|
|
227
|
+
min-width: 24px;
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
.k-btn-group-sm {
|
|
230
231
|
.k-btn {
|
|
231
|
-
height:
|
|
232
|
-
line-height:
|
|
232
|
+
height: 24px;
|
|
233
|
+
line-height: 22px;
|
|
233
234
|
font-size: 12px;
|
|
234
235
|
padding: 0 8px;
|
|
235
236
|
}
|
|
@@ -24,19 +24,22 @@ export default {
|
|
|
24
24
|
return modes.indexOf(value) !== -1
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
+
shape: String,
|
|
28
|
+
icon: String,
|
|
29
|
+
showArrow: { type: Boolean, default: true },
|
|
27
30
|
defalutColors: {
|
|
28
31
|
type: Array, default: () => ['#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#03a9f4', '#00bcd4', '#009688', '#4caf50', '#8bc34a', '#cddc39', '#ffeb3b', '#ffc107', '#ff9800', '#ff5722', '#795548', '#9e9e9e', '#607d8b', '#000'],
|
|
29
32
|
validator: function (value) { return value.length <= 20 }
|
|
30
33
|
}
|
|
31
34
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
watch: {
|
|
36
|
+
value(v1) {
|
|
37
|
+
// console.log(v1, v2, this.currentColor)
|
|
38
|
+
if (v1 != this.currentColor) {
|
|
39
|
+
this.valueChange('COLOR', v1)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
40
43
|
data() {
|
|
41
44
|
return {
|
|
42
45
|
currentMode: this.mode,
|
|
@@ -95,22 +98,28 @@ export default {
|
|
|
95
98
|
case 'COLOR':
|
|
96
99
|
[this.R, this.G, this.B, this.A] = parseColor(value, 'rgba') || [0, 0, 0, 1];
|
|
97
100
|
[this.H, this.S, this.L] = rgbToHsl(this.R, this.G, this.B);
|
|
98
|
-
this.paintHelper
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
if (this.paintHelper) {
|
|
102
|
+
this.paintHelper.setHue(this.H);
|
|
103
|
+
this.updatePostion()
|
|
104
|
+
this.alphaCanvsSetHue(this.$refs.alpha)
|
|
105
|
+
}
|
|
101
106
|
break;
|
|
102
107
|
case 'HUE':
|
|
103
108
|
this.H = value;
|
|
104
109
|
[this.R, this.G, this.B] = hslToRgb(this.H, this.S, this.L);
|
|
105
|
-
this.paintHelper
|
|
106
|
-
|
|
110
|
+
if (this.paintHelper) {
|
|
111
|
+
this.paintHelper.setHue(value);
|
|
112
|
+
this.alphaCanvsSetHue(this.$refs.alpha);
|
|
113
|
+
}
|
|
107
114
|
break;
|
|
108
115
|
case 'RGB':
|
|
109
116
|
[this.R, this.G, this.B] = value;
|
|
110
117
|
[this.H, this.S, this.L] = rgbToHsl(this.R, this.G, this.B);
|
|
111
118
|
// let colors = rgbToHsl(this.R, this.G, this.B);
|
|
112
119
|
// [this.H, this.S, this.L] = colors
|
|
113
|
-
|
|
120
|
+
if (this.paintHelper) {
|
|
121
|
+
this.alphaCanvsSetHue(this.$refs.alpha)
|
|
122
|
+
}
|
|
114
123
|
break;
|
|
115
124
|
case 'ALPHA':
|
|
116
125
|
this.A = value;
|
|
@@ -404,20 +413,23 @@ export default {
|
|
|
404
413
|
|
|
405
414
|
render() {
|
|
406
415
|
let drop = this.renderDrop()
|
|
416
|
+
let { showArrow, icon } = this
|
|
407
417
|
let style = [
|
|
408
418
|
'k-color-picker',
|
|
409
419
|
{
|
|
410
420
|
'k-color-picker-disabled': this.disabled,
|
|
411
421
|
'k-color-picker-sm': this.size == 'small',
|
|
422
|
+
'k-color-picker-circle': this.shape == 'circle' && !showArrow,
|
|
412
423
|
'k-color-picker-lg': this.size == 'large'
|
|
413
424
|
},
|
|
414
425
|
]
|
|
426
|
+
|
|
415
427
|
return (<div class={style}>
|
|
416
428
|
<div class="k-color-picker-selection" onClick={this.toggleDrop}>
|
|
417
429
|
<div class="k-color-picker-color">
|
|
418
430
|
<div class="k-color-picker-color-inner" style={`background-color:${this.currentColor}`}></div>
|
|
419
431
|
</div>
|
|
420
|
-
<Icon type=
|
|
432
|
+
{showArrow && <Icon type={icon || 'chevron-down'} />}
|
|
421
433
|
</div>
|
|
422
434
|
{drop}
|
|
423
435
|
</div >)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import Info from './info'
|
|
3
3
|
import Base from './base'
|
|
4
|
+
import Shape from './shape.md'
|
|
4
5
|
import Mode from './mode.md'
|
|
5
6
|
import Size from './size.md'
|
|
6
7
|
import Colors from './colors.md'
|
|
@@ -11,6 +12,7 @@ export default {
|
|
|
11
12
|
<div>
|
|
12
13
|
<Info class="typo" />
|
|
13
14
|
<Base />
|
|
15
|
+
<Shape />
|
|
14
16
|
<Mode />
|
|
15
17
|
<Size />
|
|
16
18
|
<Colors />
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
#### 自定义
|
|
3
|
+
可通过 icon 定义图标和 shape='circle' 呈现外型
|
|
4
|
+
</cn>
|
|
5
|
+
|
|
6
|
+
```vue
|
|
7
|
+
<template>
|
|
8
|
+
<div class="demo-color-picker">
|
|
9
|
+
<Form>
|
|
10
|
+
<FormItem label="没有下拉箭头">
|
|
11
|
+
<ColorPicker showMode v-model="color1" :showArrow="false"/>
|
|
12
|
+
</FormItem>
|
|
13
|
+
<FormItem label="自定义下拉箭头">
|
|
14
|
+
<ColorPicker showMode v-model="color2" mode="rgba" icon="caret-down-outline"/>
|
|
15
|
+
</FormItem>
|
|
16
|
+
<FormItem label="圆形">
|
|
17
|
+
<ColorPicker showMode v-model="color3" mode="hsla" shape="circle" :showArrow="false"/>
|
|
18
|
+
</FormItem>
|
|
19
|
+
</Form>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
color1: '#f44336',
|
|
27
|
+
color2: '#9c27b0',
|
|
28
|
+
color3: '#03a9f4',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
```
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
### API
|
|
2
|
-
| 属性
|
|
3
|
-
|
|
4
|
-
| value | 当前激活的面板的 `name`,可以使用 `v-model` 双向绑定
|
|
5
|
-
| mode | 颜色展示类型,提供3种模式(`hex` 、 `rgba` 、`hsla`)
|
|
6
|
-
| default-colors | 自定义颜色盘,最多20种
|
|
7
|
-
| show-mode | 是否展示颜色模式
|
|
8
|
-
|
|
|
2
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
3
|
+
| -------------- | ---------------------------------------------------- | -------- | ------ |
|
|
4
|
+
| value | 当前激活的面板的 `name`,可以使用 `v-model` 双向绑定 | String | - |
|
|
5
|
+
| mode | 颜色展示类型,提供3种模式(`hex` 、 `rgba` 、`hsla`) | String | 'hex' |
|
|
6
|
+
| default-colors | 自定义颜色盘,最多20种 | Array | [...] |
|
|
7
|
+
| show-mode | 是否展示颜色模式 | Boolean | false |
|
|
8
|
+
| show-arrow | 是否展示下拉箭头 | Boolean | true |
|
|
9
|
+
| icon | 自定义下拉箭头 | Boolean | true |
|
|
10
|
+
| shape | shape='circle' 呈现圆形 | String | - |
|
|
11
|
+
| change | 颜色值改变的时候触发,返回颜色的值 | Function | - |
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
@import '../../styles/var.less';
|
|
2
2
|
.k-color-picker {
|
|
3
|
-
width: 55px;
|
|
3
|
+
// width: 55px;
|
|
4
4
|
height: 30px;
|
|
5
5
|
border: 1px solid var(--kui-color-border);
|
|
6
6
|
border-radius: var(--kui-border-radius);
|
|
7
7
|
position: relative;
|
|
8
8
|
display: inline-block;
|
|
9
|
+
.k-color-picker-selection {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
padding: 2px;
|
|
13
|
+
}
|
|
9
14
|
.k-color-picker-color {
|
|
10
15
|
height: 26px;
|
|
11
16
|
width: 26px;
|
|
12
17
|
border-radius: var(--kui-border-radius);
|
|
13
|
-
margin: 2px;
|
|
18
|
+
// margin: 2px;
|
|
14
19
|
overflow: hidden;
|
|
15
20
|
background-image: linear-gradient(-45deg, #cdcdcd 25%, transparent 0), linear-gradient(45deg, #cdcdcd 25%, transparent 0), linear-gradient(-45deg, transparent 75%, #cdcdcd 0), linear-gradient(45deg, transparent 75%, #cdcdcd 0);
|
|
16
21
|
background-size: 11px 11px;
|
|
@@ -21,10 +26,11 @@
|
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
28
|
.k-icon {
|
|
24
|
-
position: absolute;
|
|
25
|
-
right: 5px;
|
|
26
|
-
top: 50%;
|
|
27
|
-
transform: translateY(-50%);
|
|
29
|
+
// position: absolute;
|
|
30
|
+
// right: 5px;
|
|
31
|
+
// top: 50%;
|
|
32
|
+
// transform: translateY(-50%);
|
|
33
|
+
margin: 0 5px;
|
|
28
34
|
font-size: 16px;
|
|
29
35
|
color: var(--kui-color-icon);
|
|
30
36
|
}
|
|
@@ -41,7 +47,7 @@
|
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
.k-color-picker-lg {
|
|
44
|
-
width: 70px;
|
|
50
|
+
// width: 70px;
|
|
45
51
|
height: 40px;
|
|
46
52
|
.k-color-picker-color {
|
|
47
53
|
width: 35.5px;
|
|
@@ -53,11 +59,14 @@
|
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
.k-color-picker-sm {
|
|
56
|
-
width: 45px;
|
|
57
|
-
height:
|
|
62
|
+
// width: 45px;
|
|
63
|
+
height: 22px;
|
|
64
|
+
.k-color-picker-selection {
|
|
65
|
+
padding: 3px;
|
|
66
|
+
}
|
|
58
67
|
.k-color-picker-color {
|
|
59
|
-
width:
|
|
60
|
-
height:
|
|
68
|
+
width: 16px;
|
|
69
|
+
height: 16px;
|
|
61
70
|
}
|
|
62
71
|
.k-icon {
|
|
63
72
|
font-size: 14px;
|
|
@@ -71,13 +80,14 @@
|
|
|
71
80
|
position: absolute;
|
|
72
81
|
border-radius: var(--kui-border-radius);
|
|
73
82
|
background: var(--kui-color-back);
|
|
83
|
+
z-index: 1001;
|
|
74
84
|
.k-color-picker-paint-dot {
|
|
75
85
|
width: 15px;
|
|
76
86
|
height: 15px;
|
|
77
87
|
display: block;
|
|
78
88
|
position: absolute;
|
|
79
89
|
background: var(--kui-color-back);
|
|
80
|
-
border:1px solid var(--kui-color-border);
|
|
90
|
+
border: 1px solid var(--kui-color-border);
|
|
81
91
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
|
82
92
|
border-radius: 50%;
|
|
83
93
|
top: 10px;
|
|
@@ -128,7 +138,7 @@
|
|
|
128
138
|
display: block;
|
|
129
139
|
position: absolute;
|
|
130
140
|
background: var(--kui-color-back);
|
|
131
|
-
border:1px solid
|
|
141
|
+
border: 1px solid var(--kui-color-border);
|
|
132
142
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
|
133
143
|
border-radius: 50%;
|
|
134
144
|
pointer-events: none;
|
|
@@ -208,6 +218,13 @@
|
|
|
208
218
|
}
|
|
209
219
|
}
|
|
210
220
|
|
|
221
|
+
.k-color-picker-circle {
|
|
222
|
+
border-radius: 50%;
|
|
223
|
+
.k-color-picker-color {
|
|
224
|
+
border-radius: 50%;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
211
228
|
@keyframes dropDownIn {
|
|
212
229
|
0% {
|
|
213
230
|
opacity: 0;
|