@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
|
@@ -41,13 +41,42 @@ const findImageChildSchema = (target: any): any | undefined => {
|
|
|
41
41
|
})
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* 通过引擎的 IPublicModelNode API 查找 key='image' 的子节点。
|
|
46
|
+
* 相比直接读 node.schema.children,这里使用的是引擎可感知的公共 API,
|
|
47
|
+
* 保证后续 setPropValue/getPropValue 操作能被引擎正确追踪(触发响应式更新)。
|
|
48
|
+
*/
|
|
49
|
+
const findImageChildNode = (target: any): any | undefined => {
|
|
50
|
+
const children = target?.node?.children
|
|
51
|
+
if (!children) return undefined
|
|
52
|
+
if (typeof children.find === 'function') {
|
|
53
|
+
return children.find((child: any) => {
|
|
54
|
+
return normalizeNodeKey(child?.getPropValue?.('key')) === IMAGE_KEY
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
return undefined
|
|
58
|
+
}
|
|
59
|
+
|
|
44
60
|
const getImageStyleNumber = (target: any, styleKey: 'width' | 'height'): number | undefined => {
|
|
61
|
+
// 优先通过引擎 API 读取,保证与 syncImageStyleValue 写入来源一致
|
|
62
|
+
const imageChildNode = findImageChildNode(target)
|
|
63
|
+
if (imageChildNode) {
|
|
64
|
+
return parsePxNumber(imageChildNode.getPropValue?.('style')?.[styleKey])
|
|
65
|
+
}
|
|
66
|
+
// 降级:从 schema 快照读取
|
|
45
67
|
const imageChildSchema = findImageChildSchema(target)
|
|
46
|
-
|
|
47
|
-
return parsePxNumber(childStyleValue)
|
|
68
|
+
return parsePxNumber(imageChildSchema?.props?.style?.[styleKey])
|
|
48
69
|
}
|
|
49
70
|
|
|
50
71
|
const syncImageStyleValue = (target: any, styleKey: 'width' | 'height', value: number) => {
|
|
72
|
+
// 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
|
|
73
|
+
const imageChildNode = findImageChildNode(target)
|
|
74
|
+
if (imageChildNode) {
|
|
75
|
+
const currentStyle = imageChildNode.getPropValue?.('style') || {}
|
|
76
|
+
imageChildNode.setPropValue?.('style', { ...currentStyle, [styleKey]: `${value}px` })
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
// 降级:直接写 schema(引擎无法感知,但保留作为兜底)
|
|
51
80
|
const imageChildSchema = findImageChildSchema(target)
|
|
52
81
|
if (!imageChildSchema) {
|
|
53
82
|
return
|
|
@@ -82,6 +111,15 @@ const syncImageDimensionPropsFromChild = (target: any) => {
|
|
|
82
111
|
}
|
|
83
112
|
}
|
|
84
113
|
|
|
114
|
+
const isDataListBoundExpression = (target: any): boolean => {
|
|
115
|
+
const dataListValue = target?.getProps?.()?.getPropValue?.('dataList')
|
|
116
|
+
return !!(
|
|
117
|
+
dataListValue &&
|
|
118
|
+
typeof dataListValue === 'object' &&
|
|
119
|
+
(dataListValue as any).type === 'JSExpression'
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
85
123
|
const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
86
124
|
group: '低代码组件',
|
|
87
125
|
componentName: 'TeletextList',
|
|
@@ -207,7 +245,16 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
207
245
|
},
|
|
208
246
|
extraProps: {
|
|
209
247
|
setValue: (target, value) => {
|
|
210
|
-
target.getProps()
|
|
248
|
+
const props = target.getProps()
|
|
249
|
+
// 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
|
|
250
|
+
const prevDataList = props.getPropValue('dataList')
|
|
251
|
+
const prevDataListBind = props.getPropValue('dataListBind')
|
|
252
|
+
const prevTextImgGap = props.getPropValue('textImgGap')
|
|
253
|
+
props.setPropValue('imagePlacement', value)
|
|
254
|
+
// 写回被保护的配置(幂等操作,若引擎未重置则无副作用)
|
|
255
|
+
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList)
|
|
256
|
+
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind)
|
|
257
|
+
if (prevTextImgGap !== undefined) props.setPropValue('textImgGap', prevTextImgGap)
|
|
211
258
|
// 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
|
|
212
259
|
syncImageDimensionPropsFromChild(target)
|
|
213
260
|
},
|
|
@@ -228,9 +275,25 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
228
275
|
const propValue = target?.getProps()?.getPropValue?.('imgWidth')
|
|
229
276
|
const parsedPropValue = parsePxNumber(propValue)
|
|
230
277
|
if (parsedPropValue !== undefined) return parsedPropValue
|
|
231
|
-
|
|
278
|
+
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
279
|
+
if (isDataListBoundExpression(target)) {
|
|
280
|
+
return undefined
|
|
281
|
+
}
|
|
282
|
+
return 100
|
|
283
|
+
},
|
|
284
|
+
defaultValue: (target) => {
|
|
285
|
+
const styleWidth = getImageStyleNumber(target, 'width')
|
|
286
|
+
if (styleWidth !== undefined) {
|
|
287
|
+
return styleWidth
|
|
288
|
+
}
|
|
289
|
+
const propValue = target?.getProps()?.getPropValue?.('imgWidth')
|
|
290
|
+
const parsedPropValue = parsePxNumber(propValue)
|
|
291
|
+
if (parsedPropValue !== undefined) return parsedPropValue
|
|
292
|
+
if (isDataListBoundExpression(target)) {
|
|
293
|
+
return undefined
|
|
294
|
+
}
|
|
295
|
+
return 100
|
|
232
296
|
},
|
|
233
|
-
defaultValue: (target) => getImageStyleNumber(target, 'width') ?? 100,
|
|
234
297
|
},
|
|
235
298
|
extraProps: {
|
|
236
299
|
getValue: (target) => {
|
|
@@ -247,7 +310,10 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
247
310
|
if (parsedPropValue !== undefined) {
|
|
248
311
|
return parsedPropValue
|
|
249
312
|
}
|
|
250
|
-
|
|
313
|
+
if (isDataListBoundExpression(target)) {
|
|
314
|
+
return undefined
|
|
315
|
+
}
|
|
316
|
+
return 100
|
|
251
317
|
},
|
|
252
318
|
setValue: (target, value) => {
|
|
253
319
|
const parsedValue = parsePxNumber(value)
|
|
@@ -274,9 +340,25 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
274
340
|
const propValue = target?.getProps()?.getPropValue?.('imgHeight')
|
|
275
341
|
const parsedPropValue = parsePxNumber(propValue)
|
|
276
342
|
if (parsedPropValue !== undefined) return parsedPropValue
|
|
277
|
-
|
|
343
|
+
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
344
|
+
if (isDataListBoundExpression(target)) {
|
|
345
|
+
return undefined
|
|
346
|
+
}
|
|
347
|
+
return 100
|
|
348
|
+
},
|
|
349
|
+
defaultValue: (target) => {
|
|
350
|
+
const styleHeight = getImageStyleNumber(target, 'height')
|
|
351
|
+
if (styleHeight !== undefined) {
|
|
352
|
+
return styleHeight
|
|
353
|
+
}
|
|
354
|
+
const propValue = target?.getProps()?.getPropValue?.('imgHeight')
|
|
355
|
+
const parsedPropValue = parsePxNumber(propValue)
|
|
356
|
+
if (parsedPropValue !== undefined) return parsedPropValue
|
|
357
|
+
if (isDataListBoundExpression(target)) {
|
|
358
|
+
return undefined
|
|
359
|
+
}
|
|
360
|
+
return 100
|
|
278
361
|
},
|
|
279
|
-
defaultValue: (target) => getImageStyleNumber(target, 'height') ?? 100,
|
|
280
362
|
},
|
|
281
363
|
extraProps: {
|
|
282
364
|
getValue: (target) => {
|
|
@@ -293,7 +375,10 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
293
375
|
if (parsedPropValue !== undefined) {
|
|
294
376
|
return parsedPropValue
|
|
295
377
|
}
|
|
296
|
-
|
|
378
|
+
if (isDataListBoundExpression(target)) {
|
|
379
|
+
return undefined
|
|
380
|
+
}
|
|
381
|
+
return 100
|
|
297
382
|
},
|
|
298
383
|
setValue: (target, value) => {
|
|
299
384
|
const parsedValue = parsePxNumber(value)
|
|
@@ -400,21 +485,23 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
400
485
|
node?.children?.push(newChild)
|
|
401
486
|
}
|
|
402
487
|
} else if (value < currentLength) {
|
|
403
|
-
//
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
488
|
+
// 收集需要移除的节点,再调用 child.remove() 通过引擎 API 逐个删除
|
|
489
|
+
// 避免 node.children = [...] 直接赋值(IPublicModelNodeChildren 不支持重新赋值)
|
|
490
|
+
const nodesToRemove: any[] = []
|
|
491
|
+
node?.children?.forEach?.((child: any) => {
|
|
492
|
+
const key = child?.schema?.props?.key
|
|
493
|
+
if (
|
|
494
|
+
child?.componentName === 'NextText' &&
|
|
495
|
+
typeof key === 'string' &&
|
|
496
|
+
key.startsWith('text-')
|
|
497
|
+
) {
|
|
413
498
|
const order = Number(key.split('-')[1])
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
499
|
+
if (!Number.isNaN(order) && order > value) {
|
|
500
|
+
nodesToRemove.push(child)
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
})
|
|
504
|
+
nodesToRemove.forEach((child) => child?.remove?.())
|
|
418
505
|
}
|
|
419
506
|
|
|
420
507
|
// 更新数据源绑定的配置
|
|
@@ -34,14 +34,47 @@ var findImageChildSchema = function findImageChildSchema(target) {
|
|
|
34
34
|
return keyFromProps === IMAGE_KEY || keyFromNode === IMAGE_KEY;
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 通过引擎的 IPublicModelNode API 查找 key='image' 的子节点。
|
|
40
|
+
* 相比直接读 node.schema.children,这里使用的是引擎可感知的公共 API,
|
|
41
|
+
* 保证后续 setPropValue/getPropValue 操作能被引擎正确追踪(触发响应式更新)。
|
|
42
|
+
*/
|
|
43
|
+
var findImageChildNode = function findImageChildNode(target) {
|
|
44
|
+
var _target$node2;
|
|
45
|
+
var children = target === null || target === void 0 ? void 0 : (_target$node2 = target.node) === null || _target$node2 === void 0 ? void 0 : _target$node2.children;
|
|
46
|
+
if (!children) return undefined;
|
|
47
|
+
if (typeof children.find === 'function') {
|
|
48
|
+
return children.find(function (child) {
|
|
49
|
+
var _child$getPropValue;
|
|
50
|
+
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;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
54
|
+
};
|
|
37
55
|
var getImageStyleNumber = function getImageStyleNumber(target, styleKey) {
|
|
38
56
|
var _imageChildSchema$pro, _imageChildSchema$pro2;
|
|
57
|
+
// 优先通过引擎 API 读取,保证与 syncImageStyleValue 写入来源一致
|
|
58
|
+
var imageChildNode = findImageChildNode(target);
|
|
59
|
+
if (imageChildNode) {
|
|
60
|
+
var _imageChildNode$getPr, _imageChildNode$getPr2;
|
|
61
|
+
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]);
|
|
62
|
+
}
|
|
63
|
+
// 降级:从 schema 快照读取
|
|
39
64
|
var imageChildSchema = findImageChildSchema(target);
|
|
40
|
-
|
|
41
|
-
return parsePxNumber(childStyleValue);
|
|
65
|
+
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]);
|
|
42
66
|
};
|
|
43
67
|
var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value) {
|
|
44
|
-
var
|
|
68
|
+
var _extends3;
|
|
69
|
+
// 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
|
|
70
|
+
var imageChildNode = findImageChildNode(target);
|
|
71
|
+
if (imageChildNode) {
|
|
72
|
+
var _imageChildNode$getPr3, _imageChildNode$setPr, _extends2;
|
|
73
|
+
var _currentStyle = ((_imageChildNode$getPr3 = imageChildNode.getPropValue) === null || _imageChildNode$getPr3 === void 0 ? void 0 : _imageChildNode$getPr3.call(imageChildNode, 'style')) || {};
|
|
74
|
+
(_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', _extends({}, _currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2)));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// 降级:直接写 schema(引擎无法感知,但保留作为兜底)
|
|
45
78
|
var imageChildSchema = findImageChildSchema(target);
|
|
46
79
|
if (!imageChildSchema) {
|
|
47
80
|
return;
|
|
@@ -50,7 +83,7 @@ var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value)
|
|
|
50
83
|
imageChildSchema.props = {};
|
|
51
84
|
}
|
|
52
85
|
var currentStyle = imageChildSchema.props.style || {};
|
|
53
|
-
imageChildSchema.props.style = _extends({}, currentStyle, (
|
|
86
|
+
imageChildSchema.props.style = _extends({}, currentStyle, (_extends3 = {}, _extends3[styleKey] = value + "px", _extends3));
|
|
54
87
|
};
|
|
55
88
|
var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild(target) {
|
|
56
89
|
var _target$getProps;
|
|
@@ -72,6 +105,11 @@ var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild
|
|
|
72
105
|
}
|
|
73
106
|
}
|
|
74
107
|
};
|
|
108
|
+
var isDataListBoundExpression = function isDataListBoundExpression(target) {
|
|
109
|
+
var _target$getProps2, _target$getProps2$cal, _target$getProps2$cal2;
|
|
110
|
+
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');
|
|
111
|
+
return !!(dataListValue && typeof dataListValue === 'object' && dataListValue.type === 'JSExpression');
|
|
112
|
+
};
|
|
75
113
|
var TeletextListMeta = {
|
|
76
114
|
group: '低代码组件',
|
|
77
115
|
componentName: 'TeletextList',
|
|
@@ -175,7 +213,16 @@ var TeletextListMeta = {
|
|
|
175
213
|
},
|
|
176
214
|
extraProps: {
|
|
177
215
|
setValue: function setValue(target, value) {
|
|
178
|
-
target.getProps()
|
|
216
|
+
var props = target.getProps();
|
|
217
|
+
// 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
|
|
218
|
+
var prevDataList = props.getPropValue('dataList');
|
|
219
|
+
var prevDataListBind = props.getPropValue('dataListBind');
|
|
220
|
+
var prevTextImgGap = props.getPropValue('textImgGap');
|
|
221
|
+
props.setPropValue('imagePlacement', value);
|
|
222
|
+
// 写回被保护的配置(幂等操作,若引擎未重置则无副作用)
|
|
223
|
+
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList);
|
|
224
|
+
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind);
|
|
225
|
+
if (prevTextImgGap !== undefined) props.setPropValue('textImgGap', prevTextImgGap);
|
|
179
226
|
// 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
|
|
180
227
|
syncImageDimensionPropsFromChild(target);
|
|
181
228
|
}
|
|
@@ -188,40 +235,57 @@ var TeletextListMeta = {
|
|
|
188
235
|
componentName: 'NumberSetter',
|
|
189
236
|
isRequired: false,
|
|
190
237
|
initialValue: function initialValue(target) {
|
|
191
|
-
var _target$
|
|
238
|
+
var _target$getProps3, _target$getProps3$get;
|
|
192
239
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
193
240
|
if (styleWidth !== undefined) {
|
|
194
241
|
return styleWidth;
|
|
195
242
|
}
|
|
196
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
243
|
+
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');
|
|
197
244
|
var parsedPropValue = parsePxNumber(propValue);
|
|
198
245
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
199
|
-
|
|
246
|
+
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
247
|
+
if (isDataListBoundExpression(target)) {
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
return 100;
|
|
200
251
|
},
|
|
201
252
|
defaultValue: function defaultValue(target) {
|
|
202
|
-
var
|
|
203
|
-
|
|
253
|
+
var _target$getProps4, _target$getProps4$get;
|
|
254
|
+
var styleWidth = getImageStyleNumber(target, 'width');
|
|
255
|
+
if (styleWidth !== undefined) {
|
|
256
|
+
return styleWidth;
|
|
257
|
+
}
|
|
258
|
+
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');
|
|
259
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
260
|
+
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
261
|
+
if (isDataListBoundExpression(target)) {
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
return 100;
|
|
204
265
|
}
|
|
205
266
|
},
|
|
206
267
|
extraProps: {
|
|
207
268
|
getValue: function getValue(target) {
|
|
208
|
-
var _target$
|
|
269
|
+
var _target$getProps7, _target$getProps7$get;
|
|
209
270
|
var styleWidth = getImageStyleNumber(target, 'width');
|
|
210
271
|
if (styleWidth !== undefined) {
|
|
211
|
-
var _target$
|
|
212
|
-
var currentWidth = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$
|
|
272
|
+
var _target$getProps5, _target$getProps5$get;
|
|
273
|
+
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'));
|
|
213
274
|
if (currentWidth !== styleWidth) {
|
|
214
|
-
var _target$
|
|
215
|
-
target === null || target === void 0 ? void 0 : (_target$
|
|
275
|
+
var _target$getProps6, _target$getProps6$set;
|
|
276
|
+
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);
|
|
216
277
|
}
|
|
217
278
|
return styleWidth;
|
|
218
279
|
}
|
|
219
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
280
|
+
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');
|
|
220
281
|
var parsedPropValue = parsePxNumber(propValue);
|
|
221
282
|
if (parsedPropValue !== undefined) {
|
|
222
283
|
return parsedPropValue;
|
|
223
284
|
}
|
|
224
|
-
|
|
285
|
+
if (isDataListBoundExpression(target)) {
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
return 100;
|
|
225
289
|
},
|
|
226
290
|
setValue: function setValue(target, value) {
|
|
227
291
|
var parsedValue = parsePxNumber(value);
|
|
@@ -240,40 +304,57 @@ var TeletextListMeta = {
|
|
|
240
304
|
componentName: 'NumberSetter',
|
|
241
305
|
isRequired: false,
|
|
242
306
|
initialValue: function initialValue(target) {
|
|
243
|
-
var _target$
|
|
307
|
+
var _target$getProps8, _target$getProps8$get;
|
|
244
308
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
245
309
|
if (styleHeight !== undefined) {
|
|
246
310
|
return styleHeight;
|
|
247
311
|
}
|
|
248
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
312
|
+
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');
|
|
249
313
|
var parsedPropValue = parsePxNumber(propValue);
|
|
250
314
|
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
251
|
-
|
|
315
|
+
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
316
|
+
if (isDataListBoundExpression(target)) {
|
|
317
|
+
return undefined;
|
|
318
|
+
}
|
|
319
|
+
return 100;
|
|
252
320
|
},
|
|
253
321
|
defaultValue: function defaultValue(target) {
|
|
254
|
-
var
|
|
255
|
-
|
|
322
|
+
var _target$getProps9, _target$getProps9$get;
|
|
323
|
+
var styleHeight = getImageStyleNumber(target, 'height');
|
|
324
|
+
if (styleHeight !== undefined) {
|
|
325
|
+
return styleHeight;
|
|
326
|
+
}
|
|
327
|
+
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');
|
|
328
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
329
|
+
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
330
|
+
if (isDataListBoundExpression(target)) {
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
333
|
+
return 100;
|
|
256
334
|
}
|
|
257
335
|
},
|
|
258
336
|
extraProps: {
|
|
259
337
|
getValue: function getValue(target) {
|
|
260
|
-
var _target$
|
|
338
|
+
var _target$getProps10, _target$getProps10$ge;
|
|
261
339
|
var styleHeight = getImageStyleNumber(target, 'height');
|
|
262
340
|
if (styleHeight !== undefined) {
|
|
263
|
-
var _target$
|
|
264
|
-
var currentHeight = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$
|
|
341
|
+
var _target$getProps0, _target$getProps0$get;
|
|
342
|
+
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'));
|
|
265
343
|
if (currentHeight !== styleHeight) {
|
|
266
|
-
var _target$
|
|
267
|
-
target === null || target === void 0 ? void 0 : (_target$
|
|
344
|
+
var _target$getProps1, _target$getProps1$set;
|
|
345
|
+
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);
|
|
268
346
|
}
|
|
269
347
|
return styleHeight;
|
|
270
348
|
}
|
|
271
|
-
var propValue = target === null || target === void 0 ? void 0 : (_target$
|
|
349
|
+
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');
|
|
272
350
|
var parsedPropValue = parsePxNumber(propValue);
|
|
273
351
|
if (parsedPropValue !== undefined) {
|
|
274
352
|
return parsedPropValue;
|
|
275
353
|
}
|
|
276
|
-
|
|
354
|
+
if (isDataListBoundExpression(target)) {
|
|
355
|
+
return undefined;
|
|
356
|
+
}
|
|
357
|
+
return 100;
|
|
277
358
|
},
|
|
278
359
|
setValue: function setValue(target, value) {
|
|
279
360
|
var parsedValue = parsePxNumber(value);
|
|
@@ -355,9 +436,9 @@ var TeletextListMeta = {
|
|
|
355
436
|
},
|
|
356
437
|
extraProps: {
|
|
357
438
|
setValue: function setValue(target, value) {
|
|
358
|
-
var _target$
|
|
439
|
+
var _target$node3, _schemaChildren$filte, _target$parent, _target$parent$items;
|
|
359
440
|
target.getProps().setPropValue('textLines', value);
|
|
360
|
-
var schema = target === null || target === void 0 ? void 0 : (_target$
|
|
441
|
+
var schema = target === null || target === void 0 ? void 0 : (_target$node3 = target.node) === null || _target$node3 === void 0 ? void 0 : _target$node3.schema;
|
|
361
442
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
362
443
|
var schemaChildren = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.children) ? schema.children : [];
|
|
363
444
|
|
|
@@ -381,20 +462,24 @@ var TeletextListMeta = {
|
|
|
381
462
|
node === null || node === void 0 ? void 0 : (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.push(newChild);
|
|
382
463
|
}
|
|
383
464
|
} else if (value < currentLength) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
var key = child === null || child === void 0 ? void 0 : (_child$
|
|
391
|
-
if (
|
|
392
|
-
|
|
465
|
+
var _node$children2, _node$children2$forEa;
|
|
466
|
+
// 收集需要移除的节点,再调用 child.remove() 通过引擎 API 逐个删除
|
|
467
|
+
// 避免 node.children = [...] 直接赋值(IPublicModelNodeChildren 不支持重新赋值)
|
|
468
|
+
var nodesToRemove = [];
|
|
469
|
+
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) {
|
|
470
|
+
var _child$schema, _child$schema$props;
|
|
471
|
+
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;
|
|
472
|
+
if ((child === null || child === void 0 ? void 0 : child.componentName) === 'NextText' && typeof key === 'string' && key.startsWith('text-')) {
|
|
473
|
+
var order = Number(key.split('-')[1]);
|
|
474
|
+
if (!Number.isNaN(order) && order > value) {
|
|
475
|
+
nodesToRemove.push(child);
|
|
476
|
+
}
|
|
393
477
|
}
|
|
394
|
-
var order = Number(key.split('-')[1]);
|
|
395
|
-
return Number.isNaN(order) || order <= value;
|
|
396
478
|
});
|
|
397
|
-
|
|
479
|
+
nodesToRemove.forEach(function (child) {
|
|
480
|
+
var _child$remove;
|
|
481
|
+
return child === null || child === void 0 ? void 0 : (_child$remove = child.remove) === null || _child$remove === void 0 ? void 0 : _child$remove.call(child);
|
|
482
|
+
});
|
|
398
483
|
}
|
|
399
484
|
|
|
400
485
|
// 更新数据源绑定的配置
|