resolver-egretimp-plus 0.1.75 → 0.1.76

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.1.75",
3
+ "version": "0.1.76",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -9,6 +9,7 @@ import { executeEventOrchestration } from './components/helper/eventOrchestratio
9
9
  import { useRouter } from 'vue-router'
10
10
  import { onErrorCaptured } from 'vue'
11
11
  import LoadingComponent from './components/loadingComponent/LoadingComponent.vue'
12
+ import { useConfigLoad } from './hooks/configLoad.js'
12
13
 
13
14
  export default {
14
15
  name: 'AnalysisComponent',
@@ -51,6 +52,7 @@ export default {
51
52
  delete ret.onClick
52
53
  return ret
53
54
  })
55
+ useConfigLoad(props.config)
54
56
  const ruleExecuter = inject('_ruleExecuter')
55
57
  const dialogReq = inject('_dialogReq', {})
56
58
  const requestTraceId = inject('requestTraceId')
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { computed, inject, ref, resolveComponent, useAttrs } from "vue";
2
+ import { computed, inject, onMounted, ref, resolveComponent, useAttrs, watch } from "vue";
3
3
  import Renderer from '../../renderer.jsx'
4
4
  import { commonPropsType, DISPLAY_HIDDEN, hasOwn } from '../../utils/index.js'
5
5
 
@@ -13,7 +13,7 @@ const props = defineProps({
13
13
  cardbgcolor: String,
14
14
  })
15
15
 
16
- const collapseLimt = 5
16
+ const collapseLimt = ref(Number.MAX_VALUE)
17
17
  const isCollapse = ref(true)
18
18
  const attrs = useAttrs()
19
19
  const lang = inject('lang')
@@ -28,15 +28,61 @@ const cmiProps = computed(() => {
28
28
  }
29
29
  })
30
30
 
31
+ const propCollapseLimt = computed(() => {
32
+ return props.config?.collapseLimt || 5
33
+ })
34
+
31
35
  const pmPageMetaList = computed(() => {
32
- return props.config?.pmPageMetaList?.filter(item => !item.collapseSlot) || []
36
+ return props.config?.pmPageMetaList || []
37
+ })
38
+
39
+ const showPageMeteList = computed(() => {
40
+ return pmPageMetaList.value.filter(item => item.displayType != DISPLAY_HIDDEN && item.hidden != '1')
33
41
  })
42
+
43
+ const lastShowPageMeteItem = computed(() => {
44
+ return showPageMeteList.value?.length ? showPageMeteList.value[showPageMeteList.value.length - 1] : null
45
+ })
46
+
34
47
  const showCollapseBtn = computed(() => {
35
- return pmPageMetaList.value.filter(item => item.displayType != DISPLAY_HIDDEN)?.length > collapseLimt
48
+ return showPageMeteList.value?.length > collapseLimt.value
36
49
  })
