@dckj-npm/dc-material 0.1.372 → 0.1.373
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.78ba47eb.js → umi.8274544c.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 +71 -76
- package/lowcode_es/meta.js +1 -1
- package/lowcode_es/teletext-list/meta.js +77 -80
- package/lowcode_lib/meta.js +1 -1
- package/lowcode_lib/teletext-list/meta.js +77 -80
- package/package.json +3 -3
|
@@ -141,30 +141,30 @@ var isDataListBoundExpression = function isDataListBoundExpression(target) {
|
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* dataList.initialValue;此时 node.getPropValue 与 getProps().getPropValue 均返回
|
|
149
|
-
* undefined,导致 initialValue 回退默认数组、覆盖已绑定的 JSExpression 或用户数据。
|
|
150
|
-
* 通过在每次 imgWidth/imgHeight/imagePlacement.setValue 执行任何 setPropValue 之前
|
|
151
|
-
* 将当前 dataList 写入此缓存,initialValue 可从缓存安全恢复,彻底切断引擎中间态影响。
|
|
144
|
+
* 模块级缓存:使用 node.id(稳定的字符串 ID)作为 key。
|
|
145
|
+
* 替代 WeakMap 方案:WeakMap 以 target.node 对象引用为 key,
|
|
146
|
+
* 但引擎可能通过 Proxy/getter 每次返回不同的包装对象,导致缓存命中失败。
|
|
147
|
+
* 使用 node.id 字符串做 key 彻底消除引用不一致问题。
|
|
152
148
|
*/
|
|
153
|
-
var
|
|
149
|
+
var _dataListCacheById = {};
|
|
154
150
|
var _cacheDataList = function _cacheDataList(target) {
|
|
155
|
-
var
|
|
156
|
-
var
|
|
157
|
-
if (!
|
|
158
|
-
|
|
159
|
-
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
|
+
var _target$node3, _target$node4, _target$node4$getProp, _target$node5, _target$node5$schema, _target$node5$schema$, _target$getProps4, _target$getProps4$cal, _target$getProps4$cal2;
|
|
152
|
+
var nodeId = target === null || target === void 0 ? void 0 : (_target$node3 = target.node) === null || _target$node3 === void 0 ? void 0 : _target$node3.id;
|
|
153
|
+
if (!nodeId) return;
|
|
154
|
+
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');
|
|
160
155
|
if (fromNode !== undefined) {
|
|
161
|
-
|
|
156
|
+
_dataListCacheById[nodeId] = fromNode;
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
// schema 序列化快照:源头数据,不受 settings 中间态影响
|
|
160
|
+
var fromSchema = target === null || target === void 0 ? void 0 : (_target$node5 = target.node) === null || _target$node5 === void 0 ? void 0 : (_target$node5$schema = _target$node5.schema) === null || _target$node5$schema === void 0 ? void 0 : (_target$node5$schema$ = _target$node5$schema.props) === null || _target$node5$schema$ === void 0 ? void 0 : _target$node5$schema$.dataList;
|
|
161
|
+
if (fromSchema !== undefined) {
|
|
162
|
+
_dataListCacheById[nodeId] = fromSchema;
|
|
162
163
|
return;
|
|
163
164
|
}
|
|
164
|
-
// 降级:从 settings API 读取
|
|
165
165
|
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');
|
|
166
166
|
if (fromProps !== undefined) {
|
|
167
|
-
|
|
167
|
+
_dataListCacheById[nodeId] = fromProps;
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
var TeletextListMeta = {
|
|
@@ -350,10 +350,14 @@ var TeletextListMeta = {
|
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
352
352
|
var props = target.getProps();
|
|
353
|
-
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
354
353
|
_cacheDataList(target);
|
|
354
|
+
// 快照 dataList:在 setPropValue 前捕获,防止引擎重评估时被默认值覆盖
|
|
355
|
+
var prevDataList = props.getPropValue('dataList');
|
|
355
356
|
props.setPropValue('imgWidth', parsedValue);
|
|
356
|
-
//
|
|
357
|
+
// 还原 dataList(幂等操作,若引擎未覆盖则无副作用)
|
|
358
|
+
if (prevDataList !== undefined) {
|
|
359
|
+
props.setPropValue('dataList', prevDataList);
|
|
360
|
+
}
|
|
357
361
|
syncImageStyleValue(target, 'width', parsedValue);
|
|
358
362
|
}
|
|
359
363
|
}
|
|
@@ -415,10 +419,14 @@ var TeletextListMeta = {
|
|
|
415
419
|
return;
|
|
416
420
|
}
|
|
417
421
|
var props = target.getProps();
|
|
418
|
-
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
419
422
|
_cacheDataList(target);
|
|
423
|
+
// 快照 dataList:在 setPropValue 前捕获,防止引擎重评估时被默认值覆盖
|
|
424
|
+
var prevDataList = props.getPropValue('dataList');
|
|
420
425
|
props.setPropValue('imgHeight', parsedValue);
|
|
421
|
-
//
|
|
426
|
+
// 还原 dataList(幂等操作,若引擎未覆盖则无副作用)
|
|
427
|
+
if (prevDataList !== undefined) {
|
|
428
|
+
props.setPropValue('dataList', prevDataList);
|
|
429
|
+
}
|
|
422
430
|
syncImageStyleValue(target, 'height', parsedValue);
|
|
423
431
|
}
|
|
424
432
|
}
|
|
@@ -493,9 +501,9 @@ var TeletextListMeta = {
|
|
|
493
501
|
},
|
|
494
502
|
extraProps: {
|
|
495
503
|
setValue: function setValue(target, value) {
|
|
496
|
-
var _target$
|
|
504
|
+
var _target$node6, _schemaChildren$filte, _target$parent, _target$parent$items;
|
|
497
505
|
target.getProps().setPropValue('textLines', value);
|
|
498
|
-
var schema = target === null || target === void 0 ? void 0 : (_target$
|
|
506
|
+
var schema = target === null || target === void 0 ? void 0 : (_target$node6 = target.node) === null || _target$node6 === void 0 ? void 0 : _target$node6.schema;
|
|
499
507
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
500
508
|
var schemaChildren = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.children) ? schema.children : [];
|
|
501
509
|
|
|
@@ -889,36 +897,31 @@ var TeletextListMeta = {
|
|
|
889
897
|
}
|
|
890
898
|
},
|
|
891
899
|
initialValue: function initialValue(target) {
|
|
892
|
-
var
|
|
893
|
-
|
|
894
|
-
// 1. node
|
|
895
|
-
|
|
896
|
-
// 3. settings API(重评估中间态下可能已清空,作为最后手段)
|
|
897
|
-
// 4. 默认占位数据(仅首次创建组件时触达)
|
|
898
|
-
//
|
|
899
|
-
// 关键防御:一旦组件已绑定数据源(缓存或 node 中有值),
|
|
900
|
-
// 无论是哪种场景的 initialValue 调用,都必须返回已有值而不是默认数组。
|
|
901
|
-
// syncImageStyleValue 改为异步后,通常 node.getPropValue 已能拿到正确值;
|
|
902
|
-
// 缓存作为最后一道防线,彻底切断默认数组覆盖绑定表达式的可能。
|
|
903
|
-
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
904
|
-
// 优先读缓存:即使 node.getPropValue 暂时处于中间态,缓存也能提供可靠值
|
|
905
|
-
var cached = node ? _nodeDataListCache.get(node) : undefined;
|
|
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');
|
|
900
|
+
var _target$node7, _target$node8, _target$node8$getProp, _target$getProps1, _target$getProps1$cal, _target$getProps1$cal2, _target$node9, _target$node9$schema, _target$node9$schema$;
|
|
901
|
+
var nodeId = target === null || target === void 0 ? void 0 : (_target$node7 = target.node) === null || _target$node7 === void 0 ? void 0 : _target$node7.id;
|
|
902
|
+
// 1. node API
|
|
903
|
+
var fromNode = target === null || target === void 0 ? void 0 : (_target$node8 = target.node) === null || _target$node8 === void 0 ? void 0 : (_target$node8$getProp = _target$node8.getPropValue) === null || _target$node8$getProp === void 0 ? void 0 : _target$node8$getProp.call(_target$node8, 'dataList');
|
|
907
904
|
if (fromNode !== undefined) {
|
|
908
|
-
|
|
909
|
-
if (node) _nodeDataListCache.set(node, fromNode);
|
|
905
|
+
if (nodeId) _dataListCacheById[nodeId] = fromNode;
|
|
910
906
|
return fromNode;
|
|
911
907
|
}
|
|
912
|
-
// node.
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
return cached;
|
|
908
|
+
// 2. 模块级缓存(node.id 索引,不受 Proxy 引用问题影响)
|
|
909
|
+
if (nodeId && _dataListCacheById[nodeId] !== undefined) {
|
|
910
|
+
return _dataListCacheById[nodeId];
|
|
916
911
|
}
|
|
912
|
+
// 3. settings API
|
|
917
913
|
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');
|
|
918
914
|
if (current !== undefined) {
|
|
919
|
-
if (
|
|
915
|
+
if (nodeId) _dataListCacheById[nodeId] = current;
|
|
920
916
|
return current;
|
|
921
917
|
}
|
|
918
|
+
// 4. schema 序列化快照(源头数据,不受 settings 中间态影响)
|
|
919
|
+
var fromSchema = target === null || target === void 0 ? void 0 : (_target$node9 = target.node) === null || _target$node9 === void 0 ? void 0 : (_target$node9$schema = _target$node9.schema) === null || _target$node9$schema === void 0 ? void 0 : (_target$node9$schema$ = _target$node9$schema.props) === null || _target$node9$schema$ === void 0 ? void 0 : _target$node9$schema$.dataList;
|
|
920
|
+
if (fromSchema !== undefined) {
|
|
921
|
+
if (nodeId) _dataListCacheById[nodeId] = fromSchema;
|
|
922
|
+
return fromSchema;
|
|
923
|
+
}
|
|
924
|
+
// 5. 默认数据(仅首次创建组件时触达)
|
|
922
925
|
return [{
|
|
923
926
|
image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
|
|
924
927
|
title: '标题名称',
|
|
@@ -939,55 +942,49 @@ var TeletextListMeta = {
|
|
|
939
942
|
},
|
|
940
943
|
extraProps: {
|
|
941
944
|
/**
|
|
942
|
-
*
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
* 触发场景:修改 imgWidth/imgHeight 或通过布局面板修改图片 margin 时,
|
|
946
|
-
* imageChildNode.setPropValue('style', ...) 会触发引擎对父节点 settings 的重评估;
|
|
947
|
-
* 若此时 dataList Prop 处于 "unset" 中间态,parent.getPropValue 会返回 undefined,
|
|
948
|
-
* 导致不带 getValue 时 field.getValue() = undefined → initDefaultValue 触发 → 默认图。
|
|
949
|
-
* 有了此 getValue 后,即使 schema 层暂时返回 undefined,从缓存取值仍可返回用户数据,
|
|
950
|
-
* field.getValue() 非 undefined → initDefaultValue 永远跳过 → 默认图问题彻底消失。
|
|
945
|
+
* 保证引擎重评估期间 field.getValue() 始终返回有效值(非 undefined),
|
|
946
|
+
* 阻止 initDefaultValue 覆盖已绑定的 JSExpression。
|
|
947
|
+
* 回退链:currentValue → 缓存(node.id) → schema 快照 → node API。
|
|
951
948
|
*/
|
|
952
949
|
getValue: function getValue(target, currentValue) {
|
|
953
|
-
var
|
|
950
|
+
var _target$node0, _target$node1, _target$node1$schema, _target$node1$schema$, _target$node10, _target$node10$getPro;
|
|
951
|
+
var nodeId = target === null || target === void 0 ? void 0 : (_target$node0 = target.node) === null || _target$node0 === void 0 ? void 0 : _target$node0.id;
|
|
954
952
|
if (currentValue !== undefined) {
|
|
955
|
-
|
|
956
|
-
if (node) _nodeDataListCache.set(node, currentValue);
|
|
953
|
+
if (nodeId) _dataListCacheById[nodeId] = currentValue;
|
|
957
954
|
return currentValue;
|
|
958
955
|
}
|
|
959
|
-
//
|
|
960
|
-
|
|
961
|
-
|
|
956
|
+
// 引擎 currentValue 为 undefined(重评估中间态),逐级回退:
|
|
957
|
+
if (nodeId && _dataListCacheById[nodeId] !== undefined) {
|
|
958
|
+
return _dataListCacheById[nodeId];
|
|
959
|
+
}
|
|
960
|
+
// node.schema 序列化快照:不受 settings 中间态影响,是最可靠的源头数据
|
|
961
|
+
var fromSchema = target === null || target === void 0 ? void 0 : (_target$node1 = target.node) === null || _target$node1 === void 0 ? void 0 : (_target$node1$schema = _target$node1.schema) === null || _target$node1$schema === void 0 ? void 0 : (_target$node1$schema$ = _target$node1$schema.props) === null || _target$node1$schema$ === void 0 ? void 0 : _target$node1$schema$.dataList;
|
|
962
|
+
if (fromSchema !== undefined) {
|
|
963
|
+
if (nodeId) _dataListCacheById[nodeId] = fromSchema;
|
|
964
|
+
return fromSchema;
|
|
965
|
+
}
|
|
966
|
+
var fromNode = target === null || target === void 0 ? void 0 : (_target$node10 = target.node) === null || _target$node10 === void 0 ? void 0 : (_target$node10$getPro = _target$node10.getPropValue) === null || _target$node10$getPro === void 0 ? void 0 : _target$node10$getPro.call(_target$node10, 'dataList');
|
|
967
|
+
if (fromNode !== undefined) {
|
|
968
|
+
if (nodeId) _dataListCacheById[nodeId] = fromNode;
|
|
969
|
+
return fromNode;
|
|
970
|
+
}
|
|
971
|
+
return undefined;
|
|
962
972
|
},
|
|
963
973
|
/**
|
|
964
|
-
*
|
|
965
|
-
*
|
|
966
|
-
*
|
|
967
|
-
* ⚠️ 此引擎中 extraProps.setValue 完全接管写入逻辑,引擎不会自动持久化:
|
|
968
|
-
* 若不在此处显式调用 setPropValue,用户编辑的数据将只存于内存缓存,
|
|
969
|
-
* 页面刷新后丢失,同时 imgWidth/imgHeight.setValue 的快照–还原机制也因
|
|
970
|
-
* props.getPropValue('dataList') 返回 undefined 而失效,导致还原跳过,
|
|
971
|
-
* 进而触发引擎 initDefaultValue,画布回退默认图。
|
|
972
|
-
*
|
|
973
|
-
* 写入顺序:先缓存(供 initialValue/getValue 兜底),再写 schema(持久化)。
|
|
974
|
-
* 写入 schema 会触发引擎对 settings 的重评估,但此时 schema 已有值,
|
|
975
|
-
* initialValue 不会被调用,不会产生循环。
|
|
974
|
+
* 用户编辑 dataList 时同步更新缓存并持久化到 schema。
|
|
975
|
+
* 引擎 extraProps.setValue 完全接管写入,必须显式 setPropValue。
|
|
976
976
|
*/
|
|
977
977
|
setValue: function setValue(target, value) {
|
|
978
|
-
var
|
|
979
|
-
|
|
978
|
+
var _target$node11;
|
|
979
|
+
var nodeId = target === null || target === void 0 ? void 0 : (_target$node11 = target.node) === null || _target$node11 === void 0 ? void 0 : _target$node11.id;
|
|
980
|
+
if (!nodeId) return;
|
|
980
981
|
if (value !== undefined) {
|
|
981
982
|
var _target$getProps10, _target$getProps10$ca, _target$getProps10$ca2;
|
|
982
|
-
|
|
983
|
-
_nodeDataListCache.set(node, value);
|
|
984
|
-
// 再持久化到 schema(引擎不会自动写入,必须显式调用)
|
|
983
|
+
_dataListCacheById[nodeId] = value;
|
|
985
984
|
(_target$getProps10 = target.getProps) === null || _target$getProps10 === void 0 ? void 0 : (_target$getProps10$ca = _target$getProps10.call(target)) === null || _target$getProps10$ca === void 0 ? void 0 : (_target$getProps10$ca2 = _target$getProps10$ca.setPropValue) === null || _target$getProps10$ca2 === void 0 ? void 0 : _target$getProps10$ca2.call(_target$getProps10$ca, 'dataList', value);
|
|
986
985
|
} else {
|
|
987
986
|
var _target$getProps11, _target$getProps11$ca, _target$getProps11$ca2;
|
|
988
|
-
|
|
989
|
-
// 可正常返回默认数组(仅用于组件被显式清除数据的情况)
|
|
990
|
-
_nodeDataListCache["delete"](node);
|
|
987
|
+
delete _dataListCacheById[nodeId];
|
|
991
988
|
(_target$getProps11 = target.getProps) === null || _target$getProps11 === void 0 ? void 0 : (_target$getProps11$ca = _target$getProps11.call(target)) === null || _target$getProps11$ca === void 0 ? void 0 : (_target$getProps11$ca2 = _target$getProps11$ca.setPropValue) === null || _target$getProps11$ca2 === void 0 ? void 0 : _target$getProps11$ca2.call(_target$getProps11$ca, 'dataList', undefined);
|
|
992
989
|
}
|
|
993
990
|
}
|
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.373",
|
|
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.373/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.373/build/index.html"
|
|
123
123
|
}
|