ai.touchui-vue 1.38.0 → 1.39.0
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/lib/ai.touchui-vue.common.js +337 -193
- package/lib/date-picker.js +22 -15
- package/lib/float.js +39 -9
- package/lib/import.js +19 -11
- package/lib/index.js +1 -1
- package/lib/input.js +4 -7
- package/lib/progress.js +8 -2
- package/lib/select.js +210 -96
- package/lib/theme/css/theme/B-Design.css +1 -1
- package/lib/theme/css/theme/aiplan.css +1 -1
- package/lib/theme/css/theme/aiplangd.css +1 -1
- package/lib/theme/css/theme/chbn.css +1 -1
- package/lib/theme/css/theme/default.css +1 -1
- package/lib/theme/css/theme/dt.css +1 -1
- package/lib/theme/css/theme/ecloud.css +1 -1
- package/lib/theme/css/theme/hongkong.css +1 -1
- package/lib/theme/css/theme/logistics.css +1 -1
- package/lib/theme/css/theme/narrow.css +1 -1
- package/lib/theme/css/theme/sdpf.css +1 -1
- package/lib/theme/css/theme/upc.css +1 -1
- package/lib/theme/css/theme/website.css +1 -1
- package/lib/theme/css/theme/workbench-gz.css +1 -1
- package/lib/theme/css/theme/zj.css +1 -1
- package/lib/utils/validate.js +4 -22
- package/package.json +1 -1
- package/packages/date-picker/src/.DS_Store +0 -0
- package/packages/date-picker/src/date-picker.vue +15 -9
- package/packages/float/src/main.vue +37 -7
- package/packages/import/src/import.vue +1 -1
- package/packages/input/src/input.vue +2 -5
- package/packages/progress/src/progress.vue +5 -0
- package/packages/select/src/select.vue +95 -19
- package/packages/theme/lib/css/theme/B-Design.css +1 -1
- package/packages/theme/lib/css/theme/aiplan.css +1 -1
- package/packages/theme/lib/css/theme/aiplangd.css +1 -1
- package/packages/theme/lib/css/theme/chbn.css +1 -1
- package/packages/theme/lib/css/theme/default.css +1 -1
- package/packages/theme/lib/css/theme/dt.css +1 -1
- package/packages/theme/lib/css/theme/ecloud.css +1 -1
- package/packages/theme/lib/css/theme/hongkong.css +1 -1
- package/packages/theme/lib/css/theme/logistics.css +1 -1
- package/packages/theme/lib/css/theme/narrow.css +1 -1
- package/packages/theme/lib/css/theme/sdpf.css +1 -1
- package/packages/theme/lib/css/theme/upc.css +1 -1
- package/packages/theme/lib/css/theme/website.css +1 -1
- package/packages/theme/lib/css/theme/workbench-gz.css +1 -1
- package/packages/theme/lib/css/theme/zj.css +1 -1
- package/packages/theme/src/less/element/pic.less +1 -0
- package/packages/theme/src/less/element/progress.less +1 -1
- package/packages/theme/src/less/element/select.less +8 -0
- package/src/index.js +1 -1
- package/src/utils/validate.js +4 -22
package/lib/utils/validate.js
CHANGED
|
@@ -318,11 +318,7 @@ var validate = function validate(dom) {
|
|
|
318
318
|
} else {
|
|
319
319
|
reg = new RegExp(rule);
|
|
320
320
|
if (!reg.test(value)) {
|
|
321
|
-
|
|
322
|
-
formVue.errorTip = (0, _locale.t)('to.validate.tip.custom', desc, formVue.validateTip ? '\uFF0C' + formVue.validateTip : '');
|
|
323
|
-
} else {
|
|
324
|
-
formVue.errorTip = (0, _locale.t)('to.validate.tip.customRemark', desc, formVue.validateTip ? '\uFF0C' + formVue.validateTip : '');
|
|
325
|
-
}
|
|
321
|
+
formVue.errorTip = (0, _locale.t)('to.validate.tip.custom', desc, formVue.validateTip ? '\uFF0C' + formVue.validateTip : '');
|
|
326
322
|
allPass = false;
|
|
327
323
|
setHiddenErrorNodes(formEl);
|
|
328
324
|
return 'continue';
|
|
@@ -335,12 +331,7 @@ var validate = function validate(dom) {
|
|
|
335
331
|
}
|
|
336
332
|
} else if (required) {
|
|
337
333
|
formVue.errorType = 'required';
|
|
338
|
-
|
|
339
|
-
var desc_label = desc.replace('-label', '');
|
|
340
|
-
formVue.errorTip = (0, _locale.t)('to.validate.tip.required', desc_label);
|
|
341
|
-
} else {
|
|
342
|
-
formVue.errorTip = (0, _locale.t)('to.validate.tip.requiredRemark', desc);
|
|
343
|
-
}
|
|
334
|
+
formVue.errorTip = (0, _locale.t)('to.validate.tip.required', desc);
|
|
344
335
|
allPass = false;
|
|
345
336
|
setHiddenErrorNodes(formEl);
|
|
346
337
|
return 'continue';
|
|
@@ -366,11 +357,7 @@ var validate = function validate(dom) {
|
|
|
366
357
|
} else {
|
|
367
358
|
_reg = new RegExp(rule);
|
|
368
359
|
if (!_reg.test(value)) {
|
|
369
|
-
|
|
370
|
-
showTip(formEl, (0, _locale.t)('to.validate.tip.custom', desc, formVue.validateTip ? '\uFF0C' + formVue.validateTip : ''));
|
|
371
|
-
} else {
|
|
372
|
-
showTip(formEl, (0, _locale.t)('to.validate.tip.customRemark', desc, formVue.validateTip ? '\uFF0C' + formVue.validateTip : ''));
|
|
373
|
-
}
|
|
360
|
+
showTip(formEl, (0, _locale.t)('to.validate.tip.custom', desc, formVue.validateTip ? '\uFF0C' + formVue.validateTip : ''));
|
|
374
361
|
return {
|
|
375
362
|
v: false
|
|
376
363
|
};
|
|
@@ -382,12 +369,7 @@ var validate = function validate(dom) {
|
|
|
382
369
|
return 'continue';
|
|
383
370
|
}
|
|
384
371
|
} else if (required) {
|
|
385
|
-
|
|
386
|
-
var _desc_label = desc.replace('-label', '');
|
|
387
|
-
showTip(formEl, (0, _locale.t)('to.validate.tip.required', _desc_label));
|
|
388
|
-
} else {
|
|
389
|
-
showTip(formEl, (0, _locale.t)('to.validate.tip.requiredRemark', desc));
|
|
390
|
-
}
|
|
372
|
+
showTip(formEl, (0, _locale.t)('to.validate.tip.required', desc));
|
|
391
373
|
return {
|
|
392
374
|
v: false
|
|
393
375
|
};
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -201,6 +201,12 @@ export default {
|
|
|
201
201
|
},
|
|
202
202
|
immediate: true
|
|
203
203
|
},
|
|
204
|
+
iValue: {
|
|
205
|
+
handler(val) {
|
|
206
|
+
this.$emit('change', val)
|
|
207
|
+
},
|
|
208
|
+
immediate: true
|
|
209
|
+
},
|
|
204
210
|
displayFormat: {
|
|
205
211
|
handler(fmt) {
|
|
206
212
|
this.displayFormatRegExp = new RegExp(`^${String(fmt).replace(/\-|\//g, '\\-').replace(/[a-zA-Z]/g, '\\d')}$`)
|
|
@@ -215,7 +221,7 @@ export default {
|
|
|
215
221
|
}
|
|
216
222
|
if (this.value) {
|
|
217
223
|
this.iValue = this.value
|
|
218
|
-
this.$emit('change', this.value)
|
|
224
|
+
// this.$emit('change', this.value)
|
|
219
225
|
}
|
|
220
226
|
},
|
|
221
227
|
mounted() {
|
|
@@ -228,7 +234,7 @@ export default {
|
|
|
228
234
|
},
|
|
229
235
|
handleDisplayChange(value) {
|
|
230
236
|
this.datedisplay = value
|
|
231
|
-
this.$emit('change', this.datedisplay)
|
|
237
|
+
// this.$emit('change', this.datedisplay)
|
|
232
238
|
},
|
|
233
239
|
handleDisplayBlur() {
|
|
234
240
|
setTimeout(() => {
|
|
@@ -243,7 +249,7 @@ export default {
|
|
|
243
249
|
if (!this.displayFormatRegExp.test(this.datedisplay)) {
|
|
244
250
|
this.datedisplay = this.formatDate(new Date(this.datedisplay), this.displayFormat, this.datedisplay)
|
|
245
251
|
this.iValue = this.formatDate(new Date(this.datedisplay), this.displayFormat, this.datedisplay)
|
|
246
|
-
this.$emit('change', this.iValue)
|
|
252
|
+
// this.$emit('change', this.iValue)
|
|
247
253
|
} else {
|
|
248
254
|
this.changeValue(this.getDateFromValue(this.datedisplay, this.displayFormat), this.datedisplay)
|
|
249
255
|
}
|
|
@@ -271,7 +277,7 @@ export default {
|
|
|
271
277
|
this.datedisplay = value.split(' ').length > 1 ? value.split(' ')[1] : value
|
|
272
278
|
this.iValue = value.split(' ').length > 1 ? value.split(' ')[1] : value
|
|
273
279
|
}
|
|
274
|
-
this.$emit('change', this.iValue)
|
|
280
|
+
// this.$emit('change', this.iValue)
|
|
275
281
|
} else {
|
|
276
282
|
const flag = isNaN(new Date(value).getTime()) // 判断是否可以使用 2022-05 如果不可用,则替换为 2022/05
|
|
277
283
|
if (flag) {
|
|
@@ -279,15 +285,15 @@ export default {
|
|
|
279
285
|
}
|
|
280
286
|
this.datedisplay = this.formatDate(new Date(value), this.displayFormat, oldVal)
|
|
281
287
|
this.iValue = this.formatDate(new Date(value), this.valueFormat, oldVal)
|
|
282
|
-
this.$emit('change', this.iValue)
|
|
288
|
+
// this.$emit('change', this.iValue)
|
|
283
289
|
}
|
|
284
290
|
},
|
|
285
291
|
clear() {
|
|
286
|
-
const oldVal = this.iValue // 失去焦点时原本就是空的情况不应该 change
|
|
292
|
+
// const oldVal = this.iValue // 失去焦点时原本就是空的情况不应该 change
|
|
287
293
|
this.iValue = ''
|
|
288
|
-
if (oldVal) {
|
|
289
|
-
|
|
290
|
-
}
|
|
294
|
+
// if (oldVal) {
|
|
295
|
+
// this.$emit('change', this.iValue)
|
|
296
|
+
// }
|
|
291
297
|
if (!this.$pc) {
|
|
292
298
|
this.$refs.layer.close()
|
|
293
299
|
}
|
|
@@ -88,6 +88,10 @@ export default {
|
|
|
88
88
|
dy: {
|
|
89
89
|
type: [String, Number],
|
|
90
90
|
default: 0
|
|
91
|
+
},
|
|
92
|
+
maxHeight: {
|
|
93
|
+
type: [Number, String],
|
|
94
|
+
default: ''
|
|
91
95
|
}
|
|
92
96
|
},
|
|
93
97
|
data() {
|
|
@@ -262,7 +266,7 @@ export default {
|
|
|
262
266
|
clearTimeout(timer)
|
|
263
267
|
}, 0);
|
|
264
268
|
} else if (this.link) {
|
|
265
|
-
this.$refs.content.style.height = ''
|
|
269
|
+
// this.$refs.content.style.height = '100em'
|
|
266
270
|
this.$nextTick(()=>{
|
|
267
271
|
// 宽度设置
|
|
268
272
|
if (!this.width) {
|
|
@@ -423,9 +427,35 @@ export default {
|
|
|
423
427
|
}
|
|
424
428
|
|
|
425
429
|
// 设置内容高度
|
|
430
|
+
let flag = true
|
|
431
|
+
if (this.maxHeight) {
|
|
432
|
+
let heig = this.maxHeight * this.$TouchUI.em()
|
|
433
|
+
if (useSpace > heig) {
|
|
434
|
+
flag = false
|
|
435
|
+
this.$refs.content.style.height = heig + 'px'
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (!flag) {
|
|
439
|
+
return false
|
|
440
|
+
}
|
|
426
441
|
if (useSpace < contentHeight) {
|
|
427
442
|
this.isOver = true
|
|
428
443
|
this.$refs.content.style.height = useSpace + 'px'
|
|
444
|
+
} else {
|
|
445
|
+
if (this.$refs.content.children[0] && this.$refs.content.children[0].className.includes('to-scroll')) {
|
|
446
|
+
let count = 0
|
|
447
|
+
let arr = this.$refs.content.children[0].children[0].children
|
|
448
|
+
for (let i = 0; i < arr.length; i++) {
|
|
449
|
+
count += arr[i].offsetHeight
|
|
450
|
+
}
|
|
451
|
+
if (useSpace > count) {
|
|
452
|
+
this.isOver = false
|
|
453
|
+
this.$refs.content.style.height = (count + 2) + 'px'
|
|
454
|
+
} else {
|
|
455
|
+
this.isOver = true
|
|
456
|
+
this.$refs.content.style.height = useSpace + 'px'
|
|
457
|
+
}
|
|
458
|
+
}
|
|
429
459
|
}
|
|
430
460
|
}
|
|
431
461
|
})
|
|
@@ -456,9 +486,9 @@ export default {
|
|
|
456
486
|
},
|
|
457
487
|
closeAction() {
|
|
458
488
|
// 重置 content 高度,这样下次打开的时候才好重新计算是否超过整体高度
|
|
459
|
-
if (!this.height) {
|
|
460
|
-
|
|
461
|
-
}
|
|
489
|
+
// if (!this.height) {
|
|
490
|
+
// this.$refs.content.style.height = ''
|
|
491
|
+
// }
|
|
462
492
|
this.isOver = false
|
|
463
493
|
|
|
464
494
|
// 关闭 float 后,移除事件监听
|
|
@@ -469,9 +499,9 @@ export default {
|
|
|
469
499
|
this.$emit('beforeClose')
|
|
470
500
|
this.show = false;
|
|
471
501
|
this.opened = false;
|
|
472
|
-
if (this.$refs.content && this.$refs.content.style.height !== 'auto' && (this.iposition === 'top' || this.iposition === 'bottom') && !this.height) {
|
|
473
|
-
|
|
474
|
-
}
|
|
502
|
+
// if (this.$refs.content && this.$refs.content.style.height !== 'auto' && (this.iposition === 'top' || this.iposition === 'bottom') && !this.height) {
|
|
503
|
+
// this.$refs.content.style.height = 'auto'
|
|
504
|
+
// }
|
|
475
505
|
this.$emit('closed')
|
|
476
506
|
setTimeout(() => {
|
|
477
507
|
if (this.lazy) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span class="to-button-import to-form-readonly">
|
|
3
3
|
<to-button v-if="!iconMode" ref="button" :fillet="fillet" :disabled="disabled" unfold :icon="$attrs.icon || 'import'" v-bind="$attrs" :progress="progress" @click.stop="$refs.float.toggle('button')">{{ buttonText ? buttonText : t('to.import.button') }}</to-button>
|
|
4
|
-
<to-icon v-else ref="button" link value="import" mode="none" @click.stop="$refs.float.toggle('button')"></to-icon>
|
|
4
|
+
<to-icon v-else ref="button" link value="import" mode="none" v-bind="$attrs" @click.stop="$refs.float.toggle('button')"></to-icon>
|
|
5
5
|
<to-float ref="float" :width="30" :lazy="false" :slide="$phone ? true : false" :position="$phone ? 'bottom' : 'auto'" @closed="$emit('closed')" @beforeClose="$emit('beforeClose')" @opened="$emit('opened')" @beforeOpen="$emit('beforeOpen')">
|
|
6
6
|
<to-padding>
|
|
7
7
|
<to-input ref="filename" v-model="importFileName" :fillet="fillet" v-bind="inputProps" width="full" type="text" :placeholder="t('to.import.tip.placeholder')" readonly>
|
|
@@ -386,11 +386,7 @@ export default {
|
|
|
386
386
|
if (this.desc) {
|
|
387
387
|
return this.desc;
|
|
388
388
|
} else if (this.ToFormItem && this.ToFormItem.label) {
|
|
389
|
-
|
|
390
|
-
return this.ToFormItem.label + '-label';
|
|
391
|
-
} else {
|
|
392
|
-
return this.ToFormItem.label;
|
|
393
|
-
}
|
|
389
|
+
return this.ToFormItem.label;
|
|
394
390
|
} else {
|
|
395
391
|
return ''
|
|
396
392
|
}
|
|
@@ -464,6 +460,7 @@ export default {
|
|
|
464
460
|
}
|
|
465
461
|
},
|
|
466
462
|
mounted() {
|
|
463
|
+
// console.log('input mounted')
|
|
467
464
|
if (this.$platform === 'pc') {
|
|
468
465
|
this.$el.addEventListener('mouseover', this.showClear);
|
|
469
466
|
this.$el.addEventListener('mouseout', this.hideClear);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<circle :r="offsetWidth / 2 - strokeWidth / 2" :cy="offsetWidth / 2" :cx="offsetWidth / 2" :stroke-width="strokeWidth" class="to-progressBg" stroke-linejoin="round" stroke-linecap="round" fill="none" />
|
|
6
6
|
<circle
|
|
7
7
|
class="to-progressBar"
|
|
8
|
+
:class="animation?'animation':''"
|
|
8
9
|
:r="radius"
|
|
9
10
|
:cy="offsetWidth / 2"
|
|
10
11
|
:cx="offsetWidth / 2"
|
|
@@ -116,6 +117,10 @@ export default {
|
|
|
116
117
|
barSize: {
|
|
117
118
|
type: [Number, String],
|
|
118
119
|
default: 1
|
|
120
|
+
},
|
|
121
|
+
animation: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: true
|
|
119
124
|
}
|
|
120
125
|
},
|
|
121
126
|
data() {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
>
|
|
13
13
|
</span>
|
|
14
14
|
<span v-if="$slots.prefix" class="to-selectPrefix"><slot name="prefix"></slot></span>
|
|
15
|
-
<span class="to-selectContent" :class="setContentClass" @click="click">
|
|
15
|
+
<span ref="selectContentRef" class="to-selectContent" :class="setContentClass" @click="click">
|
|
16
16
|
|
|
17
17
|
<!-- 前缀文本/图标 -->
|
|
18
18
|
<to-icon v-if="icon" v-bind="iconProps" :value="icon" mode="none" class="to-selectIcon"></to-icon>
|
|
@@ -46,18 +46,19 @@
|
|
|
46
46
|
|
|
47
47
|
<!-- 多选 -->
|
|
48
48
|
<template v-else>
|
|
49
|
-
<span v-if="
|
|
49
|
+
<span v-if="conTags.filter(item => !item.hide).length === 0 && !inputable && !filterable && !setDataFn" class="to-selectValue">{{ placeholder }}</span>
|
|
50
50
|
<span v-if="(isAll && useAllText)" v-color="allTextColor" class="to-selectValue">{{ allText }}</span>
|
|
51
51
|
<span class="to-selectTag">
|
|
52
|
-
<template v-if="
|
|
53
|
-
<template v-for="(item, index) in
|
|
54
|
-
<to-tag v-if="!item.hide" :key="index" color="fg" mode="plain" :deletable="!disabled" @delete="removeTag(item)">{{ item[iLabelText] }}</to-tag>
|
|
52
|
+
<template v-if="conTags.length > 0 && !(isAll && useAllText) || (showCount && count > 0)">
|
|
53
|
+
<template v-for="(item, index) in conTags">
|
|
54
|
+
<to-tag v-if="!item.hide" :key="index" :class="{'show-count': isNeedMin}" color="fg" mode="plain" :deletable="!disabled" @delete="removeTag(item)">{{ item[iLabelText] }}</to-tag>
|
|
55
55
|
</template>
|
|
56
|
+
<to-tag v-if="showCount && count > 0" class="tag-count" color="fg" mode="plain">+{{ count }}</to-tag>
|
|
56
57
|
</template>
|
|
57
|
-
<template v-if="!$phone || ($phone &&
|
|
58
|
-
<to-input v-if="inputable && !filterable" ref="input" v-model="multipleInputValue" :sp-chars="spChars" :readonly="$phone" prevent-focus mode="none" :placeholder="
|
|
59
|
-
<to-input v-if="filterable" ref="filter" v-model="multipleFilterValue" :sp-chars="inputable ? spChars : false" :readonly="$phone" prevent-focus mode="none" :placeholder="
|
|
60
|
-
<to-input v-if="setDataFn" ref="filter" v-model="setDataInputValue" :sp-chars="inputable ? spChars : false" prevent-focus mode="none" :placeholder="
|
|
58
|
+
<template v-if="!$phone || ($phone && conTags.length === 0)">
|
|
59
|
+
<to-input v-if="inputable && !filterable" ref="input" v-model="multipleInputValue" :sp-chars="spChars" :readonly="$phone" prevent-focus mode="none" :placeholder="conTags.filter(item => !item.hide).length > 0 ? '' : placeholder " @focus="multipleInputFocus" @blur="multipleInputBlur"></to-input>
|
|
60
|
+
<to-input v-if="filterable" ref="filter" v-model="multipleFilterValue" :sp-chars="inputable ? spChars : false" :readonly="$phone" prevent-focus mode="none" :placeholder="conTags.filter(item => !item.hide).length > 0 ? '' : placeholder " @focus="multipleFilterFocus" @blur="multipleFilterBlur"></to-input>
|
|
61
|
+
<to-input v-if="setDataFn" ref="filter" v-model="setDataInputValue" :sp-chars="inputable ? spChars : false" prevent-focus mode="none" :placeholder="conTags.filter(item => !item.hide).length > 0 ? '' : placeholder " @focus="multipleFilterFocus" @blur="multipleFilterBlur"></to-input>
|
|
61
62
|
</template>
|
|
62
63
|
</span>
|
|
63
64
|
</template>
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
不能为空
|
|
87
88
|
</template>
|
|
88
89
|
</span>
|
|
89
|
-
<to-float v-if="optionDisplay !== 'none'" ref="layer" :align="optionAlign" class="to-selectLayer" :lazy="lazy" :slide="layerSlide" :width="iOptionWidth" :position="layerPosition" @closed="layerClose" @mousedown="layerMousedown">
|
|
90
|
+
<to-float v-if="optionDisplay !== 'none'" ref="layer" :align="optionAlign" class="to-selectLayer" :lazy="lazy" :slide="layerSlide" :width="iOptionWidth" :position="layerPosition" :max-height="maxHeight" @closed="layerClose" @mousedown="layerMousedown">
|
|
90
91
|
|
|
91
92
|
<to-padding v-if="dataLoading" v-align="'center'" :value="2">
|
|
92
93
|
<to-icon value="loading"></to-icon>
|
|
@@ -485,6 +486,14 @@ export default {
|
|
|
485
486
|
valueType: {
|
|
486
487
|
type: String,
|
|
487
488
|
default: ''
|
|
489
|
+
},
|
|
490
|
+
showCount: {
|
|
491
|
+
type: Boolean,
|
|
492
|
+
default: false
|
|
493
|
+
},
|
|
494
|
+
maxHeight: {
|
|
495
|
+
type: [Number, String],
|
|
496
|
+
default: ''
|
|
488
497
|
}
|
|
489
498
|
},
|
|
490
499
|
data() {
|
|
@@ -511,7 +520,10 @@ export default {
|
|
|
511
520
|
layerPosition: 'auto',
|
|
512
521
|
disabled: this.readonly,
|
|
513
522
|
iApiHeaders: {},
|
|
514
|
-
inputing: false
|
|
523
|
+
inputing: false,
|
|
524
|
+
count: 0,
|
|
525
|
+
conTags: [],
|
|
526
|
+
isNeedMin: false
|
|
515
527
|
}
|
|
516
528
|
},
|
|
517
529
|
computed: {
|
|
@@ -655,6 +667,9 @@ export default {
|
|
|
655
667
|
} else {
|
|
656
668
|
arr.push('to-box-mode-toast')
|
|
657
669
|
}
|
|
670
|
+
// if (this.showCount) {
|
|
671
|
+
// arr.push('to-select-showCount')
|
|
672
|
+
// }
|
|
658
673
|
return arr
|
|
659
674
|
},
|
|
660
675
|
validateRequired() {
|
|
@@ -670,11 +685,7 @@ export default {
|
|
|
670
685
|
if (this.desc) {
|
|
671
686
|
return this.desc
|
|
672
687
|
} else if (this.ToFormItem && this.ToFormItem.label) {
|
|
673
|
-
|
|
674
|
-
return this.ToFormItem.label + '-label';
|
|
675
|
-
} else {
|
|
676
|
-
return this.ToFormItem.label;
|
|
677
|
-
}
|
|
688
|
+
return this.ToFormItem.label;
|
|
678
689
|
} else {
|
|
679
690
|
return ''
|
|
680
691
|
}
|
|
@@ -715,8 +726,10 @@ export default {
|
|
|
715
726
|
handler(val) {
|
|
716
727
|
if (val) {
|
|
717
728
|
this.selected = []
|
|
729
|
+
this.conTags = []
|
|
718
730
|
} else {
|
|
719
731
|
this.selected = {}
|
|
732
|
+
this.conTags = {}
|
|
720
733
|
}
|
|
721
734
|
},
|
|
722
735
|
immediate: true
|
|
@@ -769,7 +782,9 @@ export default {
|
|
|
769
782
|
} else {
|
|
770
783
|
this.$emit('change', val, this.selected)
|
|
771
784
|
}
|
|
772
|
-
|
|
785
|
+
if (this.showCount && this.multiple) {
|
|
786
|
+
this.getAllTag()
|
|
787
|
+
}
|
|
773
788
|
const detail = {
|
|
774
789
|
name: 'ToSelect',
|
|
775
790
|
value: val,
|
|
@@ -818,6 +833,11 @@ export default {
|
|
|
818
833
|
}
|
|
819
834
|
},
|
|
820
835
|
created() {
|
|
836
|
+
this.$nextTick(() => {
|
|
837
|
+
if (this.showCount && this.multiple) {
|
|
838
|
+
this.getAllTag()
|
|
839
|
+
}
|
|
840
|
+
})
|
|
821
841
|
this.iLabelText = this.labelText
|
|
822
842
|
this.iValueText = this.valueText
|
|
823
843
|
this.iResPath = this.resPath
|
|
@@ -842,6 +862,59 @@ export default {
|
|
|
842
862
|
}
|
|
843
863
|
},
|
|
844
864
|
methods: {
|
|
865
|
+
calculateTagLayout(isRecalculate = false) {
|
|
866
|
+
this.$nextTick(() => {
|
|
867
|
+
const tags = this.$el.querySelectorAll('.to-selectTag .to-tag')
|
|
868
|
+
const selectContent = this.$refs.selectContentRef
|
|
869
|
+
const gap = selectContent.scrollWidth - selectContent.clientWidth
|
|
870
|
+
if (gap > 0) {
|
|
871
|
+
this.isNeedMin = true
|
|
872
|
+
return false
|
|
873
|
+
}
|
|
874
|
+
this.isNeedMin = false
|
|
875
|
+
let firstTagTop = 0
|
|
876
|
+
if (tags.length > 1) {
|
|
877
|
+
for (let i = 0; i < tags.length; i++) {
|
|
878
|
+
if (i === 0) {
|
|
879
|
+
firstTagTop = tags[i].offsetTop
|
|
880
|
+
} else {
|
|
881
|
+
if (tags[i].offsetTop !== firstTagTop) {
|
|
882
|
+
if (!tags[i].className.includes('tag-count')) {
|
|
883
|
+
const index = isRecalculate && this.count > 0 ? (i - 1) : i
|
|
884
|
+
this.conTags = this.selected.filter((item, idx) => idx < index)
|
|
885
|
+
let arrs = this.selected.filter((item, idx) => idx >= index)
|
|
886
|
+
this.count = arrs.length
|
|
887
|
+
if (!isRecalculate) {
|
|
888
|
+
this.layoutCount()
|
|
889
|
+
}
|
|
890
|
+
break
|
|
891
|
+
} else {
|
|
892
|
+
if (i >= 2) {
|
|
893
|
+
const index = isRecalculate && this.count > 0 ? (i - 1) : i
|
|
894
|
+
this.conTags = this.selected.filter((item, idx) => idx < index)
|
|
895
|
+
let arrs = this.selected.filter((item, idx) => idx >= index)
|
|
896
|
+
this.count = arrs.length
|
|
897
|
+
if (!isRecalculate) {
|
|
898
|
+
this.layoutCount()
|
|
899
|
+
}
|
|
900
|
+
break
|
|
901
|
+
} else {
|
|
902
|
+
this.isNeedMin = true
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
})
|
|
910
|
+
},
|
|
911
|
+
getAllTag() {
|
|
912
|
+
this.count = 0
|
|
913
|
+
this.calculateTagLayout(false)
|
|
914
|
+
},
|
|
915
|
+
layoutCount() {
|
|
916
|
+
this.calculateTagLayout(true)
|
|
917
|
+
},
|
|
845
918
|
valueChange(val) {
|
|
846
919
|
if (!this.multiple) {
|
|
847
920
|
if (this.inputable) {
|
|
@@ -903,14 +976,17 @@ export default {
|
|
|
903
976
|
if (fn && fn.then) {
|
|
904
977
|
fn.then(flag => {
|
|
905
978
|
this.selected = selected
|
|
979
|
+
this.conTags = selected
|
|
906
980
|
}).catch((e)=>{})
|
|
907
981
|
} else {
|
|
908
982
|
if (fn) {
|
|
909
983
|
this.selected = selected
|
|
984
|
+
this.conTags = selected
|
|
910
985
|
}
|
|
911
986
|
}
|
|
912
987
|
} else {
|
|
913
988
|
this.selected = selected
|
|
989
|
+
this.conTags = selected
|
|
914
990
|
}
|
|
915
991
|
|
|
916
992
|
},
|
|
@@ -1191,9 +1267,9 @@ export default {
|
|
|
1191
1267
|
},
|
|
1192
1268
|
adjustLayer() {
|
|
1193
1269
|
if (this.optionDisplay !== 'none' && this.$refs.layer.show) {
|
|
1194
|
-
|
|
1270
|
+
setTimeout(()=>{
|
|
1195
1271
|
this.$refs.layer.set(this.$refs.link)
|
|
1196
|
-
})
|
|
1272
|
+
}, 10)
|
|
1197
1273
|
}
|
|
1198
1274
|
},
|
|
1199
1275
|
openLayer() {
|