@dckj-npm/dc-material 0.1.372 → 0.1.373

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.
@@ -143,30 +143,30 @@ const isDataListBoundExpression = (target: any): boolean => {
143
143
  }
144
144
 
145
145
  /**
146
- * 模块级 WeakMap 缓存:以 IPublicModelNode 对象引用为 key,存储每个 TeletextList 节点
147
- * 最后一次已知的「非默认」dataList 值。
148
- *
149
- * 作用:在 setPropValue 触发的 settings 重评估中,引擎可能先将 node prop 清空再调用
150
- * dataList.initialValue;此时 node.getPropValue 与 getProps().getPropValue 均返回
151
- * undefined,导致 initialValue 回退默认数组、覆盖已绑定的 JSExpression 或用户数据。
152
- * 通过在每次 imgWidth/imgHeight/imagePlacement.setValue 执行任何 setPropValue 之前
153
- * 将当前 dataList 写入此缓存,initialValue 可从缓存安全恢复,彻底切断引擎中间态影响。
146
+ * 模块级缓存:使用 node.id(稳定的字符串 ID)作为 key
147
+ * 替代 WeakMap 方案:WeakMap 以 target.node 对象引用为 key,
148
+ * 但引擎可能通过 Proxy/getter 每次返回不同的包装对象,导致缓存命中失败。
149
+ * 使用 node.id 字符串做 key 彻底消除引用不一致问题。
154
150
  */
155
- const _nodeDataListCache = new WeakMap<object, any>()
151
+ const _dataListCacheById: Record<string, any> = {}
156
152
 
157
153
  const _cacheDataList = (target: any): void => {
158
- const node = target?.node
159
- if (!node) return
160
- // 优先从 node 级 API 读取(schema 层,不受 settings 重评估中间态影响)
161
- const fromNode = node?.getPropValue?.('dataList')
154
+ const nodeId = target?.node?.id
155
+ if (!nodeId) return
156
+ const fromNode = target?.node?.getPropValue?.('dataList')
162
157
  if (fromNode !== undefined) {
163
- _nodeDataListCache.set(node, fromNode)
158
+ _dataListCacheById[nodeId] = fromNode
159
+ return
160
+ }
161
+ // schema 序列化快照:源头数据,不受 settings 中间态影响
162
+ const fromSchema = target?.node?.schema?.props?.dataList
163
+ if (fromSchema !== undefined) {
164
+ _dataListCacheById[nodeId] = fromSchema
164
165
  return
165
166
  }
166
- // 降级:从 settings API 读取
167
167
  const fromProps = target?.getProps?.()?.getPropValue?.('dataList')
168
168
  if (fromProps !== undefined) {
169
- _nodeDataListCache.set(node, fromProps)
169
+ _dataListCacheById[nodeId] = fromProps
170
170
  }
171
171
  }
172
172
 
@@ -373,10 +373,14 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
373
373
  return
374
374
  }
375
375
  const props = target.getProps()
376
- // 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
377
376
  _cacheDataList(target)
377
+ // 快照 dataList:在 setPropValue 前捕获,防止引擎重评估时被默认值覆盖
378
+ const prevDataList = props.getPropValue('dataList')
378
379
  props.setPropValue('imgWidth', parsedValue)
379
- // syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
380
+ // 还原 dataList(幂等操作,若引擎未覆盖则无副作用)
381
+ if (prevDataList !== undefined) {
382
+ props.setPropValue('dataList', prevDataList)
383
+ }
380
384
  syncImageStyleValue(target, 'width', parsedValue)
381
385
  },
382
386
  },
@@ -436,10 +440,14 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
436
440
  return
437
441
  }
438
442
  const props = target.getProps()
439
- // 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
440
443
  _cacheDataList(target)
444
+ // 快照 dataList:在 setPropValue 前捕获,防止引擎重评估时被默认值覆盖
445
+ const prevDataList = props.getPropValue('dataList')
441
446
  props.setPropValue('imgHeight', parsedValue)
