resolver-egretimp-plus 0.0.48 → 0.0.49

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -6,8 +6,14 @@ const props = defineProps({
6
6
  type: [Object, Function],
7
7
  default: () => null
8
8
  },
9
- config: [Object, Array],
10
- lang: String,
9
+ config: {
10
+ type: Object,
11
+ default: () => ({})
12
+ },
13
+ lang: {
14
+ type: String,
15
+ default: 'zh'
16
+ },
11
17
  labelWidth: [String, Number]
12
18
  })
13
19
  const attrs = useAttrs()
@@ -47,9 +47,9 @@ const selects = inject('selects')
47
47
  const rootValue = inject('rootValue')
48
48
  const dataLoad = inject('dataLoad')
49
49
  const rootForm = inject('rootForm')
50
+ const validate = inject('_validate', () => {})
50
51
  const routeQuery= route?.query
51
52
 
52
-
53
53
  const buttonAction = (...arg) => {
54
54
  attrs?.onClick?.(...arg) // 如果配置中有点击事件
55
55
  const actionKey = props.config?.clickActionKey || props.config?.buttonActionKey || props.config?.hireRelat
@@ -62,7 +62,8 @@ const buttonAction = (...arg) => {
62
62
  rootValue,
63
63
  dataLoad,
64
64
  rootForm,
65
- routeQuery
65
+ routeQuery,
66
+ validate
66
67
  }, appContext)
67
68
  }
68
69
  </script>
@@ -5,8 +5,7 @@
5
5
  </template>
6
6
  <script setup>
7
7
  import Renderer from '../../renderer.jsx'
8
- import { computed, inject } from "vue"
9
-
8
+ import { computed, inject, onMounted, reactive, ref, watch } from "vue"
10
9
 
11
10
  const emits = defineEmits(['update:modelValue'])
12
11
  const props = defineProps({
@@ -21,13 +20,21 @@ const props = defineProps({
21
20
  },
22
21
  })
23
22
 
23
+ const val = computed({
24
+ get() {
25
+ return props.modelValue
26
+ },
27
+ set(val) {
28
+ emits('update:modelValue', val)
29
+ }
30
+ })
24
31
  const rootForm = inject('rootForm')
25
32
  const refFn = e => {
26
33
  if (props.config?.rootForm) {
27
34
  rootForm.value = e
35
+ rootForm?.value?.setModel?.(val);
28
36
  }
29
37
  }
30
-
31
38
  const formProps = computed(() => {
32
39
  return {
33
40
  validatefirst: props.config?.validatefirst == '1' ? true : false,
@@ -41,14 +48,6 @@ const formProps = computed(() => {
41
48
 
42
49
  const pmPageMetaList = computed(() => props.config.pmPageMetaList)
43
50
 
44
- const val = computed({
45
- get() {
46
- return props.modelValue
47
- },
48
- set(val) {
49
- emits('update:modelValue', val)
50
- }
51
- })
52
51
  defineExpose({
53
52
  val
54
53
  })
@@ -69,6 +69,7 @@ const selects = inject('selects')
69
69
  const rootValue = inject('rootValue')
70
70
  const dataLoad = inject('dataLoad')
71
71
  const rootForm = inject('rootForm')
72
+ const validate = inject('_validate', () => {})
72
73
 
73
74
  const routeQuery= route?.query
74
75
 
@@ -85,7 +86,8 @@ const buttonAction = async (...arg) => {
85
86
  rootValue: rootValue?.value,
86
87
  dataLoad,
87
88
  rootForm,
88
- routeQuery
89
+ routeQuery,
90
+ validate
89
91
  }, appContext)
90
92
  }
91
93
  </script>
package/src/index.jsx CHANGED
@@ -178,7 +178,6 @@ export default {
178
178
  }
179
179
  )
180
180
  })
181
-
182
181
  provide('_messageCb', props.messageCb)
183
182
  provide('_rootStore', rootStore)
184
183
  provide('_openChildDialogInstance', toRef(props, 'openChildDialogInstance'))
@@ -208,6 +207,7 @@ export default {
208
207
  const validate = (cb) => {
209
208
  toValidate(rootForm, cb, dynamicMapComp)
210
209
  }
210
+ provide('_validate', validate)
211
211
  expose({
212
212
  dynamicMapComp,
213
213
  validate,
@@ -337,7 +337,12 @@ export function getComponentForConfig({config, disabled, getNativeComps}) {
337
337
  if (renderby && typeof renderby === 'string') {
338
338
  let renderbyComp = resolveAssetComponents(allComps, renderby) //则通过传入的获取组件
339
339
  if (!renderbyComp) {
340
- renderbyComp = resolveComponent(renderby) // 实例上绑定的组件
340
+ try {
341
+ renderbyComp = resolveComponent(renderby) // 实例上绑定的组件
342
+ } catch (error) {
343
+ console.log('resolveComponent fail, config:', config)
344
+ renderbyComp = <div>not component</div>
345
+ }
341
346
  }
342
347
  component = renderbyComp || component
343
348
  }
@@ -614,8 +619,10 @@ export function generateFormItemPolyfill(config, lang, compProps, _isH5, params)
614
619
  }
615
620
 
616
621
  function getFormItemExtendProps(config, lang, params) {
622
+ const propAttr = config.dynamicHireRelat ? config.dynamicHireRelat?.split('->') : []
623
+ const prop = propAttr.join('.')
617
624
  return {
618
- prop: config.dynamicHireRelat,
625
+ prop,
619
626
  rules: getFormItemRule(config, lang, params),
620
627
  class: {
621
628
  'content-right': config.contentRight,