@dckj-npm/dc-material 0.1.368 → 0.1.370

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.
@@ -134,6 +134,34 @@ const isDataListBoundExpression = (target: any): boolean => {
134
134
  )
135
135
  }
136
136
 
137
+ /**
138
+ * 模块级 WeakMap 缓存:以 IPublicModelNode 对象引用为 key,存储每个 TeletextList 节点
139
+ * 最后一次已知的「非默认」dataList 值。
140
+ *
141
+ * 作用:在 setPropValue 触发的 settings 重评估中,引擎可能先将 node prop 清空再调用
142
+ * dataList.initialValue;此时 node.getPropValue 与 getProps().getPropValue 均返回
143
+ * undefined,导致 initialValue 回退默认数组、覆盖已绑定的 JSExpression 或用户数据。
144
+ * 通过在每次 imgWidth/imgHeight/imagePlacement.setValue 执行任何 setPropValue 之前
145
+ * 将当前 dataList 写入此缓存,initialValue 可从缓存安全恢复,彻底切断引擎中间态影响。
146
+ */
147
+ const _nodeDataListCache = new WeakMap<object, any>()
148
+
149
+ const _cacheDataList = (target: any): void => {
150
+ const node = target?.node
151
+ if (!node) return
152
+ // 优先从 node 级 API 读取(schema 层,不受 settings 重评估中间态影响)
153
+ const fromNode = node?.getPropValue?.('dataList')
154
+ if (fromNode !== undefined) {
155
+ _nodeDataListCache.set(node, fromNode)
156
+ return
157
+ }
158
+ // 降级:从 settings API 读取
159
+ const fromProps = target?.getProps?.()?.getPropValue?.('dataList')
160
+ if (fromProps !== undefined) {
161
+ _nodeDataListCache.set(node, fromProps)
162
+ }
163
+ }
164
+
137
165
  const TeletextListMeta: IPublicTypeComponentMetadata = {
138
166
  group: '低代码组件',
139
167
  componentName: 'TeletextList',
@@ -260,6 +288,9 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
260
288
  extraProps: {
261
289
  setValue: (target, value) => {
262
290
  const props = target.getProps()
291
+ // 在任何 setPropValue 之前先写入模块级缓存,确保 dataList.initialValue
292
+ // 重评估时即使 engine 已清空 node prop 也能从缓存恢复正确值
293
+ _cacheDataList(target)
263
294
  // 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
264
295
  const prevDataList = props.getPropValue('dataList')
265
296
  const prevDataListBind = props.getPropValue('dataListBind')
@@ -334,8 +365,10 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
334
365
  return
335
366
  }
336
367
  const props = target.getProps()
368
+ // 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
369
+ _cacheDataList(target)
337
370
  // 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
338
- // 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图(与 imagePlacement.setValue 同策略)
371
+ // 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
339
372
  const prevDataList = props.getPropValue('dataList')
340
373
  const prevDataListBind = props.getPropValue('dataListBind')
341
374
  props.setPropValue('imgWidth', parsedValue)
@@ -401,6 +434,8 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
401
434
  return
402
435
  }
403
436
  const props = target.getProps()
437
+ // 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
438
+ _cacheDataList(target)
404
439
  // 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
405
440
  // 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
406
441
  const prevDataList = props.getPropValue('dataList')
@@ -921,19 +956,27 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
921
956
  },
922
957
  },
