@dckj-npm/dc-material 0.1.363 → 0.1.365

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.
@@ -61,11 +61,18 @@ var TeletextListItem = function TeletextListItem(_ref) {
61
61
  };
62
62
  var imageChildProps = getChildPropsByKey('image');
63
63
  var imageClassName = ['teletext-list__panel__item_image', imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.className].filter(Boolean).join(' ');
64
- var imageStyle = _extends({}, typeof imgWidth === 'number' ? {
65
- width: imgWidth + "px"
66
- } : {}, typeof imgHeight === 'number' ? {
67
- height: imgHeight + "px"
68
- } : {}, (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {});
64
+ // 合并策略:子节点 style 所有属性(含布局面板设置的 margin-left 等)优先保留;
65
+ // width/height 若子节点 style 中没有,则用父级 imgWidth/imgHeight prop 兜底补充;
66
+ // 两者都没有时,使用默认尺寸 100px 防止图片无尺寸。
67
+ // 布局面板 replace style 时可能只保留 margin-left(丢失 width/height),
68
+ // 此时 imgWidth/imgHeight prop 的兜底确保图片尺寸不丢失。
69
+ var childStyle = (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {};
70
+ var DEFAULT_IMG_SIZE = 100;
71
+ var imageStyle = _extends({}, childStyle, childStyle.width == null ? {
72
+ width: (typeof imgWidth === 'number' ? imgWidth : DEFAULT_IMG_SIZE) + "px"
73
+ } : {}, childStyle.height == null ? {
74
+ height: (typeof imgHeight === 'number' ? imgHeight : DEFAULT_IMG_SIZE) + "px"
75
+ } : {});
69
76
  var containerStyle = _extends({
70
77
  padding: itemPadding + "px",
71
78
  backgroundColor: itemBgColor,
@@ -66,11 +66,18 @@ var TeletextListItem = function TeletextListItem(_ref) {
66
66
  };
67
67
  var imageChildProps = getChildPropsByKey('image');
68
68
  var imageClassName = ['teletext-list__panel__item_image', imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.className].filter(Boolean).join(' ');
69
- var imageStyle = (0, _extends2["default"])({}, typeof imgWidth === 'number' ? {
70
- width: imgWidth + "px"
71
- } : {}, typeof imgHeight === 'number' ? {
72
- height: imgHeight + "px"
73
- } : {}, (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {});
69
+ // 合并策略:子节点 style 所有属性(含布局面板设置的 margin-left 等)优先保留;
70
+ // width/height 若子节点 style 中没有,则用父级 imgWidth/imgHeight prop 兜底补充;
71
+ // 两者都没有时,使用默认尺寸 100px 防止图片无尺寸。
72
+ // 布局面板 replace style 时可能只保留 margin-left(丢失 width/height),
73
+ // 此时 imgWidth/imgHeight prop 的兜底确保图片尺寸不丢失。
74
+ var childStyle = (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {};
75
+ var DEFAULT_IMG_SIZE = 100;
76
+ var imageStyle = (0, _extends2["default"])({}, childStyle, childStyle.width == null ? {
77
+ width: (typeof imgWidth === 'number' ? imgWidth : DEFAULT_IMG_SIZE) + "px"
78
+ } : {}, childStyle.height == null ? {
79
+ height: (typeof imgHeight === 'number' ? imgHeight : DEFAULT_IMG_SIZE) + "px"
80
+ } : {});
74
81
  var containerStyle = (0, _extends2["default"])({
75
82
  padding: itemPadding + "px",
76
83
  backgroundColor: itemBgColor,
@@ -73,7 +73,21 @@ const syncImageStyleValue = (target: any, styleKey: 'width' | 'height', value: n
73
73
  const imageChildNode = findImageChildNode(target)
74
74
  if (imageChildNode) {
75
75
  const currentStyle = imageChildNode.getPropValue?.('style') || {}
76
- imageChildNode.setPropValue?.('style', { ...currentStyle, [styleKey]: `${value}px` })
76
+ // 同时确保 width/height 都存在于子节点 style 中,防止布局面板 replace 时丢失其中一个
77
+ const updatedStyle: Record<string, any> = { ...currentStyle, [styleKey]: `${value}px` }
78
+ // 如果另一轴尺寸在子节点 style 中不存在,则从父级 prop 补充,保证两轴都写入
79
+ const otherKey = styleKey === 'width' ? 'height' : 'width'
80
+ if (!updatedStyle[otherKey]) {
81
+ const otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight'
82
+ const otherPropValue = parsePxNumber(target?.getProps?.()?.getPropValue?.(otherPropKey))
83
+ if (otherPropValue !== undefined) {
84
+ updatedStyle[otherKey] = `${otherPropValue}px`
85
+ } else {
86
+ // 子节点 style 也没有,使用默认值 100
87
+ updatedStyle[otherKey] = '100px'
88
+ }
89
+ }
90
+ imageChildNode.setPropValue?.('style', updatedStyle)
77
91
  return
78
92
  }
79
93
  // 降级:直接写 schema(引擎无法感知,但保留作为兜底)
@@ -250,11 +264,15 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
250
264
  const prevDataList = props.getPropValue('dataList')
251
265
  const prevDataListBind = props.getPropValue('dataListBind')
252
266
  const prevTextImgGap = props.getPropValue('textImgGap')
267
+ const prevImgWidth = props.getPropValue('imgWidth')
268
+ const prevImgHeight = props.getPropValue('imgHeight')
253
269
  props.setPropValue('imagePlacement', value)
254
270
  // 写回被保护的配置(幂等操作,若引擎未重置则无副作用)
255
271
  if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList)
256
272
  if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind)
257
273
  if (prevTextImgGap !== undefined) props.setPropValue('textImgGap', prevTextImgGap)
274
+ if (prevImgWidth !== undefined) props.setPropValue('imgWidth', prevImgWidth)
275
+ if (prevImgHeight !== undefined) props.setPropValue('imgHeight', prevImgHeight)
258
276
  // 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
259
277
  syncImageDimensionPropsFromChild(target)
260
278
  },
@@ -297,12 +315,10 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
297
315
  },
298
316
  extraProps: {
299
317
  getValue: (target) => {
318
+ // getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
319
+ // (写操作会导致引擎重初始化 dataList 等 prop,画布图片回退到默认图)
300
320
  const styleWidth = getImageStyleNumber(target, 'width')
301
321
  if (styleWidth !== undefined) {
302
- const currentWidth = parsePxNumber(target?.getProps()?.getPropValue?.('imgWidth'))
303
- if (currentWidth !== styleWidth) {
304
- target?.getProps()?.setPropValue?.('imgWidth', styleWidth)
305
- }
306
322
  return styleWidth
307
323
  }
308
324
  const propValue = target?.getProps()?.getPropValue?.('imgWidth')
@@ -310,9 +326,6 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
310
326
  if (parsedPropValue !== undefined) {
311
327
  return parsedPropValue
312
328
  }
313
- if (isDataListBoundExpression(target)) {
314
- return undefined
315
- }
316
329
  return 100
317
330
  },
318
331
  setValue: (target, value) => {
@@ -362,12 +375,9 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
362
375
  },
363
376
  extraProps: {
364
377
  getValue: (target) => {
378
+ // getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
365
379
  const styleHeight = getImageStyleNumber(target, 'height')
366
380
  if (styleHeight !== undefined) {
367
- const currentHeight = parsePxNumber(target?.getProps()?.getPropValue?.('imgHeight'))
368
- if (currentHeight !== styleHeight) {
369
- target?.getProps()?.setPropValue?.('imgHeight', styleHeight)
370
- }
371
381
  return styleHeight
372
382
  }
373
383
  const propValue = target?.getProps()?.getPropValue?.('imgHeight')
@@ -375,9 +385,6 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
375
385
  if (parsedPropValue !== undefined) {
376
386
  return parsedPropValue
377
387
  }
378
- if (isDataListBoundExpression(target)) {
379
- return undefined
380
- }
381
388
  return 100
382
389
  },
383
390
  setValue: (target, value) => {
@@ -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.362';
120
+ version = '0.1.365';
121
121
  }
122
122
  if (basicLibraryVersion === void 0) {
123
123
  basicLibraryVersion = {
@@ -69,9 +69,24 @@ var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value)
69
69
  // 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
70
70
  var imageChildNode = findImageChildNode(target);
71
71
  if (imageChildNode) {
72
- var _imageChildNode$getPr3, _imageChildNode$setPr, _extends2;
72
+ var _imageChildNode$getPr3, _extends2, _imageChildNode$setPr;
73
73
  var _currentStyle = ((_imageChildNode$getPr3 = imageChildNode.getPropValue) === null || _imageChildNode$getPr3 === void 0 ? void 0 : _imageChildNode$getPr3.call(imageChildNode, 'style')) || {};
74
- (_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', _extends({}, _currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2)));
74
+ // 同时确保 width/height 都存在于子节点 style 中,防止布局面板 replace 时丢失其中一个
75
+ var updatedStyle = _extends({}, _currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2));
76
+ // 如果另一轴尺寸在子节点 style 中不存在,则从父级 prop 补充,保证两轴都写入
77
+ var otherKey = styleKey === 'width' ? 'height' : 'width';
78
+ if (!updatedStyle[otherKey]) {
79
+ var _target$getProps, _target$getProps$call, _target$getProps$call2;
80
+ var otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight';
81
+ var otherPropValue = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : (_target$getProps$call = _target$getProps.call(target)) === null || _target$getProps$call === void 0 ? void 0 : (_target$getProps$call2 = _target$getProps$call.getPropValue) === null || _target$getProps$call2 === void 0 ? void 0 : _target$getProps$call2.call(_target$getProps$call, otherPropKey));
82
+ if (otherPropValue !== undefined) {
83
+ updatedStyle[otherKey] = otherPropValue + "px";
84
+ } else {
85
+ // 子节点 style 也没有,使用默认值 100
86
+ updatedStyle[otherKey] = '100px';
87
+ }
88
+ }
89
+ (_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', updatedStyle);
75
90
  return;
76
91
  }
77
92
  // 降级:直接写 schema(引擎无法感知,但保留作为兜底)
@@ -86,10 +101,10 @@ var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value)
86
101
  imageChildSchema.props.style = _extends({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
87
102
  };
88
103
  var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild(target) {
89
- var _target$getProps;
104
+ var _target$getProps2;
90
105
  var widthFromChild = getImageStyleNumber(target, 'width');
91
106
  var heightFromChild = getImageStyleNumber(target, 'height');
92
- var propsApi = target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : _target$getProps.call(target);
107
+ var propsApi = target === null || target === void 0 ? void 0 : (_target$getProps2 = target.getProps) === null || _target$getProps2 === void 0 ? void 0 : _target$getProps2.call(target);
93
108
  if (propsApi && widthFromChild !== undefined) {
94
109
  var _propsApi$getPropValu;
95
110
  var currentWidth = parsePxNumber((_propsApi$getPropValu = propsApi.getPropValue) === null || _propsApi$getPropValu === void 0 ? void 0 : _propsApi$getPropValu.call(propsApi, 'imgWidth'));
@@ -106,8 +121,8 @@ var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild
106
121
  }
107
122
  };
108
123
  var isDataListBoundExpression = function isDataListBoundExpression(target) {
109
- var _target$getProps2, _target$getProps2$cal, _target$getProps2$cal2;
110
- var dataListValue = target === null || target === void 0 ? void 0 : (_target$getProps2 = target.getProps) === null || _target$getProps2 === void 0 ? void 0 : (_target$getProps2$cal = _target$getProps2.call(target)) === null || _target$getProps2$cal === void 0 ? void 0 : (_target$getProps2$cal2 = _target$getProps2$cal.getPropValue) === null || _target$getProps2$cal2 === void 0 ? void 0 : _target$getProps2$cal2.call(_target$getProps2$cal, 'dataList');
124
+ var _target$getProps3, _target$getProps3$cal, _target$getProps3$cal2;
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');
111
126
  return !!(dataListValue && typeof dataListValue === 'object' && dataListValue.type === 'JSExpression');
112
127
  };
113
128
  var TeletextListMeta = {
@@ -218,11 +233,15 @@ var TeletextListMeta = {
218
233
  var prevDataList = props.getPropValue('dataList');
219
234
  var prevDataListBind = props.getPropValue('dataListBind');
220
235
  var prevTextImgGap = props.getPropValue('textImgGap');
236
+ var prevImgWidth = props.getPropValue('imgWidth');
237
+ var prevImgHeight = props.getPropValue('imgHeight');
221
238
  props.setPropValue('imagePlacement', value);
222
239
  // 写回被保护的配置(幂等操作,若引擎未重置则无副作用)
223
240
  if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList);
224
241
  if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind);
225
242
  if (prevTextImgGap !== undefined) props.setPropValue('textImgGap', prevTextImgGap);
243
+ if (prevImgWidth !== undefined) props.setPropValue('imgWidth', prevImgWidth);
244
+ if (prevImgHeight !== undefined) props.setPropValue('imgHeight', prevImgHeight);
226
245
  // 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
227
246
  syncImageDimensionPropsFromChild(target);
228
247
  }
@@ -235,12 +254,12 @@ var TeletextListMeta = {
235
254
  componentName: 'NumberSetter',
236
255
  isRequired: false,
237
256
  initialValue: function initialValue(target) {
238
- var _target$getProps3, _target$getProps3$get;
257
+ var _target$getProps4, _target$getProps4$get;
239
258
  var styleWidth = getImageStyleNumber(target, 'width');
240
259
  if (styleWidth !== undefined) {
241
260
  return styleWidth;
242
261
  }
243
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps3 = target.getProps()) === null || _target$getProps3 === void 0 ? void 0 : (_target$getProps3$get = _target$getProps3.getPropValue) === null || _target$getProps3$get === void 0 ? void 0 : _target$getProps3$get.call(_target$getProps3, 'imgWidth');
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');
244
263
  var parsedPropValue = parsePxNumber(propValue);
245
264
  if (parsedPropValue !== undefined) return parsedPropValue;
246
265
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -250,12 +269,12 @@ var TeletextListMeta = {
250
269
  return 100;
251
270
  },
252
271
  defaultValue: function defaultValue(target) {
253
- var _target$getProps4, _target$getProps4$get;
272
+ var _target$getProps5, _target$getProps5$get;
254
273
  var styleWidth = getImageStyleNumber(target, 'width');
255
274
  if (styleWidth !== undefined) {
256
275
  return styleWidth;
257
276
  }
258
- 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');
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');
259
278
  var parsedPropValue = parsePxNumber(propValue);
260
279
  if (parsedPropValue !== undefined) return parsedPropValue;
261
280
  if (isDataListBoundExpression(target)) {
@@ -266,25 +285,18 @@ var TeletextListMeta = {
266
285
  },
267
286
  extraProps: {
268
287
  getValue: function getValue(target) {
269
- var _target$getProps7, _target$getProps7$get;
288
+ var _target$getProps6, _target$getProps6$get;
289
+ // getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
290
+ // (写操作会导致引擎重初始化 dataList 等 prop,画布图片回退到默认图)
270
291
  var styleWidth = getImageStyleNumber(target, 'width');
271
292
  if (styleWidth !== undefined) {
272
- var _target$getProps5, _target$getProps5$get;
273
- var currentWidth = parsePxNumber(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'));
274
- if (currentWidth !== styleWidth) {
275
- var _target$getProps6, _target$getProps6$set;
276
- target === null || target === void 0 ? void 0 : (_target$getProps6 = target.getProps()) === null || _target$getProps6 === void 0 ? void 0 : (_target$getProps6$set = _target$getProps6.setPropValue) === null || _target$getProps6$set === void 0 ? void 0 : _target$getProps6$set.call(_target$getProps6, 'imgWidth', styleWidth);
277
- }
278
293
  return styleWidth;
279
294
  }
280
- 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');
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');
281
296
  var parsedPropValue = parsePxNumber(propValue);
282
297
  if (parsedPropValue !== undefined) {
283
298
  return parsedPropValue;
284
299
  }
285
- if (isDataListBoundExpression(target)) {
286
- return undefined;
287
- }
288
300
  return 100;
289
301
  },
290
302
  setValue: function setValue(target, value) {
@@ -304,12 +316,12 @@ var TeletextListMeta = {
304
316
  componentName: 'NumberSetter',
305
317
  isRequired: false,
306
318
  initialValue: function initialValue(target) {
307
- var _target$getProps8, _target$getProps8$get;
319
+ var _target$getProps7, _target$getProps7$get;
308
320
  var styleHeight = getImageStyleNumber(target, 'height');
309
321
  if (styleHeight !== undefined) {
310
322
  return styleHeight;
311
323
  }
312
- 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');
324
+ 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');
313
325
  var parsedPropValue = parsePxNumber(propValue);
314
326
  if (parsedPropValue !== undefined) return parsedPropValue;
315
327
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -319,12 +331,12 @@ var TeletextListMeta = {
319
331
  return 100;
320
332
  },
321
333
  defaultValue: function defaultValue(target) {
322
- var _target$getProps9, _target$getProps9$get;
334
+ var _target$getProps8, _target$getProps8$get;
323
335
  var styleHeight = getImageStyleNumber(target, 'height');
324
336
  if (styleHeight !== undefined) {
325
337
  return styleHeight;
326
338
  }
327
- 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');
339
+ 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');
328
340
  var parsedPropValue = parsePxNumber(propValue);
329
341
  if (parsedPropValue !== undefined) return parsedPropValue;
330
342
  if (isDataListBoundExpression(target)) {
@@ -335,25 +347,17 @@ var TeletextListMeta = {
335
347
  },
336
348
  extraProps: {
337
349
  getValue: function getValue(target) {
338
- var _target$getProps10, _target$getProps10$ge;
350
+ var _target$getProps9, _target$getProps9$get;
351
+ // getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
339
352
  var styleHeight = getImageStyleNumber(target, 'height');
340
353
  if (styleHeight !== undefined) {
341
- var _target$getProps0, _target$getProps0$get;
342
- var currentHeight = parsePxNumber(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'));
343
- if (currentHeight !== styleHeight) {
344
- var _target$getProps1, _target$getProps1$set;
345
- target === null || target === void 0 ? void 0 : (_target$getProps1 = target.getProps()) === null || _target$getProps1 === void 0 ? void 0 : (_target$getProps1$set = _target$getProps1.setPropValue) === null || _target$getProps1$set === void 0 ? void 0 : _target$getProps1$set.call(_target$getProps1, 'imgHeight', styleHeight);
346
- }
347
354
  return styleHeight;
348
355
  }
349
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps10 = target.getProps()) === null || _target$getProps10 === void 0 ? void 0 : (_target$getProps10$ge = _target$getProps10.getPropValue) === null || _target$getProps10$ge === void 0 ? void 0 : _target$getProps10$ge.call(_target$getProps10, 'imgHeight');
356
+ 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');
350
357
  var parsedPropValue = parsePxNumber(propValue);
351
358
  if (parsedPropValue !== undefined) {
352
359
  return parsedPropValue;
353
360
  }
354
- if (isDataListBoundExpression(target)) {
355
- return undefined;
356
- }
357
361
  return 100;
358
362
  },
359
363
  setValue: function setValue(target, value) {
@@ -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.362';
125
+ version = '0.1.365';
126
126
  }
127
127
  if (basicLibraryVersion === void 0) {
128
128
  basicLibraryVersion = {
@@ -74,9 +74,24 @@ var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value)
74
74
  // 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
75
75
  var imageChildNode = findImageChildNode(target);
76
76
  if (imageChildNode) {
77
- var _imageChildNode$getPr3, _imageChildNode$setPr, _extends2;
77
+ var _imageChildNode$getPr3, _extends2, _imageChildNode$setPr;
78
78
  var _currentStyle = ((_imageChildNode$getPr3 = imageChildNode.getPropValue) === null || _imageChildNode$getPr3 === void 0 ? void 0 : _imageChildNode$getPr3.call(imageChildNode, 'style')) || {};
79
- (_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', (0, _extends4["default"])({}, _currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2)));
79
+ // 同时确保 width/height 都存在于子节点 style 中,防止布局面板 replace 时丢失其中一个
80
+ var updatedStyle = (0, _extends4["default"])({}, _currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2));
81
+ // 如果另一轴尺寸在子节点 style 中不存在,则从父级 prop 补充,保证两轴都写入
82
+ var otherKey = styleKey === 'width' ? 'height' : 'width';
83
+ if (!updatedStyle[otherKey]) {
84
+ var _target$getProps, _target$getProps$call, _target$getProps$call2;
85
+ var otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight';
86
+ var otherPropValue = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : (_target$getProps$call = _target$getProps.call(target)) === null || _target$getProps$call === void 0 ? void 0 : (_target$getProps$call2 = _target$getProps$call.getPropValue) === null || _target$getProps$call2 === void 0 ? void 0 : _target$getProps$call2.call(_target$getProps$call, otherPropKey));
87
+ if (otherPropValue !== undefined) {
88
+ updatedStyle[otherKey] = otherPropValue + "px";
89
+ } else {
90
+ // 子节点 style 也没有,使用默认值 100
91
+ updatedStyle[otherKey] = '100px';
92
+ }
93
+ }
94
+ (_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', updatedStyle);
80
95
  return;
81
96
  }
82
97
  // 降级:直接写 schema(引擎无法感知,但保留作为兜底)
@@ -91,10 +106,10 @@ var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value)
91
106
  imageChildSchema.props.style = (0, _extends4["default"])({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
92
107
  };
93
108
  var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild(target) {
94
- var _target$getProps;
109
+ var _target$getProps2;
95
110
  var widthFromChild = getImageStyleNumber(target, 'width');
96
111
  var heightFromChild = getImageStyleNumber(target, 'height');
97
- var propsApi = target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : _target$getProps.call(target);
112
+ var propsApi = target === null || target === void 0 ? void 0 : (_target$getProps2 = target.getProps) === null || _target$getProps2 === void 0 ? void 0 : _target$getProps2.call(target);
98
113
  if (propsApi && widthFromChild !== undefined) {
99
114
  var _propsApi$getPropValu;
100
115
  var currentWidth = parsePxNumber((_propsApi$getPropValu = propsApi.getPropValue) === null || _propsApi$getPropValu === void 0 ? void 0 : _propsApi$getPropValu.call(propsApi, 'imgWidth'));
@@ -111,8 +126,8 @@ var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild
111
126
  }
112
127
  };
113
128
  var isDataListBoundExpression = function isDataListBoundExpression(target) {
114
- var _target$getProps2, _target$getProps2$cal, _target$getProps2$cal2;
115
- var dataListValue = target === null || target === void 0 ? void 0 : (_target$getProps2 = target.getProps) === null || _target$getProps2 === void 0 ? void 0 : (_target$getProps2$cal = _target$getProps2.call(target)) === null || _target$getProps2$cal === void 0 ? void 0 : (_target$getProps2$cal2 = _target$getProps2$cal.getPropValue) === null || _target$getProps2$cal2 === void 0 ? void 0 : _target$getProps2$cal2.call(_target$getProps2$cal, 'dataList');
129
+ var _target$getProps3, _target$getProps3$cal, _target$getProps3$cal2;
130
+ 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');
116
131
  return !!(dataListValue && typeof dataListValue === 'object' && dataListValue.type === 'JSExpression');
117
132
  };
118
133
  var TeletextListMeta = {
@@ -223,11 +238,15 @@ var TeletextListMeta = {
223
238
  var prevDataList = props.getPropValue('dataList');
224
239
  var prevDataListBind = props.getPropValue('dataListBind');
225
240
  var prevTextImgGap = props.getPropValue('textImgGap');
241
+ var prevImgWidth = props.getPropValue('imgWidth');
242
+ var prevImgHeight = props.getPropValue('imgHeight');
226
243
  props.setPropValue('imagePlacement', value);
227
244
  // 写回被保护的配置(幂等操作,若引擎未重置则无副作用)
228
245
  if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList);
229
246
  if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind);
230
247
  if (prevTextImgGap !== undefined) props.setPropValue('textImgGap', prevTextImgGap);
248
+ if (prevImgWidth !== undefined) props.setPropValue('imgWidth', prevImgWidth);
249
+ if (prevImgHeight !== undefined) props.setPropValue('imgHeight', prevImgHeight);
231
250
  // 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
232
251
  syncImageDimensionPropsFromChild(target);
233
252
  }
@@ -240,12 +259,12 @@ var TeletextListMeta = {
240
259
  componentName: 'NumberSetter',
241
260
  isRequired: false,
242
261
  initialValue: function initialValue(target) {
243
- var _target$getProps3, _target$getProps3$get;
262
+ var _target$getProps4, _target$getProps4$get;
244
263
  var styleWidth = getImageStyleNumber(target, 'width');
245
264
  if (styleWidth !== undefined) {
246
265
  return styleWidth;
247
266
  }
248
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps3 = target.getProps()) === null || _target$getProps3 === void 0 ? void 0 : (_target$getProps3$get = _target$getProps3.getPropValue) === null || _target$getProps3$get === void 0 ? void 0 : _target$getProps3$get.call(_target$getProps3, 'imgWidth');
267
+ 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');
249
268
  var parsedPropValue = parsePxNumber(propValue);
250
269
  if (parsedPropValue !== undefined) return parsedPropValue;
251
270
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -255,12 +274,12 @@ var TeletextListMeta = {
255
274
  return 100;
256
275
  },
257
276
  defaultValue: function defaultValue(target) {
258
- var _target$getProps4, _target$getProps4$get;
277
+ var _target$getProps5, _target$getProps5$get;
259
278
  var styleWidth = getImageStyleNumber(target, 'width');
260
279
  if (styleWidth !== undefined) {
261
280
  return styleWidth;
262
281
  }
263
- 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');
282
+ 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');
264
283
  var parsedPropValue = parsePxNumber(propValue);
265
284
  if (parsedPropValue !== undefined) return parsedPropValue;
266
285
  if (isDataListBoundExpression(target)) {
@@ -271,25 +290,18 @@ var TeletextListMeta = {
271
290
  },
272
291
  extraProps: {
273
292
  getValue: function getValue(target) {
274
- var _target$getProps7, _target$getProps7$get;
293
+ var _target$getProps6, _target$getProps6$get;
294
+ // getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
295
+ // (写操作会导致引擎重初始化 dataList 等 prop,画布图片回退到默认图)
275
296
  var styleWidth = getImageStyleNumber(target, 'width');
276
297
  if (styleWidth !== undefined) {
277
- var _target$getProps5, _target$getProps5$get;
278
- var currentWidth = parsePxNumber(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'));
279
- if (currentWidth !== styleWidth) {
280
- var _target$getProps6, _target$getProps6$set;
281
- target === null || target === void 0 ? void 0 : (_target$getProps6 = target.getProps()) === null || _target$getProps6 === void 0 ? void 0 : (_target$getProps6$set = _target$getProps6.setPropValue) === null || _target$getProps6$set === void 0 ? void 0 : _target$getProps6$set.call(_target$getProps6, 'imgWidth', styleWidth);
282
- }
283
298
  return styleWidth;
284
299
  }
285
- 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');
300
+ 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');
286
301
  var parsedPropValue = parsePxNumber(propValue);
287
302
  if (parsedPropValue !== undefined) {
288
303
  return parsedPropValue;
289
304
  }
290
- if (isDataListBoundExpression(target)) {
291
- return undefined;
292
- }
293
305
  return 100;
294
306
  },
295
307
  setValue: function setValue(target, value) {
@@ -309,12 +321,12 @@ var TeletextListMeta = {
309
321
  componentName: 'NumberSetter',
310
322
  isRequired: false,
311
323
  initialValue: function initialValue(target) {
312
- var _target$getProps8, _target$getProps8$get;
324
+ var _target$getProps7, _target$getProps7$get;
313
325
  var styleHeight = getImageStyleNumber(target, 'height');
314
326
  if (styleHeight !== undefined) {
315
327
  return styleHeight;
316
328
  }
317
- 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');
329
+ 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');
318
330
  var parsedPropValue = parsePxNumber(propValue);
319
331
  if (parsedPropValue !== undefined) return parsedPropValue;
320
332
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -324,12 +336,12 @@ var TeletextListMeta = {
324
336
  return 100;
325
337
  },
326
338
  defaultValue: function defaultValue(target) {
327
- var _target$getProps9, _target$getProps9$get;
339
+ var _target$getProps8, _target$getProps8$get;
328
340
  var styleHeight = getImageStyleNumber(target, 'height');
329
341
  if (styleHeight !== undefined) {
330
342
  return styleHeight;
331
343
  }
332
- 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');
344
+ 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
345
  var parsedPropValue = parsePxNumber(propValue);
334
346
  if (parsedPropValue !== undefined) return parsedPropValue;
335
347
  if (isDataListBoundExpression(target)) {
@@ -340,25 +352,17 @@ var TeletextListMeta = {
340
352
  },
341
353
  extraProps: {
342
354
  getValue: function getValue(target) {
343
- var _target$getProps10, _target$getProps10$ge;
355
+ var _target$getProps9, _target$getProps9$get;
356
+ // getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
344
357
  var styleHeight = getImageStyleNumber(target, 'height');
345
358
  if (styleHeight !== undefined) {
346
- var _target$getProps0, _target$getProps0$get;
347
- var currentHeight = parsePxNumber(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'));
348
- if (currentHeight !== styleHeight) {
349
- var _target$getProps1, _target$getProps1$set;
350
- target === null || target === void 0 ? void 0 : (_target$getProps1 = target.getProps()) === null || _target$getProps1 === void 0 ? void 0 : (_target$getProps1$set = _target$getProps1.setPropValue) === null || _target$getProps1$set === void 0 ? void 0 : _target$getProps1$set.call(_target$getProps1, 'imgHeight', styleHeight);
351
- }
352
359
  return styleHeight;
353
360
  }
354
- var propValue = target === null || target === void 0 ? void 0 : (_target$getProps10 = target.getProps()) === null || _target$getProps10 === void 0 ? void 0 : (_target$getProps10$ge = _target$getProps10.getPropValue) === null || _target$getProps10$ge === void 0 ? void 0 : _target$getProps10$ge.call(_target$getProps10, 'imgHeight');
361
+ 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');
355
362
  var parsedPropValue = parsePxNumber(propValue);
356
363
  if (parsedPropValue !== undefined) {
357
364
  return parsedPropValue;
358
365
  }
359
- if (isDataListBoundExpression(target)) {
360
- return undefined;
361
- }
362
366
  return 100;
363
367
  },
364
368
  setValue: function setValue(target, value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dckj-npm/dc-material",
3
- "version": "0.1.363",
3
+ "version": "0.1.365",
4
4
  "description": "dc低代码物料",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -114,10 +114,10 @@
114
114
  },
115
115
  "componentConfig": {
116
116
  "isComponentLibrary": true,
117
- "materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.362/build/lowcode/assets-prod.json"
117
+ "materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.365/build/lowcode/assets-prod.json"
118
118
  },
119
119
  "lcMeta": {
120
120
  "type": "component"
121
121
  },
122
- "homepage": "https://unpkg.com/@dckj-npm/dc-material@0.1.362/build/index.html"
122
+ "homepage": "https://unpkg.com/@dckj-npm/dc-material@0.1.365/build/index.html"
123
123
  }