kui-vue 3.2.10-rc2 → 3.2.11-rc2

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.
Files changed (61) hide show
  1. package/components/_tool/number.js +177 -0
  2. package/components/base/input.jsx +82 -54
  3. package/components/base/pop.jsx +5 -3
  4. package/components/button/styles/index.less +3 -2
  5. package/components/checkbox/demo/check-all.md +1 -0
  6. package/components/form/demo/base.md +6 -0
  7. package/components/form/demo/valid.md +13 -4
  8. package/components/form/styles/index.less +1 -5
  9. package/components/icon/demo/search.vue +31 -14
  10. package/components/icon/icon.jsx +3 -1
  11. package/components/icon/styles/index.less +1 -1
  12. package/components/index.js +2 -0
  13. package/components/input/demo/icon.md +2 -2
  14. package/components/input/demo/size.md +3 -3
  15. package/components/input/demo/suffix.md +13 -6
  16. package/components/input/index.md +2 -1
  17. package/components/input/input.jsx +5 -0
  18. package/components/input/styles/index.less +52 -63
  19. package/components/inputNumber/demo/base.md +34 -0
  20. package/components/inputNumber/demo/ffix.md +27 -0
  21. package/components/inputNumber/demo/format.md +80 -0
  22. package/components/inputNumber/demo/index.vue +23 -0
  23. package/components/inputNumber/demo/info.md +7 -0
  24. package/components/inputNumber/demo/size.md +18 -0
  25. package/components/inputNumber/index.js +2 -0
  26. package/components/inputNumber/index.md +16 -0
  27. package/components/inputNumber/inputNumber.jsx +169 -0
  28. package/components/inputNumber/styles/index.less +172 -0
  29. package/components/radio/styles/index.less +4 -2
  30. package/components/skeleton/demo/items.md +6 -2
  31. package/components/skeleton/index.md +32 -12
  32. package/components/skeleton/skeletonAvatar.jsx +11 -4
  33. package/components/skeleton/skeletonButton.jsx +8 -2
  34. package/components/skeleton/skeletonImage.jsx +22 -4
  35. package/components/skeleton/skeletonText.jsx +8 -2
  36. package/components/slider/demo/base.md +7 -15
  37. package/components/slider/demo/formatter.md +19 -0
  38. package/components/slider/demo/index.vue +10 -1
  39. package/components/slider/demo/marks.md +42 -0
  40. package/components/slider/demo/reverse.md +26 -0
  41. package/components/slider/demo/vertical.md +26 -3
  42. package/components/slider/demo/withNumber.md +43 -0
  43. package/components/slider/index.md +15 -6
  44. package/components/slider/slider.jsx +188 -38
  45. package/components/slider/styles/index.less +109 -44
  46. package/components/slider/thumb.jsx +148 -0
  47. package/components/space/demo/align.md +22 -21
  48. package/components/space/demo/base.md +0 -1
  49. package/components/space/demo/index.vue +2 -0
  50. package/components/space/demo/size.md +34 -22
  51. package/components/space/demo/vertical.md +1 -1
  52. package/components/space/demo/wrap.md +12 -0
  53. package/components/space/index.md +6 -5
  54. package/components/space/space.jsx +40 -35
  55. package/components/space/styles/index.less +15 -0
  56. package/components/styles/index.less +1 -0
  57. package/components/table/styles/index.less +9 -10
  58. package/components/tooltip/tooltip.jsx +3 -0
  59. package/dist/k-ui.css +2 -2
  60. package/dist/k-ui.js +2 -2
  61. 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
+ // };
@@ -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('', { target: { value: '' } })
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
- this.setValue(e.target.value, e)
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(value, e) {
81
- this.currentValue = value
82
- this.$emit('input', value)
83
- this.$emit('change', e)
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
- ? <Icon type='search' onClick={this.searchEvent} /> : null
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 || this.suffix
122
+ return Password || Search || this.$slots.suffix || (suffix ? <div class="k-input-suffix">{suffix}</div> : null)
95
123
  },
