@dckj-npm/dc-material 0.1.361 → 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 +3 -3
- package/build/docs/colorful-input.html +3 -3
- package/build/docs/index.html +3 -3
- package/build/docs/teletext-list.html +48 -0
- package/build/docs/umi.399a9633.js +1 -0
- package/build/docs/{umi.a2a18b22.css → umi.6743fcd4.css} +2 -2
- 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 +47 -0
- package/build/docs/~demos/teletext-list-demo.html +47 -0
- 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/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/dist/BizComps.css +1 -1
- package/dist/BizComps.js +1 -1
- package/dist/BizComps.js.map +1 -1
- package/es/components/teletext-list/index.scss +9 -0
- package/es/components/teletext-list/teletext-list-item.d.ts +5 -1
- package/es/components/teletext-list/teletext-list-item.js +32 -24
- package/es/components/teletext-list/teletext-list-item.scss +0 -16
- package/es/components/teletext-list/teletext-list.d.ts +4 -4
- package/es/components/teletext-list/teletext-list.js +11 -24
- package/es/types/assets.d.ts +4 -0
- package/es/utils/children-node-handle.js +12 -6
- package/lib/components/teletext-list/index.scss +9 -0
- package/lib/components/teletext-list/teletext-list-item.d.ts +5 -1
- package/lib/components/teletext-list/teletext-list-item.js +33 -24
- package/lib/components/teletext-list/teletext-list-item.scss +0 -16
- package/lib/components/teletext-list/teletext-list.d.ts +4 -4
- package/lib/components/teletext-list/teletext-list.js +11 -24
- package/lib/types/assets.d.ts +4 -0
- package/lib/utils/children-node-handle.js +12 -6
- package/lowcode/teletext-list/meta.ts +266 -38
- package/lowcode_es/meta.js +1 -1
- package/lowcode_es/teletext-list/meta.d.ts +2 -2
- package/lowcode_es/teletext-list/meta.js +272 -24
- package/lowcode_lib/meta.js +1 -1
- package/lowcode_lib/teletext-list/meta.d.ts +2 -2
- package/lowcode_lib/teletext-list/meta.js +274 -26
- package/package.json +3 -3
- package/build/docs/umi.e8fefa28.js +0 -1
|
@@ -3,8 +3,118 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports["default"] = void 0;
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var _extends4 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
|
+
var IMAGE_KEY = 'image';
|
|
8
|
+
var normalizeNodeKey = function normalizeNodeKey(rawKey) {
|
|
9
|
+
if (rawKey === undefined || rawKey === null) return '';
|
|
10
|
+
return String(rawKey).replace(/^\.?\$?/, '');
|
|
11
|
+
};
|
|
12
|
+
var parsePxNumber = function parsePxNumber(value) {
|
|
13
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
if (typeof value === 'string') {
|
|
17
|
+
var numberLike = Number(value.trim());
|
|
18
|
+
if (Number.isFinite(numberLike)) {
|
|
19
|
+
return numberLike;
|
|
20
|
+
}
|
|
21
|
+
var matched = value.match(/^\s*(\d+(?:\.\d+)?)\s*px\s*$/i);
|
|
22
|
+
if (!matched) return undefined;
|
|
23
|
+
var parsed = Number(matched[1]);
|
|
24
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
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
|
+
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
|
+
};
|
|
60
|
+
var getImageStyleNumber = function getImageStyleNumber(target, styleKey) {
|
|
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 快照读取
|
|
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]);
|
|
71
|
+
};
|
|
72
|
+
var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value) {
|
|
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(引擎无法感知,但保留作为兜底)
|
|
83
|
+
var imageChildSchema = findImageChildSchema(target);
|
|
84
|
+
if (!imageChildSchema) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (!imageChildSchema.props) {
|
|
88
|
+
imageChildSchema.props = {};
|
|
89
|
+
}
|
|
90
|
+
var currentStyle = imageChildSchema.props.style || {};
|
|
91
|
+
imageChildSchema.props.style = (0, _extends4["default"])({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
|
|
92
|
+
};
|
|
93
|
+
var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild(target) {
|
|
94
|
+
var _target$getProps;
|
|
95
|
+
var widthFromChild = getImageStyleNumber(target, 'width');
|
|
96
|
+
var heightFromChild = getImageStyleNumber(target, 'height');
|
|
97
|
+
var propsApi = target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : _target$getProps.call(target);
|
|
98
|
+
if (propsApi && widthFromChild !== undefined) {
|
|
99
|
+
var _propsApi$getPropValu;
|
|
100
|
+
var currentWidth = parsePxNumber((_propsApi$getPropValu = propsApi.getPropValue) === null || _propsApi$getPropValu === void 0 ? void 0 : _propsApi$getPropValu.call(propsApi, 'imgWidth'));
|
|
101
|
+
if (currentWidth !== widthFromChild) {
|
|
102
|
+
propsApi.setPropValue('imgWidth', widthFromChild);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (propsApi && heightFromChild !== undefined) {
|
|
106
|
+
var _propsApi$getPropValu2;
|
|
107
|
+
var currentHeight = parsePxNumber((_propsApi$getPropValu2 = propsApi.getPropValue) === null || _propsApi$getPropValu2 === void 0 ? void 0 : _propsApi$getPropValu2.call(propsApi, 'imgHeight'));
|
|
108
|
+
if (currentHeight !== heightFromChild) {
|
|
109
|
+
propsApi.setPropValue('imgHeight', heightFromChild);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
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
|
+
};
|
|
8
118
|
var TeletextListMeta = {
|
|
9
119
|
group: '低代码组件',
|
|
10
120
|
componentName: 'TeletextList',
|
|
@@ -108,7 +218,18 @@ var TeletextListMeta = {
|
|
|
108
218
|
},
|
|
109
219
|
extraProps: {
|
|
110
220
|
setValue: function setValue(target, value) {
|
|
111
|
-
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);
|
|
231
|
+
// 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
|
|
232
|
+
syncImageDimensionPropsFromChild(target);
|
|
112
233
|
}
|
|
113
234
|
}
|
|
114
235
|
}, {
|
|
@@ -118,8 +239,67 @@ var TeletextListMeta = {
|
|
|
118
239
|
setter: {
|
|
119
240
|
componentName: 'NumberSetter',
|
|
120
241
|
isRequired: false,
|
|
121
|
-
initialValue:
|
|
122
|
-
|
|
242
|
+
initialValue: function initialValue(target) {
|
|
243
|
+
var _target$getProps3, _target$getProps3$get;
|
|
244
|
+
var styleWidth = getImageStyleNumber(target, 'width');
|
|
245
|
+
if (styleWidth !== undefined) {
|
|
246
|
+
return styleWidth;
|
|
247
|
+
}
|
|
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');
|
|
249
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
250
|
+
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
251
|
+
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
252
|
+
if (isDataListBoundExpression(target)) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
return 100;
|
|
256
|
+
},
|
|
257
|
+
defaultValue: function defaultValue(target) {
|
|
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;
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
extraProps: {
|
|
273
|
+
getValue: function getValue(target) {
|
|
274
|
+
var _target$getProps7, _target$getProps7$get;
|
|
275
|
+
var styleWidth = getImageStyleNumber(target, 'width');
|
|
276
|
+
if (styleWidth !== undefined) {
|
|
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'));
|
|
279
|
+
if (currentWidth !== styleWidth) {
|
|
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);
|
|
282
|
+
}
|
|
283
|
+
return styleWidth;
|
|
284
|
+
}
|
|
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');
|
|
286
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
287
|
+
if (parsedPropValue !== undefined) {
|
|
288
|
+
return parsedPropValue;
|
|
289
|
+
}
|
|
290
|
+
if (isDataListBoundExpression(target)) {
|
|
291
|
+
return undefined;
|
|
292
|
+
}
|
|
293
|
+
return 100;
|
|
294
|
+
},
|
|
295
|
+
setValue: function setValue(target, value) {
|
|
296
|
+
var parsedValue = parsePxNumber(value);
|
|
297
|
+
if (parsedValue === undefined) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
target.getProps().setPropValue('imgWidth', parsedValue);
|
|
301
|
+
syncImageStyleValue(target, 'width', parsedValue);
|
|
302
|
+
}
|
|
123
303
|
}
|
|
124
304
|
}, {
|
|
125
305
|
title: '图片高度',
|
|
@@ -128,8 +308,67 @@ var TeletextListMeta = {
|
|
|
128
308
|
setter: {
|
|
129
309
|
componentName: 'NumberSetter',
|
|
130
310
|
isRequired: false,
|
|
131
|
-
initialValue:
|
|
132
|
-
|
|
311
|
+
initialValue: function initialValue(target) {
|
|
312
|
+
var _target$getProps8, _target$getProps8$get;
|
|
313
|
+
var styleHeight = getImageStyleNumber(target, 'height');
|
|
314
|
+
if (styleHeight !== undefined) {
|
|
315
|
+
return styleHeight;
|
|
316
|
+
}
|
|
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');
|
|
318
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
319
|
+
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
320
|
+
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
321
|
+
if (isDataListBoundExpression(target)) {
|
|
322
|
+
return undefined;
|
|
323
|
+
}
|
|
324
|
+
return 100;
|
|
325
|
+
},
|
|
326
|
+
defaultValue: function defaultValue(target) {
|
|
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;
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
extraProps: {
|
|
342
|
+
getValue: function getValue(target) {
|
|
343
|
+
var _target$getProps10, _target$getProps10$ge;
|
|
344
|
+
var styleHeight = getImageStyleNumber(target, 'height');
|
|
345
|
+
if (styleHeight !== undefined) {
|
|
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'));
|
|
348
|
+
if (currentHeight !== styleHeight) {
|
|
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);
|
|
351
|
+
}
|
|
352
|
+
return styleHeight;
|
|
353
|
+
}
|
|
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');
|
|
355
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
356
|
+
if (parsedPropValue !== undefined) {
|
|
357
|
+
return parsedPropValue;
|
|
358
|
+
}
|
|
359
|
+
if (isDataListBoundExpression(target)) {
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
return 100;
|
|
363
|
+
},
|
|
364
|
+
setValue: function setValue(target, value) {
|
|
365
|
+
var parsedValue = parsePxNumber(value);
|
|
366
|
+
if (parsedValue === undefined) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
target.getProps().setPropValue('imgHeight', parsedValue);
|
|
370
|
+
syncImageStyleValue(target, 'height', parsedValue);
|
|
371
|
+
}
|
|
133
372
|
}
|
|
134
373
|
}, {
|
|
135
374
|
title: '数据源绑定',
|
|
@@ -158,7 +397,7 @@ var TeletextListMeta = {
|
|
|
158
397
|
},
|
|
159
398
|
extraProps: {
|
|
160
399
|
setValue: function setValue(target, value) {
|
|
161
|
-
|
|
400
|
+
target.getProps().setPropValue('dataListBind', value);
|
|
162
401
|
}
|
|
163
402
|
}
|
|
164
403
|
}, {
|
|
@@ -202,16 +441,17 @@ var TeletextListMeta = {
|
|
|
202
441
|
},
|
|
203
442
|
extraProps: {
|
|
204
443
|
setValue: function setValue(target, value) {
|
|
205
|
-
var _target$
|
|
444
|
+
var _target$node3, _schemaChildren$filte, _target$parent, _target$parent$items;
|
|
206
445
|
target.getProps().setPropValue('textLines', value);
|
|
207
|
-
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;
|
|
208
447
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
448
|
+
var schemaChildren = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.children) ? schema.children : [];
|
|
209
449
|
|
|
210
450
|
// 获取当前文本组件数量
|
|
211
|
-
var currentLength = (
|
|
212
|
-
var _child$
|
|
213
|
-
return child.componentName === 'NextText' && ((_child$props$key =
|
|
214
|
-
})) === null ||
|
|
451
|
+
var currentLength = ((_schemaChildren$filte = schemaChildren.filter(function (child) {
|
|
452
|
+
var _child$props2, _child$props2$key;
|
|
453
|
+
return child.componentName === 'NextText' && (child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : (_child$props2$key = _child$props2.key) === null || _child$props2$key === void 0 ? void 0 : _child$props2$key.startsWith('text-'));
|
|
454
|
+
})) === null || _schemaChildren$filte === void 0 ? void 0 : _schemaChildren$filte.length) || 0;
|
|
215
455
|
if (value > currentLength) {
|
|
216
456
|
// 需要添加新的文本组件
|
|
217
457
|
for (var i = currentLength + 1; i <= value; i++) {
|
|
@@ -224,20 +464,31 @@ var TeletextListMeta = {
|
|
|
224
464
|
key: "text-" + i
|
|
225
465
|
}
|
|
226
466
|
};
|
|
227
|
-
console.log('node', node, 'node-children', node === null || node === void 0 ? void 0 : node.children);
|
|
228
467
|
node === null || node === void 0 ? void 0 : (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.push(newChild);
|
|
229
468
|
}
|
|
230
469
|
} else if (value < currentLength) {
|
|
231
|
-
var _node$children2;
|
|
232
|
-
//
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|
+
}
|
|
482
|
+
}
|
|
483
|
+
});
|
|
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);
|
|
236
487
|
});
|
|
237
488
|
}
|
|
238
489
|
|
|
239
490
|
// 更新数据源绑定的配置
|
|
240
|
-
var dataListBindProp = target.parent.items.find(function (item) {
|
|
491
|
+
var dataListBindProp = target === null || target === void 0 ? void 0 : (_target$parent = target.parent) === null || _target$parent === void 0 ? void 0 : (_target$parent$items = _target$parent.items) === null || _target$parent$items === void 0 ? void 0 : _target$parent$items.find(function (item) {
|
|
241
492
|
return item.name === 'dataListBind';
|
|
242
493
|
});
|
|
243
494
|
if (dataListBindProp && dataListBindProp.setter) {
|
|
@@ -268,7 +519,6 @@ var TeletextListMeta = {
|
|
|
268
519
|
// 更新setter的attributes
|
|
269
520
|
dataListBindProp.setter.props.attributes[0].children = [].concat(baseChildren, textChildren);
|
|
270
521
|
}
|
|
271
|
-
console.log('文字行数', target, value, schema, target.node, target.parent, target.parent.getPropValue('dataListBind'), (_target$parent$node = target.parent.node) === null || _target$parent$node === void 0 ? void 0 : _target$parent$node.getProp('dataListBind'));
|
|
272
522
|
}
|
|
273
523
|
}
|
|
274
524
|
}, {
|
|
@@ -730,8 +980,6 @@ var getSnippets = function getSnippets(textLines) {
|
|
|
730
980
|
}
|
|
731
981
|
}];
|
|
732
982
|
};
|
|
733
|
-
var _default = exports["default"] = (0,
|
|
734
|
-
snippets: getSnippets(
|
|
735
|
-
return prop.name === 'textLines';
|
|
736
|
-
})) === null || _props$find === void 0 ? void 0 : (_props$find$setter = _props$find.setter) === null || _props$find$setter === void 0 ? void 0 : (_props$find$setter$ge = _props$find$setter.getValue) === null || _props$find$setter$ge === void 0 ? void 0 : _props$find$setter$ge.call(_props$find$setter)) || 2)
|
|
983
|
+
var _default = exports["default"] = (0, _extends4["default"])({}, TeletextListMeta, {
|
|
984
|
+
snippets: getSnippets(2)
|
|
737
985
|
});
|
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.363",
|
|
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.362/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.362/build/index.html"
|
|
123
123
|
}
|