resolver-egretimp-plus 0.0.136 → 0.0.138
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/const/index.js +1 -1
- package/dist/h5/index.js +2 -2
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/analysisComponent.jsx +4 -8
- package/src/components/childDialog/index.js +33 -32
- package/src/components/packages-web/CustomComponentTable.jsx +3 -3
- package/src/components/packages-web/ElButton.vue +2 -1
- package/src/components/packages-web/ElInput.jsx +1 -1
- package/src/components/packages-web/ElInputNumber.vue +14 -1
- package/src/components/packages-web/ElSelect.vue +3 -1
- package/src/hooks/index.js +20 -29
- package/src/index.jsx +9 -2
- package/src/resolver-web.vue +2 -2
- package/src/rules/parseCondition.js +0 -3
- package/src/utils/common.js +47 -0
- package/src/utils/const.js +2 -2
- package/src/utils/render.jsx +7 -9
package/package.json
CHANGED
|
@@ -185,18 +185,14 @@ export default {
|
|
|
185
185
|
|
|
186
186
|
const configLinks = [parent, ...props.additionConfigs, props.config]
|
|
187
187
|
configLinks.reduce((parent, config) => {
|
|
188
|
-
definePrivatelyProp(
|
|
188
|
+
definePrivatelyProp(config, 'parent', parent)
|
|
189
189
|
|
|
190
190
|
config.dynamicMapComp = dynamicMapComp
|
|
191
|
-
config.dynamicHireRelat = parent?.dynamicHireRelat ? `${parent?.dynamicHireRelat}${hasOwn(
|
|
192
|
-
config.dynamicHireRelat && (dynamicMapComp[
|
|
193
|
-
return
|
|
191
|
+
config.dynamicHireRelat = parent?.dynamicHireRelat ? `${parent?.dynamicHireRelat}${hasOwn(config, 'rowIndex') ? `[${config.rowIndex}]` : ''}->${(config.metaCode || '')}` : config.metaCode
|
|
192
|
+
config.dynamicHireRelat && (dynamicMapComp[config.dynamicHireRelat] = config)
|
|
193
|
+
return config
|
|
194
194
|
})
|
|
195
195
|
|
|
196
|
-
// props.config.parent = parent
|
|
197
|
-
// props.config.dynamicMapComp = dynamicMapComp
|
|
198
|
-
// props.config.dynamicHireRelat = parent?.dynamicHireRelat ? `${parent?.dynamicHireRelat}${hasOwn(props.config, 'rowIndex') ? `[${props.config.rowIndex}]` : ''}->${(props.config.metaCode || '')}` : props.config.metaCode
|
|
199
|
-
// props.config.dynamicHireRelat && (dynamicMapComp[props.config.dynamicHireRelat] = props.config)
|
|
200
196
|
provide('parent', props.config)
|
|
201
197
|
|
|
202
198
|
const _isH5 = inject('_isH5')
|
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import ChildDialog from './src/index.vue'
|
|
2
2
|
import { createVNode, render } from 'vue'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
export function generateOpenChildDialog() {
|
|
5
|
+
let instance = null
|
|
6
|
+
return function openChildDialog(options = {}, appContext) {
|
|
7
|
+
const initData = options.initData || {}
|
|
8
|
+
if (instance) {
|
|
9
|
+
Object.keys(options).forEach(key => {
|
|
10
|
+
instance.props[key] = options[key]
|
|
11
|
+
|
|
12
|
+
})
|
|
13
|
+
instance.vm.exposed.dialogVisible.value = true
|
|
14
|
+
// instance?.vm?.exposed?.clearData()
|
|
15
|
+
instance?.vm?.exposed?.initData(initData)
|
|
16
|
+
return instance.close
|
|
17
|
+
}
|
|
18
|
+
const container = document.createElement('div')
|
|
19
|
+
const vnode = createVNode(ChildDialog, {
|
|
20
|
+
...options,
|
|
12
21
|
})
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
document.body.appendChild(container.firstElementChild)
|
|
25
|
-
|
|
26
|
-
instance = {
|
|
27
|
-
vnode,
|
|
28
|
-
vm: vnode.component,
|
|
29
|
-
props: vnode.component?.props,
|
|
30
|
-
close: () => {
|
|
31
|
-
vnode.component.exposed.dialogVisible.value = false
|
|
22
|
+
vnode.appContext = appContext
|
|
23
|
+
render(vnode, container)
|
|
24
|
+
document.body.appendChild(container.firstElementChild)
|
|
25
|
+
|
|
26
|
+
instance = {
|
|
27
|
+
vnode,
|
|
28
|
+
vm: vnode.component,
|
|
29
|
+
props: vnode.component?.props,
|
|
30
|
+
close: () => {
|
|
31
|
+
vnode.component.exposed.dialogVisible.value = false
|
|
32
|
+
}
|
|
32
33
|
}
|
|
34
|
+
vnode.component.exposed.dialogVisible.value = true
|
|
35
|
+
vnode.component.exposed?.initData(initData)
|
|
36
|
+
|
|
37
|
+
return instance.close
|
|
33
38
|
}
|
|
34
|
-
|
|
35
|
-
vnode.component.exposed?.initData(initData)
|
|
36
|
-
|
|
37
|
-
return instance.close
|
|
38
|
-
}
|
|
39
|
+
}
|
|
@@ -113,12 +113,12 @@ export default {
|
|
|
113
113
|
const ret = sortList.reduce((ret, item) => {
|
|
114
114
|
ret = ret.sort((a, b) => {
|
|
115
115
|
if (a[item.prop] === '' || a[item.prop] === undefined || a[item.prop] === null) {
|
|
116
|
-
return item.order === 'descending' ?
|
|
116
|
+
return item.order === 'descending' ? 1 : -1
|
|
117
117
|
}
|
|
118
118
|
if (b[item.prop] === '' || b[item.prop] === undefined || b[item.prop] === null) {
|
|
119
|
-
return item.order === 'descending' ? 1 :
|
|
119
|
+
return item.order === 'descending' ? -1 : 1
|
|
120
120
|
}
|
|
121
|
-
return (a[item.prop] > b[item.prop] ? (item.order === 'descending' ? 1 :
|
|
121
|
+
return (a[item.prop] > b[item.prop] ? (item.order === 'descending' ? -1 : 1) : a[item.prop] === b[item.prop] ? 0 : (item.order === 'descending' ? 1 : -1))
|
|
122
122
|
})
|
|
123
123
|
return ret
|
|
124
124
|
}, [...(normalTableData.value || [])])
|
|
@@ -17,7 +17,8 @@ const appContext = getCurrentInstance()?.appContext
|
|
|
17
17
|
const props = defineProps({
|
|
18
18
|
...commonPropsType,
|
|
19
19
|
...ElButton.props,
|
|
20
|
-
plain: [String, Boolean]
|
|
20
|
+
plain: [String, Boolean],
|
|
21
|
+
circle: [String, Boolean]
|
|
21
22
|
})
|
|
22
23
|
const calcPorps = computed(() => {
|
|
23
24
|
const ret = Object.keys(ElButton.props).reduce((total, key) => {
|
|
@@ -173,7 +173,7 @@ export default {
|
|
|
173
173
|
<span ref={(e) => calcSpanRef.value = e} class="calc-span">{ modelValue.value }</span>
|
|
174
174
|
{
|
|
175
175
|
polyfillInputWrap(
|
|
176
|
-
<div
|
|
176
|
+
<div class="input-wrap" ref={(e) => inputWrapRef.value = e}>
|
|
177
177
|
<ElInput {...vmodelProps.value} {...{...normalAttrs.value, ...normalInputProps.value}}>
|
|
178
178
|
{
|
|
179
179
|
getInputSolts()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ElInputNumber v-bind="{...inputNumberProps, ...attrs}" @blur="normalValue" :class="[textAlignClass]" :key="updateKey" v-model="
|
|
2
|
+
<ElInputNumber v-bind="{...inputNumberProps, ...attrs}" @blur="normalValue" :class="[textAlignClass]" :key="updateKey" v-model="inputNumberValue"></ElInputNumber>
|
|
3
3
|
</template>
|
|
4
4
|
<script setup>
|
|
5
5
|
import { ElInputNumber } from 'element-plus'
|
|
@@ -13,6 +13,8 @@ const props = defineProps({
|
|
|
13
13
|
},
|
|
14
14
|
...ElInputNumber.props,
|
|
15
15
|
...commonPropsType,
|
|
16
|
+
step: [String, Number],
|
|
17
|
+
modeValue: [String, Number]
|
|
16
18
|
})
|
|
17
19
|
const textAlignClass = computed(() => {
|
|
18
20
|
return props.textAlign === 'right' ? 'text-right' :
|
|
@@ -32,10 +34,21 @@ const inputNumberProps = computed(() => {
|
|
|
32
34
|
if (props.config?.precise && !isNaN(props.config.minValue)) {
|
|
33
35
|
ret.precision = props.config.precise
|
|
34
36
|
}
|
|
37
|
+
if (ret.step) {
|
|
38
|
+
ret.step = parseFloat(ret.step)
|
|
39
|
+
}
|
|
35
40
|
return ret
|
|
36
41
|
})
|
|
37
42
|
const attrs = useAttrs()
|
|
38
43
|
const modeValue = defineModel()
|
|
44
|
+
const inputNumberValue = computed({
|
|
45
|
+
get() {
|
|
46
|
+
return parseFloat(modeValue.value)
|
|
47
|
+
},
|
|
48
|
+
set(val) {
|
|
49
|
+
modeValue.value = val
|
|
50
|
+
}
|
|
51
|
+
})
|
|
39
52
|
// 目前有问题,可以输入--跟e字符串
|
|
40
53
|
const updateKey = ref(false)
|
|
41
54
|
const normalValue = () => {
|
|
@@ -17,7 +17,9 @@ const modelValue = defineModel()
|
|
|
17
17
|
const props = defineProps({
|
|
18
18
|
...ElSelect.props,
|
|
19
19
|
...commonPropsType,
|
|
20
|
-
multiple: [String, Boolean]
|
|
20
|
+
multiple: [String, Boolean],
|
|
21
|
+
filterable: [String, Boolean],
|
|
22
|
+
multipleLimit: [String, Number],
|
|
21
23
|
})
|
|
22
24
|
const attrs = useAttrs()
|
|
23
25
|
|
package/src/hooks/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { computed, inject, nextTick, reactive } from "vue"
|
|
2
2
|
import rulesDriver from '../rules/rulesDriver'
|
|
3
3
|
import defaultVal from '../utils/defaultVal.js'
|
|
4
|
-
import {
|
|
5
|
-
// import { deepMerge } from '../utils'
|
|
4
|
+
import {isNonRefType, modelValueDeepMerge } from "../utils"
|
|
6
5
|
|
|
7
6
|
export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
|
|
8
7
|
const { hireRelatMapRules, messageInstance, rootValue, ruleExecuter, dataLoad, dynamicMapComp, lang, _mapComp } = this
|
|
@@ -23,10 +22,7 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
|
|
|
23
22
|
// 如果使用v-model:[]方式绑定非modelValue,可能会出现没有对应的config
|
|
24
23
|
return
|
|
25
24
|
}
|
|
26
|
-
const
|
|
27
|
-
const val = getValueDeep(rootValue.value, dynamicHireRelat)
|
|
28
|
-
|
|
29
|
-
// const val = (metaCodeKey ? props.modelValue?.[metaCodeKey] : props.modelValue) ?? null
|
|
25
|
+
const val = (metaCodeKey ? props.modelValue?.[metaCodeKey] : props.modelValue) ?? null
|
|
30
26
|
if (modelKey === 'update:modelValue' && !val) {
|
|
31
27
|
setTimeout(() => {
|
|
32
28
|
defaultVal(config)
|
|
@@ -64,30 +60,25 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
|
|
|
64
60
|
if (!config) {
|
|
65
61
|
return
|
|
66
62
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
const modelValue = props.modelValue
|
|
64
|
+
const metaCode = metaCodeKey
|
|
65
|
+
if (!metaCode) return
|
|
66
|
+
if (!modelValue) {
|
|
67
|
+
emit('update:modelValue', {
|
|
68
|
+
[metaCode]: val
|
|
69
|
+
})
|
|
70
|
+
} else {
|
|
71
|
+
if (modelValue?.[metaCode]) {
|
|
72
|
+
if (typeof modelValue[metaCode] === 'object' || typeof val === 'object') {
|
|
73
|
+
val = modelValueDeepMerge(val, modelValue[metaCode])
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (isNonRefType(modelValue[metaCode]) && isNonRefType(val) && modelValue[metaCode] === val) {
|
|
77
|
+
// 这边的值没有变,就不用出触发下面的其他动作了
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
props.modelValue[metaCode] = val
|
|
70
81
|
}
|
|
71
|
-
|
|
72
|
-
// const modelValue = props.modelValue
|
|
73
|
-
// const metaCode = metaCodeKey
|
|
74
|
-
// if (!metaCode) return
|
|
75
|
-
// if (!modelValue) {
|
|
76
|
-
// emit('update:modelValue', {
|
|
77
|
-
// [metaCode]: val
|
|
78
|
-
// })
|
|
79
|
-
// } else {
|
|
80
|
-
// // if (modelValue?.[metaCode]) {
|
|
81
|
-
// // if (typeof modelValue?.[metaCode] === 'object' || typeof val === 'object') {
|
|
82
|
-
// // val = deepMerge(val, modelValue?.[metaCode], 'union')
|
|
83
|
-
// // }
|
|
84
|
-
// // }
|
|
85
|
-
// if (isNonRefType(modelValue[metaCode]) && isNonRefType(val) && modelValue[metaCode] === val) {
|
|
86
|
-
// // 这边的值没有变,就不用出触发下面的其他动作了
|
|
87
|
-
// return
|
|
88
|
-
// }
|
|
89
|
-
// props.modelValue[metaCode] = val
|
|
90
|
-
// }
|
|
91
82
|
if (config) {
|
|
92
83
|
setTimeout(() => {
|
|
93
84
|
ruleExecuter?.run({
|
package/src/index.jsx
CHANGED
|
@@ -128,7 +128,7 @@ export default {
|
|
|
128
128
|
type: String,
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
|
-
emits: ['update:modelValue'],
|
|
131
|
+
emits: ['update:modelValue', 'rootStoreChange'],
|
|
132
132
|
setup(props, { emit, attrs, expose }) {
|
|
133
133
|
const ruleExecuter = null
|
|
134
134
|
// const ruleExecuter = new RuleExecuter()
|
|
@@ -235,7 +235,14 @@ export default {
|
|
|
235
235
|
provide('buttonActions', props.buttonActions)
|
|
236
236
|
provide('components', toRef(props, 'components'))
|
|
237
237
|
provide('selects', toRef(props, 'selects'))
|
|
238
|
-
provide('rootValue',
|
|
238
|
+
provide('rootValue', computed({
|
|
239
|
+
get() {
|
|
240
|
+
return props.modelValue
|
|
241
|
+
},
|
|
242
|
+
set(val) {
|
|
243
|
+
emit('update:modelValue', val)
|
|
244
|
+
}
|
|
245
|
+
})) // 绑定进入的跟数据
|
|
239
246
|
provide('lang', toRef(props, 'lang'))
|
|
240
247
|
provide('dataLoad', dataLoad) // 是否可以开始执行规则初始化
|
|
241
248
|
provide('dialogComponents', props.dialogComponents) // 是否可以开始执行规则初始化
|
package/src/resolver-web.vue
CHANGED
|
@@ -4,7 +4,7 @@ import { ElMessage, ElMessageBox } from "element-plus"
|
|
|
4
4
|
import { loadingInstance } from './components/loading'
|
|
5
5
|
import { computed, ref, useAttrs } from 'vue';
|
|
6
6
|
import Resolver from './resolver-common.vue'
|
|
7
|
-
import {
|
|
7
|
+
import { generateOpenChildDialog } from './components/childDialog';
|
|
8
8
|
import { generateUniqueId } from './utils/common.js';
|
|
9
9
|
|
|
10
10
|
const props = defineProps({
|
|
@@ -26,7 +26,7 @@ const props = defineProps({
|
|
|
26
26
|
openChildDialogInstance: {
|
|
27
27
|
type: [Function],
|
|
28
28
|
default: () => {
|
|
29
|
-
return
|
|
29
|
+
return generateOpenChildDialog()
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
requestTraceId: {
|
|
@@ -199,9 +199,6 @@ export function parseCondition(rule) {
|
|
|
199
199
|
// } else {
|
|
200
200
|
conditionsRet = conditions.map(condition => {
|
|
201
201
|
const { refType, refValue, targetType, targetValue } = condition
|
|
202
|
-
if (refValue?.indexOf('onlyDisplayPricingParameters') > -1) {
|
|
203
|
-
debugger
|
|
204
|
-
}
|
|
205
202
|
// if (refValue === 'studentId') {
|
|
206
203
|
// debugger
|
|
207
204
|
// }
|
package/src/utils/common.js
CHANGED
|
@@ -210,6 +210,53 @@ export function deepMerge(
|
|
|
210
210
|
return ret
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
export function modelValueDeepMerge(
|
|
214
|
+
source,
|
|
215
|
+
target,
|
|
216
|
+
) {
|
|
217
|
+
if (!target) {
|
|
218
|
+
return source;
|
|
219
|
+
}
|
|
220
|
+
if (!source) {
|
|
221
|
+
return target;
|
|
222
|
+
}
|
|
223
|
+
let ret = mergeWith(source, target, (sourceValue, targetValue) => {
|
|
224
|
+
if (!targetValue) {
|
|
225
|
+
return sourceValue
|
|
226
|
+
}
|
|
227
|
+
if (!sourceValue) {
|
|
228
|
+
return targetValue
|
|
229
|
+
}
|
|
230
|
+
if (isArray(sourceValue) && isArray(targetValue)) {
|
|
231
|
+
const ret = []
|
|
232
|
+
let idx = 0
|
|
233
|
+
for(;idx < sourceValue.length && idx < targetValue.length; i ++) {
|
|
234
|
+
ret.push(modelValueDeepMerge[sourceValue[idx], targetValue[idx]])
|
|
235
|
+
}
|
|
236
|
+
if (idx < sourceValue.length) {
|
|
237
|
+
ret.push(...sourceValue.slice(idx))
|
|
238
|
+
} else {
|
|
239
|
+
ret.push(...targetValue.slice(idx))
|
|
240
|
+
}
|
|
241
|
+
return ret
|
|
242
|
+
}
|
|
243
|
+
if (isPlainObject(targetValue) && isPlainObject(sourceValue)) {
|
|
244
|
+
return deepMerge(sourceValue, targetValue, mergeArrays);
|
|
245
|
+
}
|
|
246
|
+
return targetValue;
|
|
247
|
+
});
|
|
248
|
+
if (Array.isArray(source)) {
|
|
249
|
+
if (ret && !Array.isArray(ret)) {
|
|
250
|
+
let arr = []
|
|
251
|
+
Object.keys(ret).forEach(key => {
|
|
252
|
+
arr[key] = ret[key]
|
|
253
|
+
})
|
|
254
|
+
ret = arr
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return ret
|
|
258
|
+
}
|
|
259
|
+
|
|
213
260
|
export function isFnStr(str) {
|
|
214
261
|
// 匹配具名函数和匿名函数(但不包括箭头函数)
|
|
215
262
|
const functionRegex = /^\s*(?:function\s*(?:\w+\s*)?\([^()]*\)\s*\{[\s\S]*?\})\s*$/
|
package/src/utils/const.js
CHANGED
|
@@ -151,14 +151,14 @@ export const commonPropsType = {
|
|
|
151
151
|
},
|
|
152
152
|
placeholder: {
|
|
153
153
|
type: String,
|
|
154
|
-
default: () =>
|
|
154
|
+
default: () => '',
|
|
155
155
|
getValue(config, props, modelValue, selects, lang) {
|
|
156
156
|
return (lang?.indexOf('zh') > -1 ? config.defPlacehold : config.defPlaceholdEn) || ''
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
placeholderEn: {
|
|
160
160
|
type: String,
|
|
161
|
-
default: () =>
|
|
161
|
+
default: () => '',
|
|
162
162
|
getValue(config, props, modelValue, selects, lang) {
|
|
163
163
|
return config.defPlaceholdEn
|
|
164
164
|
}
|
package/src/utils/render.jsx
CHANGED
|
@@ -831,15 +831,13 @@ function createFormLable(config, lang = 'zh') {
|
|
|
831
831
|
{required ? <span style="color: #f5222d; margin-right: 3px">*</span> : null}
|
|
832
832
|
<span>{lang.indexOf('zh') > -1 ? config.metaNameZh : config.metaNameEn}</span>
|
|
833
833
|
</span>
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}
|
|
842
|
-
</ElTooltip>
|
|
834
|
+
{
|
|
835
|
+
config.hintFlag == '1' ? (
|
|
836
|
+
<ElTooltip effect="dark" content={lang.indexOf('zh') > -1 ? config.hintContentZh : config.hintContentEn} placement="top">
|
|
837
|
+
<span class="label-tip"><elIcon><QuestionFilled /></elIcon></span>
|
|
838
|
+
</ElTooltip>
|
|
839
|
+
) : null
|
|
840
|
+
}
|
|
843
841
|
</div>
|
|
844
842
|
)
|
|
845
843
|
}
|