@dckj-npm/dc-material 0.1.371 → 0.1.372
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/docs/colorful-button.html +3 -3
- package/build/docs/colorful-input.html +3 -3
- package/build/docs/index.html +3 -3
- package/build/docs/teletext-list.html +3 -3
- package/build/docs/{umi.63d950fd.js → umi.78ba47eb.js} +1 -1
- package/build/docs/~demos/colorful-button-demo.html +3 -3
- package/build/docs/~demos/colorful-input-demo.html +3 -3
- package/build/docs/~demos/teletext-list-demo-1.html +3 -3
- package/build/docs/~demos/teletext-list-demo.html +3 -3
- package/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/meta.design.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/lowcode/teletext-list/meta.ts +53 -51
- package/lowcode_es/meta.js +1 -1
- package/lowcode_es/teletext-list/meta.js +53 -50
- package/lowcode_lib/meta.js +1 -1
- package/lowcode_lib/teletext-list/meta.js +53 -50
- package/package.json +3 -3
|
@@ -68,41 +68,49 @@ const getImageStyleNumber = (target: any, styleKey: 'width' | 'height'): number
|
|
|
68
68
|
return parsePxNumber(imageChildSchema?.props?.style?.[styleKey])
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
/**
|
|
72
|
+
* 异步写入 Image 子节点的 style,避免在 imgWidth/imgHeight.setValue 的同步执行栈内
|
|
73
|
+
* 触发引擎重评估 dataList.initialValue(会先清空 dataList prop,导致默认图覆盖绑定数据)。
|
|
74
|
+
* 通过 Promise.resolve().then() 将写入推迟到当前 settings 重评估完成后执行,
|
|
75
|
+
* 此时 dataList 已稳定为正确的 JSExpression,重评估无副作用。
|
|
76
|
+
*/
|
|
77
|
+
const syncImageStyleValue = (target: any, styleKey: 'width' | 'height', value: number): void => {
|
|
78
|
+
Promise.resolve().then(() => {
|
|
79
|
+
// 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
|
|
80
|
+
const imageChildNode = findImageChildNode(target)
|
|
81
|
+
if (imageChildNode) {
|
|
82
|
+
const currentStyle = imageChildNode.getPropValue?.('style') || {}
|
|
83
|
+
// 同时确保 width/height 都存在于子节点 style 中,防止布局面板 replace 时丢失其中一个
|
|
84
|
+
const updatedStyle: Record<string, any> = { ...currentStyle, [styleKey]: `${value}px` }
|
|
85
|
+
// 如果另一轴尺寸在子节点 style 中不存在,则从父级 prop 补充,保证两轴都写入
|
|
86
|
+
const otherKey = styleKey === 'width' ? 'height' : 'width'
|
|
87
|
+
if (!updatedStyle[otherKey]) {
|
|
88
|
+
const otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight'
|
|
89
|
+
const otherPropValue = parsePxNumber(target?.getProps?.()?.getPropValue?.(otherPropKey))
|
|
90
|
+
if (otherPropValue !== undefined) {
|
|
91
|
+
updatedStyle[otherKey] = `${otherPropValue}px`
|
|
92
|
+
} else {
|
|
93
|
+
// 子节点 style 也没有,使用默认值 100
|
|
94
|
+
updatedStyle[otherKey] = '100px'
|
|
95
|
+
}
|
|
88
96
|
}
|
|
97
|
+
imageChildNode.setPropValue?.('style', updatedStyle)
|
|
98
|
+
return
|
|
89
99
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
imageChildSchema.props = {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
[styleKey]: `${value}px`,
|
|
105
|
-
}
|
|
100
|
+
// 降级:直接写 schema(引擎无法感知,但保留作为兜底)
|
|
101
|
+
const imageChildSchema = findImageChildSchema(target)
|
|
102
|
+
if (!imageChildSchema) {
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
if (!imageChildSchema.props) {
|
|
106
|
+
imageChildSchema.props = {}
|
|
107
|
+
}
|
|
108
|
+
const currentStyle = imageChildSchema.props.style || {}
|
|
109
|
+
imageChildSchema.props.style = {
|
|
110
|
+
...currentStyle,
|
|
111
|
+
[styleKey]: `${value}px`,
|
|
112
|
+
}
|
|
113
|
+
})
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
const syncImageDimensionPropsFromChild = (target: any) => {
|
|
@@ -365,17 +373,11 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
365
373
|
return
|
|
366
374
|
}
|
|
367
375
|
const props = target.getProps()
|
|
368
|
-
//
|
|
376
|
+
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
369
377
|
_cacheDataList(target)
|
|
370
|
-
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
371
|
-
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
372
|
-
const prevDataList = props.getPropValue('dataList')
|
|
373
|
-
const prevDataListBind = props.getPropValue('dataListBind')
|
|
374
378
|
props.setPropValue('imgWidth', parsedValue)
|
|
379
|
+
// syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
|
|
375
380
|
syncImageStyleValue(target, 'width', parsedValue)
|
|
376
|
-
// 还原被保护的数据(幂等操作,若引擎未重置则无副作用)
|
|
377
|
-
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList)
|
|
378
|
-
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind)
|
|
379
381
|
},
|
|
380
382
|
},
|
|
381
383
|
},
|
|
@@ -434,17 +436,11 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
434
436
|
return
|
|
435
437
|
}
|
|
436
438
|
const props = target.getProps()
|
|
437
|
-
//
|
|
439
|
+
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
438
440
|
_cacheDataList(target)
|
|
439
|
-
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
440
|
-
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
441
|
-
const prevDataList = props.getPropValue('dataList')
|
|
442
|
-
const prevDataListBind = props.getPropValue('dataListBind')
|
|
443
441
|
props.setPropValue('imgHeight', parsedValue)
|
|
442
|
+
// syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
|
|
444
443
|
syncImageStyleValue(target, 'height', parsedValue)
|
|
445
|
-
// 还原被保护的数据(幂等操作,若引擎未重置则无副作用)
|
|
446
|
-
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList)
|
|
447
|
-
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind)
|
|
448
444
|
},
|
|
449
445
|
},
|
|
450
446
|
},
|
|
@@ -961,16 +957,22 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
961
957
|
// 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
|
|
962
958
|
// 3. settings API(重评估中间态下可能已清空,作为最后手段)
|
|
963
959
|
// 4. 默认占位数据(仅首次创建组件时触达)
|
|
960
|
+
//
|
|
961
|
+
// 关键防御:一旦组件已绑定数据源(缓存或 node 中有值),
|
|
962
|
+
// 无论是哪种场景的 initialValue 调用,都必须返回已有值而不是默认数组。
|
|
963
|
+
// syncImageStyleValue 改为异步后,通常 node.getPropValue 已能拿到正确值;
|
|
964
|
+
// 缓存作为最后一道防线,彻底切断默认数组覆盖绑定表达式的可能。
|
|
964
965
|
const node = target?.node
|
|
966
|
+
// 优先读缓存:即使 node.getPropValue 暂时处于中间态,缓存也能提供可靠值
|
|
967
|
+
const cached = node ? _nodeDataListCache.get(node) : undefined
|
|
965
968
|
const fromNode = node?.getPropValue?.('dataList')
|
|
966
969
|
if (fromNode !== undefined) {
|
|
967
970
|
// 同步更新缓存,为后续可能的重评估提供后备
|
|
968
971
|
if (node) _nodeDataListCache.set(node, fromNode)
|
|
969
972
|
return fromNode
|
|
970
973
|
}
|
|
971
|
-
// node.getPropValue 返回 undefined
|
|
974
|
+
// node.getPropValue 返回 undefined:引擎可能已在调用 initialValue 前清空 node prop
|
|
972
975
|
// → 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
|
|
973
|
-
const cached = node ? _nodeDataListCache.get(node) : undefined
|
|
974
976
|
if (cached !== undefined) {
|
|
975
977
|
return cached
|
|
976
978
|
}
|
package/lowcode_es/meta.js
CHANGED
|
@@ -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.
|
|
120
|
+
version = '0.1.372';
|
|
121
121
|
}
|
|
122
122
|
if (basicLibraryVersion === void 0) {
|
|
123
123
|
basicLibraryVersion = {
|
|
@@ -64,41 +64,50 @@ var getImageStyleNumber = function getImageStyleNumber(target, styleKey) {
|
|
|
64
64
|
var imageChildSchema = findImageChildSchema(target);
|
|
65
65
|
return parsePxNumber(imageChildSchema === null || imageChildSchema === void 0 ? void 0 : (_imageChildSchema$pro = imageChildSchema.props) === null || _imageChildSchema$pro === void 0 ? void 0 : (_imageChildSchema$pro2 = _imageChildSchema$pro.style) === null || _imageChildSchema$pro2 === void 0 ? void 0 : _imageChildSchema$pro2[styleKey]);
|
|
66
66
|
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 异步写入 Image 子节点的 style,避免在 imgWidth/imgHeight.setValue 的同步执行栈内
|
|
70
|
+
* 触发引擎重评估 dataList.initialValue(会先清空 dataList prop,导致默认图覆盖绑定数据)。
|
|
71
|
+
* 通过 Promise.resolve().then() 将写入推迟到当前 settings 重评估完成后执行,
|
|
72
|
+
* 此时 dataList 已稳定为正确的 JSExpression,重评估无副作用。
|
|
73
|
+
*/
|
|
67
74
|
var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
Promise.resolve().then(function () {
|
|
76
|
+
var _extends3;
|
|
77
|
+
// 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
|
|
78
|
+
var imageChildNode = findImageChildNode(target);
|
|
79
|
+
if (imageChildNode) {
|
|
80
|
+
var _imageChildNode$getPr3, _extends2, _imageChildNode$setPr;
|
|
81
|
+
var _currentStyle = ((_imageChildNode$getPr3 = imageChildNode.getPropValue) === null || _imageChildNode$getPr3 === void 0 ? void 0 : _imageChildNode$getPr3.call(imageChildNode, 'style')) || {};
|
|
82
|
+
// 同时确保 width/height 都存在于子节点 style 中,防止布局面板 replace 时丢失其中一个
|
|
83
|
+
var updatedStyle = _extends({}, _currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2));
|
|
84
|
+
// 如果另一轴尺寸在子节点 style 中不存在,则从父级 prop 补充,保证两轴都写入
|
|
85
|
+
var otherKey = styleKey === 'width' ? 'height' : 'width';
|
|
86
|
+
if (!updatedStyle[otherKey]) {
|
|
87
|
+
var _target$getProps, _target$getProps$call, _target$getProps$call2;
|
|
88
|
+
var otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight';
|
|
89
|
+
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));
|
|
90
|
+
if (otherPropValue !== undefined) {
|
|
91
|
+
updatedStyle[otherKey] = otherPropValue + "px";
|
|
92
|
+
} else {
|
|
93
|
+
// 子节点 style 也没有,使用默认值 100
|
|
94
|
+
updatedStyle[otherKey] = '100px';
|
|
95
|
+
}
|
|
87
96
|
}
|
|
97
|
+
(_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', updatedStyle);
|
|
98
|
+
return;
|
|
88
99
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
imageChildSchema.props = {};
|
|
99
|
-
}
|
|
100
|
-
var currentStyle = imageChildSchema.props.style || {};
|
|
101
|
-
imageChildSchema.props.style = _extends({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
|
|
100
|
+
// 降级:直接写 schema(引擎无法感知,但保留作为兜底)
|
|
101
|
+
var imageChildSchema = findImageChildSchema(target);
|
|
102
|
+
if (!imageChildSchema) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!imageChildSchema.props) {
|
|
106
|
+
imageChildSchema.props = {};
|
|
107
|
+
}
|
|
108
|
+
var currentStyle = imageChildSchema.props.style || {};
|
|
109
|
+
imageChildSchema.props.style = _extends({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
|
|
110
|
+
});
|
|
102
111
|
};
|
|
103
112
|
var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild(target) {
|
|
104
113
|
var _target$getProps2;
|
|
@@ -336,17 +345,11 @@ var TeletextListMeta = {
|
|
|
336
345
|
return;
|
|
337
346
|
}
|
|
338
347
|
var props = target.getProps();
|
|
339
|
-
//
|
|
348
|
+
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
340
349
|
_cacheDataList(target);
|
|
341
|
-
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
342
|
-
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
343
|
-
var prevDataList = props.getPropValue('dataList');
|
|
344
|
-
var prevDataListBind = props.getPropValue('dataListBind');
|
|
345
350
|
props.setPropValue('imgWidth', parsedValue);
|
|
351
|
+
// syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
|
|
346
352
|
syncImageStyleValue(target, 'width', parsedValue);
|
|
347
|
-
// 还原被保护的数据(幂等操作,若引擎未重置则无副作用)
|
|
348
|
-
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList);
|
|
349
|
-
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind);
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
355
|
}, {
|
|
@@ -407,17 +410,11 @@ var TeletextListMeta = {
|
|
|
407
410
|
return;
|
|
408
411
|
}
|
|
409
412
|
var props = target.getProps();
|
|
410
|
-
//
|
|
413
|
+
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
411
414
|
_cacheDataList(target);
|
|
412
|
-
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
413
|
-
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
414
|
-
var prevDataList = props.getPropValue('dataList');
|
|
415
|
-
var prevDataListBind = props.getPropValue('dataListBind');
|
|
416
415
|
props.setPropValue('imgHeight', parsedValue);
|
|
416
|
+
// syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
|
|
417
417
|
syncImageStyleValue(target, 'height', parsedValue);
|
|
418
|
-
// 还原被保护的数据(幂等操作,若引擎未重置则无副作用)
|
|
419
|
-
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList);
|
|
420
|
-
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind);
|
|
421
418
|
}
|
|
422
419
|
}
|
|
423
420
|
}, {
|
|
@@ -893,16 +890,22 @@ var TeletextListMeta = {
|
|
|
893
890
|
// 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
|
|
894
891
|
// 3. settings API(重评估中间态下可能已清空,作为最后手段)
|
|
895
892
|
// 4. 默认占位数据(仅首次创建组件时触达)
|
|
893
|
+
//
|
|
894
|
+
// 关键防御:一旦组件已绑定数据源(缓存或 node 中有值),
|
|
895
|
+
// 无论是哪种场景的 initialValue 调用,都必须返回已有值而不是默认数组。
|
|
896
|
+
// syncImageStyleValue 改为异步后,通常 node.getPropValue 已能拿到正确值;
|
|
897
|
+
// 缓存作为最后一道防线,彻底切断默认数组覆盖绑定表达式的可能。
|
|
896
898
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
899
|
+
// 优先读缓存:即使 node.getPropValue 暂时处于中间态,缓存也能提供可靠值
|
|
900
|
+
var cached = node ? _nodeDataListCache.get(node) : undefined;
|
|
897
901
|
var fromNode = node === null || node === void 0 ? void 0 : (_node$getPropValue2 = node.getPropValue) === null || _node$getPropValue2 === void 0 ? void 0 : _node$getPropValue2.call(node, 'dataList');
|
|
898
902
|
if (fromNode !== undefined) {
|
|
899
903
|
// 同步更新缓存,为后续可能的重评估提供后备
|
|
900
904
|
if (node) _nodeDataListCache.set(node, fromNode);
|
|
901
905
|
return fromNode;
|
|
902
906
|
}
|
|
903
|
-
// node.getPropValue 返回 undefined
|
|
907
|
+
// node.getPropValue 返回 undefined:引擎可能已在调用 initialValue 前清空 node prop
|
|
904
908
|
// → 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
|
|
905
|
-
var cached = node ? _nodeDataListCache.get(node) : undefined;
|
|
906
909
|
if (cached !== undefined) {
|
|
907
910
|
return cached;
|
|
908
911
|
}
|
package/lowcode_lib/meta.js
CHANGED
|
@@ -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.
|
|
125
|
+
version = '0.1.372';
|
|
126
126
|
}
|
|
127
127
|
if (basicLibraryVersion === void 0) {
|
|
128
128
|
basicLibraryVersion = {
|
|
@@ -69,41 +69,50 @@ var getImageStyleNumber = function getImageStyleNumber(target, styleKey) {
|
|
|
69
69
|
var imageChildSchema = findImageChildSchema(target);
|
|
70
70
|
return parsePxNumber(imageChildSchema === null || imageChildSchema === void 0 ? void 0 : (_imageChildSchema$pro = imageChildSchema.props) === null || _imageChildSchema$pro === void 0 ? void 0 : (_imageChildSchema$pro2 = _imageChildSchema$pro.style) === null || _imageChildSchema$pro2 === void 0 ? void 0 : _imageChildSchema$pro2[styleKey]);
|
|
71
71
|
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 异步写入 Image 子节点的 style,避免在 imgWidth/imgHeight.setValue 的同步执行栈内
|
|
75
|
+
* 触发引擎重评估 dataList.initialValue(会先清空 dataList prop,导致默认图覆盖绑定数据)。
|
|
76
|
+
* 通过 Promise.resolve().then() 将写入推迟到当前 settings 重评估完成后执行,
|
|
77
|
+
* 此时 dataList 已稳定为正确的 JSExpression,重评估无副作用。
|
|
78
|
+
*/
|
|
72
79
|
var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
Promise.resolve().then(function () {
|
|
81
|
+
var _extends3;
|
|
82
|
+
// 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
|
|
83
|
+
var imageChildNode = findImageChildNode(target);
|
|
84
|
+
if (imageChildNode) {
|
|
85
|
+
var _imageChildNode$getPr3, _extends2, _imageChildNode$setPr;
|
|
86
|
+
var _currentStyle = ((_imageChildNode$getPr3 = imageChildNode.getPropValue) === null || _imageChildNode$getPr3 === void 0 ? void 0 : _imageChildNode$getPr3.call(imageChildNode, 'style')) || {};
|
|
87
|
+
// 同时确保 width/height 都存在于子节点 style 中,防止布局面板 replace 时丢失其中一个
|
|
88
|
+
var updatedStyle = (0, _extends4["default"])({}, _currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2));
|
|
89
|
+
// 如果另一轴尺寸在子节点 style 中不存在,则从父级 prop 补充,保证两轴都写入
|
|
90
|
+
var otherKey = styleKey === 'width' ? 'height' : 'width';
|
|
91
|
+
if (!updatedStyle[otherKey]) {
|
|
92
|
+
var _target$getProps, _target$getProps$call, _target$getProps$call2;
|
|
93
|
+
var otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight';
|
|
94
|
+
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));
|
|
95
|
+
if (otherPropValue !== undefined) {
|
|
96
|
+
updatedStyle[otherKey] = otherPropValue + "px";
|
|
97
|
+
} else {
|
|
98
|
+
// 子节点 style 也没有,使用默认值 100
|
|
99
|
+
updatedStyle[otherKey] = '100px';
|
|
100
|
+
}
|
|
92
101
|
}
|
|
102
|
+
(_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', updatedStyle);
|
|
103
|
+
return;
|
|
93
104
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
imageChildSchema.props = {};
|
|
104
|
-
}
|
|
105
|
-
var currentStyle = imageChildSchema.props.style || {};
|
|
106
|
-
imageChildSchema.props.style = (0, _extends4["default"])({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
|
|
105
|
+
// 降级:直接写 schema(引擎无法感知,但保留作为兜底)
|
|
106
|
+
var imageChildSchema = findImageChildSchema(target);
|
|
107
|
+
if (!imageChildSchema) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!imageChildSchema.props) {
|
|
111
|
+
imageChildSchema.props = {};
|
|
112
|
+
}
|
|
113
|
+
var currentStyle = imageChildSchema.props.style || {};
|
|
114
|
+
imageChildSchema.props.style = (0, _extends4["default"])({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
|
|
115
|
+
});
|
|
107
116
|
};
|
|
108
117
|
var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild(target) {
|
|
109
118
|
var _target$getProps2;
|
|
@@ -341,17 +350,11 @@ var TeletextListMeta = {
|
|
|
341
350
|
return;
|
|
342
351
|
}
|
|
343
352
|
var props = target.getProps();
|
|
344
|
-
//
|
|
353
|
+
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
345
354
|
_cacheDataList(target);
|
|
346
|
-
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
347
|
-
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
348
|
-
var prevDataList = props.getPropValue('dataList');
|
|
349
|
-
var prevDataListBind = props.getPropValue('dataListBind');
|
|
350
355
|
props.setPropValue('imgWidth', parsedValue);
|
|
356
|
+
// syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
|
|
351
357
|
syncImageStyleValue(target, 'width', parsedValue);
|
|
352
|
-
// 还原被保护的数据(幂等操作,若引擎未重置则无副作用)
|
|
353
|
-
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList);
|
|
354
|
-
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind);
|
|
355
358
|
}
|
|
356
359
|
}
|
|
357
360
|
}, {
|
|
@@ -412,17 +415,11 @@ var TeletextListMeta = {
|
|
|
412
415
|
return;
|
|
413
416
|
}
|
|
414
417
|
var props = target.getProps();
|
|
415
|
-
//
|
|
418
|
+
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
416
419
|
_cacheDataList(target);
|
|
417
|
-
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
418
|
-
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
419
|
-
var prevDataList = props.getPropValue('dataList');
|
|
420
|
-
var prevDataListBind = props.getPropValue('dataListBind');
|
|
421
420
|
props.setPropValue('imgHeight', parsedValue);
|
|
421
|
+
// syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
|
|
422
422
|
syncImageStyleValue(target, 'height', parsedValue);
|
|
423
|
-
// 还原被保护的数据(幂等操作,若引擎未重置则无副作用)
|
|
424
|
-
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList);
|
|
425
|
-
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind);
|
|
426
423
|
}
|
|
427
424
|
}
|
|
428
425
|
}, {
|
|
@@ -898,16 +895,22 @@ var TeletextListMeta = {
|
|
|
898
895
|
// 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
|
|
899
896
|
// 3. settings API(重评估中间态下可能已清空,作为最后手段)
|
|
900
897
|
// 4. 默认占位数据(仅首次创建组件时触达)
|
|
898
|
+
//
|
|
899
|
+
// 关键防御:一旦组件已绑定数据源(缓存或 node 中有值),
|
|
900
|
+
// 无论是哪种场景的 initialValue 调用,都必须返回已有值而不是默认数组。
|
|
901
|
+
// syncImageStyleValue 改为异步后,通常 node.getPropValue 已能拿到正确值;
|
|
902
|
+
// 缓存作为最后一道防线,彻底切断默认数组覆盖绑定表达式的可能。
|
|
901
903
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
904
|
+
// 优先读缓存:即使 node.getPropValue 暂时处于中间态,缓存也能提供可靠值
|
|
905
|
+
var cached = node ? _nodeDataListCache.get(node) : undefined;
|
|
902
906
|
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');
|
|
903
907
|
if (fromNode !== undefined) {
|
|
904
908
|
// 同步更新缓存,为后续可能的重评估提供后备
|
|
905
909
|
if (node) _nodeDataListCache.set(node, fromNode);
|
|
906
910
|
return fromNode;
|
|
907
911
|
}
|
|
908
|
-
// node.getPropValue 返回 undefined
|
|
912
|
+
// node.getPropValue 返回 undefined:引擎可能已在调用 initialValue 前清空 node prop
|
|
909
913
|
// → 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
|
|
910
|
-
var cached = node ? _nodeDataListCache.get(node) : undefined;
|
|
911
914
|
if (cached !== undefined) {
|
|
912
915
|
return cached;
|
|
913
916
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dckj-npm/dc-material",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.372",
|
|
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.
|
|
117
|
+
"materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.372/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.
|
|
122
|
+
"homepage": "https://unpkg.com/@dckj-npm/dc-material@0.1.372/build/index.html"
|
|
123
123
|
}
|