resolver-egretimp-plus 0.0.229 → 0.0.231
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 +2 -1
- package/src/components/helper/eventOrchestration.js +16 -4
- package/src/components/helper/resolver.js +38 -0
- package/src/components/packages-H5/CmiPicker.vue +4 -1
- package/src/components/packages-H5/CustomComponentTabPaneH5.vue +1 -1
- package/src/components/packages-web/CustomComponentPlain.vue +1 -1
- package/src/components/packages-web/CustomComponentRow.vue +8 -1
- package/src/components/packages-web/CustomComponentTable.jsx +4 -0
- package/src/index.jsx +14 -5
- package/src/rules/eventsSupplement.js +3 -3
- package/src/rules/ruleUtils.js +14 -6
- package/src/utils/common.js +46 -0
package/package.json
CHANGED
|
@@ -79,6 +79,7 @@ export default {
|
|
|
79
79
|
definePrivatelyProp(props.config, 'route', route)
|
|
80
80
|
definePrivatelyProp(props.config, '_validate', validate)
|
|
81
81
|
definePrivatelyProp(props.config, '_rowScope', props.rowScope)
|
|
82
|
+
definePrivatelyProp(props.config, '_selects', selects)
|
|
82
83
|
// 当前组件的实例
|
|
83
84
|
const instance = getCurrentInstance()
|
|
84
85
|
const appContext = instance?.appContext
|
|
@@ -133,7 +134,7 @@ export default {
|
|
|
133
134
|
const rules = context.rules
|
|
134
135
|
delete context.rules
|
|
135
136
|
setTimeout(() => {
|
|
136
|
-
|
|
137
|
+
ruleExecuter?.run(context, rules)
|
|
137
138
|
}, 0)
|
|
138
139
|
})
|
|
139
140
|
ruleExecuter.penddingRules[hireRelat] = null
|
|
@@ -78,9 +78,9 @@ export async function dispatchClickEvent(service, {
|
|
|
78
78
|
// 定义的请求后钩子
|
|
79
79
|
const configAfterRequestService = compConfig?.afterRequestService
|
|
80
80
|
if (configAfterRequestService || afterRequestService) {
|
|
81
|
-
normalAfterRequestService = (...arg) => {
|
|
82
|
-
afterRequestService?.(...arg)
|
|
83
|
-
configAfterRequestService?.(...arg)
|
|
81
|
+
normalAfterRequestService = async (...arg) => {
|
|
82
|
+
await afterRequestService?.(...arg)
|
|
83
|
+
await configAfterRequestService?.(...arg)
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -142,7 +142,19 @@ export async function dispatchClickEvent(service, {
|
|
|
142
142
|
delete reqConfig.data
|
|
143
143
|
}
|
|
144
144
|
const ret = await (axiosInstance && axiosInstance(reqConfig))
|
|
145
|
-
|
|
145
|
+
if (normalAfterRequestService) {
|
|
146
|
+
await normalAfterRequestService(ret, {
|
|
147
|
+
dynamicMapComp,
|
|
148
|
+
requestTraceId,
|
|
149
|
+
mixinServiceConfig,
|
|
150
|
+
rootValue,
|
|
151
|
+
dynamicHireRelat,
|
|
152
|
+
compConfig,
|
|
153
|
+
service,
|
|
154
|
+
reqData: reqResult
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
|
|
146
158
|
const noSuccessIip = httpMethod.toLocaleLowerCase() === 'get' || service.transactionType == '1' || serviceCustomProps?.noSuccessIip
|
|
147
159
|
if (!resultToast(ret?.data, messageInstance, {messageCb, service, compConfig, noSuccessIip})) {
|
|
148
160
|
await Promise.reject()
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import rulesDriver from "../../rules/rulesDriver"
|
|
2
|
+
import { penddingRules } from "../../rules/ruleUtils"
|
|
1
3
|
import { hasOwn } from "../../utils"
|
|
2
4
|
import { resultToast } from "../../utils/respone"
|
|
3
5
|
|
|
@@ -67,4 +69,40 @@ export function resetConfigEventInit(dynamicMapComp) {
|
|
|
67
69
|
dynamicMapComp[key].eventInit = false
|
|
68
70
|
}
|
|
69
71
|
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function assginConfig({
|
|
75
|
+
dynamicMapComp,
|
|
76
|
+
preKey,
|
|
77
|
+
pmPageMetaList,
|
|
78
|
+
ruleExecuter
|
|
79
|
+
}) {
|
|
80
|
+
pmPageMetaList?.forEach(config => {
|
|
81
|
+
const configKey = config.metaCode
|
|
82
|
+
dynamicMapComp[`${preKey}->${configKey}`] = config
|
|
83
|
+
|
|
84
|
+
// 执行没有执行完的规则
|
|
85
|
+
const hireRelat = config?.hireRelat
|
|
86
|
+
if (penddingRules[hireRelat]?.length) {
|
|
87
|
+
penddingRules[hireRelat].forEach(context => {
|
|
88
|
+
const rules = context.rules
|
|
89
|
+
delete context.rules
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
rulesDriver.call(context, rules)
|
|
92
|
+
}, 0)
|
|
93
|
+
})
|
|
94
|
+
penddingRules[hireRelat] = null
|
|
95
|
+
}
|
|
96
|
+
// 使用json-rules-engine书写的规则,打开这边,需要对之前的规则进行注释,并且需要再index.js文件中进行开启 ====start====
|
|
97
|
+
if (ruleExecuter?.penddingRules?.[hireRelat]?.length) {
|
|
98
|
+
ruleExecuter?.penddingRules[hireRelat].forEach(context => {
|
|
99
|
+
const rules = context.rules
|
|
100
|
+
delete context.rules
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
rulesDriver.call(context, rules)
|
|
103
|
+
}, 0)
|
|
104
|
+
})
|
|
105
|
+
ruleExecuter.penddingRules[hireRelat] = null
|
|
106
|
+
}
|
|
107
|
+
})
|
|
70
108
|
}
|
|
@@ -61,9 +61,12 @@ const getColumns = () => {
|
|
|
61
61
|
})
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
const onFocus = () => {
|
|
64
|
+
const onFocus = (e) => {
|
|
65
65
|
open.value = true
|
|
66
66
|
pickerRef.value?.setColumns?.(getColumns())
|
|
67
|
+
e.preventDefault()
|
|
68
|
+
e.stopPropagation()
|
|
69
|
+
e.target.blur()
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
const onClose = () => {
|
|
@@ -22,7 +22,7 @@ const pmPageMetaList = computed(() => {
|
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
24
|
<template>
|
|
25
|
-
<cmi-tab-content v-bind="{...attrs, ...tabProps}">
|
|
25
|
+
<cmi-tab-content v-bind="{...attrs, ...tabProps}" :style="props.config?.style">
|
|
26
26
|
<slot>
|
|
27
27
|
<Renderer :config="pmPageMetaList" v-model="modelValue"></Renderer>
|
|
28
28
|
</slot>
|
|
@@ -25,13 +25,17 @@ const attrs = useAttrs()
|
|
|
25
25
|
const classRef = computed(() => {
|
|
26
26
|
return {
|
|
27
27
|
'clear-right-margin': !reserveRightMargin.value,
|
|
28
|
-
'clear-bottom-margin': !reserveBottomMargin.value,
|
|
28
|
+
'clear-bottom-margin': !reserveBottomMargin.value || allHidden.value,
|
|
29
29
|
}
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
const pmPageMetaList = computed(() => {
|
|
33
33
|
return props.config?.pmPageMetaList || []
|
|
34
34
|
})
|
|
35
|
+
|
|
36
|
+
const allHidden = computed(() => {
|
|
37
|
+
return !!pmPageMetaList.value?.find(config => !((typeof config.hidden === 'boolean' && config.hidden) || config.hidden === '1'))
|
|
38
|
+
})
|
|
35
39
|
// 保留内部formItem的margin-right
|
|
36
40
|
const reserveRightMargin = computed(() => {
|
|
37
41
|
return props.config?.reserveRightMargin
|
|
@@ -56,6 +60,9 @@ const reserveBottomMargin = computed(() => {
|
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
.clear-bottom-margin {
|
|
63
|
+
&.clear-bottom-margin.clear-bottom-margin.clear-bottom-margin {
|
|
64
|
+
margin-bottom: 0;
|
|
65
|
+
}
|
|
59
66
|
.el-col {
|
|
60
67
|
& > .el-form-item {
|
|
61
68
|
margin-bottom: 0;
|
|
@@ -4,6 +4,7 @@ import Renderer from '../../renderer.jsx'
|
|
|
4
4
|
import { computed, inject, watch, h, ref, reactive } from 'vue'
|
|
5
5
|
import { commonPropsType, TABLE_COLUMN_NOT_RENDER_META_TYPE, DISPLAY_SHOW, compareComponet, isPlainObject, hasOwn, cloneDeep, isPromise, isPlainColumn, generateUniqueId, calcDisable, camelize, capitalize, DISPLAY_HIDDEN, definePrivatelyProp } from '../../utils/index.js'
|
|
6
6
|
import '../styles/CustomComponenTable.scss'
|
|
7
|
+
import { assginConfig } from '../helper/resolver.js'
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
inheritAttrs: false,
|
|
@@ -58,6 +59,8 @@ export default {
|
|
|
58
59
|
return getCompEvents(ElPagination)
|
|
59
60
|
})
|
|
60
61
|
|
|
62
|
+
const ruleExecuter = inject('_ruleExecuter')
|
|
63
|
+
const dynamicMapComp = inject('dynamicMapComp')
|
|
61
64
|
const parentRootValue = inject('_parentRootValue', {})
|
|
62
65
|
const selectionsObj = inject('_selectionsObj', {})
|
|
63
66
|
const rootStore = inject('_rootStore', {})
|
|
@@ -65,6 +68,7 @@ export default {
|
|
|
65
68
|
const rootValue = inject('rootValue')
|
|
66
69
|
const selects = inject('selects')
|
|
67
70
|
const tableColumnFirstMetaCode = ref("")
|
|
71
|
+
// assginConfig({dynamicMapComp, pmPageMetaList: props.config.pmPageMetaList || [], preKey: props.config?.dynamicHireRelat || '', ruleExecuter })
|
|
68
72
|
const tableColumnConfigs = computed(() => {
|
|
69
73
|
let pmPageMetaList = props.config.pmPageMetaList || []
|
|
70
74
|
return pmPageMetaList.map((config) => {
|
package/src/index.jsx
CHANGED
|
@@ -6,7 +6,7 @@ import { toValidate } from './utils/valid.js'
|
|
|
6
6
|
import { MODE } from "./utils/const.js"
|
|
7
7
|
import { generateRequester } from "./utils/request.js"
|
|
8
8
|
import { executeLoadServices, resetConfigEventInit } from "./components/helper/resolver.js"
|
|
9
|
-
import { deepMerge } from "./utils/index.js"
|
|
9
|
+
import { createEmptyCopy, deepMerge } from "./utils/index.js"
|
|
10
10
|
import { nextTick } from "vue"
|
|
11
11
|
// import { RuleExecuter } from "./rulesImp/index.js"
|
|
12
12
|
export default {
|
|
@@ -177,6 +177,7 @@ export default {
|
|
|
177
177
|
const { initPageConfig, pageConfigRef, mapCompRef, hireRelatMapRulesRef } = usePageConfig()
|
|
178
178
|
function toExecuteLoadServices(clearFlag, alongLoad) {
|
|
179
179
|
// 触发加载事件执行
|
|
180
|
+
const oldNativeDataload = nativeDataLoad.value
|
|
180
181
|
nativeDataLoad.value = false
|
|
181
182
|
executeLoadServices(
|
|
182
183
|
props.config?.pmPageServiceMapVOList || props.config?.lcpPageServiceMapVOList || [],
|
|
@@ -199,13 +200,21 @@ export default {
|
|
|
199
200
|
val = deepMerge(props.modelValue, result, 'replace')
|
|
200
201
|
val = {...val}
|
|
201
202
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
|
|
204
|
+
if (oldNativeDataload) {
|
|
205
|
+
resetConfigEventInit(dynamicMapComp)
|
|
206
|
+
const emptyObj = createEmptyCopy(val)
|
|
207
|
+
emit('update:modelValue', emptyObj)
|
|
208
|
+
nextTick(() => {
|
|
209
|
+
nativeDataLoad.value = true
|
|
210
|
+
emit('update:modelValue', val)
|
|
211
|
+
emit('loadEvnetsCompleted', result)
|
|
212
|
+
})
|
|
213
|
+
} else {
|
|
205
214
|
nativeDataLoad.value = true
|
|
206
215
|
emit('update:modelValue', val)
|
|
207
216
|
emit('loadEvnetsCompleted', result)
|
|
208
|
-
}
|
|
217
|
+
}
|
|
209
218
|
}
|
|
210
219
|
}
|
|
211
220
|
)
|
|
@@ -66,7 +66,7 @@ const allInitEvents = {
|
|
|
66
66
|
}
|
|
67
67
|
if (val === ARG_FLAGS.REF_VAL) {
|
|
68
68
|
const { config } = this
|
|
69
|
-
val = config?.bindValue
|
|
69
|
+
val = config?.bindValue ?? ''
|
|
70
70
|
} else {
|
|
71
71
|
let routeMatchs = null
|
|
72
72
|
const _absoluteTarget = /^_absoluteTarget:(.+)$/
|
|
@@ -193,7 +193,7 @@ const allInitEvents = {
|
|
|
193
193
|
const { targetObj: target } = event
|
|
194
194
|
if (!target) return
|
|
195
195
|
const targetObj = `${tabpanelCode ? tabpanelCode + '->' : ''}${target}`
|
|
196
|
-
const configs = getCurrentComp.call(this, targetObj)
|
|
196
|
+
const configs = getCurrentComp.call(this, targetObj, 'setHidden')
|
|
197
197
|
// const oldDisplayTypes = []
|
|
198
198
|
// 隐藏的效果需要晚点触发,才能正常执行清空等一些列需要组件操作
|
|
199
199
|
setTimeout(() => {
|
|
@@ -223,7 +223,7 @@ const allInitEvents = {
|
|
|
223
223
|
const { targetObj: target } = event
|
|
224
224
|
if (!target) return
|
|
225
225
|
const targetObj = `${tabpanelCode ? tabpanelCode + '->' : ''}${target}`
|
|
226
|
-
const configs = getCurrentComp.call(this, targetObj)
|
|
226
|
+
const configs = getCurrentComp.call(this, targetObj, 'setShow')
|
|
227
227
|
// const oldDisplayTypes = []
|
|
228
228
|
configs.forEach((labelInfo) => {
|
|
229
229
|
// const oldDisplayType = labelInfo && labelInfo.displayType
|
package/src/rules/ruleUtils.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { hasOwn, isPlainObject } from "../utils"
|
|
3
3
|
import { MULTI_PAGE_META_LIST_TYPES, findComponent } from '../utils/index'
|
|
4
4
|
|
|
5
|
+
const pmPageMetaListTypeList = ['setShow', 'setHidden']
|
|
5
6
|
// 这边是一些组件在执行规则的时候,如果还没有加载出来,规则会走不动,这边就是存储没走通的规则,等组件加载完之后,再去执行
|
|
6
7
|
export const penddingRules = {}
|
|
7
8
|
|
|
@@ -59,7 +60,7 @@ export function setFormVal(pathStr, val) {
|
|
|
59
60
|
})
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
function getRelateConfigs(codesStr, config) {
|
|
63
|
+
function getRelateConfigs(codesStr, config, type) {
|
|
63
64
|
const { dynamicHireRelat = '' } = config
|
|
64
65
|
// 组装成此数据结果,用于后续的获取对应字段=====start====
|
|
65
66
|
const dynamicCodeInfos = dynamicHireRelat.split('->').map(code => {
|
|
@@ -122,11 +123,18 @@ function getRelateConfigs(codesStr, config) {
|
|
|
122
123
|
list.push(fincCg)
|
|
123
124
|
sameIdx = null
|
|
124
125
|
} else {
|
|
125
|
-
|
|
126
|
-
const fincCg =
|
|
126
|
+
if (pmPageMetaListTypeList.includes(type)) {
|
|
127
|
+
const fincCg = cg?.pmPageMetaList?.find(childCg => childCg.metaCode === code)
|
|
127
128
|
if (!fincCg) return
|
|
128
129
|
list.push(fincCg)
|
|
129
|
-
}
|
|
130
|
+
} else {
|
|
131
|
+
cg.multiPmPageMetaList.forEach(childCgList => {
|
|
132
|
+
const fincCg = childCgList.find(childCg => childCg.metaCode === code)
|
|
133
|
+
if (!fincCg) return
|
|
134
|
+
list.push(fincCg)
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
|
|
130
138
|
}
|
|
131
139
|
} else {
|
|
132
140
|
const fincCg = cg?.pmPageMetaList?.find(childCg => childCg.metaCode === code)
|
|
@@ -174,10 +182,10 @@ export function canTransNumber(val) {
|
|
|
174
182
|
/**
|
|
175
183
|
* 根据code path 获取到对应的组件或者label
|
|
176
184
|
*/
|
|
177
|
-
export function getCurrentComp(codesStr) {
|
|
185
|
+
export function getCurrentComp(codesStr, type) {
|
|
178
186
|
if (!codesStr) return null
|
|
179
187
|
const { config } = this
|
|
180
|
-
return getRelateConfigs.call(this, codesStr, config)
|
|
188
|
+
return getRelateConfigs.call(this, codesStr, config, type)
|
|
181
189
|
}
|
|
182
190
|
|
|
183
191
|
export function parseRules(config) {
|
package/src/utils/common.js
CHANGED
|
@@ -436,3 +436,49 @@ export function getValueDeep(obj, key) {
|
|
|
436
436
|
}
|
|
437
437
|
}, obj)
|
|
438
438
|
}
|
|
439
|
+
|
|
440
|
+
// 深度清空对象上面的属性
|
|
441
|
+
|
|
442
|
+
export function createEmptyCopy(source, cache = new WeakMap()) {
|
|
443
|
+
// 处理非对象类型(基础类型)
|
|
444
|
+
if (source === null || typeof source !== 'object') {
|
|
445
|
+
switch (typeof source) {
|
|
446
|
+
case 'string': return '';
|
|
447
|
+
case 'number': return '';
|
|
448
|
+
case 'boolean': return null;
|
|
449
|
+
default: return null; // undefined, symbol, function 等返回 null
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// 处理循环引用:如果已缓存,直接返回缓存的副本
|
|
454
|
+
if (cache.has(source)) {
|
|
455
|
+
return cache.get(source);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// 根据类型创建空结构
|
|
459
|
+
let copy;
|
|
460
|
+
if (Array.isArray(source)) {
|
|
461
|
+
// 数组:递归处理每个元素
|
|
462
|
+
copy = [];
|
|
463
|
+
cache.set(source, copy); // 缓存当前对象,避免循环引用
|
|
464
|
+
copy.push(...source.map(item => createEmptyCopy(item, cache)));
|
|
465
|
+
} else if (source instanceof Date) {
|
|
466
|
+
// Date:返回初始时间(可选)
|
|
467
|
+
copy = null;
|
|
468
|
+
} else if (source instanceof Set) {
|
|
469
|
+
// Set:清空为空的 Set
|
|
470
|
+
copy = new Set();
|
|
471
|
+
} else if (source instanceof Map) {
|
|
472
|
+
// Map:清空为空的 Map
|
|
473
|
+
copy = new Map();
|
|
474
|
+
} else {
|
|
475
|
+
// 普通对象:递归处理每个属性
|
|
476
|
+
copy = {};
|
|
477
|
+
cache.set(source, copy);
|
|
478
|
+
for (const key of Object.keys(source)) {
|
|
479
|
+
copy[key] = createEmptyCopy(source[key], cache);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return copy;
|
|
484
|
+
}
|