resolver-egretimp-plus 0.0.126 → 0.0.128
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
|
@@ -27,6 +27,9 @@ export default {
|
|
|
27
27
|
if (props.config?.icon) {
|
|
28
28
|
ret.suffixIcon = props.config?.icon
|
|
29
29
|
}
|
|
30
|
+
if (props.config?.maxLength) {
|
|
31
|
+
ret.maxlength = parseInt(props.config.maxLength)
|
|
32
|
+
}
|
|
30
33
|
return ret
|
|
31
34
|
})
|
|
32
35
|
const normalInputProps = computed(() => {
|
|
@@ -164,6 +167,7 @@ export default {
|
|
|
164
167
|
{
|
|
165
168
|
polyfillInputWrap(
|
|
166
169
|
<div v-else class="input-wrap" ref={(e) => inputWrapRef.value = e}>
|
|
170
|
+
maxlength: {normalInputProps.maxlength}
|
|
167
171
|
<ElInput {...vmodelProps.value} {...{...normalAttrs.value, ...normalInputProps.value}}>
|
|
168
172
|
{
|
|
169
173
|
getInputSolts()
|
package/src/utils/render.jsx
CHANGED
|
@@ -746,7 +746,7 @@ function getFormItemRule(config, lang, params) {
|
|
|
746
746
|
return
|
|
747
747
|
}
|
|
748
748
|
const val = (config.bindValue === null || config.bindValue === undefined) ? '' : config.bindValue
|
|
749
|
-
|
|
749
|
+
if (!val) callback() // 为空不进行正则校验
|
|
750
750
|
for (let i = 0; i < regexPattern.length; i++) {
|
|
751
751
|
const validInfo = regexPattern[i]
|
|
752
752
|
const { reg, tip, tipEn } = validInfo
|
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>
|