37
- const showPageMeteList = computed(() => {
38
- return pmPageMetaList.value.filter(item => item.displayType != DISPLAY_HIDDEN).slice(0, isCollapse.value ? collapseLimt : Number.MAX_VALUE)
50
+
51
+
52
+ // 定位到最后显示的组件在折叠组件中的索引
53
+ const lasetLimitIdx = computed(() => {
54
+ const limt = isCollapse.value ? collapseLimt.value : Number.MAX_VALUE
55
+ return pmPageMetaList.value?.findIndex(item => item == showPageMeteList.value[limt - 1])
56
+ })
57
+
58
+ // 通过监听最后一个显示组件的索引,控制那些组件隐藏(通过collapseHidden控制隐藏)
59
+ watch(lasetLimitIdx, (val) => {
60
+ pmPageMetaList.value?.forEach((item, index) => {
61
+ item.collapseHidden = '0'
62
+ if (item.metaType === 'cmi-cell') {
63
+ item.borderHidden = '0'
64
+ }
65
+ if (val > -1) {
66
+ if (index > val) {
67
+ item.collapseHidden = '1'
68
+ }
69
+ if (index === val) {
70
+ if (item.metaType === 'cmi-cell') {
71
+ item.borderHidden = '1'
72
+ }
73
+ }
74
+ }
75
+ })
76
+ if (val === -1) {
77
+ if (lastShowPageMeteItem.value?.metaType === 'cmi-cell') {
78
+ lastShowPageMeteItem.value.borderHidden = '1'
79
+ }
80
+ }
81
+ }, {
82
+ immediate: true
39
83
  })
84
+
85
+
40
86
  const collapseLabel = computed(() => {
41
87
  const isCh = lang?.value?.indexOf('zh') > -1
42
88
  return isCollapse.value ? (isCh ? '更多' : 'More') : (isCh ? '收起' : 'Close')
@@ -44,11 +90,24 @@ const collapseLabel = computed(() => {
44
90
  function toCollapse() {
45
91
  isCollapse.value = !isCollapse.value
46
92
  }
93
+
94
+ onMounted(() => {
95
+ watch(() => props.config._componentLoad, (val) => {
96
+ if (val) {
97
+ collapseLimt.value = propCollapseLimt.value
98
+ watch(propCollapseLimt, (val) => {
99
+ collapseLimt.value = val
100
+ })
101
+ }
102
+ }, {
103
+ immediate: true
104
+ })
105
+ })
47
106
  </script>
48
107
  <template>
49
- <cmi-card v-bind="{...cmiProps, ...attrs}">
108
+ <cmi-card v-bind="{...attrs, ...cmiProps}">
50
109
  <div slot="content" :style="{'background-color': cmiProps.cardbgcolor}">
51
- <Renderer :config="showPageMeteList" v-model="modelValue"></Renderer>
110
+ <Renderer :config="pmPageMetaList" v-model="modelValue"></Renderer>
52
111
  <div v-if="showCollapseBtn" class="collapse-wrap">
53
112
  <cmi-button type="text" size="small" @click="toCollapse">
54
113
  {{ collapseLabel }}
@@ -2,10 +2,12 @@
2
2
  import { computed, inject, useAttrs } from 'vue'
3
3
  import Renderer from '../../renderer.jsx'
4
4
  import { commonPropsType } from '../../utils/index.js'
5
+ import { useConfigLoad } from '../../hooks/configLoad.js'
5
6
  const lang = inject('lang')
6
7
  const props = defineProps({
7
8
  ...commonPropsType,
8
9
  })
10
+ useConfigLoad(props.config)
9
11
  const attrs = useAttrs()
10
12
  const tabProps = computed(() => {
11
13
  return {
@@ -0,0 +1,45 @@
1
+ import { definePrivatelyProp, findComponent, NOT_LOAD_CHILD_TYPE } from "../utils"
2
+ import { inject, onMounted, provide } from "vue"
3
+
4
+ const CONFIG_LOAD_KEY = Symbol()
5
+ export const useConfigLoad = (config) => {
6
+ const injectLoadFn = inject(CONFIG_LOAD_KEY) // 加载父组件传递下来的 加载完成的 回调函数
7
+ const loadFn = (childConfig) => {
8
+ const multiPmPageMetaList = config.multiPmPageMetaList
9
+ const pmPageMetaList = config.pmPageMetaList
10
+ // if (config.metaCode == 'rackRental') {
11
+ // debugger
12
+ // }
13
+ if (multiPmPageMetaList && multiPmPageMetaList.length) {
14
+ const allLoad = multiPmPageMetaList.every(configList => configList.every(config => config._componentLoad))
15
+ if (allLoad) {
16
+ config._componentLoad = true
17
+ injectLoadFn?.(config)
18
+ }
19
+ } else {
20
+ const allLoad = pmPageMetaList.every(config => config._componentLoad)
21
+ if (allLoad) {
22
+ config._componentLoad = true
23
+ injectLoadFn?.(config)
24
+ }
25
+ }
26
+ }
27
+ provide(CONFIG_LOAD_KEY, loadFn)
28
+
29
+ onMounted(() => {
30
+ const multiPmPageMetaList = config.multiPmPageMetaList
31
+ const pmPageMetaList = config.pmPageMetaList
32
+
33
+ if (
34
+ (
35
+ (!multiPmPageMetaList || multiPmPageMetaList.length === 0) &&
36
+ (!pmPageMetaList || pmPageMetaList.length === 0)
37
+ ) ||
38
+ config.renderby ||
39
+ findComponent(NOT_LOAD_CHILD_TYPE, config.metaType) !== -1
40
+ ) {
41
+ config._componentLoad = true
42
+ injectLoadFn?.(config)
43
+ }
44
+ })
45
+ }
@@ -15,6 +15,7 @@ export const VALUE_TYPES = {
15
15
  OBJECT: 'object',
16
16
  STRING: 'string',
17
17
  }
18
+ export const NOT_LOAD_CHILD_TYPE = ['CustomComponentTableH5']
18
19
  export const NOT_LOG_EFFECT_TYPE = ['CustomComponentTabs', 'CustomComponentTabPane', 'CustomComponentCycleTabPane', 'CustomComponentCollapse', 'CustomComponentTabPaneH5']
19
20
  export const FORM_META_TYPE = 'CustomComponentFormLayout'
20
21
  export const FORM_META_TYPE_H5 = 'CustomComponentFormLayoutH5'