resolver-egretimp-plus 0.0.126 → 0.0.127
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/package.json
CHANGED
package/src/utils/valid.js
CHANGED
|
@@ -20,8 +20,9 @@ function validFailAction(errInfo, dynamicMapComp) {
|
|
|
20
20
|
while (oneKey.indexOf('->') > -1) {
|
|
21
21
|
const compInfo = dynamicMapComp[oneKey]
|
|
22
22
|
compInfo && referComps.unshift(compInfo)
|
|
23
|
-
oneKey = oneKey
|
|
24
|
-
oneKey = oneKey.replace(
|
|
23
|
+
oneKey = oneKey?.split('->')?.slice(0, -1)?.join('->') || ''
|
|
24
|
+
// oneKey = oneKey.replace(/->[^(->)]+$/, '')
|
|
25
|
+
// oneKey = oneKey.replace(/\[\d+\]$/, '')
|
|
25
26
|
}
|
|
26
27
|
const compInfo = dynamicMapComp[oneKey]
|
|
27
28
|
compInfo && referComps.unshift(compInfo)
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ElInput } from 'element-plus'
|
|
3
|
-
import { computed, defineProps, useAttrs } from 'vue'
|
|
4
|
-
import { commonPropsType, isElement } from '../../utils/index.js'
|
|
5
|
-
import { ref } from 'vue';
|
|
6
|
-
import { onMounted } from 'vue';
|
|
7
|
-
import { getDomWidth } from '../../utils/dom.js';
|
|
8
|
-
import { watch } from 'vue';
|
|
9
|
-
import { nextTick } from 'vue';
|
|
10
|
-
|
|
11
|
-
const isOverflow = ref(false)
|
|
12
|
-
const inputWrapRef = ref(null)
|
|
13
|
-
const calcSpanRef = ref(null)
|
|
14
|
-
const props = defineProps({
|
|
15
|
-
...commonPropsType,
|
|
16
|
-
...ElInput.props
|
|
17
|
-
})
|
|
18
|
-
const inputProps = computed(() => {
|
|
19
|
-
const ret = Object.keys(ElInput.props).reduce((total, key) => {
|
|
20
|
-
total[key] = props[key]
|
|
21
|
-
return total
|
|
22
|
-
}, {})
|
|
23
|
-
if (props.config?.icon) {
|
|
24
|
-
ret.suffixIcon = props.config?.icon
|
|
25
|
-
}
|
|
26
|
-
return ret
|
|
27
|
-
})
|
|
28
|
-
const showTooltip = computed(() => {
|
|
29
|
-
return props?.config?.showTooltip == '1' && props.disabled
|
|
30
|
-
})
|
|
31
|
-
const attrs = useAttrs()
|
|
32
|
-
const modelValue = defineModel()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const tooltipCalc = (() => {
|
|
36
|
-
let unWatch = null
|
|
37
|
-
let onResize = null
|
|
38
|
-
return {
|
|
39
|
-
clear: () => {
|
|
40
|
-
unWatch && unWatch()
|
|
41
|
-
onResize && window.removeEventListener('resize', onResize)
|
|
42
|
-
},
|
|
43
|
-
calc() {
|
|
44
|
-
this.clear()
|
|
45
|
-
let inputWrapWidth = getDomWidth(inputWrapRef.value, 0)
|
|
46
|
-
let textLengthWidth = getDomWidth(calcSpanRef.value, -22)
|
|
47
|
-
isOverflow.value = inputWrapWidth < textLengthWidth
|
|
48
|
-
unWatch = watch(() => modelValue.value, (val) => {
|
|
49
|
-
nextTick(() => {
|
|
50
|
-
textLengthWidth = getDomWidth(calcSpanRef.value, -22)
|
|
51
|
-
isOverflow.value = inputWrapWidth < textLengthWidth
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
onResize = () => {
|
|
55
|
-
inputWrapWidth = getDomWidth(inputWrapRef.value, 0)
|
|
56
|
-
isOverflow.value = inputWrapWidth < textLengthWidth
|
|
57
|
-
console.log('isOverflow==:', isOverflow.value, inputWrapWidth)
|
|
58
|
-
}
|
|
59
|
-
window.addEventListener('resize', onResize)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
})()
|
|
63
|
-
|
|
64
|
-
onMounted(() => {
|
|
65
|
-
watch(showTooltip, (val) => {
|
|
66
|
-
if (val) {
|
|
67
|
-
tooltipCalc?.calc()
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
immediate: true
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
</script>
|
|
74
|
-
<template>
|
|
75
|
-
<div class="input-contrainer">
|
|
76
|
-
<span ref="calcSpanRef" class="calc-span">{{ modelValue }}</span>
|
|
77
|
-
<el-tooltip v-if="isOverflow" :content="modelValue" placement="top">
|
|
78
|
-
<div class="input-wrap" :ref="(e) => inputWrapRef = e">
|
|
79
|
-
<ElInput v-model="modelValue" v-bind="{...attrs, ...inputProps}"></ElInput>
|
|
80
|
-
</div>
|
|
81
|
-
</el-tooltip>
|
|
82
|
-
<div v-else class="input-wrap" :ref="(e) => inputWrapRef = e">
|
|
83
|
-
<ElInput v-model="modelValue" v-bind="{...attrs, ...inputProps}"></ElInput>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</template>
|
|
87
|
-
|
|
88
|
-
<style lang="scss" scoped>
|
|
89
|
-
.input-contrainer {
|
|
90
|
-
width: 100%;
|
|
91
|
-
.calc-span {
|
|
92
|
-
white-space: nowrap;
|
|
93
|
-
position: absolute;
|
|
94
|
-
visibility: hidden;
|
|
95
|
-
padding: 0 11px;
|
|
96
|
-
box-sizing: border-box;
|
|
97
|
-
}
|
|
98
|
-
.input-wrap{
|
|
99
|
-
width: 100%;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
</style>
|