kui-vue 3.2.5 → 3.2.6-rc
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/utils.js +9 -3
- package/components/affix/affix.jsx +20 -7
- package/components/avatar/styles/index.less +1 -1
- package/components/base/pop.jsx +7 -4
- 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 +14 -12
- package/components/datePicker/datepicker.jsx +6 -3
- package/components/datePicker/styles/datepicker.less +2 -2
- package/components/drawer/demo/custom.md +1 -1
- package/components/drawer/demo/form.md +1 -1
- package/components/drawer/drawer.jsx +5 -4
- 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 +2 -2
- package/components/icon/index.md +1 -1
- package/components/index.js +10 -2
- 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 +54 -0
- package/components/locale/lang/el.js +71 -0
- package/components/locale/lang/en.js +54 -0
- package/components/locale/lang/fr.js +71 -0
- package/components/locale/lang/it.js +71 -0
- package/components/locale/lang/ja.js +71 -0
- package/components/locale/lang/ko.js +71 -0
- package/components/locale/lang/ru.js +54 -0
- package/components/locale/lang/th.js +71 -0
- package/components/locale/lang/ua.js +54 -0
- package/components/locale/lang/vi.js +54 -0
- package/components/locale/lang/zh-CN.js +54 -0
- package/components/locale/lang/zh-TW.js +54 -0
- package/components/modal/demo/custom.md +1 -1
- package/components/modal/index.js +3 -3
- package/components/modal/modal.jsx +6 -5
- 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/styles/color.less +2 -2
- package/components/table/index.md +4 -3
- package/components/table/table.jsx +2 -1
- package/components/tabs/tabs.jsx +1 -1
- 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/upload/upload.jsx +4 -3
- 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
|
@@ -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
35
|
if (target) {
|
|
32
|
-
target.addEventListener('scroll',
|
|
33
|
-
this.updatePosition(e)
|
|
34
|
-
})
|
|
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/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;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import Button from '../button'
|
|
3
3
|
import moment from 'moment'
|
|
4
4
|
import animate from '../_tool/animate'
|
|
5
|
+
import { t } from '../locale'
|
|
5
6
|
export default {
|
|
6
7
|
name: "Calendar",
|
|
7
8
|
props: {
|
|
@@ -28,8 +29,8 @@ export default {
|
|
|
28
29
|
second: null,
|
|
29
30
|
|
|
30
31
|
monthsHead: "1.2.3.4.5.6.7.8.9.10.11.12".split("."),
|
|
31
|
-
months:
|
|
32
|
-
weeks:
|
|
32
|
+
// months: t('k.datePicker.months'), // months of panel
|
|
33
|
+
// weeks: t('k.datePicker.weeks'), // weeks
|
|
33
34
|
years: [],
|
|
34
35
|
|
|
35
36
|
};
|
|
@@ -403,7 +404,8 @@ export default {
|
|
|
403
404
|
|
|
404
405
|
showMonths = showMonths || mode == 'month'
|
|
405
406
|
showYears = showYears || mode == 'year'
|
|
406
|
-
|
|
407
|
+
let months = t('k.datePicker.months');
|
|
408
|
+
let weeks = t('k.datePicker.weeks');
|
|
407
409
|
let showArrow = true
|
|
408
410
|
//header
|
|
409
411
|
let headNode = []
|
|
@@ -411,13 +413,13 @@ export default {
|
|
|
411
413
|
headNode.push(<span class="k-calendar-prev-year-btn" onClick={this.prevYear}>«</span>)
|
|
412
414
|
if ((!showYears && !showMonths && !showTimes))
|
|
413
415
|
headNode.push(<span class="k-calendar-prev-month-btn" onClick={this.prevMonth}>‹</span>)
|
|
414
|
-
headNode.push(<span class="k-calendar-year-select" onClick={this.setShowYear}>{year}
|
|
416
|
+
headNode.push(<span class="k-calendar-year-select" onClick={this.setShowYear}>{year}{t('k.datePicker.year')}</span>)
|
|
415
417
|
if (!showYears && !showMonths) {
|
|
416
|
-
headNode.push(<span class="k-calendar-month-select" onClick={this.setShowMonth}>{month
|
|
418
|
+
headNode.push(<span class="k-calendar-month-select" onClick={this.setShowMonth}>{months[month]}</span>)
|
|
417
419
|
if (!showTimes)
|
|
418
420
|
headNode.push(<span class="k-calendar-next-month-btn" onClick={this.nextMonth}>›</span>)
|
|
419
421
|
else
|
|
420
|
-
headNode.push(<span class="k-calendar-day-select">{day}
|
|
422
|
+
headNode.push(<span class="k-calendar-day-select">{day}{t('k.datePicker.day')}</span>)
|
|
421
423
|
}
|
|
422
424
|
if (!showTimes)
|
|
423
425
|
headNode.push(<span class="k-calendar-next-year-btn" onClick={this.nextYear}>»</span>)
|
|
@@ -425,7 +427,7 @@ export default {
|
|
|
425
427
|
//body
|
|
426
428
|
const bodyNode = []
|
|
427
429
|
if (mode == 'date' || isRange) {
|
|
428
|
-
let weekNode =
|
|
430
|
+
let weekNode = weeks.map(w => <span class="k-calendar-week" key={w}>{w}</span>)
|
|
429
431
|
const getDay = (j, x) => {
|
|
430
432
|
const props = {
|
|
431
433
|
domProps: { innerHTML: j.d },
|
|
@@ -443,7 +445,7 @@ export default {
|
|
|
443
445
|
bodyNode.push(daysNode)
|
|
444
446
|
}
|
|
445
447
|
if (showMonths) {
|
|
446
|
-
const m =
|
|
448
|
+
const m = months.map((i, j) => <span key={i} class={classes(year, j, day, null, 'YYYYMM')} onClick={(e) => this.setMonth(e, j)}>{i}</span >)
|
|
447
449
|
const mouthNode = <div class="k-calendar-months">{m}</div>
|
|
448
450
|
bodyNode.push(mouthNode)
|
|
449
451
|
}
|
|
@@ -479,12 +481,12 @@ export default {
|
|
|
479
481
|
let disabled = disabledDate(new Date())
|
|
480
482
|
let time_disabled = isRange ? !(temp_left && temp_right) : (!currentValue);
|
|
481
483
|
|
|
482
|
-
!isRange && footerNode.push(<Button type="link" size='small' disabled={disabled} class="k-calendar-btn-today" onClick={this.setToday}
|
|
483
|
-
footerNode.push(<Button type="link" size="small" disabled={time_disabled} onClick={this.setShowTime}>{showTimes ? '
|
|
484
|
-
footerNode.push(<Button type="primary" size='small' disabled={time_disabled} onClick={this.setDate}
|
|
484
|
+
!isRange && footerNode.push(<Button type="link" size='small' disabled={disabled} class="k-calendar-btn-today" onClick={this.setToday}>{t('k.datePicker.now')}</Button>)
|
|
485
|
+
footerNode.push(<Button type="link" size="small" disabled={time_disabled} onClick={this.setShowTime}>{showTimes ? t('k.datePicker.selectDate') : t('k.datePicker.selectTime')}</Button>)
|
|
486
|
+
footerNode.push(<Button type="primary" size='small' disabled={time_disabled} onClick={this.setDate}>{t('k.datePicker.ok')}</Button>)
|
|
485
487
|
} else if (mode == 'date') {
|
|
486
488
|
let disabled = disabledDate(new Date())
|
|
487
|
-
footerNode.push(<Button type="link" disabled={disabled} block size='small' onClick={this.setToday}
|
|
489
|
+
footerNode.push(<Button type="link" disabled={disabled} block size='small' onClick={this.setToday}>{t('k.datePicker.today')}</Button>)
|
|
488
490
|
}
|
|
489
491
|
footerNode = footerNode.length || (isRange && this.showTime) ? <div class="k-calendar-footer">{footerNode}</div> : null
|
|
490
492
|
return (
|
|
@@ -3,7 +3,7 @@ import Icon from "../icon";
|
|
|
3
3
|
import { isNotEmpty } from '../_tool/utils'
|
|
4
4
|
import moment from 'moment'
|
|
5
5
|
import Drop from '../base/drop'
|
|
6
|
-
|
|
6
|
+
import { t } from '../locale'
|
|
7
7
|
export default {
|
|
8
8
|
name: 'DatePicker',
|
|
9
9
|
props: {
|
|
@@ -23,6 +23,7 @@ export default {
|
|
|
23
23
|
return ["small", "large", "default"].indexOf(value) >= 0;
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
+
placement: String,
|
|
26
27
|
theme: String,
|
|
27
28
|
shape: String,
|
|
28
29
|
placeholder: [String, Array],
|
|
@@ -127,6 +128,7 @@ export default {
|
|
|
127
128
|
},
|
|
128
129
|
},
|
|
129
130
|
render() {
|
|
131
|
+
// console.log(t('k.datePicker'))
|
|
130
132
|
let { currentValue, placeholder, disabled, clearable,
|
|
131
133
|
opened, size, label, transfer, bordered, theme, shape, dateIcon,
|
|
132
134
|
format, mode, disabledTime, disabledDate, showTime
|
|
@@ -140,7 +142,7 @@ export default {
|
|
|
140
142
|
console.error('Please set placeholder as array !')
|
|
141
143
|
placeholder = []
|
|
142
144
|
}
|
|
143
|
-
let p1 = placeholder[0] || '
|
|
145
|
+
let p1 = placeholder[0] || t('k.datePicker.startDate'), p2 = placeholder[1] || t('k.datePicker.endDate')
|
|
144
146
|
let v1 = label[0], v2 = label[1]
|
|
145
147
|
if (v1) {
|
|
146
148
|
childNode.push(<div class="k-datepicker-value">{v1}</div>)
|
|
@@ -154,7 +156,7 @@ export default {
|
|
|
154
156
|
childNode.push(<div class="k-datepicker-placeholder">{p2}</div>)
|
|
155
157
|
}
|
|
156
158
|
} else {
|
|
157
|
-
placeholder = placeholder || '
|
|
159
|
+
placeholder = placeholder || t('k.datePicker.placeholder')
|
|
158
160
|
if (label) {
|
|
159
161
|
childNode.push(<div class="k-datepicker-value">{label}</div>)
|
|
160
162
|
} else if (placeholder) {
|
|
@@ -199,6 +201,7 @@ export default {
|
|
|
199
201
|
transfer: transfer,
|
|
200
202
|
selection: this.$el,
|
|
201
203
|
value: this.opened,
|
|
204
|
+
placement:'bottom-left',
|
|
202
205
|
transitionName: 'k-date-picker'
|
|
203
206
|
},
|
|
204
207
|
on: {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<Radio label="bottom" value="bottom"/>
|
|
14
14
|
</RadioGroup>
|
|
15
15
|
<Button @click="show=true" >Open</Button>
|
|
16
|
-
<Drawer v-model="show" width="300" :placement="placement" title="What's your name? " cancelText="
|
|
16
|
+
<Drawer v-model="show" width="300" :placement="placement" title="What's your name? " cancelText="Cancel" okText="Ok">My name is chuchur.</Drawer>
|
|
17
17
|
</div>
|
|
18
18
|
</template>
|
|
19
19
|
<script>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<Button @click="show1=true">普通表单</Button>
|
|
10
10
|
<Button @click="show2=true">自定义</Button>
|
|
11
11
|
<Drawer v-model="show1" title="表单验证" @ok="submitForm" @cancel="resetForm" footer>
|
|
12
|
-
<Form ref="form" :model="form" :rules="rules" label-align="left">
|
|
12
|
+
<Form ref="form" :model="form" :rules="rules" label-align="left" :labelCol="{span:5}">
|
|
13
13
|
<FormItem label="Input" prop="input">
|
|
14
14
|
<Input clearable icon="home"></Input>
|
|
15
15
|
</FormItem>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Button from "../button";
|
|
2
2
|
import Icon from "../icon";
|
|
3
|
+
import { t } from "../locale";
|
|
3
4
|
import transfer from "../_tool/transfer";
|
|
4
5
|
import { measureScrollBar } from '../_tool/utils'
|
|
5
6
|
|
|
@@ -13,8 +14,8 @@ export default {
|
|
|
13
14
|
title: { default: "Title", type: String },
|
|
14
15
|
width: { default: 520, type: [Number, String] },
|
|
15
16
|
height: { default: 256, type: [Number, String] },
|
|
16
|
-
okText:
|
|
17
|
-
cancelText:
|
|
17
|
+
okText: String,
|
|
18
|
+
cancelText: String,
|
|
18
19
|
placement: { type: String, default: 'right' },
|
|
19
20
|
closable: { type: Boolean, default: true },
|
|
20
21
|
footer: { type: Boolean, default: true },
|
|
@@ -96,8 +97,8 @@ export default {
|
|
|
96
97
|
placement, cancel, $slots,
|
|
97
98
|
closable, close, } = this
|
|
98
99
|
const hasFooter = this.footer || $slots.footer
|
|
99
|
-
const canelBtn = <Button onClick={cancel}>{cancelText}</Button>
|
|
100
|
-
const okBtn = <Button type="primary" onClick={ok}>{okText}</Button>
|
|
100
|
+
const canelBtn = <Button onClick={cancel}>{cancelText || t('k.drawer.cancel')}</Button>
|
|
101
|
+
const okBtn = <Button type="primary" onClick={ok}>{okText || t('k.drawer.ok')}</Button>
|
|
101
102
|
const footNode = (
|
|
102
103
|
hasFooter ? <div class="k-drawer-footer">
|
|
103
104
|
{$slots.footer}
|