resolver-egretimp-plus 0.0.151 → 0.0.152

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/index-H5.js CHANGED
@@ -1,2 +1,17 @@
1
1
  export * from './index.js'
2
2
  export { default as default} from './src/resolver-H5.vue'
3
+ import * as all from './index.js'
4
+ import * as resolverAll from './src/resolver-H5.vue'
5
+
6
+ if (window) {
7
+ const obj = {
8
+ ...all,
9
+ ...resolverAll
10
+ }
11
+ Object.keys(obj).forEach(key => {
12
+ !window['resolver-egretimp-plus'] && (window['resolver-egretimp-plus'] = {})
13
+ if (!Object.prototype.hasOwnProperty.call(window['resolver-egretimp-plus'], key)) {
14
+ window['resolver-egretimp-plus'][key] = obj[key]
15
+ }
16
+ })
17
+ }
package/index-web.js CHANGED
@@ -4,8 +4,14 @@ import * as all from './index.js'
4
4
  import * as resolverAll from './src/resolver-web.vue'
5
5
 
6
6
  if (window) {
7
- window['resolver-egretimp-plus'] = {
7
+ const obj = {
8
8
  ...all,
9
9
  ...resolverAll
10
10
  }
11
+ Object.keys(obj).forEach(key => {
12
+ !window['resolver-egretimp-plus'] && (window['resolver-egretimp-plus'] = {})
13
+ if (!Object.prototype.hasOwnProperty.call(window['resolver-egretimp-plus'], key)) {
14
+ window['resolver-egretimp-plus'][key] = obj[key]
15
+ }
16
+ })
11
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.0.151",
3
+ "version": "0.0.152",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -8,6 +8,7 @@ import { useRoute } from 'vue-router'
8
8
  import { executeEventOrchestration } from './components/helper/eventOrchestration.js'
9
9
  import { useRouter } from 'vue-router'
10
10
  import { onErrorCaptured } from 'vue'
11
+ import LoadingComponent from './components/loadingComponent/LoadingComponent.vue'
11
12
 
12
13
  export default {
13
14
  name: 'AnalysisComponent',
@@ -164,7 +165,7 @@ export default {
164
165
  if (res?.default?.emits) {
165
166
  initVmodels(res?.default?.emits)
166
167
  }
167
- fnComponentkeys.value = getComponentPropsKeys(res?.default)
168
+ fnComponentkeys.value = getComponentPropsKeys(res?.default || res)
168
169
  // const obj = {}
169
170
  // const propsKeys = getComponentPropsKeys(res?.default)
170
171
  // propsKeys.forEach(key => {
@@ -182,7 +183,10 @@ export default {
182
183
  // 获取组件中定义的props,赋值对应的属性===end===
183
184
  const currentComponent = computed(() => {
184
185
  if (typeof props.component === 'function') {
185
- return defineAsyncComponent(props.component)
186
+ return defineAsyncComponent({
187
+ loader: props.component,
188
+ loadingComponent: LoadingComponent,
189
+ })
186
190
  } else {
187
191
  return props.component
188
192
  }
@@ -2,4 +2,5 @@ export const QUERY_PAGE_CONFIG_DATA = '/sa-lcp/api/v1/pageConfig/queryPageConfig
2
2
  export const LCP_LOGIN = '/sa-lcp/login'
3
3
  export const GET_SYS_PARAM_CACHE = '/sa-lcp/api/v1/sysparam/getSysParamCache'
4
4
  export const REFRESH_TOKEN = '/sa-lcp/changePwd/refreshToken'
5
- export const DATA_VALID_RULE_EXECUTE = '/sa-lcp/api/v1/validate/dataValidRuleExecute'
5
+ export const DATA_VALID_RULE_EXECUTE = '/sa-lcp/api/v1/validate/dataValidRuleExecute'
6
+ export const FIND_FILEA_NND_CONENT_BY_ID = '/sa-lcp/api/v1/fileopertate/findFileAndContentById'
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
3
+ <path
4
+ fill="currentColor"
5
+ d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"
6
+ />
7
+ </svg>
8
+ </template>
9
+ <script setup>
10
+ defineOptions({
11
+ name: 'Loading',
12
+ })
13
+ </script>
@@ -0,0 +1,33 @@
1
+ <script setup>
2
+ import Loading from '../icons/loading.vue'
3
+ </script>
4
+ <template>
5
+ <i class="loading-icon">
6
+ <Loading></Loading>
7
+ </i>
8
+ </template>
9
+ <style lang="scss" scoped>
10
+ .loading-icon {
11
+ --color: inherit;
12
+ height: 1em;
13
+ width: 1em;
14
+ line-height: 1em;
15
+ display: inline-flex;
16
+ justify-content: center;
17
+ align-items: center;
18
+ position: relative;
19
+ fill: currentColor;
20
+ color: var(--color);
21
+ // font-size: inherit;
22
+
23
+ font-size: 18px;
24
+ color: #606266;
25
+ margin: 0 auto;
26
+ animation: loading-rotate 2s linear infinite;
27
+ }
28
+ @keyframes loading-rotate {
29
+ 100% {
30
+ transform: rotate(360deg);
31
+ }
32
+ }
33
+ </style>
@@ -1,7 +1,9 @@
1
- import { DATA_VALID_RULE_EXECUTE, GET_SYS_PARAM_CACHE, LCP_LOGIN, QUERY_PAGE_CONFIG_DATA } from "../api/builtIn"
1
+ import { DATA_VALID_RULE_EXECUTE, FIND_FILEA_NND_CONENT_BY_ID, GET_SYS_PARAM_CACHE, LCP_LOGIN, QUERY_PAGE_CONFIG_DATA } from "../api/builtIn"
2
2
 
3
- export const USER_NAME = 'lcpsupport'
4
- export const PASSWORD = '8ik,*IK<'
3
+ export const USER_NAME = 'caowb3'
4
+ export const PASSWORD = '123456'
5
+ // export const USER_NAME = 'lcpsupport'
6
+ // export const PASSWORD = '8ik,*IK<'
5
7
  export const USER_TYPE = '1'
6
8
  export const AUTH_CODE = '9887'
7
9
 
@@ -9,5 +11,6 @@ export const NOT_AUTH_APIS = [
9
11
  LCP_LOGIN,
10
12
  GET_SYS_PARAM_CACHE,
11
13
  QUERY_PAGE_CONFIG_DATA,
12
- DATA_VALID_RULE_EXECUTE
14
+ DATA_VALID_RULE_EXECUTE,
15
+ FIND_FILEA_NND_CONENT_BY_ID
13
16
  ]
package/src/index.jsx CHANGED
@@ -126,7 +126,12 @@ export default {
126
126
  messageCb: Function,
127
127
  requestTraceId: {
128
128
  type: String,
129
- }
129
+ },
130
+ // 加载上传自定义组件需要的模块集合
131
+ loadModuleCache: {
132
+ type: Object,
133
+ default: () => ({})
134
+ },
130
135
  },
131
136
  emits: ['update:modelValue', 'rootStoreChange'],
132
137
  setup(props, { emit, attrs, expose }) {
@@ -215,6 +220,7 @@ export default {
215
220
  })
216
221
  toExecuteLoadServices()
217
222
  })
223
+ provide('_loadModuleCache', props.loadModuleCache)
218
224
  provide('_ruleExecuter', ruleExecuter)
219
225
  provide('_toExecuteLoadServices', toExecuteLoadServices)
220
226
  provide('_dialogReq', props.dialogReq)
package/src/renderer.jsx CHANGED
@@ -41,6 +41,7 @@ export default {
41
41
  }
42
42
  })
43
43
  const getNativeComps = inject('_getNativeComps')
44
+ const loadModuleCache = inject('_loadModuleCache')
44
45
  const _isH5 = inject('_isH5')
45
46
  const injectMode = inject('injectMode', '')
46
47
  const mode = props.mode || injectMode
@@ -56,7 +57,7 @@ export default {
56
57
  return null
57
58
  }
58
59
  const disabled = calcDisable(config, mode)
59
- const component = getComponentForConfig({config, disabled, getNativeComps, isH5: _isH5?.value})
60
+ const component = getComponentForConfig({config, disabled, getNativeComps, isH5: _isH5?.value, loadModuleCache})
60
61
  if (component) {
61
62
  const layoutPolyfill = generateLayoutPolyfill(config, disabled, _isH5?.value) // // 生成布局框(col)的辅助函数
62
63
  return layoutPolyfill(
@@ -28,7 +28,7 @@ const props = defineProps({
28
28
  loadConfigReq: {
29
29
  type: Object,
30
30
  default: () => ({})
31
- },
31
+ }
32
32
  })
33
33
  defineOptions({
34
34
  inheritAttrs: false
@@ -399,16 +399,16 @@ const allInitEvents = {
399
399
  })
400
400
  return () => {
401
401
  // 需要晚点触发,才能正常执行清空等一些列需要组件操作
402
- return setTimeout(() => {
403
- configs.forEach((labelInfo, idx) => {
404
- const oldProps = oldPorpsList[idx]
405
- if (!labelInfo) return
406
- const porpsKeys = Object.keys(oldProps)
407
- porpsKeys.forEach(key => {
408
- labelInfo[key] = oldProps[key]
409
- })
402
+ // return setTimeout(() => {
403
+ configs.forEach((labelInfo, idx) => {
404
+ const oldProps = oldPorpsList[idx]
405
+ if (!labelInfo) return
406
+ const porpsKeys = Object.keys(oldProps)
407
+ porpsKeys.forEach(key => {
408
+ labelInfo[key] = oldProps[key]
410
409
  })
411
- }, 0)
410
+ })
411
+ // }, 0)
412
412
  }
413
413
  }
414
414
  },
@@ -487,15 +487,15 @@ const allInitEvents = {
487
487
  // 有的事件在不满足条件的情况下,需要进行恢复
488
488
  return () => {
489
489
  // 需要晚点触发,才能正常执行清空等一些列需要组件操作
490
- return setTimeout(() => {
491
- configs.forEach((labelInfo, idx) => {
492
- const oldProps = oldPorpsList[idx]
493
- if (!labelInfo) return
494
- porpsKeys.forEach(key => {
495
- labelInfo[key] = oldProps[key]
496
- })
490
+ // return setTimeout(() => {
491
+ configs.forEach((labelInfo, idx) => {
492
+ const oldProps = oldPorpsList[idx]
493
+ if (!labelInfo) return
494
+ porpsKeys.forEach(key => {
495
+ labelInfo[key] = oldProps[key]
497
496
  })
498
- }, 0)
497
+ })
498
+ // }, 0)
499
499
  }
500
500
  },
501
501
  }
@@ -465,16 +465,16 @@ const allInitEvents = {
465
465
  })
466
466
  return () => {
467
467
  // 需要晚点触发,才能正常执行清空等一些列需要组件操作
468
- return setTimeout(() => {
469
- configs.forEach((labelInfo, idx) => {
470
- const oldProps = oldPorpsList[idx]
471
- if (!labelInfo) return
472
- const porpsKeys = Object.keys(oldProps)
473
- porpsKeys.forEach(key => {
474
- labelInfo[key] = oldProps[key]
475
- })
468
+ // return setTimeout(() => {
469
+ configs.forEach((labelInfo, idx) => {
470
+ const oldProps = oldPorpsList[idx]
471
+ if (!labelInfo) return
472
+ const porpsKeys = Object.keys(oldProps)
473
+ porpsKeys.forEach(key => {
474
+ labelInfo[key] = oldProps[key]
476
475
  })
477
- }, 0)
476
+ })
477
+ // }, 0)
478
478
  }
479
479
  }
480
480
  },
@@ -552,15 +552,15 @@ const allInitEvents = {
552
552
  // 有的事件在不满足条件的情况下,需要进行恢复
553
553
  return () => {
554
554
  // 需要晚点触发,才能正常执行清空等一些列需要组件操作
555
- return setTimeout(() => {
556
- configs.forEach((labelInfo, idx) => {
557
- const oldProps = oldPorpsList[idx]
558
- if (!labelInfo) return
559
- porpsKeys.forEach(key => {
560
- labelInfo[key] = oldProps[key]
561
- })
555
+ // return setTimeout(() => {
556
+ configs.forEach((labelInfo, idx) => {
557
+ const oldProps = oldPorpsList[idx]
558
+ if (!labelInfo) return
559
+ porpsKeys.forEach(key => {
560
+ labelInfo[key] = oldProps[key]
562
561
  })
563
- }, 0)
562
+ })
563
+ // }, 0)
564
564
  }
565
565
  },
566
566
  }
@@ -229,4 +229,9 @@ export const META_TYPE_MAP = {
229
229
 
230
230
  export {
231
231
  commonPropsType as componentPropsType
232
+ }
233
+
234
+ if (window) {
235
+ !window['resolver-egretimp-plus'] && (window['resolver-egretimp-plus'] = {})
236
+ window['resolver-egretimp-plus']['componentPropsType'] = commonPropsType
232
237
  }
@@ -1,16 +1,25 @@
1
1
  import * as Vue from 'vue'
2
2
  import { loadModule } from 'vue3-sfc-loader'
3
+ import * as Router from 'vue-router'
4
+ import { buildInRequest } from './request'
5
+ import { FIND_FILEA_NND_CONENT_BY_ID } from '../api/builtIn'
6
+ import { resultToast } from './respone'
3
7
 
4
8
  const options = {
5
9
  moduleCache: {
6
10
  vue: Vue,
11
+ 'vue-router': Router,
7
12
  },
8
-
9
13
  async getFile(url) {
10
- const res = await fetch(url);
11
- if ( !res.ok )
12
- throw Object.assign(new Error(url+' '+res.statusText), { res });
13
- return await res.text();
14
+ return buildInRequest(FIND_FILEA_NND_CONENT_BY_ID, {fileId: url?.originVal?.() || url}).then(ret => {
15
+ if (resultToast(ret.data)) {
16
+ return ret.data.result?.content
17
+ } else {
18
+ return ''
19
+ }
20
+ }).catch(() => {
21
+ return ''
22
+ })
14
23
  },
15
24
 
16
25
  addStyle(textContent) {
@@ -43,6 +52,12 @@ const options = {
43
52
  }
44
53
  }
45
54
 
46
- export default function(url) {
55
+ export default function(url, moduleCache) {
56
+ options.moduleCache['resolver-egretimp-plus'] = window['resolver-egretimp-plus']
57
+ options.moduleCache['resolver-egretimp-plus/h5'] = window['resolver-egretimp-plus']
58
+ options.moduleCache['resolver-egretimp-plus/web'] = window['resolver-egretimp-plus']
59
+ Object.keys(moduleCache || {}).forEach(key => {
60
+ options.moduleCache[key] = moduleCache[key]
61
+ })
47
62
  return loadModule(url, options)
48
63
  }
@@ -338,9 +338,9 @@ export function isPlainColumn(config, disabled) {
338
338
  return false
339
339
  }
340
340
 
341
- export function getComponentForConfig({config, disabled, getNativeComps}) {
342
- if (config.isCustomComp) {
343
- return () => loadModule(config.url)
341
+ export function getComponentForConfig({config, disabled, getNativeComps, loadModuleCache}) {
342
+ if (config.isCustom) {
343
+ return () => loadModule(generateVuePath(config.fileId), loadModuleCache)
344
344
  }
345
345
  // 表格中中的列,是否需要转换为普通形式
346
346
  if (isPlainColumn(config, disabled)) {
@@ -874,4 +874,23 @@ function isTransCellMobile(config, disabled) {
874
874
 
875
875
  function isHidden({config}) {
876
876
  return (typeof config.hidden === 'boolean' && config.hidden) || config.hidden === '1'
877
- }
877
+ }
878
+
879
+ function generateVuePath(path) {
880
+ class LoadModulePath extends String {
881
+ constructor(...arg) {
882
+ super(...arg)
883
+ }
884
+ toString(...arg) {
885
+ const ret = super.toString(...arg)
886
+ if (!/\.\w*$/.test(ret)) {
887
+ return `${ret}.vue`
888
+ }
889
+ return ret
890
+ }
891
+ originVal() {
892
+ return path
893
+ }
894
+ }
895
+ return new LoadModulePath(path)
896
+ }