442
- // syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
447
+ // 还原 dataList(幂等操作,若引擎未覆盖则无副作用)
448
+ if (prevDataList !== undefined) {
449
+ props.setPropValue('dataList', prevDataList)
450
+ }
443
451
  syncImageStyleValue(target, 'height', parsedValue)
444
452
  },
445
453
  },
@@ -952,35 +960,30 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
952
960
  },
953
961
  },
954
962
  initialValue: (target) => {
955
- // 读取顺序(由最可靠到最不可靠):
956
- // 1. node API(schema 层,引擎重评估前通常仍有值)
957
- // 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
958
- // 3. settings API(重评估中间态下可能已清空,作为最后手段)
959
- // 4. 默认占位数据(仅首次创建组件时触达)
960
- //
961
- // 关键防御:一旦组件已绑定数据源(缓存或 node 中有值),
962
- // 无论是哪种场景的 initialValue 调用,都必须返回已有值而不是默认数组。
963
- // syncImageStyleValue 改为异步后,通常 node.getPropValue 已能拿到正确值;
964
- // 缓存作为最后一道防线,彻底切断默认数组覆盖绑定表达式的可能。
965
- const node = target?.node
966
- // 优先读缓存:即使 node.getPropValue 暂时处于中间态,缓存也能提供可靠值
967
- const cached = node ? _nodeDataListCache.get(node) : undefined
968
- const fromNode = node?.getPropValue?.('dataList')
963
+ const nodeId = target?.node?.id
964
+ // 1. node API
965
+ const fromNode = target?.node?.getPropValue?.('dataList')
969
966
  if (fromNode !== undefined) {
970
- // 同步更新缓存,为后续可能的重评估提供后备
971
- if (node) _nodeDataListCache.set(node, fromNode)
967
+ if (nodeId) _dataListCacheById[nodeId] = fromNode
972
968
  return fromNode
973
969
  }
974
- // node.getPropValue 返回 undefined:引擎可能已在调用 initialValue 前清空 node prop
975
- // 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
976
- if (cached !== undefined) {
977
- return cached
970
+ // 2. 模块级缓存(node.id 索引,不受 Proxy 引用问题影响)
971
+ if (nodeId && _dataListCacheById[nodeId] !== undefined) {
972
+ return _dataListCacheById[nodeId]
978
973
  }
974
+ // 3. settings API
979
975
  const current = target?.getProps?.()?.getPropValue?.('dataList')
980
976
  if (current !== undefined) {
981
- if (node) _nodeDataListCache.set(node, current)
977
+ if (nodeId) _dataListCacheById[nodeId] = current
982
978
  return current
983
979
  }
980
+ // 4. schema 序列化快照(源头数据,不受 settings 中间态影响)
981
+ const fromSchema = target?.node?.schema?.props?.dataList
982
+ if (fromSchema !== undefined) {
983
+ if (nodeId) _dataListCacheById[nodeId] = fromSchema
984
+ return fromSchema
985
+ }
986
+ // 5. 默认数据(仅首次创建组件时触达)
984
987
  return [
985
988
  {
986
989
  image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
@@ -1009,53 +1012,45 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
1009
1012
  },
1010
1013
  extraProps: {
1011
1014
  /**
1012
- * 自定义 getValue:保证引擎重评估期间 field.getValue() 始终返回有效值(非 undefined),
1013
- * 从而阻止 initDefaultValue 在不应该的时机调用 initialValue 并覆盖为默认图数组。
1014
- *
1015
- * 触发场景:修改 imgWidth/imgHeight 或通过布局面板修改图片 margin 时,
1016
- * imageChildNode.setPropValue('style', ...) 会触发引擎对父节点 settings 的重评估;
1017
- * 若此时 dataList Prop 处于 "unset" 中间态,parent.getPropValue 会返回 undefined,
1018
- * 导致不带 getValue 时 field.getValue() = undefined → initDefaultValue 触发 → 默认图。
1019
- * 有了此 getValue 后,即使 schema 层暂时返回 undefined,从缓存取值仍可返回用户数据,
1020
- * field.getValue() 非 undefined → initDefaultValue 永远跳过 → 默认图问题彻底消失。
1015
+ * 保证引擎重评估期间 field.getValue() 始终返回有效值(非 undefined),
1016
+ * 阻止 initDefaultValue 覆盖已绑定的 JSExpression。
1017
+ * 回退链:currentValue → 缓存(node.id) → schema 快照 → node API。
1021
1018
  */
1022
1019
  getValue: (target: any, currentValue: any) => {
1023
- const node = target?.node
1020
+ const nodeId = target?.node?.id
1024
1021
  if (currentValue !== undefined) {
1025
- // schema 层有值:同步更新缓存,确保用户最新编辑的数据被记录
1026
- if (node) _nodeDataListCache.set(node, currentValue)
1022
+ if (nodeId) _dataListCacheById[nodeId] = currentValue
1027
1023
  return currentValue
1028
1024
  }
1029
- // schema 层暂时无值(引擎重评估中间态):从缓存恢复,避免 initDefaultValue 触发
1030
- const cached = node ? _nodeDataListCache.get(node) : undefined
1031
- return cached // undefined 仅在缓存为空(全新组件首次初始化)时出现,属正常情况
1025
+ // 引擎 currentValue undefined(重评估中间态),逐级回退:
1026
+ if (nodeId && _dataListCacheById[nodeId] !== undefined) {
1027
+ return _dataListCacheById[nodeId]
1028
+ }
1029
+ // node.schema 序列化快照:不受 settings 中间态影响,是最可靠的源头数据
1030
+ const fromSchema = target?.node?.schema?.props?.dataList
1031
+ if (fromSchema !== undefined) {
1032
+ if (nodeId) _dataListCacheById[nodeId] = fromSchema
1033
+ return fromSchema
1034
+ }
1035
+ const fromNode = target?.node?.getPropValue?.('dataList')
1036
+ if (fromNode !== undefined) {
1037
+ if (nodeId) _dataListCacheById[nodeId] = fromNode
1038
+ return fromNode
1039
+ }
1040
+ return undefined
1032
1041
  },
1033
1042
  /**
1034
- * 自定义 setValue:用户每次编辑 dataList 条目时,先更新 WeakMap 缓存,
1035
- * 再通过 node.setPropValue 将值持久化到 schema
1036
- *
1037
- * ⚠️ 此引擎中 extraProps.setValue 完全接管写入逻辑,引擎不会自动持久化:
1038
- * 若不在此处显式调用 setPropValue,用户编辑的数据将只存于内存缓存,
1039
- * 页面刷新后丢失,同时 imgWidth/imgHeight.setValue 的快照–还原机制也因
1040
- * props.getPropValue('dataList') 返回 undefined 而失效,导致还原跳过,
1041
- * 进而触发引擎 initDefaultValue,画布回退默认图。
1042
- *
1043
- * 写入顺序:先缓存(供 initialValue/getValue 兜底),再写 schema(持久化)。
1044
- * 写入 schema 会触发引擎对 settings 的重评估,但此时 schema 已有值,
1045
- * initialValue 不会被调用,不会产生循环。
1043
+ * 用户编辑 dataList 时同步更新缓存并持久化到 schema。
1044
+ * 引擎 extraProps.setValue 完全接管写入,必须显式 setPropValue
1046
1045
  */
1047
1046
  setValue: (target: any, value: any) => {
1048
- const node = target?.node
1049
- if (!node) return
1047
+ const nodeId = target?.node?.id
1048
+ if (!nodeId) return
1050
1049
  if (value !== undefined) {
1051
- // 先写缓存,确保重评估期间 getValue 可从缓存返回有效值
1052
- _nodeDataListCache.set(node, value)
1053
- // 再持久化到 schema(引擎不会自动写入,必须显式调用)
1050
+ _dataListCacheById[nodeId] = value
1054
1051
  target.getProps?.()?.setPropValue?.('dataList', value)
1055
1052
  } else {
1056
- // clearValue 场景(value = undefined):清空缓存,使下次 initDefaultValue
1057
- // 可正常返回默认数组(仅用于组件被显式清除数据的情况)
1058
- _nodeDataListCache.delete(node)
1053
+ delete _dataListCacheById[nodeId]
1059
1054
  target.getProps?.()?.setPropValue?.('dataList', undefined)
1060
1055
  }
1061
1056
  },
@@ -117,7 +117,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
117
117
  packageName = '@dckj-npm/dc-material';
118
118
  }
119
119
  if (version === void 0) {
120
- version = '0.1.372';
120
+ version = '0.1.373';
121
121
  }
122
122
  if (basicLibraryVersion === void 0) {
123
123
  basicLibraryVersion = {
@@ -136,30 +136,30 @@ var isDataListBoundExpression = function isDataListBoundExpression(target) {
136
136
  };
137
137
 
138
138
  /**
139
- * 模块级 WeakMap 缓存:以 IPublicModelNode 对象引用为 key,存储每个 TeletextList 节点
140
- * 最后一次已知的「非默认」dataList 值。
141
- *
142
- * 作用:在 setPropValue 触发的 settings 重评估中,引擎可能先将 node prop 清空再调用
143
- * dataList.initialValue;此时 node.getPropValue 与 getProps().getPropValue 均返回
144
- * undefined,导致 initialValue 回退默认数组、覆盖已绑定的 JSExpression 或用户数据。
145
- * 通过在每次 imgWidth/imgHeight/imagePlacement.setValue 执行任何 setPropValue 之前
146
- * 将当前 dataList 写入此缓存,initialValue 可从缓存安全恢复,彻底切断引擎中间态影响。
139
+ * 模块级缓存:使用 node.id(稳定的字符串 ID)作为 key
140
+ * 替代 WeakMap 方案:WeakMap 以 target.node 对象引用为 key,
141
+ * 但引擎可能通过 Proxy/getter 每次返回不同的包装对象,导致缓存命中失败。
142
+ * 使用 node.id 字符串做 key 彻底消除引用不一致问题。
147
143
  */
148
- var _nodeDataListCache = new WeakMap();
144
+ var _dataListCacheById = {};
149
145
  var _cacheDataList = function _cacheDataList(target) {
150
- var _node$getPropValue, _target$getProps4, _target$getProps4$cal, _target$getProps4$cal2;
151
- var node = target === null || target === void 0 ? void 0 : target.node;
152
- if (!node) return;
153
- // 优先从 node API 读取(schema 层,不受 settings 重评估中间态影响)
154
- var fromNode = node === null || node === void 0 ? void 0 : (_node$getPropValue = node.getPropValue) === null || _node$getPropValue === void 0 ? void 0 : _node$getPropValue.call(node, 'dataList');
146
+ var _target$node3, _target$node4, _target$node4$getProp, _target$node5, _target$node5$schema, _target$node5$schema$, _target$getProps4, _target$getProps4$cal, _target$getProps4$cal2;
147
+ var nodeId = target === null || target === void 0 ? void 0 : (_target$node3 = target.node) === null || _target$node3 === void 0 ? void 0 : _target$node3.id;
148
+ if (!nodeId) return;
149
+ var fromNode = target === null || target === void 0 ? void 0 : (_target$node4 = target.node) === null || _target$node4 === void 0 ? void 0 : (_target$node4$getProp = _target$node4.getPropValue) === null || _target$node4$getProp === void 0 ? void 0 : _target$node4$getProp.call(_target$node4, 'dataList');
155
150
  if (fromNode !== undefined) {
156
- _nodeDataListCache.set(node, fromNode);
151
+ _dataListCacheById[nodeId] = fromNode;
152
+ return;
153
+ }
154
+ // schema 序列化快照:源头数据,不受 settings 中间态影响
155
+ var fromSchema = target === null || target === void 0 ? void 0 : (_target$node5 = target.node) === null || _target$node5 === void 0 ? void 0 : (_target$node5$schema = _target$node5.schema) === null || _target$node5$schema === void 0 ? void 0 : (_target$node5$schema$ = _target$node5$schema.props) === null || _target$node5$schema$ === void 0 ? void 0 : _target$node5$schema$.dataList;
156
+ if (fromSchema !== undefined) {
157
+ _dataListCacheById[nodeId] = fromSchema;
157
158
  return;
158
159
  }
159
- // 降级:从 settings API 读取
160
160
  var fromProps = target === null || target === void 0 ? void 0 : (_target$getProps4 = target.getProps) === null || _target$getProps4 === void 0 ? void 0 : (_target$getProps4$cal = _target$getProps4.call(target)) === null || _target$getProps4$cal === void 0 ? void 0 : (_target$getProps4$cal2 = _target$getProps4$cal.getPropValue) === null || _target$getProps4$cal2 === void 0 ? void 0 : _target$getProps4$cal2.call(_target$getProps4$cal, 'dataList');
161
161
  if (fromProps !== undefined) {
162
- _nodeDataListCache.set(node, fromProps);
162
+ _dataListCacheById[nodeId] = fromProps;
163
163
  }
164
164
  };
165
165
  var TeletextListMeta = {
@@ -345,10 +345,14 @@ var TeletextListMeta = {
345
345
  return;
346
346
  }
347
347
  var props = target.getProps();
348
- // 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
349
348
  _cacheDataList(target);
349
+ // 快照 dataList:在 setPropValue 前捕获,防止引擎重评估时被默认值覆盖
350
+ var prevDataList = props.getPropValue('dataList');
350
351
  props.setPropValue('imgWidth', parsedValue);
351
- // syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
352
+ // 还原 dataList(幂等操作,若引擎未覆盖则无副作用)
353
+ if (prevDataList !== undefined) {
354
+ props.setPropValue('dataList', prevDataList);
355
+ }
352
356
  syncImageStyleValue(target, 'width', parsedValue);
353
357
  }
354
358
  }
@@ -410,10 +414,14 @@ var TeletextListMeta = {
410
414
  return;
411
415
  }
412
416
  var props = target.getProps();
413
- // 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
414
417
  _cacheDataList(target);
418
+ // 快照 dataList:在 setPropValue 前捕获,防止引擎重评估时被默认值覆盖
419
+ var prevDataList = props.getPropValue('dataList');
415
420
  props.setPropValue('imgHeight', parsedValue);
416
- // syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
421
+ // 还原 dataList(幂等操作,若引擎未覆盖则无副作用)
422
+ if (prevDataList !== undefined) {
423
+ props.setPropValue('dataList', prevDataList);
424
+ }
417
425
  syncImageStyleValue(target, 'height', parsedValue);
418
426
  }
419
427
  }
@@ -488,9 +496,9 @@ var TeletextListMeta = {
488
496
  },
489
497
  extraProps: {
490
498
  setValue: function setValue(target, value) {
491
- var _target$node3, _schemaChildren$filte, _target$parent, _target$parent$items;
499
+ var _target$node6, _schemaChildren$filte, _target$parent, _target$parent$items;
492
500
  target.getProps().setPropValue('textLines', value);
493
- var schema = target === null || target === void 0 ? void 0 : (_target$node3 = target.node) === null || _target$node3 === void 0 ? void 0 : _target$node3.schema;
501
+ var schema = target === null || target === void 0 ? void 0 : (_target$node6 = target.node) === null || _target$node6 === void 0 ? void 0 : _target$node6.schema;
494
502
  var node = target === null || target === void 0 ? void 0 : target.node;
495
503
  var schemaChildren = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.children) ? schema.children : [];
496
504
 
@@ -884,36 +892,31 @@ var TeletextListMeta = {
884
892
  }
885
893
  },
886
894
  initialValue: function initialValue(target) {
887
- var _node$getPropValue2, _target$getProps1, _target$getProps1$cal, _target$getProps1$cal2;
888
- // 读取顺序(由最可靠到最不可靠):
889
- // 1. node API(schema 层,引擎重评估前通常仍有值)
890
- // 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
891
- // 3. settings API(重评估中间态下可能已清空,作为最后手段)
892
- // 4. 默认占位数据(仅首次创建组件时触达)
893
- //
894
- // 关键防御:一旦组件已绑定数据源(缓存或 node 中有值),
895
- // 无论是哪种场景的 initialValue 调用,都必须返回已有值而不是默认数组。
896
- // syncImageStyleValue 改为异步后,通常 node.getPropValue 已能拿到正确值;
897
- // 缓存作为最后一道防线,彻底切断默认数组覆盖绑定表达式的可能。
898
- var node = target === null || target === void 0 ? void 0 : target.node;
899
- // 优先读缓存:即使 node.getPropValue 暂时处于中间态,缓存也能提供可靠值
900
- var cached = node ? _nodeDataListCache.get(node) : undefined;
901
- var fromNode = node === null || node === void 0 ? void 0 : (_node$getPropValue2 = node.getPropValue) === null || _node$getPropValue2 === void 0 ? void 0 : _node$getPropValue2.call(node, 'dataList');
895
+ var _target$node7, _target$node8, _target$node8$getProp, _target$getProps1, _target$getProps1$cal, _target$getProps1$cal2, _target$node9, _target$node9$schema, _target$node9$schema$;
896
+ var nodeId = target === null || target === void 0 ? void 0 : (_target$node7 = target.node) === null || _target$node7 === void 0 ? void 0 : _target$node7.id;
897
+ // 1. node API
898
+ var fromNode = target === null || target === void 0 ? void 0 : (_target$node8 = target.node) === null || _target$node8 === void 0 ? void 0 : (_target$node8$getProp = _target$node8.getPropValue) === null || _target$node8$getProp === void 0 ? void 0 : _target$node8$getProp.call(_target$node8, 'dataList');
902
899
  if (fromNode !== undefined) {
903
- // 同步更新缓存,为后续可能的重评估提供后备
904
- if (node) _nodeDataListCache.set(node, fromNode);
900
+ if (nodeId) _dataListCacheById[nodeId] = fromNode;
905
901
  return fromNode;
906
902
  }
907
- // node.getPropValue 返回 undefined:引擎可能已在调用 initialValue 前清空 node prop
908
- // 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
909
- if (cached !== undefined) {
910
- return cached;
903
+ // 2. 模块级缓存(node.id 索引,不受 Proxy 引用问题影响)
904
+ if (nodeId && _dataListCacheById[nodeId] !== undefined) {
905
+ return _dataListCacheById[nodeId];
911
906
  }
907
+ // 3. settings API
912
908
  var current = target === null || target === void 0 ? void 0 : (_target$getProps1 = target.getProps) === null || _target$getProps1 === void 0 ? void 0 : (_target$getProps1$cal = _target$getProps1.call(target)) === null || _target$getProps1$cal === void 0 ? void 0 : (_target$getProps1$cal2 = _target$getProps1$cal.getPropValue) === null || _target$getProps1$cal2 === void 0 ? void 0 : _target$getProps1$cal2.call(_target$getProps1$cal, 'dataList');
913
909
  if (current !== undefined) {
914
- if (node) _nodeDataListCache.set(node, current);
910
+ if (nodeId) _dataListCacheById[nodeId] = current;
915
911
  return current;
916
912
  }
913
+ // 4. schema 序列化快照(源头数据,不受 settings 中间态影响)
914
+ var fromSchema = target === null || target === void 0 ? void 0 : (_target$node9 = target.node) === null || _target$node9 === void 0 ? void 0 : (_target$node9$schema = _target$node9.schema) === null || _target$node9$schema === void 0 ? void 0 : (_target$node9$schema$ = _target$node9$schema.props) === null || _target$node9$schema$ === void 0 ? void 0 : _target$node9$schema$.dataList;
915
+ if (fromSchema !== undefined) {
916
+ if (nodeId) _dataListCacheById[nodeId] = fromSchema;
917
+ return fromSchema;
918
+ }
919
+ // 5. 默认数据(仅首次创建组件时触达)
917
920
  return [{
918
921
  image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
919
922
  title: '标题名称',
@@ -934,55 +937,49 @@ var TeletextListMeta = {
934
937
  },
935
938
  extraProps: {
936
939
  /**
937
- * 自定义 getValue:保证引擎重评估期间 field.getValue() 始终返回有效值(非 undefined),
938
- * 从而阻止 initDefaultValue 在不应该的时机调用 initialValue 并覆盖为默认图数组。
939
- *
940
- * 触发场景:修改 imgWidth/imgHeight 或通过布局面板修改图片 margin 时,
941
- * imageChildNode.setPropValue('style', ...) 会触发引擎对父节点 settings 的重评估;
942
- * 若此时 dataList Prop 处于 "unset" 中间态,parent.getPropValue 会返回 undefined,
943
- * 导致不带 getValue 时 field.getValue() = undefined → initDefaultValue 触发 → 默认图。
944
- * 有了此 getValue 后,即使 schema 层暂时返回 undefined,从缓存取值仍可返回用户数据,
945
- * field.getValue() 非 undefined → initDefaultValue 永远跳过 → 默认图问题彻底消失。
940
+ * 保证引擎重评估期间 field.getValue() 始终返回有效值(非 undefined),
941
+ * 阻止 initDefaultValue 覆盖已绑定的 JSExpression。
942
+ * 回退链:currentValue → 缓存(node.id) → schema 快照 → node API。
946
943
  */
947
944
  getValue: function getValue(target, currentValue) {
948
- var node = target === null || target === void 0 ? void 0 : target.node;
945
+ var _target$node0, _target$node1, _target$node1$schema, _target$node1$schema$, _target$node10, _target$node10$getPro;
946
+ var nodeId = target === null || target === void 0 ? void 0 : (_target$node0 = target.node) === null || _target$node0 === void 0 ? void 0 : _target$node0.id;
949
947
  if (currentValue !== undefined) {
950
- // schema 层有值:同步更新缓存,确保用户最新编辑的数据被记录
951
- if (node) _nodeDataListCache.set(node, currentValue);
948
+ if (nodeId) _dataListCacheById[nodeId] = currentValue;
952
949
  return currentValue;
953
950
  }
954
- // schema 层暂时无值(引擎重评估中间态):从缓存恢复,避免 initDefaultValue 触发
955
- var cached = node ? _nodeDataListCache.get(node) : undefined;
956
- return cached; // undefined 仅在缓存为空(全新组件首次初始化)时出现,属正常情况
951
+ // 引擎 currentValue undefined(重评估中间态),逐级回退:
952
+ if (nodeId && _dataListCacheById[nodeId] !== undefined) {
953
+ return _dataListCacheById[nodeId];
954
+ }
955
+ // node.schema 序列化快照:不受 settings 中间态影响,是最可靠的源头数据
956
+ var fromSchema = target === null || target === void 0 ? void 0 : (_target$node1 = target.node) === null || _target$node1 === void 0 ? void 0 : (_target$node1$schema = _target$node1.schema) === null || _target$node1$schema === void 0 ? void 0 : (_target$node1$schema$ = _target$node1$schema.props) === null || _target$node1$schema$ === void 0 ? void 0 : _target$node1$schema$.dataList;
957
+ if (fromSchema !== undefined) {
958
+ if (nodeId) _dataListCacheById[nodeId] = fromSchema;
959
+ return fromSchema;
960
+ }
961
+ var fromNode = target === null || target === void 0 ? void 0 : (_target$node10 = target.node) === null || _target$node10 === void 0 ? void 0 : (_target$node10$getPro = _target$node10.getPropValue) === null || _target$node10$getPro === void 0 ? void 0 : _target$node10$getPro.call(_target$node10, 'dataList');
962
+ if (fromNode !== undefined) {
963
+ if (nodeId) _dataListCacheById[nodeId] = fromNode;
964
+ return fromNode;
965
+ }
966
+ return undefined;
957
967
  },
958
968
  /**
959
- * 自定义 setValue:用户每次编辑 dataList 条目时,先更新 WeakMap 缓存,
960
- * 再通过 node.setPropValue 将值持久化到 schema
961
- *
962
- * ⚠️ 此引擎中 extraProps.setValue 完全接管写入逻辑,引擎不会自动持久化:
963
- * 若不在此处显式调用 setPropValue,用户编辑的数据将只存于内存缓存,
964
- * 页面刷新后丢失,同时 imgWidth/imgHeight.setValue 的快照–还原机制也因
965
- * props.getPropValue('dataList') 返回 undefined 而失效,导致还原跳过,
966
- * 进而触发引擎 initDefaultValue,画布回退默认图。
967
- *
968
- * 写入顺序:先缓存(供 initialValue/getValue 兜底),再写 schema(持久化)。
969
- * 写入 schema 会触发引擎对 settings 的重评估,但此时 schema 已有值,
970
- * initialValue 不会被调用,不会产生循环。
969
+ * 用户编辑 dataList 时同步更新缓存并持久化到 schema。
970
+ * 引擎 extraProps.setValue 完全接管写入,必须显式 setPropValue
971
971
  */
972
972
  setValue: function setValue(target, value) {
973
- var node = target === null || target === void 0 ? void 0 : target.node;
974
- if (!node) return;
973
+ var _target$node11;
974
+ var nodeId = target === null || target === void 0 ? void 0 : (_target$node11 = target.node) === null || _target$node11 === void 0 ? void 0 : _target$node11.id;
975
+ if (!nodeId) return;
975
976
  if (value !== undefined) {
976
977
  var _target$getProps10, _target$getProps10$ca, _target$getProps10$ca2;
977
- // 先写缓存,确保重评估期间 getValue 可从缓存返回有效值
978
- _nodeDataListCache.set(node, value);
979
- // 再持久化到 schema(引擎不会自动写入,必须显式调用)
978
+ _dataListCacheById[nodeId] = value;
980
979
  (_target$getProps10 = target.getProps) === null || _target$getProps10 === void 0 ? void 0 : (_target$getProps10$ca = _target$getProps10.call(target)) === null || _target$getProps10$ca === void 0 ? void 0 : (_target$getProps10$ca2 = _target$getProps10$ca.setPropValue) === null || _target$getProps10$ca2 === void 0 ? void 0 : _target$getProps10$ca2.call(_target$getProps10$ca, 'dataList', value);
981
980
  } else {
982
981
  var _target$getProps11, _target$getProps11$ca, _target$getProps11$ca2;
983
- // clearValue 场景(value = undefined):清空缓存,使下次 initDefaultValue
984
- // 可正常返回默认数组(仅用于组件被显式清除数据的情况)
985
- _nodeDataListCache["delete"](node);
982
+ delete _dataListCacheById[nodeId];
986
983
  (_target$getProps11 = target.getProps) === null || _target$getProps11 === void 0 ? void 0 : (_target$getProps11$ca = _target$getProps11.call(target)) === null || _target$getProps11$ca === void 0 ? void 0 : (_target$getProps11$ca2 = _target$getProps11$ca.setPropValue) === null || _target$getProps11$ca2 === void 0 ? void 0 : _target$getProps11$ca2.call(_target$getProps11$ca, 'dataList', undefined);
987
984
  }
988
985
  }
@@ -122,7 +122,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
122
122
  packageName = '@dckj-npm/dc-material';
123
123
  }
124
124
  if (version === void 0) {
125
- version = '0.1.372';
125
+ version = '0.1.373';
126
126
  }
127
127
  if (basicLibraryVersion === void 0) {
128
128
  basicLibraryVersion = {