kui-vue 3.2.10 → 3.2.11
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/number.js +177 -0
- package/components/_tool/utils.js +9 -3
- package/components/base/input.jsx +82 -54
- package/components/base/pop.jsx +22 -8
- package/components/button/button.jsx +1 -1
- package/components/button/styles/index.less +6 -2
- package/components/checkbox/checkbox.jsx +6 -11
- package/components/checkbox/demo/check-all.md +6 -6
- package/components/checkbox/group.jsx +0 -1
- package/components/checkbox/styles/index.less +17 -11
- package/components/divider/styles/index.less +1 -1
- package/components/dropdown/demo/rightmenu.md +2 -2
- package/components/dropdown/styles/index.less +23 -34
- package/components/form/demo/base.md +7 -1
- package/components/form/demo/valid.md +13 -4
- package/components/form/styles/index.less +1 -5
- package/components/icon/demo/base.md +2 -2
- package/components/icon/demo/search.vue +31 -14
- package/components/icon/icon.jsx +3 -1
- package/components/icon/styles/index.less +1 -1
- package/components/index.js +2 -0
- package/components/input/demo/icon.md +2 -2
- package/components/input/demo/size.md +3 -3
- package/components/input/demo/suffix.md +13 -6
- package/components/input/demo/theme.md +11 -6
- package/components/input/index.md +2 -1
- package/components/input/input.jsx +5 -0
- package/components/input/styles/index.less +52 -63
- package/components/inputNumber/demo/base.md +34 -0
- package/components/inputNumber/demo/ffix.md +27 -0
- package/components/inputNumber/demo/format.md +80 -0
- package/components/inputNumber/demo/index.vue +23 -0
- package/components/inputNumber/demo/info.md +7 -0
- package/components/inputNumber/demo/size.md +18 -0
- package/components/inputNumber/index.js +2 -0
- package/components/inputNumber/index.md +16 -0
- package/components/inputNumber/inputNumber.jsx +169 -0
- package/components/inputNumber/styles/index.less +172 -0
- package/components/menu/demo/collapsed.md +1 -1
- package/components/menu/styles/dropmenu.less +2 -2
- package/components/menu/styles/index.less +31 -14
- package/components/message/demo/icon.md +33 -0
- package/components/message/demo/index.vue +2 -0
- package/components/message/index.md +9 -7
- package/components/message/inner.jsx +5 -3
- package/components/modal/modal.jsx +31 -31
- package/components/notice/demo/icon.md +27 -11
- package/components/notice/demo/index.vue +2 -0
- package/components/notice/demo/types.md +28 -0
- package/components/notice/index.js +3 -0
- package/components/notice/index.md +8 -6
- package/components/popconfirm/styles/index.less +64 -83
- package/components/poptip/demo/base.md +7 -0
- package/components/poptip/demo/placement.md +12 -13
- package/components/poptip/styles/index.less +60 -79
- package/components/progress/demo/circle.md +2 -2
- package/components/radio/button.jsx +4 -2
- package/components/radio/demo/button.md +32 -28
- package/components/radio/group.jsx +4 -2
- package/components/radio/radio.jsx +7 -7
- package/components/radio/styles/index.less +61 -29
- package/components/rate/demo/base.md +7 -1
- package/components/rate/rate.jsx +8 -3
- package/components/rate/star.jsx +4 -3
- package/components/rate/styles/index.less +5 -3
- package/components/select/select.jsx +2 -0
- package/components/skeleton/demo/custom.md +62 -0
- package/components/skeleton/demo/index.vue +2 -0
- package/components/skeleton/demo/items.md +6 -2
- package/components/skeleton/index.md +32 -12
- package/components/skeleton/skeleton.jsx +1 -3
- package/components/skeleton/skeletonAvatar.jsx +33 -7
- package/components/skeleton/skeletonButton.jsx +29 -4
- package/components/skeleton/skeletonImage.jsx +43 -6
- package/components/skeleton/skeletonText.jsx +29 -4
- package/components/slider/demo/base.md +7 -15
- package/components/slider/demo/formatter.md +19 -0
- package/components/slider/demo/index.vue +10 -1
- package/components/slider/demo/marks.md +42 -0
- package/components/slider/demo/reverse.md +26 -0
- package/components/slider/demo/vertical.md +26 -3
- package/components/slider/demo/withNumber.md +43 -0
- package/components/slider/index.md +15 -6
- package/components/slider/slider.jsx +173 -41
- package/components/slider/styles/index.less +109 -44
- package/components/slider/thumb.jsx +165 -0
- package/components/space/demo/align.md +22 -21
- package/components/space/demo/base.md +0 -1
- package/components/space/demo/index.vue +2 -0
- package/components/space/demo/size.md +34 -22
- package/components/space/demo/vertical.md +1 -1
- package/components/space/demo/wrap.md +12 -0
- package/components/space/index.md +6 -5
- package/components/space/space.jsx +40 -35
- package/components/space/styles/index.less +15 -0
- package/components/spin/demo/mode.md +6 -4
- package/components/spin/spin.jsx +1 -1
- package/components/styles/index.less +1 -0
- package/components/switch/demo/loading.md +1 -1
- package/components/switch/demo/text.md +3 -1
- package/components/switch/styles/index.less +31 -20
- package/components/table/styles/index.less +9 -10
- package/components/tooltip/styles/index.less +103 -76
- package/components/tooltip/tooltip.jsx +3 -0
- package/components/upload/styles/index.less +7 -0
- package/components/upload/upload.jsx +22 -12
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @desc 解决浮动运算问题,避免小数点后产生多位数和计算精度损失。
|
|
3
|
+
* 问题示例:2.3 + 2.4 = 4.699999999999999,1.0 - 0.9 = 0.09999999999999998
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 把错误的数据转正
|
|
8
|
+
* strip(0.09999999999999998)=0.1
|
|
9
|
+
*/
|
|
10
|
+
function strip(num, precision = 15) {
|
|
11
|
+
return +parseFloat(Number(num).toPrecision(precision));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Return digits length of a number
|
|
16
|
+
* @param {*number} num Input number
|
|
17
|
+
*/
|
|
18
|
+
function digitLength(num) {
|
|
19
|
+
// Get digit length of e
|
|
20
|
+
const eSplit = num.toString().split(/[eE]/);
|
|
21
|
+
const len = (eSplit[0].split('.')[1] || '').length - +(eSplit[1] || 0);
|
|
22
|
+
return len > 0 ? len : 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 把小数转成整数,支持科学计数法。如果是小数则放大成整数
|
|
27
|
+
* @param {*number} num 输入数
|
|
28
|
+
*/
|
|
29
|
+
function float2Fixed(num) {
|
|
30
|
+
if (num.toString().indexOf('e') === -1) {
|
|
31
|
+
return Number(num.toString().replace('.', ''));
|
|
32
|
+
}
|
|
33
|
+
const dLen = digitLength(num);
|
|
34
|
+
return dLen > 0 ? strip(Number(num) * Math.pow(10, dLen)) : Number(num);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 检测数字是否越界,如果越界给出提示
|
|
39
|
+
* @param {*number} num 输入数
|
|
40
|
+
*/
|
|
41
|
+
function checkBoundary(num) {
|
|
42
|
+
if (_boundaryCheckingState) {
|
|
43
|
+
if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
|
|
44
|
+
console.warn(`${num} is beyond boundary when transfer to integer, the results may not be accurate`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function toNumber(num) {
|
|
49
|
+
if (num && num.length > 16) {
|
|
50
|
+
return num
|
|
51
|
+
}
|
|
52
|
+
return strip(num)
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 迭代操作
|
|
56
|
+
*/
|
|
57
|
+
function iteratorOperation(arr, operation) {
|
|
58
|
+
const [num1, num2, ...others] = arr;
|
|
59
|
+
let res = operation(num1, num2);
|
|
60
|
+
|
|
61
|
+
others.forEach((num) => {
|
|
62
|
+
res = operation(res, num);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return res;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 精确乘法
|
|
70
|
+
*/
|
|
71
|
+
function times(...nums) {
|
|
72
|
+
if (nums.length > 2) {
|
|
73
|
+
return iteratorOperation(nums, times);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const [num1, num2] = nums;
|
|
77
|
+
const num1Changed = float2Fixed(num1);
|
|
78
|
+
const num2Changed = float2Fixed(num2);
|
|
79
|
+
const baseNum = digitLength(num1) + digitLength(num2);
|
|
80
|
+
const leftValue = num1Changed * num2Changed;
|
|
81
|
+
|
|
82
|
+
// checkBoundary(leftValue);
|
|
83
|
+
|
|
84
|
+
return leftValue / Math.pow(10, baseNum);
|
|
85
|
+
}
|
|
86
|
+
function getMaxDigit(...nums) {
|
|
87
|
+
const [num1, num2] = nums;
|
|
88
|
+
return Math.max(digitLength(num1), digitLength(num2))
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 精确加法
|
|
92
|
+
*/
|
|
93
|
+
function plus(...nums) {
|
|
94
|
+
if (nums.length > 2) {
|
|
95
|
+
return iteratorOperation(nums, plus);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const [num1, num2] = nums;
|
|
99
|
+
let maxdigit = getMaxDigit(...nums)
|
|
100
|
+
|
|
101
|
+
// 取最大的小数位
|
|
102
|
+
// const baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
|
|
103
|
+
const baseNum = Math.pow(10, maxdigit)
|
|
104
|
+
|
|
105
|
+
// console.log(baseNum)
|
|
106
|
+
// 把小数都转为整数然后再计算
|
|
107
|
+
let s = Math.min(baseNum, 100)
|
|
108
|
+
let res = ((times(num1, baseNum) + times(num2, baseNum)) / baseNum).toFixed(maxdigit);
|
|
109
|
+
return toNumber(res)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 精确减法
|
|
114
|
+
*/
|
|
115
|
+
function minus(...nums) {
|
|
116
|
+
if (nums.length > 2) {
|
|
117
|
+
return iteratorOperation(nums, minus);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const [num1, num2] = nums;
|
|
121
|
+
let maxdigit = getMaxDigit(...nums)
|
|
122
|
+
// const baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
|
|
123
|
+
const baseNum = Math.pow(10, maxdigit)
|
|
124
|
+
let res = ((times(num1, baseNum) - times(num2, baseNum)) / baseNum).toFixed(maxdigit)
|
|
125
|
+
return toNumber(res)
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 精确除法
|
|
131
|
+
*/
|
|
132
|
+
function divide(...nums) {
|
|
133
|
+
if (nums.length > 2) {
|
|
134
|
+
return iteratorOperation(nums, divide);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const [num1, num2] = nums;
|
|
138
|
+
const num1Changed = float2Fixed(num1);
|
|
139
|
+
const num2Changed = float2Fixed(num2);
|
|
140
|
+
// checkBoundary(num1Changed);
|
|
141
|
+
// checkBoundary(num2Changed);
|
|
142
|
+
// fix: 类似 10 ** -4 为 0.00009999999999999999,strip 修正
|
|
143
|
+
return times(num1Changed / num2Changed, strip(Math.pow(10, digitLength(num2) - digitLength(num1))));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 四舍五入
|
|
148
|
+
*/
|
|
149
|
+
function round(num, ratio) {
|
|
150
|
+
const base = Math.pow(10, ratio);
|
|
151
|
+
let result = divide(Math.round(Math.abs(times(num, base))), base);
|
|
152
|
+
if (num < 0 && result !== 0) {
|
|
153
|
+
result = times(result, -1);
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
let _boundaryCheckingState = true;
|
|
159
|
+
/**
|
|
160
|
+
* 是否进行边界检查,默认开启
|
|
161
|
+
* @param flag 标记开关,true 为开启,false 为关闭,默认为 true
|
|
162
|
+
*/
|
|
163
|
+
function enableBoundaryChecking(flag = true) {
|
|
164
|
+
_boundaryCheckingState = flag;
|
|
165
|
+
}
|
|
166
|
+
export { strip, plus, minus, toNumber, getMaxDigit, times, divide, round, digitLength, float2Fixed, enableBoundaryChecking };
|
|
167
|
+
// export default {
|
|
168
|
+
// strip,
|
|
169
|
+
// plus,
|
|
170
|
+
// minus,
|
|
171
|
+
// times,
|
|
172
|
+
// divide,
|
|
173
|
+
// round,
|
|
174
|
+
// digitLength,
|
|
175
|
+
// float2Fixed,
|
|
176
|
+
// enableBoundaryChecking,
|
|
177
|
+
// };
|
|
@@ -133,12 +133,13 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
133
133
|
//底部
|
|
134
134
|
let showInBottom = clientHeight - selectionRect.bottom > pickerHeight
|
|
135
135
|
//上面
|
|
136
|
-
let showInTop =
|
|
136
|
+
let showInTop = selectionRect.top > pickerHeight
|
|
137
137
|
//左边
|
|
138
|
-
let showInLeft =
|
|
138
|
+
let showInLeft = selectionRect.left > pickerWidth
|
|
139
139
|
//右边
|
|
140
140
|
let showInRight = clientWidth - selectionRect.right > pickerWidth
|
|
141
141
|
|
|
142
|
+
// console.log(showInRight, selectionRect.left > pickerWidth, selectionRect.right, pickerWidth)
|
|
142
143
|
|
|
143
144
|
// console.log(placement, 'showInTop:', showInTop, 'showInBottom:', showInBottom, clientHeight, scrollTop, selectionRect.top, pickerHeight)
|
|
144
145
|
|
|
@@ -151,7 +152,8 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
151
152
|
if ((hasBottom && showInBottom) || (hasTop && !showInTop)) { //正常在底部显示
|
|
152
153
|
if (transfer) {
|
|
153
154
|
top = selectionRect.bottom + offset + scrollTop;
|
|
154
|
-
left =
|
|
155
|
+
left = selectionRect.left + scrollLeft
|
|
156
|
+
// left = showInRight ? selectionRect.left + scrollLeft : selectionRect.right - pickerWidth + scrollLeft
|
|
155
157
|
if (placement == 'bottom' || placement == 'top') {
|
|
156
158
|
left = selectionRect.left - (pickerWidth - selectionRect.width) / 2 + scrollLeft
|
|
157
159
|
}
|
|
@@ -161,8 +163,12 @@ export function getPosition(selection, picker, transfer, placement = 'bottom-lef
|
|
|
161
163
|
if (hasTop) {
|
|
162
164
|
placement = placement.replace('top', 'bottom')
|
|
163
165
|
}
|
|
166
|
+
if (!showInRight && showInLeft) {
|
|
167
|
+
left = selectionRect.right - pickerWidth + scrollLeft
|
|
168
|
+
}
|
|
164
169
|
if (!showInRight) {
|
|
165
170
|
placement = placement.replace('left', 'right') //右边放不下去
|
|
171
|
+
// left = selectionRect.right - pickerWidth + scrollLeft
|
|
166
172
|
}
|
|
167
173
|
} else {
|
|
168
174
|
top = selectionRect.height + offset;
|
|
@@ -22,8 +22,11 @@ export default {
|
|
|
22
22
|
},
|
|
23
23
|
icon: String,
|
|
24
24
|
suffix: String,
|
|
25
|
+
prefix: String,
|
|
25
26
|
theme: String,
|
|
26
|
-
shape: String
|
|
27
|
+
shape: String,
|
|
28
|
+
formatter: Function,
|
|
29
|
+
parser: Function
|
|
27
30
|
},
|
|
28
31
|
data() {
|
|
29
32
|
return {
|
|
@@ -53,7 +56,7 @@ export default {
|
|
|
53
56
|
},
|
|
54
57
|
methods: {
|
|
55
58
|
clear() {
|
|
56
|
-
this.setValue(
|
|
59
|
+
this.setValue({ input: '', output: '' })
|
|
57
60
|
this.$nextTick(e => this.$refs.input.focus())
|
|
58
61
|
},
|
|
59
62
|
iconClick() {
|
|
@@ -65,108 +68,133 @@ export default {
|
|
|
65
68
|
intput && intput.$emit('focus', e)
|
|
66
69
|
},
|
|
67
70
|
handleBlur(e) {
|
|
68
|
-
this.isFocus = false
|
|
69
71
|
let intput = this.Input || this.TextArea
|
|
72
|
+
// console.log('base blur')
|
|
73
|
+
this.$emit('blur', e);
|
|
70
74
|
intput && intput.$emit('blur', e)
|
|
75
|
+
this.isFocus = false
|
|
71
76
|
},
|
|
72
77
|
handleInput(e) {
|
|
73
|
-
|
|
78
|
+
let v = e.target.value + '', input = v, output = v + '';
|
|
79
|
+
let { parser, formatter } = this
|
|
80
|
+
|
|
81
|
+
if (parser) {
|
|
82
|
+
output = parser(v)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// console.log('output', output)
|
|
86
|
+
|
|
87
|
+
if (output !== '' && formatter) {
|
|
88
|
+
input = formatter(output)
|
|
89
|
+
// e.target.value = v
|
|
90
|
+
}
|
|
91
|
+
// console.log('res', input, output)
|
|
92
|
+
e.target.value = input
|
|
93
|
+
if (input === '') {
|
|
94
|
+
output = ''
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// e.target.value = e.target.value.replace(/\D/g, '')
|
|
98
|
+
this.setValue({ input, output })
|
|
74
99
|
},
|
|
75
100
|
showPassword() {
|
|
101
|
+
if (this.disabled) return;
|
|
76
102
|
let type = this.isPassword ? 'text' : 'password'
|
|
77
103
|
this.isPassword = !this.isPassword
|
|
78
104
|
this.$refs.input.type = type
|
|
79
105
|
},
|
|
80
|
-
setValue(
|
|
81
|
-
this.currentValue =
|
|
82
|
-
this.$emit('input',
|
|
83
|
-
this.$emit('change',
|
|
106
|
+
setValue({ input, output }) {
|
|
107
|
+
this.currentValue = input
|
|
108
|
+
this.$emit('input', output)
|
|
109
|
+
this.$emit('change', output)
|
|
84
110
|
},
|
|
111
|
+
|
|
85
112
|
searchEvent() {
|
|
113
|
+
if (this.disabled) return;
|
|
86
114
|
this.$listeners.search(this.currentValue)
|
|
87
115
|
},
|
|
88
116
|
getSuffix() {
|
|
89
|
-
let { $listeners } = this
|
|
90
|
-
const Search = ('search' in $listeners)
|
|
91
|
-
|
|
117
|
+
let { $listeners, suffix } = this
|
|
118
|
+
const Search = ('search' in $listeners) ? <Icon type='search' class="k-input-icon-search" onClick={this.searchEvent} /> : null
|
|
119
|
+
|
|
92
120
|
const Password = (this.type == 'password') ? <Icon type={!this.isPassword ? 'eye-outline' : 'eye-off-outline'} onClick={this.showPassword} /> : null
|
|
93
121
|
|
|
94
|
-
return Password || Search || this.$slots.suffix ||
|
|
122
|
+
return Password || Search || this.$slots.suffix || (suffix ? <div class="k-input-suffix">{suffix}</div> : null)
|
|
95
123
|
},
|
|
96
|
-
getTextInput(
|
|
124
|
+
getTextInput(mult) {
|
|
97
125
|
const { disabled, size, type, inputType, currentValue, id, theme, shape } = this
|
|
98
126
|
let isTextArea = inputType == 'textarea'
|
|
99
|
-
// console.log(this.props)
|
|
100
127
|
const props = {
|
|
101
128
|
domProps: {
|
|
102
129
|
value: currentValue
|
|
103
130
|
},
|
|
104
131
|
class: [
|
|
105
|
-
`k-${inputType}`,
|
|
106
132
|
{
|
|
133
|
+
[`k-${inputType}`]: !mult,
|
|
134
|
+
[`k-${inputType}-text`]: mult,
|
|
107
135
|
[`k-${inputType}-disabled`]: disabled,
|
|
108
|
-
[
|
|
109
|
-
[
|
|
110
|
-
[`k
|
|
111
|
-
|
|
136
|
+
[`k-${inputType}-sm`]: size == 'small' && !isTextArea && !mult,
|
|
137
|
+
[`k-${inputType}-lg`]: size == 'large' && !isTextArea && !mult,
|
|
138
|
+
[`k-${inputType}-${theme}`]: theme != 'solid' && !mult,
|
|
139
|
+
[`k-${inputType}-circle`]: shape == 'circle' && !isTextArea && !mult,
|
|
112
140
|
}
|
|
113
141
|
],
|
|
114
142
|
ref: 'input',
|
|
115
|
-
attrs: {
|
|
143
|
+
attrs: {
|
|
144
|
+
...this.$attrs, disabled, id
|
|
145
|
+
},
|
|
116
146
|
on: {
|
|
117
147
|
...this.$listeners,
|
|
118
148
|
focus: this.handleFocus,
|
|
119
149
|
blur: this.handleBlur,
|
|
120
150
|
input: this.handleInput
|
|
121
151
|
}
|
|
122
|
-
|
|
123
152
|
}
|
|
153
|
+
|
|
124
154
|
if (!isTextArea) {
|
|
125
155
|
props.attrs.type = type
|
|
126
|
-
// delete props.rows
|
|
127
156
|
}
|
|
128
|
-
return isTextArea ? <textarea {...props} /> : <input {...props} />
|
|
157
|
+
return isTextArea ? <textarea {...props} /> : <input {...props} single />
|
|
129
158
|
},
|
|
130
159
|
},
|
|
131
160
|
render() {
|
|
132
|
-
const { inputType, icon, $slots, size, type, $listeners, clearable, suffix, theme, shape } = this
|
|
161
|
+
const { inputType, icon, $slots, size, disabled, type, $listeners, clearable, suffix, theme, prefix, shape } = this
|
|
133
162
|
|
|
134
163
|
let isTextArea = inputType == 'textarea'
|
|
135
|
-
let
|
|
164
|
+
let mult = icon || ('search' in $listeners) || $slots.suffix || suffix || $slots.prefix || prefix || type == 'password' || clearable
|
|
136
165
|
|
|
137
|
-
let textInput = this.getTextInput(
|
|
166
|
+
let textInput = this.getTextInput(mult)
|
|
138
167
|
|
|
139
|
-
if (isTextArea || !
|
|
168
|
+
if (isTextArea || !mult)
|
|
140
169
|
return textInput
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
[`k-input-${theme}`]: theme != 'solid',
|
|
155
|
-
'k-input-circle': shape == 'circle' && !isTextArea,
|
|
156
|
-
}
|
|
157
|
-
],
|
|
158
|
-
on: {
|
|
159
|
-
mouseenter: () => this.isEnter = true,
|
|
160
|
-
mouseleave: () => this.isEnter = false
|
|
170
|
+
|
|
171
|
+
let { isFocus, isEnter, currentValue } = this
|
|
172
|
+
let clearableShow = clearable && (isFocus || isEnter) && isNotEmpty(currentValue)
|
|
173
|
+
const props = {
|
|
174
|
+
class: [
|
|
175
|
+
`k-${inputType}`,
|
|
176
|
+
{
|
|
177
|
+
[`k-${inputType}-focus`]: isFocus,
|
|
178
|
+
[`k-${inputType}-disabled`]: disabled,
|
|
179
|
+
[`k-${inputType}-sm`]: size == 'small',
|
|
180
|
+
[`k-${inputType}-lg`]: size == 'large',
|
|
181
|
+
[`k-${inputType}-${theme}`]: theme && theme != 'solid',
|
|
182
|
+
[`k-${inputType}-circle`]: shape == 'circle' && !isTextArea,
|
|
161
183
|
}
|
|
184
|
+
],
|
|
185
|
+
on: {
|
|
186
|
+
mouseenter: () => this.isEnter = true,
|
|
187
|
+
mouseleave: () => this.isEnter = false
|
|
162
188
|
}
|
|
163
|
-
const suffixNode = this.getSuffix()
|
|
164
|
-
return <div {...props}>
|
|
165
|
-
{icon ? <Icon type={icon} class="k-input-icon" onClick={this.iconClick} /> : null}
|
|
166
|
-
{textInput}
|
|
167
|
-
{clearableShow ? <Icon type="close-circle" class="k-input-clearable" onClick={this.clear} /> : null}
|
|
168
|
-
{suffixNode ? <div class="k-input-suffix">{suffixNode}</div> : null}
|
|
169
|
-
</div>
|
|
170
189
|
}
|
|
190
|
+
const suffixNode = this.getSuffix()
|
|
191
|
+
const prefixNode = $slots.prefix || (prefix ? <div class={`k-${inputType}-prefix`}>{prefix}</div> : null)
|
|
192
|
+
return <div {...props} mult>
|
|
193
|
+
{icon ? <Icon type={icon} class={`k-${inputType}-icon`} onClick={this.iconClick} /> : null}
|
|
194
|
+
{prefixNode ? prefixNode : null}
|
|
195
|
+
{textInput}
|
|
196
|
+
{clearableShow ? <Icon type="close-circle" class={`k-${inputType}-clearable`} onClick={this.clear} /> : null}
|
|
197
|
+
{suffixNode ? suffixNode : null}
|
|
198
|
+
</div >
|
|
171
199
|
}
|
|
172
200
|
};
|
package/components/base/pop.jsx
CHANGED
|
@@ -27,7 +27,8 @@ export default {
|
|
|
27
27
|
},
|
|
28
28
|
okText: String,
|
|
29
29
|
cancelText: String,
|
|
30
|
-
updateKey: [String, Object, Array]
|
|
30
|
+
updateKey: [String, Object, Array],
|
|
31
|
+
show: Boolean
|
|
31
32
|
},
|
|
32
33
|
data() {
|
|
33
34
|
return {
|
|
@@ -54,8 +55,9 @@ export default {
|
|
|
54
55
|
this.$emit("cancel");
|
|
55
56
|
},
|
|
56
57
|
toggle(value) {
|
|
57
|
-
this.
|
|
58
|
-
this
|
|
58
|
+
let show = this.show || value
|
|
59
|
+
this.opened = show
|
|
60
|
+
this.$emit('input', show)
|
|
59
61
|
},
|
|
60
62
|
mouseEnter(e) {
|
|
61
63
|
clearTimeout(this.timer)
|
|
@@ -101,6 +103,7 @@ export default {
|
|
|
101
103
|
let { placement, trigger, title, preCls, $slots, transfer, color, updateKey } = this, childNode;
|
|
102
104
|
|
|
103
105
|
title = title || getChild($slots.title)
|
|
106
|
+
// console.log(title)
|
|
104
107
|
let okText = this.okText || t('k.pop.ok')
|
|
105
108
|
let cancelText = this.cancelText || t('k.pop.cancel')
|
|
106
109
|
if (this.showPlacementArrow) {
|
|
@@ -113,13 +116,20 @@ export default {
|
|
|
113
116
|
<Button type="primary" size="small" onClick={this.ok}>{okText}</Button>
|
|
114
117
|
</div>
|
|
115
118
|
} else {
|
|
116
|
-
titleNode = title ? <div class={`k-${preCls}-title`}>{title}</div> : null
|
|
119
|
+
titleNode = title.length ? <div class={`k-${preCls}-title`}>{title}</div> : null
|
|
117
120
|
contentNode = $slots.content
|
|
118
121
|
}
|
|
119
|
-
contentNode = contentNode ? <div class={`k-${preCls}-
|
|
122
|
+
contentNode = contentNode ? <div class={`k-${preCls}-body`}>{contentNode}</div> : null;
|
|
120
123
|
|
|
121
|
-
childNode = [
|
|
122
|
-
|
|
124
|
+
childNode = [
|
|
125
|
+
<div class={`k-${preCls}-content`} style={{ backgroundColor: /^#/.test(color) ? color : null }}>
|
|
126
|
+
{[titleNode, contentNode, footerNode]}
|
|
127
|
+
<div class={`k-${preCls}-arrow`}>
|
|
128
|
+
<svg style={{ fill: /^#/.test(color) ? color : 'currentcolor' }} viewBox="0 0 24 7">
|
|
129
|
+
<path d="M24 0V1C20 1 18.5 2 16.5 4C14.5 6 14 7 12 7C10 7 9.5 6 7.5 4C5.5 2 4 1 0 1V0H24Z"></path>
|
|
130
|
+
</svg>
|
|
131
|
+
</div>
|
|
132
|
+
</div>]
|
|
123
133
|
|
|
124
134
|
} else {
|
|
125
135
|
childNode = $slots.content
|
|
@@ -129,7 +139,11 @@ export default {
|
|
|
129
139
|
props: {
|
|
130
140
|
transfer,
|
|
131
141
|
value: this.opened,
|
|
132
|
-
className: [`k-${preCls}
|
|
142
|
+
className: [`k-${preCls}`, {
|
|
143
|
+
[`k-${preCls}-${color}`]: color && !/^#/.test(color),
|
|
144
|
+
[`k-${preCls}-has-color`]: /^#/.test(color),
|
|
145
|
+
[`k-${preCls}-has-arrow`]: this.showPlacementArrow
|
|
146
|
+
}],
|
|
133
147
|
width: this.width,
|
|
134
148
|
selection: this.selection,
|
|
135
149
|
placement,
|
|
@@ -191,8 +191,9 @@
|
|
|
191
191
|
|
|
192
192
|
.k-btn-group {
|
|
193
193
|
position: relative;
|
|
194
|
-
display: inline-
|
|
195
|
-
vertical-align: middle;
|
|
194
|
+
display: inline-flex;
|
|
195
|
+
// vertical-align: middle;
|
|
196
|
+
align-items: center;
|
|
196
197
|
white-space: nowrap;
|
|
197
198
|
.k-btn {
|
|
198
199
|
margin-left: -1px;
|
|
@@ -266,6 +267,9 @@
|
|
|
266
267
|
background: var(--kui-color-disable-back);
|
|
267
268
|
border-color: var(--kui-color-disable-border);
|
|
268
269
|
}
|
|
270
|
+
&.k-btn-normal {
|
|
271
|
+
background: 0 0;
|
|
272
|
+
}
|
|
269
273
|
}
|
|
270
274
|
|
|
271
275
|
.k-btn-primary[disabled='disabled'] {
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
disabled: Boolean,
|
|
8
8
|
label: { type: [String, Number] },
|
|
9
9
|
indeterminate: Boolean,
|
|
10
|
-
checked: [Boolean, Number]
|
|
10
|
+
checked: [Boolean, Number],
|
|
11
11
|
},
|
|
12
12
|
model: {
|
|
13
13
|
prop: 'checked',
|
|
@@ -50,23 +50,18 @@ export default {
|
|
|
50
50
|
checked = isChecked
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
const wpclasses = ["k-checkbox-wrapper", {
|
|
53
|
+
const wpclasses = ["k-checkbox", {
|
|
55
54
|
["k-checkbox-disabled"]: disabled,
|
|
56
55
|
["k-checkbox-checked"]: checked && !indeterminate,
|
|
56
|
+
["k-checkbox-indeterminate"]: indeterminate
|
|
57
57
|
}]
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
["k-checkbox-indeterminate"]: indeterminate
|
|
63
|
-
}
|
|
64
|
-
];
|
|
65
|
-
let inner = checked ? <Icon type="checkmark" /> : null
|
|
59
|
+
|
|
60
|
+
let inner = checked ? <Icon type="checkmark-outline" strokeWidth={60} /> : null
|
|
66
61
|
const labelNode = label || $slots.default
|
|
67
62
|
return (
|
|
68
63
|
<label class={wpclasses} onClick={e => e.stopPropagation()}>
|
|
69
|
-
<span class=
|
|
64
|
+
<span class="k-checkbox-symbol">
|
|
70
65
|
<input type="checkbox" class="k-checkbox-input" checked={checked} disabled={disabled} onChange={change} />
|
|
71
66
|
<span class="k-checkbox-inner">{inner}</span>
|
|
72
67
|
</span>
|
|
@@ -30,14 +30,14 @@ export default {
|
|
|
30
30
|
methods: {
|
|
31
31
|
handelCheckAll(e) {
|
|
32
32
|
let checked = e.target.checked
|
|
33
|
-
this.cities = checked ?
|
|
34
|
-
|
|
35
|
-
let length = this.cities.length
|
|
36
|
-
this.indeterminate = length > 0 && length< this.options.length
|
|
33
|
+
this.cities = checked ? this.options.map(v=>v.value) : [];
|
|
34
|
+
this.indeterminate = !checked && !this.options.length
|
|
37
35
|
},
|
|
38
36
|
change(data) {
|
|
39
|
-
|
|
40
|
-
this.indeterminate =
|
|
37
|
+
let length = this.cities.length
|
|
38
|
+
this.indeterminate = length > 0 && length < this.options.length
|
|
39
|
+
|
|
40
|
+
this.checkAll = length == this.options.length
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
};
|