resolver-egretimp-plus 0.1.115 → 0.1.116
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 +9 -9
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/components/packages-web/CustomComponentPlain.vue +5 -1
- package/src/hooks/watchRuels.js +94 -0
- package/src/index.jsx +9 -2
- package/src/rulesOfDate/eventsSupplement.js +559 -0
- package/src/rulesOfDate/parseCondition.js +257 -0
- package/src/rulesOfDate/ruleUtils.js +343 -0
- package/src/rulesOfDate/rulesDriver.js +67 -0
- package/src/utils/common.js +24 -16
- package/src/utils/const.js +1 -0
- package/src/utils/render.jsx +7 -1
- package/src-bak/components/packages-H5/CustomComponentCollapseH5.vue +6 -2
- package/src-bak/components/packages-web/CustomComponentPlain.vue +6 -2
- package/src-bak/components/packages-web/CustomComponentTable.jsx +41 -40
- package/src-bak/index.jsx +21 -18
- package/src-bak/rules/rulesDriver.js +21 -0
- package/src-bak/utils/render.jsx +5 -5
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span class="custom-component-plain" :class="classObj" @click="clickAction">{{ props.formatter?.(value) ?? value }}</span>
|
|
2
|
+
<span class="custom-component-plain" :class="classObj" @click.stop.self="clickAction">{{ props.formatter?.(value) ?? value }}</span>
|
|
3
3
|
</template>
|
|
4
4
|
<script setup>
|
|
5
5
|
import { findComponent } from '../../utils/common';
|
|
@@ -9,6 +9,10 @@ import dayjs from 'dayjs'
|
|
|
9
9
|
import { isNaN } from '../../utils/is';
|
|
10
10
|
import { useFormItem } from 'element-plus'
|
|
11
11
|
|
|
12
|
+
defineOptions({
|
|
13
|
+
inheritAttrs: false
|
|
14
|
+
})
|
|
15
|
+
|
|
12
16
|
const { formItem: elFormItem } = useFormItem()
|
|
13
17
|
const modelValue = defineModel()
|
|
14
18
|
const props = defineProps({
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import rulesDriver from "../rulesOfDate/rulesDriver"
|
|
2
|
+
import { getPathVal, isCycleConfig } from "../utils"
|
|
3
|
+
import { unref, watch } from "vue"
|
|
4
|
+
|
|
5
|
+
export function toWatchRules({
|
|
6
|
+
rules,
|
|
7
|
+
rootValue,
|
|
8
|
+
mapComp,
|
|
9
|
+
route,
|
|
10
|
+
lang,
|
|
11
|
+
}) {
|
|
12
|
+
const ruleKeys = Object.keys(rules)
|
|
13
|
+
ruleKeys.forEach(originKey => {
|
|
14
|
+
let comps = []
|
|
15
|
+
let key = originKey
|
|
16
|
+
while (key) {
|
|
17
|
+
const comp = mapComp[key]
|
|
18
|
+
if (comp) {
|
|
19
|
+
comps.unshift(comp)
|
|
20
|
+
const convertkey = key.replace(/->\w*$/, '')
|
|
21
|
+
if (convertkey === key) {
|
|
22
|
+
key = ''
|
|
23
|
+
} else {
|
|
24
|
+
key = convertkey
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
comps = []
|
|
28
|
+
key = ''
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (comps && comps.length) {
|
|
32
|
+
function watchCb(currentPath) {
|
|
33
|
+
rulesDriver({
|
|
34
|
+
rules: rules[originKey],
|
|
35
|
+
mapComp,
|
|
36
|
+
rootValue,
|
|
37
|
+
route,
|
|
38
|
+
lang,
|
|
39
|
+
currentPath,
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
watchRuleTrace({comps, rootValue, watchCb})
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function watchRuleTrace({comps, rootValue, watchCb}, prefix = '', idx = 0, unWatchsList = []) {
|
|
48
|
+
if (comps && comps.length) {
|
|
49
|
+
const comp = comps[idx]
|
|
50
|
+
prefix += prefix ? `->${comp.metaCode}` : comp.metaCode
|
|
51
|
+
if (comps.length === (idx + 1)) {
|
|
52
|
+
const unWatch = watch(() => getPathVal(unref(rootValue), prefix, '->'), (val) => {
|
|
53
|
+
// 开始执行规则
|
|
54
|
+
console.log('watch====:', prefix)
|
|
55
|
+
watchCb?.(prefix)
|
|
56
|
+
}, {
|
|
57
|
+
immediate: true
|
|
58
|
+
})
|
|
59
|
+
// 这边先执行,因为当前的_unWatchs里面只放子级的watch
|
|
60
|
+
unWatchsList?.forEach(list => {
|
|
61
|
+
list?.push(unWatch)
|
|
62
|
+
})
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
if (isCycleConfig(comp)) {
|
|
66
|
+
const _mapUnWatchs = comp._mapUnWatchs || (comp._mapUnWatchs = Object.create(null))
|
|
67
|
+
const _rowMapWatchs = _mapUnWatchs[prefix] || (_mapUnWatchs[prefix] = new Map())
|
|
68
|
+
watch(() => getPathVal(unref(rootValue), prefix, '->')?.length, () => {
|
|
69
|
+
const list = getPathVal(unref(rootValue), prefix, '->') || []
|
|
70
|
+
list.forEach((row, index) => {
|
|
71
|
+
if (!_rowMapWatchs.get(row)) {
|
|
72
|
+
const childUnWatchs = []
|
|
73
|
+
unWatchsList.push(childUnWatchs)
|
|
74
|
+
const currentPrefix = `${prefix}[${index}]`
|
|
75
|
+
idx++
|
|
76
|
+
watchRuleTrace({comps, rootValue, watchCb}, currentPrefix, idx, [...unWatchsList])
|
|
77
|
+
_rowMapWatchs.set(row, {key: currentPrefix, childUnWatchs})
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
const mapKeys = _rowMapWatchs.keys()
|
|
81
|
+
mapKeys.forEach(row => {
|
|
82
|
+
if (!list.some(row2 => row2 === row)) {
|
|
83
|
+
_rowMapWatchs.get(row)?.childUnWatchs?.forEach(un => un?.())
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
}, {
|
|
87
|
+
immediate: true
|
|
88
|
+
})
|
|
89
|
+
} else {
|
|
90
|
+
idx++
|
|
91
|
+
watchRuleTrace({comps, rootValue, watchCb}, prefix, idx)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
package/src/index.jsx
CHANGED
|
@@ -8,6 +8,7 @@ import { generateRequester } from "./utils/request.js"
|
|
|
8
8
|
import { executeLoadServices, resetConfigEventInit } from "./components/helper/resolver.js"
|
|
9
9
|
import { createEmptyCopy, deepMerge } from "./utils/index.js"
|
|
10
10
|
import { initBpm, SUBMIT_TYPE, bpmInstance } from "./bpm/bpmInstance.js"
|
|
11
|
+
import { toWatchRules } from "./hooks/watchRuels.js"
|
|
11
12
|
// import { RuleExecuter } from "./rulesImp/index.js"
|
|
12
13
|
export default {
|
|
13
14
|
name: 'Resolver',
|
|
@@ -212,9 +213,8 @@ export default {
|
|
|
212
213
|
const rootStore = reactive({})
|
|
213
214
|
const nativeDataLoad = ref(false)
|
|
214
215
|
// const router = useRouter()
|
|
215
|
-
|
|
216
|
+
const route = useRoute()
|
|
216
217
|
const router = {}
|
|
217
|
-
const route = {}
|
|
218
218
|
const axiosInstance = ref(props.axiosInstance)
|
|
219
219
|
watch(() => {
|
|
220
220
|
return props.axiosConfig
|
|
@@ -403,6 +403,13 @@ export default {
|
|
|
403
403
|
emit('update:modelValue', val)
|
|
404
404
|
}
|
|
405
405
|
})
|
|
406
|
+
// toWatchRules({
|
|
407
|
+
// rules: hireRelatMapRulesRef.value,
|
|
408
|
+
// rootValue: toRef(props, 'modelValue'),
|
|
409
|
+
// mapComp: mapCompRef.value,
|
|
410
|
+
// route,
|
|
411
|
+
// lang: props.lang,
|
|
412
|
+
// })
|
|
406
413
|
onMounted(() => {
|
|
407
414
|
if (props.openBpm) {
|
|
408
415
|
initBpm(props.bpmMessage, props.bpmActions, props.bpmConfigs, {
|