kui-vue 3.3.12 → 3.4.1
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/transfer.js +5 -5
- package/components/_tool/utils.js +0 -135
- package/components/base/drop.jsx +230 -17
- package/components/base/pop.jsx +1 -1
- package/components/button/styles/index.less +1 -0
- package/components/checkbox/styles/index.less +7 -3
- package/components/colorPicker/colorpicker.jsx +4 -3
- package/components/colorPicker/styles/index.less +16 -25
- package/components/datePicker/datepicker.jsx +5 -2
- package/components/datePicker/index.md +0 -1
- package/components/datePicker/styles/datepicker.less +1 -0
- package/components/drawer/demo/form.md +4 -2
- package/components/drawer/styles/index.less +9 -2
- package/components/dropdown/index.md +0 -1
- package/components/dropdown/styles/index.less +4 -0
- package/components/form/demo/align.md +1 -1
- package/components/form/demo/base.md +1 -1
- package/components/form/demo/dynamicvalid.md +1 -1
- package/components/form/demo/length.md +2 -2
- package/components/form/demo/valid.md +2 -2
- package/components/input/styles/index.less +29 -20
- package/components/inputNumber/styles/index.less +3 -3
- package/components/menu/demo/inline.md +4 -4
- package/components/menu/styles/index.less +1 -1
- package/components/popconfirm/index.md +0 -1
- package/components/popconfirm/styles/index.less +4 -2
- package/components/poptip/demo/closeinside.md +1 -1
- package/components/poptip/index.md +1 -2
- package/components/poptip/styles/index.less +10 -5
- package/components/radio/styles/index.less +22 -3
- package/components/rate/styles/index.less +9 -1
- package/components/select/demo/base.md +1 -1
- package/components/select/demo/multiple.md +1 -1
- package/components/select/demo/theme.md +11 -13
- package/components/select/index.md +0 -1
- package/components/select/select.jsx +64 -34
- package/components/select/styles/index.less +144 -128
- package/components/styles/color.less +17 -12
- package/components/styles/var.less +7 -0
- package/components/table/demo/edit.md +34 -12
- package/components/table/styles/index.less +87 -38
- package/components/table/table.jsx +1 -1
- package/components/tooltip/index.md +1 -4
- package/components/tooltip/styles/index.less +8 -4
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.js +2 -2
- package/package.json +2 -2
- /package/{README.md → readme.md} +0 -0
|
@@ -46,7 +46,8 @@ export default {
|
|
|
46
46
|
currentValue: this.value || '',
|
|
47
47
|
showSearch: false,
|
|
48
48
|
queryKey: '',
|
|
49
|
-
selectWidth: this.width
|
|
49
|
+
selectWidth: this.width,
|
|
50
|
+
isFocus: false
|
|
50
51
|
};
|
|
51
52
|
},
|
|
52
53
|
watch: {
|
|
@@ -62,7 +63,7 @@ export default {
|
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
65
|
methods: {
|
|
65
|
-
|
|
66
|
+
hideDrop() {
|
|
66
67
|
if (this.showSearch) {
|
|
67
68
|
this.queryKey = ''
|
|
68
69
|
this.$refs.search.value = ''
|
|
@@ -124,16 +125,21 @@ export default {
|
|
|
124
125
|
if (this.filterable || isSearch) {
|
|
125
126
|
this.showSearch = this.opened
|
|
126
127
|
if (this.opened) {
|
|
127
|
-
this.$nextTick(e =>
|
|
128
|
+
this.$nextTick(e => {
|
|
129
|
+
this.isFocus = true
|
|
130
|
+
this.$refs.search.focus()
|
|
131
|
+
})
|
|
128
132
|
} else {
|
|
129
133
|
this.$refs.search.blur()
|
|
134
|
+
this.isFocus = false
|
|
135
|
+
|
|
130
136
|
setTimeout(() => {
|
|
131
137
|
this.queryKey = ''
|
|
132
138
|
this.$refs.search.value = ''
|
|
133
139
|
}, 200);
|
|
134
140
|
}
|
|
135
141
|
}
|
|
136
|
-
this.$nextTick(e => this.setPosition())
|
|
142
|
+
// this.$nextTick(e => this.setPosition())
|
|
137
143
|
},
|
|
138
144
|
toggleDrop() {
|
|
139
145
|
if (this.disabled) {
|
|
@@ -141,18 +147,21 @@ export default {
|
|
|
141
147
|
}
|
|
142
148
|
let isSearch = ('search' in this.$listeners)
|
|
143
149
|
if (isSearch) {
|
|
150
|
+
// this.$nextTick(e => {
|
|
151
|
+
this.showSearch = true
|
|
144
152
|
this.$nextTick(e => {
|
|
145
|
-
this.
|
|
146
|
-
this
|
|
153
|
+
this.$refs.search.focus()
|
|
154
|
+
this.isFocus = true
|
|
147
155
|
})
|
|
156
|
+
// })
|
|
148
157
|
return;
|
|
149
158
|
}
|
|
150
159
|
this.showDrops()
|
|
151
160
|
},
|
|
152
161
|
setPosition() {
|
|
153
|
-
if (!hasProp(this, 'width')) {
|
|
154
|
-
|
|
155
|
-
}
|
|
162
|
+
// if (!hasProp(this, 'width')) {
|
|
163
|
+
// this.selectWidth = this.$el.offsetWidth
|
|
164
|
+
// }
|
|
156
165
|
if (this.opened) {
|
|
157
166
|
this.$refs.overlay.setPosition()
|
|
158
167
|
}
|
|
@@ -170,7 +179,11 @@ export default {
|
|
|
170
179
|
this.opened = false
|
|
171
180
|
this.showSearch = false
|
|
172
181
|
} else if ('search' in this.$listeners || this.filterable) {
|
|
173
|
-
this.$nextTick(e =>
|
|
182
|
+
this.$nextTick(e => {
|
|
183
|
+
this.$refs.search.focus()
|
|
184
|
+
this.isFocus = true
|
|
185
|
+
|
|
186
|
+
})
|
|
174
187
|
}
|
|
175
188
|
let hasValue = hasProp(this, 'value')
|
|
176
189
|
//set value
|
|
@@ -219,9 +232,10 @@ export default {
|
|
|
219
232
|
},
|
|
220
233
|
searchInput(e) {
|
|
221
234
|
this.queryKey = e.target.value
|
|
235
|
+
//todo:
|
|
222
236
|
this.$nextTick(k => {
|
|
223
|
-
let max = this.selectWidth - 15 - (this.showArrow ? 25 : 0)
|
|
224
|
-
e.target.style.width =
|
|
237
|
+
// let max = this.selectWidth - 15 - (this.showArrow ? 25 : 0)
|
|
238
|
+
e.target.style.width = this.$refs.mirror.offsetWidth + 'px'
|
|
225
239
|
this.setPosition()
|
|
226
240
|
})
|
|
227
241
|
if ('search' in this.$listeners) {
|
|
@@ -234,7 +248,11 @@ export default {
|
|
|
234
248
|
},
|
|
235
249
|
emptyClick(e) {
|
|
236
250
|
if (this.showSearch) {
|
|
237
|
-
this.$nextTick(e =>
|
|
251
|
+
this.$nextTick(e => {
|
|
252
|
+
this.$refs.search.focus()
|
|
253
|
+
this.isFocus = true
|
|
254
|
+
|
|
255
|
+
})
|
|
238
256
|
}
|
|
239
257
|
},
|
|
240
258
|
getOptions() {
|
|
@@ -271,7 +289,7 @@ export default {
|
|
|
271
289
|
let { disabled, size, multiple,
|
|
272
290
|
opened, placeholder, showArrow, bordered,
|
|
273
291
|
clear, removeTag, queryKey, theme, arrowIcon, icon, shape, filterable,
|
|
274
|
-
clearable, label, toggleDrop,
|
|
292
|
+
clearable, label, toggleDrop, isFocus } = this
|
|
275
293
|
let childNode = []
|
|
276
294
|
if (arrowIcon == undefined) {
|
|
277
295
|
arrowIcon = ChevronDown
|
|
@@ -287,6 +305,9 @@ export default {
|
|
|
287
305
|
"k-select-light": theme == 'light',
|
|
288
306
|
"k-select-has-icon": !!icon,
|
|
289
307
|
"k-select-circle": shape == 'circle' && !multiple,
|
|
308
|
+
"k-select-multiple": multiple,
|
|
309
|
+
"k-select-show-search": isFocus,
|
|
310
|
+
"k-select-show-tags": multiple && (label || []).length
|
|
290
311
|
}
|
|
291
312
|
]
|
|
292
313
|
|
|
@@ -295,6 +316,8 @@ export default {
|
|
|
295
316
|
input: this.searchInput,
|
|
296
317
|
blur: () => {
|
|
297
318
|
if (!this.opened) this.showSearch = false
|
|
319
|
+
this.isFocus = false
|
|
320
|
+
|
|
298
321
|
}
|
|
299
322
|
},
|
|
300
323
|
ref: 'search',
|
|
@@ -317,16 +340,19 @@ export default {
|
|
|
317
340
|
width: this.selectWidth,
|
|
318
341
|
value: opened,
|
|
319
342
|
selection: this.$el,
|
|
320
|
-
|
|
321
|
-
|
|
343
|
+
transfer: true,
|
|
344
|
+
extendWidth: true,
|
|
322
345
|
transitionName: 'k-select',
|
|
323
346
|
className: ['k-select-dropdown', { 'k-select-dropdown-multiple': this.multiple, 'k-select-dropdown-sm': size == 'small' }]
|
|
324
347
|
},
|
|
325
348
|
on: {
|
|
349
|
+
input: e => {
|
|
350
|
+
this.opened = e
|
|
351
|
+
},
|
|
326
352
|
hide: () => {
|
|
327
353
|
this.opened = false
|
|
328
354
|
setTimeout(() => {
|
|
329
|
-
this.
|
|
355
|
+
this.hideDrop()
|
|
330
356
|
}, 300)
|
|
331
357
|
}
|
|
332
358
|
}
|
|
@@ -346,40 +372,44 @@ export default {
|
|
|
346
372
|
: null
|
|
347
373
|
|
|
348
374
|
const labelStyle = {
|
|
349
|
-
opacity: this.showSearch ? .4 : 1,
|
|
375
|
+
// opacity: this.showSearch ? .4 : 1,
|
|
350
376
|
display: queryKey.length ? 'none' : ''
|
|
351
377
|
}
|
|
352
|
-
const labelsNode = (multiple
|
|
378
|
+
const labelsNode = ((multiple)
|
|
353
379
|
? (
|
|
354
|
-
<
|
|
380
|
+
[<div class="k-select-labels" name="k-select-tag">{tags}{queryNode}</div>]
|
|
355
381
|
)
|
|
356
|
-
: <div class="k-select-label" style={labelStyle}>{label}</div>
|
|
382
|
+
: (label.length ? <div class="k-select-label" style={labelStyle}>{label}</div> : null)
|
|
357
383
|
)
|
|
358
384
|
let isSearch = ('search' in this.$listeners)
|
|
359
385
|
childNode.push(labelsNode);
|
|
360
386
|
placeNode && childNode.push(placeNode);
|
|
361
387
|
|
|
362
|
-
(!isSearch && showArrow) && childNode.push(<Icon class="k-select-arrow" type={arrowIcon} />)
|
|
363
388
|
|
|
364
389
|
if ((filterable || isSearch) && !multiple) {
|
|
365
390
|
childNode.push(queryNode)
|
|
366
391
|
}
|
|
367
|
-
|
|
392
|
+
// label = "1"
|
|
368
393
|
const styles = { width: `${this.width}px` }
|
|
369
394
|
let showClear = !disabled && clearable && isNotEmpty(label) && label.length > 0
|
|
370
|
-
const selectCls = [
|
|
371
|
-
"k-select-selection", {
|
|
372
|
-
"k-select-has-clear": showClear,
|
|
373
|
-
}
|
|
374
|
-
]
|
|
375
|
-
showClear && childNode.push(<Icon class="k-select-clearable" type={CloseCircle} onClick={clear} />)
|
|
376
395
|
|
|
396
|
+
classes[1]['k-select-has-clear'] = showClear
|
|
397
|
+
const iconNodes = []
|
|
398
|
+
|
|
399
|
+
if (!isSearch && showArrow) {
|
|
400
|
+
iconNodes.push(<Icon class="k-select-arrow" type={arrowIcon} />)
|
|
401
|
+
}
|
|
402
|
+
if (showClear) {
|
|
403
|
+
iconNodes.push(<Icon class="k-select-clearable" type={CloseCircle} onClick={clear} />)
|
|
404
|
+
}
|
|
405
|
+
console.log(iconNodes)
|
|
406
|
+
|
|
407
|
+
iconNodes.push(" ")
|
|
377
408
|
return (
|
|
378
|
-
<div tabIndex="0" class={classes} style={styles}>
|
|
379
|
-
<
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
</div>
|
|
409
|
+
<div tabIndex="0" class={classes} style={styles} onClick={toggleDrop} ref="rel">
|
|
410
|
+
{icon ? <Icon type={icon} class="k-select-icon" /> : null}
|
|
411
|
+
<div class="k-select-selection">{childNode}</div>
|
|
412
|
+
{iconNodes}
|
|
383
413
|
{overlay}
|
|
384
414
|
</div >
|
|
385
415
|
)
|