resolver-egretimp-plus 0.0.137 → 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 +1 -1
- 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/hooks/index.js +20 -29
- package/src/resolver-web.vue +2 -2
- package/src/rules/parseCondition.js +0 -3
- package/src/utils/common.js +47 -0
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 || [])])
|
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/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*$/
|