@dckj-npm/dc-material 0.1.363 → 0.1.364

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,11 @@ 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' ? {
64
+ var imageStyle = _extends({}, (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {}, typeof imgWidth === 'number' ? {
65
65
  width: imgWidth + "px"
66
66
  } : {}, typeof imgHeight === 'number' ? {
67
67
  height: imgHeight + "px"
68
- } : {}, (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {});
68
+ } : {});
69
69
  var containerStyle = _extends({
70
70
  padding: itemPadding + "px",
71
71
  backgroundColor: itemBgColor,
@@ -66,11 +66,11 @@ 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' ? {
69
+ var imageStyle = (0, _extends2["default"])({}, (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {}, typeof imgWidth === 'number' ? {
70
70
  width: imgWidth + "px"
71
71
  } : {}, typeof imgHeight === 'number' ? {
72
72
  height: imgHeight + "px"
73
- } : {}, (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {});
73
+ } : {});
74
74
  var containerStyle = (0, _extends2["default"])({
75
75
  padding: itemPadding + "px",
76
76
  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(引擎无法感知,但保留作为兜底)
@@ -308,11 +322,15 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
308
322
  const propValue = target?.getProps()?.getPropValue?.('imgWidth')
309
323
  const parsedPropValue = parsePxNumber(propValue)
310
324
  if (parsedPropValue !== undefined) {
325
+ // prop 有值但子节点 style 中没有,同步写入子节点,保证引擎感知
326
+ syncImageStyleValue(target, 'width', parsedPropValue)
311
327
  return parsedPropValue
312
328
  }
313
- if (isDataListBoundExpression(target)) {
314
- return undefined
315
- }
329
+ // getValue 始终返回默认值 100,不因数据源绑定而返回 undefined
330
+ // isDataListBoundExpression 只影响 initialValue/defaultValue(防止初始化时误写入 mock 数据)
331
+ // 同时将默认值 100 写入 prop 和子节点 style,确保后续引擎可感知
332
+ target?.getProps()?.setPropValue?.('imgWidth', 100)
333
+ syncImageStyleValue(target, 'width', 100)
316
334
  return 100
317
335
  },
318
336
  setValue: (target, value) => {
@@ -373,11 +391,14 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
373
391
  const propValue = target?.getProps()?.getPropValue?.('imgHeight')
374
392
  const parsedPropValue = parsePxNumber(propValue)
375
393
  if (parsedPropValue !== undefined) {
394
+ // prop 有值但子节点 style 中没有,同步写入子节点,保证引擎感知
395
+ syncImageStyleValue(target, 'height', parsedPropValue)
376
396
  return parsedPropValue
377
397
  }
378
- if (isDataListBoundExpression(target)) {
379
- return undefined
380
- }
398
+ // getValue 始终返回默认值 100,不因数据源绑定而返回 undefined
399
+ // 同时将默认值 100 写入 prop 和子节点 style,确保后续引擎可感知
400
+ target?.getProps()?.setPropValue?.('imgHeight', 100)
401
+ syncImageStyleValue(target, 'height', 100)
381
402
  return 100
382
403
  },
383
404
  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.364';
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 = {
@@ -235,12 +250,12 @@ var TeletextListMeta = {
235
250
  componentName: 'NumberSetter',
236
251
  isRequired: false,
237
252
  initialValue: function initialValue(target) {
238
- var _target$getProps3, _target$getProps3$get;
253
+ var _target$getProps4, _target$getProps4$get;
239
254
  var styleWidth = getImageStyleNumber(target, 'width');
240
255
  if (styleWidth !== undefined) {
241
256
  return styleWidth;
242
257
  }
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');
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');
244
259
  var parsedPropValue = parsePxNumber(propValue);
245
260
  if (parsedPropValue !== undefined) return parsedPropValue;
246
261
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -250,12 +265,12 @@ var TeletextListMeta = {
250
265
  return 100;
251
266
  },
252
267
  defaultValue: function defaultValue(target) {
253
- var _target$getProps4, _target$getProps4$get;
268
+ var _target$getProps5, _target$getProps5$get;
254
269
  var styleWidth = getImageStyleNumber(target, 'width');
255
270
  if (styleWidth !== undefined) {
256
271
  return styleWidth;
257
272
  }
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');
273
+ 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
274
  var parsedPropValue = parsePxNumber(propValue);
260
275
  if (parsedPropValue !== undefined) return parsedPropValue;
261
276
  if (isDataListBoundExpression(target)) {
@@ -266,25 +281,29 @@ var TeletextListMeta = {
266
281
  },
267
282
  extraProps: {
268
283
  getValue: function getValue(target) {
269
- var _target$getProps7, _target$getProps7$get;
284
+ var _target$getProps8, _target$getProps8$get, _target$getProps9, _target$getProps9$set;
270
285
  var styleWidth = getImageStyleNumber(target, 'width');
271
286
  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'));
287
+ var _target$getProps6, _target$getProps6$get;
288
+ var currentWidth = parsePxNumber(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'));
274
289
  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);
290
+ var _target$getProps7, _target$getProps7$set;
291
+ target === null || target === void 0 ? void 0 : (_target$getProps7 = target.getProps()) === null || _target$getProps7 === void 0 ? void 0 : (_target$getProps7$set = _target$getProps7.setPropValue) === null || _target$getProps7$set === void 0 ? void 0 : _target$getProps7$set.call(_target$getProps7, 'imgWidth', styleWidth);
277
292
  }
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$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, 'imgWidth');
281
296
  var parsedPropValue = parsePxNumber(propValue);
282
297
  if (parsedPropValue !== undefined) {
298
+ // prop 有值但子节点 style 中没有,同步写入子节点,保证引擎感知
299
+ syncImageStyleValue(target, 'width', parsedPropValue);
283
300
  return parsedPropValue;
284
301
  }
285
- if (isDataListBoundExpression(target)) {
286
- return undefined;
287
- }
302
+ // getValue 始终返回默认值 100,不因数据源绑定而返回 undefined
303
+ // isDataListBoundExpression 只影响 initialValue/defaultValue(防止初始化时误写入 mock 数据)
304
+ // 同时将默认值 100 写入 prop 和子节点 style,确保后续引擎可感知
305
+ target === null || target === void 0 ? void 0 : (_target$getProps9 = target.getProps()) === null || _target$getProps9 === void 0 ? void 0 : (_target$getProps9$set = _target$getProps9.setPropValue) === null || _target$getProps9$set === void 0 ? void 0 : _target$getProps9$set.call(_target$getProps9, 'imgWidth', 100);
306
+ syncImageStyleValue(target, 'width', 100);
288
307
  return 100;
289
308
  },
290
309
  setValue: function setValue(target, value) {
@@ -304,12 +323,12 @@ var TeletextListMeta = {
304
323
  componentName: 'NumberSetter',
305
324
  isRequired: false,
306
325
  initialValue: function initialValue(target) {
307
- var _target$getProps8, _target$getProps8$get;
326
+ var _target$getProps0, _target$getProps0$get;
308
327
  var styleHeight = getImageStyleNumber(target, 'height');
309
328
  if (styleHeight !== undefined) {
310
329
  return styleHeight;
311
330
  }
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');
331
+ 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');
313
332
  var parsedPropValue = parsePxNumber(propValue);
314
333
  if (parsedPropValue !== undefined) return parsedPropValue;
315
334
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -319,12 +338,12 @@ var TeletextListMeta = {
319
338
  return 100;
320
339
  },
321
340
  defaultValue: function defaultValue(target) {
322
- var _target$getProps9, _target$getProps9$get;
341
+ var _target$getProps1, _target$getProps1$get;
323
342
  var styleHeight = getImageStyleNumber(target, 'height');
324
343
  if (styleHeight !== undefined) {
325
344
  return styleHeight;
326
345
  }
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');
346
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps1 = target.getProps()) === null || _target$getProps1 === void 0 ? void 0 : (_target$getProps1$get = _target$getProps1.getPropValue) === null || _target$getProps1$get === void 0 ? void 0 : _target$getProps1$get.call(_target$getProps1, 'imgHeight');
328
347
  var parsedPropValue = parsePxNumber(propValue);
329
348
  if (parsedPropValue !== undefined) return parsedPropValue;
330
349
  if (isDataListBoundExpression(target)) {
@@ -335,25 +354,28 @@ var TeletextListMeta = {
335
354
  },
336
355
  extraProps: {
337
356
  getValue: function getValue(target) {
338
- var _target$getProps10, _target$getProps10$ge;
357
+ var _target$getProps12, _target$getProps12$ge, _target$getProps13, _target$getProps13$se;
339
358
  var styleHeight = getImageStyleNumber(target, 'height');
340
359
  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'));
360
+ var _target$getProps10, _target$getProps10$ge;
361
+ var currentHeight = parsePxNumber(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'));
343
362
  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);
363
+ var _target$getProps11, _target$getProps11$se;
364
+ target === null || target === void 0 ? void 0 : (_target$getProps11 = target.getProps()) === null || _target$getProps11 === void 0 ? void 0 : (_target$getProps11$se = _target$getProps11.setPropValue) === null || _target$getProps11$se === void 0 ? void 0 : _target$getProps11$se.call(_target$getProps11, 'imgHeight', styleHeight);
346
365
  }
347
366
  return styleHeight;
348
367
  }
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');
368
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps12 = target.getProps()) === null || _target$getProps12 === void 0 ? void 0 : (_target$getProps12$ge = _target$getProps12.getPropValue) === null || _target$getProps12$ge === void 0 ? void 0 : _target$getProps12$ge.call(_target$getProps12, 'imgHeight');
350
369
  var parsedPropValue = parsePxNumber(propValue);
351
370
  if (parsedPropValue !== undefined) {
371
+ // prop 有值但子节点 style 中没有,同步写入子节点,保证引擎感知
372
+ syncImageStyleValue(target, 'height', parsedPropValue);
352
373
  return parsedPropValue;
353
374
  }
354
- if (isDataListBoundExpression(target)) {
355
- return undefined;
356
- }
375
+ // getValue 始终返回默认值 100,不因数据源绑定而返回 undefined
376
+ // 同时将默认值 100 写入 prop 和子节点 style,确保后续引擎可感知
377
+ target === null || target === void 0 ? void 0 : (_target$getProps13 = target.getProps()) === null || _target$getProps13 === void 0 ? void 0 : (_target$getProps13$se = _target$getProps13.setPropValue) === null || _target$getProps13$se === void 0 ? void 0 : _target$getProps13$se.call(_target$getProps13, 'imgHeight', 100);
378
+ syncImageStyleValue(target, 'height', 100);
357
379
  return 100;
358
380
  },
359
381
  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.364';
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 = {
@@ -240,12 +255,12 @@ var TeletextListMeta = {
240
255
  componentName: 'NumberSetter',
241
256
  isRequired: false,
242
257
  initialValue: function initialValue(target) {
243
- var _target$getProps3, _target$getProps3$get;
258
+ var _target$getProps4, _target$getProps4$get;
244
259
  var styleWidth = getImageStyleNumber(target, 'width');
245
260
  if (styleWidth !== undefined) {
246
261
  return styleWidth;
247
262
  }
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');
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');
249
264
  var parsedPropValue = parsePxNumber(propValue);
250
265
  if (parsedPropValue !== undefined) return parsedPropValue;
251
266
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -255,12 +270,12 @@ var TeletextListMeta = {
255
270
  return 100;
256
271
  },
257
272
  defaultValue: function defaultValue(target) {
258
- var _target$getProps4, _target$getProps4$get;
273
+ var _target$getProps5, _target$getProps5$get;
259
274
  var styleWidth = getImageStyleNumber(target, 'width');
260
275
  if (styleWidth !== undefined) {
261
276
  return styleWidth;
262
277
  }
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');
278
+ 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
279
  var parsedPropValue = parsePxNumber(propValue);
265
280
  if (parsedPropValue !== undefined) return parsedPropValue;
266
281
  if (isDataListBoundExpression(target)) {
@@ -271,25 +286,29 @@ var TeletextListMeta = {
271
286
  },
272
287
  extraProps: {
273
288
  getValue: function getValue(target) {
274
- var _target$getProps7, _target$getProps7$get;
289
+ var _target$getProps8, _target$getProps8$get, _target$getProps9, _target$getProps9$set;
275
290
  var styleWidth = getImageStyleNumber(target, 'width');
276
291
  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'));
292
+ var _target$getProps6, _target$getProps6$get;
293
+ var currentWidth = parsePxNumber(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'));
279
294
  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);
295
+ var _target$getProps7, _target$getProps7$set;
296
+ target === null || target === void 0 ? void 0 : (_target$getProps7 = target.getProps()) === null || _target$getProps7 === void 0 ? void 0 : (_target$getProps7$set = _target$getProps7.setPropValue) === null || _target$getProps7$set === void 0 ? void 0 : _target$getProps7$set.call(_target$getProps7, 'imgWidth', styleWidth);
282
297
  }
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$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, 'imgWidth');
286
301
  var parsedPropValue = parsePxNumber(propValue);
287
302
  if (parsedPropValue !== undefined) {
303
+ // prop 有值但子节点 style 中没有,同步写入子节点,保证引擎感知
304
+ syncImageStyleValue(target, 'width', parsedPropValue);
288
305
  return parsedPropValue;
289
306
  }
290
- if (isDataListBoundExpression(target)) {
291
- return undefined;
292
- }
307
+ // getValue 始终返回默认值 100,不因数据源绑定而返回 undefined
308
+ // isDataListBoundExpression 只影响 initialValue/defaultValue(防止初始化时误写入 mock 数据)
309
+ // 同时将默认值 100 写入 prop 和子节点 style,确保后续引擎可感知
310
+ target === null || target === void 0 ? void 0 : (_target$getProps9 = target.getProps()) === null || _target$getProps9 === void 0 ? void 0 : (_target$getProps9$set = _target$getProps9.setPropValue) === null || _target$getProps9$set === void 0 ? void 0 : _target$getProps9$set.call(_target$getProps9, 'imgWidth', 100);
311
+ syncImageStyleValue(target, 'width', 100);
293
312
  return 100;
294
313
  },
295
314
  setValue: function setValue(target, value) {
@@ -309,12 +328,12 @@ var TeletextListMeta = {
309
328
  componentName: 'NumberSetter',
310
329
  isRequired: false,
311
330
  initialValue: function initialValue(target) {
312
- var _target$getProps8, _target$getProps8$get;
331
+ var _target$getProps0, _target$getProps0$get;
313
332
  var styleHeight = getImageStyleNumber(target, 'height');
314
333
  if (styleHeight !== undefined) {
315
334
  return styleHeight;
316
335
  }
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');
336
+ 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');
318
337
  var parsedPropValue = parsePxNumber(propValue);
319
338
  if (parsedPropValue !== undefined) return parsedPropValue;
320
339
  // 数据源已绑定时,避免回退为 100 触发误写回
@@ -324,12 +343,12 @@ var TeletextListMeta = {
324
343
  return 100;
325
344
  },
326
345
  defaultValue: function defaultValue(target) {
327
- var _target$getProps9, _target$getProps9$get;
346
+ var _target$getProps1, _target$getProps1$get;
328
347
  var styleHeight = getImageStyleNumber(target, 'height');
329
348
  if (styleHeight !== undefined) {
330
349
  return styleHeight;
331
350
  }
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');
351
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps1 = target.getProps()) === null || _target$getProps1 === void 0 ? void 0 : (_target$getProps1$get = _target$getProps1.getPropValue) === null || _target$getProps1$get === void 0 ? void 0 : _target$getProps1$get.call(_target$getProps1, 'imgHeight');
333
352
  var parsedPropValue = parsePxNumber(propValue);
334
353
  if (parsedPropValue !== undefined) return parsedPropValue;
335
354
  if (isDataListBoundExpression(target)) {
@@ -340,25 +359,28 @@ var TeletextListMeta = {
340
359
  },
341
360
  extraProps: {
342
361
  getValue: function getValue(target) {
343
- var _target$getProps10, _target$getProps10$ge;
362
+ var _target$getProps12, _target$getProps12$ge, _target$getProps13, _target$getProps13$se;
344
363
  var styleHeight = getImageStyleNumber(target, 'height');
345
364
  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'));
365
+ var _target$getProps10, _target$getProps10$ge;
366
+ var currentHeight = parsePxNumber(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'));
348
367
  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);
368
+ var _target$getProps11, _target$getProps11$se;
369
+ target === null || target === void 0 ? void 0 : (_target$getProps11 = target.getProps()) === null || _target$getProps11 === void 0 ? void 0 : (_target$getProps11$se = _target$getProps11.setPropValue) === null || _target$getProps11$se === void 0 ? void 0 : _target$getProps11$se.call(_target$getProps11, 'imgHeight', styleHeight);
351
370
  }
352
371
  return styleHeight;
353
372
  }
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');
373
+ var propValue = target === null || target === void 0 ? void 0 : (_target$getProps12 = target.getProps()) === null || _target$getProps12 === void 0 ? void 0 : (_target$getProps12$ge = _target$getProps12.getPropValue) === null || _target$getProps12$ge === void 0 ? void 0 : _target$getProps12$ge.call(_target$getProps12, 'imgHeight');
355
374
  var parsedPropValue = parsePxNumber(propValue);
356
375
  if (parsedPropValue !== undefined) {
376
+ // prop 有值但子节点 style 中没有,同步写入子节点,保证引擎感知
377
+ syncImageStyleValue(target, 'height', parsedPropValue);
357
378
  return parsedPropValue;
358
379
  }
359
- if (isDataListBoundExpression(target)) {
360
- return undefined;
361
- }
380
+ // getValue 始终返回默认值 100,不因数据源绑定而返回 undefined
381
+ // 同时将默认值 100 写入 prop 和子节点 style,确保后续引擎可感知
382
+ target === null || target === void 0 ? void 0 : (_target$getProps13 = target.getProps()) === null || _target$getProps13 === void 0 ? void 0 : (_target$getProps13$se = _target$getProps13.setPropValue) === null || _target$getProps13$se === void 0 ? void 0 : _target$getProps13$se.call(_target$getProps13, 'imgHeight', 100);
383
+ syncImageStyleValue(target, 'height', 100);
362
384
  return 100;
363
385
  },
364
386
  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.364",
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.364/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.364/build/index.html"
123
123
  }