@dckj-npm/dc-material 0.1.368 → 0.1.369
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.376c5b45.js → umi.50369ae0.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 +52 -9
- package/lowcode_es/meta.js +1 -1
- package/lowcode_es/teletext-list/meta.js +66 -23
- package/lowcode_lib/meta.js +1 -1
- package/lowcode_lib/teletext-list/meta.js +66 -23
- package/package.json +3 -3
|
@@ -134,6 +134,34 @@ const isDataListBoundExpression = (target: any): boolean => {
|
|
|
134
134
|
)
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* 模块级 WeakMap 缓存:以 IPublicModelNode 对象引用为 key,存储每个 TeletextList 节点
|
|
139
|
+
* 最后一次已知的「非默认」dataList 值。
|
|
140
|
+
*
|
|
141
|
+
* 作用:在 setPropValue 触发的 settings 重评估中,引擎可能先将 node prop 清空再调用
|
|
142
|
+
* dataList.initialValue;此时 node.getPropValue 与 getProps().getPropValue 均返回
|
|
143
|
+
* undefined,导致 initialValue 回退默认数组、覆盖已绑定的 JSExpression 或用户数据。
|
|
144
|
+
* 通过在每次 imgWidth/imgHeight/imagePlacement.setValue 执行任何 setPropValue 之前
|
|
145
|
+
* 将当前 dataList 写入此缓存,initialValue 可从缓存安全恢复,彻底切断引擎中间态影响。
|
|
146
|
+
*/
|
|
147
|
+
const _nodeDataListCache = new WeakMap<object, any>()
|
|
148
|
+
|
|
149
|
+
const _cacheDataList = (target: any): void => {
|
|
150
|
+
const node = target?.node
|
|
151
|
+
if (!node) return
|
|
152
|
+
// 优先从 node 级 API 读取(schema 层,不受 settings 重评估中间态影响)
|
|
153
|
+
const fromNode = node?.getPropValue?.('dataList')
|
|
154
|
+
if (fromNode !== undefined) {
|
|
155
|
+
_nodeDataListCache.set(node, fromNode)
|
|
156
|
+
return
|
|
157
|
+
}
|
|
158
|
+
// 降级:从 settings API 读取
|
|
159
|
+
const fromProps = target?.getProps?.()?.getPropValue?.('dataList')
|
|
160
|
+
if (fromProps !== undefined) {
|
|
161
|
+
_nodeDataListCache.set(node, fromProps)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
137
165
|
const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
138
166
|
group: '低代码组件',
|
|
139
167
|
componentName: 'TeletextList',
|
|
@@ -260,6 +288,9 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
260
288
|
extraProps: {
|
|
261
289
|
setValue: (target, value) => {
|
|
262
290
|
const props = target.getProps()
|
|
291
|
+
// 在任何 setPropValue 之前先写入模块级缓存,确保 dataList.initialValue
|
|
292
|
+
// 重评估时即使 engine 已清空 node prop 也能从缓存恢复正确值
|
|
293
|
+
_cacheDataList(target)
|
|
263
294
|
// 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
|
|
264
295
|
const prevDataList = props.getPropValue('dataList')
|
|
265
296
|
const prevDataListBind = props.getPropValue('dataListBind')
|
|
@@ -334,8 +365,10 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
334
365
|
return
|
|
335
366
|
}
|
|
336
367
|
const props = target.getProps()
|
|
368
|
+
// 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
|
|
369
|
+
_cacheDataList(target)
|
|
337
370
|
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
338
|
-
// 触发引擎重评估 dataList.initialValue,导致 dataList
|
|
371
|
+
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
339
372
|
const prevDataList = props.getPropValue('dataList')
|
|
340
373
|
const prevDataListBind = props.getPropValue('dataListBind')
|
|
341
374
|
props.setPropValue('imgWidth', parsedValue)
|
|
@@ -401,6 +434,8 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
401
434
|
return
|
|
402
435
|
}
|
|
403
436
|
const props = target.getProps()
|
|
437
|
+
// 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
|
|
438
|
+
_cacheDataList(target)
|
|
404
439
|
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
405
440
|
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
406
441
|
const prevDataList = props.getPropValue('dataList')
|
|
@@ -921,19 +956,27 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
921
956
|
},
|
|
922
957
|
},
|
|
923
958
|
initialValue: (target) => {
|
|
924
|
-
//
|
|
925
|
-
//
|
|
926
|
-
//
|
|
927
|
-
//
|
|
928
|
-
//
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
const fromNode = target?.node?.getPropValue?.('dataList')
|
|
959
|
+
// 读取顺序(由最可靠到最不可靠):
|
|
960
|
+
// 1. node 级 API(schema 层,引擎重评估前通常仍有值)
|
|
961
|
+
// 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
|
|
962
|
+
// 3. settings API(重评估中间态下可能已清空,作为最后手段)
|
|
963
|
+
// 4. 默认占位数据(仅首次创建组件时触达)
|
|
964
|
+
const node = target?.node
|
|
965
|
+
const fromNode = node?.getPropValue?.('dataList')
|
|
932
966
|
if (fromNode !== undefined) {
|
|
967
|
+
// 同步更新缓存,为后续可能的重评估提供后备
|
|
968
|
+
if (node) _nodeDataListCache.set(node, fromNode)
|
|
933
969
|
return fromNode
|
|
934
970
|
}
|
|
971
|
+
// node.getPropValue 返回 undefined:引擎已在调用 initialValue 前清空 node prop
|
|
972
|
+
// → 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
|
|
973
|
+
const cached = node ? _nodeDataListCache.get(node) : undefined
|
|
974
|
+
if (cached !== undefined) {
|
|
975
|
+
return cached
|
|
976
|
+
}
|
|
935
977
|
const current = target?.getProps?.()?.getPropValue?.('dataList')
|
|
936
978
|
if (current !== undefined) {
|
|
979
|
+
if (node) _nodeDataListCache.set(node, current)
|
|
937
980
|
return current
|
|
938
981
|
}
|
|
939
982
|
return [
|
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.369';
|
|
121
121
|
}
|
|
122
122
|
if (basicLibraryVersion === void 0) {
|
|
123
123
|
basicLibraryVersion = {
|
|
@@ -125,6 +125,34 @@ var isDataListBoundExpression = function isDataListBoundExpression(target) {
|
|
|
125
125
|
var dataListValue = target === null || target === void 0 ? void 0 : (_target$getProps3 = target.getProps) === null || _target$getProps3 === void 0 ? void 0 : (_target$getProps3$cal = _target$getProps3.call(target)) === null || _target$getProps3$cal === void 0 ? void 0 : (_target$getProps3$cal2 = _target$getProps3$cal.getPropValue) === null || _target$getProps3$cal2 === void 0 ? void 0 : _target$getProps3$cal2.call(_target$getProps3$cal, 'dataList');
|
|
126
126
|
return !!(dataListValue && typeof dataListValue === 'object' && dataListValue.type === 'JSExpression');
|
|
127
127
|
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 模块级 WeakMap 缓存:以 IPublicModelNode 对象引用为 key,存储每个 TeletextList 节点
|
|
131
|
+
* 最后一次已知的「非默认」dataList 值。
|
|
132
|
+
*
|
|
133
|
+
* 作用:在 setPropValue 触发的 settings 重评估中,引擎可能先将 node prop 清空再调用
|
|
134
|
+
* dataList.initialValue;此时 node.getPropValue 与 getProps().getPropValue 均返回
|
|
135
|
+
* undefined,导致 initialValue 回退默认数组、覆盖已绑定的 JSExpression 或用户数据。
|
|
136
|
+
* 通过在每次 imgWidth/imgHeight/imagePlacement.setValue 执行任何 setPropValue 之前
|
|
137
|
+
* 将当前 dataList 写入此缓存,initialValue 可从缓存安全恢复,彻底切断引擎中间态影响。
|
|
138
|
+
*/
|
|
139
|
+
var _nodeDataListCache = new WeakMap();
|
|
140
|
+
var _cacheDataList = function _cacheDataList(target) {
|
|
141
|
+
var _node$getPropValue, _target$getProps4, _target$getProps4$cal, _target$getProps4$cal2;
|
|
142
|
+
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
143
|
+
if (!node) return;
|
|
144
|
+
// 优先从 node 级 API 读取(schema 层,不受 settings 重评估中间态影响)
|
|
145
|
+
var fromNode = node === null || node === void 0 ? void 0 : (_node$getPropValue = node.getPropValue) === null || _node$getPropValue === void 0 ? void 0 : _node$getPropValue.call(node, 'dataList');
|
|
146
|
+
if (fromNode !== undefined) {
|
|
147
|
+
_nodeDataListCache.set(node, fromNode);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// 降级:从 settings API 读取
|
|
151
|
+
var fromProps = target === null || target === void 0 ? void 0 : (_target$getProps4 = target.getProps) === null || _target$getProps4 === void 0 ? void 0 : (_target$getProps4$cal = _target$getProps4.call(target)) === null || _target$getProps4$cal === void 0 ? void 0 : (_target$getProps4$cal2 = _target$getProps4$cal.getPropValue) === null || _target$getProps4$cal2 === void 0 ? void 0 : _target$getProps4$cal2.call(_target$getProps4$cal, 'dataList');
|
|
152
|
+
if (fromProps !== undefined) {
|
|
153
|
+
_nodeDataListCache.set(node, fromProps);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
128
156
|
var TeletextListMeta = {
|
|
129
157
|
group: '低代码组件',
|
|
130
158
|
componentName: 'TeletextList',
|
|
@@ -229,6 +257,9 @@ var TeletextListMeta = {
|
|
|
229
257
|
extraProps: {
|
|
230
258
|
setValue: function setValue(target, value) {
|
|
231
259
|
var props = target.getProps();
|
|
260
|
+
// 在任何 setPropValue 之前先写入模块级缓存,确保 dataList.initialValue
|
|
261
|
+
// 重评估时即使 engine 已清空 node prop 也能从缓存恢复正确值
|
|
262
|
+
_cacheDataList(target);
|
|
232
263
|
// 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
|
|
233
264
|
var prevDataList = props.getPropValue('dataList');
|
|
234
265
|
var prevDataListBind = props.getPropValue('dataListBind');
|
|
@@ -254,12 +285,12 @@ var TeletextListMeta = {
|
|
|
254
285
|
componentName: 'NumberSetter',
|
|
255
286
|
isRequired: false,
|
|
256
287
|
initialValue: function initialValue(target) {
|
|
257
|
-
var _target$
|
|
288
|
+
var _target$getProps5, _target$getProps5$get;
|
|
258
289
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
259
290
|
if (styleWidth !== undefined) {
|
|
260
291
|
return styleWidth;
|
|
261
292
|
}
|
|
262
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
293
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps5 = target.getProps()) === null || _target$getProps5 === void 0 ? void 0 : (_target$getProps5$get = _target$getProps5.getPropValue) === null || _target$getProps5$get === void 0 ? void 0 : _target$getProps5$get.call(_target$getProps5, 'imgWidth');
|
|
263
294
|
var parsedPropValue = parsePxNumber(propValue);
|
|
264
295
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
265
296
|
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
@@ -269,12 +300,12 @@ var TeletextListMeta = {
|
|
|
269
300
|
return 100;
|
|
270
301
|
},
|
|
271
302
|
defaultValue: function defaultValue(target) {
|
|
272
|
-
var _target$
|
|
303
|
+
var _target$getProps6, _target$getProps6$get;
|
|
273
304
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
274
305
|
if (styleWidth !== undefined) {
|
|
275
306
|
return styleWidth;
|
|
276
307
|
}
|
|
277
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
308
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps6 = target.getProps()) === null || _target$getProps6 === void 0 ? void 0 : (_target$getProps6$get = _target$getProps6.getPropValue) === null || _target$getProps6$get === void 0 ? void 0 : _target$getProps6$get.call(_target$getProps6, 'imgWidth');
|
|
278
309
|
var parsedPropValue = parsePxNumber(propValue);
|
|
279
310
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
280
311
|
if (isDataListBoundExpression(target)) {
|
|
@@ -285,14 +316,14 @@ var TeletextListMeta = {
|
|
|
285
316
|
},
|
|
286
317
|
extraProps: {
|
|
287
318
|
getValue: function getValue(target) {
|
|
288
|
-
var _target$
|
|
319
|
+
var _target$getProps7, _target$getProps7$get;
|
|
289
320
|
// getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
|
|
290
321
|
// (写操作会导致引擎重初始化 dataList 等 prop,画布图片回退到默认图)
|
|
291
322
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
292
323
|
if (styleWidth !== undefined) {
|
|
293
324
|
return styleWidth;
|
|
294
325
|
}
|
|
295
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
326
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps7 = target.getProps()) === null || _target$getProps7 === void 0 ? void 0 : (_target$getProps7$get = _target$getProps7.getPropValue) === null || _target$getProps7$get === void 0 ? void 0 : _target$getProps7$get.call(_target$getProps7, 'imgWidth');
|
|
296
327
|
var parsedPropValue = parsePxNumber(propValue);
|
|
297
328
|
if (parsedPropValue !== undefined) {
|
|
298
329
|
return parsedPropValue;
|
|
@@ -305,8 +336,10 @@ var TeletextListMeta = {
|
|
|
305
336
|
return;
|
|
306
337
|
}
|
|
307
338
|
var props = target.getProps();
|
|
339
|
+
// 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
|
|
340
|
+
_cacheDataList(target);
|
|
308
341
|
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
309
|
-
// 触发引擎重评估 dataList.initialValue,导致 dataList
|
|
342
|
+
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
310
343
|
var prevDataList = props.getPropValue('dataList');
|
|
311
344
|
var prevDataListBind = props.getPropValue('dataListBind');
|
|
312
345
|
props.setPropValue('imgWidth', parsedValue);
|
|
@@ -324,12 +357,12 @@ var TeletextListMeta = {
|
|
|
324
357
|
componentName: 'NumberSetter',
|
|
325
358
|
isRequired: false,
|
|
326
359
|
initialValue: function initialValue(target) {
|
|
327
|
-
var _target$
|
|
360
|
+
var _target$getProps8, _target$getProps8$get;
|
|
328
361
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
329
362
|
if (styleHeight !== undefined) {
|
|
330
363
|
return styleHeight;
|
|
331
364
|
}
|
|
332
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
365
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps8 = target.getProps()) === null || _target$getProps8 === void 0 ? void 0 : (_target$getProps8$get = _target$getProps8.getPropValue) === null || _target$getProps8$get === void 0 ? void 0 : _target$getProps8$get.call(_target$getProps8, 'imgHeight');
|
|
333
366
|
var parsedPropValue = parsePxNumber(propValue);
|
|
334
367
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
335
368
|
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
@@ -339,12 +372,12 @@ var TeletextListMeta = {
|
|
|
339
372
|
return 100;
|
|
340
373
|
},
|
|
341
374
|
defaultValue: function defaultValue(target) {
|
|
342
|
-
var _target$
|
|
375
|
+
var _target$getProps9, _target$getProps9$get;
|
|
343
376
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
344
377
|
if (styleHeight !== undefined) {
|
|
345
378
|
return styleHeight;
|
|
346
379
|
}
|
|
347
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
380
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps9 = target.getProps()) === null || _target$getProps9 === void 0 ? void 0 : (_target$getProps9$get = _target$getProps9.getPropValue) === null || _target$getProps9$get === void 0 ? void 0 : _target$getProps9$get.call(_target$getProps9, 'imgHeight');
|
|
348
381
|
var parsedPropValue = parsePxNumber(propValue);
|
|
349
382
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
350
383
|
if (isDataListBoundExpression(target)) {
|
|
@@ -355,13 +388,13 @@ var TeletextListMeta = {
|
|
|
355
388
|
},
|
|
356
389
|
extraProps: {
|
|
357
390
|
getValue: function getValue(target) {
|
|
358
|
-
var _target$
|
|
391
|
+
var _target$getProps0, _target$getProps0$get;
|
|
359
392
|
// getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
|
|
360
393
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
361
394
|
if (styleHeight !== undefined) {
|
|
362
395
|
return styleHeight;
|
|
363
396
|
}
|
|
364
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
397
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps0 = target.getProps()) === null || _target$getProps0 === void 0 ? void 0 : (_target$getProps0$get = _target$getProps0.getPropValue) === null || _target$getProps0$get === void 0 ? void 0 : _target$getProps0$get.call(_target$getProps0, 'imgHeight');
|
|
365
398
|
var parsedPropValue = parsePxNumber(propValue);
|
|
366
399
|
if (parsedPropValue !== undefined) {
|
|
367
400
|
return parsedPropValue;
|
|
@@ -374,6 +407,8 @@ var TeletextListMeta = {
|
|
|
374
407
|
return;
|
|
375
408
|
}
|
|
376
409
|
var props = target.getProps();
|
|
410
|
+
// 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
|
|
411
|
+
_cacheDataList(target);
|
|
377
412
|
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
378
413
|
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
379
414
|
var prevDataList = props.getPropValue('dataList');
|
|
@@ -852,20 +887,28 @@ var TeletextListMeta = {
|
|
|
852
887
|
}
|
|
853
888
|
},
|
|
854
889
|
initialValue: function initialValue(target) {
|
|
855
|
-
var
|
|
856
|
-
//
|
|
857
|
-
//
|
|
858
|
-
//
|
|
859
|
-
//
|
|
860
|
-
//
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
var fromNode = target === null || target === void 0 ? void 0 : (_target$node4 = target.node) === null || _target$node4 === void 0 ? void 0 : (_target$node4$getProp = _target$node4.getPropValue) === null || _target$node4$getProp === void 0 ? void 0 : _target$node4$getProp.call(_target$node4, 'dataList');
|
|
890
|
+
var _node$getPropValue2, _target$getProps1, _target$getProps1$cal, _target$getProps1$cal2;
|
|
891
|
+
// 读取顺序(由最可靠到最不可靠):
|
|
892
|
+
// 1. node 级 API(schema 层,引擎重评估前通常仍有值)
|
|
893
|
+
// 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
|
|
894
|
+
// 3. settings API(重评估中间态下可能已清空,作为最后手段)
|
|
895
|
+
// 4. 默认占位数据(仅首次创建组件时触达)
|
|
896
|
+
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
897
|
+
var fromNode = node === null || node === void 0 ? void 0 : (_node$getPropValue2 = node.getPropValue) === null || _node$getPropValue2 === void 0 ? void 0 : _node$getPropValue2.call(node, 'dataList');
|
|
864
898
|
if (fromNode !== undefined) {
|
|
899
|
+
// 同步更新缓存,为后续可能的重评估提供后备
|
|
900
|
+
if (node) _nodeDataListCache.set(node, fromNode);
|
|
865
901
|
return fromNode;
|
|
866
902
|
}
|
|
867
|
-
|
|
903
|
+
// node.getPropValue 返回 undefined:引擎已在调用 initialValue 前清空 node prop
|
|
904
|
+
// → 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
|
|
905
|
+
var cached = node ? _nodeDataListCache.get(node) : undefined;
|
|
906
|
+
if (cached !== undefined) {
|
|
907
|
+
return cached;
|
|
908
|
+
}
|
|
909
|
+
var current = target === null || target === void 0 ? void 0 : (_target$getProps1 = target.getProps) === null || _target$getProps1 === void 0 ? void 0 : (_target$getProps1$cal = _target$getProps1.call(target)) === null || _target$getProps1$cal === void 0 ? void 0 : (_target$getProps1$cal2 = _target$getProps1$cal.getPropValue) === null || _target$getProps1$cal2 === void 0 ? void 0 : _target$getProps1$cal2.call(_target$getProps1$cal, 'dataList');
|
|
868
910
|
if (current !== undefined) {
|
|
911
|
+
if (node) _nodeDataListCache.set(node, current);
|
|
869
912
|
return current;
|
|
870
913
|
}
|
|
871
914
|
return [{
|
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.369';
|
|
126
126
|
}
|
|
127
127
|
if (basicLibraryVersion === void 0) {
|
|
128
128
|
basicLibraryVersion = {
|
|
@@ -130,6 +130,34 @@ var isDataListBoundExpression = function isDataListBoundExpression(target) {
|
|
|
130
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');
|
|
131
131
|
return !!(dataListValue && typeof dataListValue === 'object' && dataListValue.type === 'JSExpression');
|
|
132
132
|
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 模块级 WeakMap 缓存:以 IPublicModelNode 对象引用为 key,存储每个 TeletextList 节点
|
|
136
|
+
* 最后一次已知的「非默认」dataList 值。
|
|
137
|
+
*
|
|
138
|
+
* 作用:在 setPropValue 触发的 settings 重评估中,引擎可能先将 node prop 清空再调用
|
|
139
|
+
* dataList.initialValue;此时 node.getPropValue 与 getProps().getPropValue 均返回
|
|
140
|
+
* undefined,导致 initialValue 回退默认数组、覆盖已绑定的 JSExpression 或用户数据。
|
|
141
|
+
* 通过在每次 imgWidth/imgHeight/imagePlacement.setValue 执行任何 setPropValue 之前
|
|
142
|
+
* 将当前 dataList 写入此缓存,initialValue 可从缓存安全恢复,彻底切断引擎中间态影响。
|
|
143
|
+
*/
|
|
144
|
+
var _nodeDataListCache = new WeakMap();
|
|
145
|
+
var _cacheDataList = function _cacheDataList(target) {
|
|
146
|
+
var _node$getPropValue, _target$getProps4, _target$getProps4$cal, _target$getProps4$cal2;
|
|
147
|
+
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
148
|
+
if (!node) return;
|
|
149
|
+
// 优先从 node 级 API 读取(schema 层,不受 settings 重评估中间态影响)
|
|
150
|
+
var fromNode = node === null || node === void 0 ? void 0 : (_node$getPropValue = node.getPropValue) === null || _node$getPropValue === void 0 ? void 0 : _node$getPropValue.call(node, 'dataList');
|
|
151
|
+
if (fromNode !== undefined) {
|
|
152
|
+
_nodeDataListCache.set(node, fromNode);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
// 降级:从 settings API 读取
|
|
156
|
+
var fromProps = target === null || target === void 0 ? void 0 : (_target$getProps4 = target.getProps) === null || _target$getProps4 === void 0 ? void 0 : (_target$getProps4$cal = _target$getProps4.call(target)) === null || _target$getProps4$cal === void 0 ? void 0 : (_target$getProps4$cal2 = _target$getProps4$cal.getPropValue) === null || _target$getProps4$cal2 === void 0 ? void 0 : _target$getProps4$cal2.call(_target$getProps4$cal, 'dataList');
|
|
157
|
+
if (fromProps !== undefined) {
|
|
158
|
+
_nodeDataListCache.set(node, fromProps);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
133
161
|
var TeletextListMeta = {
|
|
134
162
|
group: '低代码组件',
|
|
135
163
|
componentName: 'TeletextList',
|
|
@@ -234,6 +262,9 @@ var TeletextListMeta = {
|
|
|
234
262
|
extraProps: {
|
|
235
263
|
setValue: function setValue(target, value) {
|
|
236
264
|
var props = target.getProps();
|
|
265
|
+
// 在任何 setPropValue 之前先写入模块级缓存,确保 dataList.initialValue
|
|
266
|
+
// 重评估时即使 engine 已清空 node prop 也能从缓存恢复正确值
|
|
267
|
+
_cacheDataList(target);
|
|
237
268
|
// 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
|
|
238
269
|
var prevDataList = props.getPropValue('dataList');
|
|
239
270
|
var prevDataListBind = props.getPropValue('dataListBind');
|
|
@@ -259,12 +290,12 @@ var TeletextListMeta = {
|
|
|
259
290
|
componentName: 'NumberSetter',
|
|
260
291
|
isRequired: false,
|
|
261
292
|
initialValue: function initialValue(target) {
|
|
262
|
-
var _target$
|
|
293
|
+
var _target$getProps5, _target$getProps5$get;
|
|
263
294
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
264
295
|
if (styleWidth !== undefined) {
|
|
265
296
|
return styleWidth;
|
|
266
297
|
}
|
|
267
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
298
|
+
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');
|
|
268
299
|
var parsedPropValue = parsePxNumber(propValue);
|
|
269
300
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
270
301
|
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
@@ -274,12 +305,12 @@ var TeletextListMeta = {
|
|
|
274
305
|
return 100;
|
|
275
306
|
},
|
|
276
307
|
defaultValue: function defaultValue(target) {
|
|
277
|
-
var _target$
|
|
308
|
+
var _target$getProps6, _target$getProps6$get;
|
|
278
309
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
279
310
|
if (styleWidth !== undefined) {
|
|
280
311
|
return styleWidth;
|
|
281
312
|
}
|
|
282
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
313
|
+
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');
|
|
283
314
|
var parsedPropValue = parsePxNumber(propValue);
|
|
284
315
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
285
316
|
if (isDataListBoundExpression(target)) {
|
|
@@ -290,14 +321,14 @@ var TeletextListMeta = {
|
|
|
290
321
|
},
|
|
291
322
|
extraProps: {
|
|
292
323
|
getValue: function getValue(target) {
|
|
293
|
-
var _target$
|
|
324
|
+
var _target$getProps7, _target$getProps7$get;
|
|
294
325
|
// getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
|
|
295
326
|
// (写操作会导致引擎重初始化 dataList 等 prop,画布图片回退到默认图)
|
|
296
327
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
297
328
|
if (styleWidth !== undefined) {
|
|
298
329
|
return styleWidth;
|
|
299
330
|
}
|
|
300
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
331
|
+
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');
|
|
301
332
|
var parsedPropValue = parsePxNumber(propValue);
|
|
302
333
|
if (parsedPropValue !== undefined) {
|
|
303
334
|
return parsedPropValue;
|
|
@@ -310,8 +341,10 @@ var TeletextListMeta = {
|
|
|
310
341
|
return;
|
|
311
342
|
}
|
|
312
343
|
var props = target.getProps();
|
|
344
|
+
// 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
|
|
345
|
+
_cacheDataList(target);
|
|
313
346
|
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
314
|
-
// 触发引擎重评估 dataList.initialValue,导致 dataList
|
|
347
|
+
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
315
348
|
var prevDataList = props.getPropValue('dataList');
|
|
316
349
|
var prevDataListBind = props.getPropValue('dataListBind');
|
|
317
350
|
props.setPropValue('imgWidth', parsedValue);
|
|
@@ -329,12 +362,12 @@ var TeletextListMeta = {
|
|
|
329
362
|
componentName: 'NumberSetter',
|
|
330
363
|
isRequired: false,
|
|
331
364
|
initialValue: function initialValue(target) {
|
|
332
|
-
var _target$
|
|
365
|
+
var _target$getProps8, _target$getProps8$get;
|
|
333
366
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
334
367
|
if (styleHeight !== undefined) {
|
|
335
368
|
return styleHeight;
|
|
336
369
|
}
|
|
337
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
370
|
+
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');
|
|
338
371
|
var parsedPropValue = parsePxNumber(propValue);
|
|
339
372
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
340
373
|
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
@@ -344,12 +377,12 @@ var TeletextListMeta = {
|
|
|
344
377
|
return 100;
|
|
345
378
|
},
|
|
346
379
|
defaultValue: function defaultValue(target) {
|
|
347
|
-
var _target$
|
|
380
|
+
var _target$getProps9, _target$getProps9$get;
|
|
348
381
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
349
382
|
if (styleHeight !== undefined) {
|
|
350
383
|
return styleHeight;
|
|
351
384
|
}
|
|
352
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
385
|
+
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');
|
|
353
386
|
var parsedPropValue = parsePxNumber(propValue);
|
|
354
387
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
355
388
|
if (isDataListBoundExpression(target)) {
|
|
@@ -360,13 +393,13 @@ var TeletextListMeta = {
|
|
|
360
393
|
},
|
|
361
394
|
extraProps: {
|
|
362
395
|
getValue: function getValue(target) {
|
|
363
|
-
var _target$
|
|
396
|
+
var _target$getProps0, _target$getProps0$get;
|
|
364
397
|
// getValue 纯读操作,不做任何写入,避免触发引擎重评估其他 setter 的 initialValue
|
|
365
398
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
366
399
|
if (styleHeight !== undefined) {
|
|
367
400
|
return styleHeight;
|
|
368
401
|
}
|
|
369
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
402
|
+
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');
|
|
370
403
|
var parsedPropValue = parsePxNumber(propValue);
|
|
371
404
|
if (parsedPropValue !== undefined) {
|
|
372
405
|
return parsedPropValue;
|
|
@@ -379,6 +412,8 @@ var TeletextListMeta = {
|
|
|
379
412
|
return;
|
|
380
413
|
}
|
|
381
414
|
var props = target.getProps();
|
|
415
|
+
// 在任何 setPropValue 之前先写入模块级缓存(与 imagePlacement.setValue 同策略)
|
|
416
|
+
_cacheDataList(target);
|
|
382
417
|
// 快照需要保护的数据,防止 syncImageStyleValue → imageChildNode.setPropValue
|
|
383
418
|
// 触发引擎重评估 dataList.initialValue,导致 dataList 被重置为默认图
|
|
384
419
|
var prevDataList = props.getPropValue('dataList');
|
|
@@ -857,20 +892,28 @@ var TeletextListMeta = {
|
|
|
857
892
|
}
|
|
858
893
|
},
|
|
859
894
|
initialValue: function initialValue(target) {
|
|
860
|
-
var
|
|
861
|
-
//
|
|
862
|
-
//
|
|
863
|
-
//
|
|
864
|
-
//
|
|
865
|
-
//
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
var fromNode = target === null || target === void 0 ? void 0 : (_target$node4 = target.node) === null || _target$node4 === void 0 ? void 0 : (_target$node4$getProp = _target$node4.getPropValue) === null || _target$node4$getProp === void 0 ? void 0 : _target$node4$getProp.call(_target$node4, 'dataList');
|
|
895
|
+
var _node$getPropValue2, _target$getProps1, _target$getProps1$cal, _target$getProps1$cal2;
|
|
896
|
+
// 读取顺序(由最可靠到最不可靠):
|
|
897
|
+
// 1. node 级 API(schema 层,引擎重评估前通常仍有值)
|
|
898
|
+
// 2. 模块级 WeakMap 缓存(在任何 setPropValue 之前写入,完全不受引擎清空影响)
|
|
899
|
+
// 3. settings API(重评估中间态下可能已清空,作为最后手段)
|
|
900
|
+
// 4. 默认占位数据(仅首次创建组件时触达)
|
|
901
|
+
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
902
|
+
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');
|
|
869
903
|
if (fromNode !== undefined) {
|
|
904
|
+
// 同步更新缓存,为后续可能的重评估提供后备
|
|
905
|
+
if (node) _nodeDataListCache.set(node, fromNode);
|
|
870
906
|
return fromNode;
|
|
871
907
|
}
|
|
872
|
-
|
|
908
|
+
// node.getPropValue 返回 undefined:引擎已在调用 initialValue 前清空 node prop
|
|
909
|
+
// → 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
|
|
910
|
+
var cached = node ? _nodeDataListCache.get(node) : undefined;
|
|
911
|
+
if (cached !== undefined) {
|
|
912
|
+
return cached;
|
|
913
|
+
}
|
|
914
|
+
var current = target === null || target === void 0 ? void 0 : (_target$getProps1 = target.getProps) === null || _target$getProps1 === void 0 ? void 0 : (_target$getProps1$cal = _target$getProps1.call(target)) === null || _target$getProps1$cal === void 0 ? void 0 : (_target$getProps1$cal2 = _target$getProps1$cal.getPropValue) === null || _target$getProps1$cal2 === void 0 ? void 0 : _target$getProps1$cal2.call(_target$getProps1$cal, 'dataList');
|
|
873
915
|
if (current !== undefined) {
|
|
916
|
+
if (node) _nodeDataListCache.set(node, current);
|
|
874
917
|
return current;
|
|
875
918
|
}
|
|
876
919
|
return [{
|
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.369",
|
|
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.369/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.369/build/index.html"
|
|
123
123
|
}
|