@dckj-npm/dc-material 0.1.372 → 0.1.374
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.f5910099.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 +72 -328
- package/lowcode_es/meta.js +1 -1
- package/lowcode_es/teletext-list/meta.js +79 -333
- package/lowcode_lib/meta.js +1 -1
- package/lowcode_lib/teletext-list/meta.js +81 -335
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports["default"] = void 0;
|
|
6
|
-
var
|
|
6
|
+
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
7
|
var IMAGE_KEY = 'image';
|
|
8
8
|
var normalizeNodeKey = function normalizeNodeKey(rawKey) {
|
|
9
9
|
if (rawKey === undefined || rawKey === null) return '';
|
|
@@ -25,29 +25,9 @@ var parsePxNumber = function parsePxNumber(value) {
|
|
|
25
25
|
}
|
|
26
26
|
return undefined;
|
|
27
27
|
};
|
|
28
|
-
var getSchemaChildren = function getSchemaChildren(target) {
|
|
29
|
-
var _target$node;
|
|
30
|
-
var nodeSchema = target === null || target === void 0 ? void 0 : (_target$node = target.node) === null || _target$node === void 0 ? void 0 : _target$node.schema;
|
|
31
|
-
return Array.isArray(nodeSchema === null || nodeSchema === void 0 ? void 0 : nodeSchema.children) ? nodeSchema.children : [];
|
|
32
|
-
};
|
|
33
|
-
var findImageChildSchema = function findImageChildSchema(target) {
|
|
34
|
-
var schemaChildren = getSchemaChildren(target);
|
|
35
|
-
return schemaChildren.find(function (child) {
|
|
36
|
-
var _child$props;
|
|
37
|
-
var keyFromProps = normalizeNodeKey(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.key);
|
|
38
|
-
var keyFromNode = normalizeNodeKey(child === null || child === void 0 ? void 0 : child.key);
|
|
39
|
-
return keyFromProps === IMAGE_KEY || keyFromNode === IMAGE_KEY;
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 通过引擎的 IPublicModelNode API 查找 key='image' 的子节点。
|
|
45
|
-
* 相比直接读 node.schema.children,这里使用的是引擎可感知的公共 API,
|
|
46
|
-
* 保证后续 setPropValue/getPropValue 操作能被引擎正确追踪(触发响应式更新)。
|
|
47
|
-
*/
|
|
48
28
|
var findImageChildNode = function findImageChildNode(target) {
|
|
49
|
-
var _target$
|
|
50
|
-
var children = target === null || target === void 0 ? void 0 : (_target$
|
|
29
|
+
var _target$node;
|
|
30
|
+
var children = target === null || target === void 0 ? void 0 : (_target$node = target.node) === null || _target$node === void 0 ? void 0 : _target$node.children;
|
|
51
31
|
if (!children) return undefined;
|
|
52
32
|
if (typeof children.find === 'function') {
|
|
53
33
|
return children.find(function (child) {
|
|
@@ -58,115 +38,36 @@ var findImageChildNode = function findImageChildNode(target) {
|
|
|
58
38
|
return undefined;
|
|
59
39
|
};
|
|
60
40
|
var getImageStyleNumber = function getImageStyleNumber(target, styleKey) {
|
|
61
|
-
var _imageChildSchema$pro, _imageChildSchema$pro2;
|
|
62
|
-
// 优先通过引擎 API 读取,保证与 syncImageStyleValue 写入来源一致
|
|
63
41
|
var imageChildNode = findImageChildNode(target);
|
|
64
42
|
if (imageChildNode) {
|
|
65
43
|
var _imageChildNode$getPr, _imageChildNode$getPr2;
|
|
66
44
|
return parsePxNumber((_imageChildNode$getPr = imageChildNode.getPropValue) === null || _imageChildNode$getPr === void 0 ? void 0 : (_imageChildNode$getPr2 = _imageChildNode$getPr.call(imageChildNode, 'style')) === null || _imageChildNode$getPr2 === void 0 ? void 0 : _imageChildNode$getPr2[styleKey]);
|
|
67
45
|
}
|
|
68
|
-
|
|
69
|
-
var imageChildSchema = findImageChildSchema(target);
|
|
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]);
|
|
46
|
+
return undefined;
|
|
71
47
|
};
|
|
72
48
|
|
|
73
49
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* 此时 dataList 已稳定为正确的 JSExpression,重评估无副作用。
|
|
50
|
+
* 同步 Image 子节点的 style.width / style.height。
|
|
51
|
+
* 使用 Promise.resolve().then() 异步执行,避免在父节点 setPropValue
|
|
52
|
+
* 的 MobX 同步响应链中触发子节点变更(可能导致 SettingField 重建)。
|
|
78
53
|
*/
|
|
79
54
|
var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value) {
|
|
80
55
|
Promise.resolve().then(function () {
|
|
81
|
-
var
|
|
82
|
-
// 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
|
|
56
|
+
var _imageChildNode$getPr3, _extends2, _imageChildNode$setPr;
|
|
83
57
|
var imageChildNode = findImageChildNode(target);
|
|
84
|
-
if (imageChildNode)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
}
|
|
101
|
-
}
|
|
102
|
-
(_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', updatedStyle);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
// 降级:直接写 schema(引擎无法感知,但保留作为兜底)
|
|
106
|
-
var imageChildSchema = findImageChildSchema(target);
|
|
107
|
-
if (!imageChildSchema) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
if (!imageChildSchema.props) {
|
|
111
|
-
imageChildSchema.props = {};
|
|
58
|
+
if (!imageChildNode) return;
|
|
59
|
+
var currentStyle = ((_imageChildNode$getPr3 = imageChildNode.getPropValue) === null || _imageChildNode$getPr3 === void 0 ? void 0 : _imageChildNode$getPr3.call(imageChildNode, 'style')) || {};
|
|
60
|
+
var updatedStyle = (0, _extends3["default"])({}, currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2));
|
|
61
|
+
var otherKey = styleKey === 'width' ? 'height' : 'width';
|
|
62
|
+
if (!updatedStyle[otherKey]) {
|
|
63
|
+
var _target$getProps, _target$getProps$call, _target$getProps$call2;
|
|
64
|
+
var otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight';
|
|
65
|
+
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));
|
|
66
|
+
updatedStyle[otherKey] = (otherPropValue !== null && otherPropValue !== void 0 ? otherPropValue : 100) + "px";
|
|
112
67
|
}
|
|
113
|
-
|
|
114
|
-
imageChildSchema.props.style = (0, _extends4["default"])({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
|
|
68
|
+
(_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', updatedStyle);
|
|
115
69
|
});
|
|
116
70
|
};
|
|
117
|
-
var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild(target) {
|
|
118
|
-
var _target$getProps2;
|
|
119
|
-
var widthFromChild = getImageStyleNumber(target, 'width');
|
|
120
|
-
var heightFromChild = getImageStyleNumber(target, 'height');
|
|
121
|
-
var propsApi = target === null || target === void 0 ? void 0 : (_target$getProps2 = target.getProps) === null || _target$getProps2 === void 0 ? void 0 : _target$getProps2.call(target);
|
|
122
|
-
if (propsApi && widthFromChild !== undefined) {
|
|
123
|
-
var _propsApi$getPropValu;
|
|
124
|
-
var currentWidth = parsePxNumber((_propsApi$getPropValu = propsApi.getPropValue) === null || _propsApi$getPropValu === void 0 ? void 0 : _propsApi$getPropValu.call(propsApi, 'imgWidth'));
|
|
125
|
-
if (currentWidth !== widthFromChild) {
|
|
126
|
-
propsApi.setPropValue('imgWidth', widthFromChild);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (propsApi && heightFromChild !== undefined) {
|
|
130
|
-
var _propsApi$getPropValu2;
|
|
131
|
-
var currentHeight = parsePxNumber((_propsApi$getPropValu2 = propsApi.getPropValue) === null || _propsApi$getPropValu2 === void 0 ? void 0 : _propsApi$getPropValu2.call(propsApi, 'imgHeight'));
|
|
132
|
-
if (currentHeight !== heightFromChild) {
|
|
133
|
-
propsApi.setPropValue('imgHeight', heightFromChild);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
var isDataListBoundExpression = function isDataListBoundExpression(target) {
|
|
138
|
-
var _target$getProps3, _target$getProps3$cal, _target$getProps3$cal2;
|
|
139
|
-
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');
|
|
140
|
-
return !!(dataListValue && typeof dataListValue === 'object' && dataListValue.type === 'JSExpression');
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* 模块级 WeakMap 缓存:以 IPublicModelNode 对象引用为 key,存储每个 TeletextList 节点
|
|
145
|
-
* 最后一次已知的「非默认」dataList 值。
|
|
146
|
-
*
|
|
147
|
-
* 作用:在 setPropValue 触发的 settings 重评估中,引擎可能先将 node prop 清空再调用
|
|
148
|
-
* dataList.initialValue;此时 node.getPropValue 与 getProps().getPropValue 均返回
|
|
149
|
-
* undefined,导致 initialValue 回退默认数组、覆盖已绑定的 JSExpression 或用户数据。
|
|
150
|
-
* 通过在每次 imgWidth/imgHeight/imagePlacement.setValue 执行任何 setPropValue 之前
|
|
151
|
-
* 将当前 dataList 写入此缓存,initialValue 可从缓存安全恢复,彻底切断引擎中间态影响。
|
|
152
|
-
*/
|
|
153
|
-
var _nodeDataListCache = new WeakMap();
|
|
154
|
-
var _cacheDataList = function _cacheDataList(target) {
|
|
155
|
-
var _node$getPropValue, _target$getProps4, _target$getProps4$cal, _target$getProps4$cal2;
|
|
156
|
-
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
157
|
-
if (!node) return;
|
|
158
|
-
// 优先从 node 级 API 读取(schema 层,不受 settings 重评估中间态影响)
|
|
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');
|
|
160
|
-
if (fromNode !== undefined) {
|
|
161
|
-
_nodeDataListCache.set(node, fromNode);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
// 降级:从 settings API 读取
|
|
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
|
-
if (fromProps !== undefined) {
|
|
167
|
-
_nodeDataListCache.set(node, fromProps);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
71
|
var TeletextListMeta = {
|
|
171
72
|
group: '低代码组件',
|
|
172
73
|
componentName: 'TeletextList',
|
|
@@ -269,27 +170,8 @@ var TeletextListMeta = {
|
|
|
269
170
|
initialValue: 'left'
|
|
270
171
|
},
|
|
271
172
|
extraProps: {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
// 在任何 setPropValue 之前先写入模块级缓存,确保 dataList.initialValue
|
|
275
|
-
// 重评估时即使 engine 已清空 node prop 也能从缓存恢复正确值
|
|
276
|
-
_cacheDataList(target);
|
|
277
|
-
// 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
|
|
278
|
-
var prevDataList = props.getPropValue('dataList');
|
|
279
|
-
var prevDataListBind = props.getPropValue('dataListBind');
|
|
280
|
-
var prevTextImgGap = props.getPropValue('textImgGap');
|
|
281
|
-
var prevImgWidth = props.getPropValue('imgWidth');
|
|
282
|
-
var prevImgHeight = props.getPropValue('imgHeight');
|
|
283
|
-
props.setPropValue('imagePlacement', value);
|
|
284
|
-
// 写回被保护的配置(幂等操作,若引擎未重置则无副作用)
|
|
285
|
-
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList);
|
|
286
|
-
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind);
|
|
287
|
-
if (prevTextImgGap !== undefined) props.setPropValue('textImgGap', prevTextImgGap);
|
|
288
|
-
if (prevImgWidth !== undefined) props.setPropValue('imgWidth', prevImgWidth);
|
|
289
|
-
if (prevImgHeight !== undefined) props.setPropValue('imgHeight', prevImgHeight);
|
|
290
|
-
// 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
|
|
291
|
-
syncImageDimensionPropsFromChild(target);
|
|
292
|
-
}
|
|
173
|
+
// 引擎已自动 setPropValue('imagePlacement', value),无需再做任何额外写入
|
|
174
|
+
// 之前的快照-还原逻辑反而触发多余的 MobX 响应链,导致 dataList 被覆盖
|
|
293
175
|
}
|
|
294
176
|
}, {
|
|
295
177
|
title: '图片宽度',
|
|
@@ -298,63 +180,23 @@ var TeletextListMeta = {
|
|
|
298
180
|
setter: {
|
|
299
181
|
componentName: 'NumberSetter',
|
|
300
182
|
isRequired: false,
|
|
301
|
-
initialValue:
|
|
302
|
-
var _target$getProps5, _target$getProps5$get;
|
|
303
|
-
var styleWidth = getImageStyleNumber(target, 'width');
|
|
304
|
-
if (styleWidth !== undefined) {
|
|
305
|
-
return styleWidth;
|
|
306
|
-
}
|
|
307
|
-
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');
|
|
308
|
-
var parsedPropValue = parsePxNumber(propValue);
|
|
309
|
-
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
310
|
-
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
311
|
-
if (isDataListBoundExpression(target)) {
|
|
312
|
-
return undefined;
|
|
313
|
-
}
|
|
314
|
-
return 100;
|
|
315
|
-
},
|
|
316
|
-
defaultValue: function defaultValue(target) {
|
|
317
|
-
var _target$getProps6, _target$getProps6$get;
|
|
318
|
-
var styleWidth = getImageStyleNumber(target, 'width');
|
|
319
|
-
if (styleWidth !== undefined) {
|
|
320
|
-
return styleWidth;
|
|
321
|
-
}
|
|
322
|
-
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');
|
|
323
|
-
var parsedPropValue = parsePxNumber(propValue);
|
|
324
|
-
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
325
|
-
if (isDataListBoundExpression(target)) {
|
|
326
|
-
return undefined;
|
|
327
|
-
}
|
|
328
|
-
return 100;
|
|
329
|
-
}
|
|
183
|
+
initialValue: 100
|
|
330
184
|
},
|
|
331
185
|
extraProps: {
|
|
332
|
-
getValue: function getValue(target) {
|
|
333
|
-
var
|
|
334
|
-
|
|
335
|
-
// (写操作会导致引擎重初始化 dataList 等 prop,画布图片回退到默认图)
|
|
186
|
+
getValue: function getValue(target, value) {
|
|
187
|
+
var _parsePxNumber;
|
|
188
|
+
if (value !== undefined) return (_parsePxNumber = parsePxNumber(value)) !== null && _parsePxNumber !== void 0 ? _parsePxNumber : 100;
|
|
336
189
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
337
|
-
if (styleWidth !== undefined)
|
|
338
|
-
return styleWidth;
|
|
339
|
-
}
|
|
340
|
-
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');
|
|
341
|
-
var parsedPropValue = parsePxNumber(propValue);
|
|
342
|
-
if (parsedPropValue !== undefined) {
|
|
343
|
-
return parsedPropValue;
|
|
344
|
-
}
|
|
190
|
+
if (styleWidth !== undefined) return styleWidth;
|
|
345
191
|
return 100;
|
|
346
192
|
},
|
|
347
193
|
setValue: function setValue(target, value) {
|
|
194
|
+
// 引擎已自动 setPropValue('imgWidth', value)
|
|
195
|
+
// 只需同步到 Image 子节点的 style
|
|
348
196
|
var parsedValue = parsePxNumber(value);
|
|
349
|
-
if (parsedValue
|
|
350
|
-
|
|
197
|
+
if (parsedValue !== undefined) {
|
|
198
|
+
syncImageStyleValue(target, 'width', parsedValue);
|
|
351
199
|
}
|
|
352
|
-
var props = target.getProps();
|
|
353
|
-
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
354
|
-
_cacheDataList(target);
|
|
355
|
-
props.setPropValue('imgWidth', parsedValue);
|
|
356
|
-
// syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
|
|
357
|
-
syncImageStyleValue(target, 'width', parsedValue);
|
|
358
200
|
}
|
|
359
201
|
}
|
|
360
202
|
}, {
|
|
@@ -364,62 +206,23 @@ var TeletextListMeta = {
|
|
|
364
206
|
setter: {
|
|
365
207
|
componentName: 'NumberSetter',
|
|
366
208
|
isRequired: false,
|
|
367
|
-
initialValue:
|
|
368
|
-
var _target$getProps8, _target$getProps8$get;
|
|
369
|
-
var styleHeight = getImageStyleNumber(target, 'height');
|
|
370
|
-
if (styleHeight !== undefined) {
|
|
371
|
-
return styleHeight;
|
|
372
|
-
}
|
|
373
|
-
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');
|
|
374
|
-
var parsedPropValue = parsePxNumber(propValue);
|
|
375
|
-
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
376
|
-
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
377
|
-
if (isDataListBoundExpression(target)) {
|
|
378
|
-
return undefined;
|
|
379
|
-
}
|
|
380
|
-
return 100;
|
|
381
|
-
},
|
|
382
|
-
defaultValue: function defaultValue(target) {
|
|
383
|
-
var _target$getProps9, _target$getProps9$get;
|
|
384
|
-
var styleHeight = getImageStyleNumber(target, 'height');
|
|
385
|
-
if (styleHeight !== undefined) {
|
|
386
|
-
return styleHeight;
|
|
387
|
-
}
|
|
388
|
-
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');
|
|
389
|
-
var parsedPropValue = parsePxNumber(propValue);
|
|
390
|
-
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
391
|
-
if (isDataListBoundExpression(target)) {
|
|
392
|
-
return undefined;
|
|
393
|
-
}
|
|
394
|
-
return 100;
|
|
395
|
-
}
|
|
209
|
+
initialValue: 100
|
|
396
210
|
},
|
|
397
211
|
extraProps: {
|
|
398
|
-
getValue: function getValue(target) {
|
|
399
|
-
var
|
|
400
|
-
|
|
212
|
+
getValue: function getValue(target, value) {
|
|
213
|
+
var _parsePxNumber2;
|
|
214
|
+
if (value !== undefined) return (_parsePxNumber2 = parsePxNumber(value)) !== null && _parsePxNumber2 !== void 0 ? _parsePxNumber2 : 100;
|
|
401
215
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
402
|
-
if (styleHeight !== undefined)
|
|
403
|
-
return styleHeight;
|
|
404
|
-
}
|
|
405
|
-
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');
|
|
406
|
-
var parsedPropValue = parsePxNumber(propValue);
|
|
407
|
-
if (parsedPropValue !== undefined) {
|
|
408
|
-
return parsedPropValue;
|
|
409
|
-
}
|
|
216
|
+
if (styleHeight !== undefined) return styleHeight;
|
|
410
217
|
return 100;
|
|
411
218
|
},
|
|
412
219
|
setValue: function setValue(target, value) {
|
|
220
|
+
// 引擎已自动 setPropValue('imgHeight', value)
|
|
221
|
+
// 只需同步到 Image 子节点的 style
|
|
413
222
|
var parsedValue = parsePxNumber(value);
|
|
414
|
-
if (parsedValue
|
|
415
|
-
|
|
223
|
+
if (parsedValue !== undefined) {
|
|
224
|
+
syncImageStyleValue(target, 'height', parsedValue);
|
|
416
225
|
}
|
|
417
|
-
var props = target.getProps();
|
|
418
|
-
// 在写入前先更新模块级缓存,确保async syncImageStyleValue触发的重评估时缓存有效
|
|
419
|
-
_cacheDataList(target);
|
|
420
|
-
props.setPropValue('imgHeight', parsedValue);
|
|
421
|
-
// syncImageStyleValue 异步执行,不在当前同步栈内触发 dataList.initialValue 重评估
|
|
422
|
-
syncImageStyleValue(target, 'height', parsedValue);
|
|
423
226
|
}
|
|
424
227
|
}
|
|
425
228
|
}, {
|
|
@@ -493,16 +296,16 @@ var TeletextListMeta = {
|
|
|
493
296
|
},
|
|
494
297
|
extraProps: {
|
|
495
298
|
setValue: function setValue(target, value) {
|
|
496
|
-
var _target$
|
|
299
|
+
var _target$node2, _schemaChildren$filte, _target$parent, _target$parent$items;
|
|
497
300
|
target.getProps().setPropValue('textLines', value);
|
|
498
|
-
var schema = target === null || target === void 0 ? void 0 : (_target$
|
|
301
|
+
var schema = target === null || target === void 0 ? void 0 : (_target$node2 = target.node) === null || _target$node2 === void 0 ? void 0 : _target$node2.schema;
|
|
499
302
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
500
303
|
var schemaChildren = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.children) ? schema.children : [];
|
|
501
304
|
|
|
502
305
|
// 获取当前文本组件数量
|
|
503
306
|
var currentLength = ((_schemaChildren$filte = schemaChildren.filter(function (child) {
|
|
504
|
-
var _child$
|
|
505
|
-
return child.componentName === 'NextText' && (child === null || child === void 0 ? void 0 : (_child$
|
|
307
|
+
var _child$props, _child$props$key;
|
|
308
|
+
return child.componentName === 'NextText' && (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : (_child$props$key = _child$props.key) === null || _child$props$key === void 0 ? void 0 : _child$props$key.startsWith('text-'));
|
|
506
309
|
})) === null || _schemaChildren$filte === void 0 ? void 0 : _schemaChildren$filte.length) || 0;
|
|
507
310
|
if (value > currentLength) {
|
|
508
311
|
// 需要添加新的文本组件
|
|
@@ -889,107 +692,35 @@ var TeletextListMeta = {
|
|
|
889
692
|
}
|
|
890
693
|
},
|
|
891
694
|
initialValue: function initialValue(target) {
|
|
892
|
-
var
|
|
893
|
-
//
|
|
894
|
-
//
|
|
895
|
-
//
|
|
896
|
-
|
|
897
|
-
|
|
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');
|
|
907
|
-
if (fromNode !== undefined) {
|
|
908
|
-
// 同步更新缓存,为后续可能的重评估提供后备
|
|
909
|
-
if (node) _nodeDataListCache.set(node, fromNode);
|
|
910
|
-
return fromNode;
|
|
911
|
-
}
|
|
912
|
-
// node.getPropValue 返回 undefined:引擎可能已在调用 initialValue 前清空 node prop
|
|
913
|
-
// → 读取模块级缓存(在 setValue 中任何 setPropValue 之前写入,最可靠的后备)
|
|
914
|
-
if (cached !== undefined) {
|
|
915
|
-
return cached;
|
|
916
|
-
}
|
|
917
|
-
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
|
-
if (current !== undefined) {
|
|
919
|
-
if (node) _nodeDataListCache.set(node, current);
|
|
920
|
-
return current;
|
|
921
|
-
}
|
|
922
|
-
return [{
|
|
923
|
-
image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
|
|
924
|
-
title: '标题名称',
|
|
925
|
-
description: '说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字'
|
|
926
|
-
}, {
|
|
927
|
-
image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
|
|
928
|
-
title: '标题名称',
|
|
929
|
-
description: '说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字',
|
|
930
|
-
tags: [{
|
|
931
|
-
name: '报名火热',
|
|
932
|
-
color: 'orange'
|
|
933
|
-
}, {
|
|
934
|
-
name: '人数众多',
|
|
935
|
-
color: 'blue'
|
|
936
|
-
}]
|
|
937
|
-
}];
|
|
695
|
+
var _target$node$schema$p, _target$node3, _target$node3$schema, _target$node3$schema$, _target$getProps2, _target$getProps2$cal, _target$getProps2$cal2;
|
|
696
|
+
// ignoreDefaultValue: () => true 保证此函数在 SettingFieldView remount 时
|
|
697
|
+
// 永远不会被 initDefaultValue 调用,仅作为安全兜底保留。
|
|
698
|
+
// 正常的首次创建数据由 snippet.props.dataList 提供。
|
|
699
|
+
var existing = (_target$node$schema$p = target === null || target === void 0 ? void 0 : (_target$node3 = target.node) === null || _target$node3 === void 0 ? void 0 : (_target$node3$schema = _target$node3.schema) === null || _target$node3$schema === void 0 ? void 0 : (_target$node3$schema$ = _target$node3$schema.props) === null || _target$node3$schema$ === void 0 ? void 0 : _target$node3$schema$.dataList) !== null && _target$node$schema$p !== void 0 ? _target$node$schema$p : 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');
|
|
700
|
+
if (existing !== undefined) return existing;
|
|
701
|
+
return DEFAULT_DATA_LIST;
|
|
938
702
|
}
|
|
939
703
|
},
|
|
940
704
|
extraProps: {
|
|
941
705
|
/**
|
|
942
|
-
*
|
|
943
|
-
*
|
|
706
|
+
* ignoreDefaultValue: 彻底阻止引擎在 SettingFieldView remount 时
|
|
707
|
+
* 调用 initDefaultValue → 把 initialValue(默认数据数组)通过 field.setValue
|
|
708
|
+
* 写入 dataList prop,覆盖已绑定的 JSExpression。
|
|
944
709
|
*
|
|
945
|
-
*
|
|
946
|
-
*
|
|
947
|
-
* 若此时 dataList Prop 处于 "unset" 中间态,parent.getPropValue 会返回 undefined,
|
|
948
|
-
* 导致不带 getValue 时 field.getValue() = undefined → initDefaultValue 触发 → 默认图。
|
|
949
|
-
* 有了此 getValue 后,即使 schema 层暂时返回 undefined,从缓存取值仍可返回用户数据,
|
|
950
|
-
* field.getValue() 非 undefined → initDefaultValue 永远跳过 → 默认图问题彻底消失。
|
|
710
|
+
* 这是根本性解决方案:在引擎层面阻断 initDefaultValue 的执行,
|
|
711
|
+
* 而不是试图在 initialValue/getValue/setValue 中做缓存和还原来补救。
|
|
951
712
|
*/
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
if (currentValue !== undefined) {
|
|
955
|
-
// schema 层有值:同步更新缓存,确保用户最新编辑的数据被记录
|
|
956
|
-
if (node) _nodeDataListCache.set(node, currentValue);
|
|
957
|
-
return currentValue;
|
|
958
|
-
}
|
|
959
|
-
// schema 层暂时无值(引擎重评估中间态):从缓存恢复,避免 initDefaultValue 触发
|
|
960
|
-
var cached = node ? _nodeDataListCache.get(node) : undefined;
|
|
961
|
-
return cached; // undefined 仅在缓存为空(全新组件首次初始化)时出现,属正常情况
|
|
713
|
+
ignoreDefaultValue: function ignoreDefaultValue() {
|
|
714
|
+
return true;
|
|
962
715
|
},
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
* 进而触发引擎 initDefaultValue,画布回退默认图。
|
|
972
|
-
*
|
|
973
|
-
* 写入顺序:先缓存(供 initialValue/getValue 兜底),再写 schema(持久化)。
|
|
974
|
-
* 写入 schema 会触发引擎对 settings 的重评估,但此时 schema 已有值,
|
|
975
|
-
* initialValue 不会被调用,不会产生循环。
|
|
976
|
-
*/
|
|
977
|
-
setValue: function setValue(target, value) {
|
|
978
|
-
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
979
|
-
if (!node) return;
|
|
980
|
-
if (value !== undefined) {
|
|
981
|
-
var _target$getProps10, _target$getProps10$ca, _target$getProps10$ca2;
|
|
982
|
-
// 先写缓存,确保重评估期间 getValue 可从缓存返回有效值
|
|
983
|
-
_nodeDataListCache.set(node, value);
|
|
984
|
-
// 再持久化到 schema(引擎不会自动写入,必须显式调用)
|
|
985
|
-
(_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
|
-
} else {
|
|
987
|
-
var _target$getProps11, _target$getProps11$ca, _target$getProps11$ca2;
|
|
988
|
-
// clearValue 场景(value = undefined):清空缓存,使下次 initDefaultValue
|
|
989
|
-
// 可正常返回默认数组(仅用于组件被显式清除数据的情况)
|
|
990
|
-
_nodeDataListCache["delete"](node);
|
|
991
|
-
(_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
|
-
}
|
|
716
|
+
getValue: function getValue(target, currentValue) {
|
|
717
|
+
var _target$node4, _target$node4$schema, _target$node4$schema$;
|
|
718
|
+
// currentValue 已有值时直接返回
|
|
719
|
+
if (currentValue !== undefined) return currentValue;
|
|
720
|
+
// 从 schema 快照兜底读取(最可靠的源头数据,始终反映持久化状态)
|
|
721
|
+
var fromSchema = target === null || target === void 0 ? void 0 : (_target$node4 = target.node) === null || _target$node4 === void 0 ? void 0 : (_target$node4$schema = _target$node4.schema) === null || _target$node4$schema === void 0 ? void 0 : (_target$node4$schema$ = _target$node4$schema.props) === null || _target$node4$schema$ === void 0 ? void 0 : _target$node4$schema$.dataList;
|
|
722
|
+
if (fromSchema !== undefined) return fromSchema;
|
|
723
|
+
return undefined;
|
|
993
724
|
}
|
|
994
725
|
}
|
|
995
726
|
}],
|
|
@@ -1008,6 +739,15 @@ var TeletextListMeta = {
|
|
|
1008
739
|
}
|
|
1009
740
|
}
|
|
1010
741
|
};
|
|
742
|
+
var DEFAULT_DATA_LIST = [{
|
|
743
|
+
image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
|
|
744
|
+
title: '标题名称',
|
|
745
|
+
description: '说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字'
|
|
746
|
+
}, {
|
|
747
|
+
image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
|
|
748
|
+
title: '标题名称',
|
|
749
|
+
description: '说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字'
|
|
750
|
+
}];
|
|
1011
751
|
var getSnippets = function getSnippets(textLines) {
|
|
1012
752
|
if (textLines === void 0) {
|
|
1013
753
|
textLines = 2;
|
|
@@ -1017,7 +757,13 @@ var getSnippets = function getSnippets(textLines) {
|
|
|
1017
757
|
screenshot: '',
|
|
1018
758
|
schema: {
|
|
1019
759
|
componentName: 'TeletextList',
|
|
1020
|
-
props: {
|
|
760
|
+
props: {
|
|
761
|
+
// 将默认数据放到 snippet props 中,而非依赖 setter.initialValue。
|
|
762
|
+
// 因为 dataList 使用了 ignoreDefaultValue:()=>true 来阻止引擎在
|
|
763
|
+
// SettingFieldView remount 时覆盖已绑定的 JSExpression,
|
|
764
|
+
// 所以 initDefaultValue 永远不会运行,首次拖入的初始数据必须由 snippet 提供。
|
|
765
|
+
dataList: DEFAULT_DATA_LIST
|
|
766
|
+
},
|
|
1021
767
|
children: [{
|
|
1022
768
|
componentName: 'NextText',
|
|
1023
769
|
props: {
|
|
@@ -1119,6 +865,6 @@ var getSnippets = function getSnippets(textLines) {
|
|
|
1119
865
|
}
|
|
1120
866
|
}];
|
|
1121
867
|
};
|
|
1122
|
-
var _default = exports["default"] = (0,
|
|
868
|
+
var _default = exports["default"] = (0, _extends3["default"])({}, TeletextListMeta, {
|
|
1123
869
|
snippets: getSnippets(2)
|
|
1124
870
|
});
|
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.374",
|
|
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.374/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.374/build/index.html"
|
|
123
123
|
}
|