resolver-egretimp-plus 0.1.101 → 0.1.103
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/h5/index.js +18 -18
- package/dist/web/index.js +2 -2
- package/package.json +1 -1
- package/src/analysisComponent.jsx +10 -3
- package/src/components/helper/eventOrchestration.js +3 -3
- package/src/components/packages-H5/CustomComponentTableH5.vue +18 -0
- package/src/components/packages-web/CustomComponentSelectEmployees.vue +4 -4
- package/src/components/packages-web/ElInput.jsx +0 -1
- package/src/hooks/index.js +20 -8
- package/src/utils/render.jsx +11 -3
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, defineAsyncComponent, getCurrentInstance, inject, onBeforeMount, provide, ref, watch } from 'vue'
|
|
2
|
-
import { commonPropsType, definePrivatelyProp, EXECTE_CLICK_EVENT_COMPONENTS, findComponent, getComponentPropsKeys, getComponentSolt, hasOwn, isPlainObject } from './utils/index.js'
|
|
2
|
+
import { COFNGI_KEY_EVENT_FLAG, commonPropsType, definePrivatelyProp, EXECTE_CLICK_EVENT_COMPONENTS, findComponent, getComponentPropsKeys, getComponentSolt, hasOwn, isPlainObject } from './utils/index.js'
|
|
3
3
|
import { useVmodels } from './hooks/index.js'
|
|
4
4
|
import { getRenderComponentProps, generateFormItemPolyfill } from './utils/index.js'
|
|
5
5
|
import rulesDriver from './rules/rulesDriver'
|
|
@@ -191,7 +191,14 @@ export default {
|
|
|
191
191
|
const obj = {}
|
|
192
192
|
fnComponentkeys.value.forEach(key => {
|
|
193
193
|
if (hasOwn(props.config, key)) {
|
|
194
|
-
|
|
194
|
+
const config = props.config
|
|
195
|
+
if (COFNGI_KEY_EVENT_FLAG.test(key) && typeof config[key] === 'function') {
|
|
196
|
+
obj[key] = function(...arg) {
|
|
197
|
+
return config[key](...arg, vm)
|
|
198
|
+
}
|
|
199
|
+
} else {
|
|
200
|
+
obj[key] = config[key]
|
|
201
|
+
}
|
|
195
202
|
}
|
|
196
203
|
})
|
|
197
204
|
return obj
|
|
@@ -303,7 +310,7 @@ export default {
|
|
|
303
310
|
})
|
|
304
311
|
return () => {
|
|
305
312
|
const componentProps = getFncomponentProps()
|
|
306
|
-
const compProps = getRenderComponentProps({config: props.config, props, component: props.component, modelValue, selects, lang: lang.value})
|
|
313
|
+
const compProps = getRenderComponentProps({config: props.config, props, component: props.component, modelValue, selects, lang: lang.value, vm: instance.proxy})
|
|
307
314
|
const compPropsOnClick = compProps?.onClick
|
|
308
315
|
delete compProps.onClick
|
|
309
316
|
const formItemPolyfill = generateFormItemPolyfill(props.config, lang.value, compProps, _isH5?.value, {
|
|
@@ -266,7 +266,7 @@ export function getTableConfig(outParamMappingList = [], { dynamicMapComp, dynam
|
|
|
266
266
|
const configCode = configCodes[0]
|
|
267
267
|
if (configCode) {
|
|
268
268
|
const compConfig = dynamicMapComp[configCode]
|
|
269
|
-
if (compConfig.metaType === 'CustomComponentTable') {
|
|
269
|
+
if (compConfig.metaType === 'CustomComponentTable' || compConfig.metaType === 'CustomComponentTableH5') {
|
|
270
270
|
return compConfig
|
|
271
271
|
}
|
|
272
272
|
}
|
|
@@ -312,8 +312,8 @@ export function openDailg({
|
|
|
312
312
|
orignParam,
|
|
313
313
|
}
|
|
314
314
|
}) || []
|
|
315
|
-
let mapList = {}
|
|
316
|
-
let selectionsObj = {}
|
|
315
|
+
let mapList = {} // 在返回的是list的数据的时候,我们支持返回数据的key跟父页面的编码不一致,所以这里需要做一个映射
|
|
316
|
+
let selectionsObj = {} // 打开弹框的时候,如果是多选表格数据,这个的作用就是回显已经选择的数据(list数据需要选择主键,也就是primaryKeyFlag)
|
|
317
317
|
|
|
318
318
|
if (isList ) {
|
|
319
319
|
const primaryKeys = []
|
|
@@ -114,6 +114,11 @@ watch(() => page.pageNum, (val) => {
|
|
|
114
114
|
modelValue.value = ret
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
+
|
|
118
|
+
// 以下是配置的点击事件服务所绑定的调用方法 ==== start ======
|
|
119
|
+
const serviceFn = props.config?.serviceCurrentChange
|
|
120
|
+
serviceFn?.(val, props, page)
|
|
121
|
+
// 以下是配置的点击事件服务所绑定的调用方法 ==== end ======
|
|
117
122
|
})
|
|
118
123
|
// 页面大小变动
|
|
119
124
|
watch(() => page.pageSize, (val) => {
|
|
@@ -128,6 +133,11 @@ watch(() => page.pageSize, (val) => {
|
|
|
128
133
|
modelValue.value = ret
|
|
129
134
|
}
|
|
130
135
|
}
|
|
136
|
+
|
|
137
|
+
// 以下是配置的点击事件服务所绑定的调用方法 ==== start ======
|
|
138
|
+
const serviceFn = props.config?.serviceSizeChange
|
|
139
|
+
serviceFn?.(val, props, page)
|
|
140
|
+
// 以下是配置的点击事件服务所绑定的调用方法 ==== end ======
|
|
131
141
|
})
|
|
132
142
|
|
|
133
143
|
const pmPageMetaList = computed(() => {
|
|
@@ -301,6 +311,14 @@ function normalTableRowValue(row) {
|
|
|
301
311
|
})
|
|
302
312
|
return ret
|
|
303
313
|
}
|
|
314
|
+
|
|
315
|
+
defineExpose({
|
|
316
|
+
page,
|
|
317
|
+
changePage: (val, key) => {
|
|
318
|
+
page[key || 'pageNum'] = val
|
|
319
|
+
},
|
|
320
|
+
})
|
|
321
|
+
|
|
304
322
|
</script>
|
|
305
323
|
<template>
|
|
306
324
|
<div>
|
|
@@ -104,9 +104,9 @@ const initSelEmployee = async () => {
|
|
|
104
104
|
const data = modelValue.value ? modelValue.value.split(separator.value) : []
|
|
105
105
|
let deptForUser = {}
|
|
106
106
|
if (props.deptIds || props.excludeDeptIds) {
|
|
107
|
-
deptForUser.deptIds = isString(
|
|
108
|
-
deptForUser.excludeDeptIds = isString(
|
|
109
|
-
deptForUser.cascade = isBoolean(
|
|
107
|
+
deptForUser.deptIds = isString(props.deptIds) ? props.deptIds : ''
|
|
108
|
+
deptForUser.excludeDeptIds = isString(props.excludeDeptIds) ? props.excludeDeptIds : ''
|
|
109
|
+
deptForUser.cascade = isBoolean(props.cascade) ? props.cascade : !!(props.cascade)
|
|
110
110
|
}
|
|
111
111
|
const initParams = {
|
|
112
112
|
el: `#${metaCode.value}`,
|
|
@@ -130,7 +130,7 @@ const initSelEmployee = async () => {
|
|
|
130
130
|
if (props.disabled) {
|
|
131
131
|
initParams.userIds = data
|
|
132
132
|
}
|
|
133
|
-
console.log(
|
|
133
|
+
console.log(`metaCode:${props?.config?.metaCode},initParams:`, initParams)
|
|
134
134
|
initSelUser(initParams)
|
|
135
135
|
unWatch && unWatch()
|
|
136
136
|
}, {
|
package/src/hooks/index.js
CHANGED
|
@@ -63,7 +63,7 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
|
|
|
63
63
|
}
|
|
64
64
|
const modelValue = props.modelValue
|
|
65
65
|
const metaCode = metaCodeKey
|
|
66
|
-
if (!metaCode) return
|
|
66
|
+
// if (!metaCode) return
|
|
67
67
|
if (!modelValue) {
|
|
68
68
|
// frameSet 表示的是一帧之内重复设置对应metaCode的值
|
|
69
69
|
// 一帧之内重复设置metaCode的值需要进行merge,也就是下面modelValueDeepMerge走的逻辑
|
|
@@ -76,23 +76,35 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
|
|
|
76
76
|
nextTick(() => {
|
|
77
77
|
config.parent && (config.parent.frameSet = false)
|
|
78
78
|
})
|
|
79
|
-
|
|
79
|
+
let updateValue = {
|
|
80
80
|
[metaCode]: val
|
|
81
|
-
}
|
|
81
|
+
}
|
|
82
|
+
if (!metaCode) {
|
|
83
|
+
updateValue = val
|
|
84
|
+
}
|
|
85
|
+
emit('update:modelValue', updateValue)
|
|
82
86
|
} else {
|
|
87
|
+
let updateValue = modelValue?.[metaCode]
|
|
83
88
|
if (config?.frameSet) {
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
if (!metaCode) {
|
|
90
|
+
updateValue = modelValue
|
|
91
|
+
}
|
|
92
|
+
if (updateValue) {
|
|
93
|
+
if (typeof updateValue === 'object' || typeof val === 'object') {
|
|
94
|
+
val = modelValueDeepMerge(updateValue, val)
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
97
|
}
|
|
90
|
-
if (isNonRefType(
|
|
98
|
+
if (isNonRefType(updateValue) && isNonRefType(val) && updateValue === val) {
|
|
91
99
|
// 这边的值没有变,就不用出触发下面的其他动作了
|
|
92
100
|
return
|
|
93
101
|
}
|
|
94
102
|
try {
|
|
95
|
-
|
|
103
|
+
if (!metaCode) {
|
|
104
|
+
props.modelValue = val
|
|
105
|
+
} else {
|
|
106
|
+
props.modelValue[metaCode] = val
|
|
107
|
+
}
|
|
96
108
|
} catch (error) {
|
|
97
109
|
console.log('config', config, metaCode)
|
|
98
110
|
}
|
package/src/utils/render.jsx
CHANGED
|
@@ -37,6 +37,8 @@ import loadModule from './loadModule.js'
|
|
|
37
37
|
import { h } from 'vue'
|
|
38
38
|
import dayjs from 'dayjs'
|
|
39
39
|
|
|
40
|
+
export const COFNGI_KEY_EVENT_FLAG = /^on[A-Z]/
|
|
41
|
+
|
|
40
42
|
// 解析配置中的defStyle属性
|
|
41
43
|
export function parseDefStyle(defStyle) {
|
|
42
44
|
try {
|
|
@@ -453,7 +455,7 @@ export function getComponentForConfig({messageInstance, config, disabled, getNat
|
|
|
453
455
|
}
|
|
454
456
|
|
|
455
457
|
// 获取渲染组件的props配置数据
|
|
456
|
-
export function getRenderComponentProps({ props, component, modelValue, selects, lang }) {
|
|
458
|
+
export function getRenderComponentProps({ props, component, modelValue, selects, lang, vm }) {
|
|
457
459
|
if (!component) return {}
|
|
458
460
|
let config = props.config
|
|
459
461
|
if (findComponent(['CustomComponentTabs'], config.renderby || config.metaType) !== -1) {
|
|
@@ -472,7 +474,13 @@ export function getRenderComponentProps({ props, component, modelValue, selects,
|
|
|
472
474
|
if (propsKeys) {
|
|
473
475
|
propsKeys.forEach(key => {
|
|
474
476
|
if (hasOwn(config, key)) {
|
|
475
|
-
|
|
477
|
+
if (COFNGI_KEY_EVENT_FLAG.test(key) && typeof config[key] === 'function') {
|
|
478
|
+
defprops[key] = function(...arg) {
|
|
479
|
+
return config[key](...arg, vm)
|
|
480
|
+
}
|
|
481
|
+
} else {
|
|
482
|
+
defprops[key] = config[key]
|
|
483
|
+
}
|
|
476
484
|
}
|
|
477
485
|
})
|
|
478
486
|
}
|
|
@@ -1025,7 +1033,7 @@ export function getComponentPropsKeys(comp, config) {
|
|
|
1025
1033
|
let emitsKyes = []
|
|
1026
1034
|
if (config) {
|
|
1027
1035
|
Object.keys(config).forEach(key => {
|
|
1028
|
-
if (
|
|
1036
|
+
if (COFNGI_KEY_EVENT_FLAG.test(key) && !['onVnodeMounted'].includes(key)) {
|
|
1029
1037
|
emitsKyes.push(key)
|
|
1030
1038
|
}
|
|
1031
1039
|
})
|