resolver-egretimp-plus 0.0.292 → 0.0.294

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.292",
3
+ "version": "0.0.294",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -0,0 +1,148 @@
1
+ import { ElText, ElIcon } from 'element-plus'
2
+ import { computed, defineProps, inject, getCurrentInstance, useAttrs, useSlots } from 'vue'
3
+ import { commonPropsType } from '../../utils/index.js'
4
+ import { h, resolveComponent, withModifiers } from 'vue'
5
+ import '../styles/text.scss'
6
+
7
+ export default {
8
+ inheritAttrs: false,
9
+ props: {
10
+ ...commonPropsType,
11
+ ...ElText.props,
12
+ fontSize: [String, Number],
13
+ needWrap: {
14
+ type: [String, Number],
15
+ default: '0'
16
+ },
17
+ suffixIcon: {
18
+ type: [String, Object],
19
+ default: ''
20
+ },
21
+ isPointer: {
22
+ type: [String, Number]
23
+ }
24
+ },
25
+ emits: ['update:modelValue'],
26
+ setup(props, { emit, attrs, expose, slots }) {
27
+ // 这个是真实的值
28
+ const modelValue = computed({
29
+ get() {
30
+ return props.modelValue
31
+ },
32
+ set(val) {
33
+ emit('update:modelValue', val)
34
+ }
35
+ })
36
+ const lang = inject('lang')
37
+ const appContext = getCurrentInstance()?.appContext
38
+ const isPagePopup = computed(() => {
39
+ return props.config?.lcpPagePopupMapVO
40
+ })
41
+ const normalVal = computed(() => {
42
+ let val = (modelValue.value !== null && modelValue.value !== undefined) ? modelValue.value : ''
43
+ if (typeof val === 'object') {
44
+ try {
45
+ val = JSON.stringify(val)
46
+ } catch (error) {
47
+ val = ''
48
+ }
49
+ } else if (typeof val === 'function') {
50
+ val = ''
51
+ }
52
+ const findItem = props?.options?.find(item => item.columnValue == val)
53
+ if (findItem) {
54
+ return lang?.value?.indexOf('zh') > -1 ? findItem.columnDesc_zh : findItem.columnDesc
55
+ }
56
+ return val
57
+ })
58
+
59
+ const elTextProps = computed(() => {
60
+ const result = Object.keys(ElText.props).reduce((ret, key) => {
61
+ ret[key] = props[key]
62
+ return ret
63
+ }, {})
64
+ return result
65
+ })
66
+ const buttonActions = inject('buttonActions', {})
67
+
68
+ const labelDesc = computed(() => {
69
+ return normalVal.value
70
+ })
71
+
72
+ const dynamicMapComp = inject('dynamicMapComp')
73
+ const hireRelatMapRules = inject('hireRelatMapRules')
74
+ const components = inject('components')
75
+ const selects = inject('selects')
76
+ const rootValue = inject('rootValue')
77
+ const dataLoad = inject('dataLoad')
78
+ const rootForm = inject('rootForm')
79
+
80
+ const clickAction = (e) => {
81
+ // attrs?.onClick?.(e) // 如果配置中有点击事件
82
+ const actionKey = props.config?.clickActionKey || props.config?.buttonActionKey || props.config?.hireRelat
83
+ const actionFn = buttonActions[actionKey]
84
+ actionFn && actionFn(props, {
85
+ dynamicMapComp,
86
+ hireRelatMapRules,
87
+ components,
88
+ selects,
89
+ rootValue,
90
+ dataLoad,
91
+ rootForm
92
+ }, appContext)
93
+ }
94
+ function getSuffixIcon() {
95
+ if (props.suffixIcon && !props.disabled) {
96
+ const iconProps = {
97
+ color: '#a8abb2',
98
+ size: 14
99
+ }
100
+ let suffixIcon = props.suffixIcon
101
+ if (typeof suffixIcon === 'string') {
102
+ if (isPagePopup.value && suffixIcon == 'Search') {
103
+ iconProps.onClick = withModifiers(attrs.onClick, [
104
+ 'stop'
105
+ ]),
106
+ iconProps.style = {
107
+ cursor: 'pointer',
108
+ }
109
+ }
110
+ suffixIcon = resolveComponent(suffixIcon)
111
+ }
112
+ return (
113
+ <ElIcon {...{...iconProps}}>
114
+ <suffixIcon></suffixIcon>
115
+ </ElIcon>
116
+ )
117
+ }
118
+ return null
119
+ }
120
+ function getWrap(node) {
121
+ if (props.needWrap == '1') {
122
+ return (
123
+ <div class={{
124
+ 'resolver-custom-cust-input-wrap': true,
125
+ 'resolver-custom-is-disabled': props.disabled
126
+ }}>
127
+ { node }
128
+ { getSuffixIcon() }
129
+ </div>
130
+ )
131
+ } else {
132
+ return node
133
+ }
134
+ }
135
+ return () => {
136
+ return getWrap(
137
+ <ElText {...{...attrs, ...elTextProps.value}} onClickCapture={withModifiers((e) => {clickAction(e)}, [ 'stop', 'self' ])} class={{cursor: props.isPointer == '1'}}>
138
+ {
139
+ {
140
+ default: () => labelDesc.value,
141
+ ...slots,
142
+ }
143
+ }
144
+ </ElText>
145
+ )
146
+ }
147
+ }
148
+ }
@@ -0,0 +1,20 @@
1
+ .resolver-custom-cust-input-wrap {
2
+ display: flex;
3
+ width: 100%;
4
+ align-items: center;
5
+ justify-content: space-between;
6
+ min-height: 32px;
7
+ line-height: 24px;
8
+ padding: 1px 11px;
9
+ box-sizing: border-box;
10
+ border-radius: var(--el-input-border-radius, var(--el-border-radius-base));
11
+ box-shadow: 0 0 0 1px var(--el-input-border-color, var(--el-border-color)) inset;
12
+ background: var(--el-input-bg-color, var(--el-fill-color-blank));
13
+ cursor: 'not-allowed';
14
+ }
15
+ .resolver-custom-is-disabled {
16
+ background: var(--el-disabled-bg-color);
17
+ }
18
+ .cursor {
19
+ cursor: pointer;
20
+ }
package/src/index.jsx CHANGED
@@ -221,11 +221,11 @@ export default {
221
221
  resetConfigEventInit(dynamicMapComp)
222
222
  const emptyObj = createEmptyCopy(val)
223
223
  emit('update:modelValue', emptyObj)
224
- nextTick(() => {
224
+ setTimeout(() => {
225
225
  nativeDataLoad.value = true
226
226
  emit('update:modelValue', val)
227
227
  emit('loadEvnetsCompleted', result)
228
- })
228
+ }, 20);
229
229
  } else {
230
230
  nativeDataLoad.value = true
231
231
  emit('update:modelValue', val)