@dckj-npm/dc-material 0.1.362 → 0.1.363
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 +1 -1
- package/build/docs/colorful-input.html +1 -1
- package/build/docs/index.html +1 -1
- package/build/docs/teletext-list.html +1 -1
- package/build/docs/{umi.b6edaa19.js → umi.399a9633.js} +1 -1
- package/build/docs/~demos/colorful-button-demo.html +1 -1
- package/build/docs/~demos/colorful-input-demo.html +1 -1
- package/build/docs/~demos/teletext-list-demo-1.html +1 -1
- package/build/docs/~demos/teletext-list-demo.html +1 -1
- package/build/lowcode/meta.design.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/lowcode/teletext-list/meta.ts +110 -23
- package/lowcode_es/teletext-list/meta.js +128 -43
- package/lowcode_lib/teletext-list/meta.js +130 -45
- package/package.json +1 -1
|
@@ -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 _extends4 = _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 '';
|
|
@@ -39,14 +39,47 @@ var findImageChildSchema = function findImageChildSchema(target) {
|
|
|
39
39
|
return keyFromProps === IMAGE_KEY || keyFromNode === IMAGE_KEY;
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 通过引擎的 IPublicModelNode API 查找 key='image' 的子节点。
|
|
45
|
+
* 相比直接读 node.schema.children,这里使用的是引擎可感知的公共 API,
|
|
46
|
+
* 保证后续 setPropValue/getPropValue 操作能被引擎正确追踪(触发响应式更新)。
|
|
47
|
+
*/
|
|
48
|
+
var findImageChildNode = function findImageChildNode(target) {
|
|
49
|
+
var _target$node2;
|
|
50
|
+
var children = target === null || target === void 0 ? void 0 : (_target$node2 = target.node) === null || _target$node2 === void 0 ? void 0 : _target$node2.children;
|
|
51
|
+
if (!children) return undefined;
|
|
52
|
+
if (typeof children.find === 'function') {
|
|
53
|
+
return children.find(function (child) {
|
|
54
|
+
var _child$getPropValue;
|
|
55
|
+
return normalizeNodeKey(child === null || child === void 0 ? void 0 : (_child$getPropValue = child.getPropValue) === null || _child$getPropValue === void 0 ? void 0 : _child$getPropValue.call(child, 'key')) === IMAGE_KEY;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
};
|
|
42
60
|
var getImageStyleNumber = function getImageStyleNumber(target, styleKey) {
|
|
43
61
|
var _imageChildSchema$pro, _imageChildSchema$pro2;
|
|
62
|
+
// 优先通过引擎 API 读取,保证与 syncImageStyleValue 写入来源一致
|
|
63
|
+
var imageChildNode = findImageChildNode(target);
|
|
64
|
+
if (imageChildNode) {
|
|
65
|
+
var _imageChildNode$getPr, _imageChildNode$getPr2;
|
|
66
|
+
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
|
+
}
|
|
68
|
+
// 降级:从 schema 快照读取
|
|
44
69
|
var imageChildSchema = findImageChildSchema(target);
|
|
45
|
-
|
|
46
|
-
return parsePxNumber(childStyleValue);
|
|
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]);
|
|
47
71
|
};
|
|
48
72
|
var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value) {
|
|
49
|
-
var
|
|
73
|
+
var _extends3;
|
|
74
|
+
// 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
|
|
75
|
+
var imageChildNode = findImageChildNode(target);
|
|
76
|
+
if (imageChildNode) {
|
|
77
|
+
var _imageChildNode$getPr3, _imageChildNode$setPr, _extends2;
|
|
78
|
+
var _currentStyle = ((_imageChildNode$getPr3 = imageChildNode.getPropValue) === null || _imageChildNode$getPr3 === void 0 ? void 0 : _imageChildNode$getPr3.call(imageChildNode, 'style')) || {};
|
|
79
|
+
(_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', (0, _extends4["default"])({}, _currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2)));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// 降级:直接写 schema(引擎无法感知,但保留作为兜底)
|
|
50
83
|
var imageChildSchema = findImageChildSchema(target);
|
|
51
84
|
if (!imageChildSchema) {
|
|
52
85
|
return;
|
|
@@ -55,7 +88,7 @@ var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value)
|
|
|
55
88
|
imageChildSchema.props = {};
|
|
56
89
|
}
|
|
57
90
|
var currentStyle = imageChildSchema.props.style || {};
|
|
58
|
-
imageChildSchema.props.style = (0,
|
|
91
|
+
imageChildSchema.props.style = (0, _extends4["default"])({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
|
|
59
92
|
};
|
|
60
93
|
var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild(target) {
|
|
61
94
|
var _target$getProps;
|
|
@@ -77,6 +110,11 @@ var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild
|
|
|
77
110
|
}
|
|
78
111
|
}
|
|
79
112
|
};
|
|
113
|
+
var isDataListBoundExpression = function isDataListBoundExpression(target) {
|
|
114
|
+
var _target$getProps2, _target$getProps2$cal, _target$getProps2$cal2;
|
|
115
|
+
var dataListValue = target === null || target === void 0 ? void 0 : (_target$getProps2 = target.getProps) === null || _target$getProps2 === void 0 ? void 0 : (_target$getProps2$cal = _target$getProps2.call(target)) === null || _target$getProps2$cal === void 0 ? void 0 : (_target$getProps2$cal2 = _target$getProps2$cal.getPropValue) === null || _target$getProps2$cal2 === void 0 ? void 0 : _target$getProps2$cal2.call(_target$getProps2$cal, 'dataList');
|
|
116
|
+
return !!(dataListValue && typeof dataListValue === 'object' && dataListValue.type === 'JSExpression');
|
|
117
|
+
};
|
|
80
118
|
var TeletextListMeta = {
|
|
81
119
|
group: '低代码组件',
|
|
82
120
|
componentName: 'TeletextList',
|
|
@@ -180,7 +218,16 @@ var TeletextListMeta = {
|
|
|
180
218
|
},
|
|
181
219
|
extraProps: {
|
|
182
220
|
setValue: function setValue(target, value) {
|
|
183
|
-
target.getProps()
|
|
221
|
+
var props = target.getProps();
|
|
222
|
+
// 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
|
|
223
|
+
var prevDataList = props.getPropValue('dataList');
|
|
224
|
+
var prevDataListBind = props.getPropValue('dataListBind');
|
|
225
|
+
var prevTextImgGap = props.getPropValue('textImgGap');
|
|
226
|
+
props.setPropValue('imagePlacement', value);
|
|
227
|
+
// 写回被保护的配置(幂等操作,若引擎未重置则无副作用)
|
|
228
|
+
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList);
|
|
229
|
+
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind);
|
|
230
|
+
if (prevTextImgGap !== undefined) props.setPropValue('textImgGap', prevTextImgGap);
|
|
184
231
|
// 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
|
|
185
232
|
syncImageDimensionPropsFromChild(target);
|
|
186
233
|
}
|
|
@@ -193,40 +240,57 @@ var TeletextListMeta = {
|
|
|
193
240
|
componentName: 'NumberSetter',
|
|
194
241
|
isRequired: false,
|
|
195
242
|
initialValue: function initialValue(target) {
|
|
196
|
-
var _target$
|
|
243
|
+
var _target$getProps3, _target$getProps3$get;
|
|
197
244
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
198
245
|
if (styleWidth !== undefined) {
|
|
199
246
|
return styleWidth;
|
|
200
247
|
}
|
|
201
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
248
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps3 = target.getProps()) === null || _target$getProps3 === void 0 ? void 0 : (_target$getProps3$get = _target$getProps3.getPropValue) === null || _target$getProps3$get === void 0 ? void 0 : _target$getProps3$get.call(_target$getProps3, 'imgWidth');
|
|
202
249
|
var parsedPropValue = parsePxNumber(propValue);
|
|
203
250
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
204
|
-
|
|
251
|
+
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
252
|
+
if (isDataListBoundExpression(target)) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
return 100;
|
|
205
256
|
},
|
|
206
257
|
defaultValue: function defaultValue(target) {
|
|
207
|
-
var
|
|
208
|
-
|
|
258
|
+
var _target$getProps4, _target$getProps4$get;
|
|
259
|
+
var styleWidth = getImageStyleNumber(target, 'width');
|
|
260
|
+
if (styleWidth !== undefined) {
|
|
261
|
+
return styleWidth;
|
|
262
|
+
}
|
|
263
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps4 = target.getProps()) === null || _target$getProps4 === void 0 ? void 0 : (_target$getProps4$get = _target$getProps4.getPropValue) === null || _target$getProps4$get === void 0 ? void 0 : _target$getProps4$get.call(_target$getProps4, 'imgWidth');
|
|
264
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
265
|
+
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
266
|
+
if (isDataListBoundExpression(target)) {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
269
|
+
return 100;
|
|
209
270
|
}
|
|
210
271
|
},
|
|
211
272
|
extraProps: {
|
|
212
273
|
getValue: function getValue(target) {
|
|
213
|
-
var _target$
|
|
274
|
+
var _target$getProps7, _target$getProps7$get;
|
|
214
275
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
215
276
|
if (styleWidth !== undefined) {
|
|
216
|
-
var _target$
|
|
217
|
-
var currentWidth = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$
|
|
277
|
+
var _target$getProps5, _target$getProps5$get;
|
|
278
|
+
var currentWidth = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$getProps5 = target.getProps()) === null || _target$getProps5 === void 0 ? void 0 : (_target$getProps5$get = _target$getProps5.getPropValue) === null || _target$getProps5$get === void 0 ? void 0 : _target$getProps5$get.call(_target$getProps5, 'imgWidth'));
|
|
218
279
|
if (currentWidth !== styleWidth) {
|
|
219
|
-
var _target$
|
|
220
|
-
target === null || target === void 0 ? void 0 : (_target$
|
|
280
|
+
var _target$getProps6, _target$getProps6$set;
|
|
281
|
+
target === null || target === void 0 ? void 0 : (_target$getProps6 = target.getProps()) === null || _target$getProps6 === void 0 ? void 0 : (_target$getProps6$set = _target$getProps6.setPropValue) === null || _target$getProps6$set === void 0 ? void 0 : _target$getProps6$set.call(_target$getProps6, 'imgWidth', styleWidth);
|
|
221
282
|
}
|
|
222
283
|
return styleWidth;
|
|
223
284
|
}
|
|
224
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
285
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps7 = target.getProps()) === null || _target$getProps7 === void 0 ? void 0 : (_target$getProps7$get = _target$getProps7.getPropValue) === null || _target$getProps7$get === void 0 ? void 0 : _target$getProps7$get.call(_target$getProps7, 'imgWidth');
|
|
225
286
|
var parsedPropValue = parsePxNumber(propValue);
|
|
226
287
|
if (parsedPropValue !== undefined) {
|
|
227
288
|
return parsedPropValue;
|
|
228
289
|
}
|
|
229
|
-
|
|
290
|
+
if (isDataListBoundExpression(target)) {
|
|
291
|
+
return undefined;
|
|
292
|
+
}
|
|
293
|
+
return 100;
|
|
230
294
|
},
|
|
231
295
|
setValue: function setValue(target, value) {
|
|
232
296
|
var parsedValue = parsePxNumber(value);
|
|
@@ -245,40 +309,57 @@ var TeletextListMeta = {
|
|
|
245
309
|
componentName: 'NumberSetter',
|
|
246
310
|
isRequired: false,
|
|
247
311
|
initialValue: function initialValue(target) {
|
|
248
|
-
var _target$
|
|
312
|
+
var _target$getProps8, _target$getProps8$get;
|
|
249
313
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
250
314
|
if (styleHeight !== undefined) {
|
|
251
315
|
return styleHeight;
|
|
252
316
|
}
|
|
253
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
317
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps8 = target.getProps()) === null || _target$getProps8 === void 0 ? void 0 : (_target$getProps8$get = _target$getProps8.getPropValue) === null || _target$getProps8$get === void 0 ? void 0 : _target$getProps8$get.call(_target$getProps8, 'imgHeight');
|
|
254
318
|
var parsedPropValue = parsePxNumber(propValue);
|
|
255
319
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
256
|
-
|
|
320
|
+
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
321
|
+
if (isDataListBoundExpression(target)) {
|
|
322
|
+
return undefined;
|
|
323
|
+
}
|
|
324
|
+
return 100;
|
|
257
325
|
},
|
|
258
326
|
defaultValue: function defaultValue(target) {
|
|
259
|
-
var
|
|
260
|
-
|
|
327
|
+
var _target$getProps9, _target$getProps9$get;
|
|
328
|
+
var styleHeight = getImageStyleNumber(target, 'height');
|
|
329
|
+
if (styleHeight !== undefined) {
|
|
330
|
+
return styleHeight;
|
|
331
|
+
}
|
|
332
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps9 = target.getProps()) === null || _target$getProps9 === void 0 ? void 0 : (_target$getProps9$get = _target$getProps9.getPropValue) === null || _target$getProps9$get === void 0 ? void 0 : _target$getProps9$get.call(_target$getProps9, 'imgHeight');
|
|
333
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
334
|
+
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
335
|
+
if (isDataListBoundExpression(target)) {
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
return 100;
|
|
261
339
|
}
|
|
262
340
|
},
|
|
263
341
|
extraProps: {
|
|
264
342
|
getValue: function getValue(target) {
|
|
265
|
-
var _target$
|
|
343
|
+
var _target$getProps10, _target$getProps10$ge;
|
|
266
344
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
267
345
|
if (styleHeight !== undefined) {
|
|
268
|
-
var _target$
|
|
269
|
-
var currentHeight = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$
|
|
346
|
+
var _target$getProps0, _target$getProps0$get;
|
|
347
|
+
var currentHeight = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$getProps0 = target.getProps()) === null || _target$getProps0 === void 0 ? void 0 : (_target$getProps0$get = _target$getProps0.getPropValue) === null || _target$getProps0$get === void 0 ? void 0 : _target$getProps0$get.call(_target$getProps0, 'imgHeight'));
|
|
270
348
|
if (currentHeight !== styleHeight) {
|
|
271
|
-
var _target$
|
|
272
|
-
target === null || target === void 0 ? void 0 : (_target$
|
|
349
|
+
var _target$getProps1, _target$getProps1$set;
|
|
350
|
+
target === null || target === void 0 ? void 0 : (_target$getProps1 = target.getProps()) === null || _target$getProps1 === void 0 ? void 0 : (_target$getProps1$set = _target$getProps1.setPropValue) === null || _target$getProps1$set === void 0 ? void 0 : _target$getProps1$set.call(_target$getProps1, 'imgHeight', styleHeight);
|
|
273
351
|
}
|
|
274
352
|
return styleHeight;
|
|
275
353
|
}
|
|
276
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
354
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps10 = target.getProps()) === null || _target$getProps10 === void 0 ? void 0 : (_target$getProps10$ge = _target$getProps10.getPropValue) === null || _target$getProps10$ge === void 0 ? void 0 : _target$getProps10$ge.call(_target$getProps10, 'imgHeight');
|
|
277
355
|
var parsedPropValue = parsePxNumber(propValue);
|
|
278
356
|
if (parsedPropValue !== undefined) {
|
|
279
357
|
return parsedPropValue;
|
|
280
358
|
}
|
|
281
|
-
|
|
359
|
+
if (isDataListBoundExpression(target)) {
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
return 100;
|
|
282
363
|
},
|
|
283
364
|
setValue: function setValue(target, value) {
|
|
284
365
|
var parsedValue = parsePxNumber(value);
|
|
@@ -360,9 +441,9 @@ var TeletextListMeta = {
|
|
|
360
441
|
},
|
|
361
442
|
extraProps: {
|
|
362
443
|
setValue: function setValue(target, value) {
|
|
363
|
-
var _target$
|
|
444
|
+
var _target$node3, _schemaChildren$filte, _target$parent, _target$parent$items;
|
|
364
445
|
target.getProps().setPropValue('textLines', value);
|
|
365
|
-
var schema = target === null || target === void 0 ? void 0 : (_target$
|
|
446
|
+
var schema = target === null || target === void 0 ? void 0 : (_target$node3 = target.node) === null || _target$node3 === void 0 ? void 0 : _target$node3.schema;
|
|
366
447
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
367
448
|
var schemaChildren = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.children) ? schema.children : [];
|
|
368
449
|
|
|
@@ -386,20 +467,24 @@ var TeletextListMeta = {
|
|
|
386
467
|
node === null || node === void 0 ? void 0 : (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.push(newChild);
|
|
387
468
|
}
|
|
388
469
|
} else if (value < currentLength) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
var key = child === null || child === void 0 ? void 0 : (_child$
|
|
396
|
-
if (
|
|
397
|
-
|
|
470
|
+
var _node$children2, _node$children2$forEa;
|
|
471
|
+
// 收集需要移除的节点,再调用 child.remove() 通过引擎 API 逐个删除
|
|
472
|
+
// 避免 node.children = [...] 直接赋值(IPublicModelNodeChildren 不支持重新赋值)
|
|
473
|
+
var nodesToRemove = [];
|
|
474
|
+
node === null || node === void 0 ? void 0 : (_node$children2 = node.children) === null || _node$children2 === void 0 ? void 0 : (_node$children2$forEa = _node$children2.forEach) === null || _node$children2$forEa === void 0 ? void 0 : _node$children2$forEa.call(_node$children2, function (child) {
|
|
475
|
+
var _child$schema, _child$schema$props;
|
|
476
|
+
var key = child === null || child === void 0 ? void 0 : (_child$schema = child.schema) === null || _child$schema === void 0 ? void 0 : (_child$schema$props = _child$schema.props) === null || _child$schema$props === void 0 ? void 0 : _child$schema$props.key;
|
|
477
|
+
if ((child === null || child === void 0 ? void 0 : child.componentName) === 'NextText' && typeof key === 'string' && key.startsWith('text-')) {
|
|
478
|
+
var order = Number(key.split('-')[1]);
|
|
479
|
+
if (!Number.isNaN(order) && order > value) {
|
|
480
|
+
nodesToRemove.push(child);
|
|
481
|
+
}
|
|
398
482
|
}
|
|
399
|
-
var order = Number(key.split('-')[1]);
|
|
400
|
-
return Number.isNaN(order) || order <= value;
|
|
401
483
|
});
|
|
402
|
-
|
|
484
|
+
nodesToRemove.forEach(function (child) {
|
|
485
|
+
var _child$remove;
|
|
486
|
+
return child === null || child === void 0 ? void 0 : (_child$remove = child.remove) === null || _child$remove === void 0 ? void 0 : _child$remove.call(child);
|
|
487
|
+
});
|
|
403
488
|
}
|
|
404
489
|
|
|
405
490
|
// 更新数据源绑定的配置
|
|
@@ -895,6 +980,6 @@ var getSnippets = function getSnippets(textLines) {
|
|
|
895
980
|
}
|
|
896
981
|
}];
|
|
897
982
|
};
|
|
898
|
-
var _default = exports["default"] = (0,
|
|
983
|
+
var _default = exports["default"] = (0, _extends4["default"])({}, TeletextListMeta, {
|
|
899
984
|
snippets: getSnippets(2)
|
|
900
985
|
});
|