923
958
  initialValue: (target) => {
924
- // 若 dataList prop 已有值(用户自定义数组、JSExpression 数据源绑定等),
925
- // 直接返回当前值,防止引擎在任意 setPropValue 触发重评估时用静态默认数组
926
- // 覆盖已设置的 dataList,导致画布图片回退为默认图(问题 12.4 残留路径)。
927
- // 优先使用 node API(读取 schema 层数据,不受引擎 settings 重评估中间态影响);
928
- // settings API (getProps) 在引擎重评估时可能处于已清空的中间状态,
929
- // node.getPropValue 始终反映最后一次持久化写入的值。
930
- // 仅当两者均为 undefined(首次创建组件)时才注入默认占位数据。
931
- const fromNode = target?.node?.getPropValue?.('dataList')
959
+ // 读取顺序(由最可靠到最不可靠):
960
+ // 1. node 级 API(schema 层,引擎重评估前通常仍有值)
961
+ // 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
962
+ // 3. settings API(重评估中间态下可能已清空,作为最后手段)
963
+ // 4. 默认占位数据(仅首次创建组件时触达)
964
+ const node = target?.node
965
+ const fromNode = node?.getPropValue?.('dataList')
932
966
  if (fromNode !== undefined) {
967
+ // 同步更新缓存,为后续可能的重评估提供后备
968
+ if (node) _nodeDataListCache.set(node, fromNode)
933
969
  return fromNode
934
970
  }
971
+ // node.getPropValue 返回 undefined:引擎已在调用 initialValue 前清空 node prop
972
+ // → 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
973
+ const cached = node ? _nodeDataListCache.get(node) : undefined
974
+ if (cached !== undefined) {
975
+ return cached
976
+ }
935
977
  const current = target?.getProps?.()?.getPropValue?.('dataList')
936
978
  if (current !== undefined) {
979
+ if (node) _nodeDataListCache.set(node, current)
937
980
  return current
938
981
  }
939
982
  return [
@@ -962,6 +1005,47 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
962
1005
  ]
963
1006
  },
964
1007
  },
1008
+ extraProps: {
1009
+ /**
1010
+ * 自定义 getValue:保证引擎重评估期间 field.getValue() 始终返回有效值(非 undefined),
1011
+ * 从而阻止 initDefaultValue 在不应该的时机调用 initialValue 并覆盖为默认图数组。
1012
+ *
1013
+ * 触发场景:修改 imgWidth/imgHeight 或通过布局面板修改图片 margin 时,
1014
+ * imageChildNode.setPropValue('style', ...) 会触发引擎对父节点 settings 的重评估;
1015
+ * 若此时 dataList Prop 处于 "unset" 中间态,parent.getPropValue 会返回 undefined,
1016
+ * 导致不带 getValue 时 field.getValue() = undefined → initDefaultValue 触发 → 默认图。
1017
+ * 有了此 getValue 后,即使 schema 层暂时返回 undefined,从缓存取值仍可返回用户数据,
1018
+ * field.getValue() 非 undefined → initDefaultValue 永远跳过 → 默认图问题彻底消失。
1019
+ */
1020
+ getValue: (target: any, currentValue: any) => {
1021
+ const node = target?.node
1022
+ if (currentValue !== undefined) {
1023
+ // schema 层有值:同步更新缓存,确保用户最新编辑的数据被记录
1024
+ if (node) _nodeDataListCache.set(node, currentValue)
1025
+ return currentValue
1026
+ }
1027
+ // schema 层暂时无值(引擎重评估中间态):从缓存恢复,避免 initDefaultValue 触发
1028
+ const cached = node ? _nodeDataListCache.get(node) : undefined
1029
+ return cached // undefined 仅在缓存为空(全新组件首次初始化)时出现,属正常情况
1030
+ },
1031
+ /**
1032
+ * 自定义 setValue:用户每次编辑 dataList 条目时即时更新 WeakMap 缓存。
1033
+ * 这是保证缓存与用户实际数据保持同步的关键——之前缓存只在
1034
+ * imgWidth/imgHeight/imagePlacement.setValue 中写入,用户直接编辑 dataList
1035
+ * 时缓存一直停留在初始默认值,导致 margin 修改时从缓存取出默认图数组。
1036
+ */
1037
+ setValue: (target: any, value: any) => {
1038
+ const node = target?.node
1039
+ if (!node) return
1040
+ if (value !== undefined) {
1041
+ _nodeDataListCache.set(node, value)
1042
+ } else {
1043
+ // clearValue 场景(value = undefined):清空缓存,使下次 initDefaultValue
1044
+ // 可正常返回默认数组(仅用于组件被显式清除数据的情况)
1045
+ _nodeDataListCache.delete(node)
1046
+ }
1047
+ },
1048
+ },
965
1049
  },
966
1050
  ],
967
1051
  supports: {
@@ -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.368';
120
+ version = '0.1.370';
121
121
  }