96
- getTextInput(hasChild) {
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
- ["k-input-sm"]: size == 'small' && !isTextArea,
109
- ["k-input-lg"]: size == 'large' && !isTextArea,
110
- [`k-input-${theme}`]: theme != 'solid' && !hasChild,
111
- 'k-input-circle': shape == 'circle' && !isTextArea,
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: { ...this.$attrs, disabled, id },
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 hasChild = icon || ('search' in $listeners) || $slots.suffix || suffix || type == 'password' || clearable
164
+ let mult = icon || ('search' in $listeners) || $slots.suffix || suffix || $slots.prefix || prefix || type == 'password' || clearable
136
165
 
137
- let textInput = this.getTextInput(hasChild)
166
+ let textInput = this.getTextInput(mult)
138
167
 
139
- if (isTextArea || !hasChild) {
168
+ if (isTextArea || !mult)
140
169
  return textInput
141
- } else {
142
- let { isFocus, isEnter, currentValue } = this
143
- let clearableShow = clearable && (isFocus || isEnter) && isNotEmpty(currentValue)
144
- let hasSuffix = ('search' in $listeners) || $slots.suffix || suffix || type == 'password'
145
- const props = {
146
- class: [
147
- 'k-input-wrapper',
148
- {
149
- 'k-input-focus': isFocus,
150
- ["k-input-has-suffix"]: hasSuffix,
151
- ["k-input-sm"]: size == 'small',
152
- ["k-input-lg"]: size == 'large',
153
- ["k-input-has-clear"]: clearable,
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
  };
@@ -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.opened = value
58
- this.$emit('input', value)
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)
@@ -191,8 +191,9 @@
191
191
 
192
192
  .k-btn-group {
193
193
  position: relative;
194
- display: inline-block;
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;
@@ -31,6 +31,7 @@ export default {
31
31
  handelCheckAll(e) {
32
32
  let checked = e.target.checked
33
33
  this.cities = checked ? this.options.map(v=>v.value) : [];
34
+ this.indeterminate = !checked && !this.options.length
34
35
  },
35
36
  change(data) {
36
37
  let length = this.cities.length
@@ -21,6 +21,9 @@
21
21
  <FormItem label="Input">
22
22
  <Input placeholder="input..."/>
23
23
  </FormItem>
24
+ <FormItem label="InputNumber">
25
+ <InputNumber placeholder="inputnumber..."/>
26
+ </FormItem>
24
27
  <FormItem label="Select">
25
28
  <Select >
26
29
  <Option value="0" label="Apple" />
@@ -28,6 +31,9 @@
28
31
  <Option value="2" label="Orange" />
29
32
  </Select>
30
33
  </FormItem>
34
+ <FormItem label="Slider">
35
+ <Slider placeholder="slider..."/>
36
+ </FormItem>
31
37
  <FormItem label="DatePicker">
32
38
  <DatePicker />
33
39
  </FormItem>
@@ -17,6 +17,9 @@
17
17
  <FormItem label="E-mail" prop="email">
18
18
  <Input clearable />
19
19
  </FormItem>
20
+ <FormItem label="Number" prop="number">
21
+ <InputNumber />
22
+ </FormItem>
20
23
  <FormItem label="Password" prop="password">
21
24
  <Input type="password" />
22
25
  </FormItem>
@@ -28,10 +31,10 @@
28
31
  </FormItem>
29
32
  <FormItem label="Captcha" prop="captcha">
30
33
  <Input >
31
- <template slot="suffix">
32
- <span v-if="time==60" @click="sendCode">获取验证码</span>
33
- <span v-else>{{time}}(s)</span>
34
- </template>
34
+ <template slot="suffix">
35
+ <Button size="small" type="primary" v-if="time==60" @click="sendCode">获取验证码</Button>
36
+ <span v-else>{{time}}(s)</span>
37
+ </template>
35
38
  </Input>
36
39
  </FormItem>
37
40
  <FormItem label="Country">
@@ -119,6 +122,7 @@ export default {
119
122
  size:'default',
120
123
  form: {
121
124
  email: '',
125
+ number:'',
122
126
  password: '',
123
127
  repassword: '',
124
128
  phone: '',
@@ -140,6 +144,10 @@ export default {
140
144
  { type: 'mail', message: '请输入有效的电子邮箱' },
141
145
  { required: true, message: '请输入电子邮箱' },
142
146
  ],
147
+ number:[
148
+ { type: 'number', message: '请输入有效的请输入数字' },
149
+ { required: true, message: '请输入数字' },
150
+ ],
143
151
  password: [
144
152
  { min: 8, max: 20, message: '密码长度请控制在8-20位之间', trigger: 'blur' },
145
153
  { required: true, message: '请输入密码' },
@@ -208,6 +216,7 @@ export default {
208
216
  captcha: '8888',
209
217
  gender: '1',
210
218
  slider:5,
219
+ number:5,
211
220
  system: '0',
212
221
  one: true,
213
222
  birthday: '1995-05-05',
@@ -71,17 +71,13 @@
71
71
  }
72
72
  }
73
73
  .k-form-item-error {
74
- .k-input, .k-textarea, .k-datepicker ,.k-input-wrapper{
74
+ .k-input, .k-textarea, .k-datepicker, .k-input-number {
75
75
  border: 1px solid var(--kui-color-danger);
76
76
  &:focus {
77
77
  border: 1px solid var(--kui-color-danger);
78
78
  box-shadow: 0 0 5px var(--kui-color-danger-30);
79
79
  }
80
80
  }
81
- .k-input-wrapper .k-input{
82
- border: none;
83
- box-shadow: none;
84
- }
85
81
  .k-select {
86
82
  .k-select-selection {
87
83
  border: 1px solid var(--kui-color-danger);
@@ -3,8 +3,16 @@
3
3
  <h3>图标快速检索</h3>
4
4
  <br />
5
5
  <Affix :offsetTop="55">
6
- <Input placeholder="输入英文关键字,搜索图标,点击图标即可复制" icon="logo-kui" v-model="key" size="large" @input="search" clearable style="width:80%;margin:0 10%;background:var(--kui-color-back);">
7
- <RadioGroup v-model="type" @change="switchIcon" slot="suffix">
6
+ <Input placeholder="输入英文关键字,搜索图标,点击图标即可复制"
7
+ icon="logo-kui"
8
+ v-model="key"
9
+ size="large"
10
+ @input="search"
11
+ clearable
12
+ style="width:80%;margin:0 10%;background:var(--kui-color-back);">
13
+ <RadioGroup v-model="type"
14
+ @change="switchIcon"
15
+ slot="suffix">
8
16
  <RadioButton value="outline">Outline</RadioButton>
9
17
  <RadioButton value="filled">Filled</RadioButton>
10
18
  </RadioGroup>
@@ -20,26 +28,32 @@
20
28
  </div>
21
29
  <br />
22
30
  <div class="icon-item">
23
- <span @click.stop="copy(x)" v-for="(x,y) in showIcons" :key="y">
24
- <!-- <Icon :type="x" /> -->
25
- <svg width="1em" height="1em">
31
+ <span @click.stop="copy(x)"
32
+ v-for="(x,y) in showIcons"
33
+ :key="y">
34
+ <Icon :type="x" />
35
+ <!-- <svg width="1em" height="1em">
26
36
  <use :xlink:href="`${sprite}#${x}`"></use>
27
- </svg>
37
+ </svg> -->
28
38
  </span>
29
39
  </div>
30
40
  </template>
31
41
  <template v-if="logo.length">
32
42
  <h3>Logos</h3>
33
43
  <div class="icon-item">
34
- <span @click.stop="copy(x)" v-for="(x,y) in logo" :key="y">
35
- <!-- <Icon :type="x" /> -->
36
- <svg width="1em" height="1em">
44
+ <span @click.stop="copy(x)"
45
+ v-for="(x,y) in logo"
46
+ :key="y">
47
+ <Icon :type="x" />
48
+ <!-- <svg width="1em"
49
+ height="1em">
37
50
  <use :xlink:href="`${sprite}#${x}`"></use>
38
- </svg>
51
+ </svg> -->
39
52
  </span>
40
53
  </div>
41
54
  </template>
42
- <h3 v-if="!showIcons.length && !logo.length" style="text-align:center;padding-bottom:50px;color:#888;">
55
+ <h3 v-if="!showIcons.length && !logo.length"
56
+ style="text-align:center;padding-bottom:50px;color:#888;">
43
57
  No results for "{{key}}"
44
58
  </h3>
45
59
  </div>
@@ -56,7 +70,10 @@
56
70
  height: 80px;
57
71
  line-height: 80px;
58
72
  color: var(--kui-color-font);
59
- float: left;
73
+ // float: left;
74
+ display: inline-flex;
75
+ align-items: center;
76
+ justify-content: center;
60
77
  font-size: 32px;
61
78
  cursor: pointer;
62
79
  transition: color 0.3s ease-in-out;
@@ -70,7 +87,7 @@
70
87
  </style>
71
88
  <script>
72
89
  import icons from 'kui-icons'
73
- import sprite from 'kui-icons/lib/sprite.svg'
90
+ // import sprite from 'kui-icons/lib/sprite.svg'
74
91
  // import icons from '../lib/kui-icons'
75
92
  // import sprite from '../lib/sprite.svg'
76
93
 
@@ -82,7 +99,7 @@ let logos = iconKeys.filter(x => /logo-/.test(x)),
82
99
  export default {
83
100
  data() {
84
101
  return {
85
- sprite,
102
+ // sprite,
86
103
  key: '',
87
104
  type: 'outline',
88
105
  logo: logos,
@@ -36,9 +36,11 @@ export default {
36
36
  const { $listeners, type, spin, color, size } = this
37
37
  const classes = ['k-icon', { 'k-load-loop': spin }];
38
38
  const styles = {
39
- fontSize: `${size}px`,
40
39
  color
41
40
  };
41
+ if (size) {
42
+ styles.fontSize = `${size}px`
43
+ }
42
44
 
43
45
  const props = {
44
46
  style: styles,
@@ -20,7 +20,7 @@
20
20
  line-height: 0;
21
21
  text-align: center;
22
22
  text-transform: none;
23
- vertical-align: -0.125em;
23
+ // vertical-align: -0.125em;
24
24
  text-rendering: optimizeLegibility;
25
25
  -webkit-font-smoothing: antialiased;
26
26
  -moz-osx-font-smoothing: grayscale;
@@ -20,6 +20,7 @@ import { Form, FormItem } from './form'
20
20
  import { Image, ImageGroup } from './image'
21
21
  import Icon from './icon'
22
22
  import { Input, TextArea } from './input'
23
+ import InputNumber from './inputNumber'
23
24
  import { Layout, Header, Footer, Content, Sider } from './layout'
24
25
  import Loading from './loading'
25
26
  import Modal from './modal'
@@ -77,6 +78,7 @@ const components = {
77
78
  Icon,
78
79
  ImageGroup,
79
80
  Input, TextArea,
81
+ InputNumber,
80
82
  Menu, MenuGroup, MenuItem, MenuDivider, SubMenu,
81
83
  Modal,
82
84
  Message,
@@ -7,8 +7,8 @@
7
7
  <template>
8
8
  <div style="width:512px;">
9
9
  <Input placeholder="User Name..." icon="person" />
10
- <Input type="password" placeholder="Password..." icon="lock-closed" />
11
- <Input placeholder="请输入关进行搜索键字..." @search="search"/>
10
+ <Input type="password" placeholder="Password..." icon="lock-closed" />
11
+ <Input placeholder="请输入关进行搜索键字..." @search="search"/>
12
12
  </div>
13
13
  </template>
14
14
  <script>
@@ -6,9 +6,9 @@
6
6
  ```vue
7
7
  <template>
8
8
  <div style="width:512px;">
9
- <Input placeholder="Large Input" size="large" icon="logo-kui" icon-align="left" clearable/>
10
- <Input placeholder="Base Input" icon="logo-kui" clearable icon-align="left"/>
11
- <Input size="small" placeholder="Small Input" icon="logo-kui" @icon-click="$Message.info('点击图标事件')" clearable icon-align="left"/>
9
+ <Input placeholder="Large Input" size="large" icon="logo-kui" clearable/>
10
+ <Input placeholder="Base Input" icon="logo-kui" clearable />
11
+ <Input size="small" placeholder="Small Input" icon="logo-kui" @icon-click="$Message.info('点击图标事件')" clearable />
12
12
  </div>
13
13
  </template>
14
14
  ```