resolver-egretimp-plus 0.0.125 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.0.125",
3
+ "version": "0.0.127",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -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 props?.options?.find(item => item.columnValue == modelValue.value)?.[lang?.value?.indexOf('zh') > -1 ? 'columnDesc_zh' : 'columnDesc']
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
+
@@ -42,3 +42,4 @@
42
42
  @import './steps.scss';
43
43
  @import './dialog.scss';
44
44
  @import './textarea.scss';
45
+ @import './text.scss';
@@ -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
  }
@@ -0,0 +1,3 @@
1
+ .el-text {
2
+ line-height: 16px;
3
+ }
@@ -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.replace(/->[^(->)]+$/, '')
24
- oneKey = oneKey.replace(/\[\d+\]$/, '')
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>