122
122
  if (basicLibraryVersion === void 0) {
123
123
  basicLibraryVersion = {
@@ -125,6 +125,34 @@ var isDataListBoundExpression = function isDataListBoundExpression(target) {
125
125
  var dataListValue = target === null || target === void 0 ? void 0 : (_target$getProps3 = target.getProps) === null || _target$getProps3 === void 0 ? void 0 : (_target$getProps3$cal = _target$getProps3.call(target)) === null || _target$getProps3$cal === void 0 ? void 0 : (_target$getProps3$cal2 = _target$getProps3$cal.getPropValue) === null || _target$getProps3$cal2 === void 0 ? void 0 : _target$getProps3$cal2.call(_target$getProps3$cal, 'dataList');
126
126
  return !!(dataListValue && typeof dataListValue === 'object' && dataListValue.type === 'JSExpression');
127
127
  };
128
+
129
+ /**
130
+ * 模块级 WeakMap 缓存:以 IPublicModelNode 对象引用为 key,存储每个 TeletextList 节点
131
+ * 最后一次已知的「非默认」dataList 值。
132
+ *
133
+ * 作用:在 setPropValue 触发的 settings 重评估中,引擎可能先将 node prop 清空再调用
134
+ * dataList.initialValue;此时 node.getPropValue 与 getProps().getPropValue 均返回
135
+ * undefined,导致 initialValue 回退默认数组、覆盖已绑定的 JSExpression 或用户数据。
136
+ * 通过在每次 imgWidth/imgHeight/imagePlacement.setValue 执行任何 setPropValue 之前
137
+ * 将当前 dataList 写入此缓存,initialValue 可从缓存安全恢复,彻底切断引擎中间态影响。
138
+ */
139
+ var _nodeDataListCache = new WeakMap();
140
+ var _cacheDataList = function _cacheDataList(target) {
141
+ var _node$getPropValue, _target$getProps4, _target$getProps4$cal, _target$getProps4$cal2;
142
+ var node = target === null || target === void 0 ? void 0 : target.node;
143
+ if (!node) return;
144
+ // 优先从 node 级 API 读取(schema 层,不受 settings 重评估中间态影响)
145
+ 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
+ if (fromNode !== undefined) {
147
+ _nodeDataListCache.set(node, fromNode);
148
+ return;
149
+ }
150
+ // 降级:从 settings API 读取
151
+ 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');
152
+ if (fromProps !== undefined) {
153
+ _nodeDataListCache.set(node, fromProps);
154
+ }
155
+ };
128
156
  var TeletextListMeta = {
129
157
  group: '低代码组件',
130
158
  componentName: 'TeletextList',
@@ -229,6 +257,9 @@ var TeletextListMeta = {
229
257
  extraProps: {
230
258
  setValue: function setValue(target, value) {
231
259
  var props = target.getProps();
260
+ // 在任何 setPropValue 之前先写入模块级缓存,确保 dataList.initialValue
261
+ // 重评估时即使 engine 已清空 node prop 也能从缓存恢复正确值
262
+ _cacheDataList(target);
232
263
  // 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
233
264
  var prevDataList = props.getPropValue('dataList');
234
265
  var prevDataListBind = props.getPropValue('dataListBind');
@@ -254,12 +285,12 @@ var TeletextListMeta = {
254
285
  componentName: 'NumberSetter',
255
286
  isRequired: false,
256
287
  initialValue: function initialValue(target) {
257
- var _target$getProps4, _target$getProps4$get;
288
+ var _target$getProps5, _target$getProps5$get;
258
289
  var styleWidth = getImageStyleNumber(target, 'width');
259
290
  if (styleWidth !== undefined) {
260
291
  return styleWidth;
261
292
  }
262
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps4 = target.getProps()) === null || _target$getProps4 === void 0 ? void 0 : (_target$getProps4$get = _target$getProps4.getPropValue) === null || _target$getProps4$get === void 0 ? void 0 : _target$getProps4$get.call(_target$getProps4, 'imgWidth');
293
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps5 = target.getProps()) === null || _target$getProps5 === void 0 ? void 0 : (_target$getProps5$get = _target$getProps5.getPropValue) === null || _target$getProps5$get === void 0 ? void 0 : _target$getProps5$get.call(_target$getProps5, 'imgWidth');
263
294
  var parsedPropValue = parsePxNumber(propValue);
264
295
  if (parsedPropValue !== undefined) return parsedPropValue;
265
296
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -269,12 +300,12 @@ var TeletextListMeta = {
269
300
  return 100;
270
301
  },
271
302
  defaultValue: function defaultValue(target) {
272
- var _target$getProps5, _target$getProps5$get;
303
+ var _target$getProps6, _target$getProps6$get;
273
304
  var styleWidth = getImageStyleNumber(target, 'width');
274
305
  if (styleWidth !== undefined) {
275
306
  return styleWidth;
276
307
  }
277
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps5 = target.getProps()) === null || _target$getProps5 === void 0 ? void 0 : (_target$getProps5$get = _target$getProps5.getPropValue) === null || _target$getProps5$get === void 0 ? void 0 : _target$getProps5$get.call(_target$getProps5, 'imgWidth');
308
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps6 = target.getProps()) === null || _target$getProps6 === void 0 ? void 0 : (_target$getProps6$get = _target$getProps6.getPropValue) === null || _target$getProps6$get === void 0 ? void 0 : _target$getProps6$get.call(_target$getProps6, 'imgWidth');
278
309
  var parsedPropValue = parsePxNumber(propValue);
279
310
  if (parsedPropValue !== undefined) return parsedPropValue;
280
311
  if (isDataListBoundExpression(target)) {
@@ -285,14 +316,14 @@ var TeletextListMeta = {
285
316
  },
286
317
  extraProps: {
287
318
  getValue: function getValue(target) {
288
- var _target$getProps6, _target$getProps6$get;
319
+ var _target$getProps7, _target$getProps7$get;
289
320
  // getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
290
321
  // (写操作会导致引擎重初始化 dataList 等 prop,画布图片回退到默认图)
291
322
  var styleWidth = getImageStyleNumber(target, 'width');
292
323
  if (styleWidth !== undefined) {
293
324
  return styleWidth;
294
325
  }
295
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps6 = target.getProps()) === null || _target$getProps6 === void 0 ? void 0 : (_target$getProps6$get = _target$getProps6.getPropValue) === null || _target$getProps6$get === void 0 ? void 0 : _target$getProps6$get.call(_target$getProps6, 'imgWidth');
326
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps7 = target.getProps()) === null || _target$getProps7 === void 0 ? void 0 : (_target$getProps7$get = _target$getProps7.getPropValue) === null || _target$getProps7$get === void 0 ? void 0 : _target$getProps7$get.call(_target$getProps7, 'imgWidth');
296
327
  var parsedPropValue = parsePxNumber(propValue);
297
328
  if (parsedPropValue !== undefined) {
298
329
  return parsedPropValue;
@@ -305,8 +336,10 @@ var TeletextListMeta = {
305
336
  return;
306
337
  }
307
338
  var props = target.getProps();
339
+ // 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
340
+ _cacheDataList(target);
308
341
  // 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
309
- // 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图(与 imagePlacement.setValue 同策略)
342
+ // 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
310
343
  var prevDataList = props.getPropValue('dataList');
311
344
  var prevDataListBind = props.getPropValue('dataListBind');
312
345
  props.setPropValue('imgWidth', parsedValue);
@@ -324,12 +357,12 @@ var TeletextListMeta = {
324
357
  componentName: 'NumberSetter',
325
358
  isRequired: false,
326
359
  initialValue: function initialValue(target) {
327
- var _target$getProps7, _target$getProps7$get;
360
+ var _target$getProps8, _target$getProps8$get;
328
361
  var styleHeight = getImageStyleNumber(target, 'height');
329
362
  if (styleHeight !== undefined) {
330
363
  return styleHeight;
331
364
  }
332
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps7 = target.getProps()) === null || _target$getProps7 === void 0 ? void 0 : (_target$getProps7$get = _target$getProps7.getPropValue) === null || _target$getProps7$get === void 0 ? void 0 : _target$getProps7$get.call(_target$getProps7, 'imgHeight');
365
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps8 = target.getProps()) === null || _target$getProps8 === void 0 ? void 0 : (_target$getProps8$get = _target$getProps8.getPropValue) === null || _target$getProps8$get === void 0 ? void 0 : _target$getProps8$get.call(_target$getProps8, 'imgHeight');
333
366
  var parsedPropValue = parsePxNumber(propValue);
334
367
  if (parsedPropValue !== undefined) return parsedPropValue;
335
368
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -339,12 +372,12 @@ var TeletextListMeta = {
339
372
  return 100;
340
373
  },
341
374
  defaultValue: function defaultValue(target) {
342
- var _target$getProps8, _target$getProps8$get;
375
+ var _target$getProps9, _target$getProps9$get;
343
376
  var styleHeight = getImageStyleNumber(target, 'height');
344
377
  if (styleHeight !== undefined) {
345
378
  return styleHeight;
346
379
  }
347
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps8 = target.getProps()) === null || _target$getProps8 === void 0 ? void 0 : (_target$getProps8$get = _target$getProps8.getPropValue) === null || _target$getProps8$get === void 0 ? void 0 : _target$getProps8$get.call(_target$getProps8, 'imgHeight');
380
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps9 = target.getProps()) === null || _target$getProps9 === void 0 ? void 0 : (_target$getProps9$get = _target$getProps9.getPropValue) === null || _target$getProps9$get === void 0 ? void 0 : _target$getProps9$get.call(_target$getProps9, 'imgHeight');
348
381
  var parsedPropValue = parsePxNumber(propValue);
349
382
  if (parsedPropValue !== undefined) return parsedPropValue;
350
383
  if (isDataListBoundExpression(target)) {
@@ -355,13 +388,13 @@ var TeletextListMeta = {
355
388
  },
356
389
  extraProps: {
357
390
  getValue: function getValue(target) {
358
- var _target$getProps9, _target$getProps9$get;
391
+ var _target$getProps0, _target$getProps0$get;
359
392
  // getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
360
393
  var styleHeight = getImageStyleNumber(target, 'height');
361
394
  if (styleHeight !== undefined) {
362
395
  return styleHeight;
363
396
  }
364
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps9 = target.getProps()) === null || _target$getProps9 === void 0 ? void 0 : (_target$getProps9$get = _target$getProps9.getPropValue) === null || _target$getProps9$get === void 0 ? void 0 : _target$getProps9$get.call(_target$getProps9, 'imgHeight');
397
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps0 = target.getProps()) === null || _target$getProps0 === void 0 ? void 0 : (_target$getProps0$get = _target$getProps0.getPropValue) === null || _target$getProps0$get === void 0 ? void 0 : _target$getProps0$get.call(_target$getProps0, 'imgHeight');
365
398
  var parsedPropValue = parsePxNumber(propValue);
366
399
  if (parsedPropValue !== undefined) {
367
400
  return parsedPropValue;
@@ -374,6 +407,8 @@ var TeletextListMeta = {
374
407
  return;
375
408
  }
376
409
  var props = target.getProps();
410
+ // 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
411
+ _cacheDataList(target);
377
412
  // 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
378
413
  // 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
379
414
  var prevDataList = props.getPropValue('dataList');
@@ -852,20 +887,28 @@ var TeletextListMeta = {
852
887
  }
853
888
  },
854
889
  initialValue: function initialValue(target) {
855
- var _target$node4, _target$node4$getProp, _target$getProps0, _target$getProps0$cal, _target$getProps0$cal2;
856
- // 若 dataList prop 已有值(用户自定义数组、JSExpression 数据源绑定等),
857
- // 直接返回当前值,防止引擎在任意 setPropValue 触发重评估时用静态默认数组
858
- // 覆盖已设置的 dataList,导致画布图片回退为默认图(问题 12.4 残留路径)。
859
- // 优先使用 node API(读取 schema 层数据,不受引擎 settings 重评估中间态影响);
860
- // settings API (getProps) 在引擎重评估时可能处于已清空的中间状态,
861
- // node.getPropValue 始终反映最后一次持久化写入的值。
862
- // 仅当两者均为 undefined(首次创建组件)时才注入默认占位数据。
863
- 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');
890
+ var _node$getPropValue2, _target$getProps1, _target$getProps1$cal, _target$getProps1$cal2;
891
+ // 读取顺序(由最可靠到最不可靠):
892
+ // 1. node 级 API(schema 层,引擎重评估前通常仍有值)
893
+ // 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
894
+ // 3. settings API(重评估中间态下可能已清空,作为最后手段)
895
+ // 4. 默认占位数据(仅首次创建组件时触达)
896
+ var node = target === null || target === void 0 ? void 0 : target.node;
897
+ 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');
864
898
  if (fromNode !== undefined) {
899
+ // 同步更新缓存,为后续可能的重评估提供后备
900
+ if (node) _nodeDataListCache.set(node, fromNode);
865
901
  return fromNode;
866
902
  }
867
- var current = target === null || target === void 0 ? void 0 : (_target$getProps0 = target.getProps) === null || _target$getProps0 === void 0 ? void 0 : (_target$getProps0$cal = _target$getProps0.call(target)) === null || _target$getProps0$cal === void 0 ? void 0 : (_target$getProps0$cal2 = _target$getProps0$cal.getPropValue) === null || _target$getProps0$cal2 === void 0 ? void 0 : _target$getProps0$cal2.call(_target$getProps0$cal, 'dataList');
903
+ // node.getPropValue 返回 undefined:引擎已在调用 initialValue 前清空 node prop
904
+ // → 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
905
+ var cached = node ? _nodeDataListCache.get(node) : undefined;
906
+ if (cached !== undefined) {
907
+ return cached;
908
+ }
909
+ 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');
868
910
  if (current !== undefined) {
911
+ if (node) _nodeDataListCache.set(node, current);
869
912
  return current;
870
913
  }
871
914
  return [{
@@ -885,6 +928,47 @@ var TeletextListMeta = {
885
928
  }]
886
929
  }];
887
930
  }
931
+ },
932
+ extraProps: {
933
+ /**
934
+ * 自定义 getValue:保证引擎重评估期间 field.getValue() 始终返回有效值(非 undefined),
935
+ * 从而阻止 initDefaultValue 在不应该的时机调用 initialValue 并覆盖为默认图数组。
936
+ *
937
+ * 触发场景:修改 imgWidth/imgHeight 或通过布局面板修改图片 margin 时,
938
+ * imageChildNode.setPropValue('style', ...) 会触发引擎对父节点 settings 的重评估;
939
+ * 若此时 dataList Prop 处于 "unset" 中间态,parent.getPropValue 会返回 undefined,
940
+ * 导致不带 getValue 时 field.getValue() = undefined → initDefaultValue 触发 → 默认图。
941
+ * 有了此 getValue 后,即使 schema 层暂时返回 undefined,从缓存取值仍可返回用户数据,
942
+ * field.getValue() 非 undefined → initDefaultValue 永远跳过 → 默认图问题彻底消失。
943
+ */
944
+ getValue: function getValue(target, currentValue) {
945
+ var node = target === null || target === void 0 ? void 0 : target.node;
946
+ if (currentValue !== undefined) {
947
+ // schema 层有值:同步更新缓存,确保用户最新编辑的数据被记录
948
+ if (node) _nodeDataListCache.set(node, currentValue);
949
+ return currentValue;
950
+ }
951
+ // schema 层暂时无值(引擎重评估中间态):从缓存恢复,避免 initDefaultValue 触发
952
+ var cached = node ? _nodeDataListCache.get(node) : undefined;
953
+ return cached; // undefined 仅在缓存为空(全新组件首次初始化)时出现,属正常情况
954
+ },
955
+ /**
956
+ * 自定义 setValue:用户每次编辑 dataList 条目时即时更新 WeakMap 缓存。
957
+ * 这是保证缓存与用户实际数据保持同步的关键——之前缓存只在
958
+ * imgWidth/imgHeight/imagePlacement.setValue 中写入,用户直接编辑 dataList
959
+ * 时缓存一直停留在初始默认值,导致 margin 修改时从缓存取出默认图数组。
960
+ */
961
+ setValue: function setValue(target, value) {
962
+ var node = target === null || target === void 0 ? void 0 : target.node;
963
+ if (!node) return;
964
+ if (value !== undefined) {
965
+ _nodeDataListCache.set(node, value);
966
+ } else {
967
+ // clearValue 场景(value = undefined):清空缓存,使下次 initDefaultValue
968
+ // 可正常返回默认数组(仅用于组件被显式清除数据的情况)
969
+ _nodeDataListCache["delete"](node);
970
+ }
971
+ }
888
972
  }
889
973
  }],
890
974
  supports: {
@@ -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.368';
125
+ version = '0.1.370';
126
126
  }
127
127
  if (basicLibraryVersion === void 0) {
128
128
  basicLibraryVersion = {