resolver-egretimp-plus 0.0.228 → 0.0.230

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.228",
3
+ "version": "0.0.230",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -61,9 +61,12 @@ const getColumns = () => {
61
61
  })
62
62
  }
63
63
 
64
- const onFocus = () => {
64
+ const onFocus = (e) => {
65
65
  open.value = true
66
66
  pickerRef.value?.setColumns?.(getColumns())
67
+ e.preventDefault()
68
+ e.stopPropagation()
69
+ e.target.blur()
67
70
  }
68
71
 
69
72
  const onClose = () => {
@@ -22,7 +22,7 @@ const pmPageMetaList = computed(() => {
22
22
  </script>
23
23
 
24
24
  <template>
25
- <cmi-tab-content v-bind="{...attrs, ...tabProps}">
25
+ <cmi-tab-content v-bind="{...attrs, ...tabProps}" :style="props.config?.style">
26
26
  <slot>
27
27
  <Renderer :config="pmPageMetaList" v-model="modelValue"></Renderer>
28
28
  </slot>
package/src/index.jsx CHANGED
@@ -6,7 +6,7 @@ import { toValidate } from './utils/valid.js'
6
6
  import { MODE } from "./utils/const.js"
7
7
  import { generateRequester } from "./utils/request.js"
8
8
  import { executeLoadServices, resetConfigEventInit } from "./components/helper/resolver.js"
9
- import { deepMerge } from "./utils/index.js"
9
+ import { createEmptyCopy, deepMerge } from "./utils/index.js"
10
10
  import { nextTick } from "vue"
11
11
  // import { RuleExecuter } from "./rulesImp/index.js"
12
12
  export default {
@@ -177,6 +177,7 @@ export default {
177
177
  const { initPageConfig, pageConfigRef, mapCompRef, hireRelatMapRulesRef } = usePageConfig()
178
178
  function toExecuteLoadServices(clearFlag, alongLoad) {
179
179
  // 触发加载事件执行
180
+ const oldNativeDataload = nativeDataLoad.value
180
181
  nativeDataLoad.value = false
181
182
  executeLoadServices(
182
183
  props.config?.pmPageServiceMapVOList || props.config?.lcpPageServiceMapVOList || [],
@@ -199,13 +200,21 @@ export default {
199
200
  val = deepMerge(props.modelValue, result, 'replace')
200
201
  val = {...val}
201
202
  }
202
- resetConfigEventInit(dynamicMapComp)
203
- emit('update:modelValue', {})
204
- nextTick(() => {
203
+
204
+ if (oldNativeDataload) {
205
+ resetConfigEventInit(dynamicMapComp)
206
+ const emptyObj = createEmptyCopy(val)
207
+ emit('update:modelValue', emptyObj)
208
+ nextTick(() => {
209
+ nativeDataLoad.value = true
210
+ emit('update:modelValue', val)
211
+ emit('loadEvnetsCompleted', result)
212
+ })
213
+ } else {
205
214
  nativeDataLoad.value = true
206
215
  emit('update:modelValue', val)
207
- })
208
- emit('loadEvnetsCompleted', result)
216
+ emit('loadEvnetsCompleted', result)
217
+ }
209
218
  }
210
219
  }
211
220
  )
@@ -436,3 +436,49 @@ export function getValueDeep(obj, key) {
436
436
  }
437
437
  }, obj)
438
438
  }
439
+
440
+ // 深度清空对象上面的属性
441
+
442
+ export function createEmptyCopy(source, cache = new WeakMap()) {
443
+ // 处理非对象类型(基础类型)
444
+ if (source === null || typeof source !== 'object') {
445
+ switch (typeof source) {
446
+ case 'string': return '';
447
+ case 'number': return '';
448
+ case 'boolean': return null;
449
+ default: return null; // undefined, symbol, function 等返回 null
450
+ }
451
+ }
452
+
453
+ // 处理循环引用:如果已缓存,直接返回缓存的副本
454
+ if (cache.has(source)) {
455
+ return cache.get(source);
456
+ }
457
+
458
+ // 根据类型创建空结构
459
+ let copy;
460
+ if (Array.isArray(source)) {
461
+ // 数组:递归处理每个元素
462
+ copy = [];
463
+ cache.set(source, copy); // 缓存当前对象,避免循环引用
464
+ copy.push(...source.map(item => createEmptyCopy(item, cache)));
465
+ } else if (source instanceof Date) {
466
+ // Date:返回初始时间(可选)
467
+ copy = null;
468
+ } else if (source instanceof Set) {
469
+ // Set:清空为空的 Set
470
+ copy = new Set();
471
+ } else if (source instanceof Map) {
472
+ // Map:清空为空的 Map
473
+ copy = new Map();
474
+ } else {
475
+ // 普通对象:递归处理每个属性
476
+ copy = {};
477
+ cache.set(source, copy);
478
+ for (const key of Object.keys(source)) {
479
+ copy[key] = createEmptyCopy(source[key], cache);
480
+ }
481
+ }
482
+
483
+ return copy;
484
+ }