@dckj-npm/dc-material 0.1.373 → 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.8274544c.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 +71 -322
- package/lowcode_es/meta.js +1 -1
- package/lowcode_es/teletext-list/meta.js +79 -330
- package/lowcode_lib/meta.js +1 -1
- package/lowcode_lib/teletext-list/meta.js +81 -332
- package/package.json +3 -3
|
@@ -27,25 +27,6 @@ const parsePxNumber = (value: any): number | undefined => {
|
|
|
27
27
|
return undefined
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const getSchemaChildren = (target: any): any[] => {
|
|
31
|
-
const nodeSchema = target?.node?.schema
|
|
32
|
-
return Array.isArray(nodeSchema?.children) ? nodeSchema.children : []
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const findImageChildSchema = (target: any): any | undefined => {
|
|
36
|
-
const schemaChildren = getSchemaChildren(target)
|
|
37
|
-
return schemaChildren.find((child: any) => {
|
|
38
|
-
const keyFromProps = normalizeNodeKey(child?.props?.key)
|
|
39
|
-
const keyFromNode = normalizeNodeKey(child?.key)
|
|
40
|
-
return keyFromProps === IMAGE_KEY || keyFromNode === IMAGE_KEY
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 通过引擎的 IPublicModelNode API 查找 key='image' 的子节点。
|
|
46
|
-
* 相比直接读 node.schema.children,这里使用的是引擎可感知的公共 API,
|
|
47
|
-
* 保证后续 setPropValue/getPropValue 操作能被引擎正确追踪(触发响应式更新)。
|
|
48
|
-
*/
|
|
49
30
|
const findImageChildNode = (target: any): any | undefined => {
|
|
50
31
|
const children = target?.node?.children
|
|
51
32
|
if (!children) return undefined
|
|
@@ -58,118 +39,34 @@ const findImageChildNode = (target: any): any | undefined => {
|
|
|
58
39
|
}
|
|
59
40
|
|
|
60
41
|
const getImageStyleNumber = (target: any, styleKey: 'width' | 'height'): number | undefined => {
|
|
61
|
-
// 优先通过引擎 API 读取,保证与 syncImageStyleValue 写入来源一致
|
|
62
42
|
const imageChildNode = findImageChildNode(target)
|
|
63
43
|
if (imageChildNode) {
|
|
64
44
|
return parsePxNumber(imageChildNode.getPropValue?.('style')?.[styleKey])
|
|
65
45
|
}
|
|
66
|
-
|
|
67
|
-
const imageChildSchema = findImageChildSchema(target)
|
|
68
|
-
return parsePxNumber(imageChildSchema?.props?.style?.[styleKey])
|
|
46
|
+
return undefined
|
|
69
47
|
}
|
|
70
48
|
|
|
71
49
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* 此时 dataList 已稳定为正确的 JSExpression,重评估无副作用。
|
|
50
|
+
* 同步 Image 子节点的 style.width / style.height。
|
|
51
|
+
* 使用 Promise.resolve().then() 异步执行,避免在父节点 setPropValue
|
|
52
|
+
* 的 MobX 同步响应链中触发子节点变更(可能导致 SettingField 重建)。
|
|
76
53
|
*/
|
|
77
54
|
const syncImageStyleValue = (target: any, styleKey: 'width' | 'height', value: number): void => {
|
|
78
55
|
Promise.resolve().then(() => {
|
|
79
|
-
// 优先通过引擎节点 API 更新子节点 style,确保引擎感知变化(布局面板读取时可见)
|
|
80
56
|
const imageChildNode = findImageChildNode(target)
|
|
81
|
-
if (imageChildNode)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const otherPropValue = parsePxNumber(target?.getProps?.()?.getPropValue?.(otherPropKey))
|
|
90
|
-
if (otherPropValue !== undefined) {
|
|
91
|
-
updatedStyle[otherKey] = `${otherPropValue}px`
|
|
92
|
-
} else {
|
|
93
|
-
// 子节点 style 也没有,使用默认值 100
|
|
94
|
-
updatedStyle[otherKey] = '100px'
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
imageChildNode.setPropValue?.('style', updatedStyle)
|
|
98
|
-
return
|
|
99
|
-
}
|
|
100
|
-
// 降级:直接写 schema(引擎无法感知,但保留作为兜底)
|
|
101
|
-
const imageChildSchema = findImageChildSchema(target)
|
|
102
|
-
if (!imageChildSchema) {
|
|
103
|
-
return
|
|
104
|
-
}
|
|
105
|
-
if (!imageChildSchema.props) {
|
|
106
|
-
imageChildSchema.props = {}
|
|
107
|
-
}
|
|
108
|
-
const currentStyle = imageChildSchema.props.style || {}
|
|
109
|
-
imageChildSchema.props.style = {
|
|
110
|
-
...currentStyle,
|
|
111
|
-
[styleKey]: `${value}px`,
|
|
57
|
+
if (!imageChildNode) return
|
|
58
|
+
const currentStyle = imageChildNode.getPropValue?.('style') || {}
|
|
59
|
+
const updatedStyle: Record<string, any> = { ...currentStyle, [styleKey]: `${value}px` }
|
|
60
|
+
const otherKey = styleKey === 'width' ? 'height' : 'width'
|
|
61
|
+
if (!updatedStyle[otherKey]) {
|
|
62
|
+
const otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight'
|
|
63
|
+
const otherPropValue = parsePxNumber(target?.getProps?.()?.getPropValue?.(otherPropKey))
|
|
64
|
+
updatedStyle[otherKey] = `${otherPropValue ?? 100}px`
|
|
112
65
|
}
|
|
66
|
+
imageChildNode.setPropValue?.('style', updatedStyle)
|
|
113
67
|
})
|
|
114
68
|
}
|
|
115
69
|
|
|
116
|
-
const syncImageDimensionPropsFromChild = (target: any) => {
|
|
117
|
-
const widthFromChild = getImageStyleNumber(target, 'width')
|
|
118
|
-
const heightFromChild = getImageStyleNumber(target, 'height')
|
|
119
|
-
const propsApi = target?.getProps?.()
|
|
120
|
-
|
|
121
|
-
if (propsApi && widthFromChild !== undefined) {
|
|
122
|
-
const currentWidth = parsePxNumber(propsApi.getPropValue?.('imgWidth'))
|
|
123
|
-
if (currentWidth !== widthFromChild) {
|
|
124
|
-
propsApi.setPropValue('imgWidth', widthFromChild)
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (propsApi && heightFromChild !== undefined) {
|
|
129
|
-
const currentHeight = parsePxNumber(propsApi.getPropValue?.('imgHeight'))
|
|
130
|
-
if (currentHeight !== heightFromChild) {
|
|
131
|
-
propsApi.setPropValue('imgHeight', heightFromChild)
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const isDataListBoundExpression = (target: any): boolean => {
|
|
137
|
-
const dataListValue = target?.getProps?.()?.getPropValue?.('dataList')
|
|
138
|
-
return !!(
|
|
139
|
-
dataListValue &&
|
|
140
|
-
typeof dataListValue === 'object' &&
|
|
141
|
-
(dataListValue as any).type === 'JSExpression'
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* 模块级缓存:使用 node.id(稳定的字符串 ID)作为 key。
|
|
147
|
-
* 替代 WeakMap 方案:WeakMap 以 target.node 对象引用为 key,
|
|
148
|
-
* 但引擎可能通过 Proxy/getter 每次返回不同的包装对象,导致缓存命中失败。
|
|
149
|
-
* 使用 node.id 字符串做 key 彻底消除引用不一致问题。
|
|
150
|
-
*/
|
|
151
|
-
const _dataListCacheById: Record<string, any> = {}
|
|
152
|
-
|
|
153
|
-
const _cacheDataList = (target: any): void => {
|
|
154
|
-
const nodeId = target?.node?.id
|
|
155
|
-
if (!nodeId) return
|
|
156
|
-
const fromNode = target?.node?.getPropValue?.('dataList')
|
|
157
|
-
if (fromNode !== undefined) {
|
|
158
|
-
_dataListCacheById[nodeId] = fromNode
|
|
159
|
-
return
|
|
160
|
-
}
|
|
161
|
-
// schema 序列化快照:源头数据,不受 settings 中间态影响
|
|
162
|
-
const fromSchema = target?.node?.schema?.props?.dataList
|
|
163
|
-
if (fromSchema !== undefined) {
|
|
164
|
-
_dataListCacheById[nodeId] = fromSchema
|
|
165
|
-
return
|
|
166
|
-
}
|
|
167
|
-
const fromProps = target?.getProps?.()?.getPropValue?.('dataList')
|
|
168
|
-
if (fromProps !== undefined) {
|
|
169
|
-
_dataListCacheById[nodeId] = fromProps
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
70
|
const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
174
71
|
group: '低代码组件',
|
|
175
72
|
componentName: 'TeletextList',
|
|
@@ -294,27 +191,8 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
294
191
|
initialValue: 'left',
|
|
295
192
|
},
|
|
296
193
|
extraProps: {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
// 在任何 setPropValue 之前先写入模块级缓存,确保 dataList.initialValue
|
|
300
|
-
// 重评估时即使 engine 已清空 node prop 也能从缓存恢复正确值
|
|
301
|
-
_cacheDataList(target)
|
|
302
|
-
// 显式快照需要保护的配置,防止引擎某些实现在写入时触发重初始化导致配置丢失
|
|
303
|
-
const prevDataList = props.getPropValue('dataList')
|
|
304
|
-
const prevDataListBind = props.getPropValue('dataListBind')
|
|
305
|
-
const prevTextImgGap = props.getPropValue('textImgGap')
|
|
306
|
-
const prevImgWidth = props.getPropValue('imgWidth')
|
|
307
|
-
const prevImgHeight = props.getPropValue('imgHeight')
|
|
308
|
-
props.setPropValue('imagePlacement', value)
|
|
309
|
-
// 写回被保护的配置(幂等操作,若引擎未重置则无副作用)
|
|
310
|
-
if (prevDataList !== undefined) props.setPropValue('dataList', prevDataList)
|
|
311
|
-
if (prevDataListBind !== undefined) props.setPropValue('dataListBind', prevDataListBind)
|
|
312
|
-
if (prevTextImgGap !== undefined) props.setPropValue('textImgGap', prevTextImgGap)
|
|
313
|
-
if (prevImgWidth !== undefined) props.setPropValue('imgWidth', prevImgWidth)
|
|
314
|
-
if (prevImgHeight !== undefined) props.setPropValue('imgHeight', prevImgHeight)
|
|
315
|
-
// 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
|
|
316
|
-
syncImageDimensionPropsFromChild(target)
|
|
317
|
-
},
|
|
194
|
+
// 引擎已自动 setPropValue('imagePlacement', value),无需再做任何额外写入
|
|
195
|
+
// 之前的快照-还原逻辑反而触发多余的 MobX 响应链,导致 dataList 被覆盖
|
|
318
196
|
},
|
|
319
197
|
},
|
|
320
198
|
{
|
|
@@ -324,64 +202,22 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
324
202
|
setter: {
|
|
325
203
|
componentName: 'NumberSetter',
|
|
326
204
|
isRequired: false,
|
|
327
|
-
initialValue:
|
|
328
|
-
const styleWidth = getImageStyleNumber(target, 'width')
|
|
329
|
-
if (styleWidth !== undefined) {
|
|
330
|
-
return styleWidth
|
|
331
|
-
}
|
|
332
|
-
const propValue = target?.getProps()?.getPropValue?.('imgWidth')
|
|
333
|
-
const parsedPropValue = parsePxNumber(propValue)
|
|
334
|
-
if (parsedPropValue !== undefined) return parsedPropValue
|
|
335
|
-
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
336
|
-
if (isDataListBoundExpression(target)) {
|
|
337
|
-
return undefined
|
|
338
|
-
}
|
|
339
|
-
return 100
|
|
340
|
-
},
|
|
341
|
-
defaultValue: (target) => {
|
|
342
|
-
const styleWidth = getImageStyleNumber(target, 'width')
|
|
343
|
-
if (styleWidth !== undefined) {
|
|
344
|
-
return styleWidth
|
|
345
|
-
}
|
|
346
|
-
const propValue = target?.getProps()?.getPropValue?.('imgWidth')
|
|
347
|
-
const parsedPropValue = parsePxNumber(propValue)
|
|
348
|
-
if (parsedPropValue !== undefined) return parsedPropValue
|
|
349
|
-
if (isDataListBoundExpression(target)) {
|
|
350
|
-
return undefined
|
|
351
|
-
}
|
|
352
|
-
return 100
|
|
353
|
-
},
|
|
205
|
+
initialValue: 100,
|
|
354
206
|
},
|
|
355
207
|
extraProps: {
|
|
356
|
-
getValue: (target) => {
|
|
357
|
-
|
|
358
|
-
// (写操作会导致引擎重初始化 dataList 等 prop,画布图片回退到默认图)
|
|
208
|
+
getValue: (target, value) => {
|
|
209
|
+
if (value !== undefined) return parsePxNumber(value) ?? 100
|
|
359
210
|
const styleWidth = getImageStyleNumber(target, 'width')
|
|
360
|
-
if (styleWidth !== undefined)
|
|
361
|
-
return styleWidth
|
|
362
|
-
}
|
|
363
|
-
const propValue = target?.getProps()?.getPropValue?.('imgWidth')
|
|
364
|
-
const parsedPropValue = parsePxNumber(propValue)
|
|
365
|
-
if (parsedPropValue !== undefined) {
|
|
366
|
-
return parsedPropValue
|
|
367
|
-
}
|
|
211
|
+
if (styleWidth !== undefined) return styleWidth
|
|
368
212
|
return 100
|
|
369
213
|
},
|
|
370
214
|
setValue: (target, value) => {
|
|
215
|
+
// 引擎已自动 setPropValue('imgWidth', value)
|
|
216
|
+
// 只需同步到 Image 子节点的 style
|
|
371
217
|
const parsedValue = parsePxNumber(value)
|
|
372
|
-
if (parsedValue
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
const props = target.getProps()
|
|
376
|
-
_cacheDataList(target)
|
|
377
|
-
// 快照 dataList:在 setPropValue 前捕获,防止引擎重评估时被默认值覆盖
|
|
378
|
-
const prevDataList = props.getPropValue('dataList')
|
|
379
|
-
props.setPropValue('imgWidth', parsedValue)
|
|
380
|
-
// 还原 dataList(幂等操作,若引擎未覆盖则无副作用)
|
|
381
|
-
if (prevDataList !== undefined) {
|
|
382
|
-
props.setPropValue('dataList', prevDataList)
|
|
218
|
+
if (parsedValue !== undefined) {
|
|
219
|
+
syncImageStyleValue(target, 'width', parsedValue)
|
|
383
220
|
}
|
|
384
|
-
syncImageStyleValue(target, 'width', parsedValue)
|
|
385
221
|
},
|
|
386
222
|
},
|
|
387
223
|
},
|
|
@@ -392,63 +228,22 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
392
228
|
setter: {
|
|
393
229
|
componentName: 'NumberSetter',
|
|
394
230
|
isRequired: false,
|
|
395
|
-
initialValue:
|
|
396
|
-
const styleHeight = getImageStyleNumber(target, 'height')
|
|
397
|
-
if (styleHeight !== undefined) {
|
|
398
|
-
return styleHeight
|
|
399
|
-
}
|
|
400
|
-
const propValue = target?.getProps()?.getPropValue?.('imgHeight')
|
|
401
|
-
const parsedPropValue = parsePxNumber(propValue)
|
|
402
|
-
if (parsedPropValue !== undefined) return parsedPropValue
|
|
403
|
-
// 数据源已绑定时,避免回退为 100 触发误写回
|
|
404
|
-
if (isDataListBoundExpression(target)) {
|
|
405
|
-
return undefined
|
|
406
|
-
}
|
|
407
|
-
return 100
|
|
408
|
-
},
|
|
409
|
-
defaultValue: (target) => {
|
|
410
|
-
const styleHeight = getImageStyleNumber(target, 'height')
|
|
411
|
-
if (styleHeight !== undefined) {
|
|
412
|
-
return styleHeight
|
|
413
|
-
}
|
|
414
|
-
const propValue = target?.getProps()?.getPropValue?.('imgHeight')
|
|
415
|
-
const parsedPropValue = parsePxNumber(propValue)
|
|
416
|
-
if (parsedPropValue !== undefined) return parsedPropValue
|
|
417
|
-
if (isDataListBoundExpression(target)) {
|
|
418
|
-
return undefined
|
|
419
|
-
}
|
|
420
|
-
return 100
|
|
421
|
-
},
|
|
231
|
+
initialValue: 100,
|
|
422
232
|
},
|
|
423
233
|
extraProps: {
|
|
424
|
-
getValue: (target) => {
|
|
425
|
-
|
|
234
|
+
getValue: (target, value) => {
|
|
235
|
+
if (value !== undefined) return parsePxNumber(value) ?? 100
|
|
426
236
|
const styleHeight = getImageStyleNumber(target, 'height')
|
|
427
|
-
if (styleHeight !== undefined)
|
|
428
|
-
return styleHeight
|
|
429
|
-
}
|
|
430
|
-
const propValue = target?.getProps()?.getPropValue?.('imgHeight')
|
|
431
|
-
const parsedPropValue = parsePxNumber(propValue)
|
|
432
|
-
if (parsedPropValue !== undefined) {
|
|
433
|
-
return parsedPropValue
|
|
434
|
-
}
|
|
237
|
+
if (styleHeight !== undefined) return styleHeight
|
|
435
238
|
return 100
|
|
436
239
|
},
|
|
437
240
|
setValue: (target, value) => {
|
|
241
|
+
// 引擎已自动 setPropValue('imgHeight', value)
|
|
242
|
+
// 只需同步到 Image 子节点的 style
|
|
438
243
|
const parsedValue = parsePxNumber(value)
|
|
439
|
-
if (parsedValue
|
|
440
|
-
|
|
441
|
-
}
|
|
442
|
-
const props = target.getProps()
|
|
443
|
-
_cacheDataList(target)
|
|
444
|
-
// 快照 dataList:在 setPropValue 前捕获,防止引擎重评估时被默认值覆盖
|
|
445
|
-
const prevDataList = props.getPropValue('dataList')
|
|
446
|
-
props.setPropValue('imgHeight', parsedValue)
|
|
447
|
-
// 还原 dataList(幂等操作,若引擎未覆盖则无副作用)
|
|
448
|
-
if (prevDataList !== undefined) {
|
|
449
|
-
props.setPropValue('dataList', prevDataList)
|
|
244
|
+
if (parsedValue !== undefined) {
|
|
245
|
+
syncImageStyleValue(target, 'height', parsedValue)
|
|
450
246
|
}
|
|
451
|
-
syncImageStyleValue(target, 'height', parsedValue)
|
|
452
247
|
},
|
|
453
248
|
},
|
|
454
249
|
},
|
|
@@ -960,100 +755,33 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
960
755
|
},
|
|
961
756
|
},
|
|
962
757
|
initialValue: (target) => {
|
|
963
|
-
|
|
964
|
-
//
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
// 2. 模块级缓存(node.id 索引,不受 Proxy 引用问题影响)
|
|
971
|
-
if (nodeId && _dataListCacheById[nodeId] !== undefined) {
|
|
972
|
-
return _dataListCacheById[nodeId]
|
|
973
|
-
}
|
|
974
|
-
// 3. settings API
|
|
975
|
-
const current = target?.getProps?.()?.getPropValue?.('dataList')
|
|
976
|
-
if (current !== undefined) {
|
|
977
|
-
if (nodeId) _dataListCacheById[nodeId] = current
|
|
978
|
-
return current
|
|
979
|
-
}
|
|
980
|
-
// 4. schema 序列化快照(源头数据,不受 settings 中间态影响)
|
|
981
|
-
const fromSchema = target?.node?.schema?.props?.dataList
|
|
982
|
-
if (fromSchema !== undefined) {
|
|
983
|
-
if (nodeId) _dataListCacheById[nodeId] = fromSchema
|
|
984
|
-
return fromSchema
|
|
985
|
-
}
|
|
986
|
-
// 5. 默认数据(仅首次创建组件时触达)
|
|
987
|
-
return [
|
|
988
|
-
{
|
|
989
|
-
image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
|
|
990
|
-
title: '标题名称',
|
|
991
|
-
description:
|
|
992
|
-
'说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字',
|
|
993
|
-
},
|
|
994
|
-
{
|
|
995
|
-
image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
|
|
996
|
-
title: '标题名称',
|
|
997
|
-
description:
|
|
998
|
-
'说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字',
|
|
999
|
-
tags: [
|
|
1000
|
-
{
|
|
1001
|
-
name: '报名火热',
|
|
1002
|
-
color: 'orange',
|
|
1003
|
-
},
|
|
1004
|
-
{
|
|
1005
|
-
name: '人数众多',
|
|
1006
|
-
color: 'blue',
|
|
1007
|
-
},
|
|
1008
|
-
],
|
|
1009
|
-
},
|
|
1010
|
-
]
|
|
758
|
+
// ignoreDefaultValue: () => true 保证此函数在 SettingFieldView remount 时
|
|
759
|
+
// 永远不会被 initDefaultValue 调用,仅作为安全兜底保留。
|
|
760
|
+
// 正常的首次创建数据由 snippet.props.dataList 提供。
|
|
761
|
+
const existing = target?.node?.schema?.props?.dataList
|
|
762
|
+
?? target?.getProps?.()?.getPropValue?.('dataList')
|
|
763
|
+
if (existing !== undefined) return existing
|
|
764
|
+
return DEFAULT_DATA_LIST
|
|
1011
765
|
},
|
|
1012
766
|
},
|
|
1013
767
|
extraProps: {
|
|
1014
768
|
/**
|
|
1015
|
-
*
|
|
1016
|
-
*
|
|
1017
|
-
*
|
|
769
|
+
* ignoreDefaultValue: 彻底阻止引擎在 SettingFieldView remount 时
|
|
770
|
+
* 调用 initDefaultValue → 把 initialValue(默认数据数组)通过 field.setValue
|
|
771
|
+
* 写入 dataList prop,覆盖已绑定的 JSExpression。
|
|
772
|
+
*
|
|
773
|
+
* 这是根本性解决方案:在引擎层面阻断 initDefaultValue 的执行,
|
|
774
|
+
* 而不是试图在 initialValue/getValue/setValue 中做缓存和还原来补救。
|
|
1018
775
|
*/
|
|
776
|
+
ignoreDefaultValue: () => true,
|
|
1019
777
|
getValue: (target: any, currentValue: any) => {
|
|
1020
|
-
|
|
1021
|
-
if (currentValue !== undefined)
|
|
1022
|
-
|
|
1023
|
-
return currentValue
|
|
1024
|
-
}
|
|
1025
|
-
// 引擎 currentValue 为 undefined(重评估中间态),逐级回退:
|
|
1026
|
-
if (nodeId && _dataListCacheById[nodeId] !== undefined) {
|
|
1027
|
-
return _dataListCacheById[nodeId]
|
|
1028
|
-
}
|
|
1029
|
-
// node.schema 序列化快照:不受 settings 中间态影响,是最可靠的源头数据
|
|
778
|
+
// currentValue 已有值时直接返回
|
|
779
|
+
if (currentValue !== undefined) return currentValue
|
|
780
|
+
// 从 schema 快照兜底读取(最可靠的源头数据,始终反映持久化状态)
|
|
1030
781
|
const fromSchema = target?.node?.schema?.props?.dataList
|
|
1031
|
-
if (fromSchema !== undefined)
|
|
1032
|
-
if (nodeId) _dataListCacheById[nodeId] = fromSchema
|
|
1033
|
-
return fromSchema
|
|
1034
|
-
}
|
|
1035
|
-
const fromNode = target?.node?.getPropValue?.('dataList')
|
|
1036
|
-
if (fromNode !== undefined) {
|
|
1037
|
-
if (nodeId) _dataListCacheById[nodeId] = fromNode
|
|
1038
|
-
return fromNode
|
|
1039
|
-
}
|
|
782
|
+
if (fromSchema !== undefined) return fromSchema
|
|
1040
783
|
return undefined
|
|
1041
784
|
},
|
|
1042
|
-
/**
|
|
1043
|
-
* 用户编辑 dataList 时同步更新缓存并持久化到 schema。
|
|
1044
|
-
* 引擎 extraProps.setValue 完全接管写入,必须显式 setPropValue。
|
|
1045
|
-
*/
|
|
1046
|
-
setValue: (target: any, value: any) => {
|
|
1047
|
-
const nodeId = target?.node?.id
|
|
1048
|
-
if (!nodeId) return
|
|
1049
|
-
if (value !== undefined) {
|
|
1050
|
-
_dataListCacheById[nodeId] = value
|
|
1051
|
-
target.getProps?.()?.setPropValue?.('dataList', value)
|
|
1052
|
-
} else {
|
|
1053
|
-
delete _dataListCacheById[nodeId]
|
|
1054
|
-
target.getProps?.()?.setPropValue?.('dataList', undefined)
|
|
1055
|
-
}
|
|
1056
|
-
},
|
|
1057
785
|
},
|
|
1058
786
|
},
|
|
1059
787
|
],
|
|
@@ -1076,13 +804,34 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
1076
804
|
},
|
|
1077
805
|
}
|
|
1078
806
|
|
|
807
|
+
const DEFAULT_DATA_LIST = [
|
|
808
|
+
{
|
|
809
|
+
image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
|
|
810
|
+
title: '标题名称',
|
|
811
|
+
description:
|
|
812
|
+
'说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字',
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
image: 'https://img.alicdn.com/tps/TB16TQvOXXXXXbiaFXXXXXXXXXX-120-120.svg',
|
|
816
|
+
title: '标题名称',
|
|
817
|
+
description:
|
|
818
|
+
'说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字说明文字',
|
|
819
|
+
},
|
|
820
|
+
]
|
|
821
|
+
|
|
1079
822
|
const getSnippets = (textLines = 2): IPublicTypeSnippet[] => [
|
|
1080
823
|
{
|
|
1081
824
|
title: '图文列表',
|
|
1082
825
|
screenshot: '',
|
|
1083
826
|
schema: {
|
|
1084
827
|
componentName: 'TeletextList',
|
|
1085
|
-
props: {
|
|
828
|
+
props: {
|
|
829
|
+
// 将默认数据放到 snippet props 中,而非依赖 setter.initialValue。
|
|
830
|
+
// 因为 dataList 使用了 ignoreDefaultValue:()=>true 来阻止引擎在
|
|
831
|
+
// SettingFieldView remount 时覆盖已绑定的 JSExpression,
|
|
832
|
+
// 所以 initDefaultValue 永远不会运行,首次拖入的初始数据必须由 snippet 提供。
|
|
833
|
+
dataList: DEFAULT_DATA_LIST,
|
|
834
|
+
},
|
|
1086
835
|
children: [
|
|
1087
836
|
{
|
|
1088
837
|
componentName: 'NextText',
|
package/lowcode_es/meta.js
CHANGED
|
@@ -117,7 +117,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
117
117
|
packageName = '@dckj-npm/dc-material';
|
|
118
118
|
}
|
|
119
119
|
if (version === void 0) {
|
|
120
|
-
version = '0.1.
|
|
120
|
+
version = '0.1.374';
|
|
121
121
|
}
|
|
122
122
|
if (basicLibraryVersion === void 0) {
|
|
123
123
|
basicLibraryVersion = {
|