resolver-egretimp-plus 0.0.85 → 0.0.87

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.85",
3
+ "version": "0.0.87",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -172,8 +172,8 @@ export default {
172
172
  const _isH5 = inject('_isH5')
173
173
  const lang = inject('lang')
174
174
  const rootValue = inject('rootValue')
175
- const onClick = (e) => {
176
- e.stopPropagation()
175
+ const onClick = (e, { beforeRequestService, afterRequestService } = {}) => {
176
+ e?.stopPropagation?.()
177
177
  const context = {
178
178
  props,
179
179
  dynamicMapComp,
@@ -187,10 +187,12 @@ export default {
187
187
  appContext
188
188
  }
189
189
  attrs?.onClick?.call(context, e) // 如果配置中有点击事件
190
- executeClickEvents()
190
+ executeClickEvents({ beforeRequestService, afterRequestService })
191
191
  }
192
- function executeClickEvents() {
192
+ function executeClickEvents({ beforeRequestService, afterRequestService }) {
193
193
  executeEventOrchestration({
194
+ beforeRequestService,
195
+ afterRequestService,
194
196
  components,
195
197
  props,
196
198
  requestTraceId: requestTraceId?.value,
@@ -225,7 +227,7 @@ export default {
225
227
  onVnodeMounted={onVnodeMounted}
226
228
  onVnodeUnmounted={onVnodeUnmounted}
227
229
  {...currentAttrs.value}
228
- onClick={(e) => {onClick(e);compPropsOnClick?.(e)}}
230
+ onClick={(e, params) => {onClick(e, params);compPropsOnClick?.(e)}}
229
231
  {...componentProps.value}
230
232
  {...compProps}
231
233
  {...vModelObjs}
@@ -104,8 +104,8 @@ defineExpose({
104
104
  <ElConfigProvider :locale="locale">
105
105
  <ElDialog class="open-child-frame"
106
106
  :close-on-click-modal="false"
107
- :width="dialogWidth"
108
107
  v-bind="dialogProps"
108
+ :width="dialogWidth"
109
109
  v-model="dialogVisible"
110
110
  :style="dialogStyle"
111
111
  >
@@ -453,7 +453,25 @@ function closePage(lcpPageClosedMapVO) {
453
453
  }
454
454
  }
455
455
 
456
- export async function executeEventOrchestration({components, props, requestTraceId, axiosInstance, polyfillConfigs, buttonActions, rootValue, confirmInstance, dialogReq, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
456
+ export async function executeEventOrchestration({
457
+ beforeRequestService,
458
+ afterRequestService,
459
+ components,
460
+ props,
461
+ requestTraceId,
462
+ axiosInstance,
463
+ polyfillConfigs,
464
+ buttonActions,
465
+ rootValue,
466
+ confirmInstance,
467
+ dialogReq,
468
+ dynamicMapComp,
469
+ messageInstance,
470
+ openChildDialog,
471
+ messageCb,
472
+ lang,
473
+ appContext
474
+ } = {}) {
457
475
  const lcpPageRuleVOLis = props.config?.lcpPageRuleVOList || []
458
476
  const PageServiceMapVOList = props.config.lcpPageServiceMapVOList || []
459
477
  const mixinServiceConfig = PageServiceMapVOList.find(service => service.serviceType === '1')
@@ -475,9 +493,30 @@ export async function executeEventOrchestration({components, props, requestTrace
475
493
 
476
494
  if (PageServiceMapVOList?.length) {
477
495
  // 定义的请求前钩子
478
- const beforeRequestService = props.config?.beforeRequestService
496
+ const configBeforeRequestService = props.config?.beforeRequestService
497
+ let normalBeforeRequestService = null
498
+ if (configBeforeRequestService || beforeRequestService) {
499
+ normalBeforeRequestService = async (...arg) => {
500
+ let ret = true
501
+ if (beforeRequestService) {
502
+ ret = beforeRequestService?.(...arg)
503
+ }
504
+ const beforeRequestServiceRetValid = await beforeRequestServiceRet
505
+ if (!beforeRequestServiceRetValid) {
506
+ return
507
+ }
508
+ }
509
+ return configBeforeRequestService?.(...arg)
510
+ }
479
511
  // 定义的请求后钩子
480
- const afterRequestService = props.config?.afterRequestService
512
+ const configAfterRequestService = props.config?.afterRequestService
513
+ let normalAfterRequestService = null
514
+ if (configAfterRequestService || afterRequestService) {
515
+ normalAfterRequestService = (...arg) => {
516
+ afterRequestService?.(...arg)
517
+ configAfterRequestService?.(...arg)
518
+ }
519
+ }
481
520
 
482
521
  const dynamicHireRelat = props.config?.dynamicHireRelat
483
522
  dispatchClickEvents({
@@ -491,8 +530,8 @@ export async function executeEventOrchestration({components, props, requestTrace
491
530
  messageCb,
492
531
  compConfig: props.config,
493
532
  dialogReq,
494
- beforeRequestService,
495
- afterRequestService
533
+ beforeRequestService: normalBeforeRequestService,
534
+ afterRequestService: normalAfterRequestService
496
535
  })
497
536
  }
498
537
  const lcpPagePopupMapVO = props.config.lcpPagePopupMapVO
@@ -7,7 +7,6 @@ defineOptions({
7
7
  inheritAttrs: false
8
8
  })
9
9
 
10
- const collapseLimt = 5
11
10
  const isCollapse = ref(true)
12
11
  const modelValue = defineModel()
13
12
  const attrs = useAttrs()
@@ -15,6 +14,9 @@ const lang = inject('lang')
15
14
  const props = defineProps({
16
15
  ...commonPropsType,
17
16
  })
17
+ const collapseLimt = computed(() => {
18
+ return props.config?.collapseLimt || 5
19
+ })
18
20
  const collapseProps = computed(() => {
19
21
  return {
20
22
  title: lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
@@ -28,10 +30,10 @@ const pmPageMetaList = computed(() => {
28
30
  return props.config?.pmPageMetaList?.filter(item => !item.collapseSlot) || []
29
31
  })
30
32
  const showCollapseBtn = computed(() => {
31
- return pmPageMetaList.value.filter(item => item.displayType != DISPLAY_HIDDEN && item.hidden != '1')?.length > collapseLimt
33
+ return pmPageMetaList.value.filter(item => item.displayType != DISPLAY_HIDDEN && item.hidden != '1')?.length > collapseLimt.value
32
34
  })
33
35
  const showPageMeteList = computed(() => {
34
- return pmPageMetaList.value.filter(item => item.displayType != DISPLAY_HIDDEN && item.hidden != '1').slice(0, isCollapse.value ? collapseLimt : Number.MAX_VALUE)
36
+ return pmPageMetaList.value.filter(item => item.displayType != DISPLAY_HIDDEN && item.hidden != '1').slice(0, isCollapse.value ? collapseLimt.value : Number.MAX_VALUE)
35
37
  })
36
38
  const collapseLabel = computed(() => {
37
39
  const isCh = lang?.value?.indexOf('zh') > -1
@@ -469,13 +469,8 @@ export default {
469
469
  }
470
470
  const config = multiPmPageMetaList.value?.[$index]?.[configIdx]
471
471
  return (
472
- <div>
473
- requiredFlag: {config.requiredFlag}
474
- {
475
- tableColumnNotRender(config) ? null :
476
- <Renderer key={`${config.columnId}-${config.rowIndex}`} class="error-tip-block" modelValue={getValue($index)} rowScope={{row, $index}} onUpdate:modelValue={(val) => { onUpdateModelValue(val, $index) }} config={config}></Renderer>
477
- }
478
- </div>
472
+ tableColumnNotRender(config) ? null :
473
+ <Renderer key={`${config.columnId}-${config.rowIndex}`} class="error-tip-block" modelValue={getValue($index)} rowScope={{row, $index}} onUpdate:modelValue={(val) => { onUpdateModelValue(val, $index) }} config={config}></Renderer>
479
474
  )
480
475
  }
481
476
  }}
@@ -74,9 +74,10 @@ const parentRootValue = inject('_parentRootValue', {})
74
74
 
75
75
  const routeQuery= route?.query
76
76
 
77
- const buttonAction = async (...arg) => {
77
+ // params主要用于外部直接调用click方法时候传入的
78
+ const buttonAction = async (e, params) => {
78
79
  const lastClick = () => {
79
- attrs?.onClick?.(...arg)
80
+ attrs?.onClick?.(e, params)
80
81
  }
81
82
  const actionKey = props.config?.clickActionKey || props.config?.buttonActionKey || props.config?.hireRelat
82
83
  const actionFn = buttonActions[actionKey]
@@ -113,4 +114,9 @@ const buttonAction = async (...arg) => {
113
114
  lastClick()
114
115
  }
115
116
  }
117
+ defineExpose({
118
+ click: (params) => {
119
+ buttonAction(null, params)
120
+ }
121
+ })
116
122
  </script>