resolver-egretimp-plus 0.0.125 → 0.0.126
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/dist/h5/index.js +1 -1
- package/dist/theme/element/index.css +1 -1
- package/dist/theme/element/src/components/index.scss +1 -0
- package/dist/theme/element/src/components/input.scss +14 -0
- package/dist/theme/element/src/components/text.scss +3 -0
- package/dist/web/index.js +23 -23
- package/package.json +1 -1
- package/src/components/packages-web/CustomComponentPlain.vue +23 -2
- package/src/components/packages-web/ElInput.jsx +180 -0
- package/src/theme/element/components/index.scss +1 -0
- package/src/theme/element/components/input.scss +14 -0
- package/src/theme/element/components/text.scss +3 -0
- /package/src/components/packages-web/{ElInput.vue → ElInputBak.vue} +0 -0
package/package.json
CHANGED
|
@@ -17,6 +17,9 @@ const props = defineProps({
|
|
|
17
17
|
formatter: {
|
|
18
18
|
type: Function,
|
|
19
19
|
default: null
|
|
20
|
+
},
|
|
21
|
+
isPointer: {
|
|
22
|
+
type: [String]
|
|
20
23
|
}
|
|
21
24
|
})
|
|
22
25
|
const lang = inject('lang')
|
|
@@ -27,7 +30,7 @@ const value = computed(() => {
|
|
|
27
30
|
if (
|
|
28
31
|
isPatchComponent(PLAIN_TYPE_OPTIONS_COLUMNS, props)
|
|
29
32
|
) {
|
|
30
|
-
return
|
|
33
|
+
return selectFormat(modelValue.value)
|
|
31
34
|
} else {
|
|
32
35
|
if (isPatchComponent(['ElDatePicker'], props)) {
|
|
33
36
|
if (!modelValue.value) {
|
|
@@ -40,7 +43,8 @@ const value = computed(() => {
|
|
|
40
43
|
})
|
|
41
44
|
|
|
42
45
|
const classObj = computed(() => ({
|
|
43
|
-
[`custom-component-plain--${props.type}`]: true
|
|
46
|
+
[`custom-component-plain--${props.type}`]: true,
|
|
47
|
+
cursor: props.isPointer == '1'
|
|
44
48
|
}))
|
|
45
49
|
|
|
46
50
|
|
|
@@ -67,6 +71,20 @@ const clickAction = () => {
|
|
|
67
71
|
rootForm
|
|
68
72
|
}, appContext)
|
|
69
73
|
}
|
|
74
|
+
|
|
75
|
+
function selectFormat(value) {
|
|
76
|
+
let valList = value
|
|
77
|
+
const multiple = props?.config?.multiple == '1'
|
|
78
|
+
const isStrVal = props.config?.valueType !== 'list'
|
|
79
|
+
// 在满足多选,并且不是str格式的时候,就表示value为数组类型,取反就表示不满足的时候,需要转换成数组格式进行计算
|
|
80
|
+
if (!(multiple && !isStrVal)) {
|
|
81
|
+
valList = valList ? (valList?.split(',') || []) : []
|
|
82
|
+
}
|
|
83
|
+
return valList?.reduce((ret, val) => {
|
|
84
|
+
const str = props?.options?.find(item => item.columnValue == val)?.[lang?.value?.indexOf('zh') > -1 ? 'columnDesc_zh' : 'columnDesc']
|
|
85
|
+
return `${ret}${ret ? ',' : ''}${str}`
|
|
86
|
+
}, '')
|
|
87
|
+
}
|
|
70
88
|
</script>
|
|
71
89
|
<style lang="scss" scoped>
|
|
72
90
|
.custom-component-plain {
|
|
@@ -77,4 +95,7 @@ const clickAction = () => {
|
|
|
77
95
|
.custom-component-plain--error {
|
|
78
96
|
color: #F54A45;
|
|
79
97
|
}
|
|
98
|
+
.cursor {
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
80
101
|
</style>
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { ElInput } from 'element-plus'
|
|
2
|
+
import { computed, defineProps, useAttrs } from 'vue'
|
|
3
|
+
import { commonPropsType, hasOwn, isElement } from '../../utils/index.js'
|
|
4
|
+
import { ref } from 'vue';
|
|
5
|
+
import { onMounted } from 'vue';
|
|
6
|
+
import { getDomWidth } from '../../utils/dom.js';
|
|
7
|
+
import { watch } from 'vue';
|
|
8
|
+
import { nextTick } from 'vue';
|
|
9
|
+
import { resolveComponent } from 'vue';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
props: {
|
|
14
|
+
...commonPropsType,
|
|
15
|
+
...ElInput.props
|
|
16
|
+
},
|
|
17
|
+
emits: ['update:modelValue'],
|
|
18
|
+
setup(props, { emit, attrs }) {
|
|
19
|
+
const isOverflow = ref(false)
|
|
20
|
+
const inputWrapRef = ref(null)
|
|
21
|
+
const calcSpanRef = ref(null)
|
|
22
|
+
const inputProps = computed(() => {
|
|
23
|
+
const ret = Object.keys(ElInput.props).reduce((total, key) => {
|
|
24
|
+
total[key] = props[key]
|
|
25
|
+
return total
|
|
26
|
+
}, {})
|
|
27
|
+
if (props.config?.icon) {
|
|
28
|
+
ret.suffixIcon = props.config?.icon
|
|
29
|
+
}
|
|
30
|
+
return ret
|
|
31
|
+
})
|
|
32
|
+
const normalInputProps = computed(() => {
|
|
33
|
+
const ret = {
|
|
34
|
+
...inputProps.value
|
|
35
|
+
}
|
|
36
|
+
delete ret.suffixIcon
|
|
37
|
+
delete ret.prefixIcon
|
|
38
|
+
return ret
|
|
39
|
+
})
|
|
40
|
+
const showTooltip = computed(() => {
|
|
41
|
+
return props?.config?.showTooltip == '1' && props.disabled
|
|
42
|
+
})
|
|
43
|
+
const modelValue = computed({
|
|
44
|
+
get() {
|
|
45
|
+
return props.modelValue
|
|
46
|
+
},
|
|
47
|
+
set(val) {
|
|
48
|
+
emit('update:modelValue', val)
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
const isPagePopup = computed(() => {
|
|
52
|
+
return props.config?.lcpPagePopupMapVO
|
|
53
|
+
})
|
|
54
|
+
// 弹框是否只能支持点击icon进行触发,默认是
|
|
55
|
+
const isOnlyIconClickFlag = computed(() => {
|
|
56
|
+
return hasOwn(props.config, 'onlyIconClickFlag') ? props.config?.onlyIconClickFlag == '1' : true
|
|
57
|
+
})
|
|
58
|
+
// 输入点击弹框的情况下,是否仍然可以编辑
|
|
59
|
+
const isPagePopupAlwayEdit = computed(() => {
|
|
60
|
+
return props.config?.pagePopupEditFlag == '1'
|
|
61
|
+
})
|
|
62
|
+
const vmodelProps = computed(() => {
|
|
63
|
+
const ret = {
|
|
64
|
+
modelValue: modelValue.value
|
|
65
|
+
}
|
|
66
|
+
if (!(isPagePopup.value && !isPagePopupAlwayEdit.value)) {
|
|
67
|
+
ret['onUpdate:modelValue'] = (val) => {
|
|
68
|
+
modelValue.value = val
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
ret['onClear'] = () => {
|
|
72
|
+
attrs?.onClear?.()
|
|
73
|
+
modelValue.value = ''
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return ret
|
|
77
|
+
})
|
|
78
|
+
const normalAttrs = computed(() => {
|
|
79
|
+
const ret = {
|
|
80
|
+
...attrs
|
|
81
|
+
}
|
|
82
|
+
if (isPagePopup.value && isOnlyIconClickFlag.value) {
|
|
83
|
+
delete ret.onClick
|
|
84
|
+
}
|
|
85
|
+
return ret
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
const tooltipCalc = (() => {
|
|
89
|
+
let unWatch = null
|
|
90
|
+
let onResize = null
|
|
91
|
+
return {
|
|
92
|
+
clear: () => {
|
|
93
|
+
unWatch && unWatch()
|
|
94
|
+
onResize && window.removeEventListener('resize', onResize)
|
|
95
|
+
},
|
|
96
|
+
calc() {
|
|
97
|
+
this.clear()
|
|
98
|
+
let inputWrapWidth = getDomWidth(inputWrapRef.value, 0)
|
|
99
|
+
let textLengthWidth = getDomWidth(calcSpanRef.value, -22)
|
|
100
|
+
isOverflow.value = inputWrapWidth < textLengthWidth
|
|
101
|
+
unWatch = watch(() => modelValue.value, (val) => {
|
|
102
|
+
nextTick(() => {
|
|
103
|
+
textLengthWidth = getDomWidth(calcSpanRef.value, -22)
|
|
104
|
+
isOverflow.value = inputWrapWidth < textLengthWidth
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
onResize = () => {
|
|
108
|
+
inputWrapWidth = getDomWidth(inputWrapRef.value, 0)
|
|
109
|
+
isOverflow.value = inputWrapWidth < textLengthWidth
|
|
110
|
+
console.log('isOverflow==:', isOverflow.value, inputWrapWidth)
|
|
111
|
+
}
|
|
112
|
+
window.addEventListener('resize', onResize)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
})()
|
|
116
|
+
|
|
117
|
+
onMounted(() => {
|
|
118
|
+
watch(showTooltip, (val) => {
|
|
119
|
+
if (val) {
|
|
120
|
+
tooltipCalc?.calc()
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
immediate: true
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
const polyfillInputWrap = (node) => {
|
|
127
|
+
if (isOverflow.value) {
|
|
128
|
+
return (
|
|
129
|
+
<el-tooltip content={modelValue.value} placement="top">
|
|
130
|
+
{ node }
|
|
131
|
+
</el-tooltip>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
return node
|
|
135
|
+
}
|
|
136
|
+
const getInputSolts = () => {
|
|
137
|
+
const ret = {}
|
|
138
|
+
if (inputProps.value?.suffixIcon) {
|
|
139
|
+
const suffixIcon = resolveComponent(inputProps.value.suffixIcon)
|
|
140
|
+
ret.suffix = () => {
|
|
141
|
+
const iconProps = {}
|
|
142
|
+
if (isPagePopup.value && inputProps.value.suffixIcon == 'Search') {
|
|
143
|
+
iconProps.onClick = attrs.onClick
|
|
144
|
+
iconProps.style = {
|
|
145
|
+
cursor: 'pointer'
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return <el-icon {...iconProps}><suffixIcon /></el-icon>
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (inputProps.value?.prefixIcon) {
|
|
153
|
+
const prefixIcon = resolveComponent(inputProps.value.prefixIcon)
|
|
154
|
+
ret.prefix = () => {
|
|
155
|
+
return <el-icon><prefixIcon /></el-icon>
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return ret
|
|
159
|
+
}
|
|
160
|
+
return () => {
|
|
161
|
+
return (
|
|
162
|
+
<div class="input-contrainer">
|
|
163
|
+
<span ref={(e) => calcSpanRef.value = e} class="calc-span">{ modelValue.value }</span>
|
|
164
|
+
{
|
|
165
|
+
polyfillInputWrap(
|
|
166
|
+
<div v-else class="input-wrap" ref={(e) => inputWrapRef.value = e}>
|
|
167
|
+
<ElInput {...vmodelProps.value} {...{...normalAttrs.value, ...normalInputProps.value}}>
|
|
168
|
+
{
|
|
169
|
+
getInputSolts()
|
|
170
|
+
}
|
|
171
|
+
</ElInput>
|
|
172
|
+
</div>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
</div>
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
@@ -12,4 +12,18 @@
|
|
|
12
12
|
.el-input__suffix-inner {
|
|
13
13
|
flex-direction: row-reverse;
|
|
14
14
|
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.input-contrainer {
|
|
18
|
+
width: 100%;
|
|
19
|
+
.calc-span {
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
position: absolute;
|
|
22
|
+
visibility: hidden;
|
|
23
|
+
padding: 0 11px;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
}
|
|
26
|
+
.input-wrap{
|
|
27
|
+
width: 100%;
|
|
28
|
+
}
|
|
15
29
|
}
|
|
File without changes
|